[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-patch-tracker] [patch #7924] Added two functions: locale() and s
From: |
Kai Torben Ohlhus |
Subject: |
[Octave-patch-tracker] [patch #7924] Added two functions: locale() and setlocale() |
Date: |
Sat, 18 Jan 2020 11:56:30 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36 |
Update of patch #7924 (project octave):
Priority: 5 - Normal => 3 - Low
Status: None => Wont Do
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #3:
Review for Octave 6.
Thank you for your contribution. Sorry for the first reply after almost 7
years. I changing the system locale is too platform specific. For example I
extracted a portion of your patch.
#include <locale>
#include <stdexcept>
#include <octave/oct.h>
DEFUN_DLD (locale, args, , "")
{
int nargin = args.length ();
octave_value retval;
if (nargin > 1)
print_usage ();
if (nargin == 0)
{
retval = std::locale("").name ();
}
else
{
try
{
std::string loc_name = args(0).string_value ();
std::locale _(loc_name.c_str ());
retval = true;
// the empty string represents the user's locale
// in C++, this should be hidden from the end user
if (loc_name.empty ())
retval = false;
}
catch (std::runtime_error& e)
{
retval = false;
}
}
return retval;
}
and on my system (openSUSE 15.1; Octave 5.1.0) the output is
>> mkoctfile locale.cc
>> locale
ans =
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=en_US.UTF-8;LC_ADDRESS=en_US.UTF-8;LC_TELEPHONE=en_US.UTF-8;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=en_US.UTF-8
while
>> system("locale")
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=C
LC_TIME=C
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
On MS Windows (Octave 5.1.0) your patch results in
>> mkoctfile locale.cc
>> locale
ans = C
While `system("locale")` doesn't work on MS Windows. You claimed the output
should be that of the LANG variable:
"en_US.UTF-8"
My humble opinion is, that tampering with the OS settings should be done only
as little as needed by Octave to guarantee reliable numerical results and I
kindly refuse this patch.
Closing item.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/patch/?7924>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-patch-tracker] [patch #7924] Added two functions: locale() and setlocale(),
Kai Torben Ohlhus <=