Previous Page Next Page Contents

generate::Macrofort::init -- initialize genFor

Introduction

Mac::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'').

Call(s)

generate::Macrofort::init()

Returns

the void object of domain type DOM_NULL

Side Effects

Default values for global variables Mac::genFor are set.

Related Functions

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

Details

Example 1

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.




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000