Skip files already done

This commit is contained in:
Ganesh Viswanathan 2018-07-13 01:37:50 -05:00
commit 1a2ef87087
3 changed files with 12 additions and 10 deletions

View file

@ -7,14 +7,10 @@ template relativePath(path: untyped): untyped =
proc c2nim*(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
var file = search(fl)
if file == "":
if file.len() == 0:
return
if file in gDoneRecursive:
return
echo "Processing $# => $#" % [file, outfile]
gDoneRecursive.add(file)
echo " Generating " & outfile
# Remove static inline function bodies
removeStatic(file)

View file

@ -8,7 +8,7 @@ import globals
proc getNimout*(file: string, rename=true): string =
result = file.splitFile().name.replace(re"[\-\.]", "_") & ".nim"
if gOutput != "":
result = gOutput/result
result = gOutput & "/" & result
if not rename:
return
@ -35,7 +35,7 @@ proc search*(file: string): string =
elif not fileExists(result) and not dirExists(result):
var found = false
for inc in gIncludes:
result = inc/file
result = inc & "/" & file
if fileExists(result) or dirExists(result):
found = true
break
@ -69,7 +69,7 @@ proc rename*(file: string, renfile: string) =
final = final.replace(srch, repl)
newname = newname.replace(matches[0], final)
gRenames[file] = gOutput/newname
gRenames[file] = gOutput & "/" & newname
# ###
# Actions

View file

@ -24,11 +24,17 @@ proc runFile*(file: string, cfgin: OrderedTableRef = newOrderedTable[string, str
cfg = cfgin
sfile = search(file)
if sfile.len() == 0 or sfile in gDoneRecursive:
return
echo "Processing " & sfile
gDoneRecursive.add(sfile)
for pattern in gWildcards.keys():
var m: RegexMatch
let pat = pattern.replace(".", "\\.").replace("*", ".*").replace("?", ".?")
if file.find(toPattern(pat), m):
echo "Appending " & file & " " & pattern
echo " Appending keys for wildcard " & pattern
for key in gWildcards[pattern].keys():
cfg[key & "." & pattern] = gWildcards[pattern][key]