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 /llimits.h | |
| 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 'llimits.h')
| -rw-r--r-- | llimits.h | 45 |
1 files changed, 30 insertions, 15 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llimits.h,v 1.74 2009/08/31 14:26:28 roberto Exp roberto $ | 2 | ** $Id: llimits.h,v 1.75 2009/11/17 11:56:03 roberto Exp roberto $ |
| 3 | ** Limits, basic types, and some other `installation-dependent' definitions | 3 | ** Limits, basic types, and some other `installation-dependent' definitions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -44,6 +44,10 @@ typedef unsigned char lu_byte; | |||
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | /* type to ensure maximum alignment */ | 46 | /* type to ensure maximum alignment */ |
| 47 | #if !defined(LUAI_USER_ALIGNMENT_T) | ||
| 48 | #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } | ||
| 49 | #endif | ||
| 50 | |||
| 47 | typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; | 51 | typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; |
| 48 | 52 | ||
| 49 | 53 | ||
| @@ -52,36 +56,47 @@ typedef LUAI_UACNUMBER l_uacNumber; | |||
| 52 | 56 | ||
| 53 | 57 | ||
| 54 | /* internal assertions for in-house debugging */ | 58 | /* internal assertions for in-house debugging */ |
| 55 | #ifdef lua_assert | 59 | #if defined(lua_assert) |
| 56 | |||
| 57 | #define check_exp(c,e) (lua_assert(c), (e)) | 60 | #define check_exp(c,e) (lua_assert(c), (e)) |
| 58 | #undef luai_apicheck | ||
| 59 | #define luai_apicheck(L,e) lua_assert(e) | ||
| 60 | |||
| 61 | #else | 61 | #else |
| 62 | |||
| 63 | #define lua_assert(c) ((void)0) | 62 | #define lua_assert(c) ((void)0) |
| 64 | #define check_exp(c,e) (e) | 63 | #define check_exp(c,e) (e) |
| 64 | #endif | ||
| 65 | 65 | ||
| 66 | /* | ||
| 67 | ** assertion for checking API calls | ||
| 68 | */ | ||
| 69 | #if defined(LUA_USE_APICHECK) | ||
| 70 | #include <assert.h> | ||
| 71 | #define luai_apicheck(L,e) { (void)L; assert(e); } | ||
| 72 | #elif !defined(luai_apicheck) | ||
| 73 | #define luai_apicheck(L,e) lua_assert(e) | ||
| 66 | #endif | 74 | #endif |
| 67 | 75 | ||
| 68 | #define api_check(l,e,msg) luai_apicheck(l,(e) && msg) | 76 | #define api_check(l,e,msg) luai_apicheck(l,(e) && msg) |
| 69 | 77 | ||
| 70 | 78 | ||
| 71 | #ifndef UNUSED | 79 | #if !defined(UNUSED) |
| 72 | #define UNUSED(x) ((void)(x)) /* to avoid warnings */ | 80 | #define UNUSED(x) ((void)(x)) /* to avoid warnings */ |
| 73 | #endif | 81 | #endif |
| 74 | 82 | ||
| 75 | 83 | ||
| 76 | #ifndef cast | ||
| 77 | #define cast(t, exp) ((t)(exp)) | 84 | #define cast(t, exp) ((t)(exp)) |
| 78 | #endif | ||
| 79 | 85 | ||
| 80 | #define cast_byte(i) cast(lu_byte, (i)) | 86 | #define cast_byte(i) cast(lu_byte, (i)) |
| 81 | #define cast_num(i) cast(lua_Number, (i)) | 87 | #define cast_num(i) cast(lua_Number, (i)) |
| 82 | #define cast_int(i) cast(int, (i)) | 88 | #define cast_int(i) cast(int, (i)) |
| 83 | 89 | ||
| 84 | 90 | ||
| 91 | /* | ||
| 92 | ** maximum depth for nested C calls and syntactical nested non-terminals | ||
| 93 | ** in a program. (Value must fit in an unsigned short int.) | ||
| 94 | */ | ||
| 95 | #if !defined(LUAI_MAXCCALLS) | ||
| 96 | #define LUAI_MAXCCALLS 200 | ||
| 97 | #endif | ||
| 98 | |||
| 99 | |||
| 85 | 100 | ||
| 86 | /* | 101 | /* |
| 87 | ** type for virtual-machine instructions | 102 | ** type for virtual-machine instructions |
| @@ -97,23 +112,23 @@ typedef lu_int32 Instruction; | |||
| 97 | 112 | ||
| 98 | 113 | ||
| 99 | /* minimum size for the string table (must be power of 2) */ | 114 | /* minimum size for the string table (must be power of 2) */ |
| 100 | #ifndef MINSTRTABSIZE | 115 | #if !defined(MINSTRTABSIZE) |
| 101 | #define MINSTRTABSIZE 32 | 116 | #define MINSTRTABSIZE 32 |
| 102 | #endif | 117 | #endif |
| 103 | 118 | ||
| 104 | 119 | ||
| 105 | /* minimum size for string buffer */ | 120 | /* minimum size for string buffer */ |
| 106 | #ifndef LUA_MINBUFFER | 121 | #if !defined(LUA_MINBUFFER) |
| 107 | #define LUA_MINBUFFER 32 | 122 | #define LUA_MINBUFFER 32 |
| 108 | #endif | 123 | #endif |
| 109 | 124 | ||
| 110 | 125 | ||
| 111 | #ifndef lua_lock | 126 | #if !defined(lua_lock) |
| 112 | #define lua_lock(L) ((void) 0) | 127 | #define lua_lock(L) ((void) 0) |
| 113 | #define lua_unlock(L) ((void) 0) | 128 | #define lua_unlock(L) ((void) 0) |
| 114 | #endif | 129 | #endif |
| 115 | 130 | ||
| 116 | #ifndef luai_threadyield | 131 | #if !defined(luai_threadyield) |
| 117 | #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} | 132 | #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} |
| 118 | #endif | 133 | #endif |
| 119 | 134 | ||
| @@ -121,7 +136,7 @@ typedef lu_int32 Instruction; | |||
| 121 | /* | 136 | /* |
| 122 | ** macro to control inclusion of some hard tests on stack reallocation | 137 | ** macro to control inclusion of some hard tests on stack reallocation |
| 123 | */ | 138 | */ |
| 124 | #ifndef HARDSTACKTESTS | 139 | #if !defined(HARDSTACKTESTS) |
| 125 | #define condmovestack(L) ((void)0) | 140 | #define condmovestack(L) ((void)0) |
| 126 | #else | 141 | #else |
| 127 | /* realloc stack keeping its size */ | 142 | /* realloc stack keeping its size */ |
