zhuwei_debug.h

来自「systemc源码」· C头文件 代码 · 共 68 行

H
68
字号
/************************************************************************
 * file name:		zhuwei_debug.h 
 * description:		for debug use.
 *
 * modification history
 * --------------------
 * 2002-5, created by zhuwei <zw84611@sina.com>
 * 2003-7-1, zhuwei add COUT, for C++ use.
 */

/*
 * example:
 * [#define ZHUWEI_SINGLE_DEBUG
 * #undef ZHUWEI_DEBUG
 * #define ZHUWEI_DEBUG]
 * #include "zhuwei_debug.h"
 *
 * example:
 * COUT( << "flit_num: " << flit_num << endl);
 */
 
#ifndef _ZHUWEI_DEBUG_H_
#define _ZHUWEI_DEGUB_H_

#include "string.h"
#include "stdio.h"

#ifndef ZHUWEI_SINGLE_DEBUG
#undef ZHUWEI_DEBUG
#define ZHUWEI_DEBUG /* comment it to turn off the debug command */
#endif

#define SEPARATOR '\\'  /* dos, windows: '\\', unix like(unix, linux, vxworks): '/' */

#ifdef ZHUWEI_DEBUG

  #define PRINTF printf
  #define PRINT(a) fprintf(stderr,"->ZHUWEI_DEBUG(%s,%d):"##a,strrchr(__FILE__,SEPARATOR),__LINE__)
  #define PRINT2(a,b) fprintf(stderr,"->ZHUWEI_DEBUG(%s,%d):"##a,strrchr(__FILE__,SEPARATOR),__LINE__,b)
  #define PRINT3(a,b,c) fprintf(stderr,"->ZHUWEI_DEBUG(%s,%d):"##a,strrchr(__FILE__,SEPARATOR),__LINE__,b,c)
  
  /* logMsg() only used in VxWorks. */
  #define LOG logMsg
  #define LOG1(a) logMsg("->ZW(%s,%d):"##a,strrchr(__FILE__,SEPARATOR),__LINE__)
  #define LOG2(a,b) logMsg("->ZW(%s,%d):"##a,strrchr(__FILE__,SEPARATOR),__LINE__,b)
  #define LOG3(a,b,c) logMsg("->ZW(%s,%d):"##a,strrchr(__FILE__,SEPARATOR),__LINE__,b,c)

  /* used in C++ */
  #define COUT(a) cout a
  #define COUTL(a) cout << a << endl
  
#else

  #define PRINTF
  #define PRINT(a)
  #define PRINT2(a,b)
  #define PRINT3(a,b,c)
  #define LOG
  #define LOG1(a)
  #define LOG2(a,b)
  #define LOG3(a,b,c)
  #define COUT(a)
  #define COUTL(a)
  
#endif

#endif  /* _ZHUWEI_DEGUB_H_ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?