A file (or sequence) introduction directive appears at the beginning
of the file. There are two different directives, one is DECK
for normal files, the other is KEEP
for include files (sequences).
The first argument is the name of the file. The file name may not be larger
than 32 characters and is converted to lower case in the general case.
The optionnal following arguments may be
of 2 type (and may be mixed, separated by ‘,’):
A conditionnal is introduced by IF=
followed by a conditionnal
expression described in
Conditional expressions. The
file is preprocessed if the conditionnal expression is true.
A language specification is introduced by a T=
. The most
common languages are ‘mtn’ for the mortran, ‘ftn’ for
fortran not preprocessed, ‘f77’ for preprocessed fortran,
‘c’ for the c language and ‘txt’ for text files.
In general the language of the file determines the name of files
the preprocessed file is extracted to, the comment style and
the command for inclusions.
It is a common practice to have wrong language type in KEEP
as the language may be determined from the DECK
that include
them with cmz, or from their file name with make. This is not recommended
and considered a bad practice.
Such a directive will always appear in cmz, as it is built-in. It
is recommended to have one when using make too, even though it is not
required in most cases. Indeed make uses the file name directly
and finds the language and file type by looking at the file extension.
make should then pass the language type with a
--lang lang
command
line switch when calling the cmz directives preprocessor.
With make, the convention is to have ‘cm’ added before the normal
file suffix and after the ‘.’. The table table 3.2
shows the matching between suffixes, file type and file language.
For example, a file beginning with
+Deck, subroutine_foo, If=monitor&-simple, T=f77.
is a main preprocessed fortran file that will only be generated if ‘monitor’ is selected and ‘simple’ is not selected. The file to be preprocessed by make should have the ‘.cmF’ suffix, and be called ‘subroutine_foo.cmF’.
A file beginning with
+KEEP,inc_common,If=monitor|interface,T=mtn
is an mortran include file that should be processed only if ‘monitor’ or ‘interface’ is selected. The file to be preprocessed by make should have the ‘cmmti’ suffix and be called ‘inc_common.cmmti’. The resulting file when make is used will be called ‘inc_common.mti’.