alien.parser/prettyprint: moving the predicates

char-rename
Björn Lindqvist 2016-08-10 13:45:38 +02:00
parent ddc5ece757
commit 13a983783f
3 changed files with 22 additions and 17 deletions

View File

@ -151,18 +151,6 @@ PRIVATE>
: (CALLBACK:) ( -- word quot effect ) : (CALLBACK:) ( -- word quot effect )
(FUNCTION:) make-callback-type ; (FUNCTION:) make-callback-type ;
PREDICATE: alien-function-alias-word < word
def>> {
[ length 6 = ]
[ last \ alien-invoke eq? ]
} 1&& ;
PREDICATE: alien-function-word < alien-function-alias-word
[ def>> third ] [ name>> ] bi = ;
PREDICATE: alien-callback-type-word < typedef-word
"callback-effect" word-prop >boolean ;
: global-quot ( type word -- quot ) : global-quot ( type word -- quot )
swap [ name>> current-library get ] dip swap [ name>> current-library get ] dip
'[ _ _ address-of 0 _ alien-value ] ; '[ _ _ address-of 0 _ alien-value ] ;

View File

@ -0,0 +1,5 @@
USING: help.markup help.syntax ;
IN: alien.prettyprint
HELP: alien-function-alias-word
{ $class-description "Used to prettier pretty-printing of alien function words." } ;

View File

@ -1,10 +1,10 @@
! Copyright (C) 2008, 2010 Slava Pestov, Joe Groff. ! Copyright (C) 2008, 2010 Slava Pestov, Joe Groff.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel combinators alien alien.enums USING: accessors alien alien.c-types alien.enums alien.strings
alien.strings alien.c-types alien.parser alien.syntax arrays alien.syntax arrays assocs combinators combinators.short-circuit
assocs effects math.parser prettyprint prettyprint.backend definitions effects kernel math.parser prettyprint prettyprint.backend
prettyprint.custom prettyprint.sections definitions see prettyprint.custom prettyprint.sections see see.private sequences
see.private sequences strings words ; words ;
IN: alien.prettyprint IN: alien.prettyprint
M: alien pprint* M: alien pprint*
@ -77,6 +77,12 @@ M: typedef-word synopsis*
")" text block> ")" text block>
] tri ; inline ] tri ; inline
PREDICATE: alien-function-alias-word < word
def>> {
[ length 6 = ]
[ last \ alien-invoke eq? ]
} 1&& ;
M: alien-function-alias-word definer M: alien-function-alias-word definer
drop \ FUNCTION-ALIAS: f ; drop \ FUNCTION-ALIAS: f ;
M: alien-function-alias-word definition drop f ; M: alien-function-alias-word definition drop f ;
@ -90,6 +96,9 @@ M: alien-function-alias-word synopsis*
} cleave ; } cleave ;
M: alien-function-alias-word declarations. drop ; M: alien-function-alias-word declarations. drop ;
PREDICATE: alien-function-word < alien-function-alias-word
[ def>> third ] [ name>> ] bi = ;
M: alien-function-word definer M: alien-function-word definer
drop \ FUNCTION: f ; drop \ FUNCTION: f ;
M: alien-function-word synopsis* M: alien-function-word synopsis*
@ -100,6 +109,9 @@ M: alien-function-word synopsis*
[ [ pprint-word ] pprint-function ] [ [ pprint-word ] pprint-function ]
} cleave ; } cleave ;
PREDICATE: alien-callback-type-word < typedef-word
"callback-effect" word-prop >boolean ;
M: alien-callback-type-word definer M: alien-callback-type-word definer
drop \ CALLBACK: f ; drop \ CALLBACK: f ;
M: alien-callback-type-word definition drop f ; M: alien-callback-type-word definition drop f ;