From e137cde7f841a1dbd0b9f5118cbbe88805890463 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 8 Jul 2014 16:12:41 -0700 Subject: [PATCH] cocoa.plists: use new NSFastEnumeration>hashtable word. --- basis/cocoa/enumeration/enumeration.factor | 9 +++++++-- basis/cocoa/plists/plists.factor | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/basis/cocoa/enumeration/enumeration.factor b/basis/cocoa/enumeration/enumeration.factor index f4d1053f0a..a78a29bd7f 100644 --- a/basis/cocoa/enumeration/enumeration.factor +++ b/basis/cocoa/enumeration/enumeration.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2008 Joe Groff. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors kernel classes.struct cocoa cocoa.runtime cocoa.types alien.data -locals math sequences vectors fry libc destructors specialized-arrays ; +USING: accessors alien.data assocs classes.struct cocoa +cocoa.runtime cocoa.types destructors fry hashtables kernel libc +locals sequences specialized-arrays vectors ; SPECIALIZED-ARRAY: id IN: cocoa.enumeration @@ -32,3 +33,7 @@ CONSTANT: NS-EACH-BUFFER-SIZE 16 : NSFastEnumeration>vector ( object -- vector ) [ ] NSFastEnumeration-map ; + +: NSFastEnumeration>hashtable ( ... object quot: ( ... elt -- ... key value ) -- ... vector ) + NS-EACH-BUFFER-SIZE + [ '[ @ swap _ set-at ] NSFastEnumeration-each ] keep ; inline diff --git a/basis/cocoa/plists/plists.factor b/basis/cocoa/plists/plists.factor index 0ac7a43229..63662d5489 100644 --- a/basis/cocoa/plists/plists.factor +++ b/basis/cocoa/plists/plists.factor @@ -30,8 +30,8 @@ DEFER: plist> [ plist> ] NSFastEnumeration-map ; : (plist-NSDictionary>) ( NSDictionary -- hashtable ) - dup [ [ nip ] [ -> valueForKey: ] 2bi [ plist> ] bi@ 2array ] with - NSFastEnumeration-map >hashtable ; + dup [ [ nip ] [ -> valueForKey: ] 2bi [ plist> ] bi@ ] with + NSFastEnumeration>hashtable ; : (read-plist) ( NSData -- id ) NSPropertyListSerialization swap kCFPropertyListImmutable f