#line 10 "debug.c-nw" #include #ifndef DEBUG #define debug if (0) EXPORTDEF(debug) #define debug0 if (0) EXPORTDEF(debug0) #define enter if (0) EXPORTDEF(enter) #define leave if (0) EXPORTDEF(leave) #else /* DEBUG */ #define INDENT 2 static int indent = 0; EXPORT void debug(char *format,...) { int i; va_list args; va_start(args, format); for (i = 0; i < indent; i++) putc(' ', stderr); vfprintf(stderr, format, args); va_end(args); } EXPORT void debug0(char *format,...) { va_list args; va_start(args, format); vfprintf(stderr, format, args); va_end(args); } EXPORT void enter(char *format,...) { int i; va_list args; va_start(args, format); for (i = 0; i < indent; i++) putc(' ', stderr); fprintf(stderr, "> "); vfprintf(stderr, format, args); indent += INDENT; va_end(args); } EXPORT void leave(char *format,...) { int i; va_list args; va_start(args, format); indent -= INDENT; for (i = 0; i < indent; i++) putc(' ', stderr); fprintf(stderr, "< "); vfprintf(stderr, format, args); va_end(args); } #endif /* DEBUG */