* libc/ctype/local.h (JP_JIS, JP_SJIS, JP_EUCJP): Move definition

to jp2uc.c.
	(__jp2uc): Remove declaration.
	(_jp2uc): Declare.
	* libc/ctype/jp2uc.c (JP_JIS, JP_SJIS, JP_EUCJP): Define.
	(__jp2uc): Remove Cygwin special case.
	(_jp2uc): New function.  On Cygwin, just return c.
	* libc/ctype/iswalpha.c (iswalpha): Just call _jp2uc.
	* libc/ctype/iswblank.c (iswblank): Ditto.
	* libc/ctype/iswcntrl.c (iswcntrl): Ditto.
	* libc/ctype/iswprint.c (iswprint): Ditto.
	* libc/ctype/iswpunct.c (iswpunt): Ditto.
	* libc/ctype/iswspace.c (iswspace): Ditto.
	* libc/ctype/towlower.c (towlower): Ditto.
	* libc/ctype/towupper.c (towupper): Ditto.
This commit is contained in:
Corinna Vinschen 2009-05-14 20:16:21 +00:00
parent 6f401eccfb
commit 1cf38d075c
11 changed files with 47 additions and 61 deletions

View File

@ -1,3 +1,21 @@
2009-05-14 Corinna Vinschen <corinna@vinschen.de>
* libc/ctype/local.h (JP_JIS, JP_SJIS, JP_EUCJP): Move definition
to jp2uc.c.
(__jp2uc): Remove declaration.
(_jp2uc): Declare.
* libc/ctype/jp2uc.c (JP_JIS, JP_SJIS, JP_EUCJP): Define.
(__jp2uc): Remove Cygwin special case.
(_jp2uc): New function. On Cygwin, just return c.
* libc/ctype/iswalpha.c (iswalpha): Just call _jp2uc.
* libc/ctype/iswblank.c (iswblank): Ditto.
* libc/ctype/iswcntrl.c (iswcntrl): Ditto.
* libc/ctype/iswprint.c (iswprint): Ditto.
* libc/ctype/iswpunct.c (iswpunt): Ditto.
* libc/ctype/iswspace.c (iswspace): Ditto.
* libc/ctype/towlower.c (towlower): Ditto.
* libc/ctype/towupper.c (towupper): Ditto.
2009-05-13 Paul Brook <paul@codesourcery.com>
* libc/machine/arm/setjmp.S: Don't bother saving IP. Copy SP to

View File

@ -76,12 +76,7 @@ _DEFUN(iswalpha,(c), wint_t c)
int size;
wint_t x;
if (!strcmp (__locale_charset (), "JIS"))
c = __jp2uc (c, JP_JIS);
else if (!strcmp (__locale_charset (), "SJIS"))
c = __jp2uc (c, JP_SJIS);
else if (!strcmp (__locale_charset (), "EUCJP"))
c = __jp2uc (c, JP_EUCJP);
c = _jp2uc (c);
x = (c >> 8);
/* for some large sections, all characters are alphabetic so handle them here */

View File

