Universität Ulm,
Fakultät für Mathematik und Wirtschaftswissenschaften,
SAI
WS 2000/01 || Entwicklung objekt-orientierter Bibliotheken || Beispiele || Rooms
DEFINITION Cmds
(* Glueck: select one or more sentences from a set of files per random *)
(* University of Ulm, SAI, Helmholtzstr. 18, D-7900 Ulm -- AFB 7/92 *)
DEFINITION Cmds;
IMPORT Streams;
CONST
unlimited = -1; (* for maxargs *)
(* return values of Read *)
unknown = -1; (* cmd not recognized *)
done = -2; (* no further action necessary, e.g. usage has been printed *)
error = -3; (* input errors occured *)
empty = -4; (* empty input line *)
TYPE
Set = SET; (* set of command codes *)
PROCEDURE Add(s: Streams.Stream;
code: INTEGER; (* >=0, identifies the command *)
name: ARRAY OF CHAR; (* name of the command *)
minargs: INTEGER; (* minimal number of args *)
maxargs: INTEGER; (* maximal number of args; -1=unltd *)
usage: ARRAY OF CHAR; (* usage text w/o Usage: and cmd name *)
help: ARRAY OF CHAR (* short description *)
);
PROCEDURE SetOutput(s, out: Streams.Stream);
PROCEDURE Legal(s: Streams.Stream; set: Set);
(* set the set of legal commands *)
PROCEDURE Read(s: Streams.Stream;
VAR nfields: INTEGER;
VAR fields: ARRAY OF ARRAY OF CHAR) : INTEGER;
(* read an entire line and return the command code together
with its fields
*)
END Cmds.
WS 2000/01 || Entwicklung objekt-orientierter Bibliotheken || Beispiele || Rooms
Andreas Borchert, 29. Januar 2001