diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-09-18 11:03:18 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-09-18 11:03:18 -0300 |
commit | d22526ec30c32f7ed422d2cd63d4b5c426769597 (patch) | |
tree | f49002e0365ec2e33b18abaad9c853af2eee05b9 | |
parent | bd869c7b3147c277a974c896a5e3a013979ac64e (diff) | |
download | lua-d22526ec30c32f7ed422d2cd63d4b5c426769597.tar.gz lua-d22526ec30c32f7ed422d2cd63d4b5c426769597.tar.bz2 lua-d22526ec30c32f7ed422d2cd63d4b5c426769597.zip |
'lua_strlen' is for compatibility only
-rw-r--r-- | lauxlib.c | 6 | ||||
-rw-r--r-- | liolib.c | 6 | ||||
-rw-r--r-- | lua.c | 4 | ||||
-rw-r--r-- | lua.h | 8 | ||||
-rw-r--r-- | luaconf.h | 4 |
5 files changed, 14 insertions, 14 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.159 2006/03/21 19:31:09 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.160 2006/06/22 16:12:59 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 | */ |
@@ -411,9 +411,9 @@ static void adjuststack (luaL_Buffer *B) { | |||
411 | if (B->lvl > 1) { | 411 | if (B->lvl > 1) { |
412 | lua_State *L = B->L; | 412 | lua_State *L = B->L; |
413 | int toget = 1; /* number of levels to concat */ | 413 | int toget = 1; /* number of levels to concat */ |
414 | size_t toplen = lua_strlen(L, -1); | 414 | size_t toplen = lua_objlen(L, -1); |
415 | do { | 415 | do { |
416 | size_t l = lua_strlen(L, -(toget+1)); | 416 | size_t l = lua_objlen(L, -(toget+1)); |
417 | if (B->lvl - toget + 1 >= LIMIT || toplen > l) { | 417 | if (B->lvl - toget + 1 >= LIMIT || toplen > l) { |
418 | toplen += l; | 418 | toplen += l; |
419 | toget++; | 419 | toget++; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.73 2006/05/08 20:14:16 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.74 2006/06/22 16:12:59 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 | */ |
@@ -280,7 +280,7 @@ static int read_line (lua_State *L, FILE *f) { | |||
280 | char *p = luaL_prepbuffer(&b); | 280 | char *p = luaL_prepbuffer(&b); |
281 | if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ | 281 | if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ |
282 | luaL_pushresult(&b); /* close buffer */ | 282 | luaL_pushresult(&b); /* close buffer */ |
283 | return (lua_strlen(L, -1) > 0); /* check whether read something */ | 283 | return (lua_objlen(L, -1) > 0); /* check whether read something */ |
284 | } | 284 | } |
285 | l = strlen(p); | 285 | l = strlen(p); |
286 | if (l == 0 || p[l-1] != '\n') | 286 | if (l == 0 || p[l-1] != '\n') |
@@ -308,7 +308,7 @@ static int read_chars (lua_State *L, FILE *f, size_t n) { | |||
308 | n -= nr; /* still have to read `n' chars */ | 308 | n -= nr; /* still have to read `n' chars */ |
309 | } while (n > 0 && nr == rlen); /* until end of count or eof */ | 309 | } while (n > 0 && nr == rlen); /* until end of count or eof */ |
310 | luaL_pushresult(&b); /* close buffer */ | 310 | luaL_pushresult(&b); /* close buffer */ |
311 | return (n == 0 || lua_strlen(L, -1) > 0); | 311 | return (n == 0 || lua_objlen(L, -1) > 0); |
312 | } | 312 | } |
313 | 313 | ||
314 | 314 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.161 2006/06/23 16:09:15 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.162 2006/09/11 14:07:24 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 | */ |
@@ -199,7 +199,7 @@ static int loadline (lua_State *L) { | |||
199 | if (!pushline(L, 1)) | 199 | if (!pushline(L, 1)) |
200 | return -1; /* no input */ | 200 | return -1; /* no input */ |
201 | for (;;) { /* repeat until gets a complete line */ | 201 | for (;;) { /* repeat until gets a complete line */ |
202 | status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin"); | 202 | status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_objlen(L, 1), "=stdin"); |
203 | if (!incomplete(L, status)) break; /* cannot try to add lines? */ | 203 | if (!incomplete(L, status)) break; /* cannot try to add lines? */ |
204 | if (!pushline(L, 0)) /* no more input? */ | 204 | if (!pushline(L, 0)) /* no more input? */ |
205 | return -1; | 205 | return -1; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.218 2006/06/02 15:34:00 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.219 2006/09/11 14:07:24 roberto Exp roberto $ |
3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension 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 |
@@ -259,8 +259,6 @@ LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); | |||
259 | 259 | ||
260 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) | 260 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) |
261 | 261 | ||
262 | #define lua_strlen(L,i) lua_objlen(L, (i)) | ||
263 | |||
264 | #define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) | 262 | #define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) |
265 | #define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) | 263 | #define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) |
266 | #define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) | 264 | #define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) |
@@ -284,7 +282,9 @@ LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); | |||
284 | ** compatibility macros and functions | 282 | ** compatibility macros and functions |
285 | */ | 283 | */ |
286 | 284 | ||
287 | #define lua_open() luaL_newstate() | 285 | #define lua_strlen(L,i) lua_objlen(L, (i)) |
286 | |||
287 | #define lua_open() luaL_newstate() | ||
288 | 288 | ||
289 | #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) | 289 | #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) |
290 | 290 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.84 2006/08/07 19:14:30 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.85 2006/08/30 13:19:58 roberto Exp roberto $ |
3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -276,7 +276,7 @@ | |||
276 | #include <readline/history.h> | 276 | #include <readline/history.h> |
277 | #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) | 277 | #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) |
278 | #define lua_saveline(L,idx) \ | 278 | #define lua_saveline(L,idx) \ |
279 | if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ | 279 | if (lua_objlen(L,idx) > 0) /* non-empty line? */ \ |
280 | add_history(lua_tostring(L, idx)); /* add it to history */ | 280 | add_history(lua_tostring(L, idx)); /* add it to history */ |
281 | #define lua_freeline(L,b) ((void)L, free(b)) | 281 | #define lua_freeline(L,b) ((void)L, free(b)) |
282 | #else | 282 | #else |