Applied Araq's suggestions for c2nim

This commit is contained in:
Vincent Burns 2014-01-14 16:35:00 -05:00
commit aec9195c95
2 changed files with 11 additions and 9 deletions

View file

@ -49,8 +49,8 @@ proc parse(infile: string, options: PParserOptions): PNode =
proc main(infile, outfile: string, options: PParserOptions, spliceHeader: bool) =
var start = getTime()
if spliceHeader and infile[infile.len-2 .. infile.len] == ".c" and existsFile(infile[0 .. infile.len-2] & "h"):
var header_module = parse(infile[0 .. infile.len-2] & "h", options)
if spliceHeader and infile.splitFile.ext == ".c" and existsFile(infile.changeFileExt(".h")):
var header_module = parse(infile.changeFileExt(".h"), options)
var source_module = parse(infile, options)
for n in source_module:
addson(header_module, n)