about summary refs log tree commit diff stats
path: root/022arithmetic.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-05-26 16:43:18 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-05-26 17:36:16 -0700
commit2b25071710656d7a755c2f66c99734cd7990d1ba (patch)
treef4e3a83d6397343c7c225a354f4f2c837aef8190 /022arithmetic.cc
parent5e320aa049bc1d5ad78eec23be0127f4a8d6ec3d (diff)
downloadmu-2b25071710656d7a755c2f66c99734cd7990d1ba.tar.gz
3877
Diffstat (limited to '022arithmetic.cc')
-rw-r--r--022arithmetic.cc66
1 files changed, 33 insertions, 33 deletions
diff --git a/022arithmetic.cc b/022arithmetic.cc
index 0b842dd4..530541aa 100644
--- a/022arithmetic.cc
+++ b/022arithmetic.cc
@@ -14,7 +14,7 @@ case ADD: {
     }
   }
   if (SIZE(inst.products) > 1) {
-    raise << maybe(get(Recipe, r).name) << "'add' yields exactly one product in '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'add' yields exactly one product in '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) {
@@ -86,7 +86,7 @@ case SUBTRACT: {
     }
   }
   if (SIZE(inst.products) > 1) {
-    raise << maybe(get(Recipe, r).name) << "'subtract' yields exactly one product in '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'subtract' yields exactly one product in '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) {
@@ -142,7 +142,7 @@ case MULTIPLY: {
     }
   }
   if (SIZE(inst.products) > 1) {
-    raise << maybe(get(Recipe, r).name) << "'multiply' yields exactly one product in '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'multiply' yields exactly one product in '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) {
@@ -199,7 +199,7 @@ case DIVIDE: {
     }
   }
   if (SIZE(inst.products) > 1) {
-    raise << maybe(get(Recipe, r).name) << "'divide' yields exactly one product in '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'divide' yields exactly one product in '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) {
@@ -247,15 +247,15 @@ put(Recipe_ordinal, "divide-with-remainder", DIVIDE_WITH_REMAINDER);
 :(before "End Primitive Recipe Checks")
 case DIVIDE_WITH_REMAINDER: {
   if (SIZE(inst.ingredients) != 2) {
-    raise << maybe(get(Recipe, r).name) << "'divide-with-remainder' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'divide-with-remainder' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!is_mu_number(inst.ingredients.at(0)) || !is_mu_number(inst.ingredients.at(1))) {
-    raise << maybe(get(Recipe, r).name) << "'divide-with-remainder' requires number ingredients, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'divide-with-remainder' requires number ingredients, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (SIZE(inst.products) > 2) {
-    raise << maybe(get(Recipe, r).name) << "'divide-with-remainder' yields two products in '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'divide-with-remainder' yields two products in '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   for (int i = 0;  i < SIZE(inst.products);  ++i) {
@@ -273,7 +273,7 @@ case DIVIDE_WITH_REMAINDER: {
   long long int a = static_cast<long long int>(ingredients.at(0).at(0));
   long long int b = static_cast<long long int>(ingredients.at(1).at(0));
   if (b == 0) {
-    raise << maybe(current_recipe_name()) << "divide by zero in '" << current_instruction().original_string << "'\n" << end();
+    raise << maybe(current_recipe_name()) << "divide by zero in '" << to_original_string(current_instruction()) << "'\n" << end();
     products.resize(2);
     products.at(0).push_back(0);
     products.at(1).push_back(0);
@@ -331,15 +331,15 @@ put(Recipe_ordinal, "shift-left", SHIFT_LEFT);
 :(before "End Primitive Recipe Checks")
 case SHIFT_LEFT: {
   if (SIZE(inst.ingredients) != 2) {
-    raise << maybe(get(Recipe, r).name) << "'shift-left' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'shift-left' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!is_mu_number(inst.ingredients.at(0)) || !is_mu_number(inst.ingredients.at(1))) {
-    raise << maybe(get(Recipe, r).name) << "'shift-left' requires number ingredients, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'shift-left' requires number ingredients, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (SIZE(inst.products) > 1) {
-    raise << maybe(get(Recipe, r).name) << "'shift-left' yields one product in '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'shift-left' yields one product in '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) {
@@ -355,7 +355,7 @@ case SHIFT_LEFT: {
   int b = static_cast<int>(ingredients.at(1).at(0));
   products.resize(1);
   if (b < 0) {
-    raise << maybe(current_recipe_name()) << "second ingredient can't be negative in '" << current_instruction().original_string << "'\n" << end();
+    raise << maybe(current_recipe_name()) << "second ingredient can't be negative in '" << to_original_string(current_instruction()) << "'\n" << end();
     products.at(0).push_back(0);
     break;
   }
@@ -402,15 +402,15 @@ put(Recipe_ordinal, "shift-right", SHIFT_RIGHT);
 :(before "End Primitive Recipe Checks")
 case SHIFT_RIGHT: {
   if (SIZE(inst.ingredients) != 2) {
-    raise << maybe(get(Recipe, r).name) << "'shift-right' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'shift-right' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!is_mu_number(inst.ingredients.at(0)) || !is_mu_number(inst.ingredients.at(1))) {
-    raise << maybe(get(Recipe, r).name) << "'shift-right' requires number ingredients, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'shift-right' requires number ingredients, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (SIZE(inst.products) > 1) {
-    raise << maybe(get(Recipe, r).name) << "'shift-right' yields one product in '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'shift-right' yields one product in '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) {
@@ -426,7 +426,7 @@ case SHIFT_RIGHT: {
   int b = static_cast<int>(ingredients.at(1).at(0));
   products.resize(1);
   if (b < 0) {
-    raise << maybe(current_recipe_name()) << "second ingredient can't be negative in '" << current_instruction().original_string << "'\n" << end();
+    raise << maybe(current_recipe_name()) << "second ingredient can't be negative in '" << to_original_string(current_instruction()) << "'\n" << end();
     products.at(0).push_back(0);
     break;
   }
@@ -473,15 +473,15 @@ put(Recipe_ordinal, "and-bits", AND_BITS);
 :(before "End Primitive Recipe Checks")
 case AND_BITS: {
   if (SIZE(inst.ingredients) != 2) {
-    raise << maybe(get(Recipe, r).name) << "'and-bits' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'and-bits' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!is_mu_number(inst.ingredients.at(0)) || !is_mu_number(inst.ingredients.at(1))) {
-    raise << maybe(get(Recipe, r).name) << "'and-bits' requires number ingredients, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'and-bits' requires number ingredients, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (SIZE(inst.products) > 1) {
-    raise << maybe(get(Recipe, r).name) << "'and-bits' yields one product in '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'and-bits' yields one product in '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) {
@@ -531,15 +531,15 @@ put(Recipe_ordinal, "or-bits", OR_BITS);
 :(before "End Primitive Recipe Checks")
 case OR_BITS: {
   if (SIZE(inst.ingredients) != 2) {
-    raise << maybe(get(Recipe, r).name) << "'or-bits' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'or-bits' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!is_mu_number(inst.ingredients.at(0)) || !is_mu_number(inst.ingredients.at(1))) {
-    raise << maybe(get(Recipe, r).name) << "'or-bits' requires number ingredients, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'or-bits' requires number ingredients, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (SIZE(inst.products) > 1) {
-    raise << maybe(get(Recipe, r).name) << "'or-bits' yields one product in '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'or-bits' yields one product in '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) {
@@ -583,15 +583,15 @@ put(Recipe_ordinal, "xor-bits", XOR_BITS);
 :(before "End Primitive Recipe Checks")
 case XOR_BITS: {
   if (SIZE(inst.ingredients) != 2) {
-    raise << maybe(get(Recipe, r).name) << "'xor-bits' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'xor-bits' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!is_mu_number(inst.ingredients.at(0)) || !is_mu_number(inst.ingredients.at(1))) {
-    raise << maybe(get(Recipe, r).name) << "'xor-bits' requires number ingredients, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'xor-bits' requires number ingredients, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (SIZE(inst.products) > 1) {
-    raise << maybe(get(Recipe, r).name) << "'xor-bits' yields one product in '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'xor-bits' yields one product in '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) {
@@ -635,15 +635,15 @@ put(Recipe_ordinal, "flip-bits", FLIP_BITS);
 :(before "End Primitive Recipe Checks")
 case FLIP_BITS: {
   if (SIZE(inst.ingredients) != 1) {
-    raise << maybe(get(Recipe, r).name) << "'flip-bits' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'flip-bits' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!is_mu_number(inst.ingredients.at(0))) {
-    raise << maybe(get(Recipe, r).name) << "'flip-bits' requires a number ingredient, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'flip-bits' requires a number ingredient, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (SIZE(inst.products) > 1) {
-    raise << maybe(get(Recipe, r).name) << "'flip-bits' yields one product in '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'flip-bits' yields one product in '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) {
@@ -692,7 +692,7 @@ put(Recipe_ordinal, "round", ROUND);
 :(before "End Primitive Recipe Checks")
 case ROUND: {
   if (SIZE(inst.ingredients) != 1) {
-    raise << maybe(get(Recipe, r).name) << "'round' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'round' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!is_mu_number(inst.ingredients.at(0))) {
@@ -733,7 +733,7 @@ put(Recipe_ordinal, "truncate", TRUNCATE);
 :(before "End Primitive Recipe Checks")
 case TRUNCATE: {
   if (SIZE(inst.ingredients) != 1) {
-    raise << maybe(get(Recipe, r).name) << "'truncate' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'truncate' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!is_mu_number(inst.ingredients.at(0))) {
@@ -768,7 +768,7 @@ put(Recipe_ordinal, "square-root", SQUARE_ROOT);
 :(before "End Primitive Recipe Checks")
 case SQUARE_ROOT: {
   if (SIZE(inst.ingredients) != 1) {
-    raise << maybe(get(Recipe, r).name) << "'square-root' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'square-root' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!is_mu_number(inst.ingredients.at(0))) {
@@ -791,7 +791,7 @@ put(Recipe_ordinal, "character-to-code", CHARACTER_TO_CODE);
 :(before "End Primitive Recipe Checks")
 case CHARACTER_TO_CODE: {
   if (SIZE(inst.ingredients) != 1) {
-    raise << maybe(get(Recipe, r).name) << "'character-to-code' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'character-to-code' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!is_mu_character(inst.ingredients.at(0))) {
@@ -799,7 +799,7 @@ case CHARACTER_TO_CODE: {
     break;
   }
   if (SIZE(inst.products) != 1) {
-    raise << maybe(get(Recipe, r).name) << "'character-to-code' requires exactly one product, but got '" << inst.original_string << "'\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'character-to-code' requires exactly one product, but got '" << to_original_string(inst) << "'\n" << end();
     break;
   }
   if (!is_mu_number(inst.products.at(0))) {