libcore: Remove extern mod { ... }
from libcore. rs=deexterning
This commit is contained in:
parent
88f0a10578
commit
fd271adc75
21 changed files with 822 additions and 624 deletions
|
@ -23,11 +23,18 @@ use vec;
|
|||
/// Code for dealing with @-vectors. This is pretty incomplete, and
|
||||
/// contains a bunch of duplication from the code for ~-vectors.
|
||||
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod rustrt {
|
||||
pub unsafe fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
|
||||
++v: **vec::raw::VecRepr,
|
||||
++n: libc::size_t);
|
||||
pub mod rustrt {
|
||||
use libc;
|
||||
use sys;
|
||||
use vec;
|
||||
|
||||
#[abi = "cdecl"]
|
||||
#[link_name = "rustrt"]
|
||||
pub extern {
|
||||
pub unsafe fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
|
||||
++v: **vec::raw::VecRepr,
|
||||
++n: libc::size_t);
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the number of elements the vector can hold without reallocating
|
||||
|
|
|
@ -8,10 +8,13 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[abi = "rust-intrinsic"]
|
||||
extern mod rusti {
|
||||
fn forget<T>(-x: T);
|
||||
fn reinterpret_cast<T, U>(&&e: T) -> U;
|
||||
pub mod rusti {
|
||||
#[abi = "rust-intrinsic"]
|
||||
#[link_name = "rusti"]
|
||||
pub extern {
|
||||
fn forget<T>(-x: T);
|
||||
fn reinterpret_cast<T, U>(&&e: T) -> U;
|
||||
}
|
||||
}
|
||||
|
||||
/// Casts the value at `src` to U. The two types must have the same length.
|
||||
|
|
|
@ -218,9 +218,14 @@ pub unsafe fn annihilate() {
|
|||
}
|
||||
|
||||
/// Bindings to the runtime
|
||||
extern mod rustrt {
|
||||
#[rust_stack]
|
||||
// FIXME (#4386): Unable to make following method private.
|
||||
pub unsafe fn rust_get_task() -> *c_void;
|
||||
pub mod rustrt {
|
||||
use libc::c_void;
|
||||
|
||||
#[link_name = "rustrt"]
|
||||
pub extern {
|
||||
#[rust_stack]
|
||||
// FIXME (#4386): Unable to make following method private.
|
||||
pub unsafe fn rust_get_task() -> *c_void;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,16 +21,23 @@ use vec;
|
|||
|
||||
#[cfg(test)] use rand;
|
||||
|
||||
extern mod rustrt {
|
||||
unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
|
||||
src_buf_len: size_t,
|
||||
pout_len: *size_t,
|
||||
flags: c_int) -> *c_void;
|
||||
pub mod rustrt {
|
||||
use libc::{c_int, c_void, size_t};
|
||||
|
||||
unsafe fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
|
||||
src_buf_len: size_t,
|
||||
pout_len: *size_t,
|
||||
flags: c_int) -> *c_void;
|
||||
#[link_name = "rustrt"]
|
||||
pub extern {
|
||||
unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
|
||||
src_buf_len: size_t,
|
||||
pout_len: *size_t,
|
||||
flags: c_int)
|
||||
-> *c_void;
|
||||
|
||||
unsafe fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
|
||||
src_buf_len: size_t,
|
||||
pout_len: *size_t,
|
||||
flags: c_int)
|
||||
-> *c_void;
|
||||
}
|
||||
}
|
||||
|
||||
const lz_none : c_int = 0x0; // Huffman-coding only.
|
||||
|
|
|
@ -48,23 +48,30 @@ use sys;
|
|||
pub use stackwalk::Word;
|
||||
|
||||
// Mirrors rust_stack.h stk_seg
|
||||
struct StackSegment {
|
||||
pub struct StackSegment {
|
||||
prev: *StackSegment,
|
||||
next: *StackSegment,
|
||||
end: uintptr_t,
|
||||
// And other fields which we don't care about...
|
||||
}
|
||||
|
||||
extern mod rustrt {
|
||||
#[rust_stack]
|
||||
pub unsafe fn rust_call_tydesc_glue(root: *Word,
|
||||
tydesc: *Word,
|
||||
field: size_t);
|
||||
pub mod rustrt {
|
||||
use libc::size_t;
|
||||
use stackwalk::Word;
|
||||
use super::StackSegment;
|
||||
|
||||
#[rust_stack]
|
||||
pub unsafe fn rust_gc_metadata() -> *Word;
|
||||
#[link_name = "rustrt"]
|
||||
pub extern {
|
||||
#[rust_stack]
|
||||
pub unsafe fn rust_call_tydesc_glue(root: *Word,
|
||||
tydesc: *Word,
|
||||
field: size_t);
|
||||
|
||||
pub unsafe fn rust_get_stack_segment() -> *StackSegment;
|
||||
#[rust_stack]
|
||||
pub unsafe fn rust_gc_metadata() -> *Word;
|
||||
|
||||
pub unsafe fn rust_get_stack_segment() -> *StackSegment;
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn bump<T, U>(ptr: *T, count: uint) -> *U {
|
||||
|
|
|
@ -32,11 +32,16 @@ use vec;
|
|||
#[allow(non_camel_case_types)] // not sure what to do about this
|
||||
pub type fd_t = c_int;
|
||||
|
||||
#[abi = "cdecl"]
|
||||
extern mod rustrt {
|
||||
unsafe fn rust_get_stdin() -> *libc::FILE;
|
||||
unsafe fn rust_get_stdout() -> *libc::FILE;
|
||||
unsafe fn rust_get_stderr() -> *libc::FILE;
|
||||
pub mod rustrt {
|
||||
use libc;
|
||||
|
||||
#[abi = "cdecl"]
|
||||
#[link_name = "rustrt"]
|
||||
pub extern {
|
||||
unsafe fn rust_get_stdin() -> *libc::FILE;
|
||||
unsafe fn rust_get_stdout() -> *libc::FILE;
|
||||
unsafe fn rust_get_stderr() -> *libc::FILE;
|
||||
}
|
||||
}
|
||||
|
||||
// Reading
|
||||
|
|
|
@ -1006,138 +1006,160 @@ pub mod funcs {
|
|||
// or anything. The same is not true of POSIX.
|
||||
|
||||
pub mod c95 {
|
||||
use libc::types::common::c95::{FILE, c_void, fpos_t};
|
||||
use libc::types::os::arch::c95::{c_char, c_double, c_int, c_long};
|
||||
use libc::types::os::arch::c95::{c_uint, c_ulong, c_void, size_t};
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod ctype {
|
||||
unsafe fn isalnum(c: c_int) -> c_int;
|
||||
unsafe fn isalpha(c: c_int) -> c_int;
|
||||
unsafe fn iscntrl(c: c_int) -> c_int;
|
||||
unsafe fn isdigit(c: c_int) -> c_int;
|
||||
unsafe fn isgraph(c: c_int) -> c_int;
|
||||
unsafe fn islower(c: c_int) -> c_int;
|
||||
unsafe fn isprint(c: c_int) -> c_int;
|
||||
unsafe fn ispunct(c: c_int) -> c_int;
|
||||
unsafe fn isspace(c: c_int) -> c_int;
|
||||
unsafe fn isupper(c: c_int) -> c_int;
|
||||
unsafe fn isxdigit(c: c_int) -> c_int;
|
||||
unsafe fn tolower(c: c_char) -> c_char;
|
||||
unsafe fn toupper(c: c_char) -> c_char;
|
||||
pub mod ctype {
|
||||
use libc::types::os::arch::c95::{c_char, c_int};
|
||||
|
||||
pub extern {
|
||||
unsafe fn isalnum(c: c_int) -> c_int;
|
||||
unsafe fn isalpha(c: c_int) -> c_int;
|
||||
unsafe fn iscntrl(c: c_int) -> c_int;
|
||||
unsafe fn isdigit(c: c_int) -> c_int;
|
||||
unsafe fn isgraph(c: c_int) -> c_int;
|
||||
unsafe fn islower(c: c_int) -> c_int;
|
||||
unsafe fn isprint(c: c_int) -> c_int;
|
||||
unsafe fn ispunct(c: c_int) -> c_int;
|
||||
unsafe fn isspace(c: c_int) -> c_int;
|
||||
unsafe fn isupper(c: c_int) -> c_int;
|
||||
unsafe fn isxdigit(c: c_int) -> c_int;
|
||||
unsafe fn tolower(c: c_char) -> c_char;
|
||||
unsafe fn toupper(c: c_char) -> c_char;
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod stdio {
|
||||
unsafe fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
|
||||
unsafe fn freopen(filename: *c_char, mode: *c_char,
|
||||
file: *FILE) -> *FILE;
|
||||
unsafe fn fflush(file: *FILE) -> c_int;
|
||||
unsafe fn fclose(file: *FILE) -> c_int;
|
||||
unsafe fn remove(filename: *c_char) -> c_int;
|
||||
unsafe fn rename(oldname: *c_char, newname: *c_char) -> c_int;
|
||||
unsafe fn tmpfile() -> *FILE;
|
||||
unsafe fn setvbuf(stream: *FILE, buffer: *c_char,
|
||||
mode: c_int, size: size_t) -> c_int;
|
||||
unsafe fn setbuf(stream: *FILE, buf: *c_char);
|
||||
// Omitted: printf and scanf variants.
|
||||
unsafe fn fgetc(stream: *FILE) -> c_int;
|
||||
unsafe fn fgets(buf: *mut c_char, n: c_int,
|
||||
stream: *FILE) -> *c_char;
|
||||
unsafe fn fputc(c: c_int, stream: *FILE) -> c_int;
|
||||
unsafe fn fputs(s: *c_char, stream: *FILE) -> *c_char;
|
||||
// Omitted: getc, getchar (might be macros).
|
||||
pub mod stdio {
|
||||
use libc::types::common::c95::{FILE, c_void, fpos_t};
|
||||
use libc::types::os::arch::c95::{c_char, c_int, c_long, size_t};
|
||||
|
||||
// Omitted: gets, so ridiculously unsafe that it should not
|
||||
// survive.
|
||||
pub extern {
|
||||
unsafe fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
|
||||
unsafe fn freopen(filename: *c_char, mode: *c_char,
|
||||
file: *FILE) -> *FILE;
|
||||
unsafe fn fflush(file: *FILE) -> c_int;
|
||||
unsafe fn fclose(file: *FILE) -> c_int;
|
||||
unsafe fn remove(filename: *c_char) -> c_int;
|
||||
unsafe fn rename(oldname: *c_char, newname: *c_char) -> c_int;
|
||||
unsafe fn tmpfile() -> *FILE;
|
||||
unsafe fn setvbuf(stream: *FILE, buffer: *c_char,
|
||||
mode: c_int, size: size_t) -> c_int;
|
||||
unsafe fn setbuf(stream: *FILE, buf: *c_char);
|
||||
// Omitted: printf and scanf variants.
|
||||
unsafe fn fgetc(stream: *FILE) -> c_int;
|
||||
unsafe fn fgets(buf: *mut c_char, n: c_int,
|
||||
stream: *FILE) -> *c_char;
|
||||
unsafe fn fputc(c: c_int, stream: *FILE) -> c_int;
|
||||
unsafe fn fputs(s: *c_char, stream: *FILE) -> *c_char;
|
||||
// Omitted: getc, getchar (might be macros).
|
||||
|
||||
// Omitted: putc, putchar (might be macros).
|
||||
unsafe fn puts(s: *c_char) -> c_int;
|
||||
unsafe fn ungetc(c: c_int, stream: *FILE) -> c_int;
|
||||
unsafe fn fread(ptr: *mut c_void, size: size_t,
|
||||
nobj: size_t, stream: *FILE) -> size_t;
|
||||
unsafe fn fwrite(ptr: *c_void, size: size_t,
|
||||
nobj: size_t, stream: *FILE) -> size_t;
|
||||
unsafe fn fseek(stream: *FILE, offset: c_long,
|
||||
whence: c_int) -> c_int;
|
||||
unsafe fn ftell(stream: *FILE) -> c_long;
|
||||
unsafe fn rewind(stream: *FILE);
|
||||
unsafe fn fgetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
|
||||
unsafe fn fsetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
|
||||
unsafe fn feof(stream: *FILE) -> c_int;
|
||||
unsafe fn ferror(stream: *FILE) -> c_int;
|
||||
unsafe fn perror(s: *c_char);
|
||||
}
|
||||
// Omitted: gets, so ridiculously unsafe that it should not
|
||||
// survive.
|
||||
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod stdlib {
|
||||
unsafe fn abs(i: c_int) -> c_int;
|
||||
unsafe fn labs(i: c_long) -> c_long;
|
||||
// Omitted: div, ldiv (return pub type incomplete).
|
||||
unsafe fn atof(s: *c_char) -> c_double;
|
||||
unsafe fn atoi(s: *c_char) -> c_int;
|
||||
unsafe fn strtod(s: *c_char, endp: **c_char) -> c_double;
|
||||
unsafe fn strtol(s: *c_char, endp: **c_char, base: c_int)
|
||||
-> c_long;
|
||||
unsafe fn strtoul(s: *c_char, endp: **c_char, base: c_int)
|
||||
-> c_ulong;
|
||||
unsafe fn calloc(nobj: size_t, size: size_t) -> *c_void;
|
||||
unsafe fn malloc(size: size_t) -> *c_void;
|
||||
unsafe fn realloc(p: *c_void, size: size_t) -> *c_void;
|
||||
unsafe fn free(p: *c_void);
|
||||
unsafe fn abort() -> !;
|
||||
unsafe fn exit(status: c_int) -> !;
|
||||
// Omitted: atexit.
|
||||
unsafe fn system(s: *c_char) -> c_int;
|
||||
unsafe fn getenv(s: *c_char) -> *c_char;
|
||||
// Omitted: bsearch, qsort
|
||||
unsafe fn rand() -> c_int;
|
||||
unsafe fn srand(seed: c_uint);
|
||||
// Omitted: putc, putchar (might be macros).
|
||||
unsafe fn puts(s: *c_char) -> c_int;
|
||||
unsafe fn ungetc(c: c_int, stream: *FILE) -> c_int;
|
||||
unsafe fn fread(ptr: *mut c_void, size: size_t,
|
||||
nobj: size_t, stream: *FILE) -> size_t;
|
||||
unsafe fn fwrite(ptr: *c_void, size: size_t,
|
||||
nobj: size_t, stream: *FILE) -> size_t;
|
||||
unsafe fn fseek(stream: *FILE, offset: c_long,
|
||||
whence: c_int) -> c_int;
|
||||
unsafe fn ftell(stream: *FILE) -> c_long;
|
||||
unsafe fn rewind(stream: *FILE);
|
||||
unsafe fn fgetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
|
||||
unsafe fn fsetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
|
||||
unsafe fn feof(stream: *FILE) -> c_int;
|
||||
unsafe fn ferror(stream: *FILE) -> c_int;
|
||||
unsafe fn perror(s: *c_char);
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod string {
|
||||
unsafe fn strcpy(dst: *c_char, src: *c_char) -> *c_char;
|
||||
unsafe fn strncpy(dst: *c_char, src: *c_char, n: size_t)
|
||||
-> *c_char;
|
||||
unsafe fn strcat(s: *c_char, ct: *c_char) -> *c_char;
|
||||
unsafe fn strncat(s: *c_char, ct: *c_char, n: size_t) -> *c_char;
|
||||
unsafe fn strcmp(cs: *c_char, ct: *c_char) -> c_int;
|
||||
unsafe fn strncmp(cs: *c_char, ct: *c_char, n: size_t) -> c_int;
|
||||
unsafe fn strcoll(cs: *c_char, ct: *c_char) -> c_int;
|
||||
unsafe fn strchr(cs: *c_char, c: c_int) -> *c_char;
|
||||
unsafe fn strrchr(cs: *c_char, c: c_int) -> *c_char;
|
||||
unsafe fn strspn(cs: *c_char, ct: *c_char) -> size_t;
|
||||
unsafe fn strcspn(cs: *c_char, ct: *c_char) -> size_t;
|
||||
unsafe fn strpbrk(cs: *c_char, ct: *c_char) -> *c_char;
|
||||
unsafe fn strstr(cs: *c_char, ct: *c_char) -> *c_char;
|
||||
unsafe fn strlen(cs: *c_char) -> size_t;
|
||||
unsafe fn strerror(n: c_int) -> *c_char;
|
||||
unsafe fn strtok(s: *c_char, t: *c_char) -> *c_char;
|
||||
unsafe fn strxfrm(s: *c_char, ct: *c_char, n: size_t) -> size_t;
|
||||
pub mod stdlib {
|
||||
use libc::types::common::c95::c_void;
|
||||
use libc::types::os::arch::c95::{c_char, c_double, c_int};
|
||||
use libc::types::os::arch::c95::{c_long, c_uint, c_ulong};
|
||||
use libc::types::os::arch::c95::{size_t};
|
||||
|
||||
// These are fine to execute on the Rust stack. They must be, in
|
||||
// fact, because LLVM generates calls to them!
|
||||
#[rust_stack]
|
||||
#[inline(always)]
|
||||
unsafe fn memcpy(s: *c_void, ct: *c_void, n: size_t) -> *c_void;
|
||||
#[rust_stack]
|
||||
#[inline(always)]
|
||||
unsafe fn memmove(s: *c_void, ct: *c_void, n: size_t) -> *c_void;
|
||||
#[rust_stack]
|
||||
#[inline(always)]
|
||||
unsafe fn memcmp(cx: *c_void, ct: *c_void, n: size_t) -> c_int;
|
||||
#[rust_stack]
|
||||
#[inline(always)]
|
||||
unsafe fn memchr(cx: *c_void, c: c_int, n: size_t) -> *c_void;
|
||||
#[rust_stack]
|
||||
#[inline(always)]
|
||||
unsafe fn memset(s: *c_void, c: c_int, n: size_t) -> *c_void;
|
||||
pub extern {
|
||||
unsafe fn abs(i: c_int) -> c_int;
|
||||
unsafe fn labs(i: c_long) -> c_long;
|
||||
// Omitted: div, ldiv (return pub type incomplete).
|
||||
unsafe fn atof(s: *c_char) -> c_double;
|
||||
unsafe fn atoi(s: *c_char) -> c_int;
|
||||
unsafe fn strtod(s: *c_char, endp: **c_char) -> c_double;
|
||||
unsafe fn strtol(s: *c_char, endp: **c_char, base: c_int)
|
||||
-> c_long;
|
||||
unsafe fn strtoul(s: *c_char, endp: **c_char, base: c_int)
|
||||
-> c_ulong;
|
||||
unsafe fn calloc(nobj: size_t, size: size_t) -> *c_void;
|
||||
unsafe fn malloc(size: size_t) -> *c_void;
|
||||
unsafe fn realloc(p: *c_void, size: size_t) -> *c_void;
|
||||
unsafe fn free(p: *c_void);
|
||||
unsafe fn abort() -> !;
|
||||
unsafe fn exit(status: c_int) -> !;
|
||||
// Omitted: atexit.
|
||||
unsafe fn system(s: *c_char) -> c_int;
|
||||
unsafe fn getenv(s: *c_char) -> *c_char;
|
||||
// Omitted: bsearch, qsort
|
||||
unsafe fn rand() -> c_int;
|
||||
unsafe fn srand(seed: c_uint);
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub mod string {
|
||||
use libc::types::common::c95::c_void;
|
||||
use libc::types::os::arch::c95::{c_char, c_int, size_t};
|
||||
|
||||
pub extern {
|
||||
unsafe fn strcpy(dst: *c_char, src: *c_char) -> *c_char;
|
||||
unsafe fn strncpy(dst: *c_char, src: *c_char, n: size_t)
|
||||
-> *c_char;
|
||||
unsafe fn strcat(s: *c_char, ct: *c_char) -> *c_char;
|
||||
unsafe fn strncat(s: *c_char, ct: *c_char, n: size_t)
|
||||
-> *c_char;
|
||||
unsafe fn strcmp(cs: *c_char, ct: *c_char) -> c_int;
|
||||
unsafe fn strncmp(cs: *c_char, ct: *c_char, n: size_t)
|
||||
-> c_int;
|
||||
unsafe fn strcoll(cs: *c_char, ct: *c_char) -> c_int;
|
||||
unsafe fn strchr(cs: *c_char, c: c_int) -> *c_char;
|
||||
unsafe fn strrchr(cs: *c_char, c: c_int) -> *c_char;
|
||||
unsafe fn strspn(cs: *c_char, ct: *c_char) -> size_t;
|
||||
unsafe fn strcspn(cs: *c_char, ct: *c_char) -> size_t;
|
||||
unsafe fn strpbrk(cs: *c_char, ct: *c_char) -> *c_char;
|
||||
unsafe fn strstr(cs: *c_char, ct: *c_char) -> *c_char;
|
||||
unsafe fn strlen(cs: *c_char) -> size_t;
|
||||
unsafe fn strerror(n: c_int) -> *c_char;
|
||||
unsafe fn strtok(s: *c_char, t: *c_char) -> *c_char;
|
||||
unsafe fn strxfrm(s: *c_char, ct: *c_char, n: size_t)
|
||||
-> size_t;
|
||||
|
||||
// These are fine to execute on the Rust stack. They must be, in
|
||||
// fact, because LLVM generates calls to them!
|
||||
#[rust_stack]
|
||||
#[inline(always)]
|
||||
unsafe fn memcpy(s: *c_void, ct: *c_void, n: size_t)
|
||||
-> *c_void;
|
||||
#[rust_stack]
|
||||
#[inline(always)]
|
||||
unsafe fn memmove(s: *c_void, ct: *c_void, n: size_t)
|
||||
-> *c_void;
|
||||
#[rust_stack]
|
||||
#[inline(always)]
|
||||
unsafe fn memcmp(cx: *c_void, ct: *c_void, n: size_t)
|
||||
-> c_int;
|
||||
#[rust_stack]
|
||||
#[inline(always)]
|
||||
unsafe fn memchr(cx: *c_void, c: c_int, n: size_t) -> *c_void;
|
||||
#[rust_stack]
|
||||
#[inline(always)]
|
||||
unsafe fn memset(s: *c_void, c: c_int, n: size_t) -> *c_void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1151,127 +1173,136 @@ pub mod funcs {
|
|||
pub mod posix88 {
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod stat_ {
|
||||
pub mod stat_ {
|
||||
use libc::types::os::common::posix01::stat;
|
||||
use libc::types::os::arch::c95::{c_int, c_char};
|
||||
|
||||
#[link_name = "_chmod"]
|
||||
unsafe fn chmod(path: *c_char, mode: c_int) -> c_int;
|
||||
pub extern {
|
||||
#[link_name = "_chmod"]
|
||||
unsafe fn chmod(path: *c_char, mode: c_int) -> c_int;
|
||||
|
||||
#[link_name = "_mkdir"]
|
||||
unsafe fn mkdir(path: *c_char) -> c_int;
|
||||
#[link_name = "_mkdir"]
|
||||
unsafe fn mkdir(path: *c_char) -> c_int;
|
||||
|
||||
#[link_name = "_fstat64"]
|
||||
unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
#[link_name = "_fstat64"]
|
||||
unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
|
||||
#[link_name = "_stat64"]
|
||||
unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
#[link_name = "_stat64"]
|
||||
unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod stdio {
|
||||
pub mod stdio {
|
||||
use libc::types::common::c95::FILE;
|
||||
use libc::types::os::arch::c95::{c_int, c_char};
|
||||
|
||||
#[link_name = "_popen"]
|
||||
unsafe fn popen(command: *c_char, mode: *c_char) -> *FILE;
|
||||
pub extern {
|
||||
#[link_name = "_popen"]
|
||||
unsafe fn popen(command: *c_char, mode: *c_char) -> *FILE;
|
||||
|
||||
#[link_name = "_pclose"]
|
||||
unsafe fn pclose(stream: *FILE) -> c_int;
|
||||
#[link_name = "_pclose"]
|
||||
unsafe fn pclose(stream: *FILE) -> c_int;
|
||||
|
||||
#[link_name = "_fdopen"]
|
||||
unsafe fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
|
||||
#[link_name = "_fdopen"]
|
||||
unsafe fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
|
||||
|
||||
#[link_name = "_fileno"]
|
||||
unsafe fn fileno(stream: *FILE) -> c_int;
|
||||
#[link_name = "_fileno"]
|
||||
unsafe fn fileno(stream: *FILE) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod fcntl {
|
||||
use libc::types::os::arch::c95::{c_int, c_char};
|
||||
pub mod fcntl {
|
||||
pub extern {
|
||||
use libc::types::os::arch::c95::{c_int, c_char};
|
||||
|
||||
#[link_name = "_open"]
|
||||
unsafe fn open(path: *c_char, oflag: c_int, mode: c_int) -> c_int;
|
||||
#[link_name = "_open"]
|
||||
unsafe fn open(path: *c_char, oflag: c_int, mode: c_int)
|
||||
-> c_int;
|
||||
|
||||
#[link_name = "_creat"]
|
||||
unsafe fn creat(path: *c_char, mode: c_int) -> c_int;
|
||||
#[link_name = "_creat"]
|
||||
unsafe fn creat(path: *c_char, mode: c_int) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod dirent {
|
||||
pub mod dirent {
|
||||
// Not supplied at all.
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod unistd {
|
||||
pub mod unistd {
|
||||
use libc::types::common::c95::c_void;
|
||||
use libc::types::os::arch::c95::{c_int, c_uint, c_char,
|
||||
c_long, size_t};
|
||||
use libc::types::os::arch::c99::intptr_t;
|
||||
|
||||
#[link_name = "_access"]
|
||||
unsafe fn access(path: *c_char, amode: c_int) -> c_int;
|
||||
pub extern {
|
||||
#[link_name = "_access"]
|
||||
unsafe fn access(path: *c_char, amode: c_int) -> c_int;
|
||||
|
||||
#[link_name = "_chdir"]
|
||||
unsafe fn chdir(dir: *c_char) -> c_int;
|
||||
#[link_name = "_chdir"]
|
||||
unsafe fn chdir(dir: *c_char) -> c_int;
|
||||
|
||||
#[link_name = "_close"]
|
||||
unsafe fn close(fd: c_int) -> c_int;
|
||||
#[link_name = "_close"]
|
||||
unsafe fn close(fd: c_int) -> c_int;
|
||||
|
||||
#[link_name = "_dup"]
|
||||
unsafe fn dup(fd: c_int) -> c_int;
|
||||
#[link_name = "_dup"]
|
||||
unsafe fn dup(fd: c_int) -> c_int;
|
||||
|
||||
#[link_name = "_dup2"]
|
||||
unsafe fn dup2(src: c_int, dst: c_int) -> c_int;
|
||||
#[link_name = "_dup2"]
|
||||
unsafe fn dup2(src: c_int, dst: c_int) -> c_int;
|
||||
|
||||
#[link_name = "_execv"]
|
||||
unsafe fn execv(prog: *c_char, argv: **c_char) -> intptr_t;
|
||||
#[link_name = "_execv"]
|
||||
unsafe fn execv(prog: *c_char, argv: **c_char) -> intptr_t;
|
||||
|
||||
#[link_name = "_execve"]
|
||||
unsafe fn execve(prog: *c_char, argv: **c_char,
|
||||
envp: **c_char) -> c_int;
|
||||
#[link_name = "_execve"]
|
||||
unsafe fn execve(prog: *c_char, argv: **c_char,
|
||||
envp: **c_char) -> c_int;
|
||||
|
||||
#[link_name = "_execvp"]
|
||||
unsafe fn execvp(c: *c_char, argv: **c_char) -> c_int;
|
||||
#[link_name = "_execvp"]
|
||||
unsafe fn execvp(c: *c_char, argv: **c_char) -> c_int;
|
||||
|
||||
#[link_name = "_execvpe"]
|
||||
unsafe fn execvpe(c: *c_char, argv: **c_char,
|
||||
envp: **c_char) -> c_int;
|
||||
#[link_name = "_execvpe"]
|
||||
unsafe fn execvpe(c: *c_char, argv: **c_char,
|
||||
envp: **c_char) -> c_int;
|
||||
|
||||
#[link_name = "_getcwd"]
|
||||
unsafe fn getcwd(buf: *c_char, size: size_t) -> *c_char;
|
||||
#[link_name = "_getcwd"]
|
||||
unsafe fn getcwd(buf: *c_char, size: size_t) -> *c_char;
|
||||
|
||||
#[link_name = "_getpid"]
|
||||
unsafe fn getpid() -> c_int;
|
||||
#[link_name = "_getpid"]
|
||||
unsafe fn getpid() -> c_int;
|
||||
|
||||
#[link_name = "_isatty"]
|
||||
unsafe fn isatty(fd: c_int) -> c_int;
|
||||
#[link_name = "_isatty"]
|
||||
unsafe fn isatty(fd: c_int) -> c_int;
|
||||
|
||||
#[link_name = "_lseek"]
|
||||
unsafe fn lseek(fd: c_int, offset: c_long, origin: c_int)
|
||||
-> c_long;
|
||||
#[link_name = "_lseek"]
|
||||
unsafe fn lseek(fd: c_int, offset: c_long, origin: c_int)
|
||||
-> c_long;
|
||||
|
||||
#[link_name = "_pipe"]
|
||||
unsafe fn pipe(fds: *mut c_int, psize: c_uint,
|
||||
textmode: c_int) -> c_int;
|
||||
#[link_name = "_pipe"]
|
||||
unsafe fn pipe(fds: *mut c_int, psize: c_uint,
|
||||
textmode: c_int) -> c_int;
|
||||
|
||||
#[link_name = "_read"]
|
||||
unsafe fn read(fd: c_int, buf: *mut c_void, count: c_uint)
|
||||
-> c_int;
|
||||
#[link_name = "_read"]
|
||||
unsafe fn read(fd: c_int, buf: *mut c_void, count: c_uint)
|
||||
-> c_int;
|
||||
|
||||
#[link_name = "_rmdir"]
|
||||
unsafe fn rmdir(path: *c_char) -> c_int;
|
||||
#[link_name = "_rmdir"]
|
||||
unsafe fn rmdir(path: *c_char) -> c_int;
|
||||
|
||||
#[link_name = "_unlink"]
|
||||
unsafe fn unlink(c: *c_char) -> c_int;
|
||||
|
||||
#[link_name = "_write"]
|
||||
unsafe fn write(fd: c_int, buf: *c_void, count: c_uint) -> c_int;
|
||||
#[link_name = "_unlink"]
|
||||
unsafe fn unlink(c: *c_char) -> c_int;
|
||||
|
||||
#[link_name = "_write"]
|
||||
unsafe fn write(fd: c_int, buf: *c_void, count: c_uint)
|
||||
-> c_int;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1281,119 +1312,145 @@ pub mod funcs {
|
|||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
pub mod posix88 {
|
||||
use libc::types::common::c95::{FILE, c_void};
|
||||
use libc::types::common::posix88::{DIR, dirent_t};
|
||||
use libc::types::os::arch::c95::{c_char, c_int, c_long, c_uint};
|
||||
use libc::types::os::arch::c95::{size_t};
|
||||
use libc::types::os::arch::posix01::stat;
|
||||
use libc::types::os::arch::posix88::{gid_t, mode_t, off_t, pid_t};
|
||||
use libc::types::os::arch::posix88::{ssize_t, uid_t};
|
||||
pub mod stat_ {
|
||||
use libc::types::os::arch::c95::{c_char, c_int};
|
||||
use libc::types::os::arch::posix01::stat;
|
||||
use libc::types::os::arch::posix88::mode_t;
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod stat_ {
|
||||
unsafe fn chmod(path: *c_char, mode: mode_t) -> c_int;
|
||||
unsafe fn fchmod(fd: c_int, mode: mode_t) -> c_int;
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern {
|
||||
unsafe fn chmod(path: *c_char, mode: mode_t) -> c_int;
|
||||
unsafe fn fchmod(fd: c_int, mode: mode_t) -> c_int;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(target_os = "android")]
|
||||
unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(target_os = "android")]
|
||||
unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link_name = "fstat64"]
|
||||
unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link_name = "fstat64"]
|
||||
unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
|
||||
unsafe fn mkdir(path: *c_char, mode: mode_t) -> c_int;
|
||||
unsafe fn mkfifo(path: *c_char, mode: mode_t) -> c_int;
|
||||
unsafe fn mkdir(path: *c_char, mode: mode_t) -> c_int;
|
||||
unsafe fn mkfifo(path: *c_char, mode: mode_t) -> c_int;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(target_os = "android")]
|
||||
unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(target_os = "android")]
|
||||
unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link_name = "stat64"]
|
||||
unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link_name = "stat64"]
|
||||
unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod stdio {
|
||||
unsafe fn popen(command: *c_char, mode: *c_char) -> *FILE;
|
||||
unsafe fn pclose(stream: *FILE) -> c_int;
|
||||
unsafe fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
|
||||
unsafe fn fileno(stream: *FILE) -> c_int;
|
||||
pub mod stdio {
|
||||
use libc::types::common::c95::FILE;
|
||||
use libc::types::os::arch::c95::{c_char, c_int};
|
||||
|
||||
pub extern {
|
||||
unsafe fn popen(command: *c_char, mode: *c_char) -> *FILE;
|
||||
unsafe fn pclose(stream: *FILE) -> c_int;
|
||||
unsafe fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
|
||||
unsafe fn fileno(stream: *FILE) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod fcntl {
|
||||
unsafe fn open(path: *c_char, oflag: c_int, mode: c_int) -> c_int;
|
||||
unsafe fn creat(path: *c_char, mode: mode_t) -> c_int;
|
||||
unsafe fn fcntl(fd: c_int, cmd: c_int) -> c_int;
|
||||
pub mod fcntl {
|
||||
use libc::types::os::arch::c95::{c_char, c_int};
|
||||
use libc::types::os::arch::posix88::mode_t;
|
||||
|
||||
pub extern {
|
||||
unsafe fn open(path: *c_char, oflag: c_int, mode: c_int)
|
||||
-> c_int;
|
||||
unsafe fn creat(path: *c_char, mode: mode_t) -> c_int;
|
||||
unsafe fn fcntl(fd: c_int, cmd: c_int) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod dirent {
|
||||
unsafe fn opendir(dirname: *c_char) -> *DIR;
|
||||
unsafe fn closedir(dirp: *DIR) -> c_int;
|
||||
unsafe fn readdir(dirp: *DIR) -> *dirent_t;
|
||||
unsafe fn rewinddir(dirp: *DIR);
|
||||
unsafe fn seekdir(dirp: *DIR, loc: c_long);
|
||||
unsafe fn telldir(dirp: *DIR) -> c_long;
|
||||
pub mod dirent {
|
||||
use libc::types::common::posix88::{DIR, dirent_t};
|
||||
use libc::types::os::arch::c95::{c_char, c_int, c_long};
|
||||
|
||||
pub extern {
|
||||
unsafe fn opendir(dirname: *c_char) -> *DIR;
|
||||
unsafe fn closedir(dirp: *DIR) -> c_int;
|
||||
unsafe fn readdir(dirp: *DIR) -> *dirent_t;
|
||||
unsafe fn rewinddir(dirp: *DIR);
|
||||
unsafe fn seekdir(dirp: *DIR, loc: c_long);
|
||||
unsafe fn telldir(dirp: *DIR) -> c_long;
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod unistd {
|
||||
unsafe fn access(path: *c_char, amode: c_int) -> c_int;
|
||||
unsafe fn alarm(seconds: c_uint) -> c_uint;
|
||||
unsafe fn chdir(dir: *c_char) -> c_int;
|
||||
unsafe fn chown(path: *c_char, uid: uid_t, gid: gid_t) -> c_int;
|
||||
unsafe fn close(fd: c_int) -> c_int;
|
||||
unsafe fn dup(fd: c_int) -> c_int;
|
||||
unsafe fn dup2(src: c_int, dst: c_int) -> c_int;
|
||||
unsafe fn execv(prog: *c_char, argv: **c_char) -> c_int;
|
||||
unsafe fn execve(prog: *c_char, argv: **c_char, envp: **c_char)
|
||||
-> c_int;
|
||||
unsafe fn execvp(c: *c_char, argv: **c_char) -> c_int;
|
||||
unsafe fn fork() -> pid_t;
|
||||
unsafe fn fpathconf(filedes: c_int, name: c_int) -> c_long;
|
||||
unsafe fn getcwd(buf: *c_char, size: size_t) -> *c_char;
|
||||
unsafe fn getegid() -> gid_t;
|
||||
unsafe fn geteuid() -> uid_t;
|
||||
unsafe fn getgid() -> gid_t ;
|
||||
unsafe fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
|
||||
pub mod unistd {
|
||||
use libc::types::common::c95::c_void;
|
||||
use libc::types::os::arch::c95::{c_char, c_int, c_long, c_uint};
|
||||
use libc::types::os::arch::c95::{size_t};
|
||||
use libc::types::os::arch::posix88::{gid_t, off_t, pid_t};
|
||||
use libc::types::os::arch::posix88::{ssize_t, uid_t};
|
||||
|
||||
pub extern {
|
||||
unsafe fn access(path: *c_char, amode: c_int) -> c_int;
|
||||
unsafe fn alarm(seconds: c_uint) -> c_uint;
|
||||
unsafe fn chdir(dir: *c_char) -> c_int;
|
||||
unsafe fn chown(path: *c_char, uid: uid_t, gid: gid_t)
|
||||
-> c_int;
|
||||
unsafe fn getlogin() -> *c_char;
|
||||
unsafe fn getopt(argc: c_int, argv: **c_char, optstr: *c_char)
|
||||
-> c_int;
|
||||
unsafe fn getpgrp() -> pid_t;
|
||||
unsafe fn getpid() -> pid_t;
|
||||
unsafe fn getppid() -> pid_t;
|
||||
unsafe fn getuid() -> uid_t;
|
||||
unsafe fn isatty(fd: c_int) -> c_int;
|
||||
unsafe fn link(src: *c_char, dst: *c_char) -> c_int;
|
||||
unsafe fn lseek(fd: c_int, offset: off_t, whence: c_int) -> off_t;
|
||||
unsafe fn pathconf(path: *c_char, name: c_int) -> c_long;
|
||||
unsafe fn pause() -> c_int;
|
||||
unsafe fn pipe(fds: *mut c_int) -> c_int;
|
||||
unsafe fn read(fd: c_int, buf: *mut c_void,
|
||||
count: size_t) -> ssize_t;
|
||||
unsafe fn rmdir(path: *c_char) -> c_int;
|
||||
unsafe fn setgid(gid: gid_t) -> c_int;
|
||||
unsafe fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
|
||||
unsafe fn setsid() -> pid_t;
|
||||
unsafe fn setuid(uid: uid_t) -> c_int;
|
||||
unsafe fn sleep(secs: c_uint) -> c_uint;
|
||||
unsafe fn sysconf(name: c_int) -> c_long;
|
||||
unsafe fn tcgetpgrp(fd: c_int) -> pid_t;
|
||||
unsafe fn ttyname(fd: c_int) -> *c_char;
|
||||
unsafe fn unlink(c: *c_char) -> c_int;
|
||||
unsafe fn write(fd: c_int, buf: *c_void, count: size_t)
|
||||
-> ssize_t;
|
||||
unsafe fn close(fd: c_int) -> c_int;
|
||||
unsafe fn dup(fd: c_int) -> c_int;
|
||||
unsafe fn dup2(src: c_int, dst: c_int) -> c_int;
|
||||
unsafe fn execv(prog: *c_char, argv: **c_char) -> c_int;
|
||||
unsafe fn execve(prog: *c_char,
|
||||
argv: **c_char,
|
||||
envp: **c_char)
|
||||
-> c_int;
|
||||
unsafe fn execvp(c: *c_char, argv: **c_char) -> c_int;
|
||||
unsafe fn fork() -> pid_t;
|
||||
unsafe fn fpathconf(filedes: c_int, name: c_int) -> c_long;
|
||||
unsafe fn getcwd(buf: *c_char, size: size_t) -> *c_char;
|
||||
unsafe fn getegid() -> gid_t;
|
||||
unsafe fn geteuid() -> uid_t;
|
||||
unsafe fn getgid() -> gid_t ;
|
||||
unsafe fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
|
||||
-> c_int;
|
||||
unsafe fn getlogin() -> *c_char;
|
||||
unsafe fn getopt(argc: c_int, argv: **c_char, optstr: *c_char)
|
||||
-> c_int;
|
||||
unsafe fn getpgrp() -> pid_t;
|
||||
unsafe fn getpid() -> pid_t;
|
||||
unsafe fn getppid() -> pid_t;
|
||||
unsafe fn getuid() -> uid_t;
|
||||
unsafe fn isatty(fd: c_int) -> c_int;
|
||||
unsafe fn link(src: *c_char, dst: *c_char) -> c_int;
|
||||
unsafe fn lseek(fd: c_int, offset: off_t, whence: c_int)
|
||||
-> off_t;
|
||||
unsafe fn pathconf(path: *c_char, name: c_int) -> c_long;
|
||||
unsafe fn pause() -> c_int;
|
||||
unsafe fn pipe(fds: *mut c_int) -> c_int;
|
||||
unsafe fn read(fd: c_int, buf: *mut c_void,
|
||||
count: size_t) -> ssize_t;
|
||||
unsafe fn rmdir(path: *c_char) -> c_int;
|
||||
unsafe fn setgid(gid: gid_t) -> c_int;
|
||||
unsafe fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
|
||||
unsafe fn setsid() -> pid_t;
|
||||
unsafe fn setuid(uid: uid_t) -> c_int;
|
||||
unsafe fn sleep(secs: c_uint) -> c_uint;
|
||||
unsafe fn sysconf(name: c_int) -> c_long;
|
||||
unsafe fn tcgetpgrp(fd: c_int) -> pid_t;
|
||||
unsafe fn ttyname(fd: c_int) -> *c_char;
|
||||
unsafe fn unlink(c: *c_char) -> c_int;
|
||||
unsafe fn write(fd: c_int, buf: *c_void, count: size_t)
|
||||
-> ssize_t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1402,59 +1459,70 @@ pub mod funcs {
|
|||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
pub mod posix01 {
|
||||
use libc::types::os::arch::c95::{c_char, c_int, size_t};
|
||||
use libc::types::os::arch::posix01::stat;
|
||||
use libc::types::os::arch::posix88::{pid_t, ssize_t};
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod stat_ {
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(target_os = "android")]
|
||||
unsafe fn lstat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
pub mod stat_ {
|
||||
use libc::types::os::arch::c95::{c_char, c_int};
|
||||
use libc::types::os::arch::posix01::stat;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link_name = "lstat64"]
|
||||
unsafe fn lstat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
pub extern {
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(target_os = "android")]
|
||||
unsafe fn lstat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link_name = "lstat64"]
|
||||
unsafe fn lstat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod unistd {
|
||||
unsafe fn readlink(path: *c_char, buf: *mut c_char,
|
||||
bufsz: size_t) -> ssize_t;
|
||||
pub mod unistd {
|
||||
use libc::types::os::arch::c95::{c_char, c_int, size_t};
|
||||
use libc::types::os::arch::posix88::{ssize_t};
|
||||
|
||||
unsafe fn fsync(fd: c_int) -> c_int;
|
||||
pub extern {
|
||||
unsafe fn readlink(path: *c_char, buf: *mut c_char,
|
||||
bufsz: size_t) -> ssize_t;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "android")]
|
||||
unsafe fn fdatasync(fd: c_int) -> c_int;
|
||||
unsafe fn fsync(fd: c_int) -> c_int;
|
||||
|
||||
unsafe fn setenv(name: *c_char, val: *c_char,
|
||||
overwrite: c_int) -> c_int;
|
||||
unsafe fn unsetenv(name: *c_char) -> c_int;
|
||||
unsafe fn putenv(string: *c_char) -> c_int;
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "android")]
|
||||
unsafe fn fdatasync(fd: c_int) -> c_int;
|
||||
|
||||
unsafe fn symlink(path1: *c_char, path2: *c_char) -> c_int;
|
||||
unsafe fn setenv(name: *c_char, val: *c_char,
|
||||
overwrite: c_int) -> c_int;
|
||||
unsafe fn unsetenv(name: *c_char) -> c_int;
|
||||
unsafe fn putenv(string: *c_char) -> c_int;
|
||||
|
||||
unsafe fn symlink(path1: *c_char, path2: *c_char) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod wait {
|
||||
unsafe fn waitpid(pid: pid_t, status: *mut c_int,
|
||||
options: c_int) -> pid_t;
|
||||
pub mod wait {
|
||||
use libc::types::os::arch::c95::{c_int};
|
||||
use libc::types::os::arch::posix88::{pid_t};
|
||||
|
||||
pub extern {
|
||||
unsafe fn waitpid(pid: pid_t,
|
||||
status: *mut c_int,
|
||||
options: c_int)
|
||||
-> pid_t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "win32")]
|
||||
pub mod posix01 {
|
||||
#[nolink]
|
||||
pub extern mod stat_ {
|
||||
pub mod stat_ {
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
pub extern mod unistd {
|
||||
pub mod unistd {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1465,30 +1533,30 @@ pub mod funcs {
|
|||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
pub mod posix08 {
|
||||
#[nolink]
|
||||
pub extern mod unistd {
|
||||
pub mod unistd {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod bsd44 {
|
||||
use libc::types::common::c95::{c_void};
|
||||
use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t};
|
||||
pub mod bsd44 {
|
||||
#[abi = "cdecl"]
|
||||
pub extern {
|
||||
use libc::types::common::c95::{c_void};
|
||||
use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t};
|
||||
|
||||
unsafe fn sysctl(name: *c_int, namelen: c_uint,
|
||||
oldp: *mut c_void, oldlenp: *mut size_t,
|
||||
newp: *c_void, newlen: size_t) -> c_int;
|
||||
unsafe fn sysctl(name: *c_int, namelen: c_uint,
|
||||
oldp: *mut c_void, oldlenp: *mut size_t,
|
||||
newp: *c_void, newlen: size_t) -> c_int;
|
||||
|
||||
unsafe fn sysctlbyname(name: *c_char,
|
||||
oldp: *mut c_void, oldlenp: *mut size_t,
|
||||
newp: *c_void, newlen: size_t) -> c_int;
|
||||
unsafe fn sysctlbyname(name: *c_char,
|
||||
oldp: *mut c_void, oldlenp: *mut size_t,
|
||||
newp: *c_void, newlen: size_t) -> c_int;
|
||||
|
||||
unsafe fn sysctlnametomib(name: *c_char, mibp: *mut c_int,
|
||||
sizep: *mut size_t) -> c_int;
|
||||
unsafe fn sysctlnametomib(name: *c_char, mibp: *mut c_int,
|
||||
sizep: *mut size_t) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1500,12 +1568,15 @@ pub mod funcs {
|
|||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod extra {
|
||||
pub mod extra {
|
||||
use libc::types::os::arch::c95::{c_char, c_int};
|
||||
|
||||
unsafe fn _NSGetExecutablePath(buf: *mut c_char,
|
||||
bufsize: *mut u32) -> c_int;
|
||||
#[abi = "cdecl"]
|
||||
pub extern {
|
||||
unsafe fn _NSGetExecutablePath(buf: *mut c_char,
|
||||
bufsize: *mut u32)
|
||||
-> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "freebsd")]
|
||||
|
@ -1520,38 +1591,50 @@ pub mod funcs {
|
|||
|
||||
#[cfg(target_os = "win32")]
|
||||
pub mod extra {
|
||||
use libc::types::os::arch::c95::c_int;
|
||||
use libc::types::os::arch::extra::{DWORD, HMODULE, LPCWSTR, LPWSTR};
|
||||
use libc::types::os::arch::extra::{BOOL, LPSECURITY_ATTRIBUTES};
|
||||
|
||||
#[abi = "stdcall"]
|
||||
pub extern mod kernel32 {
|
||||
unsafe fn GetEnvironmentVariableW(n: LPCWSTR,
|
||||
v: LPWSTR,
|
||||
nsize: DWORD) -> DWORD;
|
||||
unsafe fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR) -> BOOL;
|
||||
pub mod kernel32 {
|
||||
use libc::types::os::arch::extra::{BOOL, DWORD, HMODULE};
|
||||
use libc::types::os::arch::extra::{LPCWSTR, LPWSTR};
|
||||
use libc::types::os::arch::extra::{LPSECURITY_ATTRIBUTES};
|
||||
|
||||
unsafe fn GetModuleFileNameW(hModule: HMODULE,
|
||||
lpFilename: LPWSTR,
|
||||
nSize: DWORD) -> DWORD;
|
||||
unsafe fn CreateDirectoryW(lpPathName: LPCWSTR,
|
||||
lpSecurityAttributes:
|
||||
LPSECURITY_ATTRIBUTES) -> BOOL;
|
||||
unsafe fn CopyFileW(lpExistingFileName: LPCWSTR,
|
||||
lpNewFileName: LPCWSTR,
|
||||
bFailIfExists: BOOL) -> BOOL;
|
||||
unsafe fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
|
||||
unsafe fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
|
||||
unsafe fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
|
||||
#[abi = "stdcall"]
|
||||
pub extern {
|
||||
unsafe fn GetEnvironmentVariableW(n: LPCWSTR,
|
||||
v: LPWSTR,
|
||||
nsize: DWORD)
|
||||
-> DWORD;
|
||||
unsafe fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
|
||||
-> BOOL;
|
||||
|
||||
unsafe fn GetLastError() -> DWORD;
|
||||
unsafe fn GetModuleFileNameW(hModule: HMODULE,
|
||||
lpFilename: LPWSTR,
|
||||
nSize: DWORD)
|
||||
-> DWORD;
|
||||
unsafe fn CreateDirectoryW(lpPathName: LPCWSTR,
|
||||
lpSecurityAttributes:
|
||||
LPSECURITY_ATTRIBUTES)
|
||||
-> BOOL;
|
||||
unsafe fn CopyFileW(lpExistingFileName: LPCWSTR,
|
||||
lpNewFileName: LPCWSTR,
|
||||
bFailIfExists: BOOL)
|
||||
-> BOOL;
|
||||
unsafe fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
|
||||
unsafe fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
|
||||
unsafe fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
|
||||
|
||||
unsafe fn GetLastError() -> DWORD;
|
||||
}
|
||||
}
|
||||
|
||||
#[abi = "cdecl"]
|
||||
#[nolink]
|
||||
pub extern mod msvcrt {
|
||||
#[link_name = "_commit"]
|
||||
unsafe fn commit(fd: c_int) -> c_int;
|
||||
pub mod msvcrt {
|
||||
use libc::types::os::arch::c95::c_int;
|
||||
|
||||
#[abi = "cdecl"]
|
||||
#[nolink]
|
||||
pub extern {
|
||||
#[link_name = "_commit"]
|
||||
unsafe fn commit(fd: c_int) -> c_int;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,13 +12,16 @@
|
|||
|
||||
use libc;
|
||||
|
||||
#[nolink]
|
||||
extern mod rustrt {
|
||||
unsafe fn rust_log_console_on();
|
||||
unsafe fn rust_log_console_off();
|
||||
unsafe fn rust_log_str(level: u32,
|
||||
string: *libc::c_char,
|
||||
size: libc::size_t);
|
||||
pub mod rustrt {
|
||||
use libc;
|
||||
|
||||
pub extern {
|
||||
unsafe fn rust_log_console_on();
|
||||
unsafe fn rust_log_console_off();
|
||||
unsafe fn rust_log_str(level: u32,
|
||||
string: *libc::c_char,
|
||||
size: libc::size_t);
|
||||
}
|
||||
}
|
||||
|
||||
/// Turns on logging to stdout globally
|
||||
|
|
|
@ -17,146 +17,160 @@ use libc::c_double;
|
|||
// function names are almost identical to C's libmath, a few have been
|
||||
// renamed, grep for "rename:"
|
||||
|
||||
#[link_name = "m"]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod c_double_utils {
|
||||
pub mod c_double_utils {
|
||||
use libc::{c_double, c_int};
|
||||
|
||||
// Alpabetically sorted by link_name
|
||||
#[link_name = "m"]
|
||||
#[abi = "cdecl"]
|
||||
pub extern {
|
||||
// Alpabetically sorted by link_name
|
||||
|
||||
unsafe fn acos(n: c_double) -> c_double;
|
||||
unsafe fn asin(n: c_double) -> c_double;
|
||||
unsafe fn atan(n: c_double) -> c_double;
|
||||
unsafe fn atan2(a: c_double, b: c_double) -> c_double;
|
||||
unsafe fn cbrt(n: c_double) -> c_double;
|
||||
unsafe fn ceil(n: c_double) -> c_double;
|
||||
unsafe fn copysign(x: c_double, y: c_double) -> c_double;
|
||||
unsafe fn cos(n: c_double) -> c_double;
|
||||
unsafe fn cosh(n: c_double) -> c_double;
|
||||
unsafe fn erf(n: c_double) -> c_double;
|
||||
unsafe fn erfc(n: c_double) -> c_double;
|
||||
unsafe fn exp(n: c_double) -> c_double;
|
||||
unsafe fn expm1(n: c_double) -> c_double;
|
||||
unsafe fn exp2(n: c_double) -> c_double;
|
||||
#[link_name="fabs"] unsafe fn abs(n: c_double) -> c_double;
|
||||
// rename: for clarity and consistency with add/sub/mul/div
|
||||
#[link_name="fdim"]
|
||||
unsafe fn abs_sub(a: c_double, b: c_double) -> c_double;
|
||||
unsafe fn floor(n: c_double) -> c_double;
|
||||
// rename: for clarity and consistency with add/sub/mul/div
|
||||
#[link_name="fma"] unsafe fn mul_add(a: c_double, b: c_double,
|
||||
c: c_double) -> c_double;
|
||||
#[link_name="fmax"] unsafe fn fmax(a: c_double, b: c_double) -> c_double;
|
||||
#[link_name="fmin"] unsafe fn fmin(a: c_double, b: c_double) -> c_double;
|
||||
unsafe fn nextafter(x: c_double, y: c_double) -> c_double;
|
||||
unsafe fn frexp(n: c_double, value: &mut c_int) -> c_double;
|
||||
unsafe fn hypot(x: c_double, y: c_double) -> c_double;
|
||||
unsafe fn ldexp(x: c_double, n: c_int) -> c_double;
|
||||
#[cfg(unix)]
|
||||
#[link_name="lgamma_r"] unsafe fn lgamma(n: c_double,
|
||||
sign: &mut c_int) -> c_double;
|
||||
#[cfg(windows)]
|
||||
#[link_name="__lgamma_r"] unsafe fn lgamma(n: c_double,
|
||||
sign: &mut c_int) -> c_double;
|
||||
// renamed: log is a reserved keyword; ln seems more natural, too
|
||||
#[link_name="log"] unsafe fn ln(n: c_double) -> c_double;
|
||||
// renamed: "logb" /often/ is confused for log2 by beginners
|
||||
#[link_name="logb"] unsafe fn log_radix(n: c_double) -> c_double;
|
||||
// renamed: to be consitent with log as ln
|
||||
#[link_name="log1p"] unsafe fn ln1p(n: c_double) -> c_double;
|
||||
unsafe fn log10(n: c_double) -> c_double;
|
||||
unsafe fn log2(n: c_double) -> c_double;
|
||||
#[link_name="ilogb"] unsafe fn ilog_radix(n: c_double) -> c_int;
|
||||
unsafe fn modf(n: c_double, iptr: &mut c_double) -> c_double;
|
||||
unsafe fn pow(n: c_double, e: c_double) -> c_double;
|
||||
// FIXME (#1379): enable when rounding modes become available
|
||||
// unsafe fn rint(n: c_double) -> c_double;
|
||||
unsafe fn round(n: c_double) -> c_double;
|
||||
// rename: for consistency with logradix
|
||||
#[link_name="scalbn"] unsafe fn ldexp_radix(n: c_double, i: c_int) ->
|
||||
c_double;
|
||||
unsafe fn sin(n: c_double) -> c_double;
|
||||
unsafe fn sinh(n: c_double) -> c_double;
|
||||
unsafe fn sqrt(n: c_double) -> c_double;
|
||||
unsafe fn tan(n: c_double) -> c_double;
|
||||
unsafe fn tanh(n: c_double) -> c_double;
|
||||
unsafe fn tgamma(n: c_double) -> c_double;
|
||||
unsafe fn trunc(n: c_double) -> c_double;
|
||||
unsafe fn acos(n: c_double) -> c_double;
|
||||
unsafe fn asin(n: c_double) -> c_double;
|
||||
unsafe fn atan(n: c_double) -> c_double;
|
||||
unsafe fn atan2(a: c_double, b: c_double) -> c_double;
|
||||
unsafe fn cbrt(n: c_double) -> c_double;
|
||||
unsafe fn ceil(n: c_double) -> c_double;
|
||||
unsafe fn copysign(x: c_double, y: c_double) -> c_double;
|
||||
unsafe fn cos(n: c_double) -> c_double;
|
||||
unsafe fn cosh(n: c_double) -> c_double;
|
||||
unsafe fn erf(n: c_double) -> c_double;
|
||||
unsafe fn erfc(n: c_double) -> c_double;
|
||||
unsafe fn exp(n: c_double) -> c_double;
|
||||
unsafe fn expm1(n: c_double) -> c_double;
|
||||
unsafe fn exp2(n: c_double) -> c_double;
|
||||
#[link_name="fabs"] unsafe fn abs(n: c_double) -> c_double;
|
||||
// rename: for clarity and consistency with add/sub/mul/div
|
||||
#[link_name="fdim"]
|
||||
unsafe fn abs_sub(a: c_double, b: c_double) -> c_double;
|
||||
unsafe fn floor(n: c_double) -> c_double;
|
||||
// rename: for clarity and consistency with add/sub/mul/div
|
||||
#[link_name="fma"]
|
||||
unsafe fn mul_add(a: c_double, b: c_double, c: c_double) -> c_double;
|
||||
#[link_name="fmax"]
|
||||
unsafe fn fmax(a: c_double, b: c_double) -> c_double;
|
||||
#[link_name="fmin"]
|
||||
unsafe fn fmin(a: c_double, b: c_double) -> c_double;
|
||||
unsafe fn nextafter(x: c_double, y: c_double) -> c_double;
|
||||
unsafe fn frexp(n: c_double, value: &mut c_int) -> c_double;
|
||||
unsafe fn hypot(x: c_double, y: c_double) -> c_double;
|
||||
unsafe fn ldexp(x: c_double, n: c_int) -> c_double;
|
||||
#[cfg(unix)]
|
||||
#[link_name="lgamma_r"]
|
||||
unsafe fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
|
||||
#[cfg(windows)]
|
||||
#[link_name="__lgamma_r"]
|
||||
unsafe fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
|
||||
// renamed: log is a reserved keyword; ln seems more natural, too
|
||||
#[link_name="log"] unsafe fn ln(n: c_double) -> c_double;
|
||||
// renamed: "logb" /often/ is confused for log2 by beginners
|
||||
#[link_name="logb"] unsafe fn log_radix(n: c_double) -> c_double;
|
||||
// renamed: to be consitent with log as ln
|
||||
#[link_name="log1p"] unsafe fn ln1p(n: c_double) -> c_double;
|
||||
unsafe fn log10(n: c_double) -> c_double;
|
||||
unsafe fn log2(n: c_double) -> c_double;
|
||||
#[link_name="ilogb"] unsafe fn ilog_radix(n: c_double) -> c_int;
|
||||
unsafe fn modf(n: c_double, iptr: &mut c_double) -> c_double;
|
||||
unsafe fn pow(n: c_double, e: c_double) -> c_double;
|
||||
// FIXME (#1379): enable when rounding modes become available
|
||||
// unsafe fn rint(n: c_double) -> c_double;
|
||||
unsafe fn round(n: c_double) -> c_double;
|
||||
// rename: for consistency with logradix
|
||||
#[link_name="scalbn"] unsafe fn ldexp_radix(n: c_double, i: c_int) ->
|
||||
c_double;
|
||||
unsafe fn sin(n: c_double) -> c_double;
|
||||
unsafe fn sinh(n: c_double) -> c_double;
|
||||
unsafe fn sqrt(n: c_double) -> c_double;
|
||||
unsafe fn tan(n: c_double) -> c_double;
|
||||
unsafe fn tanh(n: c_double) -> c_double;
|
||||
unsafe fn tgamma(n: c_double) -> c_double;
|
||||
unsafe fn trunc(n: c_double) -> c_double;
|
||||
|
||||
// These are commonly only available for doubles
|
||||
// These are commonly only available for doubles
|
||||
|
||||
unsafe fn j0(n: c_double) -> c_double;
|
||||
unsafe fn j1(n: c_double) -> c_double;
|
||||
unsafe fn jn(i: c_int, n: c_double) -> c_double;
|
||||
unsafe fn j0(n: c_double) -> c_double;
|
||||
unsafe fn j1(n: c_double) -> c_double;
|
||||
unsafe fn jn(i: c_int, n: c_double) -> c_double;
|
||||
|
||||
unsafe fn y0(n: c_double) -> c_double;
|
||||
unsafe fn y1(n: c_double) -> c_double;
|
||||
unsafe fn yn(i: c_int, n: c_double) -> c_double;
|
||||
unsafe fn y0(n: c_double) -> c_double;
|
||||
unsafe fn y1(n: c_double) -> c_double;
|
||||
unsafe fn yn(i: c_int, n: c_double) -> c_double;
|
||||
}
|
||||
}
|
||||
|
||||
#[link_name = "m"]
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod c_float_utils {
|
||||
pub mod c_float_utils {
|
||||
use libc::{c_float, c_int};
|
||||
|
||||
// Alpabetically sorted by link_name
|
||||
#[link_name = "m"]
|
||||
#[abi = "cdecl"]
|
||||
pub extern {
|
||||
// Alpabetically sorted by link_name
|
||||
|
||||
#[link_name="acosf"] unsafe fn acos(n: c_float) -> c_float;
|
||||
#[link_name="asinf"] unsafe fn asin(n: c_float) -> c_float;
|
||||
#[link_name="atanf"] unsafe fn atan(n: c_float) -> c_float;
|
||||
#[link_name="atan2f"] unsafe fn atan2(a: c_float, b: c_float) -> c_float;
|
||||
#[link_name="cbrtf"] unsafe fn cbrt(n: c_float) -> c_float;
|
||||
#[link_name="ceilf"] unsafe fn ceil(n: c_float) -> c_float;
|
||||
#[link_name="copysignf"] unsafe fn copysign(x: c_float,
|
||||
y: c_float) -> c_float;
|
||||
#[link_name="cosf"] unsafe fn cos(n: c_float) -> c_float;
|
||||
#[link_name="coshf"] unsafe fn cosh(n: c_float) -> c_float;
|
||||
#[link_name="erff"] unsafe fn erf(n: c_float) -> c_float;
|
||||
#[link_name="erfcf"] unsafe fn erfc(n: c_float) -> c_float;
|
||||
#[link_name="expf"] unsafe fn exp(n: c_float) -> c_float;
|
||||
#[link_name="expm1f"]unsafe fn expm1(n: c_float) -> c_float;
|
||||
#[link_name="exp2f"] unsafe fn exp2(n: c_float) -> c_float;
|
||||
#[link_name="fabsf"] unsafe fn abs(n: c_float) -> c_float;
|
||||
#[link_name="fdimf"] unsafe fn abs_sub(a: c_float, b: c_float) -> c_float;
|
||||
#[link_name="floorf"] unsafe fn floor(n: c_float) -> c_float;
|
||||
#[link_name="frexpf"] unsafe fn frexp(n: c_float,
|
||||
value: &mut c_int) -> c_float;
|
||||
#[link_name="fmaf"] unsafe fn mul_add(a: c_float,
|
||||
b: c_float, c: c_float) -> c_float;
|
||||
#[link_name="fmaxf"] unsafe fn fmax(a: c_float, b: c_float) -> c_float;
|
||||
#[link_name="fminf"] unsafe fn fmin(a: c_float, b: c_float) -> c_float;
|
||||
#[link_name="nextafterf"] unsafe fn nextafter(x: c_float,
|
||||
y: c_float) -> c_float;
|
||||
#[link_name="hypotf"] unsafe fn hypot(x: c_float, y: c_float) -> c_float;
|
||||
#[link_name="ldexpf"] unsafe fn ldexp(x: c_float, n: c_int) -> c_float;
|
||||
#[link_name="acosf"] unsafe fn acos(n: c_float) -> c_float;
|
||||
#[link_name="asinf"] unsafe fn asin(n: c_float) -> c_float;
|
||||
#[link_name="atanf"] unsafe fn atan(n: c_float) -> c_float;
|
||||
#[link_name="atan2f"]
|
||||
unsafe fn atan2(a: c_float, b: c_float) -> c_float;
|
||||
#[link_name="cbrtf"] unsafe fn cbrt(n: c_float) -> c_float;
|
||||
#[link_name="ceilf"] unsafe fn ceil(n: c_float) -> c_float;
|
||||
#[link_name="copysignf"] unsafe fn copysign(x: c_float,
|
||||
y: c_float) -> c_float;
|
||||
#[link_name="cosf"] unsafe fn cos(n: c_float) -> c_float;
|
||||
#[link_name="coshf"] unsafe fn cosh(n: c_float) -> c_float;
|
||||
#[link_name="erff"] unsafe fn erf(n: c_float) -> c_float;
|
||||
#[link_name="erfcf"] unsafe fn erfc(n: c_float) -> c_float;
|
||||
#[link_name="expf"] unsafe fn exp(n: c_float) -> c_float;
|
||||
#[link_name="expm1f"]unsafe fn expm1(n: c_float) -> c_float;
|
||||
#[link_name="exp2f"] unsafe fn exp2(n: c_float) -> c_float;
|
||||
#[link_name="fabsf"] unsafe fn abs(n: c_float) -> c_float;
|
||||
#[link_name="fdimf"]
|
||||
unsafe fn abs_sub(a: c_float, b: c_float) -> c_float;
|
||||
#[link_name="floorf"] unsafe fn floor(n: c_float) -> c_float;
|
||||
#[link_name="frexpf"] unsafe fn frexp(n: c_float,
|
||||
value: &mut c_int) -> c_float;
|
||||
#[link_name="fmaf"]
|
||||
unsafe fn mul_add(a: c_float, b: c_float, c: c_float) -> c_float;
|
||||
#[link_name="fmaxf"]
|
||||
unsafe fn fmax(a: c_float, b: c_float) -> c_float;
|
||||
#[link_name="fminf"]
|
||||
unsafe fn fmin(a: c_float, b: c_float) -> c_float;
|
||||
#[link_name="nextafterf"]
|
||||
unsafe fn nextafter(x: c_float, y: c_float) -> c_float;
|
||||
#[link_name="hypotf"]
|
||||
unsafe fn hypot(x: c_float, y: c_float) -> c_float;
|
||||
#[link_name="ldexpf"]
|
||||
unsafe fn ldexp(x: c_float, n: c_int) -> c_float;
|
||||
|
||||
#[cfg(unix)]
|
||||
#[link_name="lgammaf_r"] unsafe fn lgamma(n: c_float,
|
||||
sign: &mut c_int) -> c_float;
|
||||
#[cfg(unix)]
|
||||
#[link_name="lgammaf_r"] unsafe fn lgamma(n: c_float,
|
||||
sign: &mut c_int) -> c_float;
|
||||
|
||||
#[cfg(windows)]
|
||||
#[link_name="__lgammaf_r"] unsafe fn lgamma(n: c_float,
|
||||
sign: &mut c_int) -> c_float;
|
||||
#[cfg(windows)]
|
||||
#[link_name="__lgammaf_r"]
|
||||
unsafe fn lgamma(n: c_float, sign: &mut c_int) -> c_float;
|
||||
|
||||
#[link_name="logf"] unsafe fn ln(n: c_float) -> c_float;
|
||||
#[link_name="logbf"] unsafe fn log_radix(n: c_float) -> c_float;
|
||||
#[link_name="log1pf"] unsafe fn ln1p(n: c_float) -> c_float;
|
||||
#[link_name="log2f"] unsafe fn log2(n: c_float) -> c_float;
|
||||
#[link_name="log10f"] unsafe fn log10(n: c_float) -> c_float;
|
||||
#[link_name="ilogbf"] unsafe fn ilog_radix(n: c_float) -> c_int;
|
||||
#[link_name="modff"] unsafe fn modf(n: c_float,
|
||||
iptr: &mut c_float) -> c_float;
|
||||
#[link_name="powf"] unsafe fn pow(n: c_float, e: c_float) -> c_float;
|
||||
// FIXME (#1379): enable when rounding modes become available
|
||||
// #[link_name="rintf"] unsafe fn rint(n: c_float) -> c_float;
|
||||
#[link_name="roundf"] unsafe fn round(n: c_float) -> c_float;
|
||||
#[link_name="scalbnf"] unsafe fn ldexp_radix(n: c_float, i: c_int)
|
||||
-> c_float;
|
||||
#[link_name="sinf"] unsafe fn sin(n: c_float) -> c_float;
|
||||
#[link_name="sinhf"] unsafe fn sinh(n: c_float) -> c_float;
|
||||
#[link_name="sqrtf"] unsafe fn sqrt(n: c_float) -> c_float;
|
||||
#[link_name="tanf"] unsafe fn tan(n: c_float) -> c_float;
|
||||
#[link_name="tanhf"] unsafe fn tanh(n: c_float) -> c_float;
|
||||
#[link_name="tgammaf"] unsafe fn tgamma(n: c_float) -> c_float;
|
||||
#[link_name="truncf"] unsafe fn trunc(n: c_float) -> c_float;
|
||||
#[link_name="logf"] unsafe fn ln(n: c_float) -> c_float;
|
||||
#[link_name="logbf"] unsafe fn log_radix(n: c_float) -> c_float;
|
||||
#[link_name="log1pf"] unsafe fn ln1p(n: c_float) -> c_float;
|
||||
#[link_name="log2f"] unsafe fn log2(n: c_float) -> c_float;
|
||||
#[link_name="log10f"] unsafe fn log10(n: c_float) -> c_float;
|
||||
#[link_name="ilogbf"] unsafe fn ilog_radix(n: c_float) -> c_int;
|
||||
#[link_name="modff"] unsafe fn modf(n: c_float,
|
||||
iptr: &mut c_float) -> c_float;
|
||||
#[link_name="powf"] unsafe fn pow(n: c_float, e: c_float) -> c_float;
|
||||
// FIXME (#1379): enable when rounding modes become available
|
||||
// #[link_name="rintf"] unsafe fn rint(n: c_float) -> c_float;
|
||||
#[link_name="roundf"] unsafe fn round(n: c_float) -> c_float;
|
||||
#[link_name="scalbnf"] unsafe fn ldexp_radix(n: c_float, i: c_int)
|
||||
-> c_float;
|
||||
#[link_name="sinf"] unsafe fn sin(n: c_float) -> c_float;
|
||||
#[link_name="sinhf"] unsafe fn sinh(n: c_float) -> c_float;
|
||||
#[link_name="sqrtf"] unsafe fn sqrt(n: c_float) -> c_float;
|
||||
#[link_name="tanf"] unsafe fn tan(n: c_float) -> c_float;
|
||||
#[link_name="tanhf"] unsafe fn tanh(n: c_float) -> c_float;
|
||||
#[link_name="tgammaf"] unsafe fn tgamma(n: c_float) -> c_float;
|
||||
#[link_name="truncf"] unsafe fn trunc(n: c_float) -> c_float;
|
||||
}
|
||||
}
|
||||
|
||||
// PORT check these by running src/etc/machconsts.c for your architecture
|
||||
|
|
|
@ -51,15 +51,20 @@ pub fn close(fd: c_int) -> c_int {
|
|||
}
|
||||
}
|
||||
|
||||
extern mod rustrt {
|
||||
unsafe fn rust_get_argc() -> c_int;
|
||||
unsafe fn rust_get_argv() -> **c_char;
|
||||
unsafe fn rust_getcwd() -> ~str;
|
||||
unsafe fn rust_path_is_dir(path: *libc::c_char) -> c_int;
|
||||
unsafe fn rust_path_exists(path: *libc::c_char) -> c_int;
|
||||
unsafe fn rust_list_files2(&&path: ~str) -> ~[~str];
|
||||
unsafe fn rust_process_wait(handle: c_int) -> c_int;
|
||||
unsafe fn rust_set_exit_status(code: libc::intptr_t);
|
||||
pub mod rustrt {
|
||||
use libc::{c_char, c_int};
|
||||
use libc;
|
||||
|
||||
pub extern {
|
||||
unsafe fn rust_get_argc() -> c_int;
|
||||
unsafe fn rust_get_argv() -> **c_char;
|
||||
unsafe fn rust_getcwd() -> ~str;
|
||||
unsafe fn rust_path_is_dir(path: *libc::c_char) -> c_int;
|
||||
unsafe fn rust_path_exists(path: *libc::c_char) -> c_int;
|
||||
unsafe fn rust_list_files2(&&path: ~str) -> ~[~str];
|
||||
unsafe fn rust_process_wait(handle: c_int) -> c_int;
|
||||
unsafe fn rust_set_exit_status(code: libc::intptr_t);
|
||||
}
|
||||
}
|
||||
|
||||
pub const TMPBUF_SZ : uint = 1000u;
|
||||
|
@ -159,14 +164,14 @@ fn with_env_lock<T>(f: &fn() -> T) -> T {
|
|||
}
|
||||
|
||||
pub fn env() -> ~[(~str,~str)] {
|
||||
extern mod rustrt {
|
||||
extern {
|
||||
unsafe fn rust_env_pairs() -> ~[~str];
|
||||
}
|
||||
|
||||
unsafe {
|
||||
do with_env_lock {
|
||||
let mut pairs = ~[];
|
||||
for vec::each(rustrt::rust_env_pairs()) |p| {
|
||||
for vec::each(rust_env_pairs()) |p| {
|
||||
let vs = str::splitn_char(*p, '=', 1u);
|
||||
assert vec::len(vs) == 2u;
|
||||
pairs.push((copy vs[0], copy vs[1]));
|
||||
|
|
|
@ -288,22 +288,28 @@ pub fn swap_task(dst: &mut *rust_task, src: *rust_task) -> *rust_task {
|
|||
|
||||
#[doc(hidden)]
|
||||
#[allow(non_camel_case_types)]
|
||||
type rust_task = libc::c_void;
|
||||
pub type rust_task = libc::c_void;
|
||||
|
||||
#[doc(hidden)]
|
||||
extern mod rustrt {
|
||||
#[rust_stack]
|
||||
unsafe fn rust_get_task() -> *rust_task;
|
||||
#[rust_stack]
|
||||
unsafe fn rust_task_ref(task: *rust_task);
|
||||
unsafe fn rust_task_deref(task: *rust_task);
|
||||
pub mod rustrt {
|
||||
use libc;
|
||||
use super::rust_task;
|
||||
|
||||
#[rust_stack]
|
||||
unsafe fn task_clear_event_reject(task: *rust_task);
|
||||
pub extern {
|
||||
#[rust_stack]
|
||||
unsafe fn rust_get_task() -> *rust_task;
|
||||
#[rust_stack]
|
||||
unsafe fn rust_task_ref(task: *rust_task);
|
||||
unsafe fn rust_task_deref(task: *rust_task);
|
||||
|
||||
unsafe fn task_wait_event(this: *rust_task, killed: &mut *libc::c_void)
|
||||
-> bool;
|
||||
unsafe fn task_signal_event(target: *rust_task, event: *libc::c_void);
|
||||
#[rust_stack]
|
||||
unsafe fn task_clear_event_reject(task: *rust_task);
|
||||
|
||||
unsafe fn task_wait_event(this: *rust_task,
|
||||
killed: &mut *libc::c_void)
|
||||
-> bool;
|
||||
unsafe fn task_signal_event(target: *rust_task, event: *libc::c_void);
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
|
|
|
@ -20,25 +20,32 @@ use sys;
|
|||
#[cfg(test)] use str;
|
||||
#[cfg(notest)] use cmp::{Eq, Ord};
|
||||
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
extern mod libc_ {
|
||||
#[rust_stack]
|
||||
unsafe fn memmove(dest: *mut c_void,
|
||||
src: *const c_void,
|
||||
n: libc::size_t)
|
||||
-> *c_void;
|
||||
pub mod libc_ {
|
||||
use libc::c_void;
|
||||
use libc;
|
||||
|
||||
#[rust_stack]
|
||||
unsafe fn memset(dest: *mut c_void,
|
||||
c: libc::c_int,
|
||||
len: libc::size_t)
|
||||
-> *c_void;
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
pub extern {
|
||||
#[rust_stack]
|
||||
unsafe fn memmove(dest: *mut c_void,
|
||||
src: *const c_void,
|
||||
n: libc::size_t)
|
||||
-> *c_void;
|
||||
|
||||
#[rust_stack]
|
||||
unsafe fn memset(dest: *mut c_void,
|
||||
c: libc::c_int,
|
||||
len: libc::size_t)
|
||||
-> *c_void;
|
||||
}
|
||||
}
|
||||
|
||||
#[abi = "rust-intrinsic"]
|
||||
extern mod rusti {
|
||||
fn addr_of<T>(&&val: T) -> *T;
|
||||
pub mod rusti {
|
||||
#[abi = "rust-intrinsic"]
|
||||
pub extern {
|
||||
fn addr_of<T>(&&val: T) -> *T;
|
||||
}
|
||||
}
|
||||
|
||||
/// Get an unsafe pointer to a value
|
||||
|
|
|
@ -117,15 +117,20 @@ impl<T:Rand> Rand for Option<T> {
|
|||
}
|
||||
|
||||
#[allow(non_camel_case_types)] // runtime type
|
||||
enum rust_rng {}
|
||||
pub enum rust_rng {}
|
||||
|
||||
#[abi = "cdecl"]
|
||||
extern mod rustrt {
|
||||
unsafe fn rand_seed_size() -> size_t;
|
||||
unsafe fn rand_gen_seed(buf: *mut u8, sz: size_t);
|
||||
unsafe fn rand_new_seeded(buf: *u8, sz: size_t) -> *rust_rng;
|
||||
unsafe fn rand_next(rng: *rust_rng) -> u32;
|
||||
unsafe fn rand_free(rng: *rust_rng);
|
||||
pub mod rustrt {
|
||||
use libc::size_t;
|
||||
use rand::rust_rng;
|
||||
|
||||
pub extern {
|
||||
unsafe fn rand_seed_size() -> size_t;
|
||||
unsafe fn rand_gen_seed(buf: *mut u8, sz: size_t);
|
||||
unsafe fn rand_new_seeded(buf: *u8, sz: size_t) -> *rust_rng;
|
||||
unsafe fn rand_next(rng: *rust_rng) -> u32;
|
||||
unsafe fn rand_free(rng: *rust_rng);
|
||||
}
|
||||
}
|
||||
|
||||
/// A random number generator
|
||||
|
|
|
@ -23,12 +23,20 @@ use str;
|
|||
use task;
|
||||
use vec;
|
||||
|
||||
#[abi = "cdecl"]
|
||||
extern mod rustrt {
|
||||
unsafe fn rust_run_program(argv: **libc::c_char, envp: *c_void,
|
||||
dir: *libc::c_char,
|
||||
in_fd: c_int, out_fd: c_int, err_fd: c_int)
|
||||
-> pid_t;
|
||||
pub mod rustrt {
|
||||
use libc::{c_int, c_void, pid_t};
|
||||
use libc;
|
||||
|
||||
#[abi = "cdecl"]
|
||||
pub extern {
|
||||
unsafe fn rust_run_program(argv: **libc::c_char,
|
||||
envp: *c_void,
|
||||
dir: *libc::c_char,
|
||||
in_fd: c_int,
|
||||
out_fd: c_int,
|
||||
err_fd: c_int)
|
||||
-> pid_t;
|
||||
}
|
||||
}
|
||||
|
||||
/// A value representing a child process
|
||||
|
|
|
@ -86,11 +86,16 @@ fn frame_address(f: fn(++x: *u8)) {
|
|||
}
|
||||
}
|
||||
|
||||
extern mod rustrt {
|
||||
pub unsafe fn rust_dbg_breakpoint();
|
||||
pub mod rustrt {
|
||||
pub extern {
|
||||
pub unsafe fn rust_dbg_breakpoint();
|
||||
}
|
||||
}
|
||||
|
||||
#[abi = "rust-intrinsic"]
|
||||
extern mod rusti {
|
||||
pub fn frame_address(f: &once fn(++x: *u8));
|
||||
pub mod rusti {
|
||||
#[abi = "rust-intrinsic"]
|
||||
pub extern {
|
||||
pub fn frame_address(f: &once fn(++x: *u8));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,17 +37,25 @@ pub struct Closure {
|
|||
env: *(),
|
||||
}
|
||||
|
||||
#[abi = "rust-intrinsic"]
|
||||
extern mod rusti {
|
||||
fn get_tydesc<T>() -> *();
|
||||
fn size_of<T>() -> uint;
|
||||
fn pref_align_of<T>() -> uint;
|
||||
fn min_align_of<T>() -> uint;
|
||||
pub mod rusti {
|
||||
#[abi = "rust-intrinsic"]
|
||||
pub extern {
|
||||
fn get_tydesc<T>() -> *();
|
||||
fn size_of<T>() -> uint;
|
||||
fn pref_align_of<T>() -> uint;
|
||||
fn min_align_of<T>() -> uint;
|
||||
}
|
||||
}
|
||||
|
||||
extern mod rustrt {
|
||||
#[rust_stack]
|
||||
unsafe fn rust_upcall_fail(expr: *c_char, file: *c_char, line: size_t);
|
||||
pub mod rustrt {
|
||||
use libc::{c_char, size_t};
|
||||
|
||||
pub extern {
|
||||
#[rust_stack]
|
||||
unsafe fn rust_upcall_fail(expr: *c_char,
|
||||
file: *c_char,
|
||||
line: size_t);
|
||||
}
|
||||
}
|
||||
|
||||
/// Compares contents of two pointers using the default method.
|
||||
|
|
|
@ -938,15 +938,17 @@ fn test_spawn_sched_childs_on_default_sched() {
|
|||
po.recv();
|
||||
}
|
||||
|
||||
#[nolink]
|
||||
#[cfg(test)]
|
||||
extern mod testrt {
|
||||
unsafe fn rust_dbg_lock_create() -> *libc::c_void;
|
||||
unsafe fn rust_dbg_lock_destroy(lock: *libc::c_void);
|
||||
unsafe fn rust_dbg_lock_lock(lock: *libc::c_void);
|
||||
unsafe fn rust_dbg_lock_unlock(lock: *libc::c_void);
|
||||
unsafe fn rust_dbg_lock_wait(lock: *libc::c_void);
|
||||
unsafe fn rust_dbg_lock_signal(lock: *libc::c_void);
|
||||
pub mod testrt {
|
||||
#[nolink]
|
||||
pub extern {
|
||||
unsafe fn rust_dbg_lock_create() -> *libc::c_void;
|
||||
unsafe fn rust_dbg_lock_destroy(lock: *libc::c_void);
|
||||
unsafe fn rust_dbg_lock_lock(lock: *libc::c_void);
|
||||
unsafe fn rust_dbg_lock_unlock(lock: *libc::c_void);
|
||||
unsafe fn rust_dbg_lock_wait(lock: *libc::c_void);
|
||||
unsafe fn rust_dbg_lock_signal(lock: *libc::c_void);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -36,18 +36,22 @@ pub mod extfmt;
|
|||
#[cfg(notest)]
|
||||
pub mod lang;
|
||||
|
||||
extern mod rustrt {
|
||||
pub unsafe fn rust_create_little_lock() -> rust_little_lock;
|
||||
pub unsafe fn rust_destroy_little_lock(lock: rust_little_lock);
|
||||
pub unsafe fn rust_lock_little_lock(lock: rust_little_lock);
|
||||
pub unsafe fn rust_unlock_little_lock(lock: rust_little_lock);
|
||||
mod rustrt {
|
||||
use unstable::{raw_thread, rust_little_lock};
|
||||
|
||||
pub unsafe fn rust_raw_thread_start(f: &fn()) -> *raw_thread;
|
||||
pub unsafe fn rust_raw_thread_join_delete(thread: *raw_thread);
|
||||
pub extern {
|
||||
pub unsafe fn rust_create_little_lock() -> rust_little_lock;
|
||||
pub unsafe fn rust_destroy_little_lock(lock: rust_little_lock);
|
||||
pub unsafe fn rust_lock_little_lock(lock: rust_little_lock);
|
||||
pub unsafe fn rust_unlock_little_lock(lock: rust_little_lock);
|
||||
|
||||
pub unsafe fn rust_raw_thread_start(f: &fn()) -> *raw_thread;
|
||||
pub unsafe fn rust_raw_thread_join_delete(thread: *raw_thread);
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)] // runtime type
|
||||
type raw_thread = libc::c_void;
|
||||
pub type raw_thread = libc::c_void;
|
||||
|
||||
/**
|
||||
|
||||
|
@ -204,7 +208,7 @@ impl<T:Owned> Clone for SharedMutableState<T> {
|
|||
/****************************************************************************/
|
||||
|
||||
#[allow(non_camel_case_types)] // runtime type
|
||||
type rust_little_lock = *libc::c_void;
|
||||
pub type rust_little_lock = *libc::c_void;
|
||||
|
||||
struct LittleLock {
|
||||
l: rust_little_lock,
|
||||
|
|
|
@ -37,8 +37,12 @@ pub fn at_exit(f: ~fn()) {
|
|||
// NB: The double pointer indirection here is because ~fn() is a fat
|
||||
// pointer and due to FFI problems I am more comfortable making the
|
||||
// interface use a normal pointer
|
||||
extern mod rustrt {
|
||||
fn rust_register_exit_function(runner: *c_void, f: ~~fn());
|
||||
mod rustrt {
|
||||
use libc::c_void;
|
||||
|
||||
pub extern {
|
||||
fn rust_register_exit_function(runner: *c_void, f: ~~fn());
|
||||
}
|
||||
}
|
||||
|
||||
struct ExitFunctions {
|
||||
|
|
|
@ -26,12 +26,16 @@ pub const FROZEN_BIT: uint = 0x80000000;
|
|||
#[cfg(target_word_size = "64")]
|
||||
pub const FROZEN_BIT: uint = 0x8000000000000000;
|
||||
|
||||
pub extern mod rustrt {
|
||||
#[rust_stack]
|
||||
unsafe fn rust_upcall_malloc(td: *c_char, size: uintptr_t) -> *c_char;
|
||||
pub mod rustrt {
|
||||
use libc::{c_char, uintptr_t};
|
||||
|
||||
#[rust_stack]
|
||||
unsafe fn rust_upcall_free(ptr: *c_char);
|
||||
pub extern {
|
||||
#[rust_stack]
|
||||
unsafe fn rust_upcall_malloc(td: *c_char, size: uintptr_t) -> *c_char;
|
||||
|
||||
#[rust_stack]
|
||||
unsafe fn rust_upcall_free(ptr: *c_char);
|
||||
}
|
||||
}
|
||||
|
||||
#[lang="fail_"]
|
||||
|
|
|
@ -28,16 +28,22 @@ use sys;
|
|||
use uint;
|
||||
use vec;
|
||||
|
||||
#[abi = "cdecl"]
|
||||
pub extern mod rustrt {
|
||||
// These names are terrible. reserve_shared applies
|
||||
// to ~[] and reserve_shared_actual applies to @[].
|
||||
unsafe fn vec_reserve_shared(++t: *sys::TypeDesc,
|
||||
++v: **raw::VecRepr,
|
||||
++n: libc::size_t);
|
||||
unsafe fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
|
||||
++v: **raw::VecRepr,
|
||||
++n: libc::size_t);
|
||||
pub mod rustrt {
|
||||
use libc;
|
||||
use sys;
|
||||
use vec::raw;
|
||||
|
||||
#[abi = "cdecl"]
|
||||
pub extern {
|
||||
// These names are terrible. reserve_shared applies
|
||||
// to ~[] and reserve_shared_actual applies to @[].
|
||||
unsafe fn vec_reserve_shared(++t: *sys::TypeDesc,
|
||||
++v: **raw::VecRepr,
|
||||
++n: libc::size_t);
|
||||
unsafe fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
|
||||
++v: **raw::VecRepr,
|
||||
++n: libc::size_t);
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if a vector contains no elements
|
||||
|
|
Loading…
Add table
Reference in a new issue