Commit 84a14c3a authored by Dick Hollenbeck's avatar Dick Hollenbeck

back annotation when CVPCB and EESCHEMA are running under KICAD

parent d6a8696a
...@@ -83,7 +83,11 @@ inline void scanAtom( PTREE* aTree, DSNLEXER* aLexer ) ...@@ -83,7 +83,11 @@ inline void scanAtom( PTREE* aTree, DSNLEXER* aLexer )
//D(printf( "%s: '%s'\n", __func__, key );) //D(printf( "%s: '%s'\n", __func__, key );)
#if 0
aTree->push_back( PTREE::value_type( key, PTREE() ) ); aTree->push_back( PTREE::value_type( key, PTREE() ) );
#else
aTree->put_value( key );
#endif
} }
...@@ -190,7 +194,7 @@ static void formatNode( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, ...@@ -190,7 +194,7 @@ static void formatNode( OUTPUTFORMATTER* out, int aNestLevel, int aCtl,
out->Print( aNestLevel, "(%s%s", out->Quotes( aKey ).c_str(), ctl & CTL_OMIT_NL ? "" : "\n" ); out->Print( aNestLevel, "(%s%s", out->Quotes( aKey ).c_str(), ctl & CTL_OMIT_NL ? "" : "\n" );
if( aTree.data().size() ) // only xml typically uses "data()", not sexpr. if( aTree.data().size() )
{ {
out->Print( 0, " %s%s", out->Print( 0, " %s%s",
out->Quotes( aTree.data() ).c_str(), out->Quotes( aTree.data() ).c_str(),
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <kiway.h>
#include <common.h> #include <common.h>
#include <confirm.h> #include <confirm.h>
#include <build_version.h> #include <build_version.h>
...@@ -343,6 +344,11 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName ) ...@@ -343,6 +344,11 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
if( !fn.HasExt() ) if( !fn.HasExt() )
fn.SetExt( ComponentFileExtension ); fn.SetExt( ComponentFileExtension );
#if 0 // RHH 6-Jul-14: We did not auto generate the
// footprint table. And the dialog which does suppport editing does the saving.
// Besides, this is not the place to do this, it belies the name of this
// function.
// Save the project specific footprint library table. // Save the project specific footprint library table.
if( !Prj().PcbFootprintLibs()->IsEmpty( false ) ) if( !Prj().PcbFootprintLibs()->IsEmpty( false ) )
{ {
...@@ -368,6 +374,8 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName ) ...@@ -368,6 +374,8 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
} }
} }
} }
#endif
} }
if( !IsWritable( fn.GetFullPath() ) ) if( !IsWritable( fn.GetFullPath() ) )
...@@ -380,6 +388,16 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName ) ...@@ -380,6 +388,16 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
} }
wxString msg = wxString::Format( _("File %s saved"), GetChars( fn.GetFullPath() ) ); wxString msg = wxString::Format( _("File %s saved"), GetChars( fn.GetFullPath() ) );
// Perhaps this replaces all of the above someday.
{
STRING_FORMATTER sf;
m_netlist.FormatBackAnnotation( &sf );
Kiway().ExpressMail( FRAME_SCH, MAIL_BACKANNOTATE_FOOTPRINTS, sf.GetString() );
}
SetStatusText( msg ); SetStatusText( msg );
return 1; return 1;
} }
...@@ -42,15 +42,84 @@ ...@@ -42,15 +42,84 @@
#include <sch_component.h> #include <sch_component.h>
#include <netlist.h> #include <netlist.h>
#include <dsnlexer.h>
#include <ptree.h>
#include <boost/property_tree/ptree.hpp>
bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename, void SCH_EDIT_FRAME::backAnnotateFootprints( const std::string& aChangedSetOfReferences ) throw( IO_ERROR )
{
// Build a flat list of components in schematic:
SCH_REFERENCE_LIST refs;
SCH_SHEET_LIST sheets;
bool isChanged = false;
sheets.GetComponents( refs, false );
static const KEYWORD empty_keywords[1] = {};
DSNLEXER lexer( empty_keywords, 0, aChangedSetOfReferences, FROM_UTF8( __func__ ) );
PTREE doc;
Scan( &doc, &lexer );
#if defined(DEBUG) && 0
STRING_FORMATTER sf;
Format( &sf, 0, 0, doc );
printf( "%s: '%s'\n", __func__, sf.GetString().c_str() );
#endif
CPTREE& back_anno = doc.get_child( "back_annotation" );
for( PTREE::const_iterator ref = back_anno.begin(); ref != back_anno.end(); ++ref )
{
wxASSERT( ref->first == "ref" );
wxString reference = (UTF8&) ref->second.data();
wxString footprint = (UTF8) ref->second.get<std::string>( "fpid" );
// DBG( printf( "%s: ref:%s fpid:%s\n", __func__, TO_UTF8( reference ), TO_UTF8( footprint ) ); )
// Search the component in the flat list
for( unsigned ii = 0; ii < refs.GetCount(); ++ii )
{
if( Cmp_KEEPCASE( reference, refs[ii].GetRef() ) == 0 )
{
// We have found a candidate.
// Note: it can be not unique (multiple parts per package)
// So we *do not* stop the search here
SCH_COMPONENT* component = refs[ii].GetComponent();
SCH_FIELD* fpfield = component->GetField( FOOTPRINT );
const wxString& oldfp = fpfield->GetText();
if( !oldfp && fpfield->IsVisible() )
{
fpfield->SetVisible( false );
}
// DBG( printf("%s: ref:%s fpid:%s\n", __func__, TO_UTF8( refs[ii].GetRef() ), TO_UTF8( footprint ) );)
fpfield->SetText( footprint );
if( oldfp != footprint )
isChanged = true;
}
}
}
if( isChanged )
OnModify();
}
bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( const wxString& aFullFilename,
bool aForceFieldsVisibleAttribute, bool aForceFieldsVisibleAttribute,
bool aFieldsVisibleAttributeState ) bool aFieldsVisibleAttributeState )
{ {
// Build a flat list of components in schematic: // Build a flat list of components in schematic:
SCH_REFERENCE_LIST referencesList; SCH_REFERENCE_LIST referencesList;
SCH_SHEET_LIST SheetList; SCH_SHEET_LIST SheetList;
SheetList.GetComponents( referencesList, false ); SheetList.GetComponents( referencesList, false );
FILE* cmpFile = wxFopen( aFullFilename, wxT( "rt" ) ); FILE* cmpFile = wxFopen( aFullFilename, wxT( "rt" ) );
...@@ -71,7 +140,7 @@ bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename, ...@@ -71,7 +140,7 @@ bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename,
{ {
buffer = FROM_UTF8( cmpFileReader.Line() ); buffer = FROM_UTF8( cmpFileReader.Line() );
if( ! buffer.StartsWith( wxT("BeginCmp") ) ) if( !buffer.StartsWith( wxT("BeginCmp") ) )
continue; continue;
// Begin component description. // Begin component description.
...@@ -87,20 +156,17 @@ bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename, ...@@ -87,20 +156,17 @@ bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename,
// store string value, stored between '=' and ';' delimiters. // store string value, stored between '=' and ';' delimiters.
value = buffer.AfterFirst( '=' ); value = buffer.AfterFirst( '=' );
value = value.BeforeLast( ';'); value = value.BeforeLast( ';' );
value.Trim(true); value.Trim(true);
value.Trim(false); value.Trim(false);
if( buffer.StartsWith( wxT("Reference") ) ) if( buffer.StartsWith( wxT("Reference") ) )
{ {
reference = value; reference = value;
continue;
} }
else if( buffer.StartsWith( wxT("IdModule =" ) ) )
if( buffer.StartsWith( wxT("IdModule =" ) ) )
{ {
footprint = value; footprint = value;
continue;
} }
} }
...@@ -108,16 +174,18 @@ bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename, ...@@ -108,16 +174,18 @@ bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename,
// if the footprint name is not empty // if the footprint name is not empty
if( reference.IsEmpty() ) if( reference.IsEmpty() )
continue; continue;
// Search the component in the flat list // Search the component in the flat list
for( unsigned ii = 0; ii < referencesList.GetCount(); ii++ ) for( unsigned ii = 0; ii < referencesList.GetCount(); ii++ )
{ {
if( reference.CmpNoCase( referencesList[ii].GetRef() ) == 0 ) if( Cmp_KEEPCASE( reference, referencesList[ii].GetRef() ) == 0 )
{ {
// We have found a candidate. // We have found a candidate.
// Note: it can be not unique (multiple parts per package) // Note: it can be not unique (multiple parts per package)
// So we *do not* stop the search here // So we *do not* stop the search here
SCH_COMPONENT* component = referencesList[ii].GetComponent(); SCH_COMPONENT* component = referencesList[ii].GetComponent();
SCH_FIELD * fpfield = component->GetField( FOOTPRINT ); SCH_FIELD* fpfield = component->GetField( FOOTPRINT );
fpfield->SetText( footprint ); fpfield->SetText( footprint );
if( aForceFieldsVisibleAttribute ) if( aForceFieldsVisibleAttribute )
...@@ -128,6 +196,7 @@ bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename, ...@@ -128,6 +196,7 @@ bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename,
} }
} }
} }
return true; return true;
} }
...@@ -170,10 +239,12 @@ bool SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile() ...@@ -170,10 +239,12 @@ bool SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile()
visible = response == wxYES; visible = response == wxYES;
} }
if( ! ProcessCmpToFootprintLinkFile( filename, changevisibility, visible ) ) if( !ProcessCmpToFootprintLinkFile( filename, changevisibility, visible ) )
{ {
wxString msg; wxString msg = wxString::Format( _(
msg.Printf( _( "Failed to open component-footprint link file <%s>" ), filename.GetData() ); "Failed to open component-footprint link file '%s'" ),
filename.GetData()
);
DisplayError( this, msg ); DisplayError( this, msg );
return false; return false;
} }
......
...@@ -196,8 +196,20 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) ...@@ -196,8 +196,20 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
ExecuteRemoteCommand( payload.c_str() ); ExecuteRemoteCommand( payload.c_str() );
break; break;
case MAIL_BACKANNOTATE_FOOTPRINTS:
try
{
backAnnotateFootprints( payload );
}
catch( const IO_ERROR& ioe )
{
DBG( printf( "%s: ioe:%s\n", __func__, TO_UTF8( ioe.errorText ) );)
}
break;
// many many others. // many many others.
} }
} }
...@@ -39,9 +39,6 @@ class OUTPUTFORMATTER; ...@@ -39,9 +39,6 @@ class OUTPUTFORMATTER;
class MODULE; class MODULE;
class FP_LIB_TABLE_LEXER; class FP_LIB_TABLE_LEXER;
class FPID; class FPID;
class NETLIST;
class REPORTER;
class SEARCH_STACK;
/** /**
* Class FP_LIB_TABLE * Class FP_LIB_TABLE
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
enum MAIL_T enum MAIL_T
{ {
MAIL_CROSS_PROBE, ///< PCB<->SCH, CVPCB->SCH cross-probing. MAIL_CROSS_PROBE, ///< PCB<->SCH, CVPCB->SCH cross-probing.
MAIL_BACKANNOTATE_FOOTPRINTS, ///< CVPCB->SCH footprint stuffing at cvpcb termination
}; };
#endif // MAIL_TYPE_H_ #endif // MAIL_TYPE_H_
...@@ -202,6 +202,8 @@ protected: ...@@ -202,6 +202,8 @@ protected:
void updateFindReplaceView( wxFindDialogEvent& aEvent ); void updateFindReplaceView( wxFindDialogEvent& aEvent );
void backAnnotateFootprints( const std::string& aChangedSetOfReferences ) throw( IO_ERROR );
public: public:
SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ); SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
~SCH_EDIT_FRAME(); ~SCH_EDIT_FRAME();
...@@ -709,7 +711,7 @@ public: ...@@ -709,7 +711,7 @@ public:
* @param aFieldsVisibleAttributeState = footprint field flag visible new state * @param aFieldsVisibleAttributeState = footprint field flag visible new state
* @return bool = true if success. * @return bool = true if success.
*/ */
bool ProcessCmpToFootprintLinkFile( wxString& aFullFilename, bool ProcessCmpToFootprintLinkFile( const wxString& aFullFilename,
bool aForceFieldsVisibleAttribute, bool aForceFieldsVisibleAttribute,
bool aFieldsVisibleAttributeState ); bool aFieldsVisibleAttributeState );
......
...@@ -130,17 +130,15 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event ) ...@@ -130,17 +130,15 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event )
void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
{ {
/* List of file extensions to save. */ // List of file extensions to save.
static const wxChar* extentionList[] = { static const wxChar* extentionList[] = {
wxT( "*.sch" ), wxT( "*.lib" ), wxT( "*.mod" ), wxT( "*.cmp" ), wxT( "*.sch" ), wxT( "*.lib" ), wxT( "*.mod" ), wxT( "*.cmp" ),
wxT( "*.brd" ), wxT( "*.kicad_pcb" ), wxT( "*.gbr" ), wxT( "*.brd" ), wxT( "*.kicad_pcb" ), wxT( "*.gbr" ),
wxT( "*.net" ), wxT( "*.pro" ), wxT( "*.pho" ), wxT( "*.py" ), wxT( "*.net" ), wxT( "*.pro" ), wxT( "*.pho" ), wxT( "*.py" ),
wxT( "*.pdf" ), wxT( "*.txt" ), wxT( "*.dcm" ), wxT( "*.kicad_wks" ), wxT( "*.pdf" ), wxT( "*.txt" ), wxT( "*.dcm" ), wxT( "*.kicad_wks" ),
NULL
}; };
wxString msg; wxString msg;
size_t i;
wxFileName fileName = m_ProjectFileName; wxFileName fileName = m_ProjectFileName;
wxString oldPath = wxGetCwd(); wxString oldPath = wxGetCwd();
...@@ -153,7 +151,6 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event ) ...@@ -153,7 +151,6 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
wxFileName zip = dlg.GetPath(); wxFileName zip = dlg.GetPath();
wxString currdirname = wxT( "." ); wxString currdirname = wxT( "." );
...@@ -172,17 +169,21 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event ) ...@@ -172,17 +169,21 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
// Build list of filenames to put in zip archive // Build list of filenames to put in zip archive
wxString currFilename; wxString currFilename;
int zipBytesCnt = 0; // Size of the zip file int zipBytesCnt = 0; // Size of the zip file
for( i = 0; extentionList[i] != 0; i++ )
for( unsigned i = 0; i<DIM( extentionList ); i++ )
{ {
bool cont = dir.GetFirst( &currFilename, extentionList[i] ); bool cont = dir.GetFirst( &currFilename, extentionList[i] );
while( cont ) while( cont )
{ {
wxFileSystem fsfile; wxFileSystem fsfile;
msg.Printf(_( "Archive file <%s>" ), GetChars( currFilename ) ); msg.Printf(_( "Archive file <%s>" ), GetChars( currFilename ) );
PrintMsg( msg ); PrintMsg( msg );
// Read input file and put it in zip file: // Read input file and put it in zip file:
wxFSFile * infile = fsfile.OpenFile(currFilename); wxFSFile* infile = fsfile.OpenFile(currFilename);
if( infile ) if( infile )
{ {
zipstream.PutNextEntry( currFilename, infile->GetModificationTime() ); zipstream.PutNextEntry( currFilename, infile->GetModificationTime() );
......
...@@ -227,7 +227,8 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) ...@@ -227,7 +227,8 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
break; break;
// many many others. // many many others.
default:
;
} }
} }
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
//#include <pgm_base.h>
#include <project.h> #include <project.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <confirm.h> #include <confirm.h>
...@@ -435,9 +434,16 @@ bool DIALOG_NETLIST::verifyFootprints( const wxString& aNetlistFilename, ...@@ -435,9 +434,16 @@ bool DIALOG_NETLIST::verifyFootprints( const wxString& aNetlistFilename,
#if defined( DEBUG ) #if defined( DEBUG )
{
m_MessageWindow->Clear(); m_MessageWindow->Clear();
WX_TEXT_CTRL_REPORTER rpt( m_MessageWindow ); WX_TEXT_CTRL_REPORTER rpt( m_MessageWindow );
netlist.Show( 0, rpt );
STRING_FORMATTER sf;
netlist.Format( &sf, 0 );
rpt.Report( FROM_UTF8( sf.GetString().c_str() ) );
}
#endif #endif
BOARD* pcb = m_parent->GetBoard(); BOARD* pcb = m_parent->GetBoard();
......
...@@ -608,6 +608,9 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF ...@@ -608,6 +608,9 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
GetChars( pcbFileName.GetFullPath() ) )) ) GetChars( pcbFileName.GetFullPath() ) )) )
return false; return false;
#if 0 // RHH 6-Jul-14: I see no plausible reason to do this. We did not auto generate the
// footprint table. And the dialog which does suppport editing does the saving.
// Save the project specific footprint library table. // Save the project specific footprint library table.
if( !Prj().PcbFootprintLibs()->IsEmpty( false ) ) if( !Prj().PcbFootprintLibs()->IsEmpty( false ) )
{ {
...@@ -633,6 +636,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF ...@@ -633,6 +636,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
} }
} }
} }
#endif
} }
else else
{ {
...@@ -640,7 +645,6 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF ...@@ -640,7 +645,6 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
if( pcbFileName.GetExt() == LegacyPcbFileExtension ) if( pcbFileName.GetExt() == LegacyPcbFileExtension )
pluginType = IO_MGR::LEGACY; pluginType = IO_MGR::LEGACY;
else
{ {
pluginType = IO_MGR::KICAD; pluginType = IO_MGR::KICAD;
pcbFileName.SetExt( KiCadPcbFileExtension ); pcbFileName.SetExt( KiCadPcbFileExtension );
......
...@@ -35,30 +35,12 @@ ...@@ -35,30 +35,12 @@
#include <class_module.h> #include <class_module.h>
#if defined(DEBUG) int COMPONENT_NET::Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl )
/**
* Function NestedSpace
* outputs nested space for pretty indenting.
* @param aNestLevel The nest count
* @param aReporter A reference to a #REPORTER object where to output.
* @return REPORTER& for continuation.
**/
static REPORTER& NestedSpace( int aNestLevel, REPORTER& aReporter )
{
for( int i = 0; i < aNestLevel; ++i )
aReporter.Report( wxT( " " ) );
return aReporter;
}
void COMPONENT_NET::Show( int aNestLevel, REPORTER& aReporter )
{ {
NestedSpace( aNestLevel, aReporter ); return aOut->Print( aNestLevel, "(pin_net %s %s)",
aReporter.Report( wxString::Format( wxT( "<pin_name=%s net_name=%s>\n" ), aOut->Quotew( m_pinName ).c_str(),
GetChars( m_pinName ), GetChars( m_netName ) ) ); aOut->Quotew( m_netName ).c_str() );
} }
#endif
void COMPONENT::SetModule( MODULE* aModule ) void COMPONENT::SetModule( MODULE* aModule )
...@@ -108,51 +90,66 @@ bool COMPONENT::MatchesFootprintFilters( const wxString& aFootprintName ) const ...@@ -108,51 +90,66 @@ bool COMPONENT::MatchesFootprintFilters( const wxString& aFootprintName ) const
} }
#if defined(DEBUG) void COMPONENT::Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl )
void COMPONENT::Show( int aNestLevel, REPORTER& aReporter )
{ {
NestedSpace( aNestLevel, aReporter ); int nl = aNestLevel;
aReporter.Report( wxT( "<component>\n" ) );
NestedSpace( aNestLevel+1, aReporter ); aOut->Print( nl, "(ref %s ", aOut->Quotew( m_reference ).c_str() );
aReporter.Report( wxString::Format( wxT( "<ref=%s value=%s name=%s library=%s fpid=%s " aOut->Print( 0, "(fpid %s)\n", m_fpid.Format().c_str() );
"timestamp=%s>\n" ),
GetChars( m_reference ), GetChars( m_value ),
GetChars( m_name ), GetChars( m_library ),
m_fpid.Format().c_str(),
GetChars( m_timeStamp ) ) );
if( !m_footprintFilters.IsEmpty() )
{
NestedSpace( aNestLevel+1, aReporter );
aReporter.Report( wxT( "<fp_filters>\n" ) );
for( unsigned i = 0; i < m_footprintFilters.GetCount(); i++ ) if( ! ( aCtl & CTL_OMIT_EXTRA ) )
{ {
NestedSpace( aNestLevel+2, aReporter ); aOut->Print( nl+1, "(value %s)\n", aOut->Quotew( m_value ).c_str() );
aReporter.Report( wxString::Format( wxT( "<%s>\n" ), aOut->Print( nl+1, "(name %s)\n", aOut->Quotew( m_name ).c_str() );
GetChars( m_footprintFilters[i] ) ) ); aOut->Print( nl+1, "(library %s)\n", aOut->Quotew( m_library ).c_str() );
aOut->Print( nl+1, "(timestamp %s)\n", aOut->Quotew( m_timeStamp ).c_str() );
} }
NestedSpace( aNestLevel+1, aReporter ); if( !( aCtl & CTL_OMIT_FILTERS ) && m_footprintFilters.GetCount() )
aReporter.Report( wxT( "</fp_filters>\n" ) ); {
aOut->Print( nl+1, "(fp_filters" );
for( unsigned i = 0; i < m_footprintFilters.GetCount(); ++i )
aOut->Print( 0, " %s", aOut->Quotew( m_footprintFilters[i] ).c_str() );
aOut->Print( 0, ")\n" );
} }
if( !m_nets.empty() ) if( !( aCtl & CTL_OMIT_NETS ) && m_nets.size() )
{ {
NestedSpace( aNestLevel+1, aReporter ); int llen = aOut->Print( nl+1, "(nets " );
aReporter.Report( wxT( "<nets>\n" ) );
for( unsigned i = 0; i < m_nets.size(); i++ ) for( unsigned i = 0; i < m_nets.size(); ++i )
m_nets[i].Show( aNestLevel+3, aReporter ); {
if( llen > 80 )
{
aOut->Print( 0, "\n" );
llen = aOut->Print( nl+1, " " );
}
llen += m_nets[i].Format( aOut, 0, aCtl );
}
aOut->Print( 0, ")\n" );
}
aOut->Print( nl, ")\n" ); // </ref>
}
void NETLIST::Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl )
{
int nl = aNestLevel;
aOut->Print( nl, "(back_annotation\n" );
NestedSpace( aNestLevel+1, aReporter ); for( unsigned i = 0; i < m_components.size(); i++ )
aReporter.Report( "</nets>\n" ); {
m_components[i].Format( aOut, nl+1, aCtl );
} }
NestedSpace( aNestLevel, aReporter ); aOut->Print( nl, ")\n" );
aReporter.Report( "</component>\n" );
} }
#endif
void NETLIST::AddComponent( COMPONENT* aComponent ) void NETLIST::AddComponent( COMPONENT* aComponent )
...@@ -250,29 +247,3 @@ bool NETLIST::AllFootprintsLinked() const ...@@ -250,29 +247,3 @@ bool NETLIST::AllFootprintsLinked() const
return true; return true;
} }
#if defined( DEBUG )
void NETLIST::Show( int aNestLevel, REPORTER& aReporter )
{
NestedSpace( aNestLevel, aReporter );
aReporter.Report( "<netlist>\n" );
if( !m_components.empty() )
{
NestedSpace( aNestLevel+1, aReporter );
aReporter.Report( "<components>\n" );
for( unsigned i = 0; i < m_components.size(); i++ )
{
m_components[i].Show( aNestLevel+2, aReporter );
}
NestedSpace( aNestLevel+1, aReporter );
aReporter.Report( "</components>\n" );
}
NestedSpace( aNestLevel, aReporter );
aReporter.Report( "</netlist>\n" );
}
#endif
...@@ -68,16 +68,7 @@ public: ...@@ -68,16 +68,7 @@ public:
return m_pinName < aNet.m_pinName; return m_pinName < aNet.m_pinName;
} }
#if defined(DEBUG) int Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl );
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param aNestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param aReporter A reference to a #REPORTER object to output to.
*/
virtual void Show( int aNestLevel, REPORTER& aReporter );
#endif
}; };
...@@ -192,16 +183,7 @@ public: ...@@ -192,16 +183,7 @@ public:
bool FootprintChanged() const { return m_footprintChanged; } bool FootprintChanged() const { return m_footprintChanged; }
#if defined(DEBUG) void Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl );
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param aNestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param aReporter A reference to a #REPORTER object to output to.
*/
virtual void Show( int aNestLevel, REPORTER& aReporter );
#endif
}; };
...@@ -348,16 +330,18 @@ public: ...@@ -348,16 +330,18 @@ public:
*/ */
bool AnyFootprintsChanged() const; bool AnyFootprintsChanged() const;
#if defined(DEBUG) void Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl = 0 );
/**
* Function Show #define CTL_OMIT_EXTRA (1<<0)
* is used to output the object tree, currently for debugging only. #define CTL_OMIT_NETS (1<<1)
* @param aNestLevel An aid to prettier tree indenting, and is the level #define CTL_OMIT_FILTERS (1<<2)
* of nesting of this object within the overall tree.
* @param aReporter A reference to a #REPORTER object to output to. #define CTL_FOR_BACKANNO (CTL_OMIT_NETS | CTL_OMIT_FILTERS | CTL_OMIT_EXTRA)
*/
virtual void Show( int aNestLevel, REPORTER& aReporter ); void FormatBackAnnotation( OUTPUTFORMATTER* aOut )
#endif {
Format( aOut, 0, CTL_FOR_BACKANNO );
}
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment