Sage-ST ä

Bufio

Documentation

Global Declarations (Constants, Types, Variables)
BFClose BFOpen BFReadBlock
BFReadChar BFReadLine BFReadPos BFSetPos
BFStats BFWriteBlock BFWriteChar BFWriteLine
BFWriteLn BFWritePos BFWriteString GetHandleState





  type FileBF is private;




  procedure BFClose
             (FTable : in out FileBF;
              state  :    out Files.FileState);

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




  procedure BFOpen
             (FTable   :    out FileBF;
              FileName : in     string;
              Modify   : in     boolean;
              Append   : in     boolean;
              maxBuf   : in     ModSys.S_Natural;
              state    :    out Files.FileState);

  --*
  --  BFOpen - Open file for large buffered reads/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 : string
  --      Name of file to open
  --
  --    modify : boolean
  --      Open file w/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 : ModSys.S_Natural
  --      The maximum size of file IO buffer in bytes.
  --
  --  EXIT -
  --
  --    state : Files.FileState
  --      The file status.
  --




  procedure BFReadBlock
             (FTable    : in out FileBF;
              buf       : in     System.Address;
              nBytes    : in     ModSys.S_Natural;
              bytesRead :    out ModSys.S_Natural;
              endOfFile :    out boolean;
              state     :    out Files.FileState);

  --*
  --  BFReadBlock - Read block of bytes from a file.
  --
  --
  --  This procedure reads a block of characters 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 : ModSys.S_Natural
  --      The number of bytes (characters) requested to be read.
  --
  --  EXIT -
  --
  --    buf : System.Address
  --      The line read from the file.
  --
  --    bytesRead : ModSys.S_Natural
  --      The number of characters read into 'line'.
  --
  --    endOfFile : boolean
  --      End of file reached.
  --
  --    state : Files.FileState
  --      The file status.
  --




  procedure BFReadChar
             (FTable    : in out FileBF;
              TheChar   :    out character;
              endOfFile :    out boolean;
              state     :    out Files.FileState);

  --*
  --  BFReadChar - Read a character from a file.
  --
  --
  --  This procedure reads a character from the buffered file.  This
  --  file should have been opened with the BFOpen procedure.  This
  --  procedure will read any ASCII or extended ASCII character.
  --
  --  CALLING SEQUENCE -
  --
  --    BFReadChar (fTable, c, endOfFile, state)
  --
  --  ENTRY -
  --
  --    fTable : FileBF
  --      File table
  --
  --  EXIT -
  --
  --    c : character
  --      The character read from the file.
  --
  --    endOfFile : boolean
  --      End of file reached.
  --
  --    state : Files.FileState
  --      The file status.
  --




  procedure BFReadLine
             (FTable    : in out FileBF;
              line      :    out string;
              lineSize  :    out ModSys.S_Natural;
              endOfFile :    out boolean;
              state     :    out Files.FileState);

  --*
  --  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.  In Ada, this procedure
  --  returns only ASCII characters between 32..127.
  --
  --  CALLING SEQUENCE -
  --
  --    BFReadLine (fTable, line, lineSize, endOfFile, state)
  --
  --  ENTRY -
  --
  --    fTable : FileBF
  --      File table
  --
  --  EXIT -
  --
  --    line : string
  --      The line read from the file.
  --
  --    lineSize : ModSys.S_Natural
  --      The number of characters read into 'line'.
  --
  --    endOfFile : boolean
  --      End of file reached.
  --
  --    state : Files.FileState
  --      The file status.
  --




  procedure BFReadPos
             (FTable    : in out FileBF;
              buf       : in     System.Address;
              filePos   : in     Files.FilePosition;
              nBytes    : in     ModSys.S_Natural;
              bytesRead :    out ModSys.S_Natural;
              endOfFile :    out boolean;
              state     :    out Files.FileState);

  --*
  --  BFReadPos - Read block of bytes from file w/o buffering.
  --
  --
  --  This procedure reads 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 : ModSys.S_Natural
  --      The number of bytes (characters) requested to be read.
  --
  --  EXIT -
  --
  --    buf : System.Address
  --      The data from the file.
  --
  --    bytesRead : ModSys.S_Natural
  --      The number of characters read into 'buf'.
  --
  --    endOfFile : boolean
  --      End of file reached.
  --
  --    state : Files.FileState
  --      The file status.
  --




  procedure BFSetPos
             (FTable  : in out FileBF;
              filePos : in     Files.FilePosition;
              state   :    out Files.FileState);

  --*
  --  BFSetPos - Set position in file for next operation.
  --
  --
  --  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) in the file where 0 is the beginning of the file.
  --
  --    state : Files.FileState
  --      The file status.
  --




  procedure BFStats
             (FTable     : in out FileBF;
              FileSize   :    out Files.FilePosition;
              currentPos :    out Files.FilePosition;
              state      :    out Files.FileState);

  --*
  --  BFStats - Return statistics on file being processed.
  --
  --
  --  This procedure returns the current statistics for file
  --  identified.
  --
  --  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 : Files.FileState
  --      The file status.
  --




  procedure BFWriteBlock
             (FTable : in out FileBF;
              buf    : in     System.Address;
              nBytes : in     ModSys.S_Natural;
              state  :    out Files.FileState);

  --*
  --  BFWriteBlock - Write out a block of data to a buffered file.
  --
  --
  --  This procedure writes 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 : System.Address
  --      Address of the block of data to written out.
  --
  --    nBytes : ModSys.S_Natural
  --      Number of bytes to write out.
  --
  --  EXIT -
  --
  --    state : Files.FileState
  --      The file status.
  --




  procedure BFWriteChar
             (FTable : in out FileBF;
              cc     : in     character;
              state  :    out Files.FileState);

  --*
  --  BFWriteChar - Write out character to buffered file.
  --
  --
  --  This procedure writes 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 : character
  --      Character to be written out.
  --
  --  EXIT -
  --
  --    state : Files.FileState
  --      The file status.
  --




  procedure BFWriteLine
             (FTable : in out FileBF;
              line   : in     string;
              state  :    out Files.FileState);

  --*
  --  BFWriteLine - Write out line to buffered file.
  --
  --
  --  This procedure writes out a line to the buffered file.  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 : string
  --      Line to be written out.
  --
  --  EXIT -
  --
  --    state : Files.FileState
  --      The file status.
  --




  procedure BFWriteLn
             (FTable : in out FileBF;
              state  :    out Files.FileState);

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




  procedure BFWritePos
             (FTable  : in out FileBF;
              buf     : in     System.Address;
              filePos : in     Files.FilePosition;
              nBytes  : in     ModSys.S_Natural;
              state   :    out Files.FileState);

  --*
  --  BFWritePos - Write out a block of data to a file.
  --
  --
  --  This procedure writes 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 writing
  --  using BFWritePos.  This procedure may be called if the file has
  --  been opened with or without MODIFY permission.  It may be useful
  --  for the case where writes to a file may be useful during buffered
  --  read operations.
  --
  --  CALLING SEQUENCE -
  --
  --    BFWritePos (fTable, buf, filePos, nBytes, state)
  --
  --  ENTRY -
  --
  --    fTable : FileBF
  --      File table.
  --
  --    buf : System.Address
  --      Address of the block of data to written out.
  --
  --    filePos : Files.FilePosition
  --      The position within the file to write to (0..n).
  --
  --    nBytes : ModSys.S_Natural
  --      Number of bytes to write out.
  --
  --  EXIT -
  --
  --    state : Files.FileState
  --      The file status.
  --




  procedure BFWriteString
             (FTable : in out FileBF;
              line   : in     string;
              state  :    out Files.FileState);

  --*
  --  BFWriteString - Write out string to buffered file.
  --
  --
  --  This procedure writes 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 : string
  --      Line to be written out.
  --
  --  EXIT -
  --
  --    state : Files.FileState
  --      The file status.
  --




  function GetHandleState
            (FTable : in     FileBF) return ModSys.HandleState;

  --*
  --  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