summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/analysis/roptions.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/analysis/roptions.c')
-rw-r--r--plugins/pychrysa/analysis/roptions.c276
1 files changed, 0 insertions, 276 deletions
diff --git a/plugins/pychrysa/analysis/roptions.c b/plugins/pychrysa/analysis/roptions.c
deleted file mode 100644
index 72e99e5..0000000
--- a/plugins/pychrysa/analysis/roptions.c
+++ /dev/null
@@ -1,276 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * roptions.c - équivalent Python du fichier "analysis/roptions.h"
- *
- * Copyright (C) 2010-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * OpenIDA is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * OpenIDA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "roptions.h"
-
-
-#include <pygobject.h>
-
-
-#include "../format/executable.h"
-
-
-
-
-/* Classe 'analysis.roptions' pour Python */
-typedef struct _py_rendering_options
-{
- PyObject_HEAD
-
- GRenderingOptions *glib; /* Options réelles manipulées */
-
-} py_rendering_options;
-
-
-
-
-/* Crée un nouvel objet Python de type 'py_rendering_options'. */
-static PyObject *py_rendering_options_new(PyTypeObject *, PyObject *, PyObject *);
-
-
-
-/* Indique si les adresses des instructions sont à afficher. */
-static PyObject *py_rendering_options_get_show_address(PyObject *, void *);
-
-/* Affiche (ou non) les adresses des instructions. */
-static int py_rendering_options_set_show_address(PyObject *, PyObject *, void *);
-
-
-
-
-/* Affiche (ou non) le code des instructions. */
-static PyObject *py_rendering_options_show_code(PyObject *, PyObject *);
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : type = type de l'objet à instancier. *
-* args = arguments fournis à l'appel. *
-* kwds = arguments de type key=val fournis. *
-* *
-* Description : Crée un nouvel objet Python de type 'py_rendering_options'. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_rendering_options_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- py_rendering_options *result; /* Instance à retourner */
- PyObject *executable; /* Format d'exécutable joint */
- int ret; /* Bilan de lecture des args. */
- GExeFormat *_executable; /* Version GLib du format */
-
- ret = PyArg_ParseTuple(args, "O", &executable);
- if (!ret) Py_RETURN_NONE;
-
- result = (py_rendering_options *)type->tp_alloc(type, 0);
-
- _executable = G_EXE_FORMAT(pygobject_get(executable));
- if (_executable == NULL) return NULL;
-
- g_object_ref(G_OBJECT(_executable));
- result->glib = g_rendering_options_new(_executable);
-
- return (PyObject *)result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : roptions = instance Python dont la référence est à donner. *
-* *
-* Description : Fournit l'instance GLib d'une instance Python. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRenderingOptions *py_rendering_options_get_glib_instance(PyObject *roptions)
-{
- return ((py_rendering_options *)roptions)->glib;
-
-}
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe présentant des options de représentation. *
-* data = adresse non utilisée ici. *
-* *
-* Description : Indique si les adresses des instructions sont à afficher. *
-* *
-* Retour : Valeur booléenne indiquant le statut d'une option. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_rendering_options_get_show_address(PyObject *self, void *data)
-{
-
- printf(" -->> get address\n");
-
- return Py_BuildValue("i", true);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe présentant des options de représentation. *
-* value = nouvelle valeur affectée. *
-* data = adresse non utilisée ici. *
-* *
-* Description : Affiche (ou non) les adresses des instructions. *
-* *
-* Retour : Bilan de la mise à jour. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static int py_rendering_options_set_show_address(PyObject *self, PyObject *value, void *data)
-{
- printf(" -->> set address\n");
-
- return 0;
-
-}
-
-
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe assurant le lien avec l'éditeur de messages. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Affiche (ou non) le code des instructions. *
-* *
-* Retour : Rien en équivalent Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_rendering_options_show_code(PyObject *self, PyObject *args)
-{
- int state; /* Nouveau statut d'affichage */
-
- if (!PyArg_ParseTuple(args, "i", &state))
- return NULL;
-
-
-
-
- printf("show code :: %d\n", state);
-
- Py_RETURN_NONE;
-
-}
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Ajoute l'objet 'analysis.roptions' au module Python. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool add_analysis_roptions_to_python_module(PyObject *module)
-{
- int ret; /* Bilan d'un appel */
-
- static PyMethodDef py_rendering_options_methods[] = {
- {
- "show_code", (PyCFunction)py_rendering_options_show_code,
- METH_VARARGS,
- "Define if the binary code has to be processed or not."
- },
- { NULL }
- };
-
- static PyGetSetDef py_rendering_options_getset[] = {
- {
- "show_address",
- (getter)py_rendering_options_get_show_address,
- (setter)py_rendering_options_set_show_address,
- "Define or retrieve if the instruction address need to be shown."
- },
- { NULL }
- };
-
- static PyTypeObject py_rendering_options_type = {
-
- PyObject_HEAD_INIT(NULL)
-
- .tp_name = "pyoida.analysis.RenderingOptions",
- .tp_basicsize = sizeof(py_rendering_options),
-
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-
- .tp_doc = "PyOIDA rendering options",
-
- .tp_methods = py_rendering_options_methods,
- .tp_getset = py_rendering_options_getset,
- .tp_new = (newfunc)py_rendering_options_new
-
- };
-
- if (PyType_Ready(&py_rendering_options_type) < 0)
- return false;
-
- Py_INCREF(&py_rendering_options_type);
- ret = PyModule_AddObject(module, "RenderingOptions", (PyObject *)&py_rendering_options_type);
-
- return (ret == 0);
-
-}