From 426d173b7ce44a5c04516c7920d0cb358c7f0276 Mon Sep 17 00:00:00 2001 From: Jeremy Hughes Date: Thu, 9 Jul 2009 10:36:21 +1200 Subject: [PATCH] alien.marshall: unmarshaller fixes --- basis/alien/marshall/marshall.factor | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/basis/alien/marshall/marshall.factor b/basis/alien/marshall/marshall.factor index 2468539583..2ddd30b9f9 100644 --- a/basis/alien/marshall/marshall.factor +++ b/basis/alien/marshall/marshall.factor @@ -230,17 +230,19 @@ M: struct-wrapper dynamic-cast ; } case ; +: ?malloc-byte-array ( c-type -- alien ) + dup alien? [ malloc-byte-array ] unless ; + : struct-unmarshaller ( type -- quot ) current-vocab lookup [ - dup superclasses [ struct-wrapper? ] any? [ - [ class name>> heap-size ] keep - '[ _ malloc-byte-array _ new swap >>underlying ] + dup superclasses [ \ struct-wrapper = ] any? [ + '[ ?malloc-byte-array _ new swap >>underlying ] ] [ drop [ ] ] if ] [ [ ] ] if* ; : pointer-unmarshaller ( type -- quot ) type-sans-pointer current-vocab lookup [ - dup superclasses [ alien-wrapper? ] any? [ + dup superclasses [ \ alien-wrapper = ] any? [ '[ _ new swap >>underlying dynamic-cast ] ] [ drop [ ] ] if ] [ [ ] ] if* ;