From 04075be6469f287334a99cebc0589963ee2c3fcd Mon Sep 17 00:00:00 2001
From: Joe Groff <arcata@gmail.com>
Date: Wed, 11 Aug 2010 10:02:51 -0700
Subject: [PATCH] alien.c-types: classify typedefs of array/string types as
 typedef-words so they prettyprint correctly

---
 basis/alien/c-types/c-types.factor              |  2 +-
 .../alien/prettyprint/prettyprint-tests.factor  | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/basis/alien/c-types/c-types.factor b/basis/alien/c-types/c-types.factor
index 46c2209db9..04755ea033 100644
--- a/basis/alien/c-types/c-types.factor
+++ b/basis/alien/c-types/c-types.factor
@@ -157,7 +157,7 @@ CONSULT: c-type-protocol c-type-name
     c-type ;
 
 PREDICATE: typedef-word < c-type-word
-    "c-type" word-prop c-type-name? ;
+    "c-type" word-prop [ c-type-name? ] [ array? ] bi or ;
 
 : typedef ( old new -- )
     {
diff --git a/basis/alien/prettyprint/prettyprint-tests.factor b/basis/alien/prettyprint/prettyprint-tests.factor
index dd32172b58..91f19c4ccf 100644
--- a/basis/alien/prettyprint/prettyprint-tests.factor
+++ b/basis/alien/prettyprint/prettyprint-tests.factor
@@ -25,6 +25,23 @@ FUNCTION-ALIAS: function-test int function_test
     [ \ function-test see ] with-string-writer
 ] unit-test
 
+TYPEDEF: c-string[ascii] string-typedef
+TYPEDEF: char[1][2][3] array-typedef
+
+[ "USING: alien.c-types alien.syntax ;
+IN: alien.prettyprint.tests
+TYPEDEF: c-string[ascii] string-typedef
+" ] [
+    [ \ string-typedef see ] with-string-writer
+] unit-test
+
+[ "USING: alien.c-types alien.syntax ;
+IN: alien.prettyprint.tests
+TYPEDEF: char[1][2][3] array-typedef
+" ] [
+    [ \ array-typedef see ] with-string-writer
+] unit-test
+
 C-TYPE: opaque-c-type
 
 [ "USING: alien.syntax ;