diff options
| author | hallgren <hallgren@chalmers.se> | 2015-03-19 14:14:30 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2015-03-19 14:14:30 +0000 |
| commit | 99f87c30d053e89e0bdb02a42fe8006904e7e9e3 (patch) | |
| tree | 95778ac146e522176a3160f92294ca82782fd456 /src/runtime/haskell-bind/PGF2.hsc | |
| parent | e72fcb1513024e192eb112005da5e8586f517620 (diff) | |
haskell-bind: add bindings to graphviz rendering functions for abstract&parse trees
Diffstat (limited to 'src/runtime/haskell-bind/PGF2.hsc')
| -rw-r--r-- | src/runtime/haskell-bind/PGF2.hsc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc index 0f3b46886..97460de4d 100644 --- a/src/runtime/haskell-bind/PGF2.hsc +++ b/src/runtime/haskell-bind/PGF2.hsc @@ -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 |
