C****************************** Module Header ******************************
C*
C* Copyright (c) 1990  Microsoft Corporation
C*
C* Module Name: FLIB.FI
C*
C* This module provides interface descriptions for subprograms found
C* in the various FORTRAN libraries.  Each of the functional areas
C* covered by these interfaces are small enough that separate include
C* files for each are not warranted.
C*
C* The functional areas covered are the following.
C*
C*    Math error support
C*    Signal handling
C*    Date and Time
C*    Command Line Arguments
C*    Random Numbers
C*    Spawning programs
C*    Handling drives, directories, and files
C*    Keyboard input
C*    Error handling
C*    Environment variables
C*
C***************************************************************************

C -----------------------------------------------------------------
C Math Error Support
C -----------------------------------------------------------------

      INTERFACE TO SUBROUTINE MATHERRQQ(NAME, NLEN, INFO, RETCODE)
      INTEGER*2 NLEN
      CHARACTER NAME(NLEN)       ! INPUT : Name of function causing error.
      STRUCTURE /MTH$E_INFO/
        INTEGER*4 ERRCODE        ! INPUT : One of the MTH$ values in flib.fd
        INTEGER*4 FTYPE          ! INPUT : One of the TY$ values in flib.fd
        UNION
        MAP
            REAL*4 R4ARG1        ! INPUT : First argument
            REAL*4 R4ARG2        ! INPUT : Second argument (if any)
            REAL*4 R4RES         ! OUTPUT : Desired result
        END MAP
        MAP
            REAL*8 R8ARG1        ! INPUT : FIrst argument
            REAL*8 R8ARG2        ! INPUT : Second argument (if any)
            REAL*8 R8RES         ! OUTPUT : Desired result
        END MAP
        MAP
            COMPLEX*8 C8ARG1     ! INPUT : FIrst argument
            COMPLEX*8 C8ARG2     ! INPUT : Second argument (if any)
            COMPLEX*8 C8RES      ! OUTPUT : Desired result
        END MAP
        MAP
            COMPLEX*16 C16ARG1   ! INPUT : FIrst argument
            COMPLEX*16 C16ARG2   ! INPUT : Second argument (if any)
            COMPLEX*16 C16RES    ! OUTPUT : Desired result
        END MAP
        END UNION
      END STRUCTURE
      RECORD /MTH$E_INFO/ INFO
      INTEGER*2 RETCODE          ! OUTPUT : 0 for failure, non 0 for success
      END

C -----------------------------------------------------------------
C Signal support
C -----------------------------------------------------------------
      INTERFACE TO INTEGER*4 FUNCTION SIGNALQQ[c,alias:'_signal']
     +                                        (SIGNAL, HANDLER)
      INTEGER*4 SIGNAL[value]
      EXTERNAL HANDLER
      END

      INTERFACE TO INTEGER*4 FUNCTION RAISEQQ[c,alias:'_raise'](SIGNAL)
      INTEGER*4 SIGNAL[value]
      END

C -----------------------------------------------------------------
C Coprocessor Control
C -----------------------------------------------------------------

      INTERFACE TO SUBROUTINE LCWRQQ(CONTROL)
      INTEGER*2 CONTROL
      END

      INTERFACE TO SUBROUTINE SCWRQQ(CONTROL)
      INTEGER*2 CONTROL
      END

      INTERFACE TO SUBROUTINE SSWRQQ(STATUS)
      INTEGER*2 STATUS
      END

      INTERFACE TO SUBROUTINE SETCONTROLFPQQ[alias:'_LCWRQQ@4'](CONTROL)
      INTEGER*2 CONTROL
      END

      INTERFACE TO SUBROUTINE GETCONTROLFPQQ[alias:'_SCWRQQ@4'](CONTROL)
      INTEGER*2 CONTROL
      END

      INTERFACE TO SUBROUTINE GETSTATUSFPQQ[alias:'_SSWRQQ@4'](STATUS)
      INTEGER*2 STATUS
      END

