1
0
forked from GitHub/gf-core

added an API for custom literals in the Haskell binding

This commit is contained in:
kr.angelov
2014-09-10 14:56:18 +00:00
parent fb18482aeb
commit d84d3b5763
2 changed files with 78 additions and 1 deletions

View File

@@ -78,6 +78,9 @@ foreign import ccall "gu/enum.h gu_enum_next"
foreign import ccall "gu/string.h gu_string_buf_freeze"
gu_string_buf_freeze :: Ptr GuStringBuf -> Ptr GuPool -> IO CString
foreign import ccall "gu/utf8.h gu_utf8_decode"
gu_utf8_decode :: Ptr (Ptr CChar) -> IO ()
withGuPool :: (Ptr GuPool -> IO a) -> IO a
withGuPool f = bracket gu_new_pool gu_pool_free f
@@ -143,6 +146,22 @@ foreign import ccall "pgf/pgf.h pgf_linearize"
foreign import ccall "pgf/pgf.h pgf_parse"
pgf_parse :: Ptr PgfConcr -> CString -> CString -> Ptr GuExn -> Ptr GuPool -> Ptr GuPool -> IO (Ptr GuEnum)
foreign import ccall "pgf/pgf.h pgf_concr_get_pool"
pgf_concr_get_pool :: Ptr PgfConcr -> IO (Ptr GuPool)
type LiteralMatchCallback = Ptr () -> CInt -> CString -> Ptr CInt -> Ptr GuPool -> IO (Ptr PgfExprProb)
foreign import ccall "wrapper"
wrapLiteralMatchCallback :: LiteralMatchCallback -> IO (FunPtr LiteralMatchCallback)
type LiteralPredictCallback = Ptr () -> CInt -> CString -> Ptr GuPool -> IO (Ptr PgfExprProb)
foreign import ccall "wrapper"
wrapLiteralPredictCallback :: LiteralPredictCallback -> IO (FunPtr LiteralPredictCallback)
foreign import ccall "pgf/pgf.h pgf_concr_add_literal"
pgf_concr_add_literal :: Ptr PgfConcr -> CString -> Ptr () -> Ptr GuExn -> IO ()
foreign import ccall "pgf/pgf.h pgf_lookup_morpho"
pgf_lookup_morpho :: Ptr PgfConcr -> CString -> Ptr PgfMorphoCallback -> Ptr GuExn -> IO ()