Next Previous Up Top Contents Index

5 Function and Macro Reference

define-c-enum

Macro

Summary

Defines an FLI enumerator type specifier corresponding to the Cenum type.
Package

fli

Signature

define-c-enum name &rest enumerator-list => list

enumerator-list ::= {entry-name | (entry-name entry-value)}*

Arguments

name

The name of the new enumeration type specifier.

enumerator-list

A sequence of symbols, possibly with index values, constituting the enumerator type.

entry-name

A symbol.

entry-value

An index value for an entry-name.

Values

list

The list(:enumname).

Description

The macrodefine-c-enum is used to define an FLI enumerator type specifier, which corresponds to the Cenum type. It is a convenience function, as an enumerator type could also be defined usingdefine-foreign-type.
Each entry in the enumerator-list can either consist of a symbol, in which case the first entry has an index value of 0, or of a list of a symbol and its corresponding index value.
Example

In the following example an FLI enumerator type specifier is defined, and the corresponding definition for a C enumerator type follows.
(def-c-enum colors red green blue)

enum colors { red, green, blue};

The next example illustrates how to start the enumerator index list counting from 1, instead of from the default value of 0.
(def-c-enum half_year (jan 1) feb mar apr may jun)

enum half_year { jan = 1, feb, mar, apr, may, jun }

See Also

define-c-struct
define-c-typedef
define-c-union
define-foreign-type

LispWorks Foreign Language Interface - 12 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker