2010-09-01 13:24:14 -07:00
|
|
|
import util.common.span;
|
2010-11-22 16:27:00 -08:00
|
|
|
import util.common.ty_mach;
|
2010-09-01 13:24:14 -07:00
|
|
|
import std._uint;
|
2011-03-25 10:42:57 -07:00
|
|
|
import std.map;
|
2010-09-01 13:24:14 -07:00
|
|
|
|
2010-11-22 16:27:00 -08:00
|
|
|
tag os {
|
|
|
|
os_win32;
|
|
|
|
os_macos;
|
|
|
|
os_linux;
|
|
|
|
}
|
|
|
|
|
|
|
|
tag arch {
|
|
|
|
arch_x86;
|
|
|
|
arch_x64;
|
|
|
|
arch_arm;
|
|
|
|
}
|
|
|
|
|
|
|
|
type cfg = rec(os os,
|
|
|
|
arch arch,
|
|
|
|
ty_mach int_type,
|
|
|
|
ty_mach uint_type,
|
|
|
|
ty_mach float_type);
|
|
|
|
|
2011-03-25 10:42:57 -07:00
|
|
|
type crate_metadata = vec[u8];
|
|
|
|
|
|
|
|
obj session(cfg targ, map.hashmap[int, crate_metadata] crates) {
|
2010-11-22 16:27:00 -08:00
|
|
|
|
|
|
|
fn get_targ_cfg() -> cfg {
|
|
|
|
ret targ;
|
|
|
|
}
|
|
|
|
|
2010-09-23 13:15:51 -07:00
|
|
|
fn span_err(span sp, str msg) {
|
2010-10-18 16:03:22 -07:00
|
|
|
log #fmt("%s:%u:%u:%u:%u: error: %s",
|
|
|
|
sp.filename,
|
|
|
|
sp.lo.line, sp.lo.col,
|
|
|
|
sp.hi.line, sp.hi.col,
|
|
|
|
msg);
|
2010-09-01 13:24:14 -07:00
|
|
|
fail;
|
|
|
|
}
|
|
|
|
|
2010-09-23 13:15:51 -07:00
|
|
|
fn err(str msg) {
|
2010-10-18 16:03:22 -07:00
|
|
|
log #fmt("error: %s", msg);
|
2010-09-01 13:24:14 -07:00
|
|
|
fail;
|
|
|
|
}
|
2010-09-23 13:15:51 -07:00
|
|
|
|
2011-03-18 13:44:13 -07:00
|
|
|
fn span_warn(span sp, str msg) {
|
|
|
|
log #fmt("%s:%u:%u:%u:%u: warning: %s",
|
|
|
|
sp.filename,
|
|
|
|
sp.lo.line, sp.lo.col,
|
|
|
|
sp.hi.line, sp.hi.col,
|
|
|
|
msg);
|
|
|
|
}
|
|
|
|
|
2010-11-22 16:27:00 -08:00
|
|
|
fn bug(str msg) {
|
|
|
|
log #fmt("error: internal compiler error %s", msg);
|
|
|
|
fail;
|
|
|
|
}
|
|
|
|
|
2011-03-18 12:30:44 -07:00
|
|
|
fn span_unimpl(span sp, str msg) {
|
|
|
|
log #fmt("%s:%u:%u:%u:%u: error: unimplemented %s",
|
|
|
|
sp.filename,
|
|
|
|
sp.lo.line, sp.lo.col,
|
|
|
|
sp.hi.line, sp.hi.col,
|
|
|
|
msg);
|
|
|
|
fail;
|
|
|
|
}
|
|
|
|
|
2010-09-23 13:15:51 -07:00
|
|
|
fn unimpl(str msg) {
|
2010-10-18 16:03:22 -07:00
|
|
|
log #fmt("error: unimplemented %s", msg);
|
2010-09-23 13:15:51 -07:00
|
|
|
fail;
|
|
|
|
}
|
2011-03-25 10:42:57 -07:00
|
|
|
|
|
|
|
fn get_external_crate(int num) -> crate_metadata {
|
|
|
|
ret crates.get(num);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_external_crate(int num, &crate_metadata metadata) {
|
|
|
|
crates.insert(num, metadata);
|
|
|
|
}
|
2010-09-01 13:24:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Local Variables:
|
|
|
|
// 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:
|