summary refs log tree commit diff stats
path: root/commands/global.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/global.go')
0 files changed, 0 insertions, 0 deletions
hor Araq <rumpf_a@web.de> 2012-03-04 21:44:56 +0100 committer Araq <rumpf_a@web.de> 2012-03-04 21:44:56 +0100 win64 is a supported target; bugfix: nimrod c -r on windows; stdlib uses wide char versions of the WinAPI' href='/ahoang/Nim/commit/compiler/nimrod.nim?h=devel&id=ff4a69b6243f8f14cea78d428d2fd78ee4be3823'>ff4a69b62 ^
765366c1f ^
39cabcdd2 ^


e25474154 ^
f530bbd63 ^


d43febf81 ^
214c7a2eb ^

39cabcdd2 ^
fd62116f6 ^





c617479c6 ^
2df9b442c ^
73919e308 ^
e25474154 ^
fc9fdc2b9 ^
e25474154 ^
92b8fac94 ^
fc9fdc2b9 ^
ae0ab9a10 ^
e4e74034c ^
2f43fdb83 ^
fc9fdc2b9 ^



c617479c6 ^
e4e74034c ^
2df9b442c ^
3b7ef2288 ^

e25474154 ^
2df9b442c ^

e25474154 ^
73919e308 ^
627e192f6 ^


d9b5ae13b ^
fc9fdc2b9 ^
1785c6877 ^
b0a16fb61 ^





01dfcf631 ^
fe285b354 ^
3b38ceac2 ^





438703f59 ^
3b38ceac2 ^
01dfcf631 ^
e25474154 ^
dd806cafa ^
4aba7421f ^
65fdd641a ^
3d7abb958 ^
65fdd641a ^

b731e6ef1 ^
1e26047c3 ^

2df9b442c ^
1e26047c3 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92


                               
                                         




                                                   




                                       
 


                                                                     
 


                     
                                               

                                             
 





                                       
 
                      
                       
                           
       
                                     
                                
                          
          
                                                     
                     



                                     
         
                                    
                                                      

                                                                           
                       

                                
                                                
                             


                               
                                       
                                  
                                  





                                                                                 
                                                                     
             





                                                                       
                                                                       
                                      
                                                           
 
                              
                      
 
                                                              

                                                        
                      

                           
                 
                                    
#
#
#           The Nimrod Compiler
#        (c) Copyright 2013 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

when defined(gcc) and defined(windows):
  when defined(x86):
    {.link: "icons/nimrod.res".}
  else:
    {.link: "icons/nimrod_icon.o".}

import
  commands, lexer, condsyms, options, msgs, nversion, nimconf, ropes,
  extccomp, strutils, os, osproc, platform, main, parseopt, service

when hasTinyCBackend:
  import tccgen

when defined(profiler) or defined(memProfiler):
  {.hint: "Profiling support is turned on!".}
  import nimprof

proc prependCurDir(f: string): string =
  when defined(unix):
    if os.isAbsolute(f): result = f
    else: result = "./" & f
  else:
    result = f

proc handleCmdLine() =
  if paramCount() == 0:
    writeCommandLineUsage()
  else:
    # Process command line arguments:
    processCmdLine(passCmd1, "")
    if gProjectName != "":
      try:
        gProjectFull = canonicalizePath(gProjectName)
      except OSError:
        gProjectFull = gProjectName
      var p = splitFile(gProjectFull)
      gProjectPath = p.dir
      gProjectName = p.name
    else:
      gProjectPath = getCurrentDir()
    loadConfigs(DefaultConfig) # load all config files
    # now process command line arguments again, because some options in the
    # command line can overwite the config file's settings
    extccomp.initVars()
    processCmdLine(passCmd2, "")
    mainCommand()
    if gVerbosity >= 2: echo(GC_getStatistics())
    #echo(GC_getStatistics())
    if msgs.gErrorCounter == 0:
      when hasTinyCBackend:
        if gCmd == cmdRun:
          tccgen.run(service.arguments)
      if optRun in gGlobalOptions:
        if gCmd == cmdCompileToJS:
          var ex: string
          if options.outFile.len > 0:
            ex = options.outFile.prependCurDir.quoteShell
          else:
            ex = quoteShell(
              completeCFilePath(changeFileExt(gProjectFull, "js").prependCurDir))
          execExternalProgram("node " & ex & ' ' & service.arguments)
        else:
          var binPath: string
          if options.outFile.len > 0:
            # If the user specified an outFile path, use that directly.
            binPath = options.outFile.prependCurDir
          else:
            # Figure out ourselves a valid binary name.
            binPath = changeFileExt(gProjectFull, ExeExt).prependCurDir
          var ex = quoteShell(binPath)
          execExternalProgram(ex & ' ' & service.arguments)

when declared(GC_setMaxPause):
  GC_setMaxPause 2_000

when compileOption("gc", "v2") or compileOption("gc", "refc"):
  # the new correct mark&sweet collector is too slow :-/
  GC_disableMarkAndSweep()
condsyms.initDefines()

when not defined(selftest):
  handleCmdLine()
  quit(int8(msgs.gErrorCounter > 0))