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/014arithmetic | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'cpp/014arithmetic') 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; -- cgit 1.4.1-2-gfad0 bbdefd205a206fab30a6485be0c721db315d (plain) (tree)
1
2
3
4
5
6
7
8
9