about summary refs log tree commit diff
path: root/REORG.TODO/wctype
diff options
context:
space:
mode:
Diffstat (limited to 'REORG.TODO/wctype')
-rw-r--r--REORG.TODO/wctype/Makefile31
-rw-r--r--REORG.TODO/wctype/Versions23
-rw-r--r--REORG.TODO/wctype/bits/wctype-wchar.h173
-rw-r--r--REORG.TODO/wctype/bug-wctypeh.c10
-rw-r--r--REORG.TODO/wctype/iswctype.c37
-rw-r--r--REORG.TODO/wctype/iswctype_l.c36
-rw-r--r--REORG.TODO/wctype/test_wcfuncs.c87
-rw-r--r--REORG.TODO/wctype/test_wctype.c82
-rw-r--r--REORG.TODO/wctype/towctrans.c35
-rw-r--r--REORG.TODO/wctype/towctrans_l.c35
-rw-r--r--REORG.TODO/wctype/wcfuncs.c94
-rw-r--r--REORG.TODO/wctype/wcfuncs_l.c74
-rw-r--r--REORG.TODO/wctype/wchar-lookup.h143
-rw-r--r--REORG.TODO/wctype/wctrans.c48
-rw-r--r--REORG.TODO/wctype/wctrans_l.c47
-rw-r--r--REORG.TODO/wctype/wctype.c48
-rw-r--r--REORG.TODO/wctype/wctype.h148
-rw-r--r--REORG.TODO/wctype/wctype_l.c49
18 files changed, 1200 insertions, 0 deletions
diff --git a/REORG.TODO/wctype/Makefile b/REORG.TODO/wctype/Makefile
new file mode 100644
index 0000000000..2cb2a6dc86
--- /dev/null
+++ b/REORG.TODO/wctype/Makefile
@@ -0,0 +1,31 @@
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+#
+#	Sub-makefile for wctype portion of the library.
+#
+subdir	:= wctype
+
+include ../Makeconfig
+
+headers		:= wctype.h bits/wctype-wchar.h
+routines	:= wcfuncs wctype iswctype wctrans towctrans \
+		   wcfuncs_l wctype_l iswctype_l wctrans_l towctrans_l
+
+tests	:= test_wctype test_wcfuncs bug-wctypeh
+
+include ../Rules
diff --git a/REORG.TODO/wctype/Versions b/REORG.TODO/wctype/Versions
new file mode 100644
index 0000000000..9b4fc57b1b
--- /dev/null
+++ b/REORG.TODO/wctype/Versions
@@ -0,0 +1,23 @@
+libc {
+  GLIBC_2.0 {
+    # functions used in inline functions or macros
+    __iswctype;
+
+    # i*
+    iswalnum; iswalpha; iswcntrl; iswctype; iswdigit; iswgraph; iswlower;
+    iswprint; iswpunct; iswspace; iswupper; iswxdigit;
+
+    # t*
+    towctrans; towlower; towupper;
+
+    # w*
+    wctrans; wctype; wcwidth;
+  }
+  GLIBC_2.1 {
+    # functions used in inline functions or macros
+    __towctrans;
+
+    # i*
+    iswblank;
+  }
+}
diff --git a/REORG.TODO/wctype/bits/wctype-wchar.h b/REORG.TODO/wctype/bits/wctype-wchar.h
new file mode 100644
index 0000000000..df5fd0396f
--- /dev/null
+++ b/REORG.TODO/wctype/bits/wctype-wchar.h
@@ -0,0 +1,173 @@
+/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/*
+ *	ISO C99 Standard: 7.25
+ *	Wide character classification and mapping utilities  <wctype.h>
+ */
+
+#ifndef _BITS_WCTYPE_WCHAR_H
+#define _BITS_WCTYPE_WCHAR_H 1
+
+#if !defined _WCTYPE_H && !defined _WCHAR_H
+#error "Never include <bits/wctype-wchar.h> directly; include <wctype.h> or <wchar.h> instead."
+#endif
+
+#include <bits/types.h>
+#include <bits/types/wint_t.h>
+
+/* The definitions in this header are specified to appear in <wctype.h>
+   in ISO C99, but in <wchar.h> in Unix98.  _GNU_SOURCE follows C99.  */
+
+/* Scalar type that can hold values which represent locale-specific
+   character classifications.  */
+typedef unsigned long int wctype_t;
+
+# ifndef _ISwbit
+/* The characteristics are stored always in network byte order (big
+   endian).  We define the bit value interpretations here dependent on the
+   machine's byte order.  */
+
+#  include <endian.h>
+#  if __BYTE_ORDER == __BIG_ENDIAN
+#   define _ISwbit(bit)	(1 << (bit))
+#  else /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#   define _ISwbit(bit)	\
+	((bit) < 8 ? (int) ((1UL << (bit)) << 24)			      \
+	 : ((bit) < 16 ? (int) ((1UL << (bit)) << 8)			      \
+	    : ((bit) < 24 ? (int) ((1UL << (bit)) >> 8)			      \
+	       : (int) ((1UL << (bit)) >> 24))))
+#  endif
+
+enum
+{
+  __ISwupper = 0,			/* UPPERCASE.  */
+  __ISwlower = 1,			/* lowercase.  */
+  __ISwalpha = 2,			/* Alphabetic.  */
+  __ISwdigit = 3,			/* Numeric.  */
+  __ISwxdigit = 4,			/* Hexadecimal numeric.  */
+  __ISwspace = 5,			/* Whitespace.  */
+  __ISwprint = 6,			/* Printing.  */
+  __ISwgraph = 7,			/* Graphical.  */
+  __ISwblank = 8,			/* Blank (usually SPC and TAB).  */
+  __ISwcntrl = 9,			/* Control character.  */
+  __ISwpunct = 10,			/* Punctuation.  */
+  __ISwalnum = 11,			/* Alphanumeric.  */
+
+  _ISwupper = _ISwbit (__ISwupper),	/* UPPERCASE.  */
+  _ISwlower = _ISwbit (__ISwlower),	/* lowercase.  */
+  _ISwalpha = _ISwbit (__ISwalpha),	/* Alphabetic.  */
+  _ISwdigit = _ISwbit (__ISwdigit),	/* Numeric.  */
+  _ISwxdigit = _ISwbit (__ISwxdigit),	/* Hexadecimal numeric.  */
+  _ISwspace = _ISwbit (__ISwspace),	/* Whitespace.  */
+  _ISwprint = _ISwbit (__ISwprint),	/* Printing.  */
+  _ISwgraph = _ISwbit (__ISwgraph),	/* Graphical.  */
+  _ISwblank = _ISwbit (__ISwblank),	/* Blank (usually SPC and TAB).  */
+  _ISwcntrl = _ISwbit (__ISwcntrl),	/* Control character.  */
+  _ISwpunct = _ISwbit (__ISwpunct),	/* Punctuation.  */
+  _ISwalnum = _ISwbit (__ISwalnum)	/* Alphanumeric.  */
+};
+# endif /* Not _ISwbit  */
+
+
+__BEGIN_DECLS
+
+/*
+ * Wide-character classification functions: 7.15.2.1.
+ */
+
+/* Test for any wide character for which `iswalpha' or `iswdigit' is
+   true.  */
+extern int iswalnum (wint_t __wc) __THROW;
+
+/* Test for any wide character for which `iswupper' or 'iswlower' is
+   true, or any wide character that is one of a locale-specific set of
+   wide-characters for which none of `iswcntrl', `iswdigit',
+   `iswpunct', or `iswspace' is true.  */
+extern int iswalpha (wint_t __wc) __THROW;
+
+/* Test for any control wide character.  */
+extern int iswcntrl (wint_t __wc) __THROW;
+
+/* Test for any wide character that corresponds to a decimal-digit
+   character.  */
+extern int iswdigit (wint_t __wc) __THROW;
+
+/* Test for any wide character for which `iswprint' is true and
+   `iswspace' is false.  */
+extern int iswgraph (wint_t __wc) __THROW;
+
+/* Test for any wide character that corresponds to a lowercase letter
+   or is one of a locale-specific set of wide characters for which
+   none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true.  */
+extern int iswlower (wint_t __wc) __THROW;
+
+/* Test for any printing wide character.  */
+extern int iswprint (wint_t __wc) __THROW;
+
+/* Test for any printing wide character that is one of a
+   locale-specific et of wide characters for which neither `iswspace'
+   nor `iswalnum' is true.  */
+extern int iswpunct (wint_t __wc) __THROW;
+
+/* Test for any wide character that corresponds to a locale-specific
+   set of wide characters for which none of `iswalnum', `iswgraph', or
+   `iswpunct' is true.  */
+extern int iswspace (wint_t __wc) __THROW;
+
+/* Test for any wide character that corresponds to an uppercase letter
+   or is one of a locale-specific set of wide character for which none
+   of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true.  */
+extern int iswupper (wint_t __wc) __THROW;
+
+/* Test for any wide character that corresponds to a hexadecimal-digit
+   character equivalent to that performed be the functions described
+   in the previous subclause.  */
+extern int iswxdigit (wint_t __wc) __THROW;
+
+/* Test for any wide character that corresponds to a standard blank
+   wide character or a locale-specific set of wide characters for
+   which `iswalnum' is false.  */
+# ifdef __USE_ISOC99
+extern int iswblank (wint_t __wc) __THROW;
+# endif
+
+/*
+ * Extensible wide-character classification functions: 7.15.2.2.
+ */
+
+/* Construct value that describes a class of wide characters identified
+   by the string argument PROPERTY.  */
+extern wctype_t wctype (const char *__property) __THROW;
+
+/* Determine whether the wide-character WC has the property described by
+   DESC.  */
+extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
+
+/*
+ * Wide-character case-mapping functions: 7.15.3.1.
+ */
+
+/* Converts an uppercase letter to the corresponding lowercase letter.  */
+extern wint_t towlower (wint_t __wc) __THROW;
+
+/* Converts an lowercase letter to the corresponding uppercase letter.  */
+extern wint_t towupper (wint_t __wc) __THROW;
+
+__END_DECLS
+
+#endif /* bits/wctype-wchar.h.  */
diff --git a/REORG.TODO/wctype/bug-wctypeh.c b/REORG.TODO/wctype/bug-wctypeh.c
new file mode 100644
index 0000000000..9d5acb3a5c
--- /dev/null
+++ b/REORG.TODO/wctype/bug-wctypeh.c
@@ -0,0 +1,10 @@
+#include <wchar.h>
+#include <wctype.h>
+#include <stddef.h>
+ptrdiff_t i;
+
+int
+main (void)
+{
+  return 0;
+}
diff --git a/REORG.TODO/wctype/iswctype.c b/REORG.TODO/wctype/iswctype.c
new file mode 100644
index 0000000000..c8eb8c2dbb
--- /dev/null
+++ b/REORG.TODO/wctype/iswctype.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ctype.h>
+#include <wctype.h>
+
+#include "wchar-lookup.h"
+
+#undef __iswctype
+
+int
+__iswctype (wint_t wc, wctype_t desc)
+{
+  /* If the user passes in an invalid DESC valid (the one returned from
+     `wctype' in case of an error) simply return 0.  */
+  if (desc == (wctype_t) 0)
+    return 0;
+
+  return wctype_table_lookup ((const char *) desc, wc);
+}
+libc_hidden_def (__iswctype)
+weak_alias (__iswctype, iswctype)
diff --git a/REORG.TODO/wctype/iswctype_l.c b/REORG.TODO/wctype/iswctype_l.c
new file mode 100644
index 0000000000..9a5daecda5
--- /dev/null
+++ b/REORG.TODO/wctype/iswctype_l.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ctype.h>
+#include <wctype.h>
+
+#define USE_IN_EXTENDED_LOCALE_MODEL	1
+#include "wchar-lookup.h"
+
+
+int
+__iswctype_l (wint_t wc, wctype_t desc, __locale_t locale)
+{
+  /* If the user passes in an invalid DESC valid (the one returned from
+     `__wctype_l' in case of an error) simply return 0.  */
+  if (desc == (wctype_t) 0)
+    return 0;
+
+  return wctype_table_lookup ((const char *) desc, wc);
+}
+weak_alias (__iswctype_l, iswctype_l)
diff --git a/REORG.TODO/wctype/test_wcfuncs.c b/REORG.TODO/wctype/test_wcfuncs.c
new file mode 100644
index 0000000000..185899e8d9
--- /dev/null
+++ b/REORG.TODO/wctype/test_wcfuncs.c
@@ -0,0 +1,87 @@
+/* Copyright (C) 1999-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <wctype.h>
+
+int
+main (int argc, char *argv[])
+{
+  int result = 0;
+  wint_t ch;
+
+
+  for (ch = 0; ch < 128; ++ch)
+    {
+      if (iswlower (ch))
+	{
+	  /* Get corresponding upper case character.  */
+	  wint_t up = towupper (ch);
+	  /* This should have no effect.  */
+	  wint_t low  = towlower (ch);
+
+	  if ((ch != low) || (up == ch) || (up == low))
+	    {
+	      printf ("iswlower/towupper/towlower for character \\%x failed\n", ch);
+	      result++;
+	    }
+	}
+      if (iswupper (ch))
+	{
+	  /* Get corresponding lower case character.  */
+	  wint_t low = towlower (ch);
+	  /* This should have no effect.  */
+	  wint_t up  = towupper (ch);
+
+	  if ((ch != up) || (low == ch) || (up == low))
+	    {
+	      printf ("iswupper/towlower/towupper for character \\%x failed\n", ch);
+	      result++;
+	    }
+	}
+    }
+
+  /* Finally some specific tests.  */
+  ch = L'A';
+  if (!iswupper (ch) || iswlower (ch))
+    {
+      printf ("!iswupper/iswlower (L'A') failed\n");
+      result++;
+
+    }
+  ch = L'a';
+  if (iswupper (ch) || !iswlower (ch))
+    {
+      printf ("iswupper/!iswlower (L'a') failed\n");
+      result++;
+    }
+  if (towlower (L'A') != L'a')
+    {
+      printf ("towlower(L'A') failed\n");
+      result++;
+    }
+  if (towupper (L'a') != L'A')
+    {
+      printf ("towupper(L'a') failed\n");
+      result++;
+    }
+
+  if (result == 0)
+    puts ("All test successful!");
+  return result != 0;
+}
diff --git a/REORG.TODO/wctype/test_wctype.c b/REORG.TODO/wctype/test_wctype.c
new file mode 100644
index 0000000000..4c1f2f2029
--- /dev/null
+++ b/REORG.TODO/wctype/test_wctype.c
@@ -0,0 +1,82 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wctype.h>
+
+int
+main (int argc, char *argv[])
+{
+  int result = 0;
+  wctype_t bit_alnum = wctype ("alnum");
+  wctype_t bit_alpha = wctype ("alpha");
+  wctype_t bit_cntrl = wctype ("cntrl");
+  wctype_t bit_digit = wctype ("digit");
+  wctype_t bit_graph = wctype ("graph");
+  wctype_t bit_lower = wctype ("lower");
+  wctype_t bit_print = wctype ("print");
+  wctype_t bit_punct = wctype ("punct");
+  wctype_t bit_space = wctype ("space");
+  wctype_t bit_upper = wctype ("upper");
+  wctype_t bit_xdigit = wctype ("xdigit");
+  int ch;
+
+  if (wctype ("does not exist") != 0)
+    {
+      puts ("wctype return value != 0 for non existing property");
+      result = 1;
+    }
+
+  for (ch = 0; ch < 256; ++ch)
+    {
+#define TEST(test) \
+      do								      \
+	{								      \
+	  if ((is##test (ch) == 0) != (iswctype (ch, bit_##test) == 0))	      \
+	    {								      \
+	      printf ("`iswctype' class `%s' test "			      \
+		      "for character \\%o failed\n", #test, ch);	      \
+	      result = 1;						      \
+	    }								      \
+	  if ((is##test (ch) == 0) != (isw##test (ch) == 0))		      \
+	    {								      \
+	      printf ("`isw%s' test for character \\%o failed\n",	      \
+		      #test, ch);					      \
+	      result = 1;						      \
+	    }								      \
+	 }								      \
+      while (0)
+
+      TEST (alnum);
+      TEST (alpha);
+      TEST (cntrl);
+      TEST (digit);
+      TEST (graph);
+      TEST (lower);
+      TEST (print);
+      TEST (punct);
+      TEST (space);
+      TEST (upper);
+      TEST (xdigit);
+    }
+
+  if (result == 0)
+    puts ("All test successful!");
+  return result;
+}
diff --git a/REORG.TODO/wctype/towctrans.c b/REORG.TODO/wctype/towctrans.c
new file mode 100644
index 0000000000..841e402f3f
--- /dev/null
+++ b/REORG.TODO/wctype/towctrans.c
@@ -0,0 +1,35 @@
+/* Map wide character using given mapping.
+   Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <wctype.h>
+
+/* Define the lookup function.  */
+#include "wchar-lookup.h"
+
+wint_t
+__towctrans (wint_t wc, wctrans_t desc)
+{
+  /* If the user passes in an invalid DESC valid (the one returned from
+     `wctrans' in case of an error) simply return the value.  */
+  if (desc == (wctrans_t) 0)
+    return wc;
+
+  return wctrans_table_lookup ((const char *) desc, wc);
+}
+libc_hidden_def (__towctrans)
+weak_alias (__towctrans, towctrans)
diff --git a/REORG.TODO/wctype/towctrans_l.c b/REORG.TODO/wctype/towctrans_l.c
new file mode 100644
index 0000000000..f45f195f07
--- /dev/null
+++ b/REORG.TODO/wctype/towctrans_l.c
@@ -0,0 +1,35 @@
+/* Map wide character using given mapping and locale.
+   Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <wctype.h>
+
+/* Define the lookup function.  */
+#define USE_IN_EXTENDED_LOCALE_MODEL	1
+#include "wchar-lookup.h"
+
+wint_t
+__towctrans_l (wint_t wc, wctrans_t desc, __locale_t locale)
+{
+  /* If the user passes in an invalid DESC valid (the one returned from
+     `__wctrans_l' in case of an error) simply return the value.  */
+  if (desc == (wctrans_t) 0)
+    return wc;
+
+  return wctrans_table_lookup ((const char *) desc, wc);
+}
+weak_alias (__towctrans_l, towctrans_l)
diff --git a/REORG.TODO/wctype/wcfuncs.c b/REORG.TODO/wctype/wcfuncs.c
new file mode 100644
index 0000000000..e770b3c7fb
--- /dev/null
+++ b/REORG.TODO/wctype/wcfuncs.c
@@ -0,0 +1,94 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ctype.h>
+#include <wctype.h>
+#include <locale/localeinfo.h>
+
+#include "wchar-lookup.h"
+
+/* Provide real-function versions of all the wctype macros.  */
+
+#define	func(name, type)						      \
+  extern int __isw##name (wint_t __wc);					      \
+  int									      \
+  __isw##name (wint_t wc)						      \
+  {									      \
+    if (isascii (wc))							      \
+      return is##name ((int) wc);					      \
+    size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET) + type;    \
+    const char *desc = _NL_CURRENT (LC_CTYPE, i);			      \
+    return wctype_table_lookup (desc, wc);				      \
+  }									      \
+  weak_alias (__isw##name, isw##name)
+
+#undef iswalnum
+func (alnum, __ISwalnum)
+libc_hidden_def (__iswalnum)
+libc_hidden_weak (iswalnum)
+#undef iswalpha
+func (alpha, __ISwalpha)
+libc_hidden_weak (iswalpha)
+#undef iswblank
+func (blank, __ISwblank)
+#undef iswcntrl
+func (cntrl, __ISwcntrl)
+#undef iswdigit
+func (digit, __ISwdigit)
+libc_hidden_weak (iswdigit)
+#undef iswlower
+func (lower, __ISwlower)
+libc_hidden_def (__iswlower)
+libc_hidden_weak (iswlower)
+#undef iswgraph
+func (graph, __ISwgraph)
+#undef iswprint
+func (print, __ISwprint)
+#undef iswpunct
+func (punct, __ISwpunct)
+#undef iswspace
+func (space, __ISwspace)
+libc_hidden_weak (iswspace)
+#undef iswupper
+func (upper, __ISwupper)
+#undef iswxdigit
+func (xdigit, __ISwxdigit)
+libc_hidden_weak (iswxdigit)
+
+#undef towlower
+wint_t
+__towlower (wint_t wc)
+{
+  size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_tolower;
+  const char *desc = _NL_CURRENT (LC_CTYPE, i);
+  return wctrans_table_lookup (desc, wc);
+}
+libc_hidden_def (__towlower)
+weak_alias (__towlower, towlower)
+libc_hidden_weak (towlower)
+
+#undef towupper
+wint_t
+__towupper (wint_t wc)
+{
+  size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_toupper;
+  const char *desc = _NL_CURRENT (LC_CTYPE, i);
+  return wctrans_table_lookup (desc, wc);
+}
+libc_hidden_def (__towupper)
+weak_alias (__towupper, towupper)
+libc_hidden_weak (towupper)
diff --git a/REORG.TODO/wctype/wcfuncs_l.c b/REORG.TODO/wctype/wcfuncs_l.c
new file mode 100644
index 0000000000..994813bb62
--- /dev/null
+++ b/REORG.TODO/wctype/wcfuncs_l.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ctype.h>
+#include <wctype.h>
+#include <stdint.h>
+#include <locale.h>
+#include <locale/localeinfo.h>
+
+#define USE_IN_EXTENDED_LOCALE_MODEL
+#include "wchar-lookup.h"
+
+/* Provide real-function versions of all the wctype macros.  */
+
+#define	func(name, type) \
+  int __isw##name (wint_t wc, __locale_t locale)			      \
+  {									      \
+    if (isascii (wc))							      \
+      return is##name ((int) wc, locale);				      \
+    size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + type; \
+    const char *desc = locale->__locales[LC_CTYPE]->values[i].string;	      \
+    return wctype_table_lookup (desc, wc);				      \
+  }									      \
+  libc_hidden_def (__isw##name)						      \
+  weak_alias (__isw##name, isw##name)
+
+func (alnum_l, __ISwalnum)
+func (alpha_l, __ISwalpha)
+func (blank_l, __ISwblank)
+func (cntrl_l, __ISwcntrl)
+#undef iswdigit_l
+#undef __iswdigit_l
+func (digit_l, __ISwdigit)
+func (lower_l, __ISwlower)
+func (graph_l, __ISwgraph)
+func (print_l, __ISwprint)
+func (punct_l, __ISwpunct)
+func (space_l, __ISwspace)
+func (upper_l, __ISwupper)
+func (xdigit_l, __ISwxdigit)
+
+wint_t
+(__towlower_l) (wint_t wc, __locale_t locale)
+{
+  size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_tolower;
+  const char *desc = locale->__locales[LC_CTYPE]->values[i].string;
+  return wctrans_table_lookup (desc, wc);
+}
+libc_hidden_def (__towlower_l)
+weak_alias (__towlower_l, towlower_l)
+
+wint_t
+(__towupper_l) (wint_t wc, __locale_t locale)
+{
+  size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_toupper;
+  const char *desc = locale->__locales[LC_CTYPE]->values[i].string;
+  return wctrans_table_lookup (desc, wc);
+}
+libc_hidden_def (__towupper_l)
+weak_alias (__towupper_l, towupper_l)
diff --git a/REORG.TODO/wctype/wchar-lookup.h b/REORG.TODO/wctype/wchar-lookup.h
new file mode 100644
index 0000000000..cbf68937ea
--- /dev/null
+++ b/REORG.TODO/wctype/wchar-lookup.h
@@ -0,0 +1,143 @@
+/* Copyright (C) 2000-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdint.h>
+
+/* Tables indexed by a wide character are compressed through the use
+   of a multi-level lookup.  The compression effect comes from blocks
+   that don't need particular data and from blocks that can share their
+   data.  */
+
+/* Bit tables are accessed by cutting wc in four blocks of bits:
+   - the high 32-q-p bits,
+   - the next q bits,
+   - the next p bits,
+   - the next 5 bits.
+
+	    +------------------+-----+-----+-----+
+     wc  =  +     32-q-p-5     |  q  |  p  |  5  |
+	    +------------------+-----+-----+-----+
+
+   p and q are variable.  For 16-bit Unicode it is sufficient to
+   choose p and q such that q+p+5 <= 16.
+
+   The table contains the following uint32_t words:
+   - q+p+5,
+   - s = upper exclusive bound for wc >> (q+p+5),
+   - p+5,
+   - 2^q-1,
+   - 2^p-1,
+   - 1st-level table: s offsets, pointing into the 2nd-level table,
+   - 2nd-level table: k*2^q offsets, pointing into the 3rd-level table,
+   - 3rd-level table: j*2^p words, each containing 32 bits of data.
+*/
+
+static __inline int
+__attribute ((always_inline))
+wctype_table_lookup (const char *table, uint32_t wc)
+{
+  uint32_t shift1 = ((const uint32_t *) table)[0];
+  uint32_t index1 = wc >> shift1;
+  uint32_t bound = ((const uint32_t *) table)[1];
+  if (index1 < bound)
+    {
+      uint32_t lookup1 = ((const uint32_t *) table)[5 + index1];
+      if (lookup1 != 0)
+	{
+	  uint32_t shift2 = ((const uint32_t *) table)[2];
+	  uint32_t mask2 = ((const uint32_t *) table)[3];
+	  uint32_t index2 = (wc >> shift2) & mask2;
+	  uint32_t lookup2 = ((const uint32_t *)(table + lookup1))[index2];
+	  if (lookup2 != 0)
+	    {
+	      uint32_t mask3 = ((const uint32_t *) table)[4];
+	      uint32_t index3 = (wc >> 5) & mask3;
+	      uint32_t lookup3 = ((const uint32_t *)(table + lookup2))[index3];
+
+	      return (lookup3 >> (wc & 0x1f)) & 1;
+	    }
+	}
+    }
+  return 0;
+}
+
+/* Byte tables are similar to bit tables, except that the addressing
+   unit is a single byte, and no 5 bits are used as a word index.  */
+
+static __inline int
+__attribute ((always_inline))
+wcwidth_table_lookup (const char *table, uint32_t wc)
+{
+  uint32_t shift1 = ((const uint32_t *) table)[0];
+  uint32_t index1 = wc >> shift1;
+  uint32_t bound = ((const uint32_t *) table)[1];
+  if (index1 < bound)
+    {
+      uint32_t lookup1 = ((const uint32_t *) table)[5 + index1];
+      if (lookup1 != 0)
+	{
+	  uint32_t shift2 = ((const uint32_t *) table)[2];
+	  uint32_t mask2 = ((const uint32_t *) table)[3];
+	  uint32_t index2 = (wc >> shift2) & mask2;
+	  uint32_t lookup2 = ((const uint32_t *)(table + lookup1))[index2];
+	  if (lookup2 != 0)
+	    {
+	      uint32_t mask3 = ((const uint32_t *) table)[4];
+	      uint32_t index3 = wc & mask3;
+	      uint8_t lookup3 = ((const uint8_t *)(table + lookup2))[index3];
+
+	      return lookup3;
+	    }
+	}
+    }
+  return 0xff;
+}
+
+/* Mapping tables are similar to bit tables, except that the
+   addressing unit is a single signed 32-bit word, containing the
+   difference between the desired result and the argument, and no 5
+   bits are used as a word index.  */
+
+static __inline uint32_t
+__attribute ((always_inline))
+wctrans_table_lookup (const char *table, uint32_t wc)
+{
+  uint32_t shift1 = ((const uint32_t *) table)[0];
+  uint32_t index1 = wc >> shift1;
+  uint32_t bound = ((const uint32_t *) table)[1];
+  if (index1 < bound)
+    {
+      uint32_t lookup1 = ((const uint32_t *) table)[5 + index1];
+      if (lookup1 != 0)
+	{
+	  uint32_t shift2 = ((const uint32_t *) table)[2];
+	  uint32_t mask2 = ((const uint32_t *) table)[3];
+	  uint32_t index2 = (wc >> shift2) & mask2;
+	  uint32_t lookup2 = ((const uint32_t *)(table + lookup1))[index2];
+	  if (lookup2 != 0)
+	    {
+	      uint32_t mask3 = ((const uint32_t *) table)[4];
+	      uint32_t index3 = wc & mask3;
+	      int32_t lookup3 = ((const int32_t *)(table + lookup2))[index3];
+
+	      return wc + lookup3;
+	    }
+	}
+    }
+  return wc;
+}
diff --git a/REORG.TODO/wctype/wctrans.c b/REORG.TODO/wctype/wctrans.c
new file mode 100644
index 0000000000..5e6df23002
--- /dev/null
+++ b/REORG.TODO/wctype/wctrans.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <inttypes.h>
+#include <string.h>
+#include <wctype.h>
+#include "../locale/localeinfo.h"
+
+wctrans_t
+__wctrans (const char *property)
+{
+  const char *names;
+  size_t cnt;
+  size_t i;
+
+  names = _NL_CURRENT (LC_CTYPE, _NL_CTYPE_MAP_NAMES);
+  cnt = 0;
+  while (names[0] != '\0')
+    {
+      if (strcmp (property, names) == 0)
+	break;
+
+      names = strchr (names, '\0') + 1;
+      ++cnt;
+    }
+
+  if (names[0] == '\0')
+    return 0;
+
+  i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + cnt;
+  return (wctrans_t) _NL_CURRENT_DATA (LC_CTYPE)->values[i].string;
+}
+weak_alias (__wctrans, wctrans)
diff --git a/REORG.TODO/wctype/wctrans_l.c b/REORG.TODO/wctype/wctrans_l.c
new file mode 100644
index 0000000000..10a960bac1
--- /dev/null
+++ b/REORG.TODO/wctype/wctrans_l.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <locale.h>
+#include <string.h>
+#include <wctype.h>
+#include "../locale/localeinfo.h"
+
+wctrans_t
+__wctrans_l (const char *property, __locale_t locale)
+{
+  const char *names;
+  size_t cnt;
+  size_t i;
+
+  names = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_NAMES)].string;
+  cnt = 0;
+  while (names[0] != '\0')
+    {
+      if (strcmp (property, names) == 0)
+	break;
+
+      names = strchr (names, '\0') + 1;
+      ++cnt;
+    }
+
+  if (names[0] == '\0')
+    return 0;
+
+  i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + cnt;
+  return (wctrans_t) locale->__locales[LC_CTYPE]->values[i].string;
+}
+weak_alias (__wctrans_l, wctrans_l)
diff --git a/REORG.TODO/wctype/wctype.c b/REORG.TODO/wctype/wctype.c
new file mode 100644
index 0000000000..0f70bc8332
--- /dev/null
+++ b/REORG.TODO/wctype/wctype.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <endian.h>
+#include <string.h>
+#include <wctype.h>
+#include <locale/localeinfo.h>
+
+wctype_t
+__wctype (const char *property)
+{
+  const char *names;
+  unsigned int result;
+  size_t proplen = strlen (property);
+  size_t i;
+
+  names = _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS_NAMES);
+  for (result = 0; ; result++)
+    {
+      size_t nameslen = strlen (names);
+
+      if (proplen == nameslen && memcmp (property, names, proplen) == 0)
+	break;
+
+      names += nameslen + 1;
+      if (names[0] == '\0')
+	return 0;
+    }
+
+  i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET) + result;
+  return (wctype_t) _NL_CURRENT_DATA (LC_CTYPE)->values[i].string;
+}
+weak_alias (__wctype, wctype)
diff --git a/REORG.TODO/wctype/wctype.h b/REORG.TODO/wctype/wctype.h
new file mode 100644
index 0000000000..962aef1de6
--- /dev/null
+++ b/REORG.TODO/wctype/wctype.h
@@ -0,0 +1,148 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/*
+ *	ISO C99 Standard: 7.25
+ *	Wide character classification and mapping utilities  <wctype.h>
+ */
+
+#ifndef _WCTYPE_H
+#define _WCTYPE_H 1
+
+#include <features.h>
+#include <bits/types.h>
+#include <bits/types/wint_t.h>
+
+/* Constant expression of type `wint_t' whose value does not correspond
+   to any member of the extended character set.  */
+#ifndef WEOF
+# define WEOF (0xffffffffu)
+#endif
+
+/* Some definitions from this header also appear in <wchar.h> in
+   Unix98 mode.  */
+#include <bits/wctype-wchar.h>
+
+/*
+ * Extensible wide-character mapping functions: 7.15.3.2.
+ */
+
+__BEGIN_DECLS
+
+/* Scalar type that can hold values which represent locale-specific
+   character mappings.  */
+typedef const __int32_t *wctrans_t;
+
+/* Construct value that describes a mapping between wide characters
+   identified by the string argument PROPERTY.  */
+extern wctrans_t wctrans (const char *__property) __THROW;
+
+/* Map the wide character WC using the mapping described by DESC.  */
+extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
+
+# ifdef __USE_XOPEN2K8
+/* Declare the interface to extended locale model.  */
+#  include <xlocale.h>
+
+/* Test for any wide character for which `iswalpha' or `iswdigit' is
+   true.  */
+extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Test for any wide character for which `iswupper' or 'iswlower' is
+   true, or any wide character that is one of a locale-specific set of
+   wide-characters for which none of `iswcntrl', `iswdigit',
+   `iswpunct', or `iswspace' is true.  */
+extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Test for any control wide character.  */
+extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Test for any wide character that corresponds to a decimal-digit
+   character.  */
+extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Test for any wide character for which `iswprint' is true and
+   `iswspace' is false.  */
+extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Test for any wide character that corresponds to a lowercase letter
+   or is one of a locale-specific set of wide characters for which
+   none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true.  */
+extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Test for any printing wide character.  */
+extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Test for any printing wide character that is one of a
+   locale-specific et of wide characters for which neither `iswspace'
+   nor `iswalnum' is true.  */
+extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Test for any wide character that corresponds to a locale-specific
+   set of wide characters for which none of `iswalnum', `iswgraph', or
+   `iswpunct' is true.  */
+extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Test for any wide character that corresponds to an uppercase letter
+   or is one of a locale-specific set of wide character for which none
+   of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true.  */
+extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Test for any wide character that corresponds to a hexadecimal-digit
+   character equivalent to that performed be the functions described
+   in the previous subclause.  */
+extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Test for any wide character that corresponds to a standard blank
+   wide character or a locale-specific set of wide characters for
+   which `iswalnum' is false.  */
+extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Construct value that describes a class of wide characters identified
+   by the string argument PROPERTY.  */
+extern wctype_t wctype_l (const char *__property, __locale_t __locale)
+     __THROW;
+
+/* Determine whether the wide-character WC has the property described by
+   DESC.  */
+extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
+     __THROW;
+
+/*
+ * Wide-character case-mapping functions.
+ */
+
+/* Converts an uppercase letter to the corresponding lowercase letter.  */
+extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Converts an lowercase letter to the corresponding uppercase letter.  */
+extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW;
+
+/* Construct value that describes a mapping between wide characters
+   identified by the string argument PROPERTY.  */
+extern wctrans_t wctrans_l (const char *__property, __locale_t __locale)
+     __THROW;
+
+/* Map the wide character WC using the mapping described by DESC.  */
+extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc,
+			   __locale_t __locale) __THROW;
+
+# endif /* Use POSIX 2008.  */
+
+__END_DECLS
+
+#endif /* wctype.h  */
diff --git a/REORG.TODO/wctype/wctype_l.c b/REORG.TODO/wctype/wctype_l.c
new file mode 100644
index 0000000000..c17a1e9ce6
--- /dev/null
+++ b/REORG.TODO/wctype/wctype_l.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <endian.h>
+#include <locale.h>
+#include <string.h>
+#include <wctype.h>
+#include <locale/localeinfo.h>
+
+wctype_t
+__wctype_l (const char *property, __locale_t locale)
+{
+  const char *names;
+  unsigned int result;
+  size_t proplen = strlen (property);
+  size_t i;
+
+  names = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_NAMES)].string;
+  for (result = 0; ; result++)
+    {
+      size_t nameslen = strlen (names);
+
+      if (proplen == nameslen && memcmp (property, names, proplen) == 0)
+	break;
+
+      names += nameslen + 1;
+      if (names[0] == '\0')
+	return 0;
+    }
+
+  i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + result;
+  return (wctype_t) locale->__locales[LC_CTYPE]->values[i].string;
+}
+weak_alias (__wctype_l, wctype_l)