45 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Modula-2
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Modula-2
		
	
	
	
	
	
| (*
 | |
|   (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
 | |
|   See the copyright notice in the ACK home directory, in the file "Copyright".
 | |
| *)
 | |
|  
 | |
| (* 
 | |
|   Module:       Interface to termcap database
 | |
|   From:         Unix manual chapter 3 
 | |
|   Version:      $Header$ 
 | |
| *)
 | |
| 
 | |
| (*
 | |
|   Use this like the C-version. In this Modula-2 version, some of the buffers,
 | |
|   that are explicit in the C-version, are hidden. These buffers are initialized
 | |
|   by a call to Tgetent. The "ARRAY OF CHAR" parameters must be null-terminated.
 | |
|   You can call them with a constant string argument, as these are always
 | |
|   null-terminated in our Modula-2 implementation.
 | |
|   Unlike the C version, this version takes care of UP, BC, PC, and ospeed
 | |
|   automatically.
 | |
|   If Tgetent is not called by the user, it is called by the module itself,
 | |
|   using the TERM environment variable, or "dumb" if TERM does not exist.
 | |
| *)
 | |
| 
 | |
| DEFINITION MODULE Termcap;
 | |
| 
 | |
|   TYPE	STRCAP;
 | |
| 	PUTPROC = PROCEDURE(CHAR);
 | |
| 
 | |
|   PROCEDURE Tgetent(name: ARRAY OF CHAR) : INTEGER;
 | |
| 
 | |
|   PROCEDURE Tgetnum(id: ARRAY OF CHAR): INTEGER;
 | |
| 
 | |
|   PROCEDURE Tgetflag(id: ARRAY OF CHAR): BOOLEAN;
 | |
| 
 | |
|   PROCEDURE Tgoto(cm: STRCAP; col, line: INTEGER): STRCAP;
 | |
|   (* Result exists until next call to Tgoto *)
 | |
| 
 | |
|   PROCEDURE Tgetstr(id: ARRAY OF CHAR; VAR res: STRCAP) : BOOLEAN;
 | |
|   (* Returns FALSE if capability does not exist;
 | |
|      Result exists until next call to Tgetent.
 | |
|   *)
 | |
| 
 | |
|   PROCEDURE Tputs(cp: STRCAP; affcnt: INTEGER; p: PUTPROC);
 | |
| 
 | |
| END Termcap.
 |