about summary refs log tree commit diff stats
path: root/cpp/012transform.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-04 11:02:56 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-04 11:02:56 -0700
commita66c9ae68122e04637d65c7f3aedcd96012c8cb6 (patch)
treeceddf9f22c55621be86768a0aeedc927495e62d6 /cpp/012transform.cc
parentde49fb426aa44984d308f5856ec836360ba0bdce (diff)
downloadmu-a66c9ae68122e04637d65c7f3aedcd96012c8cb6.tar.gz
1249 - new type: index_t
It will always be identical to size_t, just more readable, like
recipe_number, etc. The various unsigned types are sizes, indices (which
often compare with sizes for bounds checking), numbers which are
canonical elements of a specific space (like recipes or mu types), and
ids which I haven't introduced yet.
Diffstat (limited to 'cpp/012transform.cc')
-rw-r--r--cpp/012transform.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/cpp/012transform.cc b/cpp/012transform.cc
index 888c7585..2c1e4610 100644
--- a/cpp/012transform.cc
+++ b/cpp/012transform.cc
@@ -4,7 +4,7 @@
 //: deconstructed alternative to conventional compilers.
 
 :(before "End recipe Fields")
-size_t transformed_until;
+index_t transformed_until;
   recipe() :transformed_until(-1) {}
 
 :(before "End Types")
@@ -16,7 +16,7 @@ vector<transform_fn> Transform;
 :(code)
 void transform_all() {
 //?   cout << "AAA transform_all\n"; //? 1
-  for (size_t t = 0; t < Transform.size(); ++t) {
+  for (index_t t = 0; t < Transform.size(); ++t) {
     for (map<recipe_number, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) {
       recipe& r = p->second;
       if (r.steps.empty()) continue;
@@ -33,12 +33,12 @@ void parse_int_reagents() {
   for (map<recipe_number, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) {
     recipe& r = p->second;
     if (r.steps.empty()) continue;
-    for (size_t index = 0; index < r.steps.size(); ++index) {
+    for (index_t index = 0; index < r.steps.size(); ++index) {
       instruction& inst = r.steps[index];
-      for (size_t i = 0; i < inst.ingredients.size(); ++i) {
+      for (index_t i = 0; i < inst.ingredients.size(); ++i) {
         populate_value(inst.ingredients[i]);
       }
-      for (size_t i = 0; i < inst.products.size(); ++i) {
+      for (index_t i = 0; i < inst.products.size(); ++i) {
         populate_value(inst.products[i]);
       }
     }