From 9cbb342f0c697bad082d8817513cd9771ade1b1f Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 8 May 2019 17:53:00 +0200 Subject: Defined an improved generic macro for Python methods. --- plugins/dex/python/format.c | 4 ++-- plugins/dex/python/pool.c | 20 ++++++++++---------- plugins/pychrysalide/helpers.h | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugins/dex/python/format.c b/plugins/dex/python/format.c index 9bbbfbd..f798981 100644 --- a/plugins/dex/python/format.c +++ b/plugins/dex/python/format.c @@ -124,8 +124,8 @@ static PyObject *py_dex_format_read_type_list(PyObject *self, PyObject *args) #define DEX_POOL_READ_TYPE_LIST_METHOD PYTHON_METHOD_DEF \ ( \ - "read_type_list", "$self, offset, /", \ - METH_VARARGS, py_dex_format_read_type_list, \ + read_type_list, "$self, offset, /", \ + METH_VARARGS, py_dex_format, \ "Provide the raw data of a given type list as an array of pychrysalide.PyStructObject" \ " instances." \ "\n" \ diff --git a/plugins/dex/python/pool.c b/plugins/dex/python/pool.c index 695e07f..971f163 100644 --- a/plugins/dex/python/pool.c +++ b/plugins/dex/python/pool.c @@ -102,8 +102,8 @@ static PyObject *py_dex_pool_get_raw_type(PyObject *self, PyObject *args) #define DEX_POOL_GET_RAW_TYPE_METHOD PYTHON_METHOD_DEF \ ( \ - "get_raw_type", "$self, index, /", \ - METH_VARARGS, py_dex_pool_get_raw_type, \ + get_raw_type, "$self, index, /", \ + METH_VARARGS, py_dex_pool, \ "Provide the raw data of a given type in the Dex pool as a pychrysalide.PyStructObject" \ " instance." \ "\n" \ @@ -160,8 +160,8 @@ static PyObject *py_dex_pool_get_raw_field(PyObject *self, PyObject *args) #define DEX_POOL_GET_RAW_FIELD_METHOD PYTHON_METHOD_DEF \ ( \ - "get_raw_field", "$self, index, /", \ - METH_VARARGS, py_dex_pool_get_raw_field, \ + get_raw_field, "$self, index, /", \ + METH_VARARGS, py_dex_pool, \ "Provide the raw data of a given field in the Dex pool as a pychrysalide.PyStructObject" \ " instance." \ "\n" \ @@ -220,8 +220,8 @@ static PyObject *py_dex_pool_get_raw_prototype(PyObject *self, PyObject *args) #define DEX_POOL_GET_RAW_PROTOTYPE_METHOD PYTHON_METHOD_DEF \ ( \ - "get_raw_prototype", "$self, index, /", \ - METH_VARARGS, py_dex_pool_get_raw_prototype, \ + get_raw_prototype, "$self, index, /", \ + METH_VARARGS, py_dex_pool, \ "Provide the raw data of a given prototype in the Dex pool as a pychrysalide.PyStructObject" \ " instance." \ "\n" \ @@ -280,8 +280,8 @@ static PyObject *py_dex_pool_get_raw_method(PyObject *self, PyObject *args) #define DEX_POOL_GET_RAW_METHOD_METHOD PYTHON_METHOD_DEF \ ( \ - "get_raw_method", "$self, index, /", \ - METH_VARARGS, py_dex_pool_get_raw_method, \ + get_raw_method, "$self, index, /", \ + METH_VARARGS, py_dex_pool, \ "Provide the raw data of a given method in the Dex pool as a pychrysalide.PyStructObject" \ " instance." \ "\n" \ @@ -340,8 +340,8 @@ static PyObject *py_dex_pool_get_raw_class(PyObject *self, PyObject *args) #define DEX_POOL_GET_RAW_CLASS_METHOD PYTHON_METHOD_DEF \ ( \ - "get_raw_class", "$self, index, /", \ - METH_VARARGS, py_dex_pool_get_raw_class, \ + get_raw_class, "$self, index, /", \ + METH_VARARGS, py_dex_pool, \ "Provide the raw data of a given class in the Dex pool as a pychrysalide.PyStructObject" \ " instance." \ "\n" \ diff --git a/plugins/pychrysalide/helpers.h b/plugins/pychrysalide/helpers.h index ca393db..d30a307 100644 --- a/plugins/pychrysalide/helpers.h +++ b/plugins/pychrysalide/helpers.h @@ -83,11 +83,11 @@ bool register_python_module_object(PyObject *, PyTypeObject *); * Aide à la définition de documentation pour Python. */ -#define PYTHON_METHOD_DEF(name, args, flags, meth, doc) \ +#define PYTHON_METHOD_DEF(name, args, flags, base, doc) \ { \ - name, meth, \ + #name, base ## _ ## name, \ flags, \ - name "(" args ")\n--\n\n" doc \ + #name "(" args ")\n--\n\n" doc \ } #define PYTHON_GETSET_DEF(name, get, set, doc, closure) \ -- cgit v0.11.2-87-g4458