delint..
[AROS.git] / test / oop2 / debug.h
blob6ecdcb9eb9daf63fd4126ba0e6968a1cd9068636
1 /*
2 Copyright © 1995-96, The AROS Development Team. All rights reserved.
3 Debugging macros.
5 This include file can be included several times !
6 */
8 #ifndef TYPES_H
9 # include "types.h"
10 #endif
11 #include <stdio.h>
13 #ifndef DEBUG
14 # define DEBUG 0
15 #endif
17 /* Remove all macros. They get new values each time this file is
18 included */
19 #undef D
20 #undef DB2
21 #undef ReturnVoid
22 #undef ReturnPtr
23 #undef ReturnStr
24 #undef ReturnInt
25 #undef ReturnXInt
26 #undef ReturnFloat
27 #undef ReturnSpecial
28 #undef ReturnBool
31 #if DEBUG
32 # define D(x) x
34 # if DEBUG > 1
35 # define DB2(x) x
36 # else
37 # define DB2(x) /* eps */
38 # endif
42 /* return-macros. NOTE: I make a copy of the value in __aros_val, because
43 the return-value might have side effects (like return x++;). */
44 # define ReturnVoid(name) { printf ("Exit " name "()\n"); return; }
45 # define ReturnPtr(name,type,val) { type __aros_val = (type)val; \
46 printf ("Exit " name "=%08lx\n", \
47 (ULONG)__aros_val); return __aros_val; }
48 # define ReturnStr(name,type,val) { type __aros_val = (type)val; \
49 printf ("Exit " name "=\"%s\"\n", \
50 __aros_val); return __aros_val; }
51 # define ReturnInt(name,type,val) { type __aros_val = (type)val; \
52 printf ("Exit " name "=%ld\n", \
53 (ULONG)__aros_val); return __aros_val; }
54 # define ReturnXInt(name,type,val) { type __aros_val = (type)val; \
55 printf ("Exit " name "=%lx\n", \
56 (ULONG)__aros_val); return __aros_val; }
57 # define ReturnFloat(name,type,val) { type __aros_val = (type)val; \
58 printf ("Exit " name "=%g\n", \
59 (ULONG)__aros_val); return __aros_val; }
60 # define ReturnSpecial(name,type,val,fmt) { type __aros_val = (type)val; \
61 printf ("Exit " name "=" fmt "\n", \
62 (ULONG)__aros_val); return __aros_val; }
63 # define ReturnBool(name,val) { BOOL __aros_val = (val != 0); \
64 printf ("Exit " name "=%s\n", \
65 __aros_val ? "TRUE" : "FALSE"); \
66 return __aros_val; }
67 #else /* !DEBUG */
68 # define D(x) /* eps */
69 # define DB2(x) /* eps */
71 # define ReturnVoid(name) return
72 # define ReturnPtr(name,type,val) return val
73 # define ReturnStr(name,type,val) return val
74 # define ReturnInt(name,type,val) return val
75 # define ReturnXInt(name,type,val) return val
76 # define ReturnFloat(name,type,val) return val
77 # define ReturnSpecial(name,type,val,fmt) return val
78 # define ReturnBool(name,val) return val
79 #endif /* DEBUG */
81 #ifndef AROS_DEBUG_H
82 #define AROS_DEBUG_H
84 #define bug printf
86 #endif /* AROS_DEBUG_H */