cocoa.plists: use new NSFastEnumeration>hashtable word.
parent
116086ddf7
commit
e137cde7f8
|
@ -1,7 +1,8 @@
|
||||||
! Copyright (C) 2008 Joe Groff.
|
! Copyright (C) 2008 Joe Groff.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors kernel classes.struct cocoa cocoa.runtime cocoa.types alien.data
|
USING: accessors alien.data assocs classes.struct cocoa
|
||||||
locals math sequences vectors fry libc destructors specialized-arrays ;
|
cocoa.runtime cocoa.types destructors fry hashtables kernel libc
|
||||||
|
locals sequences specialized-arrays vectors ;
|
||||||
SPECIALIZED-ARRAY: id
|
SPECIALIZED-ARRAY: id
|
||||||
IN: cocoa.enumeration
|
IN: cocoa.enumeration
|
||||||
|
|
||||||
|
@ -32,3 +33,7 @@ CONSTANT: NS-EACH-BUFFER-SIZE 16
|
||||||
|
|
||||||
: NSFastEnumeration>vector ( object -- vector )
|
: NSFastEnumeration>vector ( object -- vector )
|
||||||
[ ] NSFastEnumeration-map ;
|
[ ] NSFastEnumeration-map ;
|
||||||
|
|
||||||
|
: NSFastEnumeration>hashtable ( ... object quot: ( ... elt -- ... key value ) -- ... vector )
|
||||||
|
NS-EACH-BUFFER-SIZE <hashtable>
|
||||||
|
[ '[ @ swap _ set-at ] NSFastEnumeration-each ] keep ; inline
|
||||||
|
|
|
@ -30,8 +30,8 @@ DEFER: plist>
|
||||||
[ plist> ] NSFastEnumeration-map ;
|
[ plist> ] NSFastEnumeration-map ;
|
||||||
|
|
||||||
: (plist-NSDictionary>) ( NSDictionary -- hashtable )
|
: (plist-NSDictionary>) ( NSDictionary -- hashtable )
|
||||||
dup [ [ nip ] [ -> valueForKey: ] 2bi [ plist> ] bi@ 2array ] with
|
dup [ [ nip ] [ -> valueForKey: ] 2bi [ plist> ] bi@ ] with
|
||||||
NSFastEnumeration-map >hashtable ;
|
NSFastEnumeration>hashtable ;
|
||||||
|
|
||||||
: (read-plist) ( NSData -- id )
|
: (read-plist) ( NSData -- id )
|
||||||
NSPropertyListSerialization swap kCFPropertyListImmutable f
|
NSPropertyListSerialization swap kCFPropertyListImmutable f
|
||||||
|
|
Loading…
Reference in New Issue