mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-02 07:42:50 -06:00
added exprFunctions in the Haskell binding
This commit is contained in:
@@ -39,7 +39,7 @@ module PGF2 (-- * PGF
|
||||
mkFloat,unFloat,
|
||||
mkMeta,unMeta,
|
||||
mkCId,
|
||||
exprHash, exprSize,
|
||||
exprHash, exprSize, exprFunctions,
|
||||
treeProbability,
|
||||
|
||||
-- ** Types
|
||||
@@ -338,6 +338,16 @@ exprSize (Expr c_expr touch1) =
|
||||
touch1
|
||||
return (fromIntegral size)
|
||||
|
||||
exprFunctions :: Expr -> [Fun]
|
||||
exprFunctions (Expr c_expr touch) =
|
||||
unsafePerformIO $
|
||||
withGuPool $ \tmpPl -> do
|
||||
seq <- pgf_expr_functions c_expr tmpPl
|
||||
len <- (#peek GuSeq, len) seq
|
||||
arr <- peekArray (fromIntegral (len :: CInt)) (seq `plusPtr` (#offset GuSeq, data))
|
||||
funs <- mapM peekUtf8CString arr
|
||||
touch
|
||||
return funs
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Graphviz
|
||||
|
||||
Reference in New Issue
Block a user