[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
27.1.6.7 C enums
This form defines enum
types.
<enum-type> →(enum (
<ident> <string>)…
…)
Let us suppose the type:
(type enum (enum (id_1 name_1) ... (id_n name_n)))
Bigloo creates the following functions:
- Creators:
(enum-id_1::enum) ... (enum-id_n::enum)
These functions create enum values.
- A type checker:
(enum?::bool obj::obj)
This function returns
#t
if the argument obj is of type enum and#f
otherwise. - An equality checker:
(=enum?::bool ::enum ::enum)
This function returns
#t
if the arguments are equal and#f
otherwise.
Here is an example of Scheme code using enum type.
(module foo (extern (type gizmo (enum (titi "titi") (tutu "tutu") (tata "tata")) "enum toto"))) (let ((v1 (gizmo-titi)) (v2 (gizmo-tutu))) (print (=gizmo? v1 v2)))
This document was generated on March 31, 2014 using texi2html 5.0.