This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/6] generated character data for libc/ctype


Hi Thomas,

This patch appears to regress 3 tests in libstdc++:

22_locale/ctype/is/wchar_t/1.cc execution test
22_locale/ctype/scan/wchar_t/1.cc execution test
28_regex/traits/wchar_t/isctype.cc execution test

I believe the issue is due to ... (scroll down)

On 09/03/18 22:54, Thomas Wolff wrote:

[SNIP]

diff --git a/newlib/libc/ctype/iswupper_l.c b/newlib/libc/ctype/iswupper_l.c
index 2555cd0..7ce8b5e
--- a/newlib/libc/ctype/iswupper_l.c
+++ b/newlib/libc/ctype/iswupper_l.c
@@ -1,10 +1,20 @@
+/* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */
  #include <_ansi.h>
+#include <ctype.h>
  #include <wctype.h>
+#include "local.h"
+#include "categories.h"
int
  iswupper_l (wint_t c, struct __locale_t *locale)
  {
-  /* We're using a locale-independent representation of upper/lower case
-     based on Unicode data.  Thus, the locale doesn't matter. */
-  return towlower (c) != c;
+#ifdef _MB_CAPABLE
+  c = _jp2uc_l (c, locale);
+  // The wide-character class "upper" contains at least those characters wc
+  // which are equal to towupper(wc) and different from towlower(wc).
+  enum category cat = category (c);
+  return cat == CAT_Lu || (cat == CAT_LC && towupper (c) == c);
+#else
+  return c < 0x100 ? islower (c) : 0;
+#endif /* _MB_CAPABLE */
  }

This change. Shouldn't is call isupper instead of islower? Or perhaps !islower? I've tried with isupper and it makes the tests mentionned above pass.

Best regards,

Thomas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]