 : define-enum-value ( class value -- )
     "enum-value" set-word-prop ;
 
-: define-enum-members ( member-names -- )
+: define-enum-members ( members -- )
     [
-        [ first define-symbol ]
-        [ first2 define-enum-value ] bi
-    ] each ;
+        [ drop define-singleton-class ]
+        [ define-enum-value ] 2bi
+    ] assoc-each ;
 
 : define-enum-constructor ( word -- )
     [ name>> "<" ">" surround create-in ] keep

! (c)2010 Joe Groff, Erik Charlebois bsd license
USING: accessors alien.c-types arrays combinators delegate fry
generic.parser kernel macros math parser sequences words words.symbol ;
IN: alien.enums

<PRIVATE


: define-enum ( word base-type members -- )
    [ dup define-enum-constructor ] 2dip
    [ define-enum-members ]
    [ <enum-c-type> swap typedef ] bi ;
    
PREDICATE: enum-c-type-word < c-type-word
    "c-type" word-prop enum-c-type? ;
