2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-11 09:51:50 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2013-11-05 04:15:12 +01:00
|
|
|
#ifndef INCLUDED_TOOLS_DEBUG_HXX
|
|
|
|
#define INCLUDED_TOOLS_DEBUG_HXX
|
2007-04-11 19:09:57 +00:00
|
|
|
|
2013-11-09 15:37:43 -06:00
|
|
|
#include <tools/toolsdllapi.h>
|
2007-04-11 19:09:57 +00:00
|
|
|
|
2011-11-23 15:45:43 +01:00
|
|
|
#include <sal/detail/log.h>
|
2007-04-11 19:09:57 +00:00
|
|
|
#include <sal/types.h>
|
|
|
|
|
2011-11-22 09:34:46 +01:00
|
|
|
/** The facilities provided by this header are deprecated. True assertions
|
|
|
|
(that detect broken program logic) should use standard assert (which aborts
|
|
|
|
if an assertion fails, and is controlled by the standard NDEBUG macro).
|
2014-03-28 16:32:23 +01:00
|
|
|
Logging of warnings (e.g., about malformed input) should use the facilities
|
2011-11-23 15:45:43 +01:00
|
|
|
provided by sal/log.hxx.
|
2011-11-22 09:34:46 +01:00
|
|
|
|
2013-03-21 19:10:52 +01:00
|
|
|
Because the assertion macro (DBG_ASSERT) has been used for
|
|
|
|
true assertions as well as to log warnings, it maps to SAL_WARN instead of
|
2011-12-02 11:28:17 +01:00
|
|
|
standard assert. The warning and error macros (DBG_ASSERTWARNING,
|
2014-10-28 12:36:04 +01:00
|
|
|
DBG_WARNING) all map to
|
2012-01-10 07:27:36 +01:00
|
|
|
SAL_INFO.
|
2011-11-22 09:34:46 +01:00
|
|
|
*/
|
|
|
|
|
2007-04-11 19:09:57 +00:00
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
|
|
|
typedef void (*DbgTestSolarMutexProc)();
|
|
|
|
|
|
|
|
#define DBG_TEST_RESOURCE (0x02000000)
|
|
|
|
#define DBG_TEST_DIALOG (0x04000000)
|
|
|
|
#define DBG_TEST_BOLDAPPFONT (0x08000000)
|
|
|
|
|
|
|
|
struct DbgData
|
|
|
|
{
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uIntPtr nTestFlags;
|
2007-04-11 19:09:57 +00:00
|
|
|
sal_Char aDbgWinState[50]; // DbgGUIData for VCL
|
|
|
|
};
|
|
|
|
|
2012-08-12 01:01:00 +02:00
|
|
|
// Dbg prototypes
|
2014-03-31 12:34:17 +02:00
|
|
|
#define DBG_FUNC_GETDATA 0
|
|
|
|
#define DBG_FUNC_SAVEDATA 1
|
|
|
|
#define DBG_FUNC_SETTESTSOLARMUTEX 2
|
|
|
|
#define DBG_FUNC_TESTSOLARMUTEX 3
|
2007-04-11 19:09:57 +00:00
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
TOOLS_DLLPUBLIC void* DbgFunc( sal_uInt16 nAction, void* pData = NULL );
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
inline DbgData* DbgGetData()
|
|
|
|
{
|
2015-03-28 19:08:00 +01:00
|
|
|
return static_cast<DbgData*>(DbgFunc( DBG_FUNC_GETDATA ));
|
2007-04-11 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgSaveData( const DbgData& rData )
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_SAVEDATA, (void*)&rData );
|
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
inline sal_uIntPtr DbgIsResource()
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
DbgData* pData = DbgGetData();
|
|
|
|
if ( pData )
|
|
|
|
return pData->nTestFlags & DBG_TEST_RESOURCE;
|
|
|
|
else
|
2010-11-10 13:50:33 +08:00
|
|
|
return sal_False;
|
2007-04-11 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
inline sal_uIntPtr DbgIsDialog()
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
DbgData* pData = DbgGetData();
|
|
|
|
if ( pData )
|
|
|
|
return pData->nTestFlags & DBG_TEST_DIALOG;
|
|
|
|
else
|
2010-11-10 13:50:33 +08:00
|
|
|
return sal_False;
|
2007-04-11 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
inline sal_uIntPtr DbgIsBoldAppFont()
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
DbgData* pData = DbgGetData();
|
|
|
|
if ( pData )
|
|
|
|
return pData->nTestFlags & DBG_TEST_BOLDAPPFONT;
|
|
|
|
else
|
2010-11-10 13:50:33 +08:00
|
|
|
return sal_False;
|
2007-04-11 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgSetTestSolarMutex( DbgTestSolarMutexProc pProc )
|
|
|
|
{
|
2014-12-08 08:19:15 +01:00
|
|
|
DbgFunc( DBG_FUNC_SETTESTSOLARMUTEX, reinterpret_cast<void*>(reinterpret_cast<sal_uIntPtr>(pProc)) );
|
2007-04-11 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
2011-11-22 09:34:46 +01:00
|
|
|
#define DBG_ASSERTWARNING( sCon, aWarning ) \
|
2015-03-13 10:47:52 +01:00
|
|
|
SAL_DETAIL_INFO_IF_FORMAT(!(sCon), "legacy.tools", "%s", aWarning)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
2011-11-22 09:34:46 +01:00
|
|
|
#define DBG_ASSERT( sCon, aError ) \
|
2015-03-13 10:47:52 +01:00
|
|
|
SAL_DETAIL_WARN_IF_FORMAT(!(sCon), "legacy.tools", "%s", aError)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
2011-11-23 15:45:43 +01:00
|
|
|
#define DBG_WARNING( aWarning ) \
|
2015-03-13 10:47:52 +01:00
|
|
|
SAL_DETAIL_INFO_IF_FORMAT(true, "legacy.tools", "%s", aWarning)
|
2011-11-22 09:34:46 +01:00
|
|
|
|
2008-11-10 15:06:12 +00:00
|
|
|
#define DBG_TESTSOLARMUTEX() \
|
|
|
|
do \
|
|
|
|
{ \
|
2014-03-31 12:34:17 +02:00
|
|
|
DbgFunc(DBG_FUNC_TESTSOLARMUTEX); \
|
2014-01-28 19:58:14 +01:00
|
|
|
} while(false)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
#else
|
2012-08-13 22:51:30 +02:00
|
|
|
// NO DBG_UITL
|
2007-04-11 19:09:57 +00:00
|
|
|
|
2008-11-10 15:06:12 +00:00
|
|
|
#define DBG_ASSERTWARNING( sCon, aWarning ) ((void)0)
|
|
|
|
#define DBG_ASSERT( sCon, aError ) ((void)0)
|
|
|
|
#define DBG_WARNING( aWarning ) ((void)0)
|
|
|
|
|
|
|
|
#define DBG_TESTSOLARMUTEX() ((void)0)
|
|
|
|
|
2007-04-11 19:09:57 +00:00
|
|
|
#endif
|
|
|
|
|
2012-08-13 23:14:08 +02:00
|
|
|
#endif
|
2010-10-14 08:27:31 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|