1 2 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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<!--
***********************************************************************
FUNNELWEB MANUAL WEB PAGE
=========================
Copyright (c) Ross N. Williams 1992,1999. All rights reserved.
Permission is granted to redistribute and use this manual in
any medium, with or without modification, provided that all
notices (including, without limitation, the copyright
notice, this permission notice, any record of modification,
and all legal notices) are preserved on all copies, that all
modifications are clearly marked, and that modified versions
are not represented as the original version unless all the
modifications since the manual's original release by Ross N.
Williams (www.ross.net) consist of translations or other
transformations that alter only the manual's form, not its
content. THIS MANUAL IS PROVIDED "AS IS" AND WITHOUT ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
FITNESS FOR A PARTICULAR PURPOSE. TO THE EXTENT PERMITTED BY
LAW THERE IS ABSOLUTELY NO WARRANTY.
***********************************************************************
-->
<HEAD>
<TITLE>2.8 File Name Management</TITLE>
<STYLE TYPE="text/css"> <!-- A {text-decoration: none} // --> </STYLE>
</HEAD>
<BODY BACKGROUND="binary/background.gif"
BGCOLOR="#FFFFFF"
TEXT="#000000"
VLINK="#660000"
LINK="#FF0000"
ALINK="#CC0000">
<TABLE WIDTH="490">
<TR>
<TD WIDTH="130" VALIGN="top">
<IMG SRC="binary/d_clear.gif" ALT="" WIDTH="130" HEIGHT="1"><BR>
<FONT SIZE="2">
<BR>
<A HREF="http://www.ross.net/"
TARGET="rosshome"
onClick="window.open('','rosshome','location,status,menubar,scrollbars,resizable',false).focus(); return true;"
>
<IMG SRC="binary/rossnet_logo.gif"
WIDTH="64" HEIGHT="32"
BORDER="0" ALT="RossNet"
HSPACE="0" VSPACE="1"></A><BR>
<BR>
<A HREF="../index.shtml"
TARGET="funnelweb"
onClick="window.open('','funnelweb','location,status,menubar,scrollbars,resizable',false).focus(); return true;"
>
<IMG SRC="binary/linklogo.gif"
WIDTH="64" HEIGHT="32"
BORDER="0" ALT="FunnelWeb"
HSPACE="0" VSPACE="1"></A><BR>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD BGCOLOR="#000000">
<A HREF="../reference/index.html"
TARGET="funnelwebreference"
onClick="window.open('','funnelwebreference','location,status,menubar,scrollbars,resizable',false).focus(); return true;"
><FONT COLOR="#FFFFFF"><B>Reference</B></FONT></A><BR>
<BR>
<A HREF="../tutorial/index.html"
TARGET="funnelwebtutorial"
onClick="window.open('','funnelwebtutorial','location,status,menubar,scrollbars,resizable',false).focus(); return true;"
><FONT COLOR="#FFFFFF"><B>Tutorial</B></FONT></A><BR>
<BR>
<A HREF="index.html"><FONT COLOR="#FFFFFF"><B>Developer</B></FONT></A><BR>
<A HREF="compile.html"><FONT COLOR="#FFFFFF">1 Compile</FONT></A><BR>
<A HREF="design.html"><FONT COLOR="#FFFFFF">2 Design</FONT></A><BR>
<A HREF="implement.html"><FONT COLOR="#FFFFFF">3 Implement</FONT></A><BR>
<A HREF="modify.html"><FONT COLOR="#FFFFFF">4 Modify</FONT></A><BR>
<A HREF="misc.html"><FONT COLOR="#FFFFFF">5 Misc</FONT></A><BR>
<A HREF="gpl.html"><FONT COLOR="#FFFFFF">6 Licence</FONT></A><BR>
<BR>
<A HREF="search.html"><FONT COLOR="#FFFFFF"><B>SEARCH</B></FONT></A><BR>
</FONT>
</TD></TR></TABLE>
</TD>
<TD WIDTH="360" VALIGN="top">
<FONT SIZE="3">
<A HREF="index.html"><IMG SRC="binary/title.gif"
WIDTH="316" HEIGHT="24"
BORDER="0" ALT="FunnelWeb Developer Manual"
HSPACE="0" VSPACE="0"></A>
<P><FONT SIZE="5">2.8 File Name Management</FONT><BR>
<P>File names present a host of problems for a program
like FunnelWeb. First, FunnelWeb can generate so many
different kinds of files that conventions must be adopted to
prevent their names from colliding. Second, the
constraints on file names, and even the structure of file
names themselves varies considerably from machine to
machine. These two problems have combined to result in the
sophisticated and rather complicated way in which
FunnelWeb handles filenames.
<P>To summarize, the three problems are:
<P>
<OL>
<LI> What filename extensions should be chosen for various kinds of file?
<LI> What filename inheritance should take place?
<LI> How should FunnelWeb cope with the variations in filename structure
between platforms?
</OL>
<P>These problems are addressed in the following sections.
<P><BR><FONT SIZE="4"><STRONG>Filename Extensions</STRONG></FONT><BR>
<P>FunnelWeb is capable of reading and writing a variety
of different kinds of files. In particular, FunnelWeb must
often operate in an environment where the same information
is stored in many forms (e.g. prog.fw, prog.c, proc.exe).
File extensions are an essential tool in managing this
situation. The default filename extensions chosen for
FunnelWeb are:
<P>
<PRE>
FunnelWeb : .fw
Product : None
Documentation : .tex or .html
Listing : .lis
Journal : .jrn
</PRE>
<P>Lowercase will be used in systems that are case
sensitive.
<P><BR><FONT SIZE="4"><STRONG>Filename Inheritance</STRONG></FONT><BR>
<P>Inheritance in filenames refers to how input and output
files inherit parts of their name from other filenames and
their environment. For example if the command
<P>
<PRE>
fw sloth +J +L +T
</PRE>
<P>were issued, you would expect to see output files
<SAMP>sloth.jrn</SAMP>, <SAMP>sloth.lis</SAMP>, and
<SAMP>sloth.tex</SAMP>. The output file names have inherited
the "<TT>sloth</TT>" part of the argument. In fact,
FunnelWeb implements a comprehensive filename inheritance
scheme, which is shown in the following table. Each filename
is built up by starting at the top of its column in the
table and working down the column, inheriting filename
fields (directory, name, extension) that are absent at that
point.
<P>
<CENTER>
<TABLE BORDER="3">
<TR>
<TD> </TD>
<TD> <STRONG>Script</STRONG> </TD>
<TD> <STRONG>Input</STRONG> </TD>
<TD> <STRONG>Include</STRONG> </TD>
<TD> <STRONG>Journal</STRONG> </TD>
<TD> <STRONG>List</STRONG> </TD>
<TD> <STRONG>Document</STRONG> </TD>
<TD> <STRONG>Product</STRONG> </TD>
</TR>
<TR>
<TD>1 </TD>
<TD> </TD>
<TD> </TD>
<TD> <SAMP>@i</SAMP> </TD>
<TD> </TD>
<TD> </TD>
<TD> </TD>
<TD> <SAMP>@o</SAMP> </TD>
</TR>
<TR>
<TD>2 </TD>
<TD> <SAMP>+x</SAMP> </TD>
<TD> <SAMP>+f</SAMP> </TD>
<TD> <SAMP>+i</SAMP> </TD>
<TD> <SAMP>+j</SAMP> </TD>
<TD> <SAMP>+l</SAMP> </TD>
<TD> <SAMP>+t</SAMP> </TD>
<TD> <SAMP>+o</SAMP> </TD>
</TR>
<TR>
<TD>3 </TD>
<TD> "<TT>.fws</TT>" </TD>
<TD> "<TT>.fw</TT>" </TD>
<TD> "<TT>.fwi</TT>" </TD>
<TD> "<TT>.jrn</TT>" </TD>
<TD> "<TT>.lis</TT>" </TD>
<TD> "<TT>.tex</TT>" </TD>
<TD> </TD>
</TR>
<TR>
<TD>4 </TD>
<TD> </TD>
<TD> </TD>
<TD> <SAMP>+f</SAMP> </TD>
<TD> <SAMP>+f</SAMP> </TD>
<TD> <SAMP>+f</SAMP> </TD>
<TD> <SAMP>+f</SAMP> </TD>
<TD> </TD>
</TR>
<TR>
<TD>5 </TD>
<TD> DefDir </TD>
<TD> Defdir </TD>
<TD> Defdir </TD>
<TD> Defdir </TD>
<TD> Defdir </TD>
<TD> Defdir </TD>
<TD> Defdir </TD>
</TR>
</TABLE>
</CENTER>
<P>The following notes explain the table.
<P><OL>
<LI> Level 1 has the highest priority because it is a
direct specification by the user.
<LI> Level 2 comes next because this is also a direct
specification from the user on the command line.
<LI> Level 3 provides the default file extensions.
Product files do not inherit an extension.
<LI> Level 5 is built into most operating systems'
file specification systems. If you specify file
"<TT>x.y</TT>", it is taken to mean on the default disk in
the default directory.
<LI> Level 4 looks straightforward, but secretly
conceals a difficult design decision. By the time we get
down to this level of inheritance, we know for sure that the
filename has already picked up a file extension. So all that
is left to inherit is the path and the filename proper.
Obviously we have to inherit the filename proper (e.g.
<SAMP>sloth</SAMP> in <SAMP>sloth.tex</SAMP>), but should we
inherit the input file path? If we do inherit the input file
path, files will be placed in the same directory as the
input file. If we don't inherit the input file path, files
will be placed in the current directory. The choice made is
to send all the logging type files into the same directory
as the input file. This means, for example, that
<SAMP>sloth.lis</SAMP> and <SAMP>sloth.tex</SAMP> will generally
land in the same directory as <SAMP>sloth.fw</SAMP>. However,
product files are sent to the default directory (if not
earlier specified), as this is where the action is. In
normal use, the main output of FunnelWeb will be product
files, and so the user will expect them to appear in the
current directory by default.
</OL>
<P><BR><FONT SIZE="4"><STRONG>Portable Structure of File Names</STRONG></FONT><BR>
<P>Another problem with file names is the variation of
their structure between environments. Here are examples of
some of the formats that prevail:
<P>
<PRE>
UNIX /device/dir1/dir2/name
VMS node::device:[dir1.dir2]name.ext;vn
MSDOS device:\dir1\dir2\name.ext
MAC device:dir1:dir2:name
</PRE>
<P>The solution to dealing with these different formats is
to classify them as non-portable and hide the functions that
manipulate them in the machine-specific module of FunnelWeb.
Luckily there are not many such functions.
<P>The main problem is coping with file systems that do
not explicitly support file extensions. With so many
possible input and output files, FunnelWeb all but needs
such extensions. Machines that do not support them pose
difficult design decisions. If the user specifies
"<TT>sloth</TT>" as an input file on such a
non-extension-supporting system, should FunnelWeb look for
<SAMP>sloth</SAMP> or <SAMP>sloth.fw</SAMP>? If the user specifies
<SAMP>walrus</SAMP> as a listing file, should it generate
<SAMP>walrus</SAMP> or <SAMP>walrus.lis</SAMP>?
<P>Some possible solutions are:
<OL>
<LI> Regard the filename <SAMP>sloth</SAMP> as having an
empty extension. It will then default to <SAMP>sloth.fw</SAMP>.
<LI> Regard the filename <SAMP>sloth</SAMP> as having a
blank but full extension. That is, it cannot be overwritten
by inheritance, but it remains blank.
<LI> Provide an extra syntactic mechanism to allow the
user to specify one or other of the two options above.
</OL>
<P>The solution adopted in FunnelWeb is the first option.
Use of FunnelWeb results in lots of files lying around
(e.g. <SAMP>sloth.lis</SAMP>) and it is hard to see how the
user will cope with them all without some kind of naming
discipline. If a naming discipline has to be used, it might
as well be the FunnelWeb one.
<P>Thus the names of all files read and written by
FunnelWeb will have a file extension of from zero to three
letters separated from the rest of the filename by a
"<TT>.</TT>".
<P>The only exception is product files, whose extension is
left undefined. Product files need not contain a
"<TT>.</TT>" and a file extension.
<P>
<TABLE WIDTH="100%">
<TR>
<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>
<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>
<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>
</TR>
</TABLE>
<P>
<HR>
<FONT SIZE="2">
<A HREF="mailto:webmaster@ross.net">Webmaster</A>
<A HREF="copyright.html">Copyright © Ross N. Williams 1992,1999. All rights reserved.</A><BR>
</FONT>
</FONT>
</TD>
</TR>
</TABLE>
</BODY>
<!-- *********************************************************************** -->
<!-- End Of A FunnelWeb Manual Web Page (www.ross.net/funnelweb/) -->
<!-- *********************************************************************** -->
</HTML>
|