diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2019-01-31 19:04:18 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2019-01-31 19:04:18 (GMT) |
commit | e7325a7e273ea1df59aa949cf8b2614e1e6eb46e (patch) | |
tree | f659e4932744344093cde619613fab13ad2cab62 /plugins | |
parent | 5efaafe278314051661c99c1e33a00d0883025a6 (diff) |
Extended the Python API for symbols.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/pychrysalide/format/symbol.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/plugins/pychrysalide/format/symbol.c b/plugins/pychrysalide/format/symbol.c index c948423..bb58f64 100644 --- a/plugins/pychrysalide/format/symbol.c +++ b/plugins/pychrysalide/format/symbol.c @@ -60,6 +60,9 @@ static PyObject *py_binary_symbol_get_label(PyObject *, void *); /* Fournit l'emplacement où se situe un symbole. */ static PyObject *py_binary_symbol_get_range(PyObject *, void *); +/* Définit la couverture physique / en mémoire d'un symbole. */ +static int py_binary_symbol_set_range(PyObject *, PyObject *, void *); + /* Fournit la visibilité du symbole. */ static PyObject *py_binary_symbol_get_status(PyObject *, void *); @@ -295,6 +298,40 @@ static PyObject *py_binary_symbol_get_range(PyObject *self, void *closure) /****************************************************************************** * * * Paramètres : self = objet Python concerné par l'appel. * +* value = valeur fournie à intégrer ou prendre en compte. * +* closure = adresse non utilisée ici. * +* * +* Description : Définit la couverture physique / en mémoire d'un symbole. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static int py_binary_symbol_set_range(PyObject *self, PyObject *value, void *closure) +{ + int ret; /* Bilan d'analyse */ + mrange_t *range; /* Espace mémoire à manipuler */ + GBinSymbol *symbol; /* Elément à consulter */ + + ret = PyObject_IsInstance(value, (PyObject *)get_python_mrange_type()); + if (!ret) return -1; + + range = get_internal_mrange(value); + + symbol = G_BIN_SYMBOL(pygobject_get(self)); + + g_binary_symbol_set_range(symbol, range); + + return 0; + +} + + +/****************************************************************************** +* * +* Paramètres : self = objet Python concerné par l'appel. * * closure = non utilisé ici. * * * * Description : Fournit la visibilité du symbole. * @@ -391,7 +428,7 @@ PyTypeObject *get_python_binary_symbol_type(void) "Label of the symbol, provided by the internal component or by an alternative label.", NULL }, { - "range", py_binary_symbol_get_range, NULL, + "range", py_binary_symbol_get_range, py_binary_symbol_set_range, "Range covered by the symbol.", NULL }, { |