Subject: [clisp-list] PARSE-NAMESTRING and LOGICAL-PATHNAMEs

From: Marco Antoniotti <[email-masked]>
Date: Wed, 1 Mar 2000 17:33:38 +0100 (MET)

Hi

I am working on the following little function in MK:DEFSYSTEM 4.0

(defun namestring-probably-logical-p (namestring)
  (and (stringp namestring)
       (typep (parse-namestring namestring) 'logical-pathname)))

Unfortunately, in CLisp

[1]> (setf (logical-pathname-translations "XXX")
`(("*.*" "/user/zut/")))
((#S(LOGICAL-PATHNAME :HOST "XXX" :DEVICE NIL :DIRECTORY (:ABSOLUTE)
       :NAME :WILD :TYPE :WILD :VERSION NIL
    )
    "/user/zut/"
))
[2]> (translate-logical-pathname "XXX:zot.c")
#P"/user/zut/zot.c"
[3]> (parse-namestring "XXX:zot.c")
#P"XXX:zot.c" ;
9
[4]> (type-of *)
PATHNAME
[5]> (describe **)
 
#P"XXX:zot.c" is a pathname, with the following components:
DIRECTORY = 
NAME = XXX:zot
TYPE = .c

[6] ;;; define the function NAMESTRING-PROBABLY-LOGICAL-P.
NAMESTRING-PROBABLY-LOGICAL-P 
[7]> (namestring-probably-logical-p "XXX:zot.c")
NIL
[8]> (translate-logical-pathname (parse-namestring "XXX:zot.c"))
#P"XXX:zot.c"
[9]> (type-of *)
PATHNAME

It may be that I have not updated my version later, but this is
incorrect w.r.t. the Hyperspec.  I.e. PARSE-NAMESTRING should
recognize a logical pathname and parse it accordingly.  Instead it
seems to return a PATHNAME with an unparsed name.

Note that CMUCL, Harlequin and ACL go the extra step to return
something for which (typep * 'logical-pathname) is T.  Hence, my
function may be wrong, but also CLisp's behavior is non-conformant in
this case.

Cheers

-- 
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - 06 68 10 03 17, fax. +39 - 06 68 80 79 26
http://www.parades.rm.cnr.it/~marcoxa

---

From: Sam Steingold <[email-masked]>
Date: 01 Mar 2000 13:39:25 -0500

this is the behavior documented in the impnotes.html.
yes, it is not compliant (it is quite ugly that the type of the result
is determined by the presence of a semicolon in the pathname).
for now, you might want to check for #\: yourself and call
`logical-pathname'.

[note that `reply-to' is set to <[email-masked]>]

Bruno, how about lisp:*ansi-parse-namestring*?

>>>> In message <[email-masked]>
>>>> On the subject of "[clisp-list] PARSE-NAMESTRING and LOGICAL-PATHNAMEs"
>>>> Sent on Wed Mar 01 11:39:08 EST 2000
>>>> Honorable Marco Antoniotti <[email-masked]> writes:
 >> 
 >> function may be wrong, but also CLisp's behavior is non-conformant
 >> in this case.

-- 
Sam Steingold (http://www.podval.org/~sds)
Micros**t is not the answer.  Micros**t is a question, and the answer is Linux,
(http://www.linux.org) the choice of the GNU (http://www.gnu.org) generation.
Isn't "Microsoft Works" an advertisement lie?

---

From: Marco Antoniotti <[email-masked]>
Date: Thu, 2 Mar 2000 10:00:14 +0100 (MET)

> Delivery-Date: Wed, 01 Mar 2000 19:39:48 +0100
> Cc: [email-masked]
> Reply-To: [email-masked]
> Mail-Copies-To: never
> From: Sam Steingold <[email-masked]>
> Date: 01 Mar 2000 13:39:25 -0500
> 

I agree the spec is ugly, but I need a *portable* way to determine
whether a string is a logical pathname string which .... here is the
catch ... works also on MCL.

I suppose that I'll have to trap errors and use return a value based on
that.

Cheers