From e3aa392e63b0d0f314b286d207cd187be5837ad8 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 4 Oct 2017 09:45:56 +0200 Subject: further extend the API of the C runtime --- src/runtime/c/pgf/pgf.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/runtime/c/pgf/pgf.c') diff --git a/src/runtime/c/pgf/pgf.c b/src/runtime/c/pgf/pgf.c index 6d43eab3b..5317830fb 100644 --- a/src/runtime/c/pgf/pgf.c +++ b/src/runtime/c/pgf/pgf.c @@ -152,6 +152,17 @@ pgf_category_context(PgfPGF *gr, PgfCId catname) return abscat->context; } +PGF_API prob_t +pgf_category_prob(PgfPGF* pgf, PgfCId catname) +{ + PgfAbsCat* abscat = + gu_seq_binsearch(pgf->abstract.cats, pgf_abscat_order, PgfAbsCat, catname); + if (abscat == NULL) + return INFINITY; + + return abscat->prob; +} + PGF_API GuString pgf_language_code(PgfConcr* concr) { @@ -221,7 +232,7 @@ pgf_function_is_constructor(PgfPGF* pgf, PgfCId funname) return (absfun->defns == NULL); } -PGF_API double +PGF_API prob_t pgf_function_prob(PgfPGF* pgf, PgfCId funname) { PgfAbsFun* absfun = -- cgit v1.2.3