Modulefpreviousupnextcontentsindex[BIG][Normal][small]
Next: 5.3 Obtaining general information Up: 5 Diverse utilities Prev: 5.1 Initializing a MODULEF program Index Contents


5.2 Manipulating characters

   

It is sometimes convenient to use "Hollerith variables" [Laug 1984]. Such variables are of type INTEGER, but contain 4 characters. The utilities CHAR4 and ICHAR4, described in this section, are used to manipulate them. For example:

INTEGER I, ICHAR4

CHARACTER*4 C, CHAR4

I = ICHAR4('ABCD')

WRITE (*, '(A4)') I ABCD

C = CHAR4(I)

WRITE (*, '(A4)') C ABCD

The utility NUMALP is presented later on.

Utility CHAR4

  

CHARACTER*4 FUNCTION CHAR4( )

INTEGER I

This utility effects the conversion: Hollerith CHARACTER*4

Utility ICHAR4

  

INTEGER FUNCTION ICHAR4( )

CHARACTER*(*) C

Parameter C is copied into a intermediary variable of type CHARACTER*4, which is truncated or filled by blanks if necessary. Next, this utility effects the conversion: CHARACTER*4 Hollerith.

Utility NUMALP

  

CHARACTER*1 FUNCTION NUMALP( )

INTEGER NB

This utility returns a character for an integer, NB, according to the following conventions:

-1 returns '%'.
0 ... 9 returns '0' ... '9'.
10 ... 35 returns 'A' ... 'Z'.
Any other value returns '*'.

It thus enables us to generate the names of the dynamic arrays belonging to a DS.


Modulefpreviousupnextcontentsindex[BIG][Normal][small]
Next: 5.3 Obtaining general information Up: 5 Diverse utilities Prev: 5.1 Initializing a MODULEF program Index Contents