/*
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<T> {
+enum t<T> {
t({ base: *mutable T, len: uint, rsrc: @dtor_res});
}
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<T> {
+ enum taggypar<T> {
onepar(int); twopar(int, int); threepar(int, int, int);
}
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;
}
}
// 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.
// 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;
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;
// 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] {
// 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;
// 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
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 {
/*
Tag: tree_node
*/
-tag tree_node<K, V> {
+enum tree_node<K, V> {
empty;
node(@K, @V, @tree_node<K, V>, @tree_node<K, V>);
}
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
ret {name: mkname(name), hasarg: yes, occur: multi};
}
-tag optval { val(str); given; }
+enum optval { val(str); given; }
/*
Type: match
The type returned when the command line does not conform to the
expected format. Pass this value to <fail_str> to get an error message.
*/
-tag fail_ {
+enum fail_ {
argument_missing(str);
unrecognized_option(str);
option_missing(str);
/*
Function: fail_str
-Convert a <fail_> tag into an error string
+Convert a <fail_> enum into an error string
*/
fn fail_str(f: fail_) -> str {
ret alt f {
import opt = getopts;
import result::{err, ok};
- tag fail_type {
+ enum fail_type {
argument_missing_;
unrecognized_option_;
option_missing_;
// 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.
// Writing
-tag fileflag { append; create; truncate; none; }
+enum fileflag { append; create; truncate; none; }
// FIXME: Seekable really should be orthogonal.
// FIXME: eventually u64
mod fsync {
- tag level {
+ enum level {
// whatever fsync does on that platform
fsync;
Represents a json value.
*/
-tag json {
+enum json {
/* Variant: num */
num(float);
/* Variant: string */
/*
Tag: list
*/
-tag list<T> {
+enum list<T> {
/* Variant: cons */
cons(T, @list<T>);
/* Variant: nil */
mutable next: chain<K, V>
};
- tag chain<K, V> {
+ enum chain<K, V> {
present(@entry<K, V>);
absent;
}
eqer: eqfn<K>
};
- tag search_result<K, V> {
+ enum search_result<K, V> {
not_found;
found_first(uint, @entry<K,V>);
found_after(@entry<K,V>, @entry<K,V>);
An IP address
*/
-tag ip_addr {
+enum ip_addr {
/*
Variant: ipv4
Convert a str to <ip_addr>
-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:
empty - An empty rope
content - A non-empty rope
*/
- tag root {
+ enum root {
empty;
content(@node);
}
leaf - A leaf consisting in a `str`
concat - The concatenation of two ropes
*/
- tag node {
+ enum node {
leaf(leaf);
concat(concat);
}
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,
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);
/*
Tag: tree_node
*/
-tag tree_node<K, V> { empty; node(@K, @V, treemap<K, V>, treemap<K, V>); }
+enum tree_node<K, V> { empty; node(@K, @V, treemap<K, V>, treemap<K, V>); }
/* Section: Operations */
* 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 = '/';