home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / lisp / mcl / 1641 < prev    next >
Encoding:
Text File  |  1992-11-20  |  3.9 KB  |  102 lines

  1. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!cs.utexas.edu!sun-barr!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!@explorer-en.dgp.toronto.edu:markt@dgp.toronto.edu
  2. From: markt@dgp.toronto.edu ("Mark A. Tapia")
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re:  Logical pathname bug?
  5. Message-ID: <92Nov20.100035est.144035@explorer-en.dgp.toronto.edu>
  6. Date: 20 Nov 92 15:00:21 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 91
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10.  
  11. Christopher Fry (cfry@MIT.EDU) writes about problems using
  12. logical pathnames:
  13.   I define some logical pathnames.
  14.   I use them to load some .lisp files.
  15.   The files load fine. I can meta-point functions defined in them.
  16.   They have pathnames like "hd:ccs:oval:foo.lisp".
  17.   When I eval a defun in such a file I get the warning message
  18.   ;Warning:  FUNCTION LIST-OF-VALUES previously defined in:
  19.   oval-source:eval.lisp
  20.   ;                  is now being redefined in: root:hd;eval.lisp
  21.    
  22.   Now when I meta point the fn, I get a choice of two pathnames, neither
  23.   of which are
  24.   correct, and neither of which are either of the above two. They are:
  25.   "eval.lisp {hd;}" and
  26.   "eval.lisp {}"
  27.     
  28.   Choosing the first errors with
  29.   > Error: File #4P"root:hd;eval.lisp" does not exist.
  30.   > While executing: #<STANDARD-METHOD FRED-INITIALIZE (FRED-MIXIN)>
  31.   (it's true that that file doesn't exist, but why did meta-point think it
  32.   did?)
  33.      
  34.   Choosing the second works fine.
  35.       
  36.   The directory in the title bar of a fred window editing the file is
  37.   the correct physical directory.
  38.   Inspecting the window shows that its instance variable ccl::my-file-name
  39.   is the correct full physical pathname.
  40.        
  41.   I play some tricks with defining logical pathnames. Its likely I'm doing
  42.   something wrong. CLtL2 has done an excellent job of documenting a very
  43.   complex mechanism obscurly. If there are better explanations of logical
  44.   pathnames, please tell me where. But it still sounds like MCL2 is
  45.   inconsistent here.
  46.  
  47.  
  48. I still don't understand logical pathnames either. But I've developed
  49. an approached based on Guillame Cartiers extended-apropos
  50. package. Logical pathname translations replace the old-style
  51. logical directories.
  52.  
  53. Surely we need to cover this topic in the new MCL FAQ currently
  54. under development.
  55.  
  56. It wasn'tg easy converting from the old style
  57. directories to the new logical pathnames.  I hope the following
  58. helps:
  59.  
  60. Here is an example of the old (MCL2.0b1p3) way of defining logical
  61. pathnames for the toplevel (ccl) directory
  62.     (def-logical-directory "Lisp.root"  "CCL")
  63. and using this logical directory to define a a sub-directory:
  64.     (def-logical-directory "Utilities" "CCL;utilities:")
  65.  
  66. Here is the replacement in MCL final which uses logical hosts:
  67.     (setf (logical-pathname-translations "mcl")
  68.           (list (list "mcl:**;*.*"
  69.                       (full-pathname
  70.                         "ccl:**;*.*")))
  71.  
  72.     (setf (logical-pathname-translations "Utilities")
  73.           (list (list "Utilities:**;*.*"
  74.                       (full-pathname
  75.                         "mcl:utilities;**;*.*"))))
  76.  
  77. Here is the method I use to expand the logical name when I use
  78. the defsys utility developed by Mark Kantorwitz at CMU:
  79.  
  80.     (defmacro logical-to-name (logical-name &optional rest)
  81.       "Allow the expansion of logical pathnames"
  82.       `(if ,rest
  83.          (format nil "~a~a" (mac-directory-namestring 
  84.                              (truename ,logical-name))
  85.                  ,rest)
  86.          (mac-directory-namestring (truename ,logical-name))))
  87.  
  88.     (defun translate-name (top-dir &optional sub-dirs file)
  89.       (let (main-dir)
  90.         (if file
  91.           (setq main-dir (logical-to-name top-dir sub-dirs))
  92.           (setq main-dir (logical-to-name top-dir)
  93.                 file sub-dirs))
  94.         (format nil "~a~a"  main-dir file)))
  95.  
  96. Here is the way that to load the file logical-pathnames.lisp
  97. in the subdirectory utilities:
  98.  
  99.     (load (translate-name "CCL:" "utilities:" "logical-pathnames.lisp"))
  100.  
  101. mark
  102.