| 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.10 Document Structure Vs Macro Structure</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.10 Document Structure Vs Macro Structure</FONT><BR> |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
<P>Once the decision was made to adopt five levels of |
| 109 |
headings as a document structure, the next issue was to |
| 110 |
decide how this document structure would relate to the macro |
| 111 |
structure. The issues to be addressed were as follows: |
| 112 |
|
| 113 |
<P> |
| 114 |
<UL> |
| 115 |
<LI> How should the hierarchical structure connect to the macro structure? |
| 116 |
<LI> How can backwards compatibility be achieved? Should it? |
| 117 |
<LI> Should the macros be cross referenced by section or by definition? |
| 118 |
<LI> Should nameless sections inherit macro names as headings? |
| 119 |
<LI> Should TeX macros be used to structure the document? |
| 120 |
</UL> |
| 121 |
|
| 122 |
<P>This page contains some thoughts on these issues: |
| 123 |
|
| 124 |
<P><BR><FONT SIZE="4"><STRONG>TeX File Document Basis</STRONG></FONT><BR> |
| 125 |
|
| 126 |
<P>One idea is to make the |
| 127 |
FunnelWeb input file an actual TeX <SAMP>.tex</SAMP> file |
| 128 |
which is directly typesettable, and use FunnelWeb to |
| 129 |
extract code from the TeX file to generate the product files. |
| 130 |
This approach was rejected because it is too typesetter |
| 131 |
dependent. Instead, the separate FunnelWeb format was adopted. |
| 132 |
|
| 133 |
<P><BR><FONT SIZE="4"><STRONG>Hierarchical Heading Numbering</STRONG></FONT><BR> |
| 134 |
|
| 135 |
<P>WEB and FunnelWeb V1 used two levels of section |
| 136 |
headings, but numbered them all sequentially. This is |
| 137 |
unacceptable in a fully hierarchical document which should |
| 138 |
have hierarchical section numbers such as 3.2.4. So |
| 139 |
FunnelWeb V3 uses hierarchical numbering for its |
| 140 |
headings in the documentation file. |
| 141 |
|
| 142 |
While hierarchical numbering is |
| 143 |
good for headings, it is messy and confusing when applied to |
| 144 |
macro names. In FunnelWeb V1's typeset output, each |
| 145 |
macro call has appended in square brackets the number of the |
| 146 |
section in which the macro is defined. However, hierarchical |
| 147 |
numbering would be somewhat messy. For example, in the |
| 148 |
typeset documentation, a macro call might look like. |
| 149 |
|
| 150 |
<P><PRE> |
| 151 |
Write out the output[6.7.4.3] |
| 152 |
</PRE> |
| 153 |
|
| 154 |
<P>Similarly, cross reference lists would be messy: |
| 155 |
|
| 156 |
<P> |
| 157 |
<PRE> |
| 158 |
This macro is used in 3.4.5, 1.2, 7.8.9, 7.4, 2.2.1.1. |
| 159 |
</PRE> |
| 160 |
|
| 161 |
<P>These problems were solved by numbering headings |
| 162 |
hierarchically and numbering the macros sequentially |
| 163 |
and independently. |
| 164 |
|
| 165 |
<P><BR><FONT SIZE="4"><STRONG>Input Format Matters Most</STRONG></FONT><BR> |
| 166 |
|
| 167 |
<P>In terms of legacy commitment, the critical issue is |
| 168 |
not how FunnelWeb formats programs for printing, but how the |
| 169 |
FunnelWeb <SAMP>.fw</SAMP> input file should be formatted. The |
| 170 |
typeset output can always be changed simply by fiddling with |
| 171 |
FunnelWeb's Weave module. However, as soon as the input |
| 172 |
syntax is defined, it will be used in dozens or hundreds of |
| 173 |
documents and it will be very difficult indeed to change it. |
| 174 |
Therefore, the important thing is to provide as sensible and |
| 175 |
expressive a <SAMP>.fw</SAMP> format as possible. |
| 176 |
|
| 177 |
<P>Thus, the issue of how to number headings and macros |
| 178 |
in the typeset documentation is not a serious architectural |
| 179 |
issue. |
| 180 |
|
| 181 |
<P><BR><FONT SIZE="4"><STRONG>Naming Sections</STRONG></FONT><BR> |
| 182 |
|
| 183 |
<P>How should sections be named? In many cases (especially |
| 184 |
in the case of high-level sections) the writer will provide |
| 185 |
an explicit name for a section. In other cases, provision of |
| 186 |
such a name will merely duplicate the name of the macro |
| 187 |
contained within the section. It therefore makes sense to |
| 188 |
allow the user to omit the name from a section, allowing Weave |
| 189 |
to name the section after the first macro definition in the |
| 190 |
section. If a macro is unnamed and there is no macro in the |
| 191 |
section, an error can be generated. |
| 192 |
|
| 193 |
<P><BR><FONT SIZE="4"><STRONG>Summary</STRONG></FONT><BR> |
| 194 |
|
| 195 |
<P>All these thoughts lead to the following scheme: |
| 196 |
|
| 197 |
<P> |
| 198 |
<UL> |
| 199 |
<LI> Documents will be hierarchically structured using <SAMP>@A</SAMP>, <SAMP>@B</SAMP> etc. |
| 200 |
<LI> Each section can be given a name <SAMP>@<...></SAMP>. |
| 201 |
<LI> Sections that do not have names inherit the name of their first macro. |
| 202 |
<LI> If a section does not have a name or a macro, it is erroneous. |
| 203 |
<LI> Sections will be numbered hierarchically either by FunnelWeb or by TeX. |
| 204 |
<LI> Macro body parts will be numbered sequentially by FunnelWeb and cross |
| 205 |
referenced by these numbers. |
| 206 |
</UL> |
| 207 |
|
| 208 |
<P>All this results in a system which: |
| 209 |
|
| 210 |
<P> |
| 211 |
<UL> |
| 212 |
|
| 213 |
<LI> Provides a hierarchical document structuring capability. |
| 214 |
<LI> Is typesetter independent. |
| 215 |
<LI> Does not require duplication between heading and macro names. |
| 216 |
<LI> Separates the heading and macro systems so that Weave can be configured |
| 217 |
at a later date to cross reference in different ways without requiring |
| 218 |
input files to be reworked. |
| 219 |
</UL> |
| 220 |
|
| 221 |
|
| 222 |
<P> |
| 223 |
<TABLE WIDTH="100%"> |
| 224 |
<TR> |
| 225 |
<TD ALIGN="left" VALIGN="bottom"><A HREF="design_numinst.html"><IMG SRC="binary/fw_left.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Prev"></A></TD> |
| 226 |
<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> |
| 227 |
<TD ALIGN="right" VALIGN="bottom"><A HREF="design_diagnostics.html"><IMG SRC="binary/fw_right.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Next"></A></TD> |
| 228 |
</TR> |
| 229 |
</TABLE> |
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
<P> |
| 234 |
<HR> |
| 235 |
<FONT SIZE="2"> |
| 236 |
<A HREF="mailto:[email protected]">Webmaster</A> |
| 237 |
<A HREF="copyright.html">Copyright © Ross N. Williams 1992,1999. All rights reserved.</A><BR> |
| 238 |
</FONT> |
| 239 |
|
| 240 |
</FONT> |
| 241 |
</TD> |
| 242 |
</TR> |
| 243 |
</TABLE> |
| 244 |
|
| 245 |
|
| 246 |
</BODY> |
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
</HTML> |