diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-06-08 15:27:13 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-06-08 15:27:13 -0300 |
commit | 8ca9534d048782af13141874e0d2fec0d0f806af (patch) | |
tree | d58ab47be12ff9d5910ffaf6222cf94bd0dff0f6 /lapi.c | |
parent | 8bcf6228765e56be19feb90c8805cc2fb2223188 (diff) | |
download | lua-8ca9534d048782af13141874e0d2fec0d0f806af.tar.gz lua-8ca9534d048782af13141874e0d2fec0d0f806af.tar.bz2 lua-8ca9534d048782af13141874e0d2fec0d0f806af.zip |
access to `values' in TObject always through macros
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.82 2000/05/26 19:17:57 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.83 2000/06/06 16:31:41 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 | */ |
@@ -63,7 +63,7 @@ lua_Object lua_pop (lua_State *L) { | |||
63 | 63 | ||
64 | 64 | ||
65 | void lua_pushglobaltable (lua_State *L) { | 65 | void lua_pushglobaltable (lua_State *L) { |
66 | avalue(L->top) = L->gt; | 66 | hvalue(L->top) = L->gt; |
67 | ttype(L->top) = TAG_TABLE; | 67 | ttype(L->top) = TAG_TABLE; |
68 | incr_top; | 68 | incr_top; |
69 | } | 69 | } |
@@ -72,7 +72,7 @@ void lua_pushglobaltable (lua_State *L) { | |||
72 | void lua_setglobaltable (lua_State *L, lua_Object newtable) { | 72 | void lua_setglobaltable (lua_State *L, lua_Object newtable) { |
73 | if (lua_type(L, newtable)[0] != 't') /* type == "table"? */ | 73 | if (lua_type(L, newtable)[0] != 't') /* type == "table"? */ |
74 | lua_error(L, "Lua API error - invalid value for global table"); | 74 | lua_error(L, "Lua API error - invalid value for global table"); |
75 | L->gt = avalue(newtable); | 75 | L->gt = hvalue(newtable); |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
@@ -125,7 +125,7 @@ lua_Object lua_rawget (lua_State *L) { | |||
125 | luaA_checkCargs(L, 2); | 125 | luaA_checkCargs(L, 2); |
126 | if (ttype(L->top-2) != TAG_TABLE) | 126 | if (ttype(L->top-2) != TAG_TABLE) |
127 | lua_error(L, "indexed expression not a table"); | 127 | lua_error(L, "indexed expression not a table"); |
128 | res = luaA_putluaObject(L, luaH_get(L, avalue(L->top-2), L->top-1)); | 128 | res = luaA_putluaObject(L, luaH_get(L, hvalue(L->top-2), L->top-1)); |
129 | L->top -= 2; | 129 | L->top -= 2; |
130 | return res; | 130 | return res; |
131 | } | 131 | } |
@@ -144,7 +144,7 @@ void lua_rawset (lua_State *L) { | |||
144 | luaA_checkCargs(L, 3); | 144 | luaA_checkCargs(L, 3); |
145 | if (ttype(L->top-3) != TAG_TABLE) | 145 | if (ttype(L->top-3) != TAG_TABLE) |
146 | lua_error(L, "indexed expression not a table"); | 146 | lua_error(L, "indexed expression not a table"); |
147 | *luaH_set(L, avalue(L->top-3), L->top-2) = *(L->top-1); | 147 | *luaH_set(L, hvalue(L->top-3), L->top-2) = *(L->top-1); |
148 | L->top -= 3; | 148 | L->top -= 3; |
149 | } | 149 | } |
150 | 150 | ||
@@ -152,7 +152,7 @@ void lua_rawset (lua_State *L) { | |||
152 | lua_Object lua_createtable (lua_State *L) { | 152 | lua_Object lua_createtable (lua_State *L) { |
153 | TObject o; | 153 | TObject o; |
154 | luaC_checkGC(L); | 154 | luaC_checkGC(L); |
155 | avalue(&o) = luaH_new(L, 0); | 155 | hvalue(&o) = luaH_new(L, 0); |
156 | ttype(&o) = TAG_TABLE; | 156 | ttype(&o) = TAG_TABLE; |
157 | return luaA_putluaObject(L, &o); | 157 | return luaA_putluaObject(L, &o); |
158 | } | 158 | } |
@@ -311,7 +311,7 @@ int lua_tag (lua_State *L, lua_Object o) { | |||
311 | if (o == LUA_NOOBJECT) | 311 | if (o == LUA_NOOBJECT) |
312 | return TAG_NIL; | 312 | return TAG_NIL; |
313 | else if (ttype(o) == TAG_USERDATA) /* to allow `old' tags (deprecated) */ | 313 | else if (ttype(o) == TAG_USERDATA) /* to allow `old' tags (deprecated) */ |
314 | return o->value.ts->u.d.tag; | 314 | return tsvalue(o)->u.d.tag; |
315 | else | 315 | else |
316 | return luaT_effectivetag(L, o); | 316 | return luaT_effectivetag(L, o); |
317 | } | 317 | } |
@@ -322,10 +322,10 @@ void lua_settag (lua_State *L, int tag) { | |||
322 | luaT_realtag(L, tag); | 322 | luaT_realtag(L, tag); |
323 | switch (ttype(L->top-1)) { | 323 | switch (ttype(L->top-1)) { |
324 | case TAG_TABLE: | 324 | case TAG_TABLE: |
325 | (L->top-1)->value.a->htag = tag; | 325 | hvalue(L->top-1)->htag = tag; |
326 | break; | 326 | break; |
327 | case TAG_USERDATA: | 327 | case TAG_USERDATA: |
328 | (L->top-1)->value.ts->u.d.tag = tag; | 328 | tsvalue(L->top-1)->u.d.tag = tag; |
329 | break; | 329 | break; |
330 | default: | 330 | default: |
331 | luaL_verror(L, "cannot change the tag of a %.20s", | 331 | luaL_verror(L, "cannot change the tag of a %.20s", |
@@ -352,7 +352,7 @@ int luaA_next (lua_State *L, const Hash *t, int i) { | |||
352 | int lua_next (lua_State *L, lua_Object t, int i) { | 352 | int lua_next (lua_State *L, lua_Object t, int i) { |
353 | if (ttype(t) != TAG_TABLE) | 353 | if (ttype(t) != TAG_TABLE) |
354 | lua_error(L, "Lua API error - object is not a table in `lua_next'"); | 354 | lua_error(L, "Lua API error - object is not a table in `lua_next'"); |
355 | i = luaA_next(L, avalue(t), i); | 355 | i = luaA_next(L, hvalue(t), i); |
356 | top2LC(L, (i==0) ? 0 : 2); | 356 | top2LC(L, (i==0) ? 0 : 2); |
357 | return i; | 357 | return i; |
358 | } | 358 | } |