summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2015-01-30 13:05:57 +0000
committerkr.angelov <kr.angelov@gmail.com>2015-01-30 13:05:57 +0000
commit68a2f095904281308a51f0c1dcaf9df301dc62eb (patch)
tree7d6bb0f45cd238398b46224c4886e0ffc87de29b /src
parent340328b8a18d7533444f3d4957c5c3644ca1975e (diff)
added hasLinearization in the Haskell binding
Diffstat (limited to 'src')
-rw-r--r--src/runtime/haskell-bind/PGF2.hsc7
-rw-r--r--src/runtime/haskell-bind/PGF2/FFI.hs3
2 files changed, 9 insertions, 1 deletions
diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc
index 20ffc11c4..64f849e56 100644
--- a/src/runtime/haskell-bind/PGF2.hsc
+++ b/src/runtime/haskell-bind/PGF2.hsc
@@ -17,7 +17,8 @@ module PGF2 (-- * CId
-- * PGF
PGF,readPGF,AbsName,abstractName,startCat,
-- * Concrete syntax
- ConcName,Concr,languages,parse,parseWithHeuristics,linearize,alignWords,
+ ConcName,Concr,languages,parse,parseWithHeuristics,
+ hasLinearization,linearize,alignWords,
-- * Types
Type(..), Hypo, functionType,
-- * Trees
@@ -409,6 +410,10 @@ mkCallbacksMap concr callbacks pool = do
predict_callback _ _ _ _ = return nullPtr
+hasLinearization :: Concr -> Fun -> Bool
+hasLinearization lang id = unsafePerformIO $
+ withCString id (pgf_has_linearization (concr lang))
+
linearize :: Concr -> Expr -> String
linearize lang e = unsafePerformIO $
withGuPool $ \pl ->
diff --git a/src/runtime/haskell-bind/PGF2/FFI.hs b/src/runtime/haskell-bind/PGF2/FFI.hs
index f36fa1368..9de76fb51 100644
--- a/src/runtime/haskell-bind/PGF2/FFI.hs
+++ b/src/runtime/haskell-bind/PGF2/FFI.hs
@@ -133,6 +133,9 @@ foreign import ccall "pgf/pgf.h pgf_function_type"
foreign import ccall "pgf/pgf.h pgf_print_name"
pgf_print_name :: Ptr PgfConcr -> CString -> IO CString
+foreign import ccall "pgf/pgf.h pgf_has_linearization"
+ pgf_has_linearization :: Ptr PgfConcr -> CString -> IO Bool
+
foreign import ccall "pgf/pgf.h pgf_linearize"
pgf_linearize :: Ptr PgfConcr -> PgfExpr -> Ptr GuOut -> Ptr GuExn -> IO ()