@ -66,12 +66,7 @@ int
_DEFUN(iswblank,(c), wint_t c)
{
#ifdef _MB_CAPABLE
if (!strcmp (__locale_charset (), "JIS"))
c = __jp2uc (c, JP_JIS);
else if (!strcmp (__locale_charset (), "SJIS"))
c = __jp2uc (c, JP_SJIS);
else if (!strcmp (__locale_charset (), "EUCJP"))
c = __jp2uc (c, JP_EUCJP);
c = _jp2uc (c);
return (c == 0x0009 || c == 0x0020 || c == 0x1680 ||
(c >= 0x2000 && c <= 0x2006) ||
(c >= 0x2008 && c <= 0x200b) ||

View File

@ -66,12 +66,7 @@ int
_DEFUN(iswcntrl,(c), wint_t c)
{
#ifdef _MB_CAPABLE
if (!strcmp (__locale_charset (), "JIS"))
c = __jp2uc (c, JP_JIS);
else if (!strcmp (__locale_charset (), "SJIS"))
c = __jp2uc (c, JP_SJIS);
else if (!strcmp (__locale_charset (), "EUCJP"))
c = __jp2uc (c, JP_EUCJP);
c = _jp2uc (c);
return ((c >= 0x0000 && c <= 0x001f) ||
(c >= 0x007f && c <= 0x009f) ||
c == 0x2028 || c == 0x2029);

View File

@ -76,12 +76,7 @@ _DEFUN(iswprint,(c), wint_t c)
int size;
wint_t x;
if (!strcmp (__locale_charset (), "JIS"))
c = __jp2uc (c, JP_JIS);
else if (!strcmp (__locale_charset (), "SJIS"))
c = __jp2uc (c, JP_SJIS);
else if (!strcmp (__locale_charset (), "EUCJP"))
c = __jp2uc (c, JP_EUCJP);
c = _jp2uc (c);
x = (c >> 8);
/* for some large sections, all characters are printuation so handle them here */

View File

@ -76,12 +76,7 @@ _DEFUN(iswpunct,(c), wint_t c)
int size;
wint_t x;
if (!strcmp (__locale_charset (), "JIS"))
c = __jp2uc (c, JP_JIS);
else if (!strcmp (__locale_charset (), "SJIS"))
c = __jp2uc (c, JP_SJIS);
else if (!strcmp (__locale_charset (), "EUCJP"))
c = __jp2uc (c, JP_EUCJP);
c = _jp2uc (c);
x = (c >> 8);
/* for some large sections, all characters are punctuation so handle them here */

View File

@ -66,12 +66,7 @@ int
_DEFUN(iswspace,(c), wint_t c)
{
#ifdef _MB_CAPABLE
if (!strcmp (__locale_charset (), "JIS"))
c = __jp2uc (c, JP_JIS);
else if (!strcmp (__locale_charset (), "SJIS"))
c = __jp2uc (c, JP_SJIS);
else if (!strcmp (__locale_charset (), "EUCJP"))
c = __jp2uc (c, JP_EUCJP);
c = _jp2uc (c);
return ((c >= 0x0009 && c <= 0x000d) || c == 0x0020 || c == 0x1680 ||
(c >= 0x2000 && c <= 0x2006) ||
(c >= 0x2008 && c <= 0x200b) ||

View File

@ -38,14 +38,14 @@
#include "local.h"
#include "jp2uc.h"
/* Japanese encoding types supported */
#define JP_JIS 1
#define JP_SJIS 2
#define JP_EUCJP 3
wint_t
_DEFUN (__jp2uc, (c, type), wint_t c _AND int type)
{
/* Under Cygwin, the incoming wide character is already given in UTF due
to the requirements of the underlying OS. */
#ifdef __CYGWIN__
return c;
#else
int index, adj;
unsigned char byte1, byte2;
wint_t ret;
@ -145,7 +145,22 @@ _DEFUN (__jp2uc, (c, type), wint_t c _AND int type)
}
return WEOF;
}
wint_t
_DEFUN (_jp2uc, (c), wint_t c)
{
/* Under Cygwin, the incoming wide character is already given in UTF due
to the requirements of the underlying OS. */
#ifndef __CYGWIN__
if (!strcmp (__locale_charset (), "JIS"))
c = __jp2uc (c, JP_JIS);
else if (!strcmp (__locale_charset (), "SJIS"))
c = __jp2uc (c, JP_SJIS);
else if (!strcmp (__locale_charset (), "EUCJP"))
c = __jp2uc (c, JP_EUCJP);
#endif
return c;
}
#endif /* _MB_CAPABLE */

View File

@ -22,11 +22,6 @@
extern char *__locale_charset ();
/* Japanese encoding types supported */
#define JP_JIS 1
#define JP_SJIS 2
#define JP_EUCJP 3
/* internal function to translate JP to Unicode */
wint_t _EXFUN (__jp2uc, (wint_t, int));
wint_t _EXFUN (_jp2uc, (wint_t));

View File

@ -70,13 +70,7 @@ wint_t
_DEFUN(towlower,(c), wint_t c)
{
#ifdef _MB_CAPABLE
if (!strcmp (__locale_charset (), "JIS"))
c = __jp2uc (c, JP_JIS);
else if (!strcmp (__locale_charset (), "SJIS"))
c = __jp2uc (c, JP_SJIS);
else if (!strcmp (__locale_charset (), "EUCJP"))
c = __jp2uc (c, JP_EUCJP);
c = _jp2uc (c);
if (c < 0x100)
{
if ((c >= 0x0041 && c <= 0x005a) ||

View File

@ -70,13 +70,7 @@ wint_t
_DEFUN(towupper,(c), wint_t c)
{
#ifdef _MB_CAPABLE
if (!strcmp (__locale_charset (), "JIS"))
c = __jp2uc (c, JP_JIS);
else if (!strcmp (__locale_charset (), "SJIS"))
c = __jp2uc (c, JP_SJIS);
else if (!strcmp (__locale_charset (), "EUCJP"))
c = __jp2uc (c, JP_EUCJP);
c = _jp2uc (c);
if (c < 0x100)
{
if (c == 0x00b5)