From 3d9e6867cf398e875e84db335ae7687037e7254c Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 19 Oct 2018 17:33:01 +0200 Subject: [PATCH] Spice netlist exporter: handle multiline directives Fixes: lp:1797937 * https://bugs.launchpad.net/kicad/+bug/1797937 (cherry-picked from 9757107b) --- .../netlist_exporters/netlist_exporter_pspice.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp index 90b0e3260c..62e91664ca 100644 --- a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp @@ -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( '+' ) ); } } }