Commit Graph

81 Commits

Author SHA1 Message Date
Corinna Vinschen 9479563e48 newlib: Drop incorrect const qualifier from __loadlocale parameter
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-10-10 11:18:20 +02:00
Keith Packard 77f8a6dfab Use !__HAVE_LOCALE_INFO__ define to use _ctype_ directly [v2]
When __HAVE_LOCALE_INFO__ is not selected, directly access the
existing _ctype_ variable from __locale_ctype_ptr() and
__locale_ctype_ptr_l(), eliminating the need for any locale or reent
structure

Signed-off-by: Keith Packard <keithp@keithp.com>

v2:
	locale: fix conflict with __locale_ctype_ptr macro

	If we are building without __HAVE_LOCALE_INFO__, there is a
	macro providing __locale_ctype_ptr which in turn fouls up this
	declaration.

	Signed-off-by: Michael Lyle <mlyle@lyle.org>
2018-09-06 14:19:53 +02:00
Thomas Wolff f92f048528 Locale modifier @cjkwide to adjust ambiguous-width in non-CJK locales
Locale modifier @cjkwide makes Unicode "ambiguous width" characters
wide.  So ambiguous width characters can be enforced to have width 2
even in non-CJK locales. This gives e.g. users of "Powerline symbols"
the opportunity to adjust their width to the desired behaviour (and the
behaviour apparently expected by some tools) without having to set a CJK
locale and without losing consistence of terminal character width with
wcwidth/wcswidth locale width.
2018-03-05 17:15:12 +01:00
Yaakov Selkowitz 9087163804 ansification: remove _DEFUN
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:26 -06:00
Yaakov Selkowitz fff27f8429 ansification: remove _DEFUN_VOID
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:19 -06:00
Yaakov Selkowitz 0bda30e1ff ansification: remove _CONST
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:08 -06:00
Yaakov Selkowitz 6783860a2e ansification: remove _AND
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:05 -06:00
Yaakov Selkowitz 59235deeec locale: remove TRAD_SYNOPSIS
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-12-01 03:41:50 -06:00
Koichi Murase 973f766f6e Fix duplocale (libc/locale/duplocale.c) which fails to properly call __loadlocale
Problem:

  After  passing  locales  created  by  'duplocale'   to   'uselocale',
  referencing   'MB_CUR_MAX',   which   is   actually   expanded    to
  '__locale_mb_cur_max()' by preprocessors, causes segmentation faults.
  Direct use of locales from 'newlocale' does not  cause  the  problem.
  This is the problem of 'duplocale'.

  $ echo $LANG
  ja_JP.UTF-8
  $ cat test.c
  #include <stdlib.h>
  #include <locale.h>

  volatile int var;

  int main(void) {
    locale_t const loc = newlocale(LC_ALL_MASK, "", NULL);
    locale_t const dup = duplocale(loc);
    locale_t const old = uselocale(dup);
    var = MB_CUR_MAX; /* <-- crashes here */
    uselocale(old);
    freelocale(dup);
    freelocale(loc);
    return 0;
  }
  $ gcc test.c
  $ ./a
  Segmentation fault (core dumped)

  # Note: "core dumped" in the above message was  actually written  in
  # Japanese, but I translated the part to post a mail in English.

Bug:

  In the beginning of '__loadlocale' (newlib/libc/locale/locale.c:501),
  there is a code which checks if the operations can be skipped:

  > /* Avoid doing everything twice if nothing has changed. */
  > if (!strcmp (new_locale, loc->categories[category]))
  >   return loc->categories[category];

  While,   in   the   function   '_duplocale_r'    (newlib/libc/locale/
  duplocale.c), '__loadlocale'  is  called  as  in  the  quoted  codes:

  > /* If the object is not a "C" locale category, copy it.  Just call
  >    __loadlocale.  It knows what to do to replicate the category. */
  > tmp_locale.lc_cat[i].ptr = NULL;
  > tmp_locale.lc_cat[i].buf = NULL;
  > if (!__loadlocale (&tmp_locale, i, tmp_locale.categories[i]))
  >   goto error;

  This call of '__loadlocale' results in the skip check being

    !strcmp(tmp_locale.categories[i], tmp_locale.categories[i]),

  which is always true. This  means  that  the  actual  operations  of
  '__loadLocale' will never be performed for 'duplocale'.

