[SLOF] [PATCH v2 1/1] Fix output word
Segher Boessenkool
segher at kernel.crashing.org
Fri Nov 24 03:53:31 AEDT 2017
On Thu, Nov 23, 2017 at 10:26:13AM +0100, Laurent Vivier wrote:
> >> We can select the console output, but it does not really work
It used to work, what broke?
> >> Implement term-io-emit, as we have term-io-key to really
> >> send characters to the output selected by stdout.
This is a nice optimisation of course (caching the xt), but term-io-key
should do the same thing then.
> >> +0 VALUE stdout_ihandle
> >> +0 VALUE write_xt
Please use dashes instead of underscores.
> >> : 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
> >> ;
An xt of zero will crash the system if you try to execute it. Use
['] 2drop instead? Or similar. Or don't do a term-io-emit but
just a term-io-type.
> >>
> >> @@ -40,6 +46,15 @@
> >>
> >> 1 BUFFER: (term-io-char-buf)
> >>
> >> +: term-io-emit ( char -- )
> >> + write_xt 0= IF [ ' emit behavior compile, ] EXIT THEN
That is very problematic. If the xt of term-io-emit already is the
behaviour of emit, this will loop. It sounds like you just want the
"system emit"; just assign that to the hook, don't do extra redirections?
Segher
More information about the SLOF
mailing list