summaryrefslogtreecommitdiff
path: root/src/tools.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools.h')
-rw-r--r--src/tools.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/tools.h b/src/tools.h
index 4a77a6a..d0169cf 100644
--- a/src/tools.h
+++ b/src/tools.h
@@ -25,6 +25,8 @@
25#define lua_getuservalue lua_getfenv 25#define lua_getuservalue lua_getfenv
26#define lua_rawlen lua_objlen 26#define lua_rawlen lua_objlen
27#define luaG_registerlibfuncs( L, _funcs) luaL_register( L, NULL, _funcs) 27#define luaG_registerlibfuncs( L, _funcs) luaL_register( L, NULL, _funcs)
28#define LUA_OK 0
29#define LUA_ERRGCMM 666 // doesn't exist in Lua 5.1, we don't care about the actual value
28#endif // LUA_VERSION_NUM == 501 30#endif // LUA_VERSION_NUM == 501
29 31
30// wrap Lua 5.2 calls under Lua 5.1 API when it is simpler that way 32// wrap Lua 5.2 calls under Lua 5.1 API when it is simpler that way
@@ -33,14 +35,21 @@
33#define luaG_registerlibfuncs( L, _funcs) luaL_setfuncs( L, _funcs, 0) 35#define luaG_registerlibfuncs( L, _funcs) luaL_setfuncs( L, _funcs, 0)
34#endif // LUA_VERSION_NUM == 502 36#endif // LUA_VERSION_NUM == 502
35 37
38#define USE_DEBUG_SPEW 0
39#if USE_DEBUG_SPEW
40extern char const* debugspew_indent;
41#define DEBUGSPEW_CODE(_code) _code
42#else // USE_DEBUG_SPEW
43#define DEBUGSPEW_CODE(_code)
44#endif // USE_DEBUG_SPEW
45
46
36#ifdef NDEBUG 47#ifdef NDEBUG
37 #define _ASSERT_L(lua,c) /*nothing*/ 48 #define _ASSERT_L(lua,c) /*nothing*/
38 #define STACK_CHECK(L) /*nothing*/ 49 #define STACK_CHECK(L) /*nothing*/
39 #define STACK_MID(L,c) /*nothing*/ 50 #define STACK_MID(L,c) /*nothing*/
40 #define STACK_END(L,c) /*nothing*/ 51 #define STACK_END(L,c) /*nothing*/
41 #define STACK_DUMP(L) /*nothing*/ 52 #define STACK_DUMP(L) /*nothing*/
42 #define DEBUG() /*nothing*/
43 #define DEBUGEXEC(_code) {} /*nothing*/
44#else 53#else
45 #define _ASSERT_L(lua,c) do { if (!(c)) luaL_error( lua, "ASSERT failed: %s:%d '%s'", __FILE__, __LINE__, #c ); } while( 0) 54 #define _ASSERT_L(lua,c) do { if (!(c)) luaL_error( lua, "ASSERT failed: %s:%d '%s'", __FILE__, __LINE__, #c ); } while( 0)
46 // 55 //
@@ -50,8 +59,6 @@
50 #define STACK_END(L,change) STACK_MID(L,change) } 59 #define STACK_END(L,change) STACK_MID(L,change) }
51 60
52 #define STACK_DUMP(L) luaG_dump(L); 61 #define STACK_DUMP(L) luaG_dump(L);
53 #define DEBUG() fprintf( stderr, "<<%s %d>>\n", __FILE__, __LINE__ );
54 #define DEBUGEXEC(_code) {_code;} /*nothing*/
55#endif 62#endif
56#define ASSERT_L(c) _ASSERT_L(L,c) 63#define ASSERT_L(c) _ASSERT_L(L,c)
57 64
@@ -73,7 +80,8 @@ typedef struct {
73 void *deep; 80 void *deep;
74} DEEP_PRELUDE; 81} DEEP_PRELUDE;
75 82
76void luaG_push_proxy( lua_State *L, luaG_IdFunction idfunc, DEEP_PRELUDE *deep_userdata ); 83void luaG_push_proxy( lua_State *L, luaG_IdFunction idfunc, DEEP_PRELUDE *deep_userdata);
84void luaG_inter_copy_package( lua_State* L, lua_State* L2, int _idx);
77 85
78int luaG_inter_copy( lua_State *L, lua_State *L2, uint_t n); 86int luaG_inter_copy( lua_State *L, lua_State *L2, uint_t n);
79int luaG_inter_move( lua_State *L, lua_State *L2, uint_t n); 87int luaG_inter_move( lua_State *L, lua_State *L2, uint_t n);
@@ -85,7 +93,7 @@ int luaG_nameof( lua_State* L);
85extern MUTEX_T deep_lock; 93extern MUTEX_T deep_lock;
86extern MUTEX_T mtid_lock; 94extern MUTEX_T mtid_lock;
87 95
88void populate_func_lookup_table( lua_State *L, int _i, char const *_name); 96void populate_func_lookup_table( lua_State* L, int _i, char const* _name);
89void serialize_require( lua_State *L); 97void serialize_require( lua_State *L);
90extern MUTEX_T require_cs; 98extern MUTEX_T require_cs;
91 99