 
 : struct-align ( slots -- align )
     [ c-type>> c-type-align ] [ max ] map-reduce ;
+PRIVATE>
 
 M: struct-class c-type
     name>> c-type ;


! class definition

: make-struct-prototype ( class -- prototype )
    [ heap-size <byte-array> ]
    [ memory>struct ]

M: struct clone
    [ >c-ptr ] [ byte-length memory>byte-array ] [ class memory>struct ] tri ;

<PRIVATE
: (init-struct) ( class with-prototype: ( prototype -- alien ) sans-prototype: ( class -- alien ) -- alien )
    '[ dup struct-prototype _ _ ?if ] keep memory>struct ; inline
PRIVATE>

: (malloc-struct) ( class -- struct )
    [ heap-size malloc ] keep memory>struct ; inline
