From 4ea65ba7cb9f3c0114643e5e1bef8d957218960e Mon Sep 17 00:00:00 2001 From: PHO Date: Sun, 8 Aug 2010 16:57:35 +0900 Subject: [PATCH] more bindings --- Bindings/APR/Allocator.hsc | 28 ++++++ Bindings/APR/Errno.hsc | 173 +++++++++++++++++++++++++++++++++++++ bindings-apr.cabal | 5 ++ cbits/helper_apr_errno.c | 76 ++++++++++++++++ 4 files changed, 282 insertions(+) create mode 100644 Bindings/APR/Allocator.hsc create mode 100644 Bindings/APR/Errno.hsc create mode 100644 cbits/helper_apr_errno.c diff --git a/Bindings/APR/Allocator.hsc b/Bindings/APR/Allocator.hsc new file mode 100644 index 0000000..454ff16 --- /dev/null +++ b/Bindings/APR/Allocator.hsc @@ -0,0 +1,28 @@ +#include +#include + +module Bindings.APR.Allocator where +#strict_import +import Bindings.APR +import Bindings.APR.Errno + +#opaque_t apr_allocator_t + +#starttype struct apr_memnode_t +#field next , Ptr +#field ref , Ptr (Ptr ) +#field index , +#field free_index , +#field first_avail, Ptr CChar +#field endp , Ptr CChar +#stoptype + +#num APR_MEMNODE_T_SIZE +#num APR_ALLOCATOR_MAX_FREE_UNLIMITED + +#ccall apr_allocator_create , Ptr (Ptr ) -> IO +#ccall apr_allocator_destroy, Ptr -> IO () +#ccall apr_allocator_alloc , Ptr -> -> IO (Ptr ) +#ccall apr_allocator_free , Ptr -> Ptr -> IO () + +-- FIXME: incomplete diff --git a/Bindings/APR/Errno.hsc b/Bindings/APR/Errno.hsc new file mode 100644 index 0000000..a18a2c8 --- /dev/null +++ b/Bindings/APR/Errno.hsc @@ -0,0 +1,173 @@ +#include +#include + +module Bindings.APR.Errno where +#strict_import +import Bindings.APR + +#integral_t apr_status_t + +#ccall apr_strerror, -> Ptr CChar -> -> IO (Ptr CChar) + +#num APR_OS_START_ERROR +#num APR_OS_ERRSPACE_SIZE +#num APR_UTIL_ERRSPACE_SIZE +#num APR_OS_START_STATUS +#num APR_UTIL_START_STATUS +#num APR_OS_START_USERERR +#num APR_OS_START_USEERR +#num APR_OS_START_CANONERR +#num APR_OS_START_EAIERR +#num APR_OS_START_SYSERR + +#num APR_SUCCESS + +#num APR_ENOSTAT +#num APR_ENOPOOL +#num APR_EBADDATE +#num APR_EINVALSOCK +#num APR_ENOPROC +#num APR_ENOTIME +#num APR_ENODIR +#num APR_ENOLOCK +#num APR_ENOPOLL +#num APR_ENOSOCKET +#num APR_ENOTHREAD +#num APR_ENOTHDKEY +#num APR_EGENERAL +#num APR_ENOSHMAVAIL +#num APR_EBADIP +#num APR_EBADMASK +#num APR_EDSOOPEN +#num APR_EABSOLUTE +#num APR_ERELATIVE +#num APR_EINCOMPLETE +#num APR_EABOVEROOT +#num APR_EBADPATH +#num APR_EPATHWILD +#num APR_ESYMNOTFOUND +#num APR_EPROC_UNKNOWN +#num APR_ENOTENOUGHENTROPY + +#cinline APR_STATUS_IS_ENOSTAT , -> IO CInt +#cinline APR_STATUS_IS_ENOPOOL , -> IO CInt +#cinline APR_STATUS_IS_EBADDATE , -> IO CInt +#cinline APR_STATUS_IS_EINVALSOCK , -> IO CInt +#cinline APR_STATUS_IS_ENOPROC , -> IO CInt +#cinline APR_STATUS_IS_ENOTIME , -> IO CInt +#cinline APR_STATUS_IS_ENODIR , -> IO CInt +#cinline APR_STATUS_IS_ENOLOCK , -> IO CInt +#cinline APR_STATUS_IS_ENOSOCKET , -> IO CInt +#cinline APR_STATUS_IS_ENOTHREAD , -> IO CInt +#cinline APR_STATUS_IS_ENOTHDKEY , -> IO CInt +#cinline APR_STATUS_IS_EGENERAL , -> IO CInt +#cinline APR_STATUS_IS_ENOSHMAVAIL , -> IO CInt +#cinline APR_STATUS_IS_EBADIP , -> IO CInt +#cinline APR_STATUS_IS_EBADMASK , -> IO CInt +#cinline APR_STATUS_IS_EDSOOPEN , -> IO CInt +#cinline APR_STATUS_IS_EABSOLUTE , -> IO CInt +#cinline APR_STATUS_IS_ERELATIVE , -> IO CInt +#cinline APR_STATUS_IS_EINCOMPLETE , -> IO CInt +#cinline APR_STATUS_IS_EABOVEROOT , -> IO CInt +#cinline APR_STATUS_IS_EBADPATH , -> IO CInt +#cinline APR_STATUS_IS_EPATHWILD , -> IO CInt +#cinline APR_STATUS_IS_ESYMNOTFOUND, -> IO CInt +#cinline APR_STATUS_IS_EPROC_UNKNOWN , -> IO CInt +#cinline APR_STATUS_IS_ENOTENOUGHENTROPY, -> IO CInt + +#num APR_INCHILD +#num APR_INPARENT +#num APR_DETACH +#num APR_NOTDETACH +#num APR_CHILD_DONE +#num APR_CHILD_NOTDONE +#num APR_TIMEUP +#num APR_INCOMPLETE +#num APR_BADCH +#num APR_BADARG +#num APR_EOF +#num APR_NOTFOUND +#num APR_ANONYMOUS +#num APR_FILEBASED +#num APR_KEYBASED +#num APR_EINIT +#num APR_ENOTIMPL +#num APR_EMISMATCH +#num APR_EBUSY + +#cinline APR_STATUS_IS_INCHILD , -> IO CInt +#cinline APR_STATUS_IS_INPARENT , -> IO CInt +#cinline APR_STATUS_IS_DETACH , -> IO CInt +#cinline APR_STATUS_IS_NOTDETACH , -> IO CInt +#cinline APR_STATUS_IS_CHILD_DONE, -> IO CInt +#cinline APR_STATUS_IS_CHILD_NOTDONE, -> IO CInt +#cinline APR_STATUS_IS_TIMEUP , -> IO CInt +#cinline APR_STATUS_IS_INCOMPLETE, -> IO CInt +#cinline APR_STATUS_IS_BADCH , -> IO CInt +#cinline APR_STATUS_IS_BADARG , -> IO CInt +#cinline APR_STATUS_IS_EOF , -> IO CInt +#cinline APR_STATUS_IS_NOTFOUND , -> IO CInt +#cinline APR_STATUS_IS_ANONYMOUS , -> IO CInt +#cinline APR_STATUS_IS_FILEBASED , -> IO CInt +#cinline APR_STATUS_IS_KEYBASED , -> IO CInt +#cinline APR_STATUS_IS_EINIT , -> IO CInt +#cinline APR_STATUS_IS_ENOTIMPL , -> IO CInt +#cinline APR_STATUS_IS_EMISMATCH , -> IO CInt +#cinline APR_STATUS_IS_EBUSY , -> IO CInt + +#num APR_EACCES +#num APR_EEXIST +#num APR_ENAMETOOLONG +#num APR_ENOENT +#num APR_ENOTDIR +#num APR_ENOSPC +#num APR_ENOMEM +#num APR_EMFILE +#num APR_ENFILE +#num APR_EBADF +#num APR_EINVAL +#num APR_ESPIPE +#num APR_EAGAIN +#num APR_EINTR +#num APR_ENOTSOCK +#num APR_ECONNREFUSED +#num APR_EINPROGRESS +#num APR_ECONNABORTED +#num APR_ECONNRESET +#num APR_ETIMEDOUT +#num APR_EHOSTUNREACH +#num APR_ENETUNREACH +#num APR_EFTYPE +#num APR_EPIPE +#num APR_EXDEV +#num APR_ENOTEMPTY +#num APR_EAFNOSUPPORT + +#cinline APR_STATUS_IS_EACCES , -> IO CInt +#cinline APR_STATUS_IS_EEXIST , -> IO CInt +#cinline APR_STATUS_IS_ENAMETOOLONG, -> IO CInt +#cinline APR_STATUS_IS_ENOENT , -> IO CInt +#cinline APR_STATUS_IS_ENOTDIR, -> IO CInt +#cinline APR_STATUS_IS_ENOSPC , -> IO CInt +#cinline APR_STATUS_IS_ENOMEM , -> IO CInt +#cinline APR_STATUS_IS_EMFILE , -> IO CInt +#cinline APR_STATUS_IS_ENFILE , -> IO CInt +#cinline APR_STATUS_IS_EBADF , -> IO CInt +#cinline APR_STATUS_IS_EINVAL , -> IO CInt +#cinline APR_STATUS_IS_ESPIPE , -> IO CInt +#cinline APR_STATUS_IS_EAGAIN , -> IO CInt +#cinline APR_STATUS_IS_EINTR , -> IO CInt +#cinline APR_STATUS_IS_ENOTSOCK, -> IO CInt +#cinline APR_STATUS_IS_ECONNREFUSED, -> IO CInt +#cinline APR_STATUS_IS_EINPROGRESS , -> IO CInt +#cinline APR_STATUS_IS_ECONNABORTED, -> IO CInt +#cinline APR_STATUS_IS_ECONNRESET , -> IO CInt +#cinline APR_STATUS_IS_ETIMEDOUT , -> IO CInt +#cinline APR_STATUS_IS_TIMEDUP , -> IO CInt +#cinline APR_STATUS_IS_EHOSTUNREACH, -> IO CInt +#cinline APR_STATUS_IS_ENETUNREACH , -> IO CInt +#cinline APR_STATUS_IS_EFTYPE , -> IO CInt +#cinline APR_STATUS_IS_EPIPE , -> IO CInt +#cinline APR_STATUS_IS_EXDEV , -> IO CInt +#cinline APR_STATUS_IS_ENOTEMPTY, -> IO CInt +#cinline APR_STATUS_IS_EAFNOSUPPORT, -> IO CInt diff --git a/bindings-apr.cabal b/bindings-apr.cabal index 55ef003..1c8947c 100644 --- a/bindings-apr.cabal +++ b/bindings-apr.cabal @@ -29,6 +29,11 @@ Library Exposed-Modules: Bindings.APR + Bindings.APR.Allocator + Bindings.APR.Errno + + C-Sources: + cbits/helper_apr_errno.c Extensions: ForeignFunctionInterface diff --git a/cbits/helper_apr_errno.c b/cbits/helper_apr_errno.c new file mode 100644 index 0000000..0223174 --- /dev/null +++ b/cbits/helper_apr_errno.c @@ -0,0 +1,76 @@ +#include +#include + +BC_INLINE1(APR_STATUS_IS_ENOSTAT , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOPOOL , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EBADDATE , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EINVALSOCK , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOPROC , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOTIME , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENODIR , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOPOLL , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOSOCKET , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOTHREAD , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOTHDKEY , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EGENERAL , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOSHMAVAIL, apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EBADIP , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EBADMASK , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EDSOOPEN , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EABSOLUTE , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ERELATIVE , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EINCOMPLETE, apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EABOVEROOT , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EBADPATH , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EPATHWILD , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ESYMNOTFOUND , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EPROC_UNKNOWN , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOTENOUGHENTROPY, apr_status_t, int) + +BC_INLINE1(APR_STATUS_IS_INCHILD , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_INPARENT , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_DETACH , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_NOTDETACH , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_CHILD_DONE, apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_CHILD_NOTDONE, apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_TIMEUP , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_INCOMPLETE, apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_BADCH , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_BADARG , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EOF , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_NOTFOUND , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ANONYMOUS , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_FILEBASED , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_KEYBASED , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EINIT , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOTIMPL , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EMISMATCH , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EBUSY , apr_status_t, int) + +BC_INLINE1(APR_STATUS_IS_EACCES , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EEXIST , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENAMETOOLONG, apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOENT , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOTDIR, apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOSPC , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOMEM , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EMFILE , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENFILE , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EBADF , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EINVAL , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ESPIPE , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EAGAIN , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EINTR , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOTSOCK, apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ECONNREFUSED, apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EINPROGRESS , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ECONNABORTED, apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ECONNRESET , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ETIMEDOUT , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EHOSTUNREACH, apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENETUNREACH , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EFTYPE , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EPIPE , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EXDEV , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_ENOTEMPTY , apr_status_t, int) +BC_INLINE1(APR_STATUS_IS_EAFNOSUPPORT, apr_status_t, int) -- 2.40.0