diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/liolib.c | 4 | ||||
-rw-r--r-- | src/llex.c | 4 | ||||
-rw-r--r-- | src/loslib.c | 9 | ||||
-rw-r--r-- | src/lstate.h | 10 | ||||
-rw-r--r-- | src/luaconf.h | 4 |
6 files changed, 18 insertions, 15 deletions
diff --git a/src/Makefile b/src/Makefile index 13d0d497..fb69ce1e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -107,6 +107,8 @@ posix: solaris: $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" +# list targets that do not create files (but not all makes understand .PHONY) +.PHONY: all $(PLATS) default o a clean depend echo none # DO NOT DELETE diff --git a/src/liolib.c b/src/liolib.c index fd7894c9..bb3b5194 100644 --- a/src/liolib.c +++ b/src/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.71 2006/01/17 13:54:02 roberto Exp $ +** $Id: liolib.c,v 2.72 2006/01/28 12:59:13 roberto Exp $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -283,7 +283,7 @@ static int read_line (lua_State *L, FILE *f) { return (lua_strlen(L, -1) > 0); /* check whether read something */ } l = strlen(p); - if (p[l-1] != '\n') + if (l == 0 || p[l-1] != '\n') luaL_addsize(&b, l); else { luaL_addsize(&b, l - 1); /* do not include `eol' */ @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 2.18 2006/01/23 20:06:19 roberto Exp $ +** $Id: llex.c,v 2.19 2006/02/06 18:28:16 roberto Exp $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -166,7 +166,7 @@ static int check_next (LexState *ls, const char *set) { static void buffreplace (LexState *ls, char from, char to) { - int n = luaZ_bufflen(ls->buff); + size_t n = luaZ_bufflen(ls->buff); char *p = luaZ_buffer(ls->buff); while (n--) if (p[n] == from) p[n] = to; diff --git a/src/loslib.c b/src/loslib.c index 235377e4..509d7b72 100644 --- a/src/loslib.c +++ b/src/loslib.c @@ -1,5 +1,5 @@ /* -** $Id: loslib.c,v 1.16 2005/12/22 16:19:56 roberto Exp $ +** $Id: loslib.c,v 1.17 2006/01/27 13:54:31 roberto Exp $ ** Standard Operating System library ** See Copyright Notice in lua.h */ @@ -21,6 +21,7 @@ static int os_pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ if (i) { lua_pushboolean(L, 1); return 1; @@ -28,10 +29,10 @@ static int os_pushresult (lua_State *L, int i, const char *filename) { else { lua_pushnil(L); if (filename) - lua_pushfstring(L, "%s: %s", filename, strerror(errno)); + lua_pushfstring(L, "%s: %s", filename, strerror(en)); else - lua_pushfstring(L, "%s", strerror(errno)); - lua_pushinteger(L, errno); + lua_pushfstring(L, "%s", strerror(en)); + lua_pushinteger(L, en); return 3; } } diff --git a/src/lstate.h b/src/lstate.h index e8bc15ab..d296a4ca 100644 --- a/src/lstate.h +++ b/src/lstate.h @@ -1,5 +1,5 @@ /* -** $Id: lstate.h,v 2.23 2005/07/09 13:22:34 roberto Exp $ +** $Id: lstate.h,v 2.24 2006/02/06 18:27:59 roberto Exp $ ** Global State ** See Copyright Notice in lua.h */ @@ -49,8 +49,8 @@ typedef struct CallInfo { StkId base; /* base for this function */ StkId func; /* function index in the stack */ StkId top; /* top for this function */ - int nresults; /* expected number of results from this function */ const Instruction *savedpc; + int nresults; /* expected number of results from this function */ int tailcalls; /* number of tail calls lost under this entry */ } CallInfo; @@ -71,9 +71,9 @@ typedef struct global_State { void *ud; /* auxiliary data to `frealloc' */ lu_byte currentwhite; lu_byte gcstate; /* state of garbage collector */ + int sweepstrgc; /* position of sweep in `strt' */ GCObject *rootgc; /* list of all collectable objects */ GCObject **sweepgc; /* position of sweep in `rootgc' */ - int sweepstrgc; /* position of sweep in `strt' */ GCObject *gray; /* list of gray objects */ GCObject *grayagain; /* list of objects to be traversed atomically */ GCObject *weak; /* list of weak tables (to be cleared) */ @@ -99,6 +99,7 @@ typedef struct global_State { */ struct lua_State { CommonHeader; + lu_byte status; StkId top; /* first free slot in the stack */ StkId base; /* base of current function */ global_State *l_G; @@ -106,14 +107,13 @@ struct lua_State { const Instruction *savedpc; /* `savedpc' of current function */ StkId stack_last; /* last free slot in the stack */ StkId stack; /* stack base */ - int stacksize; CallInfo *end_ci; /* points after end of ci array*/ CallInfo *base_ci; /* array of CallInfo's */ + int stacksize; int size_ci; /* size of array `base_ci' */ unsigned short nCcalls; /* number of nested C calls */ lu_byte hookmask; lu_byte allowhook; - lu_byte status; int basehookcount; int hookcount; lua_Hook hook; diff --git a/src/luaconf.h b/src/luaconf.h index 56705985..3f3e2bbe 100644 --- a/src/luaconf.h +++ b/src/luaconf.h @@ -1,5 +1,5 @@ /* -** $Id: luaconf.h,v 1.79 2006/01/23 19:51:43 roberto Exp $ +** $Id: luaconf.h,v 1.80 2006/01/27 13:54:39 roberto Exp $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ @@ -541,7 +541,7 @@ */ /* On a Pentium, resort to a trick */ -#if !defined(LUA_ANSI) && !defined(__SSE2__) && \ +#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ (defined(__i386) || defined (_M_IX86) || defined(__i386__)) union luai_Cast { double l_d; long l_l; }; #define lua_number2int(i,d) \ |