diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2014-09-10 14:56:18 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2014-09-10 14:56:18 +0000 |
| commit | 80725e872be76ce713fe34c72f6df42e2dd644ed (patch) | |
| tree | e5329b696029bb7e980b11cad89f65750a83621b /src/runtime/haskell-bind/PGF2 | |
| parent | b553729f37043b7b1e4d7528ea81d0c8e8e99286 (diff) | |
added an API for custom literals in the Haskell binding
Diffstat (limited to 'src/runtime/haskell-bind/PGF2')
| -rw-r--r-- | src/runtime/haskell-bind/PGF2/FFI.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/runtime/haskell-bind/PGF2/FFI.hs b/src/runtime/haskell-bind/PGF2/FFI.hs index b686a8ee9..9b0f9961e 100644 --- a/src/runtime/haskell-bind/PGF2/FFI.hs +++ b/src/runtime/haskell-bind/PGF2/FFI.hs @@ -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 () |
