1 /* trace_nt.h - Debugging routines
3 Written by Juan Grigera<grigera@isis.unlp.edu.ar>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 /* ------------------------------------------------------------------------------------------ *
22 * ------------------------------------------------------------------------------------------ */
25 /************************/
27 /************************/
31 win32Trace(x) - Trace macro. Use double in parenthesis for x. Same args as printf.
32 win32ASSERT(x) - assert macro, but will not abort program and output sent to trace routine.
33 win32APICALL(x) - Use to enclose a Win32 system call that should return TRUE.
34 win32APICALL_HANDLE(h,api) - Use to enclose a Win32 system call that should return a handle.
36 #define win32Trace(x) if (__win32_tracing_enabled) _win32Trace x
37 #define win32ASSERT(x) if (!(x)) _win32DebugAssertionFailed (#x, __LINE__, __FILE__)
38 #define win32APICALL(x) if (!(x)) _win32DebugFailedWin32APICall (#x, __LINE__, __FILE__)
39 #define win32APICALL_HANDLE(h,api) h=api; if (h==INVALID_HANDLE_VALUE) _win32DebugFailedWin32APICall (#h" = "#api, __LINE__, __FILE__)
42 void _win32Trace (const char *, ...);
43 void _win32DebugFailedWin32APICall (const char *name
, int line
, const char *file
);
44 void _win32DebugAssertionFailed (const char *name
, int line
, const char *file
);
46 void _win32SetTrace (int trace
);
47 void _win32TraceOn (void);
48 void _win32TraceOff (void);
50 #define SetTrace _win32SetTrace
51 #define TraceOn _win32TraceOn
52 #define TraceOff _win32TraceOff
54 /* Global variables */
55 extern int __win32_tracing_enabled
;
58 /************************/
59 /* Non-debug version */
60 /************************/
62 /* Wipe-out these macros */
64 #define win32ASSERT(x)
65 #define win32APICALL(x) x
66 #define win32APICALL_HANDLE(h,api) h=api;
68 /* Wipe-out these funcs */