factor/basis/alien/prettyprint/prettyprint.factor

37 lines
1.0 KiB
Factor
Raw Normal View History

2008-12-08 15:58:00 -05:00
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
2009-09-15 16:18:54 -04:00
USING: kernel combinators alien alien.strings alien.c-types
alien.syntax arrays math.parser prettyprint.backend
prettyprint.custom prettyprint.sections definitions see see.private
strings words ;
2008-12-08 15:58:00 -05:00
IN: alien.prettyprint
M: alien pprint*
{
{ [ dup expired? ] [ drop \ BAD-ALIEN pprint-word ] }
{ [ dup pinned-c-ptr? not ] [ drop "( displaced alien )" text ] }
[ \ ALIEN: [ alien-address >hex text ] pprint-prefix ]
2008-12-08 15:58:00 -05:00
} cond ;
M: dll pprint* dll-path dup "DLL\" " "\"" pprint-string ;
2009-09-15 16:18:54 -04:00
M: c-type-word definer drop \ C-TYPE: f ;
M: c-type-word definition drop f ;
2009-09-15 23:10:41 -04:00
M: typedef-word declarations. drop ;
2009-09-15 16:18:54 -04:00
GENERIC: pprint-c-type ( c-type -- )
M: word pprint-c-type pprint-word ;
M: string pprint-c-type text ;
M: array pprint-c-type pprint* ;
2009-09-15 23:10:41 -04:00
M: typedef-word definer drop \ TYPEDEF: f ;
M: typedef-word synopsis*
2009-09-15 16:18:54 -04:00
<colon
\ TYPEDEF: pprint-word
dup "c-type" word-prop pprint-c-type
2009-09-15 16:18:54 -04:00
pprint-word
block> ;
2009-09-15 23:10:41 -04:00