From d963b3bac96690e249cbc7e97253febba3ae151d Mon Sep 17 00:00:00 2001 From: Mark Poliakov Date: Sun, 9 Mar 2025 14:16:42 +0200 Subject: [PATCH] libc: borrow relibc's wctype.h --- .../lib/ygglibc/src/headers/ctype/mod.rs | 2 +- .../lib/ygglibc/src/headers/langinfo/mod.rs | 10 +- .../lib/ygglibc/src/headers/wctype/alpha.rs | 193 ++++++++ .../lib/ygglibc/src/headers/wctype/casecmp.rs | 417 ++++++++++++++++++ .../lib/ygglibc/src/headers/wctype/mod.rs | 252 ++++++++--- .../lib/ygglibc/src/headers/wctype/punct.rs | 167 +++++++ 6 files changed, 964 insertions(+), 77 deletions(-) create mode 100644 userspace/lib/ygglibc/src/headers/wctype/alpha.rs create mode 100644 userspace/lib/ygglibc/src/headers/wctype/casecmp.rs create mode 100644 userspace/lib/ygglibc/src/headers/wctype/punct.rs diff --git a/userspace/lib/ygglibc/src/headers/ctype/mod.rs b/userspace/lib/ygglibc/src/headers/ctype/mod.rs index 0405d510..af7e216c 100644 --- a/userspace/lib/ygglibc/src/headers/ctype/mod.rs +++ b/userspace/lib/ygglibc/src/headers/ctype/mod.rs @@ -20,7 +20,7 @@ unsafe extern "C" fn isascii(ch: c_int) -> c_int { } #[no_mangle] -unsafe extern "C" fn isblank(ch: c_int) -> c_int { +pub unsafe extern "C" fn isblank(ch: c_int) -> c_int { (ch == b' ' as c_int || ch == b'\t' as c_int) as _ } diff --git a/userspace/lib/ygglibc/src/headers/langinfo/mod.rs b/userspace/lib/ygglibc/src/headers/langinfo/mod.rs index f34dae73..cbb1cd32 100644 --- a/userspace/lib/ygglibc/src/headers/langinfo/mod.rs +++ b/userspace/lib/ygglibc/src/headers/langinfo/mod.rs @@ -1,4 +1,4 @@ -use core::ffi::c_char; +use core::{ffi::c_char, ptr::null_mut}; use super::{locale::locale_t, nl_types::nl_item}; @@ -59,8 +59,12 @@ pub const NOEXPR: nl_item = 54; pub const CRNCYSTR: nl_item = 55; #[no_mangle] -unsafe extern "C" fn nl_langinfo(_item: nl_item) -> *mut c_char { - todo!() +unsafe extern "C" fn nl_langinfo(item: nl_item) -> *mut c_char { + let cstr = match item { + CODESET => c"UTF-8", + _ => todo!("nl_langinfo({item})"), + }; + cstr.as_ptr().cast_mut() } #[no_mangle] diff --git a/userspace/lib/ygglibc/src/headers/wctype/alpha.rs b/userspace/lib/ygglibc/src/headers/wctype/alpha.rs new file mode 100644 index 00000000..41c34415 --- /dev/null +++ b/userspace/lib/ygglibc/src/headers/wctype/alpha.rs @@ -0,0 +1,193 @@ +// Borrowed from relibc's wctype/alpha.rs +// Which in turn borrowed it from musl's src/ctype/alpha.h +// Copyright 2005-2020 Rich Felker, et al. + +use core::ffi::c_uchar; + +pub fn is(wc: usize) -> c_uchar { + if wc < 0x20000 { + return (table[(table[wc >> 8] as usize) * 32 + ((wc & 255) >> 3)] >> (wc & 7)) & 1; + } + if wc < 0x2fffe { + return 1; + } + return 0; +} + +const table: [c_uchar; 3904] = [ + 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, 74, 17, 75, + 76, 77, 78, 79, 80, 81, 16, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 16, 94, 95, 96, 16, + 17, 17, 17, 97, 98, 99, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 100, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 101, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 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, 102, 103, 16, 16, 104, 105, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 106, 17, 17, 107, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 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, 108, 109, 16, 16, 16, 16, 16, 16, 16, 16, 16, 110, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 111, 112, 113, 114, 16, 16, + 16, 16, 16, 16, 16, 16, 115, 116, 117, 16, 16, 16, 16, 16, 118, 119, 16, 16, 16, 16, 120, 16, + 16, 121, 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, 188, 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, 255, 254, 255, 255, 255, 127, 2, + 255, 255, 255, 255, 255, 1, 0, 0, 0, 0, 255, 191, 182, 0, 255, 255, 255, 135, 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, 255, 7, 0, 0, 0, 0, 0, 0, 255, 255, + 223, 63, 0, 0, 240, 255, 248, 3, 255, 255, 255, 255, 255, 255, 255, 255, 255, 239, 255, 223, + 225, 255, 207, 255, 254, 255, 239, 159, 249, 255, 255, 253, 197, 227, 159, 89, 128, 176, 207, + 255, 3, 16, 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, 30, 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, 239, 223, 253, 255, 255, 253, 255, 227, 223, 29, 96, 7, 207, 255, 0, 0, + 239, 223, 253, 255, 255, 253, 239, 227, 223, 29, 96, 64, 207, 255, 6, 0, 239, 223, 253, 255, + 255, 255, 255, 231, 223, 93, 240, 128, 207, 255, 0, 252, 236, 255, 127, 252, 255, 255, 251, 47, + 127, 128, 95, 255, 192, 255, 12, 0, 254, 255, 255, 255, 255, 127, 255, 7, 63, 32, 255, 3, 0, 0, + 0, 0, 214, 247, 255, 255, 175, 255, 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, 255, 255, 255, 255, 255, + 255, 255, 63, 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, 7, + 0, 0, 0, 0, 255, 255, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 63, 63, 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, 255, 1, 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, 1, 255, 255, 255, 255, 255, 7, 255, 255, 255, 255, 255, + 255, 255, 255, 63, 0, 255, 255, 255, 127, 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, 127, 0, + 255, 227, 255, 255, 255, 255, 255, 63, 255, 1, 255, 255, 255, 255, 255, 231, 0, 0, 0, 0, 0, + 222, 111, 4, 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, 128, 255, 31, 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, + 255, 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, 255, 255, 255, 255, 255, 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, 255, 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, 249, 255, 255, 255, 255, 255, 255, 124, 0, 0, 0, 0, 0, 128, 255, + 191, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 15, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 47, 0, 255, 3, 0, 0, 252, 232, 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, 255, 255, 255, + 127, 255, 255, 255, 255, 255, 255, 127, 0, 255, 63, 255, 3, 255, 255, 127, 252, 255, 255, 255, + 255, 255, 255, 255, 127, 5, 0, 0, 56, 255, 255, 60, 0, 126, 126, 126, 0, 127, 127, 255, 255, + 255, 255, 255, 247, 255, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 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, 255, 0, 224, 255, 255, 255, 7, 255, 255, + 255, 255, 255, 7, 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, 255, 255, 255, 255, 15, 255, 255, 255, 255, 15, 255, 255, 255, 255, 255, 0, 255, 255, 255, + 255, 255, 255, 15, 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, 127, 0, 255, 255, 63, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 63, 253, 255, 255, 255, 255, 191, 145, 255, 255, 63, 0, 255, 255, 127, 0, 255, 255, 255, + 127, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 55, 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, 63, 0, 0, 0, 0, 0, 255, 255, 255, 31, 255, 255, 255, 31, 0, 0, 0, 0, 255, 254, 255, + 255, 31, 0, 0, 0, 255, 255, 255, 255, 255, 255, 63, 0, 255, 255, 63, 0, 255, 255, 7, 0, 255, + 255, 3, 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, 255, 255, 255, 255, 255, 255, 7, 0, 255, 255, 255, 255, 255, 255, 7, 0, 255, + 255, 255, 255, 255, 0, 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, 255, 255, 255, 31, 128, 0, 255, 255, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 127, 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, 112, 0, 255, 255, 255, 255, 71, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 30, 0, 255, 23, 0, 0, 0, 0, 255, 255, 251, 255, 255, 255, 159, 64, 0, 0, 0, 0, 0, 0, 0, 0, 127, + 189, 255, 191, 255, 1, 255, 255, 255, 255, 255, 255, 255, 1, 255, 3, 239, 159, 249, 255, 255, + 253, 237, 227, 159, 25, 129, 224, 15, 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, 187, 7, 255, 131, 0, 0, 0, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 179, 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, 127, 0, 0, 0, 63, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, + 127, 17, 0, 255, 3, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 63, 1, 255, 3, 0, 0, 0, 0, 0, 0, + 255, 255, 255, 231, 255, 7, 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, 255, 255, 255, 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 3, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 252, 255, 255, 255, 255, 255, 252, 26, 0, 0, 0, 255, 255, 255, 255, 255, 255, + 231, 127, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 32, 0, 0, 0, 0, 255, 255, 255, + 255, 255, 255, 255, 1, 255, 253, 255, 255, 255, 255, 127, 127, 1, 0, 255, 3, 0, 0, 252, 255, + 255, 255, 252, 255, 255, 254, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 251, 255, 255, 255, 255, + 127, 180, 203, 0, 255, 3, 191, 253, 255, 255, 255, 127, 123, 1, 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, 255, + 255, 127, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 3, 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, 127, 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, 15, 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, 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, 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, 255, 255, 255, 255, 255, + 255, 255, 1, 255, 255, 255, 127, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 63, + 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 15, 0, 255, 3, 248, 255, 255, 224, 255, 255, 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, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 135, 255, 255, 255, 255, 255, 255, 255, 128, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 11, 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, 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, 7, 0, 255, 255, 255, 127, 0, 0, 0, 0, 0, 0, 7, 0, 240, 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, 255, 255, 255, 15, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 7, 255, 31, 255, 1, 255, 67, 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, 127, 255, 255, 249, 219, 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, 0, 255, 255, 255, 255, + 255, 31, 128, 63, 255, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, + 15, 255, 3, 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, 0, 255, 255, 255, 255, 255, 255, + 255, 255, 143, 8, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 255, 255, 255, 3, 255, 255, 255, 3, + 255, 255, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +]; diff --git a/userspace/lib/ygglibc/src/headers/wctype/casecmp.rs b/userspace/lib/ygglibc/src/headers/wctype/casecmp.rs new file mode 100644 index 00000000..bd229414 --- /dev/null +++ b/userspace/lib/ygglibc/src/headers/wctype/casecmp.rs @@ -0,0 +1,417 @@ +// Borrowed from relibc's wctype/casecmp.rs +// Which in turn borrowed it from musl's src/ctype/casemap.h +// Licensed under the MIT license +// Copyright 2005-2020 Rich Felker, et al. + +use core::ffi::{c_int, c_uchar, c_uint}; + +use super::wint_t; + +const tab: [c_uchar; 2666] = [ + 7, 8, 9, 10, 11, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 13, 6, 6, 14, 6, 6, 6, 6, 6, 6, 6, 6, 15, + 16, 17, 18, 6, 19, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 20, 21, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 22, 23, 6, 6, 6, 24, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 43, 43, 43, + 43, 43, 43, 43, 43, 1, 0, 84, 86, 86, 86, 86, 86, 86, 86, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 43, 43, 43, 43, 43, 43, 43, 7, 43, 43, 91, 86, 86, 86, 86, + 86, 86, 86, 74, 86, 86, 5, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 36, + 80, 121, 49, 80, 49, 80, 49, 56, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, + 78, 49, 2, 78, 13, 13, 78, 3, 78, 0, 36, 110, 0, 78, 49, 38, 110, 81, 78, 36, 80, 78, 57, 20, + 129, 27, 29, 29, 83, 49, 80, 49, 80, 13, 49, 80, 49, 80, 49, 80, 27, 83, 36, 80, 49, 2, 92, + 123, 92, 123, 92, 123, 92, 123, 92, 123, 20, 121, 92, 123, 92, 123, 92, 45, 43, 73, 3, 72, 3, + 120, 92, 123, 20, 0, 150, 10, 1, 43, 40, 6, 6, 0, 42, 6, 42, 42, 43, 7, 187, 181, 43, 30, 0, + 43, 7, 43, 43, 43, 1, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 205, 70, 205, 43, 0, 37, 43, 7, 1, 6, 1, 85, 86, 86, 86, 86, 86, 85, 86, 86, 2, + 36, 129, 129, 129, 129, 129, 21, 129, 129, 129, 0, 0, 43, 0, 178, 209, 178, 209, 178, 209, 178, + 209, 0, 0, 205, 204, 1, 0, 215, 215, 215, 215, 215, 131, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 28, 0, 0, 0, 0, 0, 49, 80, 49, + 80, 49, 80, 49, 80, 49, 80, 49, 2, 0, 0, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, + 80, 49, 80, 49, 80, 78, 49, 80, 49, 80, 78, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, + 80, 49, 2, 135, 166, 135, 166, 135, 166, 135, 166, 135, 166, 135, 166, 135, 166, 135, 166, 42, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 0, 0, 0, 84, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 84, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 12, 0, 12, 42, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 42, 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, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 86, 86, 108, 129, 21, 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 7, 108, 3, 65, 43, 43, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 44, 86, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 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, 12, 108, 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, 6, 37, 6, + 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, + 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 86, 122, 158, 38, 6, 37, + 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, + 37, 6, 1, 43, 43, 79, 86, 86, 44, 43, 127, 86, 86, 57, 43, 43, 85, 86, 86, 43, 43, 79, 86, 86, + 44, 43, 127, 86, 86, 129, 55, 117, 91, 123, 92, 43, 43, 79, 86, 86, 2, 172, 4, 0, 0, 57, 43, + 43, 85, 86, 86, 43, 43, 79, 86, 86, 44, 43, 43, 86, 86, 50, 19, 129, 87, 0, 111, 129, 126, 201, + 215, 126, 45, 129, 129, 14, 126, 57, 127, 111, 87, 0, 129, 129, 126, 21, 0, 126, 3, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 43, 36, 43, 151, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, + 43, 43, 43, 43, 43, 86, 86, 86, 86, 86, 128, 129, 129, 129, 129, 57, 187, 42, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 201, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 208, 13, 0, 78, 49, 2, 180, 193, 193, 215, 215, 36, 80, 49, 80, 49, 80, 49, 80, + 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, + 49, 80, 215, 215, 83, 193, 71, 212, 215, 215, 215, 5, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 7, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 78, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 13, 0, 0, 0, 0, 0, 36, 80, + 49, 80, 49, 80, 49, 80, 49, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 121, 92, + 123, 92, 123, 79, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, + 92, 123, 92, 45, 43, 43, 121, 20, 92, 123, 92, 45, 121, 42, 92, 39, 92, 123, 92, 123, 92, 123, + 164, 0, 10, 180, 92, 123, 92, 123, 79, 3, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 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, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 7, + 0, 72, 86, 86, 86, 86, 86, 86, 86, 86, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 85, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 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, 36, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 0, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 0, 0, 0, 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 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, 0, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 85, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +]; + +const rules: [c_int; 240] = [ + 0x0, 0x2001, -0x2000, 0x1dbf00, 0x2e700, 0x7900, 0x2402, 0x101, -0x100, 0x0, 0x201, -0x200, + -0xc6ff, -0xe800, -0x78ff, -0x12c00, 0xc300, 0xd201, 0xce01, 0xcd01, 0x4f01, 0xca01, 0xcb01, + 0xcf01, 0x6100, 0xd301, 0xd101, 0xa300, 0xd501, 0x8200, 0xd601, 0xda01, 0xd901, 0xdb01, 0x3800, + 0x3, -0x4f00, -0x60ff, -0x37ff, 0x242802, 0x0, 0x101, -0x100, -0xcd00, -0xda00, -0x81ff, + 0x2a2b01, -0xa2ff, 0x2a2801, 0x2a3f00, -0xc2ff, 0x4501, 0x4701, 0x2a1f00, 0x2a1c00, 0x2a1e00, + -0xd200, -0xce00, -0xca00, -0xcb00, 0xa54f00, 0xa54b00, -0xcf00, 0xa52800, 0xa54400, -0xd100, + -0xd300, 0x29f700, 0xa54100, 0x29fd00, -0xd500, -0xd600, 0x29e700, 0xa54300, 0xa52a00, -0x4500, + -0xd900, -0x4700, -0xdb00, 0xa51500, 0xa51200, 0x4c2402, 0x0, 0x2001, -0x2000, 0x101, -0x100, + 0x5400, 0x7401, 0x2601, 0x2501, 0x4001, 0x3f01, -0x2600, -0x2500, -0x1f00, -0x4000, -0x3f00, + 0x801, -0x3e00, -0x3900, -0x2f00, -0x3600, -0x800, -0x5600, -0x5000, 0x700, -0x7400, -0x3bff, + -0x6000, -0x6ff, 0x701a02, 0x101, -0x100, 0x2001, -0x2000, 0x5001, 0xf01, -0xf00, 0x0, 0x3001, + -0x3000, 0x101, -0x100, 0x0, 0xbc000, 0x1c6001, 0x0, 0x97d001, 0x801, -0x800, 0x8a0502, 0x0, + -0xbbfff, -0x186200, 0x89c200, -0x182500, -0x186e00, -0x186d00, -0x186400, -0x186300, + -0x185c00, 0x0, 0x8a3800, 0x8a0400, 0xee600, 0x101, -0x100, 0x0, -0x3b00, -0x1dbeff, 0x8f1d02, + 0x800, -0x7ff, 0x0, 0x5600, -0x55ff, 0x4a00, 0x6400, 0x8000, 0x7000, 0x7e00, 0x900, -0x49ff, + -0x8ff, -0x1c2500, -0x63ff, -0x6fff, -0x7fff, -0x7dff, 0xac0502, 0x0, 0x1001, -0x1000, 0x1c01, + 0x101, -0x1d5cff, -0x20beff, -0x2045ff, -0x1c00, 0xb10b02, 0x101, -0x100, 0x3001, -0x3000, 0x0, + -0x29f6ff, -0xee5ff, -0x29e6ff, -0x2a2b00, -0x2a2800, -0x2a1bff, -0x29fcff, -0x2a1eff, + -0x2a1dff, -0x2a3eff, 0x0, -0x1c6000, 0x0, 0x101, -0x100, 0xbc0c02, 0x0, 0x101, -0x100, + -0xa543ff, 0x3a001, -0x8a03ff, -0xa527ff, 0x3000, -0xa54eff, -0xa54aff, -0xa540ff, -0xa511ff, + -0xa529ff, -0xa514ff, -0x2fff, -0xa542ff, -0x8a37ff, 0x0, -0x97d000, -0x3a000, 0x0, 0x2001, + -0x2000, 0x0, 0x2801, -0x2800, 0x0, 0x4001, -0x4000, 0x0, 0x2001, -0x2000, 0x0, 0x2001, + -0x2000, 0x0, 0x2201, -0x2200, +]; + +const rulebases: [c_uchar; 512] = [ + 0, 6, 39, 81, 111, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, + 131, 142, 146, 151, 0, 170, 0, 0, 0, 0, 0, 0, 0, 0,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 237, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +]; + +const exceptions: [[c_uchar; 2]; 200] = [ + [48, 12], + [49, 13], + [120, 14], + [127, 15], + [128, 16], + [129, 17], + [134, 18], + [137, 19], + [138, 19], + [142, 20], + [143, 21], + [144, 22], + [147, 19], + [148, 23], + [149, 24], + [150, 25], + [151, 26], + [154, 27], + [156, 25], + [157, 28], + [158, 29], + [159, 30], + [166, 31], + [169, 31], + [174, 31], + [177, 32], + [178, 32], + [183, 33], + [191, 34], + [197, 35], + [200, 35], + [203, 35], + [221, 36], + [242, 35], + [246, 37], + [247, 38], + [32, 45], + [58, 46], + [61, 47], + [62, 48], + [63, 49], + [64, 49], + [67, 50], + [68, 51], + [69, 52], + [80, 53], + [81, 54], + [82, 55], + [83, 56], + [84, 57], + [89, 58], + [91, 59], + [92, 60], + [97, 61], + [99, 62], + [101, 63], + [102, 64], + [104, 65], + [105, 66], + [106, 64], + [107, 67], + [108, 68], + [111, 66], + [113, 69], + [114, 70], + [117, 71], + [125, 72], + [130, 73], + [135, 74], + [137, 75], + [138, 76], + [139, 76], + [140, 77], + [146, 78], + [157, 79], + [158, 80], + [69, 87], + [123, 29], + [124, 29], + [125, 29], + [127, 88], + [134, 89], + [136, 90], + [137, 90], + [138, 90], + [140, 91], + [142, 92], + [143, 92], + [172, 93], + [173, 94], + [174, 94], + [175, 94], + [194, 95], + [204, 96], + [205, 97], + [206, 97], + [207, 98], + [208, 99], + [209, 100], + [213, 101], + [214, 102], + [215, 103], + [240, 104], + [241, 105], + [242, 106], + [243, 107], + [244, 108], + [245, 109], + [249, 110], + [253, 45], + [254, 45], + [255, 45], + [80, 105], + [81, 105], + [82, 105], + [83, 105], + [84, 105], + [85, 105], + [86, 105], + [87, 105], + [88, 105], + [89, 105], + [90, 105], + [91, 105], + [92, 105], + [93, 105], + [94, 105], + [95, 105], + [130, 0], + [131, 0], + [132, 0], + [133, 0], + [134, 0], + [135, 0], + [136, 0], + [137, 0], + [192, 117], + [207, 118], + [128, 137], + [129, 138], + [130, 139], + [133, 140], + [134, 141], + [112, 157], + [113, 157], + [118, 158], + [119, 158], + [120, 159], + [121, 159], + [122, 160], + [123, 160], + [124, 161], + [125, 161], + [179, 162], + [186, 163], + [187, 163], + [188, 164], + [190, 165], + [195, 162], + [204, 164], + [218, 166], + [219, 166], + [229, 106], + [234, 167], + [235, 167], + [236, 110], + [243, 162], + [248, 168], + [249, 168], + [250, 169], + [251, 169], + [252, 164], + [38, 176], + [42, 177], + [43, 178], + [78, 179], + [132, 8], + [98, 186], + [99, 187], + [100, 188], + [101, 189], + [102, 190], + [109, 191], + [110, 192], + [111, 193], + [112, 194], + [126, 195], + [127, 195], + [125, 207], + [141, 208], + [148, 209], + [171, 210], + [172, 211], + [173, 212], + [176, 213], + [177, 214], + [178, 215], + [196, 216], + [197, 217], + [198, 218], +]; + +pub fn casemap(mut c: u32, dir: i32) -> wint_t { + if c >= 0x20000 { + return c; + } + let c0 = c; + let b = c >> 8; + c &= 255; + let x = c / 3; + let y = c % 3; + /* lookup entry in two-level base-6 table */ + let mut v: c_uint = tab[(tab[b as usize] as u32 * 86 + x) as usize] as c_uint; + let mt: [c_uint; 3] = [2048, 342, 57]; + v = (v * mt[y as usize] >> 11) % 6; + + /* use the bit vector out of the tables as an index into + * a block-specific set of rules and decode the rule into + * a type and a case-mapping delta. */ + let mut r: c_int = rules[(rulebases[b as usize] as c_uint + v) as usize]; + let mut rt: c_uint = (r & 255) as c_uint; + let mut rd: c_int = r >> 8; + + /* rules 0/1 are simple lower/upper case with a delta. + * apply according to desired mapping direction. */ + if rt < 2 { + let tmp = -((rt ^ dir as c_uint) as c_int) as c_uint; + return c0.wrapping_add(rd as c_uint & tmp); + } + + /* binary search. endpoints of the binary search for + * this block are stored in the rule delta field. */ + let mut xn: c_uint = (rd & 0xff) as c_uint; + let mut xb: c_uint = rd as c_uint >> 8; + while xn != 0 { + let attempt: c_uint = exceptions[(xb + xn / 2) as usize][0] as c_uint; + if attempt == c { + r = rules[exceptions[(xb + xn / 2) as usize][1] as usize]; + rt = r as c_uint & 255; + rd = r >> 8; + if rt < 2 { + let tmp = -((rt ^ dir as c_uint) as c_int) as c_uint; + return c0.wrapping_add(rd as c_uint & tmp); + } + /* Hard-coded for the four exceptional titlecase */ + if dir == 0 { + return c0 + 1; + } else { + return c0 - 1; + } + } else if attempt > c { + xn /= 2; + } else { + xb += xn / 2; + xn -= xn / 2; + } + } + return c0; +} diff --git a/userspace/lib/ygglibc/src/headers/wctype/mod.rs b/userspace/lib/ygglibc/src/headers/wctype/mod.rs index 017ddd71..af4c44ee 100644 --- a/userspace/lib/ygglibc/src/headers/wctype/mod.rs +++ b/userspace/lib/ygglibc/src/headers/wctype/mod.rs @@ -1,7 +1,34 @@ +// Most functions are borrowed from relibc's wctype +// Because these are extremely boring to implement + use core::ffi::{c_char, c_int, c_uint}; +use casecmp::casemap; + +use crate::{headers::ctype, util::PointerStrExt}; + use super::locale::locale_t; +mod alpha; +mod casecmp; +mod punct; + +pub const WCTYPE_ALNUM: wctype_t = 1; +pub const WCTYPE_ALPHA: wctype_t = 2; +pub const WCTYPE_BLANK: wctype_t = 3; +pub const WCTYPE_CNTRL: wctype_t = 4; +pub const WCTYPE_DIGIT: wctype_t = 5; +pub const WCTYPE_GRAPH: wctype_t = 6; +pub const WCTYPE_LOWER: wctype_t = 7; +pub const WCTYPE_PRINT: wctype_t = 8; +pub const WCTYPE_PUNCT: wctype_t = 9; +pub const WCTYPE_SPACE: wctype_t = 10; +pub const WCTYPE_UPPER: wctype_t = 11; +pub const WCTYPE_XDIGIT: wctype_t = 12; + +const WCTRANSUP: wctrans_t = 1 as wctrans_t; +const WCTRANSLW: wctrans_t = 2 as wctrans_t; + pub type wint_t = c_uint; pub type wctype_t = c_int; pub type wctrans_t = c_int; @@ -9,78 +36,133 @@ pub type wctrans_t = c_int; pub const WOF: wint_t = -1i32 as wint_t; #[no_mangle] -unsafe extern "C" fn iswalnum(_wc: wint_t) -> c_int { - todo!() +unsafe extern "C" fn iswalnum(wc: wint_t) -> c_int { + c_int::from(iswdigit(wc) != 0 || iswalpha(wc) != 0) } #[no_mangle] -unsafe extern "C" fn iswalpha(_wc: wint_t) -> c_int { - todo!() +unsafe extern "C" fn iswalpha(wc: wint_t) -> c_int { + c_int::from(alpha::is(wc as usize)) } #[no_mangle] -unsafe extern "C" fn iswblank(_wc: wint_t) -> c_int { - todo!() +unsafe extern "C" fn iswblank(wc: wint_t) -> c_int { + ctype::isblank(wc as c_int) } #[no_mangle] -unsafe extern "C" fn iswcntrl(_wc: wint_t) -> c_int { - todo!() +unsafe extern "C" fn iswcntrl(wc: wint_t) -> c_int { + c_int::from( + wc < 32 + || wc.wrapping_sub(0x7f) < 33 + || wc.wrapping_sub(0x2028) < 2 + || wc.wrapping_sub(0xfff9) < 3, + ) } #[no_mangle] -unsafe extern "C" fn iswdigit(_wc: wint_t) -> c_int { - todo!() +unsafe extern "C" fn iswdigit(wc: wint_t) -> c_int { + c_int::from(wc.wrapping_sub('0' as wint_t) < 10) } #[no_mangle] -unsafe extern "C" fn iswgraph(_wc: wint_t) -> c_int { - todo!() +unsafe extern "C" fn iswgraph(wc: wint_t) -> c_int { + c_int::from(iswspace(wc) == 0 && iswprint(wc) != 0) } #[no_mangle] -unsafe extern "C" fn iswlower(_wc: wint_t) -> c_int { - todo!() +unsafe extern "C" fn iswlower(wc: wint_t) -> c_int { + c_int::from(towupper(wc) != wc) } #[no_mangle] -unsafe extern "C" fn iswprint(_wc: wint_t) -> c_int { - todo!() +unsafe extern "C" fn iswprint(wc: wint_t) -> c_int { + if wc < 0xff { + c_int::from((wc + 1 & 0x7f) >= 0x21) + } else if wc < 0x2028 + || wc.wrapping_sub(0x202a) < 0xd800 - 0x202a + || wc.wrapping_sub(0xe000) < 0xfff9 - 0xe000 + { + 1 + } else if wc.wrapping_sub(0xfffc) > 0x10ffff - 0xfffc || (wc & 0xfffe) == 0xfffe { + 0 + } else { + 1 + } } #[no_mangle] -unsafe extern "C" fn iswpunct(_wc: wint_t) -> c_int { - todo!() +unsafe extern "C" fn iswpunct(wc: wint_t) -> c_int { + c_int::from(punct::is(wc as usize)) } #[no_mangle] -unsafe extern "C" fn iswspace(_wc: wint_t) -> c_int { - todo!() +unsafe extern "C" fn iswspace(wc: wint_t) -> c_int { + c_int::from( + [ + ' ' as wint_t, + '\t' as wint_t, + '\n' as wint_t, + '\r' as wint_t, + 11, + 12, + 0x0085, + 0x2000, + 0x2001, + 0x2002, + 0x2003, + 0x2004, + 0x2005, + 0x2006, + 0x2008, + 0x2009, + 0x200a, + 0x2028, + 0x2029, + 0x205f, + 0x3000, + ] + .contains(&wc), + ) } #[no_mangle] -unsafe extern "C" fn iswupper(_wc: wint_t) -> c_int { - todo!() +unsafe extern "C" fn iswupper(wc: wint_t) -> c_int { + c_int::from(towlower(wc) != wc) } #[no_mangle] -unsafe extern "C" fn iswxdigit(_wc: wint_t) -> c_int { - todo!() +unsafe extern "C" fn iswxdigit(wc: wint_t) -> c_int { + c_int::from(wc.wrapping_sub('0' as wint_t) < 10 || (wc | 32).wrapping_sub('a' as wint_t) < 6) } #[no_mangle] -unsafe extern "C" fn towlower(_wc: wint_t) -> wint_t { - todo!() +unsafe extern "C" fn towlower(wc: wint_t) -> wint_t { + casemap(wc, 0) } #[no_mangle] -unsafe extern "C" fn towupper(_wc: wint_t) -> wint_t { - todo!() +unsafe extern "C" fn towupper(wc: wint_t) -> wint_t { + casemap(wc, 1) } #[no_mangle] -unsafe extern "C" fn iswctype(_wc: wint_t, _ctype: wctype_t) -> c_int { - todo!() +unsafe extern "C" fn iswctype(wc: wint_t, ctype: wctype_t) -> c_int { + match ctype { + WCTYPE_ALNUM => iswalnum(wc), + WCTYPE_ALPHA => iswalpha(wc), + WCTYPE_BLANK => iswblank(wc), + WCTYPE_CNTRL => iswcntrl(wc), + WCTYPE_DIGIT => iswdigit(wc), + WCTYPE_GRAPH => iswgraph(wc), + WCTYPE_LOWER => iswlower(wc), + WCTYPE_PRINT => iswprint(wc), + WCTYPE_PUNCT => iswpunct(wc), + WCTYPE_SPACE => iswspace(wc), + WCTYPE_UPPER => iswupper(wc), + WCTYPE_XDIGIT => iswxdigit(wc), + _ => 0, + } } #[no_mangle] @@ -89,108 +171,132 @@ unsafe extern "C" fn wctype_t(_s: *const c_char) -> wctype_t { } #[no_mangle] -unsafe extern "C" fn towctrans(_wc: wint_t, _trans: wctrans_t) -> wint_t { - todo!() +unsafe extern "C" fn towctrans(wc: wint_t, trans: wctrans_t) -> wint_t { + match trans { + WCTRANSUP => towupper(wc), + WCTRANSLW => towlower(wc), + _ => wc, + } } #[no_mangle] -unsafe extern "C" fn wctrans(_s: *const c_char) -> wctrans_t { - todo!() +unsafe extern "C" fn wctrans(s: *const c_char) -> wctrans_t { + let s = s.ensure_str(); + match s { + "toupper" => WCTRANSUP, + "tolower" => WCTRANSLW, + _ => 0 as wctrans_t, + } } #[no_mangle] -unsafe extern "C" fn wctype(_s: *const c_char) -> wctype_t { - todo!() +unsafe extern "C" fn wctype(s: *const c_char) -> wctype_t { + let s = s.ensure_str(); + match s { + "alnum" => WCTYPE_ALNUM, + "alpha" => WCTYPE_ALPHA, + "blank" => WCTYPE_BLANK, + "cntrl" => WCTYPE_CNTRL, + "digit" => WCTYPE_DIGIT, + "graph" => WCTYPE_GRAPH, + "lower" => WCTYPE_LOWER, + "print" => WCTYPE_PRINT, + "punct" => WCTYPE_PUNCT, + "space" => WCTYPE_SPACE, + "upper" => WCTYPE_UPPER, + "xdigit" => WCTYPE_XDIGIT, + _ => 0, + } } -// Locale +// TODO Locales #[no_mangle] -unsafe extern "C" fn iswalnum_l(_wc: wint_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswalnum_l(wc: wint_t, _locale: locale_t) -> c_int { + iswalnum(wc) } #[no_mangle] -unsafe extern "C" fn iswalpha_l(_wc: wint_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswalpha_l(wc: wint_t, _locale: locale_t) -> c_int { + iswalpha(wc) } #[no_mangle] -unsafe extern "C" fn iswblank_l(_wc: wint_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswblank_l(wc: wint_t, _locale: locale_t) -> c_int { + iswblank(wc) } #[no_mangle] -unsafe extern "C" fn iswcntrl_l(_wc: wint_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswcntrl_l(wc: wint_t, _locale: locale_t) -> c_int { + iswcntrl(wc) } #[no_mangle] -unsafe extern "C" fn iswdigit_l(_wc: wint_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswdigit_l(wc: wint_t, _locale: locale_t) -> c_int { + iswdigit(wc) } #[no_mangle] -unsafe extern "C" fn iswgraph_l(_wc: wint_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswgraph_l(wc: wint_t, _locale: locale_t) -> c_int { + iswgraph(wc) } #[no_mangle] -unsafe extern "C" fn iswlower_l(_wc: wint_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswlower_l(wc: wint_t, _locale: locale_t) -> c_int { + iswlower(wc) } #[no_mangle] -unsafe extern "C" fn iswprint_l(_wc: wint_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswprint_l(wc: wint_t, _locale: locale_t) -> c_int { + iswprint(wc) } #[no_mangle] -unsafe extern "C" fn iswpunct_l(_wc: wint_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswpunct_l(wc: wint_t, _locale: locale_t) -> c_int { + iswpunct(wc) } #[no_mangle] -unsafe extern "C" fn iswspace_l(_wc: wint_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswspace_l(wc: wint_t, _locale: locale_t) -> c_int { + iswspace(wc) } #[no_mangle] -unsafe extern "C" fn iswupper_l(_wc: wint_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswupper_l(wc: wint_t, _locale: locale_t) -> c_int { + iswupper(wc) } #[no_mangle] -unsafe extern "C" fn iswxdigit_l(_wc: wint_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswxdigit_l(wc: wint_t, _locale: locale_t) -> c_int { + iswxdigit(wc) } #[no_mangle] -unsafe extern "C" fn towlower_l(_wc: wint_t, _locale: locale_t) -> wint_t { - todo!() +unsafe extern "C" fn towlower_l(wc: wint_t, _locale: locale_t) -> wint_t { + towlower(wc) } #[no_mangle] -unsafe extern "C" fn towupper_l(_wc: wint_t, _locale: locale_t) -> wint_t { - todo!() +unsafe extern "C" fn towupper_l(wc: wint_t, _locale: locale_t) -> wint_t { + towupper(wc) } #[no_mangle] -unsafe extern "C" fn iswctype_l(_wc: wint_t, _ctype: wctype_t, _locale: locale_t) -> c_int { - todo!() +unsafe extern "C" fn iswctype_l(wc: wint_t, ctype: wctype_t, _locale: locale_t) -> c_int { + iswctype(wc, ctype) } #[no_mangle] -unsafe extern "C" fn towctrans_l(_wc: wint_t, _trans: wctrans_t, _locale: locale_t) -> wint_t { - todo!() +unsafe extern "C" fn towctrans_l(wc: wint_t, trans: wctrans_t, _locale: locale_t) -> wint_t { + towctrans(wc, trans) } #[no_mangle] -unsafe extern "C" fn wctrans_l(_s: *const c_char, _locale: locale_t) -> wctrans_t { - todo!() +unsafe extern "C" fn wctrans_l(s: *const c_char, _locale: locale_t) -> wctrans_t { + wctrans(s) } #[no_mangle] -unsafe extern "C" fn wctype_l(_s: *const c_char, _locale: locale_t) -> wctype_t { - todo!() +unsafe extern "C" fn wctype_l(s: *const c_char, _locale: locale_t) -> wctype_t { + wctype(s) } diff --git a/userspace/lib/ygglibc/src/headers/wctype/punct.rs b/userspace/lib/ygglibc/src/headers/wctype/punct.rs new file mode 100644 index 00000000..3ae44ded --- /dev/null +++ b/userspace/lib/ygglibc/src/headers/wctype/punct.rs @@ -0,0 +1,167 @@ +// Borrowed from relibc's wctype/punct.rs +// Which in turn borrowed it from musl's src/ctype/punct.h +// Licensed under the MIT license +// Copyright 2005-2020 Rich Felker, et al. + +use core::ffi::c_uchar; + +pub fn is(wc: usize) -> c_uchar { + if wc < 0x20000 { + return (table[(table[wc >> 8] as usize) * 32 + ((wc & 255) >> 3)] >> (wc & 7)) & 1; + } + return 0; +} + +const table: [c_uchar; 4000] = [ + 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, 17, 47, 17, 17, 17, 17, 17, 17, 48, 49, 50, 51, 52, + 53, 54, 55, 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, 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, 57, 16, 58, 59, + 60, 61, 62, 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, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 64, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 65, 16, 16, 66, 16, 67, 68, 69, 16, 70, 71, 72, 16, 73, 16, 16, + 74, 75, 76, 77, 78, 16, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 16, 92, 93, 94, 95, + 16, 16, 16, 16, 96, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 97, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 98, 99, 16, 16, 100, 101, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 102, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 103, 104, 105, 106, 16, 16, 107, 108, 17, 17, 109, 16, + 16, 16, 16, 16, 16, 110, 111, 16, 16, 16, 16, 16, 112, 113, 16, 16, 114, 115, 116, 16, 117, + 118, 119, 17, 17, 17, 120, 121, 122, 123, 124, 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, 230, 254, 255, 255, + 255, 0, 64, 73, 0, 0, 0, 0, 0, 24, 0, 255, 255, 0, 216, 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, 227, 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, 8, 0, 7, 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, 111, 0, 0, 0, + 0, 0, 0, 0, 16, 0, 32, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 32, 0, 0, 0, 0, 3, 224, + 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, 16, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 128, 255, 16, 0, 0, 0, 0, 0, 0, 16, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 160, 0, 127, 0, 0, 255, 3, 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, 4, 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, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 224, 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, 255, 127, 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, 128, 248, 0, 0, 0, + 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 255, 255, 255, 33, 144, 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, 255, 255, 255, 255, 127, 0, 224, 251, 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, 223, 255, 241, 127, 255, + 127, 0, 0, 255, 255, 255, 255, 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, 14, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 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, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 207, 255, 255, 255, 63, 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, 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, 255, 255, 255, + 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, 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, 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,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, 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, 127, + 255, 15, 1, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 255, 255, 255, 15, 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, 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, 128, 255, 0, 0, 128, 255, 0, 0, 0, 0, 128, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 0, 0, + 192, 143, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 255, 255, 252, 255, + 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 135, 255, 1, 255, 1, 0, 0, 0, 224, 0, 0, 0, 224, 0, 0, + 0, 0, 0, 1, 0, 0, 96, 248, 127, 0, 0, 0, 0, 0, 0, 0, 0, 254, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, + 0, 30, 0, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0,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 0, 0, 255, 255, 255, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 176, 15, 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, 255, 255, 1, 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, 255, 255, 15, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 127, 0, 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, 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, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 15, 0, 248, 254, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 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, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 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, 128, 255, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 112, 7, 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, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 254, 255, 255, 255, 255, 255, 255, 255, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 254, 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, 0, 0, 0, 0, 0, 0, 0, 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, 255, 254, 255, 254, 255, 255, 255, 63, 0, 255, 31, 255, 255, + 255, 255, 0, 0, 0, 252, 0, 0, 0, 28, 0, 0, 0, 252, 255, 255, 255, 31, 0, 0, 0, 0, 0, 0, 192, + 255, 255, 255, 7, 0, 255, 255, 255, 255, 255, 15, 255, 1, 3, 0, 63, 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, 63, 0, 255, 31, 255, 7, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 1, 255, 15, 0, 0, 255, 15, 255, 255, 255, 255, 255, 255, + 255, 0, 255, 3, 255, 255, 255, 255, 255, 0, 255, 255, 255, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 255, 239, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 123, 252, 255, 255, 255, + 255, 231, 199, 255, 255, 255, 231, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 15, 0, 255, 63, 15, 7, 7, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +];