source: libcf/trunk/include/cf_debug.h@ 119

Last change on this file since 119 was 119, checked in by cheese, 11 years ago

#1 fix and arrange doxygen configuration file and doxygen comments

File size: 3.2 KB
RevLine 
[6]1/**
[119]2 * \file cf_debug.h
3 * \author myusgun <myusgun@gmail.com>
[26]4 *
[119]5 * \brief 디버그 유틸
[116]6 *
[119]7 * \remarks
[26]8 * 디버그 함수를 직접 호출하지 않고 정의된 매크로를 사용하면,
9 * Preprocessor에 _DEBUG가 정의되어 있는 경우에 만
10 * 디버그 코드가 동작하도록 할 수 있음 <br />
[66]11 * 디버그 메시지는 stdout 및 stderr 등의 파일 포인터 출력을 지원함
[34]12 *
[119]13 * \example debug.c
[6]14 */
15#ifndef __CF_DEBUG_H__
16#define __CF_DEBUG_H__
17
18#include "cf_base.h"
19
[16]20#include <stdio.h>
[66]21#include <stddef.h>
[16]22
[26]23/** Windows 함수 이름 매크로 재정의 */
[50]24#if defined(_WIN32) || defined(_WIN64)
[6]25# define __func__ __FUNCTION__
26#endif
27
28#ifdef _DEBUG
[25]29
[26]30/**
31 * 디버그 메시지를 지정된 파일 포인터로 출력
32 *
[119]33 & \param __fp 출력할 파일 포인터
34 * \param __fmt 포맷 스트링
35 * \param ... 가변 인자
[26]36 *
[119]37 * \see CF_Debug_Print
[26]38 */
[64]39# define CF_DEBUG_PRINT(__fp,__fmt,...) \
[16]40 CF_Debug_Print (__fp,__FILE__,__func__,__LINE__,__fmt,##__VA_ARGS__)
[25]41
[26]42/**
43 * 바이너리 데이터를 디버그 메시지와 함께 지정된 파일 포인터로 출력
44 *
[119]45 & \param __fp 출력할 파일 포인터
46 * \param __bin 바이너리 데이터
47 * \param __len 바이너리 길이
48 * \param __fmt 포맷 스트링
49 * \param ... 가변 인자
[26]50 *
[119]51 * \see CF_Debug_PrintBin
[26]52 */
[64]53# define CF_DEBUG_PRINT_BIN(__fp,__bin,__len,__fmt,...) \
[16]54 CF_Debug_PrintBin (__fp,__FILE__,__func__,__LINE__,__bin,__len,__fmt,##__VA_ARGS__)
[25]55
[26]56/**
[62]57 * 디버깅 모듈 초기화
58 *
[119]59 * \see CF_Debug_Initialize
[62]60 */
[64]61# define CF_DEBUG_INITIALIZE \
[62]62 CF_Debug_Initialize ()
63
64/**
65 * 디버깅 모듈 해제
66 *
[119]67 * \see CF_Debug_Finalize
[62]68 */
[64]69# define CF_DEBUG_FINALIZE \
[62]70 CF_Debug_Finalize ()
71
72/**
[51]73 * 함수에 진입
[26]74 *
[119]75 * \see CF_Debug_EnterFunction
[26]76 */
[64]77# define CF_DEBUG_BEGIN_FUNCTION \
[51]78 CF_Debug_EnterFunction (__FILE__,__func__,__LINE__)
[25]79
[26]80/**
[63]81 * 함수에서 리턴
[26]82 *
[119]83 * \see CF_Debug_LeaveFunction
[26]84 */
[64]85# define CF_DEBUG_END_FUNCTION \
[51]86 CF_Debug_LeaveFunction ()
[25]87
[63]88/**
89 * 콜스택 을 지정된 파일 포인터로 출력
90 *
[119]91 * \see CF_Debug_PrintCallStack
[63]92 */
[64]93# define CF_DEBUG_PRINT_CALLSTACK(__fp) \
[63]94 CF_Debug_PrintCallStack (__fp)
95
[6]96#else // #ifdef _DEBUG
[25]97# define CF_DEBUG_PRINT(__fp,__fmt,...)
98# define CF_DEBUG_PRINT_BIN(__fp,__bin,__len,__fmt,...)
[62]99# define CF_DEBUG_INITIALIZE
100# define CF_DEBUG_FINALIZE
[51]101# define CF_DEBUG_BEGIN_FUNCTION
102# define CF_DEBUG_END_FUNCTION
[63]103# define CF_DEBUG_PRINT_CALLSTACK(__fp)
[6]104#endif // #ifdef _DEBUG
105
106#ifdef __cplusplus
107extern "C" {
108#endif
109
110CF_EXPORT int
[16]111CF_Debug_Print (FILE * fp,
112 const char * file,
113 const char * func,
114 const int line,
115 const char * fmt, ...);
116
[26]117CF_EXPORT int
[16]118CF_Debug_PrintBin (FILE * fp,
119 const char * file,
120 const char * func,
121 const int line,
122 const unsigned char * bin,
[66]123 const size_t len,
[16]124 const char * fmt, ...);
125
126CF_EXPORT int
[62]127CF_Debug_Initialize (void);
128
129CF_EXPORT int
130CF_Debug_Finalize (void);
131
132CF_EXPORT int
[51]133CF_Debug_PrintCallStack (FILE * fp);
[6]134
135CF_EXPORT int
[51]136CF_Debug_EnterFunction (const char * file,
137 const char * func,
138 const int line);
[6]139
140CF_EXPORT int
[51]141CF_Debug_LeaveFunction (void);
[6]142
[10]143#ifdef __cplusplus
144}
145#endif
146
[6]147#endif // #ifndef __CF_DEBUG_H__
Note: See TracBrowser for help on using the repository browser.