classes.struct: rename (init-struct) to init-struct.

db4
John Benediktsson 2015-08-15 21:40:39 -07:00
parent f6a9175b2e
commit 10c4fce077
1 changed files with 5 additions and 3 deletions

View File

@ -74,21 +74,23 @@ M: struct hashcode*
[ heap-size read ] [ memory>struct ] bi ;
<PRIVATE
: (init-struct) ( class with-prototype: ( prototype -- alien ) sans-prototype: ( class -- alien ) -- alien )
: 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
: malloc-struct ( class -- struct )
[ >c-ptr malloc-byte-array ] [ 1 swap heap-size calloc ] (init-struct) ; inline
[ >c-ptr malloc-byte-array ] [ 1 swap heap-size calloc ] init-struct ; inline
: (struct) ( class -- struct )
[ heap-size (byte-array) ] keep memory>struct ; inline
: <struct> ( class -- struct )
[ >c-ptr clone ] [ heap-size <byte-array> ] (init-struct) ; inline
[ >c-ptr clone ] [ heap-size <byte-array> ] init-struct ; inline
MACRO: <struct-boa> ( class -- quot: ( ... -- struct ) )
[