]> gitweb @ CieloNegro.org - bindings-apr-util.git/commitdiff
Bindings.APR.SDBM
authorPHO <pho@cielonegro.org>
Tue, 21 Sep 2010 15:01:48 +0000 (00:01 +0900)
committerPHO <pho@cielonegro.org>
Tue, 21 Sep 2010 15:01:48 +0000 (00:01 +0900)
Bindings/APR/SDBM.hsc [new file with mode: 0644]
bindings-apr-util.cabal
cbits/helper_apr_sdbm.c [new file with mode: 0644]

diff --git a/Bindings/APR/SDBM.hsc b/Bindings/APR/SDBM.hsc
new file mode 100644 (file)
index 0000000..45e9a43
--- /dev/null
@@ -0,0 +1,34 @@
+#include <bindings.dsl.h>
+#include <apr_sdbm.h>
+
+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 <apr_sdbm_t>) -> Ptr CChar -> <apr_int32_t> -> <apr_fileperms_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#ccall   apr_sdbm_close   , Ptr <apr_sdbm_t> -> IO <apr_status_t>
+#ccall   apr_sdbm_lock    , Ptr <apr_sdbm_t> -> CInt -> IO <apr_status_t>
+#ccall   apr_sdbm_unlock  , Ptr <apr_sdbm_t> -> IO <apr_status_t>
+#cinline apr_sdbm_fetch   , Ptr <apr_sdbm_t> -> Ptr <apr_sdbm_datum_t> -> Ptr <apr_sdbm_datum_t> -> IO <apr_status_t>
+#cinline apr_sdbm_store   , Ptr <apr_sdbm_t> -> Ptr <apr_sdbm_datum_t> -> Ptr <apr_sdbm_datum_t> -> CInt -> IO <apr_status_t>
+#cinline apr_sdbm_delete  , Ptr <apr_sdbm_t> -> Ptr <apr_sdbm_datum_t> -> IO <apr_status_t>
+#ccall   apr_sdbm_firstkey, Ptr <apr_sdbm_t> -> Ptr <apr_sdbm_datum_t> -> IO <apr_status_t>
+#ccall   apr_sdbm_nextkey , Ptr <apr_sdbm_t> -> Ptr <apr_sdbm_datum_t> -> IO <apr_status_t>
+#ccall   apr_sdbm_rdonly  , Ptr <apr_sdbm_t> -> IO CInt
index afa79fcf46c29b6760c72285990998ee74374d1e..052cd4cb8cc44118c7e96e7ab7c6def55185fe80 100644 (file)
@@ -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 (file)
index 0000000..a839211
--- /dev/null
@@ -0,0 +1,23 @@
+#include <bindings.cmacros.h>
+#include <apr_sdbm.h>
+
+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);
+}