diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2013-09-17 12:45:00 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2013-09-17 12:45:00 +0000 |
| commit | 2a49e4e1d64ef2df0bb2a8a3822f7fa1048e687f (patch) | |
| tree | a4584c3831aac1a692c8be37c0c6747480874c00 /src/runtime/c/pgf/data.h | |
| parent | f5461eb3d4eb2605b546a4ed202c12bcdaa1f4e4 (diff) | |
a major refactoring in the C runtime. GuList is now removed and replaced with GuSeq. The GuSeq/GuBuf API is simplified
Diffstat (limited to 'src/runtime/c/pgf/data.h')
| -rw-r--r-- | src/runtime/c/pgf/data.h | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/runtime/c/pgf/data.h b/src/runtime/c/pgf/data.h index ef5d1a780..7717f89f9 100644 --- a/src/runtime/c/pgf/data.h +++ b/src/runtime/c/pgf/data.h @@ -1,7 +1,6 @@ #ifndef PGF_DATA_H_ #define PGF_DATA_H_ -#include <gu/list.h> #include <gu/variant.h> #include <gu/map.h> #include <gu/string.h> @@ -12,7 +11,7 @@ typedef struct PgfCCat PgfCCat; extern GU_DECLARE_TYPE(PgfCCat, abstract); -typedef GuList(PgfCCat*) PgfCCats; +typedef GuSeq PgfCCats; #define PgfCIdMap GuStringMap typedef PgfCIdMap PgfFlags; // PgfCId -> PgfLiteral @@ -74,7 +73,7 @@ typedef struct { PgfCId name; PgfType* type; int arity; - PgfEquations defns; // maybe null + PgfEquations* defns; // maybe null PgfExprProb ep; void* predicate; } PgfAbsFun; @@ -86,7 +85,7 @@ extern GU_DECLARE_TYPE(PgfMetaChildMap, GuMap); typedef struct { PgfCId name; - PgfHypos context; + PgfHypos* context; prob_t meta_prob; prob_t meta_token_prob; @@ -130,15 +129,13 @@ typedef struct { extern GU_DECLARE_TYPE(PgfCncCat, abstract); bool -pgf_tokens_equal(PgfTokens t1, PgfTokens t2); - -typedef GuList(GuString) GuStringL; +pgf_tokens_equal(PgfTokens* t1, PgfTokens* t2); typedef struct { - PgfTokens form; + PgfTokens* form; /**< The form of this variant as a list of tokens. */ - GuStringL* prefixes; + GuStrings* prefixes; /**< The prefixes of the following symbol that trigger this * form. */ } PgfAlternative; @@ -189,14 +186,14 @@ typedef struct { typedef PgfSymbolIdx PgfSymbolCat, PgfSymbolLit, PgfSymbolVar; typedef struct { - PgfTokens tokens; + PgfTokens* tokens; } PgfSymbolKS; typedef struct PgfSymbolKP /** A prefix-dependent symbol. The form that this symbol takes * depends on the form of a prefix of the following symbol. */ { - PgfTokens default_form; + PgfTokens* default_form; /**< Default form that this symbol takes if none of of the * variant forms is triggered. */ @@ -210,17 +207,17 @@ typedef struct { } PgfSymbolNE; typedef GuSeq PgfSequence; // -> PgfSymbol -typedef GuList(PgfSequence) PgfSequences; +typedef GuSeq PgfSequences; typedef struct { PgfAbsFun* absfun; PgfExprProb *ep; int funid; GuLength n_lins; - PgfSequence lins[]; + PgfSequence* lins[]; } PgfCncFun; -typedef GuList(PgfCncFun*) PgfCncFuns; +typedef GuSeq PgfCncFuns; struct PgfConcr { PgfCId name; @@ -261,7 +258,7 @@ typedef GuSeq PgfPArgs; typedef struct { PgfCncFun* fun; - PgfPArgs args; + PgfPArgs* args; } PgfProductionApply; typedef struct PgfProductionCoerce @@ -275,26 +272,30 @@ typedef struct PgfProductionCoerce typedef struct { PgfLiteralCallback *callback; PgfExprProb *ep; - GuSeq lins; + GuSeq* lins; } PgfProductionExtern; typedef struct { PgfExprProb *ep; - PgfPArgs args; + PgfPArgs* args; } PgfProductionMeta; -typedef GuSeq PgfProductionSeq; -extern GU_DECLARE_TYPE(PgfProductionSeq, GuSeq); +typedef GuSeq PgfProductionSeq; +extern GU_DECLARE_TYPE(PgfProductionSeq, abstract); + +typedef GuBuf PgfProductionBuf; +extern GU_DECLARE_TYPE(PgfProductionBuf, abstract); struct PgfCCat { PgfCncCat* cnccat; PgfCncFuns* lindefs; size_t n_synprods; - PgfProductionSeq prods; + PgfProductionSeq* prods; float viterbi_prob; int fid; PgfItemConts* conts; struct PgfAnswers* answers; + GuFinalizer fin[0]; }; #endif |
