My Project
UDK 3.2.7 C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
diagnose.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org. If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 
29 
30 #ifndef _OSL_DIAGNOSE_H_
31 #define _OSL_DIAGNOSE_H_
32 
33 #include "sal/config.h"
34 
35 #include <sal/detail/log.h>
36 #include <sal/types.h>
37 
94 #ifdef __cplusplus
95 extern "C" {
96 #endif /* __cplusplus */
97 
98 /* //////////////////////////////////////////////////////////////////////////
99  Diagnostic support
100 */
101 
102 SAL_DLLPUBLIC void SAL_CALL osl_breakDebug(void);
103 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_assertFailedLine(const sal_Char* pszFileName, sal_Int32 nLine, const sal_Char* pszMessage);
104 SAL_DLLPUBLIC void SAL_CALL osl_trace(const sal_Char* pszFormat, ...);
105 SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_reportError(sal_uInt32 nType, const sal_Char* pszErrorMessage);
106 
107 /*
108  For message delivery
109 */
110 
113 typedef void (SAL_CALL *pfunc_osl_printDebugMessage)( const sal_Char * pszMessage );
114 
117 typedef void (SAL_CALL *pfunc_osl_printDetailedDebugMessage)( const sal_Char * pszFileName, sal_Int32 nLine, const sal_Char* pszMessage );
118 
127 
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
138 #define OSL_THIS_FILE __FILE__
139 
140 /* the macro OSL_LOG_PREFIX is intended to be an office internal macro for now
141 
142  it is deprecated and superseded by (C++ only) SAL_WHERE
143 */
144 #define OSL_LOG_PREFIX SAL_DETAIL_WHERE
145 
146 #define OSL_DEBUG_ONLY(s) _OSL_DEBUG_ONLY(s)
147 
148 #define OSL_TRACE(...) \
149  SAL_DETAIL_INFO_IF_FORMAT(OSL_DEBUG_LEVEL > 0, "legacy.osl", __VA_ARGS__)
150 
151 #if OSL_DEBUG_LEVEL > 0
152 #define OSL_ASSERT(c) \
153  SAL_DETAIL_WARN_IF_FORMAT(!(c), "legacy.osl", "OSL_ASSERT: %s", #c)
154 #define OSL_ENSURE(c, m) SAL_DETAIL_WARN_IF_FORMAT(!(c), "legacy.osl", "%s", m)
155 #define OSL_FAIL(m) SAL_DETAIL_WARN_IF_FORMAT(sal_True, "legacy.osl", "%s", m)
156 #else
157 #define OSL_ASSERT(c) ((void) 0)
158 #define OSL_ENSURE(c, m) ((void) 0)
159 #define OSL_FAIL(m) ((void) 0)
160 #endif
161 
162 #define OSL_VERIFY(c) do { if (!(c)) OSL_ASSERT(0); } while (0)
163 #define OSL_PRECOND(c, m) OSL_ENSURE(c, m)
164 #define OSL_POSTCOND(c, m) OSL_ENSURE(c, m)
165 
166 
167 #ifdef __cplusplus
168 #define _OSL_GLOBAL ::
169 #else
170 #define _OSL_GLOBAL
171 #endif /* __cplusplus */
172 
173 #if OSL_DEBUG_LEVEL > 0
174 
175 #define _OSL_DEBUG_ONLY(f) (f)
176 
177 #else
178 
179 #define _OSL_DEBUG_ONLY(f) ((void)0)
180 
181 #endif /* OSL_DEBUG_LEVEL */
182 
183 /* the macro OSL_THIS_FUNC is intended to be an office internal macro for now */
184 /* copied from boost/current_function.hpp to make it usable from C
185  * sources as well
186  *
187  * Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
188  *
189  * Distributed under the Boost Software License, Version 1.0. (See
190  * accompanying file LICENSE_1_0.txt or copy at
191  * http://www.boost.org/LICENSE_1_0.txt) */
192 #if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600))
193 #define OSL_THIS_FUNC __PRETTY_FUNCTION__
194 #elif defined(__DMC__) && (__DMC__ >= 0x810)
195 #define OSL_THIS_FUNC __PRETTY_FUNCTION__
196 #elif defined(__FUNCSIG__)
197 #define OSL_THIS_FUNC __FUNCSIG__
198 #elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500))
199 #define OSL_THIS_FUNC __FUNCTION__
200 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
201 #define OSL_THIS_FUNC __func__
202 #else
203 #define OSL_THIS_FUNC ""
204 #endif
205 
206 #endif /* _OSL_DIAGNOSE_H_ */
207 
208 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */