| 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.8 File Name Management</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.8 File Name Management</FONT><BR> |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
<P>File names present a host of problems for a program |
| 107 |
like FunnelWeb. First, FunnelWeb can generate so many |
| 108 |
different kinds of files that conventions must be adopted to |
| 109 |
prevent their names from colliding. Second, the |
| 110 |
constraints on file names, and even the structure of file |
| 111 |
names themselves varies considerably from machine to |
| 112 |
machine. These two problems have combined to result in the |
| 113 |
sophisticated and rather complicated way in which |
| 114 |
FunnelWeb handles filenames. |
| 115 |
|
| 116 |
<P>To summarize, the three problems are: |
| 117 |
|
| 118 |
<P> |
| 119 |
<OL> |
| 120 |
<LI> What filename extensions should be chosen for various kinds of file? |
| 121 |
<LI> What filename inheritance should take place? |
| 122 |
<LI> How should FunnelWeb cope with the variations in filename structure |
| 123 |
between platforms? |
| 124 |
</OL> |
| 125 |
|
| 126 |
<P>These problems are addressed in the following sections. |
| 127 |
|
| 128 |
<P><BR><FONT SIZE="4"><STRONG>Filename Extensions</STRONG></FONT><BR> |
| 129 |
|
| 130 |
|
| 131 |
<P>FunnelWeb is capable of reading and writing a variety |
| 132 |
of different kinds of files. In particular, FunnelWeb must |
| 133 |
often operate in an environment where the same information |
| 134 |
is stored in many forms (e.g. prog.fw, prog.c, proc.exe). |
| 135 |
File extensions are an essential tool in managing this |
| 136 |
situation. The default filename extensions chosen for |
| 137 |
FunnelWeb are: |
| 138 |
|
| 139 |
<P> |
| 140 |
<PRE> |
| 141 |
FunnelWeb : .fw |
| 142 |
Product : None |
| 143 |
Documentation : .tex or .html |
| 144 |
Listing : .lis |
| 145 |
Journal : .jrn |
| 146 |
</PRE> |
| 147 |
|
| 148 |
<P>Lowercase will be used in systems that are case |
| 149 |
sensitive. |
| 150 |
|
| 151 |
<P><BR><FONT SIZE="4"><STRONG>Filename Inheritance</STRONG></FONT><BR> |
| 152 |
|
| 153 |
|
| 154 |
<P>Inheritance in filenames refers to how input and output |
| 155 |
files inherit parts of their name from other filenames and |
| 156 |
their environment. For example if the command |
| 157 |
|
| 158 |
<P> |
| 159 |
<PRE> |
| 160 |
fw sloth +J +L +T |
| 161 |
</PRE> |
| 162 |
|
| 163 |
<P>were issued, you would expect to see output files |
| 164 |
<SAMP>sloth.jrn</SAMP>, <SAMP>sloth.lis</SAMP>, and |
| 165 |
<SAMP>sloth.tex</SAMP>. The output file names have inherited |
| 166 |
the "<TT>sloth</TT>" part of the argument. In fact, |
| 167 |
FunnelWeb implements a comprehensive filename inheritance |
| 168 |
scheme, which is shown in the following table. Each filename |
| 169 |
is built up by starting at the top of its column in the |
| 170 |
table and working down the column, inheriting filename |
| 171 |
fields (directory, name, extension) that are absent at that |
| 172 |
point. |
| 173 |
|
| 174 |
<P> |
| 175 |
<CENTER> |
| 176 |
<TABLE BORDER="3"> |
| 177 |
<TR> |
| 178 |
<TD> </TD> |
| 179 |
<TD> <STRONG>Script</STRONG> </TD> |
| 180 |
<TD> <STRONG>Input</STRONG> </TD> |
| 181 |
<TD> <STRONG>Include</STRONG> </TD> |
| 182 |
<TD> <STRONG>Journal</STRONG> </TD> |
| 183 |
<TD> <STRONG>List</STRONG> </TD> |
| 184 |
<TD> <STRONG>Document</STRONG> </TD> |
| 185 |
<TD> <STRONG>Product</STRONG> </TD> |
| 186 |
</TR> |
| 187 |
<TR> |
| 188 |
<TD>1 </TD> |
| 189 |
<TD> </TD> |
| 190 |
<TD> </TD> |
| 191 |
<TD> <SAMP>@i</SAMP> </TD> |
| 192 |
<TD> </TD> |
| 193 |
<TD> </TD> |
| 194 |
<TD> </TD> |
| 195 |
<TD> <SAMP>@o</SAMP> </TD> |
| 196 |
</TR> |
| 197 |
<TR> |
| 198 |
<TD>2 </TD> |
| 199 |
<TD> <SAMP>+x</SAMP> </TD> |
| 200 |
<TD> <SAMP>+f</SAMP> </TD> |
| 201 |
<TD> <SAMP>+i</SAMP> </TD> |
| 202 |
<TD> <SAMP>+j</SAMP> </TD> |
| 203 |
<TD> <SAMP>+l</SAMP> </TD> |
| 204 |
<TD> <SAMP>+t</SAMP> </TD> |
| 205 |
<TD> <SAMP>+o</SAMP> </TD> |
| 206 |
</TR> |
| 207 |
<TR> |
| 208 |
<TD>3 </TD> |
| 209 |
<TD> "<TT>.fws</TT>" </TD> |
| 210 |
<TD> "<TT>.fw</TT>" </TD> |
| 211 |
<TD> "<TT>.fwi</TT>" </TD> |
| 212 |
<TD> "<TT>.jrn</TT>" </TD> |
| 213 |
<TD> "<TT>.lis</TT>" </TD> |
| 214 |
<TD> "<TT>.tex</TT>" </TD> |
| 215 |
<TD> </TD> |
| 216 |
</TR> |
| 217 |
<TR> |
| 218 |
<TD>4 </TD> |
| 219 |
<TD> </TD> |
| 220 |
<TD> </TD> |
| 221 |
<TD> <SAMP>+f</SAMP> </TD> |
| 222 |
<TD> <SAMP>+f</SAMP> </TD> |
| 223 |
<TD> <SAMP>+f</SAMP> </TD> |
| 224 |
<TD> <SAMP>+f</SAMP> </TD> |
| 225 |
<TD> </TD> |
| 226 |
</TR> |
| 227 |
<TR> |
| 228 |
<TD>5 </TD> |
| 229 |
<TD> DefDir </TD> |
| 230 |
<TD> Defdir </TD> |
| 231 |
<TD> Defdir </TD> |
| 232 |
<TD> Defdir </TD> |
| 233 |
<TD> Defdir </TD> |
| 234 |
<TD> Defdir </TD> |
| 235 |
<TD> Defdir </TD> |
| 236 |
</TR> |
| 237 |
</TABLE> |
| 238 |
</CENTER> |
| 239 |
|
| 240 |
<P>The following notes explain the table. |
| 241 |
|
| 242 |
<P><OL> |
| 243 |
|
| 244 |
<LI> Level 1 has the highest priority because it is a |
| 245 |
direct specification by the user. |
| 246 |
|
| 247 |
<LI> Level 2 comes next because this is also a direct |
| 248 |
specification from the user on the command line. |
| 249 |
|
| 250 |
<LI> Level 3 provides the default file extensions. |
| 251 |
Product files do not inherit an extension. |
| 252 |
|
| 253 |
<LI> Level 5 is built into most operating systems' |
| 254 |
file specification systems. If you specify file |
| 255 |
"<TT>x.y</TT>", it is taken to mean on the default disk in |
| 256 |
the default directory. |
| 257 |
|
| 258 |
<LI> Level 4 looks straightforward, but secretly |
| 259 |
conceals a difficult design decision. By the time we get |
| 260 |
down to this level of inheritance, we know for sure that the |
| 261 |
filename has already picked up a file extension. So all that |
| 262 |
is left to inherit is the path and the filename proper. |
| 263 |
Obviously we have to inherit the filename proper (e.g. |
| 264 |
<SAMP>sloth</SAMP> in <SAMP>sloth.tex</SAMP>), but should we |
| 265 |
inherit the input file path? If we do inherit the input file |
| 266 |
path, files will be placed in the same directory as the |
| 267 |
input file. If we don't inherit the input file path, files |
| 268 |
will be placed in the current directory. The choice made is |
| 269 |
to send all the logging type files into the same directory |
| 270 |
as the input file. This means, for example, that |
| 271 |
<SAMP>sloth.lis</SAMP> and <SAMP>sloth.tex</SAMP> will generally |
| 272 |
land in the same directory as <SAMP>sloth.fw</SAMP>. However, |
| 273 |
product files are sent to the default directory (if not |
| 274 |
earlier specified), as this is where the action is. In |
| 275 |
normal use, the main output of FunnelWeb will be product |
| 276 |
files, and so the user will expect them to appear in the |
| 277 |
current directory by default. |
| 278 |
|
| 279 |
</OL> |
| 280 |
|
| 281 |
<P><BR><FONT SIZE="4"><STRONG>Portable Structure of File Names</STRONG></FONT><BR> |
| 282 |
|
| 283 |
|
| 284 |
<P>Another problem with file names is the variation of |
| 285 |
their structure between environments. Here are examples of |
| 286 |
some of the formats that prevail: |
| 287 |
|
| 288 |
<P> |
| 289 |
<PRE> |
| 290 |
UNIX /device/dir1/dir2/name |
| 291 |
VMS node::device:[dir1.dir2]name.ext;vn |
| 292 |
MSDOS device:\dir1\dir2\name.ext |
| 293 |
MAC device:dir1:dir2:name |
| 294 |
</PRE> |
| 295 |
|
| 296 |
<P>The solution to dealing with these different formats is |
| 297 |
to classify them as non-portable and hide the functions that |
| 298 |
manipulate them in the machine-specific module of FunnelWeb. |
| 299 |
Luckily there are not many such functions. |
| 300 |
|
| 301 |
<P>The main problem is coping with file systems that do |
| 302 |
not explicitly support file extensions. With so many |
| 303 |
possible input and output files, FunnelWeb all but needs |
| 304 |
such extensions. Machines that do not support them pose |
| 305 |
difficult design decisions. If the user specifies |
| 306 |
"<TT>sloth</TT>" as an input file on such a |
| 307 |
non-extension-supporting system, should FunnelWeb look for |
| 308 |
<SAMP>sloth</SAMP> or <SAMP>sloth.fw</SAMP>? If the user specifies |
| 309 |
<SAMP>walrus</SAMP> as a listing file, should it generate |
| 310 |
<SAMP>walrus</SAMP> or <SAMP>walrus.lis</SAMP>? |
| 311 |
|
| 312 |
<P>Some possible solutions are: |
| 313 |
|
| 314 |
<OL> |
| 315 |
|
| 316 |
<LI> Regard the filename <SAMP>sloth</SAMP> as having an |
| 317 |
empty extension. It will then default to <SAMP>sloth.fw</SAMP>. |
| 318 |
|
| 319 |
<LI> Regard the filename <SAMP>sloth</SAMP> as having a |
| 320 |
blank but full extension. That is, it cannot be overwritten |
| 321 |
by inheritance, but it remains blank. |
| 322 |
|
| 323 |
<LI> Provide an extra syntactic mechanism to allow the |
| 324 |
user to specify one or other of the two options above. |
| 325 |
|
| 326 |
</OL> |
| 327 |
|
| 328 |
<P>The solution adopted in FunnelWeb is the first option. |
| 329 |
Use of FunnelWeb results in lots of files lying around |
| 330 |
(e.g. <SAMP>sloth.lis</SAMP>) and it is hard to see how the |
| 331 |
user will cope with them all without some kind of naming |
| 332 |
discipline. If a naming discipline has to be used, it might |
| 333 |
as well be the FunnelWeb one. |
| 334 |
|
| 335 |
<P>Thus the names of all files read and written by |
| 336 |
FunnelWeb will have a file extension of from zero to three |
| 337 |
letters separated from the rest of the filename by a |
| 338 |
"<TT>.</TT>". |
| 339 |
|
| 340 |
<P>The only exception is product files, whose extension is |
| 341 |
left undefined. Product files need not contain a |
| 342 |
"<TT>.</TT>" and a file extension. |
| 343 |
|
| 344 |
|
| 345 |
<P> |
| 346 |
<TABLE WIDTH="100%"> |
| 347 |
<TR> |
| 348 |
<TD ALIGN="left" VALIGN="bottom"><A HREF="design_testing.html"><IMG SRC="binary/fw_left.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Prev"></A></TD> |
| 349 |
<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> |
| 350 |
<TD ALIGN="right" VALIGN="bottom"><A HREF="design_numinst.html"><IMG SRC="binary/fw_right.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Next"></A></TD> |
| 351 |
</TR> |
| 352 |
</TABLE> |
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
<P> |
| 357 |
<HR> |
| 358 |
<FONT SIZE="2"> |
| 359 |
<A HREF="mailto:[email protected]">Webmaster</A> |
| 360 |
<A HREF="copyright.html">Copyright © Ross N. Williams 1992,1999. All rights reserved.</A><BR> |
| 361 |
</FONT> |
| 362 |
|
| 363 |
</FONT> |
| 364 |
</TD> |
| 365 |
</TR> |
| 366 |
</TABLE> |
| 367 |
|
| 368 |
|
| 369 |
</BODY> |
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
</HTML> |