more uniformity for defining system-dependent features

This commit is contained in:
Roberto Ierusalimschy
2014-02-26 12:27:56 -03:00
parent 87c930676f
commit c6c41e85b2
6 changed files with 101 additions and 65 deletions

21
ldo.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: ldo.c,v 2.112 2013/11/08 18:16:33 roberto Exp roberto $
** $Id: ldo.c,v 2.113 2014/02/15 13:12:01 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@@ -46,30 +46,33 @@
** C++ code, with _longjmp/_setjmp when asked to use them, and with
** longjmp/setjmp otherwise.
*/
#if !defined(LUAI_THROW)
#if !defined(LUAI_THROW) /* { */
#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP) /* { */
#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP)
/* C++ exceptions */
#define LUAI_THROW(L,c) throw(c)
#define LUAI_TRY(L,c,a) \
try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; }
#define luai_jmpbuf int /* dummy variable */
#elif defined(LUA_USE_ULONGJMP)
/* in Unix, try _longjmp/_setjmp (more efficient) */
#elif defined(LUA_USE_POSIX) /* }{ */
/* in Posix, try _longjmp/_setjmp (more efficient) */
#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
#define luai_jmpbuf jmp_buf
#else
/* default handling with long jumps */
#else /* }{ */
/* ANSI handling with long jumps */
#define LUAI_THROW(L,c) longjmp((c)->b, 1)
#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
#define luai_jmpbuf jmp_buf
#endif
#endif /* } */
#endif
#endif /* } */