00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _OSL_DIAGNOSE_H_
00022 #define _OSL_DIAGNOSE_H_
00023
00024 #include "sal/config.h"
00025
00026 #include "sal/detail/log.h"
00027 #include "sal/saldllapi.h"
00028 #include "sal/types.h"
00029
00086 #if !defined OSL_DEBUG_LEVEL
00087 #define OSL_DEBUG_LEVEL 0
00088 #endif
00089
00090 #ifdef __cplusplus
00091 extern "C" {
00092 #endif
00093
00094
00095
00096
00097
00098 SAL_DLLPUBLIC void SAL_CALL osl_breakDebug(void);
00099 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_assertFailedLine(const sal_Char* pszFileName, sal_Int32 nLine, const sal_Char* pszMessage);
00100 SAL_DLLPUBLIC void SAL_CALL osl_trace(const sal_Char* pszFormat, ...);
00101 SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_reportError(sal_uInt32 nType, const sal_Char* pszErrorMessage);
00102
00103
00104
00105
00106
00109 typedef void (SAL_CALL *pfunc_osl_printDebugMessage)( const sal_Char * pszMessage );
00110
00113 typedef void (SAL_CALL *pfunc_osl_printDetailedDebugMessage)( const sal_Char * pszFileName, sal_Int32 nLine, const sal_Char* pszMessage );
00114
00122 SAL_DLLPUBLIC pfunc_osl_printDebugMessage SAL_CALL osl_setDebugMessageFunc( pfunc_osl_printDebugMessage pNewFunc );
00123
00128 SAL_DLLPUBLIC pfunc_osl_printDetailedDebugMessage SAL_CALL osl_setDetailedDebugMessageFunc( pfunc_osl_printDetailedDebugMessage pNewFunc );
00129
00130 #ifdef __cplusplus
00131 }
00132 #endif
00133
00134 #define OSL_THIS_FILE __FILE__
00135
00136
00137
00138
00139
00140 #define OSL_LOG_PREFIX SAL_DETAIL_WHERE
00141
00142 #define OSL_DEBUG_ONLY(s) _OSL_DEBUG_ONLY(s)
00143
00144 #define OSL_TRACE(...) \
00145 SAL_DETAIL_INFO_IF_FORMAT(OSL_DEBUG_LEVEL > 0, "legacy.osl", __VA_ARGS__)
00146
00147 #if OSL_DEBUG_LEVEL > 0
00148 #define OSL_ASSERT(c) \
00149 SAL_DETAIL_WARN_IF_FORMAT(!(c), "legacy.osl", "OSL_ASSERT: %s", #c)
00150 #define OSL_ENSURE(c, m) SAL_DETAIL_WARN_IF_FORMAT(!(c), "legacy.osl", "%s", m)
00151 #define OSL_FAIL(m) SAL_DETAIL_WARN_IF_FORMAT(sal_True, "legacy.osl", "%s", m)
00152 #else
00153 #define OSL_ASSERT(c) ((void) 0)
00154 #define OSL_ENSURE(c, m) ((void) 0)
00155 #define OSL_FAIL(m) ((void) 0)
00156 #endif
00157
00158 #define OSL_VERIFY(c) do { if (!(c)) OSL_ASSERT(0); } while (0)
00159 #define OSL_PRECOND(c, m) OSL_ENSURE(c, m)
00160 #define OSL_POSTCOND(c, m) OSL_ENSURE(c, m)
00161
00162
00163 #ifdef __cplusplus
00164 #define _OSL_GLOBAL ::
00165 #else
00166 #define _OSL_GLOBAL
00167 #endif
00168
00169 #if OSL_DEBUG_LEVEL > 0
00170
00171 #define _OSL_DEBUG_ONLY(f) (f)
00172
00173 #else
00174
00175 #define _OSL_DEBUG_ONLY(f) ((void)0)
00176
00177 #endif
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188 #if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600))
00189 #define OSL_THIS_FUNC __PRETTY_FUNCTION__
00190 #elif defined(__DMC__) && (__DMC__ >= 0x810)
00191 #define OSL_THIS_FUNC __PRETTY_FUNCTION__
00192 #elif defined(__FUNCSIG__)
00193 #define OSL_THIS_FUNC __FUNCSIG__
00194 #elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500))
00195 #define OSL_THIS_FUNC __FUNCTION__
00196 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
00197 #define OSL_THIS_FUNC __func__
00198 #else
00199 #define OSL_THIS_FUNC ""
00200 #endif
00201
00202 #endif
00203
00204