summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/helpers.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-01-29 19:38:41 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-01-29 19:38:41 (GMT)
commitf782c58bc24df2b500ba163ece2568a434756409 (patch)
treeeb023cdb75a3ba1a2a74f4f888f3ab5bd2aff638 /plugins/pychrysalide/helpers.h
parent4cf3bae97734a9bc380aaed66059c495ecb4c41b (diff)
Create new helpers for constructors of abstract Python objects.
Diffstat (limited to 'plugins/pychrysalide/helpers.h')
-rw-r--r--plugins/pychrysalide/helpers.h34
1 files changed, 25 insertions, 9 deletions
diff --git a/plugins/pychrysalide/helpers.h b/plugins/pychrysalide/helpers.h
index 6b2bddf..348c110 100644
--- a/plugins/pychrysalide/helpers.h
+++ b/plugins/pychrysalide/helpers.h
@@ -163,16 +163,32 @@ bool register_python_module_object(PyObject *, PyTypeObject *);
/* Accompagne la création d'une instance dérivée en Python. */
PyObject *python_constructor_with_dynamic_gtype(PyTypeObject *, PyObject *, PyObject *, PyTypeObject *, GType);
+/* Accompagne la création d'une instance dérivée en Python. */
+PyObject *python_abstract_constructor_with_dynamic_gtype(PyTypeObject *, PyObject *, PyObject *, PyTypeObject *, GType, GClassInitFunc);
+
+
+#define CREATE_DYN_CONSTRUCTOR(pyname, gbase) \
+static PyObject *py_ ## pyname ## _new(PyTypeObject *, PyObject *, PyObject *); \
+static PyObject *py_ ## pyname ## _new(PyTypeObject *type, PyObject *args, PyObject *kwds) \
+{ \
+ PyObject *result; /* Objet à retourner */ \
+ PyTypeObject *base; /* Type de base à dériver */ \
+ base = get_python_ ## pyname ## _type(); \
+ result = python_constructor_with_dynamic_gtype(type, args, kwds, base, gbase); \
+ return result; \
+}
+
-#define CREATE_DYN_CONSTRUCTOR(pyname, gbase) \
-static PyObject *py_ ## pyname ## _new(PyTypeObject *, PyObject *, PyObject *); \
-static PyObject *py_ ## pyname ## _new(PyTypeObject *type, PyObject *args, PyObject *kwds) \
-{ \
- PyObject *result; /* Objet à retourner */ \
- PyTypeObject *base; /* Type de base à dériver */ \
- base = get_python_ ## pyname ## _type(); \
- result = python_constructor_with_dynamic_gtype(type, args, kwds, base, gbase); \
- return result; \
+#define CREATE_DYN_ABSTRACT_CONSTRUCTOR(pyname, gbase, cinit) \
+static PyObject *py_ ## pyname ## _new(PyTypeObject *, PyObject *, PyObject *); \
+static PyObject *py_ ## pyname ## _new(PyTypeObject *type, PyObject *args, PyObject *kwds) \
+{ \
+ PyObject *result; /* Objet à retourner */ \
+ PyTypeObject *base; /* Type de base à dériver */ \
+ base = get_python_ ## pyname ## _type(); \
+ result = python_abstract_constructor_with_dynamic_gtype(type, args, kwds, \
+ base, gbase, (GClassInitFunc)cinit); \
+ return result; \
}