From 4a57541b76fd275222bd3f303b48307763c3ce02 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Mon, 10 Sep 2018 10:09:23 +0200 Subject: [PATCH] Spice netlist exporter: make directives case insensitive, extra comments --- .../netlist_exporters/netlist_exporter_pspice.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp index f7e689ed63..cd1d4a32bb 100644 --- a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp @@ -400,6 +400,12 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl ) { wxString line( tokenizer.GetNextToken() ); + // Convert to lower-case and remove preceding + // and trailing white-space characters + line.MakeLower().Trim( true ).Trim( false ); + + // 'Include' directive stores the library file name, so it + // can be later resolved using a list of paths if( line.StartsWith( ".inc" ) ) { wxString lib = line.AfterFirst( ' ' ); @@ -416,11 +422,15 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl ) m_libraries.insert( lib ); } + + // Store the title to be sure it appears + // in the first line of output else if( line.StartsWith( ".title " ) ) { m_title = line.AfterFirst( ' ' ); } + // Handle .control .. .endc blocks else if( line.IsSameAs( ".control" ) && ( !controlBlock ) ) { controlBlock = true; @@ -431,6 +441,7 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl ) m_directives.push_back( line ); } + // Usual one-line directives else if( line.StartsWith( '.' ) ) { m_directives.push_back( line );