Skip to content

Commit a3ec0b1

Browse files
committed
Rename std modules to be camelcased
(Have fun mergining your stuff with this.)
1 parent 44c1621 commit a3ec0b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+2150
-2151
lines changed

src/comp/back/Link.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import driver.session;
22
import lib.llvm.llvm;
33
import middle.trans;
4-
import std._str;
5-
import std.fs;
4+
import std.Str;
5+
import std.FS;
66

77
import lib.llvm.llvm.ModuleRef;
88
import lib.llvm.llvm.ValueRef;
@@ -19,14 +19,14 @@ tag output_type {
1919
}
2020

2121
fn llvm_err(session.session sess, str msg) {
22-
sess.err(msg + ": " + _str.str_from_cstr(llvm.LLVMRustGetLastError()));
22+
sess.err(msg + ": " + Str.str_from_cstr(llvm.LLVMRustGetLastError()));
2323
fail;
2424
}
2525

2626
fn link_intrinsics(session.session sess, ModuleRef llmod) {
27-
auto path = fs.connect(sess.get_opts().sysroot, "intrinsics.bc");
27+
auto path = FS.connect(sess.get_opts().sysroot, "intrinsics.bc");
2828
auto membuf =
29-
llvm.LLVMRustCreateMemoryBufferWithContentsOfFile(_str.buf(path));
29+
llvm.LLVMRustCreateMemoryBufferWithContentsOfFile(Str.buf(path));
3030
if ((membuf as uint) == 0u) {
3131
llvm_err(sess, "installation problem: couldn't open intrinstics.bc");
3232
fail;
@@ -58,12 +58,12 @@ mod Write {
5858
// Decides what to call an intermediate file, given the name of the output
5959
// and the extension to use.
6060
fn mk_intermediate_name(str output_path, str extension) -> str {
61-
auto dot_pos = _str.index(output_path, '.' as u8);
61+
auto dot_pos = Str.index(output_path, '.' as u8);
6262
auto stem;
6363
if (dot_pos < 0) {
6464
stem = output_path;
6565
} else {
66-
stem = _str.substr(output_path, 0u, dot_pos as uint);
66+
stem = Str.substr(output_path, 0u, dot_pos as uint);
6767
}
6868
ret stem + "." + extension;
6969
}
@@ -86,12 +86,12 @@ mod Write {
8686
auto filename = mk_intermediate_name(output,
8787
"no-opt.bc");
8888
llvm.LLVMWriteBitcodeToFile(llmod,
89-
_str.buf(filename));
89+
Str.buf(filename));
9090
}
9191
}
9292
case (_) {
9393
auto filename = mk_intermediate_name(output, "bc");
94-
llvm.LLVMWriteBitcodeToFile(llmod, _str.buf(filename));
94+
llvm.LLVMWriteBitcodeToFile(llmod, Str.buf(filename));
9595
}
9696
}
9797
}
@@ -183,23 +183,23 @@ mod Write {
183183
"opt.bc");
184184
llvm.LLVMRunPassManager(pm.llpm, llmod);
185185
llvm.LLVMWriteBitcodeToFile(llmod,
186-
_str.buf(filename));
186+
Str.buf(filename));
187187
pm = mk_pass_manager();
188188
}
189189
}
190190
}
191191

192192
llvm.LLVMRustWriteOutputFile(pm.llpm, llmod,
193-
_str.buf(x86.get_target_triple()),
194-
_str.buf(output),
193+
Str.buf(x86.get_target_triple()),
194+
Str.buf(output),
195195
FileType);
196196
llvm.LLVMDisposeModule(llmod);
197197
ret;
198198
}
199199

200200
llvm.LLVMRunPassManager(pm.llpm, llmod);
201201

202-
llvm.LLVMWriteBitcodeToFile(llmod, _str.buf(output));
202+
llvm.LLVMWriteBitcodeToFile(llmod, Str.buf(output));
203203
llvm.LLVMDisposeModule(llmod);
204204
}
205205
}

