Tutorial Developer Reference 1 Introduction 2 Interface 3 Scanner 4 Parser 5 Analyser 6 Tangle 7 Weave 8 Shell 9 Commands 10 Glossary 11 References SEARCH

4.12 Macro Calls

A macro call consists of a name optionally followed by an actual parameter list. The number of parameters in the actual parameter list must be the same as the number of formal parameters specified in the definition of the macro. If the macro has no formal parameter list, its call must have no actual parameter list.

    macro_call = name [actual_parameter_list]
    actual_parameter_list =
          "@(" actpar { "@," actpar } "@)"
    actpar     = expression |
                 ( whitespace "@""" expression
                   "@""" whitespace )
    whitespace = {" " | eol }

FunnelWeb allows parameters to be passed directly, or delimited by special double quotes. Each form is useful under different circumstances. Direct specification is useful where the parameters are short and can be all placed on one line. Double quoted parameters allow whitespace on either side (that is not considered part of the parameter) and are useful for laying out rather messy parameters. Here are examples of the two forms.

    @<Generic Loop@>@(
       @"x:=1;@"  @,
       @"x<=10;@" @,
       @"print "x=%u, x^2=%u",x,x*x;
       x:=x+1;@+@"
    @)

    @<Colours@>@(red@,green@,blue@,yellow@)

The two forms may be mixed within the same parameter list.

Experience has shown that, in most FunnelWeb files, the vast majority of macros have no parameters.

Webmaster Copyright © Ross N. Williams 1992,1999. All rights reserved.