]> gitweb.factorcode.org Git - factor.git/blob - basis/alien/prettyprint/prettyprint.factor
fix typedef prettyprinting
[factor.git] / basis / alien / prettyprint / prettyprint.factor
1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel combinators alien alien.strings alien.c-types
4 alien.syntax arrays math.parser prettyprint.backend
5 prettyprint.custom prettyprint.sections definitions see see.private
6 strings words ;
7 IN: alien.prettyprint
8
9 M: alien pprint*
10     {
11         { [ dup expired? ] [ drop \ BAD-ALIEN pprint-word ] }
12         { [ dup pinned-c-ptr? not ] [ drop "( displaced alien )" text ] }
13         [ \ ALIEN: [ alien-address >hex text ] pprint-prefix ]
14     } cond ;
15
16 M: dll pprint* dll-path dup "DLL\" " "\"" pprint-string ;
17
18 M: c-type-word definer drop \ C-TYPE: f ;
19 M: c-type-word definition drop f ;
20 M: typedef-word declarations. drop ;
21
22 GENERIC: pprint-c-type ( c-type -- )
23 M: word pprint-c-type pprint-word ;
24 M: string pprint-c-type text ;
25 M: array pprint-c-type pprint* ;
26
27 M: typedef-word definer drop \ TYPEDEF: f ;
28
29 M: typedef-word synopsis*
30     <colon
31     \ TYPEDEF: pprint-word
32     dup "c-type" word-prop pprint-c-type
33     pprint-word
34     block> ;
35
36