| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" |
| 2 |
"http://www.w3.org/TR/REC-html40/loose.dtd"> |
| 3 |
|
| 4 |
<HTML> |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
<HEAD> |
| 31 |
<TITLE>2.9 Constraints On The Number of Instantiations</TITLE> |
| 32 |
<STYLE TYPE="text/css"> <!-- A {text-decoration: none} // --> </STYLE> |
| 33 |
</HEAD> |
| 34 |
<BODY BACKGROUND="binary/background.gif" |
| 35 |
BGCOLOR="#FFFFFF" |
| 36 |
TEXT="#000000" |
| 37 |
VLINK="#660000" |
| 38 |
LINK="#FF0000" |
| 39 |
ALINK="#CC0000"> |
| 40 |
|
| 41 |
<TABLE WIDTH="490"> |
| 42 |
<TR> |
| 43 |
<TD WIDTH="130" VALIGN="top"> |
| 44 |
<IMG SRC="binary/d_clear.gif" ALT="" WIDTH="130" HEIGHT="1"><BR> |
| 45 |
|
| 46 |
<FONT SIZE="2"> |
| 47 |
<BR> |
| 48 |
|
| 49 |
<A HREF="http://www.ross.net/" |
| 50 |
TARGET="rosshome" |
| 51 |
onClick="window.open('','rosshome','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 52 |
> |
| 53 |
<IMG SRC="binary/rossnet_logo.gif" |
| 54 |
WIDTH="64" HEIGHT="32" |
| 55 |
BORDER="0" ALT="RossNet" |
| 56 |
HSPACE="0" VSPACE="1"></A><BR> |
| 57 |
<BR> |
| 58 |
|
| 59 |
<A HREF="../index.shtml" |
| 60 |
TARGET="funnelweb" |
| 61 |
onClick="window.open('','funnelweb','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 62 |
> |
| 63 |
<IMG SRC="binary/linklogo.gif" |
| 64 |
WIDTH="64" HEIGHT="32" |
| 65 |
BORDER="0" ALT="FunnelWeb" |
| 66 |
HSPACE="0" VSPACE="1"></A><BR> |
| 67 |
<BR> |
| 68 |
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD BGCOLOR="#000000"> |
| 69 |
<A HREF="../reference/index.html" |
| 70 |
TARGET="funnelwebreference" |
| 71 |
onClick="window.open('','funnelwebreference','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 72 |
><FONT COLOR="#FFFFFF"><B>Reference</B></FONT></A><BR> |
| 73 |
<BR> |
| 74 |
<A HREF="../tutorial/index.html" |
| 75 |
TARGET="funnelwebtutorial" |
| 76 |
onClick="window.open('','funnelwebtutorial','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 77 |
><FONT COLOR="#FFFFFF"><B>Tutorial</B></FONT></A><BR> |
| 78 |
<BR> |
| 79 |
<A HREF="index.html"><FONT COLOR="#FFFFFF"><B>Developer</B></FONT></A><BR> |
| 80 |
<A HREF="compile.html"><FONT COLOR="#FFFFFF">1 Compile</FONT></A><BR> |
| 81 |
<A HREF="design.html"><FONT COLOR="#FFFFFF">2 Design</FONT></A><BR> |
| 82 |
<A HREF="implement.html"><FONT COLOR="#FFFFFF">3 Implement</FONT></A><BR> |
| 83 |
<A HREF="modify.html"><FONT COLOR="#FFFFFF">4 Modify</FONT></A><BR> |
| 84 |
<A HREF="misc.html"><FONT COLOR="#FFFFFF">5 Misc</FONT></A><BR> |
| 85 |
<A HREF="gpl.html"><FONT COLOR="#FFFFFF">6 Licence</FONT></A><BR> |
| 86 |
|
| 87 |
<BR> |
| 88 |
<A HREF="search.html"><FONT COLOR="#FFFFFF"><B>SEARCH</B></FONT></A><BR> |
| 89 |
</FONT> |
| 90 |
</TD></TR></TABLE> |
| 91 |
|
| 92 |
|
| 93 |
</TD> |
| 94 |
<TD WIDTH="360" VALIGN="top"> |
| 95 |
<FONT SIZE="3"> |
| 96 |
|
| 97 |
|
| 98 |
<A HREF="index.html"><IMG SRC="binary/title.gif" |
| 99 |
WIDTH="316" HEIGHT="24" |
| 100 |
BORDER="0" ALT="FunnelWeb Developer Manual" |
| 101 |
HSPACE="0" VSPACE="0"></A> |
| 102 |
<P><FONT SIZE="5">2.9 Constraints On The Number of Instantiations</FONT><BR> |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
<P>Experience with FunnelWeb V1 demonstrated the need |
| 107 |
to be able to specify in each macro definitions how many times |
| 108 |
the macro was expected to be called. FunnelWeb V1 |
| 109 |
generated an error if a macro is not used, but permited |
| 110 |
macros to be called more than once. This caused problems for |
| 111 |
macro libraries, many of whose macros were not called. |
| 112 |
|
| 113 |
<P>By default, FunnelWeb V3.0 requires that each macro |
| 114 |
(except for the ones attached to output files) be called |
| 115 |
exactly once. However, it also provides syntax that allows |
| 116 |
you to specify that a macro be allowed to be called |
| 117 |
zero times or many times. This allows a macro to be |
| 118 |
specified with the following permissible ranges of numbers |
| 119 |
of calls depending on the presence or absence of |
| 120 |
"<TT>@Z</TT>" and "<TT>@M</TT>": |
| 121 |
|
| 122 |
<P> |
| 123 |
<PRE> |
| 124 |
0..1 @$@<Sloth@>@Z... |
| 125 |
1 @$@<Sloth@>... |
| 126 |
1..n @$@<Sloth@>@M... |
| 127 |
0.....n @$@<Sloth@>@Z@M... |
| 128 |
</PRE> |
| 129 |
|
| 130 |
<P>The initial proposal for this syntax was to allow the |
| 131 |
user to insert zero, one, or both of <SAMP>@?</SAMP> and |
| 132 |
<SAMP>@M</SAMP> just after the <SAMP>@$</SAMP> of a macro |
| 133 |
definition. Here are some other ideas that were considered |
| 134 |
for the syntax of the calling number constraint. |
| 135 |
|
| 136 |
<P> |
| 137 |
<PRE> |
| 138 |
@?@M@$@<Slothy dogs@>@(@5@)==@{@- |
| 139 |
This is a short macro. |
| 140 |
With only a line or two@} |
| 141 |
|
| 142 |
@$@<Slothy dogs@>@?@M@(@5@)==@{@- |
| 143 |
This is a short macro. |
| 144 |
With only a line or two@} |
| 145 |
|
| 146 |
@$@<Slothy dogs@>@(@5@)@?@M==@{@- |
| 147 |
This is a short macro. |
| 148 |
With only a line or two@ |
| 149 |
</PRE> |
| 150 |
|
| 151 |
<P>The first form was rejected because it is a good visual |
| 152 |
rule to start all the macros with <SAMP>@$</SAMP>. The second |
| 153 |
form was rejected because it detaches the macro name from |
| 154 |
the parameter list, thus making it look less like a call, |
| 155 |
which is a desirable syntactic resonance. The third form is |
| 156 |
messy, but was adopted with the change that <SAMP>@?</SAMP> |
| 157 |
was changed to <SAMP>@M</SAMP>. |
| 158 |
|
| 159 |
<P>After some thought, it was decided that the third |
| 160 |
syntax was the best, but that the "<TT>@?</TT>" sequence be |
| 161 |
reserved for a possible future conditional facility. It was |
| 162 |
replaced by <SAMP>@Z</SAMP>. |
| 163 |
|
| 164 |
<P>Example of final syntax: |
| 165 |
|
| 166 |
<P> |
| 167 |
<PRE> |
| 168 |
@$@<Slothy dogs@>@(@5@)@Z@M+=@{@- |
| 169 |
This is a short macro. |
| 170 |
With only a line or two@} |
| 171 |
</PRE> |
| 172 |
|
| 173 |
|
| 174 |
<P> |
| 175 |
<TABLE WIDTH="100%"> |
| 176 |
<TR> |
| 177 |
<TD ALIGN="left" VALIGN="bottom"><A HREF="design_filenames.html"><IMG SRC="binary/fw_left.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Prev"></A></TD> |
| 178 |
<TD ALIGN="center" VALIGN="bottom"><A HREF="design.html"><IMG SRC="binary/fw_up.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Up"></A></TD> |
| 179 |
<TD ALIGN="right" VALIGN="bottom"><A HREF="design_docmac.html"><IMG SRC="binary/fw_right.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Next"></A></TD> |
| 180 |
</TR> |
| 181 |
</TABLE> |
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
<P> |
| 186 |
<HR> |
| 187 |
<FONT SIZE="2"> |
| 188 |
<A HREF="mailto:[email protected]">Webmaster</A> |
| 189 |
<A HREF="copyright.html">Copyright © Ross N. Williams 1992,1999. All rights reserved.</A><BR> |
| 190 |
</FONT> |
| 191 |
|
| 192 |
</FONT> |
| 193 |
</TD> |
| 194 |
</TR> |
| 195 |
</TABLE> |
| 196 |
|
| 197 |
|
| 198 |
</BODY> |
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
</HTML> |