# CODA Fortran

The CODA Fortran interface is a direct wrapping of all functions that are available in the CODA C Library.

Currently the CODA Fortran interface is only supported on Unix based platforms (i.e. Linux, SUN, Mac OS X, etc.). Whether the interface also works on Windows is unkown.

This page describes how to use the wrapped interface and how to compile your own Fortran programs with CODA.

## Contents

- Supported Fortran versions
- CODA definition path
- Differences between C and Fortran
  - Type Sizes
  - Pointers
  - Strings
  - Enumeration values and constants
  - Indices
  - Functions that are not wrapped
  - Functions that are only available in Fortran
- Creating your Fortran program
- Functions

## Supported Fortran versions

The CODA Fortran interface can be used with both Fortran 77 and Fortran 90. However, the CODA Fortran interface is neither fully Fortran 77 nor fully Fortran 90 compliant. Fortran 77 requires that identifiers (i.e. variable and function names) are not longer than 6 characters and with Fortran 90 they should be no longer than 31 characters. Furthemore Fortran 77 does not allow '_' characters in identifiers. For the CODA interface, however, some identifiers are longer than 31 characters and they all contain '_' characters. Fortunately, most Fortran compilers shouldn't have any problems dealing with these exceptions.

Besides the identifier naming issue, the CODA Fortran interface should be fully compliant with Fortran 77 (and, since Fortran 77 is a supported subset of Fortran 90, the interface is thus also compliant with Fortran 90).

## CODA definition path

Just as for the C interface, in order to access products whose formats are defined using .codadef files, you should let CODA now where these .codadef files are stored. You can do this by using the CODA_SET_DEFINITION_PATH() or CODA_SET_DEFINITION_PATH_CONDITIONAL() functions, or you can set the CODA_DEFINITION environment variable. This environment variable should be a ':' separated (';' on Windows) list of absolute paths to directories containing .codadef files or absolute paths to .codadef files themselves (or a mix of those).

## Differences between C and Fortran

This section details the differences between the C and Fortran interfaces of CODA and explains how the wrapping was done. Although most of the CODA functions are mapped 1-to-1 from C to Fortran there are some guidelines and some exceptions that you should be aware of.

### Type sizes

Both the C and the Fortran standards do not prescribe fixed byte sizes for their integer types. On most platforms for C an 8 bit integer is represented by a `char`, a 16 bit integer by a `short`, a 32 bit integer by `int` or `long`, and a 64 bit integer by a `long long` or a `long` on 64-bit systems. Fortran (version 77 to be precise) on the other hand only supports the `INTEGER` type, which has a length of 32 bits on most systems. However, most Fortran 77 compilers support an extension that allows you to define e.g. a 16 bit / 2 byte integer by `INTEGER*2` and 64 bit integer by `INTEGER*8`. Fortran 90 on the other hand, doesn't support this `INTEGER*...` mechanism, but uses a system in which you can specify which kind of integer you want (e.g. `INTEGER(4)`). Unfortunately this system is not very portable (you need to use the intrinsic function `SELECTED_INT_KIND` to find the kind index for the precision you want) and this is not guaranteed to give you a variable that has the exact number of bytes that you want.

Another issue is that C supports both signed and unsigned integer types, but in Fortran (both Fortran 77 and Fortran 90) all integers are signed (i.e. unsigned types are not supported).

For the C interface of CODA the type size issue has been solved by introducing special types for 8/16/32/64 bit integers (both signed and unsigned): `int8_t`, `uint8_t`, `in16_t`, `uint16_t`, `int32_t`, `uint32_t`, `int64_t`, and `uint64_t`. But these types are only used for cases where portabillity was really needed, which, in case of CODA, is for variables that contain data that was read from product files. For internal variables, such as e.g. result codes and indices, CODA uses the native C types `int` and `long` (note that `long` will be 32 bits for 32-bit systems and will be 64 bits when you compile for 64-bit systems).

Now what does all this mean for your Fortran program? The thing to remember is that when you pass arguments to a wrapped CODA function from Fortran that you should pass variables that are the exact same size in bytes as what CODA expects. Unsigned integers will be casted to signed integers, so if you try to retrieve e.g. an uint32 value mind that values >= 2.147.483.648 will appear in Fortran as negative values.

The list of function prototypes below gives an overview of how you should use the wrapped functions when you use a Fortran 77 compiler that supports the `INTEGER*...` extension and using a platform where both pointers and `long` are 64 bits.

