diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2012-12-21 23:34:14 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2012-12-21 23:34:14 (GMT) |
commit | 3bfff245c47c4dd1404c5ea7af0ff4858ac8d130 (patch) | |
tree | dc3613e2ebdef4d04fa874335795268dba732d31 /plugins/pychrysa/glibext/codebuffer.c | |
parent | 0cfcbee3c536ac6d11ec806d47ce4c136f695697 (diff) |
Resolved relative addresses for routines and fixed bugs related to PyGObjects construction.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@308 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/pychrysa/glibext/codebuffer.c')
-rw-r--r-- | plugins/pychrysa/glibext/codebuffer.c | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/plugins/pychrysa/glibext/codebuffer.c b/plugins/pychrysa/glibext/codebuffer.c index a090e27..e4c94e3 100644 --- a/plugins/pychrysa/glibext/codebuffer.c +++ b/plugins/pychrysa/glibext/codebuffer.c @@ -28,6 +28,9 @@ #include <pygobject.h> +#include <glibext/gcodebuffer.h> + + #include "../quirks.h" @@ -39,34 +42,6 @@ static PyObject *py_code_buffer_find_line_by_addr(PyObject *, PyObject *); /****************************************************************************** * * -* Paramètres : binary = instance existante GLib. * -* * -* Description : Crée un nouvel objet Python de type 'Codebuffer'. * -* * -* Retour : Instance Python mise en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -PyObject *py_code_buffer_from_c(GCodeBuffer *buffer) -{ - PyObject *module; /* Module d'appartenance */ - PyTypeObject *type; /* Type Python correspondant */ - - module = PyImport_ImportModule("pychrysalide.glibext"); - type = (PyTypeObject *)PyObject_GetAttrString(module, "CodeBuffer"); - Py_DECREF(module); - - pychrysalide_set_instance_data(G_OBJECT(buffer), type); - - return pygobject_new(G_OBJECT(buffer)); - -} - - -/****************************************************************************** -* * * Paramètres : self = classe représentant un tampon de code. * * args = arguments fournis à l'appel. * * * @@ -89,12 +64,12 @@ static PyObject *py_code_buffer_find_line_by_addr(PyObject *self, PyObject *args buffer = G_CODE_BUFFER(pygobject_get(self)); ret = PyArg_ParseTuple(args, "K", &addr); - if (!ret) return Py_None; + if (!ret) Py_RETURN_NONE; line = g_code_buffer_find_line_by_addr(buffer, addr); - if (line == NULL) return Py_None; + if (line == NULL) Py_RETURN_NONE; - result = py_buffer_line_from_c(line); + result = pygobject_new(G_OBJECT(line)); return result; @@ -154,6 +129,9 @@ bool register_python_code_buffer(PyObject *module) Py_INCREF(&py_code_buffer_type); ret = PyModule_AddObject(module, "CodeBuffer", (PyObject *)&py_code_buffer_type); + pygobject_register_class(module, "GCodeBuffer", G_TYPE_CODE_BUFFER, &py_code_buffer_type, + Py_BuildValue("(O)", py_code_buffer_type.tp_base)); + return (ret == 0); } |