+cl-uffi (0.8.6-1) unstable; urgency=low
+
+ * Fix :pointer-self for OpenMCL.
+
+ -- Kevin M. Rosenberg <kmr@debian.org> Sun, 29 Sep 2002 14:14:01 -0600
+
cl-uffi (0.8.5-1) unstable; urgency=low
* Add with-cstrings macro to mcl's source
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: aggregates.cl,v 1.2 2002/09/20 06:03:36 kevin Exp $
+;;;; $Id: aggregates.cl,v 1.3 2002/09/30 01:57:32 kevin Exp $
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;;
#+(or lispworks cmu) (declare (ignore type))
#+cmu `(alien:deref ,obj ,i)
#+lispworks `(fli:dereference ,obj :index ,i)
- #+allegro `(ff:fslot-value-typed ,(convert-from-uffi-type type :type) :c ,obj ,i)
+ #+allegro `(ff:fslot-value-typed (quote ,(convert-from-uffi-type type :type)) :c ,obj ,i)
)
(defmacro def-union (name &rest fields)
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: libraries.cl,v 1.2 2002/09/20 04:51:14 kevin Exp $
+;;;; $Id: libraries.cl,v 1.3 2002/09/30 01:57:32 kevin Exp $
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;;
(let ((type (pathname-type (parse-namestring filename))))
(if (equal type "so")
(sys::load-object-file filename)
- (alien:load-foreign filename
- :libraries
- (convert-supporting-libraries-to-string
- supporting-libraries))))
-
- #+lispworks (fli:register-module module
- :real-name filename)
+ (alien:load-foreign filename
+ :libraries
+ (convert-supporting-libraries-to-string
+ supporting-libraries))))
+ #+lispworks (fli:register-module module :real-name filename)
#+allegro (load filename)
-
+ #+openmcl (ccl:open-shared-library filename)
+ #+(and mcl (not openmcl)) (ccl:add-to-shared-library-search-path filename t)
+
(push filename *loaded-libraries*)
t)))
)
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: primitives.cl,v 1.1 2002/09/16 17:54:30 kevin Exp $
+;;;; $Id: primitives.cl,v 1.2 2002/09/30 01:57:32 kevin Exp $
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;;
(basic-convert-from-uffi-type :cstring-returning))
(t
(basic-convert-from-uffi-type type)))
- (cons (convert-from-uffi-type (first type) context)
- (convert-from-uffi-type (rest type) context))))
+ (let ((sub-type (car type)))
+ (case sub-type
+ (cl:quote
+ (convert-from-uffi-type (cadr type) context))
+ (:struct-pointer
+ #+openmcl `(:* (:struct ,(convert-from-uffi-type (cadr type) :struct)))
+ #-openmcl `(* ,(convert-from-uffi-type (cadr type) :struct))
+ )
+ (:struct
+ #+openmcl `(:struct ,(convert-from-uffi-type (cadr type) :struct))
+ #-openmcl (convert-from-uffi-type (cadr type) :struct)
+ )
+ (t
+ (cons (convert-from-uffi-type (first type) context)
+ (convert-from-uffi-type (rest type) context)))))))
+
;;;; Programmers: Kevin M. Rosenberg and John DeSoi
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: aggregates.cl,v 1.2 2002/09/20 04:51:14 kevin Exp $
+;;;; $Id: aggregates.cl,v 1.3 2002/09/30 01:57:32 kevin Exp $
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;; and John DeSoi
(defmacro def-array-pointer (name-array type)
- `(def-mcl-type ,name-array '(:array ,type)))
+ #-openmcl
+ `(def-mcl-type ,name-array '(:array ,type))
+ #+openmcl
+ `(ccl::def-foreign-type ,name-array (:array ,(convert-from-uffi-type type :array))))
(let* ((field-name (car field))
(type (cadr field))
(def (append (list field-name)
- (if (eq type :pointer-self)
- #+cmu `((* (alien:struct ,name)))
- #-cmu `((* ,name))
- `(,(convert-from-uffi-type type :struct))))))
+ (cond
+ ((eq type :pointer-self)
+ #+cmu `((* (alien:struct ,name)))
+ #+openmcl `((:* (:struct ,name)))
+ #-(or cmu openmcl) `((* ,name))
+ )
+ (t
+ `(,(convert-from-uffi-type type :struct)))))))
(if variant
(push (list def) processed)
(push def processed))))
(setf (get-slot-value s :struct :u1.s1) 5)
(get-slot-value s :struct :u1.s1)
-|#
\ No newline at end of file
+|#
;;;; Programmers: Kevin M. Rosenberg and John DeSoi
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: libraries.cl,v 1.3 2002/09/29 17:50:07 kevin Exp $
+;;;; $Id: libraries.cl,v 1.4 2002/09/30 01:57:32 kevin Exp $
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;; and John DeSoi
;in MCL calling this more than once for the same library does not do anything
#-openmcl
-(defmacro load-foreign-library (filename &key module supporting-libraries force-load)
+(defun load-foreign-library (filename &key module supporting-libraries force-load)
(declare (ignore module supporting-libraries force-load))
`(eval-when (:compile-toplevel :load-toplevel :execute)
- (when (ccl:add-to-shared-library-search-path ,filename t)
- (pushnew ,filename *loaded-libraries*))))
+ (when (ccl:add-to-shared-library-search-path filename t)
+ (pushnew filename *loaded-libraries*))))
; Note we are not dealing with OpenMCL's ability to close the library
#+openmcl
(defun load-foreign-library (filename &key module supporting-libraries force-load)
(declare (ignore module supporting-libraries force-load))
- `(let ((path (if (pathnamep ,filename) (namestring ,filename) ,filename)))
+ (let ((path (if (pathnamep filename) (namestring filename) filename)))
(when (stringp path)
(if (position path *loaded-libraries* :test #'string-equal)
t
;;;; Programmers: Kevin M. Rosenberg and John DeSoi
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: primitives.cl,v 1.3 2002/09/20 13:05:59 kevin Exp $
+;;;; $Id: primitives.cl,v 1.4 2002/09/30 01:57:32 kevin Exp $
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;; and John DeSoi
(defmacro def-foreign-type (name uffi-type)
(let ((type (convert-from-uffi-type uffi-type :type)))
- (unless (keywordp type)
+ (unless (or (keywordp type) (consp type))
(setf type `(quote ,type)))
#-openmcl
`(def-mcl-type ,(keyword name) ,type)
"Converts from a uffi type to an implementation specific type"
(if (atom type)
(cond
- #-openmcl
- ((and (eq type :void) (eq context :return)) nil)
+ #-openmcl ((and (eq type :void) (eq context :return)) nil)
(t (basic-convert-from-uffi-type type)))
- (if (eq (car type) 'cl:quote)
- (%convert-from-uffi-type (cadr type) context)
- (cons (%convert-from-uffi-type (first type) context)
- (%convert-from-uffi-type (rest type) context)))))
+ (let ((sub-type (car type)))
+ (case sub-type
+ (cl:quote
+ (%convert-from-uffi-type (cadr type) context))
+ (:struct-pointer
+ #+openmcl `(:* (:struct ,(convert-from-uffi-type (cadr type) :struct)))
+ #-openmcl `(,(convert-from-uffi-type (list '* (cadr type)) :struct))
+ )
+ (:struct
+ #+openmcl `(:struct ,(convert-from-uffi-type (cadr type) :struct))
+ #-openmcl `(,(convert-from-uffi-type (cadr type) :struct))
+ )
+ (t
+ (cons (%convert-from-uffi-type (first type) context)
+ (%convert-from-uffi-type (rest type) context)))))))
(defun convert-from-uffi-type (type context)
(let ((result (%convert-from-uffi-type type context)))
(cond
((atom result) result)
#+openmcl
- ((eq (car result) :address) :address)
+ ((eq (car result) :address)
+ (if (eq context :struct)
+ (append '(:*) (cdr result))
+ :address))
#-openmcl
((and (eq (car result) :pointer) (eq context :allocation) :pointer))
(t result))))