home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / compiler / aros / include / debug.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-07  |  2.4 KB  |  75 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     Debugging macros.
  4.  
  5.     This include file can be included several times !
  6. */
  7. #ifndef CLIB_AROS_PROTOS_H
  8. #   include <clib/aros_protos.h>
  9. #endif
  10.  
  11. #ifndef DEBUG
  12. #   define DEBUG 0
  13. #endif
  14.  
  15. /* Remove all macros. They get new values each time this file is
  16.     included */
  17. #undef D
  18. #undef ReturnVoid
  19. #undef ReturnPtr
  20. #undef ReturnStr
  21. #undef ReturnInt
  22. #undef ReturnXInt
  23. #undef ReturnFloat
  24. #undef ReturnSpecial
  25. #undef ReturnBool
  26.  
  27. #if DEBUG
  28. #   define D(x)     x
  29.  
  30.     /* return-macros. NOTE: I make a copy of the value in __aros_val, because
  31.        the return-value might have side effects (like return x++;). */
  32. #   define ReturnVoid(name)         { kprintf ("Exit " name "()\n"); return; }
  33. #   define ReturnPtr(name,type,val) { type __aros_val = (type)val; \
  34.                     kprintf ("Exit " name "=%08lx\n", \
  35.                     (ULONG)__aros_val); return __aros_val; }
  36. #   define ReturnStr(name,type,val) { type __aros_val = (type)val; \
  37.                     kprintf ("Exit " name "=\"%s\"\n", \
  38.                     __aros_val); return __aros_val; }
  39. #   define ReturnInt(name,type,val) { type __aros_val = (type)val; \
  40.                     kprintf ("Exit " name "=%ld\n", \
  41.                     (ULONG)__aros_val); return __aros_val; }
  42. #   define ReturnXInt(name,type,val) { type __aros_val = (type)val; \
  43.                     kprintf ("Exit " name "=%lx\n", \
  44.                     (ULONG)__aros_val); return __aros_val; }
  45. #   define ReturnFloat(name,type,val) { type __aros_val = (type)val; \
  46.                     kprintf ("Exit " name "=%g\n", \
  47.                     (ULONG)__aros_val); return __aros_val; }
  48. #   define ReturnSpecial(name,type,val,fmt) { type __aros_val = (type)val; \
  49.                     kprintf ("Exit " name "=" fmt "\n", \
  50.                     (ULONG)__aros_val); return __aros_val; }
  51. #   define ReturnBool(name,val)     { BOOL __aros_val = (val != 0); \
  52.                     kprintf ("Exit " name "=%s\n", \
  53.                     __aros_val ? "TRUE" : "FALSE"); \
  54.                     return __aros_val; }
  55. #else /* !DEBUG */
  56. #   define D(x)     /* eps */
  57.  
  58. #   define ReturnVoid(name)                 return
  59. #   define ReturnPtr(name,type,val)         return val
  60. #   define ReturnStr(name,type,val)         return val
  61. #   define ReturnInt(name,type,val)         return val
  62. #   define ReturnXInt(name,type,val)        return val
  63. #   define ReturnFloat(name,type,val)       return val
  64. #   define ReturnSpecial(name,type,val,fmt) return val
  65. #   define ReturnBool(name,val)             return val
  66. #endif /* DEBUG */
  67.  
  68. #ifndef AROS_DEBUG_H
  69. #define AROS_DEBUG_H
  70.  
  71. #define bug     kprintf
  72.  
  73.  
  74. #endif /* AROS_DEBUG_H */
  75.