about summary refs log tree commit diff stats
path: root/cpp/010vm
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-02-19 16:54:33 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-02-19 16:56:26 -0800
commit42b31beba71db2012db3ea47f4ca8cfc18136d14 (patch)
treee0c8aa54ec492b3aa2c4b90ed3d972113340defd /cpp/010vm
parent8d7839b99723553c08b33c30980a001e7a3557b6 (diff)
downloadmu-42b31beba71db2012db3ea47f4ca8cfc18136d14.tar.gz
789
Diffstat (limited to 'cpp/010vm')
-rw-r--r--cpp/010vm13
1 files changed, 7 insertions, 6 deletions
diff --git a/cpp/010vm b/cpp/010vm
index 317f6d70..b864179e 100644
--- a/cpp/010vm
+++ b/cpp/010vm
@@ -96,6 +96,9 @@ struct type_info {
   type_info() :size(0) {}
 };
 
+:(before "End Globals")
+const int IDLE = 0;  // always the first entry in the recipe book
+const int COPY = 1;
 :(code)
 // It's all very well to construct recipes out of other recipes, but we need
 // to know how to do *something* out of the box. For the following
@@ -103,15 +106,13 @@ struct type_info {
 // what to do for them.
 void setup_recipes() {
   Recipe.clear();  Recipe_number.clear();
-  Recipe_number["idle"] = 0;
+  Recipe_number["idle"] = IDLE;
   Next_recipe_number = 1;
   // Primitive Recipe Numbers.
-  Recipe_number["copy"] = 1;
+  Recipe_number["copy"] = COPY;
   Next_recipe_number++;
   // End Primitive Recipe Numbers.
 }
-:(before "End Types")
-const int idle = 0;  // always the first entry in the recipe book
 :(before "End Setup")
   setup_recipes();
 
@@ -119,8 +120,8 @@ const int idle = 0;  // always the first entry in the recipe book
 
 :(code)
 // Helpers
-  instruction::instruction() :is_label(false), operation(idle) {}
-  void instruction::clear() { is_label=false; label.clear(); operation=idle; ingredients.clear(); products.clear(); }
+  instruction::instruction() :is_label(false), operation(IDLE) {}
+  void instruction::clear() { is_label=false; label.clear(); operation=IDLE; ingredients.clear(); products.clear(); }
 
   // Reagents have the form <name>:<type>:<type>:.../<property>/<property>/...
   reagent::reagent(string s) {