diff options
author | Adam Strzelecki <adam.strzelecki@pl.abb.com> | 2015-10-16 20:49:49 +0200 |
---|---|---|
committer | Adam Strzelecki <adam.strzelecki@pl.abb.com> | 2015-10-16 20:55:17 +0200 |
commit | 78568859c5ae4441f9292cfa381e4e3e6e2e5ffe (patch) | |
tree | e2df647e139b27f52d8a060f1b6730df24493060 | |
parent | abb82554b7e9fce4073e6c072174b0ecb8a92d2f (diff) | |
download | Nim-78568859c5ae4441f9292cfa381e4e3e6e2e5ffe.tar.gz |
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).
-rw-r--r-- | compiler/msgs.nim | 9 | ||||
-rw-r--r-- | compiler/vm.nim | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim index 3fabf6bbf..442d9efc2 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -751,6 +751,15 @@ proc msgWriteln*(s: string) = when defined(windows): 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, args: varargs[expr]): stmt = let typForegroundColor = bindSym"ForegroundColor".getType diff --git a/compiler/vm.nim b/compiler/vm.nim index 7ba4aaeb6..6d0c63f14 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -811,13 +811,13 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg = of opcEcho: let rb = instr.regB if rb == 1: - msgWriteln(regs[ra].node.strVal) + stdoutWriteln(regs[ra].node.strVal) else: var outp = "" for i in ra..ra+rb-1: #if regs[i].kind != rkNode: debug regs[i] outp.add(regs[i].node.strVal) - msgWriteln(outp) + stdoutWriteln(outp) of opcContainsSet: decodeBC(rkInt) regs[ra].intVal = ord(inSet(regs[rb].node, regs[rc].regToNode)) |