Parent: [288ae8] (diff)

Download this file

TIO.def    313 lines (256 with data), 18.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
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.