diff --git a/basis/core-foundation/data/data.factor b/basis/core-foundation/data/data.factor index f4d2babca7..a26204b001 100644 --- a/basis/core-foundation/data/data.factor +++ b/basis/core-foundation/data/data.factor @@ -4,34 +4,32 @@ USING: alien.syntax alien.c-types sequences kernel math ; IN: core-foundation.data TYPEDEF: void* CFDataRef -TYPEDEF: void* CFDictionaryRef -TYPEDEF: void* CFMutableDictionaryRef TYPEDEF: void* CFNumberRef TYPEDEF: void* CFSetRef TYPEDEF: int CFNumberType -: kCFNumberSInt8Type 1 ; inline -: kCFNumberSInt16Type 2 ; inline -: kCFNumberSInt32Type 3 ; inline -: kCFNumberSInt64Type 4 ; inline -: kCFNumberFloat32Type 5 ; inline -: kCFNumberFloat64Type 6 ; inline -: kCFNumberCharType 7 ; inline -: kCFNumberShortType 8 ; inline -: kCFNumberIntType 9 ; inline -: kCFNumberLongType 10 ; inline -: kCFNumberLongLongType 11 ; inline -: kCFNumberFloatType 12 ; inline -: kCFNumberDoubleType 13 ; inline -: kCFNumberCFIndexType 14 ; inline -: kCFNumberNSIntegerType 15 ; inline -: kCFNumberCGFloatType 16 ; inline -: kCFNumberMaxType 16 ; inline +CONSTANT: kCFNumberSInt8Type 1 +CONSTANT: kCFNumberSInt16Type 2 +CONSTANT: kCFNumberSInt32Type 3 +CONSTANT: kCFNumberSInt64Type 4 +CONSTANT: kCFNumberFloat32Type 5 +CONSTANT: kCFNumberFloat64Type 6 +CONSTANT: kCFNumberCharType 7 +CONSTANT: kCFNumberShortType 8 +CONSTANT: kCFNumberIntType 9 +CONSTANT: kCFNumberLongType 10 +CONSTANT: kCFNumberLongLongType 11 +CONSTANT: kCFNumberFloatType 12 +CONSTANT: kCFNumberDoubleType 13 +CONSTANT: kCFNumberCFIndexType 14 +CONSTANT: kCFNumberNSIntegerType 15 +CONSTANT: kCFNumberCGFloatType 16 +CONSTANT: kCFNumberMaxType 16 TYPEDEF: int CFPropertyListMutabilityOptions -: kCFPropertyListImmutable 0 ; inline -: kCFPropertyListMutableContainers 1 ; inline -: kCFPropertyListMutableContainersAndLeaves 2 ; inline +CONSTANT: kCFPropertyListImmutable 0 +CONSTANT: kCFPropertyListMutableContainers 1 +CONSTANT: kCFPropertyListMutableContainersAndLeaves 2 FUNCTION: CFNumberRef CFNumberCreate ( CFAllocatorRef allocator, CFNumberType theType, void* valuePtr ) ; diff --git a/basis/core-foundation/dictionaries/authors.txt b/basis/core-foundation/dictionaries/authors.txt new file mode 100644 index 0000000000..d4f5d6b3ae --- /dev/null +++ b/basis/core-foundation/dictionaries/authors.txt @@ -0,0 +1 @@ +Slava Pestov \ No newline at end of file diff --git a/basis/core-foundation/dictionaries/dictionaries-tests.factor b/basis/core-foundation/dictionaries/dictionaries-tests.factor new file mode 100644 index 0000000000..287b436990 --- /dev/null +++ b/basis/core-foundation/dictionaries/dictionaries-tests.factor @@ -0,0 +1,6 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: tools.test core-foundation core-foundation.dictionaries ; +IN: core-foundation.dictionaries.tests + +[ ] [ { } CFRelease ] unit-test \ No newline at end of file diff --git a/basis/core-foundation/dictionaries/dictionaries.factor b/basis/core-foundation/dictionaries/dictionaries.factor new file mode 100644 index 0000000000..dd2a5e1727 --- /dev/null +++ b/basis/core-foundation/dictionaries/dictionaries.factor @@ -0,0 +1,28 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: alien.syntax core-foundation kernel assocs alien.c-types +specialized-arrays.alien math sequences accessors ; +IN: core-foundation.dictionaries + +TYPEDEF: void* CFDictionaryRef +TYPEDEF: void* CFMutableDictionaryRef +TYPEDEF: void* CFDictionaryKeyCallBacks* +TYPEDEF: void* CFDictionaryValueCallBacks* + +FUNCTION: CFDictionaryRef CFDictionaryCreate ( + CFAllocatorRef allocator, + void** keys, + void** values, + CFIndex numValues, + CFDictionaryKeyCallBacks* keyCallBacks, + CFDictionaryValueCallBacks* valueCallBacks +) ; + +: ( alist -- dictionary ) + [ kCFAllocatorDefault ] dip + unzip [ >void*-array ] bi@ + dup length "void*" heap-size /i + [ [ underlying>> ] bi@ ] dip + &: kCFTypeDictionaryCallBacks + &: kCFTypeDictionaryValueCallbacks + CFDictionaryCreate ; \ No newline at end of file diff --git a/basis/core-foundation/dictionaries/tags.txt b/basis/core-foundation/dictionaries/tags.txt new file mode 100644 index 0000000000..6bf68304bb --- /dev/null +++ b/basis/core-foundation/dictionaries/tags.txt @@ -0,0 +1 @@ +unportable