diff options
| author | krangelov <kr.angelov@gmail.com> | 2020-03-06 12:29:08 +0100 |
|---|---|---|
| committer | krangelov <kr.angelov@gmail.com> | 2020-03-06 12:29:08 +0100 |
| commit | 00e25d0ccb114b5c4cce4e79e7e0ef164bf57f99 (patch) | |
| tree | b58be77ce57f5d4db6d01da4ea0b400759b72473 /src/runtime/c | |
| parent | 9806232532b661f25e393f12ed8069085d522868 (diff) | |
an API to access the names of all fields withing a category
Diffstat (limited to 'src/runtime/c')
| -rw-r--r-- | src/runtime/c/pgf/pgf.c | 14 | ||||
| -rw-r--r-- | src/runtime/c/pgf/pgf.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/runtime/c/pgf/pgf.c b/src/runtime/c/pgf/pgf.c index 5317830fb..d7873f584 100644 --- a/src/runtime/c/pgf/pgf.c +++ b/src/runtime/c/pgf/pgf.c @@ -163,6 +163,20 @@ pgf_category_prob(PgfPGF* pgf, PgfCId catname) return abscat->prob; } +PGF_API GuString* +pgf_category_fields(PgfConcr* concr, PgfCId catname, size_t *n_lins) +{ + PgfCncCat* cnccat = + gu_map_get(concr->cnccats, catname, PgfCncCat*); + if (!cnccat) { + *n_lins = 0; + return NULL; + } + + *n_lins = cnccat->n_lins; + return &cnccat->labels; +} + PGF_API GuString pgf_language_code(PgfConcr* concr) { diff --git a/src/runtime/c/pgf/pgf.h b/src/runtime/c/pgf/pgf.h index c0a64f01d..5dbe2e2e1 100644 --- a/src/runtime/c/pgf/pgf.h +++ b/src/runtime/c/pgf/pgf.h @@ -95,6 +95,9 @@ pgf_category_context(PgfPGF *gr, PgfCId catname); PGF_API_DECL prob_t pgf_category_prob(PgfPGF* pgf, PgfCId catname); +PGF_API GuString* +pgf_category_fields(PgfConcr* concr, PgfCId catname, size_t *n_lins); + PGF_API_DECL void pgf_iter_functions(PgfPGF* pgf, GuMapItor* itor, GuExn* err); |
