axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] hypertex and uses info


From: Waldek Hebisch
Subject: Re: [Axiom-developer] hypertex and uses info
Date: Thu, 2 Nov 2006 00:08:23 +0100 (CET)

Vanuxem Grégory wrote:
> 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.
 
No very strong reason. However:

1) 'axiom-probe-file' is intended to be good replacement for 'probe-file'.
   More precisely, Axiom uses directories to implement what Microsoft
   would call "structured storage" and old IBM systems called "partitioned
   data sets". Such directories from Axiom point of view are equivalent
   to files.
2) I did not check all uses of 'probe-name', so it was not clear if
   change in 'probe-name' is apropriate.
3) 'probe-name' is doing a lot of extra work (calls 'probe-file' first,
   then calls 'namestring'

Concerning erase: I would prefer to limit use of 'directoryp': 
something which has name endig in 'p' should return a boolean.
What 'directoryp' returns is unexepected, so wide use of 'directoryp'
would make interpreter code hareder to read.

-- 
                              Waldek Hebisch
address@hidden 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]