[SLOF] [PATCH v2 1/1] Fix output word
Laurent Vivier
lvivier at redhat.com
Fri Nov 10 22:01:20 AEDT 2017
Ping?
Laurent
On 18/10/2017 10:32, Laurent Vivier wrote:
> 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 | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/slof/fs/term-io.fs b/slof/fs/term-io.fs
> index 52ce12a..f801f8b 100644
> --- a/slof/fs/term-io.fs
> +++ b/slof/fs/term-io.fs
> @@ -22,6 +22,9 @@
> THEN
> ;
>
> +0 VALUE stdout_ihandle
> +0 VALUE write_xt
> +
> : output ( dev-str dev-len -- )
> open-dev ?dup IF
> \ Close old stdout:
> @@ -29,7 +32,10 @@
> decode-int nip nip ?dup IF close-dev THEN
> THEN
> \ Now set the new stdout:
> + dup to stdout_ihandle
> encode-int s" stdout" set-chosen
> + s" write" stdout_ihandle ihandle>phandle find-method
> + 0= IF 0 THEN to write_xt
> THEN
> ;
>
> @@ -40,6 +46,15 @@
>
> 1 BUFFER: (term-io-char-buf)
>
> +: term-io-emit ( char -- )
> + write_xt 0= IF [ ' emit behavior compile, ] EXIT THEN
> + (term-io-char-buf) c!
> + (term-io-char-buf) 1 write_xt stdout_ihandle call-package
> + drop
> +;
> +
> +' term-io-emit to emit
> +
> : term-io-key ( -- char )
> s" stdin" get-chosen IF
> decode-int nip nip dup 0= IF 0 EXIT THEN
>
More information about the SLOF
mailing list