Spice netlist exporter: handle multiline directives

Fixes: lp:1797937
* https://bugs.launchpad.net/kicad/+bug/1797937

(cherry-picked from 9757107b)
This commit is contained in:
Maciej Suminski 2018-10-19 17:33:01 +02:00
parent bd1b15ded7
commit 3d9e6867cf
1 changed files with 10 additions and 2 deletions

View File

@ -396,6 +396,9 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
// Analyze each line of a text field
wxStringTokenizer tokenizer( text, "\r\n" );
// Flag to follow multiline directives
bool directiveStarted = false;
while( tokenizer.HasMoreTokens() )
{
wxString line( tokenizer.GetNextToken() );
@ -443,8 +446,9 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
m_directives.push_back( line );
}
// Usual one-line directives
else if( line.StartsWith( '.' ) )
else if( line.StartsWith( '.' ) // one-line directives
|| controlBlock // .control .. .endc block
|| ( directiveStarted && line.StartsWith( '+' ) ) ) // multiline directives
{
m_directives.push_back( line );
}
@ -453,6 +457,10 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
{
m_directives.push_back( line );
}
// Mark directive as started or continued in case it is a multi-line one
directiveStarted = line.StartsWith( '.' )
|| ( directiveStarted && line.StartsWith( '+' ) );
}
}
}