diff options
| author | Krasimir Angelov <kr.angelov@gmail.com> | 2017-08-31 13:03:11 +0200 |
|---|---|---|
| committer | Krasimir Angelov <kr.angelov@gmail.com> | 2017-08-31 13:03:11 +0200 |
| commit | b9c04fd6126eef43f5bc78aa973938c428d65bca (patch) | |
| tree | eff3b8ad7fadd72b9d8737b66d7c2940553f292d /src/runtime/haskell-bind | |
| parent | eaf9f0c3ac2ce1c34a0e08de9073d8fca66a3680 (diff) | |
graphvizWordAlignment in the C runtime
Diffstat (limited to 'src/runtime/haskell-bind')
| -rw-r--r-- | src/runtime/haskell-bind/PGF2.hsc | 15 | ||||
| -rw-r--r-- | src/runtime/haskell-bind/PGF2/FFI.hs | 3 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc index 45320c6cb..4523279dd 100644 --- a/src/runtime/haskell-bind/PGF2.hsc +++ b/src/runtime/haskell-bind/PGF2.hsc @@ -67,7 +67,7 @@ module PGF2 (-- * PGF MorphoAnalysis, lookupMorpho, fullFormLexicon, -- ** Visualizations GraphvizOptions(..), graphvizDefaults, - graphvizAbstractTree, graphvizParseTree, + graphvizAbstractTree, graphvizParseTree, graphvizWordAlignment, -- * Exceptions PGFError(..), @@ -357,6 +357,19 @@ graphvizParseTree c opts e = s <- gu_string_buf_freeze sb tmpPl peekUtf8CString s +graphvizWordAlignment :: [Concr] -> GraphvizOptions -> Expr -> String +graphvizWordAlignment cs opts e = + unsafePerformIO $ + withGuPool $ \tmpPl -> + withArrayLen (map concr cs) $ \n_concrs ptr -> + do (sb,out) <- newOut tmpPl + exn <- gu_new_exn tmpPl + c_opts <- newGraphvizOptions tmpPl opts + pgf_graphviz_word_alignment ptr (fromIntegral n_concrs) (expr e) c_opts out exn + touchExpr e + s <- gu_string_buf_freeze sb tmpPl + peekUtf8CString s + newGraphvizOptions :: Ptr GuPool -> GraphvizOptions -> IO (Ptr PgfGraphvizOptions) newGraphvizOptions pool opts = do c_opts <- gu_malloc pool (#size PgfGraphvizOptions) diff --git a/src/runtime/haskell-bind/PGF2/FFI.hs b/src/runtime/haskell-bind/PGF2/FFI.hs index e28e555c2..1a5e7f91b 100644 --- a/src/runtime/haskell-bind/PGF2/FFI.hs +++ b/src/runtime/haskell-bind/PGF2/FFI.hs @@ -369,3 +369,6 @@ foreign import ccall "pgf/graphviz.h pgf_graphviz_abstract_tree" foreign import ccall "pgf/graphviz.h pgf_graphviz_parse_tree" pgf_graphviz_parse_tree :: Ptr PgfConcr -> PgfExpr -> Ptr PgfGraphvizOptions -> Ptr GuOut -> Ptr GuExn -> IO () + +foreign import ccall "pgf/graphviz.h pgf_graphviz_word_alignment" + pgf_graphviz_word_alignment :: Ptr (Ptr PgfConcr) -> CInt -> PgfExpr -> Ptr PgfGraphvizOptions -> Ptr GuOut -> Ptr GuExn -> IO () |
