From c0714c6135c86a8d1f3407ed764c372ed70f8c74 Mon Sep 17 00:00:00 2001 From: Jeremy Hughes Date: Tue, 14 Jul 2009 10:20:13 +1200 Subject: [PATCH] alien.inline.types: factorize-type and pointer-to-const? accept strings with spaces --- basis/alien/inline/types/types.factor | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/basis/alien/inline/types/types.factor b/basis/alien/inline/types/types.factor index 222eadf08e..bf0a7936ba 100644 --- a/basis/alien/inline/types/types.factor +++ b/basis/alien/inline/types/types.factor @@ -5,19 +5,21 @@ continuations effects fry kernel math memoize sequences splitting ; 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' ) { { CHAR: - CHAR: space } } substitute ; -: const-pointer? ( str -- ? ) - { [ "-const" tail? ] [ "&" tail? ] } 1|| ; +: factorize-type ( str -- str' ) + 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 ) primitive-types [ resolve-typedef ] map ;