diff options
-rw-r--r-- | plugins/pychrysalide/format/format.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/plugins/pychrysalide/format/format.c b/plugins/pychrysalide/format/format.c index 3709f6d..a0f8079 100644 --- a/plugins/pychrysalide/format/format.c +++ b/plugins/pychrysalide/format/format.c @@ -43,6 +43,9 @@ /* ---------------------------- FORMAT BINAIRE GENERIQUE ---------------------------- */ +/* Assure l'interprétation d'un format en différé. */ +static PyObject *py_binary_format_analyze(PyObject *, PyObject *, PyObject *); + /* Enregistre une adresse comme début d'une zone de code. */ static PyObject *py_binary_format_register_code_point(PyObject *, PyObject *); @@ -104,6 +107,50 @@ static bool define_python_binary_format_constants(PyTypeObject *); /****************************************************************************** * * +* Paramètres : self = contenu binaire à manipuler. * +* args = arguments fournis à l'appel. * +* kwds = arguments de type key=val fournis. * +* * +* Description : Assure l'interprétation d'un format en différé. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static PyObject *py_binary_format_analyze(PyObject *self, PyObject *args, PyObject *kwds) +{ + PyObject *result; /* Bilan à retourner */ + GBinFormat *format; /* Version GLib de l'élément */ + bool status; /* Bilan d'analyse à recevoir */ + +#define BINARY_FORMAT_ANALYZE_METHOD PYTHON_METHOD_DEF \ +( \ + analyze, "$self", \ + METH_NOARGS, py_binary_format, \ + "Analyze the the format recognized from a binary content.\n" \ + "\n" \ + "Once this analysis is done, a few early symbols and the mapped" \ + " sections are expected to be defined.\n" \ + "\n" \ + "The return value is a boolean status of the operation." \ +) + + format = G_BIN_FORMAT(pygobject_get(self)); + + status = g_binary_format_analyze(format, 0, NULL); + + result = status ? Py_True : Py_False; + Py_INCREF(result); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : self = classe représentant un format. * * args = arguments fournis à l'appel. * * * @@ -669,6 +716,7 @@ static bool define_python_binary_format_constants(PyTypeObject *obj_type) PyTypeObject *get_python_binary_format_type(void) { static PyMethodDef py_bin_format_methods[] = { + BINARY_FORMAT_ANALYZE_METHOD, { "register_code_point", py_binary_format_register_code_point, METH_VARARGS, |