From 61960a60b7ab0707d6c7af7a97ce3eee61778fe1 Mon Sep 17 00:00:00 2001 From: PHO Date: Mon, 9 Aug 2010 00:42:30 +0900 Subject: [PATCH] more bindings --- Bindings/APR/FNMatch.hsc | 19 +++++++++++++++++++ Bindings/APR/General.hsc | 39 ++++++++++++++++++++++++++++++++++++++ bindings-apr.cabal | 3 +++ cbits/helper_apr_general.c | 11 +++++++++++ 4 files changed, 72 insertions(+) create mode 100644 Bindings/APR/FNMatch.hsc create mode 100644 Bindings/APR/General.hsc create mode 100644 cbits/helper_apr_general.c diff --git a/Bindings/APR/FNMatch.hsc b/Bindings/APR/FNMatch.hsc new file mode 100644 index 0000000..50d63dd --- /dev/null +++ b/Bindings/APR/FNMatch.hsc @@ -0,0 +1,19 @@ +#include +#include + +module Bindings.APR.FNMatch where +#strict_import +import Bindings.APR.ErrNo +import Bindings.APR.Pools +import Bindings.APR.Tables + +#num APR_FNM_NOMATCH + +#num APR_FNM_NOESCAPE +#num APR_FNM_PATHNAME +#num APR_FNM_PERIOD +#num APR_FNM_CASE_BLIND + +#ccall apr_fnmatch , Ptr CChar -> Ptr CChar -> CInt -> IO +#ccall apr_fnmatch_test, Ptr CChar -> IO CInt +#ccall apr_match_glob , Ptr CChar -> Ptr (Ptr ) -> Ptr -> IO diff --git a/Bindings/APR/General.hsc b/Bindings/APR/General.hsc new file mode 100644 index 0000000..b28bcb6 --- /dev/null +++ b/Bindings/APR/General.hsc @@ -0,0 +1,39 @@ +#include +#include + +module Bindings.APR.General where +#strict_import +import Bindings.APR +import Bindings.APR.ErrNo +import Bindings.APR.Pools + +#num FALSE +#num TRUE + +#num APR_ASCII_BLANK +#num APR_ASCII_CR +#num APR_ASCII_LF +#num APR_ASCII_TAB + +#integral_t apr_signum_t + +-- It's impossible to wrap around APR_OFFSET() and APR_OFFSET_OF(). + +#cinline strcasecmp , Ptr CChar -> Ptr CChar -> IO CInt +#cinline strncasecmp, Ptr CChar -> Ptr CChar -> CSize -> IO CInt + +-- What's the correct type for these macros? +#cinline APR_ALIGN, -> -> IO +#cinline APR_ALIGN_DEFAULT, -> IO + +#cinline memmove, Ptr () -> Ptr () -> CSize -> IO (Ptr ()) +#cinline memchr , Ptr () -> CInt -> CSize -> IO (Ptr ()) + +#ccall apr_initialize , IO +#ccall apr_app_initialize, Ptr CInt -> Ptr (Ptr (Ptr CChar)) -> Ptr (Ptr (Ptr CChar)) -> IO +#ccall apr_terminate , IO () +#ccall apr_terminate2 , IO () + +#if APR_HAS_RANDOM +#ccall apr_generate_random_bytes, Ptr CUChar -> -> IO +#endif diff --git a/bindings-apr.cabal b/bindings-apr.cabal index 75436cd..6b312d1 100644 --- a/bindings-apr.cabal +++ b/bindings-apr.cabal @@ -39,6 +39,8 @@ Library Bindings.APR.File.IO Bindings.APR.File.Info Bindings.APR.File.Types + Bindings.APR.FNMatch + Bindings.APR.General Bindings.APR.Pools Bindings.APR.Proc.Mutex Bindings.APR.Tables @@ -51,6 +53,7 @@ Library C-Sources: -- cbits/helper_apr_anylock.c cbits/helper_apr_errno.c + cbits/helper_apr_general.c cbits/helper_apr_pools.c cbits/helper_apr_time.c cbits/helper_apr_user.c diff --git a/cbits/helper_apr_general.c b/cbits/helper_apr_general.c new file mode 100644 index 0000000..a823f11 --- /dev/null +++ b/cbits/helper_apr_general.c @@ -0,0 +1,11 @@ +#include +#include + +BC_INLINE2(strcasecmp , const char*, const char*, int) +BC_INLINE3(strncasecmp, const char*, const char*, size_t, int) + +BC_INLINE2(APR_ALIGN, apr_uint64_t, apr_uint64_t, apr_uint64_t) +BC_INLINE1(APR_ALIGN_DEFAULT, apr_uint64_t, apr_uint64_t) + +BC_INLINE3(memmove, void*, const void*, size_t, void*) +BC_INLINE3(memchr , const void*, int, size_t, void*) -- 2.40.0