DEFINITION MODULE GKSBuf;

(*
    Title: 	GKS Buffering for output devices
    LastEdit:	"Tue Jan 18 17:26:06 1983"
    Author: 	jd
		Cambridge University Computer Laboratory
*)

(* This module is for implementors of GKSDev's. It provides a simple
   form of buffering for characters destined for the standard output
   stream. It is not a stream package, and there is only one instance of it.
   
   A buffer of indefinite length is maintained which is emptied to the
   standard output at moments explicitly defined by the caller.
*)

EXPORT QUALIFIED Brackets, Wrch, Flush;

PROCEDURE Brackets (start, end: PROC);
    (* start and end are procedures which the caller can use to insert
       special character sequences at the beginning and end of buffers
       sent to the device. start is called before the first insertion
       into an empty buffer, and end just before a full buffer is
       flushed to the device. Flush is the only procedure in this interface
       which may NOT be called by these procedures.
    *)

PROCEDURE Wrch (ch: CHAR);
    (* add a new character to the end of the buffer without any translation *)

PROCEDURE Flush (obligatory: BOOLEAN);
    (* empty the buffer by sending it to the device. If obligatory is FALSE
       then the buffer may not be sent just yet if this is judged to be more
       efficient.
    *)

END GKSBuf.
