forked from GitHub/gf-core
explicitly classify all functions in libpgf as either internal or API functions
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include <gu/assert.h>
|
||||
#include <math.h>
|
||||
|
||||
bool
|
||||
PGF_INTERNAL bool
|
||||
pgf_tokens_equal(PgfTokens* t1, PgfTokens* t2)
|
||||
{
|
||||
size_t len1 = gu_seq_length(t1);
|
||||
@@ -28,7 +28,7 @@ pgf_flag_cmp_fn(GuOrder* self, const void* p1, const void* p2)
|
||||
return strcmp((GuString) p1, ((PgfFlag*) p2)->name);
|
||||
}
|
||||
|
||||
GuOrder pgf_flag_order[1] = { { pgf_flag_cmp_fn } };
|
||||
PGF_INTERNAL GuOrder pgf_flag_order[1] = { { pgf_flag_cmp_fn } };
|
||||
|
||||
static int
|
||||
pgf_abscat_cmp_fn(GuOrder* self, const void* p1, const void* p2)
|
||||
@@ -37,7 +37,7 @@ pgf_abscat_cmp_fn(GuOrder* self, const void* p1, const void* p2)
|
||||
return strcmp((GuString) p1, ((PgfAbsCat*) p2)->name);
|
||||
}
|
||||
|
||||
GuOrder pgf_abscat_order[1] = { { pgf_abscat_cmp_fn } };
|
||||
PGF_INTERNAL GuOrder pgf_abscat_order[1] = { { pgf_abscat_cmp_fn } };
|
||||
|
||||
static int
|
||||
pgf_absfun_cmp_fn(GuOrder* self, const void* p1, const void* p2)
|
||||
@@ -46,7 +46,7 @@ pgf_absfun_cmp_fn(GuOrder* self, const void* p1, const void* p2)
|
||||
return strcmp((GuString) p1, ((PgfAbsFun*) p2)->name);
|
||||
}
|
||||
|
||||
GuOrder pgf_absfun_order[1] = { { pgf_absfun_cmp_fn } };
|
||||
PGF_INTERNAL GuOrder pgf_absfun_order[1] = { { pgf_absfun_cmp_fn } };
|
||||
|
||||
static int
|
||||
pgf_concr_cmp_fn(GuOrder* self, const void* p1, const void* p2)
|
||||
@@ -55,4 +55,4 @@ pgf_concr_cmp_fn(GuOrder* self, const void* p1, const void* p2)
|
||||
return strcmp((GuString) p1, ((PgfConcr*) p2)->name);
|
||||
}
|
||||
|
||||
GuOrder pgf_concr_order[1] = { { pgf_concr_cmp_fn } };
|
||||
PGF_INTERNAL GuOrder pgf_concr_order[1] = { { pgf_concr_cmp_fn } };
|
||||
|
||||
@@ -20,7 +20,7 @@ typedef struct {
|
||||
|
||||
typedef GuSeq PgfFlags;
|
||||
|
||||
extern GuOrder pgf_flag_order[1];
|
||||
PGF_INTERNAL_DECL extern GuOrder pgf_flag_order[1];
|
||||
|
||||
// PgfPatt
|
||||
|
||||
@@ -94,7 +94,7 @@ typedef struct {
|
||||
|
||||
typedef GuSeq PgfAbsFuns;
|
||||
|
||||
extern GuOrder pgf_absfun_order[1];
|
||||
PGF_INTERNAL_DECL extern GuOrder pgf_absfun_order[1];
|
||||
|
||||
typedef GuMap PgfMetaChildMap;
|
||||
|
||||
@@ -109,7 +109,7 @@ typedef struct {
|
||||
|
||||
typedef GuSeq PgfAbsCats;
|
||||
|
||||
extern GuOrder pgf_abscat_order[1];
|
||||
PGF_INTERNAL_DECL extern GuOrder pgf_abscat_order[1];
|
||||
|
||||
|
||||
typedef struct PgfEvalGates PgfEvalGates;
|
||||
@@ -148,7 +148,7 @@ typedef enum {
|
||||
|
||||
typedef GuSeq PgfConcrs;
|
||||
|
||||
extern GuOrder pgf_concr_order[1];
|
||||
PGF_INTERNAL_DECL extern GuOrder pgf_concr_order[1];
|
||||
|
||||
struct PgfPGF {
|
||||
uint16_t major_version;
|
||||
@@ -175,7 +175,7 @@ typedef struct {
|
||||
|
||||
typedef GuSeq PgfTokens;
|
||||
|
||||
bool
|
||||
PGF_INTERNAL_DECL bool
|
||||
pgf_tokens_equal(PgfTokens* t1, PgfTokens* t2);
|
||||
|
||||
typedef GuSeq PgfSymbols;
|
||||
|
||||
@@ -22,7 +22,7 @@ pgf_mk_pap(PgfReasoner* rs, PgfClosure* fun,
|
||||
return fun;
|
||||
}
|
||||
|
||||
PgfClosure*
|
||||
PGF_INTERNAL PgfClosure*
|
||||
pgf_evaluate_expr_thunk(PgfReasoner* rs, PgfExprThunk* thunk)
|
||||
{
|
||||
PgfEnv* env = thunk->env;
|
||||
@@ -190,7 +190,7 @@ repeat:;
|
||||
return res;
|
||||
}
|
||||
|
||||
PgfClosure*
|
||||
PGF_INTERNAL PgfClosure*
|
||||
pgf_evaluate_lambda_application(PgfReasoner* rs, PgfExprThunk* lambda,
|
||||
PgfClosure* arg)
|
||||
{
|
||||
@@ -382,7 +382,7 @@ pgf_value2expr(PgfReasoner* rs, int level, PgfClosure* clos)
|
||||
return expr;
|
||||
}
|
||||
|
||||
PgfExpr
|
||||
PGF_API PgfExpr
|
||||
pgf_compute(PgfPGF* pgf, PgfExpr expr, GuExn* err, GuPool* pool, GuPool* out_pool)
|
||||
{
|
||||
PgfReasoner* rs =
|
||||
@@ -397,7 +397,7 @@ pgf_compute(PgfPGF* pgf, PgfExpr expr, GuExn* err, GuPool* pool, GuPool* out_poo
|
||||
return pgf_value2expr(rs, 0, &thunk->header);
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_evaluate_accum_init_int(PgfReasoner* rs,
|
||||
PgfEvalAccum* accum, int val)
|
||||
{
|
||||
@@ -410,7 +410,7 @@ pgf_evaluate_accum_init_int(PgfReasoner* rs,
|
||||
accum->consts = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_evaluate_accum_init_str(PgfReasoner* rs,
|
||||
PgfEvalAccum* accum, GuString val)
|
||||
{
|
||||
@@ -426,7 +426,7 @@ pgf_evaluate_accum_init_str(PgfReasoner* rs,
|
||||
accum->consts = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_evaluate_accum_init_flt(PgfReasoner* rs,
|
||||
PgfEvalAccum* accum, float val)
|
||||
{
|
||||
@@ -463,7 +463,7 @@ pgf_evaluate_accum_add_helper(PgfEvalAccum* accum, PgfLiteral lit)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_evaluate_accum_add(PgfReasoner* rs,
|
||||
PgfEvalAccum* accum, PgfClosure* closure)
|
||||
{
|
||||
@@ -493,7 +493,7 @@ pgf_evaluate_accum_add(PgfReasoner* rs,
|
||||
}
|
||||
}
|
||||
|
||||
PgfClosure*
|
||||
PGF_INTERNAL PgfClosure*
|
||||
pgf_evaluate_accum_done(PgfReasoner* rs, PgfEvalAccum* accum)
|
||||
{
|
||||
rs->enter_stack_ptr = accum->enter_stack_ptr;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
PgfExpr
|
||||
static PgfExpr
|
||||
pgf_expr_unwrap(PgfExpr expr)
|
||||
{
|
||||
while (true) {
|
||||
@@ -29,7 +29,7 @@ pgf_expr_unwrap(PgfExpr expr)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
PGF_API int
|
||||
pgf_expr_arity(PgfExpr expr)
|
||||
{
|
||||
int n = 0;
|
||||
@@ -51,7 +51,7 @@ pgf_expr_arity(PgfExpr expr)
|
||||
}
|
||||
}
|
||||
|
||||
PgfApplication*
|
||||
PGF_API PgfApplication*
|
||||
pgf_expr_unapply(PgfExpr expr, GuPool* pool)
|
||||
{
|
||||
int arity = pgf_expr_arity(expr);
|
||||
@@ -74,7 +74,7 @@ pgf_expr_unapply(PgfExpr expr, GuPool* pool)
|
||||
return appl;
|
||||
}
|
||||
|
||||
PgfExpr
|
||||
PGF_API PgfExpr
|
||||
pgf_expr_apply(PgfApplication* app, GuPool* pool)
|
||||
{
|
||||
PgfExpr expr;
|
||||
@@ -97,7 +97,7 @@ pgf_expr_apply(PgfApplication* app, GuPool* pool)
|
||||
return expr;
|
||||
}
|
||||
|
||||
PgfExpr
|
||||
PGF_API PgfExpr
|
||||
pgf_expr_abs(PgfBindType bind_type, PgfCId id, PgfExpr body, GuPool* pool)
|
||||
{
|
||||
return gu_new_variant_i(pool,
|
||||
@@ -107,7 +107,7 @@ pgf_expr_abs(PgfBindType bind_type, PgfCId id, PgfExpr body, GuPool* pool)
|
||||
.body = body);
|
||||
}
|
||||
|
||||
PgfExprAbs*
|
||||
PGF_API PgfExprAbs*
|
||||
pgf_expr_unabs(PgfExpr expr)
|
||||
{
|
||||
GuVariantInfo i = gu_variant_open(expr);
|
||||
@@ -118,7 +118,7 @@ pgf_expr_unabs(PgfExpr expr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PgfExpr
|
||||
PGF_API PgfExpr
|
||||
pgf_expr_meta(int id, GuPool* pool)
|
||||
{
|
||||
return gu_new_variant_i(pool,
|
||||
@@ -126,7 +126,7 @@ pgf_expr_meta(int id, GuPool* pool)
|
||||
.id = id);
|
||||
}
|
||||
|
||||
PgfExprMeta*
|
||||
PGF_API PgfExprMeta*
|
||||
pgf_expr_unmeta(PgfExpr expr)
|
||||
{
|
||||
GuVariantInfo i = gu_variant_open(expr);
|
||||
@@ -137,7 +137,7 @@ pgf_expr_unmeta(PgfExpr expr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PgfExpr
|
||||
PGF_API PgfExpr
|
||||
pgf_expr_string(GuString str, GuPool* pool)
|
||||
{
|
||||
PgfLiteral lit;
|
||||
@@ -153,7 +153,7 @@ pgf_expr_string(GuString str, GuPool* pool)
|
||||
lit);
|
||||
}
|
||||
|
||||
PgfExpr
|
||||
PGF_API PgfExpr
|
||||
pgf_expr_int(int val, GuPool* pool)
|
||||
{
|
||||
PgfLiteral lit;
|
||||
@@ -168,7 +168,7 @@ pgf_expr_int(int val, GuPool* pool)
|
||||
lit);
|
||||
}
|
||||
|
||||
PgfExpr
|
||||
PGF_API PgfExpr
|
||||
pgf_expr_float(double val, GuPool* pool)
|
||||
{
|
||||
PgfLiteral lit;
|
||||
@@ -183,7 +183,7 @@ pgf_expr_float(double val, GuPool* pool)
|
||||
lit);
|
||||
}
|
||||
|
||||
void*
|
||||
PGF_API void*
|
||||
pgf_expr_unlit(PgfExpr expr, int lit_tag)
|
||||
{
|
||||
expr = pgf_expr_unwrap(expr);
|
||||
@@ -890,7 +890,7 @@ pgf_new_parser(GuIn* in, GuPool* pool, GuPool* tmp_pool, GuExn* err)
|
||||
return parser;
|
||||
}
|
||||
|
||||
PgfExpr
|
||||
PGF_API PgfExpr
|
||||
pgf_read_expr(GuIn* in, GuPool* pool, GuExn* err)
|
||||
{
|
||||
GuPool* tmp_pool = gu_new_pool();
|
||||
@@ -903,7 +903,7 @@ pgf_read_expr(GuIn* in, GuPool* pool, GuExn* err)
|
||||
return expr;
|
||||
}
|
||||
|
||||
int
|
||||
PGF_API int
|
||||
pgf_read_expr_tuple(GuIn* in,
|
||||
size_t n_exprs, PgfExpr exprs[],
|
||||
GuPool* pool, GuExn* err)
|
||||
@@ -939,7 +939,7 @@ fail:
|
||||
return 0;
|
||||
}
|
||||
|
||||
GuSeq*
|
||||
PGF_API GuSeq*
|
||||
pgf_read_expr_matrix(GuIn* in,
|
||||
size_t n_exprs,
|
||||
GuPool* pool, GuExn* err)
|
||||
@@ -991,7 +991,7 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PgfType*
|
||||
PGF_API PgfType*
|
||||
pgf_read_type(GuIn* in, GuPool* pool, GuExn* err)
|
||||
{
|
||||
GuPool* tmp_pool = gu_new_pool();
|
||||
@@ -1004,7 +1004,7 @@ pgf_read_type(GuIn* in, GuPool* pool, GuExn* err)
|
||||
return type;
|
||||
}
|
||||
|
||||
bool
|
||||
PGF_API bool
|
||||
pgf_literal_eq(PgfLiteral lit1, PgfLiteral lit2)
|
||||
{
|
||||
GuVariantInfo ei1 = gu_variant_open(lit1);
|
||||
@@ -1036,7 +1036,7 @@ pgf_literal_eq(PgfLiteral lit1, PgfLiteral lit2)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
PGF_API bool
|
||||
pgf_expr_eq(PgfExpr e1, PgfExpr e2)
|
||||
{
|
||||
GuVariantInfo ei1 = gu_variant_open(e1);
|
||||
@@ -1096,7 +1096,7 @@ pgf_expr_eq(PgfExpr e1, PgfExpr e2)
|
||||
return false;
|
||||
}
|
||||
|
||||
GuHash
|
||||
PGF_API GuHash
|
||||
pgf_literal_hash(GuHash h, PgfLiteral lit)
|
||||
{
|
||||
GuVariantInfo i = gu_variant_open(lit);
|
||||
@@ -1124,7 +1124,7 @@ pgf_literal_hash(GuHash h, PgfLiteral lit)
|
||||
return h;
|
||||
}
|
||||
|
||||
GuHash
|
||||
PGF_API GuHash
|
||||
pgf_expr_hash(GuHash h, PgfExpr e)
|
||||
{
|
||||
GuVariantInfo ei = gu_variant_open(e);
|
||||
@@ -1176,7 +1176,7 @@ pgf_expr_hash(GuHash h, PgfExpr e)
|
||||
return h;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_print_cid(PgfCId id,
|
||||
GuOut* out, GuExn* err)
|
||||
{
|
||||
@@ -1200,7 +1200,7 @@ pgf_print_cid(PgfCId id,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_print_literal(PgfLiteral lit,
|
||||
GuOut* out, GuExn* err)
|
||||
{
|
||||
@@ -1253,7 +1253,7 @@ pgf_print_literal(PgfLiteral lit,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_print_expr(PgfExpr expr, PgfPrintContext* ctxt, int prec,
|
||||
GuOut* out, GuExn* err)
|
||||
{
|
||||
@@ -1374,7 +1374,7 @@ pgf_print_expr(PgfExpr expr, PgfPrintContext* ctxt, int prec,
|
||||
}
|
||||
}
|
||||
|
||||
PgfPrintContext*
|
||||
PGF_API PgfPrintContext*
|
||||
pgf_print_hypo(PgfHypo *hypo, PgfPrintContext* ctxt, int prec,
|
||||
GuOut *out, GuExn *err)
|
||||
{
|
||||
@@ -1406,7 +1406,7 @@ pgf_print_hypo(PgfHypo *hypo, PgfPrintContext* ctxt, int prec,
|
||||
return new_ctxt;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_print_type(PgfType *type, PgfPrintContext* ctxt, int prec,
|
||||
GuOut *out, GuExn *err)
|
||||
{
|
||||
@@ -1453,7 +1453,7 @@ pgf_print_type(PgfType *type, PgfPrintContext* ctxt, int prec,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_print_expr_tuple(size_t n_exprs, PgfExpr exprs[], PgfPrintContext* ctxt,
|
||||
GuOut* out, GuExn* err)
|
||||
{
|
||||
@@ -1466,7 +1466,7 @@ pgf_print_expr_tuple(size_t n_exprs, PgfExpr exprs[], PgfPrintContext* ctxt,
|
||||
gu_putc('>', out, err);
|
||||
}
|
||||
|
||||
bool
|
||||
PGF_API bool
|
||||
pgf_type_eq(PgfType* t1, PgfType* t2)
|
||||
{
|
||||
if (gu_seq_length(t1->hypos) != gu_seq_length(t2->hypos))
|
||||
|
||||
@@ -126,12 +126,9 @@ typedef struct {
|
||||
PgfExpr expr;
|
||||
} PgfExprProb;
|
||||
|
||||
int
|
||||
PGF_API_DECL int
|
||||
pgf_expr_arity(PgfExpr expr);
|
||||
|
||||
PgfExpr
|
||||
pgf_expr_unwrap(PgfExpr expr);
|
||||
|
||||
typedef struct PgfApplication PgfApplication;
|
||||
|
||||
struct PgfApplication {
|
||||
@@ -140,64 +137,64 @@ struct PgfApplication {
|
||||
PgfExpr args[];
|
||||
};
|
||||
|
||||
PgfApplication*
|
||||
PGF_API_DECL PgfApplication*
|
||||
pgf_expr_unapply(PgfExpr expr, GuPool* pool);
|
||||
|
||||
PgfExpr
|
||||
PGF_API_DECL PgfExpr
|
||||
pgf_expr_apply(PgfApplication*, GuPool* pool);
|
||||
|
||||
PgfExpr
|
||||
PGF_API_DECL PgfExpr
|
||||
pgf_expr_abs(PgfBindType bind_type, PgfCId id, PgfExpr body, GuPool* pool);
|
||||
|
||||
PgfExprAbs*
|
||||
PGF_API_DECL PgfExprAbs*
|
||||
pgf_expr_unabs(PgfExpr expr);
|
||||
|
||||
PgfExpr
|
||||
PGF_API_DECL PgfExpr
|
||||
pgf_expr_string(GuString, GuPool* pool);
|
||||
|
||||
PgfExpr
|
||||
PGF_API_DECL PgfExpr
|
||||
pgf_expr_int(int val, GuPool* pool);
|
||||
|
||||
PgfExpr
|
||||
PGF_API_DECL PgfExpr
|
||||
pgf_expr_float(double val, GuPool* pool);
|
||||
|
||||
void*
|
||||
PGF_API_DECL void*
|
||||
pgf_expr_unlit(PgfExpr expr, int lit_tag);
|
||||
|
||||
PgfExpr
|
||||
PGF_API_DECL PgfExpr
|
||||
pgf_expr_meta(int id, GuPool* pool);
|
||||
|
||||
PgfExprMeta*
|
||||
PGF_API_DECL PgfExprMeta*
|
||||
pgf_expr_unmeta(PgfExpr expr);
|
||||
|
||||
PgfExpr
|
||||
PGF_API_DECL PgfExpr
|
||||
pgf_read_expr(GuIn* in, GuPool* pool, GuExn* err);
|
||||
|
||||
int
|
||||
PGF_API_DECL int
|
||||
pgf_read_expr_tuple(GuIn* in,
|
||||
size_t n_exprs, PgfExpr exprs[],
|
||||
GuPool* pool, GuExn* err);
|
||||
|
||||
GuSeq*
|
||||
PGF_API_DECL GuSeq*
|
||||
pgf_read_expr_matrix(GuIn* in, size_t n_exprs,
|
||||
GuPool* pool, GuExn* err);
|
||||
|
||||
PgfType*
|
||||
PGF_API_DECL PgfType*
|
||||
pgf_read_type(GuIn* in, GuPool* pool, GuExn* err);
|
||||
|
||||
bool
|
||||
PGF_API_DECL bool
|
||||
pgf_literal_eq(PgfLiteral lit1, PgfLiteral lit2);
|
||||
|
||||
bool
|
||||
PGF_API_DECL bool
|
||||
pgf_expr_eq(PgfExpr e1, PgfExpr e2);
|
||||
|
||||
bool
|
||||
PGF_API_DECL bool
|
||||
pgf_type_eq(PgfType* t1, PgfType* t2);
|
||||
|
||||
GuHash
|
||||
PGF_API_DECL GuHash
|
||||
pgf_literal_hash(GuHash h, PgfLiteral lit);
|
||||
|
||||
GuHash
|
||||
PGF_API_DECL GuHash
|
||||
pgf_expr_hash(GuHash h, PgfExpr e);
|
||||
|
||||
typedef struct PgfPrintContext PgfPrintContext;
|
||||
@@ -207,25 +204,25 @@ struct PgfPrintContext {
|
||||
PgfPrintContext* next;
|
||||
};
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_print_cid(PgfCId id, GuOut* out, GuExn* err);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_print_literal(PgfLiteral lit, GuOut* out, GuExn* err);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_print_expr(PgfExpr expr, PgfPrintContext* ctxt, int prec,
|
||||
GuOut* out, GuExn* err);
|
||||
|
||||
PgfPrintContext*
|
||||
PGF_API_DECL PgfPrintContext*
|
||||
pgf_print_hypo(PgfHypo *hypo, PgfPrintContext* ctxt, int prec,
|
||||
GuOut* out, GuExn *err);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_print_type(PgfType *type, PgfPrintContext* ctxt, int prec,
|
||||
GuOut* out, GuExn *err);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_print_expr_tuple(size_t n_exprs, PgfExpr exprs[], PgfPrintContext* ctxt,
|
||||
GuOut* out, GuExn* err);
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ pgf_graphviz_abstract_tree_(PgfExpr expr, int *pid,
|
||||
return id;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_graphviz_abstract_tree(PgfPGF* pgf, PgfExpr expr, GuOut* out, GuExn* err)
|
||||
{
|
||||
int id = 0;
|
||||
@@ -219,7 +219,7 @@ pgf_graphviz_parse_level(GuBuf* level, GuOut* out, GuExn* err)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_graphviz_parse_tree(PgfConcr* concr, PgfExpr expr, GuOut* out, GuExn* err)
|
||||
{
|
||||
GuPool* tmp_pool = gu_local_pool();
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#include "reasoner.h"
|
||||
#include "hopu.h"
|
||||
|
||||
void pgf_pattern_unify(PgfReasoner* rs, PgfClosure* c1, PgfClosure* c2)
|
||||
PGF_INTERNAL void
|
||||
pgf_pattern_unify(PgfReasoner* rs, PgfClosure* c1, PgfClosure* c2)
|
||||
{
|
||||
c1 = rs->eval_gates->enter(rs, c1);
|
||||
c2 = rs->eval_gates->enter(rs, c2);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifndef HOPU_H
|
||||
#define HOPU_H
|
||||
|
||||
void pgf_pattern_unify(PgfReasoner* rs, PgfClosure* c1, PgfClosure* c2);
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_pattern_unify(PgfReasoner* rs, PgfClosure* c1, PgfClosure* c2);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ pgf_jit_alloc_page(PgfReader* rdr)
|
||||
jit_set_ip(rdr->jit_state->buf+sizeof(GuFinalizer));
|
||||
}
|
||||
|
||||
PgfJitState*
|
||||
PGF_INTERNAL PgfJitState*
|
||||
pgf_new_jit(PgfReader* rdr)
|
||||
{
|
||||
PgfJitState* state = gu_new(PgfJitState, rdr->tmp_pool);
|
||||
@@ -134,7 +134,7 @@ pgf_jit_read_absfun(PgfReader* rdr, PgfAbstr* abstr)
|
||||
return absfun;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_jit_predicate(PgfReader* rdr, PgfAbstr* abstr,
|
||||
PgfAbsCat* abscat)
|
||||
{
|
||||
@@ -360,7 +360,7 @@ pgf_jit_finalize_cafs(GuFinalizer* self)
|
||||
gu_seq_free(gates->cafs);
|
||||
}
|
||||
|
||||
PgfEvalGates*
|
||||
PGF_INTERNAL PgfEvalGates*
|
||||
pgf_jit_gates(PgfReader* rdr)
|
||||
{
|
||||
PgfEvalGates* gates = gu_new(PgfEvalGates, rdr->opool);
|
||||
@@ -672,7 +672,7 @@ pgf_jit_gates(PgfReader* rdr)
|
||||
|
||||
#define PGF_CAFS_DELTA 20
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_jit_function(PgfReader* rdr, PgfAbstr* abstr,
|
||||
PgfAbsFun* absfun)
|
||||
{
|
||||
@@ -1330,7 +1330,7 @@ pgf_jit_function(PgfReader* rdr, PgfAbstr* abstr,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_jit_done(PgfReader* rdr, PgfAbstr* abstr)
|
||||
{
|
||||
size_t n_patches = gu_buf_length(rdr->jit_state->call_patches);
|
||||
|
||||
@@ -30,7 +30,7 @@ pgf_lzr_add_overl_entry(PgfCncOverloadMap* overl_table,
|
||||
gu_buf_push(entries, void*, entry);
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_lzr_index(PgfConcr* concr,
|
||||
PgfCCat* ccat, PgfProduction prod,
|
||||
bool is_lexical,
|
||||
@@ -109,7 +109,7 @@ typedef struct {
|
||||
} PgfCncTreeLit;
|
||||
|
||||
#ifdef PGF_LINEARIZER_DEBUG
|
||||
void
|
||||
static void
|
||||
pgf_print_cnc_tree_vars(size_t n_vars, PgfPrintContext* context,
|
||||
GuOut* out, GuExn* err)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ pgf_print_cnc_tree_vars(size_t n_vars, PgfPrintContext* context,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
pgf_print_cnc_tree(PgfCncTree ctree, GuOut* out, GuExn* err)
|
||||
{
|
||||
GuVariantInfo ti = gu_variant_open(ctree);
|
||||
@@ -321,7 +321,7 @@ pgf_cnc_cat_resolve_itor(GuMapItor* fn, const void* key, void* value, GuExn* err
|
||||
clo->index--;
|
||||
}
|
||||
|
||||
PgfCncTree
|
||||
PGF_API PgfCncTree
|
||||
pgf_lzr_wrap_linref(PgfCncTree ctree, GuPool* pool)
|
||||
{
|
||||
GuVariantInfo cti = gu_variant_open(ctree);
|
||||
@@ -611,7 +611,7 @@ pgf_cnc_tree_enum_next(GuEnum* self, void* to, GuPool* pool)
|
||||
}
|
||||
}
|
||||
|
||||
PgfCncTreeEnum*
|
||||
PGF_API PgfCncTreeEnum*
|
||||
pgf_lzr_concretize(PgfConcr* concr, PgfExpr expr, GuExn* err, GuPool* pool)
|
||||
{
|
||||
if (concr->fun_indices == NULL ||
|
||||
@@ -1043,7 +1043,7 @@ pgf_lzr_linearize_tree(PgfLzr* lzr, PgfCncTree ctree, size_t lin_idx)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_lzr_linearize(PgfConcr* concr, PgfCncTree ctree, size_t lin_idx,
|
||||
PgfLinFuncs** funcs, GuPool* tmp_pool)
|
||||
{
|
||||
@@ -1139,7 +1139,7 @@ static PgfLinFuncs pgf_file_lin_funcs = {
|
||||
.symbol_capit = pgf_file_lzn_symbol_capit
|
||||
};
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_lzr_linearize_simple(PgfConcr* concr, PgfCncTree ctree, size_t lin_idx,
|
||||
GuOut* out, GuExn* err,
|
||||
GuPool* tmp_pool)
|
||||
@@ -1154,7 +1154,7 @@ pgf_lzr_linearize_simple(PgfConcr* concr, PgfCncTree ctree, size_t lin_idx,
|
||||
pgf_lzr_linearize(concr, ctree, lin_idx, &flin.funcs, tmp_pool);
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_lzr_get_table(PgfConcr* concr, PgfCncTree ctree,
|
||||
size_t* n_lins, GuString** labels)
|
||||
{
|
||||
@@ -1183,7 +1183,7 @@ pgf_lzr_get_table(PgfConcr* concr, PgfCncTree ctree,
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_linearize(PgfConcr* concr, PgfExpr expr, GuOut* out, GuExn* err)
|
||||
{
|
||||
GuPool* tmp_pool = gu_local_pool();
|
||||
@@ -1204,7 +1204,7 @@ pgf_linearize(PgfConcr* concr, PgfExpr expr, GuOut* out, GuExn* err)
|
||||
gu_pool_free(tmp_pool);
|
||||
}
|
||||
|
||||
GuString
|
||||
PGF_INTERNAL GuString
|
||||
pgf_get_tokens(PgfSymbols* syms, uint16_t sym_idx, GuPool* pool)
|
||||
{
|
||||
GuPool* tmp_pool = gu_new_pool();
|
||||
|
||||
@@ -25,14 +25,14 @@ typedef GuVariant PgfCncTree;
|
||||
typedef GuEnum PgfCncTreeEnum;
|
||||
|
||||
/// Begin enumerating concrete syntax variants.
|
||||
PgfCncTreeEnum*
|
||||
PGF_API_DECL PgfCncTreeEnum*
|
||||
pgf_lzr_concretize(PgfConcr* concr, PgfExpr expr, GuExn* err, GuPool* pool);
|
||||
|
||||
typedef struct {
|
||||
char nothing[0]; // Empty struct
|
||||
} PgfLinNonExist;
|
||||
|
||||
PgfCncTree
|
||||
PGF_API_DECL PgfCncTree
|
||||
pgf_lzr_wrap_linref(PgfCncTree ctree, GuPool* pool);
|
||||
|
||||
|
||||
@@ -68,24 +68,24 @@ struct PgfLinFuncs
|
||||
};
|
||||
|
||||
/// Linearize a concrete syntax tree.
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_lzr_linearize(PgfConcr* concr, PgfCncTree ctree, size_t lin_idx,
|
||||
PgfLinFuncs** funcs, GuPool* tmp_pool);
|
||||
|
||||
/// Linearize a concrete syntax tree as space-separated tokens.
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_lzr_linearize_simple(PgfConcr* concr, PgfCncTree ctree, size_t lin_idx,
|
||||
GuOut* out, GuExn* err,
|
||||
GuPool* tmp_pool);
|
||||
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_lzr_get_table(PgfConcr* concr, PgfCncTree ctree,
|
||||
size_t* n_lins, GuString** labels);
|
||||
|
||||
#ifdef PGF_DATA_H_
|
||||
// Used internally in the parser
|
||||
GuString
|
||||
PGF_INTERNAL_DECL GuString
|
||||
pgf_get_tokens(PgfSymbols* sym, uint16_t sym_idx, GuPool* pool);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ pgf_match_name_lit(PgfLiteralCallback* self, PgfConcr* concr,
|
||||
return ep;
|
||||
}
|
||||
|
||||
PGF_API_DATA PgfLiteralCallback pgf_nerc_literal_callback =
|
||||
PGF_API PgfLiteralCallback pgf_nerc_literal_callback =
|
||||
{ pgf_match_name_lit, pgf_predict_empty } ;
|
||||
|
||||
static void
|
||||
@@ -419,7 +419,7 @@ pgf_match_unknown_lit(PgfLiteralCallback* self, PgfConcr* concr,
|
||||
return ep;
|
||||
}
|
||||
|
||||
PGF_API_DATA PgfLiteralCallback pgf_unknown_literal_callback =
|
||||
PGF_API PgfLiteralCallback pgf_unknown_literal_callback =
|
||||
{ pgf_match_unknown_lit, pgf_predict_empty } ;
|
||||
|
||||
PgfCallbacksMap*
|
||||
@@ -465,7 +465,7 @@ pgf_callbacks_map_add_literal(PgfConcr* concr, PgfCallbacksMap* callbacks,
|
||||
PgfLiteralCallback*, callback);
|
||||
}
|
||||
|
||||
PgfCCat*
|
||||
PGF_INTERNAL PgfCCat*
|
||||
pgf_literal_cat(PgfConcr* concr, PgfLiteral lit)
|
||||
{
|
||||
int fid;
|
||||
|
||||
@@ -1,35 +1,15 @@
|
||||
#ifndef PGF_LITERALS_H_
|
||||
#define PGF_LITERALS_H_
|
||||
|
||||
// MSVC requires explicit export/import of
|
||||
// symbols in DLLs. CMake takes care of this
|
||||
// for functions, but not for data/variables.
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(COMPILING_PGF)
|
||||
#define PGF_API_DATA_DECL __declspec(dllexport)
|
||||
#define PGF_API_DATA __declspec(dllexport)
|
||||
#else
|
||||
#define PGF_API_DATA_DECL __declspec(dllimport)
|
||||
#define PGF_API_DATA ERROR_NOT_COMPILING_LIBPGF
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define PGF_API_DATA_DECL extern
|
||||
#define PGF_API_DATA
|
||||
#endif
|
||||
// end MSVC workaround
|
||||
|
||||
|
||||
#include <pgf/data.h>
|
||||
|
||||
// literal for named entities recognition
|
||||
PGF_API_DATA_DECL PgfLiteralCallback pgf_nerc_literal_callback;
|
||||
PGF_API_DECL extern PgfLiteralCallback pgf_nerc_literal_callback;
|
||||
|
||||
// literal for finding unknown words
|
||||
PGF_API_DATA_DECL PgfLiteralCallback pgf_unknown_literal_callback;
|
||||
PGF_API_DECL extern PgfLiteralCallback pgf_unknown_literal_callback;
|
||||
|
||||
PgfCCat*
|
||||
PGF_INTERNAL_DECL PgfCCat*
|
||||
pgf_literal_cat(PgfConcr* concr, PgfLiteral lit);
|
||||
|
||||
#endif // PGF_LITERALS_H_
|
||||
|
||||
@@ -334,7 +334,7 @@ pgf_print_production(int fid, PgfProduction prod,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_print_symbol(PgfSymbol sym, GuOut *out, GuExn *err);
|
||||
|
||||
static void
|
||||
@@ -1723,7 +1723,8 @@ pgf_new_parsing(PgfConcr* concr, GuString sentence,
|
||||
}
|
||||
|
||||
#ifdef PGF_COUNTS_DEBUG
|
||||
void pgf_parsing_print_counts(PgfParsing* ps)
|
||||
static void
|
||||
pgf_parsing_print_counts(PgfParsing* ps)
|
||||
{
|
||||
printf("%d\t%d\t%d\t%d\t%d\n",
|
||||
ps->item_full_count,
|
||||
@@ -2105,7 +2106,7 @@ pgf_parsing_last_token(PgfParsing* ps, GuPool* pool)
|
||||
return tok;
|
||||
}
|
||||
|
||||
GuEnum*
|
||||
PGF_API GuEnum*
|
||||
pgf_parse(PgfConcr* concr, PgfType* typ, GuString sentence,
|
||||
GuExn* err,
|
||||
GuPool* pool, GuPool* out_pool)
|
||||
@@ -2114,7 +2115,7 @@ pgf_parse(PgfConcr* concr, PgfType* typ, GuString sentence,
|
||||
return pgf_parse_with_heuristics(concr, typ, sentence, -1.0, callbacks, err, pool, out_pool);
|
||||
}
|
||||
|
||||
GuEnum*
|
||||
PGF_API GuEnum*
|
||||
pgf_parse_with_heuristics(PgfConcr* concr, PgfType* typ, GuString sentence,
|
||||
double heuristics,
|
||||
PgfCallbacksMap* callbacks,
|
||||
@@ -2158,7 +2159,7 @@ pgf_parse_with_heuristics(PgfConcr* concr, PgfType* typ, GuString sentence,
|
||||
return &ps->en;
|
||||
}
|
||||
|
||||
PgfExprEnum*
|
||||
PGF_API PgfExprEnum*
|
||||
pgf_parse_with_oracle(PgfConcr* concr, PgfType* typ,
|
||||
GuString sentence,
|
||||
PgfOracleCallback* oracle,
|
||||
@@ -2222,7 +2223,7 @@ pgf_parser_completions_next(GuEnum* self, void* to, GuPool* pool)
|
||||
*((PgfTokenProb**)to) = ps->tp;
|
||||
}
|
||||
|
||||
GuEnum*
|
||||
PGF_API GuEnum*
|
||||
pgf_complete(PgfConcr* concr, PgfType* type, GuString sentence,
|
||||
GuString prefix, GuExn *err, GuPool* pool)
|
||||
{
|
||||
@@ -2310,7 +2311,7 @@ pgf_sequence_cmp_fn(GuOrder* order, const void* p1, const void* p2)
|
||||
return res;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_lookup_morpho(PgfConcr *concr, GuString sentence,
|
||||
PgfMorphoCallback* callback, GuExn* err)
|
||||
{
|
||||
@@ -2379,7 +2380,7 @@ gu_fullform_enum_next(GuEnum* self, void* to, GuPool* pool)
|
||||
*((PgfFullFormEntry**) to) = entry;
|
||||
}
|
||||
|
||||
GuEnum*
|
||||
PGF_API GuEnum*
|
||||
pgf_fullform_lexicon(PgfConcr *concr, GuPool* pool)
|
||||
{
|
||||
PgfFullFormState* st = gu_new(PgfFullFormState, pool);
|
||||
@@ -2390,20 +2391,20 @@ pgf_fullform_lexicon(PgfConcr *concr, GuPool* pool)
|
||||
return &st->en;
|
||||
}
|
||||
|
||||
GuString
|
||||
PGF_API GuString
|
||||
pgf_fullform_get_string(PgfFullFormEntry* entry)
|
||||
{
|
||||
return entry->tokens;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_fullform_get_analyses(PgfFullFormEntry* entry,
|
||||
PgfMorphoCallback* callback, GuExn* err)
|
||||
{
|
||||
pgf_morpho_iter(entry->idx, callback, err);
|
||||
}
|
||||
|
||||
GuEnum*
|
||||
PGF_API GuEnum*
|
||||
pgf_lookup_word_prefix(PgfConcr *concr, GuString prefix,
|
||||
GuPool* pool, GuExn* err)
|
||||
{
|
||||
@@ -2434,7 +2435,7 @@ pgf_lookup_word_prefix(PgfConcr *concr, GuString prefix,
|
||||
return &state->en;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_parser_index(PgfConcr* concr,
|
||||
PgfCCat* ccat, PgfProduction prod,
|
||||
bool is_lexical,
|
||||
@@ -2479,7 +2480,7 @@ pgf_parser_index(PgfConcr* concr,
|
||||
}
|
||||
}
|
||||
|
||||
prob_t
|
||||
PGF_INTERNAL prob_t
|
||||
pgf_ccat_set_viterbi_prob(PgfCCat* ccat) {
|
||||
if (ccat->fid < 0)
|
||||
return 0;
|
||||
|
||||
@@ -128,7 +128,7 @@ static PgfLinFuncs pgf_metrics_lin_funcs2 = {
|
||||
.symbol_capit = NULL
|
||||
};
|
||||
|
||||
bool
|
||||
PGF_API bool
|
||||
pgf_parseval(PgfConcr* concr, PgfExpr expr, PgfType* type,
|
||||
double *precision, double *recall, double *exact)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
PgfPGF*
|
||||
PGF_API PgfPGF*
|
||||
pgf_read(const char* fpath,
|
||||
GuPool* pool, GuExn* err)
|
||||
{
|
||||
@@ -34,7 +34,7 @@ pgf_read(const char* fpath,
|
||||
return pgf;
|
||||
}
|
||||
|
||||
PgfPGF*
|
||||
PGF_API PgfPGF*
|
||||
pgf_read_in(GuIn* in,
|
||||
GuPool* pool, GuPool* tmp_pool, GuExn* err)
|
||||
{
|
||||
@@ -44,13 +44,13 @@ pgf_read_in(GuIn* in,
|
||||
return pgf;
|
||||
}
|
||||
|
||||
GuString
|
||||
PGF_API GuString
|
||||
pgf_abstract_name(PgfPGF* pgf)
|
||||
{
|
||||
return pgf->abstract.name;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_iter_languages(PgfPGF* pgf, GuMapItor* itor, GuExn* err)
|
||||
{
|
||||
size_t n_concrs = gu_seq_length(pgf->concretes);
|
||||
@@ -62,19 +62,19 @@ pgf_iter_languages(PgfPGF* pgf, GuMapItor* itor, GuExn* err)
|
||||
}
|
||||
}
|
||||
|
||||
PgfConcr*
|
||||
PGF_API PgfConcr*
|
||||
pgf_get_language(PgfPGF* pgf, PgfCId lang)
|
||||
{
|
||||
return gu_seq_binsearch(pgf->concretes, pgf_concr_order, PgfConcr, lang);
|
||||
}
|
||||
|
||||
GuString
|
||||
PGF_API GuString
|
||||
pgf_concrete_name(PgfConcr* concr)
|
||||
{
|
||||
return concr->name;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_iter_categories(PgfPGF* pgf, GuMapItor* itor, GuExn* err)
|
||||
{
|
||||
size_t n_cats = gu_seq_length(pgf->abstract.cats);
|
||||
@@ -86,7 +86,7 @@ pgf_iter_categories(PgfPGF* pgf, GuMapItor* itor, GuExn* err)
|
||||
}
|
||||
}
|
||||
|
||||
PgfType*
|
||||
PGF_API PgfType*
|
||||
pgf_start_cat(PgfPGF* pgf, GuPool* pool)
|
||||
{
|
||||
PgfFlag* flag =
|
||||
@@ -117,7 +117,7 @@ pgf_start_cat(PgfPGF* pgf, GuPool* pool)
|
||||
return type;
|
||||
}
|
||||
|
||||
GuString
|
||||
PGF_API GuString
|
||||
pgf_language_code(PgfConcr* concr)
|
||||
{
|
||||
PgfFlag* flag =
|
||||
@@ -137,7 +137,7 @@ pgf_language_code(PgfConcr* concr)
|
||||
return "";
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_iter_functions(PgfPGF* pgf, GuMapItor* itor, GuExn* err)
|
||||
{
|
||||
size_t n_funs = gu_seq_length(pgf->abstract.funs);
|
||||
@@ -149,7 +149,7 @@ pgf_iter_functions(PgfPGF* pgf, GuMapItor* itor, GuExn* err)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_iter_functions_by_cat(PgfPGF* pgf, PgfCId catname,
|
||||
GuMapItor* itor, GuExn* err)
|
||||
{
|
||||
@@ -165,7 +165,7 @@ pgf_iter_functions_by_cat(PgfPGF* pgf, PgfCId catname,
|
||||
}
|
||||
}
|
||||
|
||||
PgfType*
|
||||
PGF_API PgfType*
|
||||
pgf_function_type(PgfPGF* pgf, PgfCId funname)
|
||||
{
|
||||
PgfAbsFun* absfun =
|
||||
@@ -176,7 +176,7 @@ pgf_function_type(PgfPGF* pgf, PgfCId funname)
|
||||
return absfun->type;
|
||||
}
|
||||
|
||||
double
|
||||
PGF_API double
|
||||
pgf_function_prob(PgfPGF* pgf, PgfCId funname)
|
||||
{
|
||||
PgfAbsFun* absfun =
|
||||
@@ -187,7 +187,7 @@ pgf_function_prob(PgfPGF* pgf, PgfCId funname)
|
||||
return absfun->ep.prob;
|
||||
}
|
||||
|
||||
GuString
|
||||
PGF_API GuString
|
||||
pgf_print_name(PgfConcr* concr, PgfCId id)
|
||||
{
|
||||
PgfCId name =
|
||||
@@ -197,7 +197,7 @@ pgf_print_name(PgfConcr* concr, PgfCId id)
|
||||
return name;
|
||||
}
|
||||
|
||||
bool
|
||||
PGF_API bool
|
||||
pgf_has_linearization(PgfConcr* concr, PgfCId id)
|
||||
{
|
||||
PgfCncOverloadMap* overl_table =
|
||||
@@ -205,7 +205,7 @@ pgf_has_linearization(PgfConcr* concr, PgfCId id)
|
||||
return (overl_table != NULL);
|
||||
}
|
||||
|
||||
PgfExprProb*
|
||||
PGF_API PgfExprProb*
|
||||
pgf_fun_get_ep(void* value)
|
||||
{
|
||||
PgfAbsFun* absfun = *((PgfAbsFun**) value);
|
||||
|
||||
@@ -7,6 +7,28 @@
|
||||
#include <gu/enum.h>
|
||||
#include <gu/string.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#if defined(COMPILING_PGF)
|
||||
#define PGF_API_DECL __declspec(dllexport)
|
||||
#define PGF_API __declspec(dllexport)
|
||||
#else
|
||||
#define PGF_API_DECL __declspec(dllimport)
|
||||
#define PGF_API ERROR_NOT_COMPILING_LIBPGF
|
||||
#endif
|
||||
#define PGF_INTERNAL_DECL
|
||||
#define PGF_INTERNAL
|
||||
|
||||
#else
|
||||
|
||||
#define PGF_API_DECL
|
||||
#define PGF_API
|
||||
|
||||
#define PGF_INTERNAL_DECL __attribute__ ((visibility ("hidden")))
|
||||
#define PGF_INTERNAL __attribute__ ((visibility ("hidden")))
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef GuString PgfCId;
|
||||
|
||||
@@ -21,61 +43,61 @@ typedef struct PgfConcr PgfConcr;
|
||||
|
||||
typedef GuEnum PgfExprEnum;
|
||||
|
||||
PgfPGF*
|
||||
PGF_API_DECL PgfPGF*
|
||||
pgf_read(const char* fpath,
|
||||
GuPool* pool, GuExn* err);
|
||||
|
||||
PgfPGF*
|
||||
PGF_API_DECL PgfPGF*
|
||||
pgf_read_in(GuIn* in,
|
||||
GuPool* pool, GuPool* tmp_pool, GuExn* err);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_concrete_load(PgfConcr* concr, GuIn* in, GuExn* err);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_concrete_unload(PgfConcr* concr);
|
||||
|
||||
GuString
|
||||
PGF_API_DECL GuString
|
||||
pgf_abstract_name(PgfPGF*);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_iter_languages(PgfPGF*, GuMapItor* itor, GuExn* err);
|
||||
|
||||
PgfConcr*
|
||||
PGF_API_DECL PgfConcr*
|
||||
pgf_get_language(PgfPGF*, PgfCId lang);
|
||||
|
||||
GuString
|
||||
PGF_API_DECL GuString
|
||||
pgf_concrete_name(PgfConcr*);
|
||||
|
||||
GuString
|
||||
PGF_API_DECL GuString
|
||||
pgf_language_code(PgfConcr* concr);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_iter_categories(PgfPGF* pgf, GuMapItor* itor, GuExn* err);
|
||||
|
||||
PgfType*
|
||||
PGF_API_DECL PgfType*
|
||||
pgf_start_cat(PgfPGF* pgf, GuPool* pool);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_iter_functions(PgfPGF* pgf, GuMapItor* itor, GuExn* err);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_iter_functions_by_cat(PgfPGF* pgf, PgfCId catname,
|
||||
GuMapItor* itor, GuExn* err);
|
||||
|
||||
PgfType*
|
||||
PGF_API_DECL PgfType*
|
||||
pgf_function_type(PgfPGF* pgf, PgfCId funname);
|
||||
|
||||
double
|
||||
PGF_API_DECL double
|
||||
pgf_function_prob(PgfPGF* pgf, PgfCId funname);
|
||||
|
||||
GuString
|
||||
PGF_API_DECL GuString
|
||||
pgf_print_name(PgfConcr*, PgfCId id);
|
||||
|
||||
bool
|
||||
PGF_API_DECL bool
|
||||
pgf_has_linearization(PgfConcr* concr, PgfCId id);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_linearize(PgfConcr* concr, PgfExpr expr, GuOut* out, GuExn* err);
|
||||
|
||||
typedef struct {
|
||||
@@ -84,23 +106,23 @@ typedef struct {
|
||||
int fids[];
|
||||
} PgfAlignmentPhrase;
|
||||
|
||||
GuSeq*
|
||||
PGF_API_DECL GuSeq*
|
||||
pgf_align_words(PgfConcr* concr, PgfExpr expr,
|
||||
GuExn* err, GuPool* pool);
|
||||
|
||||
bool
|
||||
PGF_API_DECL bool
|
||||
pgf_parseval(PgfConcr* concr, PgfExpr expr, PgfType* type,
|
||||
double *precision, double *recall, double *exact);
|
||||
|
||||
PgfExpr
|
||||
PGF_API_DECL PgfExpr
|
||||
pgf_compute(PgfPGF* pgf, PgfExpr expr, GuExn* err,
|
||||
GuPool* pool, GuPool* out_pool);
|
||||
|
||||
PgfExprEnum*
|
||||
PGF_API_DECL PgfExprEnum*
|
||||
pgf_generate_all(PgfPGF* pgf, PgfType* ty,
|
||||
GuExn* err, GuPool* pool, GuPool* out_pool);
|
||||
|
||||
PgfExprEnum*
|
||||
PGF_API_DECL PgfExprEnum*
|
||||
pgf_parse(PgfConcr* concr, PgfType* typ, GuString sentence,
|
||||
GuExn* err, GuPool* pool, GuPool* out_pool);
|
||||
|
||||
@@ -111,29 +133,29 @@ struct PgfMorphoCallback {
|
||||
GuExn* err);
|
||||
};
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_lookup_morpho(PgfConcr *concr, GuString sentence,
|
||||
PgfMorphoCallback* callback, GuExn* err);
|
||||
|
||||
typedef struct PgfFullFormEntry PgfFullFormEntry;
|
||||
|
||||
GuEnum*
|
||||
PGF_API_DECL GuEnum*
|
||||
pgf_fullform_lexicon(PgfConcr *concr, GuPool* pool);
|
||||
|
||||
GuString
|
||||
PGF_API_DECL GuString
|
||||
pgf_fullform_get_string(PgfFullFormEntry* entry);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_fullform_get_analyses(PgfFullFormEntry* entry,
|
||||
PgfMorphoCallback* callback, GuExn* err);
|
||||
|
||||
GuEnum*
|
||||
PGF_API_DECL GuEnum*
|
||||
pgf_lookup_word_prefix(PgfConcr *concr, GuString prefix,
|
||||
GuPool* pool, GuExn* err);
|
||||
|
||||
typedef GuMap PgfCallbacksMap;
|
||||
|
||||
PgfExprEnum*
|
||||
PGF_API_DECL PgfExprEnum*
|
||||
pgf_parse_with_heuristics(PgfConcr* concr, PgfType* typ,
|
||||
GuString sentence, double heuristics,
|
||||
PgfCallbacksMap* callbacks,
|
||||
@@ -158,7 +180,7 @@ struct PgfOracleCallback {
|
||||
GuPool *out_pool);
|
||||
};
|
||||
|
||||
PgfExprEnum*
|
||||
PGF_API_DECL PgfExprEnum*
|
||||
pgf_parse_with_oracle(PgfConcr* concr, PgfType* typ,
|
||||
GuString sentence,
|
||||
PgfOracleCallback* oracle,
|
||||
@@ -171,7 +193,7 @@ typedef struct {
|
||||
prob_t prob;
|
||||
} PgfTokenProb;
|
||||
|
||||
GuEnum*
|
||||
PGF_API_DECL GuEnum*
|
||||
pgf_complete(PgfConcr* concr, PgfType* type, GuString string,
|
||||
GuString prefix, GuExn* err, GuPool* pool);
|
||||
|
||||
@@ -188,30 +210,30 @@ struct PgfLiteralCallback {
|
||||
GuPool *out_pool);
|
||||
};
|
||||
|
||||
PgfCallbacksMap*
|
||||
PGF_API_DECL PgfCallbacksMap*
|
||||
pgf_new_callbacks_map(PgfConcr* concr, GuPool *pool);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_callbacks_map_add_literal(PgfConcr* concr, PgfCallbacksMap* callbacks,
|
||||
PgfCId cat, PgfLiteralCallback* callback);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_print(PgfPGF* pgf, GuOut* out, GuExn* err);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_check_expr(PgfPGF* gr, PgfExpr* pe, PgfType* ty,
|
||||
GuExn* exn, GuPool* pool);
|
||||
|
||||
PgfType*
|
||||
PGF_API_DECL PgfType*
|
||||
pgf_infer_expr(PgfPGF* gr, PgfExpr* pe,
|
||||
GuExn* exn, GuPool* pool);
|
||||
|
||||
void
|
||||
PGF_API_DECL void
|
||||
pgf_check_type(PgfPGF* gr, PgfType** ty,
|
||||
GuExn* exn, GuPool* pool);
|
||||
|
||||
// internal
|
||||
PgfExprProb*
|
||||
PGF_API_DECL PgfExprProb*
|
||||
pgf_fun_get_ep(void* value);
|
||||
|
||||
#endif // PGF_H_
|
||||
|
||||
@@ -6,7 +6,7 @@ typedef struct {
|
||||
GuOut* out;
|
||||
} PgfPrintFn;
|
||||
|
||||
void
|
||||
static void
|
||||
pgf_print_flags(PgfFlags* flags, GuOut *out, GuExn* err)
|
||||
{
|
||||
size_t n_flags = gu_seq_length(flags);
|
||||
@@ -21,7 +21,7 @@ pgf_print_flags(PgfFlags* flags, GuOut *out, GuExn* err)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
pgf_print_abscats(PgfAbsCats* abscats, GuOut *out, GuExn* err)
|
||||
{
|
||||
size_t n_cats = gu_seq_length(abscats);
|
||||
@@ -49,7 +49,7 @@ pgf_print_abscats(PgfAbsCats* abscats, GuOut *out, GuExn* err)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
pgf_print_absfuns(PgfAbsFuns* absfuns, GuOut *out, GuExn* err)
|
||||
{
|
||||
size_t n_funs = gu_seq_length(absfuns);
|
||||
@@ -215,7 +215,7 @@ pgf_print_token(PgfToken tok, GuOut *out, GuExn *err)
|
||||
static void
|
||||
pgf_print_symbols(PgfSymbols* syms, GuOut *out, GuExn *err);
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_print_symbol(PgfSymbol sym, GuOut *out, GuExn *err)
|
||||
{
|
||||
switch (gu_variant_tag(sym)) {
|
||||
@@ -378,7 +378,7 @@ pgf_print_concrete(PgfConcr* concr, GuOut* out, GuExn* err)
|
||||
gu_puts("}\n", out, err);
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_print(PgfPGF* pgf, GuOut* out, GuExn* err)
|
||||
{
|
||||
pgf_print_abstract(&pgf->abstract, out, err);
|
||||
|
||||
@@ -28,13 +28,13 @@ struct PgfReadTagExn {
|
||||
int tag;
|
||||
};
|
||||
|
||||
uint8_t
|
||||
PGF_INTERNAL uint8_t
|
||||
pgf_read_tag(PgfReader* rdr)
|
||||
{
|
||||
return gu_in_u8(rdr->in, rdr->err);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
PGF_INTERNAL uint32_t
|
||||
pgf_read_uint(PgfReader* rdr)
|
||||
{
|
||||
uint32_t u = 0;
|
||||
@@ -49,14 +49,14 @@ pgf_read_uint(PgfReader* rdr)
|
||||
return u;
|
||||
}
|
||||
|
||||
int32_t
|
||||
PGF_INTERNAL int32_t
|
||||
pgf_read_int(PgfReader* rdr)
|
||||
{
|
||||
uint32_t u = pgf_read_uint(rdr);
|
||||
return gu_decode_2c32(u, rdr->err);
|
||||
}
|
||||
|
||||
size_t
|
||||
PGF_INTERNAL size_t
|
||||
pgf_read_len(PgfReader* rdr)
|
||||
{
|
||||
int32_t len = pgf_read_int(rdr);
|
||||
@@ -77,21 +77,21 @@ pgf_read_len(PgfReader* rdr)
|
||||
return len;
|
||||
}
|
||||
|
||||
PgfCId
|
||||
PGF_INTERNAL PgfCId
|
||||
pgf_read_cid(PgfReader* rdr, GuPool* pool)
|
||||
{
|
||||
size_t len = pgf_read_len(rdr);
|
||||
return gu_string_read_latin1(len, pool, rdr->in, rdr->err);
|
||||
}
|
||||
|
||||
GuString
|
||||
PGF_INTERNAL GuString
|
||||
pgf_read_string(PgfReader* rdr)
|
||||
{
|
||||
size_t len = pgf_read_len(rdr);
|
||||
return gu_string_read(len, rdr->opool, rdr->in, rdr->err);
|
||||
}
|
||||
|
||||
double
|
||||
PGF_INTERNAL double
|
||||
pgf_read_double(PgfReader* rdr)
|
||||
{
|
||||
return gu_in_f64be(rdr->in, rdr->err);
|
||||
@@ -1179,7 +1179,7 @@ pgf_read_ccat_cb(GuMapItor* fn, const void* key, void* value, GuExn* err)
|
||||
// pgf_ccat_set_viterbi_prob(ccat);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
pgf_read_concrete_content(PgfReader* rdr, PgfConcr* concr)
|
||||
{
|
||||
concr->printnames =
|
||||
@@ -1263,7 +1263,7 @@ pgf_read_concrete(PgfReader* rdr, PgfAbstr* abstr, PgfConcr* concr, bool with_co
|
||||
return concr;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_concrete_load(PgfConcr* concr, GuIn* in, GuExn* err)
|
||||
{
|
||||
if (concr->fin.fn == NULL || concr->pool != NULL)
|
||||
@@ -1302,7 +1302,7 @@ end:
|
||||
gu_pool_free(tmp_pool);
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_concrete_unload(PgfConcr* concr)
|
||||
{
|
||||
if (concr->fin.fn == NULL)
|
||||
@@ -1328,7 +1328,7 @@ pgf_read_concretes(PgfReader* rdr, PgfAbstr* abstr, bool with_content)
|
||||
return concretes;
|
||||
}
|
||||
|
||||
PgfPGF*
|
||||
PGF_INTERNAL PgfPGF*
|
||||
pgf_read_pgf(PgfReader* rdr) {
|
||||
PgfPGF* pgf = gu_new(PgfPGF, rdr->opool);
|
||||
|
||||
@@ -1354,7 +1354,7 @@ pgf_read_pgf(PgfReader* rdr) {
|
||||
return pgf;
|
||||
}
|
||||
|
||||
PgfReader*
|
||||
PGF_INTERNAL PgfReader*
|
||||
pgf_new_reader(GuIn* in, GuPool* opool, GuPool* tmp_pool, GuExn* err)
|
||||
{
|
||||
PgfReader* rdr = gu_new(PgfReader, tmp_pool);
|
||||
@@ -1367,7 +1367,7 @@ pgf_new_reader(GuIn* in, GuPool* opool, GuPool* tmp_pool, GuExn* err)
|
||||
return rdr;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_reader_done(PgfReader* rdr, PgfPGF* pgf)
|
||||
{
|
||||
if (pgf == NULL)
|
||||
|
||||
@@ -16,34 +16,34 @@ typedef struct {
|
||||
struct PgfJitState* jit_state;
|
||||
} PgfReader;
|
||||
|
||||
PgfReader*
|
||||
PGF_INTERNAL_DECL PgfReader*
|
||||
pgf_new_reader(GuIn* in, GuPool* opool, GuPool* tmp_pool, GuExn* err);
|
||||
|
||||
uint8_t
|
||||
PGF_INTERNAL_DECL uint8_t
|
||||
pgf_read_tag(PgfReader* rdr);
|
||||
|
||||
uint32_t
|
||||
PGF_INTERNAL_DECL uint32_t
|
||||
pgf_read_uint(PgfReader* rdr);
|
||||
|
||||
int32_t
|
||||
PGF_INTERNAL_DECL int32_t
|
||||
pgf_read_int(PgfReader* rdr);
|
||||
|
||||
GuString
|
||||
PGF_INTERNAL_DECL GuString
|
||||
pgf_read_string(PgfReader* rdr);
|
||||
|
||||
double
|
||||
PGF_INTERNAL_DECL double
|
||||
pgf_read_double(PgfReader* rdr);
|
||||
|
||||
size_t
|
||||
PGF_INTERNAL_DECL size_t
|
||||
pgf_read_len(PgfReader* rdr);
|
||||
|
||||
PgfCId
|
||||
PGF_INTERNAL_DECL PgfCId
|
||||
pgf_read_cid(PgfReader* rdr, GuPool* pool);
|
||||
|
||||
PgfPGF*
|
||||
PGF_INTERNAL_DECL PgfPGF*
|
||||
pgf_read_pgf(PgfReader* rdr);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_reader_done(PgfReader* rdr, PgfPGF* pgf);
|
||||
|
||||
|
||||
@@ -52,21 +52,21 @@ pgf_reader_done(PgfReader* rdr, PgfPGF* pgf);
|
||||
|
||||
typedef struct PgfJitState PgfJitState;
|
||||
|
||||
PgfJitState*
|
||||
PGF_INTERNAL_DECL PgfJitState*
|
||||
pgf_new_jit(PgfReader* rdr);
|
||||
|
||||
PgfEvalGates*
|
||||
PGF_INTERNAL_DECL PgfEvalGates*
|
||||
pgf_jit_gates(PgfReader* rdr);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_jit_predicate(PgfReader* rdr, PgfAbstr* abstr,
|
||||
PgfAbsCat* abscat);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_jit_function(PgfReader* rdr, PgfAbstr* abstr,
|
||||
PgfAbsFun* absfun);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_jit_done(PgfReader* state, PgfAbstr* abstr);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -192,7 +192,7 @@ pgf_print_combine2_state(PgfReasoner* rs, PgfCombine2State* st,
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_reasoner_combine1(PgfReasoner* rs, PgfClosure* closure)
|
||||
{
|
||||
PgfCombine1State* st = (PgfCombine1State*) closure;
|
||||
@@ -210,7 +210,7 @@ pgf_reasoner_combine1(PgfReasoner* rs, PgfClosure* closure)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_reasoner_try_first(PgfReasoner* rs, PgfExprState* parent, PgfAbsFun* absfun)
|
||||
{
|
||||
PgfCId cat = absfun->type->cid;
|
||||
@@ -260,7 +260,7 @@ pgf_reasoner_try_first(PgfReasoner* rs, PgfExprState* parent, PgfAbsFun* absfun)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_reasoner_try_else(PgfReasoner* rs, PgfExprState* prev, PgfAbsFun* absfun)
|
||||
{
|
||||
PgfExprState *st = gu_new(PgfExprState, rs->pool);
|
||||
@@ -276,7 +276,7 @@ pgf_reasoner_try_else(PgfReasoner* rs, PgfExprState* prev, PgfAbsFun* absfun)
|
||||
gu_buf_heap_push(rs->pqueue, &pgf_expr_state_order, &st);
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_reasoner_combine2(PgfReasoner* rs, PgfClosure* closure)
|
||||
{
|
||||
PgfCombine2State* st = (PgfCombine2State*) closure;
|
||||
@@ -296,7 +296,7 @@ pgf_reasoner_combine2(PgfReasoner* rs, PgfClosure* closure)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_reasoner_complete(PgfReasoner* rs, PgfExprState* st)
|
||||
{
|
||||
PgfExprProb* ep = gu_new(PgfExprProb, rs->out_pool);
|
||||
@@ -317,7 +317,7 @@ pgf_reasoner_complete(PgfReasoner* rs, PgfExprState* st)
|
||||
rs->eval_gates->enter(rs, &nst->base.header);
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_reasoner_try_constant(PgfReasoner* rs, PgfExprState* prev, PgfAbsFun* absfun)
|
||||
{
|
||||
pgf_reasoner_try_else(rs, prev, absfun);
|
||||
@@ -366,21 +366,21 @@ pgf_reasoner_mk_literal(PgfReasoner* rs, PgfExprState* parent,
|
||||
gu_buf_heap_push(rs->pqueue, &pgf_expr_state_order, &parent);
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_reasoner_mk_string(PgfReasoner* rs, PgfExprState* parent)
|
||||
{
|
||||
pgf_reasoner_mk_literal(rs, parent, "String",
|
||||
pgf_expr_string("__mock_string__", rs->out_pool));
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_reasoner_mk_int(PgfReasoner* rs, PgfExprState* parent)
|
||||
{
|
||||
pgf_reasoner_mk_literal(rs, parent, "Int",
|
||||
pgf_expr_int(999, rs->out_pool));
|
||||
}
|
||||
|
||||
void
|
||||
PGF_INTERNAL void
|
||||
pgf_reasoner_mk_float(PgfReasoner* rs, PgfExprState* parent)
|
||||
{
|
||||
pgf_reasoner_mk_literal(rs, parent, "Float",
|
||||
@@ -422,7 +422,7 @@ pgf_reasoner_enum_next(GuEnum* self, void* to, GuPool* pool)
|
||||
*(PgfExprProb**)to = pgf_reasoner_next(pr);
|
||||
}
|
||||
|
||||
PgfReasoner*
|
||||
PGF_INTERNAL PgfReasoner*
|
||||
pgf_new_reasoner(PgfPGF* pgf, GuExn* err, GuPool* pool, GuPool* out_pool)
|
||||
{
|
||||
size_t n_cafs =
|
||||
@@ -453,7 +453,7 @@ pgf_new_reasoner(PgfPGF* pgf, GuExn* err, GuPool* pool, GuPool* out_pool)
|
||||
return rs;
|
||||
}
|
||||
|
||||
PgfExprEnum*
|
||||
PGF_API PgfExprEnum*
|
||||
pgf_generate_all(PgfPGF* pgf, PgfType* typ, GuExn* err, GuPool* pool, GuPool* out_pool)
|
||||
{
|
||||
PgfReasoner* rs = pgf_new_reasoner(pgf, err, pool, out_pool);
|
||||
|
||||
@@ -115,60 +115,60 @@ struct PgfEvalGates {
|
||||
GuSeq* cafs;
|
||||
};
|
||||
|
||||
PgfReasoner*
|
||||
PGF_INTERNAL_DECL PgfReasoner*
|
||||
pgf_new_reasoner(PgfPGF* pgf, GuExn* err, GuPool* pool, GuPool* out_pool);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_reasoner_try_first(PgfReasoner* rs, PgfExprState* parent, PgfAbsFun* absfun);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_reasoner_try_else(PgfReasoner* rs, PgfExprState* prev, PgfAbsFun* absfun);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_reasoner_combine1(PgfReasoner* rs, PgfClosure* closure);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_reasoner_combine2(PgfReasoner* rs, PgfClosure* closure);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_reasoner_complete(PgfReasoner* rs, PgfExprState* st);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_reasoner_try_constant(PgfReasoner* rs, PgfExprState* prev, PgfAbsFun* absfun);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_reasoner_mk_string(PgfReasoner* rs, PgfExprState* parent);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_reasoner_mk_int(PgfReasoner* rs, PgfExprState* parent);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_reasoner_mk_float(PgfReasoner* rs, PgfExprState* parent);
|
||||
|
||||
PgfClosure*
|
||||
PGF_INTERNAL_DECL PgfClosure*
|
||||
pgf_evaluate_expr_thunk(PgfReasoner* rs, PgfExprThunk* thunk);
|
||||
|
||||
PgfClosure*
|
||||
PGF_INTERNAL_DECL PgfClosure*
|
||||
pgf_evaluate_lambda_application(PgfReasoner* rs, PgfExprThunk* lambda,
|
||||
PgfClosure* arg);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_evaluate_accum_init_int(PgfReasoner* rs,
|
||||
PgfEvalAccum* accum, int val);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_evaluate_accum_init_str(PgfReasoner* rs,
|
||||
PgfEvalAccum* accum, GuString val);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_evaluate_accum_init_flt(PgfReasoner* rs,
|
||||
PgfEvalAccum* accum, float val);
|
||||
|
||||
void
|
||||
PGF_INTERNAL_DECL void
|
||||
pgf_evaluate_accum_add(PgfReasoner* rs,
|
||||
PgfEvalAccum* accum, PgfClosure* closure);
|
||||
|
||||
PgfClosure*
|
||||
PGF_INTERNAL_DECL PgfClosure*
|
||||
pgf_evaluate_accum_done(PgfReasoner* rs, PgfEvalAccum* accum);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -526,7 +526,7 @@ pgf_inf_expr(PgfTypeChecker* checker, PgfContext* ctxt, PgfExpr* pe)
|
||||
return null_cf_type;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_check_expr(PgfPGF* gr, PgfExpr* pe, PgfType* ty,
|
||||
GuExn* exn, GuPool* pool)
|
||||
{
|
||||
@@ -544,7 +544,7 @@ pgf_check_expr(PgfPGF* gr, PgfExpr* pe, PgfType* ty,
|
||||
gu_pool_free(tmp_pool);
|
||||
}
|
||||
|
||||
PgfType*
|
||||
PGF_API PgfType*
|
||||
pgf_infer_expr(PgfPGF* gr, PgfExpr* pe,
|
||||
GuExn* exn, GuPool* pool)
|
||||
{
|
||||
@@ -569,7 +569,7 @@ pgf_infer_expr(PgfPGF* gr, PgfExpr* pe,
|
||||
return ty;
|
||||
}
|
||||
|
||||
void
|
||||
PGF_API void
|
||||
pgf_check_type(PgfPGF* gr, PgfType** pty,
|
||||
GuExn* exn, GuPool* pool)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user