From 13d20a43bdc325dba0ad2b0fa2cb6b59f1dc2bce Mon Sep 17 00:00:00 2001 From: PHO Date: Fri, 15 Oct 2010 22:07:19 +0900 Subject: [PATCH 1/1] CFBase.h --- Bindings/CoreFoundation/CFBase.hsc | 66 ++++++++++++++++++++++++++++++ bindings-CoreFoundation.cabal | 9 +--- cbits/helper_CFBase.c | 12 ++++++ 3 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 cbits/helper_CFBase.c diff --git a/Bindings/CoreFoundation/CFBase.hsc b/Bindings/CoreFoundation/CFBase.hsc index be6d4a7..915baa3 100644 --- a/Bindings/CoreFoundation/CFBase.hsc +++ b/Bindings/CoreFoundation/CFBase.hsc @@ -91,3 +91,69 @@ module Bindings.CoreFoundation.CFBase where #num kCFCompareEqualTo #num kCFCompareGreaterThan #synonym_t CFComparisonResult, + +#callback CFComparatorFunction, Ptr () -> Ptr () -> Ptr () -> IO + +#num kCFNotFound + +#starttype CFRange +# field location, +# field length , +#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 +# cinline kCFNull , IO +#endif + +#opaque_t __CFAllocator +#synonym_t CFAllocatorRef , Ptr <__CFAllocator> +#cinline kCFAllocatorDefault , IO +#cinline kCFAllocatorSystemDefault, IO +#cinline kCFAllocatorMalloc , IO +#cinline kCFAllocatorMallocZone , IO +#cinline kCFAllocatorNull , IO +#cinline kCFAllocatorUseContext , IO + +#callback CFAllocatorRetainCallBack , Ptr () -> IO (Ptr ()) +#callback CFAllocatorReleaseCallBack , Ptr () -> IO () +#callback CFAllocatorCopyDescriptionCallBack, Ptr () -> IO +#callback CFAllocatorAllocateCallBack , -> -> Ptr () -> IO (Ptr ()) +#callback CFAllocatorReallocateCallBack , Ptr () -> -> -> Ptr () -> IO (Ptr ()) +#callback CFAllocatorDeallocateCallBack , Ptr () -> Ptr () -> IO () +#callback CFAllocatorPreferredSizeCallBack , -> -> Ptr () -> IO + +#starttype CFAllocatorContext +# field version , +# field info , Ptr () +# field retain , +# field release , +# field copyDescription, +# field allocate , +# field reallocate , +# field deallocate , +# field preferredSize , +#stoptype + +#ccall CFAllocatorGetTypeID , IO +#ccall CFAllocatorSetDefault, -> IO () +#ccall CFAllocatorGetDefault, IO +#ccall CFAllocatorCreate , -> Ptr -> IO +#ccall CFAllocatorAllocate , -> -> -> IO (Ptr ()) +#ccall CFAllocatorReallocate, -> Ptr () -> -> -> IO (Ptr ()) +#ccall CFAllocatorDeallocate, -> Ptr () -> IO () +#ccall CFAllocatorGetPreferredSizeForSize, -> -> -> IO +#ccall CFAllocatorGetContext, -> Ptr -> IO () + +#ccall CFGetTypeID , -> IO +#ccall CFCopyTypeIDDescription, -> IO +#ccall CFRetain , -> IO +#ccall CFRelease , -> IO () +#ccall CFGetRetainCount , -> IO +#ccall CFMakeCollectable, -> IO +#ccall CFEqual , -> -> IO +#ccall CFHash , -> IO +#ccall CFCopyDescription, -> IO +#ccall CFGetAllocator , -> IO diff --git a/bindings-CoreFoundation.cabal b/bindings-CoreFoundation.cabal index e02eed2..3691af7 100644 --- a/bindings-CoreFoundation.cabal +++ b/bindings-CoreFoundation.cabal @@ -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 index 0000000..5fb8abc --- /dev/null +++ b/cbits/helper_CFBase.c @@ -0,0 +1,12 @@ +#include +#include + +#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) -- 2.40.0