diff options
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.28 1998/07/12 16:14:34 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.29 1998/08/21 17:43:44 roberto Exp $ |
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 | */ |
@@ -276,18 +276,17 @@ static void do_callinc (int nResults) | |||
276 | ** Execute a protected call. Assumes that function is at L->Cstack.base and | 276 | ** Execute a protected call. Assumes that function is at L->Cstack.base and |
277 | ** parameters are on top of it. Leave nResults on the stack. | 277 | ** parameters are on top of it. Leave nResults on the stack. |
278 | */ | 278 | */ |
279 | int luaD_protectedrun (int nResults) | 279 | int luaD_protectedrun (int nResults) { |
280 | { | ||
281 | jmp_buf myErrorJmp; | ||
282 | int status; | ||
283 | volatile struct C_Lua_Stack oldCLS = L->Cstack; | 280 | volatile struct C_Lua_Stack oldCLS = L->Cstack; |
281 | jmp_buf myErrorJmp; | ||
282 | volatile int status; | ||
284 | jmp_buf *volatile oldErr = L->errorJmp; | 283 | jmp_buf *volatile oldErr = L->errorJmp; |
285 | L->errorJmp = &myErrorJmp; | 284 | L->errorJmp = &myErrorJmp; |
286 | if (setjmp(myErrorJmp) == 0) { | 285 | if (setjmp(myErrorJmp) == 0) { |
287 | do_callinc(nResults); | 286 | do_callinc(nResults); |
288 | status = 0; | 287 | status = 0; |
289 | } | 288 | } |
290 | else { /* an error occurred: restore L->Cstack and L->stack.top */ | 289 | else { /* an error occurred: restore L->Cstack and L->stack.top */ |
291 | L->Cstack = oldCLS; | 290 | L->Cstack = oldCLS; |
292 | L->stack.top = L->stack.stack+L->Cstack.base; | 291 | L->stack.top = L->stack.stack+L->Cstack.base; |
293 | status = 1; | 292 | status = 1; |
@@ -300,18 +299,20 @@ int luaD_protectedrun (int nResults) | |||
300 | /* | 299 | /* |
301 | ** returns 0 = chunk loaded; 1 = error; 2 = no more chunks to load | 300 | ** returns 0 = chunk loaded; 1 = error; 2 = no more chunks to load |
302 | */ | 301 | */ |
303 | static int protectedparser (ZIO *z, int bin) | 302 | static int protectedparser (ZIO *z, int bin) { |
304 | { | 303 | volatile struct C_Lua_Stack oldCLS = L->Cstack; |
304 | jmp_buf myErrorJmp; | ||
305 | volatile int status; | 305 | volatile int status; |
306 | TProtoFunc *volatile tf; | 306 | TProtoFunc *volatile tf; |
307 | jmp_buf myErrorJmp; | ||
308 | jmp_buf *volatile oldErr = L->errorJmp; | 307 | jmp_buf *volatile oldErr = L->errorJmp; |
309 | L->errorJmp = &myErrorJmp; | 308 | L->errorJmp = &myErrorJmp; |
310 | if (setjmp(myErrorJmp) == 0) { | 309 | if (setjmp(myErrorJmp) == 0) { |
311 | tf = bin ? luaU_undump1(z) : luaY_parser(z); | 310 | tf = bin ? luaU_undump1(z) : luaY_parser(z); |
312 | status = 0; | 311 | status = 0; |
313 | } | 312 | } |
314 | else { | 313 | else { /* an error occurred: restore L->Cstack and L->stack.top */ |
314 | L->Cstack = oldCLS; | ||
315 | L->stack.top = L->stack.stack+L->Cstack.base; | ||
315 | tf = NULL; | 316 | tf = NULL; |
316 | status = 1; | 317 | status = 1; |
317 | } | 318 | } |
@@ -326,8 +327,7 @@ static int protectedparser (ZIO *z, int bin) | |||
326 | } | 327 | } |
327 | 328 | ||
328 | 329 | ||
329 | static int do_main (ZIO *z, int bin) | 330 | static int do_main (ZIO *z, int bin) { |
330 | { | ||
331 | int status; | 331 | int status; |
332 | do { | 332 | do { |
333 | long old_blocks = (luaC_checkGC(), L->nblocks); | 333 | long old_blocks = (luaC_checkGC(), L->nblocks); |