From: PHO Date: Sun, 8 Aug 2010 12:52:39 +0000 (+0900) Subject: more bindings X-Git-Tag: RELEASE-0.1~26 X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=eea1d259f1beb325e569fd01b48ef3ab14db1897;p=bindings-apr.git more bindings --- diff --git a/Bindings/APR/Tables.hsc b/Bindings/APR/Tables.hsc new file mode 100644 index 0000000..78f88ab --- /dev/null +++ b/Bindings/APR/Tables.hsc @@ -0,0 +1,67 @@ +#include +#include + +module Bindings.APR.Tables where +#strict_import +import Bindings.APR +import Bindings.APR.Pools + +#opaque_t apr_table_t + +#starttype struct apr_array_header_t +# field pool , Ptr +# field elt_size, CInt +# field nelts , CInt +# field nalloc , CInt +# field elts , Ptr CChar +#stoptype + +#starttype struct apr_table_entry_t +# field key, Ptr CChar +# field val, Ptr CChar +# field key_checksum, +#stoptype + +#ccall apr_table_elts , Ptr -> IO (Ptr ) + +#ccall apr_is_empty_table, Ptr -> IO CInt +#ccall apr_is_empty_array, Ptr -> IO CInt + +#ccall apr_array_make , Ptr -> CInt -> CInt -> IO (Ptr ) +#ccall apr_array_push , Ptr -> IO (Ptr ()) + +-- It's impossible to wrap around APR_ARRAY_IDX and APR_ARRAY_PUSH as +-- they take C types as their arguments. + +#ccall apr_array_pop , Ptr -> IO (Ptr ()) +#ccall apr_array_clear , Ptr -> IO () +#ccall apr_array_cat , Ptr -> Ptr -> IO () +#ccall apr_array_copy , Ptr -> Ptr -> IO (Ptr ) +#ccall apr_array_copy_hdr, Ptr -> Ptr -> IO (Ptr ) +#ccall apr_array_append , Ptr -> Ptr -> Ptr -> IO (Ptr ) +#ccall apr_array_pstrcat , Ptr -> Ptr -> CChar -> IO (Ptr CChar) + +#ccall apr_table_make , Ptr -> CInt -> IO (Ptr ) +#ccall apr_table_copy , Ptr -> Ptr -> IO (Ptr ) +#ccall apr_table_clone , Ptr -> Ptr -> IO (Ptr ) +#ccall apr_table_clear , Ptr -> IO () +#ccall apr_table_get , Ptr -> Ptr CChar -> IO (Ptr CChar) +#ccall apr_table_set , Ptr -> Ptr CChar -> Ptr CChar -> IO () +#ccall apr_table_setn , Ptr -> Ptr CChar -> Ptr CChar -> IO () +#ccall apr_table_unset , Ptr -> Ptr CChar -> Ptr CChar -> IO () +#ccall apr_table_merge , Ptr -> Ptr CChar -> Ptr CChar -> IO () +#ccall apr_table_mergen, Ptr -> Ptr CChar -> Ptr CChar -> IO () +#ccall apr_table_add , Ptr -> Ptr CChar -> Ptr CChar -> IO () +#ccall apr_table_addn , Ptr -> Ptr CChar -> Ptr CChar -> IO () +#ccall apr_table_overlay, Ptr -> Ptr -> Ptr -> IO (Ptr ) + +#callback apr_table_do_callback_fn_t, Ptr () -> Ptr CChar -> Ptr CChar -> IO CInt + +-- It's impossible to wrap around apr_table_do and apr_table_vdo as +-- they take varargs. + +#num APR_OVERLAP_TABLES_SET +#num APR_OVERLAP_TABLES_MERGE + +#ccall apr_table_overlap , Ptr -> Ptr -> CUInt -> IO () +#ccall apr_table_compress, Ptr -> CUInt -> IO () diff --git a/Bindings/APR/User.hsc b/Bindings/APR/User.hsc new file mode 100644 index 0000000..b4b229f --- /dev/null +++ b/Bindings/APR/User.hsc @@ -0,0 +1,24 @@ +#include +#include + +module Bindings.APR.User where +#strict_import +import Bindings.APR.ErrNo +import Bindings.APR.Pools + +#integral_t apr_uid_t +#integral_t apr_gid_t + +#if APR_HAS_USER + +# ccall apr_uid_current , Ptr -> Ptr -> Ptr -> IO +# ccall apr_uid_name_get , Ptr (Ptr CChar) -> -> Ptr -> IO +# ccall apr_uid_get , Ptr -> Ptr -> Ptr CChar -> Ptr -> IO +# ccall apr_uid_homepath_get, Ptr (Ptr CChar) -> Ptr CChar -> Ptr -> IO +# cinline apr_uid_compare , -> -> IO + +# ccall apr_gid_name_get , Ptr (Ptr CChar) -> -> Ptr -> IO +# ccall apr_gid_get , Ptr -> Ptr CChar -> Ptr -> IO +# cinline apr_gid_compare , -> -> IO + +#endif \ No newline at end of file diff --git a/bindings-apr.cabal b/bindings-apr.cabal index 7ef774c..4bb86d5 100644 --- a/bindings-apr.cabal +++ b/bindings-apr.cabal @@ -38,13 +38,16 @@ Library Bindings.APR.ErrNo Bindings.APR.Pools Bindings.APR.Proc.Mutex + Bindings.APR.Tables Bindings.APR.Thread.Mutex Bindings.APR.Thread.RWLock + Bindings.APR.User C-Sources: -- cbits/helper_apr_anylock.c cbits/helper_apr_errno.c cbits/helper_apr_pools.c + cbits/helper_apr_user.c Extensions: ForeignFunctionInterface diff --git a/cbits/helper_apr_user.c b/cbits/helper_apr_user.c new file mode 100644 index 0000000..a94eceb --- /dev/null +++ b/cbits/helper_apr_user.c @@ -0,0 +1,5 @@ +#include +#include + +BC_INLINE2(apr_uid_compare, apr_uid_t, apr_uid_t, apr_status_t) +BC_INLINE2(apr_gid_compare, apr_gid_t, apr_gid_t, apr_status_t)