mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-02 07:42:50 -06:00
make it possible to merge PGF files in the compiler
This commit is contained in:
@@ -213,6 +213,33 @@ PgfDB *pgf_new_ngf(PgfText *abstract_name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PGF_API
|
||||
void pgf_merge_pgf(PgfDB *db, PgfRevision revision,
|
||||
const char* fpath,
|
||||
PgfExn* err)
|
||||
{
|
||||
FILE *in = NULL;
|
||||
|
||||
PGF_API_BEGIN {
|
||||
in = fopen(fpath, "rb");
|
||||
if (!in) {
|
||||
throw pgf_systemerror(errno, fpath);
|
||||
}
|
||||
|
||||
{
|
||||
DB_scope scope(db, WRITER_SCOPE);
|
||||
ref<PgfPGF> pgf = PgfDB::revision2pgf(revision);
|
||||
|
||||
PgfReader rdr(in);
|
||||
rdr.merge_pgf(pgf);
|
||||
}
|
||||
} PGF_API_END
|
||||
|
||||
end:
|
||||
if (in != NULL)
|
||||
fclose(in);
|
||||
}
|
||||
|
||||
PGF_API
|
||||
void pgf_write_pgf(const char* fpath,
|
||||
PgfDB *db, PgfRevision revision,
|
||||
|
||||
Reference in New Issue
Block a user