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


foreign-enum-value

foreign-enum-value

Syntax

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

Arguments and Values

type

An enum type.

keyword

A keyword symbol.

errorp

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

value

An integer.

Description

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

An error is signaled if type doesn’t contain such keyword, and errorp is true.

Examples

  (defcenum boolean
    :no
    :yes)
   
  CFFI> (foreign-enum-value 'boolean :yes)
  ⇒ 1

See Also

defcenum
foreign-enum-keyword