aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/interp/br-con.boot2
-rw-r--r--src/interp/debug.lisp2
-rw-r--r--src/interp/i-syscmd.boot12
-rw-r--r--src/interp/nlib.lisp11
-rw-r--r--src/interp/pathname.boot2
-rw-r--r--src/interp/sys-utility.boot10
7 files changed, 21 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f3578ea3..decb8b17 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
2013-05-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
+ * interp/nlib.lisp ($FINDFILE): Move to sys-utility.boot.
+
+2013-05-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
* interp/nlib.lisp (MAKE-INPUT-FILENAME): Move to sys-utility.boot.
* boot/ast.boot (bfIS1): Handle Lisp keywords.
diff --git a/src/interp/br-con.boot b/src/interp/br-con.boot
index be5f8a94..70dee07b 100644
--- a/src/interp/br-con.boot
+++ b/src/interp/br-con.boot
@@ -1053,7 +1053,7 @@ bcUnixTable(u) ==
else htSaySaturn '"&"
htSay '"{"
ft := '("SPAD")
- filename := NAMESTRING $FINDFILE(STRINGIMAGE x, ft)
+ filename := NAMESTRING findFile(STRINGIMAGE x, ft)
htMakePage [['text, '"\unixcommand{",PATHNAME_-NAME x, '"}{",
textEditor(), '" ", filename, '"} "]]
htSay '"}"
diff --git a/src/interp/debug.lisp b/src/interp/debug.lisp
index e97cc1fc..92e88a3d 100644
--- a/src/interp/debug.lisp
+++ b/src/interp/debug.lisp
@@ -206,7 +206,7 @@
(SETQ INFILE (|pathname| INFILE))
(COND
( EDITFLAG
- ;;%% next form is used because $FINDFILE seems to screw up
+ ;;%% next form is used because findFile seems to screw up
;;%% sometimes. The stream is opened and closed several times
;;%% in case the filemode has changed during editing.
(SETQ EDINFILE (|makeInputFilename| INFILE))
diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot
index 46e817cb..49e3aaae 100644
--- a/src/interp/i-syscmd.boot
+++ b/src/interp/i-syscmd.boot
@@ -434,18 +434,18 @@ compiler args ==
af := pathname args
aft := pathnameType af
haveOld or (aft = '"spad") =>
- not (af1 := $FINDFILE (af, '(spad))) =>
+ not (af1 := findFile(af, '(spad))) =>
throwKeyedMsg("S2IL0003",[NAMESTRING af])
compileSpad2Cmd [af1]
aft = '"NRLIB" =>
- not (af1 := $FINDFILE (af, '(NRLIB))) =>
+ not (af1 := findFile(af, '(NRLIB))) =>
throwKeyedMsg("S2IL0003",[NAMESTRING af])
compileSpadLispCmd [af1]
-- see if we something with the appropriate file extension
-- lying around
- af1 := $FINDFILE (af, '(as spad ao asy))
+ af1 := findFile(af, '(as spad ao asy))
af1 and pathnameType(af1) = '"spad" => compileSpad2Cmd [af1]
@@ -460,7 +460,7 @@ compiler args ==
-- see if we something with the appropriate file extension
-- lying around
- af1 := $FINDFILE (af, '(spad))
+ af1 := findFile(af, '(spad))
af1 and pathnameType(af1) = '"spad" => compileSpad2Cmd [af1]
@@ -981,7 +981,7 @@ editSpad2Cmd l ==
$UserLevel = 'compiler => '("input" "INPUT" "spad" "SPAD")
'("input" "INPUT" "spad" "SPAD" "boot" "BOOT" "lisp" "LISP")
ll :=
- oldDir = '"" => pathname $FINDFILE (pathnameName l, fileTypes)
+ oldDir = '"" => pathname findFile(pathnameName l, fileTypes)
l
l := pathname ll
$editFile := l
@@ -2001,7 +2001,7 @@ readSpad2Cmd l ==
$UserLevel = 'interpreter => '("input" "INPUT")
$UserLevel = 'compiler => '("input" "INPUT")
devFTs
- ll := $FINDFILE (l, fileTypes)
+ ll := findFile(l, fileTypes)
if null ll then
ifthere => return nil -- be quiet about it
throwKeyedMsg("S2IL0003",[namestring l])
diff --git a/src/interp/nlib.lisp b/src/interp/nlib.lisp
index 6122111a..0e76b5b8 100644
--- a/src/interp/nlib.lisp
+++ b/src/interp/nlib.lisp
@@ -236,17 +236,6 @@
(mapcar #'string keys))
(putindextable ctable filearg))
-
-(defun $findfile (filespec filetypelist)
- (let ((file-name (if (consp filespec) (car filespec) filespec))
- (file-type (if (consp filespec) (cadr filespec) nil)))
- (if file-type (push file-type filetypelist))
- (some #'(lambda (ft) (|makeInputFilename| file-name ft))
- filetypelist)))
-
-;;(defun move-file (namestring1 namestring2)
-;; (rename-file namestring1 namestring2))
-
(defun $FCOPY (filespec1 filespec2)
(let ((name1 (|makeFullFilePath| filespec1))
(name2 (|makeFullFilePath| filespec2)))
diff --git a/src/interp/pathname.boot b/src/interp/pathname.boot
index 15a8d88f..fa30d4dc 100644
--- a/src/interp/pathname.boot
+++ b/src/interp/pathname.boot
@@ -109,7 +109,7 @@ newMKINFILENAM(infile) ==
file := infile := pathname infile
repeat
fn := pathnameName file
- nfile := $FINDFILE (file,$sourceFileTypes)
+ nfile := findFile(file,$sourceFileTypes)
null nfile =>
nfile := file
if fn = '"*" or fn = '"NIL" then sayKeyedMsg("S2IL0016",NIL)
diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot
index e0cece17..d30b73e3 100644
--- a/src/interp/sys-utility.boot
+++ b/src/interp/sys-utility.boot
@@ -1,5 +1,3 @@
-)eval TRACE bfIS1
-
-- Copyright (C) 2007-2013 Gabriel Dos Reis.
-- All rights reserved.
--
@@ -471,3 +469,11 @@ makeInputFilename(filearg,filetype == nil) ==
for dir in getDirectoryList filePathType filename]
or probeReadableFile filename
probeReadableFile filename
+
+findFile(spec,exts) ==
+ name :=
+ spec is [.,:.] => first spec
+ spec
+ if spec is [.,:.] then
+ exts := [second spec,:exts]
+ or/[makeInputFilename(name,ext) for ext in exts]