diff options
| author | Marijn Haverbeke <[email protected]> | 2011-05-06 22:13:13 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <[email protected]> | 2011-05-06 22:51:19 +0200 |
| commit | a3ec0b1f643d00b9418e4884bd7caa07bf052201 (patch) | |
| tree | 82000510ac9c9cf3f0c7cf4ae5f3c6b123b559cb /src/comp/middle/metadata.rs | |
| parent | Register new snapshots. (diff) | |
| download | rust-a3ec0b1f643d00b9418e4884bd7caa07bf052201.tar.xz rust-a3ec0b1f643d00b9418e4884bd7caa07bf052201.zip | |
Rename std modules to be camelcased
(Have fun mergining your stuff with this.)
Diffstat (limited to 'src/comp/middle/metadata.rs')
| -rw-r--r-- | src/comp/middle/metadata.rs | 274 |
1 files changed, 137 insertions, 137 deletions
diff --git a/src/comp/middle/metadata.rs b/src/comp/middle/metadata.rs index ce37822d..f8e7a96e 100644 --- a/src/comp/middle/metadata.rs +++ b/src/comp/middle/metadata.rs @@ -1,12 +1,12 @@ -import std._str; -import std._uint; -import std._vec; -import std.map.hashmap; -import std.ebml; -import std.io; -import std.option; -import std.option.some; -import std.option.none; +import std.Str; +import std.UInt; +import std.Vec; +import std.Map.hashmap; +import std.EBML; +import std.IO; +import std.Option; +import std.Option.some; +import std.Option.none; import front.ast; import middle.fold; @@ -75,12 +75,12 @@ mod Encode { fn ty_str(@ctxt cx, ty.t t) -> str { assert (!cx_uses_abbrevs(cx)); - auto sw = io.string_writer(); + auto sw = IO.string_writer(); enc_ty(sw.get_writer(), cx, t); ret sw.get_str(); } - fn enc_ty(io.writer w, @ctxt cx, ty.t t) { + fn enc_ty(IO.writer w, @ctxt cx, ty.t t) { alt (cx.abbrevs) { case (ac_no_abbrevs) { enc_sty(w, cx, ty.struct(cx.tcx, t)); } case (ac_use_abbrevs(?abbrevs)) { @@ -109,8 +109,8 @@ mod Encode { if (abbrev_len < len) { // I.e. it's actually an abbreviation. auto s = ("#" - + _uint.to_str(pos, 16u) + ":" - + _uint.to_str(len, 16u) + "#"); + + UInt.to_str(pos, 16u) + ":" + + UInt.to_str(len, 16u) + "#"); auto a = rec(pos=pos, len=len, s=s); abbrevs.insert(t, a); } @@ -121,7 +121,7 @@ mod Encode { } } - fn enc_mt(io.writer w, @ctxt cx, &ty.mt mt) { + fn enc_mt(IO.writer w, @ctxt cx, &ty.mt mt) { alt (mt.mut) { case (ast.imm) { } case (ast.mut) { w.write_char('m'); } @@ -130,7 +130,7 @@ mod Encode { enc_ty(w, cx, mt.ty); } - fn enc_sty(io.writer w, @ctxt cx, ty.sty st) { + fn enc_sty(IO.writer w, @ctxt cx, ty.sty st) { alt (st) { case (ty.ty_nil) { w.write_char('n'); } case (ty.ty_bool) { w.write_char('b'); } @@ -231,14 +231,14 @@ mod Encode { } } - fn enc_proto(io.writer w, ast.proto proto) { + fn enc_proto(IO.writer w, ast.proto proto) { alt (proto) { case (ast.proto_iter) { w.write_char('W'); } case (ast.proto_fn) { w.write_char('F'); } } } - fn enc_ty_fn(io.writer w, @ctxt cx, vec[ty.arg] args, ty.t out) { + fn enc_ty_fn(IO.writer w, @ctxt cx, vec[ty.arg] args, ty.t out) { w.write_char('['); for (ty.arg arg in args) { if (arg.mode == ast.alias) { w.write_char('&'); } @@ -253,46 +253,46 @@ mod Encode { // Returns a Plain Old LLVM String. fn C_postr(str s) -> ValueRef { - ret llvm.LLVMConstString(_str.buf(s), _str.byte_len(s), False); + ret llvm.LLVMConstString(Str.buf(s), Str.byte_len(s), False); } // Path table encoding -fn encode_name(&ebml.writer ebml_w, str name) { - ebml.start_tag(ebml_w, tag_paths_data_name); - ebml_w.writer.write(_str.bytes(name)); - ebml.end_tag(ebml_w); +fn encode_name(&EBML.writer ebml_w, str name) { + EBML.start_tag(ebml_w, tag_paths_data_name); + ebml_w.writer.write(Str.bytes(name)); + EBML.end_tag(ebml_w); } -fn encode_def_id(&ebml.writer ebml_w, &ast.def_id id) { - ebml.start_tag(ebml_w, tag_def_id); - ebml_w.writer.write(_str.bytes(def_to_str(id))); - ebml.end_tag(ebml_w); +fn encode_def_id(&EBML.writer ebml_w, &ast.def_id id) { + EBML.start_tag(ebml_w, tag_def_id); + ebml_w.writer.write(Str.bytes(def_to_str(id))); + EBML.end_tag(ebml_w); } -fn encode_tag_variant_paths(&ebml.writer ebml_w, +fn encode_tag_variant_paths(&EBML.writer ebml_w, vec[ast.variant] variants, vec[str] path, &mutable vec[tup(str, uint)] index) { for (ast.variant variant in variants) { add_to_index(ebml_w, path, index, variant.node.name); - ebml.start_tag(ebml_w, tag_paths_data_item); + EBML.start_tag(ebml_w, tag_paths_data_item); encode_name(ebml_w, variant.node.name); encode_def_id(ebml_w, variant.node.id); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } } -fn add_to_index(&ebml.writer ebml_w, +fn add_to_index(&EBML.writer ebml_w, vec[str] path, &mutable vec[tup(str, uint)] index, str name) { auto full_path = path + vec(name); - index += vec(tup(_str.connect(full_path, "."), ebml_w.writer.tell())); + index += vec(tup(Str.connect(full_path, "."), ebml_w.writer.tell())); } -fn encode_native_module_item_paths(&ebml.writer ebml_w, +fn encode_native_module_item_paths(&EBML.writer ebml_w, &ast.native_mod nmod, vec[str] path, &mutable vec[tup(str, uint)] index) { @@ -300,23 +300,23 @@ fn encode_native_module_item_paths(&ebml.writer ebml_w, alt (nitem.node) { case (ast.native_item_ty(?id, ?did)) { add_to_index(ebml_w, path, index, id); - ebml.start_tag(ebml_w, tag_paths_data_item); + EBML.start_tag(ebml_w, tag_paths_data_item); encode_name(ebml_w, id); encode_def_id(ebml_w, did); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } case (ast.native_item_fn(?id, _, _, _, ?did, _)) { add_to_index(ebml_w, path, index, id); - ebml.start_tag(ebml_w, tag_paths_data_item); + EBML.start_tag(ebml_w, tag_paths_data_item); encode_name(ebml_w, id); encode_def_id(ebml_w, did); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } } } } -fn encode_module_item_paths(&ebml.writer ebml_w, +fn encode_module_item_paths(&EBML.writer ebml_w, &ast._mod module, vec[str] path, &mutable vec[tup(str, uint)] index) { @@ -325,197 +325,197 @@ fn encode_module_item_paths(&ebml.writer ebml_w, alt (it.node) { case (ast.item_const(?id, _, ?tps, ?did, ?ann)) { add_to_index(ebml_w, path, index, id); - ebml.start_tag(ebml_w, tag_paths_data_item); + EBML.start_tag(ebml_w, tag_paths_data_item); encode_name(ebml_w, id); encode_def_id(ebml_w, did); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } case (ast.item_fn(?id, _, ?tps, ?did, ?ann)) { add_to_index(ebml_w, path, index, id); - ebml.start_tag(ebml_w, tag_paths_data_item); + EBML.start_tag(ebml_w, tag_paths_data_item); encode_name(ebml_w, id); encode_def_id(ebml_w, did); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } case (ast.item_mod(?id, ?_mod, ?did)) { add_to_index(ebml_w, path, index, id); - ebml.start_tag(ebml_w, tag_paths_data_mod); + EBML.start_tag(ebml_w, tag_paths_data_mod); encode_name(ebml_w, id); encode_def_id(ebml_w, did); encode_module_item_paths(ebml_w, _mod, path + vec(id), index); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } case (ast.item_native_mod(?id, ?nmod, ?did)) { add_to_index(ebml_w, path, index, id); - ebml.start_tag(ebml_w, tag_paths_data_mod); + EBML.start_tag(ebml_w, tag_paths_data_mod); encode_name(ebml_w, id); encode_def_id(ebml_w, did); encode_native_module_item_paths(ebml_w, nmod, path + vec(id), index); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } case (ast.item_ty(?id, _, ?tps, ?did, ?ann)) { add_to_index(ebml_w, path, index, id); - ebml.start_tag(ebml_w, tag_paths_data_item); + EBML.start_tag(ebml_w, tag_paths_data_item); encode_name(ebml_w, id); encode_def_id(ebml_w, did); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } case (ast.item_tag(?id, ?variants, ?tps, ?did, _)) { add_to_index(ebml_w, path, index, id); - ebml.start_tag(ebml_w, tag_paths_data_item); + EBML.start_tag(ebml_w, tag_paths_data_item); encode_name(ebml_w, id); encode_def_id(ebml_w, did); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); encode_tag_variant_paths(ebml_w, variants, path, index); } case (ast.item_obj(?id, _, ?tps, ?odid, ?ann)) { add_to_index(ebml_w, path, index, id); - ebml.start_tag(ebml_w, tag_paths_data_item); + EBML.start_tag(ebml_w, tag_paths_data_item); encode_name(ebml_w, id); encode_def_id(ebml_w, odid.ctor); encode_obj_type_id(ebml_w, odid.ty); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } } } } -fn encode_item_paths(&ebml.writer ebml_w, @ast.crate crate) +fn encode_item_paths(&EBML.writer ebml_w, @ast.crate crate) -> vec[tup(str, uint)] { let vec[tup(str, uint)] index = vec(); let vec[str] path = vec(); - ebml.start_tag(ebml_w, tag_paths); + EBML.start_tag(ebml_w, tag_paths); encode_module_item_paths(ebml_w, crate.node.module, path, index); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); ret index; } // Item info table encoding -fn encode_kind(&ebml.writer ebml_w, u8 c) { - ebml.start_tag(ebml_w, tag_items_data_item_kind); +fn encode_kind(&EBML.writer ebml_w, u8 c) { + EBML.start_tag(ebml_w, tag_items_data_item_kind); ebml_w.writer.write(vec(c)); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } fn def_to_str(ast.def_id did) -> str { ret #fmt("%d:%d", did._0, did._1); } -fn encode_type_param_count(&ebml.writer ebml_w, vec[ast.ty_param] tps) { - ebml.start_tag(ebml_w, tag_items_data_item_ty_param_count); - ebml.write_vint(ebml_w.writer, _vec.len[ast.ty_param](tps)); - ebml.end_tag(ebml_w); +fn encode_type_param_count(&EBML.writer ebml_w, vec[ast.ty_param] tps) { + EBML.start_tag(ebml_w, tag_items_data_item_ty_param_count); + EBML.write_vint(ebml_w.writer, Vec.len[ast.ty_param](tps)); + EBML.end_tag(ebml_w); } -fn encode_variant_id(&ebml.writer ebml_w, ast.def_id vid) { - ebml.start_tag(ebml_w, tag_items_data_item_variant); - ebml_w.writer.write(_str.bytes(def_to_str(vid))); - ebml.end_tag(ebml_w); +fn encode_variant_id(&EBML.writer ebml_w, ast.def_id vid) { + EBML.start_tag(ebml_w, tag_items_data_item_variant); + ebml_w.writer.write(Str.bytes(def_to_str(vid))); + EBML.end_tag(ebml_w); } -fn encode_type(@trans.crate_ctxt cx, &ebml.writer ebml_w, ty.t typ) { - ebml.start_tag(ebml_w, tag_items_data_item_type); +fn encode_type(@trans.crate_ctxt cx, &EBML.writer ebml_w, ty.t typ) { + EBML.start_tag(ebml_w, tag_items_data_item_type); auto f = def_to_str; auto ty_str_ctxt = @rec(ds=f, tcx=cx.tcx, abbrevs=ac_use_abbrevs(cx.type_abbrevs)); - Encode.enc_ty(io.new_writer_(ebml_w.writer), ty_str_ctxt, typ); - ebml.end_tag(ebml_w); + Encode.enc_ty(IO.new_writer_(ebml_w.writer), ty_str_ctxt, typ); + EBML.end_tag(ebml_w); } -fn encode_symbol(@trans.crate_ctxt cx, &ebml.writer ebml_w, ast.def_id did) { - ebml.start_tag(ebml_w, tag_items_data_item_symbol); - ebml_w.writer.write(_str.bytes(cx.item_symbols.get(did))); - ebml.end_tag(ebml_w); +fn encode_symbol(@trans.crate_ctxt cx, &EBML.writer ebml_w, ast.def_id did) { + EBML.start_tag(ebml_w, tag_items_data_item_symbol); + ebml_w.writer.write(Str.bytes(cx.item_symbols.get(did))); + EBML.end_tag(ebml_w); } -fn encode_discriminant(@trans.crate_ctxt cx, &ebml.writer ebml_w, +fn encode_discriminant(@trans.crate_ctxt cx, &EBML.writer ebml_w, ast.def_id did) { - ebml.start_tag(ebml_w, tag_items_data_item_symbol); - ebml_w.writer.write(_str.bytes(cx.discrim_symbols.get(did))); - ebml.end_tag(ebml_w); + EBML.start_tag(ebml_w, tag_items_data_item_symbol); + ebml_w.writer.write(Str.bytes(cx.discrim_symbols.get(did))); + EBML.end_tag(ebml_w); } -fn encode_tag_id(&ebml.writer ebml_w, &ast.def_id id) { - ebml.start_tag(ebml_w, tag_items_data_item_tag_id); - ebml_w.writer.write(_str.bytes(def_to_str(id))); - ebml.end_tag(ebml_w); +fn encode_tag_id(&EBML.writer ebml_w, &ast.def_id id) { + EBML.start_tag(ebml_w, tag_items_data_item_tag_id); + ebml_w.writer.write(Str.bytes(def_to_str(id))); + EBML.end_tag(ebml_w); } -fn encode_obj_type_id(&ebml.writer ebml_w, &ast.def_id id) { - ebml.start_tag(ebml_w, tag_items_data_item_obj_type_id); - ebml_w.writer.write(_str.bytes(def_to_str(id))); - ebml.end_tag(ebml_w); +fn encode_obj_type_id(&EBML.writer ebml_w, &ast.def_id id) { + EBML.start_tag(ebml_w, tag_items_data_item_obj_type_id); + ebml_w.writer.write(Str.bytes(def_to_str(id))); + EBML.end_tag(ebml_w); } -fn encode_tag_variant_info(@trans.crate_ctxt cx, &ebml.writer ebml_w, +fn encode_tag_variant_info(@trans.crate_ctxt cx, &EBML.writer ebml_w, ast.def_id did, vec[ast.variant] variants, &mutable vec[tup(int, uint)] index, vec[ast.ty_param] ty_params) { for (ast.variant variant in variants) { index += vec(tup(variant.node.id._1, ebml_w.writer.tell())); - ebml.start_tag(ebml_w, tag_items_data_item); + EBML.start_tag(ebml_w, tag_items_data_item); encode_def_id(ebml_w, variant.node.id); encode_kind(ebml_w, 'v' as u8); encode_tag_id(ebml_w, did); encode_type(cx, ebml_w, trans.node_ann_type(cx, variant.node.ann)); - if (_vec.len[ast.variant_arg](variant.node.args) > 0u) { + if (Vec.len[ast.variant_arg](variant.node.args) > 0u) { encode_symbol(cx, ebml_w, variant.node.id); } encode_discriminant(cx, ebml_w, variant.node.id); encode_type_param_count(ebml_w, ty_params); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } } -fn encode_info_for_item(@trans.crate_ctxt cx, &ebml.writer ebml_w, +fn encode_info_for_item(@trans.crate_ctxt cx, &EBML.writer ebml_w, @ast.item item, &mutable vec[tup(int, uint)] index) { alt (item.node) { case (ast.item_const(_, _, _, ?did, ?ann)) { - ebml.start_tag(ebml_w, tag_items_data_item); + EBML.start_tag(ebml_w, tag_items_data_item); encode_def_id(ebml_w, did); encode_kind(ebml_w, 'c' as u8); encode_type(cx, ebml_w, trans.node_ann_type(cx, ann)); encode_symbol(cx, ebml_w, did); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } case (ast.item_fn(_, _, ?tps, ?did, ?ann)) { - ebml.start_tag(ebml_w, tag_items_data_item); + EBML.start_tag(ebml_w, tag_items_data_item); encode_def_id(ebml_w, did); encode_kind(ebml_w, 'f' as u8); encode_type_param_count(ebml_w, tps); encode_type(cx, ebml_w, trans.node_ann_type(cx, ann)); encode_symbol(cx, ebml_w, did); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } case (ast.item_mod(_, _, ?did)) { - ebml.start_tag(ebml_w, tag_items_data_item); + EBML.start_tag(ebml_w, tag_items_data_item); encode_def_id(ebml_w, did); encode_kind(ebml_w, 'm' as u8); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } case (ast.item_native_mod(_, _, ?did)) { - ebml.start_tag(ebml_w, tag_items_data_item); + EBML.start_tag(ebml_w, tag_items_data_item); encode_def_id(ebml_w, did); encode_kind(ebml_w, 'n' as u8); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } case (ast.item_ty(?id, _, ?tps, ?did, ?ann)) { - ebml.start_tag(ebml_w, tag_items_data_item); + EBML.start_tag(ebml_w, tag_items_data_item); encode_def_id(ebml_w, did); encode_kind(ebml_w, 'y' as u8); encode_type_param_count(ebml_w, tps); encode_type(cx, ebml_w, trans.node_ann_type(cx, ann)); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } case (ast.item_tag(?id, ?variants, ?tps, ?did, ?ann)) { - ebml.start_tag(ebml_w, tag_items_data_item); + EBML.start_tag(ebml_w, tag_items_data_item); encode_def_id(ebml_w, did); encode_kind(ebml_w, 't' as u8); encode_type_param_count(ebml_w, tps); @@ -523,33 +523,33 @@ fn encode_info_for_item(@trans.crate_ctxt cx, &ebml.writer ebml_w, for (ast.variant v in variants) { encode_variant_id(ebml_w, v.node.id); } - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); encode_tag_variant_info(cx, ebml_w, did, variants, index, tps); } case (ast.item_obj(?id, _, ?tps, ?odid, ?ann)) { - ebml.start_tag(ebml_w, tag_items_data_item); + EBML.start_tag(ebml_w, tag_items_data_item); encode_def_id(ebml_w, odid.ctor); encode_kind(ebml_w, 'o' as u8); encode_type_param_count(ebml_w, tps); auto fn_ty = trans.node_ann_type(cx, ann); encode_type(cx, ebml_w, fn_ty); encode_symbol(cx, ebml_w, odid.ctor); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); - ebml.start_tag(ebml_w, tag_items_data_item); + EBML.start_tag(ebml_w, tag_items_data_item); encode_def_id(ebml_w, odid.ty); encode_kind(ebml_w, 'y' as u8); encode_type_param_count(ebml_w, tps); encode_type(cx, ebml_w, ty.ty_fn_ret(cx.tcx, fn_ty)); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } } } -fn encode_info_for_native_item(@trans.crate_ctxt cx, &ebml.writer ebml_w, +fn encode_info_for_native_item(@trans.crate_ctxt cx, &EBML.writer ebml_w, @ast.native_item nitem) { - ebml.start_tag(ebml_w, tag_items_data_item); + EBML.start_tag(ebml_w, tag_items_data_item); alt (nitem.node) { case (ast.native_item_ty(_, ?did)) { encode_def_id(ebml_w, did); @@ -564,14 +564,14 @@ fn encode_info_for_native_item(@trans.crate_ctxt cx, &ebml.writer ebml_w, encode_symbol(cx, ebml_w, did); } } - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } -fn encode_info_for_items(@trans.crate_ctxt cx, &ebml.writer ebml_w) +fn encode_info_for_items(@trans.crate_ctxt cx, &EBML.writer ebml_w) -> vec[tup(int, uint)] { let vec[tup(int, uint)] index = vec(); - ebml.start_tag(ebml_w, tag_items_data); + EBML.start_tag(ebml_w, tag_items_data); for each (@tup(ast.def_id, @ast.item) kvp in cx.items.items()) { index += vec(tup(kvp._0._1, ebml_w.writer.tell())); encode_info_for_item(cx, ebml_w, kvp._1, index); @@ -581,7 +581,7 @@ fn encode_info_for_items(@trans.crate_ctxt cx, &ebml.writer ebml_w) index += vec(tup(kvp._0._1, ebml_w.writer.tell())); encode_info_for_native_item(cx, ebml_w, kvp._1); } - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); ret index; } @@ -597,7 +597,7 @@ fn hash_def_num(&int def_num) -> uint { fn hash_path(&str s) -> uint { auto h = 5381u; - for (u8 ch in _str.bytes(s)) { + for (u8 ch in Str.bytes(s)) { h = ((h << 5u) + h) ^ (ch as uint); } ret h; @@ -606,7 +606,7 @@ fn hash_path(&str s) -> uint { fn create_index[T](vec[tup(T, uint)] index, fn(&T) -> uint hash_fn) -> vec[vec[tup(T, uint)]] { let vec[vec[tup(T, uint)]] buckets = vec(); - for each (uint i in _uint.range(0u, 256u)) { + for each (uint i in UInt.range(0u, 256u)) { let vec[tup(T, uint)] bucket = vec(); buckets += vec(bucket); } @@ -619,69 +619,69 @@ fn create_index[T](vec[tup(T, uint)] index, fn(&T) -> uint hash_fn) ret buckets; } -fn encode_index[T](&ebml.writer ebml_w, vec[vec[tup(T, uint)]] buckets, - fn(io.writer, &T) write_fn) { - auto writer = io.new_writer_(ebml_w.writer); +fn encode_index[T](&EBML.writer ebml_w, vec[vec[tup(T, uint)]] buckets, + fn(IO.writer, &T) write_fn) { + auto writer = IO.new_writer_(ebml_w.writer); - ebml.start_tag(ebml_w, tag_index); + EBML.start_tag(ebml_w, tag_index); let vec[uint] bucket_locs = vec(); - ebml.start_tag(ebml_w, tag_index_buckets); + EBML.start_tag(ebml_w, tag_index_buckets); for (vec[tup(T, uint)] bucket in buckets) { bucket_locs += vec(ebml_w.writer.tell()); - ebml.start_tag(ebml_w, tag_index_buckets_bucket); + EBML.start_tag(ebml_w, tag_index_buckets_bucket); for (tup(T, uint) elt in bucket) { - ebml.start_tag(ebml_w, tag_index_buckets_bucket_elt); + EBML.start_tag(ebml_w, tag_index_buckets_bucket_elt); writer.write_be_uint(elt._1, 4u); write_fn(writer, elt._0); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); - ebml.start_tag(ebml_w, tag_index_table); + EBML.start_tag(ebml_w, tag_index_table); for (uint pos in bucket_locs) { writer.write_be_uint(pos, 4u); } - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); } -fn write_str(io.writer writer, &str s) { +fn write_str(IO.writer writer, &str s) { writer.write_str(s); } -fn write_int(io.writer writer, &int n) { +fn write_int(IO.writer writer, &int n) { writer.write_be_uint(n as uint, 4u); } fn encode_metadata(@trans.crate_ctxt cx, @ast.crate crate) -> ValueRef { - auto string_w = io.string_writer(); + auto string_w = IO.string_writer(); auto buf_w = string_w.get_writer().get_buf_writer(); - auto ebml_w = ebml.create_writer(buf_w); + auto ebml_w = EBML.create_writer(buf_w); // Encode and index the paths. - ebml.start_tag(ebml_w, tag_paths); + EBML.start_tag(ebml_w, tag_paths); auto paths_index = encode_item_paths(ebml_w, crate); auto str_writer = write_str; auto path_hasher = hash_path; auto paths_buckets = create_index[str](paths_index, path_hasher); encode_index[str](ebml_w, paths_buckets, str_writer); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); // Encode and index the items. - ebml.start_tag(ebml_w, tag_items); + EBML.start_tag(ebml_w, tag_items); auto items_index = encode_info_for_items(cx, ebml_w); auto int_writer = write_int; auto item_hasher = hash_def_num; auto items_buckets = create_index[int](items_index, item_hasher); encode_index[int](ebml_w, items_buckets, int_writer); - ebml.end_tag(ebml_w); + EBML.end_tag(ebml_w); // Pad this, since something (LLVM, presumably) is cutting off the // remaining % 4 bytes. @@ -698,9 +698,9 @@ fn write_metadata(@trans.crate_ctxt cx, @ast.crate crate) { auto llconst = trans.C_struct(vec(llmeta)); auto llglobal = llvm.LLVMAddGlobal(cx.llmod, trans.val_ty(llconst), - _str.buf("rust_metadata")); + Str.buf("rust_metadata")); llvm.LLVMSetInitializer(llglobal, llconst); - llvm.LLVMSetSection(llglobal, _str.buf(x86.get_meta_sect_name())); + llvm.LLVMSetSection(llglobal, Str.buf(x86.get_meta_sect_name())); } // |