1 /* vi:set ts=8 sts=8 sw=8: 2 * 3 * VIM - Vi IMproved by Bram Moolenaar 4 * Visual Workshop integration by Gordon Prieur 5 * 6 * Do ":help uganda" in Vim to read copying and usage conditions. 7 * Do ":help credits" in Vim to see a list of people who contributed. 8 */ 9 10 11 #ifndef NBDEBUG_H 12 #define NBDEBUG_H 13 14 #ifdef NBDEBUG 15 16 #ifndef ASSERT 17 #define ASSERT(c) \ 18 if (!(c)) { \ 19 fprintf(stderr, "Assertion failed: line %d, file %s\n", \ 20 __LINE__, __FILE__); \ 21 fflush(stderr); \ 22 abort(); \ 23 } 24 #endif 25 26 #define nbdebug(a) nbdbg##a 27 #define nbprint(a) nbprt##a 28 29 #define NB_TRACE 0x00000001 30 #define NB_TRACE_VERBOSE 0x00000002 31 #define NB_TRACE_COLONCMD 0x00000004 32 #define NB_PRINT 0x00000008 33 #define NB_DEBUG_ALL 0xffffffff 34 35 #define NBDLEVEL(flags) (nb_debug != NULL && (nb_dlevel & (flags))) 36 37 #define NBDEBUG_TRACE 1 38 39 typedef enum { 40 WT_ENV = 1, /* look for env var if set */ 41 WT_WAIT, /* look for ~/.gvimwait if set */ 42 WT_STOP /* look for ~/.gvimstop if set */ 43 } WtWait; 44 45 46 void nbdbg(char *, ...); 47 void nbprt(char *, ...); 48 void nbtrace(char *, ...); 49 50 void nbdebug_wait __ARGS((u_int wait_flags, char *wait_var, u_int wait_secs)); 51 void nbdebug_log_init __ARGS((char *log_var, char *level_var)); 52 53 extern FILE *nb_debug; 54 extern u_int nb_dlevel; /* nb_debug verbosity level */ 55 56 # else /* not NBDEBUG */ 57 58 #ifndef ASSERT 59 # define ASSERT(c) 60 #endif 61 62 /* 63 * The following 3 stubs are needed because a macro cannot be used because of 64 * the variable number of arguments. 65 */ 66 67 void 68 nbdbg( 69 char *fmt, 70 ...) 71 { 72 } 73 74 void 75 nbprt( 76 char *fmt, 77 ...) 78 { 79 } 80 81 void 82 nbtrace( 83 char *fmt, 84 ...) 85 { 86 } 87 88 #endif /* NBDEBUG */ 89 #endif /* NBDEBUG_H */ 90