Support towlower and towupper.
[gnulib.git] / lib / wctype.in.h
index bcd0151..fef31dd 100644 (file)
@@ -84,6 +84,8 @@
 #  undef iswspace
 #  undef iswupper
 #  undef iswxdigit
+#  undef towlower
+#  undef towupper
 
 /* Linux libc5 has <wctype.h> and the functions but they are broken.  */
 #  if @REPLACE_ISWCNTRL@
 #   define iswspace rpl_iswspace
 #   define iswupper rpl_iswupper
 #   define iswxdigit rpl_iswxdigit
+#   define towlower rpl_towlower
+#   define towupper rpl_towupper
 #  endif
 
 static inline int
@@ -178,6 +182,18 @@ iswxdigit (wint_t wc)
          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
 }
 
+static inline wint_t
+towlower (wint_t wc)
+{
+  return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
+}
+
+static inline wint_t
+towupper (wint_t wc)
+{
+  return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
+}
+
 # endif /* ! HAVE_ISWCNTRL */
 
 #endif /* _GL_WCTYPE_H */