summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-12-06 10:03:45 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-12-06 10:03:45 -0200
commit617be660158490c7f6558e82d9be2c667c48d9a4 (patch)
tree27c0c29cb550d576cef2b4953ff4c4622f852503 /ldo.c
parentf356eb010b6785cf22e8d5f1d4f7761e0789ae51 (diff)
downloadlua-github-617be660158490c7f6558e82d9be2c667c48d9a4.tar.gz
better control (and error recovery) for begin/end blocks
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c10
1 files changed, 7 insertions, 3 deletions
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;
}