C -----------------------------------------------------------------
C Time and Date Support
C -----------------------------------------------------------------
      INTERFACE TO SUBROUTINE GETTIM(IHR, IMIN, ISEC, I100TH)
      INTEGER*2 IHR, IMIN, ISEC, I100TH
      END

      INTERFACE TO LOGICAL FUNCTION SETTIM(IHR, IMIN, ISEC, I100TH)
      INTEGER*2 IHR, IMIN, ISEC, I100TH
      END

      INTERFACE TO SUBROUTINE GETDAT(IYR, IMON, IDAY)
      INTEGER*2 IYR, IMON, IDAY
      END

      INTERFACE TO LOGICAL FUNCTION SETDAT(IYR, IMON, IDAY)
      INTEGER*2 IYR, IMON, IDAY
      END

C -----------------------------------------------------------------
C Command Line Arguments
C -----------------------------------------------------------------
      INTERFACE TO INTEGER*4 FUNCTION NARGS()
      END

      INTERFACE TO SUBROUTINE GETARG(N, BUFFER, STATUS)
      INTEGER*2 N
      CHARACTER*(*) BUFFER
      INTEGER*2 STATUS
      END

C -----------------------------------------------------------------
C Random Numbers
C -----------------------------------------------------------------
      INTERFACE TO SUBROUTINE RANDOM(ARG)
      REAL*4 ARG
      END

      INTERFACE TO SUBROUTINE SEED(ARG)
      INTEGER*4 ARG
      END

C -----------------------------------------------------------------
C Running Programs and System Commands
C -----------------------------------------------------------------
      INTERFACE TO INTEGER*4 FUNCTION RUNQQ(FILENAME, COMMANDLINE)
      CHARACTER*(*) FILENAME, COMMANDLINE
      END

      INTERFACE TO LOGICAL*4 FUNCTION SYSTEMQQ(COMMANDLINE)
      CHARACTER*(*) COMMANDLINE
      END

C -----------------------------------------------------------------
C Drives and Directories
C -----------------------------------------------------------------

      INTERFACE TO LOGICAL*4 FUNCTION GETDRIVESIZEQQ(DRIVE, TOTAL,
     +                                               AVAIL)
      CHARACTER*(*) DRIVE
      INTEGER*4 TOTAL, AVAIL
      END

      INTERFACE TO CHARACTER*26 FUNCTION GETDRIVESQQ()
      END

      INTERFACE TO INTEGER*4 FUNCTION GETDRIVEDIRQQ(BUFFER)
      CHARACTER*(*) BUFFER
      END

      INTERFACE TO LOGICAL*4 FUNCTION CHANGEDRIVEQQ(DRIVE)
      CHARACTER*(*) DRIVE
      END

      INTERFACE TO LOGICAL*4 FUNCTION CHANGEDIRQQ(DIR)
      CHARACTER*(*) DIR
      END

      INTERFACE TO LOGICAL*4 FUNCTION MAKEDIRQQ(DIR)
      CHARACTER*(*) DIR
      END

      INTERFACE TO LOGICAL*4 FUNCTION DELDIRQQ(DIR)
      CHARACTER*(*) DIR
      END

      INTERFACE TO INTEGER*4 FUNCTION FULLPATHQQ(NAME, FULLPATH)
      CHARACTER*(*) NAME, FULLPATH
      END

      INTERFACE TO INTEGER*4 FUNCTION SPLITPATHQQ(PATH, DRIVE, DIR,
     +                                            NAME, EXT)
      CHARACTER*(*) PATH, DRIVE, DIR, NAME, EXT
      END

