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

New function #'cl-cffi renamed from #'cl-ffa

To make terminology consistent, the "C standard" form of type, also
what I call "CFFI" form, is called that instead of "FFA" in some
places.  Specifically, #'cl-cffi is renamed from #'cl-ffa and now the
name matches the already-existing #'cffi-cl.
parent 1e3e4a57
No related branches found
No related tags found
No related merge requests found
;; Data using ffa ;; "Data" is bulk arrayed data, like vectors, matrices, permutations,
;; Liam Healy 2008-04-06 21:23:41EDT data-ffa.lisp ;; combinations, or histograms.
;; Time-stamp: <2008-11-02 17:38:20EST data.lisp> ;; Liam Healy 2008-04-06 21:23:41EDT
;; Time-stamp: <2008-11-11 21:37:21EST data.lisp>
;; $Id$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -58,7 +59,7 @@ ...@@ -58,7 +59,7 @@
(defun element-size (object) (defun element-size (object)
"The size of each element as stored in C." "The size of each element as stored in C."
(cffi:foreign-type-size (cl-ffa (element-type object)))) (cffi:foreign-type-size (cl-cffi (element-type object))))
;;;;**************************************************************************** ;;;;****************************************************************************
;;;; Definition of specific data classes ;;;; Definition of specific data classes
...@@ -134,7 +135,7 @@ ...@@ -134,7 +135,7 @@
;;;;**************************************************************************** ;;;;****************************************************************************
(defun component-type (eltype) (defun component-type (eltype)
(cl-ffa (component-float-type eltype))) (cl-cffi (component-float-type eltype)))
(defun component-size (object) (defun component-size (object)
(if (subtypep (element-type object) 'complex) (if (subtypep (element-type object) 'complex)
......
;; Get/set array or elements: cl-array, maref ;; Get/set array or elements: cl-array, maref
;; Liam Healy 2008-08-27 22:43:10EDT maref.lisp ;; Liam Healy 2008-08-27 22:43:10EDT maref.lisp
;; Time-stamp: <2008-08-31 11:07:34EDT maref.lisp> ;; Time-stamp: <2008-11-11 21:37:44EST maref.lisp>
;; $Id: $ ;; $Id: $
(in-package :gsl) (in-package :gsl)
...@@ -128,8 +128,8 @@ ...@@ -128,8 +128,8 @@
category tp) category tp)
,@ffrestargs ,@ffrestargs
,@(if value-symbol ,@(if value-symbol
(list (cl-ffa tp) value-symbol) (list (cl-cffi tp) value-symbol)
(list (cl-ffa tp)))))) (list (cl-cffi tp))))))
*array-element-types*)))) *array-element-types*))))
(defmethod maref (defmethod maref
......
;; Macro for defining GSL functions. ;; Macro for defining GSL functions.
;; Liam Healy 2008-04-16 20:49:50EDT defmfun.lisp ;; Liam Healy 2008-04-16 20:49:50EDT defmfun.lisp
;; Time-stamp: <2008-11-09 11:11:50EST defmfun.lisp> ;; Time-stamp: <2008-11-11 21:37:46EST defmfun.lisp>
;; $Id$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -263,7 +263,7 @@ ...@@ -263,7 +263,7 @@
gsl-function-name))) gsl-function-name)))
(remf key-args :documentation) (remf key-args :documentation)
(when (eq c-return :element-c-type) (when (eq c-return :element-c-type)
(setf (getf key-args :c-return) (cl-ffa eltype))) (setf (getf key-args :c-return) (cl-cffi eltype)))
(when (eq c-return :component-float-type) (when (eq c-return :component-float-type)
(setf (getf key-args :c-return) (component-type eltype))) (setf (getf key-args :c-return) (component-type eltype)))
(if (and (llkp arglist) (listp (first gsl-name))) ; ad-hoc detection! (if (and (llkp arglist) (listp (first gsl-name))) ; ad-hoc detection!
...@@ -396,7 +396,7 @@ ...@@ -396,7 +396,7 @@
(make-st (st-symbol v) (make-st (st-symbol v)
(if (eq (st-type v) :component-float-type) (if (eq (st-type v) :component-float-type)
(component-type element-type) (component-type element-type)
(cl-ffa element-type))) (cl-cffi element-type)))
v)) v))
c-arguments)) c-arguments))
......
;; Mapping of element type names ;; Mapping of element type names
;; Liam Healy 2008-04-13 11:22:46EDT element-types.lisp ;; Liam Healy 2008-04-13 11:22:46EDT element-types.lisp
;; Time-stamp: <2008-09-14 18:09:39EDT element-types.lisp> ;; Time-stamp: <2008-11-11 21:34:47EST element-types.lisp>
;; $Id$ ;; $Id$
;;; The different element type forms: ;;; The different element type forms:
;;; C standard full :unsigned-char ;;; C standard full, or "CFFI" :unsigned-char
;;; GSL splice name "uchar" ;;; GSL splice name "uchar"
;;; C explicit :uint8 (not used here) ;;; C explicit :uint8 (not used here)
;;; CL '(unsigned-byte 8) ;;; CL '(unsigned-byte 8)
;;; Single 'unsigned-byte-8 ;;; Single 'unsigned-byte-8
;;; Functions to perform conversions ;;; Functions to perform conversions
;;; CL -> single in function #'cl-single ;;; CL -> single in function #'cl-single
;;; CL -> GSL in function #'cl-gsl ;;; CL -> GSL in function #'cl-gsl
;;; CL -> Cstd in function #'cl-ffa ;;; CL -> CFFI (Cstd) in function #'cl-cffi
;;; CFFI (Cstd) -> CL in function #'cffi-cl ;;; CFFI (Cstd) -> CL in function #'cffi-cl
;;; Sources of equivalence ;;; Sources of equivalence
...@@ -181,12 +181,12 @@ ...@@ -181,12 +181,12 @@
(concatenate 'string "_" string) (concatenate 'string "_" string)
string))) string)))
(defun cl-ffa (cl-type) (defun cl-cffi (cl-type)
"The FFA/CFFI element type from the CL type." "The CFFI element type from the CL type."
(lookup-type (clean-type cl-type) *cstd-cl-type-mapping* t)) (lookup-type (clean-type cl-type) *cstd-cl-type-mapping* t))
(defun cffi-cl (cffi-type) (defun cffi-cl (cffi-type)
"The CL type from the FFA/CFFI element type." "The CL type from the CFFI element type."
(unless (eq cffi-type :pointer) (unless (eq cffi-type :pointer)
(lookup-type cffi-type *cstd-cl-type-mapping*))) (lookup-type cffi-type *cstd-cl-type-mapping*)))
...@@ -238,9 +238,9 @@ ...@@ -238,9 +238,9 @@
(cerror "Accept gibberish." (cerror "Accept gibberish."
"Cannot pass complex scalars to and from GSL functions (structs passed by value).") "Cannot pass complex scalars to and from GSL functions (structs passed by value).")
(let* ((cleantype (clean-type (type-of number))) (let* ((cleantype (clean-type (type-of number)))
(comptype (cl-ffa (second cleantype))) (comptype (cl-cffi (second cleantype)))
(datslot (datslot
(cffi:foreign-slot-pointer gsl (cl-ffa cleantype) 'dat))) (cffi:foreign-slot-pointer gsl (cl-cffi cleantype) 'dat)))
(setf (cffi:mem-aref datslot comptype 0) (realpart number) (setf (cffi:mem-aref datslot comptype 0) (realpart number)
(cffi:mem-aref datslot comptype 1) (imagpart number)) (cffi:mem-aref datslot comptype 1) (imagpart number))
gsl)) gsl))
...@@ -280,7 +280,6 @@ ...@@ -280,7 +280,6 @@
(defparameter *array-element-types* (defparameter *array-element-types*
(remove-duplicates (all-types *cstd-cl-type-mapping* t) :test 'equal) (remove-duplicates (all-types *cstd-cl-type-mapping* t) :test 'equal)
;;(all-types ffa::*cffi-and-lisp-types* t)
"All the array element types supported.") "All the array element types supported.")
(defparameter *array-element-types-no-complex* (defparameter *array-element-types-no-complex*
......
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