case consistency part 5

This commit is contained in:
Araq
2013-12-28 00:37:45 +01:00
parent 92b8fac94a
commit 9c3751a37c
10 changed files with 42 additions and 42 deletions

View File

@@ -568,7 +568,7 @@ proc suggestWriteln*(s: string) =
writeln(stdout, s)
stdoutSocket.send(s & "\c\L")
else:
Writeln(stdout, s)
writeln(stdout, s)
if eInMemory in errorOutputs:
bufferedMsgs.safeAdd(s)

View File

@@ -110,16 +110,16 @@ proc findStartNimrod: string =
# If these fail, we try to build nimrod with the "build.(sh|bat)" script.
var nimrod = "nimrod".exe
result = "bin" / nimrod
if ExistsFile(result): return
if existsFile(result): return
for dir in split(getEnv("PATH"), PathSep):
if ExistsFile(dir / nimrod): return nimrod
if existsFile(dir / nimrod): return nimrod
when defined(Posix):
const buildScript = "build.sh"
if ExistsFile(buildScript):
if tryExec("./" & buildScript): return "bin" / nimrod
else:
const buildScript = "build.bat"
if ExistsFile(buildScript):
if existsFile(buildScript):
if tryExec(buildScript): return "bin" / nimrod
echo("Found no nimrod compiler and every attempt to build one failed!")
@@ -188,14 +188,14 @@ proc removePattern(pattern: string) =
removeFile(f)
proc clean(args: string) =
if ExistsFile("koch.dat"): removeFile("koch.dat")
if existsFile("koch.dat"): removeFile("koch.dat")
removePattern("web/*.html")
removePattern("doc/*.html")
cleanAux(getCurrentDir())
for kind, path in walkDir(getCurrentDir() / "build"):
if kind == pcDir:
echo "removing dir: ", path
RemoveDir(path)
removeDir(path)
# -------------- update -------------------------------------------------------

View File

@@ -113,7 +113,7 @@ proc handleHexChar(c: var TCfgParser, xi: var int) =
xi = (xi shl 4) or (ord(c.buf[c.bufpos]) - ord('A') + 10)
inc(c.bufpos)
else:
nil
discard
proc handleDecChars(c: var TCfgParser, xi: var int) =
while c.buf[c.bufpos] in {'0'..'9'}:
@@ -125,54 +125,54 @@ proc getEscapedChar(c: var TCfgParser, tok: var TToken) =
case c.buf[c.bufpos]
of 'n', 'N':
add(tok.literal, "\n")
Inc(c.bufpos)
inc(c.bufpos)
of 'r', 'R', 'c', 'C':
add(tok.literal, '\c')
Inc(c.bufpos)
inc(c.bufpos)
of 'l', 'L':
add(tok.literal, '\L')
Inc(c.bufpos)
inc(c.bufpos)
of 'f', 'F':
add(tok.literal, '\f')
inc(c.bufpos)
of 'e', 'E':
add(tok.literal, '\e')
Inc(c.bufpos)
inc(c.bufpos)
of 'a', 'A':
add(tok.literal, '\a')
Inc(c.bufpos)
inc(c.bufpos)
of 'b', 'B':
add(tok.literal, '\b')
Inc(c.bufpos)
inc(c.bufpos)
of 'v', 'V':
add(tok.literal, '\v')
Inc(c.bufpos)
inc(c.bufpos)
of 't', 'T':
add(tok.literal, '\t')
Inc(c.bufpos)
inc(c.bufpos)
of '\'', '"':
add(tok.literal, c.buf[c.bufpos])
Inc(c.bufpos)
inc(c.bufpos)
of '\\':
add(tok.literal, '\\')
Inc(c.bufpos)
inc(c.bufpos)
of 'x', 'X':
inc(c.bufpos)
var xi = 0
handleHexChar(c, xi)
handleHexChar(c, xi)
add(tok.literal, Chr(xi))
add(tok.literal, chr(xi))
of '0'..'9':
var xi = 0
handleDecChars(c, xi)
if (xi <= 255): add(tok.literal, Chr(xi))
if (xi <= 255): add(tok.literal, chr(xi))
else: tok.kind = tkInvalid
else: tok.kind = tkInvalid
proc HandleCRLF(c: var TCfgParser, pos: int): int =
proc handleCRLF(c: var TCfgParser, pos: int): int =
case c.buf[pos]
of '\c': result = lexbase.HandleCR(c, pos)
of '\L': result = lexbase.HandleLF(c, pos)
of '\c': result = lexbase.handleCR(c, pos)
of '\L': result = lexbase.handleLF(c, pos)
else: result = pos
proc getString(c: var TCfgParser, tok: var TToken, rawMode: bool) =
@@ -183,16 +183,16 @@ proc getString(c: var TCfgParser, tok: var TToken, rawMode: bool) =
# long string literal:
inc(pos, 2) # skip ""
# skip leading newline:
pos = HandleCRLF(c, pos)
pos = handleCRLF(c, pos)
buf = c.buf
while true:
case buf[pos]
of '"':
if (buf[pos + 1] == '"') and (buf[pos + 2] == '"'): break
add(tok.literal, '"')
Inc(pos)
inc(pos)
of '\c', '\L':
pos = HandleCRLF(c, pos)
pos = handleCRLF(c, pos)
buf = c.buf
add(tok.literal, "\n")
of lexbase.EndOfFile:
@@ -200,7 +200,7 @@ proc getString(c: var TCfgParser, tok: var TToken, rawMode: bool) =
break
else:
add(tok.literal, buf[pos])
Inc(pos)
inc(pos)
c.bufpos = pos + 3 # skip the three """
else:
# ordinary string literal
@@ -218,7 +218,7 @@ proc getString(c: var TCfgParser, tok: var TToken, rawMode: bool) =
pos = c.bufPos
else:
add(tok.literal, ch)
Inc(pos)
inc(pos)
c.bufpos = pos
proc getSymbol(c: var TCfgParser, tok: var TToken) =
@@ -226,7 +226,7 @@ proc getSymbol(c: var TCfgParser, tok: var TToken) =
var buf = c.buf
while true:
add(tok.literal, buf[pos])
Inc(pos)
inc(pos)
if not (buf[pos] in SymChars): break
c.bufpos = pos
tok.kind = tkSymbol
@@ -237,11 +237,11 @@ proc skip(c: var TCfgParser) =
while true:
case buf[pos]
of ' ', '\t':
Inc(pos)
inc(pos)
of '#', ';':
while not (buf[pos] in {'\c', '\L', lexbase.EndOfFile}): inc(pos)
of '\c', '\L':
pos = HandleCRLF(c, pos)
pos = handleCRLF(c, pos)
buf = c.buf
else:
break # EndOfFile also leaves the loop
@@ -249,7 +249,7 @@ proc skip(c: var TCfgParser) =
proc rawGetTok(c: var TCfgParser, tok: var TToken) =
tok.kind = tkInvalid
setlen(tok.literal, 0)
setLen(tok.literal, 0)
skip(c)
case c.buf[c.bufpos]
of '=':
@@ -267,7 +267,7 @@ proc rawGetTok(c: var TCfgParser, tok: var TToken) =
tok.literal = ":"
of 'r', 'R':
if c.buf[c.bufPos + 1] == '\"':
Inc(c.bufPos)
inc(c.bufPos)
getString(c, tok, true)
else:
getSymbol(c, tok)
@@ -277,7 +277,7 @@ proc rawGetTok(c: var TCfgParser, tok: var TToken) =
tok.literal = "]"
of ']':
tok.kind = tkBracketRi
Inc(c.bufpos)
inc(c.bufpos)
tok.literal = "]"
of '"':
getString(c, tok, false)

