35 bool is_comment =
false;
45 if( ( line = strchr( line,
'}' ) ) ==
nullptr )
56 && (strncasecmp( line,
"{ Allowed footprints", 20 ) == 0) )
62 if( ( line = strchr( line,
'}' ) ) ==
nullptr )
80 wxASSERT( component !=
nullptr );
98 wxString footprintName;
104 strncpy( line, aText,
sizeof(line)-1 );
105 line[
sizeof(line)-1] =
'\0';
112 if( (
text = strtok( line,
" ()\t\n" ) ) ==
nullptr )
114 msg =
_(
"Cannot parse time stamp in symbol section of netlist." );
122 if( (
text = strtok(
nullptr,
" ()\t\n" ) ) ==
nullptr )
124 msg =
_(
"Cannot parse footprint name in symbol section of netlist." );
132 if( footprintName == wxT(
"$noname" ) )
133 footprintName = wxEmptyString;
136 if( (
text = strtok(
nullptr,
" ()\t\n" ) ) ==
nullptr )
138 msg =
_(
"Cannot parse reference designator in symbol section of netlist." );
146 if( (
text = strtok(
nullptr,
" ()\t\n" ) ) ==
nullptr )
148 msg =
_(
"Cannot parse value in symbol section of netlist." );
157 if( (
text = strtok(
nullptr,
" ()\t\n" ) ) !=
nullptr )
159 name =
From_UTF8(
text ).AfterFirst( wxChar(
'=' ) ).BeforeLast( wxChar(
'}' ) );
164 if( !footprintName.IsEmpty() )
180 strncpy( line, aText,
sizeof( line ) );
181 line[
sizeof(line) - 1 ] =
'\0';
183 if( ( p = strtok( line,
" ()\t\n" ) ) == nullptr )
185 msg =
_(
"Cannot parse pin name in symbol net section of netlist." );
192 if( ( p = strtok(
nullptr,
" ()\t\n" ) ) ==
nullptr )
194 msg =
_(
"Cannot parse net name in symbol net section of netlist." );
201 if( (
char) netName[0] ==
'?' )
202 netName = wxEmptyString;
204 aComponent->
AddNet( pinName, netName, wxEmptyString, wxEmptyString );
210 wxArrayString filters;
217 if( strncasecmp( line,
"$endlist", 8 ) == 0 )
219 wxASSERT( component !=
nullptr );
226 if( strncasecmp( line,
"$endfootprintlist", 4 ) == 0 )
230 if( strncasecmp( line,
"$component", 10 ) == 0 )
234 cmpRef.Trim(
false );
239 if( component ==
nullptr )
242 msg.Printf(
_(
"Cannot find symbol %s in footprint filter section of netlist." ),
bool Load(NETLIST *aNetlist)
Read the *.cmp file format contains the component footprint assignments created by CvPcb into aNetlis...
Store all of the related footprint information found in a netlist.
void SetFootprintFilters(const wxArrayString &aFilters)
void AddNet(const wxString &aPinName, const wxString &aNetName, const wxString &aPinFunction, const wxString &aPinType)
void SetName(const wxString &aName)
COMPONENT * loadComponent(char *aText)
Read the aLine containing the description of a component from a legacy format netlist and add it to t...
void loadFootprintFilters()
Load the footprint filter section of netlist file.
void loadNet(char *aText, COMPONENT *aComponent)
Function loadNet read a component net description from aText.
virtual void LoadNetlist() override
Read the netlist file in the legacy format into aNetlist.
A logical library item identifier and consists of various portions much like a URI.
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
virtual char * ReadLine()=0
Read a line of text into the buffer and increments the line number counter.
virtual const wxString & GetSource() const
Returns the name of the source of the lines in an abstract sense.
virtual unsigned LineNumber() const
Return the line number of the last line read from this LINE_READER.
unsigned Length() const
Return the number of bytes in the last line read from this LINE_READER.
char * Line() const
Return a pointer to the last line that was read in.
NETLIST * m_netlist
The net list to read the file(s) into.
LINE_READER * m_lineReader
The line reader of the netlist.
bool m_loadFootprintFilters
Load the component footprint filters section if true.
CMP_READER * m_footprintReader
The reader used to load the footprint links. If NULL, footprint links are not read.
void AddComponent(COMPONENT *aComponent)
Add aComponent to the NETLIST.
COMPONENT * GetComponentByReference(const wxString &aReference)
Return a COMPONENT by aReference.
#define THROW_PARSE_ERROR(aProblem, aSource, aInputLine, aLineNumber, aByteIndex)
wxString From_UTF8(const char *cstring)
char * StrPurge(char *text)
Remove leading and training spaces, tabs and end of line chars in text.