about summary refs log tree commit diff stats
path: root/cpp/014arithmetic
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/014arithmetic
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/014arithmetic')
-rw-r--r--cpp/014arithmetic30
1 files changed, 10 insertions, 20 deletions
diff --git a/cpp/014arithmetic b/cpp/014arithmetic
index 915cd9ab..08647cbc 100644
--- a/cpp/014arithmetic
+++ b/cpp/014arithmetic
@@ -1,10 +1,8 @@
-:(before "End Globals")
+:(before "End Primitive Recipe Declarations")
 // Arithmetic ops.
-const int ADD = 2;
+ADD,
 :(before "End Primitive Recipe Numbers")
 Recipe_number["add"] = ADD;
-assert(Next_recipe_number == ADD);
-Next_recipe_number++;
 :(before "End Primitive Recipe Implementations")
 case ADD: {
   trace("run") << "ingredient 0 is " << instructions[pc].ingredients[0].name;
@@ -44,12 +42,10 @@ recipe main [
 +run: product 0 is 57
 +mem: storing 57 in location 3
 
-:(before "End Globals")
-const int SUBTRACT = 3;
+:(before "End Primitive Recipe Declarations")
+SUBTRACT,
 :(before "End Primitive Recipe Numbers")
 Recipe_number["subtract"] = SUBTRACT;
-assert(Next_recipe_number == SUBTRACT);
-Next_recipe_number++;
 :(before "End Primitive Recipe Implementations")
 case SUBTRACT: {
   trace("run") << "ingredient 0 is " << instructions[pc].ingredients[0].name;
@@ -89,12 +85,10 @@ recipe main [
 +run: product 0 is -11
 +mem: storing -11 in location 3
 
-:(before "End Globals")
-const int MULTIPLY = 4;
+:(before "End Primitive Recipe Declarations")
+MULTIPLY,
 :(before "End Primitive Recipe Numbers")
 Recipe_number["multiply"] = MULTIPLY;
-assert(Next_recipe_number == MULTIPLY);
-Next_recipe_number++;
 :(before "End Primitive Recipe Implementations")
 case MULTIPLY: {
   trace("run") << "ingredient 0 is " << instructions[pc].ingredients[0].name;
@@ -135,12 +129,10 @@ recipe main [
 +run: product 0 is 24
 +mem: storing 24 in location 3
 
-:(before "End Globals")
-const int DIVIDE = 5;
+:(before "End Primitive Recipe Declarations")
+DIVIDE,
 :(before "End Primitive Recipe Numbers")
 Recipe_number["divide"] = DIVIDE;
-assert(Next_recipe_number == DIVIDE);
-Next_recipe_number++;
 :(before "End Primitive Recipe Implementations")
 case DIVIDE: {
   trace("run") << "ingredient 0 is " << instructions[pc].ingredients[0].name;
@@ -181,12 +173,10 @@ recipe main [
 +run: product 0 is 9
 +mem: storing 9 in location 3
 
-:(before "End Globals")
-const int DIVIDE_WITH_REMAINDER = 6;
+:(before "End Primitive Recipe Declarations")
+DIVIDE_WITH_REMAINDER,
 :(before "End Primitive Recipe Numbers")
 Recipe_number["divide_with_remainder"] = DIVIDE_WITH_REMAINDER;
-assert(Next_recipe_number == DIVIDE_WITH_REMAINDER);
-Next_recipe_number++;
 :(before "End Primitive Recipe Implementations")
 case DIVIDE_WITH_REMAINDER: {
   trace("run") << "ingredient 0 is " << instructions[pc].ingredients[0].name;