[cl-gsl-cvs] CVS update: cl-gsl/ffi.lisp
cl-gsl-cvs at common-lisp.net
cl-gsl-cvs at common-lisp.net
Mon Apr 18 00:50:34 UTC 2005
Update of /project/cl-gsl/cvsroot/cl-gsl
In directory common-lisp.net:/tmp/cvs-serv22699
Modified Files:
ffi.lisp
Log Message:
Add matrix types.
Date: Mon Apr 18 02:50:33 2005
Author: edenny
Index: cl-gsl/ffi.lisp
diff -u cl-gsl/ffi.lisp:1.4 cl-gsl/ffi.lisp:1.5
--- cl-gsl/ffi.lisp:1.4 Mon Apr 4 02:44:15 2005
+++ cl-gsl/ffi.lisp Mon Apr 18 02:50:33 2005
@@ -72,94 +72,40 @@
;; ----------------------------------------------------------------------
-(def-foreign-struct gsl-block
- (size :unsigned-long)
- (data (* :double)))
-
-(def-foreign-struct gsl-vector
- (size :unsigned-long)
- (stride :unsigned-long)
- (data (* :double))
- (g-block (* gsl-block))
- (owner :int))
-
-(def-foreign-struct gsl-vector-view
- (vec (* gsl-vector)))
-
-;; ----------------------------------------------------------------------
-
-(def-foreign-struct gsl-block-float
- (size :unsigned-long)
- (data (* :float)))
-
-(def-foreign-struct gsl-vector-float
- (size :unsigned-long)
- (stride :unsigned-long)
- (data (* :float))
- (g-block (* gsl-block-float))
- (owner :int))
-
-(def-foreign-struct gsl-vector-float-view
- (vec (* gsl-vector-float)))
-
-;; ----------------------------------------------------------------------
-
-(def-foreign-struct gsl-block-int
- (size :unsigned-long)
- (data (* :int)))
-
-(def-foreign-struct gsl-vector-int
- (size :unsigned-long)
- (stride :unsigned-long)
- (data (* :int))
- (g-block (* gsl-block-int))
- (owner :int))
-
-(def-foreign-struct gsl-vector-int-view
- (vec (* gsl-vector-int)))
-
-;; ----------------------------------------------------------------------
-
-(def-foreign-struct gsl-block-complex
- (size :unsigned-long)
- (data (* :double)))
-
-(def-foreign-struct gsl-vector-complex
- (size :unsigned-long)
- (stride :unsigned-long)
- (data (* :double))
- (g-block (* gsl-block-complex))
- (owner :int))
-
-(def-foreign-struct gsl-vector-complex-view
- (vec (* gsl-vector-complex)))
-
-;; ----------------------------------------------------------------------
-
-(def-foreign-struct gsl-block-complex-float
- (size :unsigned-long)
- (data (* :float)))
-
-(def-foreign-struct gsl-vector-complex-float
- (size :unsigned-long)
- (stride :unsigned-long)
- (data (* :float))
- (g-block (* gsl-block-complex-float))
- (owner :int))
-
-(def-foreign-struct gsl-vector-complex-float-view
- (vec (* gsl-vector-complex-float)))
+(defmacro def-block-vector-matrix-struct% (struct-postfix data-type)
+ `(progn
+ (def-foreign-struct ,(kmrcl:concat-symbol 'gsl-block struct-postfix)
+ (size :unsigned-long)
+ (data (* ,data-type)))
+
+ (def-foreign-struct ,(kmrcl:concat-symbol 'gsl-vector struct-postfix)
+ (size :unsigned-long)
+ (stride :unsigned-long)
+ (data (* ,data-type))
+ (g-block (* ,(kmrcl:concat-symbol 'gsl-block struct-postfix)))
+ (owner :int))
+
+ (def-foreign-struct ,(kmrcl:concat-symbol 'gsl-matrix struct-postfix)
+ (size1 :unsigned-long)
+ (size2 :unsigned-long)
+ (tda :unsigned-long)
+ (data (* ,data-type))
+ (g-block (* ,(kmrcl:concat-symbol 'gsl-block struct-postfix)))
+ (owner :int))
+
+ ;; FIXME: is this correct?
+ (def-foreign-struct ,(kmrcl:concat-symbol 'gsl-vector struct-postfix '-view)
+ (vec (* ,(kmrcl:concat-symbol 'gsl-vector struct-postfix))))))
+
+
+(def-block-vector-matrix-struct% "" :double)
+(def-block-vector-matrix-struct% "-float" :float)
+(def-block-vector-matrix-struct% "-int" :int)
+(def-block-vector-matrix-struct% "-complex" :double)
+(def-block-vector-matrix-struct% "-complex-float" :float)
;; ----------------------------------------------------------------------
-(def-foreign-struct gsl-matrix
- (size1 :unsigned-long)
- (size2 :unsigned-long)
- (tda :unsigned-long)
- (data (* :double))
- (g-block (* gsl-block))
- (owner :int))
-
(defmacro register-foreign-types ()
`(progn
,@(mapcar #'(lambda (elm) `(define-foreign-type ,(car elm) ,(cadr elm)))
@@ -184,6 +130,11 @@
(gsl-vector-complex-float-ptr '(* gsl-vector-complex-float))
(gsl-matrix-ptr '(* gsl-matrix))
+ (gsl-matrix-float-ptr '(* gsl-matrix-float))
+ (gsl-matrix-int-ptr '(* gsl-matrix-int))
+ (gsl-matrix-complex-ptr '(* gsl-matrix-complex))
+ (gsl-matrix-complex-float-ptr '(* gsl-matrix-complex-float))
+
(size-t-ptr '(* size-t))
))))
More information about the Cl-gsl-cvs
mailing list