classes.struct: fields with a type that's an array of pointers (eg int*[3]) now work

db4
Slava Pestov 2010-08-15 02:44:21 -07:00
parent 25ea734a8e
commit d450d12b2b
2 changed files with 15 additions and 0 deletions

View File

@ -22,16 +22,25 @@ GENERIC: <c-array> ( len c-type -- array )
M: word <c-array>
c-array-constructor execute( len -- array ) ; inline
M: pointer <c-array>
drop void* <c-array> ;
GENERIC: (c-array) ( len c-type -- array )
M: word (c-array)
c-(array)-constructor execute( len -- array ) ; inline
M: pointer (c-array)
drop void* (c-array) ;
GENERIC: <c-direct-array> ( alien len c-type -- array )
M: word <c-direct-array>
c-direct-array-constructor execute( alien len -- array ) ; inline
M: pointer <c-direct-array>
drop void* <c-direct-array> ;
: malloc-array ( n type -- array )
[ heap-size calloc ] [ <c-direct-array> ] 2bi ; inline

View File

@ -476,3 +476,9 @@ CONSULT: struct-test-delegate struct-test-delegator del>> ;
7 >>a
8 >>b
] unit-test
SPECIALIZED-ARRAY: void*
STRUCT: silly-array-field-test { x int*[3] } ;
[ t ] [ silly-array-field-test <struct> x>> void*-array? ] unit-test