diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/010vm | 5 | ||||
-rw-r--r-- | cpp/013arithmetic | 5 | ||||
-rw-r--r-- | cpp/014boolean | 3 | ||||
-rw-r--r-- | cpp/015jump | 3 | ||||
-rw-r--r-- | cpp/016compare | 5 | ||||
-rw-r--r-- | cpp/017record | 2 | ||||
-rw-r--r-- | cpp/019array | 2 |
7 files changed, 24 insertions, 1 deletions
diff --git a/cpp/010vm b/cpp/010vm index a734305f..ee8be9cb 100644 --- a/cpp/010vm +++ b/cpp/010vm @@ -112,10 +112,13 @@ 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; - Next_recipe_number = 1; + 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. } diff --git a/cpp/013arithmetic b/cpp/013arithmetic index d1d61eed..846fdff3 100644 --- a/cpp/013arithmetic +++ b/cpp/013arithmetic @@ -3,6 +3,7 @@ const int ADD = 2; :(before "End Primitive Recipe Numbers") Recipe_number["add"] = ADD; +assert(Next_recipe_number == ADD); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case ADD: { @@ -47,6 +48,7 @@ recipe main [ const int SUBTRACT = 3; :(before "End Primitive Recipe Numbers") Recipe_number["subtract"] = SUBTRACT; +assert(Next_recipe_number == SUBTRACT); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case SUBTRACT: { @@ -91,6 +93,7 @@ recipe main [ const int MULTIPLY = 4; :(before "End Primitive Recipe Numbers") Recipe_number["multiply"] = MULTIPLY; +assert(Next_recipe_number == MULTIPLY); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case MULTIPLY: { @@ -136,6 +139,7 @@ recipe main [ const int DIVIDE = 5; :(before "End Primitive Recipe Numbers") Recipe_number["divide"] = DIVIDE; +assert(Next_recipe_number == DIVIDE); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case DIVIDE: { @@ -181,6 +185,7 @@ recipe main [ const int DIVIDE_WITH_REMAINDER = 6; :(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: { diff --git a/cpp/014boolean b/cpp/014boolean index 61f5f436..e6dd12ba 100644 --- a/cpp/014boolean +++ b/cpp/014boolean @@ -3,6 +3,7 @@ const int AND = 7; :(before "End Primitive Recipe Numbers") Recipe_number["and"] = AND; +assert(Next_recipe_number == AND); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case AND: { @@ -37,6 +38,7 @@ recipe main [ const int OR = 8; :(before "End Primitive Recipe Numbers") Recipe_number["or"] = OR; +assert(Next_recipe_number == OR); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case OR: { @@ -71,6 +73,7 @@ recipe main [ const int NOT = 9; :(before "End Primitive Recipe Numbers") Recipe_number["not"] = NOT; +assert(Next_recipe_number == NOT); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case NOT: { diff --git a/cpp/015jump b/cpp/015jump index 26861166..5b4a9624 100644 --- a/cpp/015jump +++ b/cpp/015jump @@ -3,6 +3,7 @@ const int JUMP = 10; :(before "End Primitive Recipe Numbers") Recipe_number["jump"] = JUMP; +assert(Next_recipe_number == JUMP); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case JUMP: { @@ -35,6 +36,7 @@ recipe main [ const int JUMP_IF = 11; :(before "End Primitive Recipe Numbers") Recipe_number["jump-if"] = JUMP_IF; +assert(Next_recipe_number == JUMP_IF); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case JUMP_IF: { @@ -76,6 +78,7 @@ recipe main [ const int JUMP_UNLESS = 12; :(before "End Primitive Recipe Numbers") Recipe_number["jump-unless"] = JUMP_UNLESS; +assert(Next_recipe_number == JUMP_UNLESS); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case JUMP_UNLESS: { diff --git a/cpp/016compare b/cpp/016compare index 9a97911f..57f70279 100644 --- a/cpp/016compare +++ b/cpp/016compare @@ -3,6 +3,7 @@ const int EQUAL = 13; :(before "End Primitive Recipe Numbers") Recipe_number["equal"] = EQUAL; +assert(Next_recipe_number == EQUAL); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case EQUAL: { @@ -49,6 +50,7 @@ recipe main [ const int GREATER_THAN = 14; :(before "End Primitive Recipe Numbers") Recipe_number["greater-than"] = GREATER_THAN; +assert(Next_recipe_number == GREATER_THAN); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case GREATER_THAN: { @@ -97,6 +99,7 @@ recipe main [ const int LESSER_THAN = 15; :(before "End Primitive Recipe Numbers") Recipe_number["lesser-than"] = LESSER_THAN; +assert(Next_recipe_number == LESSER_THAN); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case LESSER_THAN: { @@ -145,6 +148,7 @@ recipe main [ const int GREATER_OR_EQUAL = 16; :(before "End Primitive Recipe Numbers") Recipe_number["greater-or-equal"] = GREATER_OR_EQUAL; +assert(Next_recipe_number == GREATER_OR_EQUAL); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case GREATER_OR_EQUAL: { @@ -207,6 +211,7 @@ recipe main [ const int LESSER_OR_EQUAL = 17; :(before "End Primitive Recipe Numbers") Recipe_number["lesser-or-equal"] = LESSER_OR_EQUAL; +assert(Next_recipe_number == LESSER_OR_EQUAL); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case LESSER_OR_EQUAL: { diff --git a/cpp/017record b/cpp/017record index 6ce9da1d..d64fdcb6 100644 --- a/cpp/017record +++ b/cpp/017record @@ -28,6 +28,7 @@ recipe main [ const int GET = 18; :(before "End Primitive Recipe Numbers") Recipe_number["get"] = GET; +assert(Next_recipe_number == GET); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case GET: { @@ -104,6 +105,7 @@ recipe main [ const int GET_ADDRESS = 19; :(before "End Primitive Recipe Numbers") Recipe_number["get-address"] = GET_ADDRESS; +assert(Next_recipe_number == GET_ADDRESS); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case GET_ADDRESS: { diff --git a/cpp/019array b/cpp/019array index fe457b0a..3d797161 100644 --- a/cpp/019array +++ b/cpp/019array @@ -59,6 +59,7 @@ size_t size_of(reagent r) { const int INDEX = 20; :(before "End Primitive Recipe Numbers") Recipe_number["index"] = INDEX; +assert(Next_recipe_number == INDEX); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case INDEX: { @@ -105,6 +106,7 @@ recipe main [ const int INDEX_ADDRESS = 21; :(before "End Primitive Recipe Numbers") Recipe_number["index-address"] = INDEX_ADDRESS; +assert(Next_recipe_number == INDEX_ADDRESS); Next_recipe_number++; :(before "End Primitive Recipe Implementations") case INDEX_ADDRESS: { |