INCLUDE_MACRO

Navigation:  Appendices > Macro Language > Code Structure > Compiler Directives >

INCLUDE_MACRO

Previous pageReturn to chapter overviewNext page

The purpose of this directive is to tell Q++ 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 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++ will not know that you need to specify Macro Options for indices 8 and 9 and will not be able to issue a message warning you that you have not defined them. By using the INCLUDE_MACRO directive above, you are telling Q++ that this macro will always require Macro Options for indices 8 and 9, and therefore Q++ 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 updated on 28-Jul-2002.
Topic URL: http://www.qppstudio.net/webhelp/index.html?include_macro.htm