/* bde/dprint.h: * $Log: dprint.h,v $ * Revision 1.6 2005/10/23 07:12:22 lechner * Renamed XP (ExitProc) to LP (LeaveProc) to avoid name clash with XP * (paste macro of JPsim/olcarch) in pr_accessors.c from chgen13 . * * Revision 1.5 2005/08/26 02:51:58 lechner * Fixed typos - extra *_/ terminators. * * Revision 1.4 2005/08/26 02:35:33 lechner * Added macro #define XP do{printf("Exit %s at %s:%d\n",...)}while (0) * {EP; XP;} logs function entry and exit; * enable functions using vi commands in bde/maketrace.csh. * * Revision 1.3 2005/07/25 02:11:51 lechner * If USEDECC, cc and cxx do not recognize __FUNCTION__ used by DP EP and SP: * so try to avoid errors by #define __FUNCTION__ "Function?" . * * Revision 1.2 2005/05/02 03:03:23 lechner * Copied file from bde2alpha_rv branch onto trunk. * * Revision 1.1.2.7 2005/02/26 02:40:42 lechner * Added ' $Log: dprint.h,v $ * Added ' Revision 1.6 2005/10/23 07:12:22 lechner * Added ' Renamed XP (ExitProc) to LP (LeaveProc) to avoid name clash with XP * Added ' (paste macro of JPsim/olcarch) in pr_accessors.c from chgen13 . * Added ' * Added ' Revision 1.5 2005/08/26 02:51:58 lechner * Added ' Fixed typos - extra *_/ terminators. * Added ' * Added ' Revision 1.4 2005/08/26 02:35:33 lechner * Added ' Added macro #define XP do{printf("Exit %s at %s:%d\n",...)}while (0) * Added ' {EP; XP;} logs function entry and exit; * Added ' enable functions using vi commands in bde/maketrace.csh. * Added ' * Added ' Revision 1.3 2005/07/25 02:11:51 lechner * Added ' If USEDECC, cc and cxx do not recognize __FUNCTION__ used by DP EP and SP: * Added ' so try to avoid errors by #define __FUNCTION__ "Function?" . * Added ' * Added ' Revision 1.2 2005/05/02 03:03:23 lechner * Added ' Copied file from bde2alpha_rv branch onto trunk. * Added '' and comments * *****************************************************8 * Macros to wrap printf in #ifdef DEBUG brackets * Moved from bde/src; #include in any *schema.h - RJL 031020 * sources in pr_util/ dprint.c * Warning: I removed const from the gcc block and got an error from textops.cc: * It said discarding const was illegal * I added #ifdef DPxERINT brackets - RJL 040621; no help for EP; in pr_util * __FUNCTION__ may not be supported by gcc * __FILE/FUNC/LINE__ are NOT supported on Linux/mercury: TBD: Bypass for Linux */ /* [050830] I renamed XP (ExitProc) to LP (LeaveProc) to avoid name clash with XP */ /* (paste macro of JPsim/olcarch) which chgen13 now generates in pr_accessors.c */ /* Macros to locate function calls and entry events: - RJL 040601 */ /* do{...}while(0) brackets on DP failed, in table_loop body (if((DP), ...)*/ /* (conditional EP, LP fails to insert \n or \\ before #endif) */ /* #define XP do{...} while (0) fails before '}' or 'return' */ /* #include "configure.h" //configure.h is for [I]makefiles, not compilable */ #ifndef DPRINT #define DPRINT #include #include //#define EP #ifdef DPDBUG CEP #endif - fails to insert \n or \\ before #endif #define EP do{printf("Enter %s at %s:%d\n",__FUNCTION__,__FILE__,__LINE__);}while(0) #define LP do{printf("Exit %s at %s:%d\n",__FUNCTION__,__FILE__,__LINE__);}while(0) #define DP do{printf("Inside %s at %s:%d\n",__FUNCTION__,__FILE__,__LINE__);}while(0) /* In configure.h, #define USEDECC to compile and link with cxx instead of g++*/ /* If USEDECC, cc and cxx do not recognize __FUNCTION__ used by DP EP and SP: */ #ifdef USEDECC #define __FUNCTION__ "Function?" #endif #define SP do{printf("\nstate:%s, event %s ",\ statename[state], &eventname[event->type][0]);DP; }while(0) #ifdef __cplusplus__ /* for g++ */ extern "C" void dprint(const char*); extern "C" void dprintd(const char*, const int); extern "C" void dprints(const char*, const char*); extern "C" void dprintdd(const char*, const int,const int); extern "C" void dprintds(const char*, const int, const char*); extern "C" void dprintsd(const char*, const char*, const int); extern "C" void dprintss(const char*, const char*, const char*); #else /* for gcc */ extern void dprint(const char*); extern void dprintd(const char*, const int); extern void dprints(const char*, const char*); extern void dprintdd(const char*, const int, const int); extern void dprintds(const char*, const int, const char*); extern void dprintsd(const char*, const char*, const int); extern void dprintss(const char*, const char*, const char*); #endif #endif