Very old versions for history.
[opsoft_archive.git] / silentbob / silent_bob / dbg.h
bloba8d0798fd4594b9fa2c40b9c6974d3ddcc076099
1 /*
2 * (c) Oleg Puchinin (aka GrayCardinal) 2006
3 * graycardinalster@gmail.com
4 *
5 */
7 #ifndef DEFINE_DBG_H
8 #define DEFINE_DBG_H
10 #define dbg { fputc ('*', d_stream_dbg); fflush (d_stream_dbg); }
11 #define dbg_if { fputc ('>', d_stream_dbg); fflush (d_stream_dbg); }
12 #define dbg_else { fputc ('<', d_stream_dbg); fflush (d_stream_dbg); }
13 #define dbg_s(ptr,str) { if (strstr (ptr,str)) { fprintf (d_stream_dbg, "//SDBG %s %i %s\n", __FUNCTION__, __LINE__, ptr); \
14 d_dbg_SDBG_active = true; } else { d_dbg_SDBG_active = false; } }
15 #define dbg_s2 { if (d_dbg_SDBG_active) { fputc ('*', d_stream_dbg); fflush (d_stream_dbg); } }
16 #define dbg_sif { if (d_dbg_SDBG_active) { fputc ('>', d_stream_dbg); fflush (d_stream_dbg); } }
17 #define dbg_selse { if (d_dbg_SDBG_active) { fputc ('<', d_stream_dbg); fflush (d_stream_dbg); } }
19 #define LN { fputc ('\n', d_stream_dbg); fflush (d_stream_dbg); }
21 #define THE_TT_DBG { fputc (T, d_stream_dbg); fflush (d_stream_dbg); }
22 #define THE_TT_DBG_SPEC { fputc ('!', d_stream_dbg); fputc (T, d_stream_dbg); fflush (d_stream_dbg); }
23 #define FDBG(arg) { fprintf (d_stream_dbg, "%s", arg); fflush (d_stream_dbg); }
25 #define assert(arga,argb) if(arga) { fprintf (d_stream_dbg, "\tBUG at file %s line %i \"%s\"\n", \
26 __FILE__, __LINE__, argb); fflush (d_stream_dbg); }
28 #define fault(arga) if(arga) { fprintf (d_stream_dbg, "\tBUG at file %s line %i\n"); exit (2); }
30 #define dbg_out { fprintf (d_stream_dbg, "%s out\n", __FUNCTION__); fflush (d_stream_dbg); }
32 #endif