diff options
Diffstat (limited to 'shell/print.mu')
-rw-r--r-- | shell/print.mu | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/shell/print.mu b/shell/print.mu index 307b9ffd..ce65b4df 100644 --- a/shell/print.mu +++ b/shell/print.mu @@ -40,6 +40,13 @@ fn print-cell _in: (addr handle cell), out: (addr stream byte), trace: (addr tra trace-higher trace return } + compare *in-type, 3/stream + { + break-if-!= + print-stream in-addr, out, trace + trace-higher trace + return + } compare *in-type, 4/primitive { break-if-!= @@ -88,6 +95,25 @@ fn print-symbol _in: (addr cell), out: (addr stream byte), trace: (addr trace) { trace trace, "print", stream } +fn print-stream _in: (addr cell), out: (addr stream byte), trace: (addr trace) { + trace-text trace, "print", "stream" + var in/esi: (addr cell) <- copy _in + var data-ah/eax: (addr handle stream byte) <- get in, text-data + var _data/eax: (addr stream byte) <- lookup *data-ah + var data/esi: (addr stream byte) <- copy _data + rewind-stream data + write out, "[" + write-stream out, data + write out, "]" + # trace + rewind-stream data + var stream-storage: (stream byte 0x40) + var stream/ecx: (addr stream byte) <- address stream-storage + write stream, "=> stream " + write-stream stream, data + trace trace, "print", stream +} + fn print-number _in: (addr cell), out: (addr stream byte), trace: (addr trace) { var in/esi: (addr cell) <- copy _in var val/eax: (addr float) <- get in, number-data |