From bc6e5de9116e62a8bcf51025be5d1726444237e0 Mon Sep 17 00:00:00 2001 From: Jeremy Hughes Date: Wed, 8 Jul 2009 11:30:45 +1200 Subject: [PATCH] alien.inline.types: replaced const-type? with const-pointer? and pointer-to-const? --- basis/alien/inline/types/types.factor | 9 ++++++--- basis/alien/marshall/marshall.factor | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/basis/alien/inline/types/types.factor b/basis/alien/inline/types/types.factor index acc62a81a2..222eadf08e 100644 --- a/basis/alien/inline/types/types.factor +++ b/basis/alien/inline/types/types.factor @@ -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 ; diff --git a/basis/alien/marshall/marshall.factor b/basis/alien/marshall/marshall.factor index 66902f6c51..1aa7a4bff2 100644 --- a/basis/alien/marshall/marshall.factor +++ b/basis/alien/marshall/marshall.factor @@ -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 ]