Spice netlist exporter: handle .control .. .endc blocks
Spice may include a list of directives that are wrapped with .control and .endc. Such directives do not have a dot prefix, so they need to be handled in a special way. Fixes: lp:1787902 * https://bugs.launchpad.net/kicad/+bug/1787902
This commit is contained in:
parent
18c38bd60e
commit
36f2eb1116
|
@ -379,6 +379,7 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
|
||||||
const SCH_SHEET_LIST& sheetList = g_RootSheet;
|
const SCH_SHEET_LIST& sheetList = g_RootSheet;
|
||||||
|
|
||||||
m_directives.clear();
|
m_directives.clear();
|
||||||
|
bool controlBlock = false;
|
||||||
|
|
||||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||||
{
|
{
|
||||||
|
@ -419,10 +420,26 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
|
||||||
{
|
{
|
||||||
m_title = line.AfterFirst( ' ' );
|
m_title = line.AfterFirst( ' ' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if( line.IsSameAs( ".control" ) && ( !controlBlock ) )
|
||||||
|
{
|
||||||
|
controlBlock = true;
|
||||||
|
}
|
||||||
|
else if( line.IsSameAs( ".endc" ) && controlBlock )
|
||||||
|
{
|
||||||
|
controlBlock = false;
|
||||||
|
m_directives.push_back( line );
|
||||||
|
}
|
||||||
|
|
||||||
else if( line.StartsWith( '.' ) )
|
else if( line.StartsWith( '.' ) )
|
||||||
{
|
{
|
||||||
m_directives.push_back( line );
|
m_directives.push_back( line );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( controlBlock )
|
||||||
|
{
|
||||||
|
m_directives.push_back( line );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue