diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-01-10 10:50:00 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-01-10 10:50:00 -0200 |
commit | dd1221582bc7c0c2ec508b5bad4086f8801b61a8 (patch) | |
tree | 36c896b2dc704cc28edc59c92b83f00319e4e9ea | |
parent | bfdcbbcd76c7187022fe2d35675de0b1c92eeadf (diff) | |
download | lua-dd1221582bc7c0c2ec508b5bad4086f8801b61a8.tar.gz lua-dd1221582bc7c0c2ec508b5bad4086f8801b61a8.tar.bz2 lua-dd1221582bc7c0c2ec508b5bad4086f8801b61a8.zip |
details
-rw-r--r-- | lapi.c | 17 | ||||
-rw-r--r-- | lobject.c | 4 | ||||
-rw-r--r-- | ltests.c | 4 | ||||
-rw-r--r-- | ltm.c | 4 | ||||
-rw-r--r-- | lvm.c | 4 |
5 files changed, 16 insertions, 17 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.51 2005/10/20 11:35:50 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.52 2005/12/22 16:19: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 | */ |
@@ -40,7 +40,7 @@ const char lua_ident[] = | |||
40 | 40 | ||
41 | #define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->base)) | 41 | #define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->base)) |
42 | 42 | ||
43 | #define api_checkvalidindex(L, i) api_check(L, (i) != &luaO_nilobject) | 43 | #define api_checkvalidindex(L, i) api_check(L, (i) != luaO_nilobject) |
44 | 44 | ||
45 | #define api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;} | 45 | #define api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;} |
46 | 46 | ||
@@ -50,7 +50,7 @@ static TValue *index2adr (lua_State *L, int idx) { | |||
50 | if (idx > 0) { | 50 | if (idx > 0) { |
51 | TValue *o = L->base + (idx - 1); | 51 | TValue *o = L->base + (idx - 1); |
52 | api_check(L, idx <= L->ci->top - L->base); | 52 | api_check(L, idx <= L->ci->top - L->base); |
53 | if (o >= L->top) return cast(TValue *, &luaO_nilobject); | 53 | if (o >= L->top) return cast(TValue *, luaO_nilobject); |
54 | else return o; | 54 | else return o; |
55 | } | 55 | } |
56 | else if (idx > LUA_REGISTRYINDEX) { | 56 | else if (idx > LUA_REGISTRYINDEX) { |
@@ -70,7 +70,7 @@ static TValue *index2adr (lua_State *L, int idx) { | |||
70 | idx = LUA_GLOBALSINDEX - idx; | 70 | idx = LUA_GLOBALSINDEX - idx; |
71 | return (idx <= func->c.nupvalues) | 71 | return (idx <= func->c.nupvalues) |
72 | ? &func->c.upvalue[idx-1] | 72 | ? &func->c.upvalue[idx-1] |
73 | : cast(TValue *, &luaO_nilobject); | 73 | : cast(TValue *, luaO_nilobject); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | } | 76 | } |
@@ -234,7 +234,7 @@ LUA_API void lua_pushvalue (lua_State *L, int idx) { | |||
234 | 234 | ||
235 | LUA_API int lua_type (lua_State *L, int idx) { | 235 | LUA_API int lua_type (lua_State *L, int idx) { |
236 | StkId o = index2adr(L, idx); | 236 | StkId o = index2adr(L, idx); |
237 | return (o == &luaO_nilobject) ? LUA_TNONE : ttype(o); | 237 | return (o == luaO_nilobject) ? LUA_TNONE : ttype(o); |
238 | } | 238 | } |
239 | 239 | ||
240 | 240 | ||
@@ -272,7 +272,7 @@ LUA_API int lua_isuserdata (lua_State *L, int idx) { | |||
272 | LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { | 272 | LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { |
273 | StkId o1 = index2adr(L, index1); | 273 | StkId o1 = index2adr(L, index1); |
274 | StkId o2 = index2adr(L, index2); | 274 | StkId o2 = index2adr(L, index2); |
275 | return (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 | 275 | return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 |
276 | : luaO_rawequalObj(o1, o2); | 276 | : luaO_rawequalObj(o1, o2); |
277 | } | 277 | } |
278 | 278 | ||
@@ -283,8 +283,7 @@ LUA_API int lua_equal (lua_State *L, int index1, int index2) { | |||
283 | lua_lock(L); /* may call tag method */ | 283 | lua_lock(L); /* may call tag method */ |
284 | o1 = index2adr(L, index1); | 284 | o1 = index2adr(L, index1); |
285 | o2 = index2adr(L, index2); | 285 | o2 = index2adr(L, index2); |
286 | i = (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 | 286 | i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 : equalobj(L, o1, o2); |
287 | : equalobj(L, o1, o2); | ||
288 | lua_unlock(L); | 287 | lua_unlock(L); |
289 | return i; | 288 | return i; |
290 | } | 289 | } |
@@ -296,7 +295,7 @@ LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { | |||
296 | lua_lock(L); /* may call tag method */ | 295 | lua_lock(L); /* may call tag method */ |
297 | o1 = index2adr(L, index1); | 296 | o1 = index2adr(L, index1); |
298 | o2 = index2adr(L, index2); | 297 | o2 = index2adr(L, index2); |
299 | i = (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 | 298 | i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 |
300 | : luaV_lessthan(L, o1, o2); | 299 | : luaV_lessthan(L, o1, o2); |
301 | lua_unlock(L); | 300 | lua_unlock(L); |
302 | return i; | 301 | return i; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 2.19 2005/10/24 17:37:52 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.20 2005/12/22 16:19:56 roberto Exp roberto $ |
3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | 25 | ||
26 | 26 | ||
27 | const TValue luaO_nilobject = {{NULL}, LUA_TNIL}; | 27 | const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL}; |
28 | 28 | ||
29 | 29 | ||
30 | /* | 30 | /* |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.33 2005/10/06 20:47:32 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.34 2005/12/22 16:19:56 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -564,7 +564,7 @@ static int table_query (lua_State *L) { | |||
564 | t = hvalue(obj_at(L, 1)); | 564 | t = hvalue(obj_at(L, 1)); |
565 | if (i == -1) { | 565 | if (i == -1) { |
566 | lua_pushinteger(L, t->sizearray); | 566 | lua_pushinteger(L, t->sizearray); |
567 | lua_pushinteger(L, t->node == &luaH_dummynode ? 0 : sizenode(t)); | 567 | lua_pushinteger(L, t->node == luaH_dummynode ? 0 : sizenode(t)); |
568 | lua_pushinteger(L, t->lastfree - t->node); | 568 | lua_pushinteger(L, t->lastfree - t->node); |
569 | } | 569 | } |
570 | else if (i < t->sizearray) { | 570 | else if (i < t->sizearray) { |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 2.6 2005/05/20 15:53:42 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 2.7 2005/12/22 16:19:56 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 | */ |
@@ -70,6 +70,6 @@ const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { | |||
70 | default: | 70 | default: |
71 | mt = G(L)->mt[ttype(o)]; | 71 | mt = G(L)->mt[ttype(o)]; |
72 | } | 72 | } |
73 | return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : &luaO_nilobject); | 73 | return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); |
74 | } | 74 | } |
75 | 75 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.59 2005/11/01 16:08:45 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.60 2005/12/22 16:19:56 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 | */ |
@@ -518,7 +518,7 @@ void luaV_execute (lua_State *L, int nexeccalls) { | |||
518 | } | 518 | } |
519 | default: { /* try metamethod */ | 519 | default: { /* try metamethod */ |
520 | Protect( | 520 | Protect( |
521 | if (!call_binTM(L, rb, &luaO_nilobject, ra, TM_LEN)) | 521 | if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)) |
522 | luaG_typeerror(L, rb, "get length of"); | 522 | luaG_typeerror(L, rb, "get length of"); |
523 | ) | 523 | ) |
524 | } | 524 | } |