From 617be660158490c7f6558e82d9be2c667c48d9a4 Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 6 Dec 1999 10:03:45 -0200
Subject: better control (and error recovery) for begin/end blocks

---
 ldo.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'ldo.c')

diff --git a/ldo.c b/ldo.c
index 71e19e0f..384bd244 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
 /*
-** $Id: ldo.c,v 1.56 1999/12/02 16:41:29 roberto Exp roberto $
+** $Id: ldo.c,v 1.57 1999/12/06 11:43:58 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 */
@@ -243,12 +243,13 @@ void lua_error (lua_State *L, const char *s) {
 
 
 /*
-** Execute a protected call. Assumes that function is at L->Cstack.base and
-** parameters are on top of it. Leave nResults on the stack.
+** Execute a protected call. Assumes that function is at Cstack.base and
+** parameters are on top of it.
 */
 int luaD_protectedrun (lua_State *L) {
   struct lua_longjmp myErrorJmp;
   volatile StkId base = L->Cstack.base;
+  volatile int numCblocks = L->numCblocks;
   volatile int status;
   struct lua_longjmp *volatile oldErr = L->errorJmp;
   L->errorJmp = &myErrorJmp;
@@ -262,6 +263,7 @@ int luaD_protectedrun (lua_State *L) {
   else {  /* an error occurred: restore the stack */
     L->Cstack.num = 0;  /* no results */
     L->top = L->Cstack.base = L->Cstack.lua2C = base;
+    L->numCblocks = numCblocks;
     restore_stack_limit(L);
     status = 1;
   }
@@ -276,6 +278,7 @@ int luaD_protectedrun (lua_State *L) {
 static int protectedparser (lua_State *L, ZIO *z, int bin) {
   struct lua_longjmp myErrorJmp;
   volatile StkId base = L->Cstack.base;
+  volatile int numCblocks = L->numCblocks;
   volatile int status;
   TProtoFunc *volatile tf;
   struct lua_longjmp *volatile oldErr = L->errorJmp;
@@ -288,6 +291,7 @@ static int protectedparser (lua_State *L, ZIO *z, int bin) {
   else {  /* an error occurred: restore Cstack and top */
     L->Cstack.num = 0;  /* no results */
     L->top = L->Cstack.base = L->Cstack.lua2C = base;
+    L->numCblocks = numCblocks;
     tf = NULL;
     status = 1;
   }
-- 
cgit v1.2.3-55-g6feb