From 555f5bdd1b954ba961fa08bcc59bb3f77e57a58d Mon Sep 17 00:00:00 2001 From: PHO Date: Thu, 7 Oct 2010 01:59:07 +0900 Subject: [PATCH] Bindings.APR.XML and APU.Version --- Bindings/APR/XML.hsc | 90 ++++++++++++++++++++++++++++++++++++++ Bindings/APU/Version.hsc | 17 +++++++ bindings-apr-util.cabal | 6 ++- cbits/helper_apr_xml.c | 6 +++ cbits/helper_apu_version.c | 4 ++ 5 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 Bindings/APR/XML.hsc create mode 100644 Bindings/APU/Version.hsc create mode 100644 cbits/helper_apr_xml.c create mode 100644 cbits/helper_apu_version.c diff --git a/Bindings/APR/XML.hsc b/Bindings/APR/XML.hsc new file mode 100644 index 0000000..c048d6d --- /dev/null +++ b/Bindings/APR/XML.hsc @@ -0,0 +1,90 @@ +#include +#include + +module Bindings.APR.XML where +#strict_import +import Bindings.APR +import Bindings.APR.ErrNo +import Bindings.APR.File.Types +import Bindings.APR.Pools +import Bindings.APR.Tables +import Bindings.APR.XLate + +#starttype struct apr_text +# field text, Ptr CChar +# field next, Ptr +#stoptype + +#starttype struct apr_text_header +# field first, Ptr +# field last , Ptr +#stoptype + +#ccall apr_text_append, Ptr -> Ptr -> Ptr CChar -> IO () + +#num APR_XML_NS_DAV_ID +#num APR_XML_NS_NONE + +#num APR_XML_NS_ERROR_BASE +#cinline APR_XML_NS_IS_ERROR, CInt -> IO CInt + +#starttype struct apr_xml_attr +# field name , Ptr CChar +# field ns , CInt +# field value, Ptr CChar +# field next , Ptr +#stoptype + +#opaque_t apr_xml_ns_scope + +#starttype struct apr_xml_elem +# field name, Ptr CChar +# field ns , CInt +# field lang, Ptr CChar + +# field first_cdata , +# field following_cdata, + +# field parent , Ptr +# field next , Ptr +# field first_child, Ptr +# field attr , Ptr + +# field last_child , Ptr +# field ns_scope , Ptr + +# field priv, Ptr () +#stoptype + +#cinline APR_XML_ELEM_IS_EMPTY, Ptr -> IO CInt + +#starttype struct apr_xml_doc +# field root , Ptr +# field namespaces, Ptr +#stoptype + +#opaque_t apr_xml_parser + +#ccall apr_xml_parser_create , Ptr -> IO (Ptr ) +#ccall apr_xml_parse_file , Ptr -> Ptr (Ptr ) -> Ptr (Ptr ) -> Ptr -> -> IO +#ccall apr_xml_parser_feed , Ptr -> Ptr CChar -> -> IO +#ccall apr_xml_parser_done , Ptr -> Ptr (Ptr ) -> IO +#ccall apr_xml_parser_geterror, Ptr -> Ptr CChar -> -> IO (Ptr CChar) + +#ccall apr_xml_to_text, Ptr -> Ptr -> CInt -> Ptr -> Ptr CInt -> Ptr (Ptr CChar) -> Ptr -> IO () + +#num APR_XML_X2T_FULL +#num APR_XML_X2T_INNER +#num APR_XML_X2T_LANG_INNER +#num APR_XML_X2T_FULL_NS_LANG + +#ccall apr_xml_empty_elem , Ptr -> Ptr -> IO (Ptr CChar) +#ccall apr_xml_quote_string, Ptr -> Ptr CChar -> CInt -> IO (Ptr CChar) +#ccall apr_xml_quote_elem , Ptr -> Ptr -> IO () +#ccall apr_xml_insert_uri , Ptr -> Ptr CChar -> IO CInt + +#cinline APR_XML_GET_URI_ITEM, Ptr -> CInt -> IO (Ptr CChar) + +#if APR_CHARSET_EBCDIC +# ccall apr_xml_parser_convert_doc, Ptr -> Ptr -> Ptr -> IO +#endif diff --git a/Bindings/APU/Version.hsc b/Bindings/APU/Version.hsc new file mode 100644 index 0000000..9da2d30 --- /dev/null +++ b/Bindings/APU/Version.hsc @@ -0,0 +1,17 @@ +#include +#include + +module Bindings.APU.Version where +#strict_import +import Bindings.APR.Version + +#num APU_MAJOR_VERSION +#num APU_MINOR_VERSION +#num APU_PATCH_VERSION + +#globalarray APU_VERSION_STRING, CChar + +#ifndef APU_VERSION_ONLY +# ccall apu_version , Ptr -> IO () +# ccall apu_version_string, IO (Ptr CChar) +#endif diff --git a/bindings-apr-util.cabal b/bindings-apr-util.cabal index a78f1ac..46f80f6 100644 --- a/bindings-apr-util.cabal +++ b/bindings-apr-util.cabal @@ -29,7 +29,6 @@ Library apr-util-1 >= 1.3 Exposed-Modules: - Bindings.APU Bindings.APR.AnyLock Bindings.APR.Base64 Bindings.APR.Buckets @@ -55,6 +54,9 @@ Library Bindings.APR.URI Bindings.APR.UUID Bindings.APR.XLate + Bindings.APR.XML + Bindings.APU + Bindings.APU.Version C-Sources: cbits/helper_apr_anylock.c @@ -66,6 +68,8 @@ Library cbits/helper_apr_sdbm.c cbits/helper_apr_sha1.c cbits/helper_apr_strmatch.c + cbits/helper_apr_xml.c + cbits/helper_apu_version.c Extensions: ForeignFunctionInterface diff --git a/cbits/helper_apr_xml.c b/cbits/helper_apr_xml.c new file mode 100644 index 0000000..f66384a --- /dev/null +++ b/cbits/helper_apr_xml.c @@ -0,0 +1,6 @@ +#include +#include + +BC_INLINE1(APR_XML_NS_IS_ERROR , int, int) +BC_INLINE1(APR_XML_ELEM_IS_EMPTY, apr_xml_elem*, int) +BC_INLINE2(APR_XML_GET_URI_ITEM , apr_array_header_t*, int, const char*) diff --git a/cbits/helper_apu_version.c b/cbits/helper_apu_version.c new file mode 100644 index 0000000..28aeb78 --- /dev/null +++ b/cbits/helper_apu_version.c @@ -0,0 +1,4 @@ +#include +#include + +BC_GLOBALARRAY(APU_VERSION_STRING, char) -- 2.40.0