[Openmcl-devel] Init-file in openMCL Cocoa App

Gary King gwking at cs.umass.edu
Thu Jun 10 05:45:05 PDT 2004


On Jun 10, 2004, at 7:44 AM, Sebastian Nozzi wrote:

> Moreover, I would like to know how the directory translation works in 
> openMCL. Where can I get more info on that? (what predefined 
> directories are there, like home:, ccl:, etc. when to use ; and when 
> to use :? can I mix slashes and ; and : ? etc.)
>

Hi,

Lisp has a whole bunch of machinery for dealing with the file system 
called logical pathnames. In brief, a pathname is made up:

<host>:<directory-list><file-name><type><version>

where host is a name; directory-list is a semi-colon separated list of 
directories; filename doesn't have a period in it; type is the 
extension and version is optional and can be things like "newest". The 
host maps to a list of translations. You can see the translations by 
evaluating "logical-pathname-translations":

> ? (logical-pathname-translations "home")
> ==> ((#4P"home:**;*.*" #P"/Users/gwking/**/*.*"))

and you can set them by doing:

> ? (setf (logical-pathname-translations "home") ...)

To see what a pathname translates to you, use 
translate-logical-pathname:

> ? (translate-logical-pathname "home:.openmcl-init.lisp")
> #P"/Users/gwking/.openmcl-init"

Getting the list of hosts is (AFAIK) not part of portable CL. Under 
OpenMCL, you can look at ccl::%logical-host-translations%.

> ? ccl::%logical-host-translations%
> (("ccl" (#4P"ccl:lib;**;*.fasl" #4P"ccl:bin;*.fasl") 
> (#4P"ccl:l1;**;*.fasl" #4P"ccl:l1f;*.fasl") (#4P"ccl:l1;**;*.pfsl" 
> #4P"ccl:l1pf;*.pfsl") (#4P"ccl:l1;**;*.sfsl" #4P"ccl:l1sf;*.sfsl") 
> (#4P"ccl:l1;**;*.dfsl" #4P"ccl:l1df;*.dfsl") (#4P"ccl:l1;**;*.*" 
> #4P"ccl:level-1;**;*.*") (#4P"ccl:l1f;**;*.pfsl" 
> #4P"ccl:l1pf;**;*.pfsl") (#4P"ccl:l1f;**;*.sfsl" 
> #4P"ccl:l1sf;**;*.sfsl") (#4P"ccl:l1f;**;*.dfsl" 
> #4P"ccl:l1df;**;*.dfsl") (#4P"ccl:bin;**;*.pfsl" 
> #4P"ccl:binppc;**;*.pfsl") (#4P"ccl:bin;**;*.sfsl" 
> #4P"ccl:binsparc;**;*.sfsl") (#4P"ccl:bin;**;*.dfsl" 
> #4P"ccl:bindarwin;**.*.dfsl") (#4P"ccl:l1pf;**;*.*" 
> #4P"ccl:l1-pfsls;**;*.*") (#4P"ccl:l1sf;**;*.*" 
> #4P"ccl:l1-sfsls;**;*.*") (#4P"ccl:l1df;**;*.*" 
> #4P"ccl:l1-dfsls;**;*.*") (#4P"ccl:l1f;**;*.*" 
> #4P"ccl:l1-fasls;**;*.*") (#4P"ccl:ccl;*.*" 
> #P"/usr/local/bin/ccl/ccl/*.*") (#4P"ccl:**;*.*" 
> #P"/usr/local/bin/ccl/ccl/**/*.*")) ("home" (#4P"home:**;*.*" 
> #P"/Users/gwking/**/*.*")))
> ?

Lisps can also deal in physical pathnames. When you don't start with a 
host and instead use "/", then you have a physical pathname. I don't 
believe that you can mix physical and logical.

FWIW, I was able to create .openmcl.lisp in my home directory using:

> ? (with-open-file (s "/Users/gwking/.openmcl-init.lisp" :direction 
> :output :if-does-not-exist :cr
> eate)
>         (format s "Hello"))
> NIL
> ? (probe-file "/Users/gwking/.openmcl-init.lisp")
> #P"/Users/gwking/\\.openmcl-init.lisp"

HTH,
-- 
Gary Warren King
Lab Manager
Experimental Knowledge Systems Laboratory East
Department of Computer Science
Computer Science Building
Amherst, Massachusetts 01003
413.577.0176
gwking at cs.umass.edu




More information about the Openmcl-devel mailing list