[SLOF] [PATCH] Fix output word

Alexey Kardashevskiy aik at ozlabs.ru
Wed Oct 4 19:33:39 AEDT 2017


On 27/09/17 18:10, Laurent Vivier wrote:
> On 27/09/2017 09:25, Thomas Huth wrote:
>> On 26.09.2017 13:28, 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 | 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
>>> +;
>>
>> While this is basically the right direction, I've got three concerns /
>> remarks:
>>
>> 1) Please don't use TABs in Forth code (see Coding Style in README)
> 
> Yes, sorry, I've seen that after having sent the patch.
> 
>>
>> 2) Have you checked whether it also works with VGA screens? The code in
>>    slof/fs/display.fs ticks to EMIT again ... it looks like it should
>>    work, but better test it first...
> 
> In fact, it doesn't work... The serial console is mirrored to the VGA
> display, and when we try to switch to the second serial console, only
> the input moves (output stays on the first console and VGA).


So, v2 is coming, right?


> 
>>
>> 3) Speed ... This rather code is called for every character that we
>>    print out. While it likely does not really matter for input, the
>>    output of text was always a rather critical thing in SLOF. Could
>>    you please do some speed measurements first? Something like:
>>
>>    milliseconds 2000 0 do 41 emit loop milliseconds swap - cr .d cr
>>
>>    ... and then compare the values before and after your change.
> 
> Without:
> 
>   797 796 807
> 
> With:
> 
>   4772 4710 4782
> 
> So it's 6 times slower... what can we do for that?
> 
> Thanks,
> Laurent
> _______________________________________________
> SLOF mailing list
> SLOF at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/slof
> 


-- 
Alexey


More information about the SLOF mailing list