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

: define-enum-value ( class value -- )
    "enum-value" set-word-prop ;

: define-enum-members ( member-names -- )
    [
        [ first define-symbol ]
        [ first2 define-enum-value ] bi
    ] 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
classes.singleton assocs ;
IN: alien.enums

<PRIVATE
