]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/cocoa/plists/plists.factor
Updating code to use with-out-parameters
[factor.git] / basis / cocoa / plists / plists.factor
index 90cc64769a7e7f39cafce01da755b15d7e50d4eb..80d58e634061525383bd2db22899468c62a8e913 100644 (file)
@@ -36,9 +36,18 @@ DEFER: plist>
     NSFastEnumeration-map >hashtable ;
 
 : (read-plist) ( NSData -- id )
-    NSPropertyListSerialization swap kCFPropertyListImmutable f f <void*>
-    [ -> propertyListFromData:mutabilityOption:format:errorDescription: ] keep
-    *void* [ -> release "read-plist failed" throw ] when* ;
+    NSPropertyListSerialization swap kCFPropertyListImmutable f
+    { void* }
+    [ -> propertyListFromData:mutabilityOption:format:errorDescription: ] [ ]
+    with-out-parameters
+    [ -> release "read-plist failed" throw ] when* ;
+
+MACRO: objc-class-case ( alist -- quot )
+    [
+        dup callable?
+        [ first2 [ '[ dup _ execute -> isKindOfClass: c-bool> ] ] dip 2array ]
+        unless
+    ] map '[ _ cond ] ;
 
 PRIVATE>