102 lines
3.6 KiB
C++
102 lines
3.6 KiB
C++
/*-*-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$
|
|
** $Date$
|
|
*/
|
|
|
|
#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
|
|
|
|
#define GDBG_INFO(level, format, ...) gdbg_info(level, format, __VA_ARGS__)
|
|
#define GDBG_INFO_MORE(level, format, ...) gdbg_info_more(level, format, __VA_AR
|
|
#define GDBG_PRINTF(format, ...) gdbg_printf(format, __VA_ARGS__)
|
|
|
|
#define GDBG_ERROR_SET_CALLBACK(p) gdbg_error_set_callback(p)
|
|
#define GDBG_ERROR_CLEAR_CALLBACK(p) gdbg_error_clear_callback(p)
|
|
|
|
#define GDBG_GET_DEBUGLEVEL gdbg_get_debuglevel
|
|
#define GDBG_SET_DEBUGLEVEL gdbg_set_debuglevel
|
|
|
|
// otherwise GDBG_INFO does nothing
|
|
#else
|
|
|
|
#define GDBG_INFO(level, format, ...)
|
|
#define GDBG_INFO_MORE(level, format, ...)
|
|
#define GDBG_PRINTF(format, ...)
|
|
|
|
#define GDBG_ERROR_SET_CALLBACK(p)
|
|
#define GDBG_ERROR_CLEAR_CALLBACK(p)
|
|
|
|
#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__ */
|