generate::Macrofort::init
-- initialize
genForMac::init
(where Mac:=generate::Macrofort
)
initializes the global variables for every call to
Mac::genFor
, the Macrofort FORTRAN code generator.
This procedure must be called before the first call to
Mac::genFor
. It initializes the various counters used
internally by Macrofort for label generation within used within e.g.:
do-loops and format statements. It also sets the variables for
precision, comments, optimization, I/O settings, input and output file
definition to their default values although these can be subsequently
modified by subsidiary routines (mentioned in the list of ``Related
Functions'').
generate::Macrofort::init()
the void object of domain type DOM_NULL
Default values for global variables Mac::genFor
are
set.
generate::Macrofort::genFor
,
generate::Macrofort::setOptimizedOption
,
generate::Macrofort::setIOSettings
,
generate::Macrofort::setPrecisionOption
,
generate::Macrofort::setAutoComment
,
generate::Macrofort::openOutputFile
,
generate::Macrofort::closeOutputFile
,
generate::optimize
,
generate::fortran
Mac:=generate::Macrofort
, these are the
subsidiary routines to Mac::init
and
Mac::genFor
within the ``macrofort'' domain:
Mac::setAutoComment
Mac::setPrecisionOption
Mac::setIOSettings
Mac::setOptimizedOption
Mac::openOutputfile
Mac::closeOutputfile
Mac::openOutputfile
.Mac::init
.This example shows how Mac::init
(with
Mac:=generate::Macrofort
) automatically takes care of the
labeling in the FORTRAN output generated by Mac::genFor
.
The output is the ascii file "test.f"
>> Mac := generate::Macrofort: Mac::init(): Mac::openOutputFile("test.f"): Mac::genFor(["continue",label]): Mac::genFor(["do",label,i,1,m,-1]): Mac::closeOutputFile(): delete i, m, label:
The output file "test.f"
is:
1000 continue do 1000, i=1,m,-1
As we can see, the labeling was done automatically without the user having to worry about it.
See the help-file for Mac::genFor
for a more
comprehensive list of examples.