diff --git a/src/header/ctype/mod.rs b/src/header/ctype/mod.rs index cbe2f35548..632c417e7b 100644 --- a/src/header/ctype/mod.rs +++ b/src/header/ctype/mod.rs @@ -2,8 +2,6 @@ //! //! See . -// TODO: *_l functions - use crate::platform::types::c_int; /// See . @@ -12,12 +10,24 @@ pub extern "C" fn isalnum(c: c_int) -> c_int { c_int::from(isdigit(c) != 0 || isalpha(c) != 0) } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn isalnum_l(c: c_int, _loc: locale_t) -> c_int { + isalnum(c) +} + /// See . #[unsafe(no_mangle)] pub extern "C" fn isalpha(c: c_int) -> c_int { c_int::from(islower(c) != 0 || isupper(c) != 0) } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn isalpha_l(c: c_int, _loc: locale_t) -> c_int { + isalpha(c) +} + /// See . /// /// The `isascii()` function was marked obsolescent in the Open Group Base @@ -34,36 +44,72 @@ pub extern "C" fn isblank(c: c_int) -> c_int { c_int::from(c == c_int::from(b' ') || c == c_int::from(b'\t')) } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn isblank_l(c: c_int, _loc: locale_t) -> c_int { + isblank(c) +} + /// See . #[unsafe(no_mangle)] pub extern "C" fn iscntrl(c: c_int) -> c_int { c_int::from((c >= 0x00 && c <= 0x1f) || c == 0x7f) } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn iscntrl_l(c: c_int, _loc: locale_t) -> c_int { + iscntrl(c) +} + /// See . #[unsafe(no_mangle)] pub extern "C" fn isdigit(c: c_int) -> c_int { c_int::from(c >= c_int::from(b'0') && c <= c_int::from(b'9')) } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn isdigit_l(c: c_int, _loc: locale_t) -> c_int { + isdigit(c) +} + /// See . #[unsafe(no_mangle)] pub extern "C" fn isgraph(c: c_int) -> c_int { c_int::from(c >= 0x21 && c <= 0x7e) } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn isgraph_l(c: c_int, _loc: locale_t) -> c_int { + isgraph(c) +} + /// See . #[unsafe(no_mangle)] pub extern "C" fn islower(c: c_int) -> c_int { c_int::from(c >= c_int::from(b'a') && c <= c_int::from(b'z')) } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn islower_l(c: c_int, _loc: locale_t) -> c_int { + islower(c) +} + /// See . #[unsafe(no_mangle)] pub extern "C" fn isprint(c: c_int) -> c_int { c_int::from(c >= 0x20 && c < 0x7f) } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn isprint_l(c: c_int, _loc: locale_t) -> c_int { + isprint(c) +} + /// See . #[unsafe(no_mangle)] pub extern "C" fn ispunct(c: c_int) -> c_int { @@ -75,6 +121,12 @@ pub extern "C" fn ispunct(c: c_int) -> c_int { ) } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn ispunct_l(c: c_int, _loc: locale_t) -> c_int { + ispunct(c) +} + /// See . #[unsafe(no_mangle)] pub extern "C" fn isspace(c: c_int) -> c_int { @@ -88,18 +140,36 @@ pub extern "C" fn isspace(c: c_int) -> c_int { ) } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn isspace_l(c: c_int, _loc: locale_t) -> c_int { + isspace(c) +} + /// See . #[unsafe(no_mangle)] pub extern "C" fn isupper(c: c_int) -> c_int { c_int::from(c >= c_int::from(b'A') && c <= c_int::from(b'Z')) } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn isupper_l(c: c_int, _loc: locale_t) -> c_int { + isupper(c) +} + /// See . #[unsafe(no_mangle)] pub extern "C" fn isxdigit(c: c_int) -> c_int { c_int::from(isdigit(c) != 0 || (c | 32 >= c_int::from(b'a') && c | 32 <= c_int::from(b'f'))) } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn isxdigit_l(c: c_int, _loc: locale_t) -> c_int { + isxdigit(c) +} + /// See . /// /// The `toascii()` function was marked obsolescent in the Open Group Base @@ -116,8 +186,20 @@ pub extern "C" fn tolower(c: c_int) -> c_int { if isupper(c) != 0 { c | 0x20 } else { c } } +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn tolower_l(c: c_int, _loc: locale_t) -> c_int { + tolower(c) +} + /// See . #[unsafe(no_mangle)] pub extern "C" fn toupper(c: c_int) -> c_int { if islower(c) != 0 { c & !0x20 } else { c } } + +/// See . +#[unsafe(no_mangle)] +pub extern "C" fn toupper_l(c: c_int, _loc: locale_t) -> c_int { + toupper(c) +}