File: trace_nt.h

package info (click to toggle)
mc 4.1.35-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 6,924 kB
  • ctags: 9,665
  • sloc: ansic: 84,273; tcl: 1,779; makefile: 1,266; sh: 864; perl: 262; awk: 148; sed: 93; csh: 1
file content (72 lines) | stat: -rw-r--r-- 2,690 bytes parent folder | download | duplicates (2)
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
/* trace_nt.h - Debugging routines

   Written by Juan Grigera<grigera@isis.unlp.edu.ar>

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program 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 General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
 */

/* ------------------------------------------------------------------------------------------ *
   TRACER FUNCTIONS
 * ------------------------------------------------------------------------------------------ */

#ifdef HAVE_TRACE
/************************/
/*    Debug version     */
/************************/

/* Macros
   ------ 
   	win32Trace(x)	  - Trace macro. Use double in parenthesis for x. Same args as printf.
	win32ASSERT(x)	  - assert macro, but will not abort program and output sent to trace routine.	
	win32APICALL(x)  - Use to enclose a Win32 system call that should return TRUE. 
	win32APICALL_HANDLE(h,api)  - Use to enclose a Win32 system call that should return a handle. 
*/
#define win32Trace(x)				if (__win32_tracing_enabled) 	_win32Trace x
#define win32ASSERT(x)				if (!(x))    _win32DebugAssertionFailed (#x, __LINE__, __FILE__)
#define win32APICALL(x) 			if (!(x))    _win32DebugFailedWin32APICall (#x, __LINE__, __FILE__)
#define win32APICALL_HANDLE(h,api)	h=api; if (h==INVALID_HANDLE_VALUE)    _win32DebugFailedWin32APICall (#h" = "#api, __LINE__, __FILE__)

/* Prototypes        */
void _win32Trace (const char *, ...);
void _win32DebugFailedWin32APICall (const char *name, int line, const char *file);
void _win32DebugAssertionFailed (const char *name, int line, const char *file);

void _win32SetTrace (int trace);
void _win32TraceOn (void);
void _win32TraceOff (void);

#define SetTrace 	_win32SetTrace
#define TraceOn 	_win32TraceOn
#define TraceOff	_win32TraceOff

/* Global variables  */
extern int __win32_tracing_enabled;  

#else
/************************/
/*  Non-debug version   */
/************************/

/* Wipe-out these macros */
#define win32Trace(x)		
#define win32ASSERT(x)		
#define win32APICALL(x) 			x
#define win32APICALL_HANDLE(h,api)	h=api;

/* Wipe-out these funcs */
#define SetTrace(x)
#define TraceOn()
#define TraceOff()
#endif