Generated with CERN WebMaker
Generic Constants
Table A.1: Generic Constants.
Data Type Sizes
These macros define the sizes of the fundamental SPP data types in units of char, the smallest addressable word.
Table A.2: Sizes of SPP Data Types.
Data Type Codes
The data type codes are used, for example, in dynamic memory allocation, in which it is necessary to know how many bytes each value occupies. The sizes are in units of chars, where a char usually occupies two bytes. The lines shown Example A.1 will allocate a short and double buffer, each of size elements. The resulting memory buffers will consist of different numbers of bytes, but will logically contain the same number of elements.
Table A.3: Data Type Codes.
File and Image I/O
The macros described in this section are used in accessing text files, binary files, and images. File Types
The file type specifies the kind of file to be read or written.
Table A.4: File Types.
File I/O Modes
The mode parameters are used on opening the file and specify the manner in which the file will be accessed.
Table A.5: File I/O Modes.
I/O Streams
Table A.6: I/O Streams.
The following example (Example A.2) opens two files. The first statement opens for reading an existing text file whose name is specified in the char variable fname. The second statement opens a new image whose name will be the string in imname.
Indefinites
Indefinite values may be used to flag data for specific purpose, to exclude from further consideration or indicate an error, for example. Each SPP data type has its own indefinite value. The actual value of the various indefinites may be different, so the appropriate one must be used. In addition, there are macro functions to test values against INDEF. Values
Table A.7: Indefinite Values.
Logical Functions
These macros (Table A.8) define functions to test values against indefinite. There is a macro for each SPP data type. Example A.3 shows how to execute a block of code in the case where a particular value is indefinite.
Table A.8: Logical Functions.
Pointer Conversion
These macros are used for pointer conversions in data structures. Since all dynamically allocated arrays share the same memory (implemented by Fortran COMMON and EQUIVALENCE), the correct offset to data types having different word sizes must be computed. These macros perform that computation. Note that there is no P2I or P2R since these are assumed to be the same size according to the Fortran standard. See "Macro Definitions" on page 16 for more discussion of SPP macros.
Table A.9: Pointer Conversion Macros.
The following example from lib$gio.h is part of the definition of the gio data structure that maintains information about a plot. It defines (among other things) a string containing a label format. This is stored in a dynamically allocated char array.