diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2014-12-16 10:21:26 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2014-12-16 10:21:26 +0000 |
| commit | 9bc5349e622cf00156b46f56a940d035e000115a (patch) | |
| tree | 8259f44c9857e66dc5901235eac94ad8f3f74cdc /src/runtime/haskell-bind/PGF2 | |
| parent | d98bd34a33cee7bd6a0fba3c7105256512c309ad (diff) | |
change in the API for literals
The API in the C runtime as well as in the Haskell, Python and Java binding
is changed. Now instead of adding the literal callbacks to the concrete syntax
you need to supply them every time when you need to parse. The main reason is:
- referentially transparent API for Haskell
- when we start using memory mapped files we will not be allowed to change
anything in the grammar data structures. At that point the old API would
be impossible to use.
Diffstat (limited to 'src/runtime/haskell-bind/PGF2')
| -rw-r--r-- | src/runtime/haskell-bind/PGF2/FFI.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/runtime/haskell-bind/PGF2/FFI.hs b/src/runtime/haskell-bind/PGF2/FFI.hs index 96c5b19fa..863431bca 100644 --- a/src/runtime/haskell-bind/PGF2/FFI.hs +++ b/src/runtime/haskell-bind/PGF2/FFI.hs @@ -91,7 +91,7 @@ data PgfFullFormEntry data PgfMorphoCallback data PgfPrintContext data PgfType -data PgfLiteralCallback +data PgfCallbacksMap foreign import ccall "pgf/pgf.h pgf_read" pgf_read :: CString -> Ptr GuPool -> Ptr GuExn -> IO (Ptr PgfPGF) @@ -138,8 +138,8 @@ foreign import ccall "pgf/pgf.h pgf_print_name" foreign import ccall "pgf/pgf.h pgf_linearize" pgf_linearize :: Ptr PgfConcr -> PgfExpr -> Ptr GuOut -> Ptr GuExn -> IO () -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_parse_with_heuristics" + pgf_parse_with_heuristics :: Ptr PgfConcr -> CString -> CString -> Double -> Ptr PgfCallbacksMap -> Ptr GuExn -> Ptr GuPool -> Ptr GuPool -> IO (Ptr GuEnum) type LiteralMatchCallback = Ptr () -> CInt -> CString -> Ptr CInt -> Ptr GuPool -> IO (Ptr PgfExprProb) @@ -151,11 +151,11 @@ type LiteralPredictCallback = Ptr () -> CInt -> CString -> Ptr GuPool -> IO (Ptr foreign import ccall "wrapper" wrapLiteralPredictCallback :: LiteralPredictCallback -> IO (FunPtr LiteralPredictCallback) -foreign import ccall - hspgf_new_literal_callback :: Ptr PgfConcr -> IO (Ptr PgfLiteralCallback) +foreign import ccall "pgf/pgf.h pgf_new_callbacks_map" + pgf_new_callbacks_map :: Ptr PgfConcr -> Ptr GuPool -> IO (Ptr PgfCallbacksMap) -foreign import ccall "pgf/pgf.h pgf_concr_add_literal" - pgf_concr_add_literal :: Ptr PgfConcr -> CString -> Ptr PgfLiteralCallback -> Ptr GuExn -> IO () +foreign import ccall + hspgf_callbacks_map_add_literal :: Ptr PgfConcr -> Ptr PgfCallbacksMap -> CString -> FunPtr LiteralMatchCallback -> FunPtr LiteralPredictCallback -> Ptr GuPool -> IO () foreign import ccall "pgf/pgf.h pgf_lookup_morpho" pgf_lookup_morpho :: Ptr PgfConcr -> CString -> Ptr PgfMorphoCallback -> Ptr GuExn -> IO () |
