From: Marco Antoniotti
Subject: Need a little piece of software. LOGICAL-PATHNAME completion.
Date: 
Message-ID: <y6c1yv1n5g4.fsf@octagon.mrl.nyu.edu>
Hi,

I need a little piece of software that I can incorporate into ILISP.

The piece of software is a  "LOGICAL-PATHNAME completion" function,
which, given a string, if it is a potential LOGICAL-PATHNAME (i.e. a
striang starting with "LPNAME:.....") will return a list of the
possible pathnames given the current content of
LOGICAL-PATHNAME-TRANSLATIONS.

The result should either be NIL or a LIST of LOGICAL-PATHNAME STRINGS
(i.e. not their translations).

I realize that this last requirement may very very hard (that is why I
am not writing it :) - really, I have very little time).
If it is, I will be content to get the list of possible translations.

Examples.

Suppose you have the following example (taken from the CLHS)

==============================================================================
(setf (logical-pathname-translations "prog")
       '(("RELEASED;*.*.*"        "MY-UNIX:/sys/bin/my-prog/")
         ("RELEASED;*;*.*.*"      "MY-UNIX:/sys/bin/my-prog/*/")
         ("EXPERIMENTAL;*.*.*"    "MY-UNIX:/usr/Joe/development/prog/")
         ("EXPERIMENTAL;DOCUMENTATION;*.*.*"
                                  "MY-VAX:SYS$DISK:[JOE.DOC]")
         ("EXPERIMENTAL;*;*.*.*"  "MY-UNIX:/usr/Joe/development/prog/*/")
         ("MAIL;**;*.MAIL"        "MY-VAX:SYS$DISK:[JOE.MAIL.PROG...]*.MBX")))

 ;;;Sample use of that logical pathname.  The return value
 ;;;is implementation-dependent.          
 (translate-logical-pathname "prog:mail;save;ideas.mail.3")
=>  #P"MY-VAX:SYS$DISK:[JOE.MAIL.PROG.SAVE]IDEAS.MBX.3"

 ;;;Example translations for a program that uses three files main.lisp,
 ;;;auxiliary.lisp, and documentation.lisp.  These translations might be
 ;;;supplied by a software supplier as examples.

 ;;;For Unix with long file names
 (setf (logical-pathname-translations "prog")
       '(("CODE;*.*.*"             "/lib/prog/")))
==============================================================================

Suppose you have the function LOGICAL-PATHNAME-COMPLETIONS.

The optimal solution would be to have something like

	(logical-pathname-completions "prog:released;z")
	=> ("PROG:RELEASED;ZUT.LISP" "PROG:RELEASED;ZOT.C" "PROG:RELEASED;ZAT-DIR;")

Alternatively

	(logical-pathname-completions "prog:released;z")
	=> (#p"MY-UNIX:/sys/bin/my-prog/zut.lisp"
            #p"MY-UNIX:/sys/bin/my-prog/zot.lisp"
            #p"MY-UNIX:/sys/bin/my-prog/zat-dir/")

would do.  Note also that

	(logical-pathname-completions "prog:released;*.*")
	=> (#p"MY-UNIX:/sys/bin/my-prog/zut.lisp"
            #p"MY-UNIX:/sys/bin/my-prog/zot.lisp")

I realize that this spec is rather fuzzy,  But I believe a convergence
can be achieved.

Of course, the resulting code must run on every conceivable
almost-ANSI Common Lisp implemenation available.

Thanks for you help.  Please reply in private or on the ilisp mailing
list (··········@lists.sourceforge.net).

Happy Holidays.

-- 
Marco Antoniotti =============================================================
NYU Bioinformatics Group			 tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                          fax  +1 - 212 - 995 4122
New York, NY 10003, USA				 http://galt.mrl.nyu.edu/valis
             Like DNA, such a language [Lisp] does not go out of style.
			      Paul Graham, ANSI Common Lisp