summaryrefslogtreecommitdiff
path: root/plugins/dex/python/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/dex/python/class.c')
-rw-r--r--plugins/dex/python/class.c137
1 files changed, 90 insertions, 47 deletions
diff --git a/plugins/dex/python/class.c b/plugins/dex/python/class.c
index 82c893e..e344124 100644
--- a/plugins/dex/python/class.c
+++ b/plugins/dex/python/class.c
@@ -37,6 +37,10 @@
+#define DEX_CLASS_DOC \
+ "The DexClass object handles a class defined in a DEX file."
+
+
/* Fournit la définition brute d'une classe. */
static PyObject *py_dex_class_get_definition(PyObject *, void *);
@@ -44,13 +48,13 @@ static PyObject *py_dex_class_get_definition(PyObject *, void *);
static PyObject *py_dex_class_get_data(PyObject *, void *);
/* Indique le type Android d'une classe. */
-static PyObject *py_dex_class_get_class_type(PyObject *, void *);
+static PyObject *py_dex_class_get_type(PyObject *, void *);
/* Indique le type Android parent d'une classe. */
-static PyObject *py_dex_class_get_superclass_type(PyObject *, void *);
+static PyObject *py_dex_class_get_super(PyObject *, void *);
/* Indique le type Android des interfaces d'une classe. */
-static PyObject *py_dex_class_get_interface_types(PyObject *, void *);
+static PyObject *py_dex_class_get_interfaces(PyObject *, void *);
/* Fournit les champs chargés correspondant à une classe donnée. */
static PyObject *py_dex_class_get_fields(PyObject *, void *);
@@ -82,6 +86,12 @@ static PyObject *py_dex_class_get_definition(PyObject *self, void *closure)
GDexClass *class; /* Version native */
const class_def_item *item; /* Elément à traiter */
+#define DEX_CLASS_DEFINITION_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ definition, py_dex_class, \
+ "Native definition of the Dex class." \
+)
+
class = G_DEX_CLASS(pygobject_get(self));
item = g_dex_class_get_definition(class);
@@ -112,6 +122,12 @@ static PyObject *py_dex_class_get_data(PyObject *self, void *closure)
GDexClass *class; /* Version native */
const class_data_item *item; /* Elément à traiter */
+#define DEX_CLASS_DATA_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ data, py_dex_class, \
+ "Native data of the Dex class, if any." \
+)
+
class = G_DEX_CLASS(pygobject_get(self));
item = g_dex_class_get_data(class);
@@ -143,12 +159,18 @@ static PyObject *py_dex_class_get_data(PyObject *self, void *closure)
* *
******************************************************************************/
-static PyObject *py_dex_class_get_class_type(PyObject *self, void *closure)
+static PyObject *py_dex_class_get_type(PyObject *self, void *closure)
{
PyObject *result; /* Valeur à retourner */
GDexClass *class; /* Version native */
GDataType *type; /* Type de classe */
+#define DEX_CLASS_TYPE_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ type, py_dex_class, \
+ "Android type of the Dex class, None on error." \
+)
+
class = G_DEX_CLASS(pygobject_get(self));
type = g_dex_class_get_class_type(class);
@@ -185,12 +207,18 @@ static PyObject *py_dex_class_get_class_type(PyObject *self, void *closure)
* *
******************************************************************************/
-static PyObject *py_dex_class_get_superclass_type(PyObject *self, void *closure)
+static PyObject *py_dex_class_get_super(PyObject *self, void *closure)
{
PyObject *result; /* Valeur à retourner */
GDexClass *class; /* Version native */
GDataType *type; /* Type de classe */
+#define DEX_CLASS_SUPER_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ super, py_dex_class, \
+ "Android type of the parent Dex class, None on error." \
+)
+
class = G_DEX_CLASS(pygobject_get(self));
type = g_dex_class_get_superclass_type(class);
@@ -227,7 +255,7 @@ static PyObject *py_dex_class_get_superclass_type(PyObject *self, void *closure)
* *
******************************************************************************/
-static PyObject *py_dex_class_get_interface_types(PyObject *self, void *closure)
+static PyObject *py_dex_class_get_interfaces(PyObject *self, void *closure)
{
PyObject *result; /* Valeur à retourner */
GDexClass *class; /* Version native */
@@ -236,6 +264,13 @@ static PyObject *py_dex_class_get_interface_types(PyObject *self, void *closure)
size_t i; /* Boucle de parcours */
PyObject *type; /* Type à ajouter à la liste */
+#define DEX_CLASS_INTERFACES_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ interfaces, py_dex_class, \
+ "Interface Android types of the Dex class, None if none and" \
+ " None on error." \
+)
+
class = G_DEX_CLASS(pygobject_get(self));
types = g_dex_class_get_interface_types(class, &count);
@@ -300,6 +335,22 @@ static PyObject *py_dex_class_get_fields(PyObject *self, void *closure)
GDexField *field; /* Champ à convertir */
PyObject *fld; /* Objet à ajouter à la liste */
+#define DEX_CLASS_STATIC_FIELDS_ATTRIB PYTHON_GETSET_DEF \
+( \
+ "static_fields", py_dex_class_get_fields, NULL, \
+ "List of static fields of the Dex class, None if none and" \
+ " None on error.", \
+ NULL \
+)
+
+#define DEX_CLASS_INSTANCE_FIELDS_ATTRIB PYTHON_GETSET_DEF \
+( \
+ "static_fields", py_dex_class_get_fields, NULL, \
+ "List of instance fields of the Dex class, None if none and" \
+ " None on error.", \
+ (void *)1 \
+)
+
class = G_DEX_CLASS(pygobject_get(self));
instance = (closure != NULL);
@@ -365,6 +416,22 @@ static PyObject *py_dex_class_get_methods(PyObject *self, void *closure)
GDexMethod *method; /* Méthode à convertir */
PyObject *meth; /* Objet à ajouter à la liste */
+#define DEX_CLASS_DIRECT_METHODS_ATTRIB PYTHON_GETSET_DEF \
+( \
+ "direct_methods", py_dex_class_get_methods, NULL, \
+ "List of direct methods of the Dex class, None if none and" \
+ " None on error.", \
+ (void *)1 \
+)
+
+#define DEX_CLASS_VIRTUAL_METHODS_ATTRIB PYTHON_GETSET_DEF \
+( \
+ "virtual_methods", py_dex_class_get_methods, NULL, \
+ "List of virtual methods of the Dex class, None if none and" \
+ " None on error.", \
+ NULL \
+)
+
class = G_DEX_CLASS(pygobject_get(self));
virtual = (closure == NULL);
@@ -426,6 +493,12 @@ static PyObject *py_dex_class_get_source_file(PyObject *self, void *closure)
GDexClass *class; /* Version native */
const char *file; /* Fichier à l'origine du code */
+#define DEX_CLASS_SOURCE_FILE_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ source_file, py_dex_class, \
+ "Source file of the Dex class, None on error." \
+)
+
class = G_DEX_CLASS(pygobject_get(self));
file = g_dex_class_get_source_file(class);
@@ -463,46 +536,16 @@ PyTypeObject *get_python_dex_class_type(void)
};
static PyGetSetDef py_dex_class_getseters[] = {
- {
- "definition", py_dex_class_get_definition, NULL,
- "Native definition of the Dex class.", NULL
- },
- {
- "data", py_dex_class_get_data, NULL,
- "Native data of the Dex class, if any.", NULL
- },
- {
- "type", py_dex_class_get_class_type, NULL,
- "Android type of the Dex class, None on error.", NULL
- },
- {
- "super", py_dex_class_get_superclass_type, NULL,
- "Android type of the parent Dex class, None on error.", NULL
- },
- {
- "interfaces", py_dex_class_get_interface_types, NULL,
- "Interface Android types of the Dex class, None if none and None on error.", NULL
- },
- {
- "static_fields", py_dex_class_get_fields, NULL,
- "List of static fields of the Dex class, None if none and None on error.", NULL
- },
- {
- "instance_fields", py_dex_class_get_fields, NULL,
- "List of static fields of the Dex class, None if none and None on error.", py_dex_class_get_fields
- },
- {
- "direct_methods", py_dex_class_get_methods, NULL,
- "List of direct methods of the Dex class, None if none and None on error.", py_dex_class_get_methods
- },
- {
- "virtual_methods", py_dex_class_get_methods, NULL,
- "List of virtual methods of the Dex class, None if none and None on error.", NULL
- },
- {
- "source_file", py_dex_class_get_source_file, NULL,
- "Source file of the Dex class, None on error.", NULL
- },
+ DEX_CLASS_DEFINITION_ATTRIB,
+ DEX_CLASS_DATA_ATTRIB,
+ DEX_CLASS_TYPE_ATTRIB,
+ DEX_CLASS_SUPER_ATTRIB,
+ DEX_CLASS_INTERFACES_ATTRIB,
+ DEX_CLASS_STATIC_FIELDS_ATTRIB,
+ DEX_CLASS_INSTANCE_FIELDS_ATTRIB,
+ DEX_CLASS_DIRECT_METHODS_ATTRIB,
+ DEX_CLASS_VIRTUAL_METHODS_ATTRIB,
+ DEX_CLASS_SOURCE_FILE_ATTRIB,
{ NULL }
};
@@ -515,7 +558,7 @@ PyTypeObject *get_python_dex_class_type(void)
.tp_flags = Py_TPFLAGS_DEFAULT,
- .tp_doc = "PyChrysalide Dex class.",
+ .tp_doc = DEX_CLASS_DOC,
.tp_methods = py_dex_class_methods,
.tp_getset = py_dex_class_getseters