|
From: Ethan A M. <merritt@u.washington.edu> - 2005-09-17 01:07:41
|
On Friday 16 September 2005 04:57 pm, Ethan Merritt wrote:
>
> Please try attached patch.
> Keep an eye open for unexpected side-effects.
The side-effects may outweigh the benefit.
I really don't know what the correct thing to do is here,
partly because I'm from part of the world that doesn't use
a comma for a decimal point.
The patch changed gnuplot's scanner routine to accept
commas as part of a number. That is necessary if the user
has used "set decimalsign locale", because in this case numbers
belonging to a gnuplot command line are interpreted according
to the current LOCALE_NUMERIC.
On the other hand this makes many gnuplot commands ambiguous
at best:
set label 1 offset 1,2
I would have expected this to set the offset to (xoff=1 yoff=3 zoff=0)
but now it instead sets (xoff=1,2 yoff=0 zoff=0).
Is that acceptable? Is it what a user would expect, if he has gone
to the trouble of setting a decimalsign == comma locale?
But the current, unpatched, state of the code has problems also.
set decimalsign locale
show locale
LC_CTYPE is fr_FR
LC_NUMERIC is fr_FR
LC_TIME is C
PI = 3.14159
print PI
3.0
print pi
3,14159265358979
That is both wrong, and puzzling. I can understand why PI gets
set to 3 on input - that's the effect of sscanf() or atod() with
LC_NUMERIC set to fr_FR. But why does it revert to a dot for the
decimal sign on output? Notice that the internal constant "pi" is
printed with a comma, as I would have expected. Strange.
Anyhow, while I can see some attraction to being able to type
contants into gnuplot using a locale-modified decimal sign, e.g.
PI = 3,14159
I suspect that it breaks too many other commands.
Perhaps a better way is to force LC_NUMERIC to C during the
scanning of a gnuplot input line. That means all numbers on a
gnuplot command line must use dot rather than comma as a
decimal sign. Then to fix the original bug report, any code
that *constructs* a gnuplot command line, must *also* set
LC_NUMERIC to C while it operates.
That would include both the built-in functions like zoom and the
interpretation of key bindings.
Let's have some input from people using a locale with a comma
for LC_NUMERIC. Should gnuplot command line syntax be affected
by LC_NUMERIC, or not?
--
Ethan A Merritt
Biomolecular Structure Center
University of Washington, Seattle 98195-7742
|