mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
fuzzer: Begin writing main
This commit is contained in:
parent
01c13a3878
commit
699986d192
@ -1,3 +1,69 @@
|
||||
import std::fs;
|
||||
import std::getopts;
|
||||
import std::getopts::optopt;
|
||||
import std::getopts::opt_present;
|
||||
import std::getopts::opt_str;
|
||||
import std::io;
|
||||
import std::vec;
|
||||
|
||||
import rustc::front::ast;
|
||||
|
||||
type src_gen = iter() -> str;
|
||||
|
||||
iter dir_src_gen(str dir) -> str {
|
||||
}
|
||||
|
||||
fn usage(str binary) {
|
||||
io::stdout().write_line("usage");
|
||||
}
|
||||
|
||||
type session = rec(str srcdir);
|
||||
|
||||
fn make_session(vec[str] args) -> session {
|
||||
// Directory of rust source files to use as input
|
||||
auto opt_src = "src";
|
||||
|
||||
auto binary = vec::shift[str](args);
|
||||
auto opts = [optopt(opt_src)];
|
||||
auto match;
|
||||
alt (getopts::getopts(args, opts)) {
|
||||
case (getopts::failure(?f)) {
|
||||
log_err #fmt("error: %s", getopts::fail_str(f));
|
||||
fail;
|
||||
}
|
||||
case (getopts::success(?m)) {
|
||||
match = m;
|
||||
}
|
||||
};
|
||||
|
||||
if (!opt_present(match, opt_src)) {
|
||||
usage(binary);
|
||||
fail;
|
||||
}
|
||||
|
||||
auto srcdir = opt_str(match, opt_src);
|
||||
|
||||
ret rec(srcdir = srcdir);
|
||||
}
|
||||
|
||||
fn log_session(session sess) {
|
||||
log #fmt("srcdir: %s", sess.srcdir);
|
||||
}
|
||||
|
||||
fn run_session(session sess) {
|
||||
}
|
||||
|
||||
fn main(vec[str] args) {
|
||||
rustc::driver::rustc::main(args);
|
||||
}
|
||||
auto sess = make_session(args);
|
||||
log_session(sess);
|
||||
run_session(sess);
|
||||
}
|
||||
|
||||
// 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 $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
|
||||
// End:
|
||||
|
Loading…
Reference in New Issue
Block a user