Common Lisp Package: CFFI-UFFI-COMPAT

README:

FUNCTION

Public

DEFAULT-FOREIGN-LIBRARY-TYPE

Returns string naming default library type for platform

FIND-FOREIGN-LIBRARY (NAMES DIRECTORIES &KEY TYPES DRIVE-LETTERS)

Looks for a foreign library. directories can be a single string or a list of strings of candidate directories. Use default library type if type is not specified.

FOREIGN-LIBRARY-TYPES

Returns list of string naming possible library types for platform, sorted by preference

GETENV (VAR)

Return the value of the environment variable.

RUN-SHELL-COMMAND (CONTROL-STRING &REST ARGS &KEY OUTPUT)

Interpolate ARGS into CONTROL-STRING as if by FORMAT, and synchronously execute the result using a Bourne-compatible shell, with output to *trace-output*. Returns the shell's exit code.

Undocumented

CONVERT-FROM-FOREIGN-USB8 (S LEN)

FOREIGN-ENCODED-OCTET-COUNT (STR &KEY ENCODING)

FOREIGN-STRING-LENGTH (FOREIGN-STRING)

LOAD-FOREIGN-LIBRARY (FILENAME &KEY MODULE SUPPORTING-LIBRARIES FORCE-LOAD)

Private

CONVERT-UFFI-TYPE (UFFI-TYPE)

Convert a UFFI primitive type to a CFFI type.

Undocumented

%FOREIGN-SLOT-VALUE (OBJ TYPE FIELD)

SETF%FOREIGN-SLOT-VALUE (VALUE OBJ TYPE FIELD)

CONVERT-SUPPORTING-LIBRARIES-TO-STRING (LIBS)

MACRO

Public

ALLOCATE-FOREIGN-OBJECT (TYPE &OPTIONAL (SIZE 1))

Allocate one or more instance of a foreign type.

CONVERT-FROM-CSTRING (S)

Convert a cstring to a Lisp string.

CONVERT-TO-CSTRING (OBJ)

Convert a Lisp string to a cstring.

DEF-ARRAY-POINTER (NAME TYPE)

Define a foreign array type.

DEF-CONSTANT (NAME VALUE &KEY EXPORT)

Define a constant and conditionally export it.

DEF-ENUM (ENUM-NAME ARGS &KEY (SEPARATOR-STRING #))

Creates a constants for a C type enum list, symbols are created in the created in the current package. The symbol is the concatenation of the enum-name name, separator-string, and field-name

DEF-FOREIGN-TYPE (NAME TYPE)

Define a new foreign type.

DEF-FOREIGN-VAR (NAME TYPE MODULE)

Define a symbol macro to access a foreign variable.

DEF-FUNCTION (NAME ARGS &KEY MODULE (RETURNING VOID))

Define a foreign function.

DEF-STRUCT (NAME &BODY FIELDS)

Define a C structure.

DEF-TYPE (NAME TYPE)

Define a Common Lisp type NAME for UFFI type TYPE.

DEF-UNION (NAME &BODY FIELDS)

Define a foreign union type.

DEREF-ARRAY (ARRAY TYPE POSITION)

Dereference an array.

DEREF-POINTER (PTR TYPE)

Dereference a pointer.

ENSURE-CHAR-CHARACTER (OBJ &ENVIRONMENT ENV)

Convert OBJ to a character if it is an integer.

ENSURE-CHAR-INTEGER (OBJ &ENVIRONMENT ENV)

Convert OBJ to an integer if it is a character.

ENSURE-CHAR-STORABLE (OBJ)

Ensure OBJ is storable as a character.

FREE-CSTRING (PTR)

Free a cstring.

FREE-FOREIGN-OBJECT (PTR)

Free a foreign object allocated by ALLOCATE-FOREIGN-OBJECT.

GET-SLOT-POINTER (OBJ TYPE FIELD)

Access a pointer slot value from a structure.

GET-SLOT-VALUE (OBJ TYPE FIELD)

Access a slot value from a structure.

MAKE-NULL-POINTER (TYPE)

Create a NULL pointer.

MAKE-POINTER (ADDRESS TYPE)

Create a pointer to ADDRESS.

NULL-CHAR-P (VAL)

Return true if character is null.

NULL-POINTER-P (PTR)

Return true if PTR is a null pointer.

POINTER-ADDRESS (PTR)

Return the address of a pointer.

SIZE-OF-FOREIGN-TYPE (TYPE)

Return the size in bytes of a foreign type.

WITH-CAST-POINTER ((VAR PTR TYPE) &BODY BODY)

Cast a pointer, does nothing in CFFI.

WITH-CSTRING ((FOREIGN-STRING LISP-STRING) &BODY BODY)

Binds a newly creating string.

WITH-FOREIGN-OBJECT ((VAR TYPE) &BODY BODY)

Wrap the allocation of a foreign object around BODY.

Undocumented

ALLOCATE-FOREIGN-STRING (SIZE &KEY UNSIGNED)

CHAR-ARRAY-TO-POINTER (OBJ)

CONVERT-FROM-FOREIGN-STRING (OBJ &KEY LENGTH (LOCALE DEFAULT) (ENCODING '*DEFAULT-FOREIGN-ENCODING*) (NULL-TERMINATED-P T))

CONVERT-TO-FOREIGN-STRING (OBJ &OPTIONAL (ENCODING '*DEFAULT-FOREIGN-ENCODING*))

DEF-POINTER-VAR (NAME VALUE &OPTIONAL DOC)

OCTETS-TO-STRING (OCTETS &KEY ENCODING)

STRING-TO-OCTETS (STR &KEY ENCODING NULL-TERMINATE)

WITH-CSTRINGS (BINDINGS &REST BODY)

WITH-FOREIGN-OBJECTS (BINDINGS &REST BODY)

WITH-FOREIGN-STRING ((FOREIGN-STRING LISP-STRING) &BODY BODY)

WITH-FOREIGN-STRINGS (BINDINGS &BODY BODY)

SLOT-ACCESSOR

Private

Undocumented

ELEMENT-TYPE (OBJECT)

SETFELEMENT-TYPE (NEW-VALUE OBJECT)

NELEMS (OBJECT)

SETFNELEMS (NEW-VALUE OBJECT)

VARIABLE

Public

+NULL-CSTRING-POINTER+

A constant NULL string pointer.

Private

*LOADED-LIBRARIES*

List of foreign libraries loaded. Used to prevent reloading a library

CLASS

Private

UFFI-ARRAY-TYPE

UFFI's :array type.