mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-27 09:43:58 +00:00
minor style changes
This commit is contained in:
@@ -26,9 +26,9 @@ proc process(dir, infile: string, outfile: File,
|
||||
proc main(dir, outfile: string) =
|
||||
var o: File
|
||||
if open(o, outfile, fmWrite):
|
||||
var processed = initSet[string]()
|
||||
var processed = initHashSet[string]()
|
||||
processed.incl(outfile)
|
||||
for infile in walkfiles(dir / "*.c"):
|
||||
for infile in walkFiles(dir / "*.c"):
|
||||
discard process(dir, extractFilename(infile), o, processed)
|
||||
close(o)
|
||||
else:
|
||||
|
||||
@@ -28,7 +28,7 @@ proc findNim*(): string =
|
||||
proc exec*(cmd: string, errorcode: int = QuitFailure, additionalPath = "") =
|
||||
let prevPath = getEnv("PATH")
|
||||
if additionalPath.len > 0:
|
||||
var absolute = additionalPATH
|
||||
var absolute = additionalPath
|
||||
if not absolute.isAbsolute:
|
||||
absolute = getCurrentDir() / absolute
|
||||
echo("Adding to $PATH: ", absolute)
|
||||
@@ -57,10 +57,10 @@ proc execCleanPath*(cmd: string,
|
||||
# simulate a poor man's virtual environment
|
||||
let prevPath = getEnv("PATH")
|
||||
when defined(windows):
|
||||
let CleanPath = r"$1\system32;$1;$1\System32\Wbem" % getEnv"SYSTEMROOT"
|
||||
let cleanPath = r"$1\system32;$1;$1\System32\Wbem" % getEnv"SYSTEMROOT"
|
||||
else:
|
||||
const CleanPath = r"/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"
|
||||
putEnv("PATH", CleanPath & PathSep & additionalPath)
|
||||
const cleanPath = r"/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"
|
||||
putEnv("PATH", cleanPath & PathSep & additionalPath)
|
||||
echo(cmd)
|
||||
if execShellCmd(cmd) != 0: quit("FAILURE", errorcode)
|
||||
putEnv("PATH", prevPath)
|
||||
@@ -280,14 +280,14 @@ lib/wrappers/odbcsql.nim
|
||||
lib/js/jscore.nim
|
||||
""".splitWhitespace()
|
||||
|
||||
proc sexec(cmds: openarray[string]) =
|
||||
proc sexec(cmds: openArray[string]) =
|
||||
## Serial queue wrapper around exec.
|
||||
for cmd in cmds:
|
||||
echo(cmd)
|
||||
let (outp, exitCode) = osproc.execCmdEx(cmd)
|
||||
if exitCode != 0: quit outp
|
||||
|
||||
proc mexec(cmds: openarray[string]) =
|
||||
proc mexec(cmds: openArray[string]) =
|
||||
## Multiprocessor version of exec
|
||||
let r = execProcesses(cmds, {poStdErrToStdOut, poParentStreams, poEchoCmd})
|
||||
if r != 0:
|
||||
|
||||
@@ -89,14 +89,14 @@ proc countLines(s: string, first, last: int): int =
|
||||
proc beforePattern(s: string, first: int): int =
|
||||
result = first-1
|
||||
while result >= 0:
|
||||
if s[result] in NewLines: break
|
||||
if s[result] in Newlines: break
|
||||
dec(result)
|
||||
inc(result)
|
||||
|
||||
proc afterPattern(s: string, last: int): int =
|
||||
result = last+1
|
||||
while result < s.len:
|
||||
if s[result] in NewLines: break
|
||||
if s[result] in Newlines: break
|
||||
inc(result)
|
||||
dec(result)
|
||||
|
||||
@@ -280,7 +280,7 @@ for kind, key, val in getopt():
|
||||
replacement = key
|
||||
else:
|
||||
filenames.add(key)
|
||||
of cmdLongoption, cmdShortOption:
|
||||
of cmdLongOption, cmdShortOption:
|
||||
case normalize(key)
|
||||
of "find", "f": incl(options, optFind)
|
||||
of "replace", "r": incl(options, optReplace)
|
||||
|
||||
@@ -185,7 +185,7 @@ proc parseCmdLine(c: var ConfigData) =
|
||||
c.infile = addFileExt(key.string, "ini")
|
||||
c.nimArgs = cmdLineRest(p).string
|
||||
break
|
||||
of cmdLongoption, cmdShortOption:
|
||||
of cmdLongOption, cmdShortOption:
|
||||
case normalize(key.string)
|
||||
of "help", "h":
|
||||
stdout.write(Usage)
|
||||
|
||||
Reference in New Issue
Block a user