Fix:

  The call of '__loadlocale' in '_duplocale_r' is modified.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-13 11:12:01 +01:00
Douglas 5fdd657b36 Correct argument to __get_current_locale.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-11-28 09:54:38 +01:00
Corinna Vinschen e97109184a Drop global __ctype_ptr__ entirely in favor of using locale_t::ctype_ptr
Keep __ctype_ptr__ available on Cygwin only, for backward compatibility
with existing apps referencing it via the ctype macros.

Otherwise initialize __global_locale.ctype_ptr and __C_locale.ctype_ptr
and use them throughout.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-25 14:18:31 +02:00
Corinna Vinschen 3f36c6fa62 Add __get_C_locale inline function and fix new locale code for !_MB_CAPABLE targets
Only access "C" locale using the new __get_C_locale inline function.
Enable __global_locale for !_MB_CAPABLE targets.  Accommodate !_MB_CAPABLE
targets in new locale code.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-23 17:57:06 +02:00
Corinna Vinschen f4fb06ce17 Add/change a few #ifdef comments in locale code for clearness
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-23 12:43:40 +02:00
Corinna Vinschen b0d341442c Constify __locale_ctype_ptr and __locale_ctype_ptr_l
Remove _MB_CAPABLE-only _CONST in ctype.h

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-17 09:40:28 +02:00
Corinna Vinschen 625a8a3f62 Always fall back to __ctype_ptr__ in isXXX_l functions.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-16 16:22:12 +02:00
Corinna Vinschen 1a5d08014b setlocale.h: Fix current locale handling for !__HAVE_LOCALE_INFO__ targets
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:59 +02:00
Corinna Vinschen beb721cf37 __loadlocale: Set missing val when evaluating CP874
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:59 +02:00
Corinna Vinschen fb4fb921c6 Move lconv into struct __locale_t and implement __localeconv_l
Based on FreeBSD, just don't export symbol yet, unless required.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 956565be70 Move localeconv, duplocale, freelocale, newlocale, uselocale into separate files
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen 1afa0fe4b3 Fix memory handling in functions called from loadlocale
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen aefd8b5b51 Implement newlocale, freelocale, duplocale, uselocale
Add global const __C_locale for reference purposes.

Bump Cygwin API minor number and DLL major version number to 2.6.0.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen d4f6cae9cd Use __get_global_locale function where appropriate
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen 53f84bb5ac Rearrange struct __locale_t pointers into an array
This allows looping through the structs and buffers.  Also
rearrange definitions to follow order of LC_xxx values.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen 1498c79db8 Change loadlocale to fill a __locale_t given as parameter
Don't use global variables.  This allows to call loadlocale from
the yet to be created newlocale().

Rename _thr_locale_t to __locale_t (these locales are not restricted
to threads so the name is misleading).

Along these lines, fix _set_ctype to take a __locale_t as parameter.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen d16a56306d Consolidate wctomb/mbtowc calls for POSIX-1.2008
- Remove charset parameter from low level __foo_wctomb/__foo_mbtowc calls.
- Instead, create array of function for ISO and Windows codepages to point
  to function which does not require to evaluate the charset string on
  each call.  Create matching helper functions.  I.e., __iso_wctomb,
  __iso_mbtowc, __cp_wctomb and __cp_mbtowc are functions returning the
  right function pointer now.
- Create __WCTOMB/__MBTOWC macros utilizing per-reent locale and replace
  calls to __wctomb/__mbtowc with calls to __WCTOMB/__MBTOWC.
- Drop global __wctomb/__mbtowc vars.
- Utilize aforementioned changes in Cygwin to get rid of charset in other,
  calling functions and simplify the code.
