## `generate::Macrofort::setAutoComment` -- automatic comments

#### Introduction

`Mac::setAutoComment` (where `Mac:=generate::Macrofort`) is a switch to ensure that FORTRAN code generated by `Mac::genFor` includes FORTRAN comments.

#### Call(s)

`generate::Macrofort::setAutoComment(b)`

#### Parameters

`b` | - | TRUE or FALSE.

#### Returns

the void object of domain type `DOM_NULL`

#### Side Effects

Resets the internal macrofort variable for the FORTRAN code generated by `generate::Macrofort::genFor`.

#### Related Functions

`generate::Macrofort::init`, `generate::Macrofort::genFor`

#### Details

- `Mac::setAutoComment` (where `Mac:=generate::Macrofort`) is used with `Mac::genFor` and `Mac::init` (see these programs for more details) and adjusts Macrofort (internal) global variable for generation of FORTRAN comments. The default setting for this variable made by an initial call to `Mac::init` is TRUE for the resulting FORTRAN code.

  When a boolean value of FALSE is injected to `Mac::setAutoComment`, the FORTRAN code of `Mac::genFor` is generated without FORTRAN comments.

#### Example 1

    >> Mac:=generate::Macrofort:
       Mac::init():

Note that the default mode for the automatic comments set by `Mac::init` is TRUE (meaning on).

    >> Mac::openOutputFile("test.f"):
       Mac::genFor(["subroutinem", foo, [a, b, i],
                    [["equal", a, 1], ["equal", b, 2]]]):
       Mac::closeOutputFile():

Switch auto-comment off and send output to a different file.

    >> Mac::setAutoComment(FALSE):
       Mac::openOutputFile("test2.f"):
       Mac::genFor(["subroutinem", foo, [a, b, i],
                    [["equal", a, 1], ["equal", b, 2]]]):
       Mac::closeOutputFile();

The output file with comments `test.f` is:

          c
          c     SUBROUTINE foo
          c
                subroutine foo(a,b,i)
                  a = 1
                  b = 2
                end

The output file without comments `test2.f` is:

                subroutine foo(a,b,i)
                  a = 1
                  b = 2
                end

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000