From 4f680b728b580a0eda89197801ab6adb54ab3258 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Thu, 7 Sep 2017 21:31:33 +0200 Subject: a light API in the Haskell binding for accessing the internal data structures --- src/runtime/haskell-bind/PGF2/FFI.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/runtime/haskell-bind/PGF2/FFI.hs') diff --git a/src/runtime/haskell-bind/PGF2/FFI.hs b/src/runtime/haskell-bind/PGF2/FFI.hs index 9a65c186f..8ca2d1c98 100644 --- a/src/runtime/haskell-bind/PGF2/FFI.hs +++ b/src/runtime/haskell-bind/PGF2/FFI.hs @@ -28,10 +28,12 @@ data GuKind data GuType data GuString data GuStringBuf +data GuMap data GuMapItor data GuOut data GuSeq data GuPool +type GuVariant = Ptr () foreign import ccall fopen :: CString -> CString -> IO (Ptr ()) @@ -96,6 +98,19 @@ foreign import ccall unsafe "gu/utf8.h gu_utf8_encode" foreign import ccall unsafe "gu/seq.h gu_make_seq" gu_make_seq :: CInt -> CInt -> Ptr GuPool -> IO (Ptr GuSeq) +foreign import ccall unsafe "gu/map.h gu_map_find_default" + gu_map_find_default :: Ptr GuMap -> Ptr a -> IO (Ptr b) + +foreign import ccall "gu/map.h gu_map_iter" + gu_map_iter :: Ptr GuMap -> Ptr GuMapItor -> Ptr GuExn -> IO () + +foreign import ccall unsafe "gu/variant.h gu_variant_tag" + gu_variant_tag :: GuVariant -> IO CInt + +foreign import ccall unsafe "gu/variant.h gu_variant_data" + gu_variant_data :: GuVariant -> IO (Ptr a) + + withGuPool :: (Ptr GuPool -> IO a) -> IO a withGuPool f = bracket gu_new_pool gu_pool_free f -- cgit v1.2.3