aboutsummaryrefslogtreecommitdiff
path: root/ltests.h
diff options
context:
space:
mode:
Diffstat (limited to 'ltests.h')
-rw-r--r--ltests.h86
1 files changed, 0 insertions, 86 deletions
diff --git a/ltests.h b/ltests.h
deleted file mode 100644
index 42a560c7..00000000
--- a/ltests.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2** $Id: ltests.h,v 2.17 2005/12/27 17:12:00 roberto Exp roberto $
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 <stdlib.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 */
26typedef struct Memcontrol {
27 unsigned long numblocks;
28 unsigned long total;
29 unsigned long maxmem;
30 unsigned long memlimit;
31} Memcontrol;
32
33LUAI_DATA Memcontrol memcontrol;
34
35
36/*
37** generic variable for debug tricks
38*/
39LUAI_DATA int Trick;
40
41
42void *debug_realloc (void *ud, void *block, size_t osize, size_t nsize);
43
44#ifdef lua_c
45#define luaL_newstate() lua_newstate(debug_realloc, &memcontrol)
46#endif
47
48
49typedef struct CallInfo *pCallInfo;
50
51int lua_checkmemory (lua_State *L);
52int lua_checkpc (lua_State *L, pCallInfo ci);
53
54
55/* test for lock/unlock */
56#undef luai_userstateopen
57#undef luai_userstatethread
58#undef lua_lock
59#undef lua_unlock
60#undef LUAI_EXTRASPACE
61
62struct L_EXTRA { int lock; int *plock; };
63#define LUAI_EXTRASPACE sizeof(struct L_EXTRA)
64#define getlock(l) (cast(struct L_EXTRA *, l) - 1)
65#define luai_userstateopen(l) \
66 (getlock(l)->lock = 0, getlock(l)->plock = &(getlock(l)->lock))
67#define luai_userstatethread(l,l1) (getlock(l1)->plock = getlock(l)->plock)
68#define lua_lock(l) lua_assert((*getlock(l)->plock)++ == 0)
69#define lua_unlock(l) lua_assert(--(*getlock(l)->plock) == 0)
70
71
72int luaB_opentests (lua_State *L);
73
74#ifdef lua_c
75#define luaL_openlibs(L) { (luaL_openlibs)(L); luaB_opentests(L); }
76#endif
77
78
79
80/* change some sizes to give some bugs a chance */
81
82#undef LUAL_BUFFERSIZE
83#define LUAL_BUFFERSIZE 27
84#define MINSTRTABSIZE 2
85
86#endif