From 800a3a7a47ccff710cc902283aa3456c4108ce22 Mon Sep 17 00:00:00 2001 From: Jeremy Soller <jackpot51@gmail.com> Date: Sat, 3 Mar 2018 20:13:52 -0700 Subject: [PATCH] Merge stdio files --- stdio/cbindgen.toml | 2 +- stdio/lib.rs | 359 -------------------------------------------- stdio/src/lib.rs | 306 +++++++++++++++++++++++++++++++++++++ 3 files changed, 307 insertions(+), 360 deletions(-) delete mode 100644 stdio/lib.rs diff --git a/stdio/cbindgen.toml b/stdio/cbindgen.toml index e2c98aae..58483d52 100644 --- a/stdio/cbindgen.toml +++ b/stdio/cbindgen.toml @@ -1,4 +1,4 @@ -sys_includes = ["stdarg.h", "stddef.h"] +sys_includes = ["stdarg.h", "stddef.h", "stdint.h", "sys/types.h"] include_guard = "_STDIO_H" trailer = "#include <bits/stdio.h>" language = "C" diff --git a/stdio/lib.rs b/stdio/lib.rs deleted file mode 100644 index 6aab7760..00000000 --- a/stdio/lib.rs +++ /dev/null @@ -1,359 +0,0 @@ -#[no_mangle] -pub extern "C" fn clearerr(stream: *mut FILE) { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn ctermid(s: *mut libc::c_char) - -> *mut libc::c_char { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn cuserid(s: *mut libc::c_char) - -> *mut libc::c_char { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fclose(stream: *mut FILE) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fdopen(fildes: libc::c_int, - mode: *const libc::c_char) -> *mut FILE { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn feof(stream: *mut FILE) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn ferror(stream: *mut FILE) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fflush(stream: *mut FILE) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fgetc(stream: *mut FILE) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fgetpos(stream: *mut FILE, pos: *mut fpos_t) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fgets(s: *mut libc::c_char, - n: libc::c_int, stream: *mut FILE) - -> *mut libc::c_char { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fileno(stream: *mut FILE) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn flockfile(file: *mut FILE) { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fopen(filename: *const libc::c_char, - mode: *const libc::c_char) -> *mut FILE { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fprintf(stream: *mut FILE, format: *const libc::c_char, ...) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fputc(c: libc::c_int, stream: *mut FILE) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fputs(s: *const libc::c_char, stream: *mut FILE) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fread(ptr: *mut libc::c_void, size: usize, nitems: usize, - stream: *mut FILE) -> usize { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn freopen(filename: *const libc::c_char, - mode: *const libc::c_char, stream: *mut FILE) - -> *mut FILE { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fscanf(stream: *mut FILE, format: *const libc::c_char, ...) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fseek(stream: *mut FILE, offset: libc::c_long, - whence: libc::c_int) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fseeko(stream: *mut FILE, offset: off_t, whence: libc::c_int) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fsetpos(stream: *mut FILE, pos: *const fpos_t) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn ftell(stream: *mut FILE) -> libc::c_long { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn ftello(stream: *mut FILE) -> off_t { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn ftrylockfile(file: *mut FILE) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn funlockfile(file: *mut FILE) { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn fwrite(ptr: *const libc::c_void, size: usize, - nitems: usize, stream: *mut FILE) -> usize { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn getc(stream: *mut FILE) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn getchar() -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn getc_unlocked(stream: *mut FILE) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn getchar_unlocked() -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn getopt(argc: libc::c_int, - argv: *const *const libc::c_char, - optstring: libc::c_char) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn gets(s: *mut libc::c_char) - -> *mut libc::c_char { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn getw(stream: *mut FILE) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn pclose(stream: *mut FILE) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn perror(s: *const libc::c_char) { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn popen(command: *const libc::c_char, - mode: *const libc::c_char) -> *mut FILE { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn printf(format: *const libc::c_char, ...) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn putc(c: libc::c_int, stream: *mut FILE) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn putchar(c: libc::c_int) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn putc_unlocked(c: libc::c_int, stream: *mut FILE) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn putchar_unlocked(c: libc::c_int) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn puts(s: *const libc::c_char) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn putw(w: libc::c_int, stream: *mut FILE) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn remove(path: *const libc::c_char) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn rename(old: *const libc::c_char, - new: *const libc::c_char) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn rewind(stream: *mut FILE) { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn scanf(format: *const libc::c_char, ...) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn setbuf(stream: *mut FILE, buf: *mut libc::c_char) { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn setvbuf(stream: *mut FILE, buf: *mut libc::c_char, - _IOBUF: libc::c_int, BUFSIZ: usize) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn snprintf(arg1: *mut libc::c_char, arg2: usize, - arg3: *const libc::c_char, ...) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn sprintf(s: *mut libc::c_char, - format: *const libc::c_char, ...) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn sscanf(s: *const libc::c_char, - format: *const libc::c_char, ...) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn tempnam(dir: *const libc::c_char, - pfx: *const libc::c_char) - -> *mut libc::c_char { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn tmpfile() -> *mut FILE { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn tmpnam(s: *mut libc::c_char) - -> *mut libc::c_char { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn ungetc(c: libc::c_int, stream: *mut FILE) - -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn vfprintf(stream: *mut FILE, format: *const libc::c_char, - ap: libc::c_int) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn vprintf(format: *const libc::c_char, - ap: va_list) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn vsnprintf(s: *mut libc::c_char, n: usize, - format: *const libc::c_char, - ap: va_list) -> libc::c_int { - unimplemented!(); -} - -#[no_mangle] -pub extern "C" fn vsprintf(s: *mut libc::c_char, - format: *const libc::c_char, - ap: va_list) -> libc::c_int { - unimplemented!(); -} - diff --git a/stdio/src/lib.rs b/stdio/src/lib.rs index c8bdcbdd..eb20b343 100644 --- a/stdio/src/lib.rs +++ b/stdio/src/lib.rs @@ -14,6 +14,8 @@ pub const BUFSIZ: c_int = 4096; pub const FILENAME_MAX: c_int = 4096; +pub type fpos_t = off_t; + pub struct FILE; #[no_mangle] @@ -22,6 +24,294 @@ pub static mut stdout: *mut FILE = 1 as *mut FILE; #[no_mangle] pub static mut stderr: *mut FILE = 2 as *mut FILE; +#[no_mangle] +pub extern "C" fn clearerr(stream: *mut FILE) { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn ctermid(s: *mut c_char) + -> *mut c_char { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn cuserid(s: *mut c_char) + -> *mut c_char { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fclose(stream: *mut FILE) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fdopen(fildes: c_int, + mode: *const c_char) -> *mut FILE { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn feof(stream: *mut FILE) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn ferror(stream: *mut FILE) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fflush(stream: *mut FILE) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fgetc(stream: *mut FILE) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fgetpos(stream: *mut FILE, pos: *mut fpos_t) + -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fgets(s: *mut c_char, + n: c_int, stream: *mut FILE) + -> *mut c_char { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fileno(stream: *mut FILE) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn flockfile(file: *mut FILE) { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fopen(filename: *const c_char, + mode: *const c_char) -> *mut FILE { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fputc(c: c_int, stream: *mut FILE) + -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fputs(s: *const c_char, stream: *mut FILE) + -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fread(ptr: *mut c_void, size: usize, nitems: usize, + stream: *mut FILE) -> usize { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn freopen(filename: *const c_char, + mode: *const c_char, stream: *mut FILE) + -> *mut FILE { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fseek(stream: *mut FILE, offset: c_long, + whence: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fseeko(stream: *mut FILE, offset: off_t, whence: c_int) + -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fsetpos(stream: *mut FILE, pos: *const fpos_t) + -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn ftell(stream: *mut FILE) -> c_long { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn ftello(stream: *mut FILE) -> off_t { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn ftrylockfile(file: *mut FILE) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn funlockfile(file: *mut FILE) { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn fwrite(ptr: *const c_void, size: usize, + nitems: usize, stream: *mut FILE) -> usize { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn getc(stream: *mut FILE) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn getchar() -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn getc_unlocked(stream: *mut FILE) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn getchar_unlocked() -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn getopt(argc: c_int, + argv: *const *const c_char, + optstring: c_char) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn gets(s: *mut c_char) + -> *mut c_char { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn getw(stream: *mut FILE) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn pclose(stream: *mut FILE) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn perror(s: *const c_char) { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn popen(command: *const c_char, + mode: *const c_char) -> *mut FILE { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn putc(c: c_int, stream: *mut FILE) + -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn putchar(c: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn putc_unlocked(c: c_int, stream: *mut FILE) + -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn putchar_unlocked(c: c_int) + -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn puts(s: *const c_char) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn putw(w: c_int, stream: *mut FILE) + -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn remove(path: *const c_char) + -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn rename(old: *const c_char, + new: *const c_char) + -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn rewind(stream: *mut FILE) { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn setbuf(stream: *mut FILE, buf: *mut c_char) { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn setvbuf(stream: *mut FILE, buf: *mut c_char, + mode: c_int, size: usize) + -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn tempnam(dir: *const c_char, + pfx: *const c_char) + -> *mut c_char { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn tmpfile() -> *mut FILE { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn tmpnam(s: *mut c_char) + -> *mut c_char { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn ungetc(c: c_int, stream: *mut FILE) + -> c_int { + unimplemented!(); +} + #[no_mangle] pub unsafe extern "C" fn vfprintf(file: *mut FILE, format: *const c_char, ap: va_list) -> c_int { printf::printf(platform::FileWriter(file as c_int), format, ap) @@ -32,6 +322,22 @@ pub unsafe extern "C" fn vprintf(format: *const c_char, ap: va_list) -> c_int { vfprintf(stdout, format, ap) } +#[no_mangle] +pub extern "C" fn vsnprintf(s: *mut c_char, n: usize, + format: *const c_char, + ap: va_list) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn vsprintf(s: *mut c_char, + format: *const c_char, + ap: va_list) -> c_int { + unimplemented!(); +} + + + /* #[no_mangle] pub extern "C" fn func(args) -> c_int { -- GitLab