diff options
author | koranza <stflynn@hotmail.com> | 2018-05-18 16:20:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-18 16:20:13 -0500 |
commit | 39988eb1cfae043271376bd21fa301ba2115b59c (patch) | |
tree | 661b2410afde62935766ccdf1f1803a1e8e7715f /compiler/service.nim | |
parent | b75008292506d49f2641550457354267e11e1116 (diff) | |
parent | 06bdf8392bd3e597dbe3ef12c7a819b60e32d7ac (diff) | |
download | Nim-39988eb1cfae043271376bd21fa301ba2115b59c.tar.gz |
Merge pull request #1 from nim-lang/devel
updating my fork with the head repo
Diffstat (limited to 'compiler/service.nim')
-rw-r--r-- | compiler/service.nim | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/compiler/service.nim b/compiler/service.nim index ac04b7860..f1a988ae5 100644 --- a/compiler/service.nim +++ b/compiler/service.nim @@ -11,7 +11,7 @@ import times, commands, options, msgs, nimconf, - extccomp, strutils, os, platform, parseopt, idents + extccomp, strutils, os, platform, parseopt, idents, configuration when useCaas: import net @@ -26,7 +26,7 @@ var # in caas mode, the list of defines and options will be given at start-up? # it's enough to check that the previous compilation command is the same? -proc processCmdLine*(pass: TCmdLinePass, cmd: string) = +proc processCmdLine*(pass: TCmdLinePass, cmd: string; config: ConfigRef) = var p = parseopt.initOptParser(cmd) var argsCount = 0 while true: @@ -36,23 +36,23 @@ proc processCmdLine*(pass: TCmdLinePass, cmd: string) = of cmdLongoption, cmdShortOption: if p.key == " ": p.key = "-" - if processArgument(pass, p, argsCount): break + if processArgument(pass, p, argsCount, config): break else: - processSwitch(pass, p) + processSwitch(pass, p, config) of cmdArgument: - if processArgument(pass, p, argsCount): break + if processArgument(pass, p, argsCount, config): break if pass == passCmd2: - if optRun notin gGlobalOptions and arguments != "" and options.command.normalize != "run": - rawMessage(errArgsNeedRunOption, []) + if optRun notin config.globalOptions and config.arguments.len > 0 and config.command.normalize != "run": + rawMessage(config, errGenerated, errArgsNeedRunOption) -proc serve*(cache: IdentCache; action: proc (cache: IdentCache){.nimcall.}) = +proc serve*(cache: IdentCache; action: proc (cache: IdentCache){.nimcall.}; config: ConfigRef) = template execute(cmd) = curCaasCmd = cmd - processCmdLine(passCmd2, cmd) + processCmdLine(passCmd2, cmd, config) action(cache) - gErrorCounter = 0 + config.errorCounter = 0 - let typ = getConfigVar("server.type") + let typ = getConfigVar(config, "server.type") case typ of "stdin": while true: @@ -65,9 +65,9 @@ proc serve*(cache: IdentCache; action: proc (cache: IdentCache){.nimcall.}) = of "tcp", "": when useCaas: var server = newSocket() - let p = getConfigVar("server.port") + let p = getConfigVar(config, "server.port") let port = if p.len > 0: parseInt(p).Port else: 6000.Port - server.bindAddr(port, getConfigVar("server.address")) + server.bindAddr(port, getConfigVar(config, "server.address")) var inp = "".TaintedString server.listen() var stdoutSocket = newSocket() |