usr2ieg

Date:

06-19-2023

NAME

USR2IEG, IEG2USR - Converts Fortran data types between user-defined and generic IEEE data types

SYNOPSIS

INTEGER USR2IEG, IEG2USR

ierr  = USR2IEG(type, num,
     foreign, bitoff, native, stride,
     natlen, forlen [,nativech])

ierr = IEG2USR(type, num,
     foreign, bitoff, native, stride,
     natlen, forlen [,nativech])

DESCRIPTION

USR2IEG converts user-defined data types of user-defined size (abbreviated as “USR” in the following text) to data for systems that use generic 32-bit and 64-bit IEEE floating-point representation (abbreviated as “IEG” in the following text).

IEG2USR converts generic 32-bit and 64-bit IEEE Fortran data types to user-defined data types.

These routines are provided as interfaces for user-defined conversion routines. Cray Inc. does not supply complete and functional routines for user-defined data conversion.

When using the Cray Fortran compiler, all arguments must be of default kind unless documented otherwise. The default kind is KIND=4 for integer, real, complex, and logical arguments.

The following is a list of valid arguments for this routine.

type

An integer giving the data type code, as follows.

Code

Description

1

Typeless (no translation; natlen and forlen must be equal.)

2

Integer IEG: 8-, 16-, 32-, or 64-bit twos complement

  • USR: as delivered by the user routine

3

Real IEG: 32-, 64-, or 128-bit IEEE floating-point

  • USR: as delivered by the user routine

4

Complex IEG: 2 x 32-, 64-, or 128-bit floating-point

  • USR: as delivered by the user routine

5

Logical IEG: 8-, 16-, 32-, or 64-bit nonzero/zero logical

  • USR: as delivered by the user routine

6

IEG: ASCII

  • USR: as delivered by the user routine

  • The natlen and forlen parameters select the size of the data.

num

Number of data items to convert. Type integer variable, expression, or constant.

foreign

Variable or array of any noncharacter type or length containing the data which is not native to the current system. This variable or array either receives the converted data or contains data to be converted.

bitoff

Integer giving the bit offset within the foreign data variable or array to begin the conversion. bitoff must be at least 0 and no more than 63.

native

Variable or array of any noncharacter type or length containing the data which is native to the current system. This variable or array either receives the converted data or contains data to be converted. This may be a strided array.

  • This variable should be of a type that corresponds to the type argument. If type=6 (CHARACTER), native should be a dummy INTEGER variable and the optional nativech argument should be a CHARACTER variable or array that contains or will contain the native data.

stride

Integer variable or constant giving the memory increment for loading or storing data to the native array. For two and four-word items (complex and double-precision), this is a stride of items, not of words. For typeless, stride is always in words.

  • This parameter is ignored for CHARACTER (type = 6). Data in the foreign array is loaded or stored in a continuous bit stream regardless of this parameter.

natlen

Native storage length of an item, in bits. For COMPLEX data, natlen counts the total size of the real and imaginary component.

forlen

Fortran storage length of an item, in bits. For COMPLEX data, forlen counts the total size of the real and imaginary components.

nativech

Optional character parameter specifying native target variable if it is of type CHARACTER (type = 6). This parameter is ignored if type is not CHARACTER.

CAUTIONS

The foreign and native variables should not be associated (aliased to each other).

RETURN VALUES

The returned function values are as follows:

-1

Parameter error; too many arguments or nativech not specified with type = 6.

-2

Parameter error; invalid type.

-3

Parameter error; invalid num.

-4

Parameter error; invalid bitoff.

-5

Parameter error; invalid natlen.

-6

Parameter error; invalid forlen.

-7

Unable to malloc() memory for translation.

-8

Combination of natlen and forlen is invalid.

0

Translation complete; no errors.

>0

Translation complete; return value is the number of integer or real values that completely overflowed during conversion.