UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /************************************************************************* 00003 * 00004 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 00005 * 00006 * Copyright 2000, 2010 Oracle and/or its affiliates. 00007 * 00008 * OpenOffice.org - a multi-platform office productivity suite 00009 * 00010 * This file is part of OpenOffice.org. 00011 * 00012 * OpenOffice.org is free software: you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 3 00014 * only, as published by the Free Software Foundation. 00015 * 00016 * OpenOffice.org is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License version 3 for more details 00020 * (a copy is included in the LICENSE file that accompanied this code). 00021 * 00022 * You should have received a copy of the GNU Lesser General Public License 00023 * version 3 along with OpenOffice.org. If not, see 00024 * <http://www.openoffice.org/license.html> 00025 * for a copy of the LGPLv3 License. 00026 * 00027 ************************************************************************/ 00028 00029 00030 #ifndef _OSL_DIAGNOSE_H_ 00031 #define _OSL_DIAGNOSE_H_ 00032 00033 #include "sal/config.h" 00034 00035 #include <sal/detail/log.h> 00036 #include <sal/types.h> 00037 00094 #ifdef __cplusplus 00095 extern "C" { 00096 #endif /* __cplusplus */ 00097 00098 /* ////////////////////////////////////////////////////////////////////////// 00099 Diagnostic support 00100 */ 00101 00102 SAL_DLLPUBLIC void SAL_CALL osl_breakDebug(void); 00103 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_assertFailedLine(const sal_Char* pszFileName, sal_Int32 nLine, const sal_Char* pszMessage); 00104 SAL_DLLPUBLIC void SAL_CALL osl_trace(const sal_Char* pszFormat, ...); 00105 SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_reportError(sal_uInt32 nType, const sal_Char* pszErrorMessage); 00106 00107 /* 00108 For message delivery 00109 */ 00110 00113 typedef void (SAL_CALL *pfunc_osl_printDebugMessage)( const sal_Char * pszMessage ); 00114 00117 typedef void (SAL_CALL *pfunc_osl_printDetailedDebugMessage)( const sal_Char * pszFileName, sal_Int32 nLine, const sal_Char* pszMessage ); 00118 00126 SAL_DLLPUBLIC pfunc_osl_printDebugMessage SAL_CALL osl_setDebugMessageFunc( pfunc_osl_printDebugMessage pNewFunc ); 00127 00132 SAL_DLLPUBLIC pfunc_osl_printDetailedDebugMessage SAL_CALL osl_setDetailedDebugMessageFunc( pfunc_osl_printDetailedDebugMessage pNewFunc ); 00133 00134 #ifdef __cplusplus 00135 } 00136 #endif 00137 00138 #define OSL_THIS_FILE __FILE__ 00139 00140 /* the macro OSL_LOG_PREFIX is intended to be an office internal macro for now 00141 00142 it is deprecated and superseded by (C++ only) SAL_WHERE 00143 */ 00144 #define OSL_LOG_PREFIX SAL_DETAIL_WHERE 00145 00146 #define OSL_DEBUG_ONLY(s) _OSL_DEBUG_ONLY(s) 00147 00148 #define OSL_TRACE(...) \ 00149 SAL_DETAIL_INFO_IF_FORMAT(OSL_DEBUG_LEVEL > 0, "legacy.osl", __VA_ARGS__) 00150 00151 #if OSL_DEBUG_LEVEL > 0 00152 #define OSL_ASSERT(c) \ 00153 SAL_DETAIL_WARN_IF_FORMAT(!(c), "legacy.osl", "OSL_ASSERT: %s", #c) 00154 #define OSL_ENSURE(c, m) SAL_DETAIL_WARN_IF_FORMAT(!(c), "legacy.osl", "%s", m) 00155 #define OSL_FAIL(m) SAL_DETAIL_WARN_IF_FORMAT(sal_True, "legacy.osl", "%s", m) 00156 #else 00157 #define OSL_ASSERT(c) ((void) 0) 00158 #define OSL_ENSURE(c, m) ((void) 0) 00159 #define OSL_FAIL(m) ((void) 0) 00160 #endif 00161 00162 #define OSL_VERIFY(c) do { if (!(c)) OSL_ASSERT(0); } while (0) 00163 #define OSL_PRECOND(c, m) OSL_ENSURE(c, m) 00164 #define OSL_POSTCOND(c, m) OSL_ENSURE(c, m) 00165 00166 00167 #ifdef __cplusplus 00168 #define _OSL_GLOBAL :: 00169 #else 00170 #define _OSL_GLOBAL 00171 #endif /* __cplusplus */ 00172 00173 #if OSL_DEBUG_LEVEL > 0 00174 00175 #define _OSL_DEBUG_ONLY(f) (f) 00176 00177 #else 00178 00179 #define _OSL_DEBUG_ONLY(f) ((void)0) 00180 00181 #endif /* OSL_DEBUG_LEVEL */ 00182 00183 /* the macro OSL_THIS_FUNC is intended to be an office internal macro for now */ 00184 /* copied from boost/current_function.hpp to make it usable from C 00185 * sources as well 00186 * 00187 * Copyright (c) 2002 Peter Dimov and Multi Media Ltd. 00188 * 00189 * Distributed under the Boost Software License, Version 1.0. (See 00190 * accompanying file LICENSE_1_0.txt or copy at 00191 * http://www.boost.org/LICENSE_1_0.txt) */ 00192 #if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) 00193 #define OSL_THIS_FUNC __PRETTY_FUNCTION__ 00194 #elif defined(__DMC__) && (__DMC__ >= 0x810) 00195 #define OSL_THIS_FUNC __PRETTY_FUNCTION__ 00196 #elif defined(__FUNCSIG__) 00197 #define OSL_THIS_FUNC __FUNCSIG__ 00198 #elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500)) 00199 #define OSL_THIS_FUNC __FUNCTION__ 00200 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) 00201 #define OSL_THIS_FUNC __func__ 00202 #else 00203 #define OSL_THIS_FUNC "" 00204 #endif 00205 00206 #endif /* _OSL_DIAGNOSE_H_ */ 00207 00208 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */