[PATCH] libc/ctype: Migrate to upstream musl

24 views
Skip to first unread message

Pekka Enberg

unread,
Nov 25, 2014, 6:29:09 AM11/25/14
to osv...@googlegroups.com, Pekka Enberg
The files under libc/ctype were added in commit 5cd0168 ("add the string
library from musl") and they have not been modified since. The imported
version is unknown but the difference to our musl git submodule are
cosmetic.

Signed-off-by: Pekka Enberg <pen...@cloudius-systems.com>
---
libc/build.mk | 46 ++++-----
libc/ctype/alpha.h | 125 ----------------------
libc/ctype/isalnum.c | 7 --
libc/ctype/isascii.c | 7 --
libc/ctype/isblank.c | 7 --
libc/ctype/iscntrl.c | 7 --
libc/ctype/ispunct.c | 7 --
libc/ctype/isspace.c | 7 --
libc/ctype/iswalnum.c | 8 --
libc/ctype/iswblank.c | 9 --
libc/ctype/iswcntrl.c | 11 --
libc/ctype/iswgraph.c | 8 --
libc/ctype/iswlower.c | 7 --
libc/ctype/iswprint.c | 20 ----
libc/ctype/iswpunct.c | 13 ---
libc/ctype/iswspace.c | 20 ----
libc/ctype/iswupper.c | 7 --
libc/ctype/iswxdigit.c | 8 --
libc/ctype/isxdigit.c | 7 --
libc/ctype/nonspacing.h | 62 -----------
libc/ctype/punct.h | 109 -------------------
libc/ctype/toascii.c | 8 --
libc/ctype/tolower.c | 8 --
libc/ctype/toupper.c | 8 --
libc/ctype/towctrans.c | 270 ------------------------------------------------
libc/ctype/wcswidth.c | 10 --
libc/ctype/wcwidth.c | 29 ------
libc/ctype/wide.h | 42 --------
28 files changed, 23 insertions(+), 854 deletions(-)
delete mode 100644 libc/ctype/alpha.h
delete mode 100644 libc/ctype/isalnum.c
delete mode 100644 libc/ctype/isascii.c
delete mode 100644 libc/ctype/isblank.c
delete mode 100644 libc/ctype/iscntrl.c
delete mode 100644 libc/ctype/ispunct.c
delete mode 100644 libc/ctype/isspace.c
delete mode 100644 libc/ctype/iswalnum.c
delete mode 100644 libc/ctype/iswblank.c
delete mode 100644 libc/ctype/iswcntrl.c
delete mode 100644 libc/ctype/iswgraph.c
delete mode 100644 libc/ctype/iswlower.c
delete mode 100644 libc/ctype/iswprint.c
delete mode 100644 libc/ctype/iswpunct.c
delete mode 100644 libc/ctype/iswspace.c
delete mode 100644 libc/ctype/iswupper.c
delete mode 100644 libc/ctype/iswxdigit.c
delete mode 100644 libc/ctype/isxdigit.c
delete mode 100644 libc/ctype/nonspacing.h
delete mode 100644 libc/ctype/punct.h
delete mode 100644 libc/ctype/toascii.c
delete mode 100644 libc/ctype/tolower.c
delete mode 100644 libc/ctype/toupper.c
delete mode 100644 libc/ctype/towctrans.c
delete mode 100644 libc/ctype/wcswidth.c
delete mode 100644 libc/ctype/wcwidth.c
delete mode 100644 libc/ctype/wide.h

diff --git a/libc/build.mk b/libc/build.mk
index bd37f00..0ea6123 100644
--- a/libc/build.mk
+++ b/libc/build.mk
@@ -16,39 +16,39 @@ libc += internal/shgetc.o
musl += ctype/__ctype_get_mb_cur_max.o
musl += ctype/__ctype_tolower_loc.o
musl += ctype/__ctype_toupper_loc.o
-libc += ctype/isalnum.o
+musl += ctype/isalnum.o
musl += ctype/isalpha.o
-libc += ctype/isascii.o
-libc += ctype/isblank.o
-libc += ctype/iscntrl.o
+musl += ctype/isascii.o
+musl += ctype/isblank.o
+musl += ctype/iscntrl.o
musl += ctype/isdigit.o
musl += ctype/isgraph.o
musl += ctype/islower.o
musl += ctype/isprint.o
-libc += ctype/ispunct.o
-libc += ctype/isspace.o
+musl += ctype/ispunct.o
+musl += ctype/isspace.o
musl += ctype/isupper.o
-libc += ctype/iswalnum.o
+musl += ctype/iswalnum.o
musl += ctype/iswalpha.o
-libc += ctype/iswblank.o
-libc += ctype/iswcntrl.o
+musl += ctype/iswblank.o
+musl += ctype/iswcntrl.o
musl += ctype/iswctype.o
musl += ctype/iswdigit.o
-libc += ctype/iswgraph.o
-libc += ctype/iswlower.o
-libc += ctype/iswprint.o
-libc += ctype/iswpunct.o
-libc += ctype/iswspace.o
-libc += ctype/iswupper.o
-libc += ctype/iswxdigit.o
-libc += ctype/isxdigit.o
-libc += ctype/toascii.o
-libc += ctype/tolower.o
-libc += ctype/toupper.o
-libc += ctype/towctrans.o
-libc += ctype/wcswidth.o
+musl += ctype/iswgraph.o
+musl += ctype/iswlower.o
+musl += ctype/iswprint.o
+musl += ctype/iswpunct.o
+musl += ctype/iswspace.o
+musl += ctype/iswupper.o
+musl += ctype/iswxdigit.o
+musl += ctype/isxdigit.o
+musl += ctype/toascii.o
+musl += ctype/tolower.o
+musl += ctype/toupper.o
+musl += ctype/towctrans.o
+musl += ctype/wcswidth.o
musl += ctype/wctrans.o
-libc += ctype/wcwidth.o
+musl += ctype/wcwidth.o

musl += dirent/alphasort.o
musl += dirent/scandir.o
diff --git a/libc/ctype/alpha.h b/libc/ctype/alpha.h
deleted file mode 100644
index b318c82..0000000
diff --git a/libc/ctype/isalnum.c b/libc/ctype/isalnum.c
deleted file mode 100644
index 5fcfb77..0000000
diff --git a/libc/ctype/isascii.c b/libc/ctype/isascii.c
deleted file mode 100644
index 54ad3bf..0000000
diff --git a/libc/ctype/isblank.c b/libc/ctype/isblank.c
deleted file mode 100644
index 4583e5f..0000000
diff --git a/libc/ctype/iscntrl.c b/libc/ctype/iscntrl.c
deleted file mode 100644
index fae88a4..0000000
diff --git a/libc/ctype/ispunct.c b/libc/ctype/ispunct.c
deleted file mode 100644
index a1595c2..0000000
diff --git a/libc/ctype/isspace.c b/libc/ctype/isspace.c
deleted file mode 100644
index 55f9d59..0000000
diff --git a/libc/ctype/iswalnum.c b/libc/ctype/iswalnum.c
deleted file mode 100644
index cfe626f..0000000
diff --git a/libc/ctype/iswblank.c b/libc/ctype/iswblank.c
deleted file mode 100644
index 1061c1a..0000000
diff --git a/libc/ctype/iswcntrl.c b/libc/ctype/iswcntrl.c
deleted file mode 100644
index bbaf0c1..0000000
diff --git a/libc/ctype/iswgraph.c b/libc/ctype/iswgraph.c
deleted file mode 100644
index 2261cf2..0000000
diff --git a/libc/ctype/iswlower.c b/libc/ctype/iswlower.c
deleted file mode 100644
index 2b5012a..0000000
diff --git a/libc/ctype/iswprint.c b/libc/ctype/iswprint.c
deleted file mode 100644
index d482c19..0000000
diff --git a/libc/ctype/iswpunct.c b/libc/ctype/iswpunct.c
deleted file mode 100644
index 1d32852..0000000
diff --git a/libc/ctype/iswspace.c b/libc/ctype/iswspace.c
deleted file mode 100644
index 08340ca..0000000
diff --git a/libc/ctype/iswupper.c b/libc/ctype/iswupper.c
deleted file mode 100644
index 7c0bcbb..0000000
diff --git a/libc/ctype/iswxdigit.c b/libc/ctype/iswxdigit.c
deleted file mode 100644
index 894babd..0000000
diff --git a/libc/ctype/isxdigit.c b/libc/ctype/isxdigit.c
deleted file mode 100644
index 579edb9..0000000
diff --git a/libc/ctype/nonspacing.h b/libc/ctype/nonspacing.h
deleted file mode 100644
index 4c25ef5..0000000
diff --git a/libc/ctype/punct.h b/libc/ctype/punct.h
deleted file mode 100644
index 466e6b3..0000000
diff --git a/libc/ctype/toascii.c b/libc/ctype/toascii.c
deleted file mode 100644
index 27c5664..0000000
diff --git a/libc/ctype/tolower.c b/libc/ctype/tolower.c
deleted file mode 100644
index 07db2b7..0000000
diff --git a/libc/ctype/toupper.c b/libc/ctype/toupper.c
deleted file mode 100644
index eb18552..0000000
diff --git a/libc/ctype/towctrans.c b/libc/ctype/towctrans.c
deleted file mode 100644
index d7718f2..0000000
diff --git a/libc/ctype/wcswidth.c b/libc/ctype/wcswidth.c
deleted file mode 100644
index 72acc90..0000000
diff --git a/libc/ctype/wcwidth.c b/libc/ctype/wcwidth.c
deleted file mode 100644
index d858e80..0000000
diff --git a/libc/ctype/wide.h b/libc/ctype/wide.h
deleted file mode 100644
index 125d0ce..0000000
--
1.9.3

Nadav Har'El

unread,
Nov 25, 2014, 6:52:21 AM11/25/14
to Pekka Enberg, Osv Dev
Reviewed-by: Nadav Har'El <n...@cloudius-systems.com>

Looks good. I see many of our versions of the file started with an "#undef", which perhaps was needed for a different version of <ctype.h>, so it's good we don't need it any more.

The only change I'm slightly worried about is towctrans.c, where the code now (musl's version) has these lines:

        if (lower && (unsigned)wc - 0x10a0 < 0x2e)
                if (wc>0x10c5 && wc != 0x10c7 && wc != 0x10cd) return wc;
                else return wc + 0x2d00 - 0x10a0;

Whether the "else" binds to the inner or outer if() is a classic ambiguity in compiler design (see http://www.gnu.org/software/bison/manual/html_node/Shift_002fReduce.html and http://en.wikipedia.org/wiki/Dangling_else), and I've seen in the past gcc *warn* about it, although in principle, the C standard resolves this ambiguity (the "else" binds to the nearest "if", so the above code is indented correctly). I am guessing (?) this is why Christoph added braces in his version of this code. Can you please check we don't have warnings in that file? If we don't have warnings, then this code is fine.




--
1.9.3

--
You received this message because you are subscribed to the Google Groups "OSv Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Pekka Enberg

unread,
Nov 25, 2014, 7:28:37 AM11/25/14
to Nadav Har'El, Osv Dev
On Tue, Nov 25, 2014 at 1:52 PM, Nadav Har'El <n...@cloudius-systems.com> wrote:
> Reviewed-by: Nadav Har'El <n...@cloudius-systems.com>
>
> Looks good. I see many of our versions of the file started with an "#undef",
> which perhaps was needed for a different version of <ctype.h>, so it's good
> we don't need it any more.
>
> The only change I'm slightly worried about is towctrans.c, where the code
> now (musl's version) has these lines:
>
> if (lower && (unsigned)wc - 0x10a0 < 0x2e)
> if (wc>0x10c5 && wc != 0x10c7 && wc != 0x10cd) return wc;
> else return wc + 0x2d00 - 0x10a0;
>
> Whether the "else" binds to the inner or outer if() is a classic ambiguity
> in compiler design (see
> http://www.gnu.org/software/bison/manual/html_node/Shift_002fReduce.html and
> http://en.wikipedia.org/wiki/Dangling_else), and I've seen in the past gcc
> *warn* about it, although in principle, the C standard resolves this
> ambiguity (the "else" binds to the nearest "if", so the above code is
> indented correctly). I am guessing (?) this is why Christoph added braces in
> his version of this code. Can you please check we don't have warnings in
> that file? If we don't have warnings, then this code is fine.

I don't see any warnings with GCC 4.8.3.

- Pekka

Commit Bot

unread,
Nov 25, 2014, 7:30:16 AM11/25/14
to osv...@googlegroups.com
From: Pekka Enberg <pen...@cloudius-systems.com>

libc/ctype: Migrate to upstream musl

The files under libc/ctype were added in commit 5cd0168 ("add the string
library from musl") and they have not been modified since. The imported
version is unknown but the difference to our musl git submodule are
cosmetic.

Reviewed-by: Nadav Har'El <n...@cloudius-systems.com>
Signed-off-by: Pekka Enberg <pen...@cloudius-systems.com>

---
diff --git a/libc/build.mk b/libc/build.mk
--- a/libc/ctype/alpha.h
+++ b/libc/ctype/alpha.h
@@ -1,125 +0,0 @@
-18,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,17,34,35,36,17,37,38,39,40,
-41,42,43,44,17,45,46,47,16,16,48,16,16,16,16,16,16,16,49,50,51,16,52,53,16,16,
-17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,54,
-17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
-17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
-17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
-17,17,17,55,17,17,17,17,56,17,57,58,59,60,61,62,17,17,17,17,17,17,17,17,17,17,
-17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
-17,17,17,17,17,17,17,63,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,64,65,17,66,67,68,69,70,71,72,
-73,16,16,16,74,75,76,77,78,16,16,16,79,80,16,16,16,16,81,16,16,16,16,16,16,16,
-16,16,17,17,17,82,83,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,84,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,85,16,
-16,16,16,86,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,87,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-88,89,90,91,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-92,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,0,0,0,0,0,0,0,0,254,255,255,7,254,255,255,7,0,0,0,0,0,4,32,4,
-255,255,127,255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,195,255,3,0,31,80,0,0,0,0,
-0,0,0,0,0,0,32,0,0,0,0,0,223,60,64,215,255,255,251,255,255,255,255,255,255,
-255,255,255,191,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,3,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,0,254,255,255,255,127,2,254,255,255,255,255,0,0,0,0,0,255,191,182,
-0,255,255,255,7,7,0,0,0,255,7,255,255,255,255,255,255,255,254,255,195,255,255,
-255,255,255,255,255,255,255,255,255,255,239,31,254,225,255,159,0,0,255,255,
-255,255,255,255,0,224,255,255,255,255,255,255,255,255,255,255,255,255,3,0,255,
-255,255,255,255,7,48,4,255,255,255,252,255,31,0,0,255,255,255,1,0,0,0,0,0,0,0,
-0,253,31,0,0,0,0,0,0,240,3,255,127,255,255,255,255,255,255,255,239,255,223,
-225,255,207,255,254,254,238,159,249,255,255,253,197,227,159,89,128,176,207,
-255,3,0,238,135,249,255,255,253,109,195,135,25,2,94,192,255,63,0,238,191,251,
-255,255,253,237,227,191,27,1,0,207,255,0,0,238,159,249,255,255,253,237,227,
-159,25,192,176,207,255,2,0,236,199,61,214,24,199,255,195,199,29,129,0,192,255,
-0,0,238,223,253,255,255,253,239,227,223,29,96,3,207,255,0,0,236,223,253,255,
-255,253,239,227,223,29,96,64,207,255,6,0,236,223,253,255,255,255,255,231,223,
-93,128,0,207,255,0,252,236,255,127,252,255,255,251,47,127,128,95,255,0,0,12,0,
-254,255,255,255,255,127,255,7,63,32,255,3,0,0,0,0,150,37,240,254,174,236,255,
-59,95,32,255,243,0,0,0,0,1,0,0,0,255,3,0,0,255,254,255,255,255,31,254,255,3,
-255,255,254,255,255,255,31,0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,249,
-255,3,255,255,231,193,255,255,127,64,255,51,255,255,255,255,191,32,255,255,
-255,255,255,247,255,255,255,255,255,255,255,255,255,61,127,61,255,255,255,255,
-255,61,255,255,255,255,61,127,61,255,127,255,255,255,255,255,255,255,61,255,
-255,255,255,255,255,255,255,135,0,0,0,0,255,255,0,0,255,255,255,255,255,255,
-255,255,255,255,31,0,254,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,159,255,255,254,255,255,7,255,
-255,255,255,255,255,255,255,255,199,1,0,255,223,15,0,255,255,15,0,255,255,15,
-0,255,223,13,0,255,255,255,255,255,255,207,255,255,1,128,16,255,3,0,0,0,0,255,
-3,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,7,255,255,
-255,255,255,255,255,255,63,0,255,255,255,31,255,15,255,1,192,255,255,255,255,
-63,31,0,255,255,255,255,255,15,255,255,255,3,255,3,0,0,0,0,255,255,255,15,255,
-255,255,255,255,255,255,127,254,255,31,0,255,3,255,3,128,0,0,0,0,0,0,0,0,0,0,
-0,255,255,255,255,255,255,239,255,239,15,255,3,0,0,0,0,255,255,255,255,255,
-243,255,255,255,255,255,255,191,255,3,0,255,255,255,255,255,255,63,0,255,227,
-255,255,255,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,222,111,0,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,0,0,0,0,0,0,0,0,255,255,63,63,255,255,255,255,63,63,255,170,255,255,255,
-63,255,255,255,255,255,255,223,95,220,31,207,15,255,31,220,31,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,2,128,0,0,255,31,0,0,0,0,0,0,0,0,0,0,0,0,132,252,47,62,80,189,255,
-243,224,67,0,0,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,255,255,255,255,255,255,3,0,0,255,255,255,
-255,255,127,255,255,255,255,255,127,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,31,120,12,0,255,255,255,255,191,32,255,255,255,255,
-255,255,255,128,0,0,255,255,127,0,127,127,127,127,127,127,127,127,255,255,255,
-255,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,0,0,
-0,254,3,62,31,254,255,255,255,255,255,255,255,255,255,127,224,254,255,255,255,
-255,255,255,255,255,255,255,247,224,255,255,255,255,63,254,255,255,255,255,
-255,255,255,255,255,255,127,0,0,255,255,255,7,0,0,0,0,0,0,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-63,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,31,0,0,0,0,0,0,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,0,0,0,0,0,0,255,
-255,255,255,255,63,255,31,255,255,255,15,0,0,255,255,255,255,255,127,240,143,
-255,255,255,128,255,255,255,255,255,255,255,255,255,255,0,0,0,0,128,255,252,
-255,255,255,255,255,255,255,255,255,255,255,255,121,15,0,255,7,0,0,0,0,0,0,0,
-0,0,255,187,247,255,255,255,0,0,0,255,255,255,255,255,255,15,0,255,255,255,
-255,255,255,255,255,15,0,255,3,0,0,252,8,255,255,255,255,255,7,255,255,255,
-255,7,0,255,255,255,31,255,255,255,255,255,255,247,255,0,128,255,3,0,0,0,0,
-255,255,255,255,255,255,127,0,255,63,255,3,255,255,127,4,255,255,255,255,255,
-255,255,127,5,0,0,56,255,255,60,0,126,126,126,0,127,127,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,255,255,255,255,255,7,255,3,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,15,0,255,255,127,248,255,255,255,
-255,255,15,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,
-255,255,255,255,255,255,255,255,255,255,3,0,0,0,0,127,0,248,224,255,253,127,
-95,219,255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0,0,248,255,
-255,255,255,255,255,255,255,255,255,255,255,63,0,0,255,255,255,255,255,255,
-255,255,252,255,255,255,255,255,255,0,0,0,0,0,255,15,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,223,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,
-0,255,3,254,255,255,7,254,255,255,7,192,255,255,255,255,255,255,255,255,255,
-255,127,252,252,252,28,0,0,0,0,255,239,255,255,127,255,255,183,255,63,255,63,
-0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,7,0,0,0,0,
-0,0,0,0,255,255,255,255,255,255,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,31,255,255,255,255,255,255,1,0,0,0,0,0,
-255,255,255,127,0,0,255,255,255,7,0,0,0,0,0,0,255,255,255,63,255,255,255,255,
-15,255,62,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,63,255,3,0,0,0,0,0,0,0,0,0,0,63,253,255,255,255,255,191,
-145,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,63,0,255,255,
-255,3,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,192,0,0,0,0,0,0,0,0,111,240,
-239,254,255,255,15,0,0,0,0,0,255,255,255,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-255,255,255,255,255,255,63,0,255,255,63,0,255,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,255,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,255,255,255,255,255,255,255,255,63,0,0,0,192,255,0,0,252,255,255,
-255,255,255,255,1,0,0,255,255,255,1,255,3,255,255,255,255,255,255,199,255,0,0,
-0,0,0,0,0,0,255,255,255,255,255,255,255,255,30,0,255,3,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,63,0,255,3,0,0,0,0,0,0,255,255,255,
-255,255,255,255,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,255,255,255,255,255,255,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,255,255,255,255,255,255,255,255,31,0,255,255,255,255,255,127,0,0,
-248,255,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,
-255,255,255,255,223,100,222,255,235,239,255,255,255,255,255,255,255,191,231,
-223,223,255,255,255,123,95,252,253,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,253,255,255,
-247,255,255,255,247,255,255,223,255,255,255,223,255,255,127,255,255,255,127,
-255,255,255,253,255,255,255,253,255,255,247,207,255,255,255,255,255,255,239,
-255,255,255,150,254,247,10,132,234,150,170,150,247,247,94,255,251,255,15,238,
-251,255,15,0,0,0,0,0,0,0,0,
diff --git a/libc/ctype/isalnum.c b/libc/ctype/isalnum.c
--- a/libc/ctype/isalnum.c
+++ b/libc/ctype/isalnum.c
@@ -1,7 +0,0 @@
-#include <ctype.h>
-#undef isalnum
-
-int isalnum(int c)
-{
- return isalpha(c) || isdigit(c);
-}
diff --git a/libc/ctype/isascii.c b/libc/ctype/isascii.c
--- a/libc/ctype/isascii.c
+++ b/libc/ctype/isascii.c
@@ -1,7 +0,0 @@
-#include <ctype.h>
-#undef isascii
-
-int isascii(int c)
-{
- return !(c&~0x7f);
-}
diff --git a/libc/ctype/isblank.c b/libc/ctype/isblank.c
--- a/libc/ctype/isblank.c
+++ b/libc/ctype/isblank.c
@@ -1,7 +0,0 @@
-#include <ctype.h>
-#undef isblank
-
-int isblank(int c)
-{
- return (c == ' ' || c == '\t');
-}
diff --git a/libc/ctype/iscntrl.c b/libc/ctype/iscntrl.c
--- a/libc/ctype/iscntrl.c
+++ b/libc/ctype/iscntrl.c
@@ -1,7 +0,0 @@
-#include <ctype.h>
-#undef iscntrl
-
-int iscntrl(int c)
-{
- return (unsigned)c < 0x20 || c == 0x7f;
-}
diff --git a/libc/ctype/ispunct.c b/libc/ctype/ispunct.c
--- a/libc/ctype/ispunct.c
+++ b/libc/ctype/ispunct.c
@@ -1,7 +0,0 @@
-#include <ctype.h>
-#undef ispunct
-
-int ispunct(int c)
-{
- return isgraph(c) && !isalnum(c);
-}
diff --git a/libc/ctype/isspace.c b/libc/ctype/isspace.c
--- a/libc/ctype/isspace.c
+++ b/libc/ctype/isspace.c
@@ -1,7 +0,0 @@
-#include <ctype.h>
-#undef isspace
-
-int isspace(int c)
-{
- return c == ' ' || (unsigned)c-'\t' < 5;
-}
diff --git a/libc/ctype/iswalnum.c b/libc/ctype/iswalnum.c
--- a/libc/ctype/iswalnum.c
+++ b/libc/ctype/iswalnum.c
@@ -1,8 +0,0 @@
-#include <wchar.h>
-#include <wctype.h>
-#undef iswalnum
-
-int iswalnum(wint_t wc)
-{
- return iswdigit(wc) || iswalpha(wc);
-}
diff --git a/libc/ctype/iswblank.c b/libc/ctype/iswblank.c
--- a/libc/ctype/iswblank.c
+++ b/libc/ctype/iswblank.c
@@ -1,9 +0,0 @@
-#include <wchar.h>
-#include <wctype.h>
-#include <ctype.h>
-#undef iswcntrl
-
-int iswblank(wint_t wc)
-{
- return isblank(wc);
-}
diff --git a/libc/ctype/iswcntrl.c b/libc/ctype/iswcntrl.c
--- a/libc/ctype/iswcntrl.c
+++ b/libc/ctype/iswcntrl.c
@@ -1,11 +0,0 @@
-#include <wchar.h>
-#include <wctype.h>
-#undef iswcntrl
-
-int iswcntrl(wint_t wc)
-{
- return (unsigned)wc < 32
- || (unsigned)(wc-0x7f) < 33
- || (unsigned)(wc-0x2028) < 2
- || (unsigned)(wc-0xfff9) < 3;
-}
diff --git a/libc/ctype/iswgraph.c b/libc/ctype/iswgraph.c
--- a/libc/ctype/iswgraph.c
+++ b/libc/ctype/iswgraph.c
@@ -1,8 +0,0 @@
-#include <wctype.h>
-#undef iswgraph
-
-int iswgraph(wint_t wc)
-{
- /* ISO C defines this function as: */
- return !iswspace(wc) && iswprint(wc);
-}
diff --git a/libc/ctype/iswlower.c b/libc/ctype/iswlower.c
--- a/libc/ctype/iswlower.c
+++ b/libc/ctype/iswlower.c
@@ -1,7 +0,0 @@
-#include <wctype.h>
-#undef iswlower
-
-int iswlower(wint_t wc)
-{
- return towupper(wc) != wc || wc == 0xdf;
-}
diff --git a/libc/ctype/iswprint.c b/libc/ctype/iswprint.c
--- a/libc/ctype/iswprint.c
+++ b/libc/ctype/iswprint.c
@@ -1,20 +0,0 @@
-#include <wctype.h>
-#undef iswprint
-
-/* Consider all legal codepoints as printable except for:
- * - C0 and C1 control characters
- * - U+2028 and U+2029 (line/para break)
- * - U+FFF9 through U+FFFB (interlinear annotation controls)
- * The following code is optimized heavily to make hot paths for the
- * expected printable characters. */
-
-int iswprint(wint_t wc)
-{
- if (wc < 0xffU)
- return ((wc+1) & 0x7f) >= 0x21;
- if (wc < 0x2028U || wc-0x202aU < 0xd800-0x202a || wc-0xe000U <
0xfff9-0xe000)
- return 1;
- if (wc-0xfffcU > 0x10ffff-0xfffc || (wc&0xfffe)==0xfffe)
- return 0;
- return 1;
-}
diff --git a/libc/ctype/iswpunct.c b/libc/ctype/iswpunct.c
--- a/libc/ctype/iswpunct.c
+++ b/libc/ctype/iswpunct.c
@@ -1,13 +0,0 @@
-#include <wctype.h>
-#undef iswpunct
-
-static const unsigned char table[] = {
-#include "punct.h"
-};
-
-int iswpunct(wint_t wc)
-{
- if (wc<0x20000U)
- return (table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1;
- return 0;
-}
diff --git a/libc/ctype/iswspace.c b/libc/ctype/iswspace.c
--- a/libc/ctype/iswspace.c
+++ b/libc/ctype/iswspace.c
@@ -1,20 +0,0 @@
-#include <wchar.h>
-#include <wctype.h>
-#include <ctype.h>
-#undef iswspace
-
-/* Our definition of whitespace is the Unicode White_Space property,
- * minus non-breaking spaces (U+00A0, U+2007, and U+202F) and script-
- * specific characters with non-blank glyphs (U+1680 and U+180E). */
-
-int iswspace(wint_t wc)
-{
- static const wchar_t spaces[] = {
- ' ', '\t', '\n', '\r', 11, 12, 0x0085,
- 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005,
- 0x2006, 0x2008, 0x2009, 0x200a,
- 0x2028, 0x2029, 0x205f, 0x3000, 0
- };
- if (wcschr(spaces, wc)) return 1;
- return 0;
-}
diff --git a/libc/ctype/iswupper.c b/libc/ctype/iswupper.c
--- a/libc/ctype/iswupper.c
+++ b/libc/ctype/iswupper.c
@@ -1,7 +0,0 @@
-#include <wctype.h>
-#undef iswupper
-
-int iswupper(wint_t wc)
-{
- return towlower(wc) != wc;
-}
diff --git a/libc/ctype/iswxdigit.c b/libc/ctype/iswxdigit.c
--- a/libc/ctype/iswxdigit.c
+++ b/libc/ctype/iswxdigit.c
@@ -1,8 +0,0 @@
-#include <wchar.h>
-#include <wctype.h>
-#undef iswxdigit
-
-int iswxdigit(wint_t wc)
-{
- return (unsigned)(wc-'0') < 10 || (unsigned)((wc|32)-'a') < 6;
-}
diff --git a/libc/ctype/isxdigit.c b/libc/ctype/isxdigit.c
--- a/libc/ctype/isxdigit.c
+++ b/libc/ctype/isxdigit.c
@@ -1,7 +0,0 @@
-#include <ctype.h>
-#undef isxdigit
-
-int isxdigit(int c)
-{
- return isdigit(c) || ((unsigned)c|32)-'a' < 6;
-}
diff --git a/libc/ctype/nonspacing.h b/libc/ctype/nonspacing.h
--- a/libc/ctype/nonspacing.h
+++ b/libc/ctype/nonspacing.h
@@ -1,62 +0,0 @@
-16,16,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,16,16,32,16,16,16,33,34,35,
-36,37,38,39,16,16,40,16,16,16,16,16,16,16,16,16,16,16,41,42,16,16,43,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,44,16,45,46,47,48,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,49,16,16,50,51,16,52,16,16,
-16,16,16,16,16,16,53,16,16,16,16,16,54,55,16,16,16,16,56,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,57,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,58,59,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,3,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,255,255,255,255,191,
-182,0,0,0,0,0,0,0,31,0,255,7,0,0,0,0,0,248,255,255,0,0,1,0,0,0,0,0,0,0,0,0,0,
-0,192,191,159,61,0,0,0,128,2,0,0,0,255,255,255,7,0,0,0,0,0,0,0,0,0,0,192,255,
-1,0,0,0,0,0,0,248,15,0,0,0,192,251,239,62,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,240,255,255,127,7,0,0,0,0,0,0,20,254,33,254,0,12,0,0,0,2,0,0,0,0,0,
-0,16,30,32,0,0,12,0,0,0,6,0,0,0,0,0,0,16,134,57,2,0,0,0,35,0,6,0,0,0,0,0,0,16,
-190,33,0,0,12,0,0,0,2,0,0,0,0,0,0,144,30,32,64,0,12,0,0,0,4,0,0,0,0,0,0,0,1,
-32,0,0,0,0,0,0,0,0,0,0,0,0,0,192,193,61,96,0,12,0,0,0,0,0,0,0,0,0,0,144,64,48,
-0,0,12,0,0,0,0,0,0,0,0,0,0,0,30,32,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,4,92,0,0,0,
-0,0,0,0,0,0,0,0,242,7,128,127,0,0,0,0,0,0,0,0,0,0,0,0,242,27,0,63,0,0,0,0,0,0,
-0,0,0,3,0,0,160,2,0,0,0,0,0,0,254,127,223,224,255,254,255,255,255,31,64,0,0,0,
-0,0,0,0,0,0,0,0,0,224,253,102,0,0,0,195,1,0,30,0,100,32,0,32,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-28,0,0,0,28,0,0,0,12,0,0,0,12,0,0,0,0,0,0,0,176,63,64,254,15,32,0,0,0,0,0,56,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,1,4,
-14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,1,0,0,0,0,0,0,64,
-127,229,31,248,159,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,208,23,4,0,0,
-0,0,248,15,0,3,0,0,0,60,11,0,0,0,0,0,0,64,163,3,0,0,0,0,0,0,240,207,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,247,255,253,33,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,255,255,255,255,127,0,0,240,0,248,0,0,0,124,0,0,0,0,0,0,31,
-252,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,
-0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,0,60,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,247,63,0,0,0,128,0,0,0,0,0,
-0,0,0,0,0,3,0,68,8,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,255,
-255,3,0,0,0,0,0,192,63,0,0,128,255,3,0,0,0,0,0,7,0,0,0,0,0,200,19,0,0,0,0,0,0,
-0,0,0,0,0,0,0,126,102,0,8,16,0,0,0,0,0,0,0,0,0,0,0,0,157,193,2,0,0,0,0,48,64,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,33,0,0,0,0,0,64,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,127,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,32,110,240,0,0,0,0,0,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,255,127,0,0,0,0,0,0,0,3,0,0,0,0,0,120,38,0,0,
-0,0,0,0,0,0,7,0,0,0,128,239,31,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,192,127,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,191,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,128,3,248,255,231,15,0,0,0,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
diff --git a/libc/ctype/punct.h b/libc/ctype/punct.h
--- a/libc/ctype/punct.h
+++ b/libc/ctype/punct.h
@@ -1,109 +0,0 @@
-18,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,16,16,34,35,16,36,37,38,39,
-40,41,42,43,16,44,45,46,17,47,48,17,17,49,17,17,17,50,51,52,53,54,55,56,57,17,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,58,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,59,16,60,61,62,63,64,65,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,66,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,67,16,16,68,16,69,70,71,16,72,16,73,
-16,16,16,16,74,75,76,77,16,16,78,16,79,80,16,16,16,16,81,16,16,16,16,16,16,16,
-16,16,16,16,16,16,82,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,83,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,84,85,86,87,
-16,16,88,89,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-90,16,91,92,93,94,95,96,97,98,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,0,0,0,0,254,255,0,252,1,0,0,248,1,0,0,120,0,0,0,0,255,251,223,
-251,0,0,128,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,0,
-252,255,224,175,255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,
-255,32,64,176,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-252,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,0,0,0,0,0,134,254,
-255,255,255,0,64,73,0,0,0,0,0,24,0,223,255,0,200,0,0,0,0,0,0,0,1,0,60,0,0,0,0,
-0,0,0,0,0,0,0,0,16,224,1,30,0,96,255,191,0,0,0,0,0,0,255,7,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,248,207,3,0,0,0,3,0,32,255,127,0,0,0,78,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,252,0,0,0,0,0,0,0,0,0,16,0,32,30,0,48,0,1,0,0,0,0,0,0,0,0,16,
-0,32,0,0,0,0,252,15,0,0,0,0,0,0,0,16,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,32,0,
-0,0,0,3,0,0,0,0,0,0,0,0,16,0,32,0,0,0,0,253,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,
-255,7,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,255,0,0,0,0,0,0,0,16,0,32,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,32,0,0,0,0,63,2,0,0,0,0,0,0,0,0,0,4,0,0,0,0,16,0,0,0,0,0,0,
-128,0,128,192,223,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,254,255,255,
-255,0,252,255,255,0,0,0,0,0,0,0,0,252,0,0,0,0,0,0,192,255,223,255,7,0,0,0,0,0,
-0,0,0,0,0,128,6,0,252,0,0,24,62,0,0,128,191,0,204,0,0,0,0,0,0,0,0,0,0,0,8,0,0,
-0,0,0,0,0,0,0,0,0,96,255,255,255,31,0,0,255,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,96,0,0,1,0,0,24,0,0,0,0,0,0,0,0,0,56,0,0,0,0,16,0,0,0,112,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,48,0,0,254,127,47,0,0,255,3,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,49,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,196,255,255,255,255,0,0,0,192,0,0,0,0,0,0,0,0,1,0,224,159,0,0,0,0,
-127,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,16,0,0,252,255,255,255,31,0,0,0,0,
-0,12,0,0,0,0,0,0,64,0,12,240,0,0,0,0,0,0,192,248,0,0,0,0,0,0,0,192,0,0,0,0,0,
-0,0,0,255,0,255,255,255,33,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,255,255,255,255,127,0,0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-160,3,224,0,224,0,224,0,96,128,248,255,255,255,252,255,255,255,255,255,127,31,
-252,241,127,255,127,0,0,255,255,255,3,0,0,255,255,255,255,1,0,123,3,208,193,
-175,66,0,12,31,188,255,255,0,0,0,0,0,2,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,255,
-255,255,127,0,0,0,255,7,0,0,255,255,255,255,255,255,255,255,255,255,63,0,0,0,
-0,0,0,252,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,31,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,135,3,254,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,
-127,255,15,0,0,0,0,0,0,0,0,255,255,255,251,255,255,255,255,255,255,255,255,
-255,255,15,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,63,0,0,0,255,15,30,255,255,255,1,252,
-193,224,0,0,0,0,0,0,0,0,0,0,0,30,1,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,255,255,0,0,0,0,255,255,255,255,15,0,0,0,255,255,255,127,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,
-255,255,255,255,127,0,0,0,0,0,0,192,0,224,0,0,0,0,0,0,0,0,0,0,0,128,15,112,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,255,255,127,0,3,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,68,8,0,0,0,15,255,3,0,0,0,0,0,0,240,0,0,0,0,0,0,0,0,0,
-16,192,0,0,255,255,3,7,0,0,0,0,0,248,0,0,0,0,8,128,0,0,0,0,0,0,0,0,0,0,8,0,
-255,63,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,0,0,128,11,0,0,0,0,0,0,0,128,2,
-0,0,192,0,0,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,
-0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,2,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,252,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,255,255,255,3,127,0,255,255,255,255,247,
-255,127,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,254,255,0,252,1,0,0,248,1,0,
-0,248,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,0,48,135,255,255,255,255,255,
-143,255,0,0,0,0,0,0,224,255,255,7,255,15,0,0,0,0,0,0,255,255,255,255,255,63,0,
-0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,128,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,143,0,0,0,128,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,255,0,255,1,
-0,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,0,255,0,0,0,
-255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,127,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,63,252,255,63,0,0,0,3,0,0,0,
-0,0,0,254,3,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-225,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,7,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,63,0,255,255,255,255,127,254,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,0,
-255,255,255,255,255,255,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,255,255,255,255,255,255,255,255,255,255,127,0,255,255,3,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,8,0,0,0,
-8,0,0,32,0,0,0,32,0,0,128,0,0,0,128,0,0,0,2,0,0,0,2,0,0,8,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,255,255,255,255,255,
-15,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,127,254,127,254,
-255,254,255,0,0,0,0,255,7,255,255,255,127,255,255,255,255,255,255,255,15,255,
-255,255,255,255,7,0,0,0,0,0,0,0,0,192,255,255,255,7,0,255,255,255,255,255,7,
-255,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,191,255,
-255,255,255,255,255,255,255,31,255,255,15,0,255,255,255,255,223,7,0,0,255,255,
-1,0,255,255,255,255,255,255,255,127,253,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,30,255,255,255,255,255,
-255,255,63,15,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,255,255,
-255,255,255,255,255,255,225,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,
-63,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,15,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
diff --git a/libc/ctype/toascii.c b/libc/ctype/toascii.c
--- a/libc/ctype/toascii.c
+++ b/libc/ctype/toascii.c
@@ -1,8 +0,0 @@
-#include <ctype.h>
-#undef toascii
-
-/* nonsense function that should NEVER be used! */
-int toascii(int c)
-{
- return c & 0x7f;
-}
diff --git a/libc/ctype/tolower.c b/libc/ctype/tolower.c
--- a/libc/ctype/tolower.c
+++ b/libc/ctype/tolower.c
@@ -1,8 +0,0 @@
-#include <ctype.h>
-
-#undef tolower
-int tolower(int c)
-{
- if (isupper(c)) return c | 32;
- return c;
-}
diff --git a/libc/ctype/toupper.c b/libc/ctype/toupper.c
--- a/libc/ctype/toupper.c
+++ b/libc/ctype/toupper.c
@@ -1,8 +0,0 @@
-#include <ctype.h>
-
-#undef toupper
-int toupper(int c)
-{
- if (islower(c)) return c & 0x5f;
- return c;
-}
diff --git a/libc/ctype/towctrans.c b/libc/ctype/towctrans.c
--- a/libc/ctype/towctrans.c
+++ b/libc/ctype/towctrans.c
@@ -1,270 +0,0 @@
-#include <wchar.h>
-#include <wctype.h>
-#include <stdio.h>
-
-#define CASEMAP(u1,u2,l) { (u1), (l)-(u1), (u2)-(u1)+1 }
-#define CASELACE(u1,u2) CASEMAP((u1),(u2),(u1)+1)
-
-static const struct {
- unsigned short upper;
- signed char lower;
- unsigned char len;
-} casemaps[] = {
- CASEMAP('A','Z','a'),
- CASEMAP(0xc0,0xde,0xe0),
-
- CASELACE(0x0100,0x012e),
- CASELACE(0x0132,0x0136),
- CASELACE(0x0139,0x0147),
- CASELACE(0x014a,0x0176),
- CASELACE(0x0179,0x017d),
-
- CASELACE(0x370,0x372),
- CASEMAP(0x391,0x3a1,0x3b1),
- CASEMAP(0x3a3,0x3ab,0x3c3),
- CASEMAP(0x400,0x40f,0x450),
- CASEMAP(0x410,0x42f,0x430),
-
- CASELACE(0x460,0x480),
- CASELACE(0x48a,0x4be),
- CASELACE(0x4c1,0x4cd),
- CASELACE(0x4d0,0x50e),
-
- CASELACE(0x514,0x526),
- CASEMAP(0x531,0x556,0x561),
-
- CASELACE(0x01a0,0x01a4),
- CASELACE(0x01b3,0x01b5),
- CASELACE(0x01cd,0x01db),
- CASELACE(0x01de,0x01ee),
- CASELACE(0x01f8,0x021e),
- CASELACE(0x0222,0x0232),
- CASELACE(0x03d8,0x03ee),
-
- CASELACE(0x1e00,0x1e94),
- CASELACE(0x1ea0,0x1efe),
-
- CASEMAP(0x1f08,0x1f0f,0x1f00),
- CASEMAP(0x1f18,0x1f1d,0x1f10),
- CASEMAP(0x1f28,0x1f2f,0x1f20),
- CASEMAP(0x1f38,0x1f3f,0x1f30),
- CASEMAP(0x1f48,0x1f4d,0x1f40),
-
- CASEMAP(0x1f68,0x1f6f,0x1f60),
- CASEMAP(0x1f88,0x1f8f,0x1f80),
- CASEMAP(0x1f98,0x1f9f,0x1f90),
- CASEMAP(0x1fa8,0x1faf,0x1fa0),
- CASEMAP(0x1fb8,0x1fb9,0x1fb0),
- CASEMAP(0x1fba,0x1fbb,0x1f70),
- CASEMAP(0x1fc8,0x1fcb,0x1f72),
- CASEMAP(0x1fd8,0x1fd9,0x1fd0),
- CASEMAP(0x1fda,0x1fdb,0x1f76),
- CASEMAP(0x1fe8,0x1fe9,0x1fe0),
- CASEMAP(0x1fea,0x1feb,0x1f7a),
- CASEMAP(0x1ff8,0x1ff9,0x1f78),
- CASEMAP(0x1ffa,0x1ffb,0x1f7c),
-
- CASELACE(0x246,0x24e),
- CASELACE(0x510,0x512),
- CASEMAP(0x2160,0x216f,0x2170),
- CASEMAP(0x2c00,0x2c2e,0x2c30),
- CASELACE(0x2c67,0x2c6b),
- CASELACE(0x2c80,0x2ce2),
- CASELACE(0x2ceb,0x2ced),
-
- CASELACE(0xa640,0xa66c),
- CASELACE(0xa680,0xa696),
-
- CASELACE(0xa722,0xa72e),
- CASELACE(0xa732,0xa76e),
- CASELACE(0xa779,0xa77b),
- CASELACE(0xa77e,0xa786),
-
- CASELACE(0xa790,0xa792),
- CASELACE(0xa7a0,0xa7a8),
-
- CASEMAP(0xff21,0xff3a,0xff41),
- { 0,0,0 }
-};
-
-static const unsigned short pairs[][2] = {
- { 'I', 0x0131 },
- { 'S', 0x017f },
- { 0x0130, 'i' },
- { 0x0178, 0x00ff },
- { 0x0181, 0x0253 },
- { 0x0182, 0x0183 },
- { 0x0184, 0x0185 },
- { 0x0186, 0x0254 },
- { 0x0187, 0x0188 },
- { 0x0189, 0x0256 },
- { 0x018a, 0x0257 },
- { 0x018b, 0x018c },
- { 0x018e, 0x01dd },
- { 0x018f, 0x0259 },
- { 0x0190, 0x025b },
- { 0x0191, 0x0192 },
- { 0x0193, 0x0260 },
- { 0x0194, 0x0263 },
- { 0x0196, 0x0269 },
- { 0x0197, 0x0268 },
- { 0x0198, 0x0199 },
- { 0x019c, 0x026f },
- { 0x019d, 0x0272 },
- { 0x019f, 0x0275 },
- { 0x01a6, 0x0280 },
- { 0x01a7, 0x01a8 },
- { 0x01a9, 0x0283 },
- { 0x01ac, 0x01ad },
- { 0x01ae, 0x0288 },
- { 0x01af, 0x01b0 },
- { 0x01b1, 0x028a },
- { 0x01b2, 0x028b },
- { 0x01b7, 0x0292 },
- { 0x01b8, 0x01b9 },
- { 0x01bc, 0x01bd },
- { 0x01c4, 0x01c6 },
- { 0x01c4, 0x01c5 },
- { 0x01c5, 0x01c6 },
- { 0x01c7, 0x01c9 },
- { 0x01c7, 0x01c8 },
- { 0x01c8, 0x01c9 },
- { 0x01ca, 0x01cc },
- { 0x01ca, 0x01cb },
- { 0x01cb, 0x01cc },
- { 0x01f1, 0x01f3 },
- { 0x01f1, 0x01f2 },
- { 0x01f2, 0x01f3 },
- { 0x01f4, 0x01f5 },
- { 0x01f6, 0x0195 },
- { 0x01f7, 0x01bf },
- { 0x0220, 0x019e },
- { 0x0386, 0x03ac },
- { 0x0388, 0x03ad },
- { 0x0389, 0x03ae },
- { 0x038a, 0x03af },
- { 0x038c, 0x03cc },
- { 0x038e, 0x03cd },
- { 0x038f, 0x03ce },
- { 0x0399, 0x0345 },
- { 0x0399, 0x1fbe },
- { 0x03a3, 0x03c2 },
- { 0x03f7, 0x03f8 },
- { 0x03fa, 0x03fb },
- { 0x1e60, 0x1e9b },
- { 0xdf, 0xdf },
- { 0x1e9e, 0xdf },
-
- { 0x1f59, 0x1f51 },
- { 0x1f5b, 0x1f53 },
- { 0x1f5d, 0x1f55 },
- { 0x1f5f, 0x1f57 },
- { 0x1fbc, 0x1fb3 },
- { 0x1fcc, 0x1fc3 },
- { 0x1fec, 0x1fe5 },
- { 0x1ffc, 0x1ff3 },
-
- { 0x23a, 0x2c65 },
- { 0x23b, 0x23c },
- { 0x23d, 0x19a },
- { 0x23e, 0x2c66 },
- { 0x241, 0x242 },
- { 0x243, 0x180 },
- { 0x244, 0x289 },
- { 0x245, 0x28c },
- { 0x3f4, 0x3b8 },
- { 0x3f9, 0x3f2 },
- { 0x3fd, 0x37b },
- { 0x3fe, 0x37c },
- { 0x3ff, 0x37d },
- { 0x4c0, 0x4cf },
-
- { 0x2126, 0x3c9 },
- { 0x212a, 'k' },
- { 0x212b, 0xe5 },
- { 0x2132, 0x214e },
- { 0x2183, 0x2184 },
- { 0x2c60, 0x2c61 },
- { 0x2c62, 0x26b },
- { 0x2c63, 0x1d7d },
- { 0x2c64, 0x27d },
- { 0x2c6d, 0x251 },
- { 0x2c6e, 0x271 },
- { 0x2c6f, 0x250 },
- { 0x2c70, 0x252 },
- { 0x2c72, 0x2c73 },
- { 0x2c75, 0x2c76 },
- { 0x2c7e, 0x23f },
- { 0x2c7f, 0x240 },
- { 0x2cf2, 0x2cf3 },
-
- { 0xa77d, 0x1d79 },
- { 0xa78b, 0xa78c },
- { 0xa78d, 0x265 },
- { 0xa7aa, 0x266 },
-
- { 0x10c7, 0x2d27 },
- { 0x10cd, 0x2d2d },
-
- /* bogus greek 'symbol' letters */
- { 0x376, 0x377 },
- { 0x39c, 0xb5 },
- { 0x392, 0x3d0 },
- { 0x398, 0x3d1 },
- { 0x3a6, 0x3d5 },
- { 0x3a0, 0x3d6 },
- { 0x39a, 0x3f0 },
- { 0x3a1, 0x3f1 },
- { 0x395, 0x3f5 },
- { 0x3cf, 0x3d7 },
-
- { 0,0 }
-};
-
-
-static wchar_t __towcase(wchar_t wc, int lower)
-{
- int i;
- int lmul = 2*lower-1;
- int lmask = lower-1;
- /* no letters with case in these large ranges */
- if (!iswalpha(wc)
- || (unsigned)wc - 0x0600 <= 0x0fff-0x0600
- || (unsigned)wc - 0x2e00 <= 0xa63f-0x2e00
- || (unsigned)wc - 0xa800 <= 0xfeff-0xa800)
- return wc;
- /* special case because the diff between upper/lower is too big */
- if (lower && (unsigned)wc - 0x10a0 < 0x2e) {
- if (wc>0x10c5 && wc != 0x10c7 && wc != 0x10cd) return wc;
- else return wc + 0x2d00 - 0x10a0;
- }
- if (!lower && (unsigned)wc - 0x2d00 < 0x26) {
- if (wc>0x2d25 && wc != 0x2d27 && wc != 0x2d2d) return wc;
- else return wc + 0x10a0 - 0x2d00;
- }
- for (i=0; casemaps[i].len; i++) {
- int base = casemaps[i].upper + (lmask & casemaps[i].lower);
- if ((unsigned)wc-base < casemaps[i].len) {
- if (casemaps[i].lower == 1)
- return wc + lower - ((wc-casemaps[i].upper)&1);
- return wc + lmul*casemaps[i].lower;
- }
- }
- for (i=0; pairs[i][1-lower]; i++) {
- if (pairs[i][1-lower] == wc)
- return pairs[i][lower];
- }
- if ((unsigned)wc - (0x10428 - 0x28*lower) < 0x28)
- return wc - 0x28 + 0x50*lower;
- return wc;
-}
-
-wint_t towupper(wint_t wc)
-{
- return __towcase(wc, 0);
-}
-
-wint_t towlower(wint_t wc)
-{
- return __towcase(wc, 1);
-}
diff --git a/libc/ctype/wcswidth.c b/libc/ctype/wcswidth.c
--- a/libc/ctype/wcswidth.c
+++ b/libc/ctype/wcswidth.c
@@ -1,10 +0,0 @@
-#include <wchar.h>
-
-int wcwidth(wchar_t wc);
-
-int wcswidth(const wchar_t *wcs, size_t n)
-{
- int l=0, k=0;
- for (; n-- && *wcs && (k = wcwidth(*wcs)) >= 0; l+=k, wcs++);
- return (k < 0) ? k : l;
-}
diff --git a/libc/ctype/wcwidth.c b/libc/ctype/wcwidth.c
--- a/libc/ctype/wcwidth.c
+++ b/libc/ctype/wcwidth.c
@@ -1,29 +0,0 @@
-#include <wchar.h>
-
-static const unsigned char table[] = {
-#include "nonspacing.h"
-};
-
-static const unsigned char wtable[] = {
-#include "wide.h"
-};
-
-int wcwidth(wchar_t wc)
-{
- if (wc < 0xffU)
- return ((wc+1) & 0x7f) >= 0x21 ? 1 : wc ? -1 : 0;
- if ((wc & 0xfffeffffU) < 0xfffe) {
- if ((table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1)
- return 0;
- if ((wtable[wtable[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1)
- return 2;
- return 1;
- }
- if ((wc & 0xfffe) == 0xfffe)
- return -1;
- if (wc-0x20000U < 0x20000)
- return 2;
- if (wc == 0xe0001 || wc-0xe0020U < 0x5f || wc-0xe0100 < 0xef)
- return 0;
- return 1;
-}
diff --git a/libc/ctype/wide.h b/libc/ctype/wide.h
--- a/libc/ctype/wide.h
+++ b/libc/ctype/wide.h
@@ -1,42 +0,0 @@
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,18,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,19,16,16,16,16,16,16,16,16,16,16,20,21,22,23,24,17,
-17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,25,
-17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
-17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
-17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
-17,17,17,17,17,17,17,17,26,16,16,16,16,27,16,16,17,17,17,17,17,17,17,17,17,17,
-17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
-17,17,17,17,17,17,17,28,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,16,16,16,29,30,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,31,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-16,16,16,16,32,16,16,16,16,16,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,
-0,248,0,0,0,0,0,0,0,0,0,0,252,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,251,255,255,255,
-255,255,255,255,255,255,255,15,0,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,255,15,
-255,255,255,255,255,255,255,127,254,255,255,255,255,255,255,255,255,255,127,
-254,255,255,255,255,255,255,255,255,255,255,255,255,224,255,255,255,255,63,
-254,255,255,255,255,255,255,255,255,255,255,127,255,255,255,255,255,7,255,255,
-255,255,15,0,255,255,255,255,255,127,255,255,255,255,255,0,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,127,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,31,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,255,255,255,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,
-255,127,248,255,255,255,255,255,15,0,0,255,3,0,0,255,255,255,255,247,255,127,
-15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,255,255,255,255,255,255,255,255,
-255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,255,255,255,255,255,7,255,1,3,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

Nadav Har'El

unread,
Nov 25, 2014, 7:37:23 AM11/25/14
to Pekka Enberg, Osv Dev
On Tue, Nov 25, 2014 at 2:28 PM, Pekka Enberg <pen...@cloudius-systems.com> wrote:
> The only change I'm slightly worried about is towctrans.c, where the code
> now (musl's version) has these lines:
>
>         if (lower && (unsigned)wc - 0x10a0 < 0x2e)
>                 if (wc>0x10c5 && wc != 0x10c7 && wc != 0x10cd) return wc;
>                 else return wc + 0x2d00 - 0x10a0;
>
> Whether the "else" binds to the inner or outer if() is a classic ambiguity
> in compiler design (see
> http://www.gnu.org/software/bison/manual/html_node/Shift_002fReduce.html and
> http://en.wikipedia.org/wiki/Dangling_else), and I've seen in the past gcc
> *warn* about it, although in principle, the C standard resolves this
> ambiguity (the "else" binds to the nearest "if", so the above code is
> indented correctly). I am guessing (?) this is why Christoph added braces in
> his version of this code. Can you please check we don't have warnings in
> that file? If we don't have warnings, then this code is fine.

I don't see any warnings with GCC 4.8.3.

Turns out that -Wall *does* turn on dangling-else warnings by default, but we use
in build.mk the option "-Wno-parentheses", which turns off a bunch of warnings including
-Wdangling-else. So this is why we don't see this warning, but it is likely that
Christoph did, which is why he made this change (adding braces) originally.

hw.cl...@gmail.com

unread,
Nov 28, 2014, 10:22:39 AM11/28/14
to osv...@googlegroups.com, pen...@cloudius-systems.com
After the update to latest musl, I get this error (on X64 and AArch64):

CC musl/src/errno/strerror.o
/home/claudio/git/osv/musl/src/errno/strerror.c: In function ‘__strerror_l’:
/home/claudio/git/osv/musl/src/errno/strerror.c:29:2: error: implicit declaration of function ‘LCTRANS’ [-Werror=implicit-function-declaration]
return (char *)LCTRANS(s, LC_MESSAGES, loc);
^
/home/claudio/git/osv/musl/src/errno/strerror.c:29:9: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
return (char *)LCTRANS(s, LC_MESSAGES, loc);
^
/home/claudio/git/osv/musl/src/errno/strerror.c: In function ‘strerror’:
/home/claudio/git/osv/musl/src/errno/strerror.c:34:25: error: ‘CURRENT_LOCALE’ undeclared (first use in this function)
return __strerror_l(e, CURRENT_LOCALE);
^
/home/claudio/git/osv/musl/src/errno/strerror.c:34:25: note: each undeclared identifier is reported only once for each function it appears in
/home/claudio/git/osv/musl/src/errno/strerror.c:35:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
cc1: all warnings being treated as errors
make[1]: *** [musl/src/errno/strerror.o] Error 1

hw.cl...@gmail.com

unread,
Nov 28, 2014, 10:25:58 AM11/28/14
to osv...@googlegroups.com, pen...@cloudius-systems.com, hw.cl...@gmail.com
Seems that we have locale_impl.h in both

musl/src/internal/
libc/src/internal/

this seems to me to be an issue..

Pekka Enberg

unread,
Nov 28, 2014, 10:28:45 AM11/28/14
to Claudio Fontana, Osv Dev
Yes, there's still duplicate and sometimes modified musl code in
include/api and libc so we're still stuck at the musl level we're at
right now.

We need to reduce the diff some more and then start moving to later
musl versions one step at a time. Long term plan is to consume
upstream musl directly but that requires musl to know about OSv for
things like syscalls and such.

- Pekka

Claudio Fontana

unread,
Dec 1, 2014, 9:57:45 AM12/1/14
to Pekka Enberg, Osv Dev
I see..

What I would find useful would be to have long double 128 (ld128)
support in musl, or at least OSv's version of it, so that floating
point operations of math.h would work on AArch64.

Part of that is in latest musl, part of that is in tentative patches
in musl partial AArch64 port, and part is missing.

What I am doing now is I am extracting the minimal amount of changes
needed to get musl to "work" without upgrading to the latest musl,
which causes all sorts of breakages.
I am basically trying to enable some basic test cases (first up,
fsmark) on AArch64, and for that I need to enable the floating point
APIs in math.h, and with some extensive hacking I think it's basically
possible.

Ciao,

Claudio

Nadav Har'El

unread,
Dec 1, 2014, 6:36:58 PM12/1/14
to Pekka Enberg, Claudio Fontana, Osv Dev
On Fri, Nov 28, 2014 at 5:28 PM, Pekka Enberg <pen...@cloudius-systems.com> wrote:

Yes, there's still duplicate and sometimes modified musl code in
include/api and libc so we're still stuck at the musl level we're at
right now.

We need to reduce the diff some more and then start moving to later
musl versions one step at a time.


I like this plan.

As Pekka said, a lot of the stuff in libc/ and include/api is slightly modified versions of things from an old
snapshot of Musl. We are slowly figuring out when these modifications are not important and removing
the libc/ file, changing libc/build.mk to compile the code from the musl/ directory instead.
When we're done with that process, we can do a wholesale upgrade of the musl/ directory to the latest
musl/ upstream, and hopefully things will continue to work with minimal breakage.
 
Long term plan is to consume
upstream musl directly but that requires musl to know about OSv for
things like syscalls and such.

I think we should consume the latest upstream musl, but just compile parts of it (the parts that don't need Linux system calls, etc.).
There are stuff we'll never want Musl to supply to OSv. E.g., we'll never want musl to implement malloc() for us using brk().

Nadav Har'El

unread,
Dec 3, 2014, 3:33:37 AM12/3/14
to Pekka Enberg, Claudio Fontana, Osv Dev
On Tue, Dec 2, 2014 at 1:36 AM, Nadav Har'El <n...@cloudius-systems.com> wrote:

We need to reduce the diff some more and then start moving to later

musl versions one step at a time.


I like this plan.

Would the following plan work? Claudio, would it help you?

1. Bring the latest Musl version into a "musl-1.1.5" subdirectory in OSv.
2. Leave the old "musl/" and "libc/" directories as well.
3. In libc/build.mk & build.mk, make a new list of objects (say, "nmusl") which will take code from musl-1.1.5/ instead of musl/.
4. Start to switch individual files and directories from "musl += ..." to "nmusl += ...".  We can start with the math functions which Claudio needed. Eventually everything can be converted to nmusl and hopefully nothing or little will break and need to be fixed.
5. Replace our include/api with musl-1.1.5/include. Would be even better to drop include/api, and just use musl-1.1.5/include directly if we can. I think, though, this is low priority, and might take quite a bit of work ("git log include/api" shows we modified this quite a bit since we took it from musl). I'm hoping that the old header files will work correctly also for the newer musl.

Pekka Enberg

unread,
Dec 3, 2014, 3:37:32 AM12/3/14
to Nadav Har'El, Claudio Fontana, Osv Dev
On Tue, Dec 2, 2014 at 1:36 AM, Nadav Har'El <n...@cloudius-systems.com> wrote:
> I think we should consume the latest upstream musl, but just compile parts
> of it (the parts that don't need Linux system calls, etc.).
> There are stuff we'll never want Musl to supply to OSv. E.g., we'll never
> want musl to implement malloc() for us using brk().

That's also an option but I think Musl eventually calls syscall(), for
example, which is not what we want on OSv. We need to do something
about that and I think it would be better to do that in upstream musl,
not copy the files in osv and modify them.

- Pekka

Pekka Enberg

unread,
Dec 3, 2014, 3:39:03 AM12/3/14
to Nadav Har'El, Claudio Fontana, Osv Dev
On Wed, Dec 3, 2014 at 10:33 AM, Nadav Har'El <n...@cloudius-systems.com> wrote:
> Would the following plan work? Claudio, would it help you?
>
> 1. Bring the latest Musl version into a "musl-1.1.5" subdirectory in OSv.
> 2. Leave the old "musl/" and "libc/" directories as well.
> 3. In libc/build.mk & build.mk, make a new list of objects (say, "nmusl")
> which will take code from musl-1.1.5/ instead of musl/.
> 4. Start to switch individual files and directories from "musl += ..." to
> "nmusl += ...". We can start with the math functions which Claudio needed.
> Eventually everything can be converted to nmusl and hopefully nothing or
> little will break and need to be fixed.
> 5. Replace our include/api with musl-1.1.5/include. Would be even better to
> drop include/api, and just use musl-1.1.5/include directly if we can. I
> think, though, this is low priority, and might take quite a bit of work
> ("git log include/api" shows we modified this quite a bit since we took it
> from musl). I'm hoping that the old header files will work correctly also
> for the newer musl.

We certainly can try that. However, I suspect the problem is going to
be our duplicated musl *headers*. Once we fix those up, moving
everything to 1.1.5 is going to be easier.

- Pekka

Nadav Har'El

unread,
Dec 3, 2014, 3:49:25 AM12/3/14
to Pekka Enberg, Claudio Fontana, Osv Dev
What we did so far for such functions is simply not to use them from Musl, and have our own.

For example, musl's clock_gettime() does little beyond call the corresponding system call. Instead, our clock_gettime() implementation (libc/time.cc) is a completely different OSv-specific, in the C++ language, implementation. I don't think it will ever make sense for Musl to move this OSv-specific implementation upstream (in particular, Musl is C, not C++...). I think we should just continue not to pick up musl/src/time/clock_gettime.c, and have our own implementation of this function.

As I pointed out in a patch from yesterday, we also have a non-musl implementation for all the opendir()/readdir()/etc. functions, and don't use the one from Musl. I don't think it's a problem.

Nadav.

Nadav Har'El

unread,
Dec 3, 2014, 3:52:49 AM12/3/14
to Pekka Enberg, Claudio Fontana, Osv Dev
On Wed, Dec 3, 2014 at 10:39 AM, Pekka Enberg <pen...@cloudius-systems.com> wrote:


We certainly can try that. However, I suspect the problem is going to
be our duplicated musl *headers*. Once we fix those up, moving
everything to 1.1.5 is going to be easier.

I'd like to think (or rather, hope) that the headers (musl/include) are orthogonal to the implementation (musl/src).

i.e., as an intermediate stage, we can use the old musl headers with a new musl 1.1.5 implementation,
or vice versa, and mostly everything should work.

The thing is, the musl headers try to emulate *linux* headers, not musl, so they should be mostly
(up to bugs and small corner cases) be compatible.

Claudio Fontana

unread,
Dec 3, 2014, 4:17:27 AM12/3/14
to Nadav Har'El, Pekka Enberg, Osv Dev
On 3 December 2014 at 09:52, Nadav Har'El <n...@cloudius-systems.com> wrote:
> On Wed, Dec 3, 2014 at 10:39 AM, Pekka Enberg <pen...@cloudius-systems.com>
> wrote:
>>
>>
>>
>> We certainly can try that. However, I suspect the problem is going to
>> be our duplicated musl *headers*. Once we fix those up, moving
>> everything to 1.1.5 is going to be easier.
>
>
> I'd like to think (or rather, hope) that the headers (musl/include) are
> orthogonal to the implementation (musl/src).
>
> i.e., as an intermediate stage, we can use the old musl headers with a new
> musl 1.1.5 implementation,
> or vice versa, and mostly everything should work.

Hmm they shuffled some headers around between musl 0.9.x and 1.1.x, in
particular for floating point.

I have uploaded some patches to musl 0.9.x which add some pieces of
the puzzle, this seems enough to run fsmark.
Note however that the ld128 implementation for some functions is using
the single precision variant (so it's horribly imprecise).

https://github.com/hw-claudio/musl.git "ld128"

https://github.com/hw-claudio/musl/tree/ld128

some changes to OSv needed:

https://github.com/hw-claudio/osv_aarch64.git "pci-ld128"

https://github.com/hw-claudio/osv_aarch64/tree/pci-ld128

Claudio Fontana

unread,
Dec 3, 2014, 4:18:14 AM12/3/14
to Nadav Har'El, Pekka Enberg, Osv Dev
On 3 December 2014 at 10:17, Claudio Fontana <hw.cl...@gmail.com> wrote:
> On 3 December 2014 at 09:52, Nadav Har'El <n...@cloudius-systems.com> wrote:
>> On Wed, Dec 3, 2014 at 10:39 AM, Pekka Enberg <pen...@cloudius-systems.com>
>> wrote:
>>>
>>>
>>>
>>> We certainly can try that. However, I suspect the problem is going to
>>> be our duplicated musl *headers*. Once we fix those up, moving
>>> everything to 1.1.5 is going to be easier.
>>
>>
>> I'd like to think (or rather, hope) that the headers (musl/include) are
>> orthogonal to the implementation (musl/src).
>>
>> i.e., as an intermediate stage, we can use the old musl headers with a new
>> musl 1.1.5 implementation,
>> or vice versa, and mostly everything should work.
>
> Hmm they shuffled some headers around between musl 0.9.x and 1.1.x, in
> particular for floating point.
>
> I have uploaded some patches to musl 0.9.x which add some pieces of
> the puzzle, this seems enough to run fsmark.
> Note however that the ld128 implementation for some functions is using
> the single precision variant (so it's horribly imprecise).
>
> https://github.com/hw-claudio/musl.git "ld128"
>
> https://github.com/hw-claudio/musl/tree/ld128
>
> some changes to OSv needed:
>
> https://github.com/hw-claudio/osv_aarch64.git "pci-ld128"
>
> https://github.com/hw-claudio/osv_aarch64/tree/pci-ld128

Note, this is just to show which functionality I need, I don't think
these hacks should be included..

Ciao,

Claudio

Claudio Fontana

unread,
Dec 3, 2014, 4:21:57 AM12/3/14
to Nadav Har'El, Pekka Enberg, Osv Dev
Hmm this sounds more complicated than actually needed, seems to make
the state even more confusing..
why keep two versions of musl around, and not just integrate the newer version?

Ciao,

Claudio

Nadav Har'El

unread,
Dec 3, 2014, 4:24:30 AM12/3/14
to Claudio Fontana, Pekka Enberg, Osv Dev
On Wed, Dec 3, 2014 at 11:21 AM, Claudio Fontana <hw.cl...@gmail.com> wrote:

Hmm this sounds more complicated than actually needed, seems to make
the state even more confusing..
why keep two versions of musl around, and not just integrate the newer version?

I thought you said you had problems with the new version, and would like to start with only taking some parts (like math/*) from the new version. But if we can switch to the new version in one fell swoop, then I guess it's even better.

Claudio Fontana

unread,
Dec 3, 2014, 7:12:54 AM12/3/14
to Nadav Har'El, Pekka Enberg, Osv Dev
On 3 December 2014 at 10:24, Nadav Har'El <n...@cloudius-systems.com> wrote:
> On Wed, Dec 3, 2014 at 11:21 AM, Claudio Fontana <hw.cl...@gmail.com>
> wrote:
>>
>>
>> Hmm this sounds more complicated than actually needed, seems to make
>> the state even more confusing..
>> why keep two versions of musl around, and not just integrate the newer
>> version?
>
>
> I thought you said you had problems with the new version, and would like to
> start with only taking some parts (like math/*) from the new version.

I do have problems with the new version, both on X86 and on ARM,
compilation breaks,
but at the same time the new version provides better (partial) support
for ld128,
so I would think that it would be worthwhile to try to integrate the
new version, modifying libc/build.mk etc as needed,
and commit the result when it builds on X86 and ARM..

Have you tried to use musl master? Do you also get the same errors I am getting?

Btw, I would think that the the libc/ -specific CFLAGS should probably
be moved from top level build.mk to libc/build.mk,
and make them apply only to the libc modules, and separated from musl
CFLAGS, so that we can include the "right" -I src/internal/ for the
right objects..

C.

Nadav Har'El

unread,
Dec 3, 2014, 7:31:18 AM12/3/14
to Claudio Fontana, Pekka Enberg, Osv Dev
On Wed, Dec 3, 2014 at 2:12 PM, Claudio Fontana <hw.cl...@gmail.com> wrote:
I do have problems with the new version, both on X86 and on ARM,
compilation breaks,
but at the same time the new version provides better (partial) support
for ld128,
so I would think that it would be worthwhile to try to integrate the
new version, modifying libc/build.mk etc as needed, 
and commit  the result when it builds on X86 and ARM..

Sounds good to me, if it takes a reasonable effort.
 

Have you tried to use musl master?

No I did not.
 
Do you also get the same errors I am getting?

Btw, I would think that the the libc/ -specific CFLAGS should probably
be moved from top level build.mk to libc/build.mk,
and make them apply only to the libc modules,

This sounds good. But,
 
and separated from musl
CFLAGS, so that we can include the "right" -I src/internal/ for the
right objects..

One thing I'm worried about is libc/internal/libc.h's modified __libc. Can we have other musl code use a different definition of the same structure?
Would be best if we had fewer modifications from Musl in the first place. This is what Pekka and I are doing once in a while (removing stuff from libc/, and using the unmodified file from Musl instead), but we're doing it a bit too slowly.
Reply all
Reply to author
Forward
0 new messages