[Oberon] In.Real not working
dave at brownsmeet.com
dave at brownsmeet.com
Fri Apr 9 20:30:58 CEST 2021
The implementation of In.Real is indeed faulty in Vishaps oberon.
David Lightfoot is on to something: In.Open will work around the
problem, but you have to call In.Open before In.Real() every time.
What is happening is:
. In.Int is reading the integer digits OK
. The next thing in the input buffer is the newline character from
the carriage return key
. In.Real is not coded to skip over newline, so it finds no digits
and returns zero
. Calling In.Open resets the input buffer and thus discards the
unwanted newline character.
Vishaps In.Real needs a bit more work to conform to the Oakwood
guidelines.
-- Dave Brown.
On 2021-04-09 18:22, Duke Normandin wrote:
> On Fri, 9 Apr 2021 16:55:29 +0100
> David Lightfoot <dlightfoot at brookes.ac.uk> wrote:
>
>> Dear Duke
>> I think you need to call procedure In.Open and Out.Open before
>> attempting I/O.
>> See page 105 onwards and Appendix C of
>> *Programming in Oberon *by Martin Reiser and Niklaus Wirth at
>> https://people.inf.ethz.ch/wirth/ProgInOberonWR.pdf
>
> Thanks for the reference! I've been successful using Out.String;
> Out.Ln; etc without having had to use Out.Open first.
>
> I assumed In.Real; etc would work the same. I'll give it a try!
>
> I should have mentioned that I'm using the Vishaps Oberon Compiler:
> https://github.com/vishaps/voc
>
> for no particular reason than that I stumbled on it.
>
> --
> Duke Normandin <dukeofpurl at gmx.com>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related
> systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
More information about the Oberon
mailing list