Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2002-09-21 00:13:11 +0400
committerJeff Johnston <jjohnstn@redhat.com>2002-09-21 00:13:11 +0400
commit1525d127da1d0f5eb197805e6c8e0c27eda9d520 (patch)
treebc47b5ede8ddcfc65d84aa39bfdc5b5f3dd43c89 /newlib/libc/stdlib
parentda25e61f5998b4ec3e72486cdcd84f6220253ac8 (diff)
2002-09-20 Jeff Johnston <jjohnstn@redhat.com>
* libc/ctype/Makefile.am: Add new files. * libc/ctype/Makefile.in: Regenerated. * libc/ctype/ctype.tex: Add new iswxxxx, towxxxx, wctype, and wctrans functions to documentation index. * libc/ctype/iswalnum.c: New file. * libc/ctype/iswalpha.c: Ditto. * libc/ctype/iswblank.c: Ditto. * libc/ctype/iswcntrl.c: Ditto. * libc/ctype/iswctype.c: Ditto. * libc/ctype/iswdigit.c: Ditto. * libc/ctype/iswgraph.c: Ditto. * libc/ctype/iswlower.c: Ditto. * libc/ctype/iswprint.c: Ditto. * libc/ctype/iswpunct.c: Ditto. * libc/ctype/iswspace.c: Ditto. * libc/ctype/iswupper.c: Ditto. * libc/ctype/iswxdigit.c: Ditto. * libc/ctype/jp2uc.c: Ditto. * libc/ctype/jp2uc.h: Ditto. * libc/ctype/local.h: Ditto. * libc/ctype/towctrans.c: Ditto. * libc/ctype/towlower.c: Ditto. * libc/ctype/towupper.c: Ditto. * libc/ctype/utf8alpha.h: Ditto. * libc/ctype/utf8print.h: Ditto. * libc/ctype/utf8punct.h: Ditto. * libc/ctype/wctrans.c: Ditto. * libc/ctype/wctype.c: Ditto. * libc/locale/locale.c (__lc_ctype): New external array to replace static lc_ctype array. * libc/stdlib/mbtowc_r.c: Use __lc_ctype to check current lc_ctype rather than reentrancy structure's _current_locale field. * libc/stdlib/wctomb_r.c: Ditto.
Diffstat (limited to 'newlib/libc/stdlib')
-rw-r--r--newlib/libc/stdlib/mbtowc_r.c14
-rw-r--r--newlib/libc/stdlib/wctomb_r.c12
2 files changed, 15 insertions, 11 deletions
diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c
index 26141b4c2..c7c7effca 100644
--- a/newlib/libc/stdlib/mbtowc_r.c
+++ b/newlib/libc/stdlib/mbtowc_r.c
@@ -44,6 +44,8 @@ static JIS_ACTION JIS_action_table[JIS_S_NUM][JIS_C_NUM] = {
/* we override the mbstate_t __count field for more complex encodings and use it store a state value */
#define __state __count
+extern char __lc_ctype[12];
+
int
_DEFUN (_mbtowc_r, (r, pwc, s, n, state),
struct _reent *r _AND
@@ -62,10 +64,10 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state),
return -2;
#ifdef MB_CAPABLE
- if (r->_current_locale == NULL ||
- (strlen (r->_current_locale) <= 1))
+ if (__lc_ctype == NULL ||
+ (strlen (__lc_ctype) <= 1))
{ /* fall-through */ }
- else if (!strcmp (r->_current_locale, "C-UTF-8"))
+ else if (!strcmp (__lc_ctype, "C-UTF-8"))
{
int ch;
int i = 0;
@@ -307,7 +309,7 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state),
else
return -1;
}
- else if (!strcmp (r->_current_locale, "C-SJIS"))
+ else if (!strcmp (__lc_ctype, "C-SJIS"))
{
int ch;
int i = 0;
@@ -337,7 +339,7 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state),
return -1;
}
}
- else if (!strcmp (r->_current_locale, "C-EUCJP"))
+ else if (!strcmp (__lc_ctype, "C-EUCJP"))
{
int ch;
int i = 0;
@@ -367,7 +369,7 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state),
return -1;
}
}
- else if (!strcmp (r->_current_locale, "C-JIS"))
+ else if (!strcmp (__lc_ctype, "C-JIS"))
{
JIS_STATE curr_state;
JIS_ACTION action;
diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c
index 4bcabee5d..a01863246 100644
--- a/newlib/libc/stdlib/wctomb_r.c
+++ b/newlib/libc/stdlib/wctomb_r.c
@@ -7,6 +7,8 @@
/* for some conversions, we use the __count field as a place to store a state value */
#define __state __count
+extern char __lc_ctype[12];
+
int
_DEFUN (_wctomb_r, (r, s, wchar, state),
struct _reent *r _AND
@@ -14,9 +16,9 @@ _DEFUN (_wctomb_r, (r, s, wchar, state),
wchar_t wchar _AND
mbstate_t *state)
{
- if (strlen (r->_current_locale) <= 1)
+ if (strlen (__lc_ctype) <= 1)
{ /* fall-through */ }
- else if (!strcmp (r->_current_locale, "C-UTF-8"))
+ else if (!strcmp (__lc_ctype, "C-UTF-8"))
{
if (s == NULL)
return 0; /* UTF-8 encoding is not state-dependent */
@@ -73,7 +75,7 @@ _DEFUN (_wctomb_r, (r, s, wchar, state),
else
return -1;
}
- else if (!strcmp (r->_current_locale, "C-SJIS"))
+ else if (!strcmp (__lc_ctype, "C-SJIS"))
{
unsigned char char2 = (unsigned char)wchar;
unsigned char char1 = (unsigned char)(wchar >> 8);
@@ -94,7 +96,7 @@ _DEFUN (_wctomb_r, (r, s, wchar, state),
return -1;
}
}
- else if (!strcmp (r->_current_locale, "C-EUCJP"))
+ else if (!strcmp (__lc_ctype, "C-EUCJP"))
{
unsigned char char2 = (unsigned char)wchar;
unsigned char char1 = (unsigned char)(wchar >> 8);
@@ -115,7 +117,7 @@ _DEFUN (_wctomb_r, (r, s, wchar, state),
return -1;
}
}
- else if (!strcmp (r->_current_locale, "C-JIS"))
+ else if (!strcmp (__lc_ctype, "C-JIS"))
{
int cnt = 0;
unsigned char char2 = (unsigned char)wchar;