|
UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /* 00003 * This file is part of the LibreOffice project. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this 00007 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 00008 * 00009 * This file incorporates work covered by the following license notice: 00010 * 00011 * Licensed to the Apache Software Foundation (ASF) under one or more 00012 * contributor license agreements. See the NOTICE file distributed 00013 * with this work for additional information regarding copyright 00014 * ownership. The ASF licenses this file to you under the Apache 00015 * License, Version 2.0 (the "License"); you may not use this file 00016 * except in compliance with the License. You may obtain a copy of 00017 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 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 /* __cplusplus */ 00093 00094 /* ////////////////////////////////////////////////////////////////////////// 00095 Diagnostic support 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 For message delivery 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 /* the macro OSL_LOG_PREFIX is intended to be an office internal macro for now 00137 00138 it is deprecated and superseded by (C++ only) SAL_WHERE 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 /* __cplusplus */ 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 /* OSL_DEBUG_LEVEL */ 00178 00179 /* the macro OSL_THIS_FUNC is intended to be an office internal macro for now */ 00180 /* copied from boost/current_function.hpp to make it usable from C 00181 * sources as well 00182 * 00183 * Copyright (c) 2002 Peter Dimov and Multi Media Ltd. 00184 * 00185 * Distributed under the Boost Software License, Version 1.0. (See 00186 * accompanying file LICENSE_1_0.txt or copy at 00187 * http://www.boost.org/LICENSE_1_0.txt) */ 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 /* _OSL_DIAGNOSE_H_ */ 00203 00204 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1.7.3