Permalink
Browse files

Fix type definitions and uses for current CFFI(0.10.7)

Keywords aren't allowed any more as foreign type names
  • Loading branch information...
1 parent 74ecc59 commit 92f8754d2a8628905747cd711ab28e9df19faeb1 @sionescu sionescu committed May 1, 2012
Showing with 17 additions and 16 deletions.
  1. +5 −5 examples.lisp
  2. +8 −8 foreign-numeric-vector.lisp
  3. +2 −1 packages.lisp
  4. +2 −2 utils.lisp
View
@@ -296,25 +296,25 @@
;; This isn't valid, we don't have the right type converter in place.
;; (defun complex-double-float-write-mem-aref (length reps)
-;; (let ((foreign (foreign-alloc :complex-double :count length)))
+;; (let ((foreign (foreign-alloc 'complex-double :count length)))
;; (declare (type fixnum length)
;; (type fixnum reps))
;; (fixtimes (r reps)
;; (fixtimes (i length)
-;; (setf (mem-aref foreign :complex-double i) #C(1.0d0 1.0d0))))
+;; (setf (mem-aref foreign 'complex-double i) #C(1.0d0 1.0d0))))
;; (format t "Filled foreign array with #C(1.0d0 1.0d0), using mem-aref.")))
;; (defun complex-double-float-write-mem-ref (length reps)
-;; (let ((foreign (foreign-alloc :complex-double :count length)))
+;; (let ((foreign (foreign-alloc 'complex-double :count length)))
;; (declare (type fixnum length)
;; (type fixnum reps))
;; (fixtimes (r reps)
;; (fixtimes (i length)
;; (setf (mem-ref foreign
-;; :complex-double
-;; (fix* #.(foreign-type-size :complex-double) i))
+;; 'complex-double
+;; (fix* #.(foreign-type-size 'complex-double) i))
;; #C(1.0d0 1.0d0))))
;; (format t "Filled foreign array with #C(1.0d0 1.0d0), using mem-ref.")))
@@ -61,7 +61,7 @@
(lowlevel-copier (ncat 'lowlevel-copy- cffi-underlying-type))
(copy-fnv-name (ncat 'copy- fnv-name))
(constructor (ncat 'make- fnv-name '-internal))
- (key-name (intern (symbol-name name) :keyword))
+ (key-name name)
(fnv-ref (ncat fnv-name '-ref))
(fnv-ptr-ref (ncat fnv-name '-ptr-ref))
(set-fnv-ref (ncat 'set- fnv-ref))
@@ -82,7 +82,7 @@
(defun ,make-fnv-name (length &key foreign-ptr initial-value)
(let ((foreign-ptr (or foreign-ptr
- (foreign-alloc ,key-name :count length))))
+ (foreign-alloc ',key-name :count length))))
(let ((,fnv-name
(,constructor :foreign-pointer foreign-ptr
:length (if (null-pointer-p foreign-ptr)
@@ -285,24 +285,24 @@
',with-fnv-ptr-name ',cffi-type)))))))
-(make-fnv-typed-vector int32
+(make-fnv-typed-vector :int32
:lisp-type (signed-byte 32)
:cffi-underlying-type :int32)
#+cffi-features:x86-64
-(make-fnv-typed-vector int64
+(make-fnv-typed-vector :int64
:lisp-type (signed-byte 64)
:cffi-underlying-type :int64)
(deftype :fnv-int ()
#+cffi-features:x86 :fnv-int64
#-cffi-features:x86 :fnv-int32)
-(make-fnv-typed-vector float
+(make-fnv-typed-vector :float
:lisp-type single-float
:cffi-underlying-type :float)
-(make-fnv-typed-vector double
+(make-fnv-typed-vector :double
:lisp-type double-float
:cffi-underlying-type :double)
@@ -313,7 +313,7 @@
:cffi-elts-per-lisp-elt 2
:lisp-constructor complex
:part-extractors (realpart imagpart)
- :cffi-vector-name :complex-float
+ :cffi-vector-name complex-float
:sorters (((lambda (i j)
(flet ((mag^2 (i)
(+ (* (realpart i) (realpart i))
@@ -334,7 +334,7 @@
:cffi-elts-per-lisp-elt 2
:lisp-constructor complex
:part-extractors (realpart imagpart)
- :cffi-vector-name :complex-double
+ :cffi-vector-name complex-double
:sorters (((lambda (i j)
(flet ((mag^2 (i)
(+ (* (realpart i) (realpart i))
View
@@ -8,7 +8,8 @@
(defpackage :org.middleangle.foreign-numeric-vector-utils
(:nicknames :fnv-utils)
(:use :common-lisp :cffi :iterate)
- (:export :ncat :with-gensyms :fixfor :fixtimes
+ (:export :complex-float :complex-double
+ :ncat :with-gensyms :fixfor :fixtimes
:fix+ fix* :fix- :fix/
:df+ :df* :df- :df/
:sf+ :sf* :sf- :sf/
View
@@ -50,10 +50,10 @@
(make-typed-ops (complex single-float) csf)
-(defcstruct :complex-float
+(defcstruct complex-float
(real :float)
(imag :float))
-(defcstruct :complex-double
+(defcstruct complex-double
(real :double)
(imag :double))

0 comments on commit 92f8754

Please sign in to comment.