diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-01-26 12:04:32 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-01-26 12:04:32 -0200 |
commit | 8dae4657a120a0f01fa599014a55b5d56e846998 (patch) | |
tree | 255c982834fe371db9586cf78c671b970f488063 /table.c | |
parent | ca7be1cfeb7864df4fa7d58c9314894b14942871 (diff) | |
download | lua-8dae4657a120a0f01fa599014a55b5d56e846998.tar.gz lua-8dae4657a120a0f01fa599014a55b5d56e846998.tar.bz2 lua-8dae4657a120a0f01fa599014a55b5d56e846998.zip |
"setglobal" and "getglobal" moved to inout.c, as it concentrates pre-defined
library.
Diffstat (limited to 'table.c')
-rw-r--r-- | table.c | 28 |
1 files changed, 3 insertions, 25 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** Module to control static tables | 3 | ** Module to control static tables |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_table="$Id: table.c,v 2.41 1996/01/22 17:40:00 roberto Exp roberto $"; | 6 | char *rcs_table="$Id: table.c,v 2.42 1996/01/23 18:39:45 roberto Exp roberto $"; |
7 | 7 | ||
8 | /*#include <string.h>*/ | 8 | /*#include <string.h>*/ |
9 | 9 | ||
@@ -33,8 +33,6 @@ static Long lua_maxconstant = 0; | |||
33 | #define MIN_GARBAGE_BLOCK (GARBAGE_BLOCK/2) | 33 | #define MIN_GARBAGE_BLOCK (GARBAGE_BLOCK/2) |
34 | 34 | ||
35 | static void lua_nextvar (void); | 35 | static void lua_nextvar (void); |
36 | static void setglobal (void); | ||
37 | static void getglobal (void); | ||
38 | 36 | ||
39 | /* | 37 | /* |
40 | ** Initialise symbol table with internal functions | 38 | ** Initialise symbol table with internal functions |
@@ -57,9 +55,9 @@ static void lua_initsymbol (void) | |||
57 | n = luaI_findsymbolbyname("dofile"); | 55 | n = luaI_findsymbolbyname("dofile"); |
58 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = lua_internaldofile; | 56 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = lua_internaldofile; |
59 | n = luaI_findsymbolbyname("setglobal"); | 57 | n = luaI_findsymbolbyname("setglobal"); |
60 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = setglobal; | 58 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = luaI_setglobal; |
61 | n = luaI_findsymbolbyname("getglobal"); | 59 | n = luaI_findsymbolbyname("getglobal"); |
62 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = getglobal; | 60 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = luaI_getglobal; |
63 | n = luaI_findsymbolbyname("type"); | 61 | n = luaI_findsymbolbyname("type"); |
64 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = luaI_type; | 62 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = luaI_type; |
65 | n = luaI_findsymbolbyname("tostring"); | 63 | n = luaI_findsymbolbyname("tostring"); |
@@ -246,26 +244,6 @@ static void lua_nextvar (void) | |||
246 | } | 244 | } |
247 | 245 | ||
248 | 246 | ||
249 | static void setglobal (void) | ||
250 | { | ||
251 | lua_Object name = lua_getparam(1); | ||
252 | lua_Object value = lua_getparam(2); | ||
253 | if (!lua_isstring(name)) | ||
254 | lua_error("incorrect argument to function `setglobal'"); | ||
255 | lua_pushobject(value); | ||
256 | lua_storeglobal(lua_getstring(name)); | ||
257 | } | ||
258 | |||
259 | |||
260 | static void getglobal (void) | ||
261 | { | ||
262 | lua_Object name = lua_getparam(1); | ||
263 | if (!lua_isstring(name)) | ||
264 | lua_error("incorrect argument to function `getglobal'"); | ||
265 | lua_pushobject(lua_getglobal(lua_getstring(name))); | ||
266 | } | ||
267 | |||
268 | |||
269 | static Object *functofind; | 247 | static Object *functofind; |
270 | static int checkfunc (Object *o) | 248 | static int checkfunc (Object *o) |
271 | { | 249 | { |