From a424d172b3c1c5150cb47a861cc2ff116680ce2a Mon Sep 17 00:00:00 2001 From: PHO Date: Sat, 16 Oct 2010 00:34:15 +0900 Subject: [PATCH] CFData.h --- Bindings/CoreFoundation/CFData.hsc | 26 ++++++++++++++++++++++++++ bindings-CoreFoundation.cabal | 2 ++ cbits/helper_CFData.c | 20 ++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 Bindings/CoreFoundation/CFData.hsc create mode 100644 cbits/helper_CFData.c diff --git a/Bindings/CoreFoundation/CFData.hsc b/Bindings/CoreFoundation/CFData.hsc new file mode 100644 index 0000000..473aec2 --- /dev/null +++ b/Bindings/CoreFoundation/CFData.hsc @@ -0,0 +1,26 @@ +#include +#include + +module Bindings.CoreFoundation.CFData where +#strict_import +import Bindings.CoreFoundation.CFBase + +#opaque_t __CFData +#synonym_t CFDataRef , Ptr <__CFData> +#synonym_t CFMutableDataRef, Ptr <__CFData> + +#ccall CFDataGetTypeID , IO +#ccall CFDataCreate , -> Ptr -> -> IO +#ccall CFDataCreateWithBytesNoCopy, -> Ptr -> -> -> IO +#ccall CFDataCreateCopy , -> -> IO +#ccall CFDataCreateMutable , -> -> IO +#ccall CFDataCreateMutableCopy , -> -> -> IO +#ccall CFDataGetLength , -> IO +#ccall CFDataGetBytePtr , -> IO (Ptr ) +#ccall CFDataGetMutableBytePtr , -> IO (Ptr ) +#cinline CFDataGetBytes , -> Ptr -> Ptr -> IO () +#ccall CFDataSetLength , -> -> IO () +#ccall CFDataIncreaseLength , -> -> IO () +#ccall CFDataAppendBytes , -> Ptr -> -> IO () +#cinline CFDataReplaceBytes , -> Ptr -> Ptr -> -> IO () +#cinline CFDataDeleteBytes , -> Ptr -> IO () diff --git a/bindings-CoreFoundation.cabal b/bindings-CoreFoundation.cabal index 21c84ce..6e0dda0 100644 --- a/bindings-CoreFoundation.cabal +++ b/bindings-CoreFoundation.cabal @@ -31,10 +31,12 @@ Library Exposed-Modules: Bindings.CoreFoundation.CFArray Bindings.CoreFoundation.CFBase + Bindings.CoreFoundation.CFData C-Sources: cbits/helper_CFArray.c cbits/helper_CFBase.c + cbits/helper_CFData.c Extensions: ForeignFunctionInterface diff --git a/cbits/helper_CFData.c b/cbits/helper_CFData.c new file mode 100644 index 0000000..1c1502d --- /dev/null +++ b/cbits/helper_CFData.c @@ -0,0 +1,20 @@ +#include +#include + +void +inline_CFDataGetBytes(CFDataRef theData, CFRange* range, UInt8 *buffer) { + return CFDataGetBytes(theData, *range, buffer); +} + +void +inline_CFDataReplaceBytes(CFMutableDataRef theData, + CFRange* range, + const UInt8 *newBytes, + CFIndex newLength) { + return CFDataReplaceBytes(theData, *range, newBytes, newLength); +} + +void +inline_CFDataDeleteBytes(CFMutableDataRef theData, CFRange* range) { + return CFDataDeleteBytes(theData, *range); +} -- 2.40.0