summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/analysis/db/items/comment.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-01-16 19:02:56 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-01-16 19:02:56 (GMT)
commit9da8f8b37e3edebc917b4e223dd2447cd7cbc818 (patch)
tree3f330b13e7ca2a0a163882be3043ca9571f25211 /plugins/pychrysa/analysis/db/items/comment.c
parenteb9b7fd76451db5c9f07a800c0394480e4b88c9c (diff)
Changed the Python bindings source directory and updated code.
Diffstat (limited to 'plugins/pychrysa/analysis/db/items/comment.c')
-rw-r--r--plugins/pychrysa/analysis/db/items/comment.c241
1 files changed, 0 insertions, 241 deletions
diff --git a/plugins/pychrysa/analysis/db/items/comment.c b/plugins/pychrysa/analysis/db/items/comment.c
deleted file mode 100644
index 28886f5..0000000
--- a/plugins/pychrysa/analysis/db/items/comment.c
+++ /dev/null
@@ -1,241 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * comment.c - équivalent Python du fichier "analysis/db/items/comment.c"
- *
- * Copyright (C) 2014-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide 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.
- *
- * Chrysalide 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 "comment.h"
-
-
-#include <malloc.h>
-#include <pygobject.h>
-
-
-#include <i18n.h>
-#include <analysis/db/items/comment.h>
-
-
-#include "../item.h"
-#include "../../../helpers.h"
-#include "../../../arch/vmpa.h"
-
-
-
-/* Crée un nouvel objet Python de type 'DbComment'. */
-static PyObject *py_db_comment_new(PyTypeObject *, PyObject *, PyObject *);
-
-/* Fournit le commentaire associé à un commentaire. */
-static PyObject *py_db_comment_get_text(PyObject *, void *);
-
-/* Définit le commentaire associé à un commentaire. */
-static int py_db_comment_set_text(PyObject *, PyObject *, void *);
-
-
-
-/******************************************************************************
-* *
-* 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 'DbComment'. *
-* *
-* Retour : Instance Python mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_db_comment_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- PyObject *result; /* Instance à retourner */
- PyObject *py_vmpa; /* Localisation version Python */
- const char *text; /* Texte à associer */
- int is_volatile; /* Conservation en mémoire */
- int ret; /* Bilan de lecture des args. */
- vmpa2t *addr; /* Localisation version C */
- GDbComment *comment; /* Version GLib du commentaire */
-
- ret = PyArg_ParseTuple(args, "Osp", &py_vmpa, &text, &is_volatile);
- if (!ret) Py_RETURN_NONE;
-
- ret = PyObject_IsInstance(py_vmpa, (PyObject *)get_python_vmpa_type());
- if (!ret) return NULL;
-
- addr = get_internal_vmpa(py_vmpa);
- if (py_vmpa == NULL) Py_RETURN_NONE;
-
- return NULL;/* FIXME */
- //comment = g_db_comment_new(addr, text, is_volatile);
-
- result = pygobject_new(G_OBJECT(comment));
- g_object_unref(comment);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* closure = non utilisé ici. *
-* *
-* Description : Fournit le commentaire associé à un commentaire. *
-* *
-* Retour : Texte manipulable en Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_db_comment_get_text(PyObject *self, void *closure)
-{
- PyObject *result; /* Résultat à retourner */
- GDbComment *comment; /* Commentaire à consulter */
- char *text; /* Contenu textuel associé */
-
- comment = G_DB_COMMENT(pygobject_get(self));
- text = g_db_comment_get_text(comment);
-
- if (text == NULL)
- {
- result = Py_None;
- Py_INCREF(result);
- }
- else
- {
- result = PyUnicode_FromString(text);
- free(text);
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* value = valeur fournie à intégrer ou prendre en compte. *
-* closure = non utilisé ici. *
-* *
-* Description : Définit le commentaire associé à un commentaire. *
-* *
-* Retour : Bilan de l'opération pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static int py_db_comment_set_text(PyObject *self, PyObject *value, void *closure)
-{
- GDbComment *comment; /* Commentaire à consulter */
-
- if (!PyUnicode_Check(value))
- {
- PyErr_SetString(PyExc_TypeError, _("The attribute value must be a string."));
- return -1;
- }
-
- comment = G_DB_COMMENT(pygobject_get(self));
- //g_db_comment_set_text(comment, PyUnicode_DATA(value));
-
- return 0;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_db_comment_type(void)
-{
- static PyMethodDef py_db_comment_methods[] = {
- { NULL }
- };
-
- static PyGetSetDef py_db_comment_getseters[] = {
- {
- "text", py_db_comment_get_text, py_db_comment_set_text,
- "Give access to the content of a given comment.", NULL
- },
- { NULL }
- };
-
- static PyTypeObject py_db_comment_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.analysis.db.items.DbComment",
- .tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT,
-
- .tp_doc = "PyChrysalide comment for edited binary",
-
- .tp_methods = py_db_comment_methods,
- .tp_getset = py_db_comment_getseters,
- .tp_new = (newfunc)py_db_comment_new
-
- };
-
- return &py_db_comment_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide....db.items.DbComment'.*
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool register_python_db_comment(PyObject *module)
-{
- PyTypeObject *py_db_comment_type; /* Type Python 'DbComment' */
- PyObject *dict; /* Dictionnaire du module */
-
- py_db_comment_type = get_python_db_comment_type();
-
- dict = PyModule_GetDict(module);
-
- if (!register_class_for_pygobject(dict, G_TYPE_DB_COMMENT, py_db_comment_type, get_python_db_item_type()))
- return false;
-
- return true;
-
-}