C -----------------------------------------------------------------
C Files
C -----------------------------------------------------------------

      INTERFACE TO INTEGER*4 FUNCTION GETFILEINFOQQ(FILES, BUFFER,
     +                                              HANDLE)
      CHARACTER*(*) FILES
      STRUCTURE / FILE$INFO /
        INTEGER*4       CREATION          ! Creation time (-1 on FAT)
        INTEGER*4       LASTWRITE         ! Last write to file
        INTEGER*4       LASTACCESS        ! Last access (-1 on FAT)
        INTEGER*4       LENGTH            ! Length of file
        INTEGER*2       PERMIT            ! File access mode
        CHARACTER*255   NAME              ! File name
      END STRUCTURE
      RECORD / FILE$INFO / BUFFER(*)
      INTEGER*4 HANDLE
      END

      INTERFACE TO LOGICAL*4 FUNCTION SETFILETIMEQQ(NAME, TIMEDATE)
      CHARACTER*(*) NAME
      INTEGER*4 TIMEDATE
      END

      INTERFACE TO LOGICAL*4 FUNCTION SETFILEACCESSQQ(NAME, ACCESS)
      CHARACTER*(*) NAME
      INTEGER*4 ACCESS
      END

      INTERFACE TO INTEGER*4 FUNCTION DELFILESQQ(FILES)
      CHARACTER*(*) FILES
      END

      INTERFACE TO LOGICAL*4 FUNCTION RENAMEFILEQQ(OLDNAME, NEWNAME)
      CHARACTER*(*) OLDNAME, NEWNAME
      END

      INTERFACE TO INTEGER*4 FUNCTION FINDFILEQQ(FILE, ENV, BUF)
      CHARACTER*(*) FILE, ENV, BUF
      END

      INTERFACE TO SUBROUTINE PACKTIMEQQ(TIMEDATE, IYR, IMON, IDAY,
     +                                   IHR, IMIN, ISEC)
      INTEGER*4 TIMEDATE
      INTEGER*2 IYR, IMON, IDAY, IHR, IMIN, ISEC
      END

      INTERFACE TO SUBROUTINE UNPACKTIMEQQ(TIMEDATE, IYR, IMON, IDAY,
     +                                     IHR, IMIN, ISEC)
      INTEGER*4 TIMEDATE
      INTEGER*2 IYR, IMON, IDAY, IHR, IMIN, ISEC
      END

      INTERFACE TO LOGICAL*4 FUNCTION COMMITQQ(UNIT)
      INTEGER*4 UNIT
      END

C -----------------------------------------------------------------
C Keyboard
C -----------------------------------------------------------------

      INTERFACE TO CHARACTER*1 FUNCTION GETCHARQQ()
      END

      INTERFACE TO LOGICAL*4 FUNCTION PEEKCHARQQ()
      END

      INTERFACE TO INTEGER*4 FUNCTION GETSTRQQ(BUFFER)
      CHARACTER*(*) BUFFER
      END

C -----------------------------------------------------------------
C Errors
C -----------------------------------------------------------------

      INTERFACE TO INTEGER*4 FUNCTION GETLASTERRORQQ()
      END

      INTERFACE TO SUBROUTINE SETERRORMODEQQ(PROMPT)
      LOGICAL*4 PROMPT
      END

C -----------------------------------------------------------------
C Environment
C -----------------------------------------------------------------

      INTERFACE TO INTEGER*4 FUNCTION GETENVQQ(NAME, VALUE)
      CHARACTER*(*) NAME, VALUE
      END

      INTERFACE TO LOGICAL*4 FUNCTION SETENVQQ(NAMVAL)
      CHARACTER*(*) NAMVAL
      END


C -----------------------------------------------------------------
C Beep and Sleep
C -----------------------------------------------------------------

      INTERFACE TO SUBROUTINE SLEEPQQ(DURATION)
      INTEGER*4 DURATION
      END

      INTERFACE TO SUBROUTINE BEEPQQ(FREQUENCY, DURATION)
      INTEGER*4 FREQUENCY, DURATION
      END

C ----------------------------------------------------------------
C Sorting and Searching Arrays
C ----------------------------------------------------------------

      INTERFACE TO SUBROUTINE SORTQQ(ADRARRAY, LENGTH, SIZE)
      INTEGER*4 ADRARRAY, LENGTH, SIZE
      END

      INTERFACE TO INTEGER*4 FUNCTION BSEARCHQQ(ADRKEY, ADRARRAY,
     +                                          LENGTH, SIZE)
      INTEGER*4 ADRKEY, ADRARRAY, LENGTH, SIZE
      END

C ----------------------------------------------------------------
C Configuration
C ----------------------------------------------------------------

      INTERFACE TO INTEGER*4 FUNCTION GETCONFIGQQ()
      END
