alien.c-types: make a couple of words private

db4
Slava Pestov 2010-05-18 22:34:42 -04:00
parent 65e220b645
commit 4d66f52777
1 changed files with 10 additions and 10 deletions

View File

@ -189,15 +189,19 @@ CONSTANT: primitive-types
c-string c-string
} }
: (pointer-c-type) ( void* type -- void*' )
[ clone ] dip c-type-boxer-quot '[ _ [ f ] if* ] >>boxer-quot ;
: >c-bool ( ? -- int ) 1 0 ? ; inline : >c-bool ( ? -- int ) 1 0 ? ; inline
: c-bool> ( int -- ? ) 0 = not ; inline : c-bool> ( int -- ? ) 0 = not ; inline
<PRIVATE <PRIVATE
: 8-byte-alignment ( c-type -- c-type )
{
{ [ cpu ppc? os macosx? and ] [ 4 >>align 8 >>align-first ] }
{ [ cpu x86.32? os windows? not and ] [ 4 >>align 4 >>align-first ] }
[ 8 >>align 8 >>align-first ]
} cond ;
: resolve-pointer-typedef ( type -- base-type ) : resolve-pointer-typedef ( type -- base-type )
dup "c-type" word-prop dup word? dup "c-type" word-prop dup word?
[ nip resolve-pointer-typedef ] [ [ nip resolve-pointer-typedef ] [
@ -209,19 +213,15 @@ CONSTANT: primitive-types
resolve-pointer-typedef [ void? ] [ primitive-types member? ] bi or resolve-pointer-typedef [ void? ] [ primitive-types member? ] bi or
] [ drop t ] if ; ] [ drop t ] if ;
: (pointer-c-type) ( void* type -- void*' )
[ clone ] dip c-type-boxer-quot '[ _ [ f ] if* ] >>boxer-quot ;
PRIVATE> PRIVATE>
M: pointer c-type M: pointer c-type
[ \ void* c-type ] dip [ \ void* c-type ] dip
to>> dup primitive-pointer-type? [ drop ] [ (pointer-c-type) ] if ; to>> dup primitive-pointer-type? [ drop ] [ (pointer-c-type) ] if ;
: 8-byte-alignment ( c-type -- c-type )
{
{ [ cpu ppc? os macosx? and ] [ 4 >>align 8 >>align-first ] }
{ [ cpu x86.32? os windows? not and ] [ 4 >>align 4 >>align-first ] }
[ 8 >>align 8 >>align-first ]
} cond ;
[ [
<c-type> <c-type>
c-ptr >>class c-ptr >>class