📄 debug.h
字号:
//-------------------------------------------------------------------------/*Copyright (C) 1996, 2003 - 3D Realms EntertainmentThis file is NOT part of Duke Nukem 3D version 1.5 - Atomic EditionHowever, it is either an older version of a file that is, or issome test code written during the development of Duke Nukem 3D.This file is provided purely for educational interest.Duke Nukem 3D is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of 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 ofMERCHANTABILITY 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 Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms*///-------------------------------------------------------------------------#ifndef _debug_public#define _debug_public#ifdef __cplusplusextern "C" {#endif// DEBUG//// DEBUG works in two different modes, level and masked.//// To set the current DEBUG mode call DBG_SetDebugMode and to get the current// mode call DBG_GetDebugMode.//// In level mode all DEBUG messages with a debug level equal to or less than// the current debug level (obtained by DBG_GetDebugLevel) are outputted,// all others are ignored. You can set the debug level with DBG_SetDebugLevel//// In masked mode DEBUG messages are filtered according to a debug mask.// this debug mask is initialized when DEBUG is started to filter out all// DEBUG messages. To enable a certain DEBUG level call// DBG_EnableDebugLevel( int32 level ) and to disable a certain level call// DBG_DisableDebugLevel( int32 level ). The entire filter can be cleared with// DBG_DisableAllDebugLevels( int32 level ).//// The output of DEBUG messages are controlled by the function// DBG_SetDebugOutputMode, the current output mode can be obtained by// DBG_GetDebugOutputMode.//// The output functions supported by DEBUG natively is through printf and// to a file. Two other output modes have been left unimplemented,// dbgout_user1 and dbgout_user2. Output functions can be registered for// these modes using the function DBG_RegisterOutputFunction which takes// the mode you want to customize as well as three function pointers://// startup - a void function which starts up the output method// print - a function which takes a char * which actually does the printing// shutdown - a void function which shutsdown the output method//#define DEBUG 1typedef enum { debug_normal = 5, debug_max = 20 } debuglevel_t;typedef enum { dbgmode_level, dbgmode_masked } debugmode_t;typedef enum { dbgout_screen, dbgout_file, dbgout_user1, dbgout_user2, dbgout_endtype } debugoutput_t;void DBG_DebugString( int32 level, char *msg, ... );void DBG_DbgString( char *msg, ... );#if ( DEBUG == 1 ) #define Debug DBG_DebugString #define Dbg DBG_DbgString#else #define Debug if (1) {} else DBG_DebugString #define Dbg if (1) {} else DBG_DbgString#endifvoid DBG_SetDebugLevel( int32 level );int32 DBG_GetDebugLevel( void );void DBG_EnableDebugLevel( int32 level );void DBG_DisableDebugLevel( int32 level );void DBG_DisableAllDebugLevels( void );void DBG_SetDebugMode( int32 mode );int32 DBG_GetDebugMode( void );void DBG_SetDebugOutputMode( int32 mode );int32 DBG_GetDebugOutputMode( void );void DBG_Shutdown( void );void DBG_Startup( int32 mode, int32 level, int32 output );void DBG_RegisterOutputFunction ( int32 outmode, void (*startup) (void), void (*print) (char *), void (*shutdown) (void) );#ifdef __cplusplus};#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -