diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2018-07-13 01:37:50 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2018-07-13 01:37:50 -0500 |
| commit | 1a2ef870873f134e0df767d729ba89ecd7e1f01c (patch) | |
| tree | 46a7f25946d80c5fdd1b625df40c07c6a67aa393 | |
| parent | 5fc18f82f4f0ede6774395b3ef657751a9eef2fc (diff) | |
| download | nimgen-1a2ef870873f134e0df767d729ba89ecd7e1f01c.tar.gz nimgen-1a2ef870873f134e0df767d729ba89ecd7e1f01c.zip | |
Skip files already done
| -rw-r--r-- | src/nimgen/c2nim.nim | 8 | ||||
| -rw-r--r-- | src/nimgen/file.nim | 6 | ||||
| -rw-r--r-- | src/nimgen/runcfg.nim | 8 |
3 files changed, 12 insertions, 10 deletions
diff --git a/src/nimgen/c2nim.nim b/src/nimgen/c2nim.nim index 07b15e0..28a3b77 100644 --- a/src/nimgen/c2nim.nim +++ b/src/nimgen/c2nim.nim @@ -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) diff --git a/src/nimgen/file.nim b/src/nimgen/file.nim index 1a316bf..b46f7be 100644 --- a/src/nimgen/file.nim +++ b/src/nimgen/file.nim @@ -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 diff --git a/src/nimgen/runcfg.nim b/src/nimgen/runcfg.nim index cc48c01..a702e47 100644 --- a/src/nimgen/runcfg.nim +++ b/src/nimgen/runcfg.nim @@ -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] |