src/comp/back/x86.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import lib.llvm.llvm;
22
import lib.llvm.llvm.ModuleRef;
3-
import std._str;
4-
import std._vec;
5-
import std.os.target_os;
3+
import std.Str;
4+
import std.Vec;
5+
import std.OS.target_os;
66
import util.common.istr;
77

88
const int wordsz = 4;
@@ -241,7 +241,7 @@ fn native_glue(int n_args, abi.native_glue_type ngt) -> vec[str] {
241241
}
242242
auto m = vec("movl " + src_off + "(%ebp),%eax",
243243
"movl %eax," + dst_off + "(%esp)");
244-
ret _str.connect(m, "\n\t");
244+
ret Str.connect(m, "\n\t");
245245
}
246246

247247
auto carg = bind copy_arg(pass_task, _);
@@ -259,7 +259,7 @@ fn native_glue(int n_args, abi.native_glue_type ngt) -> vec[str] {
259259
+ vec("subl $" + wstr(n_args) + ", %esp # esp -= args",
260260
"andl $~0xf, %esp # align esp down")
261261

262-
+ _vec.init_fn[str](carg, (n_args) as uint)
262+
+ Vec.init_fn[str](carg, (n_args) as uint)
263263

264264
+ vec("movl %edx, %edi # save task from edx to edi",
265265
"call *%ecx # call *%ecx",
@@ -278,7 +278,7 @@ fn decl_glue(int align, str prefix, str name, vec[str] insns) -> str {
278278
ret "\t.globl " + sym + "\n" +
279279
"\t.balign " + istr(align) + "\n" +
280280
sym + ":\n" +
281-
"\t" + _str.connect(insns, "\n\t");
281+
"\t" + Str.connect(insns, "\n\t");
282282
}
283283

284284

@@ -291,8 +291,8 @@ fn decl_native_glue(int align, str prefix, abi.native_glue_type ngt, uint n)
291291
}
292292

293293
fn get_symbol_prefix() -> str {
294-
if (_str.eq(target_os(), "macos") ||
295-
_str.eq(target_os(), "win32")) {
294+
if (Str.eq(target_os(), "macos") ||
295+
Str.eq(target_os(), "win32")) {
296296
ret "_";
297297
} else {
298298
ret "";
@@ -313,44 +313,44 @@ fn get_module_asm() -> str {
313313
abi.yield_glue_name(),
314314
rust_yield_glue()))
315315

316-
+ _vec.init_fn[str](bind decl_native_glue(align, prefix,
316+
+ Vec.init_fn[str](bind decl_native_glue(align, prefix,
317317
abi.ngt_rust, _), (abi.n_native_glues + 1) as uint)
318-
+ _vec.init_fn[str](bind decl_native_glue(align, prefix,
318+
+ Vec.init_fn[str](bind decl_native_glue(align, prefix,
319319
abi.ngt_pure_rust, _), (abi.n_native_glues + 1) as uint)
320-
+ _vec.init_fn[str](bind decl_native_glue(align, prefix,
320+
+ Vec.init_fn[str](bind decl_native_glue(align, prefix,
321321
abi.ngt_cdecl, _), (abi.n_native_glues + 1) as uint);
322322

323323

324-
ret _str.connect(glues, "\n\n");
324+
ret Str.connect(glues, "\n\n");
325325
}
326326

327327
fn get_meta_sect_name() -> str {
328-
if (_str.eq(target_os(), "macos")) {
328+
if (Str.eq(target_os(), "macos")) {
329329
ret "__DATA,__note.rustc";
330330
}
331-
if (_str.eq(target_os(), "win32")) {
331+
if (Str.eq(target_os(), "win32")) {
332332
ret ".note.rustc";
333333
}
334334
ret ".note.rustc";
335335
}
336336

337337
fn get_data_layout() -> str {
338-
if (_str.eq(target_os(), "macos")) {
338+
if (Str.eq(target_os(), "macos")) {
339339
ret "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64" +
340340
"-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +
341341
"-n8:16:32";
342342
}
343-
if (_str.eq(target_os(), "win32")) {
343+
if (Str.eq(target_os(), "win32")) {
344344
ret "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32";
345345
}
346346
ret "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32";
347347
}
348348

349349
fn get_target_triple() -> str {
350-
if (_str.eq(target_os(), "macos")) {
350+
if (Str.eq(target_os(), "macos")) {
351351
ret "i686-apple-darwin";
352352
}
353-
if (_str.eq(target_os(), "win32")) {
353+
if (Str.eq(target_os(), "win32")) {
354354
ret "i686-pc-mingw32";
355355
}
356356
ret "i686-unknown-linux-gnu";

src/comp/driver/rustc.rs

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import back.Link;
1515
import lib.llvm;
1616
import util.common;
1717

18-
import std.fs;
19-
import std.map.mk_hashmap;
20-
import std.option;
21-
import std.option.some;
22-
import std.option.none;
23-
import std._str;
24-
import std._vec;
25-
import std.io;
18+
import std.FS;
19+
import std.Map.mk_hashmap;
20+
import std.Option;
21+
import std.Option.some;
22+
import std.Option.none;
23+
import std.Str;
24+
import std.Vec;
25+
import std.IO;
2626
import std.Time;
2727

2828
import std.GetOpts;
@@ -47,7 +47,7 @@ fn default_environment(session.session sess,
4747
ret
4848
vec(
4949
// Target bindings.
50-
tup("target_os", eval.val_str(std.os.target_os())),
50+
tup("target_os", eval.val_str(std.OS.target_os())),
5151
tup("target_arch", eval.val_str("x86")),
5252
tup("target_libc", eval.val_str(libc)),
5353

@@ -60,9 +60,9 @@ fn default_environment(session.session sess,
6060
fn parse_input(session.session sess,
6161
parser.parser p,
6262
str input) -> @ast.crate {
63-
if (_str.ends_with(input, ".rc")) {
63+
if (Str.ends_with(input, ".rc")) {
6464
ret parser.parse_crate_from_crate_file(p);
65-
} else if (_str.ends_with(input, ".rs")) {
65+
} else if (Str.ends_with(input, ".rs")) {
6666
ret parser.parse_crate_from_source_file(p);
6767
}
6868
sess.err("unknown input file type: " + input);
@@ -123,20 +123,20 @@ fn pretty_print_input(session.session sess,
123123
auto def = tup(0, 0);
124124
auto p = front.parser.new_parser(sess, env, def, input, 0u);
125125
auto crate = front.parser.parse_crate_from_source_file(p);
126-
pretty.pprust.print_file(crate.node.module, input, std.io.stdout());
126+
pretty.pprust.print_file(crate.node.module, input, std.IO.stdout());
127127
}
128128

129129
fn version(str argv0) {
130130
auto vers = "unknown version";
131131
auto env_vers = #env("CFG_VERSION");
132-
if (_str.byte_len(env_vers) != 0u) {
132+
if (Str.byte_len(env_vers) != 0u) {
133133
vers = env_vers;
134134
}
135-
io.stdout().write_str(#fmt("%s %s\n", argv0, vers));
135+
IO.stdout().write_str(#fmt("%s %s\n", argv0, vers));
136136
}
137137

138138
fn usage(str argv0) {
139-
io.stdout().write_str(#fmt("usage: %s [options] <input>\n", argv0) + "
139+
IO.stdout().write_str(#fmt("usage: %s [options] <input>\n", argv0) + "
140140
options:
141141
142142
-h --help display this message
@@ -162,38 +162,38 @@ options:
162162
}
163163

164164
fn get_os(str triple) -> session.os {
165-
if (_str.find(triple, "win32") > 0 ||
166-
_str.find(triple, "mingw32") > 0 ) {
165+
if (Str.find(triple, "win32") > 0 ||
166+
Str.find(triple, "mingw32") > 0 ) {
167167
ret session.os_win32;
168-
} else if (_str.find(triple, "darwin") > 0) { ret session.os_macos; }
169-
else if (_str.find(triple, "linux") > 0) { ret session.os_linux; }
168+
} else if (Str.find(triple, "darwin") > 0) { ret session.os_macos; }
169+
else if (Str.find(triple, "linux") > 0) { ret session.os_linux; }
170170
}
171171

172172
fn get_arch(str triple) -> session.arch {
173-
if (_str.find(triple, "i386") > 0 ||
174-
_str.find(triple, "i486") > 0 ||
175-
_str.find(triple, "i586") > 0 ||
176-
_str.find(triple, "i686") > 0 ||
177-
_str.find(triple, "i786") > 0 ) {
173+
if (Str.find(triple, "i386") > 0 ||
174+
Str.find(triple, "i486") > 0 ||
175+
Str.find(triple, "i586") > 0 ||
176+
Str.find(triple, "i686") > 0 ||
177+
Str.find(triple, "i786") > 0 ) {
178178
ret session.arch_x86;
179-
} else if (_str.find(triple, "x86_64") > 0) {
179+
} else if (Str.find(triple, "x86_64") > 0) {
180180
ret session.arch_x64;
181-
} else if (_str.find(triple, "arm") > 0 ||
182-
_str.find(triple, "xscale") > 0 ) {
181+
} else if (Str.find(triple, "arm") > 0 ||
182+
Str.find(triple, "xscale") > 0 ) {
183183
ret session.arch_arm;
184184
}
185185
}
186186

187187
fn get_default_sysroot(str binary) -> str {
188-
auto dirname = fs.dirname(binary);
189-
if (_str.eq(dirname, binary)) { ret "."; }
188+
auto dirname = FS.dirname(binary);
189+
if (Str.eq(dirname, binary)) { ret "."; }
190190
ret dirname;
191191
}
192192

193193
fn main(vec[str] args) {
194194

195195
let str triple =
196-
std._str.rustrt.str_from_cstr(llvm.llvm.LLVMRustGetHostTriple());
196+
std.Str.rustrt.str_from_cstr(llvm.llvm.LLVMRustGetHostTriple());
197197

198198
let @session.config target_cfg =
199199
@rec(os = get_os(triple),
@@ -211,7 +211,7 @@ fn main(vec[str] args) {
211211
optflag("save-temps"), optopt("sysroot"),
212212
optflag("time-passes"), optflag("no-typestate"),
213213
optflag("noverify"));
214-
auto binary = _vec.shift[str](args);
214+
auto binary = Vec.shift[str](args);
215215
auto match;
216216
alt (GetOpts.getopts(args, opts)) {
217217
case (GetOpts.failure(?f)) {
@@ -282,13 +282,13 @@ fn main(vec[str] args) {
282282
session.session(target_crate_num, target_cfg, sopts,
283283
crate_cache, md, front.codemap.new_codemap());
284284

285-
auto n_inputs = _vec.len[str](match.free);
285+
auto n_inputs = Vec.len[str](match.free);
286286

287287
if (glue) {
288288
if (n_inputs > 0u) {
289289
sess.err("No input files allowed with --glue.");
290290
}
291-
auto out = option.from_maybe[str]("glue.bc", output_file);
291+
auto out = Option.from_maybe[str]("glue.bc", output_file);
292292
middle.trans.make_common_glue(sess, out);
293293
ret;
294294
}
@@ -304,19 +304,19 @@ fn main(vec[str] args) {
304304
if (pretty) {
305305
pretty_print_input(sess, env, ifile);
306306
} else if (ls) {
307-
front.creader.list_file_metadata(ifile, std.io.stdout());
307+
front.creader.list_file_metadata(ifile, std.IO.stdout());
308308
} else {
309309
alt (output_file) {
310310
case (none[str]) {
311-
let vec[str] parts = _str.split(ifile, '.' as u8);
312-
_vec.pop[str](parts);
311+
let vec[str] parts = Str.split(ifile, '.' as u8);
312+
Vec.pop[str](parts);
313313
alt (output_type) {
314314
case (Link.output_type_none) { parts += vec("pp"); }
315315
case (Link.output_type_bitcode) { parts += vec("bc"); }
316316
case (Link.output_type_assembly) { parts += vec("s"); }
317317
case (Link.output_type_object) { parts += vec("o"); }
318318
}
319-
auto ofile = _str.connect(parts, ".");
319+
auto ofile = Str.connect(parts, ".");
320320
compile_input(sess, env, ifile, ofile);
321321
}
322322
case (some[str](?ofile)) {

0 commit comments

Comments
 (0)