0
|
1 |
|
|
2 |
#ifndef LGLIB_TYPES_H |
|
3 |
#define LGLIB_TYPES_H |
|
4 |
|
|
5 |
#include <lua.h> |
|
6 |
#include <glib.h> |
|
7 |
|
|
8 |
#ifndef LGLIB_OBJREGISTRY |
|
9 |
#define LGLIB_OBJREGISTRY ( "lglib.obj_registry" ) |
|
10 |
#endif |
|
11 |
|
|
12 |
typedef struct { |
|
13 |
int reference; |
|
14 |
lua_State *L; |
|
15 |
} lglib_callback_t; |
|
16 |
|
|
17 |
void lglib_callback_destroy (lglib_callback_t *cb); |
|
18 |
|
|
19 |
|
|
20 |
#define LGLIB_DECLARE(WHAT, TYPE) \ |
|
21 |
typedef struct { \ |
|
22 |
TYPE *WHAT; \ |
|
23 |
} lglib_##WHAT##_t; \ |
|
24 |
\ |
|
25 |
lglib_##WHAT##_t *luaL_checklglib_##WHAT (lua_State *L, int index); \ |
|
26 |
lglib_##WHAT##_t *lglib_##WHAT##_bless (lua_State *L, TYPE *WHAT); |
|
27 |
|
|
28 |
LGLIB_DECLARE (main_context, GMainContext) |
|
29 |
LGLIB_DECLARE (source, GSource) |
|
30 |
|
|
31 |
#undef LGLIB_DECLARE |
|
32 |
|
|
33 |
#endif |
|
34 |
|