Remove all usages of std::vec::vbuf
This commit is contained in:
parent
f9db0390f9
commit
3d1634db15
@ -1,5 +1,4 @@
|
||||
import str::sbuf;
|
||||
import vec::vbuf;
|
||||
|
||||
native "rust" mod rustrt {
|
||||
type socket;
|
||||
|
@ -63,7 +63,7 @@ obj FILE_buf_reader(f: os::libc::FILE, res: option::t[@FILE_res]) {
|
||||
fn read(len: uint) -> [u8] {
|
||||
let buf = ~[];
|
||||
ivec::reserve[u8](buf, len);
|
||||
let read = os::libc_ivec::fread(ivec::to_ptr[u8](buf), 1u, len, f);
|
||||
let read = os::libc::fread(ivec::to_ptr[u8](buf), 1u, len, f);
|
||||
ivec::unsafe::set_len[u8](buf, read);
|
||||
ret buf;
|
||||
}
|
||||
@ -247,7 +247,7 @@ obj FILE_writer(f: os::libc::FILE, res: option::t[@FILE_res]) {
|
||||
fn write(v: &[u8]) {
|
||||
let len = ivec::len[u8](v);
|
||||
let vbuf = ivec::to_ptr[u8](v);
|
||||
let nout = os::libc_ivec::fwrite(vbuf, len, 1u, f);
|
||||
let nout = os::libc::fwrite(vbuf, len, 1u, f);
|
||||
if nout < 1u { log_err "error dumping buffer"; }
|
||||
}
|
||||
fn seek(offset: int, whence: seek_style) {
|
||||
@ -269,7 +269,7 @@ obj fd_buf_writer(fd: int, res: option::t[@fd_res]) {
|
||||
let vbuf;
|
||||
while count < len {
|
||||
vbuf = ptr::offset(ivec::to_ptr[u8](v), count);
|
||||
let nout = os::libc_ivec::write(fd, vbuf, len);
|
||||
let nout = os::libc::write(fd, vbuf, len);
|
||||
if nout < 0 {
|
||||
log_err "error dumping buffer";
|
||||
log_err sys::rustrt::last_os_error();
|
||||
|
@ -1,14 +1,15 @@
|
||||
|
||||
import str::sbuf;
|
||||
import vec::vbuf;
|
||||
|
||||
|
||||
// FIXME Somehow merge stuff duplicated here and macosx_os.rs. Made difficult
|
||||
// by https://github.com/graydon/rust/issues#issue/268
|
||||
native "cdecl" mod libc = "" {
|
||||
fn read(fd: int, buf: *u8, count: uint) -> int;
|
||||
fn write(fd: int, buf: *u8, count: uint) -> int;
|
||||
fn fread(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
|
||||
fn fwrite(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
|
||||
fn open(s: sbuf, flags: int, mode: uint) -> int;
|
||||
fn read(fd: int, buf: vbuf, count: uint) -> int;
|
||||
fn write(fd: int, buf: vbuf, count: uint) -> int;
|
||||
fn close(fd: int) -> int;
|
||||
type FILE;
|
||||
fn fopen(path: sbuf, mode: sbuf) -> FILE;
|
||||
@ -17,8 +18,6 @@ native "cdecl" mod libc = "" {
|
||||
fn fgetc(f: FILE) -> int;
|
||||
fn ungetc(c: int, f: FILE);
|
||||
fn feof(f: FILE) -> int;
|
||||
fn fread(buf: vbuf, size: uint, n: uint, f: FILE) -> uint;
|
||||
fn fwrite(buf: vbuf, size: uint, n: uint, f: FILE) -> uint;
|
||||
fn fseek(f: FILE, offset: int, whence: int) -> int;
|
||||
fn ftell(f: FILE) -> int;
|
||||
type dir;
|
||||
@ -33,13 +32,6 @@ native "cdecl" mod libc = "" {
|
||||
fn waitpid(pid: int, status: &mutable int, options: int) -> int;
|
||||
}
|
||||
|
||||
native "cdecl" mod libc_ivec = "" {
|
||||
fn read(fd: int, buf: *u8, count: uint) -> int;
|
||||
fn write(fd: int, buf: *u8, count: uint) -> int;
|
||||
fn fread(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
|
||||
fn fwrite(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
|
||||
}
|
||||
|
||||
mod libc_constants {
|
||||
fn O_RDONLY() -> int { ret 0; }
|
||||
fn O_WRONLY() -> int { ret 1; }
|
||||
|
@ -1,11 +1,12 @@
|
||||
|
||||
import str::sbuf;
|
||||
import vec::vbuf;
|
||||
|
||||
native "cdecl" mod libc = "" {
|
||||
fn read(fd: int, buf: *u8, count: uint) -> int;
|
||||
fn write(fd: int, buf: *u8, count: uint) -> int;
|
||||
fn fread(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
|
||||
fn fwrite(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
|
||||
fn open(s: sbuf, flags: int, mode: uint) -> int;
|
||||
fn read(fd: int, buf: vbuf, count: uint) -> int;
|
||||
fn write(fd: int, buf: vbuf, count: uint) -> int;
|
||||
fn close(fd: int) -> int;
|
||||
type FILE;
|
||||
fn fopen(path: sbuf, mode: sbuf) -> FILE;
|
||||
@ -14,8 +15,6 @@ native "cdecl" mod libc = "" {
|
||||
fn fgetc(f: FILE) -> int;
|
||||
fn ungetc(c: int, f: FILE);
|
||||
fn feof(f: FILE) -> int;
|
||||
fn fread(buf: vbuf, size: uint, n: uint, f: FILE) -> uint;
|
||||
fn fwrite(buf: vbuf, size: uint, n: uint, f: FILE) -> uint;
|
||||
fn fseek(f: FILE, offset: int, whence: int) -> int;
|
||||
fn ftell(f: FILE) -> int;
|
||||
type dir;
|
||||
@ -30,13 +29,6 @@ native "cdecl" mod libc = "" {
|
||||
fn waitpid(pid: int, status: &mutable int, options: int) -> int;
|
||||
}
|
||||
|
||||
native "cdecl" mod libc_ivec = "" {
|
||||
fn read(fd: int, buf: *u8, count: uint) -> int;
|
||||
fn write(fd: int, buf: *u8, count: uint) -> int;
|
||||
fn fread(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
|
||||
fn fwrite(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
|
||||
}
|
||||
|
||||
mod libc_constants {
|
||||
fn O_RDONLY() -> int { ret 0; }
|
||||
fn O_WRONLY() -> int { ret 1; }
|
||||
|
@ -1,6 +1,5 @@
|
||||
|
||||
import str::sbuf;
|
||||
import vec::vbuf;
|
||||
|
||||
export program;
|
||||
export run_program;
|
||||
|
@ -1,11 +1,12 @@
|
||||
|
||||
import str::sbuf;
|
||||
import vec::vbuf;
|
||||
|
||||
native "cdecl" mod libc = "" {
|
||||
fn read(fd: int, buf: *u8, count: uint) -> int;
|
||||
fn write(fd: int, buf: *u8, count: uint) -> int;
|
||||
fn fread(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
|
||||
fn fwrite(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
|
||||
fn open(s: sbuf, flags: int, mode: uint) -> int = "_open";
|
||||
fn read(fd: int, buf: vbuf, count: uint) -> int = "_read";
|
||||
fn write(fd: int, buf: vbuf, count: uint) -> int = "_write";
|
||||
fn close(fd: int) -> int = "_close";
|
||||
type FILE;
|
||||
fn fopen(path: sbuf, mode: sbuf) -> FILE;
|
||||
@ -14,20 +15,11 @@ native "cdecl" mod libc = "" {
|
||||
fn fgetc(f: FILE) -> int;
|
||||
fn ungetc(c: int, f: FILE);
|
||||
fn feof(f: FILE) -> int;
|
||||
fn fread(buf: vbuf, size: uint, n: uint, f: FILE) -> uint;
|
||||
fn fwrite(buf: vbuf, size: uint, n: uint, f: FILE) -> uint;
|
||||
fn fseek(f: FILE, offset: int, whence: int) -> int;
|
||||
fn ftell(f: FILE) -> int;
|
||||
fn _pipe(fds: *mutable int, size: uint, mode: int) -> int;
|
||||
}
|
||||
|
||||
native "cdecl" mod libc_ivec = "" {
|
||||
fn read(fd: int, buf: *u8, count: uint) -> int;
|
||||
fn write(fd: int, buf: *u8, count: uint) -> int;
|
||||
fn fread(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
|
||||
fn fwrite(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
|
||||
}
|
||||
|
||||
mod libc_constants {
|
||||
fn O_RDONLY() -> int { ret 0; }
|
||||
fn O_WRONLY() -> int { ret 1; }
|
||||
|
@ -186,10 +186,10 @@ mod test_native_items {
|
||||
#[attr];
|
||||
|
||||
#[attr]
|
||||
type vbuf;
|
||||
type sbuf;
|
||||
|
||||
#[attr]
|
||||
fn vec_len[T](v: vec[T]) -> uint;
|
||||
fn str_buf(s: str) -> sbuf;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
|
||||
native "rust" mod rustrt {
|
||||
type vbuf;
|
||||
fn vec_buf[T](v: vec[T], offset: uint) -> vbuf;
|
||||
type sbuf;
|
||||
fn str_buf(s: str) -> sbuf;
|
||||
}
|
||||
|
||||
native "rust" mod bar = "" { }
|
||||
@ -10,7 +10,7 @@ native "rust" mod bar = "" { }
|
||||
native "cdecl" mod zed = "" { }
|
||||
|
||||
native "cdecl" mod libc = "" {
|
||||
fn write(fd: int, buf: rustrt::vbuf, count: uint) -> int;
|
||||
fn write(fd: int, buf: *u8, count: uint) -> int;
|
||||
}
|
||||
|
||||
native "cdecl" mod baz = "" { }
|
||||
|
Loading…
x
Reference in New Issue
Block a user