4.8 Macros
4.8 Macros
The third category of construct appearing at the highest syntactic level in a
FunnelWeb input file is the macro definition. A macro definition binds a
Tutorial
unique
macro name
to a
macro body
containing an
expression
consisting of text, calls to other macros, and formal parameters. The
Developer
syntax for a macro definition is as follows:
Reference
macro = ("@O" | "@$") name [formal_parameter_list]
1 Introduction
["@Z"] ["@M"] { "@L" } ["==" | "+="]
2 Interface
"@{" expression "@}"
3 Scanner
The complexity of the macro definition syntax is mostly to enable the user
4 Parser
to attach various attributes to the macro. If the user chooses @O, then the
5 Analyser
macro cannot be called, but is instead attached to a product file. If the user
6 Tangle
chooses @$, then the macro is an ordinary macro definition that is not
7 Weave
attached to a file. Here are some example macro definitions.
8 Shell
9 Commands
@O@@{This is an @.@}
10 Glossary
@$@@M@{swan@}
11 References
SEARCH
Number Of Invocations Constraint
By default, a non file macro must be invoked exactly once by one other
macro. Macros that aren t are flagged with errors by the FunnelWeb
analyser. However, if the user uses the @Z sequence in the macro
definition, the macro is then permitted to be invoked zero times, as well as
once. Similarly, if the user uses the @M sequence in the macro definition,
the macro is permitted to be called many times as well as once. If both @Z
and @M are present then the macro is permitted to be invoked zero, one,
or many times.
The purpose of enforcing the default "exactly one call" rule is to flag
pieces of code that the user may have defined in a macro but not hooked
into the rest of the program. Experience shows that this is a common error.
Similarly, it can be dangerous to multiply invoke a macro intended to be
invoked only once. For example, it may be dangerous to invoke a scrap of
non idempotent initialization code in two different parts of the main
function of a program! However, FunnelWeb will not generate an error if
a macro without @M is called by another macro that is called more than
once.
http://www.ross.net/funnelweb/reference/parser_macros.html (1 of 3) [3/3/2000 10:46:46 PM]
Actions web hosting footer
Our web partners:
Web Hosting PHP
Jsp Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Web Hosting
Cheap Web Hosting
Java Hosting
Cheapest Hosting
Quality Web Templates
Best Web Templates
Web Design Templates
Java Web Hosting
Cheap Hosting
Cheap Web Hosting
Jsp Web Hosting
Tomcat Web Hosting
Quality Web Hosting
Best Web Hosting
Java Web Hosting
Actionswebhosting.com Business web hosting
division of Vision Web Hosting Inc. All rights reserved.