about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-26 20:06:51 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-26 20:06:51 -0700
commit72d5d0185c63860ddebf66432d35a217e35587a1 (patch)
tree7483384ac3fc2d52e8e269a2ca18f39c9a946ea4
parentae256ea13efc77cc767a658c6f61b12cd7461e21 (diff)
downloadmu-72d5d0185c63860ddebf66432d35a217e35587a1.tar.gz
2284
-rw-r--r--010vm.cc8
-rw-r--r--030container.cc12
-rw-r--r--033exclusive_container.cc10
3 files changed, 15 insertions, 15 deletions
diff --git a/010vm.cc b/010vm.cc
index 3b4dae26..23f9d9d6 100644
--- a/010vm.cc
+++ b/010vm.cc
@@ -165,9 +165,9 @@ atexit(teardown_types);
 // with different properties for each, that may require an exclusive container
 // whose variants are individual-account and joint-account containers.
 enum kind_of_type {
-  primitive,
-  container,
-  exclusive_container
+  PRIMITIVE,
+  CONTAINER,
+  EXCLUSIVE_CONTAINER
 };
 
 struct type_info {
@@ -177,7 +177,7 @@ struct type_info {
   vector<type_tree*> elements;
   vector<string> element_names;
   // End type_info Fields
-  type_info() :kind(primitive), size(0) {}
+  type_info() :kind(PRIMITIVE), size(0) {}
 };
 
 enum primitive_recipes {
diff --git a/030container.cc b/030container.cc
index 629376b4..da12ef8d 100644
--- a/030container.cc
+++ b/030container.cc
@@ -4,7 +4,7 @@
 //: We'll use this container as a running example, with two number elements.
 type_ordinal point = Type_ordinal["point"] = Next_type_ordinal++;
 Type[point].size = 2;
-Type[point].kind = container;
+Type[point].kind = CONTAINER;
 Type[point].name = "point";
 Type[point].elements.push_back(new type_tree(number));
 Type[point].element_names.push_back("x");
@@ -39,7 +39,7 @@ recipe main [
 // elements.
 type_ordinal point_number = Type_ordinal["point-number"] = Next_type_ordinal++;
 Type[point_number].size = 2;
-Type[point_number].kind = container;
+Type[point_number].kind = CONTAINER;
 Type[point_number].name = "point-number";
 Type[point_number].elements.push_back(new type_tree(point));
 Type[point_number].element_names.push_back("xy");
@@ -88,7 +88,7 @@ if (type->value == 0) {
   return 1;
 }
 type_info t = Type[type->value];
-if (t.kind == container) {
+if (t.kind == CONTAINER) {
   // size of a container is the sum of the sizes of its elements
   long long int result = 0;
   for (long long int i = 0; i < SIZE(t.elements); ++i) {
@@ -133,7 +133,7 @@ case GET: {
   }
   reagent base = inst.ingredients.at(0);
   // Update GET base in Check
-  if (!base.type || !base.type->value || Type[base.type->value].kind != container) {
+  if (!base.type || !base.type->value || Type[base.type->value].kind != CONTAINER) {
     raise_error << maybe(Recipe[r].name) << "first ingredient of 'get' should be a container, but got " << inst.ingredients.at(0).original_string << '\n' << end();
     break;
   }
@@ -252,7 +252,7 @@ case GET_ADDRESS: {
   }
   reagent base = inst.ingredients.at(0);
   // Update GET_ADDRESS base in Check
-  if (!base.type || Type[base.type->value].kind != container) {
+  if (!base.type || Type[base.type->value].kind != CONTAINER) {
     raise_error << maybe(Recipe[r].name) << "first ingredient of 'get-address' should be a container, but got " << inst.ingredients.at(0).original_string << '\n' << end();
     break;
   }
@@ -374,7 +374,7 @@ container bar [
 
 :(before "End Command Handlers")
 else if (command == "container") {
-  insert_container(command, container, in);
+  insert_container(command, CONTAINER, in);
 }
 
 :(code)
diff --git a/033exclusive_container.cc b/033exclusive_container.cc
index 5376e058..1d1e28a0 100644
--- a/033exclusive_container.cc
+++ b/033exclusive_container.cc
@@ -9,7 +9,7 @@
 {
 type_ordinal tmp = Type_ordinal["number-or-point"] = Next_type_ordinal++;
 Type[tmp].size = 2;
-Type[tmp].kind = exclusive_container;
+Type[tmp].kind = EXCLUSIVE_CONTAINER;
 Type[tmp].name = "number-or-point";
 Type[tmp].elements.push_back(new type_tree(number));
 Type[tmp].element_names.push_back("i");
@@ -33,7 +33,7 @@ recipe main [
 +mem: storing 35 in location 6
 
 :(before "End size_of(type) Cases")
-if (t.kind == exclusive_container) {
+if (t.kind == EXCLUSIVE_CONTAINER) {
   // size of an exclusive container is the size of its largest variant
   // (So like containers, it can't contain arrays.)
   long long int result = 0;
@@ -85,7 +85,7 @@ case MAYBE_CONVERT: {
   }
   reagent base = inst.ingredients.at(0);
   canonize_type(base);
-  if (!base.type || !base.type->value || Type[base.type->value].kind != exclusive_container) {
+  if (!base.type || !base.type->value || Type[base.type->value].kind != EXCLUSIVE_CONTAINER) {
     raise_error << maybe(Recipe[r].name) << "first ingredient of 'maybe-convert' should be an exclusive-container, but got " << base.original_string << '\n' << end();
     break;
   }
@@ -132,7 +132,7 @@ exclusive-container foo [
 
 :(before "End Command Handlers")
 else if (command == "exclusive-container") {
-  insert_container(command, exclusive_container, in);
+  insert_container(command, EXCLUSIVE_CONTAINER, in);
 }
 
 //:: To construct exclusive containers out of variant types, use 'merge'.
@@ -160,7 +160,7 @@ if (current_instruction().operation == MERGE
     && current_instruction().products.at(0).type) {
   reagent x = current_instruction().products.at(0);
   canonize(x);
-  if (Type[x.type->value].kind == exclusive_container) {
+  if (Type[x.type->value].kind == EXCLUSIVE_CONTAINER) {
     return size_of(x) < SIZE(data);
   }
 }