diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-07-29 17:38:45 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-07-29 17:38:45 -0300 |
commit | 2c580a0afb8dbaf7070a9819b7e81ebde5737ff9 (patch) | |
tree | 6fd261bb3bd89e2b851cd1adaa290c17a6dcad67 /func.c | |
parent | 05e8b0ae80bbeaf41ea849e9eff5d05074093560 (diff) | |
download | lua-2c580a0afb8dbaf7070a9819b7e81ebde5737ff9.tar.gz lua-2c580a0afb8dbaf7070a9819b7e81ebde5737ff9.tar.bz2 lua-2c580a0afb8dbaf7070a9819b7e81ebde5737ff9.zip |
new way to handle global state during compilation.
Diffstat (limited to 'func.c')
-rw-r--r-- | func.c | 35 |
1 files changed, 0 insertions, 35 deletions
@@ -9,9 +9,6 @@ | |||
9 | 9 | ||
10 | 10 | ||
11 | static TFunc *function_root = NULL; | 11 | static TFunc *function_root = NULL; |
12 | static LocVar *currvars = NULL; | ||
13 | static int numcurrvars = 0; | ||
14 | static int maxcurrvars = 0; | ||
15 | 12 | ||
16 | 13 | ||
17 | /* | 14 | /* |
@@ -105,38 +102,6 @@ void lua_funcinfo (lua_Object func, char **filename, int *linedefined) | |||
105 | } | 102 | } |
106 | } | 103 | } |
107 | 104 | ||
108 | /* | ||
109 | ** Stores information to know that variable has been declared in given line | ||
110 | */ | ||
111 | void luaI_registerlocalvar (TaggedString *varname, int line) | ||
112 | { | ||
113 | if (numcurrvars >= maxcurrvars) | ||
114 | maxcurrvars = growvector(&currvars, maxcurrvars, LocVar, "", MAX_WORD); | ||
115 | currvars[numcurrvars].varname = varname; | ||
116 | currvars[numcurrvars].line = line; | ||
117 | numcurrvars++; | ||
118 | } | ||
119 | |||
120 | /* | ||
121 | ** Stores information to know that variable has been out of scope in given line | ||
122 | */ | ||
123 | void luaI_unregisterlocalvar (int line) | ||
124 | { | ||
125 | luaI_registerlocalvar(NULL, line); | ||
126 | } | ||
127 | |||
128 | /* | ||
129 | ** Copies "currvars" into a new area and store it in function header. | ||
130 | ** The values (varname = NULL, line = -1) signal the end of vector. | ||
131 | */ | ||
132 | void luaI_closelocalvars (TFunc *func) | ||
133 | { | ||
134 | func->locvars = newvector (numcurrvars+1, LocVar); | ||
135 | memcpy (func->locvars, currvars, numcurrvars*sizeof(LocVar)); | ||
136 | func->locvars[numcurrvars].varname = NULL; | ||
137 | func->locvars[numcurrvars].line = -1; | ||
138 | numcurrvars = 0; /* prepares for next function */ | ||
139 | } | ||
140 | 105 | ||
141 | /* | 106 | /* |
142 | ** Look for n-esim local variable at line "line" in function "func". | 107 | ** Look for n-esim local variable at line "line" in function "func". |