diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-14 12:14:21 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-14 12:14:21 -0300 |
| commit | afdb19ac82bcb7ceabd010a484505105977352ba (patch) | |
| tree | 9771781da1f3bd8021f181f707891b7287140b69 /lstate.c | |
| parent | 7dfa4cd655118faf164427356609fec31906dac2 (diff) | |
| download | lua-afdb19ac82bcb7ceabd010a484505105977352ba.tar.gz lua-afdb19ac82bcb7ceabd010a484505105977352ba.tar.bz2 lua-afdb19ac82bcb7ceabd010a484505105977352ba.zip | |
no more 'ccall' nor 'cpcall' functions. (With light C functions they
are obsolete.)
Diffstat (limited to 'lstate.c')
| -rw-r--r-- | lstate.c | 20 |
1 files changed, 1 insertions, 19 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.c,v 2.78 2010/04/08 17:16:46 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.79 2010/04/12 16:07:06 roberto Exp roberto $ |
| 3 | ** Global State | 3 | ** Global State |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -114,22 +114,9 @@ static void freestack (lua_State *L) { | |||
| 114 | 114 | ||
| 115 | 115 | ||
| 116 | /* | 116 | /* |
| 117 | ** Calls the function in variable pointed to by userdata in first argument | ||
| 118 | ** (Userdata cannot point directly to the function because pointer to | ||
| 119 | ** function is not compatible with void*.) | ||
| 120 | */ | ||
| 121 | static int ccall (lua_State *L) { | ||
| 122 | lua_CFunction f = *(lua_CFunction *)lua_touserdata(L, 1); | ||
| 123 | lua_remove(L, 1); /* remove f from stack */ | ||
| 124 | return f(L); | ||
| 125 | } | ||
| 126 | |||
| 127 | |||
| 128 | /* | ||
| 129 | ** Create registry table and its predefined values | 117 | ** Create registry table and its predefined values |
| 130 | */ | 118 | */ |
| 131 | static void init_registry (lua_State *L, global_State *g) { | 119 | static void init_registry (lua_State *L, global_State *g) { |
| 132 | Closure *cp; | ||
| 133 | TValue mt; | 120 | TValue mt; |
| 134 | /* create registry */ | 121 | /* create registry */ |
| 135 | Table *registry = luaH_new(L); | 122 | Table *registry = luaH_new(L); |
| @@ -138,11 +125,6 @@ static void init_registry (lua_State *L, global_State *g) { | |||
| 138 | /* registry[LUA_RIDX_MAINTHREAD] = L */ | 125 | /* registry[LUA_RIDX_MAINTHREAD] = L */ |
| 139 | setthvalue(L, &mt, L); | 126 | setthvalue(L, &mt, L); |
| 140 | setobj2t(L, luaH_setint(L, registry, LUA_RIDX_MAINTHREAD), &mt); | 127 | setobj2t(L, luaH_setint(L, registry, LUA_RIDX_MAINTHREAD), &mt); |
| 141 | /* registry[LUA_RIDX_CCALL] = ccall */ | ||
| 142 | cp = luaF_newCclosure(L, 0); | ||
| 143 | cp->c.f = ccall; | ||
| 144 | setclvalue(L, &mt, cp); | ||
| 145 | setobj2t(L, luaH_setint(L, registry, LUA_RIDX_CCALL), &mt); | ||
| 146 | /* registry[LUA_RIDX_GLOBALS] = table of globals */ | 128 | /* registry[LUA_RIDX_GLOBALS] = table of globals */ |
| 147 | sethvalue(L, &mt, luaH_new(L)); | 129 | sethvalue(L, &mt, luaH_new(L)); |
| 148 | setobj2t(L, luaH_setint(L, registry, LUA_RIDX_GLOBALS), &mt); | 130 | setobj2t(L, luaH_setint(L, registry, LUA_RIDX_GLOBALS), &mt); |
