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
USING: accessors alien assocs classes classes.struct
combinators kernel math prettyprint.backend prettyprint.custom
prettyprint.sections see.private sequences strings words ;
USING: accessors alien alien.c-types arrays assocs classes
classes.struct combinators continuations fry kernel make math
math.parser mirrors prettyprint.backend prettyprint.custom
prettyprint.sections see.private sequences strings
summary words ;
IN: classes.struct.prettyprint
<PRIVATE
@ -46,3 +48,21 @@ M: struct >pprint-sequence
M: struct pprint*
[ pprint-struct ]
[ 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.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs classes classes.struct
classes.struct.prettyprint.private classes.tuple
classes.tuple.private combinators generic hashtables kernel
math quotations sequences slots slots.private vectors words
continuations fry ;
USING: assocs hashtables kernel sequences generic words
arrays classes slots slots.private classes.tuple
classes.tuple.private math vectors quotations accessors
combinators ;
IN: mirrors
TUPLE: mirror { object read-only } ;
@ -56,13 +55,3 @@ M: array make-mirror <enum> ;
M: vector make-mirror <enum> ;
M: quotation make-mirror <enum> ;
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.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors classes sequences kernel namespaces
make words math math.parser assocs classes.struct
alien.c-types ;
make words math math.parser assocs ;
IN: summary
GENERIC: summary ( object -- string )
@ -32,11 +31,3 @@ M: assoc summary
M: f summary object-summary ;
M: integer summary object-summary ;
M: struct summary
[
dup class name>> %
" struct of " %
byte-length #
" bytes " %
] "" make ;