diff options
| author | Krasimir Angelov <kr.angelov@gmail.com> | 2017-10-03 16:05:01 +0200 |
|---|---|---|
| committer | Krasimir Angelov <kr.angelov@gmail.com> | 2017-10-03 16:05:01 +0200 |
| commit | e426e87cf8a0eb722e4ffc2239d864d53f5e476f (patch) | |
| tree | 1e67528393de918b1adcbea8a19fae695f78b710 /src/runtime/c/pgf/pgf.c | |
| parent | 8eef0b537674dc8069b27d7776bd36dd9924da6e (diff) | |
in the PGF2 api: remove showCategory. add categoryContext and functionIsConstructor
Diffstat (limited to 'src/runtime/c/pgf/pgf.c')
| -rw-r--r-- | src/runtime/c/pgf/pgf.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/runtime/c/pgf/pgf.c b/src/runtime/c/pgf/pgf.c index 7e519cbbf..6d43eab3b 100644 --- a/src/runtime/c/pgf/pgf.c +++ b/src/runtime/c/pgf/pgf.c @@ -140,6 +140,18 @@ pgf_start_cat(PgfPGF* pgf, GuPool* pool) return type; } +PGF_API PgfHypos* +pgf_category_context(PgfPGF *gr, PgfCId catname) +{ + PgfAbsCat* abscat = + gu_seq_binsearch(gr->abstract.cats, pgf_abscat_order, PgfAbsCat, catname); + if (abscat == NULL) { + return NULL; + } + + return abscat->context; +} + PGF_API GuString pgf_language_code(PgfConcr* concr) { @@ -173,7 +185,7 @@ pgf_iter_functions(PgfPGF* pgf, GuMapItor* itor, GuExn* err) } PGF_API void -pgf_iter_functions_by_cat(PgfPGF* pgf, PgfCId catname, +pgf_iter_functions_by_cat(PgfPGF* pgf, PgfCId catname, GuMapItor* itor, GuExn* err) { size_t n_funs = gu_seq_length(pgf->abstract.funs); @@ -199,6 +211,16 @@ pgf_function_type(PgfPGF* pgf, PgfCId funname) return absfun->type; } +PGF_API_DECL bool +pgf_function_is_constructor(PgfPGF* pgf, PgfCId funname) +{ + PgfAbsFun* absfun = + gu_seq_binsearch(pgf->abstract.funs, pgf_absfun_order, PgfAbsFun, funname); + if (absfun == NULL) + return false; + return (absfun->defns == NULL); +} + PGF_API double pgf_function_prob(PgfPGF* pgf, PgfCId funname) { |
