]> git.saurik.com Git - wxWidgets.git/blob - src/iodbc/itrace.h
Fixed compile errors, warnings and other DSMs, and improved comments.
[wxWidgets.git] / src / iodbc / itrace.h
1 /*
2 * itrace.h
3 *
4 * $Id$
5 *
6 * Trace functions
7 *
8 * The iODBC driver manager.
9 *
10 * Copyright (C) 1995 by Ke Jin <kejin@empress.com>
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
21 *
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26 #ifndef _ITRACE_H
27 #define _ITRACE_H
28
29 #ifdef DEBUG
30
31 #ifndef NO_TRACE
32 #define NO_TRACE
33 #endif
34
35 #endif
36
37 #define TRACE_TYPE_APP2DM 1
38 #define TRACE_TYPE_DM2DRV 2
39 #define TRACE_TYPE_DRV2DM 3
40
41 #define TRACE_TYPE_RETURN 4
42
43 extern HPROC _iodbcdm_gettrproc (void FAR * stm, int procid, int type);
44
45 #ifdef NO_TRACE
46 #define TRACE_CALL( stm, trace_on, procid, plist )
47 #else
48 #define TRACE_CALL( stm, trace_on, plist )\
49 {\
50 if( trace_on)\
51 {\
52 HPROC hproc;\
53 \
54 hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_APP2DM);\
55 \
56 if( hproc )\
57 hproc plist;\
58 }\
59 }
60 #endif
61
62 #ifdef NO_TRACE
63 #define TRACE_DM2DRV( stm, procid, plist )
64 #else
65 #define TRACE_DM2DRV( stm, procid, plist )\
66 {\
67 HPROC hproc;\
68 \
69 hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_DM2DRV);\
70 \
71 if( hproc )\
72 hproc plist;\
73 }
74 #endif
75
76 #ifdef NO_TRACE
77 #define TRACE_DRV2DM( stm, procid, plist )
78 #else
79 #define TRACE_DRV2DM( stm, procid, plist ) \
80 {\
81 HPROC hproc;\
82 \
83 hproc = _iodbcdm_gettrproc( stm, procid, TRACE_TYPE_DRV2DM);\
84 \
85 if( hproc )\
86 hproc plist;\
87 }
88 #endif
89
90 #ifdef NO_TRACE
91 #define TRACE_RETURN( stm, trace_on, ret )
92 #else
93 #define TRACE_RETURN( stm, trace_on, ret )\
94 {\
95 if( trace_on ) {\
96 HPROC hproc;\
97 \
98 hproc = _iodbcdm_gettrproc( stm, 0, TRACE_TYPE_RETURN);\
99 \
100 if( hproc )\
101 hproc( stm, ret );\
102 }\
103 }
104 #endif
105
106 #ifdef NO_TRACE
107 #define CALL_DRIVER( hdbc, ret, proc, procid, plist ) { ret = proc plist; }
108 #else
109 #define CALL_DRIVER( hdbc, ret, proc, procid, plist )\
110 {\
111 DBC_t FAR* pdbc = (DBC_t FAR*)(hdbc);\
112 \
113 if( pdbc->trace ) {\
114 TRACE_DM2DRV( pdbc->tstm, procid, plist )\
115 ret = proc plist;\
116 TRACE_DRV2DM( pdbc->tstm, procid, plist )\
117 TRACE_RETURN( pdbc->tstm, 1, ret )\
118 }\
119 else\
120 ret = proc plist;\
121 }
122 #endif
123
124 #endif