From 856d03dbe2f4b446a91e7b5c7c43afbbb529e83f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 22 May 2024 22:36:43 +0100 Subject: [PATCH] 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 --- eeschema/sim/simulator_frame_ui.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/eeschema/sim/simulator_frame_ui.cpp b/eeschema/sim/simulator_frame_ui.cpp index 3af0454ecc..36c4e97a5a 100644 --- a/eeschema/sim/simulator_frame_ui.cpp +++ b/eeschema/sim/simulator_frame_ui.cpp @@ -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() ); + } } } }