libc: finish most header stubs

This commit is contained in:
Mark Poliakov 2024-11-12 20:28:26 +02:00
parent c957a603e0
commit 0b9f1c0fac
46 changed files with 1781 additions and 24 deletions

View File

@ -32,8 +32,14 @@ fn generate_header(config_path: impl AsRef<Path>, header_output: impl AsRef<Path
.ok() .ok()
.and_then(|p| p.parent()) .and_then(|p| p.parent())
.and_then(|p| p.to_str()) .and_then(|p| p.to_str())
.unwrap() .unwrap();
.replace("_", "/");
// NOTE: a hack for nl_types.h
let relative_path = if relative_path.contains("nl_types") {
relative_path.to_owned()
} else {
relative_path.replace("_", "/")
};
// TODO use outer workspace's target directory? // TODO use outer workspace's target directory?
let header_path = header_output.join(&relative_path).with_extension("h"); let header_path = header_output.join(&relative_path).with_extension("h");
let mod_path = config_path.with_file_name("mod.rs"); let mod_path = config_path.with_file_name("mod.rs");

View File

@ -0,0 +1,7 @@
#ifndef _YGGDRASIL_MONETARY_H
#define _YGGDRASIL_MONETARY_H 1
ssize_t strfmon(char *buf, size_t buflen, const char *fmt, ...);
ssize_t strfmon_l(char *buf, size_t buflen, locale_t locale, const char *fmt, ...);
#endif

View File

@ -0,0 +1,16 @@
#ifndef _YGGDRASIL_SYS_SELECT_H
#define _YGGDRASIL_SYS_SELECT_H 1
#define FD_CLR(fd, fd_set) \
(fd_set).__bits[(fd) / FD_BITS_PER_WORD] &= ~(1 << ((fd) % FD_BITS_PER_WORD))
#define FD_ISSET(fd, fd_set) \
(!!((fd_set).__bits[(fd) / FD_BITS_PER_WORD] & (1 << ((fd) % FD_BITS_PER_WORD))))
#define FD_SET(fd, fd_set) \
(fd_set).__bits[(fd) / FD_BITS_PER_WORD] |= (1 << ((fd) % FD_BITS_PER_WORD))
#define FD_ZERO(fd_set) \
(fd_set).__bits = {0}
#endif

View File

@ -0,0 +1,25 @@
#ifndef _YGGDRASIL_SYS_WAIT_H
#define _YGGDRASIL_SYS_WAIT_H 1
#define WEXITSTATUS(c) ((int) ((c) & 0xFF))
// TODO
#define WIFCONTINUED(c) \
0
// TODO
#define WIFSTOPPED(c) \
0
// TODO
#define WSTOPSIG(c) \
0
#define WIFEXITED(c) \
((c) < 0x100 && (c) >= 0)
#define WIFSIGNALED(c) \
((c) > 0x100)
#define WTERMSIG(c) \
((c) - 0x100)
#endif

View File

@ -0,0 +1,6 @@
#ifndef _YGGDRASIL_ULIMIT_H
#define _YGGDRASIL_ULIMIT_H 1
long ulimit(int which, ...);
#endif

View File

@ -0,0 +1,11 @@
#ifndef _YGGDRASIL_WCHAR_H
#define _YGGDRASIL_WCHAR_H 1
int fwprintf(FILE *fp, const wchar_t *fmt, ...);
int fwscanf(FILE *fp, const wchar_t *fmt, ...);
int swprintf(wchar_t *buf, size_t len, const wchar_t *fmt, ...);
int swscanf(const wchar_t *buf, const wchar_t *fmt, ...);
int wprintf(const wchar_t *fmt, ...);
int wscanf(const wchar_t *fmt, ...);
#endif

View File

@ -0,0 +1,14 @@
language = "C"
style = "Type"
sys_includes = ["sys/types.h"]
no_includes = true
include_guard = "_ICONV_H"
usize_type = "size_t"
isize_type = "ssize_t"
[export]
include = ["iconv_t"]
exclude = []

View File

@ -0,0 +1,24 @@
use core::ffi::{c_char, c_int, c_void};
pub type iconv_t = *mut c_void;
#[no_mangle]
unsafe extern "C" fn iconv(
_conv: iconv_t,
_inbuf: *mut *mut c_char,
_inbytesleft: *mut usize,
_outbuf: *mut *mut c_char,
_outbytesleft: *mut usize,
) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iconv_close(_conv: iconv_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iconv_open(_tocode: *const c_char, _fromcode: *const c_char) -> iconv_t {
todo!()
}

View File

@ -0,0 +1,10 @@
language = "C"
style = "Type"
sys_includes = ["nl_types.h", "locale.h"]
no_includes = true
include_guard = "_LANGINFO_H"
usize_type = "size_t"
isize_type = "ssize_t"

View File

@ -0,0 +1,69 @@
use core::ffi::c_char;
use super::{locale::locale_t, nl_types::nl_item};
pub const CODESET: nl_item = 1;
pub const D_T_FMT: nl_item = 2;
pub const D_FMT: nl_item = 3;
pub const T_FMT: nl_item = 4;
pub const T_FMT_AMPM: nl_item = 5;
pub const AM_STR: nl_item = 6;
pub const PM_STR: nl_item = 7;
pub const DAY_1: nl_item = 8;
pub const DAY_2: nl_item = 9;
pub const DAY_3: nl_item = 10;
pub const DAY_4: nl_item = 11;
pub const DAY_5: nl_item = 12;
pub const DAY_6: nl_item = 13;
pub const DAY_7: nl_item = 14;
pub const ABDAY_1: nl_item = 15;
pub const ABDAY_2: nl_item = 16;
pub const ABDAY_3: nl_item = 17;
pub const ABDAY_4: nl_item = 18;
pub const ABDAY_5: nl_item = 19;
pub const ABDAY_6: nl_item = 20;
pub const ABDAY_7: nl_item = 21;
pub const MON_1: nl_item = 22;
pub const MON_2: nl_item = 23;
pub const MON_3: nl_item = 24;
pub const MON_4: nl_item = 25;
pub const MON_5: nl_item = 26;
pub const MON_6: nl_item = 27;
pub const MON_7: nl_item = 28;
pub const MON_8: nl_item = 29;
pub const MON_9: nl_item = 30;
pub const MON_10: nl_item = 31;
pub const MON_11: nl_item = 32;
pub const MON_12: nl_item = 33;
pub const ABMON_1: nl_item = 34;
pub const ABMON_2: nl_item = 35;
pub const ABMON_3: nl_item = 36;
pub const ABMON_4: nl_item = 37;
pub const ABMON_5: nl_item = 38;
pub const ABMON_6: nl_item = 39;
pub const ABMON_7: nl_item = 40;
pub const ABMON_8: nl_item = 41;
pub const ABMON_9: nl_item = 42;
pub const ABMON_10: nl_item = 43;
pub const ABMON_11: nl_item = 44;
pub const ABMON_12: nl_item = 45;
pub const ERA: nl_item = 46;
pub const ERA_D_FMT: nl_item = 47;
pub const ERA_D_T_FMT: nl_item = 48;
pub const ERA_T_FMT: nl_item = 49;
pub const ALT_DIGITS: nl_item = 50;
pub const RADIXCHAR: nl_item = 51;
pub const THOUSEP: nl_item = 52;
pub const YESEXPR: nl_item = 53;
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!()
}
#[no_mangle]
unsafe extern "C" fn nl_langinfo_l(_item: nl_item, _locale: locale_t) -> *mut c_char {
todo!()
}

View File

@ -12,7 +12,6 @@
// <netdb.h> ! // <netdb.h> !
// <netinet/in.h> ! // <netinet/in.h> !
// <netinet/tcp.h> ! // <netinet/tcp.h> !
// <nl_types.h> !
// <sys/socket.h> ! // <sys/socket.h> !
// <sys/un.h> ! // <sys/un.h> !
@ -26,9 +25,9 @@
// I/O utilities // I/O utilities
// <cpio.h> ! // <cpio.h> !
// <fmtmsg.h> ! // <fmtmsg.h> !
// <fnmatch.h> - // <fnmatch.h> !
// <ftw.h> - // <ftw.h> !
// <glob.h> - // <glob.h> !
// <mqueue.h> ! // <mqueue.h> !
// <stdlib.h> = // <stdlib.h> =
// <stropts.h> ! // <stropts.h> !
@ -39,14 +38,14 @@
// <aio.h> ! // <aio.h> !
// <dirent.h> + // <dirent.h> +
// <fcntl.h> + // <fcntl.h> +
// <poll.h> - // <poll.h> =
// <stdio.h> + // <stdio.h> +
// <sys/select.h> - // <sys/select.h> =
// <sys/shm.h> - // <sys/shm.h> !
// <sys/stat.h> = // <sys/stat.h> =
// <sys/statvfs.h> - // <sys/statvfs.h> =
// <syslog.h> ! // <syslog.h> !
// <termios.h> - // <termios.h> =
// <trace.h> ! // <trace.h> !
// <unistd.h> ~ // <unistd.h> ~
@ -72,26 +71,27 @@
// <semaphore.h> ! // <semaphore.h> !
// <setjmp.h> + // <setjmp.h> +
// <signal.h> = // <signal.h> =
// <spawn.h> - // <spawn.h> =
// <sys/ipc.h> ! // <sys/ipc.h> !
// <sys/mman.h> - // <sys/mman.h> =
// <sys/msg.h> ! // <sys/msg.h> !
// <sys/sem.h> ! // <sys/sem.h> !
// <sys/wait.h> - // <sys/wait.h> =
// <ulimit.h> - // <ulimit.h> =
// <utime.h> - // <utime.h> =
// Locale & string utilities // Locale & string utilities
// <ctype.h> + // <ctype.h> +
// <iconv.h> - // <iconv.h> =
// <langinfo.h> - // <langinfo.h> =
// <locale.h> = // <locale.h> =
// <monetary.h> - // <monetary.h> =
// <regex.h> - // <nl_types.h> =
// <regex.h> !
// <string.h> + // <string.h> +
// <strings.h> = // <strings.h> =
// <wchar.h> - // <wchar.h> =
// <wctype.h> - // <wctype.h> =
// <wordexp.h> ! // <wordexp.h> !
pub mod ctype; pub mod ctype;
@ -99,22 +99,37 @@ pub mod dirent;
pub mod errno; pub mod errno;
pub mod fcntl; pub mod fcntl;
pub mod grp; pub mod grp;
pub mod iconv;
pub mod langinfo;
pub mod libgen; pub mod libgen;
pub mod locale; pub mod locale;
pub mod monetary;
pub mod nl_types;
pub mod poll;
pub mod pwd; pub mod pwd;
pub mod sched; pub mod sched;
pub mod setjmp; pub mod setjmp;
pub mod signal; pub mod signal;
pub mod spawn;
pub mod stdio; pub mod stdio;
pub mod stdlib; pub mod stdlib;
pub mod string; pub mod string;
pub mod strings; pub mod strings;
pub mod termios;
pub mod time; pub mod time;
pub mod ulimit;
pub mod unistd; pub mod unistd;
pub mod utime;
pub mod wchar;
pub mod wctype;
pub mod sys_mman;
pub mod sys_resource; pub mod sys_resource;
pub mod sys_select;
pub mod sys_stat; pub mod sys_stat;
pub mod sys_statvfs;
pub mod sys_time; pub mod sys_time;
pub mod sys_times; pub mod sys_times;
pub mod sys_types; pub mod sys_types;
pub mod sys_utsname; pub mod sys_utsname;
pub mod sys_wait;

View File

@ -0,0 +1,13 @@
language = "C"
style = "Type"
sys_includes = ["sys/types.h", "stddef.h", "locale.h", "bits/monetary.h"]
no_includes = true
include_guard = "_MONETARY_H"
usize_type = "size_t"
isize_type = "ssize_t"
[export]
exclude = ["strfmon", "strfmon_l"]

View File

@ -0,0 +1,24 @@
use core::ffi::c_char;
use super::locale::locale_t;
#[no_mangle]
unsafe extern "C" fn strfmon(
_buf: *mut c_char,
_buflen: usize,
_fmt: *const c_char,
_args: ...
) -> isize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn strfmon_l(
_buf: *mut c_char,
_buflen: usize,
_locale: locale_t,
_fmt: *const c_char,
_args: ...
) -> isize {
todo!()
}

View File

@ -0,0 +1,13 @@
language = "C"
style = "Type"
sys_includes = ["locale.h"]
no_includes = true
include_guard = "_NL_TYPES_H"
usize_type = "size_t"
isize_type = "ssize_t"
[export]
include = ["nl_catd", "nl_item"]

View File

@ -0,0 +1,27 @@
use core::ffi::{c_char, c_int, c_void};
pub type nl_catd = *mut c_void;
pub type nl_item = c_int;
pub const NL_SETD: c_int = 1 << 0;
pub const NL_CAT_LOCALE: c_int = 1 << 1;
#[no_mangle]
unsafe extern "C" fn catclose(_cat: nl_catd) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn catgets(
_cat: nl_catd,
_set_number: c_int,
_message_number: c_int,
_message: *const c_char,
) -> *mut c_char {
todo!()
}
#[no_mangle]
unsafe extern "C" fn catopen(_name: *const c_char, _flag: c_int) -> nl_catd {
todo!()
}

View File

@ -0,0 +1,10 @@
language = "C"
style = "Tag"
sys_includes = ["stdint.h"]
no_includes = true
include_guard = "_POLL_H"
usize_type = "size_t"
isize_type = "ssize_t"

View File

@ -0,0 +1,28 @@
use core::ffi::{c_int, c_short};
#[repr(C)]
pub struct pollfd {
pub fd: c_int,
pub events: c_short,
pub revents: c_short,
}
pub type nfds_t = u32;
pub const POLLIN: c_short = 1 << 0;
pub const POLLOUT: c_short = 1 << 1;
pub const POLLERR: c_short = 1 << 2;
pub const POLLPRI: c_short = 1 << 3;
pub const POLLHUP: c_short = 1 << 4;
pub const POLLNVAL: c_short = 1 << 5;
pub const POLLRDNORM: c_short = 1 << 6;
pub const POLLRDBAND: c_short = 1 << 7;
pub const POLLWRNORM: c_short = 1 << 8;
pub const POLLWRBAND: c_short = 1 << 9;
#[no_mangle]
unsafe extern "C" fn poll(_fds: *mut pollfd, _nfds: nfds_t, _flags: c_int) -> c_int {
todo!()
}

View File

@ -8,3 +8,6 @@ include_guard = "_SCHED_H"
usize_type = "size_t" usize_type = "size_t"
isize_type = "ssize_t" isize_type = "ssize_t"
[export]
include = ["__ygg_sched_param_t"]

View File

@ -11,6 +11,8 @@ pub struct sched_param {
pub sched_ss_max_repl: c_int, pub sched_ss_max_repl: c_int,
} }
pub type __ygg_sched_param_t = sched_param;
pub const SCHED_FIFO: c_int = 0; pub const SCHED_FIFO: c_int = 0;
pub const SCHED_RR: c_int = 1; pub const SCHED_RR: c_int = 1;
pub const SCHED_SPORADIC: c_int = 2; pub const SCHED_SPORADIC: c_int = 2;

