about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-03-17 08:42:38 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-03-17 09:06:48 -0700
commitb1bbe92da37dd44df458ffa122e052612bb9eff3 (patch)
tree976cde85c97d4877eb8c1e5151a919406fdd1049
parentc062697c9ff3c8cb0938f56bed3df2af3d122bd6 (diff)
downloadmu-b1bbe92da37dd44df458ffa122e052612bb9eff3.tar.gz
945 - move 'transform' layer to before 'run'
-rw-r--r--cpp/012transform (renamed from cpp/023transform)12
-rw-r--r--cpp/013run (renamed from cpp/012run)1
-rw-r--r--cpp/014arithmetic (renamed from cpp/013arithmetic)0
-rw-r--r--cpp/015boolean (renamed from cpp/014boolean)0
-rw-r--r--cpp/016jump (renamed from cpp/015jump)0
-rw-r--r--cpp/017compare (renamed from cpp/016compare)0
-rw-r--r--cpp/018record (renamed from cpp/017record)0
-rw-r--r--cpp/019address (renamed from cpp/018address)0
-rw-r--r--cpp/020array (renamed from cpp/019array)0
-rw-r--r--cpp/021call (renamed from cpp/020call)0
-rw-r--r--cpp/022call_ingredient (renamed from cpp/021call_ingredient)0
-rw-r--r--cpp/023call_reply (renamed from cpp/022call_reply)0
-rwxr-xr-xcpp/relayout61
13 files changed, 64 insertions, 10 deletions
diff --git a/cpp/023transform b/cpp/012transform
index faada76e..bb130187 100644
--- a/cpp/023transform
+++ b/cpp/012transform
@@ -1,17 +1,9 @@
-//: Let's start making mu more ergonomic to use. We'll create a list of tools
-//: that each transform a recipe. Anybody can add to the list.
+//: Once a set of recipes is loaded, it can be filtered through an extensible
+//: list of 'transforms'.
 //:
 //: The hope is that this framework of transform tools will provide a
 //: deconstructed alternative to conventional compilers.
 
-:(replace{} "void run(string form)")
-void run(string form) {
-  vector<recipe_number> tmp = add_recipes(form);
-  recipes_added_by_test.insert(recipes_added_by_test.end(), tmp.begin(), tmp.end());
-  transform_all();
-  run(recipes_added_by_test.front());
-}
-
 :(before "End Recipe Fields")
 size_t transformed_until;
   recipe() :transformed_until(-1) {}
diff --git a/cpp/012run b/cpp/013run
index f4dd6390..cd0a08a6 100644
--- a/cpp/012run
+++ b/cpp/013run
@@ -98,6 +98,7 @@ vector<recipe_number> recipes_added_by_test;
 void run(string form) {
   vector<recipe_number> tmp = add_recipes(form);
   recipes_added_by_test.insert(recipes_added_by_test.end(), tmp.begin(), tmp.end());
+  transform_all();
   run(recipes_added_by_test.front());
 }
 
diff --git a/cpp/013arithmetic b/cpp/014arithmetic
index 846fdff3..846fdff3 100644
--- a/cpp/013arithmetic
+++ b/cpp/014arithmetic
diff --git a/cpp/014boolean b/cpp/015boolean
index e6dd12ba..e6dd12ba 100644
--- a/cpp/014boolean
+++ b/cpp/015boolean
diff --git a/cpp/015jump b/cpp/016jump
index 2ce18859..2ce18859 100644
--- a/cpp/015jump
+++ b/cpp/016jump
diff --git a/cpp/016compare b/cpp/017compare
index 57f70279..57f70279 100644
--- a/cpp/016compare
+++ b/cpp/017compare
diff --git a/cpp/017record b/cpp/018record
index f42531be..f42531be 100644
--- a/cpp/017record
+++ b/cpp/018record
diff --git a/cpp/018address b/cpp/019address
index cd4f180e..cd4f180e 100644
--- a/cpp/018address
+++ b/cpp/019address
diff --git a/cpp/019array b/cpp/020array
index 8a9af8c4..8a9af8c4 100644
--- a/cpp/019array
+++ b/cpp/020array
diff --git a/cpp/020call b/cpp/021call
index 2e0000c0..2e0000c0 100644
--- a/cpp/020call
+++ b/cpp/021call
diff --git a/cpp/021call_ingredient b/cpp/022call_ingredient
index 0401d5b9..0401d5b9 100644
--- a/cpp/021call_ingredient
+++ b/cpp/022call_ingredient
diff --git a/cpp/022call_reply b/cpp/023call_reply
index 17f2c463..17f2c463 100644
--- a/cpp/022call_reply
+++ b/cpp/023call_reply
diff --git a/cpp/relayout b/cpp/relayout
new file mode 100755
index 00000000..e0b38c4b
--- /dev/null
+++ b/cpp/relayout
@@ -0,0 +1,61 @@
+#!/usr/bin/env zsh
+# Helper to change the numerical prefixes across the repo, say if you want to
+# create room between 023 and 024, and so on.
+
+setopt extendedglob
+
+if [[ $# -eq 0 && `git diff HEAD |wc -l` -gt 0 ]]
+then
+  echo "Uncommitted changes"
+  exit
+fi
+
+if [[ $# -gt 0 ]] # dry run
+then
+  git() {
+    echo $*
+  }
+fi
+
+#
+
+index=0
+ls [0-9]* |grep -v "^002trace.tests$" |sort -n |perl -pwe 's/\..*//' |
+  while read file
+  do
+    echo $file >&2
+    while [[ $file != `printf "%03d" $index`* ]]
+    do
+      echo
+      index=$(($index+1))
+    done
+    echo $file
+    index=$(($index+1))
+  done > .layout
+
+vim -c "set nu" .layout
+
+#
+
+root() {
+  echo $1 |perl -pwe 's/^[0-9]*//' |perl -pwe 's/\..*//'
+}
+
+index=0
+cat .layout |
+  while read file
+  do
+    if [ ! -z $file ]
+    then
+      newfile=`printf "%03d" $index``root $file`
+      if [[ $newfile != $file ]]
+      then
+        git mv $file $newfile
+      fi
+    fi
+    index=$(($index+1))
+  done
+
+#
+
+rm .layout