Common Lisp Package: FFA

README:

FUNCTION

Public

ELT-TYPE (CFFI-ELT-TYPE)

Return the Lisp array element-type matching cffi-elt-type, nil if not found.

Private

COMPLEX-MEM-AREF (POINTER PART-TYPE INDEX)

aref workaround for C99 complex types. Part-type is NOT checked.

SETFCOMPLEX-MEM-AREF (C POINTER PART-TYPE INDEX)

setf aref workaround for C99 complex types. Part-type is NOT checked.

COPY-ARRAY-FROM-POINTER (ARRAY POINTER CFFI-TYPE LISP-TYPE INDEX-OFFSET SIZE)

Copy size elements to an array (starting at index-offset) of element type lisp-type from the memory area that starts at pointer, coercing the elements if necessary.

COPY-ARRAY-TO-POINTER (ARRAY POINTER CFFI-TYPE LISP-TYPE INDEX-OFFSET SIZE)

Copy size elements from array (starting at index-offset) of type lisp-type to the memory area that starts at pointer, coercing the elements if necessary.

DISPLACE-ARRAY (ARRAY DIMENSIONS INDEX-OFFSET)

Make a displaced array from array with the given dimensions and the index-offset and the same element-type as array. Tries to displace from the original array.

FIND-ORIGINAL-ARRAY (ARRAY)

Find the original parent of a displaced array, return this and the sum of displaced index offsets.

PART-TYPE (CFFI-TYPE)

Return the appropriate part-type if cffi-type is complex, otherwise NIL.

VALID-DIRECTION-P (DIRECTION)

Test if the given direction is valid.

Undocumented

ELT-TYPE-SIZE (CFFI-ELT-TYPE)

MACRO

Public

WITH-POINTER-TO-ARRAY ((ARRAY POINTER CFFI-TYPE SIZE DIRECTION) &BODY BODY)

See the documentation.

WITH-POINTERS-TO-ARRAYS (PARAMETER-LISTS &BODY BODY)

Same as with-pointer-to-array, but with multiple arrays, pointers, etc. parameter-lists needs to be a list of lists.

Private

COPY-TO-POINTER ((ARRAY POINTER CFFI-TYPE SIZE INDEX-OFFSET DIRECTION) &BODY BODY)

Allocate memory area and establish desired mapping between array and pointer (copy in and/or out as needed). Array will be available at pointer, which is a local binding so you do whatever you want with it (change its value etc).

ITER% (&BODY BODY)

Common iteration for all cases below. IMPORTANT: This macro captures pointer-index, size, array-index and index-offset.

PIN-TO-POINTER ((ARRAY POINTER CFFI-TYPE SIZE INDEX-OFFSET) &BODY BODY)

Use SBCL's sb-sys:with-pinned-objects and sb-ext:array-storage-vector for mapping an array to a memory location. NOTE: checking that cffi-type matches the type of the array is the responsibility of the user of this macro. The total size of the array is checked.

VARIABLE

Private

Undocumented

*CFFI-AND-LISP-TYPES*