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 ;
! 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 ;
+make words math math.parser assocs classes.struct
+alien.c-types ;
IN: summary
GENERIC: summary ( object -- string )
M: f summary object-summary ;
M: integer summary object-summary ;
+
+M: struct summary
+ [
+ dup class name>> %
+ " struct of " %
+ byte-length #
+ " bytes " %
+ ] "" make ;