home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1989-10-09 | 2.8 KB | 106 lines |
- DEFINITION MODULE SequentialIO;
- (*
- Written by Dexter (Chip) Orange, August, 1987.
-
- 3227 Rain Valley Ct.
- Tallahassee, FL. 32308
-
- home: (904) 877-0061
- Work: (904) 487-2680
- Compuserve: 71450,1162
-
-
-
-
-
-
-
- Copyright (C) 1987, 1989, Dexter (Chip) Orange
- All rights reserved. The modules of the TurboFile system may not be
- distributed in any way, nor a discussion of the algorithms used there-in,
- without the express written permission of the copyright holder (Dexter
- Orange).
-
- This module of the TurboFile system implements routines for doing very
- fast,
- I/O on sequential access files.
- All I/O is buffered, and the larger the buffer, the faster things will go.
-
-
-
- Version 1.0, September 1989.
- Converted from TDI to M2Sprint.
-
- *)
- FROM SYSTEM IMPORT
- BYTE;
-
- TYPE
- SequentialFile;
- (* You must declare a variable in your program of this type for each
- sequential file you wish to use. *)
-
- SequentialFileMode = (SequentialRead, SequentialWrite, NewSequentialFile);
- (* SequentialRead is self-explainatory, SequentialWrite will begin appending
- to the end of a file if it exists, or create a new one if necessary, and
- NewSequentialFile will force the creation of a new file *)
-
- VAR
- SIOErrorMessage: ARRAY [0..80] OF CHAR;
- (* contains the text of any error message *)
-
-
-
-
-
- PROCEDURE OpenSequentialFile (VAR File : SequentialFile; FileName : ARRAY OF
- CHAR; mode : SequentialFileMode; BufferedBytes: LONGCARD) : BOOLEAN;
- (* open (or create) a file for Sequential access. *)
- (* returns true if the open is successful *)
-
-
- PROCEDURE CloseSequentialFile (File : SequentialFile);
- (* Flushes the write buffer (if any) and concludes access to a Sequential file
- *)
-
-
-
- PROCEDURE ReadSequentialFile (File : SequentialFile; VAR data : ARRAY OF
- BYTE; (* Any type here *)
- BytesToRead: LONGCARD) : BOOLEAN;
- (* read a group of bytes from a Sequential file *)
- (* returns TRUE if number of bytes specified can be read *)
-
-
- PROCEDURE ReadLine (File : SequentialFile; VAR Data: ARRAY OF CHAR) :
- BOOLEAN;
- (* read characters from a sequential file until an EOL char is found.
- Any characters which won't fit into "Data" are lost. *)
- (* returns true if read successful *)
-
-
- PROCEDURE WriteSequentialFile (File : SequentialFile; VAR data : ARRAY OF
- BYTE; (* Any type here *)
- BytesToWrite: LONGCARD) : BOOLEAN;
- (* write a group of bytes to the Sequential file *)
- (* returns true if write successful *)
-
-
-
- PROCEDURE WriteLine (File : SequentialFile) : BOOLEAN;
- (* write an EOL character to a sequential file *)
- (* returns true if the write is successful *)
-
-
- PROCEDURE NumBytes(File: SequentialFile) : LONGCARD;
- (* return file size *)
-
-
- PROCEDURE Rewind(File: SequentialFile);
- (* re-position to beginning of file *)
-
-
-
-
- END SequentialIO.
-