Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Portability Library Routines

The following tables list library routines for portability.

If you have programs that use these routines, it is recommended that they access the portability library with USE IFPORT.

Some routines in this library can be called with different sets of arguments, and some can be used as a function or a subroutine. In these cases, the arguments and calling mechanism determine the meaning of the routine. The IFPORT module contains generic interface blocks that give procedure definitions for these routines.

Fortran contains intrinsic procedures for many of the portability functions. The portability routines are extensions to the Fortran 2018 standard. For portability and performance, you should write code using Fortran standard intrinsic procedures whenever possible.

Information Retrieval

Name

Procedure Type

Description

FOR_IFCORE_VERSION

Function

Returns the version of the Fortran runtime library (ifcore).

FOR_IFPORT_VERSION

Function

Returns the version of the Fortran portability library (ifport).

FSTAT

Function

Returns information about a logical file unit.

GETCWD

Function

Returns the pathname of the current working directory.

GETENV

Subroutine

Searches the environment for a given string and returns its value if found.

Process Control

Name

Procedure Type

Description

ABORT

Subroutine

Stops execution of the current process, clears I/O buffers, and writes a string to external unit 0.

ALARM

Function

Executes an external subroutine after waiting a specified number of seconds.

KILL

Function

Sends a signal code to the process given by ID.

SIGNAL

Function

Changes the action for signal.

SLEEP

Subroutine

Suspends program execution for a specified number of seconds.

Numeric Values and Conversion

Name

Procedure Type

Description

BESJ0, BESJ1,BESJN, BESY0,BESY1, BESYN

Functions

Return single-precision values of Bessel functions of the first and second kind of orders 1, 2, and n, respectively.

BIC, BIS

Subroutines

Perform bit level clear, set, and test for integers.

BIT

Function

Performs bit level clear, set, and test for integers.

CDFLOAT

Function

Converts a COMPLEX(4) argument to DOUBLE PRECISION type.

COMPLINT, COMPLREAL, COMPLLOG

Functions

Return a BIT-WISE complement or logical .NOT. of the argument.

Input and Output

Name

Procedure Type

Description

ACCESS

Function

Checks a file for accessibility according to mode.

CHMOD

Function

Changes file attributes.

FGETC

Function

Reads a character from an external unit.

FLUSH

Function

Flushes the buffer for an external unit to its associated file.

FPUTC

Function

Writes a character to an external unit.

Date and Time

Name

Procedure Type

Description

CLOCK

Function

Returns current time in HH:MM:SS format using a 24-hour clock.

CLOCKX

Subroutine

Returns the processor clock to the nearest microsecond.

CTIME

Function

Converts system time to a 24-character ASCII string.

DATE3

Subroutine or Function

Returns the current system date.

DATE4

Subroutine

Returns the current system date.

Error Handling

Name

Procedure Type

Description

GETLASTERROR

Function

Returns the last error set.

GETLASTERRORQQ

Function

Returns the last error set by a runtime function or subroutine.

IERRNO

Function

Returns the last code error.

SETERRORMODEQQ

Subroutine

Sets the mode for handling critical errors.

Program Control

Name

Procedure Type

Description

RAISEQQ

Function

Sends an interrupt to the executing program, simulating an interrupt from the operating system.

RUNQQ

Function

Calls another program and waits for it to execute.

SIGNALQQ

Function

Controls signal handling.

SLEEPQQ

Subroutine

Delays execution of the program for the specified time.

System, Drive, and Directory

Name

Procedure Type

Description

CHDIR

Function

Changes the current working directory.

CHANGEDIRQQ

Function

Makes the specified directory the current (default) directory.

CHANGEDRIVEQQ

Function

Makes the specified drive the current drive.

DELDIRQQ

Function

Deletes a specified directory.

GETDRIVEDIRQQ

Function

Returns the current drive and directory path.

Speaker

Name

Procedure Type

Description

BEEPQQ

Subroutine

Sounds the speaker for a specified duration in milliseconds at a specified frequency in Hertz.

File Management

Name

Procedure Type

Description

DELFILESQQ

Function

Deletes the specified files in a specified directory.

FINDFILEQQ

Function

Searches for a file in the directories specified in the PATH environment variable.

FULLPATHQQ

Function

Returns the full path for a specified file or directory.

GETFILEINFOQQ

Function

Returns information about files with names that match a request string.

PACKTIMEQQ

Subroutine

Packs time values for use by SETFILETIMEQQ.

Arrays

Name

Procedure Type

Description

BSEARCHQQ

Function

Performs a binary search for a specified element on a sorted one-dimensional array of non-structure data types (derived types are not allowed).

SORTQQ

Subroutine

Sorts a one-dimensional array of non-structure data types (derived types are not allowed).

Floating-Point Inquiry and Control

Name

Procedure Type

Description

CLEARSTATUSFPQQ

Subroutine

Clears the exception flags in the floating-point processor status word.

GETCONTROLFPQQ

Subroutine

Returns the value of the floating-point processor control word.

GETSTATUSFPQQ

Subroutine

Returns the value of the floating-point processor status word.

LCWRQQ

Subroutine

Same as SETCONTROLFPQQ.

SCWRQQ

Subroutine

Same as GETCONTROLFPQQ.

IEEE Functionality

Name

Procedure Type

Description

IEEE_FLAGS

Function

Sets, gets, or clears IEEE flags.

IEEE_HANDLER

Function

Establishes a handler for IEEE exceptions.

Serial Port I/O4

Name

Procedure Type

Description

SPORT_CANCEL_IO

Function

Cancels any I/O in progress to the specified port.

SPORT_CONNECT

Function

Establishes the connection to a serial port and defines certain usage parameters.

SPORT_CONNECT_EX

Function

Establishes the connection to a serial port, defines certain usage parameters, and defines the size of the internal buffer for data reception.

SPORT_GET_HANDLE

Function

Returns the Windows* handle associated with the communications port.

SPORT_GET_STATE

Function

Returns the baud rate, parity, data bits, and stop bit settings of the communications port.

Miscellaneous

Name

Procedure Type

Description

LNBLNK

Function

Returns the index of the last non-blank character in a string.

QSORT

Subroutine

Returns a sorted version of a one-dimensional array of a specified number of elements of a named size.

RINDEX

Function

Returns the index of the last occurrence of a substring in a string.

SCANENV

Subroutine

Scans the environment for the value of an environment variable.

TTYNAM

Subroutine

Checks whether a logical unit is a terminal.

1 This routine can also be specified as HOSTNM.

2 There is also a RANDOM subroutine in the portability library.

3 The two-digit year return value of DATE, IDATE, and JDATE may cause problems with the year 2000. Use the intrinsic subroutine DATE_AND_TIME instead.

4 Windows