| | 1 | Index: gtkhex.c |
| | 2 | =================================================================== |
| | 3 | --- gtkhex.c (revision 0) |
| | 4 | +++ gtkhex.c (revision 0) |
| | 5 | @@ -0,0 +1,2357 @@ |
| | 6 | +/* -- THIS FILE IS GENERATED - DO NOT EDIT *//* -*- Mode: C; c-basic-offset: 4 -*- */ |
| | 7 | + |
| | 8 | +#include <Python.h> |
| | 9 | + |
| | 10 | + |
| | 11 | + |
| | 12 | +#line 24 "gtkhex.override" |
| | 13 | +#define NO_IMPORT_PYGOBJECT |
| | 14 | +#include <pygobject.h> |
| | 15 | +#include <pygtk/pygtk.h> |
| | 16 | +#include <atk/atk.h> |
| | 17 | +#include <atk/atk-enum-types.h> |
| | 18 | +#include "gtkhex.h" |
| | 19 | + |
| | 20 | +#define GTK_TYPE_HEX (gtk_hex_get_type()) |
| | 21 | +#define HEX_TYPE_DOCUMENT (hex_document_get_type()) |
| | 22 | + |
| | 23 | +/* ---------- ChangeData ---------- */ |
| | 24 | +typedef struct { |
| | 25 | + PyObject_HEAD |
| | 26 | + HexChangeData *cdata; |
| | 27 | +} PyChangeData; |
| | 28 | +extern PyTypeObject PyChangeData_Type; |
| | 29 | + |
| | 30 | +static PyObject * |
| | 31 | +cdata_new_from_gpointer(gpointer cdata) |
| | 32 | +{ |
| | 33 | + PyChangeData *self = NULL; |
| | 34 | + |
| | 35 | + self = (PyChangeData *)PyObject_NEW(PyChangeData, |
| | 36 | + &PyChangeData_Type); |
| | 37 | + if (self != NULL) { |
| | 38 | + self->cdata = (HexChangeData *)cdata; |
| | 39 | + } |
| | 40 | + |
| | 41 | + return (PyObject *)self; |
| | 42 | +} |
| | 43 | + |
| | 44 | +static PyObject * |
| | 45 | +cdata_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
| | 46 | +{ |
| | 47 | + PyObject *o = NULL; |
| | 48 | + PyGPointer *py_pointer; |
| | 49 | + |
| | 50 | + if (!PyArg_ParseTuple(args, "O!:ChangeData.__new__", |
| | 51 | + &PyGPointer_Type, &py_pointer)) |
| | 52 | + return NULL; |
| | 53 | + |
| | 54 | + if (py_pointer && py_pointer->pointer) |
| | 55 | + { |
| | 56 | + o = cdata_new_from_gpointer(py_pointer->pointer); |
| | 57 | + } |
| | 58 | + return o; |
| | 59 | +} |
| | 60 | + |
| | 61 | +static void |
| | 62 | +cdata_dealloc(PyChangeData *self) |
| | 63 | +{ |
| | 64 | + self->cdata = NULL; |
| | 65 | + PyObject_DEL(self); |
| | 66 | +} |
| | 67 | + |
| | 68 | +static long |
| | 69 | +cdata_hash(PyChangeData *self) |
| | 70 | +{ |
| | 71 | + return (long)self->cdata; |
| | 72 | +} |
| | 73 | + |
| | 74 | +static PyMethodDef cdata_methods[] = { |
| | 75 | + { NULL, NULL, 0 } |
| | 76 | +}; |
| | 77 | + |
| | 78 | +/* ---------- getters/setters ---------- */ |
| | 79 | + |
| | 80 | +static PyObject * |
| | 81 | +cdata_get_start(PyChangeData *self, void *closure) { |
| | 82 | + return PyLong_FromUnsignedLong(self->cdata->start); |
| | 83 | +} |
| | 84 | + |
| | 85 | +static PyObject * |
| | 86 | +cdata_get_end(PyChangeData *self, void *closure) { |
| | 87 | + return PyLong_FromUnsignedLong(self->cdata->end); |
| | 88 | +} |
| | 89 | + |
| | 90 | +static PyObject * |
| | 91 | +cdata_get_rep_len(PyChangeData *self, void *closure) { |
| | 92 | + return PyLong_FromUnsignedLong(self->cdata->rep_len); |
| | 93 | +} |
| | 94 | + |
| | 95 | +static PyObject * |
| | 96 | +cdata_get_lower_nibble(PyChangeData *self, void *closure) { |
| | 97 | + return PyBool_FromLong(self->cdata->lower_nibble); |
| | 98 | +} |
| | 99 | + |
| | 100 | +static PyObject * |
| | 101 | +cdata_get_insert(PyChangeData *self, void *closure) { |
| | 102 | + return PyBool_FromLong(self->cdata->insert); |
| | 103 | +} |
| | 104 | + |
| | 105 | +static PyObject * |
| | 106 | +cdata_get_type(PyChangeData *self, void *closure) { |
| | 107 | + return PyInt_FromLong(self->cdata->type); |
| | 108 | +} |
| | 109 | + |
| | 110 | +static PyObject * |
| | 111 | +cdata_get_v_string(PyChangeData *self, void *closure) { |
| | 112 | + if (self->cdata->v_string) |
| | 113 | + return PyString_FromString(self->cdata->v_string); |
| | 114 | + Py_INCREF(Py_None); |
| | 115 | + return Py_None; |
| | 116 | +} |
| | 117 | + |
| | 118 | +static PyObject * |
| | 119 | +cdata_get_v_byte(PyChangeData *self, void *closure) { |
| | 120 | + return PyString_FromFormat("%c", self->cdata->v_byte); |
| | 121 | +} |
| | 122 | + |
| | 123 | +static PyGetSetDef cdata_getsets[] = { |
| | 124 | + { "start", (getter)cdata_get_start, (setter)0, NULL, NULL }, |
| | 125 | + { "end", (getter)cdata_get_end, (setter)0, NULL, NULL }, |
| | 126 | + { "rep_len", (getter)cdata_get_rep_len, (setter)0, NULL, NULL }, |
| | 127 | + { "lower_nibble", (getter)cdata_get_lower_nibble, (setter)0, NULL, NULL }, |
| | 128 | + { "insert", (getter)cdata_get_insert, (setter)0, NULL, NULL }, |
| | 129 | + { "type", (getter)cdata_get_type, (setter)0, NULL, NULL }, |
| | 130 | + { "v_string", (getter)cdata_get_v_string, (setter)0, NULL, NULL }, |
| | 131 | + { "v_byte", (getter)cdata_get_v_byte, (setter)0, NULL, NULL }, |
| | 132 | + { NULL, (getter)0, (setter)0, NULL, NULL } |
| | 133 | +}; |
| | 134 | + |
| | 135 | +PyTypeObject PyChangeData_Type = { |
| | 136 | + PyObject_HEAD_INIT(NULL) |
| | 137 | + 0, /* ob_size */ |
| | 138 | + "gtkhex.ChangeData", /* tp_name */ |
| | 139 | + sizeof(PyChangeData), /* tp_basicsize */ |
| | 140 | + 0, /* tp_itemsize */ |
| | 141 | + /* methods */ |
| | 142 | + (destructor)cdata_dealloc, /* tp_dealloc */ |
| | 143 | + 0, /* tp_print */ |
| | 144 | + 0, /* tp_getattr */ |
| | 145 | + 0, /* tp_setattr */ |
| | 146 | + 0, /* tp_compare */ |
| | 147 | + 0, /* tp_repr */ |
| | 148 | + 0, /* tp_as_number */ |
| | 149 | + 0, /* tp_as_sequence */ |
| | 150 | + 0, /* tp_as_mapping */ |
| | 151 | + (hashfunc)cdata_hash, /* tp_hash */ |
| | 152 | + 0, /* tp_call */ |
| | 153 | + 0, /* tp_str */ |
| | 154 | + 0, /* tp_getattro */ |
| | 155 | + 0, /* tp_setattro */ |
| | 156 | + 0, /* tp_as_buffer */ |
| | 157 | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ |
| | 158 | + NULL, /* Documentation string */ |
| | 159 | + 0, /* tp_traverse */ |
| | 160 | + 0, /* tp_clear */ |
| | 161 | + 0, /* tp_richcompare */ |
| | 162 | + 0, /* tp_weaklistoffset */ |
| | 163 | + 0, /* tp_iter */ |
| | 164 | + 0, /* tp_iternext */ |
| | 165 | + cdata_methods, /* tp_methods */ |
| | 166 | + 0, /* tp_members */ |
| | 167 | + cdata_getsets, /* tp_getset */ |
| | 168 | + NULL, /* tp_base */ |
| | 169 | + 0, /* tp_dict */ |
| | 170 | + 0, /* tp_descr_get */ |
| | 171 | + 0, /* tp_descr_set */ |
| | 172 | + 0, /* tp_dictoffset */ |
| | 173 | + 0, /* tp_init */ |
| | 174 | + 0, /* tp_alloc */ |
| | 175 | + (newfunc)cdata_new, /* tp_new */ |
| | 176 | + 0, /* tp_free */ |
| | 177 | + 0, /* tp_is_gc */ |
| | 178 | + 0, /* tp_bases */ |
| | 179 | +}; |
| | 180 | + |
| | 181 | +/* ---------- GtkHex_AutoHighlight ---------- */ |
| | 182 | +typedef struct { |
| | 183 | + PyObject_HEAD; |
| | 184 | + GtkHex_AutoHighlight *ahl; |
| | 185 | +} PyAutoHighlight; |
| | 186 | +extern PyTypeObject PyAutoHighlight_Type; |
| | 187 | + |
| | 188 | +static PyObject * |
| | 189 | +ahl_new(GtkHex_AutoHighlight *ahl) |
| | 190 | +{ |
| | 191 | + PyAutoHighlight *self = NULL; |
| | 192 | + |
| | 193 | + self = (PyAutoHighlight *)PyObject_NEW(PyAutoHighlight, |
| | 194 | + &PyAutoHighlight_Type); |
| | 195 | + if (self != NULL) { |
| | 196 | + self->ahl = ahl; |
| | 197 | + } |
| | 198 | + |
| | 199 | + return (PyObject *)self; |
| | 200 | +} |
| | 201 | + |
| | 202 | +static void |
| | 203 | +ahl_dealloc(PyAutoHighlight *self) |
| | 204 | +{ |
| | 205 | + self->ahl = NULL; |
| | 206 | + PyObject_DEL(self); |
| | 207 | +} |
| | 208 | + |
| | 209 | +static long |
| | 210 | +ahl_hash(PyAutoHighlight *self) |
| | 211 | +{ |
| | 212 | + return (long)self->ahl; |
| | 213 | +} |
| | 214 | + |
| | 215 | +static PyMethodDef ahl_methods[] = { |
| | 216 | + { NULL, NULL, 0 } |
| | 217 | +}; |
| | 218 | + |
| | 219 | +static PyGetSetDef ahl_getsets[] = { |
| | 220 | + { NULL, (getter)0, (setter)0, NULL, NULL } |
| | 221 | +}; |
| | 222 | + |
| | 223 | +PyTypeObject PyAutoHighlight_Type = { |
| | 224 | + PyObject_HEAD_INIT(NULL) |
| | 225 | + 0, /* ob_size */ |
| | 226 | + "gtkhex.AutoHighlight", /* tp_name */ |
| | 227 | + sizeof(PyAutoHighlight), /* tp_basicsize */ |
| | 228 | + 0, /* tp_itemsize */ |
| | 229 | + /* methods */ |
| | 230 | + (destructor)ahl_dealloc, /* tp_dealloc */ |
| | 231 | + 0, /* tp_print */ |
| | 232 | + 0, /* tp_getattr */ |
| | 233 | + 0, /* tp_setattr */ |
| | 234 | + 0, /* tp_compare */ |
| | 235 | + 0, /* tp_repr */ |
| | 236 | + 0, /* tp_as_number */ |
| | 237 | + 0, /* tp_as_sequence */ |
| | 238 | + 0, /* tp_as_mapping */ |
| | 239 | + (hashfunc)ahl_hash, /* tp_hash */ |
| | 240 | + 0, /* tp_call */ |
| | 241 | + 0, /* tp_str */ |
| | 242 | + 0, /* tp_getattro */ |
| | 243 | + 0, /* tp_setattro */ |
| | 244 | + 0, /* tp_as_buffer */ |
| | 245 | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ |
| | 246 | + NULL, /* Documentation string */ |
| | 247 | + 0, /* tp_traverse */ |
| | 248 | + 0, /* tp_clear */ |
| | 249 | + 0, /* tp_richcompare */ |
| | 250 | + 0, /* tp_weaklistoffset */ |
| | 251 | + 0, /* tp_iter */ |
| | 252 | + 0, /* tp_iternext */ |
| | 253 | + ahl_methods, /* tp_methods */ |
| | 254 | + 0, /* tp_members */ |
| | 255 | + ahl_getsets, /* tp_getset */ |
| | 256 | + NULL, /* tp_base */ |
| | 257 | + 0, /* tp_dict */ |
| | 258 | + 0, /* tp_descr_get */ |
| | 259 | + 0, /* tp_descr_set */ |
| | 260 | + 0, /* tp_dictoffset */ |
| | 261 | + 0, /* tp_init */ |
| | 262 | + 0, /* tp_alloc */ |
| | 263 | + 0, /* tp_new */ |
| | 264 | + 0, /* tp_free */ |
| | 265 | + 0, /* tp_is_gc */ |
| | 266 | + 0, /* tp_bases */ |
| | 267 | +}; |
| | 268 | + |
| | 269 | +#line 265 "gtkhex.c" |
| | 270 | + |
| | 271 | + |
| | 272 | +/* ---------- types from other modules ---------- */ |
| | 273 | +static PyTypeObject *_PyGObject_Type; |
| | 274 | +#define PyGObject_Type (*_PyGObject_Type) |
| | 275 | +static PyTypeObject *_PyAtkObject_Type; |
| | 276 | +#define PyAtkObject_Type (*_PyAtkObject_Type) |
| | 277 | +static PyTypeObject *_PyGtkWidget_Type; |
| | 278 | +#define PyGtkWidget_Type (*_PyGtkWidget_Type) |
| | 279 | +static PyTypeObject *_PyGtkFixed_Type; |
| | 280 | +#define PyGtkFixed_Type (*_PyGtkFixed_Type) |
| | 281 | + |
| | 282 | + |
| | 283 | +/* ---------- forward type declarations ---------- */ |
| | 284 | +PyTypeObject G_GNUC_INTERNAL PyGtkHex_Type; |
| | 285 | +PyTypeObject G_GNUC_INTERNAL PyHexDocument_Type; |
| | 286 | + |
| | 287 | +#line 283 "gtkhex.c" |
| | 288 | + |
| | 289 | + |
| | 290 | + |
| | 291 | +/* ----------- GtkHex ----------- */ |
| | 292 | + |
| | 293 | +#line 295 "gtkhex.override" |
| | 294 | +static int |
| | 295 | +_wrap_gtk_hex_new(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 296 | +{ |
| | 297 | + static char *kwlist[] = { "document", NULL }; |
| | 298 | + PyGObject *document = NULL; |
| | 299 | + |
| | 300 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:GtkHex.__init__", kwlist, &PyHexDocument_Type, &document)) |
| | 301 | + return -1; |
| | 302 | + |
| | 303 | + if (document) { |
| | 304 | + self->obj = (GObject *)gtk_hex_new(HEX_DOCUMENT(document->obj)); |
| | 305 | + |
| | 306 | + gtk_fixed_set_has_window(GTK_FIXED(self->obj), TRUE); |
| | 307 | + |
| | 308 | + (HEX_DOCUMENT(document->obj))->views = g_list_append(\ |
| | 309 | + (HEX_DOCUMENT(document->obj))->views, |
| | 310 | + GTK_HEX(self->obj) |
| | 311 | + ); |
| | 312 | + } |
| | 313 | + |
| | 314 | + if (!self->obj) { |
| | 315 | + PyErr_SetString(PyExc_RuntimeError, "could not create GtkHex object"); |
| | 316 | + return -1; |
| | 317 | + } |
| | 318 | + pygobject_register_wrapper((PyObject *)self); |
| | 319 | + return 0; |
| | 320 | +} |
| | 321 | +#line 317 "gtkhex.c" |
| | 322 | + |
| | 323 | + |
| | 324 | +static PyObject * |
| | 325 | +_wrap_gtk_hex_set_cursor(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 326 | +{ |
| | 327 | + static char *kwlist[] = { "index", NULL }; |
| | 328 | + int index; |
| | 329 | + |
| | 330 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:Gtk.Hex.set_cursor", kwlist, &index)) |
| | 331 | + return NULL; |
| | 332 | + |
| | 333 | + gtk_hex_set_cursor(GTK_HEX(self->obj), index); |
| | 334 | + |
| | 335 | + Py_INCREF(Py_None); |
| | 336 | + return Py_None; |
| | 337 | +} |
| | 338 | + |
| | 339 | +static PyObject * |
| | 340 | +_wrap_gtk_hex_set_cursor_xy(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 341 | +{ |
| | 342 | + static char *kwlist[] = { "x", "y", NULL }; |
| | 343 | + int x, y; |
| | 344 | + |
| | 345 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"ii:Gtk.Hex.set_cursor_xy", kwlist, &x, &y)) |
| | 346 | + return NULL; |
| | 347 | + |
| | 348 | + gtk_hex_set_cursor_xy(GTK_HEX(self->obj), x, y); |
| | 349 | + |
| | 350 | + Py_INCREF(Py_None); |
| | 351 | + return Py_None; |
| | 352 | +} |
| | 353 | + |
| | 354 | +static PyObject * |
| | 355 | +_wrap_gtk_hex_set_nibble(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 356 | +{ |
| | 357 | + static char *kwlist[] = { "lower_nibble", NULL }; |
| | 358 | + int lower_nibble; |
| | 359 | + |
| | 360 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:Gtk.Hex.set_nibble", kwlist, &lower_nibble)) |
| | 361 | + return NULL; |
| | 362 | + |
| | 363 | + gtk_hex_set_nibble(GTK_HEX(self->obj), lower_nibble); |
| | 364 | + |
| | 365 | + Py_INCREF(Py_None); |
| | 366 | + return Py_None; |
| | 367 | +} |
| | 368 | + |
| | 369 | +static PyObject * |
| | 370 | +_wrap_gtk_hex_get_cursor(PyGObject *self) |
| | 371 | +{ |
| | 372 | + guint ret; |
| | 373 | + |
| | 374 | + |
| | 375 | + ret = gtk_hex_get_cursor(GTK_HEX(self->obj)); |
| | 376 | + |
| | 377 | + return PyLong_FromUnsignedLong(ret); |
| | 378 | +} |
| | 379 | + |
| | 380 | +#line 469 "gtkhex.override" |
| | 381 | +static PyObject * |
| | 382 | +_wrap_gtk_hex_get_byte(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 383 | +{ |
| | 384 | + static char *kwlist[] = {"offset", NULL}; |
| | 385 | + PyObject *py_offset = NULL; |
| | 386 | + guint offset = 0; |
| | 387 | + guchar ret; |
| | 388 | + |
| | 389 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GtkHex.get_byte", kwlist, &py_offset)) |
| | 390 | + return NULL; |
| | 391 | + |
| | 392 | + if (py_offset) { |
| | 393 | + if (PyLong_Check(py_offset)) |
| | 394 | + offset = PyLong_AsUnsignedLong(py_offset); |
| | 395 | + else if (PyInt_Check(py_offset)) |
| | 396 | + offset = PyInt_AsLong(py_offset); |
| | 397 | + else |
| | 398 | + PyErr_SetString(PyExc_TypeError, "Parameter 'offset' must be an int or a long"); |
| | 399 | + if (PyErr_Occurred()) |
| | 400 | + return NULL; |
| | 401 | + } |
| | 402 | + |
| | 403 | + if ((offset >= 0) && (offset < (GTK_HEX(self->obj))->document->file_size)) { |
| | 404 | + |
| | 405 | + ret = gtk_hex_get_byte(GTK_HEX(self->obj), offset); |
| | 406 | + return PyString_FromFormat("%c", ret); |
| | 407 | + } |
| | 408 | + |
| | 409 | + Py_INCREF(Py_None); |
| | 410 | + return Py_None; |
| | 411 | +} |
| | 412 | +#line 408 "gtkhex.c" |
| | 413 | + |
| | 414 | + |
| | 415 | +static PyObject * |
| | 416 | +_wrap_gtk_hex_set_group_type(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 417 | +{ |
| | 418 | + static char *kwlist[] = { "gt", NULL }; |
| | 419 | + int gt; |
| | 420 | + |
| | 421 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:Gtk.Hex.set_group_type", kwlist, >)) |
| | 422 | + return NULL; |
| | 423 | + |
| | 424 | + gtk_hex_set_group_type(GTK_HEX(self->obj), gt); |
| | 425 | + |
| | 426 | + Py_INCREF(Py_None); |
| | 427 | + return Py_None; |
| | 428 | +} |
| | 429 | + |
| | 430 | +static PyObject * |
| | 431 | +_wrap_gtk_hex_set_starting_offset(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 432 | +{ |
| | 433 | + static char *kwlist[] = { "offset", NULL }; |
| | 434 | + int offset; |
| | 435 | + |
| | 436 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:Gtk.Hex.set_starting_offset", kwlist, &offset)) |
| | 437 | + return NULL; |
| | 438 | + |
| | 439 | + gtk_hex_set_starting_offset(GTK_HEX(self->obj), offset); |
| | 440 | + |
| | 441 | + Py_INCREF(Py_None); |
| | 442 | + return Py_None; |
| | 443 | +} |
| | 444 | + |
| | 445 | +static PyObject * |
| | 446 | +_wrap_gtk_hex_show_offsets(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 447 | +{ |
| | 448 | + static char *kwlist[] = { "show", NULL }; |
| | 449 | + int show; |
| | 450 | + |
| | 451 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:Gtk.Hex.show_offsets", kwlist, &show)) |
| | 452 | + return NULL; |
| | 453 | + |
| | 454 | + gtk_hex_show_offsets(GTK_HEX(self->obj), show); |
| | 455 | + |
| | 456 | + Py_INCREF(Py_None); |
| | 457 | + return Py_None; |
| | 458 | +} |
| | 459 | + |
| | 460 | +#line 337 "gtkhex.override" |
| | 461 | +static PyObject * |
| | 462 | +_wrap_gtk_hex_set_font(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 463 | +{ |
| | 464 | + static char *kwlist[] = { "font_str", NULL }; |
| | 465 | + char *font_str; |
| | 466 | + |
| | 467 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:GtkHex.set_font", kwlist, &font_str)) |
| | 468 | + return NULL; |
| | 469 | + if (font_str) { |
| | 470 | + gtk_hex_set_font(GTK_HEX(self->obj), gtk_hex_load_font(font_str), |
| | 471 | + pango_font_description_from_string(font_str)); |
| | 472 | + } |
| | 473 | + |
| | 474 | + Py_INCREF(Py_None); |
| | 475 | + return Py_None; |
| | 476 | +} |
| | 477 | +#line 473 "gtkhex.c" |
| | 478 | + |
| | 479 | + |
| | 480 | +static PyObject * |
| | 481 | +_wrap_gtk_hex_set_insert_mode(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 482 | +{ |
| | 483 | + static char *kwlist[] = { "insert", NULL }; |
| | 484 | + int insert; |
| | 485 | + |
| | 486 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:Gtk.Hex.set_insert_mode", kwlist, &insert)) |
| | 487 | + return NULL; |
| | 488 | + |
| | 489 | + gtk_hex_set_insert_mode(GTK_HEX(self->obj), insert); |
| | 490 | + |
| | 491 | + Py_INCREF(Py_None); |
| | 492 | + return Py_None; |
| | 493 | +} |
| | 494 | + |
| | 495 | +static PyObject * |
| | 496 | +_wrap_gtk_hex_set_read_only_mode(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 497 | +{ |
| | 498 | + static char *kwlist[] = { "read_only", NULL }; |
| | 499 | + int read_only; |
| | 500 | + |
| | 501 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:Gtk.Hex.set_read_only_mode", kwlist, &read_only)) |
| | 502 | + return NULL; |
| | 503 | + |
| | 504 | + gtk_hex_set_read_only_mode(GTK_HEX(self->obj), read_only); |
| | 505 | + |
| | 506 | + Py_INCREF(Py_None); |
| | 507 | + return Py_None; |
| | 508 | +} |
| | 509 | + |
| | 510 | +static PyObject * |
| | 511 | +_wrap_gtk_hex_get_insert_mode(PyGObject *self) |
| | 512 | +{ |
| | 513 | + int ret; |
| | 514 | + |
| | 515 | + |
| | 516 | + ret = gtk_hex_get_insert_mode(GTK_HEX(self->obj)); |
| | 517 | + |
| | 518 | + return PyBool_FromLong(ret); |
| | 519 | + |
| | 520 | +} |
| | 521 | + |
| | 522 | +static PyObject * |
| | 523 | +_wrap_gtk_hex_get_read_only_mode(PyGObject *self) |
| | 524 | +{ |
| | 525 | + int ret; |
| | 526 | + |
| | 527 | + |
| | 528 | + ret = gtk_hex_get_read_only_mode(GTK_HEX(self->obj)); |
| | 529 | + |
| | 530 | + return PyBool_FromLong(ret); |
| | 531 | + |
| | 532 | +} |
| | 533 | + |
| | 534 | +static PyObject * |
| | 535 | +_wrap_gtk_hex_set_geometry(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 536 | +{ |
| | 537 | + static char *kwlist[] = { "cpl", "vis_lines", NULL }; |
| | 538 | + int cpl, vis_lines; |
| | 539 | + |
| | 540 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"ii:Gtk.Hex.set_geometry", kwlist, &cpl, &vis_lines)) |
| | 541 | + return NULL; |
| | 542 | + |
| | 543 | + gtk_hex_set_geometry(GTK_HEX(self->obj), cpl, vis_lines); |
| | 544 | + |
| | 545 | + Py_INCREF(Py_None); |
| | 546 | + return Py_None; |
| | 547 | +} |
| | 548 | + |
| | 549 | +static PyObject * |
| | 550 | +_wrap_gtk_hex_copy_to_clipboard(PyGObject *self) |
| | 551 | +{ |
| | 552 | + |
| | 553 | + gtk_hex_copy_to_clipboard(GTK_HEX(self->obj)); |
| | 554 | + |
| | 555 | + Py_INCREF(Py_None); |
| | 556 | + return Py_None; |
| | 557 | +} |
| | 558 | + |
| | 559 | +static PyObject * |
| | 560 | +_wrap_gtk_hex_cut_to_clipboard(PyGObject *self) |
| | 561 | +{ |
| | 562 | + |
| | 563 | + gtk_hex_cut_to_clipboard(GTK_HEX(self->obj)); |
| | 564 | + |
| | 565 | + Py_INCREF(Py_None); |
| | 566 | + return Py_None; |
| | 567 | +} |
| | 568 | + |
| | 569 | +static PyObject * |
| | 570 | +_wrap_gtk_hex_paste_from_clipboard(PyGObject *self) |
| | 571 | +{ |
| | 572 | + |
| | 573 | + gtk_hex_paste_from_clipboard(GTK_HEX(self->obj)); |
| | 574 | + |
| | 575 | + Py_INCREF(Py_None); |
| | 576 | + return Py_None; |
| | 577 | +} |
| | 578 | + |
| | 579 | +static PyObject * |
| | 580 | +_wrap_gtk_hex_set_selection(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 581 | +{ |
| | 582 | + static char *kwlist[] = { "start", "end", NULL }; |
| | 583 | + int start, end; |
| | 584 | + |
| | 585 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"ii:Gtk.Hex.set_selection", kwlist, &start, &end)) |
| | 586 | + return NULL; |
| | 587 | + |
| | 588 | + gtk_hex_set_selection(GTK_HEX(self->obj), start, end); |
| | 589 | + |
| | 590 | + Py_INCREF(Py_None); |
| | 591 | + return Py_None; |
| | 592 | +} |
| | 593 | + |
| | 594 | +#line 324 "gtkhex.override" |
| | 595 | +static PyObject * |
| | 596 | +_wrap_gtk_hex_get_selection(PyGObject *self) |
| | 597 | +{ |
| | 598 | + gint start, end; |
| | 599 | + |
| | 600 | + if (gtk_hex_get_selection(GTK_HEX(self->obj), &start, &end)) |
| | 601 | + return Py_BuildValue("(ii)", start, end); |
| | 602 | + |
| | 603 | + Py_INCREF(Py_None); |
| | 604 | + return Py_None; |
| | 605 | +} |
| | 606 | +#line 602 "gtkhex.c" |
| | 607 | + |
| | 608 | + |
| | 609 | +static PyObject * |
| | 610 | +_wrap_gtk_hex_clear_selection(PyGObject *self) |
| | 611 | +{ |
| | 612 | + |
| | 613 | + gtk_hex_clear_selection(GTK_HEX(self->obj)); |
| | 614 | + |
| | 615 | + Py_INCREF(Py_None); |
| | 616 | + return Py_None; |
| | 617 | +} |
| | 618 | + |
| | 619 | +static PyObject * |
| | 620 | +_wrap_gtk_hex_delete_selection(PyGObject *self) |
| | 621 | +{ |
| | 622 | + |
| | 623 | + gtk_hex_delete_selection(GTK_HEX(self->obj)); |
| | 624 | + |
| | 625 | + Py_INCREF(Py_None); |
| | 626 | + return Py_None; |
| | 627 | +} |
| | 628 | + |
| | 629 | +#line 355 "gtkhex.override" |
| | 630 | +static PyObject * |
| | 631 | +_wrap_gtk_hex_insert_autohighlight(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 632 | +{ |
| | 633 | + static char *kwlist[] = { "search", "colour", NULL }; |
| | 634 | + gchar *search = NULL, *colour = NULL; |
| | 635 | + int search_len; |
| | 636 | + |
| | 637 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s#s:GtkHex.insert_autohighlight", kwlist, |
| | 638 | + &search, &search_len, &colour)) |
| | 639 | + return NULL; |
| | 640 | + |
| | 641 | + if (search && colour) { |
| | 642 | + return ahl_new(gtk_hex_insert_autohighlight(GTK_HEX(self->obj), |
| | 643 | + search, search_len, colour)); |
| | 644 | + } |
| | 645 | + |
| | 646 | + Py_INCREF(Py_None); |
| | 647 | + return Py_None; |
| | 648 | +} |
| | 649 | +#line 645 "gtkhex.c" |
| | 650 | + |
| | 651 | + |
| | 652 | +#line 376 "gtkhex.override" |
| | 653 | +static PyObject * |
| | 654 | +_wrap_gtk_hex_delete_autohighlight(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 655 | +{ |
| | 656 | + static char *kwlist[] = { "ahl", NULL }; |
| | 657 | + PyAutoHighlight *ahl = NULL; |
| | 658 | + |
| | 659 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:GtkHex.delete_autohighlight", kwlist, &PyAutoHighlight_Type, &ahl)) |
| | 660 | + return NULL; |
| | 661 | + |
| | 662 | + if (ahl) { |
| | 663 | + if (ahl->ahl) { |
| | 664 | + gtk_hex_delete_autohighlight(GTK_HEX(self->obj), ahl->ahl); |
| | 665 | + ahl_dealloc(ahl); |
| | 666 | + } |
| | 667 | + else |
| | 668 | + PyErr_SetString(PyExc_ValueError, "Parameter 'ahl' already deleted."); |
| | 669 | + |
| | 670 | + if (PyErr_Occurred()) |
| | 671 | + return NULL; |
| | 672 | + } |
| | 673 | + |
| | 674 | + Py_INCREF(Py_None); |
| | 675 | + return Py_None; |
| | 676 | +} |
| | 677 | +#line 673 "gtkhex.c" |
| | 678 | + |
| | 679 | + |
| | 680 | +static PyObject * |
| | 681 | +_wrap_GtkHex__do_cursor_moved(PyObject *cls, PyObject *args, PyObject *kwargs) |
| | 682 | +{ |
| | 683 | + gpointer klass; |
| | 684 | + static char *kwlist[] = { "self", NULL }; |
| | 685 | + PyGObject *self; |
| | 686 | + |
| | 687 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:Gtk.Hex.cursor_moved", kwlist, &PyGtkHex_Type, &self)) |
| | 688 | + return NULL; |
| | 689 | + klass = g_type_class_ref(pyg_type_from_object(cls)); |
| | 690 | + if (GTK_HEX_CLASS(klass)->cursor_moved) |
| | 691 | + GTK_HEX_CLASS(klass)->cursor_moved(GTK_HEX(self->obj)); |
| | 692 | + else { |
| | 693 | + PyErr_SetString(PyExc_NotImplementedError, "virtual method Gtk.Hex.cursor_moved not implemented"); |
| | 694 | + g_type_class_unref(klass); |
| | 695 | + return NULL; |
| | 696 | + } |
| | 697 | + g_type_class_unref(klass); |
| | 698 | + Py_INCREF(Py_None); |
| | 699 | + return Py_None; |
| | 700 | +} |
| | 701 | + |
| | 702 | +static PyObject * |
| | 703 | +_wrap_GtkHex__do_cut_clipboard(PyObject *cls, PyObject *args, PyObject *kwargs) |
| | 704 | +{ |
| | 705 | + gpointer klass; |
| | 706 | + static char *kwlist[] = { "self", NULL }; |
| | 707 | + PyGObject *self; |
| | 708 | + |
| | 709 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:Gtk.Hex.cut_clipboard", kwlist, &PyGtkHex_Type, &self)) |
| | 710 | + return NULL; |
| | 711 | + klass = g_type_class_ref(pyg_type_from_object(cls)); |
| | 712 | + if (GTK_HEX_CLASS(klass)->cut_clipboard) |
| | 713 | + GTK_HEX_CLASS(klass)->cut_clipboard(GTK_HEX(self->obj)); |
| | 714 | + else { |
| | 715 | + PyErr_SetString(PyExc_NotImplementedError, "virtual method Gtk.Hex.cut_clipboard not implemented"); |
| | 716 | + g_type_class_unref(klass); |
| | 717 | + return NULL; |
| | 718 | + } |
| | 719 | + g_type_class_unref(klass); |
| | 720 | + Py_INCREF(Py_None); |
| | 721 | + return Py_None; |
| | 722 | +} |
| | 723 | + |
| | 724 | +static PyObject * |
| | 725 | +_wrap_GtkHex__do_copy_clipboard(PyObject *cls, PyObject *args, PyObject *kwargs) |
| | 726 | +{ |
| | 727 | + gpointer klass; |
| | 728 | + static char *kwlist[] = { "self", NULL }; |
| | 729 | + PyGObject *self; |
| | 730 | + |
| | 731 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:Gtk.Hex.copy_clipboard", kwlist, &PyGtkHex_Type, &self)) |
| | 732 | + return NULL; |
| | 733 | + klass = g_type_class_ref(pyg_type_from_object(cls)); |
| | 734 | + if (GTK_HEX_CLASS(klass)->copy_clipboard) |
| | 735 | + GTK_HEX_CLASS(klass)->copy_clipboard(GTK_HEX(self->obj)); |
| | 736 | + else { |
| | 737 | + PyErr_SetString(PyExc_NotImplementedError, "virtual method Gtk.Hex.copy_clipboard not implemented"); |
| | 738 | + g_type_class_unref(klass); |
| | 739 | + return NULL; |
| | 740 | + } |
| | 741 | + g_type_class_unref(klass); |
| | 742 | + Py_INCREF(Py_None); |
| | 743 | + return Py_None; |
| | 744 | +} |
| | 745 | + |
| | 746 | +static PyObject * |
| | 747 | +_wrap_GtkHex__do_paste_clipboard(PyObject *cls, PyObject *args, PyObject *kwargs) |
| | 748 | +{ |
| | 749 | + gpointer klass; |
| | 750 | + static char *kwlist[] = { "self", NULL }; |
| | 751 | + PyGObject *self; |
| | 752 | + |
| | 753 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:Gtk.Hex.paste_clipboard", kwlist, &PyGtkHex_Type, &self)) |
| | 754 | + return NULL; |
| | 755 | + klass = g_type_class_ref(pyg_type_from_object(cls)); |
| | 756 | + if (GTK_HEX_CLASS(klass)->paste_clipboard) |
| | 757 | + GTK_HEX_CLASS(klass)->paste_clipboard(GTK_HEX(self->obj)); |
| | 758 | + else { |
| | 759 | + PyErr_SetString(PyExc_NotImplementedError, "virtual method Gtk.Hex.paste_clipboard not implemented"); |
| | 760 | + g_type_class_unref(klass); |
| | 761 | + return NULL; |
| | 762 | + } |
| | 763 | + g_type_class_unref(klass); |
| | 764 | + Py_INCREF(Py_None); |
| | 765 | + return Py_None; |
| | 766 | +} |
| | 767 | + |
| | 768 | +static const PyMethodDef _PyGtkHex_methods[] = { |
| | 769 | + { "set_cursor", (PyCFunction)_wrap_gtk_hex_set_cursor, METH_VARARGS|METH_KEYWORDS, |
| | 770 | + NULL }, |
| | 771 | + { "set_cursor_xy", (PyCFunction)_wrap_gtk_hex_set_cursor_xy, METH_VARARGS|METH_KEYWORDS, |
| | 772 | + NULL }, |
| | 773 | + { "set_nibble", (PyCFunction)_wrap_gtk_hex_set_nibble, METH_VARARGS|METH_KEYWORDS, |
| | 774 | + NULL }, |
| | 775 | + { "get_cursor", (PyCFunction)_wrap_gtk_hex_get_cursor, METH_NOARGS, |
| | 776 | + NULL }, |
| | 777 | + { "get_byte", (PyCFunction)_wrap_gtk_hex_get_byte, METH_VARARGS|METH_KEYWORDS, |
| | 778 | + NULL }, |
| | 779 | + { "set_group_type", (PyCFunction)_wrap_gtk_hex_set_group_type, METH_VARARGS|METH_KEYWORDS, |
| | 780 | + NULL }, |
| | 781 | + { "set_starting_offset", (PyCFunction)_wrap_gtk_hex_set_starting_offset, METH_VARARGS|METH_KEYWORDS, |
| | 782 | + NULL }, |
| | 783 | + { "show_offsets", (PyCFunction)_wrap_gtk_hex_show_offsets, METH_VARARGS|METH_KEYWORDS, |
| | 784 | + NULL }, |
| | 785 | + { "set_font", (PyCFunction)_wrap_gtk_hex_set_font, METH_VARARGS|METH_KEYWORDS, |
| | 786 | + NULL }, |
| | 787 | + { "set_insert_mode", (PyCFunction)_wrap_gtk_hex_set_insert_mode, METH_VARARGS|METH_KEYWORDS, |
| | 788 | + NULL }, |
| | 789 | + { "set_read_only_mode", (PyCFunction)_wrap_gtk_hex_set_read_only_mode, METH_VARARGS|METH_KEYWORDS, |
| | 790 | + NULL }, |
| | 791 | + { "get_insert_mode", (PyCFunction)_wrap_gtk_hex_get_insert_mode, METH_NOARGS, |
| | 792 | + NULL }, |
| | 793 | + { "get_read_only_mode", (PyCFunction)_wrap_gtk_hex_get_read_only_mode, METH_NOARGS, |
| | 794 | + NULL }, |
| | 795 | + { "set_geometry", (PyCFunction)_wrap_gtk_hex_set_geometry, METH_VARARGS|METH_KEYWORDS, |
| | 796 | + NULL }, |
| | 797 | + { "copy_to_clipboard", (PyCFunction)_wrap_gtk_hex_copy_to_clipboard, METH_NOARGS, |
| | 798 | + NULL }, |
| | 799 | + { "cut_to_clipboard", (PyCFunction)_wrap_gtk_hex_cut_to_clipboard, METH_NOARGS, |
| | 800 | + NULL }, |
| | 801 | + { "paste_from_clipboard", (PyCFunction)_wrap_gtk_hex_paste_from_clipboard, METH_NOARGS, |
| | 802 | + NULL }, |
| | 803 | + { "set_selection", (PyCFunction)_wrap_gtk_hex_set_selection, METH_VARARGS|METH_KEYWORDS, |
| | 804 | + NULL }, |
| | 805 | + { "get_selection", (PyCFunction)_wrap_gtk_hex_get_selection, METH_NOARGS, |
| | 806 | + NULL }, |
| | 807 | + { "clear_selection", (PyCFunction)_wrap_gtk_hex_clear_selection, METH_NOARGS, |
| | 808 | + NULL }, |
| | 809 | + { "delete_selection", (PyCFunction)_wrap_gtk_hex_delete_selection, METH_NOARGS, |
| | 810 | + NULL }, |
| | 811 | + { "insert_autohighlight", (PyCFunction)_wrap_gtk_hex_insert_autohighlight, METH_VARARGS|METH_KEYWORDS, |
| | 812 | + NULL }, |
| | 813 | + { "delete_autohighlight", (PyCFunction)_wrap_gtk_hex_delete_autohighlight, METH_VARARGS|METH_KEYWORDS, |
| | 814 | + NULL }, |
| | 815 | + { "do_cursor_moved", (PyCFunction)_wrap_GtkHex__do_cursor_moved, METH_VARARGS|METH_KEYWORDS|METH_CLASS, |
| | 816 | + NULL }, |
| | 817 | + { "do_cut_clipboard", (PyCFunction)_wrap_GtkHex__do_cut_clipboard, METH_VARARGS|METH_KEYWORDS|METH_CLASS, |
| | 818 | + NULL }, |
| | 819 | + { "do_copy_clipboard", (PyCFunction)_wrap_GtkHex__do_copy_clipboard, METH_VARARGS|METH_KEYWORDS|METH_CLASS, |
| | 820 | + NULL }, |
| | 821 | + { "do_paste_clipboard", (PyCFunction)_wrap_GtkHex__do_paste_clipboard, METH_VARARGS|METH_KEYWORDS|METH_CLASS, |
| | 822 | + NULL }, |
| | 823 | + { NULL, NULL, 0, NULL } |
| | 824 | +}; |
| | 825 | + |
| | 826 | +PyTypeObject G_GNUC_INTERNAL PyGtkHex_Type = { |
| | 827 | + PyObject_HEAD_INIT(NULL) |
| | 828 | + 0, /* ob_size */ |
| | 829 | + "gtkhex.Hex", /* tp_name */ |
| | 830 | + sizeof(PyGObject), /* tp_basicsize */ |
| | 831 | + 0, /* tp_itemsize */ |
| | 832 | + /* methods */ |
| | 833 | + (destructor)0, /* tp_dealloc */ |
| | 834 | + (printfunc)0, /* tp_print */ |
| | 835 | + (getattrfunc)0, /* tp_getattr */ |
| | 836 | + (setattrfunc)0, /* tp_setattr */ |
| | 837 | + (cmpfunc)0, /* tp_compare */ |
| | 838 | + (reprfunc)0, /* tp_repr */ |
| | 839 | + (PyNumberMethods*)0, /* tp_as_number */ |
| | 840 | + (PySequenceMethods*)0, /* tp_as_sequence */ |
| | 841 | + (PyMappingMethods*)0, /* tp_as_mapping */ |
| | 842 | + (hashfunc)0, /* tp_hash */ |
| | 843 | + (ternaryfunc)0, /* tp_call */ |
| | 844 | + (reprfunc)0, /* tp_str */ |
| | 845 | + (getattrofunc)0, /* tp_getattro */ |
| | 846 | + (setattrofunc)0, /* tp_setattro */ |
| | 847 | + (PyBufferProcs*)0, /* tp_as_buffer */ |
| | 848 | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ |
| | 849 | + NULL, /* Documentation string */ |
| | 850 | + (traverseproc)0, /* tp_traverse */ |
| | 851 | + (inquiry)0, /* tp_clear */ |
| | 852 | + (richcmpfunc)0, /* tp_richcompare */ |
| | 853 | + offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ |
| | 854 | + (getiterfunc)0, /* tp_iter */ |
| | 855 | + (iternextfunc)0, /* tp_iternext */ |
| | 856 | + (struct PyMethodDef*)_PyGtkHex_methods, /* tp_methods */ |
| | 857 | + (struct PyMemberDef*)0, /* tp_members */ |
| | 858 | + (struct PyGetSetDef*)0, /* tp_getset */ |
| | 859 | + NULL, /* tp_base */ |
| | 860 | + NULL, /* tp_dict */ |
| | 861 | + (descrgetfunc)0, /* tp_descr_get */ |
| | 862 | + (descrsetfunc)0, /* tp_descr_set */ |
| | 863 | + offsetof(PyGObject, inst_dict), /* tp_dictoffset */ |
| | 864 | + (initproc)_wrap_gtk_hex_new, /* tp_init */ |
| | 865 | + (allocfunc)0, /* tp_alloc */ |
| | 866 | + (newfunc)0, /* tp_new */ |
| | 867 | + (freefunc)0, /* tp_free */ |
| | 868 | + (inquiry)0 /* tp_is_gc */ |
| | 869 | +}; |
| | 870 | + |
| | 871 | +static void |
| | 872 | +_wrap_GtkHex__proxy_do_cursor_moved(GtkHex *self) |
| | 873 | +{ |
| | 874 | + PyGILState_STATE __py_state; |
| | 875 | + PyObject *py_self; |
| | 876 | + PyObject *py_retval; |
| | 877 | + PyObject *py_method; |
| | 878 | + |
| | 879 | + __py_state = pyg_gil_state_ensure(); |
| | 880 | + py_self = pygobject_new((GObject *) self); |
| | 881 | + if (!py_self) { |
| | 882 | + if (PyErr_Occurred()) |
| | 883 | + PyErr_Print(); |
| | 884 | + pyg_gil_state_release(__py_state); |
| | 885 | + return; |
| | 886 | + } |
| | 887 | + |
| | 888 | + |
| | 889 | + py_method = PyObject_GetAttrString(py_self, "do_cursor_moved"); |
| | 890 | + if (!py_method) { |
| | 891 | + if (PyErr_Occurred()) |
| | 892 | + PyErr_Print(); |
| | 893 | + Py_DECREF(py_self); |
| | 894 | + pyg_gil_state_release(__py_state); |
| | 895 | + return; |
| | 896 | + } |
| | 897 | + py_retval = PyObject_CallObject(py_method, NULL); |
| | 898 | + if (!py_retval) { |
| | 899 | + if (PyErr_Occurred()) |
| | 900 | + PyErr_Print(); |
| | 901 | + Py_XDECREF(py_retval); |
| | 902 | + Py_DECREF(py_method); |
| | 903 | + Py_DECREF(py_self); |
| | 904 | + pyg_gil_state_release(__py_state); |
| | 905 | + return; |
| | 906 | + } |
| | 907 | + if (py_retval != Py_None) { |
| | 908 | + PyErr_SetString(PyExc_TypeError, "virtual method should return None"); |
| | 909 | + PyErr_Print(); |
| | 910 | + Py_XDECREF(py_retval); |
| | 911 | + Py_DECREF(py_method); |
| | 912 | + Py_DECREF(py_self); |
| | 913 | + pyg_gil_state_release(__py_state); |
| | 914 | + return; |
| | 915 | + } |
| | 916 | + |
| | 917 | + |
| | 918 | + Py_XDECREF(py_retval); |
| | 919 | + Py_DECREF(py_method); |
| | 920 | + Py_DECREF(py_self); |
| | 921 | + pyg_gil_state_release(__py_state); |
| | 922 | +} |
| | 923 | +static void |
| | 924 | +_wrap_GtkHex__proxy_do_cut_clipboard(GtkHex *self) |
| | 925 | +{ |
| | 926 | + PyGILState_STATE __py_state; |
| | 927 | + PyObject *py_self; |
| | 928 | + PyObject *py_retval; |
| | 929 | + PyObject *py_method; |
| | 930 | + |
| | 931 | + __py_state = pyg_gil_state_ensure(); |
| | 932 | + py_self = pygobject_new((GObject *) self); |
| | 933 | + if (!py_self) { |
| | 934 | + if (PyErr_Occurred()) |
| | 935 | + PyErr_Print(); |
| | 936 | + pyg_gil_state_release(__py_state); |
| | 937 | + return; |
| | 938 | + } |
| | 939 | + |
| | 940 | + |
| | 941 | + py_method = PyObject_GetAttrString(py_self, "do_cut_clipboard"); |
| | 942 | + if (!py_method) { |
| | 943 | + if (PyErr_Occurred()) |
| | 944 | + PyErr_Print(); |
| | 945 | + Py_DECREF(py_self); |
| | 946 | + pyg_gil_state_release(__py_state); |
| | 947 | + return; |
| | 948 | + } |
| | 949 | + py_retval = PyObject_CallObject(py_method, NULL); |
| | 950 | + if (!py_retval) { |
| | 951 | + if (PyErr_Occurred()) |
| | 952 | + PyErr_Print(); |
| | 953 | + Py_XDECREF(py_retval); |
| | 954 | + Py_DECREF(py_method); |
| | 955 | + Py_DECREF(py_self); |
| | 956 | + pyg_gil_state_release(__py_state); |
| | 957 | + return; |
| | 958 | + } |
| | 959 | + if (py_retval != Py_None) { |
| | 960 | + PyErr_SetString(PyExc_TypeError, "virtual method should return None"); |
| | 961 | + PyErr_Print(); |
| | 962 | + Py_XDECREF(py_retval); |
| | 963 | + Py_DECREF(py_method); |
| | 964 | + Py_DECREF(py_self); |
| | 965 | + pyg_gil_state_release(__py_state); |
| | 966 | + return; |
| | 967 | + } |
| | 968 | + |
| | 969 | + |
| | 970 | + Py_XDECREF(py_retval); |
| | 971 | + Py_DECREF(py_method); |
| | 972 | + Py_DECREF(py_self); |
| | 973 | + pyg_gil_state_release(__py_state); |
| | 974 | +} |
| | 975 | +static void |
| | 976 | +_wrap_GtkHex__proxy_do_copy_clipboard(GtkHex *self) |
| | 977 | +{ |
| | 978 | + PyGILState_STATE __py_state; |
| | 979 | + PyObject *py_self; |
| | 980 | + PyObject *py_retval; |
| | 981 | + PyObject *py_method; |
| | 982 | + |
| | 983 | + __py_state = pyg_gil_state_ensure(); |
| | 984 | + py_self = pygobject_new((GObject *) self); |
| | 985 | + if (!py_self) { |
| | 986 | + if (PyErr_Occurred()) |
| | 987 | + PyErr_Print(); |
| | 988 | + pyg_gil_state_release(__py_state); |
| | 989 | + return; |
| | 990 | + } |
| | 991 | + |
| | 992 | + |
| | 993 | + py_method = PyObject_GetAttrString(py_self, "do_copy_clipboard"); |
| | 994 | + if (!py_method) { |
| | 995 | + if (PyErr_Occurred()) |
| | 996 | + PyErr_Print(); |
| | 997 | + Py_DECREF(py_self); |
| | 998 | + pyg_gil_state_release(__py_state); |
| | 999 | + return; |
| | 1000 | + } |
| | 1001 | + py_retval = PyObject_CallObject(py_method, NULL); |
| | 1002 | + if (!py_retval) { |
| | 1003 | + if (PyErr_Occurred()) |
| | 1004 | + PyErr_Print(); |
| | 1005 | + Py_XDECREF(py_retval); |
| | 1006 | + Py_DECREF(py_method); |
| | 1007 | + Py_DECREF(py_self); |
| | 1008 | + pyg_gil_state_release(__py_state); |
| | 1009 | + return; |
| | 1010 | + } |
| | 1011 | + if (py_retval != Py_None) { |
| | 1012 | + PyErr_SetString(PyExc_TypeError, "virtual method should return None"); |
| | 1013 | + PyErr_Print(); |
| | 1014 | + Py_XDECREF(py_retval); |
| | 1015 | + Py_DECREF(py_method); |
| | 1016 | + Py_DECREF(py_self); |
| | 1017 | + pyg_gil_state_release(__py_state); |
| | 1018 | + return; |
| | 1019 | + } |
| | 1020 | + |
| | 1021 | + |
| | 1022 | + Py_XDECREF(py_retval); |
| | 1023 | + Py_DECREF(py_method); |
| | 1024 | + Py_DECREF(py_self); |
| | 1025 | + pyg_gil_state_release(__py_state); |
| | 1026 | +} |
| | 1027 | +static void |
| | 1028 | +_wrap_GtkHex__proxy_do_paste_clipboard(GtkHex *self) |
| | 1029 | +{ |
| | 1030 | + PyGILState_STATE __py_state; |
| | 1031 | + PyObject *py_self; |
| | 1032 | + PyObject *py_retval; |
| | 1033 | + PyObject *py_method; |
| | 1034 | + |
| | 1035 | + __py_state = pyg_gil_state_ensure(); |
| | 1036 | + py_self = pygobject_new((GObject *) self); |
| | 1037 | + if (!py_self) { |
| | 1038 | + if (PyErr_Occurred()) |
| | 1039 | + PyErr_Print(); |
| | 1040 | + pyg_gil_state_release(__py_state); |
| | 1041 | + return; |
| | 1042 | + } |
| | 1043 | + |
| | 1044 | + |
| | 1045 | + py_method = PyObject_GetAttrString(py_self, "do_paste_clipboard"); |
| | 1046 | + if (!py_method) { |
| | 1047 | + if (PyErr_Occurred()) |
| | 1048 | + PyErr_Print(); |
| | 1049 | + Py_DECREF(py_self); |
| | 1050 | + pyg_gil_state_release(__py_state); |
| | 1051 | + return; |
| | 1052 | + } |
| | 1053 | + py_retval = PyObject_CallObject(py_method, NULL); |
| | 1054 | + if (!py_retval) { |
| | 1055 | + if (PyErr_Occurred()) |
| | 1056 | + PyErr_Print(); |
| | 1057 | + Py_XDECREF(py_retval); |
| | 1058 | + Py_DECREF(py_method); |
| | 1059 | + Py_DECREF(py_self); |
| | 1060 | + pyg_gil_state_release(__py_state); |
| | 1061 | + return; |
| | 1062 | + } |
| | 1063 | + if (py_retval != Py_None) { |
| | 1064 | + PyErr_SetString(PyExc_TypeError, "virtual method should return None"); |
| | 1065 | + PyErr_Print(); |
| | 1066 | + Py_XDECREF(py_retval); |
| | 1067 | + Py_DECREF(py_method); |
| | 1068 | + Py_DECREF(py_self); |
| | 1069 | + pyg_gil_state_release(__py_state); |
| | 1070 | + return; |
| | 1071 | + } |
| | 1072 | + |
| | 1073 | + |
| | 1074 | + Py_XDECREF(py_retval); |
| | 1075 | + Py_DECREF(py_method); |
| | 1076 | + Py_DECREF(py_self); |
| | 1077 | + pyg_gil_state_release(__py_state); |
| | 1078 | +} |
| | 1079 | + |
| | 1080 | +static int |
| | 1081 | +__GtkHex_class_init(gpointer gclass, PyTypeObject *pyclass) |
| | 1082 | +{ |
| | 1083 | + PyObject *o; |
| | 1084 | + GtkHexClass *klass = GTK_HEX_CLASS(gclass); |
| | 1085 | + PyObject *gsignals = PyDict_GetItemString(pyclass->tp_dict, "__gsignals__"); |
| | 1086 | + |
| | 1087 | + o = PyObject_GetAttrString((PyObject *) pyclass, "do_cursor_moved"); |
| | 1088 | + if (o == NULL) |
| | 1089 | + PyErr_Clear(); |
| | 1090 | + else { |
| | 1091 | + if (!PyObject_TypeCheck(o, &PyCFunction_Type) |
| | 1092 | + && !(gsignals && PyDict_GetItemString(gsignals, "cursor_moved"))) |
| | 1093 | + klass->cursor_moved = _wrap_GtkHex__proxy_do_cursor_moved; |
| | 1094 | + Py_DECREF(o); |
| | 1095 | + } |
| | 1096 | + |
| | 1097 | + /* overriding do_data_changed is currently not supported */ |
| | 1098 | + |
| | 1099 | + o = PyObject_GetAttrString((PyObject *) pyclass, "do_cut_clipboard"); |
| | 1100 | + if (o == NULL) |
| | 1101 | + PyErr_Clear(); |
| | 1102 | + else { |
| | 1103 | + if (!PyObject_TypeCheck(o, &PyCFunction_Type) |
| | 1104 | + && !(gsignals && PyDict_GetItemString(gsignals, "cut_clipboard"))) |
| | 1105 | + klass->cut_clipboard = _wrap_GtkHex__proxy_do_cut_clipboard; |
| | 1106 | + Py_DECREF(o); |
| | 1107 | + } |
| | 1108 | + |
| | 1109 | + o = PyObject_GetAttrString((PyObject *) pyclass, "do_copy_clipboard"); |
| | 1110 | + if (o == NULL) |
| | 1111 | + PyErr_Clear(); |
| | 1112 | + else { |
| | 1113 | + if (!PyObject_TypeCheck(o, &PyCFunction_Type) |
| | 1114 | + && !(gsignals && PyDict_GetItemString(gsignals, "copy_clipboard"))) |
| | 1115 | + klass->copy_clipboard = _wrap_GtkHex__proxy_do_copy_clipboard; |
| | 1116 | + Py_DECREF(o); |
| | 1117 | + } |
| | 1118 | + |
| | 1119 | + o = PyObject_GetAttrString((PyObject *) pyclass, "do_paste_clipboard"); |
| | 1120 | + if (o == NULL) |
| | 1121 | + PyErr_Clear(); |
| | 1122 | + else { |
| | 1123 | + if (!PyObject_TypeCheck(o, &PyCFunction_Type) |
| | 1124 | + && !(gsignals && PyDict_GetItemString(gsignals, "paste_clipboard"))) |
| | 1125 | + klass->paste_clipboard = _wrap_GtkHex__proxy_do_paste_clipboard; |
| | 1126 | + Py_DECREF(o); |
| | 1127 | + } |
| | 1128 | + return 0; |
| | 1129 | +} |
| | 1130 | + |
| | 1131 | + |
| | 1132 | +/* ----------- HexDocument ----------- */ |
| | 1133 | + |
| | 1134 | +static int |
| | 1135 | +_wrap_hex_document_new(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1136 | +{ |
| | 1137 | + static char* kwlist[] = { NULL }; |
| | 1138 | + |
| | 1139 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
| | 1140 | + ":gtkhex.Document.__init__", |
| | 1141 | + kwlist)) |
| | 1142 | + return -1; |
| | 1143 | + |
| | 1144 | + pygobject_constructv(self, 0, NULL); |
| | 1145 | + if (!self->obj) { |
| | 1146 | + PyErr_SetString( |
| | 1147 | + PyExc_RuntimeError, |
| | 1148 | + "could not create gtkhex.Document object"); |
| | 1149 | + return -1; |
| | 1150 | + } |
| | 1151 | + return 0; |
| | 1152 | +} |
| | 1153 | + |
| | 1154 | +static PyObject * |
| | 1155 | +_wrap_hex_document_set_data(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1156 | +{ |
| | 1157 | + static char *kwlist[] = { "offset", "len", "rep_len", "data", "undoable", NULL }; |
| | 1158 | + PyObject *py_offset = NULL, *py_len = NULL, *py_rep_len = NULL; |
| | 1159 | + int data_len, undoable; |
| | 1160 | + guchar *data; |
| | 1161 | + guint offset = 0, len = 0, rep_len = 0; |
| | 1162 | + |
| | 1163 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"OOOs#i:Hex.Document.set_data", kwlist, &py_offset, &py_len, &py_rep_len, &data, &data_len, &undoable)) |
| | 1164 | + return NULL; |
| | 1165 | + if (py_offset) { |
| | 1166 | + if (PyLong_Check(py_offset)) |
| | 1167 | + offset = PyLong_AsUnsignedLong(py_offset); |
| | 1168 | + else if (PyInt_Check(py_offset)) |
| | 1169 | + offset = PyInt_AsLong(py_offset); |
| | 1170 | + else |
| | 1171 | + PyErr_SetString(PyExc_TypeError, "Parameter 'offset' must be an int or a long"); |
| | 1172 | + if (PyErr_Occurred()) |
| | 1173 | + return NULL; |
| | 1174 | + } |
| | 1175 | + if (py_len) { |
| | 1176 | + if (PyLong_Check(py_len)) |
| | 1177 | + len = PyLong_AsUnsignedLong(py_len); |
| | 1178 | + else if (PyInt_Check(py_len)) |
| | 1179 | + len = PyInt_AsLong(py_len); |
| | 1180 | + else |
| | 1181 | + PyErr_SetString(PyExc_TypeError, "Parameter 'len' must be an int or a long"); |
| | 1182 | + if (PyErr_Occurred()) |
| | 1183 | + return NULL; |
| | 1184 | + } |
| | 1185 | + if (py_rep_len) { |
| | 1186 | + if (PyLong_Check(py_rep_len)) |
| | 1187 | + rep_len = PyLong_AsUnsignedLong(py_rep_len); |
| | 1188 | + else if (PyInt_Check(py_rep_len)) |
| | 1189 | + rep_len = PyInt_AsLong(py_rep_len); |
| | 1190 | + else |
| | 1191 | + PyErr_SetString(PyExc_TypeError, "Parameter 'rep_len' must be an int or a long"); |
| | 1192 | + if (PyErr_Occurred()) |
| | 1193 | + return NULL; |
| | 1194 | + } |
| | 1195 | + |
| | 1196 | + hex_document_set_data(HEX_DOCUMENT(self->obj), offset, len, rep_len, data, undoable); |
| | 1197 | + |
| | 1198 | + Py_INCREF(Py_None); |
| | 1199 | + return Py_None; |
| | 1200 | +} |
| | 1201 | + |
| | 1202 | +static PyObject * |
| | 1203 | +_wrap_hex_document_set_byte(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1204 | +{ |
| | 1205 | + static char *kwlist[] = { "val", "offset", "insert", "undoable", NULL }; |
| | 1206 | + char val; |
| | 1207 | + PyObject *py_offset = NULL; |
| | 1208 | + int insert, undoable; |
| | 1209 | + guint offset = 0; |
| | 1210 | + |
| | 1211 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"cOii:Hex.Document.set_byte", kwlist, &val, &py_offset, &insert, &undoable)) |
| | 1212 | + return NULL; |
| | 1213 | + if (py_offset) { |
| | 1214 | + if (PyLong_Check(py_offset)) |
| | 1215 | + offset = PyLong_AsUnsignedLong(py_offset); |
| | 1216 | + else if (PyInt_Check(py_offset)) |
| | 1217 | + offset = PyInt_AsLong(py_offset); |
| | 1218 | + else |
| | 1219 | + PyErr_SetString(PyExc_TypeError, "Parameter 'offset' must be an int or a long"); |
| | 1220 | + if (PyErr_Occurred()) |
| | 1221 | + return NULL; |
| | 1222 | + } |
| | 1223 | + |
| | 1224 | + hex_document_set_byte(HEX_DOCUMENT(self->obj), val, offset, insert, undoable); |
| | 1225 | + |
| | 1226 | + Py_INCREF(Py_None); |
| | 1227 | + return Py_None; |
| | 1228 | +} |
| | 1229 | + |
| | 1230 | +static PyObject * |
| | 1231 | +_wrap_hex_document_set_nibble(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1232 | +{ |
| | 1233 | + static char *kwlist[] = { "val", "offset", "lower_nibble", "insert", "undoable", NULL }; |
| | 1234 | + char val; |
| | 1235 | + PyObject *py_offset = NULL; |
| | 1236 | + int lower_nibble, insert, undoable; |
| | 1237 | + guint offset = 0; |
| | 1238 | + |
| | 1239 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"cOiii:Hex.Document.set_nibble", kwlist, &val, &py_offset, &lower_nibble, &insert, &undoable)) |
| | 1240 | + return NULL; |
| | 1241 | + if (py_offset) { |
| | 1242 | + if (PyLong_Check(py_offset)) |
| | 1243 | + offset = PyLong_AsUnsignedLong(py_offset); |
| | 1244 | + else if (PyInt_Check(py_offset)) |
| | 1245 | + offset = PyInt_AsLong(py_offset); |
| | 1246 | + else |
| | 1247 | + PyErr_SetString(PyExc_TypeError, "Parameter 'offset' must be an int or a long"); |
| | 1248 | + if (PyErr_Occurred()) |
| | 1249 | + return NULL; |
| | 1250 | + } |
| | 1251 | + |
| | 1252 | + hex_document_set_nibble(HEX_DOCUMENT(self->obj), val, offset, lower_nibble, insert, undoable); |
| | 1253 | + |
| | 1254 | + Py_INCREF(Py_None); |
| | 1255 | + return Py_None; |
| | 1256 | +} |
| | 1257 | + |
| | 1258 | +#line 502 "gtkhex.override" |
| | 1259 | +static PyObject * |
| | 1260 | +_wrap_hex_document_get_byte(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1261 | +{ |
| | 1262 | + static char *kwlist[] = {"offset", NULL}; |
| | 1263 | + PyObject *py_offset = NULL; |
| | 1264 | + guint offset = 0; |
| | 1265 | + guchar ret; |
| | 1266 | + |
| | 1267 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:HexDocument.get_byte", kwlist, &py_offset)) |
| | 1268 | + return NULL; |
| | 1269 | + |
| | 1270 | + if (py_offset) { |
| | 1271 | + if (PyLong_Check(py_offset)) |
| | 1272 | + offset = PyLong_AsUnsignedLong(py_offset); |
| | 1273 | + else if (PyInt_Check(py_offset)) |
| | 1274 | + offset = PyInt_AsLong(py_offset); |
| | 1275 | + else |
| | 1276 | + PyErr_SetString(PyExc_TypeError, "Parameter 'offset' must be an int or a long"); |
| | 1277 | + if (PyErr_Occurred()) |
| | 1278 | + return NULL; |
| | 1279 | + } |
| | 1280 | + |
| | 1281 | + if ((offset >= 0) && offset < (HEX_DOCUMENT(self->obj))->file_size) { |
| | 1282 | + ret = hex_document_get_byte(HEX_DOCUMENT(self->obj), offset); |
| | 1283 | + return PyString_FromFormat("%c", ret); |
| | 1284 | + } |
| | 1285 | + |
| | 1286 | + Py_INCREF(Py_None); |
| | 1287 | + return Py_None; |
| | 1288 | +} |
| | 1289 | +#line 1285 "gtkhex.c" |
| | 1290 | + |
| | 1291 | + |
| | 1292 | +#line 534 "gtkhex.override" |
| | 1293 | +static PyObject * |
| | 1294 | +_wrap_hex_document_get_data(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1295 | +{ |
| | 1296 | + static char *kwlist[] = {"offset", "len", NULL}; |
| | 1297 | + PyObject *py_offset = NULL, *py_len = NULL; |
| | 1298 | + guint offset = 0, len = 0; |
| | 1299 | + guchar *ret; |
| | 1300 | + |
| | 1301 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:HexDocument.get_data", kwlist, |
| | 1302 | + &py_offset, &py_len)) |
| | 1303 | + return NULL; |
| | 1304 | + |
| | 1305 | + if (py_offset) { |
| | 1306 | + if (PyLong_Check(py_offset)) |
| | 1307 | + offset = PyLong_AsUnsignedLong(py_offset); |
| | 1308 | + else if (PyInt_Check(py_offset)) |
| | 1309 | + offset = PyInt_AsLong(py_offset); |
| | 1310 | + else |
| | 1311 | + PyErr_SetString(PyExc_TypeError, "Parameter 'offset' must be an int or a long"); |
| | 1312 | + if (PyErr_Occurred()) |
| | 1313 | + return NULL; |
| | 1314 | + } |
| | 1315 | + |
| | 1316 | + if (py_len) { |
| | 1317 | + if (PyLong_Check(py_len)) |
| | 1318 | + len = PyLong_AsUnsignedLong(py_len); |
| | 1319 | + else if (PyInt_Check(py_len)) |
| | 1320 | + len = PyInt_AsLong(py_len); |
| | 1321 | + else |
| | 1322 | + PyErr_SetString(PyExc_TypeError, "Parameter 'len' must be an int or a long"); |
| | 1323 | + if (PyErr_Occurred()) |
| | 1324 | + return NULL; |
| | 1325 | + } |
| | 1326 | + |
| | 1327 | + if ((offset >= 0) && offset <= (HEX_DOCUMENT(self->obj))->file_size && |
| | 1328 | + (len >= 0) && len <= ((HEX_DOCUMENT(self->obj))->file_size - offset)) { |
| | 1329 | + |
| | 1330 | + ret = hex_document_get_data(HEX_DOCUMENT(self->obj), offset, len); |
| | 1331 | + if (ret) { |
| | 1332 | + return PyString_FromStringAndSize(ret, len); |
| | 1333 | + } |
| | 1334 | + else { |
| | 1335 | + return PyString_FromStringAndSize(NULL, 0); |
| | 1336 | + } |
| | 1337 | + } |
| | 1338 | + |
| | 1339 | + PyErr_SetString(PyExc_ValueError, "Parameter 'offset' and/or 'len' are incorrect."); |
| | 1340 | + return NULL; |
| | 1341 | +} |
| | 1342 | +#line 1338 "gtkhex.c" |
| | 1343 | + |
| | 1344 | + |
| | 1345 | +static PyObject * |
| | 1346 | +_wrap_hex_document_delete_data(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1347 | +{ |
| | 1348 | + static char *kwlist[] = { "offset", "len", "undoable", NULL }; |
| | 1349 | + PyObject *py_offset = NULL, *py_len = NULL; |
| | 1350 | + int undoable; |
| | 1351 | + guint offset = 0, len = 0; |
| | 1352 | + |
| | 1353 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"OOi:Hex.Document.delete_data", kwlist, &py_offset, &py_len, &undoable)) |
| | 1354 | + return NULL; |
| | 1355 | + if (py_offset) { |
| | 1356 | + if (PyLong_Check(py_offset)) |
| | 1357 | + offset = PyLong_AsUnsignedLong(py_offset); |
| | 1358 | + else if (PyInt_Check(py_offset)) |
| | 1359 | + offset = PyInt_AsLong(py_offset); |
| | 1360 | + else |
| | 1361 | + PyErr_SetString(PyExc_TypeError, "Parameter 'offset' must be an int or a long"); |
| | 1362 | + if (PyErr_Occurred()) |
| | 1363 | + return NULL; |
| | 1364 | + } |
| | 1365 | + if (py_len) { |
| | 1366 | + if (PyLong_Check(py_len)) |
| | 1367 | + len = PyLong_AsUnsignedLong(py_len); |
| | 1368 | + else if (PyInt_Check(py_len)) |
| | 1369 | + len = PyInt_AsLong(py_len); |
| | 1370 | + else |
| | 1371 | + PyErr_SetString(PyExc_TypeError, "Parameter 'len' must be an int or a long"); |
| | 1372 | + if (PyErr_Occurred()) |
| | 1373 | + return NULL; |
| | 1374 | + } |
| | 1375 | + |
| | 1376 | + hex_document_delete_data(HEX_DOCUMENT(self->obj), offset, len, undoable); |
| | 1377 | + |
| | 1378 | + Py_INCREF(Py_None); |
| | 1379 | + return Py_None; |
| | 1380 | +} |
| | 1381 | + |
| | 1382 | +static PyObject * |
| | 1383 | +_wrap_hex_document_read(PyGObject *self) |
| | 1384 | +{ |
| | 1385 | + int ret; |
| | 1386 | + |
| | 1387 | + |
| | 1388 | + ret = hex_document_read(HEX_DOCUMENT(self->obj)); |
| | 1389 | + |
| | 1390 | + return PyInt_FromLong(ret); |
| | 1391 | +} |
| | 1392 | + |
| | 1393 | +static PyObject * |
| | 1394 | +_wrap_hex_document_write(PyGObject *self) |
| | 1395 | +{ |
| | 1396 | + int ret; |
| | 1397 | + |
| | 1398 | + |
| | 1399 | + ret = hex_document_write(HEX_DOCUMENT(self->obj)); |
| | 1400 | + |
| | 1401 | + return PyInt_FromLong(ret); |
| | 1402 | +} |
| | 1403 | + |
| | 1404 | +static PyObject * |
| | 1405 | +_wrap_hex_document_write_to_file(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1406 | +{ |
| | 1407 | + static char *kwlist[] = { "file", NULL }; |
| | 1408 | + PyObject *file; |
| | 1409 | + int ret; |
| | 1410 | + |
| | 1411 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:Hex.Document.write_to_file", kwlist, &PyFile_Type, &file)) |
| | 1412 | + return NULL; |
| | 1413 | + |
| | 1414 | + ret = hex_document_write_to_file(HEX_DOCUMENT(self->obj), PyFile_AsFile(file)); |
| | 1415 | + |
| | 1416 | + return PyInt_FromLong(ret); |
| | 1417 | +} |
| | 1418 | + |
| | 1419 | +static PyObject * |
| | 1420 | +_wrap_hex_document_export_html(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1421 | +{ |
| | 1422 | + static char *kwlist[] = { "html_path", "base_name", "start", "end", "cpl", "lpp", "cpw", NULL }; |
| | 1423 | + char *html_path, *base_name; |
| | 1424 | + PyObject *py_start = NULL, *py_end = NULL, *py_cpl = NULL, *py_lpp = NULL, *py_cpw = NULL; |
| | 1425 | + int ret; |
| | 1426 | + guint start = 0, end = 0, cpl = 0, lpp = 0, cpw = 0; |
| | 1427 | + |
| | 1428 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"ssOOOOO:Hex.Document.export_html", kwlist, &html_path, &base_name, &py_start, &py_end, &py_cpl, &py_lpp, &py_cpw)) |
| | 1429 | + return NULL; |
| | 1430 | + if (py_start) { |
| | 1431 | + if (PyLong_Check(py_start)) |
| | 1432 | + start = PyLong_AsUnsignedLong(py_start); |
| | 1433 | + else if (PyInt_Check(py_start)) |
| | 1434 | + start = PyInt_AsLong(py_start); |
| | 1435 | + else |
| | 1436 | + PyErr_SetString(PyExc_TypeError, "Parameter 'start' must be an int or a long"); |
| | 1437 | + if (PyErr_Occurred()) |
| | 1438 | + return NULL; |
| | 1439 | + } |
| | 1440 | + if (py_end) { |
| | 1441 | + if (PyLong_Check(py_end)) |
| | 1442 | + end = PyLong_AsUnsignedLong(py_end); |
| | 1443 | + else if (PyInt_Check(py_end)) |
| | 1444 | + end = PyInt_AsLong(py_end); |
| | 1445 | + else |
| | 1446 | + PyErr_SetString(PyExc_TypeError, "Parameter 'end' must be an int or a long"); |
| | 1447 | + if (PyErr_Occurred()) |
| | 1448 | + return NULL; |
| | 1449 | + } |
| | 1450 | + if (py_cpl) { |
| | 1451 | + if (PyLong_Check(py_cpl)) |
| | 1452 | + cpl = PyLong_AsUnsignedLong(py_cpl); |
| | 1453 | + else if (PyInt_Check(py_cpl)) |
| | 1454 | + cpl = PyInt_AsLong(py_cpl); |
| | 1455 | + else |
| | 1456 | + PyErr_SetString(PyExc_TypeError, "Parameter 'cpl' must be an int or a long"); |
| | 1457 | + if (PyErr_Occurred()) |
| | 1458 | + return NULL; |
| | 1459 | + } |
| | 1460 | + if (py_lpp) { |
| | 1461 | + if (PyLong_Check(py_lpp)) |
| | 1462 | + lpp = PyLong_AsUnsignedLong(py_lpp); |
| | 1463 | + else if (PyInt_Check(py_lpp)) |
| | 1464 | + lpp = PyInt_AsLong(py_lpp); |
| | 1465 | + else |
| | 1466 | + PyErr_SetString(PyExc_TypeError, "Parameter 'lpp' must be an int or a long"); |
| | 1467 | + if (PyErr_Occurred()) |
| | 1468 | + return NULL; |
| | 1469 | + } |
| | 1470 | + if (py_cpw) { |
| | 1471 | + if (PyLong_Check(py_cpw)) |
| | 1472 | + cpw = PyLong_AsUnsignedLong(py_cpw); |
| | 1473 | + else if (PyInt_Check(py_cpw)) |
| | 1474 | + cpw = PyInt_AsLong(py_cpw); |
| | 1475 | + else |
| | 1476 | + PyErr_SetString(PyExc_TypeError, "Parameter 'cpw' must be an int or a long"); |
| | 1477 | + if (PyErr_Occurred()) |
| | 1478 | + return NULL; |
| | 1479 | + } |
| | 1480 | + |
| | 1481 | + ret = hex_document_export_html(HEX_DOCUMENT(self->obj), html_path, base_name, start, end, cpl, lpp, cpw); |
| | 1482 | + |
| | 1483 | + return PyInt_FromLong(ret); |
| | 1484 | +} |
| | 1485 | + |
| | 1486 | +static PyObject * |
| | 1487 | +_wrap_hex_document_has_changed(PyGObject *self) |
| | 1488 | +{ |
| | 1489 | + int ret; |
| | 1490 | + |
| | 1491 | + |
| | 1492 | + ret = hex_document_has_changed(HEX_DOCUMENT(self->obj)); |
| | 1493 | + |
| | 1494 | + return PyBool_FromLong(ret); |
| | 1495 | + |
| | 1496 | +} |
| | 1497 | + |
| | 1498 | +static PyObject * |
| | 1499 | +_wrap_hex_document_set_max_undo(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1500 | +{ |
| | 1501 | + static char *kwlist[] = { "max_undo", NULL }; |
| | 1502 | + PyObject *py_max_undo = NULL; |
| | 1503 | + guint max_undo = 0; |
| | 1504 | + |
| | 1505 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:Hex.Document.set_max_undo", kwlist, &py_max_undo)) |
| | 1506 | + return NULL; |
| | 1507 | + if (py_max_undo) { |
| | 1508 | + if (PyLong_Check(py_max_undo)) |
| | 1509 | + max_undo = PyLong_AsUnsignedLong(py_max_undo); |
| | 1510 | + else if (PyInt_Check(py_max_undo)) |
| | 1511 | + max_undo = PyInt_AsLong(py_max_undo); |
| | 1512 | + else |
| | 1513 | + PyErr_SetString(PyExc_TypeError, "Parameter 'max_undo' must be an int or a long"); |
| | 1514 | + if (PyErr_Occurred()) |
| | 1515 | + return NULL; |
| | 1516 | + } |
| | 1517 | + |
| | 1518 | + hex_document_set_max_undo(HEX_DOCUMENT(self->obj), max_undo); |
| | 1519 | + |
| | 1520 | + Py_INCREF(Py_None); |
| | 1521 | + return Py_None; |
| | 1522 | +} |
| | 1523 | + |
| | 1524 | +static PyObject * |
| | 1525 | +_wrap_hex_document_undo(PyGObject *self) |
| | 1526 | +{ |
| | 1527 | + int ret; |
| | 1528 | + |
| | 1529 | + |
| | 1530 | + ret = hex_document_undo(HEX_DOCUMENT(self->obj)); |
| | 1531 | + |
| | 1532 | + return PyBool_FromLong(ret); |
| | 1533 | + |
| | 1534 | +} |
| | 1535 | + |
| | 1536 | +static PyObject * |
| | 1537 | +_wrap_hex_document_redo(PyGObject *self) |
| | 1538 | +{ |
| | 1539 | + int ret; |
| | 1540 | + |
| | 1541 | + |
| | 1542 | + ret = hex_document_redo(HEX_DOCUMENT(self->obj)); |
| | 1543 | + |
| | 1544 | + return PyBool_FromLong(ret); |
| | 1545 | + |
| | 1546 | +} |
| | 1547 | + |
| | 1548 | +static PyObject * |
| | 1549 | +_wrap_hex_document_compare_data(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1550 | +{ |
| | 1551 | + static char *kwlist[] = { "s2", "pos", "len", NULL }; |
| | 1552 | + int s2_len, pos, len, ret; |
| | 1553 | + guchar *s2; |
| | 1554 | + |
| | 1555 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s#ii:Hex.Document.compare_data", kwlist, &s2, &s2_len, &pos, &len)) |
| | 1556 | + return NULL; |
| | 1557 | + |
| | 1558 | + ret = hex_document_compare_data(HEX_DOCUMENT(self->obj), s2, pos, len); |
| | 1559 | + |
| | 1560 | + return PyInt_FromLong(ret); |
| | 1561 | +} |
| | 1562 | + |
| | 1563 | +#line 402 "gtkhex.override" |
| | 1564 | +static PyObject * |
| | 1565 | +_wrap_hex_document_find_forward(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1566 | +{ |
| | 1567 | + static char *kwlist[] = {"what", "start", NULL}; |
| | 1568 | + guchar *what; |
| | 1569 | + int what_len; |
| | 1570 | + PyObject *py_start = NULL; |
| | 1571 | + guint start = 0, found; |
| | 1572 | + |
| | 1573 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:HexDocument.find_forward", kwlist, &what, &what_len, &py_start)) |
| | 1574 | + return NULL; |
| | 1575 | + |
| | 1576 | + if (py_start) { |
| | 1577 | + if (PyLong_Check(py_start)) |
| | 1578 | + start = PyLong_AsUnsignedLong(py_start); |
| | 1579 | + else if (PyInt_Check(py_start)) |
| | 1580 | + start = PyInt_AsLong(py_start); |
| | 1581 | + else |
| | 1582 | + PyErr_SetString(PyExc_TypeError, "Parameter 'start' must be an int or a long"); |
| | 1583 | + if (PyErr_Occurred()) |
| | 1584 | + return NULL; |
| | 1585 | + } |
| | 1586 | + |
| | 1587 | + if (hex_document_find_forward(HEX_DOCUMENT(self->obj), start, what, what_len, &found)) |
| | 1588 | + return PyLong_FromUnsignedLong(found); |
| | 1589 | + else |
| | 1590 | + { |
| | 1591 | + Py_INCREF(Py_None); |
| | 1592 | + return Py_None; |
| | 1593 | + } |
| | 1594 | +} |
| | 1595 | +#line 1591 "gtkhex.c" |
| | 1596 | + |
| | 1597 | + |
| | 1598 | +#line 435 "gtkhex.override" |
| | 1599 | +static PyObject * |
| | 1600 | +_wrap_hex_document_find_backward(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1601 | +{ |
| | 1602 | + static char *kwlist[] = {"what", "start", NULL}; |
| | 1603 | + guchar *what; |
| | 1604 | + int what_len; |
| | 1605 | + PyObject *py_start = NULL; |
| | 1606 | + guint start = 0, found; |
| | 1607 | + |
| | 1608 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:HexDocument.find_backward", kwlist, &what, &what_len, &py_start)) |
| | 1609 | + return NULL; |
| | 1610 | + |
| | 1611 | + if (py_start) { |
| | 1612 | + if (PyLong_Check(py_start)) |
| | 1613 | + start = PyLong_AsUnsignedLong(py_start); |
| | 1614 | + else if (PyInt_Check(py_start)) |
| | 1615 | + start = PyInt_AsLong(py_start); |
| | 1616 | + else |
| | 1617 | + PyErr_SetString(PyExc_TypeError, "Parameter 'start' must be an int or a long"); |
| | 1618 | + if (PyErr_Occurred()) |
| | 1619 | + return NULL; |
| | 1620 | + } |
| | 1621 | + |
| | 1622 | + if (start <= HEX_DOCUMENT(self->obj)->file_size && |
| | 1623 | + hex_document_find_backward(HEX_DOCUMENT(self->obj), start, what, what_len, &found)) |
| | 1624 | + return PyLong_FromUnsignedLong(found); |
| | 1625 | + else |
| | 1626 | + { |
| | 1627 | + Py_INCREF(Py_None); |
| | 1628 | + return Py_None; |
| | 1629 | + } |
| | 1630 | +} |
| | 1631 | +#line 1627 "gtkhex.c" |
| | 1632 | + |
| | 1633 | + |
| | 1634 | +static PyObject * |
| | 1635 | +_wrap_hex_document_remove_view(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 1636 | +{ |
| | 1637 | + static char *kwlist[] = { "view", NULL }; |
| | 1638 | + PyGObject *view; |
| | 1639 | + |
| | 1640 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:Hex.Document.remove_view", kwlist, &PyGtkWidget_Type, &view)) |
| | 1641 | + return NULL; |
| | 1642 | + |
| | 1643 | + hex_document_remove_view(HEX_DOCUMENT(self->obj), GTK_WIDGET(view->obj)); |
| | 1644 | + |
| | 1645 | + Py_INCREF(Py_None); |
| | 1646 | + return Py_None; |
| | 1647 | +} |
| | 1648 | + |
| | 1649 | +static PyObject * |
| | 1650 | +_wrap_hex_document_add_view(PyGObject *self) |
| | 1651 | +{ |
| | 1652 | + GtkWidget *ret; |
| | 1653 | + |
| | 1654 | + |
| | 1655 | + ret = hex_document_add_view(HEX_DOCUMENT(self->obj)); |
| | 1656 | + |
| | 1657 | + /* pygobject_new handles NULL checking */ |
| | 1658 | + return pygobject_new((GObject *)ret); |
| | 1659 | +} |
| | 1660 | + |
| | 1661 | +static PyObject * |
| | 1662 | +_wrap_hex_document_is_writable(PyGObject *self) |
| | 1663 | +{ |
| | 1664 | + int ret; |
| | 1665 | + |
| | 1666 | + |
| | 1667 | + ret = hex_document_is_writable(HEX_DOCUMENT(self->obj)); |
| | 1668 | + |
| | 1669 | + return PyBool_FromLong(ret); |
| | 1670 | + |
| | 1671 | +} |
| | 1672 | + |
| | 1673 | +#line 608 "gtkhex.override" |
| | 1674 | +static PyObject * |
| | 1675 | +_wrap_HexDocument__do_document_changed(PyObject *cls, PyObject *args, PyObject *kwargs) |
| | 1676 | +{ |
| | 1677 | + gpointer klass; |
| | 1678 | + static char *kwlist[] = { "self", "change_data", "push_undo", NULL }; |
| | 1679 | + PyGObject *self; |
| | 1680 | + PyChangeData *py_change_data; |
| | 1681 | + gboolean push_undo; |
| | 1682 | + |
| | 1683 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!O!b:HexDocument.do_document_changed", kwlist, |
| | 1684 | + &PyHexDocument_Type, &self, &PyChangeData_Type, &py_change_data, &push_undo)) |
| | 1685 | + return NULL; |
| | 1686 | + klass = g_type_class_ref(pyg_type_from_object(cls)); |
| | 1687 | + if (HEX_DOCUMENT_CLASS(klass)->document_changed) |
| | 1688 | + HEX_DOCUMENT_CLASS(klass)->document_changed(HEX_DOCUMENT(self->obj), py_change_data->cdata, push_undo); |
| | 1689 | + else { |
| | 1690 | + PyErr_SetString(PyExc_NotImplementedError, "virtual method HexDocument.document_changed not implemented"); |
| | 1691 | + g_type_class_unref(klass); |
| | 1692 | + return NULL; |
| | 1693 | + } |
| | 1694 | + g_type_class_unref(klass); |
| | 1695 | + Py_INCREF(Py_None); |
| | 1696 | + return Py_None; |
| | 1697 | +} |
| | 1698 | +#line 1694 "gtkhex.c" |
| | 1699 | + |
| | 1700 | + |
| | 1701 | +static PyObject * |
| | 1702 | +_wrap_HexDocument__do_undo(PyObject *cls, PyObject *args, PyObject *kwargs) |
| | 1703 | +{ |
| | 1704 | + gpointer klass; |
| | 1705 | + static char *kwlist[] = { "self", NULL }; |
| | 1706 | + PyGObject *self; |
| | 1707 | + |
| | 1708 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:Hex.Document.undo", kwlist, &PyHexDocument_Type, &self)) |
| | 1709 | + return NULL; |
| | 1710 | + klass = g_type_class_ref(pyg_type_from_object(cls)); |
| | 1711 | + if (HEX_DOCUMENT_CLASS(klass)->undo) |
| | 1712 | + HEX_DOCUMENT_CLASS(klass)->undo(HEX_DOCUMENT(self->obj)); |
| | 1713 | + else { |
| | 1714 | + PyErr_SetString(PyExc_NotImplementedError, "virtual method Hex.Document.undo not implemented"); |
| | 1715 | + g_type_class_unref(klass); |
| | 1716 | + return NULL; |
| | 1717 | + } |
| | 1718 | + g_type_class_unref(klass); |
| | 1719 | + Py_INCREF(Py_None); |
| | 1720 | + return Py_None; |
| | 1721 | +} |
| | 1722 | + |
| | 1723 | +static PyObject * |
| | 1724 | +_wrap_HexDocument__do_redo(PyObject *cls, PyObject *args, PyObject *kwargs) |
| | 1725 | +{ |
| | 1726 | + gpointer klass; |
| | 1727 | + static char *kwlist[] = { "self", NULL }; |
| | 1728 | + PyGObject *self; |
| | 1729 | + |
| | 1730 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:Hex.Document.redo", kwlist, &PyHexDocument_Type, &self)) |
| | 1731 | + return NULL; |
| | 1732 | + klass = g_type_class_ref(pyg_type_from_object(cls)); |
| | 1733 | + if (HEX_DOCUMENT_CLASS(klass)->redo) |
| | 1734 | + HEX_DOCUMENT_CLASS(klass)->redo(HEX_DOCUMENT(self->obj)); |
| | 1735 | + else { |
| | 1736 | + PyErr_SetString(PyExc_NotImplementedError, "virtual method Hex.Document.redo not implemented"); |
| | 1737 | + g_type_class_unref(klass); |
| | 1738 | + return NULL; |
| | 1739 | + } |
| | 1740 | + g_type_class_unref(klass); |
| | 1741 | + Py_INCREF(Py_None); |
| | 1742 | + return Py_None; |
| | 1743 | +} |
| | 1744 | + |
| | 1745 | +static PyObject * |
| | 1746 | +_wrap_HexDocument__do_undo_stack_forget(PyObject *cls, PyObject *args, PyObject *kwargs) |
| | 1747 | +{ |
| | 1748 | + gpointer klass; |
| | 1749 | + static char *kwlist[] = { "self", NULL }; |
| | 1750 | + PyGObject *self; |
| | 1751 | + |
| | 1752 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:Hex.Document.undo_stack_forget", kwlist, &PyHexDocument_Type, &self)) |
| | 1753 | + return NULL; |
| | 1754 | + klass = g_type_class_ref(pyg_type_from_object(cls)); |
| | 1755 | + if (HEX_DOCUMENT_CLASS(klass)->undo_stack_forget) |
| | 1756 | + HEX_DOCUMENT_CLASS(klass)->undo_stack_forget(HEX_DOCUMENT(self->obj)); |
| | 1757 | + else { |
| | 1758 | + PyErr_SetString(PyExc_NotImplementedError, "virtual method Hex.Document.undo_stack_forget not implemented"); |
| | 1759 | + g_type_class_unref(klass); |
| | 1760 | + return NULL; |
| | 1761 | + } |
| | 1762 | + g_type_class_unref(klass); |
| | 1763 | + Py_INCREF(Py_None); |
| | 1764 | + return Py_None; |
| | 1765 | +} |
| | 1766 | + |
| | 1767 | +static const PyMethodDef _PyHexDocument_methods[] = { |
| | 1768 | + { "set_data", (PyCFunction)_wrap_hex_document_set_data, METH_VARARGS|METH_KEYWORDS, |
| | 1769 | + NULL }, |
| | 1770 | + { "set_byte", (PyCFunction)_wrap_hex_document_set_byte, METH_VARARGS|METH_KEYWORDS, |
| | 1771 | + NULL }, |
| | 1772 | + { "set_nibble", (PyCFunction)_wrap_hex_document_set_nibble, METH_VARARGS|METH_KEYWORDS, |
| | 1773 | + NULL }, |
| | 1774 | + { "get_byte", (PyCFunction)_wrap_hex_document_get_byte, METH_VARARGS|METH_KEYWORDS, |
| | 1775 | + NULL }, |
| | 1776 | + { "get_data", (PyCFunction)_wrap_hex_document_get_data, METH_VARARGS|METH_KEYWORDS, |
| | 1777 | + NULL }, |
| | 1778 | + { "delete_data", (PyCFunction)_wrap_hex_document_delete_data, METH_VARARGS|METH_KEYWORDS, |
| | 1779 | + NULL }, |
| | 1780 | + { "read", (PyCFunction)_wrap_hex_document_read, METH_NOARGS, |
| | 1781 | + NULL }, |
| | 1782 | + { "write", (PyCFunction)_wrap_hex_document_write, METH_NOARGS, |
| | 1783 | + NULL }, |
| | 1784 | + { "write_to_file", (PyCFunction)_wrap_hex_document_write_to_file, METH_VARARGS|METH_KEYWORDS, |
| | 1785 | + NULL }, |
| | 1786 | + { "export_html", (PyCFunction)_wrap_hex_document_export_html, METH_VARARGS|METH_KEYWORDS, |
| | 1787 | + NULL }, |
| | 1788 | + { "has_changed", (PyCFunction)_wrap_hex_document_has_changed, METH_NOARGS, |
| | 1789 | + NULL }, |
| | 1790 | + { "set_max_undo", (PyCFunction)_wrap_hex_document_set_max_undo, METH_VARARGS|METH_KEYWORDS, |
| | 1791 | + NULL }, |
| | 1792 | + { "undo", (PyCFunction)_wrap_hex_document_undo, METH_NOARGS, |
| | 1793 | + NULL }, |
| | 1794 | + { "redo", (PyCFunction)_wrap_hex_document_redo, METH_NOARGS, |
| | 1795 | + NULL }, |
| | 1796 | + { "compare_data", (PyCFunction)_wrap_hex_document_compare_data, METH_VARARGS|METH_KEYWORDS, |
| | 1797 | + NULL }, |
| | 1798 | + { "find_forward", (PyCFunction)_wrap_hex_document_find_forward, METH_VARARGS|METH_KEYWORDS, |
| | 1799 | + NULL }, |
| | 1800 | + { "find_backward", (PyCFunction)_wrap_hex_document_find_backward, METH_VARARGS|METH_KEYWORDS, |
| | 1801 | + NULL }, |
| | 1802 | + { "remove_view", (PyCFunction)_wrap_hex_document_remove_view, METH_VARARGS|METH_KEYWORDS, |
| | 1803 | + NULL }, |
| | 1804 | + { "add_view", (PyCFunction)_wrap_hex_document_add_view, METH_NOARGS, |
| | 1805 | + NULL }, |
| | 1806 | + { "is_writable", (PyCFunction)_wrap_hex_document_is_writable, METH_NOARGS, |
| | 1807 | + NULL }, |
| | 1808 | + { "do_document_changed", (PyCFunction)_wrap_HexDocument__do_document_changed, METH_VARARGS|METH_KEYWORDS|METH_CLASS, |
| | 1809 | + NULL }, |
| | 1810 | + { "do_undo", (PyCFunction)_wrap_HexDocument__do_undo, METH_VARARGS|METH_KEYWORDS|METH_CLASS, |
| | 1811 | + NULL }, |
| | 1812 | + { "do_redo", (PyCFunction)_wrap_HexDocument__do_redo, METH_VARARGS|METH_KEYWORDS|METH_CLASS, |
| | 1813 | + NULL }, |
| | 1814 | + { "do_undo_stack_forget", (PyCFunction)_wrap_HexDocument__do_undo_stack_forget, METH_VARARGS|METH_KEYWORDS|METH_CLASS, |
| | 1815 | + NULL }, |
| | 1816 | + { NULL, NULL, 0, NULL } |
| | 1817 | +}; |
| | 1818 | + |
| | 1819 | +static PyObject * |
| | 1820 | +_wrap_hex_document__get_file_name(PyObject *self, void *closure) |
| | 1821 | +{ |
| | 1822 | + const gchar *ret; |
| | 1823 | + |
| | 1824 | + ret = HEX_DOCUMENT(pygobject_get(self))->file_name; |
| | 1825 | + if (ret) |
| | 1826 | + return PyString_FromString(ret); |
| | 1827 | + Py_INCREF(Py_None); |
| | 1828 | + return Py_None; |
| | 1829 | +} |
| | 1830 | + |
| | 1831 | +static PyObject * |
| | 1832 | +_wrap_hex_document__get_path_end(PyObject *self, void *closure) |
| | 1833 | +{ |
| | 1834 | + const gchar *ret; |
| | 1835 | + |
| | 1836 | + ret = HEX_DOCUMENT(pygobject_get(self))->path_end; |
| | 1837 | + if (ret) |
| | 1838 | + return PyString_FromString(ret); |
| | 1839 | + Py_INCREF(Py_None); |
| | 1840 | + return Py_None; |
| | 1841 | +} |
| | 1842 | + |
| | 1843 | +static PyObject * |
| | 1844 | +_wrap_hex_document__get_gap_size(PyObject *self, void *closure) |
| | 1845 | +{ |
| | 1846 | + int ret; |
| | 1847 | + |
| | 1848 | + ret = HEX_DOCUMENT(pygobject_get(self))->gap_size; |
| | 1849 | + return PyInt_FromLong(ret); |
| | 1850 | +} |
| | 1851 | + |
| | 1852 | +static PyObject * |
| | 1853 | +_wrap_hex_document__get_buffer_size(PyObject *self, void *closure) |
| | 1854 | +{ |
| | 1855 | + guint ret; |
| | 1856 | + |
| | 1857 | + ret = HEX_DOCUMENT(pygobject_get(self))->buffer_size; |
| | 1858 | + return PyLong_FromUnsignedLong(ret); |
| | 1859 | +} |
| | 1860 | + |
| | 1861 | +static PyObject * |
| | 1862 | +_wrap_hex_document__get_file_size(PyObject *self, void *closure) |
| | 1863 | +{ |
| | 1864 | + guint ret; |
| | 1865 | + |
| | 1866 | + ret = HEX_DOCUMENT(pygobject_get(self))->file_size; |
| | 1867 | + return PyLong_FromUnsignedLong(ret); |
| | 1868 | +} |
| | 1869 | + |
| | 1870 | +static const PyGetSetDef hex_document_getsets[] = { |
| | 1871 | + { "file_name", (getter)_wrap_hex_document__get_file_name, (setter)0 }, |
| | 1872 | + { "path_end", (getter)_wrap_hex_document__get_path_end, (setter)0 }, |
| | 1873 | + { "gap_size", (getter)_wrap_hex_document__get_gap_size, (setter)0 }, |
| | 1874 | + { "buffer_size", (getter)_wrap_hex_document__get_buffer_size, (setter)0 }, |
| | 1875 | + { "file_size", (getter)_wrap_hex_document__get_file_size, (setter)0 }, |
| | 1876 | + { NULL, (getter)0, (setter)0 }, |
| | 1877 | +}; |
| | 1878 | + |
| | 1879 | +PyTypeObject G_GNUC_INTERNAL PyHexDocument_Type = { |
| | 1880 | + PyObject_HEAD_INIT(NULL) |
| | 1881 | + 0, /* ob_size */ |
| | 1882 | + "gtkhex.Document", /* tp_name */ |
| | 1883 | + sizeof(PyGObject), /* tp_basicsize */ |
| | 1884 | + 0, /* tp_itemsize */ |
| | 1885 | + /* methods */ |
| | 1886 | + (destructor)0, /* tp_dealloc */ |
| | 1887 | + (printfunc)0, /* tp_print */ |
| | 1888 | + (getattrfunc)0, /* tp_getattr */ |
| | 1889 | + (setattrfunc)0, /* tp_setattr */ |
| | 1890 | + (cmpfunc)0, /* tp_compare */ |
| | 1891 | + (reprfunc)0, /* tp_repr */ |
| | 1892 | + (PyNumberMethods*)0, /* tp_as_number */ |
| | 1893 | + (PySequenceMethods*)0, /* tp_as_sequence */ |
| | 1894 | + (PyMappingMethods*)0, /* tp_as_mapping */ |
| | 1895 | + (hashfunc)0, /* tp_hash */ |
| | 1896 | + (ternaryfunc)0, /* tp_call */ |
| | 1897 | + (reprfunc)0, /* tp_str */ |
| | 1898 | + (getattrofunc)0, /* tp_getattro */ |
| | 1899 | + (setattrofunc)0, /* tp_setattro */ |
| | 1900 | + (PyBufferProcs*)0, /* tp_as_buffer */ |
| | 1901 | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ |
| | 1902 | + NULL, /* Documentation string */ |
| | 1903 | + (traverseproc)0, /* tp_traverse */ |
| | 1904 | + (inquiry)0, /* tp_clear */ |
| | 1905 | + (richcmpfunc)0, /* tp_richcompare */ |
| | 1906 | + offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ |
| | 1907 | + (getiterfunc)0, /* tp_iter */ |
| | 1908 | + (iternextfunc)0, /* tp_iternext */ |
| | 1909 | + (struct PyMethodDef*)_PyHexDocument_methods, /* tp_methods */ |
| | 1910 | + (struct PyMemberDef*)0, /* tp_members */ |
| | 1911 | + (struct PyGetSetDef*)hex_document_getsets, /* tp_getset */ |
| | 1912 | + NULL, /* tp_base */ |
| | 1913 | + NULL, /* tp_dict */ |
| | 1914 | + (descrgetfunc)0, /* tp_descr_get */ |
| | 1915 | + (descrsetfunc)0, /* tp_descr_set */ |
| | 1916 | + offsetof(PyGObject, inst_dict), /* tp_dictoffset */ |
| | 1917 | + (initproc)_wrap_hex_document_new, /* tp_init */ |
| | 1918 | + (allocfunc)0, /* tp_alloc */ |
| | 1919 | + (newfunc)0, /* tp_new */ |
| | 1920 | + (freefunc)0, /* tp_free */ |
| | 1921 | + (inquiry)0 /* tp_is_gc */ |
| | 1922 | +}; |
| | 1923 | + |
| | 1924 | +#line 634 "gtkhex.override" |
| | 1925 | +static void |
| | 1926 | +_wrap_HexDocument__proxy_do_document_changed(HexDocument *self, gpointer change_data, gboolean push_undo) |
| | 1927 | +{ |
| | 1928 | + PyGILState_STATE __py_state; |
| | 1929 | + PyObject *py_self; |
| | 1930 | + PyObject *py_retval; |
| | 1931 | + PyObject *py_method; |
| | 1932 | + PyObject *py_args; |
| | 1933 | + |
| | 1934 | + __py_state = pyg_gil_state_ensure(); |
| | 1935 | + py_self = pygobject_new((GObject *) self); |
| | 1936 | + if (!py_self) { |
| | 1937 | + if (PyErr_Occurred()) |
| | 1938 | + PyErr_Print(); |
| | 1939 | + pyg_gil_state_release(__py_state); |
| | 1940 | + return; |
| | 1941 | + } |
| | 1942 | + |
| | 1943 | + py_args = PyTuple_New(2); |
| | 1944 | + PyTuple_SET_ITEM(py_args, 0, cdata_new_from_gpointer(change_data)); |
| | 1945 | + PyTuple_SET_ITEM(py_args, 1, PyBool_FromLong(push_undo)); |
| | 1946 | + |
| | 1947 | + py_method = PyObject_GetAttrString(py_self, "do_document_changed"); |
| | 1948 | + |
| | 1949 | + if (!py_method) { |
| | 1950 | + if (PyErr_Occurred()) |
| | 1951 | + PyErr_Print(); |
| | 1952 | + Py_DECREF(py_args); |
| | 1953 | + Py_DECREF(py_self); |
| | 1954 | + pyg_gil_state_release(__py_state); |
| | 1955 | + return; |
| | 1956 | + } |
| | 1957 | + |
| | 1958 | + py_retval = PyObject_CallObject(py_method, py_args); |
| | 1959 | + if (!py_retval) { |
| | 1960 | + if (PyErr_Occurred()) |
| | 1961 | + PyErr_Print(); |
| | 1962 | + Py_XDECREF(py_retval); |
| | 1963 | + Py_DECREF(py_method); |
| | 1964 | + Py_DECREF(py_args); |
| | 1965 | + Py_DECREF(py_self); |
| | 1966 | + pyg_gil_state_release(__py_state); |
| | 1967 | + return; |
| | 1968 | + } |
| | 1969 | + if (py_retval != Py_None) { |
| | 1970 | + PyErr_SetString(PyExc_TypeError, "virtual method should return None"); |
| | 1971 | + PyErr_Print(); |
| | 1972 | + Py_XDECREF(py_retval); |
| | 1973 | + Py_DECREF(py_method); |
| | 1974 | + Py_DECREF(py_args); |
| | 1975 | + Py_DECREF(py_self); |
| | 1976 | + pyg_gil_state_release(__py_state); |
| | 1977 | + return; |
| | 1978 | + } |
| | 1979 | + |
| | 1980 | + Py_XDECREF(py_retval); |
| | 1981 | + Py_DECREF(py_method); |
| | 1982 | + Py_DECREF(py_args); |
| | 1983 | + Py_DECREF(py_self); |
| | 1984 | + pyg_gil_state_release(__py_state); |
| | 1985 | +} |
| | 1986 | +#line 1982 "gtkhex.c" |
| | 1987 | + |
| | 1988 | + |
| | 1989 | +static void |
| | 1990 | +_wrap_HexDocument__proxy_do_undo(HexDocument *self) |
| | 1991 | +{ |
| | 1992 | + PyGILState_STATE __py_state; |
| | 1993 | + PyObject *py_self; |
| | 1994 | + PyObject *py_retval; |
| | 1995 | + PyObject *py_method; |
| | 1996 | + |
| | 1997 | + __py_state = pyg_gil_state_ensure(); |
| | 1998 | + py_self = pygobject_new((GObject *) self); |
| | 1999 | + if (!py_self) { |
| | 2000 | + if (PyErr_Occurred()) |
| | 2001 | + PyErr_Print(); |
| | 2002 | + pyg_gil_state_release(__py_state); |
| | 2003 | + return; |
| | 2004 | + } |
| | 2005 | + |
| | 2006 | + |
| | 2007 | + py_method = PyObject_GetAttrString(py_self, "do_undo"); |
| | 2008 | + if (!py_method) { |
| | 2009 | + if (PyErr_Occurred()) |
| | 2010 | + PyErr_Print(); |
| | 2011 | + Py_DECREF(py_self); |
| | 2012 | + pyg_gil_state_release(__py_state); |
| | 2013 | + return; |
| | 2014 | + } |
| | 2015 | + py_retval = PyObject_CallObject(py_method, NULL); |
| | 2016 | + if (!py_retval) { |
| | 2017 | + if (PyErr_Occurred()) |
| | 2018 | + PyErr_Print(); |
| | 2019 | + Py_XDECREF(py_retval); |
| | 2020 | + Py_DECREF(py_method); |
| | 2021 | + Py_DECREF(py_self); |
| | 2022 | + pyg_gil_state_release(__py_state); |
| | 2023 | + return; |
| | 2024 | + } |
| | 2025 | + if (py_retval != Py_None) { |
| | 2026 | + PyErr_SetString(PyExc_TypeError, "virtual method should return None"); |
| | 2027 | + PyErr_Print(); |
| | 2028 | + Py_XDECREF(py_retval); |
| | 2029 | + Py_DECREF(py_method); |
| | 2030 | + Py_DECREF(py_self); |
| | 2031 | + pyg_gil_state_release(__py_state); |
| | 2032 | + return; |
| | 2033 | + } |
| | 2034 | + |
| | 2035 | + |
| | 2036 | + Py_XDECREF(py_retval); |
| | 2037 | + Py_DECREF(py_method); |
| | 2038 | + Py_DECREF(py_self); |
| | 2039 | + pyg_gil_state_release(__py_state); |
| | 2040 | +} |
| | 2041 | +static void |
| | 2042 | +_wrap_HexDocument__proxy_do_redo(HexDocument *self) |
| | 2043 | +{ |
| | 2044 | + PyGILState_STATE __py_state; |
| | 2045 | + PyObject *py_self; |
| | 2046 | + PyObject *py_retval; |
| | 2047 | + PyObject *py_method; |
| | 2048 | + |
| | 2049 | + __py_state = pyg_gil_state_ensure(); |
| | 2050 | + py_self = pygobject_new((GObject *) self); |
| | 2051 | + if (!py_self) { |
| | 2052 | + if (PyErr_Occurred()) |
| | 2053 | + PyErr_Print(); |
| | 2054 | + pyg_gil_state_release(__py_state); |
| | 2055 | + return; |
| | 2056 | + } |
| | 2057 | + |
| | 2058 | + |
| | 2059 | + py_method = PyObject_GetAttrString(py_self, "do_redo"); |
| | 2060 | + if (!py_method) { |
| | 2061 | + if (PyErr_Occurred()) |
| | 2062 | + PyErr_Print(); |
| | 2063 | + Py_DECREF(py_self); |
| | 2064 | + pyg_gil_state_release(__py_state); |
| | 2065 | + return; |
| | 2066 | + } |
| | 2067 | + py_retval = PyObject_CallObject(py_method, NULL); |
| | 2068 | + if (!py_retval) { |
| | 2069 | + if (PyErr_Occurred()) |
| | 2070 | + PyErr_Print(); |
| | 2071 | + Py_XDECREF(py_retval); |
| | 2072 | + Py_DECREF(py_method); |
| | 2073 | + Py_DECREF(py_self); |
| | 2074 | + pyg_gil_state_release(__py_state); |
| | 2075 | + return; |
| | 2076 | + } |
| | 2077 | + if (py_retval != Py_None) { |
| | 2078 | + PyErr_SetString(PyExc_TypeError, "virtual method should return None"); |
| | 2079 | + PyErr_Print(); |
| | 2080 | + Py_XDECREF(py_retval); |
| | 2081 | + Py_DECREF(py_method); |
| | 2082 | + Py_DECREF(py_self); |
| | 2083 | + pyg_gil_state_release(__py_state); |
| | 2084 | + return; |
| | 2085 | + } |
| | 2086 | + |
| | 2087 | + |
| | 2088 | + Py_XDECREF(py_retval); |
| | 2089 | + Py_DECREF(py_method); |
| | 2090 | + Py_DECREF(py_self); |
| | 2091 | + pyg_gil_state_release(__py_state); |
| | 2092 | +} |
| | 2093 | +static void |
| | 2094 | +_wrap_HexDocument__proxy_do_undo_stack_forget(HexDocument *self) |
| | 2095 | +{ |
| | 2096 | + PyGILState_STATE __py_state; |
| | 2097 | + PyObject *py_self; |
| | 2098 | + PyObject *py_retval; |
| | 2099 | + PyObject *py_method; |
| | 2100 | + |
| | 2101 | + __py_state = pyg_gil_state_ensure(); |
| | 2102 | + py_self = pygobject_new((GObject *) self); |
| | 2103 | + if (!py_self) { |
| | 2104 | + if (PyErr_Occurred()) |
| | 2105 | + PyErr_Print(); |
| | 2106 | + pyg_gil_state_release(__py_state); |
| | 2107 | + return; |
| | 2108 | + } |
| | 2109 | + |
| | 2110 | + |
| | 2111 | + py_method = PyObject_GetAttrString(py_self, "do_undo_stack_forget"); |
| | 2112 | + if (!py_method) { |
| | 2113 | + if (PyErr_Occurred()) |
| | 2114 | + PyErr_Print(); |
| | 2115 | + Py_DECREF(py_self); |
| | 2116 | + pyg_gil_state_release(__py_state); |
| | 2117 | + return; |
| | 2118 | + } |
| | 2119 | + py_retval = PyObject_CallObject(py_method, NULL); |
| | 2120 | + if (!py_retval) { |
| | 2121 | + if (PyErr_Occurred()) |
| | 2122 | + PyErr_Print(); |
| | 2123 | + Py_XDECREF(py_retval); |
| | 2124 | + Py_DECREF(py_method); |
| | 2125 | + Py_DECREF(py_self); |
| | 2126 | + pyg_gil_state_release(__py_state); |
| | 2127 | + return; |
| | 2128 | + } |
| | 2129 | + if (py_retval != Py_None) { |
| | 2130 | + PyErr_SetString(PyExc_TypeError, "virtual method should return None"); |
| | 2131 | + PyErr_Print(); |
| | 2132 | + Py_XDECREF(py_retval); |
| | 2133 | + Py_DECREF(py_method); |
| | 2134 | + Py_DECREF(py_self); |
| | 2135 | + pyg_gil_state_release(__py_state); |
| | 2136 | + return; |
| | 2137 | + } |
| | 2138 | + |
| | 2139 | + |
| | 2140 | + Py_XDECREF(py_retval); |
| | 2141 | + Py_DECREF(py_method); |
| | 2142 | + Py_DECREF(py_self); |
| | 2143 | + pyg_gil_state_release(__py_state); |
| | 2144 | +} |
| | 2145 | + |
| | 2146 | +static int |
| | 2147 | +__HexDocument_class_init(gpointer gclass, PyTypeObject *pyclass) |
| | 2148 | +{ |
| | 2149 | + PyObject *o; |
| | 2150 | + HexDocumentClass *klass = HEX_DOCUMENT_CLASS(gclass); |
| | 2151 | + PyObject *gsignals = PyDict_GetItemString(pyclass->tp_dict, "__gsignals__"); |
| | 2152 | + |
| | 2153 | + o = PyObject_GetAttrString((PyObject *) pyclass, "do_document_changed"); |
| | 2154 | + if (o == NULL) |
| | 2155 | + PyErr_Clear(); |
| | 2156 | + else { |
| | 2157 | + if (!PyObject_TypeCheck(o, &PyCFunction_Type) |
| | 2158 | + && !(gsignals && PyDict_GetItemString(gsignals, "document_changed"))) |
| | 2159 | + klass->document_changed = _wrap_HexDocument__proxy_do_document_changed; |
| | 2160 | + Py_DECREF(o); |
| | 2161 | + } |
| | 2162 | + |
| | 2163 | + o = PyObject_GetAttrString((PyObject *) pyclass, "do_undo"); |
| | 2164 | + if (o == NULL) |
| | 2165 | + PyErr_Clear(); |
| | 2166 | + else { |
| | 2167 | + if (!PyObject_TypeCheck(o, &PyCFunction_Type) |
| | 2168 | + && !(gsignals && PyDict_GetItemString(gsignals, "undo"))) |
| | 2169 | + klass->undo = _wrap_HexDocument__proxy_do_undo; |
| | 2170 | + Py_DECREF(o); |
| | 2171 | + } |
| | 2172 | + |
| | 2173 | + o = PyObject_GetAttrString((PyObject *) pyclass, "do_redo"); |
| | 2174 | + if (o == NULL) |
| | 2175 | + PyErr_Clear(); |
| | 2176 | + else { |
| | 2177 | + if (!PyObject_TypeCheck(o, &PyCFunction_Type) |
| | 2178 | + && !(gsignals && PyDict_GetItemString(gsignals, "redo"))) |
| | 2179 | + klass->redo = _wrap_HexDocument__proxy_do_redo; |
| | 2180 | + Py_DECREF(o); |
| | 2181 | + } |
| | 2182 | + |
| | 2183 | + o = PyObject_GetAttrString((PyObject *) pyclass, "do_undo_stack_forget"); |
| | 2184 | + if (o == NULL) |
| | 2185 | + PyErr_Clear(); |
| | 2186 | + else { |
| | 2187 | + if (!PyObject_TypeCheck(o, &PyCFunction_Type) |
| | 2188 | + && !(gsignals && PyDict_GetItemString(gsignals, "undo_stack_forget"))) |
| | 2189 | + klass->undo_stack_forget = _wrap_HexDocument__proxy_do_undo_stack_forget; |
| | 2190 | + Py_DECREF(o); |
| | 2191 | + } |
| | 2192 | + return 0; |
| | 2193 | +} |
| | 2194 | + |
| | 2195 | + |
| | 2196 | +/* ----------- functions ----------- */ |
| | 2197 | + |
| | 2198 | +static PyObject * |
| | 2199 | +_wrap_add_atk_namedesc(PyObject *self, PyObject *args, PyObject *kwargs) |
| | 2200 | +{ |
| | 2201 | + static char *kwlist[] = { "widget", "name", "desc", NULL }; |
| | 2202 | + PyGObject *widget; |
| | 2203 | + char *name, *desc; |
| | 2204 | + |
| | 2205 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!ss:add_atk_namedesc", kwlist, &PyGtkWidget_Type, &widget, &name, &desc)) |
| | 2206 | + return NULL; |
| | 2207 | + |
| | 2208 | + add_atk_namedesc(GTK_WIDGET(widget->obj), name, desc); |
| | 2209 | + |
| | 2210 | + Py_INCREF(Py_None); |
| | 2211 | + return Py_None; |
| | 2212 | +} |
| | 2213 | + |
| | 2214 | +static PyObject * |
| | 2215 | +_wrap_add_atk_relation(PyObject *self, PyObject *args, PyObject *kwargs) |
| | 2216 | +{ |
| | 2217 | + static char *kwlist[] = { "obj1", "obj2", "type", NULL }; |
| | 2218 | + PyGObject *obj1, *obj2; |
| | 2219 | + AtkRelationType type; |
| | 2220 | + PyObject *py_type = NULL; |
| | 2221 | + |
| | 2222 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!O!O:add_atk_relation", kwlist, &PyGtkWidget_Type, &obj1, &PyGtkWidget_Type, &obj2, &py_type)) |
| | 2223 | + return NULL; |
| | 2224 | + if (pyg_enum_get_value(ATK_TYPE_RELATION_TYPE, py_type, (gpointer)&type)) |
| | 2225 | + return NULL; |
| | 2226 | + |
| | 2227 | + add_atk_relation(GTK_WIDGET(obj1->obj), GTK_WIDGET(obj2->obj), type); |
| | 2228 | + |
| | 2229 | + Py_INCREF(Py_None); |
| | 2230 | + return Py_None; |
| | 2231 | +} |
| | 2232 | + |
| | 2233 | +static PyObject * |
| | 2234 | +_wrap_hex_document_new_from_file(PyObject *self, PyObject *args, PyObject *kwargs) |
| | 2235 | +{ |
| | 2236 | + static char *kwlist[] = { "name", NULL }; |
| | 2237 | + char *name; |
| | 2238 | + HexDocument *ret; |
| | 2239 | + |
| | 2240 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:hex_document_new_from_file", kwlist, &name)) |
| | 2241 | + return NULL; |
| | 2242 | + |
| | 2243 | + ret = hex_document_new_from_file(name); |
| | 2244 | + |
| | 2245 | + /* pygobject_new handles NULL checking */ |
| | 2246 | + return pygobject_new((GObject *)ret); |
| | 2247 | +} |
| | 2248 | + |
| | 2249 | +#line 585 "gtkhex.override" |
| | 2250 | +static PyObject * |
| | 2251 | +_wrap_hex_document_get_list(PyGObject *self, PyObject *args, PyObject *kwargs) |
| | 2252 | +{ |
| | 2253 | + const GList *list; |
| | 2254 | + PyObject *item, *ret = PyList_New(0); |
| | 2255 | + |
| | 2256 | + for (list = hex_document_get_list(); list != NULL; |
| | 2257 | + list = list->next) { |
| | 2258 | + item = pygobject_new((GObject *)HEX_DOCUMENT(list->data)); |
| | 2259 | + if (!item) { |
| | 2260 | + Py_DECREF(ret); |
| | 2261 | + Py_INCREF(Py_None); |
| | 2262 | + return Py_None; |
| | 2263 | + } |
| | 2264 | + |
| | 2265 | + PyList_Append(ret, item); |
| | 2266 | + Py_DECREF(item); |
| | 2267 | + } |
| | 2268 | + |
| | 2269 | + return ret; |
| | 2270 | +} |
| | 2271 | +#line 2267 "gtkhex.c" |
| | 2272 | + |
| | 2273 | + |
| | 2274 | +const PyMethodDef gtkhex_functions[] = { |
| | 2275 | + { "add_atk_namedesc", (PyCFunction)_wrap_add_atk_namedesc, METH_VARARGS|METH_KEYWORDS, |
| | 2276 | + NULL }, |
| | 2277 | + { "add_atk_relation", (PyCFunction)_wrap_add_atk_relation, METH_VARARGS|METH_KEYWORDS, |
| | 2278 | + NULL }, |
| | 2279 | + { "hex_document_new_from_file", (PyCFunction)_wrap_hex_document_new_from_file, METH_VARARGS|METH_KEYWORDS, |
| | 2280 | + NULL }, |
| | 2281 | + { "hex_document_get_list", (PyCFunction)_wrap_hex_document_get_list, METH_NOARGS, |
| | 2282 | + NULL }, |
| | 2283 | + { NULL, NULL, 0, NULL } |
| | 2284 | +}; |
| | 2285 | + |
| | 2286 | + |
| | 2287 | +/* ----------- enums and flags ----------- */ |
| | 2288 | + |
| | 2289 | +void |
| | 2290 | +gtkhex_add_constants(PyObject *module, const gchar *strip_prefix) |
| | 2291 | +{ |
| | 2292 | +#ifdef VERSION |
| | 2293 | + PyModule_AddStringConstant(module, "__version__", VERSION); |
| | 2294 | +#endif |
| | 2295 | + PyModule_AddIntConstant(module, (char *) pyg_constant_strip_prefix("HEX_CHANGE_STRING", strip_prefix), HEX_CHANGE_STRING); |
| | 2296 | + PyModule_AddIntConstant(module, (char *) pyg_constant_strip_prefix("HEX_CHANGE_BYTE", strip_prefix), HEX_CHANGE_BYTE); |
| | 2297 | + PyModule_AddIntConstant(module, (char *) pyg_constant_strip_prefix("GROUP_BYTE", strip_prefix), GROUP_BYTE); |
| | 2298 | + PyModule_AddIntConstant(module, (char *) pyg_constant_strip_prefix("GROUP_WORD", strip_prefix), GROUP_WORD); |
| | 2299 | + PyModule_AddIntConstant(module, (char *) pyg_constant_strip_prefix("GROUP_LONG", strip_prefix), GROUP_LONG); |
| | 2300 | + |
| | 2301 | + if (PyErr_Occurred()) |
| | 2302 | + PyErr_Print(); |
| | 2303 | +} |
| | 2304 | + |
| | 2305 | +/* initialise stuff extension classes */ |
| | 2306 | +void |
| | 2307 | +gtkhex_register_classes(PyObject *d) |
| | 2308 | +{ |
| | 2309 | + PyObject *module; |
| | 2310 | + |
| | 2311 | + if ((module = PyImport_ImportModule("gobject")) != NULL) { |
| | 2312 | + _PyGObject_Type = (PyTypeObject *)PyObject_GetAttrString(module, "GObject"); |
| | 2313 | + if (_PyGObject_Type == NULL) { |
| | 2314 | + PyErr_SetString(PyExc_ImportError, |
| | 2315 | + "cannot import name GObject from gobject"); |
| | 2316 | + return ; |
| | 2317 | + } |
| | 2318 | + } else { |
| | 2319 | + PyErr_SetString(PyExc_ImportError, |
| | 2320 | + "could not import gobject"); |
| | 2321 | + return ; |
| | 2322 | + } |
| | 2323 | + if ((module = PyImport_ImportModule("gtk")) != NULL) { |
| | 2324 | + _PyGtkWidget_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Widget"); |
| | 2325 | + if (_PyGtkWidget_Type == NULL) { |
| | 2326 | + PyErr_SetString(PyExc_ImportError, |
| | 2327 | + "cannot import name Widget from gtk"); |
| | 2328 | + return ; |
| | 2329 | + } |
| | 2330 | + _PyGtkFixed_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Fixed"); |
| | 2331 | + if (_PyGtkFixed_Type == NULL) { |
| | 2332 | + PyErr_SetString(PyExc_ImportError, |
| | 2333 | + "cannot import name Fixed from gtk"); |
| | 2334 | + return ; |
| | 2335 | + } |
| | 2336 | + } else { |
| | 2337 | + PyErr_SetString(PyExc_ImportError, |
| | 2338 | + "could not import gtk"); |
| | 2339 | + return ; |
| | 2340 | + } |
| | 2341 | + if ((module = PyImport_ImportModule("atk")) != NULL) { |
| | 2342 | + _PyAtkObject_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Object"); |
| | 2343 | + if (_PyAtkObject_Type == NULL) { |
| | 2344 | + PyErr_SetString(PyExc_ImportError, |
| | 2345 | + "cannot import name Object from atk"); |
| | 2346 | + return ; |
| | 2347 | + } |
| | 2348 | + } else { |
| | 2349 | + PyErr_SetString(PyExc_ImportError, |
| | 2350 | + "could not import atk"); |
| | 2351 | + return ; |
| | 2352 | + } |
| | 2353 | + |
| | 2354 | + |
| | 2355 | +#line 2351 "gtkhex.c" |
| | 2356 | + pygobject_register_class(d, "GtkHex", GTK_TYPE_HEX, &PyGtkHex_Type, Py_BuildValue("(O)", &PyGtkFixed_Type)); |
| | 2357 | + pyg_set_object_has_new_constructor(GTK_TYPE_HEX); |
| | 2358 | + pyg_register_class_init(GTK_TYPE_HEX, __GtkHex_class_init); |
| | 2359 | + pygobject_register_class(d, "HexDocument", HEX_TYPE_DOCUMENT, &PyHexDocument_Type, Py_BuildValue("(O)", &PyGObject_Type)); |
| | 2360 | + pyg_set_object_has_new_constructor(HEX_TYPE_DOCUMENT); |
| | 2361 | + pyg_register_class_init(HEX_TYPE_DOCUMENT, __HexDocument_class_init); |
| | 2362 | +} |