From c5a407b11bf01aa2a348010dffbbce2cf202d503 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 19 Jan 2012 15:20:57 -0800 Subject: stdlib: "tag" -> "enum" --- src/libstd/c_vec.rs | 4 ++-- src/libstd/deque.rs | 4 ++-- src/libstd/ebml.rs | 4 ++-- src/libstd/extfmt.rs | 20 ++++++++++---------- src/libstd/fun_treemap.rs | 2 +- src/libstd/getopts.rs | 14 +++++++------- src/libstd/io.rs | 6 +++--- src/libstd/json.rs | 2 +- src/libstd/list.rs | 2 +- src/libstd/map.rs | 4 ++-- src/libstd/net.rs | 4 ++-- src/libstd/rope.rs | 4 ++-- src/libstd/test.rs | 4 ++-- src/libstd/treemap.rs | 2 +- src/libstd/win32_fs.rs | 2 +- 15 files changed, 39 insertions(+), 39 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index 5bab771ab7d..05d59c2b50b 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -37,12 +37,12 @@ export ptr; /* Type: t - The type representing a native chunk of memory. Wrapped in a tag for + The type representing a native chunk of memory. Wrapped in a enum for opacity; FIXME #818 when it is possible to have truly opaque types, this should be revisited. */ -tag t { +enum t { t({ base: *mutable T, len: uint, rsrc: @dtor_res}); } diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 356b27d0c5b..b5f46732cfc 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -241,9 +241,9 @@ mod tests { assert (e(deq.get(3), d)); } - tag taggy { one(int); two(int, int); three(int, int, int); } + enum taggy { one(int); two(int, int); three(int, int, int); } - tag taggypar { + enum taggypar { onepar(int); twopar(int, int); threepar(int, int, int); } diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index fafec189414..24e072692a9 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -67,7 +67,7 @@ fn get_doc(d: doc, tg: uint) -> doc { alt maybe_get_doc(d, tg) { some(d) { ret d; } none { - #error("failed to find block with tag %u", tg); + #error("failed to find block with enum %u", tg); fail; } } @@ -155,7 +155,7 @@ fn create_writer(w: io::writer) -> writer { // TODO: Provide a function to write the standard ebml header. fn start_tag(w: writer, tag_id: uint) { - // Write the tag ID: + // Write the enum ID: write_vint(w.writer, tag_id); // Write a placeholder four-byte size. diff --git a/src/libstd/extfmt.rs b/src/libstd/extfmt.rs index a729fba905f..441ff01a3c1 100644 --- a/src/libstd/extfmt.rs +++ b/src/libstd/extfmt.rs @@ -39,9 +39,9 @@ import option::{some, none}; // Functions used by the fmt extension at compile time mod ct { - tag signedness { signed; unsigned; } - tag caseness { case_upper; case_lower; } - tag ty { + enum signedness { signed; unsigned; } + enum caseness { case_upper; case_lower; } + enum ty { ty_bool; ty_str; ty_char; @@ -52,14 +52,14 @@ mod ct { ty_float; // FIXME: More types } - tag flag { + enum flag { flag_left_justify; flag_left_zero_pad; flag_space_for_sign; flag_sign_always; flag_alternate; } - tag count { + enum count { count_is(int); count_is_param(int); count_is_next_param; @@ -76,7 +76,7 @@ mod ct { // A fragment of the output sequence - tag piece { piece_string(str); piece_conv(conv); } + enum piece { piece_string(str); piece_conv(conv); } type error_fn = fn@(str) -> ! ; fn parse_fmt_string(s: str, error: error_fn) -> [piece] { @@ -260,7 +260,7 @@ mod ct { // conditions can be evaluated at compile-time. For now though it's cleaner to // implement it this way, I think. mod rt { - tag flag { + enum flag { flag_left_justify; flag_left_zero_pad; flag_space_for_sign; @@ -273,8 +273,8 @@ mod rt { // comments in front::extfmt::make_flags flag_none; } - tag count { count_is(int); count_implied; } - tag ty { ty_default; ty_bits; ty_hex_upper; ty_hex_lower; ty_octal; } + enum count { count_is(int); count_implied; } + enum ty { ty_default; ty_bits; ty_hex_upper; ty_hex_lower; ty_octal; } // FIXME: May not want to use a vector here for flags; // instead just use a bool per flag @@ -384,7 +384,7 @@ mod rt { ret str::unsafe_from_bytes(svec); } - tag pad_mode { pad_signed; pad_unsigned; pad_nozero; } + enum pad_mode { pad_signed; pad_unsigned; pad_nozero; } fn pad(cv: conv, s: str, mode: pad_mode) -> str { let uwidth; alt cv.width { diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index 34a393b6a8e..8bd4a38d40b 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -31,7 +31,7 @@ type treemap = @tree_node; /* Tag: tree_node */ -tag tree_node { +enum tree_node { empty; node(@K, @V, @tree_node, @tree_node); } diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index 39b6de0e34f..29df5770a17 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -65,11 +65,11 @@ export opt_strs; export opt_maybe_str; export opt_default; -tag name { long(str); short(char); } +enum name { long(str); short(char); } -tag hasarg { yes; no; maybe; } +enum hasarg { yes; no; maybe; } -tag occur { req; optional; multi; } +enum occur { req; optional; multi; } /* Type: opt @@ -130,7 +130,7 @@ fn optmulti(name: str) -> opt { ret {name: mkname(name), hasarg: yes, occur: multi}; } -tag optval { val(str); given; } +enum optval { val(str); given; } /* Type: match @@ -158,7 +158,7 @@ Type: fail_ The type returned when the command line does not conform to the expected format. Pass this value to to get an error message. */ -tag fail_ { +enum fail_ { argument_missing(str); unrecognized_option(str); option_missing(str); @@ -169,7 +169,7 @@ tag fail_ { /* Function: fail_str -Convert a tag into an error string +Convert a enum into an error string */ fn fail_str(f: fail_) -> str { ret alt f { @@ -381,7 +381,7 @@ mod tests { import opt = getopts; import result::{err, ok}; - tag fail_type { + enum fail_type { argument_missing_; unrecognized_option_; option_missing_; diff --git a/src/libstd/io.rs b/src/libstd/io.rs index 9a0cb10c858..eca266ecfa9 100644 --- a/src/libstd/io.rs +++ b/src/libstd/io.rs @@ -17,7 +17,7 @@ native mod rustrt { // Reading // FIXME This is all buffered. We might need an unbuffered variant as well -tag seek_style { seek_set; seek_end; seek_cur; } +enum seek_style { seek_set; seek_end; seek_cur; } // The raw underlying reader iface. All readers must implement this. @@ -264,7 +264,7 @@ fn string_reader(s: str) -> reader { // Writing -tag fileflag { append; create; truncate; none; } +enum fileflag { append; create; truncate; none; } // FIXME: Seekable really should be orthogonal. // FIXME: eventually u64 @@ -495,7 +495,7 @@ fn read_whole_file(file: str) -> result::t<[u8], str> { mod fsync { - tag level { + enum level { // whatever fsync does on that platform fsync; diff --git a/src/libstd/json.rs b/src/libstd/json.rs index d433b12ec68..5b7523e03fd 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -23,7 +23,7 @@ Tag: json Represents a json value. */ -tag json { +enum json { /* Variant: num */ num(float); /* Variant: string */ diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 03aef97857f..3286127bb1b 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -13,7 +13,7 @@ import option::{some, none}; /* Tag: list */ -tag list { +enum list { /* Variant: cons */ cons(T, @list); /* Variant: nil */ diff --git a/src/libstd/map.rs b/src/libstd/map.rs index 9496f2febed..f7b3132b86d 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -112,7 +112,7 @@ mod chained { mutable next: chain }; - tag chain { + enum chain { present(@entry); absent; } @@ -124,7 +124,7 @@ mod chained { eqer: eqfn }; - tag search_result { + enum search_result { not_found; found_first(uint, @entry); found_after(@entry, @entry); diff --git a/src/libstd/net.rs b/src/libstd/net.rs index ba00ae64933..e73eed27864 100644 --- a/src/libstd/net.rs +++ b/src/libstd/net.rs @@ -12,7 +12,7 @@ Tag: ip_addr An IP address */ -tag ip_addr { +enum ip_addr { /* Variant: ipv4 @@ -42,7 +42,7 @@ Function: parse_addr Convert a str to -Converts a string of the format "x.x.x.x" into an ip_addr tag. +Converts a string of the format "x.x.x.x" into an ip_addr enum. Failure: diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index 013e903f7e0..54d22dde3a2 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -585,7 +585,7 @@ mod node { empty - An empty rope content - A non-empty rope */ - tag root { + enum root { empty; content(@node); } @@ -688,7 +688,7 @@ mod node { leaf - A leaf consisting in a `str` concat - The concatenation of two ropes */ - tag node { + enum node { leaf(leaf); concat(concat); } diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 440ef272ced..6131943c2fd 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -84,7 +84,7 @@ fn parse_opts(args: [str]) : vec::is_not_empty(args) -> opt_res { ret either::left(test_opts); } -tag test_result { tr_ok; tr_failed; tr_ignored; } +enum test_result { tr_ok; tr_failed; tr_ignored; } // A simple console test runner fn run_tests_console(opts: test_opts, @@ -186,7 +186,7 @@ fn run_tests_console(opts: test_opts, fn use_color() -> bool { ret get_concurrency() == 1u; } -tag testevent { +enum testevent { te_filtered([test_desc]); te_wait(test_desc); te_result(test_desc, test_result); diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index 14e9c30a83c..e5e6a433e2d 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -28,7 +28,7 @@ type treemap = @mutable tree_node; /* Tag: tree_node */ -tag tree_node { empty; node(@K, @V, treemap, treemap); } +enum tree_node { empty; node(@K, @V, treemap, treemap); } /* Section: Operations */ diff --git a/src/libstd/win32_fs.rs b/src/libstd/win32_fs.rs index 87c97fe35c9..bca09fcf835 100644 --- a/src/libstd/win32_fs.rs +++ b/src/libstd/win32_fs.rs @@ -21,7 +21,7 @@ fn path_is_absolute(p: str) -> bool { * different semantics for each. Since we build on mingw, we are usually * dealing with /-separated paths. But the whole interface to splitting and * joining pathnames needs a bit more abstraction on win32. Possibly a vec or - * tag type. + * enum type. */ const path_sep: char = '/'; -- cgit 1.4.1-3-g733a5