aboutsummaryrefslogtreecommitdiff
path: root/table.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-02-26 14:38:41 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-02-26 14:38:41 -0300
commit131d66efd2dc26b05bcb2bdaf67f5175f3eda1aa (patch)
treee912e35e04883c24e89917ee3d94b8fa574f6294 /table.c
parentbbf1b3060a1aa4e5ec3235a560d3d054457e957d (diff)
downloadlua-131d66efd2dc26b05bcb2bdaf67f5175f3eda1aa.tar.gz
lua-131d66efd2dc26b05bcb2bdaf67f5175f3eda1aa.tar.bz2
lua-131d66efd2dc26b05bcb2bdaf67f5175f3eda1aa.zip
first step in implementing internal methods.
Diffstat (limited to 'table.c')
-rw-r--r--table.c41
1 files changed, 3 insertions, 38 deletions
diff --git a/table.c b/table.c
index 8af20ccc..5fc85f3d 100644
--- a/table.c
+++ b/table.c
@@ -3,7 +3,7 @@
3** Module to control static tables 3** Module to control static tables
4*/ 4*/
5 5
6char *rcs_table="$Id: table.c,v 2.57 1996/07/12 20:00:26 roberto Exp roberto $"; 6char *rcs_table="$Id: table.c,v 2.58 1996/11/01 12:47:45 roberto Exp roberto $";
7 7
8#include "mem.h" 8#include "mem.h"
9#include "opcode.h" 9#include "opcode.h"
@@ -29,47 +29,12 @@ static Long lua_maxconstant = 0;
29 29
30#define GARBAGE_BLOCK 50 30#define GARBAGE_BLOCK 50
31 31
32static void lua_nextvar (void);
33
34/*
35** Internal functions
36*/
37static struct {
38 char *name;
39 lua_CFunction func;
40} int_funcs[] = {
41 {"assert", luaI_assert},
42 {"call", luaI_call},
43 {"dofile", lua_internaldofile},
44 {"dostring", lua_internaldostring},
45 {"error", luaI_error},
46 {"getglobal", luaI_getglobal},
47 {"next", lua_next},
48 {"nextvar", lua_nextvar},
49 {"print", luaI_print},
50 {"setfallback", luaI_setfallback},
51 {"setglobal", luaI_setglobal},
52 {"tonumber", lua_obj2number},
53 {"tostring", luaI_tostring},
54 {"type", luaI_type}
55};
56
57#define INTFUNCSIZE (sizeof(int_funcs)/sizeof(int_funcs[0]))
58
59 32
60void luaI_initsymbol (void) 33void luaI_initsymbol (void)
61{ 34{
62 int i;
63 Word n;
64 lua_maxsymbol = BUFFER_BLOCK; 35 lua_maxsymbol = BUFFER_BLOCK;
65 lua_table = newvector(lua_maxsymbol, Symbol); 36 lua_table = newvector(lua_maxsymbol, Symbol);
66 for (i=0; i<INTFUNCSIZE; i++) 37 luaI_predefine();
67 {
68 n = luaI_findsymbolbyname(int_funcs[i].name);
69 s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = int_funcs[i].func;
70 }
71 n = luaI_findsymbolbyname("_VERSION_");
72 s_tag(n) = LUA_T_STRING; s_tsvalue(n) = lua_createstring(LUA_VERSION);
73} 38}
74 39
75 40
@@ -225,7 +190,7 @@ void lua_pack (void)
225/* 190/*
226** Internal function: return next global variable 191** Internal function: return next global variable
227*/ 192*/
228static void lua_nextvar (void) 193void luaI_nextvar (void)
229{ 194{
230 Word next; 195 Word next;
231 lua_Object o = lua_getparam(1); 196 lua_Object o = lua_getparam(1);