- In Cygwin restrict global cygheap locale info to the job performed
  by internal_setlocale.  Use UTF-8 instead of ASCII on the fly in
  internal conversion functions.
- In Cygwin dll_entry, make sure to initialize a TLS area with a NULL
  _REENT->_locale pointer.  Add comment to explain why.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen 88208d3735 POSIX-1.2008 per-thread locales, groundwork part 2
Move all locale category structure definitions into setlocale.h and remove
other headers in locale subdir.  Create inline accessor functions for
current category struct pointers and use throughout.  Use pointers to
"C" locale category structs by default in __global_locale.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:56 +02:00
Corinna Vinschen a6a477fa81 POSIX-1.2008 per-thread locales, groundwork part 1
Introduce first cut of struct _thr_locale_t used for the locale_t definition.
Introduce global instance called __global_locale used by default.
Introduce internal inline functions __get_global_locale, __get_locale_r,
__get_current_locale.

Remove usage of global variables in favor of accessor functions pointing to
__global_locale for now.  Include all local headers in locale subdir from
setlocale.h to get single include for internal locale access.

Introduce __CTYPE_PTR macro to replace direct access to __ctype_ptr__
and use throughout in isxxx functions.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:56 +02:00
Corinna Vinschen 90e6582918 Drop now useless comment from locale.c
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-24 12:47:18 +02:00
Corinna Vinschen ed0ff4b940 Drop has_always_all_codepages flag 2016-06-23 22:21:23 +02:00
Jon TURNEY 958c953416 Fix mismatched parentheses in documentation.
2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/locale/locale.c: Fix mismatched parentheses in
	documentation.
	* libc/locale/locale.tex: Ditto.
	* libc/stdio/fgetwc.c: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-24 12:23:25 +01:00
Corinna Vinschen 9ae37ea0c6 * libc/locale/locale.c (__mb_cur_max): On Cygwin, align default value
with default UTF-8 charset.
2012-03-29 20:27:15 +00:00
Corinna Vinschen f737a4edba * libc/locale/lmessages.h (__messages_load_locale): Declare. Remove
accidental declaration of __numeric_load_locale.
	* libc/locale/locale.c: Include timelocal.h to get declaration of
	__time_load_locale.
	(__set_locale_from_locale_alias): Fix return type.
	(__locale_msgcharset): Avoid compiler warnings.
	(_localeconv_r): Ditto.
2011-05-04 08:54:34 +00:00
Corinna Vinschen 6e16da9dec Cygwin-specific patch from Andy Koppe:
* libc/locale/locale.c (current_categories): On Cygwin, set LC_CTYPE
	to C.UTF-8 to match initial __wctomb and __mbtowc settings.
	(lc_ctype_charset): On Cygwin, initialize to "UTF-8".
	(loadlocale): Remove unused Cygwin-specifc code.
2011-05-04 08:45:17 +00:00
Corinna Vinschen ce386bafb7 * libc/locale/locale.c (loadlocale): Recognise the "cjknarrow"
modifier on "C.<charset>" locales too.
2010-11-19 10:02:36 +00:00
Corinna Vinschen 617dc68bfe * libc/locale/locale.c (loadlocale): Fix width of CJK ambigous
characters to 1 for singlebyte charsets and 2 for non-Unicode
	multibyte charsets. Change documentation accordingly.
2010-11-18 11:02:53 +00:00
Jeff Johnston 60bdafbbda 2010-05-11 Jeff Johnston <jjohnstn@redhat.com>
* libc/locale/locale.c (loadlocale): Fix dangling
        switch statement caused by __HAVE_LOCALE_INFO__ not being
        defined.
