diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-07-17 16:36:21 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-07-17 16:36:21 (GMT) |
commit | 24d3836fcf8d443eb654b981f65478cd9923b8f1 (patch) | |
tree | 7672a28b864127e8958c3c6cce751dcf646d2fbe /plugins/pychrysa/arch/arm/v7/instruction.c | |
parent | a61f089babe336b012da31a494b0f7470b6e1a9a (diff) |
Updated the Python bindings.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@552 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/pychrysa/arch/arm/v7/instruction.c')
-rw-r--r-- | plugins/pychrysa/arch/arm/v7/instruction.c | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/plugins/pychrysa/arch/arm/v7/instruction.c b/plugins/pychrysa/arch/arm/v7/instruction.c new file mode 100644 index 0000000..8a19259 --- /dev/null +++ b/plugins/pychrysa/arch/arm/v7/instruction.c @@ -0,0 +1,117 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * instruction.c - équivalent Python du fichier "arch/arm/v7/instruction.c" + * + * Copyright (C) 2015 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 "instruction.h" + + +#include <pygobject.h> + + +#include <arch/arm/v7/instruction.h> + + +#include "../instruction.h" + + + +/****************************************************************************** +* * +* Paramètres : - * +* * +* Description : Fournit un accès à une définition de type à diffuser. * +* * +* Retour : Définition d'objet pour Python. * +* * +* Remarques : - * +* * +******************************************************************************/ + +PyTypeObject *get_python_armv7_instruction_type(void) +{ + static PyMethodDef py_armv7_instruction_methods[] = { + { NULL } + }; + + static PyGetSetDef py_armv7_instruction_getseters[] = { + { NULL } + }; + + static PyTypeObject py_armv7_instruction_type = { + + PyVarObject_HEAD_INIT(NULL, 0) + + .tp_name = "pychrysalide.arch.arm.v7.ArmV7Instruction", + .tp_basicsize = sizeof(PyGObject), + + .tp_flags = Py_TPFLAGS_DEFAULT, + + .tp_doc = "PyChrysalide instruction for an ARMv7 architecture.", + + .tp_methods = py_armv7_instruction_methods, + .tp_getset = py_armv7_instruction_getseters, + + }; + + return &py_armv7_instruction_type; + +} + + +/****************************************************************************** +* * +* Paramètres : module = module dont la définition est à compléter. * +* * +* Description : Prend en charge l'objet 'pychrysalide....arm.ArmInstruction'.* +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool register_python_armv7_instruction(PyObject *module) +{ + PyTypeObject *py_armv7_instruction_type;/* Type Python 'BinContent' */ + int ret; /* Bilan d'un appel */ + PyObject *dict; /* Dictionnaire du module */ + + py_armv7_instruction_type = get_python_armv7_instruction_type(); + + py_armv7_instruction_type->tp_base = get_python_arm_instruction_type(); + py_armv7_instruction_type->tp_basicsize = py_armv7_instruction_type->tp_base->tp_basicsize; + + if (PyType_Ready(py_armv7_instruction_type) != 0) + return false; + + Py_INCREF(py_armv7_instruction_type); + ret = PyModule_AddObject(module, "ArmV7Instruction", (PyObject *)py_armv7_instruction_type); + if (ret != 0) return false; + + dict = PyModule_GetDict(module); + pygobject_register_class(dict, "ArmV7Instruction", G_TYPE_ARMV7_INSTRUCTION, py_armv7_instruction_type, + Py_BuildValue("(O)", py_armv7_instruction_type->tp_base)); + + return true; + +} |