diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-12-03 18:50:25 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-12-03 18:50:25 -0200 |
commit | c78940f21a956064ac79f715af072e283538f35c (patch) | |
tree | 5a879991ef8d68bbfd437f35ab1da8b761bf9f14 | |
parent | 8b239eeba13877955b976ccd119ada038b67fa59 (diff) | |
download | lua-c78940f21a956064ac79f715af072e283538f35c.tar.gz lua-c78940f21a956064ac79f715af072e283538f35c.tar.bz2 lua-c78940f21a956064ac79f715af072e283538f35c.zip |
static names do not need `luaX_' prefix
-rw-r--r-- | lapi.c | 82 | ||||
-rw-r--r-- | lcode.c | 50 | ||||
-rw-r--r-- | ldebug.c | 8 | ||||
-rw-r--r-- | ldo.c | 6 | ||||
-rw-r--r-- | lparser.c | 8 | ||||
-rw-r--r-- | ltable.c | 6 | ||||
-rw-r--r-- | lvm.c | 12 |
7 files changed, 86 insertions, 86 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.19 2004/09/15 20:39:42 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.20 2004/11/24 18:55:56 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 | */ |
@@ -45,7 +45,7 @@ const char lua_ident[] = | |||
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | static TValue *luaA_index (lua_State *L, int idx) { | 48 | static TValue *index2adr (lua_State *L, int idx) { |
49 | if (idx > 0) { | 49 | if (idx > 0) { |
50 | TValue *o = L->base + (idx - 1); | 50 | TValue *o = L->base + (idx - 1); |
51 | api_check(L, idx <= L->ci->top - L->base); | 51 | api_check(L, idx <= L->ci->top - L->base); |
@@ -160,7 +160,7 @@ LUA_API void lua_settop (lua_State *L, int idx) { | |||
160 | LUA_API void lua_remove (lua_State *L, int idx) { | 160 | LUA_API void lua_remove (lua_State *L, int idx) { |
161 | StkId p; | 161 | StkId p; |
162 | lua_lock(L); | 162 | lua_lock(L); |
163 | p = luaA_index(L, idx); | 163 | p = index2adr(L, idx); |
164 | api_checkvalidindex(L, p); | 164 | api_checkvalidindex(L, p); |
165 | while (++p < L->top) setobjs2s(L, p-1, p); | 165 | while (++p < L->top) setobjs2s(L, p-1, p); |
166 | L->top--; | 166 | L->top--; |
@@ -172,7 +172,7 @@ LUA_API void lua_insert (lua_State *L, int idx) { | |||
172 | StkId p; | 172 | StkId p; |
173 | StkId q; | 173 | StkId q; |
174 | lua_lock(L); | 174 | lua_lock(L); |
175 | p = luaA_index(L, idx); | 175 | p = index2adr(L, idx); |
176 | api_checkvalidindex(L, p); | 176 | api_checkvalidindex(L, p); |
177 | for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); | 177 | for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); |
178 | setobjs2s(L, p, L->top); | 178 | setobjs2s(L, p, L->top); |
@@ -184,7 +184,7 @@ LUA_API void lua_replace (lua_State *L, int idx) { | |||
184 | StkId o; | 184 | StkId o; |
185 | lua_lock(L); | 185 | lua_lock(L); |
186 | api_checknelems(L, 1); | 186 | api_checknelems(L, 1); |
187 | o = luaA_index(L, idx); | 187 | o = index2adr(L, idx); |
188 | api_checkvalidindex(L, o); | 188 | api_checkvalidindex(L, o); |
189 | setobj(L, o, L->top - 1); | 189 | setobj(L, o, L->top - 1); |
190 | if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ | 190 | if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ |
@@ -196,7 +196,7 @@ LUA_API void lua_replace (lua_State *L, int idx) { | |||
196 | 196 | ||
197 | LUA_API void lua_pushvalue (lua_State *L, int idx) { | 197 | LUA_API void lua_pushvalue (lua_State *L, int idx) { |
198 | lua_lock(L); | 198 | lua_lock(L); |
199 | setobj2s(L, L->top, luaA_index(L, idx)); | 199 | setobj2s(L, L->top, index2adr(L, idx)); |
200 | api_incr_top(L); | 200 | api_incr_top(L); |
201 | lua_unlock(L); | 201 | lua_unlock(L); |
202 | } | 202 | } |
@@ -209,7 +209,7 @@ LUA_API void lua_pushvalue (lua_State *L, int idx) { | |||
209 | 209 | ||
210 | 210 | ||
211 | LUA_API int lua_type (lua_State *L, int idx) { | 211 | LUA_API int lua_type (lua_State *L, int idx) { |
212 | StkId o = luaA_index(L, idx); | 212 | StkId o = index2adr(L, idx); |
213 | return (o == &luaO_nilobject) ? LUA_TNONE : ttype(o); | 213 | return (o == &luaO_nilobject) ? LUA_TNONE : ttype(o); |
214 | } | 214 | } |
215 | 215 | ||
@@ -221,14 +221,14 @@ LUA_API const char *lua_typename (lua_State *L, int t) { | |||
221 | 221 | ||
222 | 222 | ||
223 | LUA_API int lua_iscfunction (lua_State *L, int idx) { | 223 | LUA_API int lua_iscfunction (lua_State *L, int idx) { |
224 | StkId o = luaA_index(L, idx); | 224 | StkId o = index2adr(L, idx); |
225 | return iscfunction(o); | 225 | return iscfunction(o); |
226 | } | 226 | } |
227 | 227 | ||
228 | 228 | ||
229 | LUA_API int lua_isnumber (lua_State *L, int idx) { | 229 | LUA_API int lua_isnumber (lua_State *L, int idx) { |
230 | TValue n; | 230 | TValue n; |
231 | const TValue *o = luaA_index(L, idx); | 231 | const TValue *o = index2adr(L, idx); |
232 | return tonumber(o, &n); | 232 | return tonumber(o, &n); |
233 | } | 233 | } |
234 | 234 | ||
@@ -240,14 +240,14 @@ LUA_API int lua_isstring (lua_State *L, int idx) { | |||
240 | 240 | ||
241 | 241 | ||
242 | LUA_API int lua_isuserdata (lua_State *L, int idx) { | 242 | LUA_API int lua_isuserdata (lua_State *L, int idx) { |
243 | const TValue *o = luaA_index(L, idx); | 243 | const TValue *o = index2adr(L, idx); |
244 | return (ttisuserdata(o) || ttislightuserdata(o)); | 244 | return (ttisuserdata(o) || ttislightuserdata(o)); |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { | 248 | LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { |
249 | StkId o1 = luaA_index(L, index1); | 249 | StkId o1 = index2adr(L, index1); |
250 | StkId o2 = luaA_index(L, index2); | 250 | StkId o2 = index2adr(L, index2); |
251 | return (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 | 251 | return (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 |
252 | : luaO_rawequalObj(o1, o2); | 252 | : luaO_rawequalObj(o1, o2); |
253 | } | 253 | } |
@@ -257,8 +257,8 @@ LUA_API int lua_equal (lua_State *L, int index1, int index2) { | |||
257 | StkId o1, o2; | 257 | StkId o1, o2; |
258 | int i; | 258 | int i; |
259 | lua_lock(L); /* may call tag method */ | 259 | lua_lock(L); /* may call tag method */ |
260 | o1 = luaA_index(L, index1); | 260 | o1 = index2adr(L, index1); |
261 | o2 = luaA_index(L, index2); | 261 | o2 = index2adr(L, index2); |
262 | i = (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 | 262 | i = (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 |
263 | : equalobj(L, o1, o2); | 263 | : equalobj(L, o1, o2); |
264 | lua_unlock(L); | 264 | lua_unlock(L); |
@@ -270,8 +270,8 @@ LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { | |||
270 | StkId o1, o2; | 270 | StkId o1, o2; |
271 | int i; | 271 | int i; |
272 | lua_lock(L); /* may call tag method */ | 272 | lua_lock(L); /* may call tag method */ |
273 | o1 = luaA_index(L, index1); | 273 | o1 = index2adr(L, index1); |
274 | o2 = luaA_index(L, index2); | 274 | o2 = index2adr(L, index2); |
275 | i = (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 | 275 | i = (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 |
276 | : luaV_lessthan(L, o1, o2); | 276 | : luaV_lessthan(L, o1, o2); |
277 | lua_unlock(L); | 277 | lua_unlock(L); |
@@ -282,7 +282,7 @@ LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { | |||
282 | 282 | ||
283 | LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { | 283 | LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { |
284 | TValue n; | 284 | TValue n; |
285 | const TValue *o = luaA_index(L, idx); | 285 | const TValue *o = index2adr(L, idx); |
286 | if (tonumber(o, &n)) | 286 | if (tonumber(o, &n)) |
287 | return nvalue(o); | 287 | return nvalue(o); |
288 | else | 288 | else |
@@ -292,7 +292,7 @@ LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { | |||
292 | 292 | ||
293 | LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { | 293 | LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { |
294 | TValue n; | 294 | TValue n; |
295 | const TValue *o = luaA_index(L, idx); | 295 | const TValue *o = index2adr(L, idx); |
296 | if (tonumber(o, &n)) { | 296 | if (tonumber(o, &n)) { |
297 | lua_Integer res; | 297 | lua_Integer res; |
298 | lua_number2integer(res, nvalue(o)); | 298 | lua_number2integer(res, nvalue(o)); |
@@ -304,13 +304,13 @@ LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { | |||
304 | 304 | ||
305 | 305 | ||
306 | LUA_API int lua_toboolean (lua_State *L, int idx) { | 306 | LUA_API int lua_toboolean (lua_State *L, int idx) { |
307 | const TValue *o = luaA_index(L, idx); | 307 | const TValue *o = index2adr(L, idx); |
308 | return !l_isfalse(o); | 308 | return !l_isfalse(o); |
309 | } | 309 | } |
310 | 310 | ||
311 | 311 | ||
312 | LUA_API const char *lua_tostring (lua_State *L, int idx) { | 312 | LUA_API const char *lua_tostring (lua_State *L, int idx) { |
313 | StkId o = luaA_index(L, idx); | 313 | StkId o = index2adr(L, idx); |
314 | if (ttisstring(o)) | 314 | if (ttisstring(o)) |
315 | return svalue(o); | 315 | return svalue(o); |
316 | else { | 316 | else { |
@@ -325,7 +325,7 @@ LUA_API const char *lua_tostring (lua_State *L, int idx) { | |||
325 | 325 | ||
326 | 326 | ||
327 | LUA_API size_t lua_objsize (lua_State *L, int idx) { | 327 | LUA_API size_t lua_objsize (lua_State *L, int idx) { |
328 | StkId o = luaA_index(L, idx); | 328 | StkId o = index2adr(L, idx); |
329 | if (ttisstring(o)) | 329 | if (ttisstring(o)) |
330 | return tsvalue(o)->len; | 330 | return tsvalue(o)->len; |
331 | else if (ttisuserdata(o)) | 331 | else if (ttisuserdata(o)) |
@@ -341,13 +341,13 @@ LUA_API size_t lua_objsize (lua_State *L, int idx) { | |||
341 | 341 | ||
342 | 342 | ||
343 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { | 343 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { |
344 | StkId o = luaA_index(L, idx); | 344 | StkId o = index2adr(L, idx); |
345 | return (!iscfunction(o)) ? NULL : clvalue(o)->c.f; | 345 | return (!iscfunction(o)) ? NULL : clvalue(o)->c.f; |
346 | } | 346 | } |
347 | 347 | ||
348 | 348 | ||
349 | LUA_API void *lua_touserdata (lua_State *L, int idx) { | 349 | LUA_API void *lua_touserdata (lua_State *L, int idx) { |
350 | StkId o = luaA_index(L, idx); | 350 | StkId o = index2adr(L, idx); |
351 | switch (ttype(o)) { | 351 | switch (ttype(o)) { |
352 | case LUA_TUSERDATA: return (rawuvalue(o) + 1); | 352 | case LUA_TUSERDATA: return (rawuvalue(o) + 1); |
353 | case LUA_TLIGHTUSERDATA: return pvalue(o); | 353 | case LUA_TLIGHTUSERDATA: return pvalue(o); |
@@ -357,13 +357,13 @@ LUA_API void *lua_touserdata (lua_State *L, int idx) { | |||
357 | 357 | ||
358 | 358 | ||
359 | LUA_API lua_State *lua_tothread (lua_State *L, int idx) { | 359 | LUA_API lua_State *lua_tothread (lua_State *L, int idx) { |
360 | StkId o = luaA_index(L, idx); | 360 | StkId o = index2adr(L, idx); |
361 | return (!ttisthread(o)) ? NULL : thvalue(o); | 361 | return (!ttisthread(o)) ? NULL : thvalue(o); |
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
365 | LUA_API const void *lua_topointer (lua_State *L, int idx) { | 365 | LUA_API const void *lua_topointer (lua_State *L, int idx) { |
366 | StkId o = luaA_index(L, idx); | 366 | StkId o = index2adr(L, idx); |
367 | switch (ttype(o)) { | 367 | switch (ttype(o)) { |
368 | case LUA_TTABLE: return hvalue(o); | 368 | case LUA_TTABLE: return hvalue(o); |
369 | case LUA_TFUNCTION: return clvalue(o); | 369 | case LUA_TFUNCTION: return clvalue(o); |
@@ -498,7 +498,7 @@ LUA_API int lua_pushthread (lua_State *L) { | |||
498 | LUA_API void lua_gettable (lua_State *L, int idx) { | 498 | LUA_API void lua_gettable (lua_State *L, int idx) { |
499 | StkId t; | 499 | StkId t; |
500 | lua_lock(L); | 500 | lua_lock(L); |
501 | t = luaA_index(L, idx); | 501 | t = index2adr(L, idx); |
502 | api_checkvalidindex(L, t); | 502 | api_checkvalidindex(L, t); |
503 | luaV_gettable(L, t, L->top - 1, L->top - 1, NULL); | 503 | luaV_gettable(L, t, L->top - 1, L->top - 1, NULL); |
504 | lua_unlock(L); | 504 | lua_unlock(L); |
@@ -509,7 +509,7 @@ LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { | |||
509 | StkId t; | 509 | StkId t; |
510 | TValue key; | 510 | TValue key; |
511 | lua_lock(L); | 511 | lua_lock(L); |
512 | t = luaA_index(L, idx); | 512 | t = index2adr(L, idx); |
513 | api_checkvalidindex(L, t); | 513 | api_checkvalidindex(L, t); |
514 | setsvalue(L, &key, luaS_new(L, k)); | 514 | setsvalue(L, &key, luaS_new(L, k)); |
515 | luaV_gettable(L, t, &key, L->top, NULL); | 515 | luaV_gettable(L, t, &key, L->top, NULL); |
@@ -521,7 +521,7 @@ LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { | |||
521 | LUA_API void lua_rawget (lua_State *L, int idx) { | 521 | LUA_API void lua_rawget (lua_State *L, int idx) { |
522 | StkId t; | 522 | StkId t; |
523 | lua_lock(L); | 523 | lua_lock(L); |
524 | t = luaA_index(L, idx); | 524 | t = index2adr(L, idx); |
525 | api_check(L, ttistable(t)); | 525 | api_check(L, ttistable(t)); |
526 | setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); | 526 | setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); |
527 | lua_unlock(L); | 527 | lua_unlock(L); |
@@ -531,7 +531,7 @@ LUA_API void lua_rawget (lua_State *L, int idx) { | |||
531 | LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { | 531 | LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { |
532 | StkId o; | 532 | StkId o; |
533 | lua_lock(L); | 533 | lua_lock(L); |
534 | o = luaA_index(L, idx); | 534 | o = index2adr(L, idx); |
535 | api_check(L, ttistable(o)); | 535 | api_check(L, ttistable(o)); |
536 | setobj2s(L, L->top, luaH_getnum(hvalue(o), n)); | 536 | setobj2s(L, L->top, luaH_getnum(hvalue(o), n)); |
537 | api_incr_top(L); | 537 | api_incr_top(L); |
@@ -553,7 +553,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) { | |||
553 | Table *mt = NULL; | 553 | Table *mt = NULL; |
554 | int res; | 554 | int res; |
555 | lua_lock(L); | 555 | lua_lock(L); |
556 | obj = luaA_index(L, objindex); | 556 | obj = index2adr(L, objindex); |
557 | switch (ttype(obj)) { | 557 | switch (ttype(obj)) { |
558 | case LUA_TTABLE: | 558 | case LUA_TTABLE: |
559 | mt = hvalue(obj)->metatable; | 559 | mt = hvalue(obj)->metatable; |
@@ -577,7 +577,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) { | |||
577 | LUA_API void lua_getfenv (lua_State *L, int idx) { | 577 | LUA_API void lua_getfenv (lua_State *L, int idx) { |
578 | StkId o; | 578 | StkId o; |
579 | lua_lock(L); | 579 | lua_lock(L); |
580 | o = luaA_index(L, idx); | 580 | o = index2adr(L, idx); |
581 | api_checkvalidindex(L, o); | 581 | api_checkvalidindex(L, o); |
582 | setobj2s(L, L->top, isLfunction(o) ? &clvalue(o)->l.g : gt(L)); | 582 | setobj2s(L, L->top, isLfunction(o) ? &clvalue(o)->l.g : gt(L)); |
583 | api_incr_top(L); | 583 | api_incr_top(L); |
@@ -594,7 +594,7 @@ LUA_API void lua_settable (lua_State *L, int idx) { | |||
594 | StkId t; | 594 | StkId t; |
595 | lua_lock(L); | 595 | lua_lock(L); |
596 | api_checknelems(L, 2); | 596 | api_checknelems(L, 2); |
597 | t = luaA_index(L, idx); | 597 | t = index2adr(L, idx); |
598 | api_checkvalidindex(L, t); | 598 | api_checkvalidindex(L, t); |
599 | luaV_settable(L, t, L->top - 2, L->top - 1, NULL); | 599 | luaV_settable(L, t, L->top - 2, L->top - 1, NULL); |
600 | L->top -= 2; /* pop index and value */ | 600 | L->top -= 2; /* pop index and value */ |
@@ -607,7 +607,7 @@ LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { | |||
607 | TValue key; | 607 | TValue key; |
608 | lua_lock(L); | 608 | lua_lock(L); |
609 | api_checknelems(L, 1); | 609 | api_checknelems(L, 1); |
610 | t = luaA_index(L, idx); | 610 | t = index2adr(L, idx); |
611 | api_checkvalidindex(L, t); | 611 | api_checkvalidindex(L, t); |
612 | setsvalue(L, &key, luaS_new(L, k)); | 612 | setsvalue(L, &key, luaS_new(L, k)); |
613 | luaV_settable(L, t, &key, L->top - 1, NULL); | 613 | luaV_settable(L, t, &key, L->top - 1, NULL); |
@@ -620,7 +620,7 @@ LUA_API void lua_rawset (lua_State *L, int idx) { | |||
620 | StkId t; | 620 | StkId t; |
621 | lua_lock(L); | 621 | lua_lock(L); |
622 | api_checknelems(L, 2); | 622 | api_checknelems(L, 2); |
623 | t = luaA_index(L, idx); | 623 | t = index2adr(L, idx); |
624 | api_check(L, ttistable(t)); | 624 | api_check(L, ttistable(t)); |
625 | setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); | 625 | setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); |
626 | luaC_barriert(L, hvalue(t), L->top-1); | 626 | luaC_barriert(L, hvalue(t), L->top-1); |
@@ -633,7 +633,7 @@ LUA_API void lua_rawseti (lua_State *L, int idx, int n) { | |||
633 | StkId o; | 633 | StkId o; |
634 | lua_lock(L); | 634 | lua_lock(L); |
635 | api_checknelems(L, 1); | 635 | api_checknelems(L, 1); |
636 | o = luaA_index(L, idx); | 636 | o = index2adr(L, idx); |
637 | api_check(L, ttistable(o)); | 637 | api_check(L, ttistable(o)); |
638 | setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1); | 638 | setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1); |
639 | luaC_barriert(L, hvalue(o), L->top-1); | 639 | luaC_barriert(L, hvalue(o), L->top-1); |
@@ -648,7 +648,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) { | |||
648 | int res = 1; | 648 | int res = 1; |
649 | lua_lock(L); | 649 | lua_lock(L); |
650 | api_checknelems(L, 1); | 650 | api_checknelems(L, 1); |
651 | obj = luaA_index(L, objindex); | 651 | obj = index2adr(L, objindex); |
652 | api_checkvalidindex(L, obj); | 652 | api_checkvalidindex(L, obj); |
653 | if (ttisnil(L->top - 1)) | 653 | if (ttisnil(L->top - 1)) |
654 | mt = NULL; | 654 | mt = NULL; |
@@ -685,7 +685,7 @@ LUA_API int lua_setfenv (lua_State *L, int idx) { | |||
685 | int res = 0; | 685 | int res = 0; |
686 | lua_lock(L); | 686 | lua_lock(L); |
687 | api_checknelems(L, 1); | 687 | api_checknelems(L, 1); |
688 | o = luaA_index(L, idx); | 688 | o = index2adr(L, idx); |
689 | api_checkvalidindex(L, o); | 689 | api_checkvalidindex(L, o); |
690 | api_check(L, ttistable(L->top - 1)); | 690 | api_check(L, ttistable(L->top - 1)); |
691 | if (isLfunction(o)) { | 691 | if (isLfunction(o)) { |
@@ -751,7 +751,7 @@ LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { | |||
751 | if (errfunc == 0) | 751 | if (errfunc == 0) |
752 | func = 0; | 752 | func = 0; |
753 | else { | 753 | else { |
754 | StkId o = luaA_index(L, errfunc); | 754 | StkId o = index2adr(L, errfunc); |
755 | api_checkvalidindex(L, o); | 755 | api_checkvalidindex(L, o); |
756 | func = savestack(L, o); | 756 | func = savestack(L, o); |
757 | } | 757 | } |
@@ -898,7 +898,7 @@ LUA_API int lua_next (lua_State *L, int idx) { | |||
898 | StkId t; | 898 | StkId t; |
899 | int more; | 899 | int more; |
900 | lua_lock(L); | 900 | lua_lock(L); |
901 | t = luaA_index(L, idx); | 901 | t = index2adr(L, idx); |
902 | api_check(L, ttistable(t)); | 902 | api_check(L, ttistable(t)); |
903 | more = luaH_next(L, hvalue(t), L->top - 1); | 903 | more = luaH_next(L, hvalue(t), L->top - 1); |
904 | if (more) { | 904 | if (more) { |
@@ -970,7 +970,7 @@ LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { | |||
970 | const char *name; | 970 | const char *name; |
971 | TValue *val; | 971 | TValue *val; |
972 | lua_lock(L); | 972 | lua_lock(L); |
973 | name = aux_upvalue(L, luaA_index(L, funcindex), n, &val); | 973 | name = aux_upvalue(L, index2adr(L, funcindex), n, &val); |
974 | if (name) { | 974 | if (name) { |
975 | setobj2s(L, L->top, val); | 975 | setobj2s(L, L->top, val); |
976 | api_incr_top(L); | 976 | api_incr_top(L); |
@@ -985,7 +985,7 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { | |||
985 | TValue *val; | 985 | TValue *val; |
986 | StkId fi; | 986 | StkId fi; |
987 | lua_lock(L); | 987 | lua_lock(L); |
988 | fi = luaA_index(L, funcindex); | 988 | fi = index2adr(L, funcindex); |
989 | api_checknelems(L, 1); | 989 | api_checknelems(L, 1); |
990 | name = aux_upvalue(L, fi, n, &val); | 990 | name = aux_upvalue(L, fi, n, &val); |
991 | if (name) { | 991 | if (name) { |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.6 2004/08/24 20:09:11 roberto Exp $ | 2 | ** $Id: lcode.c,v 2.7 2004/10/04 19:01:53 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -53,13 +53,13 @@ int luaK_jump (FuncState *fs) { | |||
53 | } | 53 | } |
54 | 54 | ||
55 | 55 | ||
56 | static int luaK_condjump (FuncState *fs, OpCode op, int A, int B, int C) { | 56 | static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { |
57 | luaK_codeABC(fs, op, A, B, C); | 57 | luaK_codeABC(fs, op, A, B, C); |
58 | return luaK_jump(fs); | 58 | return luaK_jump(fs); |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | static void luaK_fixjump (FuncState *fs, int pc, int dest) { | 62 | static void fixjump (FuncState *fs, int pc, int dest) { |
63 | Instruction *jmp = &fs->f->code[pc]; | 63 | Instruction *jmp = &fs->f->code[pc]; |
64 | int offset = dest-(pc+1); | 64 | int offset = dest-(pc+1); |
65 | lua_assert(dest != NO_JUMP); | 65 | lua_assert(dest != NO_JUMP); |
@@ -79,7 +79,7 @@ int luaK_getlabel (FuncState *fs) { | |||
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | static int luaK_getjump (FuncState *fs, int pc) { | 82 | static int getjump (FuncState *fs, int pc) { |
83 | int offset = GETARG_sBx(fs->f->code[pc]); | 83 | int offset = GETARG_sBx(fs->f->code[pc]); |
84 | if (offset == NO_JUMP) /* point to itself represents end of list */ | 84 | if (offset == NO_JUMP) /* point to itself represents end of list */ |
85 | return NO_JUMP; /* end of list */ | 85 | return NO_JUMP; /* end of list */ |
@@ -102,7 +102,7 @@ static Instruction *getjumpcontrol (FuncState *fs, int pc) { | |||
102 | ** (or produce an inverted value) | 102 | ** (or produce an inverted value) |
103 | */ | 103 | */ |
104 | static int need_value (FuncState *fs, int list, int cond) { | 104 | static int need_value (FuncState *fs, int list, int cond) { |
105 | for (; list != NO_JUMP; list = luaK_getjump(fs, list)) { | 105 | for (; list != NO_JUMP; list = getjump(fs, list)) { |
106 | Instruction i = *getjumpcontrol(fs, list); | 106 | Instruction i = *getjumpcontrol(fs, list); |
107 | if (GET_OPCODE(i) != OP_TEST || GETARG_C(i) != cond) return 1; | 107 | if (GET_OPCODE(i) != OP_TEST || GETARG_C(i) != cond) return 1; |
108 | } | 108 | } |
@@ -116,25 +116,25 @@ static void patchtestreg (Instruction *i, int reg) { | |||
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
119 | static void luaK_patchlistaux (FuncState *fs, int list, | 119 | static void patchlistaux (FuncState *fs, int list, |
120 | int ttarget, int treg, int ftarget, int freg, int dtarget) { | 120 | int ttarget, int treg, int ftarget, int freg, int dtarget) { |
121 | while (list != NO_JUMP) { | 121 | while (list != NO_JUMP) { |
122 | int next = luaK_getjump(fs, list); | 122 | int next = getjump(fs, list); |
123 | Instruction *i = getjumpcontrol(fs, list); | 123 | Instruction *i = getjumpcontrol(fs, list); |
124 | if (GET_OPCODE(*i) != OP_TEST) { | 124 | if (GET_OPCODE(*i) != OP_TEST) { |
125 | lua_assert(dtarget != NO_JUMP); | 125 | lua_assert(dtarget != NO_JUMP); |
126 | luaK_fixjump(fs, list, dtarget); /* jump to default target */ | 126 | fixjump(fs, list, dtarget); /* jump to default target */ |
127 | } | 127 | } |
128 | else { | 128 | else { |
129 | if (GETARG_C(*i)) { | 129 | if (GETARG_C(*i)) { |
130 | lua_assert(ttarget != NO_JUMP); | 130 | lua_assert(ttarget != NO_JUMP); |
131 | patchtestreg(i, treg); | 131 | patchtestreg(i, treg); |
132 | luaK_fixjump(fs, list, ttarget); | 132 | fixjump(fs, list, ttarget); |
133 | } | 133 | } |
134 | else { | 134 | else { |
135 | lua_assert(ftarget != NO_JUMP); | 135 | lua_assert(ftarget != NO_JUMP); |
136 | patchtestreg(i, freg); | 136 | patchtestreg(i, freg); |
137 | luaK_fixjump(fs, list, ftarget); | 137 | fixjump(fs, list, ftarget); |
138 | } | 138 | } |
139 | } | 139 | } |
140 | list = next; | 140 | list = next; |
@@ -142,8 +142,8 @@ static void luaK_patchlistaux (FuncState *fs, int list, | |||
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | static void luaK_dischargejpc (FuncState *fs) { | 145 | static void dischargejpc (FuncState *fs) { |
146 | luaK_patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc, NO_REG, fs->pc); | 146 | patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc, NO_REG, fs->pc); |
147 | fs->jpc = NO_JUMP; | 147 | fs->jpc = NO_JUMP; |
148 | } | 148 | } |
149 | 149 | ||
@@ -153,7 +153,7 @@ void luaK_patchlist (FuncState *fs, int list, int target) { | |||
153 | luaK_patchtohere(fs, list); | 153 | luaK_patchtohere(fs, list); |
154 | else { | 154 | else { |
155 | lua_assert(target < fs->pc); | 155 | lua_assert(target < fs->pc); |
156 | luaK_patchlistaux(fs, list, target, NO_REG, target, NO_REG, target); | 156 | patchlistaux(fs, list, target, NO_REG, target, NO_REG, target); |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
@@ -171,9 +171,9 @@ void luaK_concat (FuncState *fs, int *l1, int l2) { | |||
171 | else { | 171 | else { |
172 | int list = *l1; | 172 | int list = *l1; |
173 | int next; | 173 | int next; |
174 | while ((next = luaK_getjump(fs, list)) != NO_JUMP) /* find last element */ | 174 | while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ |
175 | list = next; | 175 | list = next; |
176 | luaK_fixjump(fs, list, l2); | 176 | fixjump(fs, list, l2); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
@@ -365,7 +365,7 @@ static void discharge2anyreg (FuncState *fs, expdesc *e) { | |||
365 | } | 365 | } |
366 | 366 | ||
367 | 367 | ||
368 | static void luaK_exp2reg (FuncState *fs, expdesc *e, int reg) { | 368 | static void exp2reg (FuncState *fs, expdesc *e, int reg) { |
369 | discharge2reg(fs, e, reg); | 369 | discharge2reg(fs, e, reg); |
370 | if (e->k == VJMP) | 370 | if (e->k == VJMP) |
371 | luaK_concat(fs, &e->t, e->info); /* put this jump in `t' list */ | 371 | luaK_concat(fs, &e->t, e->info); /* put this jump in `t' list */ |
@@ -382,8 +382,8 @@ static void luaK_exp2reg (FuncState *fs, expdesc *e, int reg) { | |||
382 | luaK_patchtohere(fs, fj); | 382 | luaK_patchtohere(fs, fj); |
383 | } | 383 | } |
384 | final = luaK_getlabel(fs); | 384 | final = luaK_getlabel(fs); |
385 | luaK_patchlistaux(fs, e->f, p_f, NO_REG, final, reg, p_f); | 385 | patchlistaux(fs, e->f, p_f, NO_REG, final, reg, p_f); |
386 | luaK_patchlistaux(fs, e->t, final, reg, p_t, NO_REG, p_t); | 386 | patchlistaux(fs, e->t, final, reg, p_t, NO_REG, p_t); |
387 | } | 387 | } |
388 | e->f = e->t = NO_JUMP; | 388 | e->f = e->t = NO_JUMP; |
389 | e->info = reg; | 389 | e->info = reg; |
@@ -395,7 +395,7 @@ void luaK_exp2nextreg (FuncState *fs, expdesc *e) { | |||
395 | luaK_dischargevars(fs, e); | 395 | luaK_dischargevars(fs, e); |
396 | freeexp(fs, e); | 396 | freeexp(fs, e); |
397 | luaK_reserveregs(fs, 1); | 397 | luaK_reserveregs(fs, 1); |
398 | luaK_exp2reg(fs, e, fs->freereg - 1); | 398 | exp2reg(fs, e, fs->freereg - 1); |
399 | } | 399 | } |
400 | 400 | ||
401 | 401 | ||
@@ -404,7 +404,7 @@ int luaK_exp2anyreg (FuncState *fs, expdesc *e) { | |||
404 | if (e->k == VNONRELOC) { | 404 | if (e->k == VNONRELOC) { |
405 | if (!hasjumps(e)) return e->info; /* exp is already in a register */ | 405 | if (!hasjumps(e)) return e->info; /* exp is already in a register */ |
406 | if (e->info >= fs->nactvar) { /* reg. is not a local? */ | 406 | if (e->info >= fs->nactvar) { /* reg. is not a local? */ |
407 | luaK_exp2reg(fs, e, e->info); /* put value on it */ | 407 | exp2reg(fs, e, e->info); /* put value on it */ |
408 | return e->info; | 408 | return e->info; |
409 | } | 409 | } |
410 | } | 410 | } |
@@ -450,7 +450,7 @@ void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { | |||
450 | switch (var->k) { | 450 | switch (var->k) { |
451 | case VLOCAL: { | 451 | case VLOCAL: { |
452 | freeexp(fs, ex); | 452 | freeexp(fs, ex); |
453 | luaK_exp2reg(fs, ex, var->info); | 453 | exp2reg(fs, ex, var->info); |
454 | return; | 454 | return; |
455 | } | 455 | } |
456 | case VUPVAL: { | 456 | case VUPVAL: { |
@@ -502,13 +502,13 @@ static int jumponcond (FuncState *fs, expdesc *e, int cond) { | |||
502 | Instruction ie = getcode(fs, e); | 502 | Instruction ie = getcode(fs, e); |
503 | if (GET_OPCODE(ie) == OP_NOT) { | 503 | if (GET_OPCODE(ie) == OP_NOT) { |
504 | fs->pc--; /* remove previous OP_NOT */ | 504 | fs->pc--; /* remove previous OP_NOT */ |
505 | return luaK_condjump(fs, OP_TEST, NO_REG, GETARG_B(ie), !cond); | 505 | return condjump(fs, OP_TEST, NO_REG, GETARG_B(ie), !cond); |
506 | } | 506 | } |
507 | /* else go through */ | 507 | /* else go through */ |
508 | } | 508 | } |
509 | discharge2anyreg(fs, e); | 509 | discharge2anyreg(fs, e); |
510 | freeexp(fs, e); | 510 | freeexp(fs, e); |
511 | return luaK_condjump(fs, OP_TEST, NO_REG, e->info, cond); | 511 | return condjump(fs, OP_TEST, NO_REG, e->info, cond); |
512 | } | 512 | } |
513 | 513 | ||
514 | 514 | ||
@@ -660,7 +660,7 @@ static void codebinop (FuncState *fs, expdesc *res, BinOpr op, | |||
660 | temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ | 660 | temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ |
661 | } | 661 | } |
662 | else if (op == OPR_NE) cond = 0; | 662 | else if (op == OPR_NE) cond = 0; |
663 | res->info = luaK_condjump(fs, ops[op - OPR_NE], cond, o1, o2); | 663 | res->info = condjump(fs, ops[op - OPR_NE], cond, o1, o2); |
664 | res->k = VJMP; | 664 | res->k = VJMP; |
665 | } | 665 | } |
666 | } | 666 | } |
@@ -717,7 +717,7 @@ void luaK_fixline (FuncState *fs, int line) { | |||
717 | 717 | ||
718 | int luaK_code (FuncState *fs, Instruction i, int line) { | 718 | int luaK_code (FuncState *fs, Instruction i, int line) { |
719 | Proto *f = fs->f; | 719 | Proto *f = fs->f; |
720 | luaK_dischargejpc(fs); /* `pc' will change */ | 720 | dischargejpc(fs); /* `pc' will change */ |
721 | /* put new instruction in code array */ | 721 | /* put new instruction in code array */ |
722 | luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction, | 722 | luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction, |
723 | MAX_INT, "code size overflow"); | 723 | MAX_INT, "code size overflow"); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 2.9 2004/10/04 19:04:34 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.10 2004/10/07 17:27:00 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 | */ |
@@ -284,7 +284,7 @@ static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) { | |||
284 | } | 284 | } |
285 | 285 | ||
286 | 286 | ||
287 | static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { | 287 | static Instruction symbexec (const Proto *pt, int lastpc, int reg) { |
288 | int pc; | 288 | int pc; |
289 | int last; /* stores position of last instruction that changed `reg' */ | 289 | int last; /* stores position of last instruction that changed `reg' */ |
290 | last = pt->sizecode-1; /* points to final return (a `neutral' instruction) */ | 290 | last = pt->sizecode-1; /* points to final return (a `neutral' instruction) */ |
@@ -434,7 +434,7 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { | |||
434 | 434 | ||
435 | 435 | ||
436 | int luaG_checkcode (const Proto *pt) { | 436 | int luaG_checkcode (const Proto *pt) { |
437 | return (luaG_symbexec(pt, pt->sizecode, NO_REG) != 0); | 437 | return (symbexec(pt, pt->sizecode, NO_REG) != 0); |
438 | } | 438 | } |
439 | 439 | ||
440 | 440 | ||
@@ -454,7 +454,7 @@ static const char *getobjname (CallInfo *ci, int stackpos, const char **name) { | |||
454 | *name = luaF_getlocalname(p, stackpos+1, pc); | 454 | *name = luaF_getlocalname(p, stackpos+1, pc); |
455 | if (*name) /* is a local? */ | 455 | if (*name) /* is a local? */ |
456 | return "local"; | 456 | return "local"; |
457 | i = luaG_symbexec(p, pc, stackpos); /* try symbolic execution */ | 457 | i = symbexec(p, pc, stackpos); /* try symbolic execution */ |
458 | lua_assert(pc != -1); | 458 | lua_assert(pc != -1); |
459 | switch (GET_OPCODE(i)) { | 459 | switch (GET_OPCODE(i)) { |
460 | case OP_GETGLOBAL: { | 460 | case OP_GETGLOBAL: { |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.11 2004/09/22 12:37:52 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.12 2004/12/01 15:52:54 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 | */ |
@@ -147,7 +147,7 @@ void luaD_growstack (lua_State *L, int n) { | |||
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | static CallInfo *luaD_growCI (lua_State *L) { | 150 | static CallInfo *growCI (lua_State *L) { |
151 | if (L->size_ci > LUA_MAXCALLS) /* overflow while handling overflow? */ | 151 | if (L->size_ci > LUA_MAXCALLS) /* overflow while handling overflow? */ |
152 | luaD_throw(L, LUA_ERRERR); | 152 | luaD_throw(L, LUA_ERRERR); |
153 | else { | 153 | else { |
@@ -238,7 +238,7 @@ static StkId tryfuncTM (lua_State *L, StkId func) { | |||
238 | 238 | ||
239 | 239 | ||
240 | #define inc_ci(L) \ | 240 | #define inc_ci(L) \ |
241 | ((L->ci == L->end_ci) ? luaD_growCI(L) : \ | 241 | ((L->ci == L->end_ci) ? growCI(L) : \ |
242 | (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci)) | 242 | (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci)) |
243 | 243 | ||
244 | 244 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.8 2004/12/03 20:35:33 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.9 2004/12/03 20:44:19 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -423,7 +423,7 @@ static void field (LexState *ls, expdesc *v) { | |||
423 | } | 423 | } |
424 | 424 | ||
425 | 425 | ||
426 | static void luaY_index (LexState *ls, expdesc *v) { | 426 | static void yindex (LexState *ls, expdesc *v) { |
427 | /* index -> '[' expr ']' */ | 427 | /* index -> '[' expr ']' */ |
428 | next(ls); /* skip the '[' */ | 428 | next(ls); /* skip the '[' */ |
429 | expr(ls, v); | 429 | expr(ls, v); |
@@ -459,7 +459,7 @@ static void recfield (LexState *ls, struct ConsControl *cc) { | |||
459 | checkname(ls, &key); | 459 | checkname(ls, &key); |
460 | } | 460 | } |
461 | else /* ls->t.token == '[' */ | 461 | else /* ls->t.token == '[' */ |
462 | luaY_index(ls, &key); | 462 | yindex(ls, &key); |
463 | check(ls, '='); | 463 | check(ls, '='); |
464 | luaK_exp2RK(fs, &key); | 464 | luaK_exp2RK(fs, &key); |
465 | expr(ls, &val); | 465 | expr(ls, &val); |
@@ -706,7 +706,7 @@ static void primaryexp (LexState *ls, expdesc *v) { | |||
706 | case '[': { /* `[' exp1 `]' */ | 706 | case '[': { /* `[' exp1 `]' */ |
707 | expdesc key; | 707 | expdesc key; |
708 | luaK_exp2anyreg(fs, v); | 708 | luaK_exp2anyreg(fs, v); |
709 | luaY_index(ls, &key); | 709 | yindex(ls, &key); |
710 | luaK_indexed(fs, v, &key); | 710 | luaK_indexed(fs, v, &key); |
711 | break; | 711 | break; |
712 | } | 712 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 2.9 2004/11/24 19:16:03 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.10 2004/11/24 19:20:21 roberto Exp roberto $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -124,7 +124,7 @@ static int arrayindex (const TValue *key) { | |||
124 | ** elements in the array part, then elements in the hash part. The | 124 | ** elements in the array part, then elements in the hash part. The |
125 | ** beginning and end of a traversal are signalled by -1. | 125 | ** beginning and end of a traversal are signalled by -1. |
126 | */ | 126 | */ |
127 | static int luaH_index (lua_State *L, Table *t, StkId key) { | 127 | static int findindex (lua_State *L, Table *t, StkId key) { |
128 | int i; | 128 | int i; |
129 | if (ttisnil(key)) return -1; /* first iteration */ | 129 | if (ttisnil(key)) return -1; /* first iteration */ |
130 | i = arrayindex(key); | 130 | i = arrayindex(key); |
@@ -142,7 +142,7 @@ static int luaH_index (lua_State *L, Table *t, StkId key) { | |||
142 | 142 | ||
143 | 143 | ||
144 | int luaH_next (lua_State *L, Table *t, StkId key) { | 144 | int luaH_next (lua_State *L, Table *t, StkId key) { |
145 | int i = luaH_index(L, t, key); /* find original element */ | 145 | int i = findindex(L, t, key); /* find original element */ |
146 | for (i++; i < t->sizearray; i++) { /* try first array part */ | 146 | for (i++; i < t->sizearray; i++) { /* try first array part */ |
147 | if (!ttisnil(&t->array[i])) { /* a non-nil value? */ | 147 | if (!ttisnil(&t->array[i])) { /* a non-nil value? */ |
148 | setnvalue(key, cast(lua_Number, i+1)); | 148 | setnvalue(key, cast(lua_Number, i+1)); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.16 2004/10/28 17:45:51 roberto Exp $ | 2 | ** $Id: lvm.c,v 2.17 2004/11/01 15:06:50 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -214,7 +214,7 @@ static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, | |||
214 | } | 214 | } |
215 | 215 | ||
216 | 216 | ||
217 | static int luaV_strcmp (const TString *ls, const TString *rs) { | 217 | static int l_strcmp (const TString *ls, const TString *rs) { |
218 | const char *l = getstr(ls); | 218 | const char *l = getstr(ls); |
219 | size_t ll = ls->tsv.len; | 219 | size_t ll = ls->tsv.len; |
220 | const char *r = getstr(rs); | 220 | const char *r = getstr(rs); |
@@ -243,21 +243,21 @@ int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { | |||
243 | else if (ttisnumber(l)) | 243 | else if (ttisnumber(l)) |
244 | return nvalue(l) < nvalue(r); | 244 | return nvalue(l) < nvalue(r); |
245 | else if (ttisstring(l)) | 245 | else if (ttisstring(l)) |
246 | return luaV_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; | 246 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; |
247 | else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) | 247 | else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) |
248 | return res; | 248 | return res; |
249 | return luaG_ordererror(L, l, r); | 249 | return luaG_ordererror(L, l, r); |
250 | } | 250 | } |
251 | 251 | ||
252 | 252 | ||
253 | static int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) { | 253 | static int lessequal (lua_State *L, const TValue *l, const TValue *r) { |
254 | int res; | 254 | int res; |
255 | if (ttype(l) != ttype(r)) | 255 | if (ttype(l) != ttype(r)) |
256 | return luaG_ordererror(L, l, r); | 256 | return luaG_ordererror(L, l, r); |
257 | else if (ttisnumber(l)) | 257 | else if (ttisnumber(l)) |
258 | return nvalue(l) <= nvalue(r); | 258 | return nvalue(l) <= nvalue(r); |
259 | else if (ttisstring(l)) | 259 | else if (ttisstring(l)) |
260 | return luaV_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; | 260 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; |
261 | else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ | 261 | else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ |
262 | return res; | 262 | return res; |
263 | else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */ | 263 | else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */ |
@@ -568,7 +568,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
568 | } | 568 | } |
569 | case OP_LE: { | 569 | case OP_LE: { |
570 | L->ci->savedpc = pc; | 570 | L->ci->savedpc = pc; |
571 | if (luaV_lessequal(L, RKB(i), RKC(i)) != GETARG_A(i)) pc++; /***/ | 571 | if (lessequal(L, RKB(i), RKC(i)) != GETARG_A(i)) pc++; /***/ |
572 | else dojump(L, pc, GETARG_sBx(*pc) + 1); | 572 | else dojump(L, pc, GETARG_sBx(*pc) + 1); |
573 | base = L->base; | 573 | base = L->base; |
574 | continue; | 574 | continue; |