about summary refs log tree commit diff stats
path: root/LICENSE
Commit message (Collapse)AuthorAgeFilesLines
* Jukka also belongs to Copyright holders after all he has contributed and ↵Anselm R. Garbe2007-05-301-0/+1
| | | | done for dwm, updated -v as well
* added nsz to copyright holders as well, because he did a lot recentlyAnselm R. Garbe2007-05-291-0/+1
|
* added anydot to Copyright holders, because he contributed a lot recentlyAnselm R. Garbe2007-05-291-0/+1
|
* I used 2006 in other places as wellAnselm R. Garbe2007-04-131-1/+1
|
* making Copyright notices more compactAnselm R. Garbe2007-04-131-2/+2
|
* correctionsarg@mig292007-01-021-2/+2
|
* next version will contain updated copyright noticearg@mig292007-01-021-2/+2
|
* added Sander to LICENSE (since he has contributed/revised big portions)Anselm R.Garbe2006-08-141-0/+1
|
* initial importAnselm R. Garbe2006-07-101-0/+21
ompiler/nim.nim?h=devel&id=9e6fb3f696b2d28f900506b531a916457b4a263c'>9e6fb3f69 ^
77ba8cb8b ^
9e6fb3f69 ^
77ba8cb8b ^
39cabcdd2 ^

2beaa7a2d ^
9e6fb3f69 ^
e25474154 ^
f530bbd63 ^


d43febf81 ^
214c7a2eb ^

39cabcdd2 ^
fd62116f6 ^





c617479c6 ^
f04d21f27 ^
73919e308 ^
e25474154 ^
fc9fdc2b9 ^
e25474154 ^
92b8fac94 ^
def61c9fc ^


074f276c8 ^
261311001 ^
def61c9fc ^
ae0ab9a10 ^
e4e74034c ^
2f43fdb83 ^
fc9fdc2b9 ^
1b7d8246c ^
92b48dbca ^

fc9fdc2b9 ^
c617479c6 ^
074f276c8 ^
f04d21f27 ^
69b32637b ^

f04d21f27 ^
69b32637b ^

29dac5ed6 ^

f04d21f27 ^
3b7ef2288 ^

e25474154 ^
2df9b442c ^
d66cc0075 ^

f04d21f27 ^
3c2074739 ^
73919e308 ^
627e192f6 ^


201a08e9a ^
fc9fdc2b9 ^
1785c6877 ^
b0a16fb61 ^





842c7f67c ^
35567a1eb ^







fe285b354 ^
3b38ceac2 ^





438703f59 ^
3b38ceac2 ^
201a08e9a ^
e25474154 ^
dd806cafa ^
4aba7421f ^
65fdd641a ^
3d7abb958 ^
65fdd641a ^

b731e6ef1 ^
1e26047c3 ^

f04d21f27 ^
7349d12e9 ^

26b853923 ^
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

 
                            
                                         




                                                   

                                       
                             
       
                                
 
                                                          
                                             
                                                         
                                            
 

                                                                     
                                                                    
                                            
 


                     
                                               

                                             
 





                                       
 
                                                          
                       
                           
       
                                     
                                


                                
                                                     
                            
                            
          
                                                     
                     
                                   
                                     

                                                             
                           
         
                                                     
                                                              

                                                       
                                                                 

                                                                                

                                                  
                                                                                   

                                                                           
                       
                                

                                       
                                              
                                                                               
                             


                               
                                        
                                  
                                  





                                                                                 
                                                                                 







                                                                                  
             





                                                                       
                                                                       
                                      
                                                            
 
                              
                      
 
                                                              

                                                        
                      

                           
                                                

                                
                                       
#
#
#           The Nim Compiler
#        (c) Copyright 2015 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/nim.res".}
  else:
    {.link: "icons/nim_icon.o".}

when defined(amd64) and defined(windows) and defined(vcc):
  {.link: "icons/nim-amd64-windows-vcc.res".}
when defined(i386) and defined(windows) and defined(vcc):
  {.link: "icons/nim-i386-windows-vcc.res".}

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

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(cache: IdentCache; config: ConfigRef) =
  if paramCount() == 0:
    writeCommandLineUsage()
  else:
    # Process command line arguments:
    processCmdLine(passCmd1, "")
    if gProjectName == "-":
      gProjectName = "stdinfile"
      gProjectFull = "stdinfile"
      gProjectPath = canonicalizePath getCurrentDir()
      gProjectIsStdin = true
    elif gProjectName != "":
      try:
        gProjectFull = canonicalizePath(gProjectName)
      except OSError:
        gProjectFull = gProjectName
      let p = splitFile(gProjectFull)
      let dir = if p.dir.len > 0: p.dir else: getCurrentDir()
      gProjectPath = canonicalizePath dir
      gProjectName = p.name
    else:
      gProjectPath = canonicalizePath getCurrentDir()
    loadConfigs(DefaultConfig, config) # load all config files
    let scriptFile = gProjectFull.changeFileExt("nims")
    if fileExists(scriptFile):
      runNimScript(cache, scriptFile, freshDefines=false, config)
      # 'nim foo.nims' means to just run the NimScript file and do nothing more:
      if scriptFile == gProjectFull: return
    elif fileExists(gProjectPath / "config.nims"):
      # directory wide NimScript file
      runNimScript(cache, gProjectPath / "config.nims", freshDefines=false, config)
    # now process command line arguments again, because some options in the
    # command line can overwite the config file's settings
    extccomp.initVars()
    processCmdLine(passCmd2, "")
    if options.command == "":
      rawMessage(errNoCommand, command)
    mainCommand(newModuleGraph(config), cache)
    if optHints in gOptions and hintGCStats in gNotes: echo(GC_getStatistics())
    #echo(GC_getStatistics())
    if msgs.gErrorCounter == 0:
      when hasTinyCBackend:
        if gCmd == cmdRun:
          tccgen.run(commands.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(findNodeJs() & " " & ex & ' ' & commands.arguments)
        elif gCmd == cmdCompileToPHP:
          var ex: string
          if options.outFile.len > 0:
            ex = options.outFile.prependCurDir.quoteShell
          else:
            ex = quoteShell(
              completeCFilePath(changeFileExt(gProjectFull, "php").prependCurDir))
          execExternalProgram("php " & ex & ' ' & commands.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 & ' ' & commands.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(newIdentCache(), newConfigRef())
  when declared(GC_setMaxPause):
    echo GC_getStatistics()
  msgQuit(int8(msgs.gErrorCounter > 0))