aa25f22f19
This giant commit changes the syntax of Rust to use "assert" for "check" expressions that didn't mean anything to the typestate system, and continue using "check" for checks that are used as part of typestate checking. Most of the changes are just replacing "check" with "assert" in test cases and rustc.
31 lines
761 B
Rust
31 lines
761 B
Rust
native "rust" mod rustrt {
|
|
fn rust_dirent_filename(os.libc.dirent ent) -> str;
|
|
}
|
|
|
|
fn list_dir(str path) -> vec[str] {
|
|
// TODO ensure this is always closed
|
|
auto dir = os.libc.opendir(_str.buf(path));
|
|
assert (dir as uint != 0u);
|
|
let vec[str] result = vec();
|
|
while (true) {
|
|
auto ent = os.libc.readdir(dir);
|
|
if (ent as int == 0) {
|
|
os.libc.closedir(dir);
|
|
ret result;
|
|
}
|
|
_vec.push[str](result, rustrt.rust_dirent_filename(ent));
|
|
}
|
|
os.libc.closedir(dir);
|
|
ret result;
|
|
}
|
|
|
|
const char path_sep = '/';
|
|
|
|
// Local Variables:
|
|
// mode: rust;
|
|
// fill-column: 78;
|
|
// indent-tabs-mode: nil
|
|
// c-basic-offset: 4
|
|
// buffer-file-coding-system: utf-8-unix
|
|
// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
|
|
// End:
|