📄 debug.h
字号:
/**************************************************************************
* Name : debug.h
* Author : BCB
* Created : 10/07/2003
*
* Copyright : 2003 by Imagination Technologies Limited. All rights reserved.
* : No part of this software, either material or conceptual
* : may be copied or distributed, transmitted, transcribed,
* : stored in a retrieval system or translated into any
* : human or computer language in any form by any means,
* : electronic, mechanical, manual or other-wise, or
* : disclosed to third parties without the express written
* : permission of Imagination Technologies Limited, Unit 8, HomePark
* : Industrial Estate, King's Langley, Hertfordshire,
* : WD4 8LZ, U.K.
*
* Platform : ANSI
*
* $Date: 2004/10/08 18:48:51 $ $Revision: 1.5 $
* $Log: debug.h $
**************************************************************************/
#ifndef _DEBUG_
#define _DEBUG_
#if defined (__cplusplus)
extern "C" {
#endif
/*
* Interface to debug macros (in DEBUG builds):
*
* ASSERT:
*
* example: ASSERT (x1 == x2);
*
* If the statement passed is true, nothing happens. If false,
* the following is printed to stderr:
*
* Assertion (x1 == x2) failed! File xxx.c, Line n.
* Continue or Abort [c/a]?
*
* If A is pressed, abort() is called; if C is pressed the function returns.
*
* DPF:
*
* example: DPF ((DBG_MESSAGE, "Rectangle: %d, %d, %d, %d", x1, y1, x2, y2));
*
* If MESSAGE level tracing is enabled for the module in which DPF is called,
*
* Rectangle: n1, n2, n3, n4
*
* The 2 sets of brackets are mandatory I'm afraid.
*
* DPFOO:
* Is a "once only" version of DPF so that the message will only be displayed
* a single time.
*
* example: DPFOO ((DBG_MESSAGE, "Rectangle: %d, %d, %d, %d", x1, y1, x2, y2));
*
*
*
* DPFDEV:
*
* Is a "developer" version of DPF so that the message will only be displayed
* in level FATAL or ERROR for developers.
*
* example: DPFDVE ((DBG_MESSAGE, "Rectangle: %d, %d, %d, %d", x1, y1, x2, y2));
*
*/
/*
* These are privately used by DEBUG.C - don't use them, use the DBG_ defines.
*/
#define DBGPRIV_FATAL 0
#define DBGPRIV_ERROR 1
#define DBGPRIV_WARNING 2
#define DBGPRIV_MESSAGE 3
#define DBGPRIV_VERBOSE 4
#define DBG_FATAL MODULE_ID,DBGPRIV_FATAL,__FILE__, __LINE__
#define DBG_ERROR MODULE_ID,DBGPRIV_ERROR,__FILE__, __LINE__
#define DBG_WARNING MODULE_ID,DBGPRIV_WARNING,__FILE__, __LINE__
#define DBG_MESSAGE MODULE_ID,DBGPRIV_MESSAGE,__FILE__, __LINE__
#define DBG_VERBOSE MODULE_ID,DBGPRIV_VERBOSE,__FILE__, __LINE__
/*
* For the times when MODULE_ID hasn't been defined (by accident)
* or has been defined too late ...
*/
#ifndef MODULE_ID
#define MODULE_ID MODID_DEFAULT
/* #pragma message ("File " __FILE__ ": MODULE_ID not #define'd (above debug.h) - Using default ID")*/
#endif
#if DEBUG
#if !defined( ASSERT )
/* debug version - display all messages */
#define ASSERT(x) { static IMG_INT32 ask = 1;\
if(!(x)&& ask) \
DbgAssert (#x, __FILE__, __LINE__, &ask);\
}
#endif
#define DPF(x) pvrdprintf x
#define DPFOO(x) if(1){static GLubyte printed = 0; if(!printed){dprintf x; printed = 1;}}
#define DPFDEV(x) pvrdprintf x
#define DPFF(x) pvrdtprintf x // did this for UITRON build
#define DPFTIME(x) pvrdtprintf x
IMG_VOID pvrdtprintf (IMG_CHAR *pszFormat, ...);
IMG_VOID pvrdprintf (IMG_INT32 i32ModuleID, IMG_INT32 i32DebugLevel, IMG_CHAR* pszFileName,
IMG_INT32 i32Line, IMG_CHAR *pszFormat, ...);
IMG_VOID DbgAssert (IMG_CHAR *pszAssertText, IMG_CHAR *pszFile, IMG_INT32 i32Line, IMG_INT32 *pi32Ask);
IMG_VOID DebugInit (IMG_UINT32 ui32Instance);
IMG_VOID DebugDeinit (IMG_VOID);
#elif TIMING
/* timing version - only display DPFTIME(()) */
#if !defined(UNDER_CE)
#if !defined( ASSERT )
#define ASSERT(x)
#endif
#endif
#define DPF(x)
#define DPFOO(x)
#define DPFDEV(x)
#define DPFTIME(x) pvrdtprintf x
#define DPFF(x)
IMG_VOID pvrdtprintf (IMG_CHAR *pszFormat, ...);
IMG_VOID DebugInit (IMG_UINT32 ui32Instance);
IMG_VOID DebugDeinit (IMG_VOID);
#elif METRIC
/* metric version - only display DPFF(()) */
#define ASSERT(x)
#define DPF(x)
#define DPFOO(x)
#define DPFDEV(x)
#define DPFTIME(x) pvrdtprintf x
#define DPFF(x) pvrdprintff x
IMG_VOID pvrdtprintf (IMG_CHAR *pszFormat, ...);
IMG_VOID DebugInit (IMG_UINT32 ui32Instance);
IMG_VOID DebugDeinit (IMG_VOID);
#else
/* release version - all stripped out */
#if !defined( ASSERT )
#define ASSERT(x)
#endif
#define DPF(x)
#define DPFOO(x)
#define DPFDEV(x)
#define DPFTIME(x)
#define DPFF(x)
#define DebugInit(x)
#define DebugDeinit()
#endif
#if defined(__cplusplus)
}
#endif
#endif /* _DEBUG_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -