Next: , Previous: foreign-bitfield-value, Up: Foreign Types


foreign-enum-keyword

Syntax

— Function: foreign-enum-keyword type value &key errorp ⇒ keyword

Arguments and Values

type
An enum type.
value
An integer.
errorp
If true (the default), signal an error if value is not defined in type. If false, foreign-enum-keyword returns nil.
keyword
A keyword symbol.

Description

The function foreign-enum-keyword returns the keyword symbol that corresponds to value in type.

An error is signaled if type doesn't contain such value and errorp is true.

Examples

  (defcenum boolean
    :no
    :yes)
   
  CFFI> (foreign-enum-keyword 'boolean 1)
  => :YES

See Also

defcenum
foreign-enum-value