View File

@ -0,0 +1,18 @@
language = "C"
style = "Type"
sys_includes = [
"stddef.h",
"sys/types.h",
"signal.h",
"sched.h"
]
no_includes = true
include_guard = "_SPAWN_H"
usize_type = "size_t"
isize_type = "ssize_t"
[export]
include = ["posix_spawnattr_t", "posix_spawn_file_actions_t"]

View File

@ -0,0 +1,192 @@
use core::ffi::{c_char, c_int, c_short, c_void};
use super::{
sched::__ygg_sched_param_t,
sys_types::{mode_t, pid_t},
};
#[repr(C)]
pub struct posix_spawnattr_t {}
#[repr(C)]
pub struct posix_spawn_file_actions_t {}
pub const POSIX_SPAWN_RESETIDS: c_int = 1 << 1;
pub const POSIX_SPAWN_SETPGROUP: c_int = 1 << 2;
pub const POSIX_SPAWN_SETSCHEDPARAM: c_int = 1 << 3;
pub const POSIX_SPAWN_SETSCHEDULER: c_int = 1 << 4;
pub const POSIX_SPAWN_SETSIGDEF: c_int = 1 << 5;
pub const POSIX_SPAWN_SETSIGMASK: c_int = 1 << 6;
#[no_mangle]
unsafe extern "C" fn posix_spawn(
_pid: *mut pid_t,
_path: *const c_char,
_file_actions: *const posix_spawn_file_actions_t,
_attrp: *const posix_spawnattr_t,
_argv: *const *mut c_char,
_envp: *const *mut c_char,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnp(
_pid: *mut pid_t,
_path: *const c_char,
_file_actions: *const posix_spawn_file_actions_t,
_attrp: *const posix_spawnattr_t,
_argv: *const *mut c_char,
_envp: *const *mut c_char,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawn_file_actions_addclose(
_file_actions: *mut posix_spawn_file_actions_t,
_fd: c_int,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawn_file_actions_adddup2(
_file_actions: *mut posix_spawn_file_actions_t,
_oldfd: c_int,
_newfd: c_int,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawn_file_actions_addopen(
_file_actions: *mut posix_spawn_file_actions_t,
_fd: c_int,
_path: *const c_char,
_oflag: c_int,
_mode: mode_t,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawn_file_actions_destroy(
_file_actions: *mut posix_spawn_file_actions_t,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawn_file_actions_init(
_file_actions: *mut posix_spawn_file_actions_t,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_destroy(_attrp: *mut posix_spawnattr_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_getflags(
_attrp: *const posix_spawnattr_t,
_flags: *mut c_short,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_getpgroup(
_attrp: *const posix_spawnattr_t,
_pgrp: *mut pid_t,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_getschedparam(
_attrp: *const posix_spawnattr_t,
_param: *mut __ygg_sched_param_t,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_getschedpolicy(
_attrp: *const posix_spawnattr_t,
_policy: *mut c_int,
) -> c_int {
todo!()
}
// TODO sigset_t
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_getsigdefault(
_attrp: *const posix_spawnattr_t,
_sigset: *mut c_void,
) -> c_int {
todo!()
}
// TODO sigset_t
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_getsigmask(
_attrp: *const posix_spawnattr_t,
_sigset: *mut c_void,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_init(_attrp: *mut posix_spawnattr_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_setflags(
_attrp: *mut posix_spawnattr_t,
_flags: c_short,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_setpgroup(
_attrp: *mut posix_spawnattr_t,
_pgrp: pid_t,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_setschedparam(
_attrp: *mut posix_spawnattr_t,
_param: *const __ygg_sched_param_t,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_setschedpolicy(
_attrp: *mut posix_spawnattr_t,
_policy: c_int,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_setsigdefault(
_attrp: *mut posix_spawnattr_t,
_sigset: *const c_void,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_spawnattr_setsigmask(
_attrp: *mut posix_spawnattr_t,
_sigset: *const c_void,
) -> c_int {
todo!()
}

View File

@ -1,7 +1,7 @@
language = "C" language = "C"
style = "Type" style = "Type"
sys_includes = ["stddef.h"] sys_includes = ["stddef.h", "sys/types.h", "locale.h"]
no_includes = true no_includes = true
include_guard = "_STRINGS_H" include_guard = "_STRINGS_H"

View File

@ -3,11 +3,27 @@ use core::{
ffi::{c_char, c_int}, ffi::{c_char, c_int},
}; };
use super::locale::locale_t;
#[no_mangle]
unsafe extern "C" fn ffs(_f: c_int) -> c_int {
todo!()
}
#[no_mangle] #[no_mangle]
unsafe extern "C" fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int { unsafe extern "C" fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int {
strncasecmp(s1, s2, usize::MAX) strncasecmp(s1, s2, usize::MAX)
} }
#[no_mangle]
unsafe extern "C" fn strcasecmp_l(
_s1: *const c_char,
_s2: *const c_char,
_locale: locale_t,
) -> c_int {
todo!()
}
#[no_mangle] #[no_mangle]
unsafe extern "C" fn strncasecmp(s1: *const c_char, s2: *const c_char, n: usize) -> c_int { unsafe extern "C" fn strncasecmp(s1: *const c_char, s2: *const c_char, n: usize) -> c_int {
for i in 0..n { for i in 0..n {
@ -27,3 +43,13 @@ unsafe extern "C" fn strncasecmp(s1: *const c_char, s2: *const c_char, n: usize)
0 0
} }
#[no_mangle]
unsafe extern "C" fn strncasecmp_l(
_s1: *const c_char,
_s2: *const c_char,
_n: usize,
_locale: locale_t,
) -> c_int {
todo!()
}

View File

@ -0,0 +1,13 @@
language = "C"
style = "Tag"
sys_includes = ["sys/types.h", "stddef.h"]
no_includes = true
include_guard = "_SYS_MMAN_H"
usize_type = "size_t"
isize_type = "ssize_t"
[export]
include = ["posix_typed_mem_info"]

View File

@ -0,0 +1,138 @@
use core::ffi::{c_char, c_int, c_void};
use crate::error::CPtrResult;
use super::sys_types::{mode_t, off_t};
pub const PROT_NONE: c_int = 0;
pub const PROT_READ: c_int = 1 << 0;
pub const PROT_WRITE: c_int = 1 << 1;
pub const PROT_EXEC: c_int = 1 << 2;
pub const MAP_FIXED: c_int = 1 << 0;
pub const MAP_PRIVATE: c_int = 1 << 1;
pub const MAP_SHARED: c_int = 1 << 2;
pub const MS_ASYNC: c_int = 1 << 0;
pub const MS_INVALIDATE: c_int = 1 << 1;
pub const MS_SYNC: c_int = 1 << 2;
pub const MCL_CURRENT: c_int = 1 << 0;
pub const MCL_FUTURE: c_int = 1 << 1;
pub const POSIX_MADV_DONTNEED: c_int = 1 << 0;
pub const POSIX_MADV_NORMAL: c_int = 1 << 1;
pub const POSIX_MADV_RANDOM: c_int = 1 << 2;
pub const POSIX_MADV_SEQUENTIAL: c_int = 1 << 3;
pub const POSIX_MADV_WILLNEED: c_int = 1 << 4;
pub const POSIX_TYPED_MEM_ALLOCATE: c_int = 1 << 0;
pub const POSIX_TYPED_MEM_ALLOCATE_CONTIG: c_int = 1 << 1;
pub const POSIX_TYPED_MEM_MAP_ALLOCATABLE: c_int = 1 << 2;
#[repr(C)]
pub struct posix_typed_mem_info {
pub posix_tmi_length: usize,
}
// msync
#[no_mangle]
unsafe extern "C" fn msync(_ptr: *mut c_void, _len: usize, _flags: c_int) -> c_int {
todo!()
}
// mlock
#[no_mangle]
unsafe extern "C" fn mlock(_ptr: *const c_void, _len: usize) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn mlockall(_flags: c_int) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn munlock(_ptr: *const c_void, _len: usize) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn munlockall() -> c_int {
todo!()
}
// mprotect
#[no_mangle]
unsafe extern "C" fn mprotect(_ptr: *mut c_void, _len: usize, _prot: c_int) -> c_int {
todo!()
}
// mmap
#[no_mangle]
unsafe extern "C" fn mmap(
_hint: *mut c_void,
_len: usize,
_prot: c_int,
_flags: c_int,
_fd: c_int,
_offset: off_t,
) -> CPtrResult<c_void> {
todo!()
}
#[no_mangle]
unsafe extern "C" fn munmap(_ptr: *mut c_void, _len: usize) -> c_int {
todo!()
}
// posix_***
#[no_mangle]
unsafe extern "C" fn posix_madvise(_ptr: *mut c_void, _len: usize, _flags: c_int) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_mem_offset(
_ptr: *const c_void,
_len: usize,
_off: *mut off_t,
_contig_len: *mut usize,
_fd: *mut c_int,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_typed_mem_get_info(
_fd: c_int,
_info: *mut posix_typed_mem_info,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn posix_typed_mem_open(
_path: *const c_char,
_oflag: c_int,
_tflag: c_int,
) -> c_int {
todo!()
}
// shm_***
#[no_mangle]
unsafe extern "C" fn shm_open(_path: *const c_char, _oflag: c_int, _mode: mode_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn shm_unlink(_path: *const c_char) -> c_int {
todo!()
}

View File

@ -0,0 +1,13 @@
language = "C"
style = "Type"
sys_includes = ["sys/types.h", "sys/time.h", "signal.h", "bits/sys/select.h"]
no_includes = true
include_guard = "_SYS_SELECT_H"
usize_type = "size_t"
isize_type = "ssize_t"
[export]
include = ["fd_set"]

View File

@ -0,0 +1,35 @@
use core::ffi::{c_int, c_void};
use super::sys_time::{__ygg_timespec_t, __ygg_timeval_t};
pub const FD_BITS_PER_WORD: usize = 64;
pub const FD_SETSIZE: usize = FD_BITS_PER_WORD * 4;
#[repr(C)]
pub struct fd_set {
__bits: [u64; 4],
}
// TODO sigmask: *const sigset_t
#[no_mangle]
unsafe extern "C" fn pselect(
_nfds: c_int,
_readfds: *mut fd_set,
_writefds: *mut fd_set,
_errorfds: *mut fd_set,
_timeout: *const __ygg_timespec_t,
_sigmask: *const c_void,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn select(
_nfds: c_int,
_readfds: *mut fd_set,
_writefds: *mut fd_set,
_errorfds: *mut fd_set,
_timeout: *const __ygg_timeval_t,
) -> c_int {
todo!()
}

View File

@ -0,0 +1,13 @@
language = "C"
style = "Tag"
sys_includes = ["sys/types.h"]
no_includes = true
include_guard = "_SYS_STATVFS_H"
usize_type = "size_t"
isize_type = "ssize_t"
[export]
include = ["statvfs"]

View File

@ -0,0 +1,33 @@
use core::ffi::{c_char, c_int, c_ulong};
use super::sys_types::{fsblkcnt_t, fsfilcnt_t};
#[repr(C)]
pub struct statvfs {
pub f_bsize: c_ulong,
pub f_frsize: c_ulong,
pub f_blocks: fsblkcnt_t,
pub f_bfree: fsblkcnt_t,
pub f_bavail: fsblkcnt_t,
pub f_files: fsfilcnt_t,
pub f_ffree: fsfilcnt_t,
pub f_favail: fsfilcnt_t,
pub f_fsid: c_ulong,
pub f_flag: c_ulong,
pub f_namemax: c_ulong
}
pub const ST_RDONLY: c_ulong = 1 << 0;
pub const ST_NOSUID: c_ulong = 1 << 1;
#[no_mangle]
unsafe extern "C" fn fstatvfs(_fd: c_int, _statvfs: *mut statvfs) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn statvfs(_path: *const c_char, _statvfs: *mut statvfs) -> c_int {
todo!()
}

View File

@ -0,0 +1,20 @@
language = "C"
style = "Type"
sys_includes = [
"stdarg.h",
"stddef.h",
"stdint.h",
"signal.h",
"sys/types.h",
"bits/sys/wait.h"
]
no_includes = true
include_guard = "_SYS_WAIT_H"
usize_type = "size_t"
isize_type = "ssize_t"
[export]
exclude = []

View File

@ -0,0 +1,38 @@
use core::ffi::{c_int, c_void};
use super::sys_types::{id_t, pid_t};
pub const WCONTINUED: c_int = 1 << 0;
pub const WNOHANG: c_int = 1 << 1;
pub const WUNTRACED: c_int = 1 << 2;
pub const WEXITED: c_int = 1 << 3;
pub const WNOWAIT: c_int = 1 << 4;
pub const WSTOPPED: c_int = 1 << 5;
pub type idtype_t = c_int;
pub const P_ALL: idtype_t = 0;
pub const P_PGID: idtype_t = 1;
pub const P_PID: idtype_t = 2;
#[no_mangle]
unsafe extern "C" fn wait(_status: *mut c_int) -> pid_t {
todo!()
}
// TODO siginfo_t
#[no_mangle]
unsafe extern "C" fn waitid(
_idtype: idtype_t,
_id: id_t,
_siginfo: *mut c_void,
_options: c_int,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn waitpid(_pid: pid_t, _status: *mut c_int, _options: c_int) -> pid_t {
todo!()
}

View File

@ -0,0 +1,14 @@
language = "C"
style = "Tag"
sys_includes = ["stddef.h"]
no_includes = true
include_guard = "_TERMIOS_H"
usize_type = "size_t"
isize_type = "ssize_t"
[export]
include = ["termios", "speed_t", "tcflag_t", "cc_t"]
exclude = []

View File

@ -0,0 +1,106 @@
use core::ffi::{c_int, c_uchar, c_uint};
pub type cc_t = c_uchar;
pub type speed_t = c_uint;
pub type tcflag_t = c_uint;
// c_iflag
pub const IGNBRK: tcflag_t = 1 << 0;
pub const BRKINT: tcflag_t = 1 << 1;
pub const IGNPAR: tcflag_t = 1 << 2;
pub const PARMRK: tcflag_t = 1 << 3;
pub const INPCK: tcflag_t = 1 << 4;
pub const ISTRIP: tcflag_t = 1 << 5;
pub const INLCR: tcflag_t = 1 << 6;
pub const IGNCR: tcflag_t = 1 << 7;
pub const ICRNL: tcflag_t = 1 << 8;
pub const IXON: tcflag_t = 1 << 9;
pub const IXANY: tcflag_t = 1 << 10;
pub const IXOFF: tcflag_t = 1 << 11;
// c_oflag
pub const OPOST: tcflag_t = 1 << 0;
pub const ONLCR: tcflag_t = 1 << 1;
pub const OCRNL: tcflag_t = 1 << 2;
pub const ONOCR: tcflag_t = 1 << 3;
pub const ONLRET: tcflag_t = 1 << 4;
pub const OFILL: tcflag_t = 1 << 5;
pub const OFDEL: tcflag_t = 1 << 6;
// c_cflag
pub const CS5: tcflag_t = 0x0;
pub const CS6: tcflag_t = 0x1;
pub const CS7: tcflag_t = 0x2;
pub const CS8: tcflag_t = 0x3;
pub const CSIZE: tcflag_t = 0x3;
pub const CSTOPB: tcflag_t = 1 << 2;
pub const CREAD: tcflag_t = 1 << 3;
pub const PARENB: tcflag_t = 1 << 4;
pub const PARODD: tcflag_t = 1 << 5;
pub const HUPCL: tcflag_t = 1 << 6;
pub const CLOCAL: tcflag_t = 1 << 7;
// c_lflag
pub const ISIG: tcflag_t = 1 << 0;
pub const ICANON: tcflag_t = 1 << 1;
pub const ECHO: tcflag_t = 1 << 2;
pub const ECHOE: tcflag_t = 1 << 3;
pub const ECHOK: tcflag_t = 1 << 4;
pub const ECHONL: tcflag_t = 1 << 5;
pub const NOFLSH: tcflag_t = 1 << 6;
pub const TOSTOP: tcflag_t = 1 << 7;
pub const IEXTEN: tcflag_t = 1 << 8;
// c_cc
pub const VEOF: usize = 0;
pub const VEOL: usize = 1;
pub const VERASE: usize = 2;
pub const VINTR: usize = 3;
pub const VKILL: usize = 4;
pub const VQUIT: usize = 5;
pub const VREPRINT: usize = 6;
pub const VSTART: usize = 7;
pub const VSTOP: usize = 8;
pub const VSUSP: usize = 9;
pub const VWERASE: usize = 10;
pub const TCSANOW: c_int = 0;
pub const TCSADRAIN: c_int = 1;
pub const TCSAFLUSH: c_int = 2;
pub const TCOOFF: c_int = 1;
pub const TCOON: c_int = 2;
pub const TCIOFF: c_int = 3;
pub const TCION: c_int = 4;
pub const NCCS: usize = 16;
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
#[repr(C)]
pub struct termios {
pub c_iflag: tcflag_t,
pub c_oflag: tcflag_t,
pub c_cflag: tcflag_t,
pub c_lflag: tcflag_t,
pub c_cc: [cc_t; NCCS],
}
#[no_mangle]
unsafe extern "C" fn tcgetattr(_fd: c_int, _termios_p: *mut termios) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn tcsetattr(
_fd: c_int,
_optional_actions: c_int,
_termios_p: *const termios,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn cfmakeraw(_termios_p: *mut termios) {
todo!()
}

View File

@ -17,4 +17,4 @@ usize_type = "size_t"
isize_type = "ssize_t" isize_type = "ssize_t"
[export] [export]
include = ["tm", "itimerspec"] include = ["tm", "itimerspec", "__ygg_tm_t"]

View File

@ -34,6 +34,8 @@ pub struct tm {
pub tm_isdst: c_int, pub tm_isdst: c_int,
} }
pub type __ygg_tm_t = tm;
#[no_mangle] #[no_mangle]
pub static mut daylight: c_int = 0; pub static mut daylight: c_int = 0;
#[no_mangle] #[no_mangle]

View File

@ -0,0 +1,13 @@
language = "C"
style = "Type"
sys_includes = ["bits/ulimit.h"]
no_includes = true
include_guard = "_ULIMIT_H"
usize_type = "size_t"
isize_type = "ssize_t"
[export]
exclude = ["ulimit"]

View File

@ -0,0 +1,9 @@
use core::ffi::{c_int, c_long};
pub const UL_GETFSIZE: c_int = 1;
pub const UL_SETFSIZE: c_int = 2;
#[no_mangle]
unsafe extern "C" fn ulimit(_cmd: c_int, _args: ...) -> c_long {
todo!()
}

View File

@ -0,0 +1,10 @@
language = "C"
style = "Tag"
sys_includes = ["sys/types.h"]
no_includes = true
include_guard = "_UTIME_H"
usize_type = "size_t"
isize_type = "ssize_t"

View File

@ -0,0 +1,14 @@
use core::ffi::{c_char, c_int};
use super::sys_types::time_t;
#[repr(C)]
pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
#[no_mangle]
unsafe extern "C" fn utime(_path: *const c_char, _buf: *const utimbuf) -> c_int {
todo!()
}

View File

@ -0,0 +1,32 @@
language = "C"
style = "Type"
sys_includes = [
"stdio.h",
"locale.h",
"stddef.h",
"stdarg.h",
"stdint.h",
"string.h",
"stdlib.h",
"wctype.h",
"ctype.h",
"time.h"
]
no_includes = true
include_guard = "_WCHAR_H"
usize_type = "size_t"
isize_type = "ssize_t"
[export]
include = ["mbstate_t"]
exclude = [
"fwprintf",
"fwscanf",
"swprintf",
"swscanf",
"wprintf",
"wscanf"
]

View File

@ -0,0 +1,130 @@
use core::ffi::{c_int, VaList};
use crate::{io::managed::FILE, types::wchar_t};
use super::wint_t;
#[no_mangle]
unsafe extern "C" fn fgetwc(_fp: *mut FILE) -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn fgetws(_buf: *mut wchar_t, _n: c_int, _fp: *mut FILE) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn fputwc(_wc: wchar_t, _fp: *mut FILE) -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn fputws(_ws: *const wchar_t, _fp: *mut FILE) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn fwide(_fp: *mut FILE, _wide: c_int) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn fwprintf(_fp: *mut FILE, _fmt: *const wchar_t, _args: ...) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn fwscanf(_fp: *mut FILE, _fmt: *const wchar_t, _args: ...) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn getwc(_fp: *mut FILE) -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn getwchar() -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn open_wmemstream(_ptr: *mut *mut wchar_t, _sizeloc: *mut usize) -> *mut FILE {
todo!()
}
#[no_mangle]
unsafe extern "C" fn putwc(_wc: wchar_t, _fp: *mut FILE) -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn putwchar(_wc: wchar_t) -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn swprintf(
_buf: *mut wchar_t,
_len: usize,
_fmt: *const wchar_t,
_args: ...
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn swscanf(_buf: *const wchar_t, _fmt: *const wchar_t, _args: ...) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn ungetwc(_wc: wchar_t, _fp: *mut FILE) -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn vfwprintf(_fp: *mut FILE, _fmt: *const wchar_t, _args: VaList) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn vfwscanf(_fp: *mut FILE, _fmt: *const wchar_t, _args: VaList) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn vswprintf(
_buf: *mut wchar_t,
_len: usize,
_fmt: *const wchar_t,
_args: VaList,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn vswscanf(_buf: *const wchar_t, _fmt: *const wchar_t, _args: VaList) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn vwprintf(_fmt: *const wchar_t, _args: VaList) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn vwscanf(_fmt: *const wchar_t, _args: VaList) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wprintf(_fmt: *const wchar_t, _args: ...) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wscanf(_fmt: *const wchar_t, _args: ...) -> c_int {
todo!()
}

View File

@ -0,0 +1,9 @@
use core::ffi::c_void;
use super::wctype::wint_t;
pub mod io;
pub mod multibyte;
pub mod string;
pub type mbstate_t = c_void;

View File

@ -0,0 +1,72 @@
use core::ffi::{c_char, c_int};
use crate::types::wchar_t;
use super::mbstate_t;
#[no_mangle]
unsafe extern "C" fn mbrlen(_str: *const c_char, _n: usize, _state: *mut mbstate_t) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcrtomb(_dst: *mut c_char, _wc: wchar_t, _state: *mut mbstate_t) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn mbrtowc(
_dst: *mut wchar_t,
_src: *const c_char,
_n: usize,
_state: *mut mbstate_t,
) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn mbsinit(_state: *const mbstate_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn mbsnrtowcs(
_dst: *mut wchar_t,
_bufs: *const *const c_char,
_n: usize,
_len: usize,
_state: *mut mbstate_t,
) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn mbsrtowcs(
_dst: *mut wchar_t,
_bufs: *const *const c_char,
_n: usize,
_state: *mut mbstate_t,
) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsnrtombs(
_dst: *mut c_char,
_bufs: *const *const wchar_t,
_n: usize,
_len: usize,
_state: *mut mbstate_t,
) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsrtombs(
_dst: *mut c_char,
_bufs: *const *const wchar_t,
_n: usize,
_state: *mut mbstate_t,
) -> usize {
todo!()
}

View File

@ -0,0 +1,272 @@
use core::ffi::{c_double, c_float, c_int, c_long, c_longlong, c_ulong, c_ulonglong};
use crate::{
headers::{locale::locale_t, time::__ygg_tm_t},
types::wchar_t,
};
#[no_mangle]
unsafe extern "C" fn btowc(_b: c_int) -> wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wctob(_wc: wchar_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcpcpy(_dst: *mut wchar_t, _src: *const wchar_t) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcpncpy(
_dst: *mut wchar_t,
_src: *const wchar_t,
_len: usize,
) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcscasecmp(_s1: *const wchar_t, _s2: *const wchar_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcscasecmp_l(
_s1: *const wchar_t,
_s2: *const wchar_t,
_locale: locale_t,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcscat(_dst: *mut wchar_t, _src: *const wchar_t) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcschr(_str: *const wchar_t, _wc: wchar_t) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcscmp(_s1: *const wchar_t, _s2: *const wchar_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcscoll(_s1: *const wchar_t, _s2: *const wchar_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcscoll_l(
_s1: *const wchar_t,
_s2: *const wchar_t,
_locale: locale_t,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcscpy(_dst: *mut wchar_t, _src: *const wchar_t) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcscspn(_s1: *const wchar_t, _s2: *const wchar_t) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsdup(_src: *const wchar_t) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsftime(
_buf: *mut wchar_t,
_buflen: usize,
_fmt: *const wchar_t,
_tm: *const __ygg_tm_t,
) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcslen(_str: *const wchar_t) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsncasecmp(_s1: *const wchar_t, _s2: *const wchar_t, _n: usize) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsncasecmp_l(
_s1: *const wchar_t,
_s2: *const wchar_t,
_n: usize,
_locale: locale_t,
) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsncat(
_dst: *mut wchar_t,
_src: *const wchar_t,
_len: usize,
) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsncmp(_s1: *const wchar_t, _s2: *const wchar_t, _len: usize) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsncpy(_dst: *mut wchar_t, _src: *const wchar_t, _len: usize) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsnlen(_str: *const wchar_t, _len: usize) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcspbrk(_str: *const wchar_t, _brk: *const wchar_t) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsrchr(_str: *const wchar_t, _wc: wchar_t) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsspn(_str: *const wchar_t, _spn: *const wchar_t) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsstr(_s1: *const wchar_t, _s2: *const wchar_t) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcstod(_str: *const wchar_t, _endptr: *mut *mut wchar_t) -> c_double {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcstof(_str: *const wchar_t, _endptr: *mut *mut wchar_t) -> c_float {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcstok(
_s1: *const wchar_t,
_s2: *const wchar_t,
_out: *mut *mut wchar_t,
) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcstol(
_str: *const wchar_t,
_endptr: *mut *mut wchar_t,
_base: c_int,
) -> c_long {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcstold(_str: *const wchar_t, _endptr: *mut *mut wchar_t) -> c_double {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcstoll(
_str: *const wchar_t,
_endptr: *mut *mut wchar_t,
_base: c_int,
) -> c_longlong {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcstoul(
_str: *const wchar_t,
_endptr: *mut *mut wchar_t,
_base: c_int,
) -> c_ulong {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcstoull(
_str: *const wchar_t,
_endptr: *mut *mut wchar_t,
_base: c_int,
) -> c_ulonglong {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcswidth(_str: *const wchar_t, _n: usize) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsxfrm(_dst: *mut wchar_t, _src: *const wchar_t, _n: usize) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcsxfrm_l(
_dst: *mut wchar_t,
_src: *const wchar_t,
_n: usize,
_locale: locale_t,
) -> usize {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wcwidth(_wc: wchar_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wmemchr(_buf: *const wchar_t, _wc: wchar_t, _n: usize) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wmemcmp(_s1: *const wchar_t, _s2: *const wchar_t, _n: usize) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wmemcpy(_dst: *mut wchar_t, _src: *const wchar_t, _n: usize) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wmemmove(_dst: *mut wchar_t, _src: *const wchar_t, _n: usize) -> *mut wchar_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wmemset(_dst: *mut wchar_t, _wc: wchar_t, _n: usize) -> *mut wchar_t {
todo!()
}

View File

@ -0,0 +1,16 @@
language = "C"
style = "Type"
sys_includes = [
"locale.h",
"ctype.h",
]
no_includes = true
include_guard = "_WCTYPE_H"
usize_type = "size_t"
isize_type = "ssize_t"
[export]
include = ["wint_t", "wctype_t"]

View File

@ -0,0 +1,196 @@
use core::ffi::{c_char, c_int, c_uint};
use super::locale::locale_t;
pub type wint_t = c_uint;
pub type wctype_t = c_int;
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!()
}
#[no_mangle]
unsafe extern "C" fn iswalpha(_wc: wint_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswblank(_wc: wint_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswcntrl(_wc: wint_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswdigit(_wc: wint_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswgraph(_wc: wint_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswlower(_wc: wint_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswprint(_wc: wint_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswpunct(_wc: wint_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswspace(_wc: wint_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswupper(_wc: wint_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswxdigit(_wc: wint_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn towlower(_wc: wint_t) -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn towupper(_wc: wint_t) -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswctype(_wc: wint_t, _ctype: wctype_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wctype_t(_s: *const c_char) -> wctype_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn towctrans(_wc: wint_t, _trans: wctrans_t) -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wctrans(_s: *const c_char) -> wctrans_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wctype(_s: *const c_char) -> wctype_t {
todo!()
}
// Locale
#[no_mangle]
unsafe extern "C" fn iswalnum_l(_wc: wint_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswalpha_l(_wc: wint_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswblank_l(_wc: wint_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswcntrl_l(_wc: wint_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswdigit_l(_wc: wint_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswgraph_l(_wc: wint_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswlower_l(_wc: wint_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswprint_l(_wc: wint_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswpunct_l(_wc: wint_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswspace_l(_wc: wint_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswupper_l(_wc: wint_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswxdigit_l(_wc: wint_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn towlower_l(_wc: wint_t, _locale: locale_t) -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn towupper_l(_wc: wint_t, _locale: locale_t) -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn iswctype_l(_wc: wint_t, _ctype: wctype_t, _locale: locale_t) -> c_int {
todo!()
}
#[no_mangle]
unsafe extern "C" fn towctrans_l(_wc: wint_t, _trans: wctrans_t, _locale: locale_t) -> wint_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wctrans_l(_s: *const c_char, _locale: locale_t) -> wctrans_t {
todo!()
}
#[no_mangle]
unsafe extern "C" fn wctype_l(_s: *const c_char, _locale: locale_t) -> wctype_t {
todo!()
}