diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-26 09:45:51 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-26 09:45:51 -0200 |
commit | bce6572579a7e6c7a96895d9280396b3b33b8f3f (patch) | |
tree | a937d0366ae9d9e37e6320b347ec463f337ceb1b | |
parent | a53d9b66ca6247818acaf41e28cdf123082a272b (diff) | |
download | lua-bce6572579a7e6c7a96895d9280396b3b33b8f3f.tar.gz lua-bce6572579a7e6c7a96895d9280396b3b33b8f3f.tar.bz2 lua-bce6572579a7e6c7a96895d9280396b3b33b8f3f.zip |
new macros + new names to facilitate compilation of threaded version
-rw-r--r-- | lapi.c | 208 | ||||
-rw-r--r-- | ldebug.c | 26 | ||||
-rw-r--r-- | ldo.c | 18 | ||||
-rw-r--r-- | liolib.c | 14 | ||||
-rw-r--r-- | lstate.c | 14 | ||||
-rw-r--r-- | lstate.h | 14 | ||||
-rw-r--r-- | ltm.c | 14 | ||||
-rw-r--r-- | lua.c | 36 | ||||
-rw-r--r-- | lua.h | 22 |
9 files changed, 190 insertions, 176 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.119 2001/01/24 15:45:33 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.120 2001/01/25 16:45:36 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -55,9 +55,9 @@ void luaA_pushobject (lua_State *L, const TObject *o) { | |||
55 | 55 | ||
56 | LUA_API int lua_stackspace (lua_State *L) { | 56 | LUA_API int lua_stackspace (lua_State *L) { |
57 | int i; | 57 | int i; |
58 | LUA_ENTRY; | 58 | LUA_LOCK; |
59 | i = (L->stack_last - L->top); | 59 | i = (L->stack_last - L->top); |
60 | LUA_EXIT; | 60 | LUA_UNLOCK; |
61 | return i; | 61 | return i; |
62 | } | 62 | } |
63 | 63 | ||
@@ -70,49 +70,49 @@ LUA_API int lua_stackspace (lua_State *L) { | |||
70 | 70 | ||
71 | LUA_API int lua_gettop (lua_State *L) { | 71 | LUA_API int lua_gettop (lua_State *L) { |
72 | int i; | 72 | int i; |
73 | LUA_ENTRY; | 73 | LUA_LOCK; |
74 | i = (L->top - L->Cbase); | 74 | i = (L->top - L->Cbase); |
75 | LUA_EXIT; | 75 | LUA_UNLOCK; |
76 | return i; | 76 | return i; |
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | LUA_API void lua_settop (lua_State *L, int index) { | 80 | LUA_API void lua_settop (lua_State *L, int index) { |
81 | LUA_ENTRY; | 81 | LUA_LOCK; |
82 | if (index >= 0) | 82 | if (index >= 0) |
83 | luaD_adjusttop(L, L->Cbase, index); | 83 | luaD_adjusttop(L, L->Cbase, index); |
84 | else | 84 | else |
85 | L->top = L->top+index+1; /* index is negative */ | 85 | L->top = L->top+index+1; /* index is negative */ |
86 | LUA_EXIT; | 86 | LUA_UNLOCK; |
87 | } | 87 | } |
88 | 88 | ||
89 | 89 | ||
90 | LUA_API void lua_remove (lua_State *L, int index) { | 90 | LUA_API void lua_remove (lua_State *L, int index) { |
91 | StkId p; | 91 | StkId p; |
92 | LUA_ENTRY; | 92 | LUA_LOCK; |
93 | p = luaA_index(L, index); | 93 | p = luaA_index(L, index); |
94 | while (++p < L->top) setobj(p-1, p); | 94 | while (++p < L->top) setobj(p-1, p); |
95 | L->top--; | 95 | L->top--; |
96 | LUA_EXIT; | 96 | LUA_UNLOCK; |
97 | } | 97 | } |
98 | 98 | ||
99 | 99 | ||
100 | LUA_API void lua_insert (lua_State *L, int index) { | 100 | LUA_API void lua_insert (lua_State *L, int index) { |
101 | StkId p; | 101 | StkId p; |
102 | StkId q; | 102 | StkId q; |
103 | LUA_ENTRY; | 103 | LUA_LOCK; |
104 | p = luaA_index(L, index); | 104 | p = luaA_index(L, index); |
105 | for (q = L->top; q>p; q--) setobj(q, q-1); | 105 | for (q = L->top; q>p; q--) setobj(q, q-1); |
106 | setobj(p, L->top); | 106 | setobj(p, L->top); |
107 | LUA_EXIT; | 107 | LUA_UNLOCK; |
108 | } | 108 | } |
109 | 109 | ||
110 | 110 | ||
111 | LUA_API void lua_pushvalue (lua_State *L, int index) { | 111 | LUA_API void lua_pushvalue (lua_State *L, int index) { |
112 | LUA_ENTRY; | 112 | LUA_LOCK; |
113 | setobj(L->top, luaA_index(L, index)); | 113 | setobj(L->top, luaA_index(L, index)); |
114 | api_incr_top(L); | 114 | api_incr_top(L); |
115 | LUA_EXIT; | 115 | LUA_UNLOCK; |
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
@@ -125,19 +125,19 @@ LUA_API void lua_pushvalue (lua_State *L, int index) { | |||
125 | LUA_API int lua_type (lua_State *L, int index) { | 125 | LUA_API int lua_type (lua_State *L, int index) { |
126 | StkId o; | 126 | StkId o; |
127 | int i; | 127 | int i; |
128 | LUA_ENTRY; | 128 | LUA_LOCK; |
129 | o = luaA_indexAcceptable(L, index); | 129 | o = luaA_indexAcceptable(L, index); |
130 | i = (o == NULL) ? LUA_TNONE : ttype(o); | 130 | i = (o == NULL) ? LUA_TNONE : ttype(o); |
131 | LUA_EXIT; | 131 | LUA_UNLOCK; |
132 | return i; | 132 | return i; |
133 | } | 133 | } |
134 | 134 | ||
135 | 135 | ||
136 | LUA_API const char *lua_typename (lua_State *L, int t) { | 136 | LUA_API const char *lua_typename (lua_State *L, int t) { |
137 | const char *s; | 137 | const char *s; |
138 | LUA_ENTRY; | 138 | LUA_LOCK; |
139 | s = (t == LUA_TNONE) ? "no value" : basictypename(G(L), t); | 139 | s = (t == LUA_TNONE) ? "no value" : basictypename(G(L), t); |
140 | LUA_EXIT; | 140 | LUA_UNLOCK; |
141 | return s; | 141 | return s; |
142 | } | 142 | } |
143 | 143 | ||
@@ -145,10 +145,10 @@ LUA_API const char *lua_typename (lua_State *L, int t) { | |||
145 | LUA_API const char *lua_xtype (lua_State *L, int index) { | 145 | LUA_API const char *lua_xtype (lua_State *L, int index) { |
146 | StkId o; | 146 | StkId o; |
147 | const char *type; | 147 | const char *type; |
148 | LUA_ENTRY; | 148 | LUA_LOCK; |
149 | o = luaA_indexAcceptable(L, index); | 149 | o = luaA_indexAcceptable(L, index); |
150 | type = (o == NULL) ? "no value" : luaT_typename(G(L), o); | 150 | type = (o == NULL) ? "no value" : luaT_typename(G(L), o); |
151 | LUA_EXIT; | 151 | LUA_UNLOCK; |
152 | return type; | 152 | return type; |
153 | } | 153 | } |
154 | 154 | ||
@@ -156,20 +156,20 @@ LUA_API const char *lua_xtype (lua_State *L, int index) { | |||
156 | LUA_API int lua_iscfunction (lua_State *L, int index) { | 156 | LUA_API int lua_iscfunction (lua_State *L, int index) { |
157 | StkId o; | 157 | StkId o; |
158 | int i; | 158 | int i; |
159 | LUA_ENTRY; | 159 | LUA_LOCK; |
160 | o = luaA_indexAcceptable(L, index); | 160 | o = luaA_indexAcceptable(L, index); |
161 | i = (o == NULL) ? 0 : iscfunction(o); | 161 | i = (o == NULL) ? 0 : iscfunction(o); |
162 | LUA_EXIT; | 162 | LUA_UNLOCK; |
163 | return i; | 163 | return i; |
164 | } | 164 | } |
165 | 165 | ||
166 | LUA_API int lua_isnumber (lua_State *L, int index) { | 166 | LUA_API int lua_isnumber (lua_State *L, int index) { |
167 | TObject *o; | 167 | TObject *o; |
168 | int i; | 168 | int i; |
169 | LUA_ENTRY; | 169 | LUA_LOCK; |
170 | o = luaA_indexAcceptable(L, index); | 170 | o = luaA_indexAcceptable(L, index); |
171 | i = (o == NULL) ? 0 : (tonumber(o) == 0); | 171 | i = (o == NULL) ? 0 : (tonumber(o) == 0); |
172 | LUA_EXIT; | 172 | LUA_UNLOCK; |
173 | return i; | 173 | return i; |
174 | } | 174 | } |
175 | 175 | ||
@@ -182,34 +182,34 @@ LUA_API int lua_isstring (lua_State *L, int index) { | |||
182 | LUA_API int lua_tag (lua_State *L, int index) { | 182 | LUA_API int lua_tag (lua_State *L, int index) { |
183 | StkId o; | 183 | StkId o; |
184 | int i; | 184 | int i; |
185 | LUA_ENTRY; | 185 | LUA_LOCK; |
186 | o = luaA_indexAcceptable(L, index); | 186 | o = luaA_indexAcceptable(L, index); |
187 | i = (o == NULL) ? LUA_NOTAG : luaT_tag(o); | 187 | i = (o == NULL) ? LUA_NOTAG : luaT_tag(o); |
188 | LUA_EXIT; | 188 | LUA_UNLOCK; |
189 | return i; | 189 | return i; |
190 | } | 190 | } |
191 | 191 | ||
192 | LUA_API int lua_equal (lua_State *L, int index1, int index2) { | 192 | LUA_API int lua_equal (lua_State *L, int index1, int index2) { |
193 | StkId o1, o2; | 193 | StkId o1, o2; |
194 | int i; | 194 | int i; |
195 | LUA_ENTRY; | 195 | LUA_LOCK; |
196 | o1 = luaA_indexAcceptable(L, index1); | 196 | o1 = luaA_indexAcceptable(L, index1); |
197 | o2 = luaA_indexAcceptable(L, index2); | 197 | o2 = luaA_indexAcceptable(L, index2); |
198 | i = (o1 == NULL || o2 == NULL) ? 0 /* index out-of-range */ | 198 | i = (o1 == NULL || o2 == NULL) ? 0 /* index out-of-range */ |
199 | : luaO_equalObj(o1, o2); | 199 | : luaO_equalObj(o1, o2); |
200 | LUA_EXIT; | 200 | LUA_UNLOCK; |
201 | return i; | 201 | return i; |
202 | } | 202 | } |
203 | 203 | ||
204 | LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { | 204 | LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { |
205 | StkId o1, o2; | 205 | StkId o1, o2; |
206 | int i; | 206 | int i; |
207 | LUA_ENTRY; | 207 | LUA_LOCK; |
208 | o1 = luaA_indexAcceptable(L, index1); | 208 | o1 = luaA_indexAcceptable(L, index1); |
209 | o2 = luaA_indexAcceptable(L, index2); | 209 | o2 = luaA_indexAcceptable(L, index2); |
210 | i = (o1 == NULL || o2 == NULL) ? 0 /* index out-of-range */ | 210 | i = (o1 == NULL || o2 == NULL) ? 0 /* index out-of-range */ |
211 | : luaV_lessthan(L, o1, o2, L->top); | 211 | : luaV_lessthan(L, o1, o2, L->top); |
212 | LUA_EXIT; | 212 | LUA_UNLOCK; |
213 | return i; | 213 | return i; |
214 | } | 214 | } |
215 | 215 | ||
@@ -218,58 +218,58 @@ LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { | |||
218 | LUA_API lua_Number lua_tonumber (lua_State *L, int index) { | 218 | LUA_API lua_Number lua_tonumber (lua_State *L, int index) { |
219 | StkId o; | 219 | StkId o; |
220 | lua_Number n; | 220 | lua_Number n; |
221 | LUA_ENTRY; | 221 | LUA_LOCK; |
222 | o = luaA_indexAcceptable(L, index); | 222 | o = luaA_indexAcceptable(L, index); |
223 | n = (o == NULL || tonumber(o)) ? 0 : nvalue(o); | 223 | n = (o == NULL || tonumber(o)) ? 0 : nvalue(o); |
224 | LUA_EXIT; | 224 | LUA_UNLOCK; |
225 | return n; | 225 | return n; |
226 | } | 226 | } |
227 | 227 | ||
228 | LUA_API const char *lua_tostring (lua_State *L, int index) { | 228 | LUA_API const char *lua_tostring (lua_State *L, int index) { |
229 | StkId o; | 229 | StkId o; |
230 | const char *s; | 230 | const char *s; |
231 | LUA_ENTRY; | 231 | LUA_LOCK; |
232 | o = luaA_indexAcceptable(L, index); | 232 | o = luaA_indexAcceptable(L, index); |
233 | s = (o == NULL || tostring(L, o)) ? NULL : svalue(o); | 233 | s = (o == NULL || tostring(L, o)) ? NULL : svalue(o); |
234 | LUA_EXIT; | 234 | LUA_UNLOCK; |
235 | return s; | 235 | return s; |
236 | } | 236 | } |
237 | 237 | ||
238 | LUA_API size_t lua_strlen (lua_State *L, int index) { | 238 | LUA_API size_t lua_strlen (lua_State *L, int index) { |
239 | StkId o; | 239 | StkId o; |
240 | size_t l; | 240 | size_t l; |
241 | LUA_ENTRY; | 241 | LUA_LOCK; |
242 | o = luaA_indexAcceptable(L, index); | 242 | o = luaA_indexAcceptable(L, index); |
243 | l = (o == NULL || tostring(L, o)) ? 0 : tsvalue(o)->len; | 243 | l = (o == NULL || tostring(L, o)) ? 0 : tsvalue(o)->len; |
244 | LUA_EXIT; | 244 | LUA_UNLOCK; |
245 | return l; | 245 | return l; |
246 | } | 246 | } |
247 | 247 | ||
248 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index) { | 248 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index) { |
249 | StkId o; | 249 | StkId o; |
250 | lua_CFunction f; | 250 | lua_CFunction f; |
251 | LUA_ENTRY; | 251 | LUA_LOCK; |
252 | o = luaA_indexAcceptable(L, index); | 252 | o = luaA_indexAcceptable(L, index); |
253 | f = (o == NULL || !iscfunction(o)) ? NULL : clvalue(o)->f.c; | 253 | f = (o == NULL || !iscfunction(o)) ? NULL : clvalue(o)->f.c; |
254 | LUA_EXIT; | 254 | LUA_UNLOCK; |
255 | return f; | 255 | return f; |
256 | } | 256 | } |
257 | 257 | ||
258 | LUA_API void *lua_touserdata (lua_State *L, int index) { | 258 | LUA_API void *lua_touserdata (lua_State *L, int index) { |
259 | StkId o; | 259 | StkId o; |
260 | void *p; | 260 | void *p; |
261 | LUA_ENTRY; | 261 | LUA_LOCK; |
262 | o = luaA_indexAcceptable(L, index); | 262 | o = luaA_indexAcceptable(L, index); |
263 | p = (o == NULL || ttype(o) != LUA_TUSERDATA) ? NULL : | 263 | p = (o == NULL || ttype(o) != LUA_TUSERDATA) ? NULL : |
264 | tsvalue(o)->u.d.value; | 264 | tsvalue(o)->u.d.value; |
265 | LUA_EXIT; | 265 | LUA_UNLOCK; |
266 | return p; | 266 | return p; |
267 | } | 267 | } |
268 | 268 | ||
269 | LUA_API const void *lua_topointer (lua_State *L, int index) { | 269 | LUA_API const void *lua_topointer (lua_State *L, int index) { |
270 | StkId o; | 270 | StkId o; |
271 | const void *p; | 271 | const void *p; |
272 | LUA_ENTRY; | 272 | LUA_LOCK; |
273 | o = luaA_indexAcceptable(L, index); | 273 | o = luaA_indexAcceptable(L, index); |
274 | if (o == NULL) p = NULL; | 274 | if (o == NULL) p = NULL; |
275 | else { | 275 | else { |
@@ -285,7 +285,7 @@ LUA_API const void *lua_topointer (lua_State *L, int index) { | |||
285 | break; | 285 | break; |
286 | } | 286 | } |
287 | } | 287 | } |
288 | LUA_EXIT; | 288 | LUA_UNLOCK; |
289 | return p; | 289 | return p; |
290 | } | 290 | } |
291 | 291 | ||
@@ -297,26 +297,26 @@ LUA_API const void *lua_topointer (lua_State *L, int index) { | |||
297 | 297 | ||
298 | 298 | ||
299 | LUA_API void lua_pushnil (lua_State *L) { | 299 | LUA_API void lua_pushnil (lua_State *L) { |
300 | LUA_ENTRY; | 300 | LUA_LOCK; |
301 | setnilvalue(L->top); | 301 | setnilvalue(L->top); |
302 | api_incr_top(L); | 302 | api_incr_top(L); |
303 | LUA_EXIT; | 303 | LUA_UNLOCK; |
304 | } | 304 | } |
305 | 305 | ||
306 | 306 | ||
307 | LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { | 307 | LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { |
308 | LUA_ENTRY; | 308 | LUA_LOCK; |
309 | setnvalue(L->top, n); | 309 | setnvalue(L->top, n); |
310 | api_incr_top(L); | 310 | api_incr_top(L); |
311 | LUA_EXIT; | 311 | LUA_UNLOCK; |
312 | } | 312 | } |
313 | 313 | ||
314 | 314 | ||
315 | LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { | 315 | LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { |
316 | LUA_ENTRY; | 316 | LUA_LOCK; |
317 | setsvalue(L->top, luaS_newlstr(L, s, len)); | 317 | setsvalue(L->top, luaS_newlstr(L, s, len)); |
318 | api_incr_top(L); | 318 | api_incr_top(L); |
319 | LUA_EXIT; | 319 | LUA_UNLOCK; |
320 | } | 320 | } |
321 | 321 | ||
322 | 322 | ||
@@ -329,20 +329,20 @@ LUA_API void lua_pushstring (lua_State *L, const char *s) { | |||
329 | 329 | ||
330 | 330 | ||
331 | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { | 331 | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { |
332 | LUA_ENTRY; | 332 | LUA_LOCK; |
333 | luaV_Cclosure(L, fn, n); | 333 | luaV_Cclosure(L, fn, n); |
334 | LUA_EXIT; | 334 | LUA_UNLOCK; |
335 | } | 335 | } |
336 | 336 | ||
337 | 337 | ||
338 | LUA_API void lua_pushusertag (lua_State *L, void *u, int tag) { | 338 | LUA_API void lua_pushusertag (lua_State *L, void *u, int tag) { |
339 | LUA_ENTRY; | 339 | LUA_LOCK; |
340 | /* ORDER LUA_T */ | 340 | /* ORDER LUA_T */ |
341 | if (!(tag == LUA_ANYTAG || tag == LUA_TUSERDATA || validtag(G(L), tag))) | 341 | if (!(tag == LUA_ANYTAG || tag == LUA_TUSERDATA || validtag(G(L), tag))) |
342 | luaO_verror(L, "invalid tag for a userdata (%d)", tag); | 342 | luaO_verror(L, "invalid tag for a userdata (%d)", tag); |
343 | setuvalue(L->top, luaS_createudata(L, u, tag)); | 343 | setuvalue(L->top, luaS_createudata(L, u, tag)); |
344 | api_incr_top(L); | 344 | api_incr_top(L); |
345 | LUA_EXIT; | 345 | LUA_UNLOCK; |
346 | } | 346 | } |
347 | 347 | ||
348 | 348 | ||
@@ -354,58 +354,58 @@ LUA_API void lua_pushusertag (lua_State *L, void *u, int tag) { | |||
354 | 354 | ||
355 | LUA_API void lua_getglobal (lua_State *L, const char *name) { | 355 | LUA_API void lua_getglobal (lua_State *L, const char *name) { |
356 | StkId top; | 356 | StkId top; |
357 | LUA_ENTRY; | 357 | LUA_LOCK; |
358 | top = L->top; | 358 | top = L->top; |
359 | setobj(top, luaV_getglobal(L, luaS_new(L, name))); | 359 | setobj(top, luaV_getglobal(L, luaS_new(L, name))); |
360 | L->top = top; | 360 | L->top = top; |
361 | api_incr_top(L); | 361 | api_incr_top(L); |
362 | LUA_EXIT; | 362 | LUA_UNLOCK; |
363 | } | 363 | } |
364 | 364 | ||
365 | 365 | ||
366 | LUA_API void lua_gettable (lua_State *L, int index) { | 366 | LUA_API void lua_gettable (lua_State *L, int index) { |
367 | StkId t, top; | 367 | StkId t, top; |
368 | LUA_ENTRY; | 368 | LUA_LOCK; |
369 | t = Index(L, index); | 369 | t = Index(L, index); |
370 | top = L->top; | 370 | top = L->top; |
371 | setobj(top-1, luaV_gettable(L, t)); | 371 | setobj(top-1, luaV_gettable(L, t)); |
372 | L->top = top; /* tag method may change top */ | 372 | L->top = top; /* tag method may change top */ |
373 | LUA_EXIT; | 373 | LUA_UNLOCK; |
374 | } | 374 | } |
375 | 375 | ||
376 | 376 | ||
377 | LUA_API void lua_rawget (lua_State *L, int index) { | 377 | LUA_API void lua_rawget (lua_State *L, int index) { |
378 | StkId t; | 378 | StkId t; |
379 | LUA_ENTRY; | 379 | LUA_LOCK; |
380 | t = Index(L, index); | 380 | t = Index(L, index); |
381 | lua_assert(ttype(t) == LUA_TTABLE); | 381 | lua_assert(ttype(t) == LUA_TTABLE); |
382 | setobj(L->top - 1, luaH_get(hvalue(t), L->top - 1)); | 382 | setobj(L->top - 1, luaH_get(hvalue(t), L->top - 1)); |
383 | LUA_EXIT; | 383 | LUA_UNLOCK; |
384 | } | 384 | } |
385 | 385 | ||
386 | 386 | ||
387 | LUA_API void lua_rawgeti (lua_State *L, int index, int n) { | 387 | LUA_API void lua_rawgeti (lua_State *L, int index, int n) { |
388 | StkId o; | 388 | StkId o; |
389 | LUA_ENTRY; | 389 | LUA_LOCK; |
390 | o = Index(L, index); | 390 | o = Index(L, index); |
391 | lua_assert(ttype(o) == LUA_TTABLE); | 391 | lua_assert(ttype(o) == LUA_TTABLE); |
392 | setobj(L->top, luaH_getnum(hvalue(o), n)); | 392 | setobj(L->top, luaH_getnum(hvalue(o), n)); |
393 | api_incr_top(L); | 393 | api_incr_top(L); |
394 | LUA_EXIT; | 394 | LUA_UNLOCK; |
395 | } | 395 | } |
396 | 396 | ||
397 | 397 | ||
398 | LUA_API void lua_getglobals (lua_State *L) { | 398 | LUA_API void lua_getglobals (lua_State *L) { |
399 | LUA_ENTRY; | 399 | LUA_LOCK; |
400 | sethvalue(L->top, L->gt); | 400 | sethvalue(L->top, L->gt); |
401 | api_incr_top(L); | 401 | api_incr_top(L); |
402 | LUA_EXIT; | 402 | LUA_UNLOCK; |
403 | } | 403 | } |
404 | 404 | ||
405 | 405 | ||
406 | LUA_API int lua_getref (lua_State *L, int ref) { | 406 | LUA_API int lua_getref (lua_State *L, int ref) { |
407 | int status = 1; | 407 | int status = 1; |
408 | LUA_ENTRY; | 408 | LUA_LOCK; |
409 | if (ref == LUA_REFNIL) { | 409 | if (ref == LUA_REFNIL) { |
410 | setnilvalue(L->top); | 410 | setnilvalue(L->top); |
411 | api_incr_top(L); | 411 | api_incr_top(L); |
@@ -417,16 +417,16 @@ LUA_API int lua_getref (lua_State *L, int ref) { | |||
417 | } | 417 | } |
418 | else | 418 | else |
419 | status = 0; | 419 | status = 0; |
420 | LUA_EXIT; | 420 | LUA_UNLOCK; |
421 | return status; | 421 | return status; |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
425 | LUA_API void lua_newtable (lua_State *L) { | 425 | LUA_API void lua_newtable (lua_State *L) { |
426 | LUA_ENTRY; | 426 | LUA_LOCK; |
427 | sethvalue(L->top, luaH_new(L, 0)); | 427 | sethvalue(L->top, luaH_new(L, 0)); |
428 | api_incr_top(L); | 428 | api_incr_top(L); |
429 | LUA_EXIT; | 429 | LUA_UNLOCK; |
430 | } | 430 | } |
431 | 431 | ||
432 | 432 | ||
@@ -438,60 +438,60 @@ LUA_API void lua_newtable (lua_State *L) { | |||
438 | 438 | ||
439 | LUA_API void lua_setglobal (lua_State *L, const char *name) { | 439 | LUA_API void lua_setglobal (lua_State *L, const char *name) { |
440 | StkId top; | 440 | StkId top; |
441 | LUA_ENTRY; | 441 | LUA_LOCK; |
442 | top = L->top; | 442 | top = L->top; |
443 | luaV_setglobal(L, luaS_new(L, name)); | 443 | luaV_setglobal(L, luaS_new(L, name)); |
444 | L->top = top-1; /* remove element from the top */ | 444 | L->top = top-1; /* remove element from the top */ |
445 | LUA_EXIT; | 445 | LUA_UNLOCK; |
446 | } | 446 | } |
447 | 447 | ||
448 | 448 | ||
449 | LUA_API void lua_settable (lua_State *L, int index) { | 449 | LUA_API void lua_settable (lua_State *L, int index) { |
450 | StkId t, top; | 450 | StkId t, top; |
451 | LUA_ENTRY; | 451 | LUA_LOCK; |
452 | t = Index(L, index); | 452 | t = Index(L, index); |
453 | top = L->top; | 453 | top = L->top; |
454 | luaV_settable(L, t, top-2); | 454 | luaV_settable(L, t, top-2); |
455 | L->top = top-2; /* pop index and value */ | 455 | L->top = top-2; /* pop index and value */ |
456 | LUA_EXIT; | 456 | LUA_UNLOCK; |
457 | } | 457 | } |
458 | 458 | ||
459 | 459 | ||
460 | LUA_API void lua_rawset (lua_State *L, int index) { | 460 | LUA_API void lua_rawset (lua_State *L, int index) { |
461 | StkId t; | 461 | StkId t; |
462 | LUA_ENTRY; | 462 | LUA_LOCK; |
463 | t = Index(L, index); | 463 | t = Index(L, index); |
464 | lua_assert(ttype(t) == LUA_TTABLE); | 464 | lua_assert(ttype(t) == LUA_TTABLE); |
465 | setobj(luaH_set(L, hvalue(t), L->top-2), (L->top-1)); | 465 | setobj(luaH_set(L, hvalue(t), L->top-2), (L->top-1)); |
466 | L->top -= 2; | 466 | L->top -= 2; |
467 | LUA_EXIT; | 467 | LUA_UNLOCK; |
468 | } | 468 | } |
469 | 469 | ||
470 | 470 | ||
471 | LUA_API void lua_rawseti (lua_State *L, int index, int n) { | 471 | LUA_API void lua_rawseti (lua_State *L, int index, int n) { |
472 | StkId o; | 472 | StkId o; |
473 | LUA_ENTRY; | 473 | LUA_LOCK; |
474 | o = Index(L, index); | 474 | o = Index(L, index); |
475 | lua_assert(ttype(o) == LUA_TTABLE); | 475 | lua_assert(ttype(o) == LUA_TTABLE); |
476 | setobj(luaH_setnum(L, hvalue(o), n), (L->top-1)); | 476 | setobj(luaH_setnum(L, hvalue(o), n), (L->top-1)); |
477 | L->top--; | 477 | L->top--; |
478 | LUA_EXIT; | 478 | LUA_UNLOCK; |
479 | } | 479 | } |
480 | 480 | ||
481 | 481 | ||
482 | LUA_API void lua_setglobals (lua_State *L) { | 482 | LUA_API void lua_setglobals (lua_State *L) { |
483 | StkId newtable; | 483 | StkId newtable; |
484 | LUA_ENTRY; | 484 | LUA_LOCK; |
485 | newtable = --L->top; | 485 | newtable = --L->top; |
486 | lua_assert(ttype(newtable) == LUA_TTABLE); | 486 | lua_assert(ttype(newtable) == LUA_TTABLE); |
487 | L->gt = hvalue(newtable); | 487 | L->gt = hvalue(newtable); |
488 | LUA_EXIT; | 488 | LUA_UNLOCK; |
489 | } | 489 | } |
490 | 490 | ||
491 | 491 | ||
492 | LUA_API int lua_ref (lua_State *L, int lock) { | 492 | LUA_API int lua_ref (lua_State *L, int lock) { |
493 | int ref; | 493 | int ref; |
494 | LUA_ENTRY; | 494 | LUA_LOCK; |
495 | if (ttype(L->top-1) == LUA_TNIL) | 495 | if (ttype(L->top-1) == LUA_TNIL) |
496 | ref = LUA_REFNIL; | 496 | ref = LUA_REFNIL; |
497 | else { | 497 | else { |
@@ -508,7 +508,7 @@ LUA_API int lua_ref (lua_State *L, int lock) { | |||
508 | G(L)->refArray[ref].st = lock ? LOCK : HOLD; | 508 | G(L)->refArray[ref].st = lock ? LOCK : HOLD; |
509 | } | 509 | } |
510 | L->top--; | 510 | L->top--; |
511 | LUA_EXIT; | 511 | LUA_UNLOCK; |
512 | return ref; | 512 | return ref; |
513 | } | 513 | } |
514 | 514 | ||
@@ -519,9 +519,9 @@ LUA_API int lua_ref (lua_State *L, int lock) { | |||
519 | */ | 519 | */ |
520 | 520 | ||
521 | LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults) { | 521 | LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults) { |
522 | LUA_ENTRY; | 522 | LUA_LOCK; |
523 | luaD_call(L, L->top-(nargs+1), nresults); | 523 | luaD_call(L, L->top-(nargs+1), nresults); |
524 | LUA_EXIT; | 524 | LUA_UNLOCK; |
525 | } | 525 | } |
526 | 526 | ||
527 | 527 | ||
@@ -535,28 +535,28 @@ LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults) { | |||
535 | 535 | ||
536 | LUA_API int lua_getgcthreshold (lua_State *L) { | 536 | LUA_API int lua_getgcthreshold (lua_State *L) { |
537 | int threshold; | 537 | int threshold; |
538 | LUA_ENTRY; | 538 | LUA_LOCK; |
539 | threshold = GCscale(G(L)->GCthreshold); | 539 | threshold = GCscale(G(L)->GCthreshold); |
540 | LUA_EXIT; | 540 | LUA_UNLOCK; |
541 | return threshold; | 541 | return threshold; |
542 | } | 542 | } |
543 | 543 | ||
544 | LUA_API int lua_getgccount (lua_State *L) { | 544 | LUA_API int lua_getgccount (lua_State *L) { |
545 | int count; | 545 | int count; |
546 | LUA_ENTRY; | 546 | LUA_LOCK; |
547 | count = GCscale(G(L)->nblocks); | 547 | count = GCscale(G(L)->nblocks); |
548 | LUA_EXIT; | 548 | LUA_UNLOCK; |
549 | return count; | 549 | return count; |
550 | } | 550 | } |
551 | 551 | ||
552 | LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold) { | 552 | LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold) { |
553 | LUA_ENTRY; | 553 | LUA_LOCK; |
554 | if (newthreshold > GCscale(ULONG_MAX)) | 554 | if (newthreshold > GCscale(ULONG_MAX)) |
555 | G(L)->GCthreshold = ULONG_MAX; | 555 | G(L)->GCthreshold = ULONG_MAX; |
556 | else | 556 | else |
557 | G(L)->GCthreshold = GCunscale(newthreshold); | 557 | G(L)->GCthreshold = GCunscale(newthreshold); |
558 | luaC_checkGC(L); | 558 | luaC_checkGC(L); |
559 | LUA_EXIT; | 559 | LUA_UNLOCK; |
560 | } | 560 | } |
561 | 561 | ||
562 | 562 | ||
@@ -566,7 +566,7 @@ LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold) { | |||
566 | 566 | ||
567 | LUA_API int lua_newtype (lua_State *L, const char *name, int basictype) { | 567 | LUA_API int lua_newtype (lua_State *L, const char *name, int basictype) { |
568 | int tag; | 568 | int tag; |
569 | LUA_ENTRY; | 569 | LUA_LOCK; |
570 | if (basictype != LUA_TNONE && | 570 | if (basictype != LUA_TNONE && |
571 | basictype != LUA_TTABLE && | 571 | basictype != LUA_TTABLE && |
572 | basictype != LUA_TUSERDATA) | 572 | basictype != LUA_TUSERDATA) |
@@ -574,7 +574,7 @@ LUA_API int lua_newtype (lua_State *L, const char *name, int basictype) { | |||
574 | tag = luaT_newtag(L, name, basictype); | 574 | tag = luaT_newtag(L, name, basictype); |
575 | if (tag == LUA_TNONE) | 575 | if (tag == LUA_TNONE) |
576 | luaO_verror(L, "type name '%.30s' already exists", name); | 576 | luaO_verror(L, "type name '%.30s' already exists", name); |
577 | LUA_EXIT; | 577 | LUA_UNLOCK; |
578 | return tag; | 578 | return tag; |
579 | } | 579 | } |
580 | 580 | ||
@@ -582,22 +582,22 @@ LUA_API int lua_newtype (lua_State *L, const char *name, int basictype) { | |||
582 | LUA_API int lua_type2tag (lua_State *L, const char *name) { | 582 | LUA_API int lua_type2tag (lua_State *L, const char *name) { |
583 | int tag; | 583 | int tag; |
584 | const TObject *v; | 584 | const TObject *v; |
585 | LUA_ENTRY; | 585 | LUA_LOCK; |
586 | v = luaH_getstr(G(L)->type2tag, luaS_new(L, name)); | 586 | v = luaH_getstr(G(L)->type2tag, luaS_new(L, name)); |
587 | if (ttype(v) == LUA_TNIL) | 587 | if (ttype(v) == LUA_TNIL) |
588 | tag = LUA_TNONE; | 588 | tag = LUA_TNONE; |
589 | else { | 589 | else { |
590 | lua_assert(ttype(v) == LUA_TNUMBER); | 590 | lua_assert(ttype(v) == LUA_TNUMBER); |
591 | tag = nvalue(v); | 591 | tag = (int)nvalue(v); |
592 | } | 592 | } |
593 | LUA_EXIT; | 593 | LUA_UNLOCK; |
594 | return tag; | 594 | return tag; |
595 | } | 595 | } |
596 | 596 | ||
597 | 597 | ||
598 | LUA_API void lua_settag (lua_State *L, int tag) { | 598 | LUA_API void lua_settag (lua_State *L, int tag) { |
599 | int basictype; | 599 | int basictype; |
600 | LUA_ENTRY; | 600 | LUA_LOCK; |
601 | if (tag < 0 || tag >= G(L)->ntag) | 601 | if (tag < 0 || tag >= G(L)->ntag) |
602 | luaO_verror(L, "%d is not a valid tag", tag); | 602 | luaO_verror(L, "%d is not a valid tag", tag); |
603 | basictype = G(L)->TMtable[tag].basictype; | 603 | basictype = G(L)->TMtable[tag].basictype; |
@@ -615,25 +615,25 @@ LUA_API void lua_settag (lua_State *L, int tag) { | |||
615 | luaO_verror(L, "cannot change the tag of a %.20s", | 615 | luaO_verror(L, "cannot change the tag of a %.20s", |
616 | luaT_typename(G(L), L->top-1)); | 616 | luaT_typename(G(L), L->top-1)); |
617 | } | 617 | } |
618 | LUA_EXIT; | 618 | LUA_UNLOCK; |
619 | } | 619 | } |
620 | 620 | ||
621 | 621 | ||
622 | LUA_API void lua_error (lua_State *L, const char *s) { | 622 | LUA_API void lua_error (lua_State *L, const char *s) { |
623 | LUA_ENTRY; | 623 | LUA_LOCK; |
624 | luaD_error(L, s); | 624 | luaD_error(L, s); |
625 | LUA_EXIT; | 625 | LUA_UNLOCK; |
626 | } | 626 | } |
627 | 627 | ||
628 | 628 | ||
629 | LUA_API void lua_unref (lua_State *L, int ref) { | 629 | LUA_API void lua_unref (lua_State *L, int ref) { |
630 | LUA_ENTRY; | 630 | LUA_LOCK; |
631 | if (ref >= 0) { | 631 | if (ref >= 0) { |
632 | lua_assert(ref < G(L)->nref && G(L)->refArray[ref].st < 0); | 632 | lua_assert(ref < G(L)->nref && G(L)->refArray[ref].st < 0); |
633 | G(L)->refArray[ref].st = G(L)->refFree; | 633 | G(L)->refArray[ref].st = G(L)->refFree; |
634 | G(L)->refFree = ref; | 634 | G(L)->refFree = ref; |
635 | } | 635 | } |
636 | LUA_EXIT; | 636 | LUA_UNLOCK; |
637 | } | 637 | } |
638 | 638 | ||
639 | 639 | ||
@@ -641,7 +641,7 @@ LUA_API int lua_next (lua_State *L, int index) { | |||
641 | StkId t; | 641 | StkId t; |
642 | Node *n; | 642 | Node *n; |
643 | int more; | 643 | int more; |
644 | LUA_ENTRY; | 644 | LUA_LOCK; |
645 | t = luaA_index(L, index); | 645 | t = luaA_index(L, index); |
646 | lua_assert(ttype(t) == LUA_TTABLE); | 646 | lua_assert(ttype(t) == LUA_TTABLE); |
647 | n = luaH_next(L, hvalue(t), luaA_index(L, -1)); | 647 | n = luaH_next(L, hvalue(t), luaA_index(L, -1)); |
@@ -655,7 +655,7 @@ LUA_API int lua_next (lua_State *L, int index) { | |||
655 | L->top -= 1; /* remove key */ | 655 | L->top -= 1; /* remove key */ |
656 | more = 0; | 656 | more = 0; |
657 | } | 657 | } |
658 | LUA_EXIT; | 658 | LUA_UNLOCK; |
659 | return more; | 659 | return more; |
660 | } | 660 | } |
661 | 661 | ||
@@ -664,7 +664,7 @@ LUA_API int lua_getn (lua_State *L, int index) { | |||
664 | Hash *h; | 664 | Hash *h; |
665 | const TObject *value; | 665 | const TObject *value; |
666 | int n; | 666 | int n; |
667 | LUA_ENTRY; | 667 | LUA_LOCK; |
668 | h = hvalue(luaA_index(L, index)); | 668 | h = hvalue(luaA_index(L, index)); |
669 | value = luaH_getstr(h, luaS_newliteral(L, "n")); /* = h.n */ | 669 | value = luaH_getstr(h, luaS_newliteral(L, "n")); /* = h.n */ |
670 | if (ttype(value) == LUA_TNUMBER) | 670 | if (ttype(value) == LUA_TNUMBER) |
@@ -682,31 +682,31 @@ LUA_API int lua_getn (lua_State *L, int index) { | |||
682 | } | 682 | } |
683 | n = (int)max; | 683 | n = (int)max; |
684 | } | 684 | } |
685 | LUA_EXIT; | 685 | LUA_UNLOCK; |
686 | return n; | 686 | return n; |
687 | } | 687 | } |
688 | 688 | ||
689 | 689 | ||
690 | LUA_API void lua_concat (lua_State *L, int n) { | 690 | LUA_API void lua_concat (lua_State *L, int n) { |
691 | StkId top; | 691 | StkId top; |
692 | LUA_ENTRY; | 692 | LUA_LOCK; |
693 | top = L->top; | 693 | top = L->top; |
694 | luaV_strconc(L, n, top); | 694 | luaV_strconc(L, n, top); |
695 | L->top = top-(n-1); | 695 | L->top = top-(n-1); |
696 | luaC_checkGC(L); | 696 | luaC_checkGC(L); |
697 | LUA_EXIT; | 697 | LUA_UNLOCK; |
698 | } | 698 | } |
699 | 699 | ||
700 | 700 | ||
701 | LUA_API void *lua_newuserdata (lua_State *L, size_t size) { | 701 | LUA_API void *lua_newuserdata (lua_State *L, size_t size) { |
702 | TString *ts; | 702 | TString *ts; |
703 | void *p; | 703 | void *p; |
704 | LUA_ENTRY; | 704 | LUA_LOCK; |
705 | ts = luaS_newudata(L, size, NULL); | 705 | ts = luaS_newudata(L, size, NULL); |
706 | setuvalue(L->top, ts); | 706 | setuvalue(L->top, ts); |
707 | api_incr_top(L); | 707 | api_incr_top(L); |
708 | p = ts->u.d.value; | 708 | p = ts->u.d.value; |
709 | LUA_EXIT; | 709 | LUA_UNLOCK; |
710 | return p; | 710 | return p; |
711 | } | 711 | } |
712 | 712 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 1.55 2001/01/24 15:45:33 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.56 2001/01/25 16:45:36 roberto Exp roberto $ |
3 | ** Debug Interface | 3 | ** Debug Interface |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -42,20 +42,20 @@ static int isLmark (StkId o) { | |||
42 | 42 | ||
43 | LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func) { | 43 | LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func) { |
44 | lua_Hook oldhook; | 44 | lua_Hook oldhook; |
45 | LUA_ENTRY; | 45 | LUA_LOCK; |
46 | oldhook = L->callhook; | 46 | oldhook = L->callhook; |
47 | L->callhook = func; | 47 | L->callhook = func; |
48 | LUA_EXIT; | 48 | LUA_UNLOCK; |
49 | return oldhook; | 49 | return oldhook; |
50 | } | 50 | } |
51 | 51 | ||
52 | 52 | ||
53 | LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func) { | 53 | LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func) { |
54 | lua_Hook oldhook; | 54 | lua_Hook oldhook; |
55 | LUA_ENTRY; | 55 | LUA_LOCK; |
56 | oldhook = L->linehook; | 56 | oldhook = L->linehook; |
57 | L->linehook = func; | 57 | L->linehook = func; |
58 | LUA_EXIT; | 58 | LUA_UNLOCK; |
59 | return oldhook; | 59 | return oldhook; |
60 | } | 60 | } |
61 | 61 | ||
@@ -76,14 +76,14 @@ static StkId aux_stackedfunction (lua_State *L, int level, StkId top) { | |||
76 | LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { | 76 | LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { |
77 | StkId f; | 77 | StkId f; |
78 | int status; | 78 | int status; |
79 | LUA_ENTRY; | 79 | LUA_LOCK; |
80 | f = aux_stackedfunction(L, level, L->top); | 80 | f = aux_stackedfunction(L, level, L->top); |
81 | if (f == NULL) status = 0; /* there is no such level */ | 81 | if (f == NULL) status = 0; /* there is no such level */ |
82 | else { | 82 | else { |
83 | ar->_func = f; | 83 | ar->_func = f; |
84 | status = 1; | 84 | status = 1; |
85 | } | 85 | } |
86 | LUA_EXIT; | 86 | LUA_UNLOCK; |
87 | return status; | 87 | return status; |
88 | } | 88 | } |
89 | 89 | ||
@@ -162,7 +162,7 @@ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { | |||
162 | const char *name; | 162 | const char *name; |
163 | StkId f; | 163 | StkId f; |
164 | Proto *fp; | 164 | Proto *fp; |
165 | LUA_ENTRY; | 165 | LUA_LOCK; |
166 | name = NULL; | 166 | name = NULL; |
167 | f = ar->_func; | 167 | f = ar->_func; |
168 | fp = getluaproto(f); | 168 | fp = getluaproto(f); |
@@ -171,7 +171,7 @@ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { | |||
171 | if (name) | 171 | if (name) |
172 | luaA_pushobject(L, (f+1)+(n-1)); /* push value */ | 172 | luaA_pushobject(L, (f+1)+(n-1)); /* push value */ |
173 | } | 173 | } |
174 | LUA_EXIT; | 174 | LUA_UNLOCK; |
175 | return name; | 175 | return name; |
176 | } | 176 | } |
177 | 177 | ||
@@ -180,7 +180,7 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { | |||
180 | const char *name; | 180 | const char *name; |
181 | StkId f; | 181 | StkId f; |
182 | Proto *fp; | 182 | Proto *fp; |
183 | LUA_ENTRY; | 183 | LUA_LOCK; |
184 | name = NULL; | 184 | name = NULL; |
185 | f = ar->_func; | 185 | f = ar->_func; |
186 | fp = getluaproto(f); | 186 | fp = getluaproto(f); |
@@ -192,7 +192,7 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { | |||
192 | else | 192 | else |
193 | setobj((f+1)+(n-1), L->top); | 193 | setobj((f+1)+(n-1), L->top); |
194 | } | 194 | } |
195 | LUA_EXIT; | 195 | LUA_UNLOCK; |
196 | return name; | 196 | return name; |
197 | } | 197 | } |
198 | 198 | ||
@@ -272,7 +272,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { | |||
272 | StkId func; | 272 | StkId func; |
273 | int isactive; | 273 | int isactive; |
274 | int status = 1; | 274 | int status = 1; |
275 | LUA_ENTRY; | 275 | LUA_LOCK; |
276 | isactive = (*what != '>'); | 276 | isactive = (*what != '>'); |
277 | if (isactive) | 277 | if (isactive) |
278 | func = ar->_func; | 278 | func = ar->_func; |
@@ -309,7 +309,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { | |||
309 | } | 309 | } |
310 | } | 310 | } |
311 | if (!isactive) L->top--; /* pop function */ | 311 | if (!isactive) L->top--; /* pop function */ |
312 | LUA_EXIT; | 312 | LUA_UNLOCK; |
313 | return status; | 313 | return status; |
314 | } | 314 | } |
315 | 315 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.115 2001/01/19 13:20:30 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.116 2001/01/24 15:45:33 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -94,9 +94,9 @@ static void dohook (lua_State *L, lua_Debug *ar, lua_Hook hook) { | |||
94 | StkId old_top = L->Cbase = L->top; | 94 | StkId old_top = L->Cbase = L->top; |
95 | luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ | 95 | luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ |
96 | L->allowhooks = 0; /* cannot call hooks inside a hook */ | 96 | L->allowhooks = 0; /* cannot call hooks inside a hook */ |
97 | LUA_EXIT; | 97 | LUA_UNLOCK; |
98 | (*hook)(L, ar); | 98 | (*hook)(L, ar); |
99 | LUA_ENTRY; | 99 | LUA_LOCK; |
100 | lua_assert(L->allowhooks == 0); | 100 | lua_assert(L->allowhooks == 0); |
101 | L->allowhooks = 1; | 101 | L->allowhooks = 1; |
102 | L->top = old_top; | 102 | L->top = old_top; |
@@ -135,9 +135,9 @@ static StkId callCclosure (lua_State *L, const struct Closure *cl, StkId base) { | |||
135 | luaD_checkstack(L, nup+LUA_MINSTACK); /* ensure minimum stack size */ | 135 | luaD_checkstack(L, nup+LUA_MINSTACK); /* ensure minimum stack size */ |
136 | for (n=0; n<nup; n++) /* copy upvalues as extra arguments */ | 136 | for (n=0; n<nup; n++) /* copy upvalues as extra arguments */ |
137 | setobj(L->top++, &cl->upvalue[n]); | 137 | setobj(L->top++, &cl->upvalue[n]); |
138 | LUA_EXIT; | 138 | LUA_UNLOCK; |
139 | n = (*cl->f.c)(L); /* do the actual call */ | 139 | n = (*cl->f.c)(L); /* do the actual call */ |
140 | LUA_ENTRY; | 140 | LUA_LOCK; |
141 | L->Cbase = old_Cbase; /* restore old C base */ | 141 | L->Cbase = old_Cbase; /* restore old C base */ |
142 | return L->top - n; /* return index of first result */ | 142 | return L->top - n; /* return index of first result */ |
143 | } | 143 | } |
@@ -219,13 +219,13 @@ LUA_API int lua_call (lua_State *L, int nargs, int nresults) { | |||
219 | StkId func; | 219 | StkId func; |
220 | struct CallS c; | 220 | struct CallS c; |
221 | int status; | 221 | int status; |
222 | LUA_ENTRY; | 222 | LUA_LOCK; |
223 | func = L->top - (nargs+1); /* function to be called */ | 223 | func = L->top - (nargs+1); /* function to be called */ |
224 | c.func = func; c.nresults = nresults; | 224 | c.func = func; c.nresults = nresults; |
225 | status = luaD_runprotected(L, f_call, &c); | 225 | status = luaD_runprotected(L, f_call, &c); |
226 | if (status != 0) /* an error occurred? */ | 226 | if (status != 0) /* an error occurred? */ |
227 | L->top = func; /* remove parameters from the stack */ | 227 | L->top = func; /* remove parameters from the stack */ |
228 | LUA_EXIT; | 228 | LUA_UNLOCK; |
229 | return status; | 229 | return status; |
230 | } | 230 | } |
231 | 231 | ||
@@ -249,7 +249,7 @@ static int protectedparser (lua_State *L, ZIO *z, int bin) { | |||
249 | struct ParserS p; | 249 | struct ParserS p; |
250 | mem_int old_blocks; | 250 | mem_int old_blocks; |
251 | int status; | 251 | int status; |
252 | LUA_ENTRY; | 252 | LUA_LOCK; |
253 | p.z = z; p.bin = bin; | 253 | p.z = z; p.bin = bin; |
254 | luaC_checkGC(L); | 254 | luaC_checkGC(L); |
255 | old_blocks = G(L)->nblocks; | 255 | old_blocks = G(L)->nblocks; |
@@ -261,7 +261,7 @@ static int protectedparser (lua_State *L, ZIO *z, int bin) { | |||
261 | } | 261 | } |
262 | else if (status == LUA_ERRRUN) /* an error occurred: correct error code */ | 262 | else if (status == LUA_ERRRUN) /* an error occurred: correct error code */ |
263 | status = LUA_ERRSYNTAX; | 263 | status = LUA_ERRSYNTAX; |
264 | LUA_EXIT; | 264 | LUA_UNLOCK; |
265 | return status; | 265 | return status; |
266 | } | 266 | } |
267 | 267 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 1.99 2001/01/18 15:59:09 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 1.100 2001/01/25 16:45:36 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -86,13 +86,14 @@ static int pushresult (lua_State *L, int i) { | |||
86 | static FILE *getopthandle (lua_State *L, int inout) { | 86 | static FILE *getopthandle (lua_State *L, int inout) { |
87 | FILE *p = (FILE *)lua_touserdata(L, 1); | 87 | FILE *p = (FILE *)lua_touserdata(L, 1); |
88 | if (p != NULL) { /* is it a userdata ? */ | 88 | if (p != NULL) { /* is it a userdata ? */ |
89 | if (!checkfile(L,1)) { | 89 | if (!checkfile(L, 1)) { |
90 | if (strcmp(lua_xtype(L, 1), "ClosedFileHandle") == 0) | 90 | if (strcmp(lua_xtype(L, 1), "ClosedFileHandle") == 0) |
91 | luaL_argerror(L, 1, "file is closed"); | 91 | luaL_argerror(L, 1, "file is closed"); |
92 | else | 92 | else |
93 | luaL_argerror(L, 1, "(invalid value)"); | 93 | luaL_argerror(L, 1, "(invalid value)"); |
94 | } | 94 | } |
95 | lua_remove(L, 1); /* remove it from stack */ | 95 | /* move it to stack top */ |
96 | lua_pushvalue(L, 1); lua_remove(L, 1); | ||
96 | } | 97 | } |
97 | else if (inout != NOFILE) { /* try global value */ | 98 | else if (inout != NOFILE) { /* try global value */ |
98 | lua_getglobal(L, filenames[inout]); | 99 | lua_getglobal(L, filenames[inout]); |
@@ -100,9 +101,8 @@ static FILE *getopthandle (lua_State *L, int inout) { | |||
100 | luaL_verror(L, "global variable `%.10s' is not a valid file handle", | 101 | luaL_verror(L, "global variable `%.10s' is not a valid file handle", |
101 | filenames[inout]); | 102 | filenames[inout]); |
102 | p = (FILE *)lua_touserdata(L, -1); | 103 | p = (FILE *)lua_touserdata(L, -1); |
103 | lua_pop(L, 1); /* remove global value from stack */ | ||
104 | } | 104 | } |
105 | return p; | 105 | return p; /* leave handle at stack top to avoid GC */ |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
@@ -295,7 +295,7 @@ static int read_chars (lua_State *L, FILE *f, size_t n) { | |||
295 | 295 | ||
296 | static int io_read (lua_State *L) { | 296 | static int io_read (lua_State *L) { |
297 | FILE *f = getopthandle(L, INFILE); | 297 | FILE *f = getopthandle(L, INFILE); |
298 | int nargs = lua_gettop(L); | 298 | int nargs = lua_gettop(L)-1; |
299 | int success; | 299 | int success; |
300 | int n; | 300 | int n; |
301 | if (nargs == 0) { /* no arguments? */ | 301 | if (nargs == 0) { /* no arguments? */ |
@@ -347,7 +347,7 @@ static int io_read (lua_State *L) { | |||
347 | 347 | ||
348 | static int io_write (lua_State *L) { | 348 | static int io_write (lua_State *L) { |
349 | FILE *f = getopthandle(L, OUTFILE); | 349 | FILE *f = getopthandle(L, OUTFILE); |
350 | int nargs = lua_gettop(L); | 350 | int nargs = lua_gettop(L)-1; |
351 | int arg; | 351 | int arg; |
352 | int status = 1; | 352 | int status = 1; |
353 | for (arg=1; arg<=nargs; arg++) { | 353 | for (arg=1; arg<=nargs; arg++) { |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 1.53 2001/01/24 15:45:33 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.54 2001/01/25 16:45:36 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 | */ |
@@ -91,7 +91,7 @@ static void f_luaopen (lua_State *L, void *ud) { | |||
91 | luaX_init(L); | 91 | luaX_init(L); |
92 | luaT_init(L); | 92 | luaT_init(L); |
93 | G(L)->GCthreshold = 4*G(L)->nblocks; | 93 | G(L)->GCthreshold = 4*G(L)->nblocks; |
94 | LUA_EXIT; /* temporary exit to use the API */ | 94 | LUA_UNLOCK; /* temporary exit to use the API */ |
95 | lua_newtable(L); | 95 | lua_newtable(L); |
96 | lua_ref(L, 1); /* create registry */ | 96 | lua_ref(L, 1); /* create registry */ |
97 | lua_register(L, LUA_ERRORMESSAGE, errormessage); | 97 | lua_register(L, LUA_ERRORMESSAGE, errormessage); |
@@ -100,7 +100,7 @@ static void f_luaopen (lua_State *L, void *ud) { | |||
100 | if (lua_state == NULL) lua_state = L; /* keep first state to be opened */ | 100 | if (lua_state == NULL) lua_state = L; /* keep first state to be opened */ |
101 | lua_assert(lua_gettop(L) == 0); | 101 | lua_assert(lua_gettop(L) == 0); |
102 | #endif | 102 | #endif |
103 | LUA_ENTRY; /* go back inside */ | 103 | LUA_LOCK; /* go back inside */ |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
@@ -108,7 +108,7 @@ static void f_luaopen (lua_State *L, void *ud) { | |||
108 | LUA_API lua_State *lua_open (lua_State *OL, int stacksize) { | 108 | LUA_API lua_State *lua_open (lua_State *OL, int stacksize) { |
109 | struct Sopen so; | 109 | struct Sopen so; |
110 | lua_State *L; | 110 | lua_State *L; |
111 | LUA_ENTRY; | 111 | LUA_LOCK; |
112 | L = luaM_new(OL, lua_State); | 112 | L = luaM_new(OL, lua_State); |
113 | if (L) { /* allocation OK? */ | 113 | if (L) { /* allocation OK? */ |
114 | L->G = NULL; | 114 | L->G = NULL; |
@@ -127,7 +127,7 @@ LUA_API lua_State *lua_open (lua_State *OL, int stacksize) { | |||
127 | L = NULL; | 127 | L = NULL; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | LUA_EXIT; | 130 | LUA_UNLOCK; |
131 | return L; | 131 | return L; |
132 | } | 132 | } |
133 | 133 | ||
@@ -158,9 +158,9 @@ static void close_state (lua_State *L) { | |||
158 | 158 | ||
159 | LUA_API void lua_close (lua_State *L) { | 159 | LUA_API void lua_close (lua_State *L) { |
160 | lua_assert(L != lua_state || lua_gettop(L) == 0); | 160 | lua_assert(L != lua_state || lua_gettop(L) == 0); |
161 | LUA_ENTRY; | 161 | LUA_LOCK; |
162 | close_state(L); | 162 | close_state(L); |
163 | LUA_EXIT; | 163 | LUA_UNLOCK; |
164 | lua_assert(L != lua_state || memdebug_numblocks == 0); | 164 | lua_assert(L != lua_state || memdebug_numblocks == 0); |
165 | lua_assert(L != lua_state || memdebug_total == 0); | 165 | lua_assert(L != lua_state || memdebug_total == 0); |
166 | } | 166 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 1.46 2001/01/24 15:45:33 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 1.47 2001/01/25 16:45:36 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 | */ |
@@ -15,8 +15,8 @@ | |||
15 | 15 | ||
16 | #ifdef LUA_DEBUG | 16 | #ifdef LUA_DEBUG |
17 | extern int islocked; | 17 | extern int islocked; |
18 | #define LUA_ENTRY lua_assert(islocked++ == 0) | 18 | #define LUA_LOCK lua_assert(islocked++ == 0) |
19 | #define LUA_EXIT lua_assert(--islocked == 0) | 19 | #define LUA_UNLOCK lua_assert(--islocked == 0) |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | 22 | ||
@@ -24,12 +24,12 @@ extern int islocked; | |||
24 | ** macros that control all entries and exits from Lua core machine | 24 | ** macros that control all entries and exits from Lua core machine |
25 | ** (mainly for thread syncronization) | 25 | ** (mainly for thread syncronization) |
26 | */ | 26 | */ |
27 | #ifndef LUA_ENTRY | 27 | #ifndef LUA_LOCK |
28 | #define LUA_ENTRY | 28 | #define LUA_LOCK |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #ifndef LUA_EXIT | 31 | #ifndef LUA_UNLOCK |
32 | #define LUA_EXIT | 32 | #define LUA_UNLOCK |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | 35 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 1.62 2001/01/24 15:45:33 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 1.63 2001/01/25 16:45:36 roberto Exp roberto $ |
3 | ** Tag methods | 3 | ** Tag methods |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -111,14 +111,14 @@ static void checktag (lua_State *L, int tag) { | |||
111 | 111 | ||
112 | LUA_API int lua_copytagmethods (lua_State *L, int tagto, int tagfrom) { | 112 | LUA_API int lua_copytagmethods (lua_State *L, int tagto, int tagfrom) { |
113 | int e; | 113 | int e; |
114 | LUA_ENTRY; | 114 | LUA_LOCK; |
115 | checktag(L, tagto); | 115 | checktag(L, tagto); |
116 | checktag(L, tagfrom); | 116 | checktag(L, tagfrom); |
117 | for (e=0; e<TM_N; e++) { | 117 | for (e=0; e<TM_N; e++) { |
118 | if (luaT_validevent(tagto, e)) | 118 | if (luaT_validevent(tagto, e)) |
119 | luaT_gettm(G(L), tagto, e) = luaT_gettm(G(L), tagfrom, e); | 119 | luaT_gettm(G(L), tagto, e) = luaT_gettm(G(L), tagfrom, e); |
120 | } | 120 | } |
121 | LUA_EXIT; | 121 | LUA_UNLOCK; |
122 | return tagto; | 122 | return tagto; |
123 | } | 123 | } |
124 | 124 | ||
@@ -156,7 +156,7 @@ const char *luaT_typename (global_State *G, const TObject *o) { | |||
156 | 156 | ||
157 | LUA_API void lua_gettagmethod (lua_State *L, int t, const char *event) { | 157 | LUA_API void lua_gettagmethod (lua_State *L, int t, const char *event) { |
158 | int e; | 158 | int e; |
159 | LUA_ENTRY; | 159 | LUA_LOCK; |
160 | e = luaI_checkevent(L, event, t); | 160 | e = luaI_checkevent(L, event, t); |
161 | checktag(L, t); | 161 | checktag(L, t); |
162 | if (luaT_validevent(t, e) && luaT_gettm(G(L), t, e)) { | 162 | if (luaT_validevent(t, e) && luaT_gettm(G(L), t, e)) { |
@@ -165,13 +165,13 @@ LUA_API void lua_gettagmethod (lua_State *L, int t, const char *event) { | |||
165 | else | 165 | else |
166 | setnilvalue(L->top); | 166 | setnilvalue(L->top); |
167 | incr_top; | 167 | incr_top; |
168 | LUA_EXIT; | 168 | LUA_UNLOCK; |
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
172 | LUA_API void lua_settagmethod (lua_State *L, int t, const char *event) { | 172 | LUA_API void lua_settagmethod (lua_State *L, int t, const char *event) { |
173 | int e; | 173 | int e; |
174 | LUA_ENTRY; | 174 | LUA_LOCK; |
175 | e = luaI_checkevent(L, event, t); | 175 | e = luaI_checkevent(L, event, t); |
176 | checktag(L, t); | 176 | checktag(L, t); |
177 | if (!luaT_validevent(t, e)) | 177 | if (!luaT_validevent(t, e)) |
@@ -190,6 +190,6 @@ LUA_API void lua_settagmethod (lua_State *L, int t, const char *event) { | |||
190 | luaD_error(L, "tag method must be a function (or nil)"); | 190 | luaD_error(L, "tag method must be a function (or nil)"); |
191 | } | 191 | } |
192 | L->top--; | 192 | L->top--; |
193 | LUA_EXIT; | 193 | LUA_UNLOCK; |
194 | } | 194 | } |
195 | 195 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.56 2001/01/10 16:58:11 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.57 2001/01/22 18:01:38 roberto Exp roberto $ |
3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -16,17 +16,27 @@ | |||
16 | #include "lualib.h" | 16 | #include "lualib.h" |
17 | 17 | ||
18 | 18 | ||
19 | static lua_State *L = NULL; | 19 | #ifdef _POSIX_SOURCE |
20 | #include <unistd.h> | ||
21 | #else | ||
22 | static int isatty (int x) { return x==0; } /* assume stdin is a tty */ | ||
23 | #endif | ||
24 | |||
20 | 25 | ||
21 | 26 | ||
22 | #ifndef PROMPT | 27 | #ifndef PROMPT |
23 | #define PROMPT "> " | 28 | #define PROMPT "> " |
24 | #endif | 29 | #endif |
25 | 30 | ||
26 | #ifdef _POSIX_SOURCE | 31 | |
27 | #include <unistd.h> | 32 | #ifndef LUA_USERINIT |
28 | #else | 33 | #define LUA_USERINIT(L) (lua_baselibopen(L), lua_iolibopen(L), \ |
29 | static int isatty (int x) { return x==0; } /* assume stdin is a tty */ | 34 | lua_strlibopen(L), lua_mathlibopen(L), lua_dblibopen(L)) |
35 | #endif | ||
36 | |||
37 | |||
38 | #ifndef LUA_USERFINI | ||
39 | #define LUA_USERFINI | ||
30 | #endif | 40 | #endif |
31 | 41 | ||
32 | 42 | ||
@@ -39,6 +49,9 @@ struct Options { | |||
39 | }; | 49 | }; |
40 | 50 | ||
41 | 51 | ||
52 | static lua_State *L = NULL; | ||
53 | |||
54 | |||
42 | typedef void (*handler)(int); /* type for signal actions */ | 55 | typedef void (*handler)(int); /* type for signal actions */ |
43 | 56 | ||
44 | static void laction (int i); | 57 | static void laction (int i); |
@@ -48,15 +61,6 @@ static lua_Hook old_linehook = NULL; | |||
48 | static lua_Hook old_callhook = NULL; | 61 | static lua_Hook old_callhook = NULL; |
49 | 62 | ||
50 | 63 | ||
51 | static void userinit (void) { | ||
52 | lua_baselibopen(L); | ||
53 | lua_iolibopen(L); | ||
54 | lua_strlibopen(L); | ||
55 | lua_mathlibopen(L); | ||
56 | lua_dblibopen(L); | ||
57 | /* add your libraries here */ | ||
58 | } | ||
59 | |||
60 | 64 | ||
61 | static handler lreset (void) { | 65 | static handler lreset (void) { |
62 | return signal(SIGINT, laction); | 66 | return signal(SIGINT, laction); |
@@ -312,7 +316,7 @@ int main (int argc, char *argv[]) { | |||
312 | opt.toclose = 0; | 316 | opt.toclose = 0; |
313 | getstacksize(argc, argv, &opt); /* handle option `-s' */ | 317 | getstacksize(argc, argv, &opt); /* handle option `-s' */ |
314 | L = lua_open(NULL, opt.stacksize); /* create state */ | 318 | L = lua_open(NULL, opt.stacksize); /* create state */ |
315 | userinit(); /* open libraries */ | 319 | LUA_USERINIT(L); /* open libraries */ |
316 | register_getargs(argv); /* create `getargs' function */ | 320 | register_getargs(argv); /* create `getargs' function */ |
317 | status = handle_argv(argv+1, &opt); | 321 | status = handle_argv(argv+1, &opt); |
318 | if (opt.toclose) | 322 | if (opt.toclose) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.83 2001/01/22 18:01:38 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.84 2001/01/25 16:45:36 roberto Exp roberto $ |
3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil | 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil |
5 | ** e-mail: lua@tecgraf.puc-rio.br | 5 | ** e-mail: lua@tecgraf.puc-rio.br |
@@ -16,11 +16,6 @@ | |||
16 | #include <stddef.h> | 16 | #include <stddef.h> |
17 | 17 | ||
18 | 18 | ||
19 | /* mark for all API functions */ | ||
20 | #ifndef LUA_API | ||
21 | #define LUA_API extern | ||
22 | #endif | ||
23 | |||
24 | 19 | ||
25 | #define LUA_VERSION "Lua 4.1 (work)" | 20 | #define LUA_VERSION "Lua 4.1 (work)" |
26 | #define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio" | 21 | #define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio" |
@@ -77,6 +72,21 @@ typedef int (*lua_CFunction) (lua_State *L); | |||
77 | #define LUA_TFUNCTION 5 | 72 | #define LUA_TFUNCTION 5 |
78 | 73 | ||
79 | 74 | ||
75 | /* | ||
76 | ** generic extra include file | ||
77 | */ | ||
78 | #ifdef LUA_USER_H | ||
79 | #include LUA_USER_H | ||
80 | #endif | ||
81 | |||
82 | |||
83 | |||
84 | /* mark for all API functions */ | ||
85 | #ifndef LUA_API | ||
86 | #define LUA_API extern | ||
87 | #endif | ||
88 | |||
89 | |||
80 | 90 | ||
81 | /* | 91 | /* |
82 | ** state manipulation | 92 | ** state manipulation |