clean up the bootstrap mess by moving the struct summary and make-mirror methods to classes.struct.prettyprint

db4
Joe Groff 2009-08-31 20:32:00 -05:00
parent badbfef890
commit f3768b5361
3 changed files with 28 additions and 28 deletions

View File

@ -1,7 +1,9 @@
! (c)Joe Groff bsd license ! (c)Joe Groff bsd license
USING: accessors alien assocs classes classes.struct USING: accessors alien alien.c-types arrays assocs classes
combinators kernel math prettyprint.backend prettyprint.custom classes.struct combinators continuations fry kernel make math
prettyprint.sections see.private sequences strings words ; math.parser mirrors prettyprint.backend prettyprint.custom
prettyprint.sections see.private sequences strings
summary words ;
IN: classes.struct.prettyprint IN: classes.struct.prettyprint
<PRIVATE <PRIVATE
@ -46,3 +48,21 @@ M: struct >pprint-sequence
M: struct pprint* M: struct pprint*
[ pprint-struct ] [ pprint-struct ]
[ pprint-struct-pointer ] pprint-c-object ; [ pprint-struct-pointer ] pprint-c-object ;
M: struct summary
[
dup class name>> %
" struct of " %
byte-length #
" bytes " %
] "" make ;
M: struct make-mirror
[
[ drop "underlying" ] [ (underlying)>> ] bi 2array 1array
] [
'[
_ struct>assoc
[ [ [ name>> ] [ c-type>> ] bi 2array ] dip ] assoc-map
] [ drop { } ] recover
] bi append ;

View File

@ -1,10 +1,9 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs classes classes.struct USING: assocs hashtables kernel sequences generic words
classes.struct.prettyprint.private classes.tuple arrays classes slots slots.private classes.tuple
classes.tuple.private combinators generic hashtables kernel classes.tuple.private math vectors quotations accessors
math quotations sequences slots slots.private vectors words combinators ;
continuations fry ;
IN: mirrors IN: mirrors
TUPLE: mirror { object read-only } ; TUPLE: mirror { object read-only } ;
@ -56,13 +55,3 @@ M: array make-mirror <enum> ;
M: vector make-mirror <enum> ; M: vector make-mirror <enum> ;
M: quotation make-mirror <enum> ; M: quotation make-mirror <enum> ;
M: object make-mirror <mirror> ; M: object make-mirror <mirror> ;
M: struct make-mirror
[
[ drop "underlying" ] [ (underlying)>> ] bi 2array 1array
] [
'[
_ struct>assoc
[ [ [ name>> ] [ c-type>> ] bi 2array ] dip ] assoc-map
] [ drop { } ] recover
] bi append ;

View File

@ -1,8 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors classes sequences kernel namespaces USING: accessors classes sequences kernel namespaces
make words math math.parser assocs classes.struct make words math math.parser assocs ;
alien.c-types ;
IN: summary IN: summary
GENERIC: summary ( object -- string ) GENERIC: summary ( object -- string )
@ -32,11 +31,3 @@ M: assoc summary
M: f summary object-summary ; M: f summary object-summary ;
M: integer summary object-summary ; M: integer summary object-summary ;
M: struct summary
[
dup class name>> %
" struct of " %
byte-length #
" bytes " %
] "" make ;