biagioni@unc.UUCP (Edoardo Biagioni) (11/06/86)
(***************************************************************************) (*** ***) (*** ***) (*** O S S I ***) (*** ========== ***) (*** ***) (**) DEFINITION MODULE SITerminal; (**) (*** ============================ ***) (*** ***) (*** This module defines a machine-independent terminal interface. ***) (*** ***) (***---------------------------------------------------------------------***) (*** ***) (*** Hardware: independent ***) (*** Operating System: UNIX BSD 4.2 ***) (*** Compiler: independent ***) (*** ***) (*** Version: 3.0 ***) (*** Implemented: see copyright ***) (*** Date: 1986-03-12 ***) (*** ***) (***---------------------------------------------------------------------***) (*** ***) (*** Copyright 1984, 1985, 1986 by ***) (*** E. S. Biagioni ***) (*** G. Heiser ***) (*** K. Hinrichs ***) (*** C. Muller ***) (*** ***) (*** Institut fuer Informatik ***) (*** ETH Zuerich ***) (*** CH 8092 Zuerich ***) (*** Switzerland ***) (*** ***) (*** Department of Computer Science ***) (*** University of North Carolina ***) (*** Chapel Hill, North Carolina 27514 ***) (*** U.S.A. ***) (*** ***) (*** Permission to copy without fee all of this material is granted ***) (*** provided that the copies are not made or distributed for direct ***) (*** commercial advantage, that this OSSI copyright notice is ***) (*** included in the copy, that the module is not modified in any way ***) (*** except where necessary for compilation on a particular system, ***) (*** and that the module is always distributed in its original form. ***) (*** Distribution of this module in a modified form without including ***) (*** the original version is a violation of this copyright notice. ***) (*** ***) (***---------------------------------------------------------------------***) (*** ***) (*** Updates: ***) (*** ***) (*** ***) (***************************************************************************) (* ========================================================================= Warning: ======== Usage of this module will cause unusual behavior of any other terminal input/output (using the Cambridge library or module StreamIO)! The Cambridge library modules should never be used for terminal I/O if this module is used. ========================================================================*) EXPORT QUALIFIED DEL, (* CONST *) DelLine, BS, FF, TAB, KeypressProc, WriteProc, (* TYPE *) ReadProc, WriteStringProc, ReadStringProc, WriteLnProc, Keypress, (* VAR *) Write, Read, WriteString, ReadString, WriteLn, ReadWithoutEcho, ReadAgain, ResetTermProcedures; (* PROC *) (* the values of these constants are system-dependent *) (* these constants are for use with the UNIX system *) CONST DEL = 177C; DelLine = 25C; (* CTRL-U *) BS = 10C; (* CTRL-H *) FF = 14C; (* CTRL-L *) TAB = 11C; (* CTRL-I *) (* these types are used to avoid type incompatibilities when the input/output procedure variables are changed *) TYPE KeypressProc = PROCEDURE() : BOOLEAN; ReadAgainProc = PROCEDURE; ReadProc = PROCEDURE() : CHAR; ReadStringProc = PROCEDURE(VAR ARRAY OF CHAR); WriteProc = PROCEDURE(CHAR); WriteStringProc = PROCEDURE(ARRAY OF CHAR); WriteLnProc = PROCEDURE; (* the following procedure variables are initialized by this module to default values. Their value may be changed as necessary, but they must satisfy the specification given in the comments *) VAR Read: ReadProc; (* returns the next character entered by the user. All characters are echoed to the screen. *) ReadWithoutEcho: ReadProc; (* returns the next character entered by the user. Characters are not echoed on the screen. *) ReadString: ReadStringProc; (* returns a string entered by the user; control chars are ignored, accepted chars are echoed on the screen. The user must close the string with RETURN (not copied to the string and not echoed). The procedure adds the EOS character at the end of the string. Line-Editing capabilities included are delete char, delete line. Truncation occurs when the actual parameter is shorter than the entered string (i.e. the procedure will no longer accept characters, and characters will not be echoed *) Write: WriteProc; (* writes a character to the screen. An internal line position is maintained to allow correct operation of DelLine. The exact operation of the procedure depends on the character witten, as follows: EOL: causes a new line to be started, and scrolls the screen if the new line would not be visible, the internal line position is set to the begin of the line; DEL: causes the cursor to move back one place and the character at this position to be deleted and the internal line position to be decremented, unless the cursor is at the beginning of a line; DelLine: causes the cursor to move to the beginning of the current line, clears the line and resets the internal line position; BS: causes the cursor to move back one place non-destructively, and the internal line position to be decremented, unless the cursor is at the beginning of a line; FF: is printed on the screen and the internal line position is reset; TAB: is printed on the screen and the internal line position is incremented; other control characters (ASCII: < 40C): printed on the screen but not affecting the internal line position; non standard character codes (ASCII: >= 200C): printed on the screen, the effect on the internal line position is system dependent; other (graphic) characters ((ASCII: 40C <= ch <= 177C): printed on the screen, the internal line position is incremented. *) WriteString: WriteStringProc; (* is completely equivalent to a series of calls to Write, but usually more efficient and never less efficient *) WriteLn: WriteLnProc; (* completely equivalent to Write (EOL) *) Keypress: KeypressProc; (* returns TRUE if a key was pressed but not yet read. In this case the corresponding character may be read by a call to the 'Read', 'ReadWithoutEcho' or 'ReadString' procedures *) ReadAgain: ReadAgainProc; (* A call to this procedure prevents the next call to 'Read' from getting the next typed character. Instead, the last character read before the call to 'ReadAgain' will be returned again. *) PROCEDURE ResetTermProcedures; (* assigns the default procedures to the procedure variables 'Read', 'ReadWithoutEcho', 'ReadString', 'Write', 'WriteString', 'WriteLn', 'Keypress' and sets the cursor at the beginning of the next line. *) END SITerminal.
cire@hpisoa1.HP.COM (Eric B. Decker) (11/11/86)
Yes but what the hell is OSSI?
cwruacm@cwruecmp.UUCP (ACM Student Chapter) (11/18/86)
In article <8380003@hpisoa1.HP.COM> cire@hpisoa1.HP.COM (Eric B. Decker) writes: >Yes but what the hell is OSSI? Operating System Standard Interface. This is an attempt to define a standard interface for Modula-2 implementations, to enhance portability of code. The definition modules posted define such an interface. This is a pretty good idea, in my opinion, since the facilities provided by the underlying system and the interfaces to these facilities differ greatly from implementation to implementation (e.g. the IO package). Chet Ramey Trademark is a Disclaimer of Bell Labs ARPANET: cwruacm%case@csnet-relay.arpa or ramey%cwru-20%case@csnet-relay.arpa CSNET: cwruacm@case or ramey%cwru-20@case UUCP: {...}!decvax!cwruecmp!cwruacm or {...}!decvax!cwruecmp!ramey@cwru-20 BITNET: ramey%cwru20@cu20b "But we decide which is right and which is an illusion..." The Moody Blues