ngspice has specific chars that are reserved

This replaces all known reserved characters with '_'

Fixes https://gitlab.com/kicad/code/kicad/issues/13404
This commit is contained in:
Seth Hillbrand 2023-01-06 09:30:55 -08:00
parent e315eb871c
commit 38a0b67e40
1 changed files with 10 additions and 4 deletions

View File

@ -44,7 +44,6 @@
#include <string_utils.h>
#include <dialogs/html_message_box.h>
#include <boost/algorithm/string/replace.hpp>
#include <fmt/core.h>
#include <paths.h>
#include <pegtl.hpp>
@ -320,9 +319,16 @@ void NETLIST_EXPORTER_SPICE::ConvertToSpiceMarkup( std::string& aNetName )
convertMarkup( root );
boost::replace_all( converted, "(", "_" );
boost::replace_all( converted, ")", "_" );
boost::replace_all( converted, " ", "_" );
// Remove ngspice-disallowed chars
std::replace( converted.begin(), converted.end(), '%', '_' );
std::replace( converted.begin(), converted.end(), '(', '_' );
std::replace( converted.begin(), converted.end(), ')', '_' );
std::replace( converted.begin(), converted.end(), ',', '_' );
std::replace( converted.begin(), converted.end(), '[', '_' );
std::replace( converted.begin(), converted.end(), ']', '_' );
std::replace( converted.begin(), converted.end(), '<', '_' );
std::replace( converted.begin(), converted.end(), '>', '_' );
std::replace( converted.begin(), converted.end(), '~', '_' );
aNetName = converted;
}