mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-04 08:42:50 -06:00
graphvizWordAlignment in the C runtime
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user