2010-05-11 20:40:14 +00:00
Corinna Vinschen d47d5b850b Extend locale support to maintain wide char values of native strings
if __HAVE_LOCALE_INFO_EXTENDED__ is defined.
	* libc/include/langinfo.h (enum __nl_item): New type.  Define all
	native values accessible through nl_langinfo.  Define previously
	existing POSIX-compatible values as macros as well.
	* libc/include/stdlib.h (__mb_cur_max): Drop declaration.
	(__locale_mb_cur_max): Declare.
	(MB_CUR_MAX): Re-define calling __locale_mb_cur_max.
	* libc/locale/Makefile.am (ELIX_SOURCES): Add lctype.c.
	* libc/locale/Makefile.in: Regenerate.
	* libc/locale/lctype.c: New file to define and load LC_CTYPE category.
	* libc/locale/lctype.h: New file, matching header.
	* libc/locale/lmessages.c (_C_messages_locale): Add default values for
	wide char members.
	(__messages_load_locale): Add _C_messages_locale in call to
	__set_lc_messages_from_win.
	* libc/locale/lmessages.h (struct lc_messages_T): Add wide char members.
	* libc/locale/lmonetary.c (_C_monetary_locale):  Add default values for
	wide char members.
	(__monetary_load_locale): Add _C_monetary_locale in call to
	__set_lc_monetary_from_win.
	* libc/locale/lmonetary.h (struct lc_monetary_T): Add wide char members.
	Add numerical values for international currency formatting per
	POSIX-1.2008, if __HAVE_LOCALE_INFO_EXTENDED__ is defined.
	* libc/locale/lnumeric.c (_C_numeric_locale): Add default values for
	wide char members.
	(__numeric_load_locale): Add _C_numeric_locale in call to
	__set_lc_numeric_from_win.
	* libc/locale/lnumeric.h (struct lc_numeric_T): Add wide char members.
	* libc/locale/locale.c (loadlocale): Return doing nothing if category
	locale didn't change.  Convert category if chain to switch statement.
	Call __ctype_load_locale in LC_CTYPE case.
	(__locale_charset): Add (but disable for now) returning codeset from
	__get_current_ctype_locale.
	(__locale_mb_cur_max): Add (but disable for now) returning mb_cur_max
	from __get_current_ctype_locale.
	(__locale_msgcharset): Add returning codeset from
	__get_current_messages_locale.
	(_localeconv_r): Accommodate int_XXX values.
	* libc/locale/nl_langinfo.c (nl_ext): New array to define what is to
	be returned for non-POSIX values.
	(nl_Langinfo): Return correct codeset for each locale category.  Return
	extended values if __HAVE_LOCALE_INFO_EXTENDED__ is defined.
	* libc/locale/timelocal.c (_C_time_locale): Add default values for
	wide char members.
	(__time_load_locale): Add _C_time_locale in call to
	__set_lc_time_from_win.
	* libc/locale/timelocal.h (struct lc_time_T): Add wide char members.
	* libc/stdio/vfwprintf.c (_VFWPRINTF_R): Use wide char decimal point
	and thousands_sep if __HAVE_LOCALE_INFO_EXTENDED__ is defined.
	* libc/time/strftime.c: Rework to accommodate availability of wide char
	strings in LC_TIME category if __HAVE_LOCALE_INFO_EXTENDED__ is defined.
2010-04-28 09:59:37 +00:00
DJ Delorie 948214b000 * libc/Makefile.am (SUBDEFS): Add LIBC_POSIX_DEF.
(libc.info): Add posix.texi.
(libc.dvi): Likewise.
(stmp-posix): New.
(posix.texi): New.
(libc_TEXINFOS): Add posix.texi.
* libc/configure.in (LIBC_POSIX_LIB, LIBC_POSIX_DEF): Add
tests.
* libc/libc.texinfo: Include posix.texi
* libc/locale/locale.c: Fix texinfo typo.
* libc/time/strftime.c: Fix texinfo typo.