When reading data from a product file using the `CODA_CURSOR_READ_...` functions you should be aware that you can read data that is stored in one kind of type into a variable that is of another type. For instance, if the data is stored as a 8 bit unsigned integer, you can use the function `CODA_CURSOR_READ_INT32` to read it into a signed 32 bit variable. So, this means you can use a plain `INTEGER` variable (assuming that your platform uses a 32 bit type for this) and the `CODA_CURSOR_READ_INT32` function to read all kinds of integers. The only exception to this automatic type conversion is that you can not read data that uses more bits into a variable that uses less bits. For example you can not read a 64 integer into a 32 bit integer variable. For the same reason CODA also won't allow you to read an unsigned 32 bit integer using `CODA_CURSOR_READ_INT32` because there is no way to represent values >= 2.147.483.648 with a signed 32 bit integer and the C interface doesn't allow casting unsigned values to signed values. The Fortran interface will allow you to use `CODA_CURSOR_READ_UINT32` however, and cast the result to `INTEGER*4`. If you are on a 32 bit platform and your Fortran compiler does not support `INTEGER*8` for 64 bit integers but you still want to read such data, then the best thing to do is to read 64 bit integer data as a `DOUBLE PRECISION` value using the `CODA_CURSOR_READ_DOUBLE` function.

For floating point data the situation is a bit more straightforward. CODA requires that your system uses IEEE 754 for storing single and double precision floating point values. If this is the case then the C types `float` and `double` should be 100% equal to the Fortran types `REAL` and `DOUBLE PRECISION`.

### Pointers

In the CODA C interface several items, such as product file handles and cursors, are passed as pointers. Since Fortran doesn't have a proper type to store such handles you should use a variable of type `INTEGER*8` for 64 bit platforms and `INTEGER*4` for 32 bit platforms to store these handles (the function prototypes below show the 64 bit variant).

### Strings

There is a big difference in the way C and Fortran deal with string data. String data in C can be allocated dynamically and the exact length of a string is determined by a termination character (the character with ascii code 0: `CHAR(0)`). In Fortran all strings are fixed in size (the size is determined by the dimensions of the character array) and string data is padded on the right with space characters if the string is shorter than the size of the character array.

For the CODA Fortran interface the translation between C strings and Fortran strings is done completely automatically for you. If you provide a character array of sufficient size, string data will be passed properly from Fortran to C and back again. If your character array is too short to fit the string data you requested from CODA, then the CODA Fortran interface will automatically truncate the string data such that it fits in your character array.

### Enumeration values and constants

For the CODA C interface a lot of constant values, such as CODA error codes, CODA Type Classes, CODA Native Type identifiers, etc. are named constants. For the Fortran interface a `coda.inc` is available that contains a full list of all available named constants (using the `PARAMETER` construct).

The `coda.inc` file also contains return type definitions for all wrapped functions.

### Indices

