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

  1. DEFINITION MODULE StreamFile;
  2.  
  3.     (* Independent sequential data streams *)
  4.  
  5. IMPORT IOChan, ChanConsts;
  6. FROM ChanConsts IMPORT ChanFlags;
  7.  
  8. TYPE
  9.   ChanId      = IOChan.ChanId;
  10.   FlagSet     = ChanConsts.FlagSet;
  11.   OpenResults = ChanConsts.OpenResults;
  12.  
  13.  
  14. (* Accept singleton values of FlagSet *)
  15. CONST
  16.   read  = FlagSet{readFlag}; (* input operations are requested/available *)
  17.   write = FlagSet{writeFlag};(* output operations are requested/available *)
  18.   old   = FlagSet{oldFlag};  (* file may/must/did exist before channel was opened *)
  19.   text  = FlagSet{textFlag}; (* text operations are requested/available *)
  20.   raw   = FlagSet{rawFlag};  (* raw operations are requested/available *)
  21.  
  22.  
  23. PROCEDURE Open (VAR cid   : ChanId;
  24.                     name  : ARRAY OF CHAR;
  25.                     flags : FlagSet;
  26.                 VAR res   : OpenResults);
  27. (* Attempts to obtain and open a channel connected to a sequential stream file
  28.    without the write flag, read is implied; the read flag implies old;
  29.    without the raw flag, text is implied.
  30.    If successful, assigns to the parameter cid the identity of a channel
  31.    open to a source/destination of the given name and assigns the value
  32.    opened to the parameter res.
  33.    If a channel cannot be opened as required, the value of the parameter
  34.    res indicates the reason and cid identifies the bad channel. *)
  35.  
  36. PROCEDURE IsStreamFile (cid : ChanId) : BOOLEAN;
  37. (* Tests if the channel is open to a sequential stream *)
  38.  
  39. PROCEDURE Close (VAR cid : ChanId);
  40. (* If the channel is not open to a sequential stream, the exception
  41.    wrongDevice is raised. Otherwise, the channel is closed and the value
  42.    identifying the bad channel is assigned to the parameter cid. *)
  43.  
  44. END StreamFile.
  45.