Please enable JavaScript to view this site.

 

The purpose of this compiler directive is to specify that a macro will specifically specifically refer to another macro token index.

 

There are 2 ways for this to occur :

 

The macro includes a call to EvalToken or PeekTokenValue where the token being evaluated is a macro token.

The value of sRESULT is a macro token.

 

Consider the example below (note that the reference to each macro index is made on a separate line) :

INCLUDE_MACRO 8
INCLUDE_MACRO 9
var
   sMacro
begin
   sMacro = EvalToken(n_TokenDate, '[1*8_ddd]')
   if sMacro <> ''
      sRESULT = ''
   else
      sRESULT = '[1*9_ddd]'
   endif
end

If there are no tokens in the GridTemplate which refer to macro indices of 8 and 9 then Q++Studio will not know that you need to specify macro options for indices 8 and 9 and will not be able to issue a design-time message warning that you have not defined them. By using the INCLUDE_MACRO directive above, you are telling Q++Studio that this macro will always require Macro Options for indices 8 and 9, and therefore Q++Studio will be able to warn any user in that uses this macro.

 

The above example was one where the reference to a macro index was explicit (the above macro always uses indices 8 and 9). There are cases where the macro index used cannot be determined from the macro itself, because the macro index used is one of the input variables of the macro.

input
   nMacroIndex
var
begin
   sRESULT = '[1*' + IntToStr(nMacroIndex) + '_ddd]'
end

In those cases, you should not set the INCLUDE_MACRO directive in the macro code, as in the first example, but rather as part of the macros options of the script that uses this macro.

 


Topic 110063, last updated on 01-Aug-2020