* 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.
This commit is contained in:
parent
2f27950afb
commit
1cea6189a3
|
@ -1,3 +1,19 @@
|
||||||
|
2010-02-09 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* 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-08 Josef Wolf <jw@raven.inka.de>
|
2010-02-08 Josef Wolf <jw@raven.inka.de>
|
||||||
|
|
||||||
* libc/machine/m68k/memcpy.S: MISALIGEND_OK should not be set for
|
* libc/machine/m68k/memcpy.S: MISALIGEND_OK should not be set for
|
||||||
|
|
|
@ -49,8 +49,29 @@ static int _messages_using_locale;
|
||||||
static char *_messages_locale_buf;
|
static char *_messages_locale_buf;
|
||||||
|
|
||||||
int
|
int
|
||||||
__messages_load_locale(const char *name) {
|
__messages_load_locale (const char *name, void *f_wctomb, const char *charset)
|
||||||
|
{
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
extern int __set_lc_messages_from_win (const char *,
|
||||||
|
struct lc_messages_T *, char **,
|
||||||
|
void *, const char *);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
int old_messages_using_locale = _messages_using_locale;
|
||||||
|
_messages_using_locale = 0;
|
||||||
|
ret = __set_lc_messages_from_win (name, &_messages_locale,
|
||||||
|
&_messages_locale_buf,
|
||||||
|
f_wctomb, charset);
|
||||||
|
/* ret == -1: error, ret == 0: C/POSIX, ret > 0: valid */
|
||||||
|
if (ret < 0)
|
||||||
|
_messages_using_locale = old_messages_using_locale;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_messages_using_locale = ret;
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
#else
|
||||||
/*
|
/*
|
||||||
* Propose that we can have incomplete locale file (w/o "{yes,no}str").
|
* Propose that we can have incomplete locale file (w/o "{yes,no}str").
|
||||||
* Initialize them before loading. In case of complete locale, they'll
|
* Initialize them before loading. In case of complete locale, they'll
|
||||||
|
@ -63,6 +84,7 @@ __messages_load_locale(const char *name) {
|
||||||
_messages_locale_buf, "LC_MESSAGES",
|
_messages_locale_buf, "LC_MESSAGES",
|
||||||
LCMESSAGES_SIZE_FULL, LCMESSAGES_SIZE_MIN,
|
LCMESSAGES_SIZE_FULL, LCMESSAGES_SIZE_MIN,
|
||||||
(const char **)&_messages_locale);
|
(const char **)&_messages_locale);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
struct lc_messages_T *
|
struct lc_messages_T *
|
||||||
|
|
|
@ -29,6 +29,10 @@
|
||||||
#ifndef _LMESSAGES_H_
|
#ifndef _LMESSAGES_H_
|
||||||
#define _LMESSAGES_H_
|
#define _LMESSAGES_H_
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
struct lc_messages_T {
|
struct lc_messages_T {
|
||||||
const char *yesexpr;
|
const char *yesexpr;
|
||||||
const char *noexpr;
|
const char *noexpr;
|
||||||
|
@ -37,6 +41,8 @@ struct lc_messages_T {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lc_messages_T *__get_current_messages_locale(void);
|
struct lc_messages_T *__get_current_messages_locale(void);
|
||||||
int __messages_load_locale(const char *);
|
int __numeric_load_locale(const char *, void *, const char *);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
#endif /* !_LMESSAGES_H_ */
|
#endif /* !_LMESSAGES_H_ */
|
||||||
|
|
|
@ -76,11 +76,12 @@ __monetary_load_locale(const char *name , void *f_wctomb, const char *charset)
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
extern int __set_lc_monetary_from_win (const char *,
|
extern int __set_lc_monetary_from_win (const char *,
|
||||||
struct lc_monetary_T *,
|
struct lc_monetary_T *, char **,
|
||||||
void *, const char *);
|
void *, const char *);
|
||||||
int old_monetary_using_locale = _monetary_using_locale;
|
int old_monetary_using_locale = _monetary_using_locale;
|
||||||
_monetary_using_locale = 0;
|
_monetary_using_locale = 0;
|
||||||
ret = __set_lc_monetary_from_win (name, &_monetary_locale,
|
ret = __set_lc_monetary_from_win (name, &_monetary_locale,
|
||||||
|
&_monetary_locale_buf,
|
||||||
f_wctomb, charset);
|
f_wctomb, charset);
|
||||||
/* ret == -1: error, ret == 0: C/POSIX, ret > 0: valid */
|
/* ret == -1: error, ret == 0: C/POSIX, ret > 0: valid */
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|
|
@ -54,11 +54,12 @@ __numeric_load_locale(const char *name , void *f_wctomb, const char *charset)
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
extern int __set_lc_numeric_from_win (const char *,
|
extern int __set_lc_numeric_from_win (const char *,
|
||||||
struct lc_numeric_T *,
|
struct lc_numeric_T *, char **,
|
||||||
void *, const char *);
|
void *, const char *);
|
||||||
int old_numeric_using_locale = _numeric_using_locale;
|
int old_numeric_using_locale = _numeric_using_locale;
|
||||||
_numeric_using_locale = 0;
|
_numeric_using_locale = 0;
|
||||||
ret = __set_lc_numeric_from_win (name, &_numeric_locale,
|
ret = __set_lc_numeric_from_win (name, &_numeric_locale,
|
||||||
|
&_numeric_locale_buf,
|
||||||
f_wctomb, charset);
|
f_wctomb, charset);
|
||||||
/* ret == -1: error, ret == 0: C/POSIX, ret > 0: valid */
|
/* ret == -1: error, ret == 0: C/POSIX, ret > 0: valid */
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|
|
@ -817,7 +817,13 @@ restart:
|
||||||
|| strncmp (locale, "zh", 2) == 0));
|
|| strncmp (locale, "zh", 2) == 0));
|
||||||
}
|
}
|
||||||
else if (category == LC_MESSAGES)
|
else if (category == LC_MESSAGES)
|
||||||
strcpy (lc_message_charset, charset);
|
{
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
ret = __messages_load_locale (locale, (void *) l_wctomb, charset);
|
||||||
|
if (!ret)
|
||||||
|
#endif
|
||||||
|
strcpy (lc_message_charset, charset);
|
||||||
|
}
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
else if (category == LC_COLLATE)
|
else if (category == LC_COLLATE)
|
||||||
ret = __collate_load_locale (locale, (void *) l_mbtowc, charset);
|
ret = __collate_load_locale (locale, (void *) l_mbtowc, charset);
|
||||||
|
|
|
@ -109,10 +109,11 @@ __time_load_locale(const char *name, void *f_wctomb, const char *charset) {
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
extern int __set_lc_time_from_win (const char *, struct lc_time_T *,
|
extern int __set_lc_time_from_win (const char *, struct lc_time_T *,
|
||||||
void *, const char *);
|
char **, void *, const char *);
|
||||||
int old_time_using_locale = _time_using_locale;
|
int old_time_using_locale = _time_using_locale;
|
||||||
_time_using_locale = 0;
|
_time_using_locale = 0;
|
||||||
ret = __set_lc_time_from_win (name, &_time_locale, f_wctomb, charset);
|
ret = __set_lc_time_from_win (name, &_time_locale, &time_locale_buf,
|
||||||
|
f_wctomb, charset);
|
||||||
/* ret == -1: error, ret == 0: C/POSIX, ret > 0: valid */
|
/* ret == -1: error, ret == 0: C/POSIX, ret > 0: valid */
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
_time_using_locale = old_time_using_locale;
|
_time_using_locale = old_time_using_locale;
|
||||||
|
|
Loading…
Reference in New Issue