aboutsummaryrefslogtreecommitdiff
path: root/src/tools.h
diff options
context:
space:
mode:
authorBenoit Germain <bnt period germain arrobase gmail period com>2014-02-17 11:05:19 +0100
committerBenoit Germain <bnt period germain arrobase gmail period com>2014-02-17 11:05:19 +0100
commit47eb3f94373a13ac9f204ca65dfde602f53bdc1a (patch)
tree95d7d7a52ca92e6527d46d97207d3f079611a355 /src/tools.h
parent32ad991eb8c590472607d61e9a831d2ca9db05c5 (diff)
downloadlanes-47eb3f94373a13ac9f204ca65dfde602f53bdc1a.tar.gz
lanes-47eb3f94373a13ac9f204ca65dfde602f53bdc1a.tar.bz2
lanes-47eb3f94373a13ac9f204ca65dfde602f53bdc1a.zip
Deep userdata support improvements
* bumped version to 3.9.0 * keepers now require "package", receive package.path & package.cpath, and call on_state_create() if it is a C function * changed the deep public API (improved deep idfunc signature, renamed luaG_deep_userdata to luaG_newdeepuserdata) * if an error occurs while copying a deep userdata, don't raise inside the keeper state * fixed situations where raised errors could lead to memory leaks (deep gc)
Diffstat (limited to 'src/tools.h')
-rw-r--r--src/tools.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/tools.h b/src/tools.h
index be358db..ebe407b 100644
--- a/src/tools.h
+++ b/src/tools.h
@@ -99,11 +99,15 @@ extern int debugspew_indent_depth;
99void luaG_dump( lua_State* L ); 99void luaG_dump( lua_State* L );
100 100
101lua_State* luaG_newstate( lua_State* _from, char const* libs); 101lua_State* luaG_newstate( lua_State* _from, char const* libs);
102void luaG_copy_one_time_settings( lua_State* L, lua_State* L2, char const* name_); 102void luaG_copy_one_time_settings( lua_State* L, lua_State* L2);
103 103
104typedef struct { 104// this is pointed to by full userdata proxies, and allocated with malloc() to survive any lua_State lifetime
105 volatile int refcount; 105typedef struct
106 void *deep; 106{
107 volatile int refcount;
108 void* deep;
109 // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc
110 luaG_IdFunction idfunc;
107} DEEP_PRELUDE; 111} DEEP_PRELUDE;
108 112
109enum eLookupMode 113enum eLookupMode
@@ -113,7 +117,7 @@ enum eLookupMode
113 eLM_FromKeeper // send a function from a keeper state to a lane 117 eLM_FromKeeper // send a function from a keeper state to a lane
114}; 118};
115 119
116void luaG_push_proxy( lua_State *L, luaG_IdFunction idfunc, DEEP_PRELUDE *deep_userdata); 120char const* push_deep_proxy( lua_State* L, DEEP_PRELUDE* prelude, enum eLookupMode mode_);
117void luaG_inter_copy_package( lua_State* L, lua_State* L2, int _idx, enum eLookupMode mode_); 121void luaG_inter_copy_package( lua_State* L, lua_State* L2, int _idx, enum eLookupMode mode_);
118 122
119int luaG_inter_copy( lua_State *L, lua_State *L2, uint_t n, enum eLookupMode mode_); 123int luaG_inter_copy( lua_State *L, lua_State *L2, uint_t n, enum eLookupMode mode_);
@@ -130,6 +134,8 @@ extern MUTEX_T mtid_lock;
130void populate_func_lookup_table( lua_State* L, int _i, char const* _name); 134void populate_func_lookup_table( lua_State* L, int _i, char const* _name);
131void serialize_require( lua_State *L); 135void serialize_require( lua_State *L);
132int initialize_on_state_create( lua_State *L); 136int initialize_on_state_create( lua_State *L);
137void call_on_state_create( lua_State* L, lua_State* from_, enum eLookupMode mode_);
138
133extern MUTEX_T require_cs; 139extern MUTEX_T require_cs;
134 140
135// for verbose errors 141// for verbose errors