home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / out-of-phase-102-c / OutOfPhase 1.02 Source / OutOfPhase Folder / Level 0 Macintosh 29Sep94 / Debug.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-23  |  1.9 KB  |  55 lines  |  [TEXT/KAHL]

  1. /* Debug.h */
  2.  
  3. #ifndef Included_Debug_h
  4. #define Included_Debug_h
  5.  
  6. /* Debug module depends on: */
  7. /* MiscInfo.h */
  8. /* Definitions */
  9. /* Audit */
  10.  
  11. /* error handling utilities */
  12.  
  13. /* in order to use this debugging package, define the following macros */
  14. /* in the MiscInfo.h file: */
  15. /* #define DEBUG (1)  defines the EXECUTE and ERROR macros */
  16. /* #define DEBUG (0)  eliminates EXECUTE and ERROR macros */
  17. /* #define ALWAYSRESUME (1)  makes the 'resume' button always available, even */
  18. /*  if 'ForceAbort' was passed to PRERR */
  19. /* #define ALWAYSRESUME (0)  makes 'ForceAbort' suppress the resume button */
  20. /* #define THINKC_DEBUGGER (1)  adds two breakpoints to the PRERR function, one */
  21. /*  just before it calls ExitToShell() for 'Quit' button, the other just before */
  22. /*  the function returns to caller for 'Resume' button. */
  23. /* #define THINKC_DEBUGGER (0)  eliminates the breakpoints */
  24.  
  25. #define ForceAbort (0)
  26. #define AllowResume (1)
  27.  
  28. /* error printing routine.  Message should be a null-terminated string */
  29. void                            PRERR(int AbortFlag, char* Message);
  30.  
  31. /* initialize the local memory buffer used by PRERR in emergency situations */
  32. /* for internal use only */
  33. void                            Eep_InitPRERR(void);
  34.  
  35. /* shut down the PRERR stuff.  for internal use only */
  36. void                            Eep_ShutdownPRERR(void);
  37.  
  38. /* debugging macros */
  39. #if DEBUG
  40.     /* EXECUTE(function) executes the function if debugging is enabled */
  41.     /* in a code block, it can be called like a function:  EXECUTE(parameter); */
  42.     /* in declarations, the semi-colon must be included as part of the parameter: */
  43.     /*  EXECUTE(parameter;) */
  44.     #define EXECUTE(function)  function
  45.     /* ERROR(condition,function) executes the function if condition is TRUE */
  46.     /* there is no reason to call this anywhere other than a code block */
  47.     #define ERROR(condition,function)  if (condition) EXECUTE(function)
  48. #else
  49.     /* these versions ignore their parameters and generate no code */
  50.     #define EXECUTE(function)
  51.     #define ERROR(condition,param)
  52. #endif
  53.  
  54. #endif
  55.