debug.h
来自「对内存的分配、释放和使用进行检查」· C头文件 代码 · 共 109 行
H
109 行
/* * (c) Copyright 1990 Conor P. Cahill (uunet!virtech!cpcahil). * You may copy, distribute, and use this software as long as this * copyright statement is not removed. *//************************************************************************//* *//* this include sets up some macro functions which can be used while *//* debugging the program, and then left in the code, but turned of by *//* just not defining "DEBUG". This way your production version of *//* the program will not be filled with bunches of debugging junk *//* *//************************************************************************//* * $Id: debug.h,v 1.2 90/05/11 00:13:08 cpcahil Exp $ */#ifdef DEBUG#if DEBUG == 1 /* if default level */#undef DEBUG#define DEBUG 100 /* use level 100 */#endif#include <stdio.h>#define DEBUG0(val,str)\ {\ if( DEBUG > val ) \ fprintf(stderr,"%s(%d): %s\n",\ __FILE__,__LINE__,str);\ }#define DEBUG1(val,str,a1)\ {\ char _debugbuf[100];\ if( DEBUG > val )\ {\ sprintf(_debugbuf,str,a1);\ fprintf(stderr,"%s(%d): %s\n",\ __FILE__,__LINE__,_debugbuf);\ }\ }#define DEBUG2(val,str,a1,a2)\ {\ char _debugbuf[100];\ if( DEBUG > val )\ {\ sprintf(_debugbuf,str,a1,a2);\ fprintf(stderr,"%s(%d): %s\n",\ __FILE__,__LINE__,_debugbuf);\ }\ }#define DEBUG3(val,str,a1,a2,a3)\ {\ char _debugbuf[100];\ if( DEBUG > val )\ {\ sprintf(_debugbuf,str,a1,a2,a3);\ fprintf(stderr,"%s(%d): %s\n",\ __FILE__,__LINE__,_debugbuf);\ }\ }#define DEBUG4(val,str,a1,a2,a3,a4)\ {\ char _debugbuf[100];\ if( DEBUG > val )\ {\ sprintf(_debugbuf,str,a1,a2,a3,a4);\ fprintf(stderr,"%s(%d): %s\n",\ __FILE__,__LINE__,_debugbuf);\ }\ }#define DEBUG5(val,str,a1,a2,a3,a4,a5)\ {\ char _debugbuf[100];\ if( DEBUG > val )\ {\ sprintf(_debugbuf,str,a1,a2,a3,a4,a5);\ fprintf(stderr,"%s(%d): %s\n",\ __FILE__,__LINE__,_debugbuf);\ }\ }#else#define DEBUG0(val,s)#define DEBUG1(val,s,a1)#define DEBUG2(val,s,a1,a2)#define DEBUG3(val,s,a1,a2,a3)#define DEBUG4(val,s,a1,a2,a3,a4)#define DEBUG5(val,s,a1,a2,a3,a4,a5)#endif /* DEBUG *//* * $Log: debug.h,v $ * Revision 1.2 90/05/11 00:13:08 cpcahil * added copyright statment * * Revision 1.1 90/02/23 07:09:01 cpcahil * Initial revision * */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?