1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
import front.ast;
import util.common.span;
import util.common.ty_mach;
import std._uint;
import std.map;
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);
type crate_metadata = vec[u8];
obj session(ast.crate_num cnum, cfg targ,
map.hashmap[int, crate_metadata] crates) {
fn get_targ_cfg() -> cfg {
ret targ;
}
fn get_targ_crate_num() -> ast.crate_num {
ret cnum;
}
fn span_err(span sp, str msg) {
log #fmt("%s:%u:%u:%u:%u: error: %s",
sp.filename,
sp.lo.line, sp.lo.col,
sp.hi.line, sp.hi.col,
msg);
fail;
}
fn err(str msg) {
log #fmt("error: %s", msg);
fail;
}
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);
}
fn bug(str msg) {
log #fmt("error: internal compiler error %s", msg);
fail;
}
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;
}
fn unimpl(str msg) {
log #fmt("error: unimplemented %s", msg);
fail;
}
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);
}
fn has_external_crate(int num) -> bool {
ret crates.contains_key(num);
}
}
// 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 $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
// End:
|