From aa13090b66d7ee1ffc68ad242c6419a83cf364d9 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Wed, 12 Dec 2012 11:25:58 +0000 Subject: started an official API to the C runtime --- src/runtime/c/pgf/pgf.h | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'src/runtime/c/pgf/pgf.h') diff --git a/src/runtime/c/pgf/pgf.h b/src/runtime/c/pgf/pgf.h index 3913d9fd2..40b290617 100644 --- a/src/runtime/c/pgf/pgf.h +++ b/src/runtime/c/pgf/pgf.h @@ -1,5 +1,5 @@ /* - * Copyright 2010 University of Helsinki. + * Copyright 2010 University of Gothenburg. * * This file is part of libpgf. * @@ -27,7 +27,7 @@ #include #include -#include +#include #include @@ -35,20 +35,25 @@ typedef GuString PgfCId; extern GU_DECLARE_TYPE(PgfCId, typedef); +extern GU_DECLARE_TYPE(PgfExn, abstract); + + /// A single lexical token -typedef GuString PgfToken; +typedef GuString PgfToken; /// @name PGF Grammar objects /// @{ typedef struct PgfPGF PgfPGF; +typedef struct PgfConcr PgfConcr; /**< A representation of a PGF grammar. */ PgfPGF* -pgf_read(GuIn* in, GuPool* pool, GuExn* err); +pgf_read(const char* fpath, + GuPool* pool, GuExn* err); /**< Read a grammar from a PGF file. * @@ -69,10 +74,34 @@ pgf_read(GuIn* in, GuPool* pool, GuExn* err); */ -bool -pgf_load_meta_child_probs(PgfPGF*, const char* fpath, GuPool* pool); +void +pgf_load_meta_child_probs(PgfPGF*, const char* fpath, + GuPool* pool, GuExn* err); + +GuString +pgf_abstract_name(PgfPGF*); -typedef struct PgfConcr PgfConcr; +void +pgf_iter_languages(PgfPGF*, GuMapItor*, GuExn* err); + +PgfConcr* +pgf_get_language(PgfPGF*, PgfCId lang); + +void +pgf_iter_categories(PgfPGF* pgf, GuMapItor* fn, GuExn* err); + +PgfCId +pgf_start_cat(PgfPGF* pgf, GuPool* pool); + +void +pgf_iter_functions(PgfPGF* pgf, GuMapItor* fn, GuExn* err); + +void +pgf_iter_functions_by_cat(PgfPGF* pgf, PgfCId catname, + GuMapItor* fn, GuExn* err); + +GuString +pgf_print_name(PgfConcr*, PgfCId id); #include extern GU_DECLARE_TYPE(PgfPGF, struct); -- cgit v1.2.3