[SLOF] [PATCH v6 1/2] Fix output word

Alexey Kardashevskiy aik at ozlabs.ru
Mon May 14 19:55:41 AEST 2018


On 8/4/18 9:05 pm, Segher Boessenkool wrote:
> Hi!
> 
> On Fri, Apr 06, 2018 at 10:47:03AM +0200, Laurent Vivier wrote:
>>  : output  ( dev-str dev-len -- )
>>     open-dev ?dup IF
> 
> It's a lot simple if you do an early exit if there is no such device.
> You're supposed to output an error message in that case, fwiw.
> 
>> -      \ Close old stdout:
>> -      s" stdout" get-chosen IF
>> -         decode-int nip nip ?dup IF close-dev THEN
>> +      \ find new ihandle and xt handle
>> +      dup s" write" rot ihandle>phandle find-method
>> +      0= IF
>> +         drop
>> +         cr ." Cannot find the write method for the given output console " cr
>> +         EXIT
> 
> This leaks the instance.


Laurent, you are reposting this patch with a fix, right? thanks.


> The description in the standard say to search
> for the method before doing the open-dev, that solves this problem too.
> 
>> +: term-io-emit ( char -- )
>> +    write-xt IF
>> +       (term-io-char-buf) c!
>> +       (term-io-char-buf) 1 write-xt stdout @ call-package
>> +       drop
>> +    ELSE
>> +       [ ' emit behavior compile, ]
>> +    THEN
>> +;
> 
> What do you expect to be in the emit hook at this point?  Could you
> just use _that_?
> 
> Looks nice and readable otherwise, great :-)
> 
> 
> Segher
> _______________________________________________
> SLOF mailing list
> SLOF at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/slof
> 


-- 
Alexey


More information about the SLOF mailing list