Kaydet (Commit) 3917b73f authored tarafından Thomas Arnhold's avatar Thomas Arnhold

Remove DBG_LOOP macro

üst 1a21e1f1
......@@ -43,7 +43,6 @@ sw sw\source\core\doc nmake - all sw_doc sw_inc NULL
sw sw\source\core\docnode nmake - all sw_dcnd sw_inc NULL
sw sw\source\core\draw nmake - all sw_draw sw_inc NULL
sw sw\source\core\edit nmake - all sw_edit sw_inc NULL
sw sw\source\core\except nmake - all sw_excpt sw_inc NULL
sw sw\source\core\fields nmake - all sw_fld sw_inc NULL
sw sw\source\core\frmedt nmake - all sw_frmed sw_inc NULL
sw sw\source\core\graphic nmake - all sw_grph sw_inc NULL
......@@ -71,7 +70,7 @@ sw sw\source\filter\ww1 nmake - all sw_ww1 sw_in
sw sw\source\filter\ww8 nmake - all sw_ww8 sw_inc NULL
sw sw\source\filter\xml nmake - all sw_xml sw_inc NULL
sw sw\source\ui nmake - all sw_ui sw_app sw_cctrl sw_chrdl sw_conf sw_dbui sw_dchdl sw_dcvw sw_dlg sw_envlp sw_fldui sw_fmtui sw_frmdl sw_globd sw_index sw_ling sw_misc sw_rbbar sw_shell sw_table sw_uiuno sw_uivw sw_utlui sw_web sw_wrtsh sw_smartmenu sw_vba NULL
sw sw\source\core nmake - all sw_core sw_attr sw_bast sw_crsr sw_dcnd sw_doc sw_draw sw_edit sw_excpt sw_fld sw_frmed sw_grph sw_layo sw_ole sw_para sw_sw3io sw_swg sw_text sw_tox sw_txtnd sw_uco sw_undo sw_view sw_acc sw_objpos sw_NumberTree sw_tablecore NULL
sw sw\source\core nmake - all sw_core sw_attr sw_bast sw_crsr sw_dcnd sw_doc sw_draw sw_edit sw_fld sw_frmed sw_grph sw_layo sw_ole sw_para sw_sw3io sw_swg sw_text sw_tox sw_txtnd sw_uco sw_undo sw_view sw_acc sw_objpos sw_NumberTree sw_tablecore NULL
sw sw\source\filter nmake - all sw_flt sw_ascii sw_bsflt sw_html sw_rtf sw_wrtr sw_ww1 sw_ww8 sw_xml NULL
sw sw\util nmake - all sw_util sw_core sw_flt sw_sdi sw_ui NULL
sw sw\qa\unoapi nmake - all sw_qa_unoapi NULL
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
#if !defined(OSL_DEBUG_LEVEL) || OSL_DEBUG_LEVEL == 0
#error Who broke the makefiles?
#endif
#include <tools/stream.hxx>
#include "dbgloop.hxx"
#include "errhdl.hxx"
DbgLoopStack DbgLoop::aDbgLoopStack;
/*************************************************************************
* class DbgLoopStack
*************************************************************************/
DbgLoopStack::DbgLoopStack()
{
Reset();
}
void DbgLoopStack::Reset()
{
nPtr = 0;
pDbg = 0;
for( USHORT i = 0; i < DBG_MAX_STACK; ++i )
aCount[i] = 0;
}
/*************************************************************************
* DbgLoopStack::Push()
*************************************************************************/
void DbgLoopStack::Push( const void *pThis )
{
// Wir muessen irgendwie mitbekommen, wann die erste Stackposition
// resettet werden soll, z.B. wenn wir einen Nullpointer uebergeben
if( !nPtr && ( pDbg != pThis || !pThis ) )
{
aCount[1] = 0;
pDbg = pThis;
}
++nPtr;
if( DBG_MAX_STACK > nPtr )
{
// Wenn eine loop entdeckt wird, wird der counter wieder zurueckgesetzt.
OSL_ENSURE( DBG_MAX_LOOP > aCount[nPtr], "DbgLoopStack::Push: loop detected" );
if( DBG_MAX_LOOP > aCount[nPtr] )
++(aCount[nPtr]);
else
aCount[nPtr] = 0;
}
}
/*************************************************************************
* DbgLoopStack::Pop()
*************************************************************************/
void DbgLoopStack::Pop()
{
if( DBG_MAX_STACK > nPtr )
{
OSL_ENSURE( nPtr, "DbgLoopStack::Pop: can't pop the stack" );
OSL_ENSURE( aCount[nPtr], "DbgLoopStack::Pop: can't dec the count" );
if( DBG_MAX_STACK > nPtr + 1 )
aCount[nPtr + 1] = 0;
}
--nPtr;
}
/*************************************************************************
* DbgLoopStack::Print()
*************************************************************************/
void DbgLoopStack::Print( SvStream &rOS ) const
{
rOS << "POS: " << nPtr << '\n';
USHORT i;
for( i = 0; i < DBG_MAX_STACK; ++i )
rOS << i << " ";
rOS << '\n';
for( i = 0; i < DBG_MAX_STACK; ++i )
rOS << aCount[i] << " ";
rOS << '\n';
}
#ifdef STAND_ALONE
// compile with: cl /AL /DSTAND_ALONE dbgloop.cxx
/*************************************************************************
* main()
*************************************************************************/
#include <stdlib.h>
void AssertFail( const char *pErr, const char *pFile, USHORT nLine )
{
cout << pErr << '\n';
PrintLoopStack( cout );
exit(0);
}
class Test
{
public:
void Run() const;
};
void Test::Run() const
{
cout << "---" << '\n';
for( USHORT i = 0; i < 10; ++i )
{
cout << "i" << i;
DBG_LOOP;
PrintLoopStack( cout );
for( USHORT j = 0; j < 10; ++j )
{
cout << " j" << j;
DBG_LOOP;
PrintLoopStack( cout );
}
cout << '\n';
}
PrintLoopStack( cout );
}
int main()
{
// unterschiedliche Instanzen waehlen wg. pDbg != pThis
Test aTest1;
aTest1.Run();
Test aTest2;
aTest2.Run();
return 0;
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenOffice.org is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License version 3 for more details
# (a copy is included in the LICENSE file that accompanied this code).
#
# You should have received a copy of the GNU Lesser General Public License
# version 3 along with OpenOffice.org. If not, see
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
#*************************************************************************
PRJ=..$/..$/..
PRJNAME=sw
TARGET=except
# --- Settings -----------------------------------------------------
.INCLUDE : $(PRJ)$/inc$/swpre.mk
# hier kein PCH!
prjpch=
PRJPCH=
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/inc$/sw.mk
# --- Files --------------------------------------------------------
CXXFILES =
.IF "$(DBG_LEVEL)">="2"
CXXFILES += \
dbgloop.cxx
SLOFILES += \
$(SLO)$/dbgloop.obj
.ENDIF
# --- Tagets -------------------------------------------------------
.INCLUDE : target.mk
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _DBGLOOP_HXX
#define _DBGLOOP_HXX
#if OSL_DEBUG_LEVEL > 1
#include <tools/solar.h>
class SvStream;
#define DBG_MAX_STACK 20 // Verschachtelungstiefe
#define DBG_MAX_LOOP 1000 // das Abbruchkriterium
class DbgLoopStack
{
USHORT aCount[DBG_MAX_STACK];
USHORT nPtr;
const void *pDbg;
void Reset();
public:
DbgLoopStack();
void Push( const void *pThis );
void Pop();
void Print( SvStream &rOS ) const; //$ ostream
};
class DbgLoop
{
friend inline void PrintLoopStack( SvStream &rOS ); //$ ostream
static DbgLoopStack aDbgLoopStack;
public:
inline DbgLoop( const void *pThis ) { aDbgLoopStack.Push( pThis ); }
inline ~DbgLoop() { aDbgLoopStack.Pop(); }
};
inline void PrintLoopStack( SvStream &rOS ) //$ ostream
{
DbgLoop::aDbgLoopStack.Print( rOS );
}
#define DBG_LOOP DbgLoop aDbgLoop( (const void*)this );
#define DBG_LOOP_RESET DbgLoop aDbgLoop( 0 );
#else
#define DBG_LOOP
#define DBG_LOOP_RESET
#endif
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -69,11 +69,6 @@ SUBLIBS3= \
$(SLB)$/SwNumberTree.lib \
$(SLB)$/tablecore.lib
.IF "$(DBG_LEVEL)">="2"
SUBLIBS3+= \
$(SLB)$/except.lib
.ENDIF
SUBLIBS4= \
$(SLB)$/frmedt.lib \
$(SLB)$/ole.lib \
......@@ -83,8 +78,6 @@ SUBLIBS4= \
$(SLB)$/bastyp.lib
#-------------------------------------------------------------------------
################################################################
LIB1TARGET=$(SLB)$/core1.lib
LIB1FILES= \
$(SUBLIBS1)
......@@ -103,8 +96,4 @@ LIB4FILES= \
.INCLUDE : target.mk
################################################################
#-------------------------------------------------------------------------
......@@ -29,17 +29,6 @@
#ifndef _TXTCFG_HXX
#define _TXTCFG_HXX
#if OSL_DEBUG_LEVEL > 1
#include "dbgloop.hxx" // DBG_LOOP
#else
#ifdef DBG_LOOP //kann per precompiled hereinkommen
#undef DBG_LOOP
#undef DBG_LOOP_RESET
#endif
#define DBG_LOOP
#define DBG_LOOP_RESET
#endif
// Toleranzwert in der Formatierung und Textausgabe.
#define SLOPPY_TWIPS 5
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment