]> git.saurik.com Git - wxWidgets.git/blob - src/iodbc/itrace.h
fixes
[wxWidgets.git] / src / iodbc / itrace.h
1 #ifndef _ITRACE_H
2 # define _ITRACE_H
3
4 # ifdef DEBUG
5 # ifndef NO_TRACE
6 # define NO_TRACE
7 # endif
8 # endif
9
10 # define TRACE_TYPE_APP2DM 1
11 # define TRACE_TYPE_DM2DRV 2
12 # define TRACE_TYPE_DRV2DM 3
13
14 # define TRACE_TYPE_RETURN 4
15
16 extern HPROC _iodbcdm_gettrproc(void FAR* stm, int procid, int type);
17
18 # ifdef NO_TRACE
19 # define TRACE_CALL( stm, trace_on, procid, plist )
20 # else
21 # define TRACE_CALL( stm, trace_on, plist )\
22 {\
23 if( trace_on)\
24 {\
25 HPROC hproc;\
26 \
27 hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_APP2DM);\
28 \
29 if( hproc )\
30 hproc plist;\
31 }\
32 }
33 # endif
34
35 # ifdef NO_TRACE
36 # define TRACE_DM2DRV( stm, procid, plist )
37 # else
38 # define TRACE_DM2DRV( stm, procid, plist )\
39 {\
40 HPROC hproc;\
41 \
42 hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_DM2DRV);\
43 \
44 if( hproc )\
45 hproc plist;\
46 }
47 # endif
48
49 # ifdef NO_TRACE
50 # define TRACE_DRV2DM( stm, procid, plist )
51 # else
52 # define TRACE_DRV2DM( stm, procid, plist ) \
53 {\
54 HPROC hproc;\
55 \
56 hproc = _iodbcdm_gettrproc( stm, procid, TRACE_TYPE_DRV2DM);\
57 \
58 if( hproc )\
59 hproc plist;\
60 }
61 # endif
62
63 # ifdef NO_TRACE
64 # define TRACE_RETURN( stm, trace_on, ret )
65 # else
66 # define TRACE_RETURN( stm, trace_on, ret )\
67 {\
68 if( trace_on ) {\
69 HPROC hproc;\
70 \
71 hproc = _iodbcdm_gettrproc( stm, 0, TRACE_TYPE_RETURN);\
72 \
73 if( hproc )\
74 hproc( stm, ret );\
75 }\
76 }
77 # endif
78
79 # ifdef NO_TRACE
80 # define CALL_DRIVER( hdbc, ret, proc, procid, plist ) { ret = proc plist; }
81 # else
82 # define CALL_DRIVER( hdbc, ret, proc, procid, plist )\
83 {\
84 DBC_t FAR* pdbc = (DBC_t FAR*)(hdbc);\
85 \
86 if( pdbc->trace ) {\
87 TRACE_DM2DRV( pdbc->tstm, procid, plist )\
88 ret = proc plist;\
89 TRACE_DRV2DM( pdbc->tstm, procid, plist )\
90 TRACE_RETURN( pdbc->tstm, 1, ret )\
91 }\
92 else\
93 ret = proc plist;\
94 }
95 # endif
96
97 #endif