1
0
forked from GitHub/gf-core

Fix compilation errors of Python bindings on macOS

This commit is contained in:
John J. Camilleri
2021-10-18 08:27:19 +02:00
parent c9b668a583
commit 61e95bcfeb
4 changed files with 18 additions and 21 deletions

View File

@@ -1,5 +1,9 @@
# Python bindings to C runtime # Python bindings to C runtime
## Compatibility
These bindings do not support Python 2. Python 3 is assumed in all these instructions.
## Pre-requisites ## Pre-requisites
1. You must have installed the PGF C runtime (see `../c/README.md`) 1. You must have installed the PGF C runtime (see `../c/README.md`)
@@ -26,10 +30,3 @@ pytest
``` ```
Requires: `pip install pytest` Requires: `pip install pytest`
## Debugging
valgrind --leak-check=full --show-leak-kinds=all pytest 2> valgrind.txt
valgrind --leak-check=full --show-leak-kinds=all -- python -c 'import pgf; s = pgf.readType("A -> B"); print(s)' 2> valgrind.txt

View File

@@ -13,7 +13,7 @@ typedef struct {
PyObject *exprs; // PyTupleObject of ExprObject PyObject *exprs; // PyTupleObject of ExprObject
} TypeObject; } TypeObject;
PyTypeObject pgf_TypeType; extern PyTypeObject pgf_TypeType;
// typedef struct { // typedef struct {
// PyObject_HEAD // PyObject_HEAD
@@ -72,14 +72,14 @@ typedef struct {
ExprObject *expr; ExprObject *expr;
} ExprImplArgObject; } ExprImplArgObject;
PyTypeObject pgf_ExprType; extern PyTypeObject pgf_ExprType;
PyTypeObject pgf_ExprAbsType; extern PyTypeObject pgf_ExprAbsType;
PyTypeObject pgf_ExprAppType; extern PyTypeObject pgf_ExprAppType;
PyTypeObject pgf_ExprLitType; extern PyTypeObject pgf_ExprLitType;
PyTypeObject pgf_ExprMetaType; extern PyTypeObject pgf_ExprMetaType;
PyTypeObject pgf_ExprFunType; extern PyTypeObject pgf_ExprFunType;
PyTypeObject pgf_ExprVarType; extern PyTypeObject pgf_ExprVarType;
PyTypeObject pgf_ExprTypedType; extern PyTypeObject pgf_ExprTypedType;
PyTypeObject pgf_ExprImplArgType; extern PyTypeObject pgf_ExprImplArgType;
#endif // PYPGF_EXPR_H_ #endif // PYPGF_EXPR_H_

View File

@@ -12,7 +12,7 @@ typedef struct {
PgfRevision revision; PgfRevision revision;
} PGFObject; } PGFObject;
PyObject *PGFError; extern PyObject *PGFError;
PgfExnType handleError(PgfExn err); PgfExnType handleError(PgfExn err);
PgfText *CString_AsPgfText(const char *s, size_t size); PgfText *CString_AsPgfText(const char *s, size_t size);
@@ -29,7 +29,7 @@ void FreePgfText(PgfText *txt);
void FreeHypos(PgfTypeHypo *hypos, Py_ssize_t n_hypos); void FreeHypos(PgfTypeHypo *hypos, Py_ssize_t n_hypos);
void FreePgfPrintContext(PgfPrintContext *ctxt); void FreePgfPrintContext(PgfPrintContext *ctxt);
PgfUnmarshaller unmarshaller; extern PgfUnmarshaller unmarshaller;
PgfMarshaller marshaller; extern PgfMarshaller marshaller;
#endif // PYPGF_FFI_H_ #endif // PYPGF_FFI_H_

View File

@@ -12,7 +12,7 @@ typedef struct {
PgfRevision revision; // transient branch PgfRevision revision; // transient branch
} TransactionObject; } TransactionObject;
PyTypeObject pgf_TransactionType; extern PyTypeObject pgf_TransactionType;
PyObject *PGF_checkoutBranch(PGFObject *self, PyObject *args); PyObject *PGF_checkoutBranch(PGFObject *self, PyObject *args);