From f3768b53615b1edf1b094f670d16176fec72120e Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Mon, 31 Aug 2009 20:32:00 -0500 Subject: [PATCH] clean up the bootstrap mess by moving the struct summary and make-mirror methods to classes.struct.prettyprint --- .../struct/prettyprint/prettyprint.factor | 26 ++++++++++++++++--- basis/mirrors/mirrors.factor | 19 +++----------- basis/summary/summary.factor | 11 +------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/basis/classes/struct/prettyprint/prettyprint.factor b/basis/classes/struct/prettyprint/prettyprint.factor index 349303d113..253f904420 100644 --- a/basis/classes/struct/prettyprint/prettyprint.factor +++ b/basis/classes/struct/prettyprint/prettyprint.factor @@ -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 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 ; diff --git a/basis/mirrors/mirrors.factor b/basis/mirrors/mirrors.factor index d9120da9dc..25486d127d 100644 --- a/basis/mirrors/mirrors.factor +++ b/basis/mirrors/mirrors.factor @@ -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 ; M: vector make-mirror ; M: quotation make-mirror ; M: object make-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 ; diff --git a/basis/summary/summary.factor b/basis/summary/summary.factor index d8542c7f83..44e5374dc5 100644 --- a/basis/summary/summary.factor +++ b/basis/summary/summary.factor @@ -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 ;