2000-05-22 04:19:54 +08:00
|
|
|
/* Copyright (C) 1991, 92, 95, 97, 99, 2000 Free Software Foundation, Inc.
|
1997-02-15 12:31:36 +08:00
|
|
|
This file is part of the GNU C Library.
|
1995-02-18 09:27:10 +08:00
|
|
|
|
1997-02-15 12:31:36 +08:00
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 12:58:11 +08:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1995-02-18 09:27:10 +08:00
|
|
|
|
1997-02-15 12:31:36 +08:00
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 12:58:11 +08:00
|
|
|
Lesser General Public License for more details.
|
1995-02-18 09:27:10 +08:00
|
|
|
|
2001-07-06 12:58:11 +08:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the GNU C Library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA. */
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
#include <locale.h>
|
Sun Mar 5 19:40:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* locale/localeinfo.h: Rewritten for new locale system, using
locale data files and with <langinfo.h> interface.
* locale/setlocale.c: Rewritten to use locale data files.
* langinfo.h: New file.
* locale/langinfo.h: New file.
* locale/nl_langinfo.c: New file.
* locale/loadlocale.c: New file.
* locale/lc-ctype.c: New file.
* locale/lc-messages.c: New file.
* locale/lc-monetary.c: New file.
* locale/lc-numeric.c: New file.
* locale/lc-time.c: New file.
* locale/categories.def: New file.
* locale/Makefile (headers): Remove localeinfo.h.
(distribute): New variable; put localeinfo.h here, and categories.def.
(routines): Add loadlocale.
(categories): New variable.
(aux): Use that to get C-category and lc-category.
* ctype/ctype.h (_IS*): Use independent bits for all but _ISalnum.
* locale/C-ctype.c, locale/C-messages.c: New files.
* locale/C-monetary.c, locale/C-numeric.c, locale/C-time.c:
Default "C" locale data updated for new locale system.
* locale/C-collate.c: File removed.
* locale/C-ctype_ct.c: File removed.
* locale/C-ctype_mb.c: File removed.
* locale/C-response.c: File removed.
* locale/localeconv.c: Use _NL_CURRENT macro to access locale data.
* stdio/printf_fp.c, stdio/vfprintf.c, stdio/vfscanf.c,
stdlib/strtod.c, time/asctime.c, time/strftime.c:
Include ../locale/localeinfo.h and use _NL_CURRENT macro to access
locale data.
* time/localtime.c: Don't include <localeinfo.h>.
* time/tzset.c: Don't use locale items for default TZ value or
"GMT" string (use "UTC").
* stdio/vfprintf.c [USE_IN_LIBIO] (PAD): Only call the function if
WIDTH>0; update DONE.
* malloc/malloc.c (morecore): Fix last change to calculate by
blocks instead of bytes.
1995-03-06 11:00:08 +08:00
|
|
|
#include "localeinfo.h"
|
2000-05-31 04:37:26 +08:00
|
|
|
#include <shlib-compat.h>
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
/* Return monetary and numeric information about the current locale. */
|
|
|
|
struct lconv *
|
2000-05-31 04:37:26 +08:00
|
|
|
__localeconv (void)
|
1995-02-18 09:27:10 +08:00
|
|
|
{
|
|
|
|
static struct lconv result;
|
|
|
|
|
Sun Mar 5 19:40:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* locale/localeinfo.h: Rewritten for new locale system, using
locale data files and with <langinfo.h> interface.
* locale/setlocale.c: Rewritten to use locale data files.
* langinfo.h: New file.
* locale/langinfo.h: New file.
* locale/nl_langinfo.c: New file.
* locale/loadlocale.c: New file.
* locale/lc-ctype.c: New file.
* locale/lc-messages.c: New file.
* locale/lc-monetary.c: New file.
* locale/lc-numeric.c: New file.
* locale/lc-time.c: New file.
* locale/categories.def: New file.
* locale/Makefile (headers): Remove localeinfo.h.
(distribute): New variable; put localeinfo.h here, and categories.def.
(routines): Add loadlocale.
(categories): New variable.
(aux): Use that to get C-category and lc-category.
* ctype/ctype.h (_IS*): Use independent bits for all but _ISalnum.
* locale/C-ctype.c, locale/C-messages.c: New files.
* locale/C-monetary.c, locale/C-numeric.c, locale/C-time.c:
Default "C" locale data updated for new locale system.
* locale/C-collate.c: File removed.
* locale/C-ctype_ct.c: File removed.
* locale/C-ctype_mb.c: File removed.
* locale/C-response.c: File removed.
* locale/localeconv.c: Use _NL_CURRENT macro to access locale data.
* stdio/printf_fp.c, stdio/vfprintf.c, stdio/vfscanf.c,
stdlib/strtod.c, time/asctime.c, time/strftime.c:
Include ../locale/localeinfo.h and use _NL_CURRENT macro to access
locale data.
* time/localtime.c: Don't include <localeinfo.h>.
* time/tzset.c: Don't use locale items for default TZ value or
"GMT" string (use "UTC").
* stdio/vfprintf.c [USE_IN_LIBIO] (PAD): Only call the function if
WIDTH>0; update DONE.
* malloc/malloc.c (morecore): Fix last change to calculate by
blocks instead of bytes.
1995-03-06 11:00:08 +08:00
|
|
|
result.decimal_point = (char *) _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
|
|
|
|
result.thousands_sep = (char *) _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
|
|
|
|
result.grouping = (char *) _NL_CURRENT (LC_NUMERIC, GROUPING);
|
2000-10-27 07:41:17 +08:00
|
|
|
if (*result.grouping == CHAR_MAX || *result.grouping == -1)
|
|
|
|
result.grouping = (char *) "";
|
Sun Mar 5 19:40:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* locale/localeinfo.h: Rewritten for new locale system, using
locale data files and with <langinfo.h> interface.
* locale/setlocale.c: Rewritten to use locale data files.
* langinfo.h: New file.
* locale/langinfo.h: New file.
* locale/nl_langinfo.c: New file.
* locale/loadlocale.c: New file.
* locale/lc-ctype.c: New file.
* locale/lc-messages.c: New file.
* locale/lc-monetary.c: New file.
* locale/lc-numeric.c: New file.
* locale/lc-time.c: New file.
* locale/categories.def: New file.
* locale/Makefile (headers): Remove localeinfo.h.
(distribute): New variable; put localeinfo.h here, and categories.def.
(routines): Add loadlocale.
(categories): New variable.
(aux): Use that to get C-category and lc-category.
* ctype/ctype.h (_IS*): Use independent bits for all but _ISalnum.
* locale/C-ctype.c, locale/C-messages.c: New files.
* locale/C-monetary.c, locale/C-numeric.c, locale/C-time.c:
Default "C" locale data updated for new locale system.
* locale/C-collate.c: File removed.
* locale/C-ctype_ct.c: File removed.
* locale/C-ctype_mb.c: File removed.
* locale/C-response.c: File removed.
* locale/localeconv.c: Use _NL_CURRENT macro to access locale data.
* stdio/printf_fp.c, stdio/vfprintf.c, stdio/vfscanf.c,
stdlib/strtod.c, time/asctime.c, time/strftime.c:
Include ../locale/localeinfo.h and use _NL_CURRENT macro to access
locale data.
* time/localtime.c: Don't include <localeinfo.h>.
* time/tzset.c: Don't use locale items for default TZ value or
"GMT" string (use "UTC").
* stdio/vfprintf.c [USE_IN_LIBIO] (PAD): Only call the function if
WIDTH>0; update DONE.
* malloc/malloc.c (morecore): Fix last change to calculate by
blocks instead of bytes.
1995-03-06 11:00:08 +08:00
|
|
|
|
|
|
|
result.int_curr_symbol = (char *) _NL_CURRENT (LC_MONETARY, INT_CURR_SYMBOL);
|
|
|
|
result.currency_symbol = (char *) _NL_CURRENT (LC_MONETARY, CURRENCY_SYMBOL);
|
|
|
|
result.mon_decimal_point = (char *) _NL_CURRENT (LC_MONETARY,
|
|
|
|
MON_DECIMAL_POINT);
|
|
|
|
result.mon_thousands_sep = (char *) _NL_CURRENT (LC_MONETARY,
|
|
|
|
MON_THOUSANDS_SEP);
|
|
|
|
result.mon_grouping = (char *) _NL_CURRENT (LC_MONETARY, MON_GROUPING);
|
2000-10-27 07:41:17 +08:00
|
|
|
if (*result.mon_grouping == CHAR_MAX || *result.mon_grouping == -1)
|
|
|
|
result.mon_grouping = (char *) "";
|
Sun Mar 5 19:40:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* locale/localeinfo.h: Rewritten for new locale system, using
locale data files and with <langinfo.h> interface.
* locale/setlocale.c: Rewritten to use locale data files.
* langinfo.h: New file.
* locale/langinfo.h: New file.
* locale/nl_langinfo.c: New file.
* locale/loadlocale.c: New file.
* locale/lc-ctype.c: New file.
* locale/lc-messages.c: New file.
* locale/lc-monetary.c: New file.
* locale/lc-numeric.c: New file.
* locale/lc-time.c: New file.
* locale/categories.def: New file.
* locale/Makefile (headers): Remove localeinfo.h.
(distribute): New variable; put localeinfo.h here, and categories.def.
(routines): Add loadlocale.
(categories): New variable.
(aux): Use that to get C-category and lc-category.
* ctype/ctype.h (_IS*): Use independent bits for all but _ISalnum.
* locale/C-ctype.c, locale/C-messages.c: New files.
* locale/C-monetary.c, locale/C-numeric.c, locale/C-time.c:
Default "C" locale data updated for new locale system.
* locale/C-collate.c: File removed.
* locale/C-ctype_ct.c: File removed.
* locale/C-ctype_mb.c: File removed.
* locale/C-response.c: File removed.
* locale/localeconv.c: Use _NL_CURRENT macro to access locale data.
* stdio/printf_fp.c, stdio/vfprintf.c, stdio/vfscanf.c,
stdlib/strtod.c, time/asctime.c, time/strftime.c:
Include ../locale/localeinfo.h and use _NL_CURRENT macro to access
locale data.
* time/localtime.c: Don't include <localeinfo.h>.
* time/tzset.c: Don't use locale items for default TZ value or
"GMT" string (use "UTC").
* stdio/vfprintf.c [USE_IN_LIBIO] (PAD): Only call the function if
WIDTH>0; update DONE.
* malloc/malloc.c (morecore): Fix last change to calculate by
blocks instead of bytes.
1995-03-06 11:00:08 +08:00
|
|
|
result.positive_sign = (char *) _NL_CURRENT (LC_MONETARY, POSITIVE_SIGN);
|
|
|
|
result.negative_sign = (char *) _NL_CURRENT (LC_MONETARY, NEGATIVE_SIGN);
|
|
|
|
result.int_frac_digits = *(char *) _NL_CURRENT (LC_MONETARY,
|
|
|
|
INT_FRAC_DIGITS);
|
|
|
|
result.frac_digits = *(char *) _NL_CURRENT (LC_MONETARY, FRAC_DIGITS);
|
|
|
|
result.p_cs_precedes = *(char *) _NL_CURRENT (LC_MONETARY, P_CS_PRECEDES);
|
|
|
|
result.p_sep_by_space = *(char *) _NL_CURRENT (LC_MONETARY, P_SEP_BY_SPACE);
|
2000-03-14 17:20:46 +08:00
|
|
|
result.n_cs_precedes = *(char *) _NL_CURRENT (LC_MONETARY, N_CS_PRECEDES);
|
Sun Mar 5 19:40:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* locale/localeinfo.h: Rewritten for new locale system, using
locale data files and with <langinfo.h> interface.
* locale/setlocale.c: Rewritten to use locale data files.
* langinfo.h: New file.
* locale/langinfo.h: New file.
* locale/nl_langinfo.c: New file.
* locale/loadlocale.c: New file.
* locale/lc-ctype.c: New file.
* locale/lc-messages.c: New file.
* locale/lc-monetary.c: New file.
* locale/lc-numeric.c: New file.
* locale/lc-time.c: New file.
* locale/categories.def: New file.
* locale/Makefile (headers): Remove localeinfo.h.
(distribute): New variable; put localeinfo.h here, and categories.def.
(routines): Add loadlocale.
(categories): New variable.
(aux): Use that to get C-category and lc-category.
* ctype/ctype.h (_IS*): Use independent bits for all but _ISalnum.
* locale/C-ctype.c, locale/C-messages.c: New files.
* locale/C-monetary.c, locale/C-numeric.c, locale/C-time.c:
Default "C" locale data updated for new locale system.
* locale/C-collate.c: File removed.
* locale/C-ctype_ct.c: File removed.
* locale/C-ctype_mb.c: File removed.
* locale/C-response.c: File removed.
* locale/localeconv.c: Use _NL_CURRENT macro to access locale data.
* stdio/printf_fp.c, stdio/vfprintf.c, stdio/vfscanf.c,
stdlib/strtod.c, time/asctime.c, time/strftime.c:
Include ../locale/localeinfo.h and use _NL_CURRENT macro to access
locale data.
* time/localtime.c: Don't include <localeinfo.h>.
* time/tzset.c: Don't use locale items for default TZ value or
"GMT" string (use "UTC").
* stdio/vfprintf.c [USE_IN_LIBIO] (PAD): Only call the function if
WIDTH>0; update DONE.
* malloc/malloc.c (morecore): Fix last change to calculate by
blocks instead of bytes.
1995-03-06 11:00:08 +08:00
|
|
|
result.n_sep_by_space = *(char *) _NL_CURRENT (LC_MONETARY, N_SEP_BY_SPACE);
|
|
|
|
result.p_sign_posn = *(char *) _NL_CURRENT (LC_MONETARY, P_SIGN_POSN);
|
|
|
|
result.n_sign_posn = *(char *) _NL_CURRENT (LC_MONETARY, N_SIGN_POSN);
|
2000-10-27 07:41:17 +08:00
|
|
|
result.int_p_cs_precedes = *(char *) _NL_CURRENT (LC_MONETARY,
|
|
|
|
INT_P_CS_PRECEDES);
|
|
|
|
result.int_p_sep_by_space = *(char *) _NL_CURRENT (LC_MONETARY,
|
|
|
|
INT_P_SEP_BY_SPACE);
|
|
|
|
result.int_n_cs_precedes = *(char *) _NL_CURRENT (LC_MONETARY,
|
|
|
|
INT_N_CS_PRECEDES);
|
|
|
|
result.int_n_sep_by_space = *(char *) _NL_CURRENT (LC_MONETARY,
|
|
|
|
INT_N_SEP_BY_SPACE);
|
|
|
|
result.int_p_sign_posn = *(char *) _NL_CURRENT (LC_MONETARY,
|
|
|
|
INT_P_SIGN_POSN);
|
|
|
|
result.int_n_sign_posn = *(char *) _NL_CURRENT (LC_MONETARY,
|
|
|
|
INT_N_SIGN_POSN);
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
return &result;
|
|
|
|
}
|
2000-05-31 04:37:26 +08:00
|
|
|
|
|
|
|
versioned_symbol (libc, __localeconv, localeconv, GLIBC_2_2);
|
|
|
|
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
|
|
|
strong_alias (__localeconv, __localeconv20)
|
|
|
|
compat_symbol (libc, __localeconv20, localeconv, GLIBC_2_0);
|
|
|
|
#endif
|