compiler/vm: Use stdout too in VM time echo
Now VM time echo outputs to stdout too, same as compile time echo, rather using same handle as compiler diagnostics (stderr default).
This commit is contained in:
parent
abb82554b7
commit
78568859c5
2 changed files with 11 additions and 2 deletions
|
|
@ -751,6 +751,15 @@ proc msgWriteln*(s: string) =
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
flushFile(stderr)
|
flushFile(stderr)
|
||||||
|
|
||||||
|
proc stdoutWriteln*(s: string) =
|
||||||
|
## Writes to stdout.
|
||||||
|
## Should be used only for VM time equivalents to procs outputting to stdout.
|
||||||
|
if not isNil(writelnHook):
|
||||||
|
writelnHook(s)
|
||||||
|
else:
|
||||||
|
writeLine(stdout, s)
|
||||||
|
flushFile(stdout)
|
||||||
|
|
||||||
macro callIgnoringStyle(theProc: typed, first: typed,
|
macro callIgnoringStyle(theProc: typed, first: typed,
|
||||||
args: varargs[expr]): stmt =
|
args: varargs[expr]): stmt =
|
||||||
let typForegroundColor = bindSym"ForegroundColor".getType
|
let typForegroundColor = bindSym"ForegroundColor".getType
|
||||||
|
|
|
||||||
|
|
@ -811,13 +811,13 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
of opcEcho:
|
of opcEcho:
|
||||||
let rb = instr.regB
|
let rb = instr.regB
|
||||||
if rb == 1:
|
if rb == 1:
|
||||||
msgWriteln(regs[ra].node.strVal)
|
stdoutWriteln(regs[ra].node.strVal)
|
||||||
else:
|
else:
|
||||||
var outp = ""
|
var outp = ""
|
||||||
for i in ra..ra+rb-1:
|
for i in ra..ra+rb-1:
|
||||||
#if regs[i].kind != rkNode: debug regs[i]
|
#if regs[i].kind != rkNode: debug regs[i]
|
||||||
outp.add(regs[i].node.strVal)
|
outp.add(regs[i].node.strVal)
|
||||||
msgWriteln(outp)
|
stdoutWriteln(outp)
|
||||||
of opcContainsSet:
|
of opcContainsSet:
|
||||||
decodeBC(rkInt)
|
decodeBC(rkInt)
|
||||||
regs[ra].intVal = ord(inSet(regs[rb].node, regs[rc].regToNode))
|
regs[ra].intVal = ord(inSet(regs[rb].node, regs[rc].regToNode))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue