Attempt to fix locale issue with decimal separator in rules.

This commit is contained in:
Jeff Young 2020-08-15 17:30:55 +01:00
parent 6c74658a98
commit b42395ec8d
2 changed files with 9 additions and 9 deletions

View File

@ -372,10 +372,10 @@ int COMPILER::resolveUnits()
bool COMPILER::lexDefault( T_TOKEN& aToken ) bool COMPILER::lexDefault( T_TOKEN& aToken )
{ {
T_TOKEN retval; T_TOKEN retval;
wxString current; wxString current;
int convertFrom; int convertFrom;
wxString msg; wxString msg;
retval.value.str = nullptr; retval.value.str = nullptr;
retval.token = G_ENDS; retval.token = G_ENDS;
@ -396,8 +396,8 @@ bool COMPILER::lexDefault( T_TOKEN& aToken )
auto extractNumber = auto extractNumber =
[&]() [&]()
{ {
bool haveSeparator = false; bool haveSeparator = false;
wxUniChar ch = m_tokenizer.GetChar(); wxUniChar ch = m_tokenizer.GetChar();
do do
{ {
@ -865,7 +865,7 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
} }
else else
{ {
value = wxAtof( *node->value.str ); value = DoubleValueFromString( EDA_UNITS::MILLIMETRES, *node->value.str );
} }
node->SetUop( TR_UOP_PUSH_VALUE, value ); node->SetUop( TR_UOP_PUSH_VALUE, value );

View File

@ -361,9 +361,9 @@ public:
switch( unitId ) switch( unitId )
{ {
case 0: return Mils2iu( v ); case 0: return DoubleValueFromString( EDA_UNITS::INCHES, aString, true );
case 1: return Millimeter2iu( v ); case 1: return DoubleValueFromString( EDA_UNITS::MILLIMETRES, aString );
case 2: return Mils2iu( v * 1000.0 ); case 2: return DoubleValueFromString( EDA_UNITS::INCHES, aString, false );
default: return v; default: return v;
} }
}; };