* libc/configure: Regenerate.
* libc/Makefile.in: Regenerate.
* libc/argz/Makefile.in: Regenerate.
* libc/ctype/Makefile.in: Regenerate.
* libc/errno/Makefile.in: Regenerate.
* libc/iconv/Makefile.in: Regenerate.
* libc/iconv/ccs/Makefile.in: Regenerate.
* libc/iconv/ccs/binary/Makefile.in: Regenerate.
* libc/iconv/ces/Makefile.in: Regenerate.
* libc/iconv/lib/Makefile.in: Regenerate.
* libc/locale/Makefile.in: Regenerate.
* libc/misc/Makefile.in: Regenerate.
* libc/posix/Makefile.in: Regenerate.
* libc/reent/Makefile.in: Regenerate.
* libc/search/Makefile.in: Regenerate.
* libc/signal/Makefile.in: Regenerate.
* libc/stdio/Makefile.in: Regenerate.
* libc/stdio64/Makefile.in: Regenerate.
* libc/stdlib/Makefile.in: Regenerate.
* libc/string/Makefile.in: Regenerate.
* libc/syscalls/Makefile.in: Regenerate.
* libc/time/Makefile.in: Regenerate.
* libc/unix/Makefile.in: Regenerate.
* libc/xdr/Makefile.in: Regenerate.
2010-04-22 23:32:42 +00:00
Corinna Vinschen eca2df4f01 * libc/locale/locale.c (loadlocale): Optimize "EUC" charset check.
Cygwin only: Allow GB2312 and EUC-CN as alternative codeset names
	for GBK.  Add to documentation.
	* libc/locale/nl_langinfo.c (nl_langinfo): On Cygwin, translate EUCCN
	to GB2312.
2010-03-27 21:04:49 +00:00
Corinna Vinschen 7c3c3fea6d * libc/locale/locale.c (loadlocale): Fix typo in comment. 2010-02-25 16:16:16 +00:00
Corinna Vinschen 830686ec0b * libc/locale/locale.c: Throughout, extensively comment on the
reason for using __CYGWIN__.
	(lconv): Remove _CONST entirely.
	(loadlocale): Guard calls to function loading locale-specific
	category data with __HAVE_LOCALE_INFO__ rather than __CYGWIN__.
	* libc/sys/config.h (__HAVE_LOCALE_INFO__): Define for Cygwin.
2010-02-25 16:10:42 +00:00
Corinna Vinschen 1cea6189a3 * libc/locale/lmessages.c (__messages_load_locale): Take additional
parameters for wide char to multibyte conversion.  Call
	__set_lc_messages_from_win on Cygwin.
	* libc/locale/lmessages.h: Make C++-safe.
	(__messages_load_locale): Change declaration.
	* libc/locale/lmonetary.c (__monetary_load_locale): Use
	_monetary_locale_buf as buffer pointer.
	* libc/locale/lnumeric.c (__numeric_load_locale): Use
	_numeric_locale_buf as buffer pointer.
	* libc/locale/timelocal.c (__time_load_locale): Use time_locale_buf
	as buffer pointer.
	* libc/locale/locale.c (loadlocale): Enable loading LC_MESSAGES data
	on Cygwin.
