overload resolution for proc vars

This commit is contained in:
Andreas Rumpf 2009-06-24 17:13:22 +02:00
commit 300430fbba
56 changed files with 2772 additions and 2430 deletions

View file

@ -281,9 +281,9 @@ proc buildDir(os, cpu: int): string =
proc writeFile(filename, content: string) =
var f: TFile
if openFile(f, filename, fmWrite):
if open(f, filename, fmWrite):
writeln(f, content)
closeFile(f)
close(f)
else:
quit("Cannot open for writing: " & filename)
@ -296,8 +296,8 @@ proc srcdist(c: var TConfigData) =
createDir(dir)
var cmd = ("nimrod compile -f --symbolfiles:off --compileonly " &
"--gen_mapping " &
" --os:$2 --cpu:$3 $1 $4") %
[c.nimrodArgs, c.oses[osA-1], c.cpus[cpuA-1],
" --os:$# --cpu:$# $# $#") %
[c.oses[osA-1], c.cpus[cpuA-1], c.nimrodArgs,
changeFileExt(c.infile, "nim")]
echo("Executing: " & cmd)
if executeShellCommand(cmd) != 0:
@ -327,14 +327,13 @@ proc srcdist(c: var TConfigData) =
# --------------------- generate inno setup -----------------------------------
proc setupDist(c: var TConfigData) =
var scrpt = GenerateInnoSetup(c)
var n = "build" / "install_$1_$2.iss" % [toLower(c.name), c.version]
var n = "build" / "install_$#_$#.iss" % [toLower(c.name), c.version]
writeFile(n, scrpt)
when defined(windows):
if c.innoSetup.path.len == 0:
c.innoSetup.path = "iscc.exe"
var outcmd = if c.outdir.len == 0: "build" else: c.outdir
var cmd = "$1 $2 /O$3 $4" % [c.innoSetup.path, c.innoSetup.flags,
outcmd, n]
var cmd = "$# $# /O$# $#" % [c.innoSetup.path, c.innoSetup.flags, outcmd, n]
Echo("Executing: " & cmd)
if executeShellCommand(cmd) == 0:
removeFile(n)
@ -350,7 +349,7 @@ when haveZipLib:
writeFile(deinstallShFile, GenerateDeinstallScript(c))
var proj = toLower(c.name)
var n = "$1_$2.zip" % [proj, c.version]
var n = "$#_$#.zip" % [proj, c.version]
if c.outdir.len == 0: n = "build" / n
else: n = c.outdir / n
var z: TZipArchive

View file

@ -156,11 +156,11 @@ proc Exec(cmd: string) =
proc buildDoc(c: var TConfigData, destPath: string) =
# call nim for the documentation:
for d in items(c.doc):
Exec("nimrod rst2html $1 -o:$2 --index=$3/theindex $4" %
Exec("nimrod rst2html $# -o:$# --index=$#/theindex $#" %
[c.nimrodArgs, destPath / changeFileExt(extractFileTrunk(d), "html"),
destpath, d])
for d in items(c.srcdoc):
Exec("nimrod doc $1 -o:$2 --index=$3/theindex $4" %
Exec("nimrod doc $# -o:$# --index=$#/theindex $#" %
[c.nimrodArgs, destPath / changeFileExt(extractFileTrunk(d), "html"),
destpath, d])
Exec("nimrod rst2html $1 -o:$2/theindex.html $2/theindex" %
@ -169,7 +169,7 @@ proc buildDoc(c: var TConfigData, destPath: string) =
proc buildAddDoc(c: var TConfigData, destPath: string) =
# build additional documentation (without the index):
for d in items(c.webdoc):
Exec("nimrod doc $1 -o:$2 $3" %
Exec("nimrod doc $# -o:$# $#" %
[c.nimrodArgs, destPath / changeFileExt(extractFileTrunk(d), "html"), d])
proc main(c: var TConfigData) =
@ -188,10 +188,10 @@ proc main(c: var TConfigData) =
var content = readFile(temp)
if isNil(content): quit("[Error] cannot open: " & temp)
var f: TFile
var outfile = "web/upload/$1.html" % file
if openFile(f, outfile, fmWrite):
var outfile = "web/upload/$#.html" % file
if open(f, outfile, fmWrite):
writeln(f, generateHTMLPage(c, file, content))
closeFile(f)
close(f)
else:
quit("[Error] cannot write file: " & outfile)
removeFile(temp)