Browse Source

added an `L' parameter to macros L_TRY & L_THROW (someone may need it).

Roberto Ierusalimschy 20 years ago
parent
commit
12dacd3c0e
2 changed files with 8 additions and 8 deletions
  1. 3 3
      ldo.c
  2. 5 5
      luaconf.h

+ 3 - 3
ldo.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ldo.c,v 2.10 2004/09/15 20:39:42 roberto Exp roberto $
+** $Id: ldo.c,v 2.11 2004/09/22 12:37:52 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -70,7 +70,7 @@ static void seterrorobj (lua_State *L, int errcode, StkId oldtop) {
 void luaD_throw (lua_State *L, int errcode) {
 void luaD_throw (lua_State *L, int errcode) {
   if (L->errorJmp) {
   if (L->errorJmp) {
     L->errorJmp->status = errcode;
     L->errorJmp->status = errcode;
-    L_THROW(L->errorJmp);
+    L_THROW(L, L->errorJmp);
   }
   }
   else {
   else {
     if (G(L)->panic) G(L)->panic(L);
     if (G(L)->panic) G(L)->panic(L);
@@ -84,7 +84,7 @@ int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
   lj.status = 0;
   lj.status = 0;
   lj.previous = L->errorJmp;  /* chain new error handler */
   lj.previous = L->errorJmp;  /* chain new error handler */
   L->errorJmp = &lj;
   L->errorJmp = &lj;
-  L_TRY(&lj,
+  L_TRY(L, &lj,
     (*f)(L, ud);
     (*f)(L, ud);
   );
   );
   L->errorJmp = lj.previous;  /* restore old error handler */
   L->errorJmp = lj.previous;  /* restore old error handler */

+ 5 - 5
luaconf.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: luaconf.h,v 1.17 2004/11/24 18:55:56 roberto Exp roberto $
+** $Id: luaconf.h,v 1.18 2004/12/01 15:50:18 roberto Exp roberto $
 ** Configuration file for Lua
 ** Configuration file for Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -234,14 +234,14 @@
 #ifndef __cplusplus
 #ifndef __cplusplus
 /* default handling with long jumps */
 /* default handling with long jumps */
 #include <setjmp.h>
 #include <setjmp.h>
-#define L_THROW(c)	longjmp((c)->b, 1)
-#define L_TRY(c,a)	if (setjmp((c)->b) == 0) { a }
+#define L_THROW(L,c)	longjmp((c)->b, 1)
+#define L_TRY(L,c,a)	if (setjmp((c)->b) == 0) { a }
 #define l_jmpbuf	jmp_buf
 #define l_jmpbuf	jmp_buf
 
 
 #else
 #else
 /* C++ exceptions */
 /* C++ exceptions */
-#define L_THROW(c)	throw(c)
-#define L_TRY(c,a)	try { a } catch(...) \
+#define L_THROW(L,c)	throw(c)
+#define L_TRY(L,c,a)	try { a } catch(...) \
 	{ if ((c)->status == 0) (c)->status = -1; }
 	{ if ((c)->status == 0) (c)->status = -1; }
 #define l_jmpbuf	int  /* dummy variable */
 #define l_jmpbuf	int  /* dummy variable */
 #endif
 #endif