Normally in Fortran all indices start with one. For instance, the first element of an array `A` is retrieved using `A(1)`. In C all indices are zero based (i.e. the first element of `A` is `A[0]`. The CODA Fortran interface provides no wrapping for these indices. This means that you will have to pass all index parameters to CODA functions using zero based indices. For example, `CODA_CURSOR_GOTO_ARRAY_ELEMENT_BY_INDEX(CURSOR,2)` will move the cursor to the third element of the array.

Furthermore, C and Fortran differ in the way they store multi-dimensional data. Where in C you would define an array to be `[6][4]`, in Fortran you would use `(4,6)` to get a similar structered array. The fastest running index in C is the last dimension and in Fortran it is the first dimension. For example, the second element in C would be `[0][1]` (remember that in C we use zero based indices) and in Fortran it would be `(2,1)`. When retrieving or specifying dimensions via the CODA interface you should remember that CODA uses the C style of specifying dimensions. This means that if you want to read multidimensional data and CODA tells you that the dimensions are `[6][4]` then you should either read it into a `(4,6)` array in Fortran, or, if you use a `CODA_CURSOR_READ_..._ARRAY` function you may read it into a `(6,4)` array and provide the `CODA_ARRAY_ORDERING_FORTRAN` parameter (but this will trigger a reshuffle of the data and thus greatly impacts performance).

### Functions that are not wrapped

Because of some issues with callback functions the CODA function `coda_match_filefilter` from the C interface is not wrapped to Fortran.

In addition, the functions `coda_str64`, `coda_str64u`, and `coda_strfl` are not wrapped, because they are specific to the C interface.

### Functions that are only available in Fortran

The Fortran interface contains some additional functions to deal with global CODA variables, cursor management, etc.

When wrapping a C interface to Fortran it is not possible to make global variables from the C interface available in Fortran. To solve this problem we have provided access routines to such variables in the CODA Fortran interface. The functions `CODA_VERSION` and `CODA_GET_ERRNO` let you retrieve the values of the global C variables `libcoda_version` and `coda_errno`.

In C it is possible to directly create a CODA cursor using: '`coda_Cursor cursor;`', but using such a mechanism for the cursor data type is not possible in Fortran. For this reason the CODA Fortran interface has been extended with three cursor management functions that allow you to create, duplicate, and remove cursors: `CODA_CURSOR_NEW`, `CODA_CURSOR_DUPLICATE`, `CODA_CURSOR_DELETE`. The functions `CODA_CURSOR_NEW` and `CODA_CURSOR_DUPLICATE` both return a pointer to a new CODA cursor (both functions return 0 if memory allocation for the new cursor failed). After you are finished with a cursor you should remove it with `CODA_CURSOR_DELETE` in order to prevent memory leaks.

Since there is no standard way to get the current system time within Fortran the CODA Fortran interface also includes a `CODA_TIME` function that is a simple wrapping of the C function `time()`. The result of this function will be the amount of seconds since 2000-01-01 (i.e. the result of the `time()` is converted from seconds since 1970-01-01 to seconds since 2000-01-01). The `CODA_TIME` function takes no parameters.

## Creating your Fortran program

After you have build and installed CODA, you will have a directory '`<prefix>/share/coda/fortran`' (with <prefix> being the installation directory you provided to the CODA configure script). In this directory you will find a `Makefile`, a `checkf77.sh` script, the `coda.inc` include file, the wrapper file `coda_fortran.c` that should be linked into your Fortran program, and an example file.

When you ran the ./configure script of CODA, the configure script was automatically locating your Fortran compiler and finding out which options it requires (if you have multiple fortran compilers installed, you can specify which fortran to use by passing the F77 option to the configure script. e.g. F77=g95). These settings should already be included in the Makefile. You are however advised to check the contents of the Makefile in order to verify that these settings are correct. If you change the Fortran compiler to a different compiler then make sure to also run the `checkf77.sh` script (pass your Fortran compiler as parameter: e.g. `./checkf77.sh g77`) to find out what options should be assigned to the `WRAPFORTRAN_FLAGS` variable.

Note: Although the F77 variable in the Makefile suggests that it is only meant for Fortran 77 compilers you can safely let it point to a Fortran 90/95 compiler.

After verifying the `Makefile` you can run:

    $ make

This should build the example. If this succeeds then just copy the files `Makefile`, `coda64.inc` (or `coda32.inc` for 32 bit code), and `coda_fortran.c` to a directory of your own and modify the `Makefile` such that it works with your own Fortran program.

## Functions

Below you will find an overview of all available Fortran functions. For a full description of each function please refer to the description of the corresponding C function in the CODA C interface documentation. There are a few functions that are Fortran only, but these are described in the previous paragraphs.

### CODA Functions

CODA General

    SUBROUTINE CODA_VERSION(CHARACTER*(*) VERSION)

    INTEGER FUNCTION CODA_INIT()
    SUBROUTINE       CODA_DONE()

    INTEGER FUNCTION CODA_SET_DEFINITION_PATH(CHARACTER*(*) PATH)
    INTEGER FUNCTION CODA_SET_DEFINITION_PATH_CONDITIONAL(CHARACTER*(*) FILE, CHARACTER*(*) SEARCHPATH, CHARACTER*(*) RELATIVE_LOCATION)

    INTEGER FUNCTION CODA_SET_OPTION_BYPASS_SPECIAL_TYPES(INTEGER ENABLE)
    INTEGER FUNCTION CODA_GET_OPTION_BYPASS_SPECIAL_TYPES()
    INTEGER FUNCTION CODA_SET_OPTION_PERFORM_BOUNDARY_CHECKS(INTEGER ENABLE)
    INTEGER FUNCTION CODA_GET_OPTION_PERFORM_BOUNDARY_CHECKS()
    INTEGER FUNCTION CODA_SET_OPTION_PERFORM_CONVERSIONS(INTEGER ENABLE)
    INTEGER FUNCTION CODA_GET_OPTION_PERFORM_CONVERSIONS()
    INTEGER FUNCTION CODA_SET_OPTION_USE_FAST_SIZE_EXPRESSIONS(INTEGER ENABLE)
    INTEGER FUNCTION CODA_GET_OPTION_USE_FAST_SIZE_EXPRESSIONS()
    INTEGER FUNCTION CODA_SET_OPTION_USE_MMAP(INTEGER ENABLE)
    INTEGER FUNCTION CODA_GET_OPTION_USE_MMAP()

    DOUBLE PRECISION FUNCTION CODA_NAN()
    INTEGER          FUNCTION CODA_ISNAN(DOUBLE PRECISION X)
    DOUBLE PRECISION FUNCTION CODA_PLUSINF()
    DOUBLE PRECISION FUNCTION CODA_MININF()
    INTEGER          FUNCTION CODA_ISINF(DOUBLE PRECISION X)
    INTEGER          FUNCTION CODA_ISPLUSINF(DOUBLE PRECISION X)
    INTEGER          FUNCTION CODA_ISMININF(DOUBLE PRECISION X)

    INTEGER FUNCTION CODA_C_INDEX_TO_FORTRAN_INDEX(INTEGER N_DIMS, INTEGER*8 DIM(CODA_MAX_N_DIMS), INTEGER*8 INDEX)

    DOUBLE PRECISION FUNCTION CODA_TIME()
    INTEGER          FUNCTION CODA_TIME_DOUBLE_TO_PARTS(DOUBLE PRECISION DATETIME, INTEGER YEAR, INTEGER MONTH, INTEGER DAY, INTEGER HOUR, INTEGER MINUTE, INTEGER SECOND, INTEGER MUSEC)
    INTEGER          FUNCTION CODA_TIME_DOUBLE_TO_PARTS_UTC(DOUBLE PRECISION DATETIME, INTEGER YEAR, INTEGER MONTH, INTEGER DAY, INTEGER HOUR, INTEGER MINUTE, INTEGER SECOND, INTEGER MUSEC)
    INTEGER          FUNCTION CODA_TIME_PARTS_TO_DOUBLE(INTEGER YEAR, INTEGER MONTH, INTEGER DAY, INTEGER HOUR, INTEGER MINUTE, INTEGER SECOND, INTEGER MUSEC, DOUBLE PRECISION DATETIME)
    INTEGER          FUNCTION CODA_TIME_PARTS_TO_DOUBLE_UTC(INTEGER YEAR, INTEGER MONTH, INTEGER DAY, INTEGER HOUR, INTEGER MINUTE, INTEGER SECOND, INTEGER MUSEC, DOUBLE PRECISION DATETIME)
    INTEGER          FUNCTION CODA_TIME_PARTS_TO_STRING(INTEGER YEAR, INTEGER MONTH, INTEGER DAY, INTEGER HOUR, INTEGER MINUTE, INTEGER SECOND, INTEGER MUSEC, CHARACTER*(*) FORMAT, CHARACTER*(*) STR)
    INTEGER          FUNCTION CODA_TIME_STRING_TO_PARTS(CHARACTER*(*) FORMAT, CHARACTER*(*) STR, INTEGER YEAR, INTEGER MONTH, INTEGER DAY, INTEGER HOUR, INTEGER MINUTE, INTEGER SECOND, INTEGER MUSEC)
    INTEGER          FUNCTION CODA_TIME_DOUBLE_TO_STRING(DOUBLE PRECISION DATETIME, CHARACTER*(*) FORMAT, CHARACTER*(*) STR)
    INTEGER          FUNCTION CODA_TIME_DOUBLE_TO_STRING_UTC(DOUBLE PRECISION DATETIME, CHARACTER*(*) FORMAT, CHARACTER*(*) STR)
    INTEGER          FUNCTION CODA_TIME_STRING_TO_DOUBLE(CHARACTER*(*) FORMAT, CHARACTER*(*) STR, DOUBLE PRECISION DATETIME)
    INTEGER          FUNCTION CODA_TIME_STRING_TO_DOUBLE_UTC(CHARACTER*(*) FORMAT, CHARACTER*(*) STR, DOUBLE PRECISION DATETIME)

CODA Error

    INTEGER FUNCTION CODA_GET_ERRNO()
    SUBROUTINE       CODA_ERRNO_TO_STRING(INTEGER ERR, CHARACTER*(*) STR)

CODA Product File

    INTEGER FUNCTION CODA_RECOGNIZE_FILE(CHARACTER*(*) FILENAME, INTEGER*8 FILE_SIZE, INTEGER FILE_FORMAT, CHARACTER*(*)PRODUCT_CLASS, CHARACTER*(*) PRODUCT_TYPE, INTEGER PRODUCT_VERSION)

    INTEGER FUNCTION CODA_OPEN(CHARACTER*(*) FILENAME, INTEGER*8 PF)
    INTEGER FUNCTION CODA_OPEN_AS(CHARACTER*(*) FILENAME, CHARACTER*(*) PRODUCT_CLASS, CHARACTER*(*) PRODUCT_TYPE, INTEGER VERSION, INTEGER*8 PF)
    INTEGER FUNCTION CODA_CLOSE(INTEGER*8 PF)

    INTEGER FUNCTION CODA_GET_PRODUCT_FILENAME(INTEGER*8 PF, CHARACTER*(*) FILENAME)
    INTEGER FUNCTION CODA_GET_PRODUCT_FILE_SIZE(INTEGER*8 PF, INTEGER*8 FILE_SIZE)
    INTEGER FUNCTION CODA_GET_PRODUCT_FORMAT(INTEGER*8 PF, INTEGER FORMAT)
    INTEGER FUNCTION CODA_GET_PRODUCT_CLASS(INTEGER*8 PF, CHARACTER*(*) PRODUCT_CLASS)
    INTEGER FUNCTION CODA_GET_PRODUCT_TYPE(INTEGER*8 PF, CHARACTER*(*) PRODUCT_TYPE)
    INTEGER FUNCTION CODA_GET_PRODUCT_VERSION(INTEGER*8 PF, INTEGER VERSION)
    INTEGER FUNCTION CODA_GET_PRODUCT_DEFINITION_FILE(INTEGER*8 PF, CHARACTER*(*) DEFINITION_FILE)
    INTEGER FUNCTION CODA_GET_PRODUCT_ROOT_TYPE(INTEGER*8 PF, INTEGER TYPE)

    INTEGER FUNCTION CODA_GET_PRODUCT_VARIABLE_VALUE(INTEGER*8 PF, CHARACTER*(*) VARIABLE, INTEGER*8 INDEX, INTEGER*8 VALUE)

CODA Types

    SUBROUTINE CODA_TYPE_GET_FORMAT_NAME(INTEGER FORMAT, CHARACTER*(*) CLASS_NAME)
    SUBROUTINE CODA_TYPE_GET_CLASS_NAME(INTEGER TYPE, CHARACTER*(*) CLASS_NAME)
    SUBROUTINE CODA_TYPE_GET_NATIVE_TYPE_NAME(INTEGER TYPE, CHARACTER*(*) NATIVE_TYPE_NAME)
    SUBROUTINE CODA_TYPE_GET_SPECIAL_TYPE_NAME(INTEGER TYPE, CHARACTER*(*) SPECIAL_TYPE_NAME)

    INTEGER FUNCTION CODA_TYPE_HAS_ATTRIBUTES(INTEGER TYPE, INTEGER HAS_ATTRIBUTES)

    INTEGER FUNCTION CODA_TYPE_GET_FORMAT(INTEGER*8 TYPE, INTEGER FORMAT)
    INTEGER FUNCTION CODA_TYPE_GET_CLASS(INTEGER*8 TYPE, INTEGER TYPE_CLASS)
    INTEGER FUNCTION CODA_TYPE_GET_READ_TYPE(INTEGER*8 TYPE, INTEGER READ_TYPE)
    INTEGER FUNCTION CODA_TYPE_GET_STRING_LENGTH(INTEGER*8 TYPE, INTEGER*8 LENGTH)
    INTEGER FUNCTION CODA_TYPE_GET_BIT_SIZE(INTEGER*8 TYPE, INTEGER*8 BIT_SIZE)
    INTEGER FUNCTION CODA_TYPE_GET_NAME(INTEGER*8 TYPE, CHARACTER*(*) NAME)
    INTEGER FUNCTION CODA_TYPE_GET_DESCRIPTION(INTEGER*8 TYPE, CHARACTER*(*) DESCRIPTION)
    INTEGER FUNCTION CODA_TYPE_GET_UNIT(INTEGER*8 TYPE, CHARACTER*(*) UNIT)
    INTEGER FUNCTION CODA_TYPE_GET_FIXED_VALUE(INTEGER*8 TYPE, CHARACTER*(*) FIXED_VALUE, INTEGER*8 LENGTH)
    INTEGER FUNCTION CODA_TYPE_GET_ATTRIBUTES(INTEGER*8 TYPE, INTEGER*8 ATTRIBUTES)

    INTEGER FUNCTION CODA_TYPE_GET_NUM_RECORD_FIELDS(INTEGER*8 TYPE, INTEGER*8 NUM_FIELDS)
    INTEGER FUNCTION CODA_TYPE_GET_RECORD_FIELD_INDEX_FROM_NAME(INTEGER*8 TYPE, CHARACTER*(*) NAME, INTEGER*8 INDEX)
    INTEGER FUNCTION CODA_TYPE_GET_RECORD_FIELD_INDEX_FROM_REAL_NAME(INTEGER*8 TYPE, CHARACTER*(*) REAL_NAME, INTEGER*8 INDEX)
    INTEGER FUNCTION CODA_TYPE_GET_RECORD_FIELD_TYPE(INTEGER*8 TYPE, INTEGER*8 INDEX, INTEGER*8 FIELD_TYPE)
    INTEGER FUNCTION CODA_TYPE_GET_RECORD_FIELD_NAME(INTEGER*8 TYPE, INTEGER*8 INDEX, CHARACTER*(*) NAME)
    INTEGER FUNCTION CODA_TYPE_GET_RECORD_FIELD_REAL_NAME(INTEGER*8 TYPE, INTEGER*8 INDEX, CHARACTER*(*) REAL_NAME)
    INTEGER FUNCTION CODA_TYPE_GET_RECORD_FIELD_HIDDEN_STATUS(INTEGER*8 TYPE, INTEGER*8 INDEX, INTEGER HIDDEN)
    INTEGER FUNCTION CODA_TYPE_GET_RECORD_FIELD_AVAILABLE_STATUS(INTEGER*8 TYPE, INTEGER*8 INDEX, INTEGER AVAILABLE)
    INTEGER FUNCTION CODA_TYPE_GET_RECORD_UNION_STATUS(INTEGER*8 TYPE, INTEGER IS_UNION)

    INTEGER FUNCTION CODA_TYPE_GET_ARRAY_NUM_DIMS(INTEGER*8 TYPE, INTEGER NUM_DIMS)
    INTEGER FUNCTION CODA_TYPE_GET_ARRAY_FIXED_DIM(INTEGER*8 TYPE, INTEGER NUM_DIMS, INTEGER*8 DIM(CODA_MAX_NUM_DIMS))
    INTEGER FUNCTION CODA_TYPE_GET_ARRAY_BASE_TYPE(INTEGER*8 TYPE, INTEGER*8 BASE_TYPE)

    INTEGER FUNCTION CODA_TYPE_GET_SPECIAL_TYPE(INTEGER*8 TYPE, INTEGER SPECIAL_TYPE)
    INTEGER FUNCTION CODA_TYPE_GET_SPECIAL_TYPE_BASE_TYPE(INTEGER*8 TYPE, INTEGER*8 BASE_TYPE)

CODA Cursor

    INTEGER*8 FUNCTION CODA_CURSOR_NEW()
    INTEGER*8 FUNCTION CODA_CURSOR_DUPLICATE(INTEGER*8 CURSOR)
    SUBROUTINE         CODA_CURSOR_DELETE(INTEGER*8 CURSOR)

    INTEGER FUNCTION CODA_CURSOR_SET_PRODUCT(INTEGER*8 CURSOR, INTEGER*8 PF)

    INTEGER FUNCTION CODA_CURSOR_GOTO)(INTEGER*8 CURSOR, CHARACTER*(*) PATH)
    INTEGER FUNCTION CODA_CURSOR_GOTO_FIRST_RECORD_FIELD)(INTEGER*8 CURSOR)
    INTEGER FUNCTION CODA_CURSOR_GOTO_NEXT_RECORD_FIELD)(INTEGER*8 CURSOR)
    INTEGER FUNCTION CODA_CURSOR_GOTO_RECORD_FIELD_BY_INDEX(INTEGER*8 CURSOR, INTEGER*8 INDEX)
    INTEGER FUNCTION CODA_CURSOR_GOTO_RECORD_FIELD_BY_NAME(INTEGER*8 CURSOR, CHARACTER*(*) NAME)
    INTEGER FUNCTION CODA_CURSOR_GOTO_AVAILABLE_UNION_FIELD(INTEGER*8 CURSOR)

    INTEGER FUNCTION CODA_CURSOR_GOTO_FIRST_ARRAY_ELEMENT(INTEGER*8 CURSOR)
    INTEGER FUNCTION CODA_CURSOR_GOTO_NEXT_ARRAY_ELEMENT(INTEGER*8 CURSOR)
    INTEGER FUNCTION CODA_CURSOR_GOTO_ARRAY_ELEMENT(INTEGER*8 CURSOR, INTEGER NUM_SUBS, INTEGER*8 SUBS(CODA_MAX_NUM_DIMS))
    INTEGER FUNCTION CODA_CURSOR_GOTO_ARRAY_ELEMENT_BY_INDEX(INTEGER*8 CURSOR, INTEGER*8 INDEX)

    INTEGER FUNCTION CODA_CURSOR_GOTO_ATTRIBUTES(INTEGER*8 CURSOR)

    INTEGER FUNCTION CODA_CURSOR_GOTO_ROOT(INTEGER*8 CURSOR)
    INTEGER FUNCTION CODA_CURSOR_GOTO_PARENT(INTEGER*8 CURSOR)

    INTEGER FUNCTION CODA_CURSOR_USE_BASE_TYPE_OF_SPECIAL_TYPE(INTEGER*8 CURSOR)

    INTEGER FUNCTION CODA_CURSOR_HAS_ASCII_CONTENT(INTEGER*8 CURSOR, INTEGER HAS_ASCII_CONTENT)
    INTEGER FUNCTION CODA_CURSOR_HAS_ATTRIBUTES(INTEGER*8 CURSOR, INTEGER HAS_ATTRIBUTES)

    INTEGER FUNCTION CODA_CURSOR_GET_STRING_LENGTH(INTEGER*8 CURSOR, INTEGER*8 LENGTH)
    INTEGER FUNCTION CODA_CURSOR_GET_BIT_SIZE(INTEGER*8 CURSOR, INTEGER*8 BIT_SIZE)
    INTEGER FUNCTION CODA_CURSOR_GET_BYTE_SIZE(INTEGER*8 CURSOR, INTEGER*8 BYTE_SIZE)
    INTEGER FUNCTION CODA_CURSOR_GET_NUM_ELEMENTS(INTEGER*8 CURSOR, INTEGER*8 NUM_ELEMENTS)

    INTEGER FUNCTION CODA_CURSOR_GET_PRODUCT_FILE(INTEGER*8 CURSOR, INTEGER*8 PF)

    INTEGER FUNCTION CODA_CURSOR_GET_DEPTH(INTEGER*8 CURSOR, INTEGER DEPTH)
    INTEGER FUNCTION CODA_CURSOR_GET_INDEX(INTEGER*8 CURSOR, INTEGER*8 INDEX)

    INTEGER FUNCTION CODA_CURSOR_GET_FILE_BIT_OFFSET(INTEGER*8 CURSOR, INTEGER*8 BIT_OFFSET)
    INTEGER FUNCTION CODA_CURSOR_GET_FILE_BYTE_OFFSET(INTEGER*8 CURSOR, INTEGER*8 BYTE_OFFSET)

    INTEGER FUNCTION CODA_CURSOR_GET_FORMAT(INTEGER*8 CURSOR, INTEGER FORMAT)
    INTEGER FUNCTION CODA_CURSOR_GET_TYPE_CLASS(INTEGER*8 CURSOR, INTEGER TYPE_CLASS)
    INTEGER FUNCTION CODA_CURSOR_GET_READ_TYPE(INTEGER*8 CURSOR, INTEGER READ_TYPE)
    INTEGER FUNCTION CODA_CURSOR_GET_SPECIAL_TYPE(INTEGER*8 CURSOR, INTEGER SPECIAL_TYPE)
    INTEGER FUNCTION CODA_CURSOR_GET_TYPE(INTEGER*8 CURSOR, INTEGER*8 TYPE)

    INTEGER FUNCTION CODA_CURSOR_GET_RECORD_FIELD_INDEX_FROM_NAME(INTEGER*8 CURSOR, CHARACTER*(*) NAME, INTEGER*8 INDEX)
    INTEGER FUNCTION CODA_CURSOR_GET_RECORD_FIELD_AVAILABLE_STATUS(INTEGER*8 CURSOR, INTEGER*8 INDEX, INTEGER AVAILABLE)
    INTEGER FUNCTION CODA_CURSOR_GET_AVAILABLE_UNION_FIELD(INTEGER*8 CURSOR, INTEGER*8 INDEX)

    INTEGER FUNCTION CODA_CURSOR_GET_ARRAY_DIM(INTEGER*8 CURSOR, INTEGER NUM_DIMS, INTEGER*8 DIM(CODA_MAX_NUM_DIMS))

    INTEGER FUNCTION CODA_CURSOR_READ_INT8(INTEGER*8 CURSOR, INTEGER*1 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_UINT8(INTEGER*8 CURSOR, INTEGER*1 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_INT16(INTEGER*8 CURSOR, INTEGER*2 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_UINT16(INTEGER*8 CURSOR, INTEGER*2 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_INT32(INTEGER*8 CURSOR, INTEGER*4 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_UINT32(INTEGER*8 CURSOR, INTEGER*4 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_INT64(INTEGER*8 CURSOR, INTEGER*8 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_UINT64(INTEGER*8 CURSOR, INTEGER*8 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_FLOAT(INTEGER*8 CURSOR, REAL DST)
    INTEGER FUNCTION CODA_CURSOR_READ_DOUBLE(INTEGER*8 CURSOR, DOUBLE PRECISION DST)
    INTEGER FUNCTION CODA_CURSOR_READ_CHAR(INTEGER*8 CURSOR, CHARACTER DST)
    INTEGER FUNCTION CODA_CURSOR_READ_STRING(INTEGER*8 CURSOR, CHARACTER*(*) DST)

    INTEGER FUNCTION CODA_CURSOR_READ_BITS(INTEGER*8 CURSOR, CHARACTER DST, INTEGER*8 BIT_OFFSET, INTEGER*8 BIT_LENGTH)
    INTEGER FUNCTION CODA_CURSOR_READ_BYTES(INTEGER*8 CURSOR, CHARACTER DST, INTEGER*8 OFFSET, INTEGER*8 LENGTH)

    INTEGER FUNCTION CODA_CURSOR_READ_INT8_ARRAY(INTEGER*8 CURSOR, INTEGER*1 DST, INTEGER ARRAY_ORDERING)
    INTEGER FUNCTION CODA_CURSOR_READ_UINT8_ARRAY(INTEGER*8 CURSOR, INTEGER*1 DST, INTEGER ARRAY_ORDERING)
    INTEGER FUNCTION CODA_CURSOR_READ_INT16_ARRAY(INTEGER*8 CURSOR, INTEGER*2 DST, INTEGER ARRAY_ORDERING)
    INTEGER FUNCTION CODA_CURSOR_READ_UINT16_ARRAY(INTEGER*8 CURSOR, INTEGER*2 DST, INTEGER ARRAY_ORDERING)
    INTEGER FUNCTION CODA_CURSOR_READ_INT32_ARRAY(INTEGER*8 CURSOR, INTEGER*4 DST, INTEGER ARRAY_ORDERING)
    INTEGER FUNCTION CODA_CURSOR_READ_UINT32_ARRAY(INTEGER*8 CURSOR, INTEGER*4 DST, INTEGER ARRAY_ORDERING)
    INTEGER FUNCTION CODA_CURSOR_READ_INT64_ARRAY(INTEGER*8 CURSOR, INTEGER*8 DST, INTEGER ARRAY_ORDERING)
    INTEGER FUNCTION CODA_CURSOR_READ_UINT64_ARRAY(INTEGER*8 CURSOR, INTEGER*8 DST, INTEGER ARRAY_ORDERING)
    INTEGER FUNCTION CODA_CURSOR_READ_FLOAT_ARRAY(INTEGER*8 CURSOR, REAL DST, INTEGER ARRAY_ORDERING)
    INTEGER FUNCTION CODA_CURSOR_READ_DOUBLE_ARRAY(INTEGER*8 CURSOR, DOUBLE PRECISION DST, INTEGER ARRAY_ORDERING)
    INTEGER FUNCTION CODA_CURSOR_READ_CHAR_ARRAY(INTEGER*8 CURSOR, CHARACTER DST, INTEGER ARRAY_ORDERING)

    INTEGER FUNCTION CODA_CURSOR_READ_INT8_PARTIAL_ARRAY(INTEGER*8 CURSOR, INTEGER*8 OFFSET, INTEGER*8 LENGTH, INTEGER*1 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_UINT8_PARTIAL_ARRAY(INTEGER*8 CURSOR, INTEGER*8 OFFSET, INTEGER*8 LENGTH, INTEGER*1 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_INT16_PARTIAL_ARRAY(INTEGER*8 CURSOR, INTEGER*8 OFFSET, INTEGER*8 LENGTH, INTEGER*2 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_UINT16_PARTIAL_ARRAY(INTEGER*8 CURSOR, INTEGER*8 OFFSET, INTEGER*8 LENGTH, INTEGER*2 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_INT32_PARTIAL_ARRAY(INTEGER*8 CURSOR, INTEGER*8 OFFSET, INTEGER*8 LENGTH, INTEGER*4 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_UINT32_PARTIAL_ARRAY(INTEGER*8 CURSOR, INTEGER*8 OFFSET, INTEGER*8 LENGTH, INTEGER*4 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_INT64_PARTIAL_ARRAY(INTEGER*8 CURSOR, INTEGER*8 OFFSET, INTEGER*8 LENGTH, INTEGER*8 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_UINT64_PARTIAL_ARRAY(INTEGER*8 CURSOR, INTEGER*8 OFFSET, INTEGER*8 LENGTH, INTEGER*8 DST)
    INTEGER FUNCTION CODA_CURSOR_READ_FLOAT_PARTIAL_ARRAY(INTEGER*8 CURSOR, INTEGER*8 OFFSET, INTEGER*8 LENGTH, REAL DST)
    INTEGER FUNCTION CODA_CURSOR_READ_DOUBLE_PARTIAL_ARRAY(INTEGER*8 CURSOR, INTEGER*8 OFFSET, INTEGER*8 LENGTH, DOUBLE PRECISION DST)
    INTEGER FUNCTION CODA_CURSOR_READ_CHAR_PARTIAL_ARRAY(INTEGER*8 CURSOR, INTEGER*8 OFFSET, INTEGER*8 LENGTH, CHARACTER DST)

    INTEGER FUNCTION CODA_CURSOR_READ_COMPLEX_DOUBLE_PAIR(INTEGER*8 CURSOR, DOUBLE PRECISION DST)
    INTEGER FUNCTION CODA_CURSOR_READ_COMPLEX_DOUBLE_PAIRS_ARRAY(INTEGER*8 CURSOR, DOUBLE PRECISION DST, INTEGER ARRAY_ORDERING)
    INTEGER FUNCTION CODA_CURSOR_READ_COMPLEX_DOUBLE_SPLIT(INTEGER*8 CURSOR, DOUBLE PRECISION DST_RE, DOUBLE PRECISION DST_IM)
    INTEGER FUNCTION CODA_CURSOR_READ_COMPLEX_DOUBLE_SPLIT_ARRAY(INTEGER*8 CURSOR, DOUBLE PRECISION DST_RE, DOUBLE PRECISION DST_IM, INTEGER ARRAY_ORDERING)

    SUBROUTINE       CODA_EXPRESSION_GET_TYPE_NAME(INTEGER EXPRESSION_TYPE, CHARACTER*(*) EXPRESSION_TYPE_NAME)
    INTEGER FUNCTION CODA_EXPRESSION_FROM_STRING(CHARACTER*(*) EXPRESSION_STRING, INTEGER*8 EXPRESSION)
    SUBROUTINE       CODA_EXPRESSION_DELETE(INTEGER*8 EXPRESSION)
    INTEGER FUNCTION CODA_EXPRESSION_GET_TYPE(INTEGER*8 EXPRESSION, INTEGER EXPRESSION_TYPE)
    INTEGER FUNCTION CODA_EXPRESSION_IS_CONSTANT(INTEGER*8 EXPRESSION)
    INTEGER FUNCTION CODA_EXPRESSION_IS_EQUAL(INTEGER*8 EXPR1, INTEGER*8 EXPR2)
    INTEGER FUNCTION CODA_EXPRESSION_EVAL_BOOL(INTEGER*8 EXPRESSION, INTEGER*8 CURSUR, INTEGER VALUE)
    INTEGER FUNCTION CODA_EXPRESSION_EVAL_INTEGER(INTEGER*8 EXPRESSION, INTEGER*8 CURSOR, INTEGER*8 VALUE)
    INTEGER FUNCTION CODA_EXPRESSION_EVAL_FLOAT(INTEGER*8 EXPRESSION, INTEGER*8 CURSOR, DOUBLE PRECISION VALUE)
    INTEGER FUNCTION CODA_EXPRESSION_EVAL_STRING(INTEGER*8 EXPRESSION, INTEGER*8 CURSOR, CHARACTER*(*) VALUE)
    INTEGER FUNCTION CODA_EXPRESSION_EVAL_NODE(INTEGE*8 EXPRESSION, INTEGER*8 CURSOR)