diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-07-01 22:34:50 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-07-01 22:34:50 -0700 |
commit | 3259784417ceb4e81156f708eaccf417cd048ea2 (patch) | |
tree | adb6c771afc019752d97e3e0aed95fa8d481ec3b | |
parent | 4634136fc80f37c534def6cbad0371ade034c747 (diff) | |
download | mu-3259784417ceb4e81156f708eaccf417cd048ea2.tar.gz |
3083
-rw-r--r-- | 010vm.cc | 11 | ||||
-rw-r--r-- | 040brace.cc | 2 | ||||
-rw-r--r-- | 070recipe.cc | 2 | ||||
-rw-r--r-- | 085scenario_console.cc | 4 |
4 files changed, 12 insertions, 7 deletions
diff --git a/010vm.cc b/010vm.cc index 66a1d6bb..8599b74d 100644 --- a/010vm.cc +++ b/010vm.cc @@ -77,9 +77,11 @@ struct type_tree { ~type_tree(); type_tree(const type_tree& old); // simple: type ordinal - explicit type_tree(string name, type_ordinal v) :name(name), value(v), left(NULL), right(NULL) {} + explicit type_tree(string name); + type_tree(string name, type_ordinal v) :name(name), value(v), left(NULL), right(NULL) {} // intermediate: list of type ordinals type_tree(string name, type_ordinal v, type_tree* r) :name(name), value(v), left(NULL), right(r) {} + type_tree(string name, type_tree* r); // advanced: tree containing type ordinals type_tree(type_tree* l, type_tree* r) :value(0), left(l), right(r) {} }; @@ -99,6 +101,9 @@ struct string_tree { }; // End type_tree Definition +:(code) +type_tree::type_tree(string name) :name(name), value(get(Type_ordinal, name)), left(NULL), right(NULL) {} +type_tree::type_tree(string name, type_tree* r) :name(name), value(get(Type_ordinal, name)), left(NULL), right(r) {} :(before "End Globals") // Locations refer to a common 'memory'. Each location can store a number. @@ -271,9 +276,9 @@ reagent::reagent(const string& s) :original_string(s), type(NULL), value(0), ini delete type_names; // special cases if (is_integer(name) && type == NULL) - type = new type_tree("literal", get(Type_ordinal, "literal")); + type = new type_tree("literal"); if (name == "_" && type == NULL) - type = new type_tree("literal", get(Type_ordinal, "literal")); + type = new type_tree("literal"); // other properties slurp_properties(in, properties); // End Parsing reagent diff --git a/040brace.cc b/040brace.cc index 02e3e210..bd104ffa 100644 --- a/040brace.cc +++ b/040brace.cc @@ -114,7 +114,7 @@ void transform_braces(const recipe_ordinal r) { } // if implicit, compute target reagent target; - target.type = new type_tree("offset", get(Type_ordinal, "offset")); + target.type = new type_tree("offset"); target.set_value(0); if (open_braces.empty()) raise << "'" << inst.old_name << "' needs a '{' before\n" << end(); diff --git a/070recipe.cc b/070recipe.cc index b7d1e71f..07e91c50 100644 --- a/070recipe.cc +++ b/070recipe.cc @@ -35,7 +35,7 @@ get_or_insert(Type, recipe).name = "recipe"; :(before "End Null-type is_disqualified Exceptions") if (!x.type && contains_key(Recipe_ordinal, x.name)) { - x.type = new type_tree("recipe-literal", get(Type_ordinal, "recipe-literal")); + x.type = new type_tree("recipe-literal"); x.set_value(get(Recipe_ordinal, x.name)); return true; } diff --git a/085scenario_console.cc b/085scenario_console.cc index c6321623..f6c17054 100644 --- a/085scenario_console.cc +++ b/085scenario_console.cc @@ -281,7 +281,7 @@ int size_of_event() { // memoize result if already computed static int result = 0; if (result) return result; - type_tree* type = new type_tree("event", get(Type_ordinal, "event")); + type_tree* type = new type_tree("event"); result = size_of(type); delete type; return result; @@ -292,7 +292,7 @@ int size_of_console() { static int result = 0; if (result) return result; assert(get(Type_ordinal, "console")); - type_tree* type = new type_tree("console", get(Type_ordinal, "console")); + type_tree* type = new type_tree("console"); result = size_of(type)+/*refcount*/1; delete type; return result; |