alien.marshall: unmarshaller fixes
parent
e2c6b21bfb
commit
426d173b7c
|
@ -230,17 +230,19 @@ M: struct-wrapper dynamic-cast ;
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
|
|
||||||
|
: ?malloc-byte-array ( c-type -- alien )
|
||||||
|
dup alien? [ malloc-byte-array ] unless ;
|
||||||
|
|
||||||
: struct-unmarshaller ( type -- quot )
|
: struct-unmarshaller ( type -- quot )
|
||||||
current-vocab lookup [
|
current-vocab lookup [
|
||||||
dup superclasses [ struct-wrapper? ] any? [
|
dup superclasses [ \ struct-wrapper = ] any? [
|
||||||
[ class name>> heap-size ] keep
|
'[ ?malloc-byte-array _ new swap >>underlying ]
|
||||||
'[ _ malloc-byte-array _ new swap >>underlying ]
|
|
||||||
] [ drop [ ] ] if
|
] [ drop [ ] ] if
|
||||||
] [ [ ] ] if* ;
|
] [ [ ] ] if* ;
|
||||||
|
|
||||||
: pointer-unmarshaller ( type -- quot )
|
: pointer-unmarshaller ( type -- quot )
|
||||||
type-sans-pointer current-vocab lookup [
|
type-sans-pointer current-vocab lookup [
|
||||||
dup superclasses [ alien-wrapper? ] any? [
|
dup superclasses [ \ alien-wrapper = ] any? [
|
||||||
'[ _ new swap >>underlying dynamic-cast ]
|
'[ _ new swap >>underlying dynamic-cast ]
|
||||||
] [ drop [ ] ] if
|
] [ drop [ ] ] if
|
||||||
] [ [ ] ] if* ;
|
] [ [ ] ] if* ;
|
||||||
|
|
Loading…
Reference in New Issue