Le mercredi 01 novembre 2006 à 23:20 +0100, Waldek Hebisch a écrit :

[...]
  
> diff -ru build-improvements.pp/src/interp/nlib.lisp.pamphlet 
> build-improvements/src/interp/nlib.lisp.pamphlet
> --- build-improvements.pp/src/interp/nlib.lisp.pamphlet       2006-11-01 
> 19:33:09.000000000 +0100
> +++ build-improvements/src/interp/nlib.lisp.pamphlet  2006-11-01 
> 19:36:00.000000000 +0100
> @@ -448,17 +448,23 @@
>                        :test #'string=) 
>                :test #'string=))))
>  
> +(defun axiom-probe-file (file)
> +    (if (equal (|directoryp| file) -1)
> +         nil
> +         (truename file))
> +)
> +
>  (defun make-input-filename (filearg &optional (filetype nil))
>     (let*
>       ((filename  (make-filename filearg filetype))
>        (dirname (pathname-directory filename))
>        (ft (pathname-type filename))
>        (dirs (get-directory-list ft))
> -      (newfn nil))   
> +      (newfn nil))
>      (if (or (null dirname) (eqcar dirname :relative))
>       (dolist (dir dirs (probe-name filename))
>               (when 
> -              (probe-file 
> +              (axiom-probe-file 
>                 (setq newfn (concatenate 'string dir filename)))
>                (return newfn)))
>        (probe-name filename))))
> @@ -476,7 +482,7 @@
>  ;; ($ERASE filearg) -> 0 if succeeds else 1
>  (defun $erase (&rest filearg)
>    (setq filearg (make-full-namestring filearg))
> -  (if (probe-file filearg)
> +  (if (axiom-probe-file filearg)
>  #+:CCL (delete-file filearg)
>  #+:AKCL
>        (if (library-file filearg)


Why not modifying and using probe-name ? Actually I use:

@@ -436,7 +436,11 @@
   (namestring (merge-pathnames (make-filename filearg filetype))))
 
 (defun probe-name (file)
-  (if (probe-file file) (namestring file) nil))
+  (cond
+    ; no need to use namestring, it is already a string
+    ((probe-file file) file)
+    ((eql (|directoryp| file) 1) (namestring (truename file)))
+    (t nil)))
 
 (defun get-directory-list (ft &aux (cd (namestring
$current-directory)))
   (cond ((member ft '("NRLIB" "DAASE" "EXPOSED") :test #'string=)
@@ -457,8 +461,8 @@
       (newfn nil))   
     (if (or (null dirname) (eqcar dirname :relative))
        (dolist (dir dirs (probe-name filename))
-               (when 
-                (probe-file 
+               (when
+                 (probe-name
                  (setq newfn (concatenate 'string dir filename)))
                 (return newfn)))
       (probe-name filename))))

It's just what I use, not that I disagree.

Greg

PS: For $erase (see another mail) I directly use directoryp.



_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to