tweak specialized-arrays to box values returned by nth
parent
d24b03098a
commit
db6706434d
|
@ -185,6 +185,9 @@ M: f byte-length drop 0 ;
|
|||
[ "Cannot read struct fields with this type" throw ]
|
||||
] unless* ;
|
||||
|
||||
: c-type-getter-boxer ( name -- quot )
|
||||
[ c-getter ] [ c-type-boxer-quot ] bi append ;
|
||||
|
||||
: c-setter ( name -- quot )
|
||||
c-type-setter [
|
||||
[ "Cannot write struct fields with this type" throw ]
|
||||
|
|
|
@ -58,10 +58,7 @@ PREDICATE: slot-writer < word "writing" word-prop >boolean ;
|
|||
: define-getter ( type spec -- )
|
||||
[ set-reader-props ] keep
|
||||
[ reader>> ]
|
||||
[
|
||||
type>>
|
||||
[ c-getter ] [ c-type-boxer-quot ] bi append
|
||||
]
|
||||
[ type>> c-type-getter-boxer ]
|
||||
[ ] tri
|
||||
(( c-ptr -- value )) define-struct-slot-word ;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ A' IS ${T}-array
|
|||
A DEFINES-CLASS direct-${T}-array
|
||||
<A> DEFINES <${A}>
|
||||
|
||||
NTH [ T dup c-getter array-accessor ]
|
||||
NTH [ T dup c-type-getter-boxer array-accessor ]
|
||||
SET-NTH [ T dup c-setter array-accessor ]
|
||||
|
||||
WHERE
|
||||
|
|
|
@ -22,7 +22,7 @@ A DEFINES-CLASS ${T}-array
|
|||
byte-array>A DEFINES byte-array>${A}
|
||||
A{ DEFINES ${A}{
|
||||
|
||||
NTH [ T dup c-getter array-accessor ]
|
||||
NTH [ T dup c-type-getter-boxer array-accessor ]
|
||||
SET-NTH [ T dup c-setter array-accessor ]
|
||||
|
||||
WHERE
|
||||
|
|
Loading…
Reference in New Issue