diff --git a/plugins/3d/vrml/v2/vrml2_appearance.cpp b/plugins/3d/vrml/v2/vrml2_appearance.cpp index 18cb29a5fd..b8bd28ae42 100644 --- a/plugins/3d/vrml/v2/vrml2_appearance.cpp +++ b/plugins/3d/vrml/v2/vrml2_appearance.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml2_base.h" #include "vrml2_appearance.h" @@ -57,9 +59,13 @@ WRL2APPEARANCE::WRL2APPEARANCE( WRL2NODE* aParent ) : WRL2NODE() WRL2APPEARANCE::~WRL2APPEARANCE() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Destroying Appearance with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Destroying Appearance with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references and "; + ostr << m_BackPointers.size() << " backpointers"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif } @@ -100,8 +106,12 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed for aNode\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed for aNode"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -112,9 +122,13 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode ) if( !checkNodeType( type ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected child node '"; - std::cerr << aNode->GetNodeTypeName( type ) << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected child node '"; + ostr << aNode->GetNodeTypeName( type ) << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -125,8 +139,12 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode ) if( NULL != material ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple material nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple material nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -141,8 +159,12 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode ) if( NULL != textureTransform ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple textureTransform nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple textureTransform nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -155,8 +177,12 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode ) if( NULL != texture ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple texture nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple texture nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -172,8 +198,12 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed for aNode\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed for aNode"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -184,9 +214,13 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode ) if( !checkNodeType( type ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected child node '"; - std::cerr << aNode->GetNodeTypeName( type ) << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected child node '"; + ostr << aNode->GetNodeTypeName( type ) << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -197,8 +231,12 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode ) if( NULL != material ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple material nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple material nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -213,8 +251,12 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode ) if( NULL != textureTransform ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple textureTransform nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple textureTransform nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -227,8 +269,12 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode ) if( NULL != texture ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple texture nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple texture nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -244,8 +290,12 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( NULL == aTopNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] aTopNode is NULL\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] aTopNode is NULL"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -259,9 +309,13 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -270,10 +324,14 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -293,8 +351,12 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -312,8 +374,12 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read material information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read material information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -324,8 +390,12 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read texture information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read texture information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -336,8 +406,12 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read textureTransform information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read textureTransform information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -346,10 +420,14 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Appearance at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Appearance at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -370,18 +448,26 @@ SGNODE* WRL2APPEARANCE::TranslateToSG( SGNODE* aParent ) if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Appearance does not have a Shape parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] Appearance does not have a Shape parent (parent ID: "; + ostr << ptype << ")"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return NULL; } #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Translating Appearance with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Translating Appearance with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references and "; + ostr << m_BackPointers.size() << " backpointers"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif if( m_sgNode ) diff --git a/plugins/3d/vrml/v2/vrml2_base.cpp b/plugins/3d/vrml/v2/vrml2_base.cpp index 87d6376b1b..76f50a9d99 100644 --- a/plugins/3d/vrml/v2/vrml2_base.cpp +++ b/plugins/3d/vrml/v2/vrml2_base.cpp @@ -22,9 +22,11 @@ */ #include +#include #include #include #include +#include #include "vrml2_base.h" #include "vrml2_transform.h" @@ -79,8 +81,12 @@ WRL2BASE::~WRL2BASE() bool WRL2BASE::SetParent( WRL2NODE* aParent ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] attempting to set parent on WRL2BASE node\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] attempting to set parent on WRL2BASE node"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -150,8 +156,12 @@ SGNODE* WRL2BASE::GetInlineData( const std::string& aName ) std::string WRL2BASE::GetName( void ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] attempting to extract name from virtual base node\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] attempting to extract name from virtual base node"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return std::string( "" ); @@ -161,8 +171,12 @@ std::string WRL2BASE::GetName( void ) bool WRL2BASE::SetName( const std::string& aName ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] attempting to set name on virtual base node\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] attempting to set name on virtual base node"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -174,8 +188,12 @@ bool WRL2BASE::Read( WRLPROC& proc ) if( proc.GetVRMLType() != VRML_V2 ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] no open file or file is not a VRML2 file\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] no open file or file is not a VRML2 file"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -207,8 +225,12 @@ bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode if( !aParent ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] invoked with NULL parent\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] invoked with NULL parent"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -219,8 +241,12 @@ bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -232,8 +258,12 @@ bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode if( NULL == ref ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] node '" << glob << "' not found\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] node '" << glob << "' not found"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return true; @@ -242,10 +272,14 @@ bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode if( !aParent->AddRefNode( ref ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] failed to add node '" << glob << "' ("; - std::cerr << ref->GetNodeTypeName( ref->GetNodeType() ) << ") to parent of type "; - std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() ) << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] failed to add node '" << glob << "' ("; + ostr << ref->GetNodeTypeName( ref->GetNodeType() ) << ") to parent of type "; + ostr << aParent->GetNodeTypeName( aParent->GetNodeType() ); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -266,8 +300,12 @@ bool WRL2BASE::implementDef( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode if( NULL == aParent ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] invalid parent pointer (NULL)\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] invalid parent pointer (NULL)"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -279,8 +317,12 @@ bool WRL2BASE::implementDef( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -297,11 +339,15 @@ bool WRL2BASE::implementDef( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode if( lnode && !lnode->SetName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - size_t line, column; - proc.GetFilePosData( line, column ); - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad formatting (invalid name) at line"; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + size_t line, column; + proc.GetFilePosData( line, column ); + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad formatting (invalid name) at line"; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -328,8 +374,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( NULL == aParent ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] invalid parent pointer (NULL)\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] invalid parent pointer (NULL)"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -343,8 +393,10 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) if( !proc.eof() ) { - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); } #endif @@ -367,8 +419,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( !implementUse( proc, aParent, aNode ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -382,8 +438,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( !implementDef( proc, aParent, aNode ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -397,8 +457,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( !proc.ReadName( glob ) || !proc.DiscardList() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -412,8 +476,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( !proc.ReadName( glob ) || !proc.ReadName( glob ) || !proc.DiscardList() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -427,8 +495,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( !proc.ReadGlob( glob ) || !proc.ReadGlob( glob ) || !proc.ReadGlob( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -443,7 +515,11 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) proc.GetFilePosData( line, column ); #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Processing node '" << glob << "' ID: " << ntype << "\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Processing node '" << glob << "' ID: " << ntype; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif switch( ntype ) @@ -477,7 +553,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( !proc.DiscardNode() ) { #ifdef DEBUG_VRML2 - std::cerr << " * [INFO] FAIL: discard " << glob << " node at l" << line << ", c" << column << "\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] FAIL: discard " << glob << " node at l"; + ostr << line << ", c" << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -485,7 +566,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) #ifdef DEBUG_VRML2 else { - std::cerr << " * [INFO] OK: discard " << glob << " node at l" << line << ", c" << column << "\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] OK: discard " << glob << " node at l"; + ostr << line << ", c" << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); } #endif @@ -503,7 +589,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( !proc.DiscardNode() ) { #ifdef DEBUG_VRML2 - std::cerr << " * [INFO] FAIL: discard " << glob << " node at l" << line << ", c" << column << "\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] FAIL: discard " << glob << " node at l"; + ostr << line << ", c" << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -511,7 +602,10 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) #ifdef DEBUG_VRML2 else { - std::cerr << " * [INFO] OK: discard " << glob << " node at l" << line << ", c" << column << "\n"; + std::ostringstream ostr; + ostr << " * [INFO] OK: discard " << glob << " node at l"; + ostr << line << ", c" << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); } #endif @@ -522,7 +616,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( !proc.DiscardNode() ) { #ifdef DEBUG_VRML2 - std::cerr << " * [INFO] FAIL: discard " << glob << " node at l" << line << ", c" << column << "\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] FAIL: discard " << glob << " node at l"; + ostr << line << ", c" << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -530,7 +629,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) #ifdef DEBUG_VRML2 else { - std::cerr << " * [INFO] OK: discard " << glob << " node at l" << line << ", c" << column << "\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] OK: discard " << glob << " node at l"; + ostr << line << ", c" << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); } #endif @@ -541,7 +645,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( !proc.DiscardNode() ) { #ifdef DEBUG_VRML2 - std::cerr << " * [INFO] FAIL: discard " << glob << " node at l" << line << ", c" << column << "\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] FAIL: discard " << glob << " node at l"; + ostr << line << ", c" << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -549,7 +658,10 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) #ifdef DEBUG_VRML2 else { - std::cerr << " * [INFO] OK: discard " << glob << " node at l" << line << ", c" << column << "\n"; + std::ostringstream ostr; + ostr << " * [INFO] OK: discard " << glob << " node at l"; + ostr << line << ", c" << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); } #endif @@ -602,7 +714,12 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( !proc.DiscardNode() ) { #ifdef DEBUG_VRML2 - std::cerr << " * [INFO] FAIL: discard " << glob << " node at l" << line << ", c" << column << "\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] FAIL: discard " << glob << " node at l"; + ostr << line << ", c" << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -610,7 +727,10 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) #ifdef DEBUG_VRML2 else { - std::cerr << " * [INFO] OK: discard " << glob << " node at l" << line << ", c" << column << "\n"; + std::ostringstream ostr; + ostr << " * [INFO] OK: discard " << glob << " node at l"; + ostr << line << ", c" << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); } #endif @@ -684,10 +804,14 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( !proc.DiscardNode() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not discard node at line " << line; - std::cerr << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not discard node at line " << line; + ostr << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -695,8 +819,10 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) #ifdef DEBUG_VRML2 else { - std::cerr << " * [INFO] OK: discard unsupported " << glob << " node at l"; - std::cerr << line << ", c" << column << "\n"; + std::ostringstream ostr; + ostr << " * [INFO] OK: discard unsupported " << glob << " node at l"; + ostr << line << ", c" << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); } #endif @@ -711,9 +837,13 @@ bool WRL2BASE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) { // this function makes no sense in the base node #ifdef DEBUG_VRML2 - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] this method must never be invoked on a WRL2BASE object\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] this method must never be invoked on a WRL2BASE object"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -974,10 +1104,14 @@ bool WRL2BASE::readInline( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) if( !proc.DiscardNode() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not discard Inline node at line " << line; - std::cerr << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not discard Inline node at line " << line; + ostr << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -1011,9 +1145,13 @@ SGNODE* WRL2BASE::TranslateToSG( SGNODE* aParent ) if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] WRL2BASE does not have a Transform parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] WRL2BASE does not have a Transform parent (parent ID: "; + ostr << ptype << ")"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return NULL; diff --git a/plugins/3d/vrml/v2/vrml2_box.cpp b/plugins/3d/vrml/v2/vrml2_box.cpp index 8813c122a0..454001fa1b 100644 --- a/plugins/3d/vrml/v2/vrml2_box.cpp +++ b/plugins/3d/vrml/v2/vrml2_box.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml2_base.h" #include "vrml2_box.h" @@ -58,7 +60,7 @@ WRL2BOX::WRL2BOX( WRL2NODE* aParent ) : WRL2NODE() WRL2BOX::~WRL2BOX() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Destroying Box node\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying Box node\n" ); #endif return; @@ -86,9 +88,13 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -97,10 +103,14 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -118,8 +128,12 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -133,11 +147,15 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFVec3f( size ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid size at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid size at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -149,10 +167,14 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode ) else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Box at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Box at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -161,10 +183,14 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( size.x < 1e-6 || size.y < 1e-6 || size.z < 1e-6 ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Box (invalid size) at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Box (invalid size) at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif } @@ -177,10 +203,14 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode ) proc.GetFilePosData( line, column ); #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Box at line " << line << ", column "; - std::cerr << column << " (no closing brace)\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Box at line " << line << ", column "; + ostr << column << " (no closing brace)\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -192,8 +222,12 @@ bool WRL2BOX::AddRefNode( WRL2NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddRefNode is not applicable\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] AddRefNode is not applicable"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -205,8 +239,12 @@ bool WRL2BOX::AddChildNode( WRL2NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddChildNode is not applicable\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] AddChildNode is not applicable"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -220,9 +258,13 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent ) if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Box does not have a Shape parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] Box does not have a Shape parent (parent ID: "; + ostr << ptype << ")"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return NULL; diff --git a/plugins/3d/vrml/v2/vrml2_color.cpp b/plugins/3d/vrml/v2/vrml2_color.cpp index 39c54d1c49..caebb505a9 100644 --- a/plugins/3d/vrml/v2/vrml2_color.cpp +++ b/plugins/3d/vrml/v2/vrml2_color.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml2_base.h" #include "vrml2_color.h" @@ -50,7 +52,7 @@ WRL2COLOR::WRL2COLOR( WRL2NODE* aParent ) : WRL2NODE() WRL2COLOR::~WRL2COLOR() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Destroying Color node\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying Color node\n" ); #endif return; @@ -73,8 +75,12 @@ bool WRL2COLOR::AddRefNode( WRL2NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddRefNode is not applicable\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] AddRefNode is not applicable"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -86,8 +92,12 @@ bool WRL2COLOR::AddChildNode( WRL2NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddChildNode is not applicable\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] AddChildNode is not applicable"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -104,9 +114,13 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -115,10 +129,14 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -136,8 +154,12 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -151,11 +173,15 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadMFVec3f( colors ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid color set at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid color set at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -164,10 +190,14 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode ) else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Color at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Color at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -182,10 +212,14 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode ) proc.GetFilePosData( line, column ); #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Color at line " << line << ", column "; - std::cerr << column << " (no closing brace)\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Color at line " << line << ", column "; + ostr << column << " (no closing brace)\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; diff --git a/plugins/3d/vrml/v2/vrml2_coords.cpp b/plugins/3d/vrml/v2/vrml2_coords.cpp index 1f9b0bff2f..570f458966 100644 --- a/plugins/3d/vrml/v2/vrml2_coords.cpp +++ b/plugins/3d/vrml/v2/vrml2_coords.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml2_base.h" #include "vrml2_coords.h" @@ -50,7 +52,7 @@ WRL2COORDS::WRL2COORDS( WRL2NODE* aParent ) : WRL2NODE() WRL2COORDS::~WRL2COORDS() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Destroying Coordinate node\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate node\n" ); #endif return; @@ -73,8 +75,12 @@ bool WRL2COORDS::AddRefNode( WRL2NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddRefNode is not applicable\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] AddRefNode is not applicable"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -86,8 +92,12 @@ bool WRL2COORDS::AddChildNode( WRL2NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddChildNode is not applicable\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] AddChildNode is not applicable\n"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -104,9 +114,13 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -115,10 +129,14 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -136,8 +154,12 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -151,11 +173,15 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadMFVec3f( points ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid point set at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid point set at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -164,10 +190,12 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode ) else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Coordinate at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Coordinate at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); #endif return false; @@ -195,10 +223,14 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode ) proc.GetFilePosData( line, column ); #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Coordinate at line " << line << ", column "; - std::cerr << column << " (no closing brace)\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Coordinate at line " << line << ", column "; + ostr << column << " (no closing brace)\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; diff --git a/plugins/3d/vrml/v2/vrml2_faceset.cpp b/plugins/3d/vrml/v2/vrml2_faceset.cpp index 7db60afe36..7d52ce281f 100644 --- a/plugins/3d/vrml/v2/vrml2_faceset.cpp +++ b/plugins/3d/vrml/v2/vrml2_faceset.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml2_base.h" #include "vrml2_faceset.h" @@ -57,9 +59,13 @@ WRL2FACESET::WRL2FACESET( WRL2NODE* aParent ) : WRL2NODE() WRL2FACESET::~WRL2FACESET() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Destroying IndexedFaceSet with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Destroying IndexedFaceSet with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references and "; + ostr << m_BackPointers.size() << " backpointers"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return; @@ -125,8 +131,12 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed for aNode\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed for aNode"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -137,9 +147,13 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode ) if( !checkNodeType( type ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected child node '"; - std::cerr << aNode->GetNodeTypeName( type ) << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected child node '"; + ostr << aNode->GetNodeTypeName( type ) << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -150,8 +164,12 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode ) if( NULL != color ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple color nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple color nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -166,8 +184,12 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode ) if( NULL != coord ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple coordinate nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple coordinate nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -182,8 +204,12 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode ) if( NULL != normal ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple normal nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple normal nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -196,8 +222,12 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode ) if( WRL2_TEXTURECOORDINATE != type ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] unexpected code branch\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] unexpected code branch"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -206,8 +236,12 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode ) if( NULL != texCoord ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple texCoord nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple texCoord nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -223,8 +257,12 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed for aNode\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed for aNode"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -235,9 +273,13 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode ) if( !checkNodeType( type ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected child node '"; - std::cerr << aNode->GetNodeTypeName( type ) << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected child node '"; + ostr << aNode->GetNodeTypeName( type ) << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -248,8 +290,12 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode ) if( NULL != color ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple color nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple color nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -264,8 +310,12 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode ) if( NULL != coord ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple coordinate nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple coordinate nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -280,8 +330,12 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode ) if( NULL != normal ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple normal nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple normal nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -294,8 +348,12 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode ) if( WRL2_TEXTURECOORDINATE != type ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] unexpected code branch\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] unexpected code branch"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -304,8 +362,12 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode ) if( NULL != texCoord ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple texCoord nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple texCoord nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -327,9 +389,13 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -338,10 +404,14 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -361,8 +431,12 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -394,11 +468,15 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFBool( ccw ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid ccw at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid ccw at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -409,11 +487,15 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFBool( colorPerVertex ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid colorPerVertex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid colorPerVertex at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -424,11 +506,15 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFBool( convex ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid convex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid convex at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -439,11 +525,15 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFBool( normalPerVertex ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid normalPerVertex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid normalPerVertex at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -454,11 +544,15 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFBool( solid ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid solid at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid solid at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -469,11 +563,15 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFFloat( creaseAngle ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid creaseAngle at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid creaseAngle at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'\n"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -491,11 +589,15 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadMFInt( colorIndex ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid colorIndex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid colorIndex at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -506,11 +608,15 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadMFInt( coordIndex ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid coordIndex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid coordIndex at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -521,11 +627,15 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadMFInt( normalIndex ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid normalIndex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid normalIndex at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -536,8 +646,12 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read color node information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read color node information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -548,8 +662,12 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read coord node information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read coord node information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -560,8 +678,12 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read normal node information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read normal node information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -572,8 +694,12 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read texCoord node information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read texCoord node information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -582,10 +708,14 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad IndexedFaceSet at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad IndexedFaceSet at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -603,19 +733,27 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent ) if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] IndexedFaceSet does not have a Shape parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] IndexedFaceSet does not have a Shape parent (parent ID: "; + ostr << ptype << ")"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return NULL; } #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Translating IndexedFaceSet with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references, "; - std::cerr << m_BackPointers.size() << " backpointers and "; - std::cerr << coordIndex.size() << " coord indices\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Translating IndexedFaceSet with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references, "; + ostr << m_BackPointers.size() << " backpointers and "; + ostr << coordIndex.size() << " coord indices"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif if( m_sgNode ) diff --git a/plugins/3d/vrml/v2/vrml2_inline.cpp b/plugins/3d/vrml/v2/vrml2_inline.cpp index f7c12c48ce..c052ad898d 100644 --- a/plugins/3d/vrml/v2/vrml2_inline.cpp +++ b/plugins/3d/vrml/v2/vrml2_inline.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml2_inline.h" #include "vrml2_base.h" @@ -53,8 +55,9 @@ WRL2INLINE::WRL2INLINE( WRL2NODE* aParent ) : WRL2NODE() WRL2INLINE::~WRL2INLINE() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Destroying Inline node\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying Inline node\n" ); #endif + return; } @@ -79,20 +82,29 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif + return false; } if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -113,8 +125,12 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -128,12 +144,17 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadMFString( url ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid url at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid url at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif + return false; } } @@ -142,12 +163,17 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFVec3f( bboxCenter ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid bboxCenter at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid bboxCenter at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif + return false; } } @@ -156,22 +182,31 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFVec3f( bboxSize ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid bboxSize at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid bboxSize at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif + return false; } } else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Inline at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Inline at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -181,10 +216,14 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) proc.GetFilePosData( line, column ); #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Inline at line " << line << ", column "; - std::cerr << column << " (no closing brace)\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Inline at line " << line << ", column "; + ostr << column << " (no closing brace)\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -196,8 +235,12 @@ bool WRL2INLINE::AddRefNode( WRL2NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddRefNode is not applicable\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] AddRefNode is not applicable"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -209,8 +252,12 @@ bool WRL2INLINE::AddChildNode( WRL2NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddChildNode is not applicable\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] AddChildNode is not applicable\n"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -230,9 +277,13 @@ SGNODE* WRL2INLINE::TranslateToSG( SGNODE* aParent ) if( ptype != S3D::SGTYPE_TRANSFORM ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Inline does not have a Transform parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] Inline does not have a Transform parent (parent ID: "; + ostr << ptype << ")"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return NULL; diff --git a/plugins/3d/vrml/v2/vrml2_lineset.cpp b/plugins/3d/vrml/v2/vrml2_lineset.cpp index e55103fe20..342e8fdb85 100644 --- a/plugins/3d/vrml/v2/vrml2_lineset.cpp +++ b/plugins/3d/vrml/v2/vrml2_lineset.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml2_base.h" #include "vrml2_lineset.h" @@ -56,9 +58,13 @@ WRL2LINESET::WRL2LINESET( WRL2NODE* aParent ) : WRL2NODE() WRL2LINESET::~WRL2LINESET() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Destroying IndexedLineSet with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Destroying IndexedLineSet with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references and "; + ostr << m_BackPointers.size() << " backpointers"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return; @@ -110,8 +116,12 @@ bool WRL2LINESET::AddRefNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed for aNode\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed for aNode"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -122,9 +132,13 @@ bool WRL2LINESET::AddRefNode( WRL2NODE* aNode ) if( !checkNodeType( type ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected child node '"; - std::cerr << aNode->GetNodeTypeName( type ) << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected child node '"; + ostr << aNode->GetNodeTypeName( type ) << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -135,8 +149,12 @@ bool WRL2LINESET::AddRefNode( WRL2NODE* aNode ) if( NULL != color ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple color nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple color nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -151,8 +169,12 @@ bool WRL2LINESET::AddRefNode( WRL2NODE* aNode ) if( NULL != coord ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple coordinate nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple coordinate nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -171,8 +193,12 @@ bool WRL2LINESET::AddChildNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed for aNode\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed for aNode"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -183,9 +209,13 @@ bool WRL2LINESET::AddChildNode( WRL2NODE* aNode ) if( !checkNodeType( type ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected child node '"; - std::cerr << aNode->GetNodeTypeName( type ) << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected child node '"; + ostr << aNode->GetNodeTypeName( type ) << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -196,8 +226,12 @@ bool WRL2LINESET::AddChildNode( WRL2NODE* aNode ) if( NULL != color ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple color nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple color nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -212,8 +246,12 @@ bool WRL2LINESET::AddChildNode( WRL2NODE* aNode ) if( NULL != coord ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple coordinate nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple coordinate nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -238,9 +276,13 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -249,10 +291,14 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -272,8 +318,12 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -296,11 +346,15 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFBool( colorPerVertex ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid colorPerVertex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid colorPerVertex at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -311,11 +365,15 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadMFInt( colorIndex ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid colorIndex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid colorIndex at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -326,11 +384,15 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadMFInt( coordIndex ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid coordIndex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid coordIndex at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -341,8 +403,12 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read color node information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read color node information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -353,8 +419,12 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read coord node information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read coord node information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -363,10 +433,14 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad IndexedLineSet at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad IndexedLineSet at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; diff --git a/plugins/3d/vrml/v2/vrml2_material.cpp b/plugins/3d/vrml/v2/vrml2_material.cpp index 5aaaf9384b..69e902d01a 100644 --- a/plugins/3d/vrml/v2/vrml2_material.cpp +++ b/plugins/3d/vrml/v2/vrml2_material.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml2_base.h" #include "vrml2_material.h" @@ -53,7 +55,7 @@ WRL2MATERIAL::WRL2MATERIAL( WRL2NODE* aParent ) : WRL2NODE() WRL2MATERIAL::~WRL2MATERIAL() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Destroying Material node\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying Material node\n" ); #endif return; @@ -97,8 +99,12 @@ bool WRL2MATERIAL::AddRefNode( WRL2NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddRefNode is not applicable\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] AddRefNode is not applicable"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -110,8 +116,12 @@ bool WRL2MATERIAL::AddChildNode( WRL2NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddChildNode is not applicable\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] AddChildNode is not applicable"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -123,8 +133,12 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( NULL == aTopNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] aTopNode is NULL\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] aTopNode is NULL"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -138,9 +152,13 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -149,10 +167,14 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -172,8 +194,12 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -194,11 +220,15 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFVec3f( specularColor ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid specularColor at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid specularColor at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -209,11 +239,15 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFVec3f( diffuseColor ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid diffuseColor at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid diffuseColor at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -224,11 +258,15 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFVec3f( emissiveColor ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid emissiveColor at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid emissiveColor at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -239,11 +277,15 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFFloat( shininess ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid shininess at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid shininess at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -254,11 +296,15 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFFloat( transparency ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid transparency at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid transparency at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -269,11 +315,15 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFFloat( ambientIntensity ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid ambientIntensity at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid ambientIntensity at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -282,10 +332,14 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode ) else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Material at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Material at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -303,18 +357,26 @@ SGNODE* WRL2MATERIAL::TranslateToSG( SGNODE* aParent ) if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Material does not have a Shape parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] Material does not have a Shape parent (parent ID: "; + ostr << ptype << ")"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return NULL; } #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Translating Material with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Translating Material with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references and "; + ostr << m_BackPointers.size() << " backpointers"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif if( m_sgNode ) diff --git a/plugins/3d/vrml/v2/vrml2_node.cpp b/plugins/3d/vrml/v2/vrml2_node.cpp index 0d38428c74..ce955b4e7f 100644 --- a/plugins/3d/vrml/v2/vrml2_node.cpp +++ b/plugins/3d/vrml/v2/vrml2_node.cpp @@ -28,7 +28,9 @@ #include #include #include +#include #include +#include #include "vrml2_node.h" @@ -195,8 +197,12 @@ void WRL2NODE::delNodeRef( WRL2NODE* aNode ) } #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] delNodeRef() did not find its target\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] delNodeRef() did not find its target"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return; @@ -231,8 +237,12 @@ bool WRL2NODE::SetName( const std::string& aName ) if( item != badNames.end() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid node name '" << *item << "' (matches restricted word)\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid node name '" << *item << "' (matches restricted word)"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -242,8 +252,12 @@ bool WRL2NODE::SetName( const std::string& aName ) if( isdigit( aName[0] ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid node name '" << *item << "' (begins with digit)\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid node name '" << *item << "' (begins with digit)"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -260,9 +274,13 @@ bool WRL2NODE::SetName( const std::string& aName ) || std::string::npos != aName.find_first_of( BAD_CHARS2 ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid node name '" << aName; - std::cerr<< "' (contains invalid character)\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid node name '" << aName; + ostr << "' (contains invalid character)"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -364,8 +382,12 @@ bool WRL2NODE::AddChildNode( WRL2NODE* aNode ) if( aNode->GetNodeType() == WRL2_BASE ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] attempting to add a base node to another node\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] attempting to add a base node to another node"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -396,8 +418,12 @@ bool WRL2NODE::AddRefNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed as node pointer\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed as node pointer"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -406,8 +432,12 @@ bool WRL2NODE::AddRefNode( WRL2NODE* aNode ) if( aNode->GetNodeType() == WRL2_BASE ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] attempting to add a base node ref to another base node\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] attempting to add a base node ref to another base node"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; diff --git a/plugins/3d/vrml/v2/vrml2_norms.cpp b/plugins/3d/vrml/v2/vrml2_norms.cpp index a75622a6f4..85f44f70b4 100644 --- a/plugins/3d/vrml/v2/vrml2_norms.cpp +++ b/plugins/3d/vrml/v2/vrml2_norms.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml2_base.h" #include "vrml2_norms.h" @@ -50,7 +52,7 @@ WRL2NORMS::WRL2NORMS( WRL2NODE* aParent ) : WRL2NODE() WRL2NORMS::~WRL2NORMS() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 3 ) - std::cerr << " * [INFO] Destroying Normal node\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying Normal node\n" ); #endif return; @@ -73,8 +75,12 @@ bool WRL2NORMS::AddRefNode( WRL2NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddRefNode is not applicable\n"; + do { + std::ostringstream ostr; + ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr<< " * [BUG] AddRefNode is not applicable"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -86,8 +92,12 @@ bool WRL2NORMS::AddChildNode( WRL2NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddChildNode is not applicable\n"; + do { + std::ostringstream ostr; + ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr<< " * [BUG] AddChildNode is not applicable"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -104,9 +114,13 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr<< " * [INFO] bad file format; unexpected eof at line "; + ostr<< line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -115,10 +129,14 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr<< proc.GetError() << "\n"; + ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr<< " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -136,8 +154,12 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr<< proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -151,11 +173,15 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadMFVec3f( vectors ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid vector set at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr<< " * [INFO] invalid vector set at line " << line << ", column "; + ostr<< column << "\n"; + ostr<< " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr<< " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -164,10 +190,14 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode ) else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Normal at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr<< " * [INFO] bad Normal at line " << line << ", column "; + ostr<< column << "\n"; + ostr<< " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -182,10 +212,14 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode ) proc.GetFilePosData( line, column ); #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Normal at line " << line << ", column "; - std::cerr << column << " (no closing brace)\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr<< " * [INFO] bad Normal at line " << line << ", column "; + ostr<< column << " (no closing brace)\n"; + ostr<< " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; diff --git a/plugins/3d/vrml/v2/vrml2_pointset.cpp b/plugins/3d/vrml/v2/vrml2_pointset.cpp index e7d10e1f83..792324bed3 100644 --- a/plugins/3d/vrml/v2/vrml2_pointset.cpp +++ b/plugins/3d/vrml/v2/vrml2_pointset.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml2_base.h" #include "vrml2_pointset.h" @@ -56,9 +58,13 @@ WRL2POINTSET::WRL2POINTSET( WRL2NODE* aParent ) : WRL2NODE() WRL2POINTSET::~WRL2POINTSET() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Destroying PointSet with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Destroying PointSet with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references and "; + ostr << m_BackPointers.size() << " backpointers"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return; @@ -109,8 +115,12 @@ bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed for aNode\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed for aNode"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -121,9 +131,13 @@ bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode ) if( !checkNodeType( type ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected child node '"; - std::cerr << aNode->GetNodeTypeName( type ) << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected child node '"; + ostr << aNode->GetNodeTypeName( type ) << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -134,8 +148,12 @@ bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode ) if( NULL != color ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple color nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple color nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -150,8 +168,12 @@ bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode ) if( NULL != coord ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple coordinate nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple coordinate nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -170,8 +192,12 @@ bool WRL2POINTSET::AddChildNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed for aNode\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed for aNode"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -182,9 +208,13 @@ bool WRL2POINTSET::AddChildNode( WRL2NODE* aNode ) if( !checkNodeType( type ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected child node '"; - std::cerr << aNode->GetNodeTypeName( type ) << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected child node '"; + ostr << aNode->GetNodeTypeName( type ) << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -195,8 +225,12 @@ bool WRL2POINTSET::AddChildNode( WRL2NODE* aNode ) if( NULL != color ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple color nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple color nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -211,8 +245,12 @@ bool WRL2POINTSET::AddChildNode( WRL2NODE* aNode ) if( NULL != coord ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple coordinate nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple coordinate nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -237,9 +275,13 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -248,10 +290,14 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -271,8 +317,12 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -289,8 +339,12 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read color node information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read color node information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -301,8 +355,12 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read coord node information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read coord node information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -311,10 +369,14 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode ) else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad PointSet at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad PointSet at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; diff --git a/plugins/3d/vrml/v2/vrml2_shape.cpp b/plugins/3d/vrml/v2/vrml2_shape.cpp index e5714f1a24..9360e37d05 100644 --- a/plugins/3d/vrml/v2/vrml2_shape.cpp +++ b/plugins/3d/vrml/v2/vrml2_shape.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml2_base.h" #include "vrml2_shape.h" @@ -56,9 +58,13 @@ WRL2SHAPE::WRL2SHAPE( WRL2NODE* aParent ) : WRL2NODE() WRL2SHAPE::~WRL2SHAPE() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Destroying Shape with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Destroying Shape with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references and "; + ostr << m_BackPointers.size() << " backpointers"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return; @@ -85,8 +91,12 @@ bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed for aNode\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed for aNode"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -97,9 +107,13 @@ bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode ) if( !checkNodeType( type ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected child node '"; - std::cerr << aNode->GetNodeTypeName( type ) << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected child node '"; + ostr << aNode->GetNodeTypeName( type ) << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -110,8 +124,12 @@ bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode ) if( NULL != appearance ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple appearance nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple appearance nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -124,8 +142,12 @@ bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode ) if( NULL != geometry ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple geometry nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple geometry nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -141,8 +163,12 @@ bool WRL2SHAPE::AddChildNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed for aNode\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed for aNode"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -153,9 +179,13 @@ bool WRL2SHAPE::AddChildNode( WRL2NODE* aNode ) if( !checkNodeType( type ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected child node '"; - std::cerr << aNode->GetNodeTypeName( type ) << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected child node '"; + ostr << aNode->GetNodeTypeName( type ) << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -166,8 +196,12 @@ bool WRL2SHAPE::AddChildNode( WRL2NODE* aNode ) if( NULL != appearance ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple appearance nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple appearance nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -180,8 +214,12 @@ bool WRL2SHAPE::AddChildNode( WRL2NODE* aNode ) if( NULL != geometry ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; multiple geometry nodes\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; multiple geometry nodes"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -223,8 +261,12 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( NULL == aTopNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] aTopNode is NULL\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] aTopNode is NULL"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -238,9 +280,13 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -249,10 +295,14 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -272,8 +322,12 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -290,8 +344,12 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read appearance information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read appearance information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -302,8 +360,12 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not read geometry information\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] could not read geometry information"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -312,10 +374,14 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode ) else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Shape at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Shape at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -346,9 +412,13 @@ SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent ) } #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Translating Shape with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Translating Shape with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references and "; + ostr << m_BackPointers.size() << " backpointers"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif bool vcolors = false; @@ -371,9 +441,13 @@ SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent ) if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Shape does not have a Transform parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] Shape does not have a Transform parent (parent ID: "; + ostr << ptype << ")"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return NULL; diff --git a/plugins/3d/vrml/v2/vrml2_switch.cpp b/plugins/3d/vrml/v2/vrml2_switch.cpp index c49039c82c..f3f0f57dca 100644 --- a/plugins/3d/vrml/v2/vrml2_switch.cpp +++ b/plugins/3d/vrml/v2/vrml2_switch.cpp @@ -22,6 +22,8 @@ */ #include +#include +#include #include "vrml2_base.h" #include "vrml2_switch.h" @@ -53,9 +55,13 @@ WRL2SWITCH::WRL2SWITCH( WRL2NODE* aParent ) : WRL2NODE() WRL2SWITCH::~WRL2SWITCH() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Destroying Switch with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Destroying Switch with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references and "; + ostr << m_BackPointers.size() << " backpointers"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return; @@ -84,8 +90,12 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( NULL == aTopNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] aTopNode is NULL\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] aTopNode is NULL"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -99,9 +109,13 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -110,10 +124,14 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -133,8 +151,12 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -151,11 +173,15 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFInt( whichChoice ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid whichChoice at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid whichChoice at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -169,10 +195,14 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode ) else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Switch at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Switch at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -188,8 +218,12 @@ bool WRL2SWITCH::AddRefNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed as node pointer\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed as node pointer"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -227,9 +261,13 @@ bool WRL2SWITCH::readChildren( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -281,15 +319,19 @@ bool WRL2SWITCH::readChildren( WRLPROC& proc, WRL2BASE* aTopNode ) SGNODE* WRL2SWITCH::TranslateToSG( SGNODE* aParent ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Translating Switch with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Translating Switch with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references and "; + ostr << m_BackPointers.size() << " backpointers"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif if( choices.empty() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Switch translation: no choices\n"; + wxLogTrace( MASK_VRML, " * [INFO] Switch translation: no choices\n" ); #endif return NULL; @@ -300,9 +342,13 @@ SGNODE* WRL2SWITCH::TranslateToSG( SGNODE* aParent ) if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Switch does not have a Transform parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] Switch does not have a Transform parent (parent ID: "; + ostr << ptype << ")"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return NULL; @@ -311,8 +357,12 @@ SGNODE* WRL2SWITCH::TranslateToSG( SGNODE* aParent ) if( whichChoice < 0 || whichChoice >= (int)choices.size() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Switch translation: no choice (choices = "; - std::cerr << choices.size() << "), whichChoice = " << whichChoice << "\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Switch translation: no choice (choices = "; + ostr << choices.size() << "), whichChoice = " << whichChoice; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return NULL; diff --git a/plugins/3d/vrml/v2/vrml2_transform.cpp b/plugins/3d/vrml/v2/vrml2_transform.cpp index c579667d47..7486315980 100644 --- a/plugins/3d/vrml/v2/vrml2_transform.cpp +++ b/plugins/3d/vrml/v2/vrml2_transform.cpp @@ -22,6 +22,8 @@ */ #include +#include +#include #include "vrml2_base.h" #include "vrml2_transform.h" @@ -50,9 +52,13 @@ WRL2TRANSFORM::WRL2TRANSFORM( WRL2NODE* aParent ) : WRL2NODE() WRL2TRANSFORM::~WRL2TRANSFORM() { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Destroying Transform with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Destroying Transform with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references and "; + ostr << m_BackPointers.size() << " backpointers"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return; @@ -89,8 +95,12 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( NULL == aTopNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] aTopNode is NULL\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] aTopNode is NULL"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -123,9 +133,13 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -134,10 +148,14 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\n"; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; expecting '{' but got '" << tok; + ostr << "' at line " << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -157,8 +175,12 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -179,11 +201,15 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFVec3f( center ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid center at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid center at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -199,11 +225,15 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFRotation( rotation ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid rotation at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid rotation at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -214,11 +244,15 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFVec3f( scale ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid scale at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid scale at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -229,11 +263,15 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFRotation( scaleOrientation ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid scaleOrientation at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid scaleOrientation at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -244,11 +282,15 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode ) if( !proc.ReadSFVec3f( translation ) ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid translation at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid translation at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + ostr << " * [INFO] message: '" << proc.GetError() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -267,10 +309,14 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode ) else { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Transform at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad Transform at line " << line << ", column "; + ostr << column << "\n"; + ostr << " * [INFO] file: '" << proc.GetFileName() << "'"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -286,8 +332,12 @@ bool WRL2TRANSFORM::AddRefNode( WRL2NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed as node pointer\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] NULL passed as node pointer"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -327,9 +377,13 @@ bool WRL2TRANSFORM::readChildren( WRLPROC& proc, WRL2BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] bad file format; unexpected eof at line "; + ostr << line << ", column " << column; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -373,9 +427,13 @@ bool WRL2TRANSFORM::readChildren( WRLPROC& proc, WRL2BASE* aTopNode ) SGNODE* WRL2TRANSFORM::TranslateToSG( SGNODE* aParent ) { #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) - std::cerr << " * [INFO] Translating Transform with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Translating Transform with " << m_Children.size(); + ostr << " children, " << m_Refs.size() << " references and "; + ostr << m_BackPointers.size() << " backpointers"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif if( m_Children.empty() && m_Refs.empty() ) @@ -386,9 +444,13 @@ SGNODE* WRL2TRANSFORM::TranslateToSG( SGNODE* aParent ) if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM ) { #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Transform does not have a Transform parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] Transform does not have a Transform parent (parent ID: "; + ostr << ptype << ")"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return NULL;