[SLOF] [PATCH] Fix output word

Laurent Vivier lvivier at redhat.com
Tue Sep 26 21:28:03 AEST 2017


We can select the console output, but it does not really work

Implement term-io-emit, as we have term-io-key to really
send characters to the output selected by stdout.

Signed-off-by: Laurent Vivier <lvivier at redhat.com>
---
 slof/fs/term-io.fs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/slof/fs/term-io.fs b/slof/fs/term-io.fs
index 52ce12a..a0b0f4b 100644
--- a/slof/fs/term-io.fs
+++ b/slof/fs/term-io.fs
@@ -40,6 +40,20 @@
 
 1 BUFFER: (term-io-char-buf)
 
+: term-io-emit ( char -- )
+    s" stdout" get-chosen IF
+        decode-int nip nip dup 0= IF 0 EXIT THEN
+	swap (term-io-char-buf) c!
+	>r (term-io-char-buf) 1 s" write" r@ $call-method
+	drop
+	r> drop
+    ELSE
+        [ ' emit behavior compile, ]
+    THEN
+;
+
+' term-io-emit to emit
+
 : term-io-key  ( -- char )
    s" stdin" get-chosen IF
       decode-int nip nip dup 0= IF 0 EXIT THEN
-- 
2.13.5



More information about the SLOF mailing list