diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools.h | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/src/tools.h b/src/tools.h index 9155747..df429f7 100644 --- a/src/tools.h +++ b/src/tools.h | |||
@@ -1,28 +1,15 @@ | |||
1 | /* | 1 | #ifndef __LANES_TOOLS_H__ |
2 | * TOOLS.H | 2 | #define __LANES_TOOLS_H__ |
3 | */ | ||
4 | #ifndef TOOLS_H | ||
5 | #define TOOLS_H | ||
6 | 3 | ||
7 | #include "lauxlib.h" | 4 | //#include "lauxlib.h" |
8 | #include "threading.h" | 5 | #include "threading.h" |
9 | #include "deep.h" | 6 | #include "deep.h" |
10 | // MUTEX_T | ||
11 | |||
12 | #include <assert.h> | ||
13 | 7 | ||
14 | #include "macros_and_utils.h" | 8 | #include "macros_and_utils.h" |
15 | 9 | ||
16 | // ################################################################################################ | 10 | // forwards |
17 | 11 | struct s_Universe; | |
18 | // this is pointed to by full userdata proxies, and allocated with malloc() to survive any lua_State lifetime | 12 | typedef struct s_Universe Universe; |
19 | struct DEEP_PRELUDE | ||
20 | { | ||
21 | volatile int refcount; | ||
22 | void* deep; | ||
23 | // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc | ||
24 | luaG_IdFunction idfunc; | ||
25 | }; | ||
26 | 13 | ||
27 | // ################################################################################################ | 14 | // ################################################################################################ |
28 | 15 | ||
@@ -33,8 +20,8 @@ struct DEEP_PRELUDE | |||
33 | 20 | ||
34 | void luaG_dump( lua_State* L ); | 21 | void luaG_dump( lua_State* L ); |
35 | 22 | ||
36 | lua_State* luaG_newstate( struct s_Universe* U, lua_State* _from, char const* libs); | 23 | lua_State* luaG_newstate( Universe* U, lua_State* _from, char const* libs); |
37 | void luaG_copy_one_time_settings( struct s_Universe* U, lua_State* L, lua_State* L2); | 24 | void luaG_copy_one_time_settings( Universe* U, lua_State* L, lua_State* L2); |
38 | 25 | ||
39 | // ################################################################################################ | 26 | // ################################################################################################ |
40 | 27 | ||
@@ -44,26 +31,24 @@ enum eLookupMode | |||
44 | eLM_ToKeeper, // send a function from a lane to a keeper state | 31 | eLM_ToKeeper, // send a function from a lane to a keeper state |
45 | eLM_FromKeeper // send a function from a keeper state to a lane | 32 | eLM_FromKeeper // send a function from a keeper state to a lane |
46 | }; | 33 | }; |
34 | typedef enum eLookupMode LookupMode; | ||
47 | 35 | ||
48 | char const* push_deep_proxy( struct s_Universe* U, lua_State* L, struct DEEP_PRELUDE* prelude, enum eLookupMode mode_); | 36 | int luaG_inter_copy_package( Universe* U, lua_State* L, lua_State* L2, int package_idx_, LookupMode mode_); |
49 | void free_deep_prelude( lua_State* L, struct DEEP_PRELUDE* prelude_); | ||
50 | |||
51 | int luaG_inter_copy_package( struct s_Universe* U, lua_State* L, lua_State* L2, int package_idx_, enum eLookupMode mode_); | ||
52 | 37 | ||
53 | int luaG_inter_copy( struct s_Universe* U, lua_State* L, lua_State* L2, uint_t n, enum eLookupMode mode_); | 38 | int luaG_inter_copy( Universe* U, lua_State* L, lua_State* L2, uint_t n, LookupMode mode_); |
54 | int luaG_inter_move( struct s_Universe* U, lua_State* L, lua_State* L2, uint_t n, enum eLookupMode mode_); | 39 | int luaG_inter_move( Universe* U, lua_State* L, lua_State* L2, uint_t n, LookupMode mode_); |
55 | 40 | ||
56 | int luaG_nameof( lua_State* L); | 41 | int luaG_nameof( lua_State* L); |
57 | int luaG_new_require( lua_State* L); | 42 | int luaG_new_require( lua_State* L); |
58 | 43 | ||
59 | void populate_func_lookup_table( lua_State* L, int _i, char const* _name); | 44 | void populate_func_lookup_table( lua_State* L, int _i, char const* _name); |
60 | void serialize_require( struct s_Universe* U, lua_State *L); | 45 | void serialize_require( Universe* U, lua_State *L); |
61 | void initialize_on_state_create( struct s_Universe* U, lua_State* L); | 46 | void initialize_on_state_create( Universe* U, lua_State* L); |
62 | void call_on_state_create( struct s_Universe* U, lua_State* L, lua_State* from_, enum eLookupMode mode_); | 47 | void call_on_state_create( Universe* U, lua_State* L, lua_State* from_, LookupMode mode_); |
63 | 48 | ||
64 | // ################################################################################################ | 49 | // ################################################################################################ |
65 | 50 | ||
66 | extern char const* const CONFIG_REGKEY; | 51 | extern char const* const CONFIG_REGKEY; |
67 | extern char const* const LOOKUP_REGKEY; | 52 | extern char const* const LOOKUP_REGKEY; |
68 | 53 | ||
69 | #endif // TOOLS_H | 54 | #endif // __LANES_TOOLS_H__ |