constant time and space grammar embedding

This commit is contained in:
Krasimir Angelov
2022-11-16 09:43:09 +01:00
parent 045f708a76
commit a6aa6c2a5a
4 changed files with 149 additions and 49 deletions

View File

@@ -100,6 +100,8 @@ public:
PGF_INTERNAL_DECL static txn_t get_txn_id();
PGF_INTERNAL_DECL const char *get_file_path() { return filepath; };
template<class A>
static ref<A> malloc(size_t extra_bytes=0) {
return current_db->malloc_internal(sizeof(A)+extra_bytes);

View File

@@ -265,7 +265,13 @@ end:
fclose(out);
}
PGF_API_DECL
PGF_API
const char *pgf_file_path(PgfDB *db)
{
return db->get_file_path();
}
PGF_API
void pgf_free_revision(PgfDB *db, PgfRevision revision)
{
try {
@@ -281,7 +287,7 @@ void pgf_free_revision(PgfDB *db, PgfRevision revision)
delete db;
}
PGF_API_DECL
PGF_API
void pgf_free_concr_revision(PgfDB *db, PgfConcrRevision revision)
{
try {

View File

@@ -267,7 +267,7 @@ PgfDB *pgf_new_ngf(PgfText *abstract_name,
PgfRevision *revision,
PgfExn* err);
PGF_API
PGF_API_DECL
void pgf_merge_pgf(PgfDB *db, PgfRevision revision,
const char* fpath,
PgfExn* err);
@@ -277,6 +277,9 @@ void pgf_write_pgf(const char* fpath,
PgfDB *db, PgfRevision revision,
PgfExn* err);
PGF_API_DECL
const char *pgf_file_path(PgfDB *db);
/* Release a revision. If this is the last revision for the given
* database, then the database is released as well. */
PGF_API_DECL