www.pudn.com > zfxcengine-0.1.0.zip > ceDebug.cpp
// $Id: ceDebug.cpp,v 1.11 2005/08/10 20:13:07 kimmi Exp $ /////////////////////////////////////////////////////////////////////////////// // // Module: Core //! \file: ceDebug.cpp // Created: 06.08.2003 // Author: Martin Zielinski // Last mod: $Id: ceDebug.cpp,v 1.11 2005/08/10 20:13:07 kimmi Exp $ // /////////////////////////////////////////////////////////////////////////////// #ifdef WIN32 # include#endif #include "Core/ceDebug.h" #include "Core/ceLogSystem.h" #include "Core/ceExceptions.h" #include "Core/ceMemManager.h" namespace ZFXCE { namespace Debug { //////////////////////////////////////////////////////////////////////////////// using namespace std; // >>>>>>>>>>>>>> HIER KEINE PUSH/POP Makros setzten WICHTIG!!! ceFunctionStack g_FunctionStack; INT iDepth = 0, iTablen = 2; static bool bDump; bool bIsInited = false; //////////////////////////////////////////////////////////////////////////////// void InitDebug() { iDepth = 0; bDump = false; bIsInited = true; } //////////////////////////////////////////////////////////////////////// void ReleaseDebug() { if (!bIsInited) return; // Empty } //////////////////////////////////////////////////////////////////////////////// void SetDumpStackMode(const DumpMode Mode) { switch (Mode) { case CE_DEBUG_OFF: bDump = false; break; case CE_DEBUG_DUMPSTACK: bDump = true; break; } } //////////////////////////////////////////////////////////////////////////////// void Print(const std::string &strText) { // Log message, kind of output stream depends to OS #ifdef _DEBUG # ifdef WIN32 ::OutputDebugString(strText.c_str()); cout << strText << endl; # else cout << strText << endl; # endif // WIN32 #endif // _DEBUG } //////////////////////////////////////////////////////////////////////////////// void PushFunctionOnStack(const std::string &strFileName, const std::string &strFuncName) { // Push function name to stack g_FunctionStack.push_back(make_pair(strFileName, strFuncName)); ++iDepth; // If overflow will be reaved, pop front function if (iDepth > CE_DEBUG_MAXSTACKDEPTH) { g_FunctionStack.pop_front(); --iDepth; } // If dumpflag is set, write current call to console if (bDump) { for (int n=0; n