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) = proc c2nim*(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
var file = search(fl) var file = search(fl)
if file == "": if file.len() == 0:
return return
if file in gDoneRecursive: echo " Generating " & outfile
return
echo "Processing $# => $#" % [file, outfile]
gDoneRecursive.add(file)
# Remove static inline function bodies # Remove static inline function bodies
removeStatic(file) removeStatic(file)

View file

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

View file

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