Fix a bug with underscores being appended to spice param names.
This commit is contained in:
parent
50ccc4e6da
commit
e41b0775db
|
@ -47,7 +47,7 @@ std::string SPICE_GENERATOR::ModelLine( const SPICE_ITEM& aItem ) const
|
||||||
if( !m_model.HasSpiceNonInstanceOverrides() && !m_model.requiresSpiceModelLine() )
|
if( !m_model.HasSpiceNonInstanceOverrides() && !m_model.requiresSpiceModelLine() )
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
std::string result = "";
|
std::string result;
|
||||||
|
|
||||||
result.append( fmt::format( ".model {} ", aItem.modelName ) );
|
result.append( fmt::format( ".model {} ", aItem.modelName ) );
|
||||||
size_t indentLength = result.length();
|
size_t indentLength = result.length();
|
||||||
|
@ -59,15 +59,32 @@ std::string SPICE_GENERATOR::ModelLine( const SPICE_ITEM& aItem ) const
|
||||||
if( param.info.isSpiceInstanceParam )
|
if( param.info.isSpiceInstanceParam )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::string name = ( param.info.spiceModelName == "" ) ?
|
std::string name;
|
||||||
param.info.name : param.info.spiceModelName;
|
std::string value;
|
||||||
std::string value = param.value->ToSpiceString();
|
|
||||||
|
if( !param.info.spiceModelName.empty() )
|
||||||
|
{
|
||||||
|
name = param.info.spiceModelName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Because of collisions with instance parameters, we append some model parameters
|
||||||
|
// with "_".
|
||||||
|
if( boost::ends_with( param.info.name, "_" ) )
|
||||||
|
name = name.substr( 0, param.info.name.length() - 1 );
|
||||||
|
else
|
||||||
|
name = param.info.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = param.value->ToSpiceString();
|
||||||
|
|
||||||
if( value == "" )
|
if( value == "" )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
result.append( fmt::format( "+{}{}={}\n", std::string( indentLength - 1, ' ' ),
|
result.append( fmt::format( "+{}{}={}\n",
|
||||||
name, value ) );
|
std::string( indentLength - 1, ' ' ),
|
||||||
|
name,
|
||||||
|
value ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue