1
/*------------------------------------------------------------------------------
2
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
4
* Distributable under the terms of either the Apache License (Version 2.0) or
5
* the GNU Lesser General Public License, as specified in the COPYING file.
6
------------------------------------------------------------------------------*/
10
//todo: this is a hack
11
#undef CND_PRECONDITION
14
To enable condition debugging uncomment _CND_DEBUG in CLConfig.h
17
#ifdef _CL__CND_DEBUG /* Don't include the debug code */
18
/* _CL__CND_DEBUG defined, include debug code */
20
#ifdef _CND_NODEBUGTEXT
21
#define CND_PRECONDITION(cond,usermessage) CND__EXITCONDITION(cond,__FILE__,__LINE__,CND_STR_PRECONDITION,NULL)
22
#define CND_CONDITION(cond,usermessage) CND__EXITCONDITION(cond,__FILE__,__LINE__,CND_STR_CONDITION,NULL)
23
#define CND_WARNING(cond,usermessage) CND__CONDITION(cond,__FILE__,__LINE__,CND_STR_WARNING,NULL)
24
#define CND_MESSAGE(cond,usermessage) CND__CONDITION(cond,__FILE__,__LINE__,CND_STR_MESSAGE,NULL)
25
#define CND_DEBUGMESSAGE(usermessage) CND__MESSAGE(__FILE__,__LINE__,CND_STR_DEBUGMESSAGE,NULL)
27
#define CND_PRECONDITION(cond,usermessage) CND__EXITCONDITION(cond,__FILE__,__LINE__,CND_STR_PRECONDITION,usermessage)
28
#define CND_CONDITION(cond,usermessage) CND__EXITCONDITION(cond,__FILE__,__LINE__,CND_STR_CONDITION,usermessage)
29
#define CND_WARNING(cond,usermessage) CND__CONDITION(cond,__FILE__,__LINE__,CND_STR_WARNING,usermessage)
30
#define CND_MESSAGE(cond,usermessage) CND__CONDITION(cond,__FILE__,__LINE__,CND_STR_MESSAGE,usermessage)
31
#define CND_DEBUGMESSAGE(usermessage) CND__MESSAGE(__FILE__,__LINE__,CND_STR_DEBUGMESSAGE,usermessage)
34
//if _CND_DEBUG_DONTIMPLEMENT_OUTDEBUG is defined, then you must implement
35
//this routine in the client application. The debug callback can then
36
//be better customised to the host application.
37
//Here is the default implementation:
38
void _Cnd_OutDebug( const char* FormattedMsg, const char* StrTitle, const char* File, int32_t Line, int32_t Title, const char* Mes2, int32_t fatal );
40
void CLUCENE_SHARED_EXPORT __cnd_FormatDebug( const char* File, int32_t Line, int32_t Title, const char* Mes2, int32_t fatal );
41
#define CND__EXIT(file,line,title,mes2) {__cnd_FormatDebug(file,line,title,mes2,1);}
42
#define CND__EXITCONDITION(cond,file,line,title,mes2) {if(!(cond)){__cnd_FormatDebug(file,line,title,mes2,1);}}
43
#define CND__CONDITION(cond,file,line,title,mes2) {if(!(cond)){__cnd_FormatDebug(file,line,title,mes2,0);}}
44
#define CND__MESSAGE(file,line,title,mes2) {__cnd_FormatDebug(file,line,title,mes2,0);}
46
#define CND_PRECONDITION(cond, usermessage)
47
#define CND_CONDITION(cond, usermessage)
48
#define CND_WARNING(cond,usermessage)
49
#define CND_MESSAGE(cond,usermessage)
50
#define CND_DEBUGMESSAGE(usermessage)
53
#ifndef CND_STR_DEFINES
54
#define CND_STR_DEFINES
55
#define CND_STR_PRECONDITION 1
56
#define CND_STR_CONDITION 2
57
#define CND_STR_WARNING 3
58
#define CND_STR_MESSAGE 4
59
#define CND_STR_DEBUGMESSAGE 5
60
#define CND_STR_EXIT 6
63
//cnd-debug exit command
64
#ifndef debugFatalExit
65
#define debugFatalExit(ret) exit(ret)