home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 359 / def / streams.def < prev    next >
Encoding:
Modula Definition  |  1989-01-09  |  2.1 KB  |  65 lines

  1. DEFINITION MODULE Streams;
  2. (*
  3. *    Copyright (c) 1985,1986,1987,1988,1989 by
  4. *    ana-systems, Foster City, California.
  5. *    All Rights Reserved.
  6. *
  7. *    This software is furnished under a license and may be used and copied
  8. *    only  in accordance with  the  terms  of  such  license and  with the
  9. *    inclusion of the above copyright notice.  This software or  any other
  10. *    copies thereof may not be provided or otherwise made available to any
  11. *    other  person.   No title to and ownership of the  software is  herby
  12. *    transferred.
  13. *
  14. *    The information in this software is  subject to change without notice
  15. *    and  should  not be construed as a commitment by ana-systems.   No
  16. *    warranty is implied or expressed.
  17. *   SCCID  = "1.1    1/26/86"; 
  18. *)
  19.   FROM SYSTEM IMPORT 
  20.         WORD, ADR;
  21.   FROM Files IMPORT 
  22.          File, FileState;
  23.  
  24.  
  25.   EXPORT QUALIFIED
  26.         Connect,  Disconnect,  ResetStream,   WriteWord,  WriteChar,
  27.         EndWrite, ReadWord,    ReadChar,       EOS,       STREAM;
  28.  
  29.   TYPE
  30.       StreamType  = RECORD
  31.                  f  : File;
  32.                  isWordStream : BOOLEAN;
  33.                END;
  34.       STREAM = POINTER TO StreamType;
  35.  
  36.   PROCEDURE Connect(VAR s : STREAM; 
  37.                         f : File;
  38.                         ws: BOOLEAN);
  39.         (* ws = TRUE : word stream;
  40.            ws = FALSE: text stream; *)
  41.  
  42.   PROCEDURE Disconnect(VAR s     : STREAM; 
  43.                         closefile: BOOLEAN);
  44.         (* disconnect STREAM s from the file connected by routine Connect.
  45.            closefile = TRUE  then the disconnected file will be closed.
  46.            closefile = FALSE then the disconnected file is still open. *)
  47.  
  48.   PROCEDURE ResetStream(s: STREAM);
  49.         (* reset s *)
  50.  
  51.   PROCEDURE WriteWord(s: STREAM; w: WORD);
  52.  
  53.   PROCEDURE WriteChar(s: STREAM; ch: CHAR);
  54.  
  55.   PROCEDURE EndWrite(s: STREAM);
  56.         (* finish writing the stream *)
  57.  
  58.   PROCEDURE ReadWord(s: STREAM; VAR w: WORD);
  59.  
  60.   PROCEDURE ReadChar(s: STREAM; VAR ch: CHAR);
  61.          
  62.   PROCEDURE EOS(s: STREAM): BOOLEAN;
  63.         (* check End_of_STREAM *)
  64. END Streams.
  65.