Debian Codegraph @

developer/design_filenames.html

raw symbols SCIP
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 FUNNELWEB MANUAL WEB PAGE
8 =========================
9 Copyright (c) Ross N. Williams 1992,1999. All rights reserved.
10
11 Permission is granted to redistribute and use this manual in
12 any medium, with or without modification, provided that all
13 notices (including, without limitation, the copyright
14 notice, this permission notice, any record of modification,
15 and all legal notices) are preserved on all copies, that all
16 modifications are clearly marked, and that modified versions
17 are not represented as the original version unless all the
18 modifications since the manual's original release by Ross N.
19 Williams (www.ross.net) consist of translations or other
20 transformations that alter only the manual's form, not its
21 content. THIS MANUAL IS PROVIDED "AS IS" AND WITHOUT ANY
22 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
23 LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
24 FITNESS FOR A PARTICULAR PURPOSE. TO THE EXTENT PERMITTED BY
25 LAW THERE IS ABSOLUTELY NO WARRANTY.
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>&nbsp;</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> &nbsp; </TD>
190 <TD> &nbsp; </TD>
191 <TD> <SAMP>@i</SAMP> </TD>
192 <TD> &nbsp; </TD>
193 <TD> &nbsp; </TD>
194 <TD> &nbsp; </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> &nbsp; </TD>
216 </TR>
217 <TR>
218 <TD>4 </TD>
219 <TD> &nbsp; </TD>
220 <TD> &nbsp; </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> &nbsp; </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&nbsp;1 has the highest priority because it is a
245 direct specification by the user.
246
247 <LI> Level&nbsp;2 comes next because this is also a direct
248 specification from the user on the command line.
249
250 <LI> Level&nbsp;3 provides the default file extensions.
251 Product files do not inherit an extension.
252
253 <LI> Level&nbsp;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&nbsp;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>&nbsp;&nbsp;&nbsp;
360 <A HREF="copyright.html">Copyright &copy; 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 <!-- End Of A FunnelWeb Manual Web Page (www.ross.net/funnelweb/) -->
373 <!-- *********************************************************************** -->
374
375 </HTML>