Description:
Create
a CHARACTER array that will be passed to a FORTRAN routine using the CHARACTER_ARRAY_ARG
macro. Use this macro, in combination with the DECLARE_CHARACTER_ARRAY_DYN and
F77_FREE_CHARACTER macros, where the size of the CHARACTER array is not known until run
time. A pointer to the actual string of characters and an integer variable giving the length of the string
are set.
Invocation
F77_CREATE_CHARACTER_ARRAY(arg,length,nels)
Arguments
arg
The variable being created.
length
The length of the character string. This will
usually be a variable name or expression of type int.
nels
The number of elements.
Examples:
F77_CREATE_CHARACTER_ARRAY(fstring,strlen(cstring),nels)
will expand as
follows:
All Unix: | { int f77dims[1];f77dims[0]=nels; |
| fstring=cnfCrefa(strlen(cstring),1,f77dims); |
| fstring_length=strlen(cstring);} |
VAX/VMS: | { int f77dims[1];f77dims[0]=nels; |
| fstring_arg = cnfCrefa(strlen(cstring),1,f77dims); |
| fstring = fstring_arg->pointer; |
| fstring_length = fstring_arg->length;} |
Notes:
On VMS, the expansion of the macro is quite complex. A descriptor structure and a pointer
to it are set up in addition to the pointer to the actual array of strings and the length of the strings.
(The address of the descriptor is what is actually passed to the called FORTRAN routine.)