diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-17 10:26:09 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-17 10:26:09 -0200 |
| commit | de6fc75d630b393d8b577ba03353abe527523d0f (patch) | |
| tree | 385cb83b63b2ec409cde308c776e7c4c2073ff84 /ldo.c | |
| parent | 2af0d3b4598060b1086884cfb879d39fa4e0c89a (diff) | |
| download | lua-de6fc75d630b393d8b577ba03353abe527523d0f.tar.gz lua-de6fc75d630b393d8b577ba03353abe527523d0f.tar.bz2 lua-de6fc75d630b393d8b577ba03353abe527523d0f.zip | |
several configuration options that do not change often moved out of
luaconf.h and into more internal files
Diffstat (limited to 'ldo.c')
| -rw-r--r-- | ldo.c | 34 |
1 files changed, 33 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 2.75 2009/12/08 18:59:24 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.76 2009/12/10 18:20:07 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 | */ |
| @@ -40,6 +40,38 @@ | |||
| 40 | ** ======================================================= | 40 | ** ======================================================= |
| 41 | */ | 41 | */ |
| 42 | 42 | ||
| 43 | /* | ||
| 44 | ** LUAI_THROW/LUAI_TRY define how Lua does exception handling. By | ||
| 45 | ** default, Lua handles errors with exceptions when compiling as | ||
| 46 | ** C++ code, with _longjmp/_setjmp when asked to use them, and with | ||
| 47 | ** longjmp/setjmp otherwise. | ||
| 48 | */ | ||
| 49 | #if !defined(LUAI_THROW) | ||
| 50 | |||
| 51 | #if defined(__cplusplus) | ||
| 52 | /* C++ exceptions */ | ||
| 53 | #define LUAI_THROW(L,c) throw(c) | ||
| 54 | #define LUAI_TRY(L,c,a) \ | ||
| 55 | try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; } | ||
| 56 | #define luai_jmpbuf int /* dummy variable */ | ||
| 57 | |||
| 58 | #elif defined(LUA_USE_ULONGJMP) | ||
| 59 | /* in Unix, try _longjmp/_setjmp (more efficient) */ | ||
| 60 | #define LUAI_THROW(L,c) _longjmp((c)->b, 1) | ||
| 61 | #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } | ||
| 62 | #define luai_jmpbuf jmp_buf | ||
| 63 | |||
| 64 | #else | ||
| 65 | /* default handling with long jumps */ | ||
| 66 | #define LUAI_THROW(L,c) longjmp((c)->b, 1) | ||
| 67 | #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } | ||
| 68 | #define luai_jmpbuf jmp_buf | ||
| 69 | |||
| 70 | #endif | ||
| 71 | |||
| 72 | #endif | ||
| 73 | |||
| 74 | |||
| 43 | 75 | ||
| 44 | /* chain list of long jump buffers */ | 76 | /* chain list of long jump buffers */ |
| 45 | struct lua_longjmp { | 77 | struct lua_longjmp { |
