]> gitweb @ CieloNegro.org - bindings-apr.git/commitdiff
more bindings
authorPHO <pho@cielonegro.org>
Sun, 8 Aug 2010 07:57:35 +0000 (16:57 +0900)
committerPHO <pho@cielonegro.org>
Sun, 8 Aug 2010 07:57:35 +0000 (16:57 +0900)
Bindings/APR/Allocator.hsc [new file with mode: 0644]
Bindings/APR/Errno.hsc [new file with mode: 0644]
bindings-apr.cabal
cbits/helper_apr_errno.c [new file with mode: 0644]

diff --git a/Bindings/APR/Allocator.hsc b/Bindings/APR/Allocator.hsc
new file mode 100644 (file)
index 0000000..454ff16
--- /dev/null
@@ -0,0 +1,28 @@
+#include <bindings.dsl.h>
+#include <apr_allocator.h>
+
+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 <apr_memnode_t>
+#field ref        , Ptr (Ptr <apr_memnode_t>)
+#field index      , <apr_uint32_t>
+#field free_index , <apr_uint32_t>
+#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 <apr_allocator_t>) -> IO <apr_status_t>
+#ccall apr_allocator_destroy, Ptr <apr_allocator_t> -> IO ()
+#ccall apr_allocator_alloc  , Ptr <apr_allocator_t> -> <apr_size_t> -> IO (Ptr <apr_memnode_t>)
+#ccall apr_allocator_free   , Ptr <apr_allocator_t> -> Ptr <apr_memnode_t> -> IO ()
+
+-- FIXME: incomplete
diff --git a/Bindings/APR/Errno.hsc b/Bindings/APR/Errno.hsc
new file mode 100644 (file)
index 0000000..a18a2c8
--- /dev/null
@@ -0,0 +1,173 @@
+#include <bindings.dsl.h>
+#include <apr_errno.h>
+
+module Bindings.APR.Errno where
+#strict_import
+import Bindings.APR
+
+#integral_t apr_status_t
+
+#ccall apr_strerror, <apr_status_t> -> Ptr CChar -> <apr_size_t> -> 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     , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOPOOL     , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EBADDATE    , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EINVALSOCK  , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOPROC     , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOTIME     , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENODIR      , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOLOCK     , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOSOCKET   , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOTHREAD   , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOTHDKEY   , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EGENERAL    , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOSHMAVAIL , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EBADIP      , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EBADMASK    , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EDSOOPEN    , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EABSOLUTE   , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ERELATIVE   , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EINCOMPLETE , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EABOVEROOT  , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EBADPATH    , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EPATHWILD   , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ESYMNOTFOUND, <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EPROC_UNKNOWN    , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOTENOUGHENTROPY, <apr_status_t> -> 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   , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_INPARENT  , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_DETACH    , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_NOTDETACH , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_CHILD_DONE, <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_CHILD_NOTDONE, <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_TIMEUP    , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_INCOMPLETE, <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_BADCH     , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_BADARG    , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EOF       , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_NOTFOUND  , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ANONYMOUS , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_FILEBASED , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_KEYBASED  , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EINIT     , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOTIMPL  , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EMISMATCH , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EBUSY     , <apr_status_t> -> 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 , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EEXIST , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENAMETOOLONG, <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOENT , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOTDIR, <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOSPC , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOMEM , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EMFILE , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENFILE , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EBADF  , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EINVAL , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ESPIPE , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EAGAIN , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EINTR  , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOTSOCK, <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ECONNREFUSED, <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EINPROGRESS , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ECONNABORTED, <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ECONNRESET  , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ETIMEDOUT   , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_TIMEDUP     , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EHOSTUNREACH, <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENETUNREACH , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EFTYPE   , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EPIPE    , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EXDEV    , <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_ENOTEMPTY, <apr_status_t> -> IO CInt
+#cinline APR_STATUS_IS_EAFNOSUPPORT, <apr_status_t> -> IO CInt
index 55ef003cc2462f7edae5a3a0223d16a56a58cd47..1c8947ca23aadd2461f26ea84804ab08138af38e 100644 (file)
@@ -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 (file)
index 0000000..0223174
--- /dev/null
@@ -0,0 +1,76 @@
+#include <bindings.cmacros.h>
+#include <apr_errno.h>
+
+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)