summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/format
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/format')
-rw-r--r--plugins/pychrysalide/format/executable.c22
-rw-r--r--plugins/pychrysalide/format/known.c22
-rw-r--r--plugins/pychrysalide/format/program.c20
3 files changed, 38 insertions, 26 deletions
diff --git a/plugins/pychrysalide/format/executable.c b/plugins/pychrysalide/format/executable.c
index 7d05578..f0d3d6b 100644
--- a/plugins/pychrysalide/format/executable.c
+++ b/plugins/pychrysalide/format/executable.c
@@ -47,9 +47,9 @@
/* Initialise la classe des formats exécutables. */
-static void py_executable_format_init_gclass(GExecutableFormatClass *, gpointer);
+static int py_executable_format_init_gclass(GExecutableFormatClass *, PyTypeObject *);
-CREATE_DYN_ABSTRACT_CONSTRUCTOR(executable_format, G_TYPE_EXECUTABLE_FORMAT, py_executable_format_init_gclass);
+CREATE_DYN_ABSTRACT_CONSTRUCTOR(executable_format, G_TYPE_EXECUTABLE_FORMAT);
/* Initialise une instance sur la base du dérivé de GObject. */
static int py_executable_format_init(PyObject *, PyObject *, PyObject *);
@@ -95,23 +95,25 @@ static PyObject *py_executable_format_get_portions(PyObject *, void *);
/******************************************************************************
* *
-* Paramètres : class = classe à initialiser. *
-* unused = données non utilisées ici. *
+* Paramètres : gclass = classe GLib à initialiser. *
+* pyclass = classe Python à initialiser. *
* *
* Description : Initialise la classe des formats exécutables. *
* *
-* Retour : - *
+* Retour : 0 pour indiquer un succès de l'opération. *
* *
* Remarques : - *
* *
******************************************************************************/
-static void py_executable_format_init_gclass(GExecutableFormatClass *class, gpointer unused)
+static int py_executable_format_init_gclass(GExecutableFormatClass *gclass, PyTypeObject *pyclass)
{
- class->get_machine = py_executable_format_get_target_machine_wrapper;
+ PY_CLASS_SET_WRAPPER(gclass->get_machine, py_executable_format_get_target_machine_wrapper);
- class->get_main_addr = py_executable_format_get_main_address_wrapper;
- class->refine_portions = py_executable_format_refine_portions_wrapper;
+ PY_CLASS_SET_WRAPPER(gclass->get_main_addr, py_executable_format_get_main_address_wrapper);
+ PY_CLASS_SET_WRAPPER(gclass->refine_portions, py_executable_format_refine_portions_wrapper);
+
+ return 0;
}
@@ -784,6 +786,8 @@ bool ensure_python_executable_format_is_registered(void)
if (!ensure_python_program_format_is_registered())
return false;
+ pyg_register_class_init(G_TYPE_EXECUTABLE_FORMAT, (PyGClassInitFunc)py_executable_format_init_gclass);
+
if (!register_class_for_pygobject(dict, G_TYPE_EXECUTABLE_FORMAT, type))
return false;
diff --git a/plugins/pychrysalide/format/known.c b/plugins/pychrysalide/format/known.c
index 5df2a8f..856c087 100644
--- a/plugins/pychrysalide/format/known.c
+++ b/plugins/pychrysalide/format/known.c
@@ -42,9 +42,9 @@
/* Initialise la classe des descriptions de fichier binaire. */
-static void py_known_format_init_gclass(GKnownFormatClass *, gpointer);
+static int py_known_format_init_gclass(GKnownFormatClass *, PyTypeObject *);
-CREATE_DYN_ABSTRACT_CONSTRUCTOR(known_format, G_TYPE_KNOWN_FORMAT, py_known_format_init_gclass);
+CREATE_DYN_ABSTRACT_CONSTRUCTOR(known_format, G_TYPE_KNOWN_FORMAT);
/* Initialise une instance sur la base du dérivé de GObject. */
static int py_known_format_init(PyObject *, PyObject *, PyObject *);
@@ -84,23 +84,25 @@ static PyObject *py_known_format_get_content(PyObject *, void *);
/******************************************************************************
* *
-* Paramètres : class = classe à initialiser. *
-* unused = données non utilisées ici. *
+* Paramètres : gclass = classe GLib à initialiser. *
+* pyclass = classe Python à initialiser. *
* *
* Description : Initialise la classe des formats connus. *
* *
-* Retour : - *
+* Retour : 0 pour indiquer un succès de l'opération. *
* *
* Remarques : - *
* *
******************************************************************************/
-static void py_known_format_init_gclass(GKnownFormatClass *class, gpointer unused)
+static int py_known_format_init_gclass(GKnownFormatClass *gclass, PyTypeObject *pyclass)
{
- class->get_key = py_known_format_get_key_wrapper;
- class->get_desc = py_known_format_get_description_wrapper;
+ PY_CLASS_SET_WRAPPER(gclass->get_key, py_known_format_get_key_wrapper);
+ PY_CLASS_SET_WRAPPER(gclass->get_desc, py_known_format_get_description_wrapper);
- class->analyze = py_known_format_analyze_wrapper;
+ PY_CLASS_SET_WRAPPER(gclass->analyze, py_known_format_analyze_wrapper);
+
+ return 0;
}
@@ -635,6 +637,8 @@ bool ensure_python_known_format_is_registered(void)
dict = PyModule_GetDict(module);
+ pyg_register_class_init(G_TYPE_KNOWN_FORMAT, (PyGClassInitFunc)py_known_format_init_gclass);
+
if (!register_class_for_pygobject(dict, G_TYPE_KNOWN_FORMAT, type))
return false;
diff --git a/plugins/pychrysalide/format/program.c b/plugins/pychrysalide/format/program.c
index 01b9703..57a359a 100644
--- a/plugins/pychrysalide/format/program.c
+++ b/plugins/pychrysalide/format/program.c
@@ -55,9 +55,9 @@
/* Initialise la classe des formats de programmes. */
-static void py_program_format_init_gclass(GProgramFormatClass *, gpointer);
+static int py_program_format_init_gclass(GProgramFormatClass *, PyTypeObject *);
-CREATE_DYN_ABSTRACT_CONSTRUCTOR(program_format, G_TYPE_PROGRAM_FORMAT, py_program_format_init_gclass);
+CREATE_DYN_ABSTRACT_CONSTRUCTOR(program_format, G_TYPE_PROGRAM_FORMAT);
/* Initialise une instance sur la base du dérivé de GObject. */
static int py_program_format_init(PyObject *, PyObject *, PyObject *);
@@ -140,21 +140,23 @@ static PyObject *py_program_format_get_errors(PyObject *, void *);
/******************************************************************************
* *
-* Paramètres : class = classe à initialiser. *
-* unused = données non utilisées ici. *
+* Paramètres : gclass = classe GLib à initialiser. *
+* pyclass = classe Python à initialiser. *
* *
* Description : Initialise la classe des formats de programmes. *
* *
-* Retour : - *
+* Retour : 0 pour indiquer un succès de l'opération. *
* *
* Remarques : - *
* *
******************************************************************************/
-static void py_program_format_init_gclass(GProgramFormatClass *class, gpointer unused)
+static int py_program_format_init_gclass(GProgramFormatClass *gclass, PyTypeObject *pyclass)
{
- class->get_endian = py_program_format_get_endianness_wrapper;
- class->find_range_by_name = py_program_format_find_section_range_by_name_wrapper;
+ PY_CLASS_SET_WRAPPER(gclass->get_endian, py_program_format_get_endianness_wrapper);
+ PY_CLASS_SET_WRAPPER(gclass->find_range_by_name, py_program_format_find_section_range_by_name_wrapper);
+
+ return 0;
}
@@ -1273,6 +1275,8 @@ bool ensure_python_program_format_is_registered(void)
if (!ensure_python_known_format_is_registered())
return false;
+ pyg_register_class_init(G_TYPE_PROGRAM_FORMAT, (PyGClassInitFunc)py_program_format_init_gclass);
+
if (!register_class_for_pygobject(dict, G_TYPE_PROGRAM_FORMAT, type))
return false;