examples/PIPS/antiword/inc/debug.h

00001 /*
00002  * debug.h
00003  * Copyright (C) 1998-2005 A.J. van Os; Released under GPL
00004  *
00005  * Description:
00006  * Macro's for debuging.
00007  */
00008 
00009 #if !defined(__debug_h)
00010 #define __debug_h 1
00011 
00012 #include <stdio.h>
00013 #include <ctype.h>
00014 
00015 #if defined(DEBUG)
00016 
00017 #define DBG_MSG(t)      (void)fprintf(stderr,\
00018                                 "%s[%3d]: %.240s\n",\
00019                                 __FILE__, __LINE__, (t))
00020 
00021 #define DBG_STRN(t,m)   (void)fprintf(stderr,\
00022                                 "%s[%3d]: %d '%.*s'\n",\
00023                                 __FILE__, __LINE__,\
00024                                 (int)(m), (int)(m), (const char *)(t))
00025 
00026 #define DBG_CHR(m)    (void)fprintf(stderr,\
00027                                 "%s[%3d]: "#m" = %3d 0x%02x '%c'\n",\
00028                                 __FILE__, __LINE__,\
00029                                 (int)(m), (unsigned int)(unsigned char)(m),\
00030                                 isprint((int)(unsigned char)(m))?(char)(m):' ')
00031 
00032 #define DBG_DEC(m)      (void)fprintf(stderr,\
00033                                 "%s[%3d]: "#m" = %ld\n",\
00034                                 __FILE__, __LINE__, (long)(m))
00035 
00036 #define DBG_HEX(m)      (void)fprintf(stderr,\
00037                                 "%s[%3d]: "#m" = 0x%02lx\n",\
00038                                 __FILE__, __LINE__, (unsigned long)(m))
00039 
00040 #define DBG_FLT(m)      (void)fprintf(stderr,\
00041                                 "%s[%3d]: "#m" = %.3f\n",\
00042                                 __FILE__, __LINE__, (double)(m))
00043 
00044 #define DBG_FIXME()     (void)fprintf(stderr,\
00045                                 "%s[%3d]: FIXME\n",\
00046                                 __FILE__, __LINE__)
00047 
00048 #define DBG_PRINT_BLOCK(b,m)    vPrintBlock(__FILE__, __LINE__,(b),(m))
00049 #define DBG_UNICODE(t)          vPrintUnicode(__FILE__, __LINE__,\
00050                                         (const UCHAR *)(t),unilen(t))
00051 #define DBG_UNICODE_N(t,m)      vPrintUnicode(__FILE__, __LINE__,\
00052                                         (const UCHAR *)(t),(m))
00053 
00054 #define DBG_MSG_C(c,t)          do { if (c) DBG_MSG(t); } while(0)
00055 #define DBG_STRN_C(c,t,m)       do { if (c) DBG_STRN(t,m); } while(0)
00056 #define DBG_CHR_C(c,m)          do { if (c) DBG_CHR(m); } while(0)
00057 #define DBG_DEC_C(c,m)          do { if (c) DBG_DEC(m); } while(0)
00058 #define DBG_HEX_C(c,m)          do { if (c) DBG_HEX(m); } while(0)
00059 #define DBG_FLT_C(c,m)          do { if (c) DBG_FLT(m); } while(0)
00060 
00061 #else
00062 
00063 #define DBG_MSG(t)              /* EMPTY */
00064 #define DBG_STRN(t,m)           /* EMPTY */
00065 #define DBG_CHR(m)              /* EMPTY */
00066 #define DBG_DEC(m)              /* EMPTY */
00067 #define DBG_HEX(m)              /* EMPTY */
00068 #define DBG_FLT(m)              /* EMPTY */
00069 
00070 #define DBG_FIXME()             /* EMPTY */
00071 #define DBG_PRINT_BLOCK(b,m)    /* EMPTY */
00072 #define DBG_UNICODE(t)          /* EMPTY */
00073 #define DBG_UNICODE_N(t,m)      /* EMPTY */
00074 
00075 #define DBG_MSG_C(c,t)          /* EMPTY */
00076 #define DBG_STRN_C(c,t,m)       /* EMPTY */
00077 #define DBG_CHR_C(c,m)          /* EMPTY */
00078 #define DBG_DEC_C(c,m)          /* EMPTY */
00079 #define DBG_HEX_C(c,m)          /* EMPTY */
00080 #define DBG_FLT_C(c,m)          /* EMPTY */
00081 
00082 #endif /* DEBUG */
00083 
00084 #define NO_DBG_MSG(t)           /* EMPTY */
00085 #define NO_DBG_STRN(t,m)        /* EMPTY */
00086 #define NO_DBG_CHR(m)           /* EMPTY */
00087 #define NO_DBG_DEC(m)           /* EMPTY */
00088 #define NO_DBG_HEX(m)           /* EMPTY */
00089 #define NO_DBG_FLT(m)           /* EMPTY */
00090 
00091 #define NO_DBG_PRINT_BLOCK(b,m) /* EMPTY */
00092 #define NO_DBG_UNICODE(t)       /* EMPTY */
00093 #define NO_DBG_UNICODE_N(t,m)   /* EMPTY */
00094 
00095 #define NO_DBG_MSG_C(c,t)       /* EMPTY */
00096 #define NO_DBG_STRN_C(c,t,m)    /* EMPTY */
00097 #define NO_DBG_CHR_C(c,m)       /* EMPTY */
00098 #define NO_DBG_DEC_C(c,m)       /* EMPTY */
00099 #define NO_DBG_HEX_C(c,m)       /* EMPTY */
00100 #define NO_DBG_FLT_C(c,m)       /* EMPTY */
00101 
00102 #if defined(TRACE)
00103 
00104 #define TRACE_MSG(t)    do {\
00105                         (void)fprintf(stderr,\
00106                                 "%s[%3d]: TRACE:%.40s\n",\
00107                                 __FILE__, __LINE__, (t));\
00108                         (void)fflush(stderr);\
00109                         } while(0)
00110 
00111 #else
00112 
00113 #define TRACE_MSG(t)            /* EMPTY */
00114 
00115 #endif /* TRACE */
00116 
00117 #endif /* !__debug_h */

Generated by  doxygen 1.6.2