File: itrace.h

package info (click to toggle)
libiodbc2 2.50.3-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 860 kB
  • ctags: 1,245
  • sloc: ansic: 8,060; sh: 6,664; makefile: 81
file content (124 lines) | stat: -rw-r--r-- 2,676 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
 *  itrace.h
 *
 *  $Id: itrace.h,v 1.3 1999/01/18 13:56:57 source Exp $
 *
 *  Trace functions
 *
 *  The iODBC driver manager.
 *  
 *  Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public
 *  License along with this library; if not, write to the Free
 *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
#ifndef	_ITRACE_H
#define _ITRACE_H

#ifdef	DEBUG

#ifndef NO_TRACE
#define NO_TRACE
#endif

#endif

#define TRACE_TYPE_APP2DM	1
#define TRACE_TYPE_DM2DRV	2
#define TRACE_TYPE_DRV2DM	3

#define TRACE_TYPE_RETURN	4

extern HPROC _iodbcdm_gettrproc (void FAR * stm, int procid, int type);

#ifdef NO_TRACE
#define TRACE_CALL( stm, trace_on, procid, plist )
#else
#define TRACE_CALL( stm, trace_on, plist )\
	{\
		if( trace_on)\
		{\
			HPROC	hproc;\
\
			hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_APP2DM);\
\
			if( hproc )\
				hproc plist;\
		}\
	}
#endif

#ifdef NO_TRACE
#define TRACE_DM2DRV( stm, procid, plist )
#else
#define TRACE_DM2DRV( stm, procid, plist )\
	{\
		HPROC	hproc;\
\
		hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_DM2DRV);\
\
		if( hproc )\
			hproc plist;\
	}
#endif

#ifdef NO_TRACE
#define TRACE_DRV2DM( stm, procid, plist )
#else
#define TRACE_DRV2DM( stm, procid, plist ) \
	{\
		HPROC	hproc;\
\
		hproc = _iodbcdm_gettrproc( stm, procid, TRACE_TYPE_DRV2DM);\
\
		if( hproc )\
				hproc plist;\
	}
#endif

#ifdef NO_TRACE
#define TRACE_RETURN( stm, trace_on, ret )
#else
#define TRACE_RETURN( stm, trace_on, ret )\
	{\
		if( trace_on ) {\
			HPROC hproc;\
\
			hproc = _iodbcdm_gettrproc( stm, 0, TRACE_TYPE_RETURN);\
\
			if( hproc )\
				hproc( stm, ret );\
		}\
	}
#endif

#ifdef	NO_TRACE
#define CALL_DRIVER( hdbc, ret, proc, procid, plist )	{ ret = proc plist; }
#else
#define CALL_DRIVER( hdbc, ret, proc, procid, plist )\
	{\
		DBC_t FAR*	pdbc = (DBC_t FAR*)(hdbc);\
\
		if( pdbc->trace ) {\
			TRACE_DM2DRV( pdbc->tstm, procid, plist )\
			ret = proc plist;\
			TRACE_DRV2DM( pdbc->tstm, procid, plist )\
			TRACE_RETURN( pdbc->tstm, 1, ret )\
		}\
		else\
			ret = proc plist;\
	}
#endif

#endif