| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
26.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
#tif the argument obj is of type enum and#fotherwise. - An equality checker:
(=enum?::bool ::enum ::enum)
This function returns
#tif the arguments are equal and#fotherwise.
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 October 23, 2011 using texi2html 5.0.
