restored graphvizAbstractTree

This commit is contained in:
krangelov
2021-12-04 16:05:24 +01:00
parent 3d1123eed4
commit a3d680f317
6 changed files with 54 additions and 11 deletions

View File

@@ -2067,6 +2067,24 @@ void pgf_set_concrete_flag(PgfDB *db, PgfConcrRevision revision,
} PGF_API_END
}
PGF_API PgfText *
pgf_graphviz_abstract_tree(PgfDB *db, PgfRevision revision,
PgfExpr expr, PgfMarshaller *m,
PgfGraphvizOptions* opts,
PgfExn *err)
{
PGF_API_BEGIN {
DB_scope scope(db, READER_SCOPE);
ref<PgfPGF> pgf = PgfDB::revision2pgf(revision);
PgfAbstractGraphvizOutput out(&pgf->abstract, opts, m);
return out.generate_graphviz(expr);
} PGF_API_END
return NULL;
}
PGF_API PgfText *
pgf_graphviz_parse_tree(PgfDB *db, PgfConcrRevision revision,
PgfExpr expr, PgfMarshaller *m,

View File

@@ -447,6 +447,20 @@ void PgfPrinter::parg(ref<PgfDTyp> ty, ref<PgfPArg> parg)
puts(")");
}
void PgfPrinter::bindings(size_t n_vars)
{
bool first = true;
PgfPrintContext *context = ctxt;
while (context != NULL && n_vars > 0) {
if (!first) {
puts(",");
first = false;
}
efun(&context->name);
context = context->next;
}
}
void PgfPrinter::lvar(size_t var)
{
char vars[] = "ijklmnopqr";

View File

@@ -18,14 +18,6 @@ class PGF_INTERNAL_DECL PgfPrinter : public PgfUnmarshaller {
// of lambda expressions is finished.
void flush_lambdas();
// Push a new variable in the printing context. If the name
// collides with an existing variable, the variable is renamed
// by adding a number.
void push_variable(PgfText *name);
// Pop the last variable name from the context.
void pop_variable();
// The current operator priority
int prio;
@@ -39,6 +31,14 @@ public:
PgfPrinter(PgfPrintContext *context, int priority,
PgfMarshaller *marshaller);
// Push a new variable in the printing context. If the name
// collides with an existing variable, the variable is renamed
// by adding a number.
void push_variable(PgfText *name);
// Pop the last variable name from the context.
void pop_variable();
void puts(PgfText *s);
void puts(const char *s);
@@ -72,6 +72,8 @@ public:
PgfText *cat,
size_t n_exprs, PgfExpr *exprs);
virtual void free_ref(object x);
void bindings(size_t n_vars);
};
#endif