summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/ldo.c b/ldo.c
index e0474a10..e13eec5a 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,15 +1,15 @@
1/* 1/*
2** $Id: ldo.c,v 2.1 2003/12/10 12:13:36 roberto Exp roberto $ 2** $Id: ldo.c,v 2.2 2004/03/23 17:02:58 roberto Exp roberto $
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*/
6 6
7 7
8#include <setjmp.h>
9#include <stdlib.h> 8#include <stdlib.h>
10#include <string.h> 9#include <string.h>
11 10
12#define ldo_c 11#define ldo_c
12#define LUA_CORE
13 13
14#include "lua.h" 14#include "lua.h"
15 15
@@ -34,29 +34,15 @@
34 34
35/* 35/*
36** {====================================================== 36** {======================================================
37** Error-recovery functions (based on long jumps) 37** Error-recovery functions
38** ======================================================= 38** =======================================================
39*/ 39*/
40 40
41 41
42#ifndef LUA_USEEXCEPTIONS
43
44#define L_THROW(c) longjmp((c)->b, 1)
45#define L_TRY(c,a) if (setjmp((c)->b) == 0) { a }
46
47#else
48
49#define L_THROW(c) throw(c)
50#define L_TRY(c,a) try { a } catch(...) \
51 { if ((c)->status == 0) (c)->status = -1; }
52
53#endif
54
55
56/* chain list of long jump buffers */ 42/* chain list of long jump buffers */
57struct lua_longjmp { 43struct lua_longjmp {
58 struct lua_longjmp *previous; 44 struct lua_longjmp *previous;
59 jmp_buf b; 45 l_jmpbuf b;
60 volatile int status; /* error code */ 46 volatile int status; /* error code */
61}; 47};
62 48