commit 73308c7605ac2e6c9af1c86f15c03d924f362696
parent 288fa056020f20647c6db3e721498b96d8c62713
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 10 May 1999 10:53:39 -0300
warnings by clinio
Diffstat:
3 files changed, 34 insertions(+), 25 deletions(-)
diff --git a/ldo.c b/ldo.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldo.c,v 1.40 1999/03/10 14:23:07 roberto Exp roberto $
+** $Id: ldo.c,v 1.41 1999/03/11 18:59:19 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@@ -123,22 +123,21 @@ void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn)
** Cstack.num is the number of arguments; Cstack.lua2C points to the
** first argument. Returns an index to the first result from C.
*/
-static StkId callC (lua_CFunction f, StkId base)
-{
- struct C_Lua_Stack *CS = &L->Cstack;
- struct C_Lua_Stack oldCLS = *CS;
+static StkId callC (lua_CFunction f, StkId base) {
+ struct C_Lua_Stack *cls = &L->Cstack;
+ struct C_Lua_Stack oldCLS = *cls;
StkId firstResult;
int numarg = (L->stack.top-L->stack.stack) - base;
- CS->num = numarg;
- CS->lua2C = base;
- CS->base = base+numarg; /* == top-stack */
+ cls->num = numarg;
+ cls->lua2C = base;
+ cls->base = base+numarg; /* == top-stack */
if (L->callhook)
luaD_callHook(base, NULL, 0);
(*f)(); /* do the actual call */
if (L->callhook) /* func may have changed callhook */
luaD_callHook(base, NULL, 1);
- firstResult = CS->base;
- *CS = oldCLS;
+ firstResult = cls->base;
+ *cls = oldCLS;
return firstResult;
}
@@ -249,7 +248,7 @@ static void message (char *s) {
void lua_error (char *s) {
if (s) message(s);
if (L->errorJmp)
- longjmp(*((jmp_buf *)L->errorJmp), 1);
+ longjmp(L->errorJmp->b, 1);
else {
message("exit(1). Unable to recover.\n");
exit(1);
@@ -276,11 +275,11 @@ static void do_callinc (int nResults)
*/
int luaD_protectedrun (int nResults) {
volatile struct C_Lua_Stack oldCLS = L->Cstack;
- jmp_buf myErrorJmp;
+ struct lua_longjmp myErrorJmp;
volatile int status;
- jmp_buf *volatile oldErr = L->errorJmp;
+ struct lua_longjmp *volatile oldErr = L->errorJmp;
L->errorJmp = &myErrorJmp;
- if (setjmp(myErrorJmp) == 0) {
+ if (setjmp(myErrorJmp.b) == 0) {
do_callinc(nResults);
status = 0;
}
@@ -299,12 +298,12 @@ int luaD_protectedrun (int nResults) {
*/
static int protectedparser (ZIO *z, int bin) {
volatile struct C_Lua_Stack oldCLS = L->Cstack;
- jmp_buf myErrorJmp;
+ struct lua_longjmp myErrorJmp;
volatile int status;
TProtoFunc *volatile tf;
- jmp_buf *volatile oldErr = L->errorJmp;
+ struct lua_longjmp *volatile oldErr = L->errorJmp;
L->errorJmp = &myErrorJmp;
- if (setjmp(myErrorJmp) == 0) {
+ if (setjmp(myErrorJmp.b) == 0) {
tf = bin ? luaU_undump1(z) : luaY_parser(z);
status = 0;
}
diff --git a/lparser.c b/lparser.c
@@ -1,5 +1,5 @@
/*
-** $Id: lparser.c,v 1.31 1999/03/25 21:06:57 roberto Exp roberto $
+** $Id: lparser.c,v 1.32 1999/05/06 14:41:41 roberto Exp roberto $
** LL(1) Parser and code generator for Lua
** See Copyright Notice in lua.h
*/
@@ -50,7 +50,7 @@
*/
typedef enum {VGLOBAL, VLOCAL, VDOT, VINDEXED, VEXP} varkind;
-typedef struct {
+typedef struct vardesc {
varkind k;
int info;
} vardesc;
@@ -62,7 +62,7 @@ typedef struct {
** and, if last expression is open (a function call),
** where is its pc index of "nparam"
*/
-typedef struct {
+typedef struct listdesc {
int n;
int pc; /* 0 if last expression is closed */
} listdesc;
@@ -74,7 +74,7 @@ typedef struct {
** it is a list constructor (k = 0) or a record constructor (k = 1)
** or empty (k = ';' or '}')
*/
-typedef struct {
+typedef struct constdesc {
int n;
int k;
} constdesc;
@@ -911,7 +911,7 @@ static OpCode opcodes [POW+1] = {NOTOP, MINUSOP, EQOP, NEQOP, GTOP, LTOP,
#define MAXOPS 20 /* op's stack size */
-typedef struct {
+typedef struct stack_op {
int ops[MAXOPS];
int top;
} stack_op;
diff --git a/lstate.h b/lstate.h
@@ -1,5 +1,5 @@
/*
-** $Id: lstate.h,v 1.15 1999/02/25 15:17:01 roberto Exp roberto $
+** $Id: lstate.h,v 1.16 1999/04/13 19:30:51 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@@ -21,6 +21,16 @@
typedef int StkId; /* index to stack elements */
+
+/*
+** "jmp_buf" may be an array, so it is better to make sure it has an
+** address (and not that it *is* an address...)
+*/
+struct lua_longjmp {
+ jmp_buf b;
+};
+
+
struct Stack {
TObject *top;
TObject *stack;
@@ -35,7 +45,7 @@ struct C_Lua_Stack {
};
-typedef struct {
+typedef struct stringtable {
int size;
int nuse; /* number of elements (including EMPTYs) */
TaggedString **hash;
@@ -54,7 +64,7 @@ struct lua_State {
/* thread-specific state */
struct Stack stack; /* Lua stack */
struct C_Lua_Stack Cstack; /* C2lua struct */
- jmp_buf *errorJmp; /* current error recover point */
+ struct lua_longjmp *errorJmp; /* current error recover point */
char *Mbuffer; /* global buffer */
int Mbuffbase; /* current first position of Mbuffer */
int Mbuffsize; /* size of Mbuffer */