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 ]
|
[ "Cannot read struct fields with this type" throw ]
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
||||||
|
: c-type-getter-boxer ( name -- quot )
|
||||||
|
[ c-getter ] [ c-type-boxer-quot ] bi append ;
|
||||||
|
|
||||||
: c-setter ( name -- quot )
|
: c-setter ( name -- quot )
|
||||||
c-type-setter [
|
c-type-setter [
|
||||||
[ "Cannot write struct fields with this type" throw ]
|
[ "Cannot write struct fields with this type" throw ]
|
||||||
|
|
|
@ -58,10 +58,7 @@ PREDICATE: slot-writer < word "writing" word-prop >boolean ;
|
||||||
: define-getter ( type spec -- )
|
: define-getter ( type spec -- )
|
||||||
[ set-reader-props ] keep
|
[ set-reader-props ] keep
|
||||||
[ reader>> ]
|
[ reader>> ]
|
||||||
[
|
[ type>> c-type-getter-boxer ]
|
||||||
type>>
|
|
||||||
[ c-getter ] [ c-type-boxer-quot ] bi append
|
|
||||||
]
|
|
||||||
[ ] tri
|
[ ] tri
|
||||||
(( c-ptr -- value )) define-struct-slot-word ;
|
(( c-ptr -- value )) define-struct-slot-word ;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ A' IS ${T}-array
|
||||||
A DEFINES-CLASS direct-${T}-array
|
A DEFINES-CLASS direct-${T}-array
|
||||||
<A> DEFINES <${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 ]
|
SET-NTH [ T dup c-setter array-accessor ]
|
||||||
|
|
||||||
WHERE
|
WHERE
|
||||||
|
|
|
@ -22,7 +22,7 @@ A DEFINES-CLASS ${T}-array
|
||||||
byte-array>A DEFINES byte-array>${A}
|
byte-array>A DEFINES byte-array>${A}
|
||||||
A{ DEFINES ${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 ]
|
SET-NTH [ T dup c-setter array-accessor ]
|
||||||
|
|
||||||
WHERE
|
WHERE
|
||||||
|
|
Loading…
Reference in New Issue