cl-autowrap

API Reference

cl-autowrap

Import c2ffi specs and generate CFFI wrappers

AUTOWRAP

  • Function STRING+ (string &rest strings)
  • Function ASDF-PATH (system &rest path)
  • Condition AUTOWRAP-CONDITION
  • Condition AUTOWRAP-ERROR  (AUTOWRAP-CONDITION, ERROR)
  • Condition AUTOWRAP-CONTINUABLE-ERROR  (AUTOWRAP-ERROR)
  • Condition SIMPLE-AUTOWRAP-CONTINUABLE-ERROR  (AUTOWRAP-CONTINUABLE-ERROR, SIMPLE-ERROR)
  • Function AUTOWRAP-CONTINUABLE-ERROR (format-control &rest format-arguments)
  • Condition UNDEFINED-FOREIGN-TYPE  (AUTOWRAP-CONTINUABLE-ERROR)
  • Condition UNDEFINED-FOREIGN-TYPE-CONTEXTUALISED  (UNDEFINED-FOREIGN-TYPE)
  • Condition SFFI-CONDITION
  • Condition SFFI-ERROR  (SFFI-CONDITION, ERROR)
  • Condition SFFI-CONTINUABLE-ERROR  (SFFI-ERROR)
  • Condition SIMPLE-SFFI-CONTINUABLE-ERROR  (SFFI-CONTINUABLE-ERROR, SIMPLE-ERROR)
  • Function SFFI-CONTINUABLE-ERROR (format-control &rest format-arguments)
  • Condition INVALID-WRAPPER  (SFFI-ERROR)
  • Variable *C2FFI-PROGRAM*
    "c2ffi"
  • Variable *TRACE-C2FFI*
    nil
  • Struct WRAPPER
    PTR
    VALIDITY
  • Function MAKE-WRAPPER (&key ((ptr ptr) (cffi-sys:null-pointer)) ((validity validity) t))
  • Struct ANONYMOUS-TYPE
    No slots.
  • Function MAKE-ANONYMOUS-TYPE (&key ((ptr ptr) (cffi-sys:null-pointer)) ((validity validity) t))
  • Function WRAPPER-VALID-P (wrapper)
  • Function PTR (wrapper)
  • Function VALID-P (wrapper)
  • Function INVALIDATE (wrapper)
  • Function WRAP-POINTER (pointer type &optional (validity t))
  • Function WRAPPER-NULL-P (wrapper)
  • Macro AUTOCOLLECT ((&optional (ptr (intern "ptr"))) wrapper-form &body body)
  • Macro AUTOCOLLECT-CANCEL (wrapper)
  • Macro MAKING-AUTOCOLLECT-INSTANCE ((ptr-var type-name) pointer-form &body cleanup-body)
  • Macro WITH-AUTOCOLLECT-CANCEL ((wrapper &key (invalidate-p t)) &body body)
    Run `BODY`, and (by default, with `:invalidate-p` as `T`) invalidate `WRAPPER`. This is protected; a non-local exit from `BODY` will still invalidate `WRAPPER`.
  • Function MAKE-WRAPPER-INSTANCE (type-name &rest args)
  • Class FOREIGN-TYPE
    NAME   Accessor: FOREIGN-TYPE-NAME
    TYPE   Accessor: FOREIGN-TYPE
  • Method FOREIGN-TYPE-NAME ((object symbol))
  • Method FOREIGN-TYPE-NAME ((object wrapper))
  • Class FOREIGN-POINTER  (FOREIGN-TYPE)
    No slots.
  • Class FOREIGN-ALIAS  (FOREIGN-TYPE)
    No slots.
  • Class FOREIGN-ARRAY  (FOREIGN-POINTER)
    SIZE   Accessor: FOREIGN-ARRAY-SIZE
  • Class FOREIGN-STRING  (FOREIGN-POINTER)
    TYPE
  • Class FOREIGN-RECORD  (FOREIGN-TYPE)
    BIT-SIZE   Accessor: FOREIGN-RECORD-BIT-SIZE
    BIT-ALIGNMENT   Accessor: FOREIGN-RECORD-BIT-ALIGNMENT
    FIELDS   Accessor: FOREIGN-RECORD-FIELDS
  • Class FOREIGN-FIELD  (FOREIGN-TYPE)
    No slots.
  • Class FOREIGN-RECORD-FIELD  (FOREIGN-FIELD)
    BITFIELD-P   Accessor: FRF-BITFIELD-P
    BIT-OFFSET   Accessor: FRF-BIT-OFFSET
    BIT-ALIGNMENT   Accessor: FRF-BIT-ALIGNMENT
    BIT-SIZE   Accessor: FRF-BIT-SIZE
    BIT-WIDTH   Accessor: FRF-BIT-WIDTH
  • Class FOREIGN-ENUM  (FOREIGN-TYPE)
    VALUES   Accessor: FOREIGN-ENUM-VALUES
  • Class FOREIGN-SYMBOL  (FOREIGN-TYPE)
    C-SYMBOL   Accessor: FOREIGN-SYMBOL-C-SYMBOL
  • Class FOREIGN-EXTERN  (FOREIGN-SYMBOL)
    No slots.
  • Class FOREIGN-FUNCTION  (FOREIGN-RECORD, FOREIGN-SYMBOL)
    VARIADIC-P   Accessor: FOREIGN-FUNCTION-VARIADIC-P
  • Function FIND-TYPE (typespec)
  • Method FOREIGN-ENUM-VALUES ((object foreign-alias))
  • Function ENUM-VALUE (foreign-enum key)
  • Function ENUM-KEY (foreign-enum val)
  • Generic-Function BASIC-FOREIGN-TYPE (foreign-type)
    Return the most basic type for `FOREIGN-TYPE`
  • Method BASIC-FOREIGN-TYPE ((type foreign-type))
  • Method BASIC-FOREIGN-TYPE ((type symbol))
  • Method BASIC-FOREIGN-TYPE ((type foreign-enum))
  • Method BASIC-FOREIGN-TYPE ((type null))
  • Generic-Function FOREIGN-SCALAR-P (type)
    Return `T` if `TYPE` is a scalar type, or `NIL` (e.g., a record type)
  • Method FOREIGN-SCALAR-P ((type symbol))
  • Method FOREIGN-SCALAR-P (type)
  • Method FOREIGN-SCALAR-P ((type foreign-alias))
  • Generic-Function FOREIGN-TYPE-SIZE (type)
    The size for type `TYPE`, in bytes.
  • Method FOREIGN-TYPE-SIZE (type)
  • Method FOREIGN-TYPE-SIZE ((type foreign-record))
  • Method FOREIGN-TYPE-SIZE ((type foreign-enum))
  • Method FOREIGN-TYPE-SIZE ((type foreign-function))
  • Method FOREIGN-TYPE-SIZE ((type foreign-alias))
  • Method FOREIGN-TYPE-SIZE ((type foreign-array))
  • Method FOREIGN-TYPE-SIZE ((type foreign-pointer))
  • Method FOREIGN-TYPE-SIZE ((type symbol))
  • Generic-Function UNALIASED-TYPE (type)
    Find the unaliased type for TYPE
  • Method UNALIASED-TYPE ((type foreign-alias))
  • Method UNALIASED-TYPE ((type symbol))
  • Function BUILTIN-TYPE-P (type)
    Determine if TYPE is a builtin type (e.g., :char, :int, etc) or alias, vs anything else (including enums).
  • Function DEFINE-FOREIGN-TYPE (name type)
    Trivially define a foreign type given `NAME` and a `foreign-type` object, `TYPE`
  • Function DEFINE-FOREIGN-EXTERN (name c-symbol type)
    Define symbol `NAME` to be an extern of type `TYPE`.
  • Function DEFINE-FOREIGN-RECORD (name type bit-size bit-alignment field-list)
    Define a foreign record (struct or union) given `NAME`, a symbol, `TYPE`, either :struct or :union, and a list of fields. The actual name for the type will be `(:struct NAME)` or `(:union NAME)`, as appropriate.
  • Function DEFINE-FOREIGN-ENUM (name id value-list)
    Define a foreign enum given `NAME`, a symbol, and a list of symbol-to-integer mappings, `VALUE-LIST`. ID should be 0 unless anonymous-indexing is enabled and this will be later typedef'd by ID.
  • Macro DEFINE-ENUM-FROM-CONSTANTS ((name &optional regex) &body values)
    Define an enum *and alias* `NAME` from a list of constants `VALUES`. Each value should evaluate to actual values, e.g. actual `+CONSTANTS+`, or be a list in the form `'(SYMBOL VALUE)`. If a symbol is given alone, it is by default pruned of any common prefix and made into a keyword. If a list is specified, the symbol given is used exactly.
  • Function DEFINE-FOREIGN-ALIAS (name type)
  • Function DEFINE-FOREIGN-FUNCTION (name-and-options return-type params)
    => FOREIGN-FUNCTION Define a foreign function given a lisp symbol, C symbol (as a string), return type and parameters. Note this just defines to SFFI what the foreign function looks like .. it doesn't actually DEFUN something to call it.
  • Function FIND-FUNCTION (name-or-function)
  • Function FIND-EXTERN (name)
  • Function FIND-RECORD-FIELD (name-or-type field-name)
    => FOREIGN-RECORD-FIELD Given `NAME-OR-TYPE`, return the field object called `FIELD-NAME`.
  • Function ENSURE-TYPE (typespec context-format-control &rest context-format-args)
  • Macro INHIBIT-STRING-CONVERSION (&body body)
  • Macro DEFINE-CFUN (name-or-function &optional (package *package*))
  • Macro DEFINE-CEXTERN (name &optional (package *package*))
  • Function BITFIELD-MASK (bit-offset bit-size bit-alignment field-width)
  • Macro DEFINE-ACCESSORS (foreign-record &optional (package *package*))
  • Macro DEFINE-WRAPPER (type &optional (package *package*))
  • Macro DEFINE-WRAPPER* (type wrapper-name &key constructor conc-name)
  • Function FOREIGN-FUNCTION (function-name)
    Return a lambda which calls function `FUNCTION-NAME`. This is useful if you need to funcall foreign functions (which is quite handy!), since CFFI-SYS and thus SFFI use macros for ordinary calls.
  • Macro DEFCALLBACK (name return-type lambda-list &body body)
    This acts much like CFFI:DEFCALLBACK except it allows SFFI type aliases to be specified.
  • Macro CALLBACK (name)
  • Function ALLOC-PTR (type &optional (count 1))
    Return a pointer allocated to the size of `TYPE`
  • Function CALLOC-PTR (type &optional (count 1))
    Return a pointer allocated to the size of `TYPE`, initialized to zero
  • Function ALLOC (type &optional (count 1))
    Return a foreign wrapper for `TYPE` with its pointer allocated. Freeing is up to you!
  • Function CALLOC (type &optional (count 1))
    Return a foreign wrapper for `TYPE` with its pointer allocated, and its contents initialized to zero. Freeing is up to you!
  • Function REALLOC (ptr type count)
  • Function FREE (object)
    Free WRAPPER via FOREIGN-FREE and invalidate.
  • Function SIZEOF (type)
  • Macro WITH-ALLOC ((name type &optional (count 1)) &body body)
  • Macro WITH-CALLOC ((name type &optional (count 1)) &body body)
  • Macro WITH-MANY-ALLOC ((&rest bindings) &body body)
  • Function C-APTR (wrapper index &optional (type (foreign-type-name wrapper)))
  • Function C-AREF (wrapper index &optional (type (foreign-type-name wrapper)))
  • Function (setf C-AREF) (v ptr index type)
  • Function MEMCPY (dest src &key (n 1) type)
  • Function ALLOC-STRING (string)
  • Function GET-ERRNO-POINTER
  • Variable *FOREIGN-TYPE-SYMBOL-FUNCTION*
    'autowrap:default-foreign-type-symbol
  • Variable *FOREIGN-C-TO-LISP-FUNCTION*
    'autowrap:default-c-to-lisp
  • Function DEFAULT-C-TO-LISP (string)
  • Function DEFAULT-FOREIGN-TYPE-SYMBOL (string type package)
  • Macro C-INCLUDE (h-file &key (spec-path *default-pathname-defaults*) symbol-exceptions symbol-regex exclude-definitions exclude-sources exclude-arch include-definitions include-sources sysincludes (definition-package *package*) (function-package definition-package) (wrapper-package definition-package) (accessor-package wrapper-package) (constant-package definition-package) (extern-package accessor-package) constant-accessor exclude-constants (trace-c2ffi *trace-c2ffi*) no-accessors no-functions release-p version type-symbol-function c-to-lisp-function)
  • Function DEFINE-BITMASK (name mask)
  • Function FIND-BITMASK (name)
  • Function REMOVE-BITMASK (name)
  • Function MASK-SYMBOL-VALUE (mask symbol)
  • Function MASK (name &rest symbols)
    Create a mask by `LOGIOR` using the *list* of symbols `SYMBOLS` from the bitmask `NAME`.
  • Function MASK-APPLY (name symbols)
  • Function MASK-KEYWORDS (name value)
    Return the list of keywords which describe the integer mask `VALUE` for the bitmask called `NAME`. Limited to 64 bits at the moment.
  • Macro DEFINE-BITMASK-FROM-CONSTANTS ((name &optional regex) &body values)
    Define a bitmask `NAME` from a list of constants `VALUES`. Each value should evaluate to actual values, e.g. actual `+CONSTANTS+`, or be a list in the form `'(SYMBOL VALUE)`. If a symbol is given alone, it is by default pruned of any common prefix and made into a keyword. If a list is specified, the symbol given is used exactly.
  • Macro DEFINE-BITMASK-FROM-ENUM ((name enum-name) &body values)
    Define a bitmask `NAME` from the values specified in the previously-defined foreign-enum named `ENUM-NAME` and any additional values, `VALUES`. (A foreign-alias of an enum may also be specified.)

