Sage-ST ä

Bufio

Documentation

Unit Documentation (Unit description)
Global Declarations (Constants, Types, Variables)
BFClose BFOpen
BFReadBlock BFReadChar BFReadLine BFReadPos
BFSetPos BFStats BFWriteBlock BFWriteChar
BFWriteLine BFWriteLn BFWritePos BFWriteString
GetHandleState STRBFOpen STRBFReadLine STRBFWriteLine
STRBFWriteString





  //*
  //  BufIO - Buffered I/O.
  //
  //
  //  This library allows reading and writing to sequential files using large
  //  buffered memory.  The size of the buffer may be selected.  This process
  //  can cause I/O to be considerably faster than regular sequential I/O,
  //  especially if other I/O is being performed concurrently.
  //





  type
    FileBF = pointer;




  procedure BFOpen
             (var   FTable   : FileBF;
              const FileName : array of char;
              const Modify   : boolean;
              const Append   : boolean;
              const maxBuf   : cardinal;
              var   state    : Files.FileState); overload; stdcall;

  exports BFOpen (var   FTable   : FileBF;
                  const FileName : array of char;
                  const Modify   : boolean;
                  const Append   : boolean;
                  const maxBuf   : cardinal;
                  var   state    : Files.FileState) name 'BufIO_BFOpen';

  //*
  //  BFOpen - Open a file for large buffered reads and writes.
  //
  //
  //  This procedure opens a sequential file for buffered
  //  reads.  Buffered reading can be considerably faster than
  //  normal IO since large buffers are used and therefore head
  //  seek and position times are reduced.
  //
  //  CALLING SEQUENCE -
  //
  //    BFOpen (fTable, fileName, modify, append, maxBuf, state)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table
  //
  //    fileName : array of char
  //      Name of file to open
  //
  //    modify : boolean
  //      Open file with write permission (True) or read
  //      only permission (False).
  //
  //    append : boolean
  //      If using 'modify' permission, start writing at
  //      the end of an existing file (True), or create
  //      a new file (False);
  //
  //    maxBuf : cardinal
  //      The maximum size of file IO buffer in bytes.
  //
  //  EXIT -
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFOpen
             (var   FTable   : FileBF;
              const FileName : string;
              const Modify   : boolean;
              const Append   : boolean;
              const maxBuf   : cardinal;
              var   state    : Files.FileState); overload; stdcall;

  exports BFOpen (var   FTable   : FileBF;
                  const FileName : string;
                  const Modify   : boolean;
                  const Append   : boolean;
                  const maxBuf   : cardinal;
                  var   state    : Files.FileState) name 'BufIO_STRBFOpen';

  //*
  //  STRBFOpen - See documentation of BFOpen.
  //




  procedure BFClose
             (var   FTable : FileBF;
              var   state  : Files.FileState); stdcall;

  exports BFClose name 'BufIO_BFClose';

  //*
  //  BFClose - Close a file used for large buffered reads and writes.
  //
  //
  //  Close a file opened with the BFOpen procedure.
  //
  //  CALLING SEQUENCE -
  //
  //    BFClose (fTable, state)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table
  //
  //  EXIT -
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFSetPos
             (var   FTable  : FileBF;
              const filePos : Files.FilePosition;
              var   state   : Files.FileState); stdcall;

  exports BFSetPos name 'BufIO_BFSetPos';

  //*
  //  BFSetPos - Set the position on the file for the next read or write.
  //
  //
  //  This procedure allows the position of the next buffered
  //  read or write to be set to a relative file position.
  //  This is not necessary, and in fact inefficient, during
  //  normal sequential processing of a file.  When this
  //  procedure is used, sequential buffered processing begins
  //  again at the point specified in the same mode (either
  //  READ or MODIFY) in which the file was opened.  The
  //  position for the end of the file may be determined using
  //  the BFStats procedure and then this procedure used to set
  //  position there.
  //
  //  CALLING SEQUENCE -
  //
  //    BFSetPos (fTable, filePos, state);
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table
  //
  //  EXIT -
  //
  //    filePos : Files.FilePosition
  //      The position (0 .. n) on the file where 0 is the beginning
  //      of the file.
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFReadLine
             (var   FTable    : FileBF;
              var   line      : array of char;
              var   lineSize  : cardinal;
              var   endOfFile : boolean;
              var   state     : Files.FileState); overload; stdcall;

  exports BFReadLine (var   FTable    : FileBF;
                      var   line      : array of char;
                      var   lineSize  : cardinal;
                      var   endOfFile : boolean;
                      var   state     : Files.FileState) name 'BufIO_BFReadLine';

  //*
  //  BFReadLine - Read a line from a file.
  //
  //
  //  This procedure reads a line from a file opened with the
  //  BFOpen procedure.  The end of line characters are
  //  recognized and not returned in the line.
  //
  //  CALLING SEQUENCE -
  //
  //    BFReadLine (fTable, line, lineSize, endOfFile)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table
  //
  //  EXIT -
  //
  //    line : array of char
  //      The line read from the file.
  //
  //    lineSize : cardinal
  //      The number of characters read into 'line'.
  //
  //    endOfFile : boolean
  //      End of file reached.
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFReadLine
             (var   FTable    : FileBF;
              var   line      : string;
              var   lineSize  : cardinal;
              var   endOfFile : boolean;
              var   state     : Files.FileState); overload; stdcall;

  exports BFReadLine (var   FTable    : FileBF;
                      var   line      : string;
                      var   lineSize  : cardinal;
                      var   endOfFile : boolean;
                      var   state     : Files.FileState) name 'BufIO_STRBFReadLine';

  //*
  //  STRBFReadLine - See documentation of BFReadLine.
  //




  procedure BFReadBlock
             (var   FTable    : FileBF;
              const buf       : pointer;
              const nBytes    : cardinal;
              var   bytesRead : cardinal;
              var   endOfFile : boolean;
              var   state     : Files.FileState); stdcall;

  exports BFReadBlock name 'BufIO_BFReadBlock';

  //*
  //  BFReadBlock - Read a block of bytes from a file.
  //
  //
  //  Read a block of data from the buffered file.  This file
  //  should have been opened with the BFOpen procedure.  Any
  //  end of line characters are not detected as with the
  //  BFReadLine procedure.
  //
  //  CALLING SEQUENCE -
  //
  //    BFReadBlock (fTable, buf, nBytes, bytesRead, endOfFile, state)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table
  //
  //    nBytes : cardinal
  //      The number of bytes (characters) requested to be read.
  //
  //  EXIT -
  //
  //    buf : ADDRESS
  //      The data read from the file.
  //
  //    bytesRead : cardinal
  //      The number of characters read into 'buf'.
  //
  //    endOfFile : boolean
  //      End of file reached, no bytes available to be read.
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFReadChar
             (var   FTable    : FileBF;
              var   ch        : char;
              var   endOfFile : boolean;
              var   state     : Files.FileState); stdcall;

  exports BFReadChar name 'BufIO_BFReadChar';

  //*
  //  BFReadChar - Read a block of bytes from a file.
  //
  //
  //  Read a character from the buffered file.  This file
  //  should have been opened with the BFOpen procedure.
  //
  //  CALLING SEQUENCE -
  //
  //    BFReadChar (fTable, c, endOfFile, state)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table
  //
  //  EXIT -
  //
  //    CH : charACTER
  //      The character read from the file.
  //
  //    endOfFile : boolean
  //      End of file reached, no characters available.
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFReadPos
             (var   FTable    : FileBF;
              const buf       : pointer;
              const filePos   : Files.FilePosition;
              const nBytes    : cardinal;
              var   bytesRead : cardinal;
              var   endOfFile : boolean;
              var   state     : Files.FileState); stdcall;

  exports BFReadPos name 'BufIO_BFReadPos';

  //*
  //  BFReadPos - Read a block of bytes from a file without buffering.
  //
  //
  //  Read a block of data from a specified position on a file
  //  without using buffering.  The read/write position of the
  //  file and its buffer are not disturbed by this operation
  //  so that continual sequential buffered I/O may occur after
  //  reading using BFReadPos.  This procedure may be called if
  //  the file has been opened with either READ or MODIFY
  //  permission.
  //
  //  CALLING SEQUENCE -
  //
  //    BFReadPos (fTable, buf, filePos, nBytes, bytesRead, endOfFile, state)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table
  //
  //    filePos : Files.FilePosition
  //      The position within the file from which to read (0 .. n).
  //
  //    nBytes : cardinal
  //      The number of bytes (characters) requested to be read.
  //
  //  EXIT -
  //
  //    buf : ADDRESS
  //      The data from the file.
  //
  //    bytesRead : cardinal
  //      The number of characters read into 'buf'.
  //
  //    endOfFile : boolean
  //      End of file reached, no bytes available to be read.
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFWriteLn
             (var   FTable : FileBF;
              var   state  : Files.FileState); stdcall;

  exports BFWriteLn name 'BufIO_BFWriteLn';

  //*
  //  BFWriteLn - Terminate a line to a buffered file.
  //
  //
  //  Terminate a line on the buffered file.  This file should
  //  have been opened with the BFOpen procedure with modify
  //  permission.
  //
  //  CALLING SEQUENCE -
  //
  //    BFWriteLn (fTable, line, state)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table
  //
  //  EXIT -
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFWriteString
             (var   FTable : FileBF;
              const line   : array of char;
              var   state  : Files.FileState); overload; stdcall;

  exports BFWriteString (var   FTable : FileBF;
                         const line   : array of char;
                         var   state  : Files.FileState) name 'BufIO_BFWriteString';

  //*
  //  BFWriteString - Write out a line to a buffered file.
  //
  //
  //  Write out a line to the buffered file.  This does not
  //  output a line terminator.  This file should have been
  //  opened with the BFOpen procedure with modify permission.
  //
  //  CALLING SEQUENCE -
  //
  //    BFWriteString (fTable, line, state)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table
  //
  //    line : array of char
  //      Line to be written out.
  //
  //  EXIT -
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFWriteString
             (var   FTable : FileBF;
              const line   : string;
              var   state  : Files.FileState); overload; stdcall;

  exports BFWriteString (var   FTable : FileBF;
                         const line   : string;
                         var   state  : Files.FileState) name 'BufIO_STRBFWriteString';

  //*
  //  STRBFWriteString - See documentation of BFWriteString.
  //




  procedure BFWriteLine
             (var   FTable : FileBF;
              const line   : array of char;
              var   state  : Files.FileState); overload; stdcall;

  exports BFWriteLine (var   FTable : FileBF;
                       const line   : array of char;
                       var   state  : Files.FileState) name 'BufIO_BFWriteLine';

  //*
  //  BFWriteLine - Write out a complete line to a buffered file.
  //
  //
  //  Write out a line to the buffered file.  This includes the
  //  the standard line terminators.  This file should have
  //  been opened with the BFOpen procedure with modify
  //  permission.
  //
  //  CALLING SEQUENCE -
  //
  //    BFWriteLine (fTable, line, state)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table
  //
  //    line : array of char
  //      Line to be written out.
  //
  //  EXIT -
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFWriteLine
             (var   FTable : FileBF;
              const line   : string;
              var   state  : Files.FileState); overload; stdcall;

  exports BFWriteLine (var   FTable : FileBF;
                       const line   : string;
                       var   state  : Files.FileState) name 'BufIO_STRBFWriteLine';

  //*
  //  STRBFWriteLine - See documentation of BFWriteLine.
  //




  procedure BFWriteChar
             (var   FTable : FileBF;
              const cc     : char;
              var   state  : Files.FileState); stdcall;

  exports BFWriteChar name 'BufIO_BFWriteChar';

  //*
  //  BFWriteChar - Write out a character to a buffered file.
  //
  //
  //  Write out a character to the buffered file.  This file
  //  should have been opened with the BFOpen procedure with
  //  modify permission.
  //
  //  CALLING SEQUENCE -
  //
  //    BFWriteChar (fTable, cc, state)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table
  //
  //    cc : char
  //      Character to be written out.
  //
  //  EXIT -
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFWriteBlock
             (var   FTable : FileBF;
              const buf    : pointer;
              const nBytes : cardinal;
              var   state  : Files.FileState); stdcall;

  exports BFWriteBlock name 'BufIO_BFWriteBlock';

  //*
  //  BFWriteBlock - Write out a block of data to a buffered file.
  //
  //
  //  Write out a block of data to the buffered file.  This
  //  file should have been opened with the BFOpen procedure
  //  with modify permission.  This procedure writes out
  //  characters within the block without attempting to
  //  determine end of line characters, etc.
  //
  //  CALLING SEQUENCE -
  //
  //    BFWriteBlock (fTable, buf, nBytes, state)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table.
  //
  //    buf : ADDRESS
  //      Address of the block of data to written out.
  //
  //    nBytes : cardinal
  //      Number of bytes to write out.
  //
  //  EXIT -
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFWritePos
             (var   FTable  : FileBF;
              const buf     : pointer;
              const filePos : Files.FilePosition;
              const nBytes  : cardinal;
              var   state   : Files.FileState); stdcall;

  exports BFWritePos name 'BufIO_BFWritePos';

  //*
  //  BFWritePos - Write out a block of data to a file.
  //
  //
  //  Write a block of data to a specified position on a file
  //  without using buffering.  The read/write position of the
  //  file and its buffer are not disturbed by this operation
  //  so that continual sequential buffered I/O may occur after
  //  reading using BFReadPos.  This procedure may be called if
  //  the file has been opened with either READ or MODIFY
  //  permission.
  //
  //  CALLING SEQUENCE -
  //
  //    BFWritePos (fTable, buf, filePos, nBytes, state)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table.
  //
  //    buf : ADDRESS
  //      Address of the block of data to written out.
  //
  //    filePos : Files.FilePosition
  //      The position within the file to write to (0 .. n).
  //
  //    nBytes : cardinal
  //      Number of bytes to write out.
  //
  //  EXIT -
  //
  //    state : FileState
  //      The file status.
  //




  procedure BFStats
             (var   FTable     : FileBF;
              var   FileSize   : Files.FilePosition;
              var   currentPos : Files.FilePosition;
              var   state      : Files.FileState); stdcall;

  exports BFStats name 'BufIO_BFStats';

  //*
  //  BFStats - Return statistics on the file being processed.
  //
  //
  //  This procedure returns the current statistics for file
  //  identifed.
  //
  //  CALLING SEQUENCE -
  //
  //    BFStats (fTable, fileSize, currentPos, state)
  //
  //  ENTRY -
  //
  //    fTable : FileBF
  //      File table.
  //
  //  EXIT -
  //
  //    fileSize : Files.FilePosition
  //      Byte size of the file.
  //
  //    currentPos : Files.FilePosition
  //      Next byte position that will be returned if a read
  //      is performed, or next byte position that will be
  //      written to if a write is performed.
  //
  //    state : FileState
  //      The file status.
  //




  function GetHandleState
             (const FTable : FileBF) : ModSys.HandleState; stdcall;

  exports GetHandleState name 'BufIO_GetHandleState';

  //*
  //  GetHandleState - Gets the current state of the handle (HandleOpened or HandleClosed).
  //
  //
  //  This procedure gets the state of the handle.  It returns one of two values depending
  //  on whether the handle is currently open or closed.
  //
  //  CALLING SEQUENCE -
  //
  //    GetHandleState (FTable);
  //
  //  ENTRY -
  //
  //    FTable : FileBF
  //      The file handle to be tested.
  //
  //  EXIT -
  //
  //    HandleState
  //      ModSys.HandleClosed - The handle is currently closed.
  //      ModSys.HandleOpen -  The handle is open for use.
  //




Send mail to   warren.merrill@inl.gov with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance