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:
Joël Bertrand 2018-09-10 10:07:27 +02:00 committed by Maciej Suminski
parent 18c38bd60e
commit 36f2eb1116
1 changed files with 17 additions and 0 deletions

View File

@ -379,6 +379,7 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
const SCH_SHEET_LIST& sheetList = g_RootSheet;
m_directives.clear();
bool controlBlock = false;
for( unsigned i = 0; i < sheetList.size(); i++ )
{
@ -419,10 +420,26 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
{
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( '.' ) )
{
m_directives.push_back( line );
}
if( controlBlock )
{
m_directives.push_back( line );
}
}
}
}