implemented multi methods
This commit is contained in:
parent
66a7e3d37c
commit
3f3dda5a77
65 changed files with 11086 additions and 1258 deletions
|
|
@ -20,7 +20,7 @@ Name: english; MessagesFile: compiler:Default.isl
|
|||
[Files]
|
||||
#for i in low(TFileCategory)..fcWindows:
|
||||
# for f in items(c.cat[i]):
|
||||
Source: ${expandFilename(f)}; DestDir: {app}\${extractDir(f)}; Flags: ignoreversion
|
||||
Source: ${expandFilename(f)}; DestDir: {app}\${splitFile(f).dir}; Flags: ignoreversion
|
||||
# end for
|
||||
#end for
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ if [ $# -eq 1 ] ; then
|
|||
#var createdDirs = newStringTable()
|
||||
#for cat in fcConfig..fcLib:
|
||||
# for f in items(c.cat[cat]):
|
||||
# var mk = extractDir(f.skipRoot)
|
||||
# var mk = splitFile(f.skipRoot).dir
|
||||
# if mk.len > 0:
|
||||
# mk = unixDirVars[cat] & "/" & mk
|
||||
# if not createdDirs.hasKey(mk):
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ Compile_options:
|
|||
"""
|
||||
|
||||
proc parseCmdLine(c: var TConfigData) =
|
||||
var p = init()
|
||||
var p = initOptParser()
|
||||
while true:
|
||||
next(p)
|
||||
var kind = p.kind
|
||||
|
|
@ -132,8 +132,8 @@ proc parseCmdLine(c: var TConfigData) =
|
|||
of "inno": incl(c.actions, actionInno)
|
||||
else: quit(Usage)
|
||||
else:
|
||||
c.infile = appendFileExt(key, "ini")
|
||||
c.nimrodArgs = getRestOfCommandLine(p)
|
||||
c.infile = addFileExt(key, "ini")
|
||||
c.nimrodArgs = cmdLineRest(p)
|
||||
break
|
||||
of cmdLongOption, cmdShortOption:
|
||||
case normalize(key)
|
||||
|
|
@ -255,7 +255,7 @@ proc parseIniFile(c: var TConfigData) =
|
|||
proc readCFiles(c: var TConfigData, osA, cpuA: int) =
|
||||
var cfg: TCfgParser
|
||||
var cfilesSection = false
|
||||
var f = extractDir(c.infile) / "mapping.txt"
|
||||
var f = splitFile(c.infile).dir / "mapping.txt"
|
||||
c.cfiles[osA][cpuA] = @[]
|
||||
var input = newFileStream(f, fmRead)
|
||||
if input != nil:
|
||||
|
|
@ -302,7 +302,7 @@ proc srcdist(c: var TConfigData) =
|
|||
[c.oses[osA-1], c.cpus[cpuA-1], c.nimrodArgs,
|
||||
changeFileExt(c.infile, "nim")]
|
||||
echo(cmd)
|
||||
if executeShellCommand(cmd) != 0:
|
||||
if execShellCmd(cmd) != 0:
|
||||
quit("Error: call to nimrod compiler failed")
|
||||
readCFiles(c, osA, cpuA)
|
||||
for i in 0 .. c.cfiles[osA][cpuA].len-1:
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ Compile_options:
|
|||
"""
|
||||
|
||||
proc parseCmdLine(c: var TConfigData) =
|
||||
var p = init()
|
||||
var p = initOptParser()
|
||||
while true:
|
||||
next(p)
|
||||
var kind = p.kind
|
||||
|
|
@ -64,8 +64,8 @@ proc parseCmdLine(c: var TConfigData) =
|
|||
var val = p.val
|
||||
case kind
|
||||
of cmdArgument:
|
||||
c.infile = appendFileExt(key, "ini")
|
||||
c.nimrodArgs = getRestOfCommandLine(p)
|
||||
c.infile = addFileExt(key, "ini")
|
||||
c.nimrodArgs = cmdLineRest(p)
|
||||
break
|
||||
of cmdLongOption, cmdShortOption:
|
||||
case normalize(key)
|
||||
|
|
@ -84,7 +84,7 @@ proc walkDirRecursively(s: var seq[string], root, ext: string) =
|
|||
for k, f in walkDir(root):
|
||||
case k
|
||||
of pcFile, pcLinkToFile:
|
||||
if cmpIgnoreCase(ext, extractFileExt(f)) == 0:
|
||||
if cmpIgnoreCase(ext, splitFile(f).ext) == 0:
|
||||
add(s, f)
|
||||
of pcDirectory: walkDirRecursively(s, f, ext)
|
||||
of pcLinkToDirectory: nil
|
||||
|
|
@ -94,7 +94,7 @@ proc addFiles(s: var seq[string], dir, ext: string, patterns: seq[string]) =
|
|||
if existsDir(dir / p):
|
||||
walkDirRecursively(s, dir / p, ext)
|
||||
else:
|
||||
add(s, dir / appendFileExt(p, ext))
|
||||
add(s, dir / addFileExt(p, ext))
|
||||
|
||||
proc parseIniFile(c: var TConfigData) =
|
||||
var
|
||||
|
|
@ -143,7 +143,7 @@ proc parseIniFile(c: var TConfigData) =
|
|||
if c.projectName.len == 0:
|
||||
c.projectName = changeFileExt(extractFilename(c.infile), "")
|
||||
if c.outdir.len == 0:
|
||||
c.outdir = extractDir(c.infile)
|
||||
c.outdir = splitFile(c.infile).dir
|
||||
else:
|
||||
quit("cannot open: " & c.infile)
|
||||
|
||||
|
|
@ -151,18 +151,18 @@ proc parseIniFile(c: var TConfigData) =
|
|||
|
||||
proc Exec(cmd: string) =
|
||||
echo(cmd)
|
||||
if os.executeShellCommand(cmd) != 0: quit("external program failed")
|
||||
if os.execShellCmd(cmd) != 0: quit("external program failed")
|
||||
|
||||
proc buildDoc(c: var TConfigData, destPath: string) =
|
||||
# call nim for the documentation:
|
||||
for d in items(c.doc):
|
||||
Exec("nimrod rst2html $# -o:$# --index=$#/theindex $#" %
|
||||
[c.nimrodArgs, destPath / changeFileExt(extractFileTrunk(d), "html"),
|
||||
[c.nimrodArgs, destPath / changeFileExt(splitFile(d).name, "html"),
|
||||
destpath, d])
|
||||
Exec("nimrod rst2tex $# $#" % [c.nimrodArgs, d])
|
||||
for d in items(c.srcdoc):
|
||||
Exec("nimrod doc $# -o:$# --index=$#/theindex $#" %
|
||||
[c.nimrodArgs, destPath / changeFileExt(extractFileTrunk(d), "html"),
|
||||
[c.nimrodArgs, destPath / changeFileExt(splitFile(d).name, "html"),
|
||||
destpath, d])
|
||||
Exec("nimrod rst2html $1 -o:$2/theindex.html $2/theindex" %
|
||||
[c.nimrodArgs, destPath])
|
||||
|
|
@ -171,7 +171,7 @@ proc buildAddDoc(c: var TConfigData, destPath: string) =
|
|||
# build additional documentation (without the index):
|
||||
for d in items(c.webdoc):
|
||||
Exec("nimrod doc $# -o:$# $#" %
|
||||
[c.nimrodArgs, destPath / changeFileExt(extractFileTrunk(d), "html"), d])
|
||||
[c.nimrodArgs, destPath / changeFileExt(splitFile(d).name, "html"), d])
|
||||
|
||||
proc main(c: var TConfigData) =
|
||||
const
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
import strutils, os
|
||||
|
||||
proc newName(f: string): string =
|
||||
return extractDir(f) / "trim_" & extractFilename(f)
|
||||
proc newName(f: string): string =
|
||||
var (dir, name, ext) = splitFile(f)
|
||||
return dir / "trim_" & name & ext
|
||||
|
||||
proc walker(dir: string) =
|
||||
for kind, path in walkDir(dir):
|
||||
|
|
@ -11,7 +12,7 @@ proc walker(dir: string) =
|
|||
of pcFile:
|
||||
moveFile(newName(path), path)
|
||||
# test if installation still works:
|
||||
if executeShellCommand(r"nimrod c --force_build tests\tlastmod") == 0:
|
||||
if execShellCmd(r"nimrod c --force_build tests\tlastmod") == 0:
|
||||
echo "Optional: ", path
|
||||
removeFile(newName(path))
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue