Changed PNS debug output to use wxLogTrace

This commit is contained in:
Maciej Suminski 2016-08-15 17:16:54 +02:00
parent 41b75f0105
commit 7e94e5282a
7 changed files with 28 additions and 30 deletions

View File

@ -182,17 +182,16 @@ private:
class PNS_DP_GATEWAYS class PNS_DP_GATEWAYS
{ {
public: public:
PNS_DP_GATEWAYS ( int aGap ): PNS_DP_GATEWAYS( int aGap ):
m_gap(aGap), m_viaGap( aGap ) m_gap( aGap ), m_viaGap( aGap )
{ {
// Do not leave unitialized members, and keep static analyser quiet: // Do not leave unitialized members, and keep static analyser quiet:
m_viaDiameter = 0; m_viaDiameter = 0;
m_fitVias = true; m_fitVias = true;
} }
void SetGap ( int aGap ) void SetGap( int aGap )
{ {
m_gap = aGap; m_gap = aGap;
m_viaGap = aGap; m_viaGap = aGap;
@ -203,7 +202,7 @@ class PNS_DP_GATEWAYS
m_gateways.clear(); m_gateways.clear();
} }
void SetFitVias ( bool aEnable, int aDiameter = 0, int aViaGap = -1 ) void SetFitVias( bool aEnable, int aDiameter = 0, int aViaGap = -1 )
{ {
m_fitVias = aEnable; m_fitVias = aEnable;
m_viaDiameter = aDiameter; m_viaDiameter = aDiameter;
@ -214,12 +213,12 @@ class PNS_DP_GATEWAYS
} }
void BuildForCursor ( const VECTOR2I& aCursorPos ); void BuildForCursor( const VECTOR2I& aCursorPos );
void BuildOrthoProjections ( PNS_DP_GATEWAYS &aEntries, const VECTOR2I& aCursorPos, int aOrthoScore ); void BuildOrthoProjections( PNS_DP_GATEWAYS &aEntries, const VECTOR2I& aCursorPos, int aOrthoScore );
void BuildGeneric ( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool aBuildEntries = false, bool aViaMode = false ); void BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool aBuildEntries = false, bool aViaMode = false );
void BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal ); void BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal );
bool FitGateways ( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTarget, bool aPrefDiagonal, PNS_DIFF_PAIR& aDp ); bool FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTarget, bool aPrefDiagonal, PNS_DIFF_PAIR& aDp );
std::vector<PNS_DP_GATEWAY>& Gateways() std::vector<PNS_DP_GATEWAY>& Gateways()
{ {
@ -234,7 +233,6 @@ class PNS_DP_GATEWAYS
void FilterByOrientation( int aAngleMask, DIRECTION_45 aRefOrientation ); void FilterByOrientation( int aAngleMask, DIRECTION_45 aRefOrientation );
private: private:
struct DP_CANDIDATE struct DP_CANDIDATE
{ {
SHAPE_LINE_CHAIN p, n; SHAPE_LINE_CHAIN p, n;

View File

@ -474,7 +474,7 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI
{ {
int netP, netN; int netP, netN;
printf( "world %p\n", m_world ); wxLogTrace( "PNS", "world %p\n", m_world );
bool result = m_world->GetRuleResolver()->DpNetPair( aItem, netP, netN ); bool result = m_world->GetRuleResolver()->DpNetPair( aItem, netP, netN );
@ -484,12 +484,12 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI
int refNet = aItem->Net(); int refNet = aItem->Net();
int coupledNet = ( refNet == netP ) ? netN : netP; int coupledNet = ( refNet == netP ) ? netN : netP;
printf( "result %d\n", !!result ); wxLogTrace( "PNS", "result %d\n", !!result );
OPT_VECTOR2I refAnchor = getDanglingAnchor( m_currentNode, aItem ); OPT_VECTOR2I refAnchor = getDanglingAnchor( m_currentNode, aItem );
PNS_ITEM* primRef = aItem; PNS_ITEM* primRef = aItem;
printf( "refAnchor %p\n", aItem ); wxLogTrace( "PNS", "refAnchor %p\n", aItem );
if( !refAnchor ) if( !refAnchor )
return false; return false;

View File

@ -266,12 +266,12 @@ bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNet
netNameP = netNameCoupled; netNameP = netNameCoupled;
} }
// printf("p %s n %s base %s\n", (const char *)netNameP.c_str(), (const char *)netNameN.c_str(), (const char *)netNameBase.c_str() ); // wxLogTrace( "PNS","p %s n %s base %s\n", (const char *)netNameP.c_str(), (const char *)netNameN.c_str(), (const char *)netNameBase.c_str() );
NETINFO_ITEM* netInfoP = m_board->FindNet( netNameP ); NETINFO_ITEM* netInfoP = m_board->FindNet( netNameP );
NETINFO_ITEM* netInfoN = m_board->FindNet( netNameN ); NETINFO_ITEM* netInfoN = m_board->FindNet( netNameN );
//printf("ip %p in %p\n", netInfoP, netInfoN); //wxLogTrace( "PNS","ip %p in %p\n", netInfoP, netInfoN);
if( !netInfoP || !netInfoN ) if( !netInfoP || !netInfoN )
return false; return false;
@ -771,7 +771,7 @@ void PNS_KICAD_IFACE::EraseView()
void PNS_KICAD_IFACE::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClearance ) void PNS_KICAD_IFACE::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClearance )
{ {
printf( "DisplayItem %p\n", aItem ); wxLogTrace( "PNS", "DisplayItem %p\n", aItem );
ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( aItem, m_previewItems ); ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( aItem, m_previewItems );
@ -878,7 +878,7 @@ void PNS_KICAD_IFACE::Commit()
void PNS_KICAD_IFACE::SetView( KIGFX::VIEW *aView ) void PNS_KICAD_IFACE::SetView( KIGFX::VIEW *aView )
{ {
printf( "SetView %p\n", aView ); wxLogTrace( "PNS", "SetView %p\n", aView );
if( m_previewItems ) if( m_previewItems )
{ {
@ -901,7 +901,7 @@ void PNS_KICAD_IFACE::SetView( KIGFX::VIEW *aView )
void PNS_KICAD_IFACE::UpdateNet( int aNetCode ) void PNS_KICAD_IFACE::UpdateNet( int aNetCode )
{ {
printf( "Update-net %d\n", aNetCode ); wxLogTrace( "PNS", "Update-net %d\n", aNetCode );
} }
PNS_RULE_RESOLVER* PNS_KICAD_IFACE::GetRuleResolver() PNS_RULE_RESOLVER* PNS_KICAD_IFACE::GetRuleResolver()

View File

@ -341,14 +341,14 @@ void PNS_LINE::ShowLinks()
{ {
if( !m_segmentRefs ) if( !m_segmentRefs )
{ {
printf( "line %p: no links\n", this ); wxLogTrace( "PNS", "line %p: no links\n", this );
return; return;
} }
printf( "line %p: %d linked segs\n", this, (int) m_segmentRefs->size() ); wxLogTrace( "PNS", "line %p: %d linked segs\n", this, (int) m_segmentRefs->size() );
for( int i = 0; i < (int) m_segmentRefs->size(); i++ ) for( int i = 0; i < (int) m_segmentRefs->size(); i++ )
printf( "seg %d: %p\n", i, (*m_segmentRefs)[i] ); wxLogTrace( "PNS", "seg %d: %p\n", i, (*m_segmentRefs)[i] );
} }
SHAPE_LINE_CHAIN dragCornerInternal( const SHAPE_LINE_CHAIN& aOrigin, const VECTOR2I& aP ) SHAPE_LINE_CHAIN dragCornerInternal( const SHAPE_LINE_CHAIN& aOrigin, const VECTOR2I& aP )

View File

@ -196,7 +196,7 @@ void PNS_LOGGER::Save( const std::string& aFilename )
EndGroup(); EndGroup();
FILE* f = fopen( aFilename.c_str(), "wb" ); FILE* f = fopen( aFilename.c_str(), "wb" );
printf( "Saving to '%s' [%p]\n", aFilename.c_str(), f ); wxLogTrace( "PNS", "Saving to '%s' [%p]\n", aFilename.c_str(), f );
const std::string s = m_theLog.str(); const std::string s = m_theLog.str();
fwrite( s.c_str(), 1, s.length(), f ); fwrite( s.c_str(), 1, s.length(), f );
fclose( f ); fclose( f );

View File

@ -1022,7 +1022,7 @@ PNS_JOINT& PNS_NODE::touchJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLaye
void PNS_JOINT::Dump() const void PNS_JOINT::Dump() const
{ {
printf( "joint layers %d-%d, net %d, pos %s, links: %d\n", m_layers.Start(), wxLogTrace( "PNS", "joint layers %d-%d, net %d, pos %s, links: %d\n", m_layers.Start(),
m_layers.End(), m_tag.net, m_tag.pos.Format().c_str(), LinkCount() ); m_layers.End(), m_tag.net, m_tag.pos.Format().c_str(), LinkCount() );
} }
@ -1072,7 +1072,7 @@ void PNS_NODE::Dump( bool aLong )
if( aLong ) if( aLong )
for( j = m_joints.begin(); j != m_joints.end(); ++j ) for( j = m_joints.begin(); j != m_joints.end(); ++j )
{ {
printf( "joint : %s, links : %d\n", wxLogTrace( "PNS", "joint : %s, links : %d\n",
j->second.GetPos().Format().c_str(), j->second.LinkCount() ); j->second.GetPos().Format().c_str(), j->second.LinkCount() );
PNS_JOINT::LINKED_ITEMS::const_iterator k; PNS_JOINT::LINKED_ITEMS::const_iterator k;
@ -1085,7 +1085,7 @@ void PNS_NODE::Dump( bool aLong )
case PNS_ITEM::SEGMENT: case PNS_ITEM::SEGMENT:
{ {
const PNS_SEGMENT* seg = static_cast<const PNS_SEGMENT*>( m_item ); const PNS_SEGMENT* seg = static_cast<const PNS_SEGMENT*>( m_item );
printf( " -> seg %s %s\n", seg->GetSeg().A.Format().c_str(), wxLogTrace( "PNS", " -> seg %s %s\n", seg->GetSeg().A.Format().c_str(),
seg->GetSeg().B.Format().c_str() ); seg->GetSeg().B.Format().c_str() );
break; break;
} }
@ -1107,14 +1107,14 @@ void PNS_NODE::Dump( bool aLong )
PNS_LINE::LinkedSegments* seg_refs = l->GetLinkedSegments(); PNS_LINE::LinkedSegments* seg_refs = l->GetLinkedSegments();
if( aLong ) if( aLong )
printf( "Line: %s, net %d ", l->GetLine().Format().c_str(), l->GetNet() ); wxLogTrace( "PNS", "Line: %s, net %d ", l->GetLine().Format().c_str(), l->GetNet() );
for( std::vector<PNS_SEGMENT*>::iterator j = seg_refs->begin(); j != seg_refs->end(); ++j ) for( std::vector<PNS_SEGMENT*>::iterator j = seg_refs->begin(); j != seg_refs->end(); ++j )
{ {
printf( "%s ", (*j)->GetSeg().A.Format().c_str() ); wxLogTrace( "PNS", "%s ", (*j)->GetSeg().A.Format().c_str() );
if( j + 1 == seg_refs->end() ) if( j + 1 == seg_refs->end() )
printf( "%s\n", (*j)->GetSeg().B.Format().c_str() ); wxLogTrace( "PNS", "%s\n", (*j)->GetSeg().B.Format().c_str() );
all_segs.erase( *j ); all_segs.erase( *j );
} }
@ -1122,7 +1122,7 @@ void PNS_NODE::Dump( bool aLong )
lines_count++; lines_count++;
} }
printf( "Local joints: %d, lines : %d \n", m_joints.size(), lines_count ); wxLogTrace( "PNS", "Local joints: %d, lines : %d \n", m_joints.size(), lines_count );
#endif #endif
} }

View File

@ -1290,7 +1290,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR
{ {
if( aNewVia ) if( aNewVia )
{ {
printf("setNewV %p", m_draggedVia); wxLogTrace( "PNS","setNewV %p", m_draggedVia);
*aNewVia = m_draggedVia; *aNewVia = m_draggedVia;
} }