From 1848b18f02b158861008214efd19708585bfcbe5 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 17 Apr 2015 10:31:17 -0700 Subject: 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. --- cpp/010vm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'cpp/010vm') 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 -- cgit 1.4.1-2-gfad0