Please enable JavaScript to view this site.

 

Navigation: Macros > Macro Language > Code Structure

The Compiler Directives Section in Macros

Scroll Prev Up Next More

The Compiler Directives section is located at the very top of any macro.

 

Compiler Directives are used to give specific directives concerning the execution of the current macro. This section is often skipped except if your macro needs special handling. Usually this is done to relax some of the default run-time error checking performed by the macro debugger.

 

For example, the number of loops performed when processing a macro is monitored to make sure that you do not accidentally go into an infinite loop. By default, the threshold is reached when going through the same loop 50 times. Obviously, if you are using a loop to go over all the dates of a year, you would include a compiler directive specifying that looping up to 366 times is OK, for this macro, as in the example below.

 

The keywords corresponding to compiler directives are INCLUDE_HOLIDAYS_LIST, INCLUDE_MACRO, INCLUDE_SAINTS_SET, MAX_NUM_ITERATIONS, MAX_STRING_LENGTH, RUNTIME_ERROR_HANDLING, and appear in bold purple color :

INCLUDE_HOLIDAYS_LIST a
MAX_STRING_LENGTH 1024
MAX_NUM_ITERATIONS 366 // need to loop over 1 year
var
   // declare some variables
begin
   // some code
   // ...
end

Note that:

 

There is no keyword at the beginning of this section (like there is for the input or var sections).

This section is optional, and even if you have it, you do not need to set values for all the compiler directives. Those for which you have not set a value will use the default value.

As always, you can insert comments anywhere; they are ignored by the compiler.

There is no equal sign "=" between each compiler directive and its value.

 

Compiler Directives can be overridden on a case-by-case basis in your script via the macros options compiler directives.

 


Topic 133200, last updated on 19-Apr-2020