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
|
2009-09-15 17:08:42 -04:00
|
|
|
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 ] }
|
2009-09-12 22:17:53 -04:00
|
|
|
[ \ 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
|
|
|
|
2009-09-15 17:08:42 -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
|
2009-09-15 17:08:42 -04:00
|
|
|
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
|
|
|
|
|
|
|
|
|