linearization for HOAS expressions

This commit is contained in:
krangelov
2021-12-09 08:45:53 +01:00
parent d1b1cd6e8c
commit 0069946f42
10 changed files with 80 additions and 32 deletions

View File

@@ -615,7 +615,7 @@ linearize c e =
withForeignPtr (c_revision c) $ \c_revision ->
bracket (newStablePtr e) freeStablePtr $ \c_e ->
withForeignPtr marshaller $ \m ->
bracket (withPgfExn "linearize" (pgf_linearize (c_db c) c_revision c_e m)) free $ \c_text ->
bracket (withPgfExn "linearize" (pgf_linearize (c_db c) c_revision c_e nullPtr m)) free $ \c_text ->
if c_text == nullPtr
then return ""
else peekText c_text
@@ -694,7 +694,7 @@ bracketedLinearize c e = unsafePerformIO $ do
(#poke PgfLinearizationOutputIfaceVtbl, symbol_ne) vtbl c_symbol_ne
(#poke PgfLinearizationOutputIfaceVtbl, symbol_meta) vtbl c_symbol_meta
(#poke PgfLinearizationOutputIface, vtbl) c_out vtbl
withPgfExn "bracketedLinearize" (pgf_bracketed_linearize (c_db c) c_revision c_e m c_out))
withPgfExn "bracketedLinearize" (pgf_bracketed_linearize (c_db c) c_revision c_e nullPtr m c_out))
(ne,_,bs) <- readIORef ref
(if ne
then return []
@@ -922,7 +922,7 @@ graphvizParseTree c opts e =
bracket (newStablePtr e) freeStablePtr $ \c_e ->
withForeignPtr marshaller $ \m ->
withGraphvizOptions opts $ \c_opts ->
bracket (withPgfExn "graphvizParseTree" (pgf_graphviz_parse_tree (c_db c) c_revision c_e m c_opts)) free $ \c_text ->
bracket (withPgfExn "graphvizParseTree" (pgf_graphviz_parse_tree (c_db c) c_revision c_e nullPtr m c_opts)) free $ \c_text ->
peekText c_text
graphvizWordAlignment :: [Concr] -> GraphvizOptions -> Expr -> String

View File

@@ -207,9 +207,9 @@ foreign import ccall pgf_drop_lin :: Ptr PgfDB -> Ptr Concr -> Ptr PgfText -> Pt
foreign import ccall pgf_has_linearization :: Ptr PgfDB -> Ptr Concr -> Ptr PgfText -> Ptr PgfExn -> IO CInt
foreign import ccall pgf_linearize :: Ptr PgfDB -> Ptr Concr -> StablePtr Expr -> Ptr PgfMarshaller -> Ptr PgfExn -> IO (Ptr PgfText)
foreign import ccall pgf_linearize :: Ptr PgfDB -> Ptr Concr -> StablePtr Expr -> Ptr PgfPrintContext -> Ptr PgfMarshaller -> Ptr PgfExn -> IO (Ptr PgfText)
foreign import ccall pgf_bracketed_linearize :: Ptr PgfDB -> Ptr Concr -> StablePtr Expr -> Ptr PgfMarshaller -> Ptr PgfLinearizationOutputIface -> Ptr PgfExn -> IO ()
foreign import ccall pgf_bracketed_linearize :: Ptr PgfDB -> Ptr Concr -> StablePtr Expr -> Ptr PgfPrintContext -> Ptr PgfMarshaller -> Ptr PgfLinearizationOutputIface -> Ptr PgfExn -> IO ()
foreign import ccall "wrapper" wrapSymbol0 :: Wrapper (Ptr PgfLinearizationOutputIface -> IO ())
@@ -237,7 +237,7 @@ foreign import ccall pgf_set_concrete_flag :: Ptr PgfDB -> Ptr Concr -> Ptr PgfT
foreign import ccall pgf_graphviz_abstract_tree :: Ptr PgfDB -> Ptr PGF -> StablePtr Expr -> Ptr PgfMarshaller -> Ptr PgfGraphvizOptions -> Ptr PgfExn -> IO (Ptr PgfText)
foreign import ccall pgf_graphviz_parse_tree :: Ptr PgfDB -> Ptr Concr -> StablePtr Expr -> Ptr PgfMarshaller -> Ptr PgfGraphvizOptions -> Ptr PgfExn -> IO (Ptr PgfText)
foreign import ccall pgf_graphviz_parse_tree :: Ptr PgfDB -> Ptr Concr -> StablePtr Expr -> Ptr PgfPrintContext -> Ptr PgfMarshaller -> Ptr PgfGraphvizOptions -> Ptr PgfExn -> IO (Ptr PgfText)
-----------------------------------------------------------------------