diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-06-17 22:42:03 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-06-17 22:42:03 +0000 |
commit | 097ee67dff1c60f201bc09435bc6eaeeafcd8123 (patch) | |
tree | 16efe7bbad1c2e935c57baa65ede283aa053c621 /embed.h | |
parent | 908f8bc1445ea9eef07cec82a8241c080da1cc4e (diff) | |
download | perl-097ee67dff1c60f201bc09435bc6eaeeafcd8123.tar.gz |
Fixed two long-standing locale bugs.
Both problems were related to numeric locale which
controls the radix character aka the decimal separator.
(1) printf (and sprintf) were resetting the numeric locale to C.
(2) Using locale-numerically formatted floating point
numbers (e.g. "1,23") together with -w caused warnings about
"isn't numeric". The operations were working fine, though,
because atof() was using the local locale.
Both problems reported by Stefan Vogtner.
Introduced a wrapper for atof() that attempts to convert
the string both ways. This helps Perl to understand
numbers like this "4.56" even when using a local locale
makes atof() understand only numbers like this "7,89".
Remaining related problems, both of which existed before
this patch and continue to exist after this patch:
(a) The behaviour of print() is _not_ as documented by perllocale.
Instead of always using the C locale, print() does use the
local locale, just like the *printf() do. This may be fixable
now that switching to-and-fro between locales has been made
more consistent, but fixing print() would change existing
behaviour. perllocale is not changed by this patch.
(b) If a number has been stringified (say, via "$number") under
a local locale, the cached string value persists even under
"no locale". This may or may not be a problem: operations
work fine because the original number is still there, but
that the string form keeps its locale-ish outlook may be
somewhat confusing.
p4raw-id: //depot/cfgperl@3542
Diffstat (limited to 'embed.h')
-rw-r--r-- | embed.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -311,6 +311,9 @@ #define mod Perl_mod #define moreswitches Perl_moreswitches #define my Perl_my +#ifdef USE_LOCALE_NUMERIC +#define my_atof Perl_my_atof +#endif #if !defined(HAS_BCOPY) || !defined(HAS_SAFE_BCOPY) #define my_bcopy Perl_my_bcopy #endif @@ -423,6 +426,7 @@ #define new_ctype Perl_new_ctype #define new_numeric Perl_new_numeric #define set_numeric_local Perl_set_numeric_local +#define set_numeric_radix Perl_set_numeric_radix #define set_numeric_standard Perl_set_numeric_standard #define require_pv Perl_require_pv #define pidgone Perl_pidgone @@ -1612,6 +1616,9 @@ #define mod(a,b) Perl_mod(aTHX_ a,b) #define moreswitches(a) Perl_moreswitches(aTHX_ a) #define my(a) Perl_my(aTHX_ a) +#ifdef USE_LOCALE_NUMERIC +#define my_atof(a) Perl_my_atof(aTHX_ a) +#endif #if !defined(HAS_BCOPY) || !defined(HAS_SAFE_BCOPY) #define my_bcopy(a,b,c) Perl_my_bcopy(aTHX_ a,b,c) #endif @@ -1723,6 +1730,7 @@ #define new_ctype(a) Perl_new_ctype(aTHX_ a) #define new_numeric(a) Perl_new_numeric(aTHX_ a) #define set_numeric_local() Perl_set_numeric_local(aTHX) +#define set_numeric_radix() Perl_set_numeric_radix(aTHX) #define set_numeric_standard() Perl_set_numeric_standard(aTHX) #define require_pv(a) Perl_require_pv(aTHX_ a) #define pidgone(a,b) Perl_pidgone(aTHX_ a,b) @@ -2917,6 +2925,9 @@ #define Perl_mod CPerlObj::mod #define Perl_moreswitches CPerlObj::moreswitches #define Perl_my CPerlObj::my +#ifdef USE_LOCALE_NUMERIC +#define Perl_my_atof CPerlObj::my_atof +#endif #if !defined(HAS_BCOPY) || !defined(HAS_SAFE_BCOPY) #define Perl_my_bcopy CPerlObj::my_bcopy #endif @@ -3029,6 +3040,7 @@ #define Perl_new_ctype CPerlObj::new_ctype #define Perl_new_numeric CPerlObj::new_numeric #define Perl_set_numeric_local CPerlObj::set_numeric_local +#define Perl_set_numeric_radix CPerlObj::set_numeric_radix #define Perl_set_numeric_standard CPerlObj::set_numeric_standard #define Perl_require_pv CPerlObj::require_pv #define Perl_pidgone CPerlObj::pidgone |