mirror of
https://github.com/lua/lua
synced 2024-11-22 12:51:30 +03:00
`lauxlib' is now part of the libraries (not used by core Lua)
This commit is contained in:
parent
2779e81fbb
commit
8060193702
7
lapi.c
7
lapi.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lapi.c,v 1.94 2000/09/05 19:33:32 roberto Exp roberto $
|
||||
** $Id: lapi.c,v 1.95 2000/09/11 19:45:27 roberto Exp roberto $
|
||||
** Lua API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -10,7 +10,6 @@
|
||||
#include "lua.h"
|
||||
|
||||
#include "lapi.h"
|
||||
#include "lauxlib.h"
|
||||
#include "ldo.h"
|
||||
#include "lfunc.h"
|
||||
#include "lgc.h"
|
||||
@ -234,7 +233,7 @@ void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
|
||||
void lua_pushusertag (lua_State *L, void *u, int tag) { /* ORDER LUA_T */
|
||||
luaC_checkGC(L);
|
||||
if (tag != LUA_ANYTAG && tag != TAG_USERDATA && tag < NUM_TAGS)
|
||||
luaL_verror(L, "invalid tag for a userdata (%d)", tag);
|
||||
luaO_verror(L, "invalid tag for a userdata (%d)", tag);
|
||||
tsvalue(L->top) = luaS_createudata(L, u, tag);
|
||||
ttype(L->top) = TAG_USERDATA;
|
||||
api_incr_top(L);
|
||||
@ -387,7 +386,7 @@ void lua_settag (lua_State *L, int tag) {
|
||||
tsvalue(L->top-1)->u.d.tag = tag;
|
||||
break;
|
||||
default:
|
||||
luaL_verror(L, "cannot change the tag of a %.20s",
|
||||
luaO_verror(L, "cannot change the tag of a %.20s",
|
||||
luaO_typename(L->top-1));
|
||||
}
|
||||
L->top--;
|
||||
|
24
lauxlib.c
24
lauxlib.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lauxlib.c,v 1.33 2000/08/29 20:43:28 roberto Exp roberto $
|
||||
** $Id: lauxlib.c,v 1.34 2000/09/11 17:38:42 roberto Exp roberto $
|
||||
** Auxiliary functions for building Lua libraries
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -118,28 +118,6 @@ void luaL_verror (lua_State *L, const char *fmt, ...) {
|
||||
}
|
||||
|
||||
|
||||
#define EXTRALEN sizeof("string \"...\"0")
|
||||
|
||||
void luaL_chunkid (char *out, const char *source, int len) {
|
||||
if (*source == '(') {
|
||||
strncpy(out, source+1, len-1); /* remove first char */
|
||||
out[len-1] = '\0'; /* make sure `out' has an end */
|
||||
out[strlen(out)-1] = '\0'; /* remove last char */
|
||||
}
|
||||
else {
|
||||
len -= EXTRALEN;
|
||||
if (*source == '@')
|
||||
sprintf(out, "file `%.*s'", len, source+1);
|
||||
else {
|
||||
const char *b = strchr(source , '\n'); /* stop at first new line */
|
||||
int lim = (b && (b-source)<len) ? b-source : len;
|
||||
sprintf(out, "string \"%.*s\"", lim, source);
|
||||
strcpy(out+lim+(EXTRALEN-sizeof("...\"0")), "...\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** Generic Buffer manipulation
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lauxlib.h,v 1.22 2000/09/04 18:27:32 roberto Exp roberto $
|
||||
** $Id: lauxlib.h,v 1.23 2000/09/11 17:38:42 roberto Exp roberto $
|
||||
** Auxiliary functions for building Lua libraries
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -34,7 +34,6 @@ void luaL_checktype (lua_State *L, int narg, const char *tname);
|
||||
|
||||
void luaL_verror (lua_State *L, const char *fmt, ...);
|
||||
int luaL_findstring (const char *name, const char *const list[]);
|
||||
void luaL_chunkid (char *out, const char *source, int len);
|
||||
|
||||
|
||||
|
||||
|
28
ldebug.c
28
ldebug.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ldebug.c,v 1.38 2000/08/28 20:22:21 roberto Exp roberto $
|
||||
** $Id: ldebug.c,v 1.39 2000/08/31 13:29:12 roberto Exp roberto $
|
||||
** Debug Interface
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -10,7 +10,6 @@
|
||||
#include "lua.h"
|
||||
|
||||
#include "lapi.h"
|
||||
#include "lauxlib.h"
|
||||
#include "lcode.h"
|
||||
#include "ldebug.h"
|
||||
#include "ldo.h"
|
||||
@ -18,6 +17,7 @@
|
||||
#include "lobject.h"
|
||||
#include "lopcodes.h"
|
||||
#include "lstate.h"
|
||||
#include "lstring.h"
|
||||
#include "ltable.h"
|
||||
#include "ltm.h"
|
||||
#include "luadebug.h"
|
||||
@ -172,17 +172,20 @@ const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int localnum) {
|
||||
}
|
||||
|
||||
|
||||
static void infoLproto (lua_Debug *ar, Proto *f) {
|
||||
ar->source = f->source->str;
|
||||
ar->linedefined = f->lineDefined;
|
||||
ar->what = "Lua";
|
||||
}
|
||||
|
||||
|
||||
static void lua_funcinfo (lua_Debug *ar, StkId func) {
|
||||
switch (ttype(func)) {
|
||||
case TAG_LCLOSURE:
|
||||
ar->source = clvalue(func)->f.l->source->str;
|
||||
ar->linedefined = clvalue(func)->f.l->lineDefined;
|
||||
ar->what = "Lua";
|
||||
infoLproto(ar, clvalue(func)->f.l);
|
||||
break;
|
||||
case TAG_LMARK:
|
||||
ar->source = infovalue(func)->func->f.l->source->str;
|
||||
ar->linedefined = infovalue(func)->func->f.l->lineDefined;
|
||||
ar->what = "Lua";
|
||||
infoLproto(ar, infovalue(func)->func->f.l);
|
||||
break;
|
||||
case TAG_CCLOSURE: case TAG_CMARK:
|
||||
ar->source = "(C)";
|
||||
@ -192,6 +195,7 @@ static void lua_funcinfo (lua_Debug *ar, StkId func) {
|
||||
default:
|
||||
LUA_INTERNALERROR("invalid `func' value");
|
||||
}
|
||||
luaO_chunkid(ar->source_id, ar->source, sizeof(ar->source_id));
|
||||
if (ar->linedefined == 0)
|
||||
ar->what = "main";
|
||||
}
|
||||
@ -431,10 +435,10 @@ void luaG_typeerror (lua_State *L, StkId o, const char *op) {
|
||||
const char *kind = getobjname(L, o, &name);
|
||||
const char *t = luaO_typename(o);
|
||||
if (kind)
|
||||
luaL_verror(L, "attempt to %.30s %.20s `%.40s' (a %.10s value)",
|
||||
luaO_verror(L, "attempt to %.30s %.20s `%.40s' (a %.10s value)",
|
||||
op, kind, name, t);
|
||||
else
|
||||
luaL_verror(L, "attempt to %.30s a %.10s value", op, t);
|
||||
luaO_verror(L, "attempt to %.30s a %.10s value", op, t);
|
||||
}
|
||||
|
||||
|
||||
@ -449,8 +453,8 @@ void luaG_ordererror (lua_State *L, StkId top) {
|
||||
const char *t1 = luaO_typename(top-2);
|
||||
const char *t2 = luaO_typename(top-1);
|
||||
if (t1[2] == t2[2])
|
||||
luaL_verror(L, "attempt to compare two %.10s values", t1);
|
||||
luaO_verror(L, "attempt to compare two %.10s values", t1);
|
||||
else
|
||||
luaL_verror(L, "attempt to compare %.10s with %.10s", t1, t2);
|
||||
luaO_verror(L, "attempt to compare %.10s with %.10s", t1, t2);
|
||||
}
|
||||
|
||||
|
3
ldo.c
3
ldo.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ldo.c,v 1.93 2000/09/04 18:52:51 roberto Exp roberto $
|
||||
** $Id: ldo.c,v 1.94 2000/09/11 17:38:42 roberto Exp roberto $
|
||||
** Stack and Call structure of Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -12,7 +12,6 @@
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
#include "lauxlib.h"
|
||||
#include "ldebug.h"
|
||||
#include "ldo.h"
|
||||
#include "lgc.h"
|
||||
|
18
liolib.c
18
liolib.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: liolib.c,v 1.77 2000/09/05 19:33:32 roberto Exp $
|
||||
** $Id: liolib.c,v 1.78 2000/09/11 17:38:42 roberto Exp roberto $
|
||||
** Standard I/O (and system) library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -393,8 +393,8 @@ static int io_read (lua_State *L) {
|
||||
firstarg = lastarg = 1; /* correct indices */
|
||||
lua_pushstring(L, "*l"); /* push default argument */
|
||||
}
|
||||
else
|
||||
luaL_checkstack(L, lastarg-firstarg+1, "too many arguments");
|
||||
else /* ensure stack space for all results and for auxlib's buffer */
|
||||
luaL_checkstack(L, lastarg-firstarg+1+LUA_MINSTACK, "too many arguments");
|
||||
for (n = firstarg; n<=lastarg; n++) {
|
||||
int success;
|
||||
if (lua_isnumber(L, n))
|
||||
@ -598,7 +598,6 @@ static int errorfb (lua_State *L) {
|
||||
lua_concat(L, 3);
|
||||
while (lua_getstack(L, level++, &ar)) {
|
||||
char buff[120]; /* enough to fit following `sprintf's */
|
||||
char buffchunk[60];
|
||||
int toconcat = 1; /* number of strings in the stack to concat */
|
||||
if (level > LEVELS1 && firstpart) {
|
||||
/* no more than `LEVELS2' more levels? */
|
||||
@ -607,7 +606,7 @@ static int errorfb (lua_State *L) {
|
||||
else {
|
||||
lua_pushstring(L, " ...\n"); /* too many levels */
|
||||
lua_concat(L, 2);
|
||||
while (lua_getstack(L, level+LEVELS2, &ar)) /* get last levels */
|
||||
while (lua_getstack(L, level+LEVELS2, &ar)) /* find last levels */
|
||||
level++;
|
||||
}
|
||||
firstpart = 0;
|
||||
@ -616,7 +615,6 @@ static int errorfb (lua_State *L) {
|
||||
sprintf(buff, "%4d: ", level-1);
|
||||
lua_pushstring(L, buff); toconcat++;
|
||||
lua_getinfo(L, "Snl", &ar);
|
||||
luaL_chunkid(buffchunk, ar.source, sizeof(buffchunk));
|
||||
switch (*ar.namewhat) {
|
||||
case 'g': case 'l': /* global, local */
|
||||
sprintf(buff, "function `%.50s'", ar.name);
|
||||
@ -629,11 +627,11 @@ static int errorfb (lua_State *L) {
|
||||
break;
|
||||
default: {
|
||||
if (*ar.what == 'm') /* main? */
|
||||
sprintf(buff, "main of %.70s", buffchunk);
|
||||
sprintf(buff, "main of %.70s", ar.source_id);
|
||||
else if (*ar.what == 'C') /* C function? */
|
||||
sprintf(buff, "%.70s", buffchunk);
|
||||
sprintf(buff, "%.70s", ar.source_id);
|
||||
else
|
||||
sprintf(buff, "function <%d:%.70s>", ar.linedefined, buffchunk);
|
||||
sprintf(buff, "function <%d:%.70s>", ar.linedefined, ar.source_id);
|
||||
ar.source = NULL;
|
||||
}
|
||||
}
|
||||
@ -643,7 +641,7 @@ static int errorfb (lua_State *L) {
|
||||
lua_pushstring(L, buff); toconcat++;
|
||||
}
|
||||
if (ar.source) {
|
||||
sprintf(buff, " [%.70s]", buffchunk);
|
||||
sprintf(buff, " [%.70s]", ar.source_id);
|
||||
lua_pushstring(L, buff); toconcat++;
|
||||
}
|
||||
lua_pushstring(L, "\n"); toconcat++;
|
||||
|
7
llex.c
7
llex.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: llex.c,v 1.68 2000/08/22 20:07:56 roberto Exp $
|
||||
** $Id: llex.c,v 1.69 2000/09/11 17:38:42 roberto Exp roberto $
|
||||
** Lexical Analyzer
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -11,7 +11,6 @@
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
#include "lauxlib.h"
|
||||
#include "llex.h"
|
||||
#include "lmem.h"
|
||||
#include "lobject.h"
|
||||
@ -58,8 +57,8 @@ void luaX_checklimit (LexState *ls, int val, int limit, const char *msg) {
|
||||
|
||||
void luaX_syntaxerror (LexState *ls, const char *s, const char *token) {
|
||||
char buff[MAXSRC];
|
||||
luaL_chunkid(buff, ls->source->str, sizeof(buff));
|
||||
luaL_verror(ls->L, "%.100s;\n last token read: `%.50s' at line %d in %.80s",
|
||||
luaO_chunkid(buff, ls->source->str, sizeof(buff));
|
||||
luaO_verror(ls->L, "%.100s;\n last token read: `%.50s' at line %d in %.80s",
|
||||
s, token, ls->linenumber, buff);
|
||||
}
|
||||
|
||||
|
36
lobject.c
36
lobject.c
@ -1,11 +1,14 @@
|
||||
/*
|
||||
** $Id: lobject.c,v 1.45 2000/08/11 16:17:28 roberto Exp roberto $
|
||||
** $Id: lobject.c,v 1.46 2000/09/11 17:38:42 roberto Exp roberto $
|
||||
** Some generic functions over Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
@ -123,3 +126,34 @@ int luaO_str2d (const char *s, Number *result) { /* LUA_NUMBER */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void luaO_verror (lua_State *L, const char *fmt, ...) {
|
||||
char buff[500];
|
||||
va_list argp;
|
||||
va_start(argp, fmt);
|
||||
vsprintf(buff, fmt, argp);
|
||||
va_end(argp);
|
||||
lua_error(L, buff);
|
||||
}
|
||||
|
||||
|
||||
#define EXTRALEN sizeof("string \"...\"0")
|
||||
|
||||
void luaO_chunkid (char *out, const char *source, int len) {
|
||||
if (*source == '(') {
|
||||
strncpy(out, source+1, len-1); /* remove first char */
|
||||
out[len-1] = '\0'; /* make sure `out' has an end */
|
||||
out[strlen(out)-1] = '\0'; /* remove last char */
|
||||
}
|
||||
else {
|
||||
len -= EXTRALEN;
|
||||
if (*source == '@')
|
||||
sprintf(out, "file `%.*s'", len, source+1);
|
||||
else {
|
||||
const char *b = strchr(source , '\n'); /* stop at first new line */
|
||||
int lim = (b && (b-source)<len) ? b-source : len;
|
||||
sprintf(out, "string \"%.*s\"", lim, source);
|
||||
strcpy(out+lim+(EXTRALEN-sizeof("...\"0")), "...\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lobject.h,v 1.74 2000/08/22 17:44:17 roberto Exp roberto $
|
||||
** $Id: lobject.h,v 1.75 2000/09/11 17:38:42 roberto Exp roberto $
|
||||
** Type definitions for Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -198,5 +198,8 @@ char *luaO_openspace (lua_State *L, size_t n);
|
||||
int luaO_equalObj (const TObject *t1, const TObject *t2);
|
||||
int luaO_str2d (const char *s, Number *result);
|
||||
|
||||
void luaO_verror (lua_State *L, const char *fmt, ...);
|
||||
void luaO_chunkid (char *out, const char *source, int len);
|
||||
|
||||
|
||||
#endif
|
||||
|
3
ltable.c
3
ltable.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltable.c,v 1.53 2000/08/09 19:16:57 roberto Exp roberto $
|
||||
** $Id: ltable.c,v 1.54 2000/08/31 14:08:27 roberto Exp roberto $
|
||||
** Lua tables (hash)
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -20,7 +20,6 @@
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
#include "lauxlib.h"
|
||||
#include "lmem.h"
|
||||
#include "lobject.h"
|
||||
#include "lstate.h"
|
||||
|
26
ltm.c
26
ltm.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltm.c,v 1.47 2000/09/05 19:33:32 roberto Exp roberto $
|
||||
** $Id: ltm.c,v 1.48 2000/09/11 19:45:27 roberto Exp roberto $
|
||||
** Tag methods
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -10,7 +10,6 @@
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
#include "lauxlib.h"
|
||||
#include "ldo.h"
|
||||
#include "lmem.h"
|
||||
#include "lobject.h"
|
||||
@ -26,14 +25,23 @@ const char *const luaT_eventname[] = { /* ORDER IM */
|
||||
};
|
||||
|
||||
|
||||
static int findevent (const char *name) {
|
||||
int i;
|
||||
for (i=0; luaT_eventname[i]; i++)
|
||||
if (strcmp(luaT_eventname[i], name) == 0)
|
||||
return i;
|
||||
return -1; /* name not found */
|
||||
}
|
||||
|
||||
|
||||
static int luaI_checkevent (lua_State *L, const char *name, int t) {
|
||||
int e = luaL_findstring(name, luaT_eventname);
|
||||
int e = findevent(name);
|
||||
if (e >= IM_N)
|
||||
luaL_verror(L, "event `%.50s' is deprecated", name);
|
||||
luaO_verror(L, "event `%.50s' is deprecated", name);
|
||||
if (e == IM_GC && t == TAG_TABLE)
|
||||
luaL_verror(L, "event `gc' for tables is deprecated");
|
||||
luaO_verror(L, "event `gc' for tables is deprecated");
|
||||
if (e < 0)
|
||||
luaL_verror(L, "`%.50s' is not a valid event name", name);
|
||||
luaO_verror(L, "`%.50s' is not a valid event name", name);
|
||||
return e;
|
||||
}
|
||||
|
||||
@ -86,12 +94,12 @@ int lua_newtag (lua_State *L) {
|
||||
|
||||
static void checktag (lua_State *L, int tag) {
|
||||
if (!(0 <= tag && tag <= L->last_tag))
|
||||
luaL_verror(L, "%d is not a valid tag", tag);
|
||||
luaO_verror(L, "%d is not a valid tag", tag);
|
||||
}
|
||||
|
||||
void luaT_realtag (lua_State *L, int tag) {
|
||||
if (!(NUM_TAGS <= tag && tag <= L->last_tag))
|
||||
luaL_verror(L, "tag %d was not created by `newtag'", tag);
|
||||
luaO_verror(L, "tag %d was not created by `newtag'", tag);
|
||||
}
|
||||
|
||||
|
||||
@ -140,7 +148,7 @@ void lua_settagmethod (lua_State *L, int t, const char *event) {
|
||||
e = luaI_checkevent(L, event, t);
|
||||
checktag(L, t);
|
||||
if (!luaT_validevent(t, e))
|
||||
luaL_verror(L, "cannot change `%.20s' tag method for type `%.20s'%.20s",
|
||||
luaO_verror(L, "cannot change `%.20s' tag method for type `%.20s'%.20s",
|
||||
luaT_eventname[e], luaO_typenames[t],
|
||||
(t == TAG_TABLE || t == TAG_USERDATA) ? " with default tag"
|
||||
: "");
|
||||
|
10
luadebug.h
10
luadebug.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: luadebug.h,v 1.12 2000/08/11 16:17:28 roberto Exp roberto $
|
||||
** $Id: luadebug.h,v 1.13 2000/08/28 17:57:04 roberto Exp roberto $
|
||||
** Debugging API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -26,16 +26,18 @@ lua_Hook lua_setcallhook (lua_State *L, lua_Hook func);
|
||||
lua_Hook lua_setlinehook (lua_State *L, lua_Hook func);
|
||||
|
||||
|
||||
#define LUA_IDSIZE 60
|
||||
|
||||
struct lua_Debug {
|
||||
const char *event; /* `call', `return' */
|
||||
const char *source; /* (S) */
|
||||
int linedefined; /* (S) */
|
||||
const char *what; /* (S) `Lua' function, `C' function, Lua `main' */
|
||||
int currentline; /* (l) */
|
||||
const char *name; /* (n) */
|
||||
const char *namewhat; /* (n) `global', `tag method', `local', `field' */
|
||||
int nups; /* (u) number of upvalues */
|
||||
int linedefined; /* (S) */
|
||||
const char *what; /* (S) `Lua' function, `C' function, Lua `main' */
|
||||
const char *source; /* (S) */
|
||||
char source_id[LUA_IDSIZE]; /* (S) */
|
||||
/* private part */
|
||||
struct lua_TObject *_func; /* active function */
|
||||
};
|
||||
|
19
lundump.c
19
lundump.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lundump.c,v 1.27 2000/09/04 18:53:41 roberto Exp roberto $
|
||||
** $Id: lundump.c,v 1.28 2000/09/11 17:38:42 roberto Exp roberto $
|
||||
** load bytecodes from files
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -7,7 +7,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lauxlib.h"
|
||||
#include "lfunc.h"
|
||||
#include "lmem.h"
|
||||
#include "lopcodes.h"
|
||||
@ -26,7 +25,7 @@ static const char* ZNAME(ZIO* Z)
|
||||
|
||||
static void unexpectedEOZ (lua_State* L, ZIO* Z)
|
||||
{
|
||||
luaL_verror(L,"unexpected end of file in `%.255s'",ZNAME(Z));
|
||||
luaO_verror(L,"unexpected end of file in `%.255s'",ZNAME(Z));
|
||||
}
|
||||
|
||||
static int ezgetc (lua_State* L, ZIO* Z)
|
||||
@ -100,7 +99,7 @@ static void LoadCode (lua_State* L, Proto* tf, ZIO* Z, int swap)
|
||||
#if 0
|
||||
if (swap) SwapBytes(tf->code,sizeof(*tf->code),size);
|
||||
#endif
|
||||
if (tf->code[size-1]!=OP_END) luaL_verror(L,"bad code in `%.255s'",ZNAME(Z));
|
||||
if (tf->code[size-1]!=OP_END) luaO_verror(L,"bad code in `%.255s'",ZNAME(Z));
|
||||
}
|
||||
|
||||
static void LoadLocals (lua_State* L, Proto* tf, ZIO* Z, int swap)
|
||||
@ -167,14 +166,14 @@ static void LoadSignature (lua_State* L, ZIO* Z)
|
||||
const char* s=SIGNATURE;
|
||||
while (*s!=0 && ezgetc(L,Z)==*s)
|
||||
++s;
|
||||
if (*s!=0) luaL_verror(L,"bad signature in `%.255s'",ZNAME(Z));
|
||||
if (*s!=0) luaO_verror(L,"bad signature in `%.255s'",ZNAME(Z));
|
||||
}
|
||||
|
||||
static void TestSize (lua_State* L, int s, const char* what, ZIO* Z)
|
||||
{
|
||||
int r=ezgetc(L,Z);
|
||||
if (r!=s)
|
||||
luaL_verror(L,"virtual machine mismatch in `%.255s':\n"
|
||||
luaO_verror(L,"virtual machine mismatch in `%.255s':\n"
|
||||
" %s is %d but read %d",ZNAME(Z),what,r,s);
|
||||
}
|
||||
|
||||
@ -188,11 +187,11 @@ static int LoadHeader (lua_State* L, ZIO* Z)
|
||||
LoadSignature(L,Z);
|
||||
version=ezgetc(L,Z);
|
||||
if (version>VERSION)
|
||||
luaL_verror(L,"`%.255s' too new:\n"
|
||||
luaO_verror(L,"`%.255s' too new:\n"
|
||||
" read version %d.%d; expected at most %d.%d",
|
||||
ZNAME(Z),V(version),V(VERSION));
|
||||
if (version<VERSION0) /* check last major change */
|
||||
luaL_verror(L,"`%.255s' too old:\n"
|
||||
luaO_verror(L,"`%.255s' too old:\n"
|
||||
" read version %d.%d; expected at least %d.%d",
|
||||
ZNAME(Z),V(version),V(VERSION));
|
||||
swap=(luaU_endianess()!=ezgetc(L,Z)); /* need to swap bytes? */
|
||||
@ -205,7 +204,7 @@ static int LoadHeader (lua_State* L, ZIO* Z)
|
||||
TESTSIZE(sizeof(Number));
|
||||
f=LoadNumber(L,Z,swap);
|
||||
if ((long)f!=(long)tf) /* disregard errors in last bit of fraction */
|
||||
luaL_verror(L,"unknown number format in `%.255s':\n"
|
||||
luaO_verror(L,"unknown number format in `%.255s':\n"
|
||||
" read " NUMBER_FMT "; expected " NUMBER_FMT,
|
||||
ZNAME(Z),f,tf);
|
||||
return swap;
|
||||
@ -226,7 +225,7 @@ Proto* luaU_undump (lua_State* L, ZIO* Z)
|
||||
if (c==ID_CHUNK)
|
||||
return LoadChunk(L,Z);
|
||||
else if (c!=EOZ)
|
||||
luaL_verror(L,"`%.255s' is not a precompiled Lua chunk",ZNAME(Z));
|
||||
luaO_verror(L,"`%.255s' is not a precompiled Lua chunk",ZNAME(Z));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
67
makefile
67
makefile
@ -1,5 +1,5 @@
|
||||
#
|
||||
## $Id: makefile,v 1.25 2000/04/24 21:05:11 roberto Exp roberto $
|
||||
## $Id: makefile,v 1.26 2000/08/09 19:16:57 roberto Exp roberto $
|
||||
## Makefile
|
||||
## See Copyright Notice in lua.h
|
||||
#
|
||||
@ -25,13 +25,13 @@
|
||||
# are passed as arguments
|
||||
# define LUA_DEPRECATETFUNCS to include obsolete functions
|
||||
|
||||
CONFIG = -DPOPEN -D_POSIX_SOURCE -DDEBUG
|
||||
CONFIG = -DPOPEN -D_POSIX_SOURCE
|
||||
#CONFIG = -DOLD_ANSI -DDEBUG -DLUA_COMPAT_READPATTERN -DLUA_COMPAT_ARGRET
|
||||
# -DLUA_DEPRECATETFUNCS
|
||||
|
||||
|
||||
# Compilation parameters
|
||||
CC = g++
|
||||
CC = gcc
|
||||
CWARNS = -Wall -W -pedantic \
|
||||
-Waggregate-return \
|
||||
-Wcast-align \
|
||||
@ -57,10 +57,7 @@ ARFLAGS = rvl
|
||||
# Aplication modules
|
||||
LUAOBJS = \
|
||||
lstate.o \
|
||||
lref.o \
|
||||
lapi.o \
|
||||
lauxlib.o \
|
||||
lbuiltin.o \
|
||||
lmem.o \
|
||||
lstring.o \
|
||||
ltable.o \
|
||||
@ -68,7 +65,6 @@ LUAOBJS = \
|
||||
lvm.o \
|
||||
ldo.o \
|
||||
lobject.o \
|
||||
lbuffer.o \
|
||||
lfunc.o \
|
||||
lgc.o \
|
||||
lcode.o \
|
||||
@ -80,6 +76,8 @@ LUAOBJS = \
|
||||
ltests.o
|
||||
|
||||
LIBOBJS = \
|
||||
lauxlib.o \
|
||||
lbaselib.o \
|
||||
liolib.o \
|
||||
lmathlib.o \
|
||||
lstrlib.o \
|
||||
@ -113,57 +111,50 @@ clear :
|
||||
co $(CO_OPTIONS) $@
|
||||
|
||||
|
||||
lapi.o: lapi.c lua.h lapi.h lobject.h llimits.h lauxlib.h ldo.h \
|
||||
lstate.h luadebug.h lfunc.h lgc.h lmem.h lref.h lstring.h ltable.h \
|
||||
ltm.h lvm.h
|
||||
lapi.o: lapi.c lua.h lapi.h lobject.h llimits.h ldo.h lstate.h \
|
||||
luadebug.h lfunc.h lgc.h lmem.h lstring.h ltable.h ltm.h lvm.h
|
||||
lauxlib.o: lauxlib.c lua.h lauxlib.h luadebug.h
|
||||
lbuffer.o: lbuffer.c lua.h lauxlib.h lmem.h llimits.h lstate.h \
|
||||
lobject.h luadebug.h
|
||||
lbuiltin.o: lbuiltin.c lua.h lapi.h lobject.h llimits.h lauxlib.h \
|
||||
lbuiltin.h ldo.h lstate.h luadebug.h lfunc.h lmem.h lstring.h \
|
||||
ltable.h ltm.h lundump.h lzio.h lvm.h
|
||||
lbaselib.o: lbaselib.c lua.h lauxlib.h lualib.h
|
||||
lcode.o: lcode.c /usr/include/stdlib.h lua.h lcode.h llex.h lobject.h \
|
||||
llimits.h lzio.h lopcodes.h lparser.h ldo.h lstate.h luadebug.h \
|
||||
lmem.h
|
||||
ldblib.o: ldblib.c lua.h lauxlib.h luadebug.h lualib.h
|
||||
ldebug.o: ldebug.c lua.h lapi.h lobject.h llimits.h lauxlib.h lcode.h \
|
||||
llex.h lzio.h lopcodes.h lparser.h ldebug.h lstate.h luadebug.h ldo.h \
|
||||
lfunc.h ltable.h ltm.h
|
||||
ldo.o: ldo.c lua.h lauxlib.h ldebug.h lstate.h lobject.h llimits.h \
|
||||
luadebug.h ldo.h lgc.h lmem.h lparser.h lzio.h lstring.h ltable.h \
|
||||
ltm.h lundump.h lvm.h
|
||||
ldebug.o: ldebug.c lua.h lapi.h lobject.h llimits.h lcode.h llex.h \
|
||||
lzio.h lopcodes.h lparser.h ldebug.h lstate.h luadebug.h ldo.h \
|
||||
lfunc.h lstring.h ltable.h ltm.h
|
||||
ldo.o: ldo.c lua.h ldebug.h lstate.h lobject.h llimits.h luadebug.h \
|
||||
ldo.h lgc.h lmem.h lparser.h lzio.h lstring.h ltable.h ltm.h \
|
||||
lundump.h lvm.h
|
||||
lfunc.o: lfunc.c lua.h lfunc.h lobject.h llimits.h lmem.h lstate.h \
|
||||
luadebug.h
|
||||
lgc.o: lgc.c lua.h ldo.h lobject.h llimits.h lstate.h luadebug.h \
|
||||
lfunc.h lgc.h lmem.h lref.h lstring.h ltable.h ltm.h
|
||||
lfunc.h lgc.h lmem.h lstring.h ltable.h ltm.h
|
||||
liolib.o: liolib.c lua.h lauxlib.h luadebug.h lualib.h
|
||||
llex.o: llex.c lua.h lauxlib.h llex.h lobject.h llimits.h lzio.h \
|
||||
lmem.h lparser.h lstate.h luadebug.h lstring.h ltable.h
|
||||
llex.o: llex.c lua.h llex.h lobject.h llimits.h lzio.h lmem.h \
|
||||
lparser.h lstate.h luadebug.h lstring.h ltable.h
|
||||
lmathlib.o: lmathlib.c lua.h lauxlib.h lualib.h
|
||||
lmem.o: lmem.c lua.h ldo.h lobject.h llimits.h lstate.h luadebug.h \
|
||||
lmem.h
|
||||
lobject.o: lobject.c lua.h lobject.h llimits.h
|
||||
lobject.o: lobject.c lua.h lmem.h llimits.h lobject.h lstate.h \
|
||||
luadebug.h
|
||||
lparser.o: lparser.c lua.h lcode.h llex.h lobject.h llimits.h lzio.h \
|
||||
lopcodes.h lparser.h lfunc.h lmem.h lstate.h luadebug.h lstring.h
|
||||
lref.o: lref.c lua.h lapi.h lobject.h llimits.h lmem.h lref.h lstate.h \
|
||||
luadebug.h
|
||||
lstate.o: lstate.c lua.h lauxlib.h lbuiltin.h ldo.h lobject.h \
|
||||
llimits.h lstate.h luadebug.h lgc.h llex.h lzio.h lmem.h lref.h \
|
||||
lstring.h ltable.h ltm.h
|
||||
lstate.o: lstate.c lua.h ldo.h lobject.h llimits.h lstate.h luadebug.h \
|
||||
lgc.h llex.h lzio.h lmem.h lstring.h ltable.h ltm.h
|
||||
lstring.o: lstring.c lua.h lmem.h llimits.h lobject.h lstate.h \
|
||||
luadebug.h lstring.h
|
||||
lstrlib.o: lstrlib.c lua.h lauxlib.h lualib.h
|
||||
ltable.o: ltable.c lua.h lauxlib.h lmem.h llimits.h lobject.h lstate.h \
|
||||
ltable.o: ltable.c lua.h lmem.h llimits.h lobject.h lstate.h \
|
||||
luadebug.h lstring.h ltable.h
|
||||
ltests.o: ltests.c lua.h lapi.h lobject.h llimits.h lauxlib.h lcode.h \
|
||||
llex.h lzio.h lopcodes.h lparser.h ldebug.h lstate.h luadebug.h ldo.h \
|
||||
lfunc.h lmem.h lstring.h ltable.h
|
||||
ltm.o: ltm.c lua.h lauxlib.h lmem.h llimits.h lobject.h lstate.h \
|
||||
luadebug.h ltm.h
|
||||
ltm.o: ltm.c lua.h ldo.h lobject.h llimits.h lstate.h luadebug.h \
|
||||
lmem.h ltm.h
|
||||
lua.o: lua.c lua.h luadebug.h lualib.h
|
||||
lundump.o: lundump.c lua.h lauxlib.h lfunc.h lobject.h llimits.h \
|
||||
lmem.h lopcodes.h lstring.h lstate.h luadebug.h lundump.h lzio.h
|
||||
lvm.o: lvm.c lua.h lapi.h lobject.h llimits.h lauxlib.h ldebug.h \
|
||||
lstate.h luadebug.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h \
|
||||
ltm.h lvm.h
|
||||
lundump.o: lundump.c lfunc.h lobject.h llimits.h lua.h lmem.h \
|
||||
lopcodes.h lstring.h lstate.h luadebug.h lundump.h lzio.h
|
||||
lvm.o: lvm.c lua.h lapi.h lobject.h llimits.h ldebug.h lstate.h \
|
||||
luadebug.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h ltm.h \
|
||||
lvm.h
|
||||
lzio.o: lzio.c lua.h lzio.h
|
||||
|
Loading…
Reference in New Issue
Block a user