AUTOWRAP.MINIMAL

A minimal set of useful symbols for doing common things with autowrap.
No exported symbols.

Also exports

  • AUTOWRAP:DEFCALLBACK
  • AUTOWRAP:INVALIDATE
  • AUTOWRAP:FREE
  • AUTOWRAP:WITH-ALLOC
  • AUTOWRAP:ALLOC-PTR
  • AUTOWRAP:CALLBACK
  • AUTOWRAP:MASK
  • AUTOWRAP:ALLOC
  • AUTOWRAP:MASK-APPLY
  • AUTOWRAP:CALLOC-PTR
  • AUTOWRAP:INHIBIT-STRING-CONVERSION
  • AUTOWRAP:WRAPPER-NULL-P
  • AUTOWRAP:MAKING-AUTOCOLLECT-INSTANCE
  • AUTOWRAP:AUTOCOLLECT
  • AUTOWRAP:ENUM-KEY
  • AUTOWRAP:WITH-MANY-ALLOC
  • AUTOWRAP:MEMCPY
  • AUTOWRAP:MASK-KEYWORDS
  • AUTOWRAP:CALLOC
  • AUTOWRAP:AUTOCOLLECT-CANCEL
  • AUTOWRAP:WITH-AUTOCOLLECT-CANCEL
  • AUTOWRAP:ENUM-VALUE
  • AUTOWRAP:PTR
  • AUTOWRAP:SIZEOF

cl-autowrap-test

Testing for CL-AUTOWRAP, may require manual work to run

AUTOWRAP.TEST

No exported symbols.

cl-plus-c

Convenience and alternative mechanic for C/autowrap

PLUS-C

  • Condition C-UNKNOWN-FUNCTION  (ERROR)
  • Condition C-UNKNOWN-FIELD  (ERROR)
  • Macro C-FUN (name &rest args)
  • Macro C-REF (&whole whole-form wrapper type &rest fields)
  • Macro C-LET (bindings &body body)
  • Macro C-WITH (bindings &body body)
  • Macro C-VAL (bindings &body body)

Also exports

  • COMMON-LISP:*