alien.inline.types: factorize-type and pointer-to-const? accept strings with spaces
parent
687d541838
commit
c0714c6135
|
@ -5,19 +5,21 @@ continuations effects fry kernel math memoize sequences
|
||||||
splitting ;
|
splitting ;
|
||||||
IN: alien.inline.types
|
IN: alien.inline.types
|
||||||
|
|
||||||
: factorize-type ( str -- str' )
|
|
||||||
"const-" ?head drop
|
|
||||||
"unsigned-" ?head [ "u" prepend ] when
|
|
||||||
"long-" ?head [ "long" prepend ] when
|
|
||||||
"-const" ?tail drop ;
|
|
||||||
|
|
||||||
: cify-type ( str -- str' )
|
: cify-type ( str -- str' )
|
||||||
{ { CHAR: - CHAR: space } } substitute ;
|
{ { CHAR: - CHAR: space } } substitute ;
|
||||||
|
|
||||||
: const-pointer? ( str -- ? )
|
: factorize-type ( str -- str' )
|
||||||
{ [ "-const" tail? ] [ "&" tail? ] } 1|| ;
|
cify-type
|
||||||
|
"const " ?head drop
|
||||||
|
"unsigned " ?head [ "u" prepend ] when
|
||||||
|
"long " ?head [ "long" prepend ] when
|
||||||
|
" const" ?tail drop ;
|
||||||
|
|
||||||
: pointer-to-const? ( str -- ? ) "const-" head? ;
|
: const-pointer? ( str -- ? )
|
||||||
|
cify-type { [ " const" tail? ] [ "&" tail? ] } 1|| ;
|
||||||
|
|
||||||
|
: pointer-to-const? ( str -- ? )
|
||||||
|
cify-type "const " head? ;
|
||||||
|
|
||||||
MEMO: resolved-primitives ( -- seq )
|
MEMO: resolved-primitives ( -- seq )
|
||||||
primitive-types [ resolve-typedef ] map ;
|
primitive-types [ resolve-typedef ] map ;
|
||||||
|
|
Loading…
Reference in New Issue