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

Re: defsystem.lisp



ferrante@world.std.com (Richard D Ferrante) writes:
 Has anyone ported Mark Kantrowitz's defsystem.lisp to MCL 2.0 final?
 If you have cna you either mail it to me or tell me a working ftp site
 for it?
  
 The version which I ftp'd from a.gp.cs.cmu.edu doesn't seem to do
 pathname translation appropriately.
 
I use defsystem with MCL2.0final and have made the following "fix"
to support the logical-hosts translation problem.

Here is the way I define a system:
  (defsystem view-extensions
    :source-pathname (logical-to-name "CCL:" "utilities:")
    :source-extension "lisp"
    :binary-pathname (logical-to-name "CCL:" "utilities:fasls:")
    :binary-extension "fasl"
    :components ((:file "view-extensions")))

The key is the logical-to-name function which translates from 
logical-hosts and directories to names comprehensible to defsystem:
    ? (logical-to-name "CCL:" "utilities:")
    "Palm:MCL 2.0f3:utilities:"

Remember to change from logical directories to logical-hosts (it's a pain
but it is necessary.)

Here is the code for logical-to-name:
(defmacro logical-to-name (logical-name &optional rest)
  "Allow the expansion of logical pathnames"
  `(if ,rest
      (format nil "~a~a" (mac-directory-namestring 
			               (truename ,logical-name))
                 		       ,rest)
	 	         (mac-directory-namestring (truename ,logical-name))))

(defun translate-name (top-dir &optional sub-dirs file)
  (let (main-dir)
     (if file
          (setq main-dir (logical-to-name top-dir sub-dirs))
	  (setq main-dir (logical-to-name top-dir)
         	file sub-dirs))
     (format nil "~a~a"  main-dir file)))