diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-07-23 13:47:47 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-07-23 13:47:47 -0300 |
| commit | b3b85806060013f660002a7c5e2d2e7d07efd1d1 (patch) | |
| tree | 1380099513030c55de65c84ca4579f835785085a | |
| parent | 73ad16b5c6baf71c3e334859666112d1c5137c23 (diff) | |
| download | lua-b3b85806060013f660002a7c5e2d2e7d07efd1d1.tar.gz lua-b3b85806060013f660002a7c5e2d2e7d07efd1d1.tar.bz2 lua-b3b85806060013f660002a7c5e2d2e7d07efd1d1.zip | |
comments + proper undef of compatibility macros + no need to undef
internal macros (this is the first definition)
| -rw-r--r-- | ltests.h | 34 |
1 files changed, 22 insertions, 12 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.h,v 2.34 2013/11/08 17:36:05 roberto Exp roberto $ | 2 | ** $Id: ltests.h,v 2.35 2014/07/18 13:27:45 roberto Exp roberto $ |
| 3 | ** Internal Header for Debugging of the Lua Implementation | 3 | ** Internal Header for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -10,11 +10,23 @@ | |||
| 10 | 10 | ||
| 11 | #include <stdlib.h> | 11 | #include <stdlib.h> |
| 12 | 12 | ||
| 13 | /* do not use compatibility macros in Lua code */ | 13 | /* test Lua with no compatibility code */ |
| 14 | #undef LUA_COMPAT_API | 14 | #undef LUA_COMPAT_MATHLIB |
| 15 | #undef LUA_COMPAT_BITLIB | ||
| 16 | #undef LUA_COMPAT_APIUNSIGNED | ||
| 17 | #undef LUA_COMPAT_FLOATSTRING | ||
| 18 | #undef LUA_COMPAT_UNPACK | ||
| 19 | #undef LUA_COMPAT_LOADERS | ||
| 20 | #undef LUA_COMPAT_LOG10 | ||
| 21 | #undef LUA_COMPAT_LOADSTRING | ||
| 22 | #undef LUA_COMPAT_MAXN | ||
| 23 | #undef LUA_COMPAT_MODULE | ||
| 24 | |||
| 15 | 25 | ||
| 16 | #define LUA_DEBUG | 26 | #define LUA_DEBUG |
| 17 | 27 | ||
| 28 | |||
| 29 | /* turn on assertions */ | ||
| 18 | #undef NDEBUG | 30 | #undef NDEBUG |
| 19 | #include <assert.h> | 31 | #include <assert.h> |
| 20 | #define lua_assert(c) assert(c) | 32 | #define lua_assert(c) assert(c) |
| @@ -24,7 +36,7 @@ | |||
| 24 | #define UNUSED(x) (x=0, (void)(x)) | 36 | #define UNUSED(x) (x=0, (void)(x)) |
| 25 | 37 | ||
| 26 | 38 | ||
| 27 | /* memory allocator control variables */ | 39 | /* memory-allocator control variables */ |
| 28 | typedef struct Memcontrol { | 40 | typedef struct Memcontrol { |
| 29 | unsigned long numblocks; | 41 | unsigned long numblocks; |
| 30 | unsigned long total; | 42 | unsigned long total; |
| @@ -42,19 +54,14 @@ extern Memcontrol l_memcontrol; | |||
| 42 | extern void *l_Trick; | 54 | extern void *l_Trick; |
| 43 | 55 | ||
| 44 | 56 | ||
| 45 | void *debug_realloc (void *ud, void *block, size_t osize, size_t nsize); | ||
| 46 | |||
| 47 | |||
| 48 | typedef struct CallInfo *pCallInfo; | ||
| 49 | 57 | ||
| 58 | /* | ||
| 59 | ** Function to traverse and check all memory used by Lua | ||
| 60 | */ | ||
| 50 | int lua_checkmemory (lua_State *L); | 61 | int lua_checkmemory (lua_State *L); |
| 51 | 62 | ||
| 52 | 63 | ||
| 53 | /* test for lock/unlock */ | 64 | /* test for lock/unlock */ |
| 54 | #undef luai_userstateopen | ||
| 55 | #undef luai_userstatethread | ||
| 56 | #undef lua_lock | ||
| 57 | #undef lua_unlock | ||
| 58 | 65 | ||
| 59 | struct L_EXTRA { int lock; int *plock; }; | 66 | struct L_EXTRA { int lock; int *plock; }; |
| 60 | #define LUAI_EXTRASPACE sizeof(struct L_EXTRA) | 67 | #define LUAI_EXTRASPACE sizeof(struct L_EXTRA) |
| @@ -70,8 +77,10 @@ struct L_EXTRA { int lock; int *plock; }; | |||
| 70 | #define lua_unlock(l) lua_assert(--(*getlock(l)->plock) == 0) | 77 | #define lua_unlock(l) lua_assert(--(*getlock(l)->plock) == 0) |
| 71 | 78 | ||
| 72 | 79 | ||
| 80 | |||
| 73 | int luaB_opentests (lua_State *L); | 81 | int luaB_opentests (lua_State *L); |
| 74 | 82 | ||
| 83 | void *debug_realloc (void *ud, void *block, size_t osize, size_t nsize); | ||
| 75 | 84 | ||
| 76 | #if defined(lua_c) | 85 | #if defined(lua_c) |
| 77 | #define luaL_newstate() lua_newstate(debug_realloc, &l_memcontrol) | 86 | #define luaL_newstate() lua_newstate(debug_realloc, &l_memcontrol) |
| @@ -93,3 +102,4 @@ int luaB_opentests (lua_State *L); | |||
| 93 | 102 | ||
| 94 | 103 | ||
| 95 | #endif | 104 | #endif |
| 105 | |||
