glib_types.h
changeset 0 84fdfb0344c9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/glib_types.h	Sun Feb 01 21:28:57 2009 +0200
@@ -0,0 +1,34 @@
+
+#ifndef LGLIB_TYPES_H
+#define LGLIB_TYPES_H
+
+#include <lua.h>
+#include <glib.h>
+
+#ifndef LGLIB_OBJREGISTRY
+#define LGLIB_OBJREGISTRY ( "lglib.obj_registry" )
+#endif
+
+typedef struct {
+	int reference;
+	lua_State *L;
+} lglib_callback_t;
+
+void lglib_callback_destroy (lglib_callback_t *cb);
+
+
+#define LGLIB_DECLARE(WHAT, TYPE)                         \
+typedef struct {                                            \
+	TYPE *WHAT;                                           \
+} lglib_##WHAT##_t;                                             \
+                                                                  \
+lglib_##WHAT##_t *luaL_checklglib_##WHAT (lua_State *L, int index); \
+lglib_##WHAT##_t *lglib_##WHAT##_bless (lua_State *L, TYPE *WHAT);
+
+LGLIB_DECLARE (main_context, GMainContext)
+LGLIB_DECLARE (source, GSource)
+
+#undef LGLIB_DECLARE
+
+#endif
+