mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-13 13:12:51 -06:00
added exprSize in the Haskell binding
This commit is contained in:
@@ -39,7 +39,7 @@ module PGF2 (-- * PGF
|
||||
mkFloat,unFloat,
|
||||
mkMeta,unMeta,
|
||||
mkCId,
|
||||
exprHash,
|
||||
exprHash, exprSize,
|
||||
treeProbability,
|
||||
|
||||
-- ** Types
|
||||
@@ -331,7 +331,13 @@ exprHash h (Expr c_expr touch1) =
|
||||
touch1
|
||||
return (fromIntegral h)
|
||||
|
||||
|
||||
exprSize :: Expr -> Int32
|
||||
exprSize (Expr c_expr touch1) =
|
||||
unsafePerformIO $ do
|
||||
size <- pgf_expr_size c_expr
|
||||
touch1
|
||||
return (fromIntegral size)
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Graphviz
|
||||
|
||||
@@ -331,6 +331,9 @@ foreign import ccall "pgf/expr.h pgf_expr_eq"
|
||||
foreign import ccall "pgf/expr.h pgf_expr_hash"
|
||||
pgf_expr_hash :: Word -> PgfExpr -> IO Word
|
||||
|
||||
foreign import ccall "pgf/expr.h pgf_expr_size"
|
||||
pgf_expr_size :: PgfExpr -> IO CInt
|
||||
|
||||
foreign import ccall "pgf/expr.h pgf_compute_tree_probability"
|
||||
pgf_compute_tree_probability :: Ptr PgfPGF -> PgfExpr -> IO CFloat
|
||||
|
||||
|
||||
Reference in New Issue
Block a user