nimfix handles helloworld

This commit is contained in:
Araq 2014-09-06 00:50:53 +02:00
commit 7f7b13a45f
9 changed files with 29 additions and 47 deletions

View file

@ -211,25 +211,6 @@ proc commandSuggest =
else: gProjectMainIdx
compileProject(projFile)
proc wantMainModule =
if gProjectFull.len == 0:
if optMainModule.len == 0:
fatal(gCmdLineInfo, errCommandExpectsFilename)
else:
gProjectName = optMainModule
gProjectFull = gProjectPath / gProjectName
gProjectMainIdx = addFileExt(gProjectFull, NimExt).fileInfoIdx
proc requireMainModuleOption =
if optMainModule.len == 0:
fatal(gCmdLineInfo, errMainModuleMustBeSpecified)
else:
gProjectName = optMainModule
gProjectFull = gProjectPath / gProjectName
gProjectMainIdx = addFileExt(gProjectFull, NimExt).fileInfoIdx
proc resetMemory =
resetCompilationLists()
ccgutils.resetCaches()
@ -293,30 +274,24 @@ proc mainCommand* =
# current path is always looked first for modules
prependStr(searchPaths, gProjectPath)
setId(100)
passes.gIncludeFile = includeModule
passes.gImportModule = importModule
case command.normalize
of "c", "cc", "compile", "compiletoc":
# compile means compileToC currently
gCmd = cmdCompileToC
wantMainModule()
commandCompileToC()
of "cpp", "compiletocpp":
extccomp.cExt = ".cpp"
gCmd = cmdCompileToCpp
if cCompiler == ccGcc: setCC("gcc")
wantMainModule()
defineSymbol("cpp")
commandCompileToC()
of "objc", "compiletooc":
extccomp.cExt = ".m"
gCmd = cmdCompileToOC
wantMainModule()
defineSymbol("objc")
commandCompileToC()
of "run":
gCmd = cmdRun
wantMainModule()
when hasTinyCBackend:
extccomp.setCC("tcc")
commandCompileToC()
@ -324,39 +299,32 @@ proc mainCommand* =
rawMessage(errInvalidCommandX, command)
of "js", "compiletojs":
gCmd = cmdCompileToJS
wantMainModule()
commandCompileToJS()
of "compiletollvm":
gCmd = cmdCompileToLLVM
wantMainModule()
when hasLLVM_Backend:
CommandCompileToLLVM()
else:
rawMessage(errInvalidCommandX, command)
of "pretty":
gCmd = cmdPretty
wantMainModule()
commandPretty()
of "doc":
gCmd = cmdDoc
loadConfigs(DocConfig)
wantMainModule()
commandDoc()
of "doc2":
gCmd = cmdDoc
loadConfigs(DocConfig)
wantMainModule()
defineSymbol("nimdoc")
commandDoc2()
of "rst2html":
gCmd = cmdRst2html
loadConfigs(DocConfig)
wantMainModule()
commandRst2Html()
of "rst2tex":
gCmd = cmdRst2tex
loadConfigs(DocTexConfig)
wantMainModule()
commandRst2TeX()
of "jsondoc":
gCmd = cmdDoc
@ -370,12 +338,11 @@ proc mainCommand* =
commandBuildIndex()
of "gendepend":
gCmd = cmdGenDepend
wantMainModule()
commandGenDepend()
of "dump":
gCmd = cmdDump
if getConfigVar("dump.format") == "json":
requireMainModuleOption()
wantMainModule()
var definedSymbols = newJArray()
for s in definedSymbolNames(): definedSymbols.elems.add(%s)
@ -399,7 +366,6 @@ proc mainCommand* =
for it in iterSearchPath(searchPaths): msgWriteln(it)
of "check":
gCmd = cmdCheck
wantMainModule()
commandCheck()
of "parse":
gCmd = cmdParse
@ -423,7 +389,6 @@ proc mainCommand* =
if gEvalExpr != "":
commandEval(gEvalExpr)
else:
wantMainModule()
commandSuggest()
of "serve":
isServing = true