diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-05-10 10:54:01 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-05-10 10:54:01 -0300 |
commit | 73308c7605ac2e6c9af1c86f15c03d924f362696 (patch) | |
tree | ec42ab7889f70e57bbeb4451c988b871c5ea077b /ldo.c | |
parent | 288fa056020f20647c6db3e721498b96d8c62713 (diff) | |
download | lua-73308c7605ac2e6c9af1c86f15c03d924f362696.tar.gz lua-73308c7605ac2e6c9af1c86f15c03d924f362696.tar.bz2 lua-73308c7605ac2e6c9af1c86f15c03d924f362696.zip |
warnings by clinio
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 33 |
1 files changed, 16 insertions, 17 deletions
@@ -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 | */ |
126 | static StkId callC (lua_CFunction f, StkId base) | 126 | static 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) { | |||
249 | void lua_error (char *s) { | 248 | void 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 | */ |
277 | int luaD_protectedrun (int nResults) { | 276 | int 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 | */ |
300 | static int protectedparser (ZIO *z, int bin) { | 299 | static 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 | } |