aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-05-10 10:54:01 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-05-10 10:54:01 -0300
commit73308c7605ac2e6c9af1c86f15c03d924f362696 (patch)
treeec42ab7889f70e57bbeb4451c988b871c5ea077b
parent288fa056020f20647c6db3e721498b96d8c62713 (diff)
downloadlua-73308c7605ac2e6c9af1c86f15c03d924f362696.tar.gz
lua-73308c7605ac2e6c9af1c86f15c03d924f362696.tar.bz2
lua-73308c7605ac2e6c9af1c86f15c03d924f362696.zip
warnings by clinio
-rw-r--r--ldo.c33
-rw-r--r--lparser.c10
-rw-r--r--lstate.h16
3 files changed, 34 insertions, 25 deletions
diff --git a/ldo.c b/ldo.c
index 6a012fe7..c1076fdf 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.40 1999/03/10 14:23:07 roberto Exp roberto $ 2** $Id: ldo.c,v 1.41 1999/03/11 18:59:19 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -123,22 +123,21 @@ void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn)
123** Cstack.num is the number of arguments; Cstack.lua2C points to the 123** Cstack.num is the number of arguments; Cstack.lua2C points to the
124** first argument. Returns an index to the first result from C. 124** first argument. Returns an index to the first result from C.
125*/ 125*/
126static StkId callC (lua_CFunction f, StkId base) 126static StkId callC (lua_CFunction f, StkId base) {
127{ 127 struct C_Lua_Stack *cls = &L->Cstack;
128 struct C_Lua_Stack *CS = &L->Cstack; 128 struct C_Lua_Stack oldCLS = *cls;
129 struct C_Lua_Stack oldCLS = *CS;
130 StkId firstResult; 129 StkId firstResult;
131 int numarg = (L->stack.top-L->stack.stack) - base; 130 int numarg = (L->stack.top-L->stack.stack) - base;
132 CS->num = numarg; 131 cls->num = numarg;
133 CS->lua2C = base; 132 cls->lua2C = base;
134 CS->base = base+numarg; /* == top-stack */ 133 cls->base = base+numarg; /* == top-stack */
135 if (L->callhook) 134 if (L->callhook)
136 luaD_callHook(base, NULL, 0); 135 luaD_callHook(base, NULL, 0);
137 (*f)(); /* do the actual call */ 136 (*f)(); /* do the actual call */
138 if (L->callhook) /* func may have changed callhook */ 137 if (L->callhook) /* func may have changed callhook */
139 luaD_callHook(base, NULL, 1); 138 luaD_callHook(base, NULL, 1);
140 firstResult = CS->base; 139 firstResult = cls->base;
141 *CS = oldCLS; 140 *cls = oldCLS;
142 return firstResult; 141 return firstResult;
143} 142}
144 143
@@ -249,7 +248,7 @@ static void message (char *s) {
249void lua_error (char *s) { 248void lua_error (char *s) {
250 if (s) message(s); 249 if (s) message(s);
251 if (L->errorJmp) 250 if (L->errorJmp)
252 longjmp(*((jmp_buf *)L->errorJmp), 1); 251 longjmp(L->errorJmp->b, 1);
253 else { 252 else {
254 message("exit(1). Unable to recover.\n"); 253 message("exit(1). Unable to recover.\n");
255 exit(1); 254 exit(1);
@@ -276,11 +275,11 @@ static void do_callinc (int nResults)
276*/ 275*/
277int luaD_protectedrun (int nResults) { 276int luaD_protectedrun (int nResults) {
278 volatile struct C_Lua_Stack oldCLS = L->Cstack; 277 volatile struct C_Lua_Stack oldCLS = L->Cstack;
279 jmp_buf myErrorJmp; 278 struct lua_longjmp myErrorJmp;
280 volatile int status; 279 volatile int status;
281 jmp_buf *volatile oldErr = L->errorJmp; 280 struct lua_longjmp *volatile oldErr = L->errorJmp;
282 L->errorJmp = &myErrorJmp; 281 L->errorJmp = &myErrorJmp;
283 if (setjmp(myErrorJmp) == 0) { 282 if (setjmp(myErrorJmp.b) == 0) {
284 do_callinc(nResults); 283 do_callinc(nResults);
285 status = 0; 284 status = 0;
286 } 285 }
@@ -299,12 +298,12 @@ int luaD_protectedrun (int nResults) {
299*/ 298*/
300static int protectedparser (ZIO *z, int bin) { 299static int protectedparser (ZIO *z, int bin) {
301 volatile struct C_Lua_Stack oldCLS = L->Cstack; 300 volatile struct C_Lua_Stack oldCLS = L->Cstack;
302 jmp_buf myErrorJmp; 301 struct lua_longjmp myErrorJmp;
303 volatile int status; 302 volatile int status;
304 TProtoFunc *volatile tf; 303 TProtoFunc *volatile tf;
305 jmp_buf *volatile oldErr = L->errorJmp; 304 struct lua_longjmp *volatile oldErr = L->errorJmp;
306 L->errorJmp = &myErrorJmp; 305 L->errorJmp = &myErrorJmp;
307 if (setjmp(myErrorJmp) == 0) { 306 if (setjmp(myErrorJmp.b) == 0) {
308 tf = bin ? luaU_undump1(z) : luaY_parser(z); 307 tf = bin ? luaU_undump1(z) : luaY_parser(z);
309 status = 0; 308 status = 0;
310 } 309 }
diff --git a/lparser.c b/lparser.c
index 9a206fba..e3696ee5 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 1.31 1999/03/25 21:06:57 roberto Exp roberto $ 2** $Id: lparser.c,v 1.32 1999/05/06 14:41:41 roberto Exp roberto $
3** LL(1) Parser and code generator for Lua 3** LL(1) Parser and code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -50,7 +50,7 @@
50*/ 50*/
51typedef enum {VGLOBAL, VLOCAL, VDOT, VINDEXED, VEXP} varkind; 51typedef enum {VGLOBAL, VLOCAL, VDOT, VINDEXED, VEXP} varkind;
52 52
53typedef struct { 53typedef struct vardesc {
54 varkind k; 54 varkind k;
55 int info; 55 int info;
56} vardesc; 56} vardesc;
@@ -62,7 +62,7 @@ typedef struct {
62** and, if last expression is open (a function call), 62** and, if last expression is open (a function call),
63** where is its pc index of "nparam" 63** where is its pc index of "nparam"
64*/ 64*/
65typedef struct { 65typedef struct listdesc {
66 int n; 66 int n;
67 int pc; /* 0 if last expression is closed */ 67 int pc; /* 0 if last expression is closed */
68} listdesc; 68} listdesc;
@@ -74,7 +74,7 @@ typedef struct {
74** it is a list constructor (k = 0) or a record constructor (k = 1) 74** it is a list constructor (k = 0) or a record constructor (k = 1)
75** or empty (k = ';' or '}') 75** or empty (k = ';' or '}')
76*/ 76*/
77typedef struct { 77typedef struct constdesc {
78 int n; 78 int n;
79 int k; 79 int k;
80} constdesc; 80} constdesc;
@@ -911,7 +911,7 @@ static OpCode opcodes [POW+1] = {NOTOP, MINUSOP, EQOP, NEQOP, GTOP, LTOP,
911 911
912#define MAXOPS 20 /* op's stack size */ 912#define MAXOPS 20 /* op's stack size */
913 913
914typedef struct { 914typedef struct stack_op {
915 int ops[MAXOPS]; 915 int ops[MAXOPS];
916 int top; 916 int top;
917} stack_op; 917} stack_op;
diff --git a/lstate.h b/lstate.h
index 6de48233..795a6008 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 1.15 1999/02/25 15:17:01 roberto Exp roberto $ 2** $Id: lstate.h,v 1.16 1999/04/13 19:30:51 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -21,6 +21,16 @@
21 21
22typedef int StkId; /* index to stack elements */ 22typedef int StkId; /* index to stack elements */
23 23
24
25/*
26** "jmp_buf" may be an array, so it is better to make sure it has an
27** address (and not that it *is* an address...)
28*/
29struct lua_longjmp {
30 jmp_buf b;
31};
32
33
24struct Stack { 34struct Stack {
25 TObject *top; 35 TObject *top;
26 TObject *stack; 36 TObject *stack;
@@ -35,7 +45,7 @@ struct C_Lua_Stack {
35}; 45};
36 46
37 47
38typedef struct { 48typedef struct stringtable {
39 int size; 49 int size;
40 int nuse; /* number of elements (including EMPTYs) */ 50 int nuse; /* number of elements (including EMPTYs) */
41 TaggedString **hash; 51 TaggedString **hash;
@@ -54,7 +64,7 @@ struct lua_State {
54 /* thread-specific state */ 64 /* thread-specific state */
55 struct Stack stack; /* Lua stack */ 65 struct Stack stack; /* Lua stack */
56 struct C_Lua_Stack Cstack; /* C2lua struct */ 66 struct C_Lua_Stack Cstack; /* C2lua struct */
57 jmp_buf *errorJmp; /* current error recover point */ 67 struct lua_longjmp *errorJmp; /* current error recover point */
58 char *Mbuffer; /* global buffer */ 68 char *Mbuffer; /* global buffer */
59 int Mbuffbase; /* current first position of Mbuffer */ 69 int Mbuffbase; /* current first position of Mbuffer */
60 int Mbuffsize; /* size of Mbuffer */ 70 int Mbuffsize; /* size of Mbuffer */