aboutsummaryrefslogtreecommitdiff
path: root/src/tools.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools.h')
-rw-r--r--src/tools.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/tools.h b/src/tools.h
index e4fbd94..f79d2ad 100644
--- a/src/tools.h
+++ b/src/tools.h
@@ -38,6 +38,9 @@
38#define USE_DEBUG_SPEW 0 38#define USE_DEBUG_SPEW 0
39#if USE_DEBUG_SPEW 39#if USE_DEBUG_SPEW
40extern char const* debugspew_indent; 40extern char const* debugspew_indent;
41extern int debugspew_indent_depth;
42#define INDENT_BEGIN "%.*s "
43#define INDENT_END , debugspew_indent_depth, debugspew_indent
41#define DEBUGSPEW_CODE(_code) _code 44#define DEBUGSPEW_CODE(_code) _code
42#else // USE_DEBUG_SPEW 45#else // USE_DEBUG_SPEW
43#define DEBUGSPEW_CODE(_code) 46#define DEBUGSPEW_CODE(_code)
@@ -53,10 +56,16 @@ extern char const* debugspew_indent;
53#else 56#else
54 #define _ASSERT_L(lua,c) do { if (!(c)) luaL_error( lua, "ASSERT failed: %s:%d '%s'", __FILE__, __LINE__, #c ); } while( 0) 57 #define _ASSERT_L(lua,c) do { if (!(c)) luaL_error( lua, "ASSERT failed: %s:%d '%s'", __FILE__, __LINE__, #c ); } while( 0)
55 // 58 //
56 #define STACK_CHECK(L) { int _oldtop_##L = lua_gettop(L); 59 #define STACK_CHECK(L) { int const _oldtop_##L = lua_gettop( L)
57 #define STACK_MID(L,change) { int a= lua_gettop(L)-_oldtop_##L; int b= (change); \ 60 #define STACK_MID(L,change) \
58 if (a != b) luaL_error( L, "STACK ASSERT failed (%d not %d): %s:%d", a, b, __FILE__, __LINE__ ); } 61 do \
59 #define STACK_END(L,change) STACK_MID(L,change) } 62 { \
63 int a = lua_gettop( L) - _oldtop_##L; \
64 int b = (change); \
65 if( a != b) \
66 luaL_error( L, "STACK ASSERT failed (%d not %d): %s:%d", a, b, __FILE__, __LINE__ ); \
67 } while( 0)
68 #define STACK_END(L,change) STACK_MID(L,change); }
60 69
61 #define STACK_DUMP(L) luaG_dump(L); 70 #define STACK_DUMP(L) luaG_dump(L);
62#endif 71#endif