Commit d9e5bb32 authored by Liam Healy's avatar Liam Healy

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
;; Data using ffa
;; Liam Healy 2008-04-06 21:23:41EDT data-ffa.lisp
;; Time-stamp: <2008-11-02 17:38:20EST data.lisp>
;; "Data" is bulk arrayed data, like vectors, matrices, permutations,
;; combinations, or histograms.
;; Liam Healy 2008-04-06 21:23:41EDT
;; Time-stamp: <2008-11-11 21:37:21EST data.lisp>
;; $Id$
(in-package :gsl)
......@@ -58,7 +59,7 @@
(defun element-size (object)
"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
......@@ -134,7 +135,7 @@
(defun component-type (eltype)
(cl-ffa (component-float-type eltype)))
(cl-cffi (component-float-type eltype)))
(defun component-size (object)
(if (subtypep (element-type object) 'complex)
;; Get/set array or elements: cl-array, maref
;; 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: $
(in-package :gsl)
......@@ -128,8 +128,8 @@
category tp)
,@(if value-symbol
(list (cl-ffa tp) value-symbol)
(list (cl-ffa tp))))))
(list (cl-cffi tp) value-symbol)
(list (cl-cffi tp))))))
(defmethod maref
;; Macro for defining GSL functions.
;; 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$
(in-package :gsl)
......@@ -263,7 +263,7 @@
(remf key-args :documentation)
(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)
(setf (getf key-args :c-return) (component-type eltype)))
(if (and (llkp arglist) (listp (first gsl-name))) ; ad-hoc detection!
......@@ -396,7 +396,7 @@
(make-st (st-symbol v)
(if (eq (st-type v) :component-float-type)
(component-type element-type)
(cl-ffa element-type)))
(cl-cffi element-type)))
;; Mapping of element type names
;; 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$
;;; The different element type forms:
;;; C standard full :unsigned-char
;;; GSL splice name "uchar"
;;; C explicit :uint8 (not used here)
;;; CL '(unsigned-byte 8)
;;; Single 'unsigned-byte-8
;;; C standard full, or "CFFI" :unsigned-char
;;; GSL splice name "uchar"
;;; C explicit :uint8 (not used here)
;;; CL '(unsigned-byte 8)
;;; Single 'unsigned-byte-8
;;; Functions to perform conversions
;;; CL -> single in function #'cl-single
;;; 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
;;; Sources of equivalence
......@@ -181,12 +181,12 @@
(concatenate 'string "_" string)
(defun cl-ffa (cl-type)
"The FFA/CFFI element type from the CL type."
(defun cl-cffi (cl-type)
"The CFFI element type from the CL type."
(lookup-type (clean-type cl-type) *cstd-cl-type-mapping* t))
(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)
(lookup-type cffi-type *cstd-cl-type-mapping*)))
......@@ -238,9 +238,9 @@
(cerror "Accept gibberish."
"Cannot pass complex scalars to and from GSL functions (structs passed by value).")
(let* ((cleantype (clean-type (type-of number)))
(comptype (cl-ffa (second cleantype)))
(comptype (cl-cffi (second cleantype)))
(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)
(cffi:mem-aref datslot comptype 1) (imagpart number))
......@@ -280,7 +280,6 @@
(defparameter *array-element-types*
(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.")
(defparameter *array-element-types-no-complex*
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment