]> gitweb.factorcode.org Git - factor.git/commitdiff
see STRUCT: definitions as STRUCT: definitions
authorJoe Groff <joe@victoria.(none)>
Wed, 12 Aug 2009 14:37:09 +0000 (10:37 -0400)
committerJoe Groff <joe@victoria.(none)>
Wed, 12 Aug 2009 14:37:09 +0000 (10:37 -0400)
extra/classes/struct/prettyprint/prettyprint.factor [new file with mode: 0644]
extra/classes/struct/struct-tests.factor
extra/classes/struct/struct.factor

diff --git a/extra/classes/struct/prettyprint/prettyprint.factor b/extra/classes/struct/prettyprint/prettyprint.factor
new file mode 100644 (file)
index 0000000..c0db853
--- /dev/null
@@ -0,0 +1,11 @@
+! (c)Joe Groff bsd license
+USING: classes.struct kernel prettyprint.backend
+prettyprint.sections see.private sequences words ;
+IN: classes.struct.prettyprint
+
+M: struct-class see-class*
+    <colon \ STRUCT: pprint-word dup pprint-word
+    <block "struct-slots" word-prop [ pprint-slot ] each
+    block> pprint-; block> ;
+
+
index 6e739edb5f04b687c14a2a3d2470df5adc55a28e..2c8f68c65116260ad51b9f374a8cdbd49fb1e2b2 100644 (file)
@@ -17,7 +17,7 @@ STRUCT: bar
 [ 123 ] [ bar new foo>> y>> ] unit-test
 
 [ 1 2 3 t ] [
-    1 2 3 t foo boa bar boa
+    1   2 3 t foo boa   bar boa
     {
         [ w>> ] 
         [ foo>> x>> ]
index b4132c68163898689535b6ef61a2fece46b1c696..9f99a6eb2219a2249dc7853c072e470befa8a424 100644 (file)
@@ -132,3 +132,6 @@ M: struct-class heap-size
 SYNTAX: STRUCT:
     parse-struct-definition define-struct-class ;
 
+USING: vocabs vocabs.loader ;
+
+"prettyprint" vocab [ "classes.struct.prettyprint" require ] when