Merge commit 'svn-vim' into vim
[MacVim/KaoriYa.git] / src / nbdebug.h
blob65bb940b5ce358631a57d25c9964c79630e1eadc
1 /* vi:set ts=8 sts=8 sw=8:
3 * VIM - Vi IMproved by Bram Moolenaar
4 * Visual Workshop integration by Gordon Prieur
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 */
11 #ifndef NBDEBUG_H
12 #define NBDEBUG_H
14 #ifdef NBDEBUG
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(); \
24 #endif
26 #define nbdebug(a) nbdbg a
28 #define NB_TRACE 0x00000001
29 #define NB_TRACE_VERBOSE 0x00000002
30 #define NB_TRACE_COLONCMD 0x00000004
31 #define NB_PRINT 0x00000008
32 #define NB_DEBUG_ALL 0xffffffff
34 #define NBDLEVEL(flags) (nb_debug != NULL && (nb_dlevel & (flags)))
36 #define NBDEBUG_TRACE 1
38 typedef enum {
39 WT_ENV = 1, /* look for env var if set */
40 WT_WAIT, /* look for ~/.gvimwait if set */
41 WT_STOP /* look for ~/.gvimstop if set */
42 } WtWait;
45 void nbdbg(char *, ...);
46 void nbprt(char *, ...);
47 void nbtrace(char *, ...);
49 void nbdebug_wait __ARGS((u_int wait_flags, char *wait_var, u_int wait_secs));
50 void nbdebug_log_init __ARGS((char *log_var, char *level_var));
52 extern FILE *nb_debug;
53 extern u_int nb_dlevel; /* nb_debug verbosity level */
55 # else /* not NBDEBUG */
57 #ifndef ASSERT
58 # define ASSERT(c)
59 #endif
62 * The following 3 stubs are needed because a macro cannot be used because of
63 * the variable number of arguments.
66 void
67 nbdbg(
68 char *fmt,
69 ...)
73 void
74 nbprt(
75 char *fmt,
76 ...)
80 void
81 nbtrace(
82 char *fmt,
83 ...)
87 #endif /* NBDEBUG */
88 #endif /* NBDEBUG_H */