diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-03-07 15:09:25 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-03-07 15:09:25 -0300 |
commit | 6048c4f74d7d63d6c2f5a53cd8e4ee01f6702be9 (patch) | |
tree | 1f8fd00995288958a32ebd8f97863c5f1cb8f776 /lapi.c | |
parent | 5e870f86a255988ca85eda795adc31063ec1ac70 (diff) | |
download | lua-6048c4f74d7d63d6c2f5a53cd8e4ee01f6702be9.tar.gz lua-6048c4f74d7d63d6c2f5a53cd8e4ee01f6702be9.tar.bz2 lua-6048c4f74d7d63d6c2f5a53cd8e4ee01f6702be9.zip |
better way to link callinfo's and stack
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.134 2001/02/23 17:28:12 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.135 2001/03/02 17:27:50 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 | */ |
@@ -31,7 +31,7 @@ const l_char lua_ident[] = l_s("$Lua: ") LUA_VERSION l_s(" ") | |||
31 | #define api_check(L, o) /* nothing */ | 31 | #define api_check(L, o) /* nothing */ |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->Cbase)) | 34 | #define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->ci->base)) |
35 | 35 | ||
36 | #define api_incr_top(L) incr_top | 36 | #define api_incr_top(L) incr_top |
37 | 37 | ||
@@ -39,11 +39,11 @@ const l_char lua_ident[] = l_s("$Lua: ") LUA_VERSION l_s(" ") | |||
39 | 39 | ||
40 | TObject *luaA_index (lua_State *L, int index) { | 40 | TObject *luaA_index (lua_State *L, int index) { |
41 | if (index > 0) { | 41 | if (index > 0) { |
42 | api_check(L, index <= L->top - L->Cbase); | 42 | api_check(L, index <= L->top - L->ci->base); |
43 | return L->Cbase+index-1; | 43 | return L->ci->base+index-1; |
44 | } | 44 | } |
45 | else { | 45 | else { |
46 | api_check(L, index != 0 && -index <= L->top - L->Cbase); | 46 | api_check(L, index != 0 && -index <= L->top - L->ci->base); |
47 | return L->top+index; | 47 | return L->top+index; |
48 | } | 48 | } |
49 | } | 49 | } |
@@ -51,13 +51,13 @@ TObject *luaA_index (lua_State *L, int index) { | |||
51 | 51 | ||
52 | static TObject *luaA_indexAcceptable (lua_State *L, int index) { | 52 | static TObject *luaA_indexAcceptable (lua_State *L, int index) { |
53 | if (index > 0) { | 53 | if (index > 0) { |
54 | TObject *o = L->Cbase+(index-1); | 54 | TObject *o = L->ci->base+(index-1); |
55 | api_check(L, index <= L->stack_last - L->Cbase); | 55 | api_check(L, index <= L->stack_last - L->ci->base); |
56 | if (o >= L->top) return NULL; | 56 | if (o >= L->top) return NULL; |
57 | else return o; | 57 | else return o; |
58 | } | 58 | } |
59 | else { | 59 | else { |
60 | api_check(L, index != 0 && -index <= L->top - L->Cbase); | 60 | api_check(L, index != 0 && -index <= L->top - L->ci->base); |
61 | return L->top+index; | 61 | return L->top+index; |
62 | } | 62 | } |
63 | } | 63 | } |
@@ -86,7 +86,7 @@ LUA_API int lua_stackspace (lua_State *L) { | |||
86 | LUA_API int lua_gettop (lua_State *L) { | 86 | LUA_API int lua_gettop (lua_State *L) { |
87 | int i; | 87 | int i; |
88 | lua_lock(L); | 88 | lua_lock(L); |
89 | i = (L->top - L->Cbase); | 89 | i = (L->top - L->ci->base); |
90 | lua_unlock(L); | 90 | lua_unlock(L); |
91 | return i; | 91 | return i; |
92 | } | 92 | } |
@@ -95,9 +95,9 @@ LUA_API int lua_gettop (lua_State *L) { | |||
95 | LUA_API void lua_settop (lua_State *L, int index) { | 95 | LUA_API void lua_settop (lua_State *L, int index) { |
96 | lua_lock(L); | 96 | lua_lock(L); |
97 | if (index >= 0) | 97 | if (index >= 0) |
98 | luaD_adjusttop(L, L->Cbase, index); | 98 | luaD_adjusttop(L, L->ci->base, index); |
99 | else { | 99 | else { |
100 | api_check(L, -(index+1) <= (L->top - L->Cbase)); | 100 | api_check(L, -(index+1) <= (L->top - L->ci->base)); |
101 | L->top = L->top+index+1; /* index is negative */ | 101 | L->top = L->top+index+1; /* index is negative */ |
102 | } | 102 | } |
103 | lua_unlock(L); | 103 | lua_unlock(L); |