diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-02-26 12:27:56 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-02-26 12:27:56 -0300 |
commit | c6c41e85b2992bba41cac23ac8bab32e29553e84 (patch) | |
tree | d48b427016446604131f730f016bceb90463777d /ldo.c | |
parent | 87c930676f4aef54054024b73a245a24747aa163 (diff) | |
download | lua-c6c41e85b2992bba41cac23ac8bab32e29553e84.tar.gz lua-c6c41e85b2992bba41cac23ac8bab32e29553e84.tar.bz2 lua-c6c41e85b2992bba41cac23ac8bab32e29553e84.zip |
more uniformity for defining system-dependent features
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.112 2013/11/08 18:16:33 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.113 2014/02/15 13:12:01 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 | */ |
@@ -46,30 +46,33 @@ | |||
46 | ** C++ code, with _longjmp/_setjmp when asked to use them, and with | 46 | ** C++ code, with _longjmp/_setjmp when asked to use them, and with |
47 | ** longjmp/setjmp otherwise. | 47 | ** longjmp/setjmp otherwise. |
48 | */ | 48 | */ |
49 | #if !defined(LUAI_THROW) | 49 | #if !defined(LUAI_THROW) /* { */ |
50 | |||
51 | #if defined(__cplusplus) && !defined(LUA_USE_LONGJMP) /* { */ | ||
50 | 52 | ||
51 | #if defined(__cplusplus) && !defined(LUA_USE_LONGJMP) | ||
52 | /* C++ exceptions */ | 53 | /* C++ exceptions */ |
53 | #define LUAI_THROW(L,c) throw(c) | 54 | #define LUAI_THROW(L,c) throw(c) |
54 | #define LUAI_TRY(L,c,a) \ | 55 | #define LUAI_TRY(L,c,a) \ |
55 | try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; } | 56 | try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; } |
56 | #define luai_jmpbuf int /* dummy variable */ | 57 | #define luai_jmpbuf int /* dummy variable */ |
57 | 58 | ||
58 | #elif defined(LUA_USE_ULONGJMP) | 59 | #elif defined(LUA_USE_POSIX) /* }{ */ |
59 | /* in Unix, try _longjmp/_setjmp (more efficient) */ | 60 | |
61 | /* in Posix, try _longjmp/_setjmp (more efficient) */ | ||
60 | #define LUAI_THROW(L,c) _longjmp((c)->b, 1) | 62 | #define LUAI_THROW(L,c) _longjmp((c)->b, 1) |
61 | #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } | 63 | #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } |
62 | #define luai_jmpbuf jmp_buf | 64 | #define luai_jmpbuf jmp_buf |
63 | 65 | ||
64 | #else | 66 | #else /* }{ */ |
65 | /* default handling with long jumps */ | 67 | |
68 | /* ANSI handling with long jumps */ | ||
66 | #define LUAI_THROW(L,c) longjmp((c)->b, 1) | 69 | #define LUAI_THROW(L,c) longjmp((c)->b, 1) |
67 | #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } | 70 | #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } |
68 | #define luai_jmpbuf jmp_buf | 71 | #define luai_jmpbuf jmp_buf |
69 | 72 | ||
70 | #endif | 73 | #endif /* } */ |
71 | 74 | ||
72 | #endif | 75 | #endif /* } */ |
73 | 76 | ||
74 | 77 | ||
75 | 78 | ||