--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

@ -274,15 +274,7 @@ proc app(a: var PRope, b: PRope) = a = con(a, b)
proc app(a: var PRope, b: string) = a = con(a, b)
proc prepend(a: var PRope, b: PRope) = a = con(b, a)
proc WriteRopeRec(f: var tfile, c: PRope) =
if c == nil: return
if (c.data != nil):
write(f, c.data)
else:
writeRopeRec(f, c.left)
writeRopeRec(f, c.right)
proc newWriteRopeRec(f: var tfile, c: PRope) =
proc writeRope*(f: var tfile, c: PRope) =
var stack = @[c]
while len(stack) > 0:
var it = pop(stack)
@ -296,7 +288,7 @@ proc newWriteRopeRec(f: var tfile, c: PRope) =
proc WriteRope(head: PRope, filename: string) =
var f: tfile # we use a textfile for automatic buffer handling
if open(f, filename, fmWrite):
if head != nil: newWriteRopeRec(f, head)
if head != nil: WriteRope(f, head)
close(f)
else:
rawMessage(errCannotOpenFile, filename)