View File

@@ -1,5 +1,5 @@
#! stdtmpl(subsChar='?') | standard
#proc GenerateBuildBatchScript(c: TConfigData, winIndex, cpuIndex: int): string =
#proc generateBuildBatchScript(c: TConfigData, winIndex, cpuIndex: int): string =
# result = "@echo off\nREM Generated by niminst\n"
SET CC=gcc
SET LINKER=gcc

View File

@@ -1,5 +1,5 @@
#! stdtmpl(subsChar='?') | standard
#proc GenerateBuildShellScript(c: TConfigData): string =
#proc generateBuildShellScript(c: TConfigData): string =
# result = "#! /bin/sh\n# Generated from niminst\n" &
# "# Template is in tools/buildsh.tmpl\n" &
# "# To regenerate run ``niminst csource`` or ``koch csource``\n"

View File

@@ -101,7 +101,7 @@ proc createChangelog(pkgName, version, maintainer: string): string =
addN(" * Initial release.")
addN("")
addN(" -- " & maintainer & " " &
formatDateTime(getGmTime(getTime()), "+0000"))
formatDateTime(getGMTime(getTime()), "+0000"))
proc createRules(): string =
## Creates a nimrod application-agnostic rules file for building deb packages.

View File

@@ -1,5 +1,5 @@
#! stdtmpl(subsChar='?') | standard
#proc GenerateDeinstallScript(c: TConfigData): string =
#proc generateDeinstallScript(c: TConfigData): string =
# result = "#! /bin/sh\n# Generated by niminst\n"
# var proj = c.name.toLower

View File

@@ -1,5 +1,5 @@
#! stdtmpl | standard
#proc GenerateInnoSetup(c: TConfigData): string =
#proc generateInnoSetup(c: TConfigData): string =
# result = ""
; Default Template for NimInst
[Setup]

View File

@@ -1,5 +1,5 @@
#! stdtmpl(subsChar = '?') | standard
#proc GenerateInstallScript(c: TConfigData): string =
#proc generateInstallScript(c: TConfigData): string =
# result = "#! /bin/sh\n# Generated by niminst\n"
# var proj = c.name.toLower

View File

@@ -188,7 +188,7 @@ proc parseCmdLine(c: var TConfigData) =
proc walkDirRecursively(s: var seq[string], root: string) =
for k, f in walkDir(root):
case k
of pcFile, pcLinkToFile: add(s, UnixToNativePath(f))
of pcFile, pcLinkToFile: add(s, unixToNativePath(f))
of pcDir: walkDirRecursively(s, f)
of pcLinkToDir: nil
@@ -199,7 +199,7 @@ proc addFiles(s: var seq[string], patterns: seq[string]) =
else:
var i = 0
for f in walkFiles(p):
add(s, UnixToNativePath(f))
add(s, unixToNativePath(f))
inc(i)
if i == 0: echo("[Warning] No file found that matches: " & p)
@@ -286,7 +286,7 @@ proc parseIniFile(c: var TConfigData) =
of "console": c.app = appConsole
of "gui": c.app = appGUI
else: quit(errorStr(p, "expected: console or gui"))
of "license": c.license = UnixToNativePath(k.value)
of "license": c.license = unixToNativePath(k.value)
else: quit(errorStr(p, "unknown variable: " & k.key))
of "var": nil
of "winbin": filesOnly(p, k.key, v, c.cat[fcWinBin])