summary refs log tree commit diff stats
path: root/koch.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-03-23 01:09:52 +0100
committerAraq <rumpf_a@web.de>2011-03-23 01:09:52 +0100
commit5b789f2da8e57ea2adf0c088f5e41fd7a71fe89b (patch)
tree81f2f23d48d56ef7b106d24982231d99809a6def /koch.nim
parent8d734244b14e09c97267432468ac20fcf8ff82eb (diff)
downloadNim-5b789f2da8e57ea2adf0c088f5e41fd7a71fe89b.tar.gz
bugfixes; field discriminant checks; linearScanEnd, unroll, shallow pragmas
Diffstat (limited to 'koch.nim')
-rwxr-xr-xkoch.nim39
1 files changed, 20 insertions, 19 deletions
diff --git a/koch.nim b/koch.nim
index 45cd9dae1..4eddb06e4 100755
--- a/koch.nim
+++ b/koch.nim
@@ -131,28 +131,29 @@ proc findStartNimrod: string =
 proc safeRemove(filename: string) = 
   if existsFile(filename): removeFile(filename)
 
-proc bootIteration(args: string): bool = 
-  var nimrod1 = "rod" / "nimrod1".exe
-  safeRemove(nimrod1)
-  moveFile(dest=nimrod1, source="rod" / "nimrod".exe)
-  exec "rod" / "nimrod1 cc $# $# rod/nimrod.nim" % [bootOptions, args]
-  # Nimrod does not produce an executable again if nothing changed. That's ok:
-  result = sameFileContent("rod" / "nimrod".exe, nimrod1)
-  var dest = "bin" / "nimrod".exe
+proc thVersion(i: int): string = 
+  result = ("rod" / "nimrod" & $i).exe
+
+proc copyExe(source, dest: string) =
   safeRemove(dest)
-  copyFile(dest=dest, source="rod" / "nimrod".exe)
+  copyFile(dest=dest, source=source)
   inclFilePermissions(dest, {fpUserExec})
-  safeRemove(nimrod1)
-  if result: echo "executables are equal: SUCCESS!"
-
+  
 proc boot(args: string) =
-  echo "iteration: 1"
-  exec findStartNimrod() & " cc $# $# rod" / "nimrod.nim" % [bootOptions, args]
-  echo "iteration: 2"
-  if not bootIteration(args):
-    echo "executables are not equal: compile once again..."
-    if not bootIteration(args):
-      echo "[Warning] executables are still not equal"
+  var output = "rod" / "nimrod".exe
+  var finalDest = "bin" / "nimrod".exe
+  
+  copyExe(findStartNimrod(), 0.thVersion)
+  for i in 0..2:
+    echo "iteration: ", i+1
+    exec i.thVersion & " cc $# $# rod" / "nimrod.nim" % [bootOptions, args]
+    if sameFileContent(output, i.thVersion):
+      copyExe(output, finalDest)
+      echo "executables are equal: SUCCESS!"
+      return
+    copyExe(output, (i+1).thVersion)
+  copyExe(output, finalDest)
+  echo "[Warning] executables are still not equal"
 
 # -------------- clean --------------------------------------------------------