The GENERIC utility is executed by typing the following command:
Arguments in square brackets are optional and items in angle brackets are descriptive terms for the actual string that would be given. The simplest form of the generic command is:
which will produce a file called prog.f
containing routines for all of the supported data types.
Likewise for C
will create a file prog.c
.
A softlink called fgeneric is also provided to avoid a clash with the IRAF generic preprocessor.
All generic input Fortran files must have a suffix of .gen
, or .g
<types> where <types> is a list of data
types (see option -t
below for a list). The latter was introduced to simplify building using GNU
tools, and is the recommended naming convention. For C files the file extension should be
.cgen
.
You can specify multiple input files explicitly or with wild cards. All output Fortran files have a suffix
of .f
, and output C files have suffix .c
.
The generic command accepts the following command-line options.
-t
by a space, and should consist of one or more of the letters
a, b, B, c, d, i, l, n, r, w or W
. The letters have the following meanings: a | all data types |
b | BYTE |
B | unsigned BYTE |
c | CHARACTER |
d | DOUBLE PRECISION |
i | INTEGER |
l | LOGICAL |
n | all numeric types (i.e. everything except CHARACTER and LOGICAL) |
r | REAL |
w | WORD (i.e. INTEGER*2) |
W | unsigned WORD |
For example, to generate routines for all of the standard Fortran numeric data types, type the command:
(Using n
instead of dir
would generate byte and word versions as well.)
GENERIC_CHASIZ
. If GENERIC_CHASIZ
is defined and the -c
argument is present, the -c
argument
takes precedence.
sub1.gen
and the -t
flag is set to dir
, then specifying the -s
flag will cause output files called sub1d.f
, sub1i.f
and sub1r.f
to be generated. This option is
provided as it is usual on Unix systems to have all Fortran routines in separate source
files.
-sc
should be followed by a space and then the character(s) to be used as the separator. For
example, the command:
will generate files called func2_d.f
, func2_i.f
and func2_r.f
. If the -sc
flag is given, then the
-s
flag can be omitted.
ub
and uw
tokens respectively in the code and in generated
filenames. This is for compability with the original VMS version when most generic routines
were developed. However, note that the -t
values of BW should still be used to obtain unsigned
byte and unsigned-word instantiations.
x
from the file name before generating the names of the output files. This is
provided for compatability with early generic files in the VMS era files that had a final x
in the
name to indicate where the token would be replaced in the instantiated files. In modern usage
the trailing x
is absent, and this option is not required.
It is possible to specify the list of data types to be processed and the local character size by setting
environment variables GENERIC_TYPES
and GENERIC_CHASIZ
, e.g.