OSDN Git Service

* libc/ctype/local.h (JP_JIS, JP_SJIS, JP_EUCJP): Move definition
authorcorinna <corinna>
Thu, 14 May 2009 20:16:21 +0000 (20:16 +0000)
committercorinna <corinna>
Thu, 14 May 2009 20:16:21 +0000 (20:16 +0000)
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.

newlib/ChangeLog
newlib/libc/ctype/iswalpha.c
newlib/libc/ctype/iswblank.c
newlib/libc/ctype/iswcntrl.c
newlib/libc/ctype/iswprint.c
newlib/libc/ctype/iswpunct.c
newlib/libc/ctype/iswspace.c
newlib/libc/ctype/jp2uc.c
newlib/libc/ctype/local.h
newlib/libc/ctype/towlower.c
newlib/libc/ctype/towupper.c

index e7b3680..642ecec 100644 (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
index 4e2ad6b..ab67857 100644 (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 */
index e0601e9..5cd3701 100644 (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) ||
index 2d8a1dd..9443978 100644 (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);
index a632aa4..055855e 100644 (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 */
index fc0bd63..4e9dd88 100644 (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 */
index 100e782..a1edbdc 100644 (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) ||
index d109644..77443b8 100644 (file)
 #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 */
index 9471607..ab1c7db 100644 (file)
 
 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));
 
index edda8ca..f1ce1f5 100644 (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) ||
index dee9468..945266f 100644 (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)