diff options
Diffstat (limited to 'src/runtime/c/pgf/expr.c')
| -rw-r--r-- | src/runtime/c/pgf/expr.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/runtime/c/pgf/expr.c b/src/runtime/c/pgf/expr.c index c1f803385..4e9f5ca89 100644 --- a/src/runtime/c/pgf/expr.c +++ b/src/runtime/c/pgf/expr.c @@ -1467,6 +1467,30 @@ pgf_print_expr_tuple(size_t n_exprs, PgfExpr exprs[], PgfPrintContext* ctxt, gu_putc('>', out, err); } +PGF_API_DECL void +pgf_print_category(PgfPGF *gr, PgfCId catname, + GuOut* out, GuExn *err) +{ + PgfAbsCat* abscat = + gu_seq_binsearch(gr->abstract.cats, pgf_abscat_order, PgfAbsCat, catname); + if (abscat == NULL) { + GuExnData* exn = gu_raise(err, PgfExn); + exn->data = "Unknown category"; + return; + } + + gu_puts(abscat->name, out, err); + + PgfPrintContext* ctxt = NULL; + size_t n_hypos = gu_seq_length(abscat->context); + for (size_t i = 0; i < n_hypos; i++) { + PgfHypo *hypo = gu_seq_index(abscat->context, PgfHypo, i); + + gu_putc(' ', out, err); + ctxt = pgf_print_hypo(hypo, ctxt, 4, out, err); + } +} + PGF_API bool pgf_type_eq(PgfType* t1, PgfType* t2) { |
