diff options
author | Lua Team <team@lua.org> | 2007-03-26 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2007-03-26 12:00:00 +0000 |
commit | d368f86a9d2a03bd5c3c0fae7f626ea8e2e6dc59 (patch) | |
tree | ae37b73d0b2f8224eb6c1cdbe5d474b511266acc | |
parent | cf61d326a6adbeb4ea9467af3fe4da1af8784f01 (diff) | |
download | lua-github-5.1.2-rc3.tar.gz |
Lua 5.1.2-rc35.1.2-rc3
-rw-r--r-- | COPYRIGHT | 2 | ||||
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | INSTALL | 9 | ||||
-rw-r--r-- | doc/manual.html | 10 | ||||
-rw-r--r-- | src/loadlib.c | 27 | ||||
-rw-r--r-- | src/lvm.c | 4 | ||||
-rw-r--r-- | src/print.c | 3 |
7 files changed, 30 insertions, 27 deletions
@@ -9,7 +9,7 @@ For details and rationale, see http://www.lua.org/license.html . =============================================================================== -Copyright (C) 1994-2006 Lua.org, PUC-Rio. +Copyright (C) 1994-2007 Lua.org, PUC-Rio. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -14,7 +14,7 @@ HISTORY for Lua 5.1 API: + new functions: lua_createtable, lua_get(set)field, lua_push(to)integer. + user supplies memory allocator (lua_open becomes lua_newstate). - + luaopen_* functionst must be called through Lua. + + luaopen_* functions must be called through Lua. Implementation: + new configuration scheme via luaconf.h. + incremental garbage collection. @@ -8,7 +8,10 @@ INSTALL for Lua 5.1 Building Lua on Unix systems should be very easy. First do "make" and see if your platform is listed. If so, just do "make xxx", where xxx is your platform name. The platforms currently supported are: - ansi bsd generic linux macosx mingw posix solaris + aix ansi bsd freebsd generic linux macosx mingw posix solaris + + If your platform is not listed, try the closest one or posix, generic, + ansi, in this order. See below for customization instructions and for instructions on how to build with other Windows compilers. @@ -81,8 +84,8 @@ INSTALL for Lua 5.1 compiler: library, luac.c print.c - If you use Visual Studio .NET, you can use etc/luavs.bat - in its "Command Prompt". + If you use Visual Studio .NET, you can use etc/luavs.bat in its + "Command Prompt". If all you want is to build the Lua interpreter, you may put all .c files in a single project, except for luac.c and print.c. Or just use etc/all.c. diff --git a/doc/manual.html b/doc/manual.html index 6203f824..6b137ff6 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -890,8 +890,8 @@ function definitions are explained in <a href="#2.5.9">§2.5.9</a>; function calls are explained in <a href="#2.5.8">§2.5.8</a>; table constructors are explained in <a href="#2.5.7">§2.5.7</a>. Vararg expressions, -denoted by three dots ('<code>...</code>'), can only be used inside -vararg functions; +denoted by three dots ('<code>...</code>'), can only be used when +directly inside a vararg function; they are explained in <a href="#2.5.9">§2.5.9</a>. @@ -3222,7 +3222,7 @@ and returns this address. <p> -Userdata represents C values in Lua. +Userdata represent C values in Lua. A <em>full userdata</em> represents a block of memory. It is an object (like a table): you must create it, it can have its own metatable, @@ -3498,7 +3498,7 @@ Pushes a light userdata onto the stack. <p> -Userdata represents C values in Lua. +Userdata represent C values in Lua. A <em>light userdata</em> represents a pointer. It is a value (like a number): you do not create it, it has no individual metatable, @@ -8511,7 +8511,7 @@ Here is the complete syntax of Lua in extended BNF. <HR> <SMALL> Last update: -Fri Mar 23 14:37:09 BRT 2007 +Mon Mar 26 12:59:26 BRT 2007 </SMALL> <!-- Last change: ready for Lua 5.1.2 diff --git a/src/loadlib.c b/src/loadlib.c index 08722e18..767383df 100644 --- a/src/loadlib.c +++ b/src/loadlib.c @@ -1,5 +1,5 @@ /* -** $Id: loadlib.c,v 1.52 2006/04/10 18:27:23 roberto Exp $ +** $Id: loadlib.c,v 1.54a 2006/07/03 20:16:49 roberto Exp $ ** Dynamic library loader for Lua ** See Copyright Notice in lua.h ** @@ -16,9 +16,9 @@ #define loadlib_c #define LUA_LIB -#include "lauxlib.h" -#include "lobject.h" #include "lua.h" + +#include "lauxlib.h" #include "lualib.h" @@ -356,15 +356,16 @@ static const char *findfile (lua_State *L, const char *name, path = lua_tostring(L, -1); if (path == NULL) luaL_error(L, LUA_QL("package.%s") " must be a string", pname); - lua_pushstring(L, ""); /* error accumulator */ + lua_pushliteral(L, ""); /* error accumulator */ while ((path = pushnexttemplate(L, path)) != NULL) { const char *filename; filename = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name); + lua_remove(L, -2); /* remove path template */ if (readable(filename)) /* does file exist and is readable? */ return filename; /* return that file name */ - lua_pop(L, 2); /* remove path template and file name */ - luaO_pushfstring(L, "\n\tno file " LUA_QS, filename); - lua_concat(L, 2); + lua_pushfstring(L, "\n\tno file " LUA_QS, filename); + lua_remove(L, -2); /* remove file name */ + lua_concat(L, 2); /* add entry to possible error message */ } return NULL; /* not found */ } @@ -423,8 +424,8 @@ static int loader_Croot (lua_State *L) { funcname = mkfuncname(L, name); if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { if (stat != ERRFUNC) loaderror(L, filename); /* real error */ - luaO_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, - name, filename); + lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, + name, filename); return 1; /* function not found */ } return 1; @@ -438,7 +439,7 @@ static int loader_preload (lua_State *L) { luaL_error(L, LUA_QL("package.preload") " must be a table"); lua_getfield(L, -1, name); if (lua_isnil(L, -1)) /* not found? */ - luaO_pushfstring(L, "\n\tno field package.preload['%s']", name); + lua_pushfstring(L, "\n\tno field package.preload['%s']", name); return 1; } @@ -462,7 +463,7 @@ static int ll_require (lua_State *L) { lua_getfield(L, LUA_ENVIRONINDEX, "loaders"); if (!lua_istable(L, -1)) luaL_error(L, LUA_QL("package.loaders") " must be a table"); - lua_pushstring(L, ""); /* error message accumulator */ + lua_pushliteral(L, ""); /* error message accumulator */ for (i=1; ; i++) { lua_rawgeti(L, -2, i); /* get a loader */ if (lua_isnil(L, -1)) @@ -646,8 +647,8 @@ LUALIB_API int luaopen_package (lua_State *L) { setpath(L, "path", LUA_PATH, LUA_PATH_DEFAULT); /* set field `path' */ setpath(L, "cpath", LUA_CPATH, LUA_CPATH_DEFAULT); /* set field `cpath' */ /* store config information */ - lua_pushstring(L, LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" - LUA_EXECDIR "\n" LUA_IGMARK); + lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" + LUA_EXECDIR "\n" LUA_IGMARK); lua_setfield(L, -2, "config"); /* set field `loaded' */ luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 2); @@ -165,7 +165,7 @@ static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ if (ttisnil(tm)) tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ - if (!ttisfunction(tm)) return 0; + if (ttisnil(tm)) return 0; callTMres(L, res, tm, p1, p2); return 1; } @@ -285,7 +285,7 @@ void luaV_concat (lua_State *L, int total, int last) { if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) luaG_concaterror(L, top-2, top-1); } else if (tsvalue(top-1)->len == 0) /* second op is empty? */ - tostring(L, top - 2); /* result is first op (as string) */ + (void)tostring(L, top - 2); /* result is first op (as string) */ else { /* at least two string values; get as many as possible */ size_t tl = tsvalue(top-1)->len; diff --git a/src/print.c b/src/print.c index 430af836..e240cfc3 100644 --- a/src/print.c +++ b/src/print.c @@ -23,8 +23,7 @@ static void PrintString(const TString* ts) { const char* s=getstr(ts); - int n=ts->tsv.len; - int i; + size_t i,n=ts->tsv.len; putchar('"'); for (i=0; i<n; i++) { |