DEFINITION MODULE TIO; (* TerminalInOut *)
(*------------------------------------------------------------------------*)
(* Bildschirmorientierte Lese- und Schreibprozeduren. *)
(* *)
(* Terminal oriented read and write procedures. *)
(* For a description please see "SIO.def" - the only difference is that *)
(* routines is this module use the terminal as the output or input *)
(* device. *)
(*------------------------------------------------------------------------*)
(* Implementation : Michael Riedl *)
(* Licence : GNU Lesser General Public License (LGPL) *)
(*------------------------------------------------------------------------*)
(* $Id: TIO.def,v 1.3 2018/06/08 21:38:43 mriedl Exp mriedl $ *)
VAR ExpAnz : CARDINAL; (* *** Obsolet *** *)
(* Legt die Anzahl der Ziffern im Exponenten fest, *)
(* bitte die Prozedur "SetExpAnz" nutzen *)
PROCEDURE SetExpAnz(nExp : CARDINAL);
(*----------------------------------------------------------------*)
(* Setzt die Anzahl der Ziffern im Exponenten von Fliesskomma- *)
(* zahlen in Exponentialschreibweise. Der Wert von nExp sollte *)
(* im Bereich [1..4] liegen, Vorgabe ist 2 was fuer die meisten *)
(* Zwecke ausreichend sein sollte. *)
(* Bitte beachten dass dieser Werte fuer TIO und FIO2 *)
(* nicht unabhaengig gewaehlt werden kann da beide Module auf *)
(* dieselben Schreibroutinen in FIO2.mod zurueckgreifen. *)
(* *)
(* Defines the number of digits in the exponent of floating point *)
(* values in sientific or engineering representation. The value *)
(* of nExp shall be in the interval [1..4], default value is 2 *)
(* which should be sufficient for most cases. *)
(* Please note the for TIO and FIO2 the value cannot be choosen *)
(* independently. *)
(*----------------------------------------------------------------*)
PROCEDURE WrLn();
(*----------------------------------------------------------------*)
(* Schreibt End-of-Line Marke auf den Bildschirm. *)
(* *)
(* Write a newline to stream "Datei" *)
(*----------------------------------------------------------------*)
PROCEDURE WrLnN(n : CARDINAL); (* Anzahl der Zeilenumbr\"uche. *)
(*----------------------------------------------------------------*)
(* Schreibt n End-of-Line Marken auf den Bildschirm. *)
(* *)
(* Write "n" times a newline to stream "Datei" *)
(*----------------------------------------------------------------*)
PROCEDURE RdChar(VAR chr : CHAR);
(*----------------------------------------------------------------*)
(* Liest den CHAR chr von der Konsole. *)
(* *)
(* Reads character "chr" from the console. *)
(*----------------------------------------------------------------*)
PROCEDURE WrChar(chr : CHAR);
(*----------------------------------------------------------------*)
(* Schreibt den CHAR chr auf den Bildschirm. *)
(* *)
(* write character "chr" to the console. *)
(*----------------------------------------------------------------*)
PROCEDURE WrCharN(chr : CHAR;
Anzahl : CARDINAL);
(*----------------------------------------------------------------*)
(* Schreibt das Zeichen chr Anzahl mal aus. *)
(* *)
(* Write character "chr" "Anzahl" times to the console *)
(*----------------------------------------------------------------*)
PROCEDURE RdStr(VAR Wort : ARRAY OF CHAR);
(*----------------------------------------------------------------*)
(* Liest die Zeichenkette Wort von der Konsole. *)
(* *)
(* Reads String "Wort" from the console *)
(*----------------------------------------------------------------*)
PROCEDURE WrStr(Wort : ARRAY OF CHAR);
(*----------------------------------------------------------------*)
(* Schreibt die Zeichenkette Wort auf den Bildschirm. *)
(* *)
(* Writes string "Wort" from the console *)
(*----------------------------------------------------------------*)
PROCEDURE WrStrForm(Str : ARRAY OF CHAR;
Breite : INTEGER);
(*----------------------------------------------------------------*)
(* Schreibt Str mit der Gesamtbreite Breite aus. Wenn die L"ange *)
(* der Zeichenkette Str kleiner als Breite ist, wird eine ent- *)
(* sprechende Anzahl Leerzeiche vorangestellt (Breite > 0) oder *)
(* angeh"angt (Breite < 0). Ist die L"ange von Str gr"o3er als *)
(* Breite wird Str unver"andert ausgegeben (d.h. es wird dann *)
(* "uber die angeforderte Breite hinaus geschrieben). *)
(* *)
(* Wrties string "Str" to the console with a minimal width of *)
(* "Breite" characters. If "Breite" > 0 the field will be left *)
(* padded with blanks, if "Breite" < 0 right padding is done. *)
(* If Breite is not sufficient the field will be expanded ! *)
(*----------------------------------------------------------------*)
PROCEDURE RdCard(VAR c : CARDINAL);
(*----------------------------------------------------------------*)
(* Liest CARDINAL-Zahl i von der Konsole. *)
(* *)
(* Reads cardinal value "c" form the console. In case of an error *)
(* MAX(CARDINAL) is returned *)
(*----------------------------------------------------------------*)
PROCEDURE WrCard(c : CARDINAL;
n : CARDINAL); (* Feldbreite *)
(*----------------------------------------------------------------*)
(* Schreibt CARDINAL-Zahl i auf auf den Bildschirm. *)
(* Falls die Feldbreite zu klein zur Darstellung der Zahl i ist, *)
(* wird Feldbreite auf die Mindestanzahl von Zeichen erweitert ! *)
(* *)
(* Write value "c" to the console with a field width of "n". *)
(* If n is choosen too small it will be expanded to the mininal *)
(* value needed to represent c. *)
(*----------------------------------------------------------------*)
PROCEDURE RdHex(VAR c : CARDINAL);
(*----------------------------------------------------------------*)
(* Liest CARDINAL-Zahl c von der Console in hexadezimaler Form. *)
(* Im Fehlerfalle wird MAX(CARDINAL) zur"uckgegeben. *)
(* *)
(* Write value "c" to file "Datei" with a field width of "n". *)
(* If n is choosen too small it will be expanded to the mininal *)
(* value needed to represent c. *)
(*----------------------------------------------------------------*)
PROCEDURE WrHex(c : CARDINAL;
n : CARDINAL); (* Feldbreite *)
(*----------------------------------------------------------------*)
(* Schreibt CARDINAL-Zahl c auf den Bildschirm in hexadezimaler *)
(* Form. *)
(* Falls die Feldbreite zu klein zur Darstellung der Zahl c ist, *)
(* wird Feldbreite auf die Mindestanzahl von Zeichen erweitert ! *)
(* *)
(* Writes "c" to "Datei" in hexadecimal representation *)
(* If n is choosen too small the field will be expanded ! *)
(*----------------------------------------------------------------*)
PROCEDURE WrBits(c : CARDINAL;
nbits : CARDINAL); (* Feldbreite *)
(*----------------------------------------------------------------*)
(* Schreibt die ersten nbits BITS der CARDINAL-Zahl c auf den *)
(* Bildschirm in binaerer Form. Das hoechstwertigste Bit wird *)
(* dabei zuerst ausgegeben. Falls die Feldbreite zu klein zur *)
(* Darstellung der Zahl c ist, wird Feldbreite auf die Mindest- *)
(* anzahl von Zeichen erweitert ! *)
(* *)
(* Beispiel: c = 13, nbits = 5 , Ausgabe ist "01101" *)
(* *)
(* Writes the first nbits bit of "c" to the console. The bit with *)
(* highst value is printed first. *)
(* If nbits is choosen too small the field will be expanded ! *)
(* *)
(* example : c = 13, nbits = 5 , output is "10110" *)
(*----------------------------------------------------------------*)
PROCEDURE RdLngCard(VAR C : LONGCARD);
(*----------------------------------------------------------------*)
(* Liest LONGCARD-Zahl C von der Konsole. *)
(* *)
(* Reads value "C" form the console. In case of an error *)
(* MAX(CARDINAL) is returned *)
(*----------------------------------------------------------------*)
PROCEDURE WrLngCard(C : LONGCARD;
n : CARDINAL); (* Feldbreite *)
(*----------------------------------------------------------------*)
(* Schreibt LONGCARD-Zahl i auf auf den Bildschirm. *)
(* Falls die Feldbreite zu klein zur Darstellung der *)
(* Zahl i ist, wird Feldbreite auf die Mindestanzahl *)
(* von Zeichen erweitert ! *)
(* *)
(* Write value "C" to the console with a field width of "n". *)
(* If n is choosen too small it will be expanded to the mininal *)
(* value needed to represent C. *)
(*----------------------------------------------------------------*)
PROCEDURE RdLngInt(VAR I : LONGINT);
(*----------------------------------------------------------------*)
(* Liest LONGINT Zahl I von der Konsole. *)
(* *)
(* Reads value "I" form "Datei". In case of an error MAX(LONGINT) *)
(* is returned *)
(*----------------------------------------------------------------*)
PROCEDURE WrLngInt(I : LONGINT;
n : CARDINAL); (* Feldbreite *)
(*----------------------------------------------------------------*)
(* Schreibt LONGINT-Zahl I auf auf den Bildschirm. *)
(* Falls die Feldbreite zu klein zur Darstellung der *)
(* Zahl i ist, wird Feldbreite auf die Mindestanzahl *)
(* von Zeichen erweitert ! *)
(* *)
(* Same as WrInt for LONGINT values *)
(*----------------------------------------------------------------*)
PROCEDURE RdInt(VAR i : INTEGER);
(*----------------------------------------------------------------*)
(* Liest Integer-Zahl i von der Konsole. *)
(* *)
(* Reads the value "i" from the console *)
(*----------------------------------------------------------------*)
PROCEDURE WrInt(i : INTEGER;
n : CARDINAL); (* Feldbreite *)
(*----------------------------------------------------------------*)
(* Schreibt Integer-Zahl i auf auf den Bildschirm. *)
(* *)
(* Writes the value "i" to the console with a field width of "n" *)
(*----------------------------------------------------------------*)
PROCEDURE RdLngReal(VAR x : LONGREAL);
(*----------------------------------------------------------------*)
(* Liest Real-Zahl x von der Konsole. *)
(* Syntax : Siehe RealConvert.StingToReal. *)
(* *)
(* Reads real value "x" form the console. In case of an error *)
(* MAX(LONGREAL) is returned. For the syntax of a value x please *)
(* refer to RealConvert.StringToReal *)
(*----------------------------------------------------------------*)
PROCEDURE WrLngReal(x : LONGREAL;
Breite : CARDINAL; (* Feldbreite *)
Komma : INTEGER); (* Nachkommastellen *)
(*----------------------------------------------------------------*)
(* Schreibt Real-Zahl x auf auf den Bildschirm. *)
(* Wenn (Komma < 0) ==> EXP-Darstellung *)
(* *)
(* Write real value "x" to "Datei" with "Komma" decimal digits *)
(* and a field width of "Breite". If Komma < 0 exponential *)
(* representation is used. In case the value is not representable *)
(* the entire field is filled by "*" (similar to Fortran) *)
(*----------------------------------------------------------------*)
PROCEDURE WrReal(x : REAL;
Breite : CARDINAL; (* Feldbreite *)
Komma : INTEGER); (* Nachkommastellen *)
(*----------------------------------------------------------------*)
(* Schreibt Real-Zahl x auf auf den Bildschirm. *)
(* Wenn (Komma < 0) ==> EXP-Darstellung *)
(* *)
(* Same as WrLngReal for REAL values *)
(*----------------------------------------------------------------*)
PROCEDURE WrLngCmplx(x : LONGCOMPLEX;
Breite : CARDINAL; (* Feldbreite *)
Komma : INTEGER); (* Nachkommastellen *)
(*----------------------------------------------------------------*)
(* Schreibt Complex-Zahl x auf auf den Bildschirm. *)
(* Wenn (m < 0) ==> EXP-Darstellung *)
(* Breite, Komma beziehen sich auf die Einzelkomponenten von x. *)
(* *)
(* Write a long complex value to Datei. For "Breite" and "Komma" *)
(* see WrLngReal. *)
(*----------------------------------------------------------------*)
PROCEDURE WrBool(Bool : BOOLEAN);
(*----------------------------------------------------------------*)
(* Schreibt den BOOLEAN - Ausdruck Bool als String (TRUE/FALSE) *)
(* auf die Standardausgabe. *)
(* *)
(* Write "TRUE " or "FALSE" debending on the value of "Bool" *)
(*----------------------------------------------------------------*)
PROCEDURE RdRealDefault(VAR X : LONGREAL; (* R"uckgabewert *)
Y : LONGREAL); (* Default-Wert *)
(*----------------------------------------------------------------*)
(* Lie3t eine Realzahl vom Terminal. *)
(* Falls sofort RETURN gegeben wird, wird Y als Vorgabe-Wert auf *)
(* X zur"uckgegeben. Bei Eingabefehlern wird solange widerholt, *)
(* bis eine legale Eingabe erfolgt. *)
(* *)
(* Read a real value x from the console. If "return" is pressed *)
(* immediately the value of y is returned. In case of an illegal *)
(* input the read is repeated until success. *)
(*----------------------------------------------------------------*)
END TIO.