From: PHO Date: Tue, 21 Sep 2010 15:01:48 +0000 (+0900) Subject: Bindings.APR.SDBM X-Git-Tag: RELEASE-0.1~6 X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=825ad4620a5166cccbf7aec2f5fd17d66531afc4;p=bindings-apr-util.git Bindings.APR.SDBM --- diff --git a/Bindings/APR/SDBM.hsc b/Bindings/APR/SDBM.hsc new file mode 100644 index 0000000..45e9a43 --- /dev/null +++ b/Bindings/APR/SDBM.hsc @@ -0,0 +1,34 @@ +#include +#include + +module Bindings.APR.SDBM where +#strict_import +import Bindings.APR +import Bindings.APR.ErrNo +import Bindings.APR.File.Info +import Bindings.APR.Pools + +#opaque_t apr_sdbm_t + +#starttype apr_sdbm_datum_t +# field dptr , Ptr CChar +# field dsize, CInt +#stoptype + +#globalarray APR_SDBM_DIRFEXT, CChar +#globalarray APR_SDBM_PAGFEXT, CChar + +#num APR_SDBM_INSERT +#num APR_SDBM_REPLACE +#num APR_SDBM_INSERTDUP + +#ccall apr_sdbm_open , Ptr (Ptr ) -> Ptr CChar -> -> -> Ptr -> IO +#ccall apr_sdbm_close , Ptr -> IO +#ccall apr_sdbm_lock , Ptr -> CInt -> IO +#ccall apr_sdbm_unlock , Ptr -> IO +#cinline apr_sdbm_fetch , Ptr -> Ptr -> Ptr -> IO +#cinline apr_sdbm_store , Ptr -> Ptr -> Ptr -> CInt -> IO +#cinline apr_sdbm_delete , Ptr -> Ptr -> IO +#ccall apr_sdbm_firstkey, Ptr -> Ptr -> IO +#ccall apr_sdbm_nextkey , Ptr -> Ptr -> IO +#ccall apr_sdbm_rdonly , Ptr -> IO CInt diff --git a/bindings-apr-util.cabal b/bindings-apr-util.cabal index afa79fc..052cd4c 100644 --- a/bindings-apr-util.cabal +++ b/bindings-apr-util.cabal @@ -48,6 +48,7 @@ Library Bindings.APR.Queue Bindings.APR.RMM Bindings.APR.ResList + Bindings.APR.SDBM Bindings.APR.XLate C-Sources: @@ -57,6 +58,7 @@ Library cbits/helper_apr_ldap.c cbits/helper_apr_ldap_init.c cbits/helper_apr_md4.c + cbits/helper_apr_sdbm.c Extensions: ForeignFunctionInterface diff --git a/cbits/helper_apr_sdbm.c b/cbits/helper_apr_sdbm.c new file mode 100644 index 0000000..a839211 --- /dev/null +++ b/cbits/helper_apr_sdbm.c @@ -0,0 +1,23 @@ +#include +#include + +BC_GLOBALARRAY(APR_SDBM_DIRFEXT, char) +BC_GLOBALARRAY(APR_SDBM_PAGFEXT, char) + +apr_status_t inline_apr_sdbm_fetch(apr_sdbm_t* db, + apr_sdbm_datum_t* value, + apr_sdbm_datum_t* key) { + return apr_sdbm_fetch(db, value, *key); +} + +apr_status_t inline_apr_sdbm_store(apr_sdbm_t* db, + apr_sdbm_datum_t* key, + apr_sdbm_datum_t* value, + int opt) { + return apr_sdbm_store(db, *key, *value, opt); +} + +apr_status_t inline_apr_sdbm_delete(apr_sdbm_t* db, + const apr_sdbm_datum_t* key) { + return apr_sdbm_delete(db, *key); +}