Next: , Previous: , Up: Foreign Types   [Contents][Index]


define-parse-method

define-parse-method

Syntax

Macro: define-parse-method name lambda-list &body body ⇒ name

Arguments and Values

type-name

A symbol naming the new foreign type.

lambda-list

A lambda list which is the argument list of the new foreign type.

body

One or more forms that provide a definition of the new foreign type.

Description

Examples

Taken from CFFI’s :boolean type definition:

  (define-foreign-type :boolean (&optional (base-type :int))
    "Boolean type. Maps to an :int by default. Only accepts integer types."
    (ecase base-type
      ((:char
        :unsigned-char
        :int
        :unsigned-int
        :long
        :unsigned-long) base-type)))
   
  CFFI> (canonicalize-foreign-type :boolean)
  ⇒ :INT
  CFFI> (canonicalize-foreign-type '(:boolean :long))
  ⇒ :LONG
  CFFI> (canonicalize-foreign-type '(:boolean :float))
  ;; error→ signalled by ECASE.
  

See Also

define-foreign-type