Update of /cvsroot/wxlua/wxLua/modules/lua/src
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv21762/wxLua/modules/lua/src
Modified Files:
lstate.c
Removed Files:
luathread.h
Log Message:
removed WXLUA_USE_NEWTHREAD_HANDLER and friends by replacing luaE_newthread, luaE_freethread
we now look up coroutine wxLuaStateData by using a light user data pushed into the lua registry table
the lua is now an unmodified copy of lua with no mods necessary
Index: lstate.c
===================================================================
RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lstate.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** lstate.c 12 Jun 2006 03:50:37 -0000 1.5
--- lstate.c 6 Dec 2006 06:58:23 -0000 1.6
***************
*** 116,166 ****
}
- #ifndef WXLUA_LUA_NEWTHREAD
- lua_State *luaE_newthread (lua_State *L) {
- lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State)));
- luaC_link(L, obj2gco(L1), LUA_TTHREAD);
- preinit_state(L1, G(L));
- stack_init(L1, L); /* init stack */
- setobj2n(L, gt(L1), gt(L)); /* share table of globals */
- L1->hookmask = L->hookmask;
- L1->basehookcount = L->basehookcount;
- L1->hook = L->hook;
- resethookcount(L1);
- lua_assert(iswhite(obj2gco(L1)));
- return L1;
- }
-
-
- void luaE_freethread (lua_State *L, lua_State *L1) {
- luaF_close(L1, L1->stack); /* close all upvalues for this thread */
- lua_assert(L1->openupval == NULL);
- luai_userstatefree(L1);
- freestack(L, L1);
- luaM_freemem(L, fromstate(L1), state_size(lua_State));
- }
- #else // WXLUA_LUA_NEWTHREAD is defined
- /* wxlua - track child threads see wxLuaState */
- //#include <luathread.h>
- typedef void (* wxlua_newthread_handler)(lua_State *L, lua_State *NL);
- typedef void (* wxlua_freethread_handler)(lua_State *L, lua_State *NL);
-
- static wxlua_newthread_handler pNewthread_handler = (wxlua_newthread_handler) NULL;
- static wxlua_freethread_handler pFreethread_handler = (wxlua_freethread_handler) NULL;
-
- LUA_API wxlua_newthread_handler wxLua_lua_getnewthreadhandler() {
- return pNewthread_handler;
- }
-
- LUA_API void wxLua_lua_setnewthreadhandler( wxlua_newthread_handler handler ) {
- pNewthread_handler = handler;
- }
-
- LUA_API wxlua_freethread_handler wxLua_lua_getfreethreadhandler() {
- return pFreethread_handler;
- }
-
- LUA_API void wxLua_lua_setfreethreadhandler( wxlua_freethread_handler handler ) {
- pFreethread_handler = handler;
- }
lua_State *luaE_newthread (lua_State *L) {
--- 116,119 ----
***************
*** 175,182 ****
resethookcount(L1);
lua_assert(iswhite(obj2gco(L1)));
-
- if (pNewthread_handler)
- (*pNewthread_handler)(L, L1); /* wxlua added newthread tracker */
-
return L1;
}
--- 128,131 ----
***************
*** 184,190 ****
void luaE_freethread (lua_State *L, lua_State *L1) {
- if (pFreethread_handler)
- (*pFreethread_handler)(L, L1); /* wxlua added freethread tracker */
-
luaF_close(L1, L1->stack); /* close all upvalues for this thread */
lua_assert(L1->openupval == NULL);
--- 133,136 ----
***************
*** 193,197 ****
luaM_freemem(L, fromstate(L1), state_size(lua_State));
}
- #endif // WXLUA_LUA_NEWTHREAD
--- 139,142 ----
--- luathread.h DELETED ---
|