Add a couple more missing pieces to libc and os.
This commit is contained in:
parent
b7d3874349
commit
7f55e7d087
|
@ -26,6 +26,9 @@
|
|||
#define put_type(N,T) \
|
||||
printf(" type %s = %c%d;\n", N, S(T), B(T))
|
||||
|
||||
#define put_ftype(N,T) \
|
||||
printf(" type %s = f%d;\n", N, B(T))
|
||||
|
||||
#define CT(T) ((((T)-1)<0) ? "int" : "uint")
|
||||
#define CS(T) ((((T)-1)<0) ? "" : "_u")
|
||||
#define put_const(N,T) \
|
||||
|
@ -48,6 +51,9 @@ void c95_types() {
|
|||
put_type("c_long", long);
|
||||
put_type("c_ulong", unsigned long);
|
||||
|
||||
put_ftype("c_float", float);
|
||||
put_ftype("c_double", double);
|
||||
|
||||
put_type("size_t", size_t);
|
||||
put_type("ptrdiff_t", ptrdiff_t);
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ export types, funcs, consts;
|
|||
// you can write more-platform-agnostic code if you stick to just these
|
||||
// symbols.
|
||||
|
||||
export c_double, c_void, FILE, fpos_t;
|
||||
export c_float, c_double, c_void, FILE, fpos_t;
|
||||
export DIR, dirent;
|
||||
export c_char, c_schar, c_uchar;
|
||||
export c_short, c_ushort, c_int, c_uint, c_long, c_ulong;
|
||||
|
@ -123,7 +123,6 @@ mod types {
|
|||
// Standard types that are opaque or common, so are not per-target.
|
||||
mod common {
|
||||
mod c95 {
|
||||
type c_double = float;
|
||||
enum c_void {}
|
||||
enum FILE {}
|
||||
enum fpos_t {}
|
||||
|
@ -154,6 +153,8 @@ mod types {
|
|||
type c_uint = u32;
|
||||
type c_long = i32;
|
||||
type c_ulong = u32;
|
||||
type c_float = f32;
|
||||
type c_double = f64;
|
||||
type size_t = u32;
|
||||
type ptrdiff_t = i32;
|
||||
type clock_t = i32;
|
||||
|
@ -196,6 +197,8 @@ mod types {
|
|||
type c_uint = u32;
|
||||
type c_long = i64;
|
||||
type c_ulong = u64;
|
||||
type c_float = f32;
|
||||
type c_double = f64;
|
||||
type size_t = u64;
|
||||
type ptrdiff_t = i64;
|
||||
type clock_t = i64;
|
||||
|
@ -241,6 +244,8 @@ mod types {
|
|||
type c_uint = u32;
|
||||
type c_long = i64;
|
||||
type c_ulong = u64;
|
||||
type c_float = f32;
|
||||
type c_double = f64;
|
||||
type size_t = u64;
|
||||
type ptrdiff_t = i64;
|
||||
type clock_t = i32;
|
||||
|
@ -286,6 +291,8 @@ mod types {
|
|||
type c_uint = u32;
|
||||
type c_long = i32;
|
||||
type c_ulong = u32;
|
||||
type c_float = f32;
|
||||
type c_double = f64;
|
||||
type size_t = u32;
|
||||
type ptrdiff_t = i32;
|
||||
type clock_t = i32;
|
||||
|
@ -358,6 +365,8 @@ mod types {
|
|||
type c_uint = u32;
|
||||
type c_long = i32;
|
||||
type c_ulong = u32;
|
||||
type c_float = f32;
|
||||
type c_double = f64;
|
||||
type size_t = u32;
|
||||
type ptrdiff_t = i32;
|
||||
type clock_t = u32;
|
||||
|
@ -400,6 +409,8 @@ mod types {
|
|||
type c_uint = u32;
|
||||
type c_long = i64;
|
||||
type c_ulong = u64;
|
||||
type c_float = f32;
|
||||
type c_double = f64;
|
||||
type size_t = u64;
|
||||
type ptrdiff_t = i64;
|
||||
type clock_t = u64;
|
||||
|
@ -841,6 +852,9 @@ mod funcs {
|
|||
|
||||
#[link_name = "_fdopen"]
|
||||
fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
|
||||
|
||||
#[link_name = "_fileno"]
|
||||
fn fileno(stream: *FILE) -> c_int;
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
|
@ -942,6 +956,7 @@ mod funcs {
|
|||
fn popen(command: *c_char, mode: *c_char) -> *FILE;
|
||||
fn pclose(stream: *FILE) -> c_int;
|
||||
fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
|
||||
fn fileno(stream: *FILE) -> c_int;
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
|
|
|
@ -24,7 +24,7 @@ import option = option::t;
|
|||
import getcwd = rustrt::rust_getcwd;
|
||||
import consts::*;
|
||||
|
||||
export close, fclose;
|
||||
export close, fclose, fsync_fd;
|
||||
export env, getenv, setenv, fdopen, pipe;
|
||||
export getcwd, dll_filename, self_exe_path;
|
||||
export exe_suffix, dll_suffix, sysname;
|
||||
|
|
Loading…
Reference in New Issue