Paste number 5352: ccl add-logical-pathname-translation for vImage framework

Index of paste annotations: 1

Paste number 5352: ccl add-logical-pathname-translation for vImage framework
Pasted by: slyrus
When:9 years, 9 months ago
Share:Tweet this! | http://paste.lisp.org/+44O
Channel:#lisp
Paste contents:
Raw Source | XML | Display As
;;
;; file: vimage.cl
;; author: cyrus harmon
;; time-stamp: Fri Apr 23 12:19:55 EDT 2004
;;

(in-package :vimage)

(defun add-logical-pathname-translation (host log phy)
  (let ((q (assoc log (logical-pathname-translations host) :test #'equalp)))
    (if q
	(rplacd q (list phy))
	(setf (logical-pathname-translations host)
	      (append (list (list log phy))
		      (logical-pathname-translations host)
		      )))))

(defun local-directory (&rest path)
  (print (merge-pathnames
   (make-pathname :directory (apply 'list :relative :up :up path))
   (make-pathname :directory (pathname-directory *load-truename*)))))

(print *load-truename*)
(add-logical-pathname-translation "ccl"
				  #4P"ccl:darwin-headers;vimage;**;*.*"
				  (merge-pathnames
				   "**/*.*"
				   (local-directory "darwin-headers" "vimage")))

(add-logical-pathname-translation "ccl"
				  #4P"ccl:darwin-headers;vimage;*.*"
				  (merge-pathnames
				   "*.*"
				   (local-directory "darwin-headers" "vimage")))

(open-shared-library "/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/vImage")
(ccl:use-interface-dir :vimage)

Annotations for this paste:

Annotation number 1: This actually explained some old code I had lying around
Pasted by: dsteuber
When:9 years, 9 months ago
Share:Tweet this! | http://paste.lisp.org/+44O/1
Paste contents:
Raw Source | Display As
So I used it:

CL-USER> (ccl::setenv "CCL_DEFAULT_DIRECTORY" "/Users/david/usr/src/ccl/")
0
CL-USER> (defun cl-user::set-ccl-path (path)
  (setf (logical-pathname-translations "ccl")
        `(("ccl;*.*" ,(merge-pathnames "*.*" path))
          ("**;*.*" ,(merge-pathnames "**/*.*" path)))))
SET-CCL-PATH
CL-USER> (set-ccl-path (ccl::ccl-directory))
(("ccl;*.*" #P"/Users/david/usr/src/ccl/*.*") ("**;*.*" #P"/Users/david/usr/src/ccl/**/*.*"))
CL-USER> (describe 'ccl::setenv)
Symbol: CCL::SETENV
Function
INTERNAL in package: #<Package "CCL">
Print name: "SETENV"
Value: #<Unbound>
Function: #<Compiled-function CCL::SETENV #x60E1E46>
Arglist: (CCL::KEY CCL::VALUE &OPTIONAL CCL::OVERWRITE)
Plist: NIL
; No value
CL-USER> #$kCFStringEncodingASCII
1536

I still don't really understand it, but this is what it takes for OpenMCL to find the CDB
Interface files when running from an application bundle on OS X.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.