All Manuals > LispWorks Foreign Language Interface User Guide and Reference Manual > 7 Function, Macro and Variable Reference

NextPrevUpTopContentsIndex

enum-symbol-value

enum-value-symbol

enum-values

enum-symbols

enum-symbol-value-pairs

Functions
Summary

Finds values and symbols in a FLI enumerator type.

Package

fli

Signature

enum-symbol-value enum-type symbol => value

enum-value-symbol enum-type value => symbol

enum-values enum-type => values

enum-symbols enum-type => symbols

enum-symbol-value-pairs enum-type => pairs

Arguments

enum-type

A FLI enumerator type defined by define-c-enum.

symbol

A symbol.

value

An integer.

Values

value

An integer or nil.

symbol

A symbol or nil.

values

A list.

symbols

A list.

pairs

A list of conses.

Description

The function enum-symbol-value returns the value value of symbol symbol in the FLI enumerator type enum-type, or nil if enum-type does not contain symbol.

The function enum-value-symbol returns the symbol symbol in the FLI enumerator type enum-type at value value, or nil if value is out of range for enum-type.

The functions enum-values, enum-symbols and enum-symbol-value-pairs respectively return a list of the values, symbols and pairs for the enum-type, where a pair is a cons of symbol and value.

enum-type must be defined by define-c-enum.

Example
(fli:define-c-enum colors red green blue)
=>
(:ENUM COLORS)
 
(fli:enum-symbol-value 'COLORS 'red)
=>
0
 
(fli:enum-value-symbol 'COLORS 0)
=>
RED
(fli:define-c-enum half_year (jan 1) feb mar apr may jun)
=>
(:ENUM HALF_YEAR)
 
(fli:enum-symbol-value 'HALF_YEAR 'feb)
=>
2
 
(fli:enum-value-symbol 'HALF_YEAR 2)
=>
FEB
 
(fli:enum-symbol-value-pairs 'HALF_YEAR)
((JAN . 1) (FEB . 2) (MAR . 3) (APR . 4) (MAY . 5) (JUN . 6))
See also

define-c-enum


LispWorks Foreign Language Interface User Guide and Reference Manual - 29 Sep 2017

NextPrevUpTopContentsIndex