File: gdebug.h

package info (click to toggle)
glide 2002.04.10ds1-21
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 59,668 kB
  • sloc: ansic: 290,122; asm: 23,305; sh: 8,090; pascal: 3,854; makefile: 1,258; perl: 73
file content (138 lines) | stat: -rw-r--r-- 4,594 bytes parent folder | download | duplicates (8)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*-*-c++-*-*/
#ifndef __GDEBUG_H__
#define __GDEBUG_H__

/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
** 
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.  
** 
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
** $Revision: 1.2 $
** $Date: 2000/10/03 18:28:36 $
*/

#include <stdarg.h>

#if defined(FX_DLL_ENABLE)
#define FX_DLL_DEFINITION

#endif
#include <fxdll.h>

#define GDBG_MAX_LEVELS 512

#ifndef GETENV
#define GETENV(a) getenv(a)
#endif

// if debug info turned on then GDBG_INFO does something
#ifdef GDBG_INFO_ON

// Standard C provides no clean way to do this, but the GNU C tools do..
#ifdef __GNUC__

#define GDBG_INFO(level, format, args...)	\
    gdbg_info(level, format , ## args)
#define GDBG_INFO_MORE(level, format, args...)	\
    gdbg_info_more(level, format , ## args)
#define GDBG_PRINTF(format, args...)		\
    gdbg_printf(format , ## args)

#else

#define GDBG_INFO gdbg_info
#define GDBG_INFO_MORE gdbg_info_more
#define GDBG_PRINTF gdbg_printf

#endif

#define GDBG_ERROR_SET_CALLBACK   gdbg_error_set_callback
#define GDBG_ERROR_CLEAR_CALLBACK gdbg_error_clear_callback

#define GDBG_GET_DEBUGLEVEL	gdbg_get_debuglevel
#define GDBG_SET_DEBUGLEVEL	gdbg_set_debuglevel

// otherwise GDBG_INFO does nothing
#else

#if defined(__WATCOMC__) || defined(__WATCOM_CPLUSPLUS__)
/* Turn off the dead code warnings. Also changed the macro definitions
 * to use an 'if' rather than the ternary operator because the
 * type of the result sub-expressions must match.
 *
 * w111: Meaningless use of an expression
 * w201: Unreachable code
 */
#pragma disable_message (111, 201)
#endif /* defined(__WATCOMC__) || defined(__WATCOM_CPLUSPLUS__) */

// Standard C provides no clean way to do this, but the GNU C tools do..
#ifdef __GNUC__

#define GDBG_INFO(level, format, args...)
#define GDBG_INFO_MORE(level, format, args...)
#define GDBG_PRINTF(format, args...)

#else

#define GDBG_INFO      0 && (unsigned long)
#define GDBG_INFO_MORE 0 && (unsigned long)
#define GDBG_PRINTF    0 && (unsigned long)

#define GDBG_ERROR_SET_CALLBACK   0 && (unsigned long)
#define GDBG_ERROR_CLEAR_CALLBACK 0 && (unsigned long)

#endif

#define GDBG_GET_DEBUGLEVEL(x) 0
#define GDBG_SET_DEBUGLEVEL(a,b)


#endif

#define GDBG_INIT		gdbg_init
#define GDBG_SHUTDOWN		gdbg_shutdown
#define GDBG_ERROR		gdbg_error
#define GDBG_GET_ERRORS		gdbg_get_errors
#define GDBG_SET_FILE		gdbg_set_file

FX_ENTRY void	FX_CALL gdbg_init(void);
FX_ENTRY void	FX_CALL gdbg_parse(const char *env);
FX_ENTRY void	FX_CALL gdbg_shutdown(void);
FX_ENTRY void	FX_CALL gdbg_vprintf(const char *format, va_list);
FX_ENTRY void	FX_CALL gdbg_printf(const char *format, ...);
FX_ENTRY int	FX_CALL gdbg_info(const int level, const char *format, ...);
FX_ENTRY int	FX_CALL gdbg_info_more(const int level, const char *format, ...);
FX_ENTRY void	FX_CALL gdbg_error(const char *name, const char *format, ...);
FX_ENTRY int	FX_CALL gdbg_get_errors(void);
FX_ENTRY int	FX_CALL gdbg_set_file(const char *name);
FX_ENTRY int	FX_CALL gdbg_get_debuglevel(const int level);
FX_ENTRY void	FX_CALL gdbg_set_debuglevel(const int level, const int value);

// these routines allow for a library (like Glide) to get called back
typedef void (*GDBGErrorProc)(const char* const procName,
                              const char* const format,
                              va_list     args);
FX_ENTRY int FX_CALL gdbg_error_set_callback(GDBGErrorProc p);
FX_ENTRY void FX_CALL gdbg_error_clear_callback(GDBGErrorProc p);

// these routines allow for some GUI code to get called once in a while
// so that it can keep the UI alive by reading the message queue
typedef void (*GDBGKeepAliveProc)(int adjust);
FX_ENTRY void FX_CALL gdbg_set_keepalive(GDBGKeepAliveProc p);

#endif /* !__GDEBUG_H__ */