/* Standard debugging and error tracking functions for console applications. */ /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */ /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */ /* Preprocessor Includes */ #include #include #include #include #include #include "stdtypes.h" #include "stddebug.h" /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */ /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */ /* Preprocessor Declarations */ #define EOL "\r\n" #define MSG ((fatal) ? "Assert" : ((thrown) ? "Throw" : "Trace")) /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */ /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */ PASCAL void Debug(char *msg, long err, char *file, char *line, int thrown, int fatal) { if (!msg || !*msg) msg = MSG; if (!err) fprintf(stderr, "%s @ %s:%s" EOL, msg, file, line); else fprintf(stderr, "%s : %ld @ %s:%s" EOL, msg, err, file, line); if (fatal) exit((err) ? err : 1); }