diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-17 14:20:01 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-17 14:20:01 -0200 |
| commit | c3a6f3fa1c6360d4ea2e32f9415f51e8e55093b4 (patch) | |
| tree | 9f26c632fa0215c21260a81f6fad1a79678f8173 | |
| parent | 0bbdddc86b1353fec36ae886b4142986f3c4713f (diff) | |
| download | lua-c3a6f3fa1c6360d4ea2e32f9415f51e8e55093b4.tar.gz lua-c3a6f3fa1c6360d4ea2e32f9415f51e8e55093b4.tar.bz2 lua-c3a6f3fa1c6360d4ea2e32f9415f51e8e55093b4.zip | |
'lua_objlen' replaced by 'lua_rawlen', 'lua_len', and 'luaL_len'
| -rw-r--r-- | lapi.c | 31 | ||||
| -rw-r--r-- | lauxlib.c | 19 | ||||
| -rw-r--r-- | lauxlib.h | 3 | ||||
| -rw-r--r-- | lbaselib.c | 6 | ||||
| -rw-r--r-- | liolib.c | 4 | ||||
| -rw-r--r-- | ltablib.c | 6 | ||||
| -rw-r--r-- | ltests.c | 16 | ||||
| -rw-r--r-- | lua.c | 8 | ||||
| -rw-r--r-- | lua.h | 9 | ||||
| -rw-r--r-- | lvm.c | 6 | ||||
| -rw-r--r-- | lvm.h | 3 |
11 files changed, 69 insertions, 42 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.103 2009/12/08 16:15:43 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.104 2009/12/15 11:25: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 | */ |
| @@ -374,20 +374,13 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { | |||
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | 376 | ||
| 377 | LUA_API size_t lua_objlen (lua_State *L, int idx) { | 377 | LUA_API size_t lua_rawlen (lua_State *L, int idx) { |
| 378 | StkId o = index2addr(L, idx); | 378 | StkId o = index2addr(L, idx); |
| 379 | if (ttisuserdata(o)) return uvalue(o)->len; | 379 | switch (ttype(o)) { |
| 380 | else { | 380 | case LUA_TSTRING: return tsvalue(o)->len; |
| 381 | size_t res; | 381 | case LUA_TUSERDATA: return uvalue(o)->len; |
| 382 | TValue temp; | 382 | case LUA_TTABLE: return luaH_getn(hvalue(o)); |
| 383 | lua_lock(L); | 383 | default: return 0; |
| 384 | res = luaV_len(L, o, &temp); | ||
| 385 | if (res == cast(size_t, -1)) { | ||
| 386 | const TValue *t = &temp; | ||
| 387 | res = tonumber(t, &temp) ? nvalue(t) : 0; | ||
| 388 | } | ||
| 389 | lua_unlock(L); | ||
| 390 | return res; | ||
| 391 | } | 384 | } |
| 392 | } | 385 | } |
| 393 | 386 | ||
| @@ -1027,6 +1020,16 @@ LUA_API void lua_concat (lua_State *L, int n) { | |||
| 1027 | } | 1020 | } |
| 1028 | 1021 | ||
| 1029 | 1022 | ||
| 1023 | LUA_API void lua_len (lua_State *L, int idx) { | ||
| 1024 | StkId t; | ||
| 1025 | lua_lock(L); | ||
| 1026 | t = index2addr(L, idx); | ||
| 1027 | luaV_objlen(L, L->top, t); | ||
| 1028 | api_incr_top(L); | ||
| 1029 | lua_unlock(L); | ||
| 1030 | } | ||
| 1031 | |||
| 1032 | |||
| 1030 | LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { | 1033 | LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { |
| 1031 | lua_Alloc f; | 1034 | lua_Alloc f; |
| 1032 | lua_lock(L); | 1035 | lua_lock(L); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.193 2009/10/05 16:44:33 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.194 2009/11/25 15:27:51 roberto Exp roberto $ |
| 3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -370,9 +370,9 @@ static void adjuststack (luaL_Buffer *B) { | |||
| 370 | if (B->lvl > 1) { | 370 | if (B->lvl > 1) { |
| 371 | lua_State *L = B->L; | 371 | lua_State *L = B->L; |
| 372 | int toget = 1; /* number of levels to concat */ | 372 | int toget = 1; /* number of levels to concat */ |
| 373 | size_t toplen = lua_objlen(L, -1); | 373 | size_t toplen = lua_rawlen(L, -1); |
| 374 | do { | 374 | do { |
| 375 | size_t l = lua_objlen(L, -(toget+1)); | 375 | size_t l = lua_rawlen(L, -(toget+1)); |
| 376 | if (B->lvl - toget + 1 >= LIMIT || toplen > l) { | 376 | if (B->lvl - toget + 1 >= LIMIT || toplen > l) { |
| 377 | toplen += l; | 377 | toplen += l; |
| 378 | toget++; | 378 | toget++; |
| @@ -463,7 +463,7 @@ LUALIB_API int luaL_ref (lua_State *L, int t) { | |||
| 463 | lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ | 463 | lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ |
| 464 | } | 464 | } |
| 465 | else { /* no free elements */ | 465 | else { /* no free elements */ |
| 466 | ref = (int)lua_objlen(L, t) + 1; /* get a new reference */ | 466 | ref = (int)lua_rawlen(L, t) + 1; /* get a new reference */ |
| 467 | if (ref == FREELIST_REF) { /* FREELIST_REF not initialized? */ | 467 | if (ref == FREELIST_REF) { /* FREELIST_REF not initialized? */ |
| 468 | lua_pushinteger(L, 0); | 468 | lua_pushinteger(L, 0); |
| 469 | lua_rawseti(L, t, FREELIST_REF); | 469 | lua_rawseti(L, t, FREELIST_REF); |
| @@ -627,6 +627,17 @@ LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { | |||
| 627 | } | 627 | } |
| 628 | 628 | ||
| 629 | 629 | ||
| 630 | LUALIB_API int luaL_len (lua_State *L, int idx) { | ||
| 631 | int l; | ||
| 632 | lua_len(L, idx); | ||
| 633 | l = lua_tointeger(L, -1); | ||
| 634 | if (l == 0 && !lua_isnumber(L, -1)) | ||
| 635 | luaL_error(L, "object length is not a number"); | ||
| 636 | lua_pop(L, 1); /* remove object */ | ||
| 637 | return l; | ||
| 638 | } | ||
| 639 | |||
| 640 | |||
| 630 | LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { | 641 | LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { |
| 631 | if (!luaL_callmeta(L, idx, "__tostring")) { /* no metafield? */ | 642 | if (!luaL_callmeta(L, idx, "__tostring")) { /* no metafield? */ |
| 632 | switch (lua_type(L, idx)) { | 643 | switch (lua_type(L, idx)) { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.h,v 1.95 2009/02/13 19:39:34 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.96 2009/06/18 18:59:58 roberto Exp roberto $ |
| 3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -73,6 +73,7 @@ LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); | |||
| 73 | 73 | ||
| 74 | LUALIB_API lua_State *(luaL_newstate) (void); | 74 | LUALIB_API lua_State *(luaL_newstate) (void); |
| 75 | 75 | ||
| 76 | LUALIB_API int luaL_len (lua_State *L, int idx); | ||
| 76 | 77 | ||
| 77 | LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, | 78 | LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, |
| 78 | const char *r); | 79 | const char *r); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.231 2009/12/11 13:40:44 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.232 2009/12/15 11:25:16 roberto Exp roberto $ |
| 3 | ** Basic library | 3 | ** Basic library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -258,7 +258,7 @@ static int ipairsaux (lua_State *L) { | |||
| 258 | i++; /* next value */ | 258 | i++; /* next value */ |
| 259 | lua_pushinteger(L, i); | 259 | lua_pushinteger(L, i); |
| 260 | lua_rawgeti(L, 1, i); | 260 | lua_rawgeti(L, 1, i); |
| 261 | return (lua_isnil(L, -1) && i > (int)lua_objlen(L, 1)) ? 0 : 2; | 261 | return (lua_isnil(L, -1) && i > luaL_len(L, 1)) ? 0 : 2; |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | 264 | ||
| @@ -416,7 +416,7 @@ static int luaB_unpack (lua_State *L) { | |||
| 416 | int i, e, n; | 416 | int i, e, n; |
| 417 | luaL_checktype(L, 1, LUA_TTABLE); | 417 | luaL_checktype(L, 1, LUA_TTABLE); |
| 418 | i = luaL_optint(L, 2, 1); | 418 | i = luaL_optint(L, 2, 1); |
| 419 | e = luaL_opt(L, luaL_checkint, 3, (int)lua_objlen(L, 1)); | 419 | e = luaL_opt(L, luaL_checkint, 3, (int)lua_rawlen(L, 1)); |
| 420 | if (i > e) return 0; /* empty range */ | 420 | if (i > e) return 0; /* empty range */ |
| 421 | n = e - i + 1; /* number of elements */ | 421 | n = e - i + 1; /* number of elements */ |
| 422 | if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */ | 422 | if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: liolib.c,v 2.83 2009/11/24 12:05:44 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.84 2009/12/17 13:08:51 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 | */ |
| @@ -336,7 +336,7 @@ static int read_line (lua_State *L, FILE *f) { | |||
| 336 | char *p = luaL_prepbuffer(&b); | 336 | char *p = luaL_prepbuffer(&b); |
| 337 | if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ | 337 | if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ |
| 338 | luaL_pushresult(&b); /* close buffer */ | 338 | luaL_pushresult(&b); /* close buffer */ |
| 339 | return (lua_objlen(L, -1) > 0); /* check whether read something */ | 339 | return (lua_rawlen(L, -1) > 0); /* check whether read something */ |
| 340 | } | 340 | } |
| 341 | l = strlen(p); | 341 | l = strlen(p); |
| 342 | if (l == 0 || p[l-1] != '\n') | 342 | if (l == 0 || p[l-1] != '\n') |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltablib.c,v 1.49 2009/11/26 17:35:13 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.50 2009/12/07 15:50:27 roberto Exp roberto $ |
| 3 | ** Library for Table Manipulation | 3 | ** Library for Table Manipulation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -16,7 +16,7 @@ | |||
| 16 | #include "lualib.h" | 16 | #include "lualib.h" |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | #define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), lua_objlen(L, n)) | 19 | #define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), lua_rawlen(L, n)) |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | static int foreachi (lua_State *L) { | 22 | static int foreachi (lua_State *L) { |
| @@ -154,7 +154,7 @@ static int tconcat (lua_State *L) { | |||
| 154 | const char *sep = luaL_optlstring(L, 2, "", &lsep); | 154 | const char *sep = luaL_optlstring(L, 2, "", &lsep); |
| 155 | luaL_checktype(L, 1, LUA_TTABLE); | 155 | luaL_checktype(L, 1, LUA_TTABLE); |
| 156 | i = luaL_optint(L, 3, 1); | 156 | i = luaL_optint(L, 3, 1); |
| 157 | last = luaL_opt(L, luaL_checkint, 4, (int)lua_objlen(L, 1)); | 157 | last = luaL_opt(L, luaL_checkint, 4, (int)lua_rawlen(L, 1)); |
| 158 | luaL_buffinit(L, &b); | 158 | luaL_buffinit(L, &b); |
| 159 | for (; i < last; i++) { | 159 | for (; i < last; i++) { |
| 160 | addfield(L, &b, i); | 160 | addfield(L, &b, i); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 2.83 2009/12/11 19:14:59 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.84 2009/12/16 16:42:58 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 | */ |
| @@ -946,7 +946,13 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
| 946 | lua_assert((s == NULL && s1 == NULL) || (strcmp)(s, s1) == 0); | 946 | lua_assert((s == NULL && s1 == NULL) || (strcmp)(s, s1) == 0); |
| 947 | } | 947 | } |
| 948 | else if EQ("objsize") { | 948 | else if EQ("objsize") { |
| 949 | lua_pushinteger(L1, lua_objlen(L1, getindex)); | 949 | lua_pushinteger(L1, lua_rawlen(L1, getindex)); |
| 950 | } | ||
| 951 | else if EQ("len") { | ||
| 952 | lua_len(L1, getindex); | ||
| 953 | } | ||
| 954 | else if EQ("Llen") { | ||
| 955 | lua_pushinteger(L1, luaL_len(L1, getindex)); | ||
| 950 | } | 956 | } |
| 951 | else if EQ("tocfunction") { | 957 | else if EQ("tocfunction") { |
| 952 | lua_pushcfunction(L1, lua_tocfunction(L1, getindex)); | 958 | lua_pushcfunction(L1, lua_tocfunction(L1, getindex)); |
| @@ -1135,13 +1141,13 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
| 1135 | else if EQ("type") { | 1141 | else if EQ("type") { |
| 1136 | lua_pushstring(L1, luaL_typename(L1, getnum)); | 1142 | lua_pushstring(L1, luaL_typename(L1, getnum)); |
| 1137 | } | 1143 | } |
| 1138 | else if EQ("getn") { | 1144 | /* else if EQ("getn") { |
| 1139 | int i = getindex; | 1145 | int i = getindex; |
| 1140 | lua_pushinteger(L1, lua_objlen(L1, i)); | 1146 | lua_pushinteger(L1, lua_objlen(L1, i)); |
| 1141 | } | 1147 | } */ |
| 1142 | else if EQ("append") { | 1148 | else if EQ("append") { |
| 1143 | int t = getindex; | 1149 | int t = getindex; |
| 1144 | int i = lua_objlen(L1, t); | 1150 | int i = lua_rawlen(L1, t); |
| 1145 | lua_rawseti(L1, t, i + 1); | 1151 | lua_rawseti(L1, t, i + 1); |
| 1146 | } | 1152 | } |
| 1147 | else if EQ("getctx") { | 1153 | else if EQ("getctx") { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.178 2009/12/17 12:26:09 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.179 2009/12/17 13:07:41 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 | */ |
| @@ -65,7 +65,7 @@ | |||
| 65 | #include <readline/history.h> | 65 | #include <readline/history.h> |
| 66 | #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) | 66 | #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) |
| 67 | #define lua_saveline(L,idx) \ | 67 | #define lua_saveline(L,idx) \ |
| 68 | if (lua_objlen(L,idx) > 0) /* non-empty line? */ \ | 68 | if (lua_rawlen(L,idx) > 0) /* non-empty line? */ \ |
| 69 | add_history(lua_tostring(L, idx)); /* add it to history */ | 69 | add_history(lua_tostring(L, idx)); /* add it to history */ |
| 70 | #define lua_freeline(L,b) ((void)L, free(b)) | 70 | #define lua_freeline(L,b) ((void)L, free(b)) |
| 71 | 71 | ||
| @@ -271,7 +271,9 @@ static int loadline (lua_State *L) { | |||
| 271 | if (!pushline(L, 1)) | 271 | if (!pushline(L, 1)) |
| 272 | return -1; /* no input */ | 272 | return -1; /* no input */ |
| 273 | for (;;) { /* repeat until gets a complete line */ | 273 | for (;;) { /* repeat until gets a complete line */ |
| 274 | status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_objlen(L, 1), "=stdin"); | 274 | size_t l; |
| 275 | const char *line = lua_tolstring(L, 1, &l); | ||
| 276 | status = luaL_loadbuffer(L, line, l, "=stdin"); | ||
| 275 | if (!incomplete(L, status)) break; /* cannot try to add lines? */ | 277 | if (!incomplete(L, status)) break; /* cannot try to add lines? */ |
| 276 | if (!pushline(L, 0)) /* no more input? */ | 278 | if (!pushline(L, 0)) /* no more input? */ |
| 277 | return -1; | 279 | return -1; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.252 2009/11/26 11:39:20 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.253 2009/12/11 13:40:44 roberto Exp roberto $ |
| 3 | ** Lua - A Scripting Language | 3 | ** Lua - A Scripting Language |
| 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
| 5 | ** See Copyright Notice at the end of this file | 5 | ** See Copyright Notice at the end of this file |
| @@ -156,7 +156,7 @@ LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); | |||
| 156 | LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); | 156 | LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); |
| 157 | LUA_API int (lua_toboolean) (lua_State *L, int idx); | 157 | LUA_API int (lua_toboolean) (lua_State *L, int idx); |
| 158 | LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); | 158 | LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); |
| 159 | LUA_API size_t (lua_objlen) (lua_State *L, int idx); | 159 | LUA_API size_t (lua_rawlen) (lua_State *L, int idx); |
| 160 | LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); | 160 | LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); |
| 161 | LUA_API void *(lua_touserdata) (lua_State *L, int idx); | 161 | LUA_API void *(lua_touserdata) (lua_State *L, int idx); |
| 162 | LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); | 162 | LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); |
| @@ -281,6 +281,7 @@ LUA_API int (lua_error) (lua_State *L); | |||
| 281 | LUA_API int (lua_next) (lua_State *L, int idx); | 281 | LUA_API int (lua_next) (lua_State *L, int idx); |
| 282 | 282 | ||
| 283 | LUA_API void (lua_concat) (lua_State *L, int n); | 283 | LUA_API void (lua_concat) (lua_State *L, int n); |
| 284 | LUA_API void (lua_len) (lua_State *L, int idx); | ||
| 284 | 285 | ||
| 285 | LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); | 286 | LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); |
| 286 | LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); | 287 | LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); |
| @@ -326,7 +327,9 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); | |||
| 326 | */ | 327 | */ |
| 327 | #if defined(LUA_COMPAT_API) | 328 | #if defined(LUA_COMPAT_API) |
| 328 | 329 | ||
| 329 | #define lua_strlen(L,i) lua_objlen(L, (i)) | 330 | #define lua_strlen(L,i) lua_rawlen(L, (i)) |
| 331 | |||
| 332 | #define lua_objlen(L,i) lua_rawlen(L, (i)) | ||
| 330 | 333 | ||
| 331 | #define lua_open() luaL_newstate() | 334 | #define lua_open() luaL_newstate() |
| 332 | 335 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 2.100 2009/10/28 12:20:07 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.101 2009/11/25 15:27:51 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 | */ |
| @@ -307,7 +307,7 @@ void luaV_concat (lua_State *L, int total) { | |||
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | 309 | ||
| 310 | static void objlen (lua_State *L, StkId ra, const TValue *rb) { | 310 | void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { |
| 311 | const TValue *tm; | 311 | const TValue *tm; |
| 312 | switch (ttype(rb)) { | 312 | switch (ttype(rb)) { |
| 313 | case LUA_TTABLE: { | 313 | case LUA_TTABLE: { |
| @@ -582,7 +582,7 @@ void luaV_execute (lua_State *L) { | |||
| 582 | continue; | 582 | continue; |
| 583 | } | 583 | } |
| 584 | case OP_LEN: { | 584 | case OP_LEN: { |
| 585 | Protect(objlen(L, ra, RB(i))); | 585 | Protect(luaV_objlen(L, ra, RB(i))); |
| 586 | continue; | 586 | continue; |
| 587 | } | 587 | } |
| 588 | case OP_CONCAT: { | 588 | case OP_CONCAT: { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.h,v 2.12 2009/11/06 17:05:34 roberto Exp roberto $ | 2 | ** $Id: lvm.h,v 2.13 2009/11/19 19:04:58 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 | */ |
| @@ -37,5 +37,6 @@ LUAI_FUNC void luaV_execute (lua_State *L); | |||
| 37 | LUAI_FUNC void luaV_concat (lua_State *L, int total); | 37 | LUAI_FUNC void luaV_concat (lua_State *L, int total); |
| 38 | LUAI_FUNC void luaV_arith (lua_State *L, StkId ra, const TValue *rb, | 38 | LUAI_FUNC void luaV_arith (lua_State *L, StkId ra, const TValue *rb, |
| 39 | const TValue *rc, TMS op); | 39 | const TValue *rc, TMS op); |
| 40 | LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); | ||
| 40 | 41 | ||
| 41 | #endif | 42 | #endif |
