Previous:User Defined Macros   Main Index   Next:Invoking Macros



The #macro Directive

The syntax for declaring a macro is:

MACRO_DEFINITION:
#macro IDENTIFIER ( [PARAM_IDENT] [, PARAM_IDENT]... ) TOKENS... #end

Where IDENTIFIER is the name of the macro and PARAM_IDENTs are a list of zero or more formal parameter identifiers separated by commas and enclosed by parentheses. The parentheses are required even if no parameters are specified.

The TOKENS are any number of POV-Ray keyword, identifiers, or punctuation marks which are the body of the macro. The body of the macro may contain almost any POV-Ray syntax items you desire. It is terminated my the #end directive. Note however that any conditional directives such as #if...#end, #while...#end, etc. must be fully nested inside or outside the macro so that the corresponding #end directives pair-up properly. Also you may not nest macro declarations.

A macro must be declared before it is invoked. All macro names are global in scope and permanent in duration. You may redefine a macro by another #macro directive with the same name. The previous definition is lost. Macro names respond to #ifdef, #ifndef, and #undef directives. See "The #ifdef and #ifndef Directives" and "Destroying Identifiers with #undef".



Previous:User Defined Macros   Main Index   Next:Invoking Macros