Spice simulator: search each line of a text field for a Spice directive
Fixes: lp:1786119 * https://bugs.launchpad.net/kicad/+bug/1786119
This commit is contained in:
parent
f82b839d06
commit
d5ee3296b2
|
@ -392,38 +392,36 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
|
||||||
if( text.IsEmpty() )
|
if( text.IsEmpty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( text.GetChar( 0 ) == '.' )
|
// Analyze each line of a text field
|
||||||
|
wxStringTokenizer tokenizer( text, "\r\n" );
|
||||||
|
|
||||||
|
while( tokenizer.HasMoreTokens() )
|
||||||
{
|
{
|
||||||
wxStringTokenizer tokenizer( text, "\r\n" );
|
wxString line( tokenizer.GetNextToken() );
|
||||||
|
|
||||||
while( tokenizer.HasMoreTokens() )
|
if( line.StartsWith( ".inc" ) )
|
||||||
{
|
{
|
||||||
wxString directive( tokenizer.GetNextToken() );
|
wxString lib = line.AfterFirst( ' ' );
|
||||||
|
|
||||||
if( directive.StartsWith( ".inc" ) )
|
if( lib.IsEmpty() )
|
||||||
{
|
continue;
|
||||||
wxString lib = directive.AfterFirst( ' ' );
|
|
||||||
|
|
||||||
if( !lib.IsEmpty() )
|
// Strip quotes if present
|
||||||
{
|
if( ( lib.StartsWith( "\"" ) && lib.EndsWith( "\"" ) )
|
||||||
// Strip quotes if present
|
|| ( lib.StartsWith( "'" ) && lib.EndsWith( "'" ) ) )
|
||||||
if( ( lib.StartsWith( "\"" ) && lib.EndsWith( "\"" ) )
|
{
|
||||||
|| ( lib.StartsWith( "'" ) && lib.EndsWith( "'" ) ) )
|
lib = lib.Mid( 1, lib.Length() - 2 );
|
||||||
{
|
}
|
||||||
lib = lib.Mid( 1, lib.Length() - 2 );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_libraries.insert( lib );
|
m_libraries.insert( lib );
|
||||||
}
|
}
|
||||||
}
|
else if( line.StartsWith( ".title " ) )
|
||||||
else if( directive.StartsWith( ".title " ) )
|
{
|
||||||
{
|
m_title = line.AfterFirst( ' ' );
|
||||||
m_title = directive.AfterFirst( ' ' );
|
}
|
||||||
}
|
else if( line.StartsWith( '.' ) )
|
||||||
else
|
{
|
||||||
{
|
m_directives.push_back( line );
|
||||||
m_directives.push_back( directive );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue