diff options
Diffstat (limited to 'cpp/014arithmetic')
-rw-r--r-- | cpp/014arithmetic | 30 |
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; |