#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) \
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);
// 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;
// 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 {}
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;
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;
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;
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;
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;
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;
#[link_name = "_fdopen"]
fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
+
+ #[link_name = "_fileno"]
+ fn fileno(stream: *FILE) -> c_int;
}
#[nolink]
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]
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;