Dear Hans, thanks a lot for your reply.
Which development environment do you use? => The current AOS (A2) environnement/IDE/compiler from ETH. https://gitlab.inf.ethz.ch/felixf/oberon
Which Oberon operating system do you use? => Debian Linux 12 "Bookworm" https://debian.ethz.ch/
Use In.Done() in Print.Me => there is no Open() Procedure in In.Mod
Kind regards Daniel On Sun, 2024-02-11 at 12:00 +0100, oberon-request@lists.inf.ethz.ch wrote:
Send Oberon mailing list submissions to oberon@lists.inf.ethz.ch
To subscribe or unsubscribe via the World Wide Web, visit https://lists.inf.ethz.ch/mailman/listinfo/oberon or, via email, send a message with subject or body 'help' to oberon-request@lists.inf.ethz.ch
You can reach the person managing the list at oberon-owner@lists.inf.ethz.ch
When replying, please edit your Subject line so it is more specific than "Re: Contents of Oberon digest..."
Today's Topics:
1. Re: Oberon Digest, Vol 237, Issue 2 (Hans Klaver)
--------------------------------------------------------------------- -
Message: 1 Date: Sat, 10 Feb 2024 17:21:40 +0100 From: Hans Klaver <hklaver@dds.nl> To: ETH Oberon and related systems <oberon@lists.inf.ethz.ch> Subject: Re: [Oberon] Oberon Digest, Vol 237, Issue 2 Message-ID: <1A4F0199-77A5-432D-BF59-D08B06B35536@dds.nl> Content-Type: text/plain; charset=us-ascii
Hi Daniel,/ developm/ development environment ent environment
You wrote:
Have no idea how to In.Char(ch);
About 1000 lines of code seem to work fine (a server to poll remote devices via tcp) but now i would like to get a user keyboard input but i get stuck:
PROCEDURE Test2; VAR b: BOOLEAN; ch: CHAR; BEGIN(*PROCEDURE*) Out.String("input: "); b:= In.Char(cWhich Oberon compiler / operating system / development environment do you use?
Unfortunately different implementations of Module In may vary somewhat inWhich Oberon compiler / operating system / development environment do you use? their use:
h); Out.Char(ch); END(*PROCEDURE*) T/ development environment est2;
compiles fine but doesn't even stop for an input? any idea/hint? / develop/ development environment ment environment Which Oberon compiler / operating system / development environment do you use?
Unfortunately different implementations of Module In may vary somewhat in their use:
- Sometimes In.Open has to be called first to initialize the input stream. - It is unusual that In.Char(ch) returns a boolean; all implementations of module In that I know use procedures with VAR parameters for input and do not return any value like your implementation appears to do. - Most implementations of In use a boolean variable In.Done that is declared outside any of the procedures of In (so it is a global variable of module In), which can be tested to see if all the input up to the test was suc/ development environment cessful.
For example using the OBNC command line compiler for Windows/Linux/macOS the following should work: MODULE TestIn; IMPORT In, Out;
PROCEDURE Test2; VAR ch: CHAR; BEGIN Out.String("Input a character and then press <enter>: "); In.Open; (* in OBNC this has no effect, but you could try it *) In.Char(ch); IF In.Done THEN Out.Char(ch) ELSE (* not useful for this character input, *) Out.String("Parameter error") (* but is useful for other input types *) END; Out.Ln END Test2;
BEGIN Test2 END TestIn.
Another example is the use of In in the Oberon System, which has no command line. There its use is more like described in the book by Reiser & Wirth "Programming in Oberon". After compilation the following module prints itself to the System.Log text, even before the text is saved to a file:
MODULE Print; (* Hans Klaver, 09-May-1999 *) (** To execute mark this viewer with * and middle-click Print.Me **) IMPORT In, Out;
PROCEDURE Me*; VAR ch: CHAR; BEGIN In.Open; (* is obligatory in the Oberon System! *) In.Char(ch); WHILE In.Done DO Out.Char(ch); In.Char(ch) END END Me;
END Print.Me*
In Wirth's latest version of the Oberon System: https://people.inf.ethz.ch/wirth/ProjectOberon/index.html modules In.Mod and Out.Mod are lacking. In that case you could use my In.Mod and Out.Mod: https://github.com/hansklav/Oberon-07
Some other versions of the Oberon System include In.Mod and Out.Mod, e.g. https://github.com/andreaspirklbauer/Oberon-extended
Regards,
Hans Klaver
------------------------------
Subject: Digest Footer
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
------------------------------
End of Oberon Digest, Vol 237, Issue 4 **************************************