Eeschema, spice netlist exporter: fix an issue that converted spice string commands to lowercase.

Therefore, it can breaks some commands, especially filenames.

Partial fix of bug 1797937.
This commit is contained in:
jean-pierre charras 2018-10-19 16:17:22 +02:00
parent 064b8a8d60
commit 8f9b0f0235
1 changed files with 9 additions and 7 deletions

View File

@ -400,13 +400,15 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
{ {
wxString line( tokenizer.GetNextToken() ); wxString line( tokenizer.GetNextToken() );
// Convert to lower-case and remove preceding // Cleanup: remove preceding and trailing white-space characters
// and trailing white-space characters line.Trim( true ).Trim( false );
line.MakeLower().Trim( true ).Trim( false ); // Convert to lower-case for parsing purposes only
wxString lowercaseline = line;
lowercaseline.MakeLower();
// 'Include' directive stores the library file name, so it // 'Include' directive stores the library file name, so it
// can be later resolved using a list of paths // can be later resolved using a list of paths
if( line.StartsWith( ".inc" ) ) if( lowercaseline.StartsWith( ".inc" ) )
{ {
wxString lib = line.AfterFirst( ' ' ); wxString lib = line.AfterFirst( ' ' );
@ -425,17 +427,17 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
// Store the title to be sure it appears // Store the title to be sure it appears
// in the first line of output // in the first line of output
else if( line.StartsWith( ".title " ) ) else if( lowercaseline.StartsWith( ".title " ) )
{ {
m_title = line.AfterFirst( ' ' ); m_title = line.AfterFirst( ' ' );
} }
// Handle .control .. .endc blocks // Handle .control .. .endc blocks
else if( line.IsSameAs( ".control" ) && ( !controlBlock ) ) else if( lowercaseline.IsSameAs( ".control" ) && ( !controlBlock ) )
{ {
controlBlock = true; controlBlock = true;
} }
else if( line.IsSameAs( ".endc" ) && controlBlock ) else if( lowercaseline.IsSameAs( ".endc" ) && controlBlock )
{ {
controlBlock = false; controlBlock = false;
m_directives.push_back( line ); m_directives.push_back( line );