2 ** $Id: ltests.h,v 1.20 2002/12/04 17:29:05 roberto Exp $
3 ** Internal Header for Debugging of the Lua Implementation
4 ** See Copyright Notice in lua.h
20 #define lua_assert(c) assert(c)
21 #define check_exp(c,e) (lua_assert(c), (e))
22 #define api_check(L, o) lua_assert(o)
25 /* to avoid warnings, and to make sure value is really unused */
26 #define UNUSED(x) (x=0, (void)(x))
29 /* memory allocator control variables */
30 extern unsigned long memdebug_numblocks
;
31 extern unsigned long memdebug_total
;
32 extern unsigned long memdebug_maxmem
;
33 extern unsigned long memdebug_memlimit
;
36 #define l_realloc(b, os, s) debug_realloc(b, os, s)
37 #define l_free(b, os) debug_realloc(b, os, 0)
39 void *debug_realloc (void *block
, size_t oldsize
, size_t size
);
43 /* test for lock/unlock */
45 #define LUA_USERSTATE int *
46 #define getlock(l) (*(cast(LUA_USERSTATE *, l) - 1))
47 #define lua_userstateopen(l) if (l != NULL) getlock(l) = &islocked;
48 #define lua_lock(l) lua_assert((*getlock(l))++ == 0)
49 #define lua_unlock(l) lua_assert(--(*getlock(l)) == 0)
52 int luaB_opentests (lua_State
*L
);
54 #define LUA_EXTRALIBS { "tests", luaB_opentests },
57 /* real main will be defined at `ltests.c' */
58 int l_main (int argc
, char *argv
[]);
63 /* change some sizes to give some bugs a chance */
65 #define LUAL_BUFFERSIZE 27
66 #define MINSTRTABSIZE 2