Commit c0d39da5 authored by jean-pierre charras's avatar jean-pierre charras

New netlist format: Cvpcb: code cleaning. Pcbew: minor enhancements

parent 72ab5174
...@@ -9,53 +9,12 @@ ...@@ -9,53 +9,12 @@
#include <footprint_info.h> #include <footprint_info.h>
PIN::PIN()
{
m_Index = 0; /* Variable used by types of netlists. */
m_Type = 0; /* Electrical type. */
}
bool operator<( const PIN& item1, const PIN& item2 ) bool operator<( const PIN& item1, const PIN& item2 )
{ {
return StrNumCmp( item1.m_Number, item2.m_Number, 4, true ) < 0; return StrNumCmp( item1.m_Number, item2.m_Number, 4, true ) < 0;
} }
bool operator==( const PIN& item1, const PIN& item2 )
{
return ( item1.m_Number == item2.m_Number );
}
bool same_pin_number( const PIN* item1, const PIN* item2 )
{
wxASSERT( item1 != NULL && item2 != NULL );
return ( item1->m_Number == item2->m_Number );
}
bool same_pin_net( const PIN* item1, const PIN* item2 )
{
wxASSERT( item1 != NULL && item2 != NULL );
return ( item1->m_Net == item2->m_Net );
}
COMPONENT::COMPONENT()
{
m_Num = 0;
m_Multi = 0;
}
COMPONENT::~COMPONENT()
{
}
bool operator<( const COMPONENT& item1, const COMPONENT& item2 ) bool operator<( const COMPONENT& item1, const COMPONENT& item2 )
{ {
return StrNumCmp( item1.m_Reference, item2.m_Reference, INT_MAX, true ) < 0; return StrNumCmp( item1.m_Reference, item2.m_Reference, INT_MAX, true ) < 0;
......
...@@ -22,14 +22,12 @@ ...@@ -22,14 +22,12 @@
class PIN class PIN
{ {
public: public:
int m_Index; /* Type of net list. */
int m_Type; /* Electrical connection type. */
wxString m_Net; /* Name of net. */ wxString m_Net; /* Name of net. */
wxString m_Number; wxString m_Number;
wxString m_Name; wxString m_Name;
wxString m_Repere; /* Formats used by net lister. */
PIN(); PIN() {};
~PIN() {};
}; };
typedef boost::ptr_vector< PIN > PIN_LIST; typedef boost::ptr_vector< PIN > PIN_LIST;
...@@ -37,29 +35,19 @@ typedef boost::ptr_vector< PIN > PIN_LIST; ...@@ -37,29 +35,19 @@ typedef boost::ptr_vector< PIN > PIN_LIST;
/* PIN object list sort function. */ /* PIN object list sort function. */
extern bool operator<( const PIN& item1, const PIN& item2 ); extern bool operator<( const PIN& item1, const PIN& item2 );
/* PIN uniqueness test function. */
extern bool operator==( const PIN& item1, const PIN& item2 );
extern bool same_pin_number( const PIN* item1, const PIN* item2 );
extern bool same_pin_net( const PIN* item1, const PIN* item2 );
class COMPONENT class COMPONENT
{ {
public: public:
int m_Num; /* Component number. */ wxString m_Reference; // Reference designator: U3, R5
int m_Multi; /* Part if component has multiple parts. */ wxString m_Value; // Value: 7400, 47K
PIN_LIST m_Pins; /* List of component pins. */ wxString m_TimeStamp; // Time stamp ( default value = "00000000")
wxString m_Reference; /* Reference designator: U3, R5 ... */ wxString m_Module; // Footprint (module) name.
wxString m_Value; /* Value: 7400, 47K ... */ wxArrayString m_FootprintFilter;// List of allowed footprints (wildcards
wxString m_TimeStamp; /* Time stamp ("00000000" if absent) */ // allowed ). If empty: no filtering
wxString m_Module; /* Footprint (module) name. */ PIN_LIST m_Pins; // List of component pins.
wxString m_Repere; /* Net list format */
wxArrayString m_FootprintFilter; /* List of allowed footprints (wildcards COMPONENT() {};
* allowed ). If empty: no filtering */ ~COMPONENT() {};
COMPONENT();
~COMPONENT();
}; };
typedef boost::ptr_vector< COMPONENT > COMPONENT_LIST; typedef boost::ptr_vector< COMPONENT > COMPONENT_LIST;
...@@ -77,6 +65,4 @@ extern const wxString FootprintAliasFileWildcard; ...@@ -77,6 +65,4 @@ extern const wxString FootprintAliasFileWildcard;
extern const wxString titleLibLoadError; extern const wxString titleLibLoadError;
void Plume( int state );
#endif /* __CVPCB_H__ */ #endif /* __CVPCB_H__ */
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,6 @@
#include <richio.h> #include <richio.h>
#define SEPARATEUR '|' /* Separator character in NetList */
static int ReadPinConnection( FILE_LINE_READER& aNetlistReader, COMPONENT* CurrentCmp ); static int ReadPinConnection( FILE_LINE_READER& aNetlistReader, COMPONENT* CurrentCmp );
static int ReadFootprintFilterList( FILE_LINE_READER& aNetlistReader, COMPONENT_LIST& aComponentsList ); static int ReadFootprintFilterList( FILE_LINE_READER& aNetlistReader, COMPONENT_LIST& aComponentsList );
...@@ -83,8 +80,7 @@ static int ReadFootprintFilterList( FILE_LINE_READER& aNetlistReader, COMPONENT_ ...@@ -83,8 +80,7 @@ static int ReadFootprintFilterList( FILE_LINE_READER& aNetlistReader, COMPONENT_
*/ */
int CVPCB_MAINFRAME::ReadSchematicNetlist() int CVPCB_MAINFRAME::ReadSchematicNetlist()
{ {
char alim[1024]; int idx, jj, k;
int idx, jj, k, l;
char cbuffer[BUFFER_CHAR_SIZE]; /* temporary storage */ char cbuffer[BUFFER_CHAR_SIZE]; /* temporary storage */
char* ptchar; char* ptchar;
COMPONENT* Cmp; COMPONENT* Cmp;
...@@ -203,8 +199,6 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist() ...@@ -203,8 +199,6 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
for( jj = 0; idx < k; idx++ ) for( jj = 0; idx < k; idx++ )
{ {
if( Line[idx] == SEPARATEUR )
break;
cbuffer[jj++] = Line[idx]; cbuffer[jj++] = Line[idx];
} }
cbuffer[jj] = 0; cbuffer[jj] = 0;
...@@ -212,15 +206,6 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist() ...@@ -212,15 +206,6 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
if( m_isEESchemaNetlist && strnicmp( cbuffer, "$noname", 7 ) != 0 ) if( m_isEESchemaNetlist && strnicmp( cbuffer, "$noname", 7 ) != 0 )
Cmp->m_Module = FROM_UTF8(cbuffer); Cmp->m_Module = FROM_UTF8(cbuffer);
if( (Line[++idx] == '(') && (Line[k - 1] == ')' ) )
{
idx++; l = 0;
while( k - 1 > idx )
alim[l++] = Line[idx++];
}
else
idx = k;
/* Search component reference */ /* Search component reference */
while( Line[idx] != ' ' && Line[idx] ) while( Line[idx] != ' ' && Line[idx] )
idx++; idx++;
...@@ -243,8 +228,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist() ...@@ -243,8 +228,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
while( Line[idx] == ' ' && Line[idx] ) while( Line[idx] == ' ' && Line[idx] )
idx++; idx++;
/** goto beginning of value */ // goto beginning of value
for( jj = 0 ; ; idx++ ) for( jj = 0 ; ; idx++ )
{ {
if( (Line[idx] == ' ') || (Line[idx] == '\n') || (Line[idx] == '\r') || Line[idx] == 0) if( (Line[idx] == ' ') || (Line[idx] == '\n') || (Line[idx] == '\r') || Line[idx] == 0)
......
...@@ -15,48 +15,6 @@ ...@@ -15,48 +15,6 @@
static void WriteFootprintFilterInfos( FILE* dest, COMPONENT_LIST& list ); static void WriteFootprintFilterInfos( FILE* dest, COMPONENT_LIST& list );
static void RemoveDuplicatePins( COMPONENT& component )
{
PIN_LIST::iterator i;
PIN *pin1, *pin2;
wxString msg;
if( component.m_Pins.size() <= 1 )
return;
i = component.m_Pins.begin();
pin1 = &(*i);
++i;
while( i != component.m_Pins.end() )
{
pin2 = &(*i);
wxASSERT( pin2 != NULL );
if( !same_pin_number( pin1, pin2 ) )
{
pin1 = pin2;
++i;
continue;
}
if( !same_pin_net( pin1, pin2 ) )
{
msg.Printf( _( "Component %s %s pin %s : Different Nets" ),
GetChars( component.m_Reference ),
GetChars( component.m_Value ),
pin1->m_Number.GetData() );
DisplayError( NULL, msg, 60 );
}
pin1 = pin2;
i = component.m_Pins.erase( i );
delete pin2;
}
}
/** /**
* Create KiCad net list file. * Create KiCad net list file.
* *
...@@ -88,7 +46,6 @@ int CVPCB_MAINFRAME::GenNetlistPcbnew( FILE* file,bool isEESchemaNetlist ) ...@@ -88,7 +46,6 @@ int CVPCB_MAINFRAME::GenNetlistPcbnew( FILE* file,bool isEESchemaNetlist )
fprintf( file, "%s\n", TO_UTF8( component.m_Value ) ); fprintf( file, "%s\n", TO_UTF8( component.m_Value ) );
component.m_Pins.sort(); component.m_Pins.sort();
RemoveDuplicatePins( component );
BOOST_FOREACH( PIN& pin, component.m_Pins ) BOOST_FOREACH( PIN& pin, component.m_Pins )
{ {
......
...@@ -166,6 +166,7 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename, ...@@ -166,6 +166,7 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename,
netList_Reader.m_UseTimeStamp = aSelect_By_Timestamp; netList_Reader.m_UseTimeStamp = aSelect_By_Timestamp;
netList_Reader.m_ChangeFootprints = aChangeFootprint; netList_Reader.m_ChangeFootprints = aChangeFootprint;
netList_Reader.m_UseCmpFile = useCmpfile; netList_Reader.m_UseCmpFile = useCmpfile;
netList_Reader.ReadFootprintFilterSetOpt( true );
netList_Reader.SetFilesnames( aNetlistFullFilename, aCmpFullFileName ); netList_Reader.SetFilesnames( aNetlistFullFilename, aCmpFullFileName );
bool success = netList_Reader.ReadNetList( netfile ); bool success = netList_Reader.ReadNetList( netfile );
...@@ -277,6 +278,9 @@ bool NETLIST_READER::InitializeModules() ...@@ -277,6 +278,9 @@ bool NETLIST_READER::InitializeModules()
readModuleComponentLinkfile(); readModuleComponentLinkfile();
} }
if( m_pcbframe == NULL )
return true;
for( unsigned ii = 0; ii < m_modulesInNetlist.size(); ii++ ) for( unsigned ii = 0; ii < m_modulesInNetlist.size(); ii++ )
{ {
MODULE_INFO* currmod_info = m_modulesInNetlist[ii]; MODULE_INFO* currmod_info = m_modulesInNetlist[ii];
...@@ -326,6 +330,9 @@ bool NETLIST_READER::InitializeModules() ...@@ -326,6 +330,9 @@ bool NETLIST_READER::InitializeModules()
void NETLIST_READER::TestFootprintsMatchingAndExchange() void NETLIST_READER::TestFootprintsMatchingAndExchange()
{ {
if( m_pcbframe == NULL )
return;
for( MODULE* module = m_pcbframe->GetBoard()->m_Modules; module; module = module->Next() ) for( MODULE* module = m_pcbframe->GetBoard()->m_Modules; module; module = module->Next() )
{ {
// Search for the corresponding module info // Search for the corresponding module info
......
...@@ -53,6 +53,7 @@ public: ...@@ -53,6 +53,7 @@ public:
wxString m_Reference; wxString m_Reference;
wxString m_Value; wxString m_Value;
wxString m_TimeStamp; wxString m_TimeStamp;
wxArrayString m_FootprintFilter;
public: MODULE_INFO( const wxString& libname, public: MODULE_INFO( const wxString& libname,
const wxString& cmpname, const wxString& cmpname,
...@@ -95,6 +96,7 @@ private: ...@@ -95,6 +96,7 @@ private:
// (must be loaded from libraries) // (must be loaded from libraries)
bool m_buildModuleListOnly; // if true read netlist, populates m_modulesInNetlist bool m_buildModuleListOnly; // if true read netlist, populates m_modulesInNetlist
// but do not read and change nets and modules on board // but do not read and change nets and modules on board
bool m_readFootprintFilter; // if true read footprint filter section
enum typenetlist m_typeNetlist; // type opt the netlist currently read enum typenetlist m_typeNetlist; // type opt the netlist currently read
public: public:
...@@ -113,6 +115,7 @@ public: NETLIST_READER( PCB_EDIT_FRAME* aFrame, wxTextCtrl* aMessageWindow = NUL ...@@ -113,6 +115,7 @@ public: NETLIST_READER( PCB_EDIT_FRAME* aFrame, wxTextCtrl* aMessageWindow = NUL
m_ChangeFootprints = false; m_ChangeFootprints = false;
m_UseCmpFile = true; m_UseCmpFile = true;
m_buildModuleListOnly = false; m_buildModuleListOnly = false;
m_readFootprintFilter = false;
m_typeNetlist = NETLIST_TYPE_UNSPECIFIED; m_typeNetlist = NETLIST_TYPE_UNSPECIFIED;
} }
...@@ -141,6 +144,19 @@ public: NETLIST_READER( PCB_EDIT_FRAME* aFrame, wxTextCtrl* aMessageWindow = NUL ...@@ -141,6 +144,19 @@ public: NETLIST_READER( PCB_EDIT_FRAME* aFrame, wxTextCtrl* aMessageWindow = NUL
m_modulesInNetlist.push_back( aModInfo ); m_modulesInNetlist.push_back( aModInfo );
} }
/**
* Function ReadFootprintFilterSetOpt
* Set to true or false the read footprint filter option
* When this option is false, the footprint filter section is ignored
* When this option is true, the footprint filter section is read,
* an filter strings are stored in module info
* @param aOpt = the value of option
*/
void ReadFootprintFilterSetOpt( bool aOpt )
{
m_readFootprintFilter = aOpt;
}
/** /**
* Function BuildModuleListOnlySetOpt * Function BuildModuleListOnlySetOpt
* Set to true or false the Build Module List Only option * Set to true or false the Build Module List Only option
...@@ -218,6 +234,27 @@ public: NETLIST_READER( PCB_EDIT_FRAME* aFrame, wxTextCtrl* aMessageWindow = NUL ...@@ -218,6 +234,27 @@ public: NETLIST_READER( PCB_EDIT_FRAME* aFrame, wxTextCtrl* aMessageWindow = NUL
*/ */
bool ReadOldFmtdNetList( FILE* aFile ); bool ReadOldFmtdNetList( FILE* aFile );
/**
* Function ReadOldFmtFootprintFilterList
* Read the section "Allowed footprints" like:
* { Allowed footprints by component:
* $component R11
* R?
* SM0603
* SM0805
* R?-*
* SM1206
* $endlist
* $endfootprintlist
* }
*
* And add the strings giving the footprint filter to m_FootprintFilter
* of the corresponding module info
* <p>This section is used by CvPcb, and is not useful in Pcbnew,
* therefore it it not always read </p>
*/
bool ReadOldFmtFootprintFilterList( FILE_LINE_READER& aNetlistReader );
/** /**
* Function ReadKicadNetList * Function ReadKicadNetList
* The main function to read a netlist (new netlist format, using S expressions), * The main function to read a netlist (new netlist format, using S expressions),
......
/** /**
* @file pcbnew/netlist_reader_firstformat.cpp * @file pcbnew/netlist_reader_firstformat.cpp
*/ */
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
...@@ -43,9 +44,10 @@ ...@@ -43,9 +44,10 @@
#include <pcbnew.h> #include <pcbnew.h>
#include <netlist_reader.h> #include <netlist_reader.h>
#include <boost/foreach.hpp>
// constants used by ReadOldFmtNetlistModuleDescr(): // constants used by ReadOldFmtNetlistModuleDescr():
#define BUILDLIST true #define BUILDLIST true
#define READMODULE false #define READMODULE false
...@@ -72,11 +74,12 @@ ...@@ -72,11 +74,12 @@
*/ */
bool NETLIST_READER::ReadOldFmtdNetList( FILE* aFile ) bool NETLIST_READER::ReadOldFmtdNetList( FILE* aFile )
{ {
int state = 0; int state = 0;
bool is_comment = false; bool is_comment = false;
/* First, read the netlist: Build the list of footprints found in netlist /* First, read the netlist: Build the list of footprints found in netlist
*/ */
// netlineReader dtor will close aFile // netlineReader dtor will close aFile
FILE_LINE_READER netlineReader( aFile, m_netlistFullName ); FILE_LINE_READER netlineReader( aFile, m_netlistFullName );
...@@ -92,10 +95,15 @@ bool NETLIST_READER::ReadOldFmtdNetList( FILE* aFile ) ...@@ -92,10 +95,15 @@ bool NETLIST_READER::ReadOldFmtdNetList( FILE* aFile )
is_comment = false; is_comment = false;
} }
if( *line == '{' ) // Start Comment if( *line == '{' ) // Start Comment or Pcbnew info section
{ {
is_comment = true; is_comment = true;
if( m_readFootprintFilter && state == 0 &&
(strnicmp( line, "{ Allowed footprints", 20 ) == 0) )
{
ReadOldFmtFootprintFilterList( netlineReader );
continue;
}
if( ( line = strchr( line, '}' ) ) == NULL ) if( ( line = strchr( line, '}' ) ) == NULL )
continue; continue;
} }
...@@ -119,13 +127,13 @@ bool NETLIST_READER::ReadOldFmtdNetList( FILE* aFile ) ...@@ -119,13 +127,13 @@ bool NETLIST_READER::ReadOldFmtdNetList( FILE* aFile )
} }
if( BuildModuleListOnlyOpt() ) if( BuildModuleListOnlyOpt() )
return true; // at this point, the module list is read and built. return true; // at this point, the module list is read and built.
// Load new footprints // Load new footprints
bool success = InitializeModules(); bool success = InitializeModules();
if( ! success ) if( !success )
wxMessageBox( _("Some footprints are not found in libraries") ); wxMessageBox( _( "Some footprints are not found in libraries" ) );
TestFootprintsMatchingAndExchange(); TestFootprintsMatchingAndExchange();
...@@ -184,7 +192,7 @@ bool NETLIST_READER::ReadOldFmtdNetList( FILE* aFile ) ...@@ -184,7 +192,7 @@ bool NETLIST_READER::ReadOldFmtdNetList( FILE* aFile )
/* Function ReadOldFmtNetlistModuleDescr /* Function ReadOldFmtNetlistModuleDescr
* Read the beginning of a footprint description, from the netlist * Read the beginning of a footprint description, from the netlist
* and add a module info to m_modulesInNetlist * and add a module info to m_modulesInNetlist
* Analyze lines like: * Analyze the first line of a component description in netlist like:
* ( /40C08647 $noname R20 4.7K {Lib=R} * ( /40C08647 $noname R20 4.7K {Lib=R}
* (1 VCC) * (1 VCC)
* (2 MODB_1) * (2 MODB_1)
...@@ -195,8 +203,8 @@ MODULE* NETLIST_READER::ReadOldFmtNetlistModuleDescr( char* aText, bool aBuildLi ...@@ -195,8 +203,8 @@ MODULE* NETLIST_READER::ReadOldFmtNetlistModuleDescr( char* aText, bool aBuildLi
char* text; char* text;
wxString timeStampPath; // the full time stamp read from netlist wxString timeStampPath; // the full time stamp read from netlist
wxString footprintName; // the footprint name read from netlist wxString footprintName; // the footprint name read from netlist
wxString cmpValue; // the component value read from netlist wxString cmpValue; // the component value read from netlist
wxString cmpReference; // the component schematic reference read from netlist wxString cmpReference; // the component schematic reference read from netlist
bool error = false; bool error = false;
char line[1024]; char line[1024];
...@@ -236,13 +244,13 @@ MODULE* NETLIST_READER::ReadOldFmtNetlistModuleDescr( char* aText, bool aBuildLi ...@@ -236,13 +244,13 @@ MODULE* NETLIST_READER::ReadOldFmtNetlistModuleDescr( char* aText, bool aBuildLi
if( aBuildList ) if( aBuildList )
{ {
MODULE_INFO* mod_info = new MODULE_INFO( footprintName, cmpReference, MODULE_INFO* mod_info = new MODULE_INFO( footprintName, cmpReference,
cmpValue, timeStampPath ); cmpValue, timeStampPath );
AddModuleInfo( mod_info ); AddModuleInfo( mod_info );
return NULL; return NULL;
} }
// search the module loaded on board // search the module loaded on board
// reference and time stamps are already updated so we can used search by reference // reference and time stamps are already updated so we can use search by reference only
MODULE* module = m_pcbframe->GetBoard()->FindModuleByReference( cmpReference ); MODULE* module = m_pcbframe->GetBoard()->FindModuleByReference( cmpReference );
if( module == NULL ) if( module == NULL )
{ {
...@@ -266,8 +274,8 @@ MODULE* NETLIST_READER::ReadOldFmtNetlistModuleDescr( char* aText, bool aBuildLi ...@@ -266,8 +274,8 @@ MODULE* NETLIST_READER::ReadOldFmtNetlistModuleDescr( char* aText, bool aBuildLi
*/ */
bool NETLIST_READER::SetPadNetName( char* aText ) bool NETLIST_READER::SetPadNetName( char* aText )
{ {
char* p; char* p;
char line[256]; char line[256];
if( m_currModule == NULL ) if( m_currModule == NULL )
return false; return false;
...@@ -284,8 +292,8 @@ bool NETLIST_READER::SetPadNetName( char* aText ) ...@@ -284,8 +292,8 @@ bool NETLIST_READER::SetPadNetName( char* aText )
wxString netName = FROM_UTF8( p ); wxString netName = FROM_UTF8( p );
bool found = false; bool found = false;
for( D_PAD* pad = m_currModule->m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = m_currModule->m_Pads; pad; pad = pad->Next() )
{ {
wxString padName = pad->GetPadName(); wxString padName = pad->GetPadName();
...@@ -313,3 +321,69 @@ bool NETLIST_READER::SetPadNetName( char* aText ) ...@@ -313,3 +321,69 @@ bool NETLIST_READER::SetPadNetName( char* aText )
return found; return found;
} }
/*
* Read the section "Allowed footprints" like:
* { Allowed footprints by component:
* $component R11
* R?
* SM0603
* SM0805
* R?-*
* SM1206
* $endlist
* $endfootprintlist
* }
*
* And add the strings giving the footprint filter to m_FootprintFilter
* of the corresponding module info
* This section is used by CvPcb, and is not useful in Pcbnew,
* therefore it it not always read
*/
bool NETLIST_READER::ReadOldFmtFootprintFilterList( FILE_LINE_READER& aNetlistReader )
{
wxString cmpRef;
MODULE_INFO* mod_info = NULL;
while( aNetlistReader.ReadLine() )
{
const char* Line = aNetlistReader.Line();
if( strnicmp( Line, "$endlist", 8 ) == 0 ) // end of list for the current component
{
mod_info = NULL;
continue;
}
if( strnicmp( Line, "$endfootprintlist", 4 ) == 0 )
// End of this section
return 0;
if( strnicmp( Line, "$component", 10 ) == 0 ) // New component reference found
{
cmpRef = FROM_UTF8( Line + 11 );
cmpRef.Trim( true );
cmpRef.Trim( false );
// Search the current component in module info list:
BOOST_FOREACH( MODULE_INFO * &component, m_modulesInNetlist )
{
if( component->m_Reference == cmpRef )
{
mod_info = component;
break;
}
}
}
else if( mod_info )
{
// Add new filter to list
wxString fp = FROM_UTF8( Line + 1 );
fp.Trim( false );
fp.Trim( true );
mod_info->m_FootprintFilter.Add( fp );
}
}
return true;
}
...@@ -81,16 +81,26 @@ public: ...@@ -81,16 +81,26 @@ public:
bool NETLIST_READER::ReadKicadNetList( FILE* aFile ) bool NETLIST_READER::ReadKicadNetList( FILE* aFile )
{ {
bool success = true;
BOARD * brd = m_pcbframe->GetBoard(); BOARD * brd = m_pcbframe->GetBoard();
// netlineReader dtor will close aFile // netlineReader dtor will close aFile
FILE_LINE_READER netlineReader( aFile, m_netlistFullName ); FILE_LINE_READER netlineReader( aFile, m_netlistFullName );
NETLIST_READER_KICAD_PARSER netlist_parser( &netlineReader, this ); NETLIST_READER_KICAD_PARSER netlist_parser( &netlineReader, this );
netlist_parser.Parse( brd ); try
{
netlist_parser.Parse( brd );
}
catch( IO_ERROR& ioe )
{
ioe.errorText += '\n';
ioe.errorText += _("Netlist error.");
wxMessageBox( ioe.errorText );
return false;
}
return success; return true;
} }
......
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