Sage-ST ä

Files

Documentation

AddToPosition AddToPositionByNum CalcFilePos ClearCommError
Close ComparePositions ComparePositionsByNum ConcatFiles
ConvertPositionToNum CopyFile Create Delete
DirQuery DiskIO DividePosition EOF
FileExists GetBOF GetCommState GetCommTimeouts
GetDeviceFreeSpace GetEOF GetFileHandle GetFileName
GetFilePos GetHandleState GetInheritMode GetPathFileName
GetSharingModes Lookup LookupRead MultiplyPosition
Open PositionDifference PositionDifferenceByNum ReadBlock
ReadByte ReadBytes ReadWord Remove
Rename Reset ResetState Rewrite
SetCommFlow SetCommState SetCommTimeouts SetFilePos
SetInheritMode SetSharingModes SetToValue SetToValueByNum
State1 SubtractFromPosition SubtractFromPositionByNum Truncate
WriteBlock WriteByte WriteBytes WriteWord




  PROCEDURE GetCommState
             (VAR   File1  : File;
              VAR   baud   : CARDINAL;
              VAR   Data   : CARDINAL;
              VAR   Parity : CARDINAL;
              VAR   stop   : CARDINAL;
              VAR   done   : BOOLEAN);




  PROCEDURE SetCommState
             (VAR   File1  : File;
              CONST baud   : CARDINAL;
              CONST Data   : CARDINAL;
              CONST Parity : CARDINAL;
              CONST stop   : CARDINAL;
              VAR   done   : BOOLEAN);




  PROCEDURE SetCommFlow
             (VAR   File1 : File;
              CONST flow  : CARDINAL;
              VAR   done  : BOOLEAN);




  PROCEDURE GetCommTimeouts
             (VAR   File1           : File;
              VAR   readTimeout     : CARDINAL;
              VAR   readMultiplier  : CARDINAL;
              VAR   readConstant    : CARDINAL;
              VAR   writeMultiplier : CARDINAL;
              VAR   writeConstant   : CARDINAL;
              VAR   done            : BOOLEAN);




  PROCEDURE SetCommTimeouts
             (VAR   File1           : File;
              CONST readTimeout     : CARDINAL;
              CONST readMultiplier  : CARDINAL;
              CONST readConstant    : CARDINAL;
              CONST writeMultiplier : CARDINAL;
              CONST writeConstant   : CARDINAL;
              VAR   done            : BOOLEAN);




  PROCEDURE ClearCommError
             (VAR   File1  : File;
              VAR   errors : CommError;
              VAR   Status : CommStatus;
              VAR   done   : BOOLEAN);




  PROCEDURE GetDeviceFreeSpace
             (CONST spec : ARRAY OF CHAR) : LONGINT;




  PROCEDURE Open
             (VAR   File1     : File;
              CONST FileName  : ARRAY OF CHAR;
              CONST BinText   : BinTextMode;
              CONST WriteMode : ReadWriteMode;
              VAR   state     : FileState);

  (**
      Open - Open an existing external file.

      This procedure opens an existing file and returns an error if
      that file is not present.

      CALLING SEQUENCE -

        Open (File1, FileName, BinText, WriteMode, state)

      ENTRY -

        File1 : File
          The file handle.

        FileName : ARRAY OF CHAR
          The name of the file to be opened.  This may optionally
          include the drive and/or directories.

        BinText : BinTextMode
          The mode of the file to be opened.  This includes the
          following enumerated values -
                        BinMode, TextMode

        WriteMode : ReadWriteMode
          The write mode in which to open the file.  This includes
          the following enumerated values -
                        ReadOnly, ReadWrite, AppendOnly

      EXIT -

        State : FileState
          The status of the requested operation (ok => successful).
  *)




  PROCEDURE Create
             (VAR   File1    : File;
              CONST FileName : ARRAY OF CHAR;
              CONST BinText  : BinTextMode;
              CONST ReplMode : ReplaceMode;
              VAR   state    : FileState);

  (**
      Create - Create a new external file.

      This procedure creates aa new file.  If the named file already
      exists, then that file will be overwritten if the 'ReplMode'
      variable is set to replace.  Otherwise no creation will occur
      and an error will be returned.

      CALLING SEQUENCE -

        Create (File1, name, BinText, ReplMode, state);

      ENTRY -

        File1 : File
          The file handle.

        FileName : ARRAY OF CHAR
          The name of the file to be created.  This may optionally
          include the drive and/or directories.

        BinText : BinTextMode
          The mode of the file to be opened.  This includes the
          following enumerated values -
                        BinMode, TextMode

        ReplMode : ReplaceMode
          The replace mode of the file to create.  This includes
          the following enumerated values -
                        NoReplace, Replace

      EXIT -

        State : FileState
          The status of the requested operation (ok => successful).
  *)




  PROCEDURE Close
             (VAR   File1 : File;
              VAR   state : FileState);

  (**
      Close - Close a file and save it.

      This procedure closes a file that has already been opened by
      one of the standard procedures supplied in this library.

      CALLING SEQUENCE -

        Close (File1, state)

      ENTRY -

        File1 : File
          The file handle.

        State : FileState
          The status of the requested operation (ok => successful).
  *)




  PROCEDURE Remove
             (VAR   File1 : File;
              VAR   state : FileState);

  (**
      Remove - Close the file and remove the external file.

      This procedure closes a file which was opened using one
      of the standard procedures in this library.  The file
      is then removed (deleted).

      CALLING SEQUENCE -

        Remove (File1, state)

      ENTRY -

        File1 : File
          The file handle.

        State : FileState
          The status of the requested operation (ok => successful).
  *)




  PROCEDURE Reset
             (VAR   File1 : File;
              VAR   state : FileState);

  (**
      Reset - Reposition an opened file to the start.

      This procedure causes an opened file to be repositioned to
      its start.  This is the default condition when a file is
      first opened or created.

      CALLING SEQUENCE -

        Reset (File1, state)

      ENTRY -

        File1 : File
          The file handle.

        State : FileState
          The status of the requested operation (ok => successful).
  *)




  PROCEDURE Rewrite
             (VAR   File1 : File;
              VAR   state : FileState);

  (**
      Rewrite - Reposition to the start of the file and truncate it.

      This procedure repositions to the start of the file and
      truncates it from there, effectively removing all of the
      data from the file just as it was when first created.

      CALLING SEQUENCE -

        Rewrite (File1, state)

      ENTRY -

        File1 : File
          The file handle.

        State : FileState
          The status of the requested operation (ok => successful).
  *)




  PROCEDURE Truncate
             (VAR   File1 : File;
              VAR   state : FileState);

  (**
      Truncate - Set the physical end of the file to the current position.

      This procedure truncates the file at the current position.

      CALLING SEQUENCE -

        Truncate (File1, state)

      ENTRY -

        File1 : File
          The file handle.

        State : FileState
          The status of the requested operation (ok => successful).
  *)




  PROCEDURE EOF
             (VAR   File1 : File;
              VAR   flag  : BOOLEAN);

  (**
      EOF - End of file error return.

      This procedure returns the 'flag' as TRUE if the last operation
      was not performed due to an End-of-file error.

      CALLING SEQUENCE -

        EOF (File1, flag)

      ENTRY -

        File1 : File
          The file handle.

      EXIT -

        flag : BOOLEAN
          TRUE if an end-of-file condition exists.
  *)




  PROCEDURE State1
             (CONST File1 : File) : FileState;

  (**
      State1 - Return the current state of the file.

      This procedure returns the current State of the file as set
      by a previous operation.

      CALLING SEQUENCE -

        s := State1 (File1)

      ENTRY -

        File1 : File
          The file handle.

      EXIT -

        s : FileState
          The state.  This may be one of the following -

            ok             noMoreRoom
            nameError      accessError
            noFile         notOpen
            noMemory       endError
            existingFile   outsideFile
            deviceError    otherError
  *)




  PROCEDURE ResetState
             (VAR   File1 : File;
              VAR   state : FileState);

  (**
      ResetState - Reset an error state to allow continued operation.

      This procedure resets the state variable to allow continued
      operation.  If an error state was detected, most file operation
      would not be allowed to continue.  This reevalutes the EOF/EOL
      (end-of-file) so that it really indicates a file position
      instead of an error.

      CALLING SEQUENCE -

        ResetState (File1, state)

      ENTRY -

        File1 : File
          The file handle.

      EXIT -

        State : FileState
          The state.
  *)




  PROCEDURE GetFileHandle
             (CONST File1  : File;
              VAR   handle : DosLib.HandleType);




  PROCEDURE GetFileName
             (VAR   File1    : File;
              VAR   FileName : ARRAY OF CHAR;
              VAR   state    : FileState);

  (**
      GetFileName - Return the file name.

      This procedure returns the complete and unambiguous name of the
      file associated with the file handle.

      CALLING SEQUENCE -

        GetFileName (File1, FileName, state)

      ENTRY -

        File1 : File
          The file handle.

      EXIT -

        FileName : ARRAY OF CHAR
          The name of the file.

        State : FileState
          The state.
  *)




  PROCEDURE GetPathFileName
             (VAR   File1        : File;
              VAR   PathFileName : ARRAY OF CHAR;
              VAR   state        : FileState);

  (**
      GetPathFileName - Return the complete file name including path.

      This procedure returns the complete and unambiguous name of the
      file associated with the file handle including its path.  The
      return name will include the path to the file even if the
      original name passed in did not include a path.

      CALLING SEQUENCE -

        GetPathFileName (File1, PathFileName, state)

      ENTRY -

        File1 : File
          The file handle.

      EXIT -

        PathFileName : ARRAY OF CHAR
          The name of the file including the path.

        State : FileState
          The state.
  *)




  PROCEDURE ReadByte
             (VAR   File1 : File;
              VAR   byte1 : SYSTEM.BYTE;
              VAR   state : FileState);

  (**
      ReadByte - Read one byte from a file.

      This procedure reads one byte of information from a binary file
      from the current position.  After reading, the current position
      of the file is one byte beyond the previous position.

      CALLING SEQUENCE -

        ReadByte (File1, byte1, state)

      ENTRY -

        File1 : File
          The file handle.

      EXIT -

        byte1 : SYSTEM.BYTE
          The byte read from the file.

        State : FileState
          The state.
  *)




  PROCEDURE ReadWord
             (VAR   File1 : File;
              VAR   word1 : SYSTEM.WORD;
              VAR   state : FileState);

  (**
      ReadWord - Read one word from a file.

      This procedure reads one word of information from a binary file
      from the current position.  After reading, the current position
      of the file is one word beyond the previous position.

      CALLING SEQUENCE -

        ReadWord (File1, word1, state)

      ENTRY -

        File1 : File
          The file handle.

      EXIT -

        word1 : SYSTEM.WORD
          The word read from the file.

        State : FileState
          The state.
  *)




  PROCEDURE ReadBlock
             (VAR   File1 : File;
              VAR   block : ARRAY OF SYSTEM.BYTE;
              VAR   state : FileState);

  (**
      ReadBlock - Read data from a binary file.

      This procedure reads a block of binary data from a
      file beginning at the current position.  As much data
      as can be contained within the supplied array will be
      read.  The current file position will be changed after
      the read by the number of bytes read.

      CALLING SEQUENCE -

        ReadBlock (File1, block, state)

      ENTRY -

        File1 : File
          The file handle.

      EXIT -

        block : ARRAY OF SYSTEM.BYTE
          The array to receive the data.  If the end-of-file
          was reached first, it may be detected by using
          the EOF procedure.

        State : FileState
          The state.
  *)




  PROCEDURE ReadBytes
             (VAR   File1     : File;
              CONST addr      : SYSTEM.ADDRESS;
              CONST bytes     : CARDINAL;
              VAR   bytesRead : CARDINAL;
              VAR   state     : FileState);

  (**
      ReadBytes - Read a specified number of bytes from a file.

      This procedure reads a specified number of bytes from a file
      beginning at the current position of the file.  After the
      read, the current position will be updated by the number
      of bytes read.

      CALLING SEQUENCE -

        ReadBytes (File1, addr, bytes, bytesRead, state)

      ENTRY -

        File1 : File
          The file handle.

        addr : SYSTEM.ADDRESS
          The address into which the data is to be read.

        bytes : CARDINAL
          The number of bytes requested to be read.

      EXIT -

        bytesRead : CARDINAL
          The actual number of bytes read into the specified
          address.

        State : FileState
          The state.
  *)




  PROCEDURE WriteByte
             (VAR   File1 : File;
              CONST byte1 : SYSTEM.BYTE;
              VAR   state : FileState);

  (**
      WriteByte - Write one byte of data to a file.

      This procedure writes one byte of data to the file at the
      current position.  After the write, the current position
      is updated by one byte.  If at the end of the file, the
      file size increases by one byte.

      CALLING SEQUENCE -

        WriteByte (File1, byte1, state)

      ENTRY -

        File1 : File
          The file handle.

        byte1 : SYSTEM.BYTE
          The byte to be written.

      EXIT -

        State : FileState
          The state.
  *)




  PROCEDURE WriteWord
             (VAR   File1 : File;
              CONST word1 : SYSTEM.WORD;
              VAR   state : FileState);

  (**
      WriteWord - Write one word of data to a file.

      This procedure writes one word of data to the file at the
      current position.  After the write, the current position
      is updated by one word.  If at the end of the file, the
      file size increases by one word.

      CALLING SEQUENCE -

        WriteWord (File1, word1, state)

      ENTRY -

        File1 : File
          The file handle.

        word1 : SYSTEM.WORD
          The word to be written.

      EXIT -

        State : FileState
          The state.
  *)




  PROCEDURE WriteBlock
             (VAR   File1 : File;
              VAR   block : ARRAY OF SYSTEM.BYTE;
              VAR   state : FileState);

  (**
      WriteBlock - Write one block of data to a file.

      This procedure writes one block of data to the file at the
      current position.  After the write, the current position
      is updated by the block size.  If at the end of the file, the
      file size increases by that block size.

      CALLING SEQUENCE -

        WriteBlock (File1, block1, state)

      ENTRY -

        File1 : File
          The file handle.

        block : ARRAY OF SYSTEM.BYTE
          The block to be written.

      EXIT -

        State : FileState
          The state.
  *)




  PROCEDURE WriteBytes
             (VAR   File1 : File;
              CONST addr  : SYSTEM.ADDRESS;
              CONST bytes : CARDINAL;
              VAR   state : FileState);

  (**
      WriteBytes - Write bytes of data to a file.

      This procedure writes a specified number of bytes of
      data to a file at the current position from the
      specified memory location (SYSTEM.ADDRESS).

      CALLING SEQUENCE -

        WriteBytes (File1, addr, bytes, state)

      ENTRY -

        File1 : File
          The file handle.

        addr : SYSTEM.ADDRESS
          The memeory location to retrieve the data from
          for the write.

        bytes : CARDINAL
          The number of bytes to write from the specified
          memory location onto the file.

      EXIT -

        State : FileState
          The state.

      EXAMPLE -

        MODULE CopyFile;

        IMPORT Files;
        IMPORT SYSTEM;

        CONST
          bufSize = 1000;

        VAR
          f1 : File;
          f2 : File;

          state1 : Files.FileState;
          state2 : Files.FileState;

          buffer : ARRAY [0 .. bufSize-1] OF CHAR;

          bytesRead : CARDINAL;

          finished : BOOLEAN;
          done : BOOLEAN;

        BEGIN
          Open (f1, "SOURCE.DAT", binMode, readWrite, state1);
          Create (f2, "DEST.DAT", binMode, replace,  state2);

          done := FALSE;

          WHILE (NOT Done) DO
            ReadBytes (f1, SYSTEM.ADR (buffer), bufSize, bytesRead, state1);
            EOF (f1, finished);
            IF finished THEN
              done := TRUE;
            END;
            WriteBytes (f2, SYSTEM.ADR (buffer), bytesRead, state2);
          END;

          Close (f1, state1);
          Close (f2, state2);
        END CopyFile.
  *)




  PROCEDURE Rename
             (CONST fromName : ARRAY OF CHAR;
              CONST toName   : ARRAY OF CHAR;
              VAR   state    : FileState);




  PROCEDURE Delete
             (CONST FileName : ARRAY OF CHAR;
              VAR   state    : FileState);




  PROCEDURE DirQuery
             (CONST WildCard : ARRAY OF CHAR;
              CONST DirProc  : DirQueryProc;
              VAR   state    : FileState);

  (**
      DirQuery - Query system for specified file (s).


      DirQuery allows the querying of files by name much the same as the DOS
      DIR (or Unix ls) command.  The 'Wild' variable is set to a file name
      (that may include '*' and/or '?' characters).  This procedure then calls
      DirProc to process each file name that meets the wild-card
      specification.  DirQuery stops calling DirProc whenever DirProc returns
      FALSE for the 'continue' value.

      The DirQuery procedure is instantiated with a user-supplied procedure
      that is passed the name of each file found and returns a variable
      indicating whether the process should continue.  This procedure must
      have the following format:

          procedure DirProc
                     (CONST FileName : ARRAY OF CHAR;
                      VAR   ContinueOn : BOOLEAN);

      CALLING SEQUENCE -

        DirQuery (WildCard, DirProc, state);

      ENTRY -

        Wild : ARRAY OF CHAR
          String containing a file name and/or wild card values to represent the
          file name (s) to be located.  This is compatible with the DOS file name
          and wild card format (use '*' and '?' characters as wild card values).

      EXIT -

        state : FileState
          The state.

      EXAMPLE -

        IMPORT Files;
        IMPORT TermX;

        PROCEDURE ListFiles;

        VAR
          state : Files.FileState;

          PROCEDURE MyList
                     (CONST FileName : ARRAY OF CHAR;
                      VAR   ContinueOn : BOOLEAN);

          BEGIN
            TermX.WriteString (fileName);
            TermX.WriteLn;
            ContinueOn := TRUE;
          END MyList;

        BEGIN
          Files.DirQuery ("*.*", MyList, state);
        END ListFiles.
  *)




  PROCEDURE GetFilePos
             (VAR   File1 : File;
              VAR   Pos   : FilePosition);

  (* returns the current position the file *)




  PROCEDURE GetEOF
             (VAR   File1 : File;
              VAR   Pos   : FilePosition);

  (* returns a FilePosition of the current end of the file *)




  PROCEDURE GetBOF
             (VAR   File1 : File;
              VAR   Pos   : FilePosition);

  (* returns a FilePosition of the beginning of the file *)




  PROCEDURE CalcFilePos
             (VAR   File1         : File;
              VAR   Pos           : FilePosition;
              CONST NumOfElements : INTEGER;
              CONST ElementLength : CARDINAL);

  (* Calculate a file position relative to FilePos, offset by NumOfElements. *)
  (* Return the resulting position FilePos *)




  PROCEDURE SetFilePos
             (VAR   File1 : File;
              CONST Pos   : FilePosition;
              VAR   state : FileState);

  (* positions the file as specified.  illegal position leaves the file *)
  (* as it was before the call and returns a bad state *)




  PROCEDURE Lookup
             (VAR   FileHandle : File;
              CONST FileName   : ARRAY OF CHAR;
              CONST NewF       : BOOLEAN;
              VAR   state      : FileState);

  (**
      Lookup - Perform a lookup on the specified file.


      This routine performs the necessary functions to allow the
      user to open an existing file or create a new one if the
      specified file does not exist.

      CALLING SEQUENCE -

        Lookup (FileHandle, FileName, NewF, State)

      ENTRY -

        FileHandle : STFile
          A file variable for the file to be opened.

        FileName : ARRAY OF CHAR
          An array of characters containing the name of the file
          to be opened.

        NewF : boolean
          A flag indicating whether a new file; to be created
          if the specified one does not exist.

      EXIT -

        State : FileState
          The file State variable; returned.
  *)




  PROCEDURE LookupRead
             (VAR   FileHandle : File;
              CONST FileName   : ARRAY OF CHAR;
              CONST NewF       : BOOLEAN;
              VAR   state      : FileState);




  PROCEDURE DiskIO
             (VAR   FileHandle  : File;
              CONST Operation   : DISKOP;
              CONST Buffer      : SYSTEM.ADDRESS;
              CONST DiskAddress : FilePosition;
              CONST Number      : CARDINAL;
              VAR   Error       : CARDINAL);




  PROCEDURE SetSharingModes
             (CONST mode : SharingModes);




  PROCEDURE GetSharingModes
             () : SharingModes;




  PROCEDURE SetInheritMode
             (CONST mode : CARDINAL);




  PROCEDURE GetInheritMode
             () : CARDINAL;




  PROCEDURE CopyFile
             (CONST SourceFile   : ARRAY OF CHAR;
              CONST DestFile     : ARRAY OF CHAR;
              CONST PreserveDate : BOOLEAN;
              VAR   Success      : BOOLEAN);

  (**
      CopyFile - Copy a file from one place to another.


      This procedure copies the SourceFile to the DestFile.  If the
      DestFile exists it is overwritten.

      CALLING SEQUENCE -

        CopyFile (SourceFile, DestFile, PreserveDate, Success);

      ENTRY -

        SourceFile : ARRAY OF CHAR
          The complete name (including path to copy from).

        DestFile : ARRAY OF CHAR
          The complete name (including path to copy to).

        PreserveDate : BOOLEAN
          TRUE - Keep the original date and time of the file
          FALSE - Set date and time to the copy date and time

      EXIT -

        Success : BOOLEAN
          TRUE - The copy was completed okay.
          FALSE - The copy could not be completed.
  *)




  PROCEDURE ConcatFiles
             (CONST SourceFile1 : ARRAY OF CHAR;
              CONST SourceFile2 : ARRAY OF CHAR;
              VAR   Success     : BOOLEAN);

  (**
      ConcatFiles - Concat SourceFile1 + SourceFile2.


      This procedure concats SourceFile2 onto the end of SourceFile1.
      If SourceFile1 does not exist it will be created.

      CALLING SEQUENCE -

        ConcatFiles (SourceFile1, SourceFile2, Success);

      ENTRY -

        SourceFile1 : ARRAY OF CHAR
          The complete name (including path to copy from) of the first
          file in the concatenation.

        SourceFile2 : ARRAY OF CHAR
          The complete name (including path to copy from) of the second
          file in the concatenation (will be appended to the end of
          SourceFile1).

      EXIT -

        Success : BOOLEAN
          TRUE - The concat was completed okay.
          FALSE - The concat could not be completed.
  *)




  PROCEDURE FileExists
             (CONST FileName : ARRAY OF CHAR) : BOOLEAN;

  (**
      FileExists - Returns a boolean to indicate the files existence.


      This procedure checks to see if a file exists and returns a boolean
      indicating the result.  The FileName should include the full path unless
      the current directory is being checked.  You may also use wildcard
      characters in the filename to check for the existence of any files
      matching the string.

      CALLING SEQUENCE -

        FileExists (FileName);

      ENTRY -

        FileName : ARRAY OF CHAR
          The complete name (including path if needed) to look for.

      EXIT -

        TRUE - The indicated file was found.
          FALSE - The indicated file was NOT found.
  *)




  PROCEDURE GetHandleState
             (CONST handle : File) : 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 (Handle);

      ENTRY -

        Handle : File
          The file handle to be tested.

      EXIT -

        HandleState
          HandleClosed - The handle is currently closed.
          HandleOpen -  The handle is open for use.
  *)




  PROCEDURE SetToValue
             (VAR   ThePosition : FilePosition;
              CONST TheValue    : FilePosition);

  (**
      SetToValue - Compiler portable way of setting to a value within a range.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of setting the position variable to a given value.

      CALLING SEQUENCE -

        SetToValue (ThePosition, TheValue);

      ENTRY -

        ThePosition : FilePosition
          The variable to be set to a value.

        TheValue : FilePosition
          A value to be assigned to the file position variable.

      EXIT -

        ThePosition : FilePosition
          The FilePosition variable set to the value.
  *)




  PROCEDURE SetToValueByNum
             (VAR   ThePosition : FilePosition;
              CONST TheValue    : CARDINAL);

  (**
      SetToValueByNum - Compiler portable way of setting to a value within a range.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of setting the position variable to a given value.

      CALLING SEQUENCE -

        SetToValueByNum (ThePosition, TheValue);

      ENTRY -

        ThePosition : FilePosition
          The variable to be set to a value.

        TheValue : CARDINAL
          A value to be assigned to the file position variable.

      EXIT -

        ThePosition : FilePosition
          The FilePosition variable set to the value.
  *)




  PROCEDURE AddToPosition
             (VAR   ThePosition : FilePosition;
              CONST AddValue    : FilePosition);

  (**
      AddToPosition - Compiler portable way of adding to a file position.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of adding to the current position.

      CALLING SEQUENCE -

        AddToPosition (ThePosition, AddValue);

      ENTRY -

        ThePosition : FilePosition
          The current/starting value of the file position.

        AddValue : FilePosition
          The amount to be added to ThePosition.

      EXIT -

        ThePosition : FilePosition
          The new value of FilePosition incremented by AddValue.
  *)




  PROCEDURE AddToPositionByNum
             (VAR   ThePosition : FilePosition;
              CONST AddValue    : CARDINAL);

  (**
      AddToPositionByNum - Compiler portable way of adding to a file position.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of adding to the current position.

      CALLING SEQUENCE -

        AddToPositionByNum (ThePosition, AddValue);

      ENTRY -

        ThePosition : FilePosition
          The current/starting value of the file position.

        AddValue : CARDINAL
          The amount to be added to ThePosition.

      EXIT -

        ThePosition : FilePosition
          The new value of FilePosition incremented by AddValue.
  *)




  PROCEDURE SubtractFromPosition
             (VAR   ThePosition   : FilePosition;
              CONST SubtractValue : FilePosition);

  (**
      SubtractFromPosition - Compiler portable way of subtacting from a file position.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of subtracting from the current position.

      WARNING - If the result of the operation would be a value less than zero
      and minor error checking is on you will get a popup that the range min
      has been exceeded.

      CALLING SEQUENCE -

        SubtractFromPosition (ThePosition, SubtractValue);

      ENTRY -

        ThePosition : FilePosition
          The current/starting value of the file position.

        SubtractValue : FilePosition
          The amount to be subtracted from ThePosition.

      EXIT -

        ThePosition : FilePosition
          The new value of FilePosition decremented by SubtractValue.  If the
          SubtractValue was larger than ThePosition then ThePosition is
          set to zero.
  *)




  PROCEDURE SubtractFromPositionByNum
             (VAR   ThePosition   : FilePosition;
              CONST SubtractValue : CARDINAL);

  (**
      SubtractFromPositionByNum - Compiler portable way of subtacting from a file position.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of subtracting from the current position.

      WARNING - If the result of the operation would be a value less than zero
      and minor error checking is on you will get a popup that the range min
      has been exceeded.

      CALLING SEQUENCE -

        SubtractFromPositionByNum (ThePosition, SubtractValue);

      ENTRY -

        ThePosition : FilePosition
          The current/starting value of the file position.

        SubtractValue : CARDINAL
          The amount to be subtracted from ThePosition.

      EXIT -

        ThePosition : FilePosition
          The new value of FilePosition decremented by SubtractValue.  If the
          SubtractValue was larger than ThePosition then ThePosition is
          set to zero.
  *)




  PROCEDURE MultiplyPosition
             (VAR   ThePosition   : FilePosition;
              CONST MultiplyValue : CARDINAL);

  (**
      MultiplyPosition - Compiler portable way of multiplying a file position.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of multiplying the current position.

      CALLING SEQUENCE -

        MultiplyPosition (ThePosition, MultiplyValue);

      ENTRY -

        ThePosition : FilePosition
          The current/starting value of the file position.

        MultiplyValue : CARDINAL
          The amount to multiply the ThePosition.

      EXIT -

        ThePosition : FilePosition
          The new value of FilePosition multiplied by MultiplyValue.
  *)




  PROCEDURE DividePosition
             (VAR   ThePosition : FilePosition;
              CONST DivideValue : CARDINAL);

  (**
      DividePosition - Compiler portable way of dividing a file position.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of dividing the current position.

      CALLING SEQUENCE -

        DividePosition (ThePosition, DivideValue);

      ENTRY -

        ThePosition : FilePosition
          The current/starting value of the file position.

        DivideValue : CARDINAL
          The amount to divide the ThePosition.

      EXIT -

        ThePosition : FilePosition
          The new value of FilePosition divided by DivideValue.
  *)




  PROCEDURE ComparePositions
             (CONST Position1 : FilePosition;
              CONST Position2 : FilePosition) : PosResult;

  (**
      ComparePositions - Compiler portable way of comparing file positions.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of comparing two file positions.  The return value of this
      routine is the relationship of Position1 vs. Position2.

      CALLING SEQUENCE -

        ComparePositions (Position1, Position2);

      ENTRY -

        Position1 : FilePosition
          The first position.  The return value will show how this value is related
          to Position2.

        Position2 : FilePosition
          The second position.  The return value will show where Position1 is relative
          to this value.

      EXIT -

        PosResult
          PosEqual - The two positions are exactly equal.
          PosLess - Position2 is less than Position1.
          PosGreater - Position 2 is greater then Position1.
  *)




  PROCEDURE ComparePositionsByNum
             (CONST Position1 : FilePosition;
              CONST Position2 : CARDINAL) : PosResult;

  (**
      ComparePositions - Compiler portable way of comparing file positions.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of comparing two file positions.  The return value of this
      routine is the relationship of Position1 vs. Position2.

      CALLING SEQUENCE -

        ComparePositionsByNum (Position1, Position2);

      ENTRY -

        Position1 : FilePosition
          The first position.  The return value will show how Position2 compares
          to this value.

        Position2 : CARDINAL
          The second position.  The return value will show where this position
          is relative to Position1.

      EXIT -

        PosResult
          PosEqual - The two positions are exactly equal.
          PosLess - Position2 is less than Position1.
          PosGreater - Position 2 is greater then Position1.
  *)




  PROCEDURE PositionDifference
             (CONST Position1  : FilePosition;
              CONST Position2  : FilePosition;
              VAR   Difference : FilePosition);

  (**
      PositionDifference - Compiler portable way of finding the difference in two positions.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of calculating the difference in two file positions.  The
      return value of this routine is the distance between the values of Position1
      and Position2.  NOTE - the return value is the absolute difference.  It does
      not matter if Position1 is larger, smaller or equal to Position2 the return
      value will always be in the range of 0 .. N.

      CALLING SEQUENCE -

        PositionDifference (Position1, Position2, Difference);

      ENTRY -

        Position1 : FilePosition
          The first position.  The return value will show the distance between
          Position2 and this value.

        Position2 : FilePosition
          The second position.  The return value will show the distance between
          Position1 and this value.

      EXIT -

        Difference : FilePosition
          The absolute value of the distance between the two positions.
  *)




  PROCEDURE PositionDifferenceByNum
             (CONST Position1  : FilePosition;
              CONST Position2  : FilePosition;
              VAR   Difference : CARDINAL);

  (**
      PositionDifferenceByNum - Compiler portable way of finding the difference in two positions.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of calculating the difference in two file positions.  The
      return value of this routine is the distance between the values of Position1
      and Position2.  NOTE - the return value is the absolute difference.  It does
      not matter if Position1 is larger, smaller or equal to Position2 the return
      value will always be in the range of 0 .. N.

      WARNING - If the result of the operation would be a value greater than the
      capacity of a CARDINAL value and minor error checking is on you will get a
      popup that the range max has been exceeded.

      CALLING SEQUENCE -

        PositionDifferenceByNum (Position1, Position2, Difference);

      ENTRY -

        Position1 : FilePosition
          The first position.  The return value will show the distance between
          Position2 and this value.

        Position2 : FilePosition
          The second position.  The return value will show the distance between
          Position1 and this value.

      EXIT -

        Difference : CARDINAL
          The absolute value of the distance between the two positions.
  *)




  PROCEDURE ConvertPositionToNum
             (CONST Position : FilePosition;
              VAR   NumValue : CARDINAL);

  (**
      ConvertPositionToNum - Compiler portable way of converting to a number.


      Not every compiler used by SageST supports the 64 bit numbers necessary to
      track a file position.  This routine provides a safe mechanism to do
      arithmetic operations on the FilePosition type.  This particular routine
      provides a method of converting the position back to a number.

      WARNING - If the result of the operation would be a value greater than the
      capacity of a CARDINAL value and minor error checking is on you will get a
      popup that the range max has been exceeded.

      CALLING SEQUENCE -

        ConvertPositionToNum (Position, NumValue);

      ENTRY -

        Position : FilePosition
          The current position.  The return value is this position converted to
          a simple number.

      EXIT -

        NumValue : CARDINAL
          The value of Position in a simple number.
  *)




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