home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / modu1096.zip / ISOsym / termfile.def < prev    next >
Text File  |  1996-08-29  |  2KB  |  56 lines

  1. DEFINITION MODULE TermFile;
  2.  
  3. (* Channels opened by this module are connected to a single terminal
  4.    device; typed characters are distributed between channels according
  5.    to the sequence of read requests.
  6.  *)
  7.  
  8. IMPORT IOChan, ChanConsts;
  9. FROM ChanConsts IMPORT ChanFlags;
  10.  
  11. TYPE
  12.   ChanId      = IOChan.ChanId;
  13.   FlagSet     = ChanConsts.FlagSet;
  14.   OpenResults = ChanConsts.OpenResults;
  15.  
  16.  
  17. (* Accept singleton values of FlagSet *)
  18. CONST
  19.   read  = FlagSet{readFlag}; (* input operations are requested/available *)
  20.   write = FlagSet{writeFlag};(* output operations are requested/available *)
  21.   text  = FlagSet{textFlag}; (* text operations are requested/available *)
  22.   raw   = FlagSet{rawFlag};  (* raw operations are requested/available *)
  23.   echo  = FlagSet{echoFlag}; (* echoing by interactive device on reading of
  24.                 characters from input stream requested/applies *)
  25.  
  26. (* In line mode, items are echoed before being added to the input stream
  27.  * and are added a line at a time.
  28.  * In single character mode, items are added to the input stream one at a
  29.  * time and are echoed as they are removed from the input stream by a
  30.  * read operation
  31.  *)
  32.  
  33. PROCEDURE Open (VAR cid   : ChanId;
  34.                     flags : FlagSet;
  35.                 VAR res   : OpenResults);
  36. (* Attempts to obtain and open a channel connected to the terminal
  37.    Without the raw flag, text is implied.
  38.    Without the echo flag, line mode is requested, otherwise single character
  39.    mode is requested.
  40.    If successful, assigns to the parameter cid the identity of a channel
  41.    open to the terminal and assigns the value, opened to the parameter res.
  42.    Otherwise, the value of the parameter res indicates the reason for failure
  43.    and cid identifies the bad channel. *)
  44.  
  45.  
  46. PROCEDURE IsTermFile (cid : ChanId) : BOOLEAN;
  47. (* Tests if the channel is open to the terminal *)
  48.  
  49.  
  50. PROCEDURE Close (VAR cid : ChanId);
  51. (* If the channel is not open to the terminal, the exception
  52.    wrongDevice is raised. Otherwise, the channel is closed and the value
  53.    identifying the bad channel is assigned to the parameter cid. *)
  54.  
  55. END TermFile.
  56.