--stdout support; idetools implemented

This commit is contained in:
Araq 2011-02-25 01:53:58 +01:00
commit f8dd74a073
17 changed files with 188 additions and 112 deletions

View file

@ -1058,9 +1058,13 @@ proc renderModule(n: PNode, filename: string, renderFlags: TRenderFlags = {}) =
of nkTypeSection, nkConstSection, nkVarSection, nkCommentStmt: putNL(g)
else: nil
gcoms(g)
if open(f, filename, fmWrite):
if optStdout in gGlobalOptions:
write(stdout, g.buf)
elif open(f, filename, fmWrite):
write(f, g.buf)
close(f)
else:
rawMessage(errCannotOpenFile, filename)
proc initTokRender(r: var TSrcGen, n: PNode, renderFlags: TRenderFlags = {}) =
initSrcGen(r, renderFlags)