1-- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
2-- All rights reserved.
3--
4-- Redistribution and use in source and binary forms, with or without
5-- modification, are permitted provided that the following conditions are
6-- met:
7--
8--     - Redistributions of source code must retain the above copyright
9--       notice, this list of conditions and the following disclaimer.
10--
11--     - Redistributions in binary form must reproduce the above copyright
12--       notice, this list of conditions and the following disclaimer in
13--       the documentation and/or other materials provided with the
14--       distribution.
15--
16--     - Neither the name of The Numerical ALgorithms Group Ltd. nor the
17--       names of its contributors may be used to endorse or promote products
18--       derived from this software without specific prior written permission.
19--
20-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21-- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22-- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
24-- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25-- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32)package "BOOT"
33
34--% Common Lisp Pathname Functions
35
36pathname p ==
37  if SYMBOLP(p) then p := SYMBOL_-NAME(p)
38  PATHNAMEP p => p
39  not PAIRP p => PATHNAME p
40  p is [fn] => PATHNAME make_filename(fn)
41  p is [fn, ft] => PATHNAME make_filename0(fn, ft)
42  error '"Strange argument to pathname"
43namestring p == NAMESTRING pathname p
44
45pathnameName p == PATHNAME_-NAME pathname p
46
47pathnameType p == PATHNAME_-TYPE pathname p
48
49pathnameTypeId p == UPCASE object2Identifier pathnameType p
50
51pathnameDirectory p ==
52    NAMESTRING MAKE_-PATHNAME(INTERN('"DIRECTORY", '"KEYWORD"),_
53                               PATHNAME_-DIRECTORY pathname p)
54
55deleteFile f == DELETE_-FILE f
56
57isExistingFile f ==
58  if make_input_filename(f)
59    then
60      true
61    else false
62
63--% Scratchpad II File Name Functions
64
65makePathname(name,type) ==
66  -- Common Lisp version of this will have to be written
67  -- using MAKE-PATHNAME and the optional args.
68  pathname [object2String name,object2String type]
69
70isSystemDirectory dir == EVERY(function CHAR_=,$SPADROOT,dir)
71