Create signals from .save directives (as well as .probe directives).

(Also fixes a bug where we only looked for a single
token after .probe.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18057
This commit is contained in:
Jeff Young 2024-05-22 22:36:43 +01:00
parent 3944d8abc9
commit 856d03dbe2
1 changed files with 12 additions and 6 deletions

View File

@ -957,18 +957,24 @@ void SIMULATOR_FRAME_UI::rebuildSignalsList()
}
}
// Add .PROBE directives
// Add .SAVE and .PROBE directives
for( const wxString& directive : circuitModel()->GetDirectives() )
{
wxStringTokenizer tokenizer( directive, wxT( "\r\n" ), wxTOKEN_STRTOK );
wxStringTokenizer directivesTokenizer( directive, wxT( "\r\n" ), wxTOKEN_STRTOK );
while( tokenizer.HasMoreTokens() )
while( directivesTokenizer.HasMoreTokens() )
{
wxString line = tokenizer.GetNextToken();
wxString line = directivesTokenizer.GetNextToken().Upper();
wxString directiveParams;
if( line.Upper().StartsWith( wxS( ".PROBE" ), &directiveParams ) )
addSignal( directiveParams.Trim( true ).Trim( false ) );
if( line.StartsWith( wxS( ".SAVE" ), &directiveParams )
|| line.StartsWith( wxS( ".PROBE" ), &directiveParams ) )
{
wxStringTokenizer paramsTokenizer( directiveParams, wxT( " \t" ), wxTOKEN_STRTOK );
while( paramsTokenizer.HasMoreTokens() )
addSignal( paramsTokenizer.GetNextToken() );
}
}
}
}