fix the binding after the API change

This commit is contained in:
Krasimir Angelov
2022-07-14 11:25:00 +02:00
parent 4d0f33e3c3
commit 833a86960b
2 changed files with 7 additions and 4 deletions

View File

@@ -33,6 +33,9 @@ const PgfDBPtr = ref.refType(PgfDB)
const PgfRevision = ref.refType(ref.types.void)
export const PgfRevisionPtr = ref.refType(PgfRevision)
const PgfProbsCallback = ref.refType(ref.types.void)
export const PgfProbsCallbackPtr = ref.refType(PgfProbsCallback)
export const PgfExn = Struct({
type: ref.types.int,
code: ref.types.int,
@@ -103,8 +106,8 @@ const PgfMarshallerPtr = ref.refType(PgfMarshaller)
// FFI
export const runtime = ffi.Library('libpgf', {
pgf_read_pgf: [PgfDBPtr, [ref.types.CString, PgfRevisionPtr, PgfExnPtr]],
pgf_boot_ngf: [PgfDBPtr, [ref.types.CString, ref.types.CString, PgfRevisionPtr, PgfExnPtr]],
pgf_read_pgf: [PgfDBPtr, [ref.types.CString, PgfRevisionPtr, PgfProbsCallbackPtr, PgfExnPtr]],
pgf_boot_ngf: [PgfDBPtr, [ref.types.CString, ref.types.CString, PgfRevisionPtr, PgfProbsCallbackPtr, PgfExnPtr]],
pgf_read_ngf: [PgfDBPtr, [ref.types.CString, PgfRevisionPtr, PgfExnPtr]],
pgf_new_ngf: [PgfDBPtr, [PgfTextPtr, ref.types.CString, PgfRevisionPtr, PgfExnPtr]],
pgf_write_pgf: [ref.types.void, [ref.types.CString, PgfDBPtr, PgfRevision, PgfExnPtr]],

View File

@@ -180,7 +180,7 @@ class PGFGrammar {
function readPGF (path: string): PGFGrammar {
const rev = ref.alloc(PgfRevisionPtr)
const err = new PgfExn()
const db = runtime.pgf_read_pgf(path, rev, err.ref())
const db = runtime.pgf_read_pgf(path, rev, null, err.ref())
handleError(err)
return new PGFGrammar(db, rev)
}
@@ -188,7 +188,7 @@ function readPGF (path: string): PGFGrammar {
function bootNGF (pgf_path: string, ngf_path: string): PGFGrammar {
const rev = ref.alloc(PgfRevisionPtr)
const err = new PgfExn()
const db = runtime.pgf_boot_ngf(pgf_path, ngf_path, rev, err.ref())
const db = runtime.pgf_boot_ngf(pgf_path, ngf_path, rev, null, err.ref())
handleError(err)
return new PGFGrammar(db, rev)
}