Skip to content

Commit d84dcc2

Browse files
committed
Use . decimal separator in Touchstone files.
1 parent c83de4f commit d84dcc2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Unit1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ void __fastcall TForm1::FormCreate(TObject *Sender)
533533
String windows_ver = common.windowsVer;
534534
String local_name = common.localName;
535535

536-
common.title = Application->Title + " by OneOfEleven et al " + s + " (+OD14) ";
536+
common.title = Application->Title + " by OneOfEleven et al " + s + " (+OD15) ";
537537

538538
this->Caption = common.title;
539539
StatusBar2->Panels->Items[0]->Text = windows_ver + " " + local_name + " '" + String(common.decimalPoint()) + "'";

common.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2191,7 +2191,7 @@ String __fastcall CCommon::loadSParams(std::vector <t_data_point> &s_params, Str
21912191
// continue;
21922192
break;
21932193

2194-
// s = localiseDecimalPoint(s);
2194+
s = localiseDecimalPoint(s);
21952195

21962196
std::vector <String> params;
21972197
parseString(s, " ", params);
@@ -2624,6 +2624,12 @@ bool __fastcall CCommon::saveSParams(std::vector <t_data_point> &points, int num
26242624
}
26252625
buffer.push_back(s);
26262626

2627+
//make a "deep copy" of current locale name.
2628+
//#include <cstddef>
2629+
std::string prev_loc = std::setlocale(LC_ALL,NULL);
2630+
// set numeric decilmal for Touchstone
2631+
std::setlocale(LC_NUMERIC, "en_US.UTF-8");
2632+
26272633
for (unsigned int i = 0; i < points.size(); i++)
26282634
{
26292635
String str;
@@ -2640,6 +2646,8 @@ bool __fastcall CCommon::saveSParams(std::vector <t_data_point> &points, int num
26402646
}
26412647
buffer.push_back(s);
26422648
}
2649+
//restore the previous locale.
2650+
std::setlocale(LC_ALL, prev_loc.c_str());
26432651

26442652
const int res = saveFileAnsi(name, buffer);
26452653
if (res <= 0)

0 commit comments

Comments
 (0)