Netlist spice creation: fix serious issues.
* fix broken float values in countries using a comma as separator (missing LOCALE_IO switch) * fix regression that ignored the pseudo directive Kxx Lyy Lzz nn (coupling factor) * fix regression that created empty blocks for .subckt and .control
This commit is contained in:
parent
bd6c153ad9
commit
767be75cac
|
@ -70,6 +70,8 @@ bool NETLIST_EXPORTER_SPICE::WriteNetlist( const wxString& aOutFileName, unsigne
|
|||
|
||||
bool NETLIST_EXPORTER_SPICE::GenerateNetlist( OUTPUTFORMATTER& aFormatter, unsigned aNetlistOptions )
|
||||
{
|
||||
LOCALE_IO dummy;
|
||||
|
||||
// Cleanup list to avoid duplicate if the netlist exporter is run more than once.
|
||||
m_rawIncludes.clear();
|
||||
|
||||
|
@ -182,6 +184,31 @@ void NETLIST_EXPORTER_SPICE::ReadDirectives()
|
|||
else
|
||||
continue;
|
||||
|
||||
// Some directives have a plain text inside them:
|
||||
// .control (that ends with .endc
|
||||
// .subckt (that ends with .ends
|
||||
// So we insert the full text in netlist without any test
|
||||
// (it is not the right place here to verify the directive)
|
||||
if( text.StartsWith( ".control" ) || text.StartsWith( ".subckt") )
|
||||
{
|
||||
m_directives.emplace_back( text );
|
||||
continue;
|
||||
}
|
||||
|
||||
// A specific "directive" allows entering coupling parameter between 2 inductors
|
||||
// Kxx Lyy Lzz nn (xx, yy, zz are digits, nn is the coupling value
|
||||
if( text.StartsWith( "K" ) )
|
||||
{
|
||||
wxRegEx couplingK( "^[kK][[:digit:]]*[[:space:]]+[[:alnum:]]+[[:space:]]+[[:alnum:]]+",
|
||||
wxRE_ADVANCED );
|
||||
|
||||
if( couplingK.Matches( text ) ) // K## L## L## coupling constant
|
||||
{
|
||||
m_directives.emplace_back( text );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
tao::pegtl::string_input<> in( ( text + "\n" ).ToUTF8(), "from_content" );
|
||||
std::unique_ptr<tao::pegtl::parse_tree::node> root;
|
||||
|
||||
|
@ -201,7 +228,9 @@ void NETLIST_EXPORTER_SPICE::ReadDirectives()
|
|||
for( const auto& node : root->children )
|
||||
{
|
||||
if( node->is_type<NETLIST_EXPORTER_SPICE_PARSER::dotTitle>() )
|
||||
{
|
||||
m_title = node->children.at( 0 )->string();
|
||||
}
|
||||
else if( node->is_type<NETLIST_EXPORTER_SPICE_PARSER::dotInclude>() )
|
||||
{
|
||||
wxString path = node->children.at( 0 )->string();
|
||||
|
@ -358,8 +387,6 @@ void NETLIST_EXPORTER_SPICE::readPinNetNames( SCH_SYMBOL& aSymbol, SPICE_ITEM& a
|
|||
ReplaceForbiddenChars( netName );
|
||||
netName = UnescapeString( netName );
|
||||
|
||||
LOCALE_IO toggle;
|
||||
|
||||
if( netName == "" )
|
||||
netName = wxString::Format( wxT( "NC-%u" ), aNCCounter++ );
|
||||
|
||||
|
|
Loading…
Reference in New Issue