2010-02-09 08:58:38 +00:00
Corinna Vinschen 9ac5e663e8 * libc/locale/locale.c: Add Cygwin's /usr/share/locale/locale.alias
support to documentation.
	(__set_locale_from_locale_alias): Declare when build for Cygwin.
	(loadlocale): On Cygwin, if locale can't be recognized, call
	__set_locale_from_locale_alias to check for locale alias.
	Define FAIL macro to replace `return NULL' statements.  Replace
	throughout.
2010-02-07 13:52:34 +00:00
Corinna Vinschen bc3677c557 * libc/locale/locale.c: Fix typo in documentation. Remove useless
_MB_CAPABLE guards within other _MB_CAPABLE guards.  Add comment
	to remaining #endif's.
2010-02-07 12:57:48 +00:00
Corinna Vinschen 5eb556c849 * libc/ctype/ctype_cp.h (_CTYPE_GEORGIAN_PS_128_254): Define.
(_CTYPE_GEORGIAN_PS_255): Define.
	(_CTYPE_PT154_128_254): Define.
	(_CTYPE_PT154_255): Define.
	(__ctype_cp): Add array members for above ctype definitions.
	* libc/locale/locale.c (loadlocale): Make TIS-620 charset name
	available for all targets.  Add guards for setting the conversion
	function pointers.  Add support for GEORGIAN-PS and PT154 charsets.
	Change documentation to reflect current behaviour more closely.
	* libc/locale/nl_langinfo.c (nl_langinfo): On Cygwin, translate
	"CP101" to "GEORGIAN-PS" and "CP102" to "PT154".
	* libc/stdlib/sb_charsets.c (__cp_conv): Add conversion arrays
	for GEORGIAN-PS and PT154.
	(__cp_index): Map invalid Windows codepage number 101 to
	GEORGIAN-PS conversion array, 102 to PT154 conversion array.
2010-02-06 18:28:33 +00:00
Corinna Vinschen 837dda8652 * libc/locale/locale.c (loadlocale): Handle ISO-8859 and KOI8 charsets
so that the dashes are optional.  Align documentation.
2010-02-05 21:24:42 +00:00
Corinna Vinschen b0466b3702 * libc/locale/locale.c (loadlocale): Allow CP932 as alias for SJIS.
Add to documentation.  Add a few comments to #endif's for Cygwin.
2010-01-23 16:41:08 +00:00
Corinna Vinschen c631824a8e * libc/locale/locale.c (loadlocale): Disable JIS entirely on Cygwin.
Allow TIS620 and TIS-620 as aliases for CP874 on Cygwin.
2010-01-23 14:32:25 +00:00
Corinna Vinschen fe57329f99 * libc/locale/lmonetary.c (__monetary_load_locale): Take additional
parameters for wide char to multibyte conversion.  Call
	__set_lc_monetary_from_win on Cygwin.
	* libc/locale/lmonetary.h: Make C++-safe.
	(__monetary_load_locale): Change declaration.
	* libc/locale/lnumeric.c (__numeric_load_locale): Take additional
	parameters for wide char to multibyte conversion.  Call
	__set_lc_numeric_from_win on Cygwin.
	* libc/locale/lnumeric.h: Make C++-safe.
	(__numeric_load_locale): Change declaration.
	* libc/locale/locale.c (lconv): De-constify for Cygwin.
	(__set_charset_from_locale): Rename from
	__set_charset_from_codepage.  Take locale as parameter instead of
	a codepage.
	(loadlocale): Allow "EUC-JP" for "EUCJP" and "EUC-KR" for "EUCKR".
	Change documnetation accordingly.  Enable LC_COLLATE, LC_MONETARY,
	LC_NUMERIC, and LC_TIME handling on Cygwin.
	(_localeconv_r): On Cygwin, copy values from monetary and numeric
	domain if change has been noted.
	* libc/locale/nl_langinfo.c (nl_langinfo): Accommodate change of
	am/pm layout in struct lc_time_T.
	* libc/locale/timelocal.c (_C_time_locale): Accommodate
	redefinition of am/pm members.
	(__time_load_locale): Take additional parameters for wide char
	to multibyte conversion.  Call __set_lc_time_from_win on Cygwin.
	* libc/locale/timelocal.h: Make C++-safe.
	(struct lc_time_T): Convert am and pm to a am_pm array for easier
	consumption by strftime and strptime.
	(__time_load_locale): Change declaration.
	* libc/time/strftime.c: Change documentation to reflect changes to
	strftime.  Remove locale constant strings in favor of access to
	locale-specifc data.
	(_ctloc): Define access method for locale-specifc data.
	(TOLOWER): Define for tolower conversion.
	(strftime): Throughout, convert locale-specific formats to use
	locale-specific data.  Add GNU-specific "%P" format.
	* libc/time/strptime.c: Remove locale constant strings in favor of
	access to locale-specifc data.
	(_ctloc): Define access method for locale-specifc data.
	(strptime): Throughout, convert locale-specific formats to use
	locale-specific data.
2010-01-22 13:03:42 +00:00
Corinna Vinschen da5f018bef * libc/locale/locale.c (loadlocale): Change comments to refer to
ISO 639-3 rather than 639-2.
2010-01-17 14:57:32 +00:00