| 1 |
|
| 2 |
<HTML> |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
<HEAD> |
| 29 |
<TITLE>4.5 Section Directive</TITLE> |
| 30 |
<STYLE TYPE="text/css"> <!-- A {text-decoration: none} // --> </STYLE> |
| 31 |
</HEAD> |
| 32 |
<BODY BACKGROUND="binary/background.gif" |
| 33 |
BGCOLOR="#FFFFFF" |
| 34 |
TEXT="#000000" |
| 35 |
VLINK="#660000" |
| 36 |
LINK="#FF0000" |
| 37 |
ALINK="#CC0000"> |
| 38 |
|
| 39 |
<TABLE WIDTH="490"> |
| 40 |
<TR> |
| 41 |
<TD WIDTH="130" VALIGN="top"> |
| 42 |
<IMG SRC="binary/d_clear.gif" ALT="" WIDTH="130" HEIGHT="1"><BR> |
| 43 |
|
| 44 |
<FONT SIZE="2"> |
| 45 |
<BR> |
| 46 |
|
| 47 |
<A HREF="http://www.ross.net/" |
| 48 |
TARGET="rosshome" |
| 49 |
onClick="window.open('','rosshome','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 50 |
> |
| 51 |
<IMG SRC="binary/rossnet_logo.gif" |
| 52 |
WIDTH="64" HEIGHT="32" |
| 53 |
BORDER="0" ALT="RossNet" |
| 54 |
HSPACE="0" VSPACE="1"></A><BR> |
| 55 |
<BR> |
| 56 |
|
| 57 |
<A HREF="../index.shtml" |
| 58 |
TARGET="funnelweb" |
| 59 |
onClick="window.open('','funnelweb','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 60 |
> |
| 61 |
<IMG SRC="binary/linklogo.gif" |
| 62 |
WIDTH="64" HEIGHT="32" |
| 63 |
BORDER="0" ALT="FunnelWeb" |
| 64 |
HSPACE="0" VSPACE="1"></A><BR> |
| 65 |
<BR> |
| 66 |
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD BGCOLOR="#000000"> |
| 67 |
<A HREF="../tutorial/index.html" |
| 68 |
TARGET="funnelwebtutorial" |
| 69 |
onClick="window.open('','funnelwebtutorial','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 70 |
><FONT COLOR="#FFFFFF"><B>Tutorial</B></FONT></A><BR> |
| 71 |
<BR> |
| 72 |
<A HREF="../developer/index.html" |
| 73 |
TARGET="funnelwebdeveloper" |
| 74 |
onClick="window.open('','funnelwebdeveloper','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 75 |
><FONT COLOR="#FFFFFF"><B>Developer</B></FONT></A><BR> |
| 76 |
<BR> |
| 77 |
<A HREF="index.html"><FONT COLOR="#FFFFFF"><B>Reference</B></FONT></A><BR> |
| 78 |
<A HREF="intro.html"><FONT COLOR="#FFFFFF">1 Introduction</FONT></A><BR> |
| 79 |
<A HREF="interface.html"><FONT COLOR="#FFFFFF">2 Interface</FONT></A><BR> |
| 80 |
<A HREF="scanner.html"><FONT COLOR="#FFFFFF">3 Scanner</FONT></A><BR> |
| 81 |
<A HREF="parser.html"><FONT COLOR="#FFFFFF">4 Parser</FONT></A><BR> |
| 82 |
<A HREF="analyser.html"><FONT COLOR="#FFFFFF">5 Analyser</FONT></A><BR> |
| 83 |
<A HREF="tangle.html"><FONT COLOR="#FFFFFF">6 Tangle</FONT></A><BR> |
| 84 |
<A HREF="weave.html"><FONT COLOR="#FFFFFF">7 Weave</FONT></A><BR> |
| 85 |
<A HREF="shell.html"><FONT COLOR="#FFFFFF">8 Shell</FONT></A><BR> |
| 86 |
<A HREF="commands.html"><FONT COLOR="#FFFFFF">9 Commands</FONT></A><BR> |
| 87 |
<A HREF="glossary.html"><FONT COLOR="#FFFFFF">10 Glossary</FONT></A><BR> |
| 88 |
<A HREF="references.html"><FONT COLOR="#FFFFFF">11 References</FONT></A><BR> |
| 89 |
|
| 90 |
<BR> |
| 91 |
<A HREF="search.html"><FONT COLOR="#FFFFFF"><B>SEARCH</B></FONT></A><BR> |
| 92 |
</FONT> |
| 93 |
</TD></TR></TABLE> |
| 94 |
|
| 95 |
|
| 96 |
</TD> |
| 97 |
<TD WIDTH="360" VALIGN="top"> |
| 98 |
<FONT SIZE="3"> |
| 99 |
|
| 100 |
|
| 101 |
<A HREF="index.html"><IMG SRC="binary/title.gif" |
| 102 |
WIDTH="316" HEIGHT="24" |
| 103 |
BORDER="0" ALT="FunnelWeb Reference Manual" |
| 104 |
HSPACE="0" VSPACE="0"></A> |
| 105 |
<P><FONT SIZE="5">4.5 Section Directive</FONT><BR> |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
<P>The section directive provides a way for the user to |
| 110 |
structure the program and documentation into a hierarchical |
| 111 |
tree structure, just as in most |
| 112 |
large documents. A section construct consists of a |
| 113 |
case-insensitive identifying letter, which determines the |
| 114 |
absolute level of the section in the document, and an |
| 115 |
optional section name, which has exactly the same syntax as |
| 116 |
a macro name. |
| 117 |
|
| 118 |
<P> |
| 119 |
<PRE> |
| 120 |
section = "@" levelchar [name] |
| 121 |
levelchar = "A" | "B" | "C" | "D" | "E" | |
| 122 |
"a" | "b" | "c" | "d" | "e" |
| 123 |
</PRE> |
| 124 |
|
| 125 |
<P>The section construct is not quite "inline", as |
| 126 |
it must appear only at the start of a line. However, unlike |
| 127 |
the "<TT>@i</TT>", "<TT>@p</TT>", and "<TT>@t</TT>" |
| 128 |
constructs, it does not consume the remainder of the line |
| 129 |
(although it would be silly to place anything on the same |
| 130 |
line anyway). |
| 131 |
|
| 132 |
<P>FunnelWeb provides five levels of sections, ranging |
| 133 |
from the highest level of <SAMP>A</SAMP> (like a |
| 134 |
LaTeX chapter) to the lowest level of |
| 135 |
<SAMP>E</SAMP> (like a LaTeX subsubsubsection). FunnelWeb |
| 136 |
input files need not contain any sections at all, but if |
| 137 |
they do, the first section must be at level <SAMP>A</SAMP>, and |
| 138 |
following sections must not skip hierarchical levels |
| 139 |
(e.g. an <SAMP>@E</SAMP> cannot follow an <SAMP>@C</SAMP>). |
| 140 |
FunnelWeb generates an error if a level is skipped. |
| 141 |
|
| 142 |
<P>All section <I>must</I> have names associated with |
| 143 |
them, but for convenience, the section name is optional if |
| 144 |
the section contains one or more macro definitions (i.e. at |
| 145 |
least one macro definition appears between the section |
| 146 |
construct in question and the next section construct in the |
| 147 |
input file.). In this case, the section <I>inherits</I> |
| 148 |
the name of the first macro defined in the section. This |
| 149 |
feature streamlines the input file, avoiding duplicate name |
| 150 |
inconsistencies. |
| 151 |
|
| 152 |
<P>Any sequence of printable characters can be used in the |
| 153 |
section name, even the target |
| 154 |
typesetter's escape sequence (e.g. in TeX, |
| 155 |
"<TT>\</TT>"). |
| 156 |
|
| 157 |
<P>The following example demonstrates the section |
| 158 |
construct. |
| 159 |
|
| 160 |
<P> |
| 161 |
<PRE> |
| 162 |
@A@<Life Simulation@> |
| 163 |
|
| 164 |
This is the main simulation module for planet |
| 165 |
earth, simulated down to the molecular level. This |
| 166 |
is a REALLY big program. I mean really big. I |
| 167 |
mean, if you thought the X-Windows source code was |
| 168 |
big, you're in for a shock... |
| 169 |
|
| 170 |
@B We start by looking at the code for six legged |
| 171 |
stick insects as they form a good example of a |
| 172 |
typical object-oriented animal implementation. |
| 173 |
|
| 174 |
@$@<Six Legged Stick Insects@>@{@- |
| 175 |
slsi.creep; slsi.crawl; slsi.creep;@} |
| 176 |
</PRE> |
| 177 |
|
| 178 |
<P>In the above example, the name for the level A |
| 179 |
section is provided explicitly, while the name for |
| 180 |
the level B section will be inherited from the |
| 181 |
macro name. |
| 182 |
|
| 183 |
|
| 184 |
<P> |
| 185 |
<TABLE WIDTH="100%"> |
| 186 |
<TR> |
| 187 |
<TD ALIGN="left" VALIGN="bottom"><A HREF="parser_type.html"><IMG SRC="binary/fw_left.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Prev"></A></TD> |
| 188 |
<TD ALIGN="center" VALIGN="bottom"><A HREF="parser.html"><IMG SRC="binary/fw_up.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Up"></A></TD> |
| 189 |
<TD ALIGN="right" VALIGN="bottom"><A HREF="parser_type_literal.html"><IMG SRC="binary/fw_right.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Next"></A></TD> |
| 190 |
</TR> |
| 191 |
</TABLE> |
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
<P> |
| 196 |
<HR> |
| 197 |
<FONT SIZE="2"> |
| 198 |
<A HREF="mailto:[email protected]">Webmaster</A> |
| 199 |
<A HREF="copyright.html">Copyright © Ross N. Williams 1992,1999. All rights reserved.</A><BR> |
| 200 |
</FONT> |
| 201 |
|
| 202 |
</FONT> |
| 203 |
</TD> |
| 204 |
</TR> |
| 205 |
</TABLE> |
| 206 |
|
| 207 |
|
| 208 |
</FONT> |
| 209 |
</BODY> |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
</HTML> |