diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2014-09-10 14:35:54 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2014-09-10 14:35:54 +0000 |
| commit | b553729f37043b7b1e4d7528ea81d0c8e8e99286 (patch) | |
| tree | d044a92dd936cf9f6a9616e1269382a308ed6401 /src/runtime/haskell-bind/PGF2 | |
| parent | 566aeb93f51a9a4aba72c93baaca593589731ce3 (diff) | |
added loadConcr/unloadConcr to the Haskell binding. This exposes an API for loading grammars compiled with -split-pgf
Diffstat (limited to 'src/runtime/haskell-bind/PGF2')
| -rw-r--r-- | src/runtime/haskell-bind/PGF2/FFI.hs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/runtime/haskell-bind/PGF2/FFI.hs b/src/runtime/haskell-bind/PGF2/FFI.hs index 35ed15958..b686a8ee9 100644 --- a/src/runtime/haskell-bind/PGF2/FFI.hs +++ b/src/runtime/haskell-bind/PGF2/FFI.hs @@ -2,7 +2,7 @@ module PGF2.FFI where ---import Foreign.C +import Foreign.C import Foreign.C.String import Foreign.Ptr import Foreign.ForeignPtr @@ -22,9 +22,14 @@ data GuMapItor data GuOut data GuPool +foreign import ccall fopen :: CString -> CString -> IO (Ptr ()) + foreign import ccall "gu/mem.h gu_new_pool" gu_new_pool :: IO (Ptr GuPool) +foreign import ccall "gu/mem.h gu_malloc" + gu_malloc :: Ptr GuPool -> CInt -> IO (Ptr a) + foreign import ccall "gu/mem.h gu_pool_free" gu_pool_free :: Ptr GuPool -> IO () @@ -64,6 +69,9 @@ foreign import ccall "gu/string.h gu_string_buf" foreign import ccall "gu/string.h gu_string_buf_out" gu_string_buf_out :: Ptr GuStringBuf -> IO (Ptr GuOut) +foreign import ccall "gu/file.h gu_file_in" + gu_file_in :: Ptr () -> Ptr GuPool -> IO (Ptr GuIn) + foreign import ccall "gu/enum.h gu_enum_next" gu_enum_next :: Ptr a -> Ptr (Ptr b) -> Ptr GuPool -> IO () @@ -102,6 +110,12 @@ foreign import ccall "pgf/pgf.h pgf_get_language" foreign import ccall "pgf/pgf.h pgf_concrete_name" pgf_concrete_name :: Ptr PgfConcr -> IO CString +foreign import ccall "pgf/pgf.h pgf_concrete_load" + pgf_concrete_load :: Ptr PgfConcr -> Ptr GuIn -> Ptr GuExn -> IO () + +foreign import ccall "pgf/pgf.h pgf_concrete_unload" + pgf_concrete_unload :: Ptr PgfConcr -> IO () + foreign import ccall "pgf/pgf.h pgf_language_code" pgf_language_code :: Ptr PgfConcr -> IO CString @@ -155,10 +169,10 @@ foreign import ccall "pgf/pgf.h pgf_expr_unapply" pgf_expr_unapply :: PgfExpr -> Ptr GuPool -> IO (Ptr PgfApplication) foreign import ccall "pgf/expr.h pgf_expr_arity" - pgf_expr_arity :: PgfExpr -> IO Int + pgf_expr_arity :: PgfExpr -> IO CInt foreign import ccall "pgf/expr.h pgf_print_expr" - pgf_print_expr :: PgfExpr -> Ptr PgfPrintContext -> Int -> Ptr GuOut -> Ptr GuExn -> IO () + pgf_print_expr :: PgfExpr -> Ptr PgfPrintContext -> CInt -> Ptr GuOut -> Ptr GuExn -> IO () foreign import ccall "pgf/pgf.h pgf_generate_all" pgf_generate_all :: Ptr PgfPGF -> CString -> Ptr GuPool -> IO (Ptr GuEnum) |
