diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-02 13:12:25 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-02 13:12:25 -0200 |
| commit | 8823f371a2a63f634121a0c16cb1d02e5ce9f5c5 (patch) | |
| tree | e0aca1333a422846eaa0f6342eca68fa2e3f5e3f | |
| parent | e506b864cdc522ed7bf33e81d785fcfbd40a0368 (diff) | |
| download | lua-8823f371a2a63f634121a0c16cb1d02e5ce9f5c5.tar.gz lua-8823f371a2a63f634121a0c16cb1d02e5ce9f5c5.tar.bz2 lua-8823f371a2a63f634121a0c16cb1d02e5ce9f5c5.zip | |
new header to put together debug-related declarations
| -rw-r--r-- | ltests.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/ltests.h b/ltests.h new file mode 100644 index 00000000..1cba13e4 --- /dev/null +++ b/ltests.h | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | /* | ||
| 2 | ** $Id: $ | ||
| 3 | ** Internal Header for Debugging of the Lua Implementation | ||
| 4 | ** See Copyright Notice in lua.h | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef ltests_h | ||
| 8 | #define ltests_h | ||
| 9 | |||
| 10 | |||
| 11 | #include "llimits.h" | ||
| 12 | |||
| 13 | |||
| 14 | #define LUA_DEBUG | ||
| 15 | |||
| 16 | #undef NDEBUG | ||
| 17 | #include <assert.h> | ||
| 18 | #define lua_assert(c) assert(c) | ||
| 19 | |||
| 20 | |||
| 21 | /* to avoid warnings, and to make sure value is really unused */ | ||
| 22 | #define UNUSED(x) (x=0, (void)(x)) | ||
| 23 | |||
| 24 | |||
| 25 | /* memory allocator control variables */ | ||
| 26 | extern mem_int memdebug_numblocks; | ||
| 27 | extern mem_int memdebug_total; | ||
| 28 | extern mem_int memdebug_maxmem; | ||
| 29 | extern mem_int memdebug_memlimit; | ||
| 30 | |||
| 31 | |||
| 32 | /* test for lock/unlock */ | ||
| 33 | #define LUA_USERSTATE int *lock; | ||
| 34 | extern int islocked; | ||
| 35 | #define LUA_LOCK(L) lua_assert((**((int **)L))++ == 0) | ||
| 36 | #define LUA_UNLOCK(L) lua_assert(--(**((int **)L)) == 0) | ||
| 37 | |||
| 38 | |||
| 39 | extern lua_State *lua_state; | ||
| 40 | |||
| 41 | |||
| 42 | void luaB_opentests (lua_State *L); | ||
| 43 | |||
| 44 | #define LUA_USERINIT(L) luaB_opentests(L) | ||
| 45 | |||
| 46 | |||
| 47 | #endif | ||
