about summary refs log tree commit diff stats
path: root/cpp/010vm
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-17 10:31:17 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-17 10:31:17 -0700
commit1848b18f02b158861008214efd19708585bfcbe5 (patch)
tree3b5ddc0355f9b2b099156a668761cf45edefefb1 /cpp/010vm
parent9da1b126cc017e14035b94c4615d211e5bc4bb21 (diff)
downloadmu-1848b18f02b158861008214efd19708585bfcbe5.tar.gz
1073 - stop fixing the values of primitive recipes
In the process I give up trace stability when I move files around, but I
gain in exchange the ability to move files around.
Diffstat (limited to 'cpp/010vm')
-rw-r--r--cpp/010vm16
1 files changed, 7 insertions, 9 deletions
diff --git a/cpp/010vm b/cpp/010vm
index df84102b..db274622 100644
--- a/cpp/010vm
+++ b/cpp/010vm
@@ -125,9 +125,12 @@ struct type_info {
   type_info() :kind(primitive), size(0) {}
 };
 
-:(before "End Globals")
-const int IDLE = 0;  // always the first entry in the recipe book
-const int COPY = 1;
+enum primitive_recipes {
+  IDLE = 0,
+  COPY,
+  // End Primitive Recipe Declarations
+  MAX_PRIMITIVE_RECIPES,
+};
 :(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
@@ -135,14 +138,9 @@ const int COPY = 1;
 // what to do for them.
 void setup_recipes() {
   Recipe.clear();  Recipe_number.clear();
-  Next_recipe_number = 0;
   Recipe_number["idle"] = IDLE;
-  assert(Next_recipe_number == IDLE);
-  Next_recipe_number++;
   // Primitive Recipe Numbers
   Recipe_number["copy"] = COPY;
-  assert(Next_recipe_number == COPY);
-  Next_recipe_number++;
   // End Primitive Recipe Numbers
 }
 //: We could just reset the recipe table after every test, but that gets slow
@@ -151,7 +149,7 @@ void setup_recipes() {
 //: itself.
 :(before "End One-time Setup")
 setup_recipes();
-assert(Next_recipe_number < 100);  // level 0 is primitives; until 99
+assert(MAX_PRIMITIVE_RECIPES < 100);  // level 0 is primitives; until 99
 Next_recipe_number = 100;
 // End Load Recipes
 // give tests a consistent starting point