Skip to content
Snippets Groups Projects
Commit 3cd314c8 authored by Liam Healy's avatar Liam Healy
Browse files

Use fsbv:object for conversion if available; fix results of dot, cdot tests

In cl-convert-form, use fsbv:object on foreign structs if FSBV has
been loaded.  Previously, the conversion of (complex single-float) was
wrong because it assumed numbers were double-float; the test results
for dot and cdot have been fixed.
parent 158a845d
No related branches found
No related tags found
No related merge requests found
;; Expand the body of a defmfun ;; Expand the body of a defmfun
;; Liam Healy 2009-04-13 22:07:13EDT body-expand.lisp ;; Liam Healy 2009-04-13 22:07:13EDT body-expand.lisp
;; Time-stamp: <2010-06-27 18:25:27EDT body-expand.lisp> ;; Time-stamp: <2010-11-27 13:54:41EST body-expand.lisp>
;; ;;
;; Copyright 2009, 2010 Liam M. Healy ;; Copyright 2009, 2010 Liam M. Healy
;; Distributed under the terms of the GNU General Public License ;; Distributed under the terms of the GNU General Public License
...@@ -84,19 +84,24 @@ ...@@ -84,19 +84,24 @@
(defun cl-convert-form (decl) (defun cl-convert-form (decl)
"Generate a form that calls the appropriate converter from C/GSL to CL." "Generate a form that calls the appropriate converter from C/GSL to CL."
(case (grid:st-actual-type decl) (or
(sf-result #+fsbv
`((val ,(grid:st-symbol decl)) (if (member (grid:st-actual-type decl) fsbv::*libffi-struct-defs*)
(err ,(grid:st-symbol decl)))) `((fsbv:object ,(grid:st-symbol decl) ',(grid:st-actual-type decl))))
(sf-result-e10 #-fsbv nil
`((val ,(grid:st-symbol decl) 'sf-result-e10) (case (grid:st-actual-type decl)
(e10 ,(grid:st-symbol decl)) (sf-result
(err ,(grid:st-symbol decl) 'sf-result-e10))) `((val ,(grid:st-symbol decl))
(grid:complex-double-c (err ,(grid:st-symbol decl))))
`((grid:complex-to-cl ,(grid:st-symbol decl) 0 'grid:complex-double-c))) (sf-result-e10
(grid:complex-float-c `((val ,(grid:st-symbol decl) 'sf-result-e10)
`((grid:complex-to-cl ,(grid:st-symbol decl) 0 'grid:complex-float-c))) (e10 ,(grid:st-symbol decl))
(t `((cffi:mem-aref ,(grid:st-symbol decl) ',(grid:st-actual-type decl)))))) (err ,(grid:st-symbol decl) 'sf-result-e10)))
(grid:complex-double-c
`((grid:complex-to-cl ,(grid:st-symbol decl) 'grid:complex-double-c)))
(grid:complex-float-c
`((grid:complex-to-cl ,(grid:st-symbol decl) 'grid:complex-float-c)))
(t `((cffi:mem-aref ,(grid:st-symbol decl) ',(grid:st-actual-type decl)))))))
(defun body-expand (name arglist gsl-name c-arguments key-args) (defun body-expand (name arglist gsl-name c-arguments key-args)
"Expand the body (computational part) of the defmfun." "Expand the body (computational part) of the defmfun."
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
(LISP-UNIT:DEFINE-TEST CDOT (LISP-UNIT:DEFINE-TEST CDOT
(LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
(LIST #C(-1.1684039224427728d28 0.0d0)) (LIST #C(-6252.624 -6236.0503))
(MULTIPLE-VALUE-LIST (MULTIPLE-VALUE-LIST
(LET ((V1 (LET ((V1
(GRID:MAKE-FOREIGN-ARRAY (GRID:MAKE-FOREIGN-ARRAY
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
-49.08d0)))) -49.08d0))))
(DOT V1 V2)))) (DOT V1 V2))))
(LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
(LIST #C(-8.778225633844878d26 0.0d0)) (LIST #C(625.9737 -4310.1177))
(MULTIPLE-VALUE-LIST (MULTIPLE-VALUE-LIST
(LET ((V1 (LET ((V1
(GRID:MAKE-FOREIGN-ARRAY (GRID:MAKE-FOREIGN-ARRAY
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment