CFBase.h
authorPHO <pho@cielonegro.org>
Fri, 15 Oct 2010 13:07:19 +0000 (22:07 +0900)
committerPHO <pho@cielonegro.org>
Fri, 15 Oct 2010 13:07:19 +0000 (22:07 +0900)
Bindings/CoreFoundation/CFBase.hsc
bindings-CoreFoundation.cabal
cbits/helper_CFBase.c [new file with mode: 0644]

index be6d4a7e4abe8c4f958a2d64049b270f792d37b8..915baa389a13cf867f3dcad651f6eb24b44ea953 100644 (file)
@@ -91,3 +91,69 @@ module Bindings.CoreFoundation.CFBase where
 #num       kCFCompareEqualTo
 #num       kCFCompareGreaterThan
 #synonym_t CFComparisonResult, <CFIndex>
+
+#callback CFComparatorFunction, Ptr () -> Ptr () -> Ptr () -> IO <CFComparisonResult>
+
+#num kCFNotFound
+
+#starttype CFRange
+#  field location, <CFIndex>
+#  field length  , <CFIndex>
+#stoptype
+
+#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED
+#  opaque_t  __CFNull
+#  synonym_t CFNullRef      , Ptr <__CFNull>
+#  ccall     CFNullGetTypeID, IO <CFTypeID>
+#  cinline   kCFNull        , IO <CFNullRef>
+#endif
+
+#opaque_t  __CFAllocator
+#synonym_t CFAllocatorRef           , Ptr <__CFAllocator>
+#cinline   kCFAllocatorDefault      , IO <CFAllocatorRef>
+#cinline   kCFAllocatorSystemDefault, IO <CFAllocatorRef>
+#cinline   kCFAllocatorMalloc       , IO <CFAllocatorRef>
+#cinline   kCFAllocatorMallocZone   , IO <CFAllocatorRef>
+#cinline   kCFAllocatorNull         , IO <CFAllocatorRef>
+#cinline   kCFAllocatorUseContext   , IO <CFAllocatorRef>
+
+#callback CFAllocatorRetainCallBack         , Ptr () -> IO (Ptr ())
+#callback CFAllocatorReleaseCallBack        , Ptr () -> IO ()
+#callback CFAllocatorCopyDescriptionCallBack, Ptr () -> IO <CFStringRef>
+#callback CFAllocatorAllocateCallBack       , <CFIndex> -> <CFOptionFlags> -> Ptr () -> IO (Ptr ())
+#callback CFAllocatorReallocateCallBack     , Ptr () -> <CFIndex> -> <CFOptionFlags> -> Ptr () -> IO (Ptr ())
+#callback CFAllocatorDeallocateCallBack     , Ptr () -> Ptr () -> IO ()
+#callback CFAllocatorPreferredSizeCallBack  , <CFIndex> -> <CFOptionFlags> -> Ptr () -> IO <CFIndex>
+
+#starttype CFAllocatorContext
+#  field version        , <CFIndex>
+#  field info           , Ptr ()
+#  field retain         , <CFAllocatorRetainCallBack>
+#  field release        , <CFAllocatorReleaseCallBack>
+#  field copyDescription, <CFAllocatorCopyDescriptionCallBack>
+#  field allocate       , <CFAllocatorAllocateCallBack>
+#  field reallocate     , <CFAllocatorReallocateCallBack>
+#  field deallocate     , <CFAllocatorDeallocateCallBack>
+#  field preferredSize  , <CFAllocatorPreferredSizeCallBack>
+#stoptype
+
+#ccall CFAllocatorGetTypeID , IO <CFTypeID>
+#ccall CFAllocatorSetDefault, <CFAllocatorRef> -> IO ()
+#ccall CFAllocatorGetDefault, IO <CFAllocatorRef>
+#ccall CFAllocatorCreate    , <CFAllocatorRef> -> Ptr <CFAllocatorContext> -> IO <CFAllocatorRef>
+#ccall CFAllocatorAllocate  , <CFAllocatorRef> -> <CFIndex> -> <CFOptionFlags> -> IO (Ptr ())
+#ccall CFAllocatorReallocate, <CFAllocatorRef> -> Ptr () -> <CFIndex> -> <CFOptionFlags> -> IO (Ptr ())
+#ccall CFAllocatorDeallocate, <CFAllocatorRef> -> Ptr () -> IO ()
+#ccall CFAllocatorGetPreferredSizeForSize, <CFAllocatorRef> -> <CFIndex> -> <CFOptionFlags> -> IO <CFIndex>
+#ccall CFAllocatorGetContext, <CFAllocatorRef> -> Ptr <CFAllocatorContext> -> IO ()
+
+#ccall CFGetTypeID      , <CFTypeRef> -> IO <CFTypeID>
+#ccall CFCopyTypeIDDescription, <CFTypeID> -> IO <CFStringRef>
+#ccall CFRetain         , <CFTypeRef> -> IO <CFTypeRef>
+#ccall CFRelease        , <CFTypeRef> -> IO ()
+#ccall CFGetRetainCount , <CFTypeRef> -> IO <CFIndex>
+#ccall CFMakeCollectable, <CFTypeRef> -> IO <CFTypeRef>
+#ccall CFEqual          , <CFTypeRef> -> <CFTypeRef> -> IO <Boolean>
+#ccall CFHash           , <CFTypeRef> -> IO <CFHashCode>
+#ccall CFCopyDescription, <CFTypeRef> -> IO <CFStringRef>
+#ccall CFGetAllocator   , <CFTypeRef> -> IO <CFAllocatorRef>
index e02eed239e496a53b64a1be42ed61e2aeb51cfbe..3691af75f9c25494b3664c02626561bfa2bfc170 100644 (file)
@@ -31,13 +31,8 @@ Library
     Exposed-Modules:
         Bindings.CoreFoundation.CFBase
 
---    C-Sources:
---        cbits/helper_aiff.c
---        cbits/helper_files.c
---        cbits/helper_mactypes.c
-
---    CC-Options:
---        -fpascal-strings
+    C-Sources:
+        cbits/helper_CFBase.c
 
     Extensions:
         ForeignFunctionInterface
diff --git a/cbits/helper_CFBase.c b/cbits/helper_CFBase.c
new file mode 100644 (file)
index 0000000..5fb8abc
--- /dev/null
@@ -0,0 +1,12 @@
+#include <bindings.cmacros.h>
+#include <CoreFoundation/CFBase.h>
+
+#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED
+BC_INLINE_(kCFNull, CFNullRef)
+#endif
+
+BC_INLINE_(kCFAllocatorDefault      , CFAllocatorRef)
+BC_INLINE_(kCFAllocatorSystemDefault, CFAllocatorRef)
+BC_INLINE_(kCFAllocatorMalloc       , CFAllocatorRef)
+BC_INLINE_(kCFAllocatorNull         , CFAllocatorRef)
+BC_INLINE_(kCFAllocatorUseContext   , CFAllocatorRef)