1 | /*-*-c++-*-*/
|
---|
2 | #ifndef __GDEBUG_H__
|
---|
3 | #define __GDEBUG_H__
|
---|
4 |
|
---|
5 | /*
|
---|
6 | ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
|
---|
7 | ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
|
---|
8 | ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
|
---|
9 | ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
|
---|
10 | ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
|
---|
11 | ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
---|
12 | ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
|
---|
13 | ** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
|
---|
14 | **
|
---|
15 | ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
|
---|
16 | ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
|
---|
17 | ** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
|
---|
18 | ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
|
---|
19 | ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
|
---|
20 | ** THE UNITED STATES.
|
---|
21 | **
|
---|
22 | ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
|
---|
23 | **
|
---|
24 | ** $Revision: 1.1 $
|
---|
25 | ** $Date: 2000-02-25 00:37:49 $
|
---|
26 | */
|
---|
27 |
|
---|
28 | #include <stdarg.h>
|
---|
29 |
|
---|
30 | #if defined(FX_DLL_ENABLE)
|
---|
31 | #define FX_DLL_DEFINITION
|
---|
32 |
|
---|
33 | #endif
|
---|
34 | #include <fxdll.h>
|
---|
35 |
|
---|
36 | #define GDBG_MAX_LEVELS 512
|
---|
37 |
|
---|
38 | #ifndef GETENV
|
---|
39 | #define GETENV(a) getenv(a)
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | // if debug info turned on then GDBG_INFO does something
|
---|
43 | #ifdef GDBG_INFO_ON
|
---|
44 |
|
---|
45 | #define GDBG_INFO gdbg_info
|
---|
46 | #define GDBG_INFO_MORE gdbg_info_more
|
---|
47 | #define GDBG_PRINTF gdbg_printf
|
---|
48 |
|
---|
49 | #define GDBG_ERROR_SET_CALLBACK gdbg_error_set_callback
|
---|
50 | #define GDBG_ERROR_CLEAR_CALLBACK gdbg_error_clear_callback
|
---|
51 |
|
---|
52 | #define GDBG_GET_DEBUGLEVEL gdbg_get_debuglevel
|
---|
53 | #define GDBG_SET_DEBUGLEVEL gdbg_set_debuglevel
|
---|
54 |
|
---|
55 | // otherwise GDBG_INFO does nothing
|
---|
56 | #else
|
---|
57 |
|
---|
58 | #if defined(__WATCOMC__) || defined(__WATCOM_CPLUSPLUS__)
|
---|
59 | /* Turn off the dead code warnings. Also changed the macro definitions
|
---|
60 | * to use an 'if' rather than the ternary operator because the
|
---|
61 | * type of the result sub-expressions must match.
|
---|
62 | *
|
---|
63 | * w111: Meaningless use of an expression
|
---|
64 | * w201: Unreachable code
|
---|
65 | */
|
---|
66 | #pragma disable_message (111, 201)
|
---|
67 | #endif /* defined(__WATCOMC__) || defined(__WATCOM_CPLUSPLUS__) */
|
---|
68 |
|
---|
69 | #define GDBG_INFO 0 && (unsigned long)
|
---|
70 | #define GDBG_INFO_MORE 0 && (unsigned long)
|
---|
71 | #define GDBG_PRINTF 0 && (unsigned long)
|
---|
72 |
|
---|
73 | #define GDBG_ERROR_SET_CALLBACK 0 && (unsigned long)
|
---|
74 | #define GDBG_ERROR_CLEAR_CALLBACK 0 && (unsigned long)
|
---|
75 |
|
---|
76 | #define GDBG_GET_DEBUGLEVEL(x) 0
|
---|
77 | #define GDBG_SET_DEBUGLEVEL(a,b)
|
---|
78 |
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | #define GDBG_INIT gdbg_init
|
---|
82 | #define GDBG_SHUTDOWN gdbg_shutdown
|
---|
83 | #define GDBG_ERROR gdbg_error
|
---|
84 | #define GDBG_GET_ERRORS gdbg_get_errors
|
---|
85 | #define GDBG_SET_FILE gdbg_set_file
|
---|
86 |
|
---|
87 | FX_ENTRY void FX_CALL gdbg_init(void);
|
---|
88 | FX_ENTRY void FX_CALL gdbg_parse(const char *env);
|
---|
89 | FX_ENTRY void FX_CALL gdbg_shutdown(void);
|
---|
90 | FX_ENTRY void FX_CALL gdbg_vprintf(const char *format, va_list);
|
---|
91 | FX_ENTRY void FX_CALL gdbg_printf(const char *format, ...);
|
---|
92 | FX_ENTRY int FX_CALL gdbg_info(const int level, const char *format, ...);
|
---|
93 | FX_ENTRY int FX_CALL gdbg_info_more(const int level, const char *format, ...);
|
---|
94 | FX_ENTRY void FX_CALL gdbg_error(const char *name, const char *format, ...);
|
---|
95 | FX_ENTRY int FX_CALL gdbg_get_errors(void);
|
---|
96 | FX_ENTRY int FX_CALL gdbg_set_file(const char *name);
|
---|
97 | FX_ENTRY int FX_CALL gdbg_get_debuglevel(const int level);
|
---|
98 | FX_ENTRY void FX_CALL gdbg_set_debuglevel(const int level, const int value);
|
---|
99 |
|
---|
100 | // these routines allow for a library (like Glide) to get called back
|
---|
101 | typedef void (*GDBGErrorProc)(const char* const procName,
|
---|
102 | const char* const format,
|
---|
103 | va_list args);
|
---|
104 | FX_ENTRY int FX_CALL gdbg_error_set_callback(GDBGErrorProc p);
|
---|
105 | FX_ENTRY void FX_CALL gdbg_error_clear_callback(GDBGErrorProc p);
|
---|
106 |
|
---|
107 | // these routines allow for some GUI code to get called once in a while
|
---|
108 | // so that it can keep the UI alive by reading the message queue
|
---|
109 | typedef void (*GDBGKeepAliveProc)(int adjust);
|
---|
110 | FX_ENTRY void FX_CALL gdbg_set_keepalive(GDBGKeepAliveProc p);
|
---|
111 |
|
---|
112 | #endif /* !__GDEBUG_H__ */
|
---|