fix: hdgnss调用mobile.reqCellInfo传错时间单位了
[LuatOS.git] / lua / include / ltests.h
blob820bc82f921d1b01a48a9812f002a4a9ebec3bf4
1 /*
2 ** $Id: ltests.h,v 2.50.1.1 2017/04/19 17:20:42 roberto Exp $
3 ** Internal Header for Debugging of the Lua Implementation
4 ** See Copyright Notice in lua.h
5 */
7 #ifndef ltests_h
8 #define ltests_h
11 #include <stdlib.h>
13 /* test Lua with no compatibility code */
14 #undef LUA_COMPAT_MATHLIB
15 #undef LUA_COMPAT_IPAIRS
16 #undef LUA_COMPAT_BITLIB
17 #undef LUA_COMPAT_APIINTCASTS
18 #undef LUA_COMPAT_FLOATSTRING
19 #undef LUA_COMPAT_UNPACK
20 #undef LUA_COMPAT_LOADERS
21 #undef LUA_COMPAT_LOG10
22 #undef LUA_COMPAT_LOADSTRING
23 #undef LUA_COMPAT_MAXN
24 #undef LUA_COMPAT_MODULE
27 #define LUA_DEBUG
30 /* turn on assertions */
31 #undef NDEBUG
32 #include <assert.h>
33 #define lua_assert(c) assert(c)
36 /* to avoid warnings, and to make sure value is really unused */
37 #define UNUSED(x) (x=0, (void)(x))
40 /* test for sizes in 'l_sprintf' (make sure whole buffer is available) */
41 #undef l_sprintf
42 #if !defined(LUA_USE_C89)
43 #define l_sprintf(s,sz,f,i) (memset(s,0xAB,sz), snprintf(s,sz,f,i))
44 #else
45 #define l_sprintf(s,sz,f,i) (memset(s,0xAB,sz), sprintf(s,f,i))
46 #endif
49 /* memory-allocator control variables */
50 typedef struct Memcontrol {
51 unsigned long numblocks;
52 unsigned long total;
53 unsigned long maxmem;
54 unsigned long memlimit;
55 unsigned long objcount[LUA_NUMTAGS];
56 } Memcontrol;
58 LUA_API Memcontrol l_memcontrol;
62 ** generic variable for debug tricks
64 extern void *l_Trick;
69 ** Function to traverse and check all memory used by Lua
71 int lua_checkmemory (lua_State *L);
74 /* test for lock/unlock */
76 struct L_EXTRA { int lock; int *plock; };
77 #undef LUA_EXTRASPACE
78 #define LUA_EXTRASPACE sizeof(struct L_EXTRA)
79 #define getlock(l) cast(struct L_EXTRA*, lua_getextraspace(l))
80 #define luai_userstateopen(l) \
81 (getlock(l)->lock = 0, getlock(l)->plock = &(getlock(l)->lock))
82 #define luai_userstateclose(l) \
83 lua_assert(getlock(l)->lock == 1 && getlock(l)->plock == &(getlock(l)->lock))
84 #define luai_userstatethread(l,l1) \
85 lua_assert(getlock(l1)->plock == getlock(l)->plock)
86 #define luai_userstatefree(l,l1) \
87 lua_assert(getlock(l)->plock == getlock(l1)->plock)
88 #define lua_lock(l) lua_assert((*getlock(l)->plock)++ == 0)
89 #define lua_unlock(l) lua_assert(--(*getlock(l)->plock) == 0)
93 LUA_API int luaB_opentests (lua_State *L);
95 LUA_API void *debug_realloc (void *ud, void *block,
96 size_t osize, size_t nsize);
98 #if defined(lua_c)
99 #define luaL_newstate() lua_newstate(debug_realloc, &l_memcontrol)
100 #define luaL_openlibs(L) \
101 { (luaL_openlibs)(L); \
102 luaL_requiref(L, "T", luaB_opentests, 1); \
103 lua_pop(L, 1); }
104 #endif
108 /* change some sizes to give some bugs a chance */
110 #undef LUAL_BUFFERSIZE
111 #define LUAL_BUFFERSIZE 23
112 #define MINSTRTABSIZE 2
113 #define MAXINDEXRK 1
116 /* make stack-overflow tests run faster */
117 #undef LUAI_MAXSTACK
118 #define LUAI_MAXSTACK 50000
121 #undef LUAI_USER_ALIGNMENT_T
122 #define LUAI_USER_ALIGNMENT_T union { char b[sizeof(void*) * 8]; }
125 #define STRCACHE_N 23
126 #define STRCACHE_M 5
128 #endif