mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-04 08:42:50 -06:00
haskell-bind: add bindings to graphviz rendering functions for abstract&parse trees
This commit is contained in:
@@ -23,6 +23,7 @@ module PGF2 (-- * CId
|
||||
Type(..), Hypo, functionType,
|
||||
-- * Trees
|
||||
Expr,Fun,readExpr,showExpr,mkApp,unApp,mkStr,
|
||||
graphvizAbstractTree,graphvizParseTree,
|
||||
-- * Morphology
|
||||
MorphoAnalysis, lookupMorpho, fullFormLexicon,
|
||||
-- * Exceptions
|
||||
@@ -272,6 +273,27 @@ showExpr e =
|
||||
peekCString s
|
||||
|
||||
|
||||
graphvizAbstractTree :: PGF -> Expr -> String
|
||||
graphvizAbstractTree p e =
|
||||
unsafePerformIO $
|
||||
withGuPool $ \tmpPl ->
|
||||
do (sb,out) <- newOut tmpPl
|
||||
exn <- gu_new_exn tmpPl
|
||||
pgf_graphviz_abstract_tree (pgf p) (expr e) out exn
|
||||
s <- gu_string_buf_freeze sb tmpPl
|
||||
peekCString s
|
||||
|
||||
|
||||
graphvizParseTree :: Concr -> Expr -> String
|
||||
graphvizParseTree c e =
|
||||
unsafePerformIO $
|
||||
withGuPool $ \tmpPl ->
|
||||
do (sb,out) <- newOut tmpPl
|
||||
exn <- gu_new_exn tmpPl
|
||||
pgf_graphviz_parse_tree (concr c) (expr e) out exn
|
||||
s <- gu_string_buf_freeze sb tmpPl
|
||||
peekCString s
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Functions using Concr
|
||||
-- Morpho analyses, parsing & linearization
|
||||
|
||||
Reference in New Issue
Block a user