aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-01-15 09:38:33 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-01-15 09:38:33 -0200
commite87fddf1adab8ca60ec988c9d71d29a44d7129a3 (patch)
tree8895efdc80040e2cd9271f8683f9e0497a60a243 /ldo.c
parentdea400bc1d2854ac26c13f1866c226d9a54ea23f (diff)
downloadlua-e87fddf1adab8ca60ec988c9d71d29a44d7129a3.tar.gz
lua-e87fddf1adab8ca60ec988c9d71d29a44d7129a3.tar.bz2
lua-e87fddf1adab8ca60ec988c9d71d29a44d7129a3.zip
GC can be called during parsing, if needed.
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/ldo.c b/ldo.c
index 9a07e7e1..4e895c0a 100644
--- a/ldo.c
+++ b/ldo.c
@@ -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*/
279int luaD_protectedrun (int nResults) 279int 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*/
303static int protectedparser (ZIO *z, int bin) 302static 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
329static int do_main (ZIO *z, int bin) 330static 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);