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
STRConcatFiles STRCopyFile STRCreate STRDelete
STRDirQuery STRFileExists STRGetDeviceFreeSpace STRGetFileName
STRGetPathFileName STRLookup STRLookupRead STROpen
STRRename SetCommFlow SetCommState SetCommTimeouts
SetFilePos SetInheritMode SetSharingModes SetToValue
SetToValueByNum State1 SubtractFromPosition SubtractFromPositionByNum
Truncate WriteBlock WriteByte WriteBytes
WriteWord




  procedure GetCommState
             (var   File1  : STFile;
              var   baud   : cardinal;
              var   Data   : cardinal;
              var   Parity : cardinal;
              var   stop   : cardinal;
              var   done   : boolean); stdcall;

  exports GetCommState name 'Files_GetCommState';




  procedure SetCommState
             (var   File1  : STFile;
              const baud   : cardinal;
              const Data   : cardinal;
              const Parity : cardinal;
              const stop   : cardinal;
              var   done   : boolean); stdcall;

  exports SetCommState name 'Files_SetCommState';




  procedure SetCommFlow
             (var   File1 : STFile;
              const flow  : cardinal;
              var   done  : boolean); stdcall;

  exports SetCommFlow name 'Files_SetCommFlow';




  procedure GetCommTimeouts
             (var   File1           : STFile;
              var   readTimeout     : cardinal;
              var   readMultiplier  : cardinal;
              var   readConstant    : cardinal;
              var   writeMultiplier : cardinal;
              var   writeConstant   : cardinal;
              var   done            : boolean); stdcall;

  exports GetCommTimeouts name 'Files_GetCommTimeouts';




  procedure SetCommTimeouts
             (var   File1           : STFile;
              const readTimeout     : cardinal;
              const readMultiplier  : cardinal;
              const readConstant    : cardinal;
              const writeMultiplier : cardinal;
              const writeConstant   : cardinal;
              var   done            : boolean); stdcall;

  exports SetCommTimeouts name 'Files_SetCommTimeouts';




  procedure ClearCommError
             (var   File1  : STFile;
              var   errors : CommError;
              var   Status : CommStatus;
              var   done   : boolean); stdcall;

  exports ClearCommError name 'Files_ClearCommError';




  function GetDeviceFreeSpace
             (const spec : array of char) : integer; overload; stdcall;

  exports GetDeviceFreeSpace (const spec : array of char) name 'Files_GetDeviceFreeSpace';




  function GetDeviceFreeSpace
             (const spec : string) : integer; overload; stdcall;

  exports GetDeviceFreeSpace (const spec : string) name 'Files_STRGetDeviceFreeSpace';




  procedure Open
             (var   File1     : STFile;
              const FileName  : array of char;
              const BinText   : BinTextMode;
              const WriteMode : ReadWriteMode;
              var   state     : FileState); overload; stdcall;

  exports Open (var   File1     : STFile;
                const FileName  : array of char;
                const BinText   : BinTextMode;
                const WriteMode : ReadWriteMode;
                var   state     : FileState) name 'Files_Open';

  //*
  //  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, name, 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 Open
             (var   File1     : STFile;
              const FileName  : string;
              const BinText   : BinTextMode;
              const WriteMode : ReadWriteMode;
              var   state     : FileState); overload; stdcall;

  exports Open (var   File1     : STFile;
                const FileName  : string;
                const BinText   : BinTextMode;
                const WriteMode : ReadWriteMode;
                var   state     : FileState) name 'Files_STROpen';

  //*
  //  STROpen - Open an existing external file.
  //




  procedure Create
             (var   File1    : STFile;
              const FileName : array of char;
              const BinText  : BinTextMode;
              const ReplMode : ReplaceMode;
              var   state    : FileState); overload; stdcall;

  exports Create (var   File1    : STFile;
                  const FileName : array of char;
                  const BinText  : BinTextMode;
                  const ReplMode : ReplaceMode;
                  var   state    : FileState) name 'Files_Create';

  //*
  //  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.
  //
  //    name : 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 Create
             (var   File1    : STFile;
              const FileName : string;
              const BinText  : BinTextMode;
              const ReplMode : ReplaceMode;
              var   state    : FileState); overload; stdcall;

  exports Create (var   File1    : STFile;
                  const FileName : string;
                  const BinText  : BinTextMode;
                  const ReplMode : ReplaceMode;
                  var   state    : FileState) name 'Files_STRCreate';

  //*
  //  STRCreate - See documentation of Create.
  //




  procedure Close
             (var   File1 : STFile;
              var   state : FileState); stdcall;

  exports Close name 'Files_Close';

  //*
  //  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 : STFile;
              var   state : FileState); stdcall;

  exports Remove name 'Files_Remove';

  //*
  //  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 : STFile;
              var   state : FileState); stdcall;

  exports Reset name 'Files_Reset';

  //*
  //  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 : STFile;
              var   state : FileState); stdcall;

  exports Rewrite name 'Files_Rewrite';

  //*
  //  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 : STFile;
              var   state : FileState); stdcall;

  exports Truncate name 'Files_Truncate';

  //*
  //  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 : STFile;
              var   flag  : boolean); stdcall;

  exports EOF name 'Files_EOF';

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




  function State1
             (const File1 : STFile) : FileState; stdcall;

  exports State1 name 'Files_State1';

  //*
  //  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 : STFile;
              var   state : FileState); stdcall;

  exports ResetState name 'Files_ResetState';

  //*
  //  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  : STFile;
              var   handle : DosLib.HandleType); stdcall;

  exports GetFileHandle name 'Files_GetFileHandle';




  procedure GetFileName
             (var   File1    : STFile;
              var   FileName : array of char;
              var   state    : FileState); overload; stdcall;

  exports GetFileName (var   File1    : STFile;
                       var   FileName : array of char;
                       var   state    : FileState) name 'Files_GetFileName';

  //*
  //  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, name, state)
  //
  //  ENTRY -
  //
  //    File1 : File
  //      The file handle.
  //
  //  EXIT -
  //
  //    name : array of char
  //      The name of the file.
  //
  //    State : FileState
  //      The state.
  //




  procedure GetFileName
             (var   File1    : STFile;
              var   FileName : string;
              var   state    : FileState); overload; stdcall;

  exports GetFileName (var   File1    : STFile;
                       var   FileName : string;
                       var   state    : FileState) name 'Files_STRGetFileName';

  //*
  //  STRGetFileName - See documentation of GetFileName.
  //




  procedure GetPathFileName
             (var   File1        : STFile;
              var   PathFileName : array of char;
              var   state        : FileState); overload; stdcall;

  exports GetPathFileName (var   File1        : STFile;
                           var   PathFileName : array of char;
                           var   state        : FileState) name 'Files_GetPathFileName';

  //*
  //  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 : STFile
  //      The file handle.
  //
  //  EXIT -
  //
  //    PathFileName : array of char
  //      The name of the file including the path.
  //
  //    State : FileState
  //      The state.
  //




  procedure GetPathFileName
             (var   File1        : STFile;
              var   PathFileName : string;
              var   state        : FileState); overload; stdcall;

  exports GetPathFileName (var   File1        : STFile;
                           var   PathFileName : string;
                           var   state        : FileState) name 'Files_STRGetPathFileName';

  //*
  //  STRGetPathFileName - See documentation of GetPathFileName.
  //




  procedure ReadByte
             (var   File1 : STFile;
              var   byte1 : System.BYTE;
              var   state : FileState); stdcall;

  exports ReadByte name 'Files_ReadByte';

  //*
  //  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 : STFile;
              var   word1 : System.word;
              var   state : FileState); stdcall;

  exports ReadWord name 'Files_ReadWord';

  //*
  //  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 : STFile;
              var   block : ByteArrayType;
              var   state : FileState); stdcall;

  exports ReadBlock name 'Files_ReadBlock';

  //*
  //  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 : ByteArrayType
  //      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     : STFile;
              const addr      : pointer;
              const bytes     : cardinal;
              var   bytesRead : cardinal;
              var   state     : FileState); stdcall;

  exports ReadBytes name 'Files_ReadBytes';

  //*
  //  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 : pointer
  //      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 : STFile;
              const byte1 : System.BYTE;
              var   state : FileState); stdcall;

  exports WriteByte name 'Files_WriteByte';

  //*
  //  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 : STFile;
              const word1 : System.word;
              var   state : FileState); stdcall;

  exports WriteWord name 'Files_WriteWord';

  //*
  //  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 : STFile;
              var   block : ByteArrayType;
              var   state : FileState); stdcall;

  exports WriteBlock name 'Files_WriteBlock';

  //*
  //  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 : ByteArrayType
  //      The block to be written.
  //
  //  EXIT -
  //
  //    State : FileState
  //      The state.
  //




  procedure WriteBytes
             (var   File1 : STFile;
              const addr  : pointer;
              const bytes : cardinal;
              var   state : FileState); stdcall;

  exports WriteBytes name 'Files_WriteBytes';

  //*
  //  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 (pointer).
  //
  //  CALLING SEQUENCE -
  //
  //    WriteBytes (File1, addr, bytes, state)
  //
  //  ENTRY -
  //
  //    File1 : File
  //      The file handle.
  //
  //    addr : pointer
  //      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          : STFile;
  //      f2          : STFile;
  //
  //
  //      state1      : Files.FileState;
  //      state2      : Files.FileState;
  //
  //
  //      buffer      : array [0 .. bufSize-1] of char;
  //
  //      bytesRead   : cardinal;
  //
  //
  //      finished    : boolean;
  //
  //    begin
  //      Open (f1, 'SOURCE.DAT', binMode, readWrite, state1);
  //      Create (f2, 'DEST.DAT', binMode, replace,  state2);
  //
  //      LOOP
  //        ReadBytes (f1,@buffer, bufSize, bytesRead, state1);
  //        EOF (f1, finished);
  //        if finished then begin
  //          break;
  //        end;
  //        WriteBytes (f2,@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); overload; stdcall;

  exports Rename (const fromName : array of char;
                  const toName   : array of char;
                  var   state    : FileState) name 'Files_Rename';




  procedure Rename
             (const fromName : string;
              const toName   : string;
              var   state    : FileState); overload; stdcall;

  exports Rename (const fromName : string;
                  const toName   : string;
                  var   state    : FileState) name 'Files_STRRename';




  procedure Delete
             (const FileName : array of char;
              var   state    : FileState); overload; stdcall;

  exports Delete (const FileName : array of char;
                  var   state    : FileState) name 'Files_Delete';




  procedure Delete
             (const FileName : string;
              var   state    : FileState); overload; stdcall;

  exports Delete (const FileName : string;
                  var   state    : FileState) name 'Files_STRDelete';




  procedure DirQuery
             (const WildCard : array of char;
              const DirProc  : DirQueryProc;
              var   state    : FileState); overload; stdcall;

  exports DirQuery (const WildCard : array of char;
                    const DirProc  : DirQueryProc;
                    var   state    : FileState) name 'Files_DirQuery';

  //*
  //  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 -
  //
  //    uses
  //       Files,
  //       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 DirQuery
             (const WildCard : string;
              const DirProc  : DirQueryProc;
              var   state    : FileState); overload; stdcall;

  exports DirQuery (const WildCard : string;
                    const DirProc  : DirQueryProc;
                    var   state    : FileState) name 'Files_STRDirQuery';

  // STRDirQuery - See documentation of DirQuery.




  procedure GetFilePos
             (var   File1 : STFile;
              var   Pos   : FilePosition); stdcall;

  exports GetFilePos name 'Files_GetFilePos';

  // returns the current position the file




  procedure GetEOF
             (var   File1 : STFile;
              var   Pos   : FilePosition); stdcall;

  exports GetEOF name 'Files_GetEOF';

  // returns a FilePosition of the current end of the file




  procedure GetBOF
             (var   File1 : STFile;
              var   Pos   : FilePosition); stdcall;

  exports GetBOF name 'Files_GetBOF';

  // returns a FilePosition of the beginning of the file




  procedure CalcFilePos
             (var   File1         : STFile;
              var   Pos           : FilePosition;
              const NumOfElements : integer;
              const ElementLength : integer); stdcall;

  exports CalcFilePos name 'Files_CalcFilePos';

  // Calculate a file position relative to FilePos, offset by NumOfElements.
  // Return the resulting position FilePos




  procedure SetFilePos
             (var   File1 : STFile;
              const Pos   : FilePosition;
              var   state : FileState); stdcall;

  exports SetFilePos name 'Files_SetFilePos';

  // 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 : STFile;
              const FileName   : array of char;
              const NewF       : boolean;
              var   state      : FileState); overload; stdcall;

  exports Lookup (var   FileHandle : STFile;
                  const FileName   : array of char;
                  const NewF       : boolean;
                  var   state      : FileState) name 'Files_Lookup';

  //*
  //  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 Lookup
             (var   FileHandle : STFile;
              const FileName   : string;
              const NewF       : boolean;
              var   state      : FileState); overload; stdcall;

  exports Lookup (var   FileHandle : STFile;
                  const FileName   : string;
                  const NewF       : boolean;
                  var   state      : FileState) name 'Files_STRLookup';

  //*
  //  STRLookup - See documentation of Lookup.
  //




  procedure LookupRead
             (var   FileHandle : STFile;
              const FileName   : array of char;
              const NewF       : boolean;
              var   state      : FileState); overload; stdcall;

  exports LookupRead (var   FileHandle : STFile;
                      const FileName   : array of char;
                      const NewF       : boolean;
                      var   state      : FileState) name 'Files_LookupRead';

  //*
  //  LookupRead - 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 -
  //
  //    LookupRead (FileHandle, Name, 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 : STFile;
              const FileName   : string;
              const NewF       : boolean;
              var   state      : FileState); overload; stdcall;

  exports LookupRead (var   FileHandle : STFile;
                      const FileName   : string;
                      const NewF       : boolean;
                      var   state      : FileState) name 'Files_STRLookupRead';

  //*
  //  STRLookupRead - See documentation of LookupRead.
  //




  procedure DiskIO
             (var   FileHandle  : STFile;
              const Operation   : DISKOP;
              const Buffer      : pointer;
              const DiskAddress : FilePosition;
              const Number      : cardinal;
              var   Error       : cardinal); stdcall;

  exports DiskIO name 'Files_DiskIO';




  procedure SetSharingModes
             (const mode : SharingModes); stdcall;

  exports SetSharingModes name 'Files_SetSharingModes';




  function GetSharingModes
             () : SharingModes; stdcall;

  exports GetSharingModes name 'Files_GetSharingModes';




  procedure SetInheritMode
             (const mode : cardinal); stdcall;

  exports SetInheritMode name 'Files_SetInheritMode';




  function GetInheritMode
             () : cardinal; stdcall;

  exports GetInheritMode name 'Files_GetInheritMode';




  procedure CopyFile
             (const SourceFile   : array of char;
              const DestFile     : array of char;
              const PreserveDate : boolean;
              var   Success      : boolean); overload; stdcall;

  exports CopyFile (const SourceFile   : array of char;
                    const DestFile     : array of char;
                    const PreserveDate : boolean;
                    var   Success      : boolean) name 'Files_CopyFile';

  //*
  //  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 CopyFile
             (const SourceFile   : string;
              const DestFile     : string;
              const PreserveDate : boolean;
              var   Success      : boolean); overload; stdcall;

  exports CopyFile (const SourceFile   : string;
                    const DestFile     : string;
                    const PreserveDate : boolean;
                    var   Success      : boolean) name 'Files_STRCopyFile';

  //*
  //  STRCopyFile - See documentation of CopyFile.
  //




  procedure ConcatFiles
             (const SourceFile1 : array of char;
              const SourceFile2 : array of char;
              var   Success     : boolean); overload; stdcall;

  exports ConcatFiles (const SourceFile1 : array of char;
                       const SourceFile2 : array of char;
                       var   Success     : boolean) name 'Files_ConcatFiles';

  //*
  //  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 ConcatFiles
             (const SourceFile1 : string;
              const SourceFile2 : string;
              var   Success     : boolean); overload; stdcall;

  exports ConcatFiles (const SourceFile1 : string;
                       const SourceFile2 : string;
                       var   Success     : boolean) name 'Files_STRConcatFiles';

  //*
  //  STRConcatFiles - See documentation of ConcatFiles.
  //




  function FileExists
             (const FileName : array of char) : boolean; overload; stdcall;

  exports FileExists (const FileName : array of char) name 'Files_FileExists';

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




  function FileExists
             (const FileName : string) : boolean; overload; stdcall;

  exports FileExists (const FileName : string) name 'Files_STRFileExists';

  //*
  //  STRFileExists - See the documentation of FileExists.
  //




  function GetHandleState
             (const handle : STFile) : ModSys.HandleState; stdcall;

  exports GetHandleState name 'Files_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 (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); stdcall;

  exports SetToValue name 'Files_SetToValue';

  //*
  //  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); stdcall;

  exports SetToValueByNum name 'Files_SetToValueByNum';

  //*
  //  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); stdcall;

  exports AddToPosition name 'Files_AddToPosition';

  //*
  //  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); stdcall;

  exports AddToPositionByNum name 'Files_AddToPositionByNum';

  //*
  //  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); stdcall;

  exports SubtractFromPosition name 'Files_SubtractFromPosition';

  //*
  //  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); stdcall;

  exports SubtractFromPositionByNum name 'Files_SubtractFromPositionByNum';

  //*
  //  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); stdcall;

  exports MultiplyPosition name 'Files_MultiplyPosition';

  //*
  //  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); stdcall;

  exports DividePosition name 'Files_DividePosition';

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




  function ComparePositions
             (const Position1 : FilePosition;
              const Position2 : FilePosition) : PosResult; stdcall;

  exports ComparePositions name 'Files_ComparePositions';

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




  function ComparePositionsByNum
             (const Position1 : FilePosition;
              const Position2 : cardinal) : PosResult; stdcall;

  exports ComparePositionsByNum name 'Files_ComparePositionsByNum';

  //*
  //  ComparePositionsByNum - 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); stdcall;

  exports PositionDifference name 'Files_PositionDifference';

  //*
  //  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); stdcall;

  exports PositionDifferenceByNum name 'Files_PositionDifferenceByNum';

  //*
  //  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); stdcall;

  exports ConvertPositionToNum name 'Files_ConvertPositionToNum';

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