diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-12-30 10:38:52 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-12-30 10:38:52 (GMT) |
commit | 932ea7c83c07d3982fee605c6dd9895fd2753874 (patch) | |
tree | 766ad53bab9e3e3005334c30e823493de8e84168 /plugins/pychrysa/gtkext | |
parent | 1b5d39bfbc48c33a0ea0924b60e48448c8b45dd4 (diff) |
Rewritten the line buffers using generators and on-demand building to save memory.
Diffstat (limited to 'plugins/pychrysa/gtkext')
-rw-r--r-- | plugins/pychrysa/gtkext/Makefile.am | 4 | ||||
-rw-r--r-- | plugins/pychrysa/gtkext/blockdisplay.c (renamed from plugins/pychrysa/gtkext/blockview.c) | 37 | ||||
-rw-r--r-- | plugins/pychrysa/gtkext/blockdisplay.h (renamed from plugins/pychrysa/gtkext/blockview.h) | 14 | ||||
-rw-r--r-- | plugins/pychrysa/gtkext/bufferdisplay.c (renamed from plugins/pychrysa/gtkext/bufferview.c) | 35 | ||||
-rw-r--r-- | plugins/pychrysa/gtkext/bufferdisplay.h (renamed from plugins/pychrysa/gtkext/bufferview.h) | 14 | ||||
-rw-r--r-- | plugins/pychrysa/gtkext/module.c | 8 |
6 files changed, 57 insertions, 55 deletions
diff --git a/plugins/pychrysa/gtkext/Makefile.am b/plugins/pychrysa/gtkext/Makefile.am index e7303e8..fee2032 100644 --- a/plugins/pychrysa/gtkext/Makefile.am +++ b/plugins/pychrysa/gtkext/Makefile.am @@ -2,8 +2,8 @@ noinst_LTLIBRARIES = libpychrysagtkext.la libpychrysagtkext_la_SOURCES = \ - blockview.h blockview.c \ - bufferview.h bufferview.c \ + blockdisplay.h blockdisplay.c \ + bufferdisplay.h bufferdisplay.c \ displaypanel.h displaypanel.c \ module.h module.c diff --git a/plugins/pychrysa/gtkext/blockview.c b/plugins/pychrysa/gtkext/blockdisplay.c index 73095b2..8262aa7 100644 --- a/plugins/pychrysa/gtkext/blockview.c +++ b/plugins/pychrysa/gtkext/blockdisplay.c @@ -1,6 +1,6 @@ /* Chrysalide - Outil d'analyse de fichiers binaires - * blockview.c - prototypes pour l'équivalent Python du fichier "gtkext/gtkblockview.c" + * blockdisplay.c - prototypes pour l'équivalent Python du fichier "gtkext/gtkblockdisplay.c" * * Copyright (C) 2012 Cyrille Bagard * @@ -22,16 +22,16 @@ */ -#include "blockview.h" +#include "blockdisplay.h" #include <pygobject.h> -#include <gtkext/gtkblockview.h> +#include <gtkext/gtkblockdisplay.h> -#include "bufferview.h" +#include "bufferdisplay.h" #include "../helpers.h" @@ -48,33 +48,33 @@ * * ******************************************************************************/ -PyTypeObject *get_python_block_view_type(void) +PyTypeObject *get_python_block_display_type(void) { - static PyMethodDef py_block_view_methods[] = { + static PyMethodDef py_block_display_methods[] = { { NULL } }; - static PyGetSetDef py_block_view_getseters[] = { + static PyGetSetDef py_block_display_getseters[] = { { NULL } }; - static PyTypeObject py_block_view_type = { + static PyTypeObject py_block_display_type = { PyVarObject_HEAD_INIT(NULL, 0) - .tp_name = "pychrysalide.gtkext.BlockView", + .tp_name = "pychrysalide.gtkext.BlockDisplay", .tp_basicsize = sizeof(PyGObject), .tp_flags = Py_TPFLAGS_DEFAULT, - .tp_doc = "PyChrysalide block view.", + .tp_doc = "PyChrysalide block display.", - .tp_methods = py_block_view_methods, - .tp_getset = py_block_view_getseters + .tp_methods = py_block_display_methods, + .tp_getset = py_block_display_getseters }; - return &py_block_view_type; + return &py_block_display_type; } @@ -83,7 +83,7 @@ PyTypeObject *get_python_block_view_type(void) * * * Paramètres : module = module dont la définition est à compléter. * * * -* Description : Prend en charge l'objet 'pychrysalide.gtkext.BlockView'. * +* Description : Prend en charge l'objet 'pychrysalide.gtkext.BlockDisplay'. * * * * Retour : Bilan de l'opération. * * * @@ -91,16 +91,17 @@ PyTypeObject *get_python_block_view_type(void) * * ******************************************************************************/ -bool register_python_block_view(PyObject *module) +bool register_python_block_display(PyObject *module) { - PyTypeObject *py_block_view_type; /* Type Python 'BlockView' */ + PyTypeObject *py_block_display_type; /* Type Python 'BlockDisplay' */ PyObject *dict; /* Dictionnaire du module */ - py_block_view_type = get_python_block_view_type(); + py_block_display_type = get_python_block_display_type(); dict = PyModule_GetDict(module); - if (!register_class_for_pygobject(dict, GTK_TYPE_BLOCK_VIEW, py_block_view_type, get_python_buffer_view_type())) + if (!register_class_for_pygobject(dict, GTK_TYPE_BLOCK_DISPLAY, + py_block_display_type, get_python_buffer_display_type())) return false; return true; diff --git a/plugins/pychrysa/gtkext/blockview.h b/plugins/pychrysa/gtkext/blockdisplay.h index acb97a9..1a45e15 100644 --- a/plugins/pychrysa/gtkext/blockview.h +++ b/plugins/pychrysa/gtkext/blockdisplay.h @@ -1,6 +1,6 @@ /* Chrysalide - Outil d'analyse de fichiers binaires - * blockview.h - prototypes pour l'équivalent Python du fichier "gtkext/gtkblockview.h" + * blockdisplay.h - prototypes pour l'équivalent Python du fichier "gtkext/gtkblockdisplay.h" * * Copyright (C) 2012 Cyrille Bagard * @@ -22,8 +22,8 @@ */ -#ifndef _PLUGINS_PYCHRYSA_GTKEXT_BLOCKVIEW_H -#define _PLUGINS_PYCHRYSA_GTKEXT_BLOCKVIEW_H +#ifndef _PLUGINS_PYCHRYSA_GTKEXT_BLOCKDISPLAY_H +#define _PLUGINS_PYCHRYSA_GTKEXT_BLOCKDISPLAY_H #include <Python.h> @@ -32,11 +32,11 @@ /* Fournit un accès à une définition de type à diffuser. */ -PyTypeObject *get_python_block_view_type(void); +PyTypeObject *get_python_block_display_type(void); -/* Prend en charge l'objet 'pychrysalide.gtkext.BlockView'. */ -bool register_python_block_view(PyObject *module); +/* Prend en charge l'objet 'pychrysalide.gtkext.BlockDisplay'. */ +bool register_python_block_display(PyObject *module); -#endif /* _PLUGINS_PYCHRYSA_GTKEXT_BLOCKVIEW_H */ +#endif /* _PLUGINS_PYCHRYSA_GTKEXT_BLOCKDISPLAY_H */ diff --git a/plugins/pychrysa/gtkext/bufferview.c b/plugins/pychrysa/gtkext/bufferdisplay.c index 3be54fd..d26d9d9 100644 --- a/plugins/pychrysa/gtkext/bufferview.c +++ b/plugins/pychrysa/gtkext/bufferdisplay.c @@ -1,6 +1,6 @@ /* Chrysalide - Outil d'analyse de fichiers binaires - * bufferview.c - prototypes pour l'équivalent Python du fichier "gtkext/gtkbufferview.c" + * bufferdisplay.c - prototypes pour l'équivalent Python du fichier "gtkext/gtkbufferdisplay.c" * * Copyright (C) 2012 Cyrille Bagard * @@ -22,13 +22,13 @@ */ -#include "bufferview.h" +#include "bufferdisplay.h" #include <pygobject.h> -#include <gtkext/gtkbufferview.h> +#include <gtkext/gtkbufferdisplay.h> #include "displaypanel.h" @@ -48,33 +48,33 @@ * * ******************************************************************************/ -PyTypeObject *get_python_buffer_view_type(void) +PyTypeObject *get_python_buffer_display_type(void) { - static PyMethodDef py_buffer_view_methods[] = { + static PyMethodDef py_buffer_display_methods[] = { { NULL } }; - static PyGetSetDef py_buffer_view_getseters[] = { + static PyGetSetDef py_buffer_display_getseters[] = { { NULL } }; - static PyTypeObject py_buffer_view_type = { + static PyTypeObject py_buffer_display_type = { PyVarObject_HEAD_INIT(NULL, 0) - .tp_name = "pychrysalide.gtkext.Bufferview", + .tp_name = "pychrysalide.gtkext.BufferDisplay", .tp_basicsize = sizeof(PyGObject), .tp_flags = Py_TPFLAGS_DEFAULT, - .tp_doc = "PyChrysalide buffer view.", + .tp_doc = "PyChrysalide buffer display.", - .tp_methods = py_buffer_view_methods, - .tp_getset = py_buffer_view_getseters + .tp_methods = py_buffer_display_methods, + .tp_getset = py_buffer_display_getseters }; - return &py_buffer_view_type; + return &py_buffer_display_type; } @@ -83,7 +83,7 @@ PyTypeObject *get_python_buffer_view_type(void) * * * Paramètres : module = module dont la définition est à compléter. * * * -* Description : Prend en charge l'objet 'pychrysalide.gtkext.Bufferview'. * +* Description : Prend en charge l'objet 'pychrysalide.gtkext.Bufferdisplay'. * * * * Retour : Bilan de l'opération. * * * @@ -91,16 +91,17 @@ PyTypeObject *get_python_buffer_view_type(void) * * ******************************************************************************/ -bool register_python_buffer_view(PyObject *module) +bool register_python_buffer_display(PyObject *module) { - PyTypeObject *py_buffer_view_type; /* Type Python 'Bufferview' */ + PyTypeObject *py_buffer_display_type; /* Type Python 'Bufferdisplay' */ PyObject *dict; /* Dictionnaire du module */ - py_buffer_view_type = get_python_buffer_view_type(); + py_buffer_display_type = get_python_buffer_display_type(); dict = PyModule_GetDict(module); - if (!register_class_for_pygobject(dict, GTK_TYPE_BUFFER_VIEW, py_buffer_view_type, get_python_display_panel_type())) + if (!register_class_for_pygobject(dict, GTK_TYPE_BUFFER_DISPLAY, + py_buffer_display_type, get_python_display_panel_type())) return false; return true; diff --git a/plugins/pychrysa/gtkext/bufferview.h b/plugins/pychrysa/gtkext/bufferdisplay.h index d4a1581..332f402 100644 --- a/plugins/pychrysa/gtkext/bufferview.h +++ b/plugins/pychrysa/gtkext/bufferdisplay.h @@ -1,6 +1,6 @@ /* Chrysalide - Outil d'analyse de fichiers binaires - * bufferview.h - prototypes pour l'équivalent Python du fichier "gtkext/gtkbufferview.h" + * bufferdisplay.h - prototypes pour l'équivalent Python du fichier "gtkext/gtkbufferdisplay.h" * * Copyright (C) 2012 Cyrille Bagard * @@ -22,8 +22,8 @@ */ -#ifndef _PLUGINS_PYCHRYSA_GTKEXT_BUFFERVIEW_H -#define _PLUGINS_PYCHRYSA_GTKEXT_BUFFERVIEW_H +#ifndef _PLUGINS_PYCHRYSA_GTKEXT_BUFFERDISPLAY_H +#define _PLUGINS_PYCHRYSA_GTKEXT_BUFFERDISPLAY_H #include <Python.h> @@ -32,11 +32,11 @@ /* Fournit un accès à une définition de type à diffuser. */ -PyTypeObject *get_python_buffer_view_type(void); +PyTypeObject *get_python_buffer_display_type(void); -/* Prend en charge l'objet 'pychrysalide.gtkext.Bufferview'. */ -bool register_python_buffer_view(PyObject *module); +/* Prend en charge l'objet 'pychrysalide.gtkext.BufferDisplay'. */ +bool register_python_buffer_display(PyObject *module); -#endif /* _PLUGINS_PYCHRYSA_GTKEXT_BUFFERVIEW_H */ +#endif /* _PLUGINS_PYCHRYSA_GTKEXT_BUFFERDISPLAY_H */ diff --git a/plugins/pychrysa/gtkext/module.c b/plugins/pychrysa/gtkext/module.c index 2230ed0..d826814 100644 --- a/plugins/pychrysa/gtkext/module.c +++ b/plugins/pychrysa/gtkext/module.c @@ -28,8 +28,8 @@ #include <assert.h> -#include "blockview.h" -#include "bufferview.h" +#include "blockdisplay.h" +#include "bufferdisplay.h" #include "displaypanel.h" @@ -81,8 +81,8 @@ bool add_gtkext_module_to_python_module(PyObject *super) result = true; result &= register_python_display_panel(module); - result &= register_python_buffer_view(module); - result &= register_python_block_view(module); + result &= register_python_buffer_display(module); + result &= register_python_block_display(module); agmtpm_exit: |