summary refs log tree commit diff stats
path: root/rod/nimrod.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <andreas@andreas-laptop>2010-04-02 19:34:57 +0200
committerAndreas Rumpf <andreas@andreas-laptop>2010-04-02 19:34:57 +0200
commitf530bbd6315f21469d7479991186e88302608726 (patch)
tree8b05aba5a3d407d50160c448fa2ba5b2fa952a6f /rod/nimrod.nim
parent227b76c34259cf406131d27fb8e0cc88530e38f7 (diff)
downloadNim-f530bbd6315f21469d7479991186e88302608726.tar.gz
tiny C backend for a much faster REPL
Diffstat (limited to 'rod/nimrod.nim')
-rwxr-xr-xrod/nimrod.nim15
1 files changed, 10 insertions, 5 deletions
diff --git a/rod/nimrod.nim b/rod/nimrod.nim
index a6f3365c2..26bfcde2d 100755
--- a/rod/nimrod.nim
+++ b/rod/nimrod.nim
@@ -11,6 +11,9 @@ import
   times, commands, scanner, condsyms, options, msgs, nversion, nimconf, ropes, 
   extccomp, strutils, os, platform, main, parseopt
 
+when hasTinyCBackend:
+  import tccgen
+
 var 
   arguments: string = ""      # the arguments to be passed to the program that
                               # should be run
@@ -21,8 +24,7 @@ proc ProcessCmdLine(pass: TCmdLinePass, command, filename: var string) =
   while true: 
     parseopt.next(p)
     case p.kind
-    of cmdEnd: 
-      break 
+    of cmdEnd: break 
     of cmdLongOption, cmdShortOption: 
       # hint[X]:off is parsed as (p.key = "hint[X]", p.val = "off")
       # we fix this here
@@ -41,7 +43,7 @@ proc ProcessCmdLine(pass: TCmdLinePass, command, filename: var string) =
         break 
   if pass == passCmd2: 
     arguments = cmdLineRest(p)
-    if not (optRun in gGlobalOptions) and (arguments != ""): 
+    if optRun notin gGlobalOptions and arguments != "": 
       rawMessage(errArgsNeedRunOption, [])
   
 proc HandleCmdLine() = 
@@ -63,8 +65,11 @@ proc HandleCmdLine() =
     ProcessCmdLine(passCmd2, command, filename)
     MainCommand(command, filename)
     if gVerbosity >= 2: echo(GC_getStatistics())
-    if (gCmd != cmdInterpret) and (msgs.gErrorCounter == 0): 
-      rawMessage(hintSuccessX, [$(gLinesCompiled), $(getTime() - start)])
+    when hasTinyCBackend:
+      if gCmd == cmdRun:
+        tccgen.run()
+    if gCmd notin {cmdInterpret, cmdRun} and msgs.gErrorCounter == 0: 
+      rawMessage(hintSuccessX, [$gLinesCompiled, $(getTime() - start)])
     if optRun in gGlobalOptions: 
       when defined(unix): 
         var prog = "./" & quoteIfContainsWhite(changeFileExt(filename, ""))