[cffi-devel] patch for uffi-compat

Леонид Новиков ln at bk.ru
Fri Dec 16 10:11:29 UTC 2005


This patch accelerates work with array


*** c:\temp\uffi-compat.lisp	Wed Nov  9 21:23:12 2005
--- c:\temp\cffi-luis-051114-1956\uffi-compat\uffi-compat.lisp	Fri Dec 16 13:53:55 2005
***************
*** 131,137 ****
    (:documentation "UFFI's :array type."))
  
  (defmethod initialize-instance :after ((self uffi-array-type) &key)
!   (setf (cffi::actual-type self) (cffi::find-type :pointer)))
  
  (defmethod cffi:foreign-type-size ((type uffi-array-type))
    (or (* (cffi:foreign-type-size (element-type type)) (nelems type))
--- 131,144 ----
    (:documentation "UFFI's :array type."))
  
  (defmethod initialize-instance :after ((self uffi-array-type) &key)
!   (setf (cffi::actual-type self) (cffi::find-type :pointer))
!   (setf (cffi::name self)
!           (intern (format nil "~A-~A-~A-~D"
!                           (cffi::symbol-name '#:anon)
!                           (cffi::class-name (class-of self))
!                           (element-type self)
!                           (nelems self))))
! )
  
  (defmethod cffi:foreign-type-size ((type uffi-array-type))
    (or (* (cffi:foreign-type-size (element-type type)) (nelems type))
***************
*** 141,148 ****
    t)
  
  (cffi:define-type-spec-parser uffi-array (element-type count)
!   (make-instance 'uffi-array-type :element-type element-type :nelems count))
! 
  ;; UFFI's :(unsigned-)char
  (cffi:define-foreign-type uffi-char (base-type)
    base-type)
--- 148,158 ----
    t)
  
  (cffi:define-type-spec-parser uffi-array (element-type count)
!   (cond ((cffi::find-type (intern (format nil "ANON-UFFI-ARRAY-TYPE-~A-~D"
!                           element-type
!                           count)))) 
!         (t (make-instance 'uffi-array-type :element-type element-type :nelems count))))
!   
  ;; UFFI's :(unsigned-)char
  (cffi:define-foreign-type uffi-char (base-type)
    base-type)







More information about the cffi-devel mailing list