diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-05-17 16:49:15 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-05-17 16:49:15 -0300 |
| commit | 67578ec51f1a3ec2c967f15d370067caf9e0b87b (patch) | |
| tree | d77b292ddec33d7e6987bae808fa1db250ebd830 | |
| parent | c2bb9abceceef125554595e23b7cc18ad3555c7c (diff) | |
| download | lua-67578ec51f1a3ec2c967f15d370067caf9e0b87b.tar.gz lua-67578ec51f1a3ec2c967f15d370067caf9e0b87b.tar.bz2 lua-67578ec51f1a3ec2c967f15d370067caf9e0b87b.zip | |
several small details
| -rw-r--r-- | lapi.c | 6 | ||||
| -rw-r--r-- | lauxlib.c | 10 | ||||
| -rw-r--r-- | lbaselib.c | 10 | ||||
| -rw-r--r-- | ldblib.c | 8 | ||||
| -rw-r--r-- | ldebug.c | 4 | ||||
| -rw-r--r-- | ldump.c | 7 | ||||
| -rw-r--r-- | llex.c | 4 | ||||
| -rw-r--r-- | loadlib.c | 24 | ||||
| -rw-r--r-- | loslib.c | 6 | ||||
| -rw-r--r-- | lparser.c | 14 | ||||
| -rw-r--r-- | lstrlib.c | 11 | ||||
| -rw-r--r-- | ltable.c | 4 | ||||
| -rw-r--r-- | ltablib.c | 4 | ||||
| -rw-r--r-- | lua.c | 15 | ||||
| -rw-r--r-- | lua.h | 43 | ||||
| -rw-r--r-- | luaconf.h | 97 | ||||
| -rw-r--r-- | lundump.h | 4 | ||||
| -rw-r--r-- | lvm.c | 8 | ||||
| -rw-r--r-- | lzio.c | 4 | ||||
| -rw-r--r-- | lzio.h | 6 |
20 files changed, 152 insertions, 137 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.39 2005/05/05 15:34:03 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.40 2005/05/16 19:21:11 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 | */ |
| @@ -846,7 +846,7 @@ LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { | |||
| 846 | } | 846 | } |
| 847 | 847 | ||
| 848 | 848 | ||
| 849 | LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *data, | 849 | LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, |
| 850 | const char *chunkname) { | 850 | const char *chunkname) { |
| 851 | ZIO z; | 851 | ZIO z; |
| 852 | int status; | 852 | int status; |
| @@ -859,7 +859,7 @@ LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *data, | |||
| 859 | } | 859 | } |
| 860 | 860 | ||
| 861 | 861 | ||
| 862 | LUA_API int lua_dump (lua_State *L, lua_Chunkwriter writer, void *data) { | 862 | LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) { |
| 863 | int status; | 863 | int status; |
| 864 | TValue *o; | 864 | TValue *o; |
| 865 | lua_lock(L); | 865 | lua_lock(L); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.131 2005/05/16 19:21:11 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.132 2005/05/16 21:19:00 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 | */ |
| @@ -47,12 +47,12 @@ LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { | |||
| 47 | if (strcmp(ar.namewhat, "method") == 0) { | 47 | if (strcmp(ar.namewhat, "method") == 0) { |
| 48 | narg--; /* do not count `self' */ | 48 | narg--; /* do not count `self' */ |
| 49 | if (narg == 0) /* error is in the self argument itself? */ | 49 | if (narg == 0) /* error is in the self argument itself? */ |
| 50 | return luaL_error(L, "calling " LUA_SM " on bad self (%s)", | 50 | return luaL_error(L, "calling " LUA_QS " on bad self (%s)", |
| 51 | ar.name, extramsg); | 51 | ar.name, extramsg); |
| 52 | } | 52 | } |
| 53 | if (ar.name == NULL) | 53 | if (ar.name == NULL) |
| 54 | ar.name = "?"; | 54 | ar.name = "?"; |
| 55 | return luaL_error(L, "bad argument #%d to " LUA_SM " (%s)", | 55 | return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)", |
| 56 | narg, ar.name, extramsg); | 56 | narg, ar.name, extramsg); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| @@ -245,7 +245,7 @@ LUALIB_API void luaL_openlib (lua_State *L, const char *libname, | |||
| 245 | luaL_setfield(L, LUA_GLOBALSINDEX, libname); | 245 | luaL_setfield(L, LUA_GLOBALSINDEX, libname); |
| 246 | } | 246 | } |
| 247 | else if (!lua_istable(L, -1)) | 247 | else if (!lua_istable(L, -1)) |
| 248 | luaL_error(L, "name conflict for library " LUA_SM, libname); | 248 | luaL_error(L, "name conflict for library " LUA_QS, libname); |
| 249 | lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); | 249 | lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); |
| 250 | lua_pushvalue(L, -2); | 250 | lua_pushvalue(L, -2); |
| 251 | lua_setfield(L, -2, libname); /* _LOADED[modname] = new table */ | 251 | lua_setfield(L, -2, libname); /* _LOADED[modname] = new table */ |
| @@ -366,7 +366,7 @@ LUALIB_API const char *luaL_searchpath (lua_State *L, const char *name, | |||
| 366 | for (;;) { | 366 | for (;;) { |
| 367 | const char *fname; | 367 | const char *fname; |
| 368 | if ((p = pushnexttemplate(L, p)) == NULL) { | 368 | if ((p = pushnexttemplate(L, p)) == NULL) { |
| 369 | lua_pushfstring(L, "no readable " LUA_SM " in path " LUA_SM "", | 369 | lua_pushfstring(L, "no readable " LUA_QS " in path " LUA_QS "", |
| 370 | name, path); | 370 | name, path); |
| 371 | return NULL; | 371 | return NULL; |
| 372 | } | 372 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.174 2005/05/16 19:21:11 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.175 2005/05/16 21:19:00 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 | */ |
| @@ -39,8 +39,8 @@ static int luaB_print (lua_State *L) { | |||
| 39 | lua_call(L, 1, 1); | 39 | lua_call(L, 1, 1); |
| 40 | s = lua_tostring(L, -1); /* get result */ | 40 | s = lua_tostring(L, -1); /* get result */ |
| 41 | if (s == NULL) | 41 | if (s == NULL) |
| 42 | return luaL_error(L, LUA_SM " must return a string to " LUA_SM, | 42 | return luaL_error(L, LUA_QL("tostring") " must return a string to " |
| 43 | "tostring", "print"); | 43 | LUA_QL("print")); |
| 44 | if (i>1) fputs("\t", stdout); | 44 | if (i>1) fputs("\t", stdout); |
| 45 | fputs(s, stdout); | 45 | fputs(s, stdout); |
| 46 | lua_pop(L, 1); /* pop result */ | 46 | lua_pop(L, 1); /* pop result */ |
| @@ -149,8 +149,8 @@ static int luaB_setfenv (lua_State *L) { | |||
| 149 | return 0; | 149 | return 0; |
| 150 | } | 150 | } |
| 151 | else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0) | 151 | else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0) |
| 152 | luaL_error(L, LUA_SM " cannot change environment of given object", | 152 | luaL_error(L, |
| 153 | "setfenv"); | 153 | LUA_QL("setfenv") " cannot change environment of given object"); |
| 154 | return 1; | 154 | return 1; |
| 155 | } | 155 | } |
| 156 | 156 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldblib.c,v 1.96 2005/05/16 18:45:15 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.97 2005/05/16 21:19:00 roberto Exp roberto $ |
| 3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -48,8 +48,8 @@ static int db_setfenv (lua_State *L) { | |||
| 48 | luaL_checktype(L, 2, LUA_TTABLE); | 48 | luaL_checktype(L, 2, LUA_TTABLE); |
| 49 | lua_settop(L, 2); | 49 | lua_settop(L, 2); |
| 50 | if (lua_setfenv(L, 1) == 0) | 50 | if (lua_setfenv(L, 1) == 0) |
| 51 | luaL_error(L, LUA_SM " cannot change environment of given object", | 51 | luaL_error(L, LUA_QL("setfenv") |
| 52 | "setfenv"); | 52 | " cannot change environment of given object"); |
| 53 | return 1; | 53 | return 1; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| @@ -348,7 +348,7 @@ static int db_errorfb (lua_State *L) { | |||
| 348 | if (ar.currentline > 0) | 348 | if (ar.currentline > 0) |
| 349 | lua_pushfstring(L, "%d:", ar.currentline); | 349 | lua_pushfstring(L, "%d:", ar.currentline); |
| 350 | if (*ar.namewhat != '\0') /* is there a name? */ | 350 | if (*ar.namewhat != '\0') /* is there a name? */ |
| 351 | lua_pushfstring(L, " in function " LUA_SM, ar.name); | 351 | lua_pushfstring(L, " in function " LUA_QS, ar.name); |
| 352 | else { | 352 | else { |
| 353 | if (*ar.what == 'm') /* main? */ | 353 | if (*ar.what == 'm') /* main? */ |
| 354 | lua_pushfstring(L, " in main chunk"); | 354 | lua_pushfstring(L, " in main chunk"); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 2.18 2005/05/16 18:45:15 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.19 2005/05/16 21:19:00 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -548,7 +548,7 @@ void luaG_typeerror (lua_State *L, const TValue *o, const char *op) { | |||
| 548 | const char *kind = (isinstack(L->ci, o)) ? | 548 | const char *kind = (isinstack(L->ci, o)) ? |
| 549 | getobjname(L, L->ci, o - L->base, &name) : NULL; | 549 | getobjname(L, L->ci, o - L->base, &name) : NULL; |
| 550 | if (kind) | 550 | if (kind) |
| 551 | luaG_runerror(L, "attempt to %s %s " LUA_SM " (a %s value)", | 551 | luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)", |
| 552 | op, kind, name, t); | 552 | op, kind, name, t); |
| 553 | else | 553 | else |
| 554 | luaG_runerror(L, "attempt to %s a %s value", op, t); | 554 | luaG_runerror(L, "attempt to %s a %s value", op, t); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldump.c,v 2.4 2004/10/04 19:01:12 roberto Exp roberto $ | 2 | ** $Id: ldump.c,v 2.5 2005/05/05 20:47:02 roberto Exp roberto $ |
| 3 | ** save pre-compiled Lua chunks | 3 | ** save pre-compiled Lua chunks |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -21,7 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | typedef struct { | 22 | typedef struct { |
| 23 | lua_State* L; | 23 | lua_State* L; |
| 24 | lua_Chunkwriter writer; | 24 | lua_Writer writer; |
| 25 | void* data; | 25 | void* data; |
| 26 | int strip; | 26 | int strip; |
| 27 | int status; | 27 | int status; |
| @@ -164,7 +164,8 @@ static void DumpHeader(DumpState* D) | |||
| 164 | /* | 164 | /* |
| 165 | ** dump Lua function as precompiled chunk | 165 | ** dump Lua function as precompiled chunk |
| 166 | */ | 166 | */ |
| 167 | int luaU_dump (lua_State* L, const Proto* f, lua_Chunkwriter w, void* data, int strip) | 167 | int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, |
| 168 | int strip) | ||
| 168 | { | 169 | { |
| 169 | DumpState D; | 170 | DumpState D; |
| 170 | D.L=L; | 171 | D.L=L; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llex.c,v 2.10 2005/04/27 18:37:51 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.11 2005/05/16 21:19:00 roberto Exp roberto $ |
| 3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -102,7 +102,7 @@ void luaX_lexerror (LexState *ls, const char *msg, int token) { | |||
| 102 | luaO_chunkid(buff, getstr(ls->source), MAXSRC); | 102 | luaO_chunkid(buff, getstr(ls->source), MAXSRC); |
| 103 | msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); | 103 | msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); |
| 104 | if (token) | 104 | if (token) |
| 105 | luaO_pushfstring(ls->L, "%s near " LUA_SM, msg, txtToken(ls, token)); | 105 | luaO_pushfstring(ls->L, "%s near " LUA_QS, msg, txtToken(ls, token)); |
| 106 | luaD_throw(ls->L, LUA_ERRSYNTAX); | 106 | luaD_throw(ls->L, LUA_ERRSYNTAX); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: loadlib.c,v 1.26 2005/04/13 17:24:20 roberto Exp roberto $ | 2 | ** $Id: loadlib.c,v 1.27 2005/05/16 21:19:00 roberto Exp roberto $ |
| 3 | ** Dynamic library loader for Lua | 3 | ** Dynamic library loader for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | ** | 5 | ** |
| @@ -191,7 +191,7 @@ static void *ll_load (lua_State *L, const char *path) { | |||
| 191 | static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { | 191 | static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { |
| 192 | NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym); | 192 | NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym); |
| 193 | if (nss == NULL) { | 193 | if (nss == NULL) { |
| 194 | lua_pushfstring(L, "symbol " LUA_SM " not found", sym); | 194 | lua_pushfstring(L, "symbol " LUA_QS " not found", sym); |
| 195 | return NULL; | 195 | return NULL; |
| 196 | } | 196 | } |
| 197 | return (lua_CFunction)NSAddressOfSymbol(nss); | 197 | return (lua_CFunction)NSAddressOfSymbol(nss); |
| @@ -213,9 +213,9 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { | |||
| 213 | 213 | ||
| 214 | 214 | ||
| 215 | #if defined(__ELF__) || defined(__sun) || defined(sgi) || defined(__hpux) | 215 | #if defined(__ELF__) || defined(__sun) || defined(sgi) || defined(__hpux) |
| 216 | #define DLMSG "'loadlib' not enabled; check your Lua installation" | 216 | #define DLMSG LUA_QL("loadlib") " not enabled; check your Lua installation" |
| 217 | #else | 217 | #else |
| 218 | #define DLMSG "'loadlib' not supported" | 218 | #define DLMSG LUA_QL("loadlib") " not supported" |
| 219 | #endif | 219 | #endif |
| 220 | 220 | ||
| 221 | static void ll_unloadlib (void *lib) { | 221 | static void ll_unloadlib (void *lib) { |
| @@ -327,11 +327,11 @@ static int loader_Lua (lua_State *L) { | |||
| 327 | path = lua_tostring(L, -1); | 327 | path = lua_tostring(L, -1); |
| 328 | } | 328 | } |
| 329 | if (path == NULL) | 329 | if (path == NULL) |
| 330 | luaL_error(L, LUA_SM " must be a string", "package.path"); | 330 | luaL_error(L, LUA_QL("package.path") " must be a string"); |
| 331 | fname = luaL_searchpath(L, fname, path); | 331 | fname = luaL_searchpath(L, fname, path); |
| 332 | if (fname == NULL) return 0; /* library not found in this path */ | 332 | if (fname == NULL) return 0; /* library not found in this path */ |
| 333 | if (luaL_loadfile(L, fname) != 0) | 333 | if (luaL_loadfile(L, fname) != 0) |
| 334 | luaL_error(L, "error loading package " LUA_SM " (%s)", | 334 | luaL_error(L, "error loading package " LUA_QS " (%s)", |
| 335 | name, lua_tostring(L, -1)); | 335 | name, lua_tostring(L, -1)); |
| 336 | return 1; /* library loaded successfully */ | 336 | return 1; /* library loaded successfully */ |
| 337 | } | 337 | } |
| @@ -345,13 +345,13 @@ static int loader_C (lua_State *L) { | |||
| 345 | lua_getfield(L, LUA_ENVIRONINDEX, "cpath"); | 345 | lua_getfield(L, LUA_ENVIRONINDEX, "cpath"); |
| 346 | path = lua_tostring(L, -1); | 346 | path = lua_tostring(L, -1); |
| 347 | if (path == NULL) | 347 | if (path == NULL) |
| 348 | luaL_error(L, LUA_SM " must be a string", "package.cpath"); | 348 | luaL_error(L, LUA_QL("package.cpath") " must be a string"); |
| 349 | fname = luaL_searchpath(L, fname, path); | 349 | fname = luaL_searchpath(L, fname, path); |
| 350 | if (fname == NULL) return 0; /* library not found in this path */ | 350 | if (fname == NULL) return 0; /* library not found in this path */ |
| 351 | funcname = luaL_gsub(L, name, ".", LUA_OFSEP); | 351 | funcname = luaL_gsub(L, name, ".", LUA_OFSEP); |
| 352 | funcname = lua_pushfstring(L, "%s%s", POF, funcname); | 352 | funcname = lua_pushfstring(L, "%s%s", POF, funcname); |
| 353 | if (ll_loadfunc(L, fname, funcname) != 1) | 353 | if (ll_loadfunc(L, fname, funcname) != 1) |
| 354 | luaL_error(L, "error loading package " LUA_SM " (%s)", | 354 | luaL_error(L, "error loading package " LUA_QS " (%s)", |
| 355 | name, lua_tostring(L, -2)); | 355 | name, lua_tostring(L, -2)); |
| 356 | return 1; /* library loaded successfully */ | 356 | return 1; /* library loaded successfully */ |
| 357 | } | 357 | } |
| @@ -360,7 +360,7 @@ static int loader_C (lua_State *L) { | |||
| 360 | static int loader_preload (lua_State *L) { | 360 | static int loader_preload (lua_State *L) { |
| 361 | lua_getfield(L, LUA_ENVIRONINDEX, "preload"); | 361 | lua_getfield(L, LUA_ENVIRONINDEX, "preload"); |
| 362 | if (!lua_istable(L, -1)) | 362 | if (!lua_istable(L, -1)) |
| 363 | luaL_error(L, LUA_SM " must be a table", "package.preload"); | 363 | luaL_error(L, LUA_QL("package.preload") " must be a table"); |
| 364 | lua_getfield(L, -1, luaL_checkstring(L, 1)); | 364 | lua_getfield(L, -1, luaL_checkstring(L, 1)); |
| 365 | return 1; | 365 | return 1; |
| 366 | } | 366 | } |
| @@ -380,11 +380,11 @@ static int ll_require (lua_State *L) { | |||
| 380 | /* iterate over available loaders */ | 380 | /* iterate over available loaders */ |
| 381 | lua_getfield(L, LUA_ENVIRONINDEX, "loaders"); | 381 | lua_getfield(L, LUA_ENVIRONINDEX, "loaders"); |
| 382 | if (!lua_istable(L, -1)) | 382 | if (!lua_istable(L, -1)) |
| 383 | luaL_error(L, LUA_SM " must be a table", "package.loaders"); | 383 | luaL_error(L, LUA_QL("package.loaders") " must be a table"); |
| 384 | for (i=1;; i++) { | 384 | for (i=1;; i++) { |
| 385 | lua_rawgeti(L, -1, i); /* get a loader */ | 385 | lua_rawgeti(L, -1, i); /* get a loader */ |
| 386 | if (lua_isnil(L, -1)) | 386 | if (lua_isnil(L, -1)) |
| 387 | return luaL_error(L, "package " LUA_SM " not found", name); | 387 | return luaL_error(L, "package " LUA_QS " not found", name); |
| 388 | lua_pushstring(L, name); | 388 | lua_pushstring(L, name); |
| 389 | lua_call(L, 1, 1); /* call it */ | 389 | lua_call(L, 1, 1); /* call it */ |
| 390 | if (lua_isnil(L, -1)) lua_pop(L, 1); | 390 | if (lua_isnil(L, -1)) lua_pop(L, 1); |
| @@ -423,7 +423,7 @@ static int ll_module (lua_State *L) { | |||
| 423 | luaL_setfield(L, LUA_GLOBALSINDEX, modname); | 423 | luaL_setfield(L, LUA_GLOBALSINDEX, modname); |
| 424 | } | 424 | } |
| 425 | else if (!lua_istable(L, -1)) | 425 | else if (!lua_istable(L, -1)) |
| 426 | return luaL_error(L, "name conflict for module " LUA_SM, modname); | 426 | return luaL_error(L, "name conflict for module " LUA_QS, modname); |
| 427 | /* check whether table already has a _NAME field */ | 427 | /* check whether table already has a _NAME field */ |
| 428 | lua_getfield(L, -1, "_NAME"); | 428 | lua_getfield(L, -1, "_NAME"); |
| 429 | if (!lua_isnil(L, -1)) /* is table an initialized module? */ | 429 | if (!lua_isnil(L, -1)) /* is table an initialized module? */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: loslib.c,v 1.7 2005/03/18 18:02:04 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.8 2005/05/16 21:19:00 roberto Exp roberto $ |
| 3 | ** Standard Operating System library | 3 | ** Standard Operating System library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -113,7 +113,7 @@ static int getfield (lua_State *L, const char *key, int d) { | |||
| 113 | res = (int)lua_tointeger(L, -1); | 113 | res = (int)lua_tointeger(L, -1); |
| 114 | else { | 114 | else { |
| 115 | if (d < 0) | 115 | if (d < 0) |
| 116 | return luaL_error(L, "field " LUA_SM " missing in date table", key); | 116 | return luaL_error(L, "field " LUA_QS " missing in date table", key); |
| 117 | res = d; | 117 | res = d; |
| 118 | } | 118 | } |
| 119 | lua_pop(L, 1); | 119 | lua_pop(L, 1); |
| @@ -151,7 +151,7 @@ static int io_date (lua_State *L) { | |||
| 151 | if (strftime(b, sizeof(b), s, stm)) | 151 | if (strftime(b, sizeof(b), s, stm)) |
| 152 | lua_pushstring(L, b); | 152 | lua_pushstring(L, b); |
| 153 | else | 153 | else |
| 154 | return luaL_error(L, LUA_SM " format too long", "date"); | 154 | return luaL_error(L, LUA_QL("date") " format too long"); |
| 155 | } | 155 | } |
| 156 | return 1; | 156 | return 1; |
| 157 | } | 157 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.c,v 2.25 2005/05/05 20:47:02 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.26 2005/05/16 21:19:00 roberto Exp roberto $ |
| 3 | ** Lua Parser | 3 | ** Lua Parser |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -82,7 +82,7 @@ static void anchor_token (LexState *ls) { | |||
| 82 | 82 | ||
| 83 | static void error_expected (LexState *ls, int token) { | 83 | static void error_expected (LexState *ls, int token) { |
| 84 | luaX_syntaxerror(ls, | 84 | luaX_syntaxerror(ls, |
| 85 | luaO_pushfstring(ls->L, LUA_SM " expected", luaX_token2str(ls, token))); | 85 | luaO_pushfstring(ls->L, LUA_QS " expected", luaX_token2str(ls, token))); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | 88 | ||
| @@ -125,7 +125,7 @@ static void check_match (LexState *ls, int what, int who, int where) { | |||
| 125 | error_expected(ls, what); | 125 | error_expected(ls, what); |
| 126 | else { | 126 | else { |
| 127 | luaX_syntaxerror(ls, luaO_pushfstring(ls->L, | 127 | luaX_syntaxerror(ls, luaO_pushfstring(ls->L, |
| 128 | LUA_SM " expected (to close " LUA_SM " at line %d)", | 128 | LUA_QS " expected (to close " LUA_QS " at line %d)", |
| 129 | luaX_token2str(ls, what), luaX_token2str(ls, who), where)); | 129 | luaX_token2str(ls, what), luaX_token2str(ls, who), where)); |
| 130 | } | 130 | } |
| 131 | } | 131 | } |
| @@ -577,7 +577,7 @@ static void parlist (LexState *ls) { | |||
| 577 | f->is_vararg = 1; | 577 | f->is_vararg = 1; |
| 578 | break; | 578 | break; |
| 579 | } | 579 | } |
| 580 | default: luaX_syntaxerror(ls, "<name> or '...' expected"); | 580 | default: luaX_syntaxerror(ls, "<name> or " LUA_QL("...") " expected"); |
| 581 | } | 581 | } |
| 582 | } while (!f->is_vararg && testnext(ls, ',')); | 582 | } while (!f->is_vararg && testnext(ls, ',')); |
| 583 | } | 583 | } |
| @@ -765,7 +765,7 @@ static void simpleexp (LexState *ls, expdesc *v) { | |||
| 765 | case TK_DOTS: { /* vararg */ | 765 | case TK_DOTS: { /* vararg */ |
| 766 | FuncState *fs = ls->fs; | 766 | FuncState *fs = ls->fs; |
| 767 | check_condition(ls, fs->f->is_vararg, | 767 | check_condition(ls, fs->f->is_vararg, |
| 768 | "cannot use '...' outside a vararg function"); | 768 | "cannot use " LUA_QL("...") " outside a vararg function"); |
| 769 | fs->f->is_vararg = NEWSTYLEVARARG; | 769 | fs->f->is_vararg = NEWSTYLEVARARG; |
| 770 | init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); | 770 | init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); |
| 771 | break; | 771 | break; |
| @@ -1017,7 +1017,7 @@ static void whilestat (LexState *ls, int line) { | |||
| 1017 | fs->jpc = NO_JUMP; | 1017 | fs->jpc = NO_JUMP; |
| 1018 | sizeexp = fs->pc - expinit; /* size of expression code */ | 1018 | sizeexp = fs->pc - expinit; /* size of expression code */ |
| 1019 | if (sizeexp > LUAI_MAXEXPWHILE) | 1019 | if (sizeexp > LUAI_MAXEXPWHILE) |
| 1020 | luaX_syntaxerror(ls, "'while' condition too complex"); | 1020 | luaX_syntaxerror(ls, LUA_QL("while") " condition too complex"); |
| 1021 | for (i = 0; i < sizeexp; i++) /* save `exp' code */ | 1021 | for (i = 0; i < sizeexp; i++) /* save `exp' code */ |
| 1022 | codeexp[i] = fs->f->code[expinit + i]; | 1022 | codeexp[i] = fs->f->code[expinit + i]; |
| 1023 | fs->pc = expinit; /* remove `exp' code */ | 1023 | fs->pc = expinit; /* remove `exp' code */ |
| @@ -1141,7 +1141,7 @@ static void forstat (LexState *ls, int line) { | |||
| 1141 | switch (ls->t.token) { | 1141 | switch (ls->t.token) { |
| 1142 | case '=': fornum(ls, varname, line); break; | 1142 | case '=': fornum(ls, varname, line); break; |
| 1143 | case ',': case TK_IN: forlist(ls, varname); break; | 1143 | case ',': case TK_IN: forlist(ls, varname); break; |
| 1144 | default: luaX_syntaxerror(ls, "'=' or 'in' expected"); | 1144 | default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected"); |
| 1145 | } | 1145 | } |
| 1146 | check_match(ls, TK_END, TK_FOR, line); | 1146 | check_match(ls, TK_END, TK_FOR, line); |
| 1147 | leaveblock(fs); /* loop scope (`break' jumps to this point) */ | 1147 | leaveblock(fs); /* loop scope (`break' jumps to this point) */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstrlib.c,v 1.113 2005/05/16 19:21:11 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.114 2005/05/16 21:19:00 roberto Exp roberto $ |
| 3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -200,14 +200,14 @@ static const char *classend (MatchState *ms, const char *p) { | |||
| 200 | switch (*p++) { | 200 | switch (*p++) { |
| 201 | case L_ESC: { | 201 | case L_ESC: { |
| 202 | if (*p == '\0') | 202 | if (*p == '\0') |
| 203 | luaL_error(ms->L, "malformed pattern (ends with '%%')"); | 203 | luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")"); |
| 204 | return p+1; | 204 | return p+1; |
| 205 | } | 205 | } |
| 206 | case '[': { | 206 | case '[': { |
| 207 | if (*p == '^') p++; | 207 | if (*p == '^') p++; |
| 208 | do { /* look for a `]' */ | 208 | do { /* look for a `]' */ |
| 209 | if (*p == '\0') | 209 | if (*p == '\0') |
| 210 | luaL_error(ms->L, "malformed pattern (missing ']')"); | 210 | luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")"); |
| 211 | if (*(p++) == L_ESC && *p != '\0') | 211 | if (*(p++) == L_ESC && *p != '\0') |
| 212 | p++; /* skip escapes (e.g. `%]') */ | 212 | p++; /* skip escapes (e.g. `%]') */ |
| 213 | } while (*p != ']'); | 213 | } while (*p != ']'); |
| @@ -382,7 +382,8 @@ static const char *match (MatchState *ms, const char *s, const char *p) { | |||
| 382 | const char *ep; char previous; | 382 | const char *ep; char previous; |
| 383 | p += 2; | 383 | p += 2; |
| 384 | if (*p != '[') | 384 | if (*p != '[') |
| 385 | luaL_error(ms->L, "missing '[' after '%%f' in pattern"); | 385 | luaL_error(ms->L, "missing " LUA_QL("[") " after " |
| 386 | LUA_QL("%%f") " in pattern"); | ||
| 386 | ep = classend(ms, p); /* points to what is next */ | 387 | ep = classend(ms, p); /* points to what is next */ |
| 387 | previous = (s == ms->src_init) ? '\0' : *(s-1); | 388 | previous = (s == ms->src_init) ? '\0' : *(s-1); |
| 388 | if (matchbracketclass(uchar(previous), p, ep-1) || | 389 | if (matchbracketclass(uchar(previous), p, ep-1) || |
| @@ -741,7 +742,7 @@ static int str_format (lua_State *L) { | |||
| 741 | } | 742 | } |
| 742 | } | 743 | } |
| 743 | default: { /* also treat cases `pnLlh' */ | 744 | default: { /* also treat cases `pnLlh' */ |
| 744 | return luaL_error(L, "invalid option to " LUA_SM, "format"); | 745 | return luaL_error(L, "invalid option to " LUA_QL("format")); |
| 745 | } | 746 | } |
| 746 | } | 747 | } |
| 747 | luaL_addlstring(&b, buff, strlen(buff)); | 748 | luaL_addlstring(&b, buff, strlen(buff)); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltable.c,v 2.21 2005/05/03 19:30:17 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.22 2005/05/16 21:19:00 roberto Exp roberto $ |
| 3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -151,7 +151,7 @@ static int findindex (lua_State *L, Table *t, StkId key) { | |||
| 151 | } | 151 | } |
| 152 | else n = gnext(n); | 152 | else n = gnext(n); |
| 153 | } while (n); | 153 | } while (n); |
| 154 | luaG_runerror(L, "invalid key to " LUA_SM, "next"); /* key not found */ | 154 | luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ |
| 155 | return 0; /* to avoid warnings */ | 155 | return 0; /* to avoid warnings */ |
| 156 | } | 156 | } |
| 157 | } | 157 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltablib.c,v 1.29 2005/03/28 17:17:53 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.30 2005/05/16 21:19:00 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 | */ |
| @@ -65,7 +65,7 @@ static int setn (lua_State *L) { | |||
| 65 | #ifndef luaL_setn | 65 | #ifndef luaL_setn |
| 66 | luaL_setn(L, 1, luaL_checkint(L, 2)); | 66 | luaL_setn(L, 1, luaL_checkint(L, 2)); |
| 67 | #else | 67 | #else |
| 68 | luaL_error(L, LUA_SM " is obsolete", "setn"); | 68 | luaL_error(L, LUA_QL("setn") " is obsolete"); |
| 69 | #endif | 69 | #endif |
| 70 | lua_pushvalue(L, 1); | 70 | lua_pushvalue(L, 1); |
| 71 | return 1; | 71 | return 1; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.142 2005/04/13 17:24:20 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.143 2005/05/16 21:19:00 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 | */ |
| @@ -44,9 +44,9 @@ static void print_usage (void) { | |||
| 44 | "usage: %s [options] [script [args]].\n" | 44 | "usage: %s [options] [script [args]].\n" |
| 45 | "Available options are:\n" | 45 | "Available options are:\n" |
| 46 | " - execute stdin as a file\n" | 46 | " - execute stdin as a file\n" |
| 47 | " -e stat execute string 'stat'\n" | 47 | " -e stat execute string " LUA_QL("stat") "\n" |
| 48 | " -i enter interactive mode after executing 'script'\n" | 48 | " -i enter interactive mode after executing " LUA_QL("script") "\n" |
| 49 | " -l name require library 'name'\n" | 49 | " -l name require library " LUA_QL("name") "\n" |
| 50 | " -v show version information\n" | 50 | " -v show version information\n" |
| 51 | " -w trap access to undefined globals\n" | 51 | " -w trap access to undefined globals\n" |
| 52 | " -- stop handling options\n" , | 52 | " -- stop handling options\n" , |
| @@ -209,8 +209,9 @@ static void dotty (lua_State *L) { | |||
| 209 | lua_getglobal(L, "print"); | 209 | lua_getglobal(L, "print"); |
| 210 | lua_insert(L, 1); | 210 | lua_insert(L, 1); |
| 211 | if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) | 211 | if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) |
| 212 | l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)", | 212 | l_message(progname, lua_pushfstring(L, |
| 213 | lua_tostring(L, -1))); | 213 | "error calling " LUA_QL("print") " (%s)", |
| 214 | lua_tostring(L, -1))); | ||
| 214 | } | 215 | } |
| 215 | } | 216 | } |
| 216 | lua_settop(L, 0); /* clear stack */ | 217 | lua_settop(L, 0); /* clear stack */ |
| @@ -222,7 +223,7 @@ static void dotty (lua_State *L) { | |||
| 222 | static int checkvar (lua_State *L) { | 223 | static int checkvar (lua_State *L) { |
| 223 | const char *name = lua_tostring(L, 2); | 224 | const char *name = lua_tostring(L, 2); |
| 224 | if (name) | 225 | if (name) |
| 225 | luaL_error(L, "attempt to access undefined variable " LUA_SM, name); | 226 | luaL_error(L, "attempt to access undefined variable " LUA_QS, name); |
| 226 | return 0; | 227 | return 0; |
| 227 | } | 228 | } |
| 228 | 229 | ||
| @@ -1,8 +1,8 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.206 2005/05/05 20:47:02 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.207 2005/05/16 19:21:11 roberto Exp roberto $ |
| 3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
| 4 | ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil | 4 | ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil |
| 5 | ** http://www.lua.org mailto:info@lua.org | 5 | ** http://www.lua.org |
| 6 | ** See Copyright Notice at the end of this file | 6 | ** See Copyright Notice at the end of this file |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| @@ -55,10 +55,9 @@ typedef int (*lua_CFunction) (lua_State *L); | |||
| 55 | /* | 55 | /* |
| 56 | ** functions that read/write blocks when loading/dumping Lua chunks | 56 | ** functions that read/write blocks when loading/dumping Lua chunks |
| 57 | */ | 57 | */ |
| 58 | typedef const char * (*lua_Chunkreader) (lua_State *L, void *ud, size_t *sz); | 58 | typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); |
| 59 | 59 | ||
| 60 | typedef int (*lua_Chunkwriter) (lua_State *L, const void* p, | 60 | typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud); |
| 61 | size_t sz, void* ud); | ||
| 62 | 61 | ||
| 63 | 62 | ||
| 64 | /* | 63 | /* |
| @@ -70,17 +69,17 @@ typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); | |||
| 70 | /* | 69 | /* |
| 71 | ** basic types | 70 | ** basic types |
| 72 | */ | 71 | */ |
| 73 | #define LUA_TNONE (-1) | 72 | #define LUA_TNONE (-1) |
| 74 | 73 | ||
| 75 | #define LUA_TNIL 0 | 74 | #define LUA_TNIL 0 |
| 76 | #define LUA_TBOOLEAN 1 | 75 | #define LUA_TBOOLEAN 1 |
| 77 | #define LUA_TLIGHTUSERDATA 2 | 76 | #define LUA_TLIGHTUSERDATA 2 |
| 78 | #define LUA_TNUMBER 3 | 77 | #define LUA_TNUMBER 3 |
| 79 | #define LUA_TSTRING 4 | 78 | #define LUA_TSTRING 4 |
| 80 | #define LUA_TTABLE 5 | 79 | #define LUA_TTABLE 5 |
| 81 | #define LUA_TFUNCTION 6 | 80 | #define LUA_TFUNCTION 6 |
| 82 | #define LUA_TUSERDATA 7 | 81 | #define LUA_TUSERDATA 7 |
| 83 | #define LUA_TTHREAD 8 | 82 | #define LUA_TTHREAD 8 |
| 84 | 83 | ||
| 85 | 84 | ||
| 86 | 85 | ||
| @@ -147,7 +146,6 @@ LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); | |||
| 147 | LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); | 146 | LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); |
| 148 | LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); | 147 | LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); |
| 149 | LUA_API int (lua_toboolean) (lua_State *L, int idx); | 148 | LUA_API int (lua_toboolean) (lua_State *L, int idx); |
| 150 | LUA_API const char *(lua_tostring) (lua_State *L, int idx); | ||
| 151 | LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); | 149 | LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); |
| 152 | LUA_API size_t (lua_objsize) (lua_State *L, int idx); | 150 | LUA_API size_t (lua_objsize) (lua_State *L, int idx); |
| 153 | LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); | 151 | LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); |
| @@ -202,11 +200,11 @@ LUA_API int (lua_setfenv) (lua_State *L, int idx); | |||
| 202 | */ | 200 | */ |
| 203 | LUA_API void (lua_call) (lua_State *L, int nargs, int nresults); | 201 | LUA_API void (lua_call) (lua_State *L, int nargs, int nresults); |
| 204 | LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); | 202 | LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); |
| 205 | LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); | 203 | LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); |
| 206 | LUA_API int (lua_load) (lua_State *L, lua_Chunkreader reader, void *dt, | 204 | LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, |
| 207 | const char *chunkname); | 205 | const char *chunkname); |
| 208 | 206 | ||
| 209 | LUA_API int (lua_dump) (lua_State *L, lua_Chunkwriter writer, void *data); | 207 | LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); |
| 210 | 208 | ||
| 211 | 209 | ||
| 212 | /* | 210 | /* |
| @@ -290,7 +288,8 @@ LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); | |||
| 290 | 288 | ||
| 291 | #define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) | 289 | #define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) |
| 292 | 290 | ||
| 293 | 291 | #define lua_Chunkreader lua_Reader | |
| 292 | #define lua_Chunkwriter lua_Writer | ||
| 294 | 293 | ||
| 295 | 294 | ||
| 296 | 295 | ||
| @@ -321,6 +320,8 @@ LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); | |||
| 321 | 320 | ||
| 322 | typedef struct lua_Debug lua_Debug; /* activation record */ | 321 | typedef struct lua_Debug lua_Debug; /* activation record */ |
| 323 | 322 | ||
| 323 | |||
| 324 | /* Functions to be called by the debuger in specific events */ | ||
| 324 | typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); | 325 | typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); |
| 325 | 326 | ||
| 326 | 327 | ||
| @@ -337,8 +338,6 @@ LUA_API int lua_gethookmask (lua_State *L); | |||
| 337 | LUA_API int lua_gethookcount (lua_State *L); | 338 | LUA_API int lua_gethookcount (lua_State *L); |
| 338 | 339 | ||
| 339 | 340 | ||
| 340 | #define LUA_IDSIZE 60 | ||
| 341 | |||
| 342 | struct lua_Debug { | 341 | struct lua_Debug { |
| 343 | int event; | 342 | int event; |
| 344 | const char *name; /* (n) */ | 343 | const char *name; /* (n) */ |
| @@ -358,7 +357,7 @@ struct lua_Debug { | |||
| 358 | 357 | ||
| 359 | 358 | ||
| 360 | /****************************************************************************** | 359 | /****************************************************************************** |
| 361 | * Copyright (C) 1994-2004 Tecgraf, PUC-Rio. All rights reserved. | 360 | * Copyright (C) 1994-2005 Tecgraf, PUC-Rio. All rights reserved. |
| 362 | * | 361 | * |
| 363 | * Permission is hereby granted, free of charge, to any person obtaining | 362 | * Permission is hereby granted, free of charge, to any person obtaining |
| 364 | * a copy of this software and associated documentation files (the | 363 | * a copy of this software and associated documentation files (the |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: luaconf.h,v 1.47 2005/05/03 19:30:17 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.48 2005/05/16 21:19:00 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 | */ |
| @@ -13,14 +13,12 @@ | |||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | /* | 15 | /* |
| 16 | ** {================================================================== | 16 | ** ================================================================== |
| 17 | ** Index (search for keyword to find corresponding entry) | 17 | ** Search for "@@" to find all configurable definitions. |
| 18 | ** =================================================================== | 18 | ** =================================================================== |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | /* }================================================================== */ | ||
| 23 | |||
| 24 | 22 | ||
| 25 | 23 | ||
| 26 | /* | 24 | /* |
| @@ -67,17 +65,17 @@ | |||
| 67 | /* | 65 | /* |
| 68 | @@ LUA_PATHSEP is the character that separates templates in a path. | 66 | @@ LUA_PATHSEP is the character that separates templates in a path. |
| 69 | ** CHANGE it if for some reason your system cannot use a | 67 | ** CHANGE it if for some reason your system cannot use a |
| 70 | ** semicolon. (E.g., a semicolon may be a too common character in | 68 | ** semicolon. (E.g., if a semicolon is a common character in |
| 71 | ** file/directory names.) Probably you do not need to change this. | 69 | ** file/directory names.) Probably you do not need to change this. |
| 72 | */ | 70 | */ |
| 73 | #define LUA_PATHSEP ';' | 71 | #define LUA_PATHSEP ';' |
| 74 | 72 | ||
| 75 | 73 | ||
| 76 | /* | 74 | /* |
| 77 | @@ LUA_PATH_MARK is ths string that marks the substitution points in a | 75 | @@ LUA_PATH_MARK is the string that marks the substitution points in a |
| 78 | @* template. | 76 | @* template. |
| 79 | ** CHANGE it if for some reason your system cannot use an interogation | 77 | ** CHANGE it if for some reason your system cannot use an interrogation |
| 80 | ** mark. (E.g., an interogation mark may be a too common character in | 78 | ** mark. (E.g., if an interogation mark is a common character in |
| 81 | ** file/directory names.) Probably you do not need to change this. | 79 | ** file/directory names.) Probably you do not need to change this. |
| 82 | */ | 80 | */ |
| 83 | #define LUA_PATH_MARK "?" | 81 | #define LUA_PATH_MARK "?" |
| @@ -113,16 +111,16 @@ | |||
| 113 | 111 | ||
| 114 | #endif | 112 | #endif |
| 115 | 113 | ||
| 116 | /* more often then not the libs go together with the core */ | 114 | /* more often than not the libs go together with the core */ |
| 117 | #define LUALIB_API LUA_API | 115 | #define LUALIB_API LUA_API |
| 118 | 116 | ||
| 119 | 117 | ||
| 120 | /* | 118 | /* |
| 121 | @@ LUAI_FUNC is a mark for all extern functions that are not to be | 119 | @@ LUAI_FUNC is a mark for all extern functions that are not to be |
| 122 | @* exported to outside modules. | 120 | @* exported to outside modules. |
| 123 | ** CHANGE it if you need to mark them in some special way. Gcc mark | 121 | ** CHANGE it if you need to mark them in some special way. Gcc (versions |
| 124 | ** them as "hidden" to optimize their call when Lua is compiled as a | 122 | ** 3.2 and later) mark them as "hidden" to optimize their call when Lua |
| 125 | ** shared library. | 123 | ** is compiled as a shared library. |
| 126 | */ | 124 | */ |
| 127 | #if defined(luaall_c) | 125 | #if defined(luaall_c) |
| 128 | #define LUAI_FUNC static | 126 | #define LUAI_FUNC static |
| @@ -141,10 +139,20 @@ | |||
| 141 | 139 | ||
| 142 | 140 | ||
| 143 | /* | 141 | /* |
| 144 | @@ LUA_SM describes how variable strings appear in error messages. | 142 | @@ LUA_QL describes how error messages quote program elements. |
| 145 | ** CHANGE it if you want a different appearance. | 143 | ** CHANGE it if you want a different appearance. |
| 146 | */ | 144 | */ |
| 147 | #define LUA_SM "'%s'" | 145 | #define LUA_QL(x) "'" x "'" |
| 146 | #define LUA_QS LUA_QL("%s") | ||
| 147 | |||
| 148 | |||
| 149 | /* | ||
| 150 | @@ LUA_IDSIZE gives the maximum size for the description of the source | ||
| 151 | @* of a function in debug information. | ||
| 152 | ** CHANGE it if you a different size. | ||
| 153 | */ | ||
| 154 | #define LUA_IDSIZE 60 | ||
| 155 | |||
| 148 | 156 | ||
| 149 | /* | 157 | /* |
| 150 | ** {================================================================== | 158 | ** {================================================================== |
| @@ -155,8 +163,8 @@ | |||
| 155 | #if defined(lua_c) || defined(luaall_c) | 163 | #if defined(lua_c) || defined(luaall_c) |
| 156 | 164 | ||
| 157 | /* | 165 | /* |
| 158 | @@ lua_stdin_is_tty is a function to detect whether the standard input is | 166 | @@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that |
| 159 | @* a 'tty' (that is, is interactive). | 167 | @* is, whether we're running lua interactively). |
| 160 | ** CHANGE it if you have a better definition for non-POSIX/non-Windows | 168 | ** CHANGE it if you have a better definition for non-POSIX/non-Windows |
| 161 | ** systems. | 169 | ** systems. |
| 162 | */ | 170 | */ |
| @@ -191,7 +199,8 @@ | |||
| 191 | 199 | ||
| 192 | 200 | ||
| 193 | /* | 201 | /* |
| 194 | @@ LUA_MAXINPUT is the maximum length for an input line | 202 | @@ LUA_MAXINPUT is the maximum length for an input line in the |
| 203 | @* stand-alone interpreter. | ||
| 195 | ** CHANGE it if you need longer lines. | 204 | ** CHANGE it if you need longer lines. |
| 196 | */ | 205 | */ |
| 197 | #define LUA_MAXINPUT 512 | 206 | #define LUA_MAXINPUT 512 |
| @@ -200,10 +209,10 @@ | |||
| 200 | /* | 209 | /* |
| 201 | @@ lua_readline defines how to show a prompt and then read a line from | 210 | @@ lua_readline defines how to show a prompt and then read a line from |
| 202 | @* the standard input. | 211 | @* the standard input. |
| 203 | @@ lua_saveline defines how to "save" a read line. | 212 | @@ lua_saveline defines how to "save" a read line in a "history". |
| 204 | @@ lua_freeline defines how to free a line read by lua_readline. | 213 | @@ lua_freeline defines how to free a line read by lua_readline. |
| 205 | ** CHANGE them if you want to improve this functionality (e.g., using GNU | 214 | ** CHANGE them if you want to improve this functionality (e.g., by using |
| 206 | ** readline and history facilities). | 215 | ** GNU readline and history facilities). |
| 207 | */ | 216 | */ |
| 208 | #if !defined(__STRICT_ANSI__) && defined(LUA_USE_READLINE) | 217 | #if !defined(__STRICT_ANSI__) && defined(LUA_USE_READLINE) |
| 209 | #include <stdio.h> | 218 | #include <stdio.h> |
| @@ -317,14 +326,14 @@ | |||
| 317 | /* | 326 | /* |
| 318 | @@ LUAI_UINT32 is an unsigned integer with at least 32 bits. | 327 | @@ LUAI_UINT32 is an unsigned integer with at least 32 bits. |
| 319 | @@ LUAI_INT32 is an signed integer with at least 32 bits. | 328 | @@ LUAI_INT32 is an signed integer with at least 32 bits. |
| 320 | @@ LUAI_UMEM is an an unsigned integer big enough to count the total | 329 | @@ LUAI_UMEM is an unsigned integer big enough to count the total |
| 321 | @* memory used by Lua. | 330 | @* memory used by Lua. |
| 322 | @@ LUAI_MEM is an a signed integer big enough to count the total memory | 331 | @@ LUAI_MEM is a signed integer big enough to count the total memory |
| 323 | @* used by Lua. | 332 | @* used by Lua. |
| 324 | ** CHANGE here if for some weird reason the default definitions are not | 333 | ** CHANGE here if for some weird reason the default definitions are not |
| 325 | ** good enough for your machine. (The 'else' definition always works, | 334 | ** good enough for your machine. (The definitions in the 'else' |
| 326 | ** but may waste space on machines with 64-bit longs.) Probably you do | 335 | ** part always works, but may waste space on machines with 64-bit |
| 327 | ** not need to change this. | 336 | ** longs.) Probably you do not need to change this. |
| 328 | */ | 337 | */ |
| 329 | #if LUAI_BITSINT >= 32 | 338 | #if LUAI_BITSINT >= 32 |
| 330 | #define LUAI_UINT32 unsigned int | 339 | #define LUAI_UINT32 unsigned int |
| @@ -352,7 +361,8 @@ | |||
| 352 | 361 | ||
| 353 | 362 | ||
| 354 | /* | 363 | /* |
| 355 | @@ LUAI_MAXCSTACK limits the number of slots that a C function can use. | 364 | @@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function |
| 365 | @* can use. | ||
| 356 | ** CHANGE it if you need lots of (Lua) stack space for your C | 366 | ** CHANGE it if you need lots of (Lua) stack space for your C |
| 357 | ** functions. This limit is arbitrary; its only purpose is to stop C | 367 | ** functions. This limit is arbitrary; its only purpose is to stop C |
| 358 | ** functions to consume unlimited stack space. | 368 | ** functions to consume unlimited stack space. |
| @@ -379,7 +389,7 @@ | |||
| 379 | @@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and | 389 | @@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and |
| 380 | @* syntactical nested non-terminals in a program. | 390 | @* syntactical nested non-terminals in a program. |
| 381 | */ | 391 | */ |
| 382 | #define LUAI_MAXCCALLS 200 | 392 | #define LUAI_MAXCCALLS 200 |
| 383 | 393 | ||
| 384 | 394 | ||
| 385 | /* | 395 | /* |
| @@ -420,7 +430,7 @@ | |||
| 420 | ** in C is extremely slow, so any alternative is worth trying. | 430 | ** in C is extremely slow, so any alternative is worth trying. |
| 421 | */ | 431 | */ |
| 422 | 432 | ||
| 423 | /* On a GNU/Pentium, resort to assembler */ | 433 | /* On a gcc/Pentium, resort to assembler */ |
| 424 | #if !defined(__STRICT_ANSI__) && defined(__GNUC__) && defined(__i386) | 434 | #if !defined(__STRICT_ANSI__) && defined(__GNUC__) && defined(__i386) |
| 425 | #define lua_number2int(i,d) __asm__ ("fistpl %0":"=m"(i):"t"(d):"st") | 435 | #define lua_number2int(i,d) __asm__ ("fistpl %0":"=m"(i):"t"(d):"st") |
| 426 | 436 | ||
| @@ -433,10 +443,10 @@ | |||
| 433 | 443 | ||
| 434 | /* on Pentium machines compliant with C99, you can try lrint */ | 444 | /* on Pentium machines compliant with C99, you can try lrint */ |
| 435 | #elif defined (__i386) && defined(__STDC_VERSION__) && \ | 445 | #elif defined (__i386) && defined(__STDC_VERSION__) && \ |
| 436 | (__STDC_VERSION__ >= 199900L) | 446 | (__STDC_VERSION__ >= 199900L) |
| 437 | #define lua_number2int(i,d) ((i)=lrint(d)) | 447 | #define lua_number2int(i,d) ((i)=lrint(d)) |
| 438 | 448 | ||
| 439 | /* this option always work, but may be slow */ | 449 | /* this option always works, but may be slow */ |
| 440 | #else | 450 | #else |
| 441 | #define lua_number2int(i,d) ((i)=(int)(d)) | 451 | #define lua_number2int(i,d) ((i)=(int)(d)) |
| 442 | 452 | ||
| @@ -447,14 +457,14 @@ | |||
| 447 | @@ lua_number2integer is a macro to convert lua_Number to lua_Integer. | 457 | @@ lua_number2integer is a macro to convert lua_Number to lua_Integer. |
| 448 | ** CHANGE (see lua_number2int). | 458 | ** CHANGE (see lua_number2int). |
| 449 | */ | 459 | */ |
| 450 | /* On a GNU or Windows/Pentium, resort to assembler */ | 460 | /* On a gcc or Windows/Pentium, resort to assembler */ |
| 451 | #if (defined(__GNUC__) && defined(__i386)) || \ | 461 | #if (defined(__GNUC__) && defined(__i386)) || \ |
| 452 | (defined(_MSC_VER) && defined(_M_IX86)) | 462 | (defined(_MSC_VER) && defined(_M_IX86)) |
| 453 | #define lua_number2integer(i,n) lua_number2int(i, n) | 463 | #define lua_number2integer(i,n) lua_number2int(i, n) |
| 454 | 464 | ||
| 455 | /* this option always work, but may be slow */ | 465 | /* this option always works, but may be slow */ |
| 456 | #else | 466 | #else |
| 457 | #define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) | 467 | #define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) |
| 458 | 468 | ||
| 459 | #endif | 469 | #endif |
| 460 | 470 | ||
| @@ -462,6 +472,7 @@ | |||
| 462 | 472 | ||
| 463 | /* | 473 | /* |
| 464 | ** {================================================================== | 474 | ** {================================================================== |
| 475 | @@ LUA_NUMBER is the type of numbers in Lua. | ||
| 465 | ** CHANGE the following definitions only if you want to build Lua | 476 | ** CHANGE the following definitions only if you want to build Lua |
| 466 | ** with a number type different from double. You may also need to | 477 | ** with a number type different from double. You may also need to |
| 467 | ** change lua_number2int & lua_number2integer. | 478 | ** change lua_number2int & lua_number2integer. |
| @@ -470,7 +481,6 @@ | |||
| 470 | 481 | ||
| 471 | 482 | ||
| 472 | /* | 483 | /* |
| 473 | @@ LUA_NUMBER is the type of numbers in Lua. | ||
| 474 | @@ LUAI_UACNUMBER is the result of an 'usual argument conversion' | 484 | @@ LUAI_UACNUMBER is the result of an 'usual argument conversion' |
| 475 | @* over a number. | 485 | @* over a number. |
| 476 | */ | 486 | */ |
| @@ -512,9 +522,9 @@ | |||
| 512 | /* | 522 | /* |
| 513 | @@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. | 523 | @@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. |
| 514 | ** CHANGE it if your system requires alignments larger than double. (For | 524 | ** CHANGE it if your system requires alignments larger than double. (For |
| 515 | ** instance, if your system supports long double and those long doubles | 525 | ** instance, if your system supports long doubles and they must be |
| 516 | ** must be aligned in 16-byte boundaries, then you should add long | 526 | ** aligned in 16-byte boundaries, then you should add long double in the |
| 517 | ** double in the union.) Probably you do not need to change this. | 527 | ** union.) Probably you do not need to change this. |
| 518 | */ | 528 | */ |
| 519 | #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } | 529 | #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } |
| 520 | 530 | ||
| @@ -535,7 +545,7 @@ | |||
| 535 | #define luai_jmpbuf int /* dummy variable */ | 545 | #define luai_jmpbuf int /* dummy variable */ |
| 536 | 546 | ||
| 537 | #elif !defined(__STRICT_ANSI__) && (defined(unix) || defined(__unix) || \ | 547 | #elif !defined(__STRICT_ANSI__) && (defined(unix) || defined(__unix) || \ |
| 538 | defined(__unix__)) | 548 | defined(__unix__)) |
| 539 | /* in Unix, try _longjmp/_setjmp (more efficient) */ | 549 | /* in Unix, try _longjmp/_setjmp (more efficient) */ |
| 540 | #define LUAI_THROW(L,c) _longjmp((c)->b, 1) | 550 | #define LUAI_THROW(L,c) _longjmp((c)->b, 1) |
| 541 | #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } | 551 | #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } |
| @@ -589,7 +599,7 @@ | |||
| 589 | ** dynamic-library system for your platform (either Windows' DLL, Mac's | 599 | ** dynamic-library system for your platform (either Windows' DLL, Mac's |
| 590 | ** dyld, or Unix's dlopen). If your system is some kind of Unix, there | 600 | ** dyld, or Unix's dlopen). If your system is some kind of Unix, there |
| 591 | ** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for | 601 | ** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for |
| 592 | ** it. To use dlopen you also need to adapt the makefile (probably | 602 | ** it. To use dlopen you also need to adapt the src/Makefile (probably |
| 593 | ** adding -ldl to the linker options), so Lua does not select it | 603 | ** adding -ldl to the linker options), so Lua does not select it |
| 594 | ** automatically. (When you change the makefile to add -ldl, you must | 604 | ** automatically. (When you change the makefile to add -ldl, you must |
| 595 | ** also add -DLUA_USE_DLOPEN.) | 605 | ** also add -DLUA_USE_DLOPEN.) |
| @@ -611,7 +621,7 @@ | |||
| 611 | @@ lua_lock/lua_unlock are macros for thread synchronization inside the | 621 | @@ lua_lock/lua_unlock are macros for thread synchronization inside the |
| 612 | @* Lua core. This is an attempt to simplify the implementation of a | 622 | @* Lua core. This is an attempt to simplify the implementation of a |
| 613 | @* multithreaded version of Lua. | 623 | @* multithreaded version of Lua. |
| 614 | ** CHANGE them only if you know what you are doing. all accesses to | 624 | ** CHANGE them only if you know what you are doing. All accesses to |
| 615 | ** the global state and to global objects are synchronized. Because | 625 | ** the global state and to global objects are synchronized. Because |
| 616 | ** threads can read the stack of other threads (when running garbage | 626 | ** threads can read the stack of other threads (when running garbage |
| 617 | ** collection), a thread must also synchronize any write-access to its | 627 | ** collection), a thread must also synchronize any write-access to its |
| @@ -650,7 +660,10 @@ | |||
| 650 | 660 | ||
| 651 | /* =================================================================== */ | 661 | /* =================================================================== */ |
| 652 | 662 | ||
| 653 | /* Local configuration */ | 663 | /* |
| 664 | ** Local configuration. You can use this space to add your redefinitions | ||
| 665 | ** without modifying the main part of the file. | ||
| 666 | */ | ||
| 654 | 667 | ||
| 655 | 668 | ||
| 656 | 669 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lundump.h,v 1.34 2003/08/25 19:51:54 roberto Exp roberto $ | 2 | ** $Id: lundump.h,v 1.35 2005/04/25 19:24:10 roberto Exp roberto $ |
| 3 | ** load pre-compiled Lua chunks | 3 | ** load pre-compiled Lua chunks |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -18,7 +18,7 @@ LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, | |||
| 18 | LUAI_FUNC int luaU_endianness (void); | 18 | LUAI_FUNC int luaU_endianness (void); |
| 19 | 19 | ||
| 20 | /* dump one chunk; from ldump.c */ | 20 | /* dump one chunk; from ldump.c */ |
| 21 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* Main, lua_Chunkwriter w, | 21 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* Main, lua_Writer w, |
| 22 | void* data, int strip); | 22 | void* data, int strip); |
| 23 | 23 | ||
| 24 | /* print one chunk; from print.c */ | 24 | /* print one chunk; from print.c */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 2.42 2005/05/04 20:42:28 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.43 2005/05/16 21:19:00 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 | */ |
| @@ -688,11 +688,11 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
| 688 | const TValue *pstep = ra+2; | 688 | const TValue *pstep = ra+2; |
| 689 | L->savedpc = pc; /* next steps may throw errors */ | 689 | L->savedpc = pc; /* next steps may throw errors */ |
| 690 | if (!tonumber(init, ra)) | 690 | if (!tonumber(init, ra)) |
| 691 | luaG_runerror(L, "'for' initial value must be a number"); | 691 | luaG_runerror(L, LUA_QL("for") " initial value must be a number"); |
| 692 | else if (!tonumber(plimit, ra+1)) | 692 | else if (!tonumber(plimit, ra+1)) |
| 693 | luaG_runerror(L, "'for' limit must be a number"); | 693 | luaG_runerror(L, LUA_QL("for") " limit must be a number"); |
| 694 | else if (!tonumber(pstep, ra+2)) | 694 | else if (!tonumber(pstep, ra+2)) |
| 695 | luaG_runerror(L, "'for' step must be a number"); | 695 | luaG_runerror(L, LUA_QL("for") " step must be a number"); |
| 696 | setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep))); | 696 | setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep))); |
| 697 | dojump(L, pc, GETARG_sBx(i)); | 697 | dojump(L, pc, GETARG_sBx(i)); |
| 698 | continue; | 698 | continue; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lzio.c,v 1.28 2003/11/18 10:44:53 roberto Exp roberto $ | 2 | ** $Id: lzio.c,v 1.29 2004/04/30 20:13:38 roberto Exp roberto $ |
| 3 | ** a generic input stream interface | 3 | ** a generic input stream interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -43,7 +43,7 @@ int luaZ_lookahead (ZIO *z) { | |||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | void luaZ_init (lua_State *L, ZIO *z, lua_Chunkreader reader, void *data) { | 46 | void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { |
| 47 | z->L = L; | 47 | z->L = L; |
| 48 | z->reader = reader; | 48 | z->reader = reader; |
| 49 | z->data = data; | 49 | z->data = data; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lzio.h,v 1.19 2003/10/03 16:05:34 roberto Exp roberto $ | 2 | ** $Id: lzio.h,v 1.20 2005/04/25 19:24:10 roberto Exp roberto $ |
| 3 | ** Buffered streams | 3 | ** Buffered streams |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -44,7 +44,7 @@ typedef struct Mbuffer { | |||
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); | 46 | LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); |
| 47 | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Chunkreader reader, | 47 | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, |
| 48 | void *data); | 48 | void *data); |
| 49 | LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ | 49 | LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ |
| 50 | LUAI_FUNC int luaZ_lookahead (ZIO *z); | 50 | LUAI_FUNC int luaZ_lookahead (ZIO *z); |
| @@ -56,7 +56,7 @@ LUAI_FUNC int luaZ_lookahead (ZIO *z); | |||
| 56 | struct Zio { | 56 | struct Zio { |
| 57 | size_t n; /* bytes still unread */ | 57 | size_t n; /* bytes still unread */ |
| 58 | const char *p; /* current position in buffer */ | 58 | const char *p; /* current position in buffer */ |
| 59 | lua_Chunkreader reader; | 59 | lua_Reader reader; |
| 60 | void* data; /* additional data */ | 60 | void* data; /* additional data */ |
| 61 | lua_State *L; /* Lua state (for reader) */ | 61 | lua_State *L; /* Lua state (for reader) */ |
| 62 | }; | 62 | }; |
