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