blob: 5aae15a889a844ff6900b9e3af5ced2e4a906b47 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001/* 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
Bram Moolenaar009b2592004-10-24 19:18:58 +000027#define nbprint(a) nbprt##a
Bram Moolenaar071d4272004-06-13 20:20:40 +000028
29#define NB_TRACE 0x00000001
30#define NB_TRACE_VERBOSE 0x00000002
31#define NB_TRACE_COLONCMD 0x00000004
Bram Moolenaar009b2592004-10-24 19:18:58 +000032#define NB_PRINT 0x00000008
Bram Moolenaar071d4272004-06-13 20:20:40 +000033#define NB_DEBUG_ALL 0xffffffff
34
35#define NBDLEVEL(flags) (nb_debug != NULL && (nb_dlevel & (flags)))
36
37#define NBDEBUG_TRACE 1
38//#define NBDEBUG_SENSE 2
39
40typedef enum {
41 WT_ENV = 1, /* look for env var if set */
42 WT_WAIT, /* look for ~/.gvimwait if set */
43 WT_STOP /* look for ~/.gvimstop if set */
44} WtWait;
45
46
47void nbdbg(char *, ...);
Bram Moolenaar009b2592004-10-24 19:18:58 +000048void nbprt(char *, ...);
Bram Moolenaar071d4272004-06-13 20:20:40 +000049void nbtrace(char *, ...);
50
51void nbdebug_wait __ARGS((u_int wait_flags, char *wait_var, u_int wait_secs));
52void nbdebug_log_init __ARGS((char *log_var, char *level_var));
53
54extern FILE *nb_debug;
55extern u_int nb_dlevel; /* nb_debug verbosity level */
56
57# else /* not NBDEBUG */
58
59#ifndef ASSERT
60# define ASSERT(c)
61#endif
62
63/*
Bram Moolenaar009b2592004-10-24 19:18:58 +000064 * The following 3 stubs are needed because a macro cannot be used because of
Bram Moolenaar071d4272004-06-13 20:20:40 +000065 * the variable number of arguments.
66 */
67
68void
69nbdbg(
70 char *fmt,
71 ...)
72{
73}
74
Bram Moolenaar009b2592004-10-24 19:18:58 +000075void
76nbprt(
77 char *fmt,
78 ...)
79{
80}
Bram Moolenaar071d4272004-06-13 20:20:40 +000081
82void
83nbtrace(
84 char *fmt,
85 ...)
86{
87}
88
89#endif /* NBDEBUG */
90#endif /* NBDEBUG_H */