alien.inline.types: replaced const-type? with const-pointer? and pointer-to-const?

db4
Jeremy Hughes 2009-07-08 11:30:45 +12:00
parent 03d4575b90
commit bc6e5de911
2 changed files with 7 additions and 4 deletions

View File

@ -8,13 +8,16 @@ IN: alien.inline.types
: factorize-type ( str -- str' )
"const-" ?head drop
"unsigned-" ?head [ "u" prepend ] when
"long-" ?head [ "long" prepend ] when ;
"long-" ?head [ "long" prepend ] when
"-const" ?tail drop ;
: cify-type ( str -- str' )
{ { CHAR: - CHAR: space } } substitute ;
: const-type? ( str -- ? )
"const-" head? ;
: const-pointer? ( str -- ? )
{ [ "-const" tail? ] [ "&" tail? ] } 1|| ;
: pointer-to-const? ( str -- ? ) "const-" head? ;
MEMO: resolved-primitives ( -- seq )
primitive-types [ resolve-typedef ] map ;

View File

@ -278,7 +278,7 @@ M: struct-wrapper dynamic-cast ;
: out-arg-unmarshaller ( type -- quot )
dup {
[ const-type? not ]
[ pointer-to-const? not ]
[ factorize-type pointer-to-primitive? ]
} 1&&
[ factorize-type primitive-unmarshaller ]