alien.c-types: classify typedefs of array/string types as typedef-words so they prettyprint correctly

db4
Joe Groff 2010-08-11 10:02:51 -07:00
parent 4fcdb2fbd5
commit 04075be646
2 changed files with 18 additions and 1 deletions

View File

@ -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 -- )
{

View File

@ -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 ;