struct-arrays: fix new-sequence method
parent
e86a76a7d8
commit
edbe9c4279
|
@ -1,11 +1,20 @@
|
||||||
IN: struct-arrays.tests
|
IN: struct-arrays.tests
|
||||||
USING: classes.struct struct-arrays tools.test kernel math sequences
|
USING: classes.struct struct-arrays tools.test kernel math sequences
|
||||||
alien.syntax alien.c-types destructors libc accessors sequences.private ;
|
alien.syntax alien.c-types destructors libc accessors sequences.private
|
||||||
|
compiler.tree.debugger combinators.smart ;
|
||||||
|
|
||||||
STRUCT: test-struct-array
|
STRUCT: test-struct-array
|
||||||
{ x int }
|
{ x int }
|
||||||
{ y int } ;
|
{ y int } ;
|
||||||
|
|
||||||
|
[ 1 ] [
|
||||||
|
1 struct-array{ test-struct-array } new-sequence length
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
[ V{ test-struct-array } ] [
|
||||||
|
[ [ test-struct-array <struct> ] struct-array{ test-struct-array } output>sequence first ] final-classes
|
||||||
|
] unit-test
|
||||||
|
|
||||||
: make-point ( x y -- struct )
|
: make-point ( x y -- struct )
|
||||||
test-struct-array <struct-boa> ;
|
test-struct-array <struct-boa> ;
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ ERROR: not-a-struct-class struct-class ;
|
||||||
tri struct-array boa ; inline
|
tri struct-array boa ; inline
|
||||||
|
|
||||||
M: struct-array new-sequence
|
M: struct-array new-sequence
|
||||||
[ element-size>> * (byte-array) ] [ length>> ] [ class>> ] tri
|
[ element-size>> * (byte-array) ] [ class>> ] 2bi
|
||||||
<direct-struct-array> ; inline
|
<direct-struct-array> ; inline
|
||||||
|
|
||||||
M: struct-array resize ( n seq -- newseq )
|
M: struct-array resize ( n seq -- newseq )
|
||||||
|
|
Loading…
Reference in New Issue