[pygi] Apply consistent whitespace formatting with:
- From: Tomeu Vizoso <tomeuv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygi] Apply consistent whitespace formatting with:
- Date: Wed, 26 May 2010 11:23:29 +0000 (UTC)
commit 1319da5b7f483e48a90b0b7489f77236ba26f479
Author: Tomeu Vizoso <tomeu vizoso collabora co uk>
Date: Wed May 26 12:19:17 2010 +0200
Apply consistent whitespace formatting with:
astyle -p -d -c -S -U -M60
This won't affect git blame nor git diff if the switch -w is used.
gi/gimodule.c | 138 ++++----
gi/pygi-argument.c | 960 +++++++++++++++++++++++-----------------------
gi/pygi-boxed.c | 108 +++---
gi/pygi-callbacks.c | 154 ++++----
gi/pygi-callbacks.h | 8 +-
gi/pygi-closure.c | 270 +++++++-------
gi/pygi-closure.h | 18 +-
gi/pygi-foreign-cairo.c | 36 +-
gi/pygi-foreign-cairo.h | 36 +-
gi/pygi-foreign.c | 54 ++--
gi/pygi-foreign.h | 10 +-
gi/pygi-info.c | 646 ++++++++++++++++----------------
gi/pygi-invoke.c | 380 ++++++++++----------
gi/pygi-repository.c | 114 +++---
gi/pygi-struct.c | 88 +++---
gi/pygi-type.c | 32 +-
gi/pygi.h | 20 +-
gi/pygobject-external.h | 14 +-
18 files changed, 1544 insertions(+), 1542 deletions(-)
---
diff --git a/gi/gimodule.c b/gi/gimodule.c
index e0ea1e8..59601fb 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -37,18 +37,18 @@ _wrap_pyg_enum_add (PyObject *self,
PyObject *py_g_type;
GType g_type;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "O!:enum_add",
- kwlist, &PyGTypeWrapper_Type, &py_g_type)) {
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs,
+ "O!:enum_add",
+ kwlist, &PyGTypeWrapper_Type, &py_g_type)) {
return NULL;
}
- g_type = pyg_type_from_object(py_g_type);
+ g_type = pyg_type_from_object (py_g_type);
if (g_type == G_TYPE_INVALID) {
return NULL;
}
- return pyg_enum_add(NULL, g_type_name(g_type), NULL, g_type);
+ return pyg_enum_add (NULL, g_type_name (g_type), NULL, g_type);
}
static PyObject *
@@ -60,18 +60,18 @@ _wrap_pyg_flags_add (PyObject *self,
PyObject *py_g_type;
GType g_type;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "O!:flags_add",
- kwlist, &PyGTypeWrapper_Type, &py_g_type)) {
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs,
+ "O!:flags_add",
+ kwlist, &PyGTypeWrapper_Type, &py_g_type)) {
return NULL;
}
- g_type = pyg_type_from_object(py_g_type);
+ g_type = pyg_type_from_object (py_g_type);
if (g_type == G_TYPE_INVALID) {
return NULL;
}
- return pyg_flags_add(NULL, g_type_name(g_type), NULL, g_type);
+ return pyg_flags_add (NULL, g_type_name (g_type), NULL, g_type);
}
static PyObject *
@@ -83,19 +83,19 @@ _wrap_pyg_set_object_has_new_constructor (PyObject *self,
PyObject *py_g_type;
GType g_type;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "O!:set_object_has_new_constructor",
- kwlist, &PyGTypeWrapper_Type, &py_g_type)) {
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs,
+ "O!:set_object_has_new_constructor",
+ kwlist, &PyGTypeWrapper_Type, &py_g_type)) {
return NULL;
}
- g_type = pyg_type_from_object(py_g_type);
- if (!g_type_is_a(g_type, G_TYPE_OBJECT)) {
- PyErr_SetString(PyExc_TypeError, "must be a subtype of GObject");
+ g_type = pyg_type_from_object (py_g_type);
+ if (!g_type_is_a (g_type, G_TYPE_OBJECT)) {
+ PyErr_SetString (PyExc_TypeError, "must be a subtype of GObject");
return NULL;
}
- pyg_set_object_has_new_constructor(g_type);
+ pyg_set_object_has_new_constructor (g_type);
Py_RETURN_NONE;
}
@@ -107,27 +107,27 @@ initialize_interface (GTypeInterface *iface, PyTypeObject *pytype)
}
static PyObject *
-_wrap_pyg_register_interface_info(PyObject *self, PyObject *args)
+_wrap_pyg_register_interface_info (PyObject *self, PyObject *args)
{
PyObject *py_g_type;
GType g_type;
GInterfaceInfo *info;
- if (!PyArg_ParseTuple(args, "O!:register_interface_info",
- &PyGTypeWrapper_Type, &py_g_type)) {
+ if (!PyArg_ParseTuple (args, "O!:register_interface_info",
+ &PyGTypeWrapper_Type, &py_g_type)) {
return NULL;
}
- g_type = pyg_type_from_object(py_g_type);
- if (!g_type_is_a(g_type, G_TYPE_INTERFACE)) {
- PyErr_SetString(PyExc_TypeError, "must be an interface");
+ g_type = pyg_type_from_object (py_g_type);
+ if (!g_type_is_a (g_type, G_TYPE_INTERFACE)) {
+ PyErr_SetString (PyExc_TypeError, "must be an interface");
return NULL;
}
- info = g_new0(GInterfaceInfo, 1);
+ info = g_new0 (GInterfaceInfo, 1);
info->interface_init = (GInterfaceInitFunc) initialize_interface;
- pyg_register_interface_info(g_type, info);
+ pyg_register_interface_info (g_type, info);
Py_RETURN_NONE;
}
@@ -149,44 +149,44 @@ _wrap_pyg_hook_up_vfunc_implementation (PyObject *self, PyObject *args)
gboolean is_interface = FALSE;
PyGICClosure *closure = NULL;
- if (!PyArg_ParseTuple(args, "O!O!O:hook_up_vfunc_implementation",
- &PyGIBaseInfo_Type, &py_info,
- &PyGTypeWrapper_Type, &py_type,
- &py_function))
+ if (!PyArg_ParseTuple (args, "O!O!O:hook_up_vfunc_implementation",
+ &PyGIBaseInfo_Type, &py_info,
+ &PyGTypeWrapper_Type, &py_type,
+ &py_function))
return NULL;
- implementor_gtype = pyg_type_from_object(py_type);
- g_assert(G_TYPE_IS_CLASSED(implementor_gtype));
+ implementor_gtype = pyg_type_from_object (py_type);
+ g_assert (G_TYPE_IS_CLASSED (implementor_gtype));
vfunc_info = py_info->info;
- ancestor_info = g_base_info_get_container(vfunc_info);
- is_interface = g_base_info_get_type(ancestor_info) == GI_INFO_TYPE_INTERFACE;
+ ancestor_info = g_base_info_get_container (vfunc_info);
+ is_interface = g_base_info_get_type (ancestor_info) == GI_INFO_TYPE_INTERFACE;
- ancestor_g_type = g_registered_type_info_get_g_type(
- (GIRegisteredTypeInfo *)ancestor_info);
+ ancestor_g_type = g_registered_type_info_get_g_type (
+ (GIRegisteredTypeInfo *) ancestor_info);
- implementor_class = g_type_class_ref(implementor_gtype);
+ implementor_class = g_type_class_ref (implementor_gtype);
if (is_interface) {
GTypeInstance *implementor_iface_class;
- implementor_iface_class = g_type_interface_peek(implementor_class,
- ancestor_g_type);
+ implementor_iface_class = g_type_interface_peek (implementor_class,
+ ancestor_g_type);
if (implementor_iface_class == NULL) {
g_type_class_unref (implementor_class);
PyErr_Format (PyExc_RuntimeError,
- "Couldn't find GType of implementor of interface %s. "
- "Forgot to set __gtype_name__?",
- g_type_name (ancestor_g_type));
+ "Couldn't find GType of implementor of interface %s. "
+ "Forgot to set __gtype_name__?",
+ g_type_name (ancestor_g_type));
return NULL;
}
g_type_class_unref (implementor_class);
implementor_class = implementor_iface_class;
- struct_info = g_interface_info_get_iface_struct ((GIInterfaceInfo*)ancestor_info);
+ struct_info = g_interface_info_get_iface_struct ( (GIInterfaceInfo*) ancestor_info);
} else
- struct_info = g_object_info_get_class_struct ((GIObjectInfo*)ancestor_info);
+ struct_info = g_object_info_get_class_struct ( (GIObjectInfo*) ancestor_info);
- length = g_struct_info_get_n_fields(struct_info);
+ length = g_struct_info_get_n_fields (struct_info);
for (i = 0; i < length; i++) {
GIFieldInfo *field_info;
GITypeInfo *type_info;
@@ -196,8 +196,8 @@ _wrap_pyg_hook_up_vfunc_implementation (PyObject *self, PyObject *args)
field_info = g_struct_info_get_field (struct_info, i);
- if (strcmp(g_base_info_get_name((GIBaseInfo*) field_info),
- g_base_info_get_name((GIBaseInfo*) vfunc_info)) != 0)
+ if (strcmp (g_base_info_get_name ( (GIBaseInfo*) field_info),
+ g_base_info_get_name ( (GIBaseInfo*) vfunc_info)) != 0)
continue;
type_info = g_field_info_get_type (field_info);
@@ -205,14 +205,14 @@ _wrap_pyg_hook_up_vfunc_implementation (PyObject *self, PyObject *args)
continue;
interface_info = g_type_info_get_interface (type_info);
- g_assert(g_base_info_get_type(interface_info) == GI_INFO_TYPE_CALLBACK);
+ g_assert (g_base_info_get_type (interface_info) == GI_INFO_TYPE_CALLBACK);
callback_info = (GICallbackInfo*) interface_info;
- offset = g_field_info_get_offset(field_info);
- method_ptr = G_STRUCT_MEMBER_P(implementor_class, offset);
+ offset = g_field_info_get_offset (field_info);
+ method_ptr = G_STRUCT_MEMBER_P (implementor_class, offset);
- closure = _pygi_make_native_closure((GICallableInfo*)callback_info,
- GI_SCOPE_TYPE_NOTIFIED, py_function, NULL);
+ closure = _pygi_make_native_closure ( (GICallableInfo*) callback_info,
+ GI_SCOPE_TYPE_NOTIFIED, py_function, NULL);
*method_ptr = closure->closure;
@@ -232,20 +232,20 @@ _wrap_pyg_hook_up_vfunc_implementation (PyObject *self, PyObject *args)
}
static void
-_sink_gobject(GObject *obj)
+_sink_gobject (GObject *obj)
{
- if (G_IS_INITIALLY_UNOWNED(obj) || g_object_is_floating(obj)) {
- g_object_ref_sink(obj);
+ if (G_IS_INITIALLY_UNOWNED (obj) || g_object_is_floating (obj)) {
+ g_object_ref_sink (obj);
}
}
static PyMethodDef _pygi_functions[] = {
- { "enum_add", (PyCFunction)_wrap_pyg_enum_add, METH_VARARGS | METH_KEYWORDS },
- { "flags_add", (PyCFunction)_wrap_pyg_flags_add, METH_VARARGS | METH_KEYWORDS },
+ { "enum_add", (PyCFunction) _wrap_pyg_enum_add, METH_VARARGS | METH_KEYWORDS },
+ { "flags_add", (PyCFunction) _wrap_pyg_flags_add, METH_VARARGS | METH_KEYWORDS },
- { "set_object_has_new_constructor", (PyCFunction)_wrap_pyg_set_object_has_new_constructor, METH_VARARGS | METH_KEYWORDS },
- { "register_interface_info", (PyCFunction)_wrap_pyg_register_interface_info, METH_VARARGS },
- { "hook_up_vfunc_implementation", (PyCFunction)_wrap_pyg_hook_up_vfunc_implementation, METH_VARARGS },
+ { "set_object_has_new_constructor", (PyCFunction) _wrap_pyg_set_object_has_new_constructor, METH_VARARGS | METH_KEYWORDS },
+ { "register_interface_info", (PyCFunction) _wrap_pyg_register_interface_info, METH_VARARGS },
+ { "hook_up_vfunc_implementation", (PyCFunction) _wrap_pyg_hook_up_vfunc_implementation, METH_VARARGS },
{ NULL, NULL, 0 }
};
@@ -255,17 +255,17 @@ struct PyGI_API PyGI_API = {
PyMODINIT_FUNC
-init_gi(void)
+init_gi (void)
{
PyObject *m;
PyObject *api;
- m = Py_InitModule("_gi", _pygi_functions);
+ m = Py_InitModule ("_gi", _pygi_functions);
if (m == NULL) {
return;
}
- if (pygobject_init(-1, -1, -1) == NULL) {
+ if (pygobject_init (-1, -1, -1) == NULL) {
return;
}
@@ -280,18 +280,18 @@ init_gi(void)
// register our floating object sink while we wait for the pygobject
// patch to be approved. Once the patch is in this becomes a noop
// For more details - https://bugzilla.gnome.org/show_bug.cgi?id=583909
- pygobject_register_sinkfunc(G_TYPE_OBJECT, _sink_gobject);
+ pygobject_register_sinkfunc (G_TYPE_OBJECT, _sink_gobject);
- _pygi_repository_register_types(m);
- _pygi_info_register_types(m);
- _pygi_struct_register_types(m);
- _pygi_boxed_register_types(m);
+ _pygi_repository_register_types (m);
+ _pygi_info_register_types (m);
+ _pygi_struct_register_types (m);
+ _pygi_boxed_register_types (m);
_pygi_argument_init();
- api = PyCObject_FromVoidPtr((void *)&PyGI_API, NULL);
+ api = PyCObject_FromVoidPtr ( (void *) &PyGI_API, NULL);
if (api == NULL) {
return;
}
- PyModule_AddObject(m, "_API", api);
+ PyModule_AddObject (m, "_API", api);
}
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index 4f91fb9..ded5b12 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -35,78 +35,78 @@ _pygi_g_type_tag_py_bounds (GITypeTag type_tag,
PyObject **lower,
PyObject **upper)
{
- switch(type_tag) {
+ switch (type_tag) {
case GI_TYPE_TAG_INT8:
- *lower = PyInt_FromLong(-128);
- *upper = PyInt_FromLong(127);
+ *lower = PyInt_FromLong (-128);
+ *upper = PyInt_FromLong (127);
break;
case GI_TYPE_TAG_UINT8:
- *upper = PyInt_FromLong(255);
- *lower = PyInt_FromLong(0);
+ *upper = PyInt_FromLong (255);
+ *lower = PyInt_FromLong (0);
break;
case GI_TYPE_TAG_INT16:
- *lower = PyInt_FromLong(-32768);
- *upper = PyInt_FromLong(32767);
+ *lower = PyInt_FromLong (-32768);
+ *upper = PyInt_FromLong (32767);
break;
case GI_TYPE_TAG_UINT16:
- *upper = PyInt_FromLong(65535);
- *lower = PyInt_FromLong(0);
+ *upper = PyInt_FromLong (65535);
+ *lower = PyInt_FromLong (0);
break;
case GI_TYPE_TAG_INT32:
- *lower = PyInt_FromLong(G_MININT32);
- *upper = PyInt_FromLong(G_MAXINT32);
+ *lower = PyInt_FromLong (G_MININT32);
+ *upper = PyInt_FromLong (G_MAXINT32);
break;
case GI_TYPE_TAG_UINT32:
/* Note: On 32-bit archs, this number doesn't fit in a long. */
- *upper = PyLong_FromLongLong(G_MAXUINT32);
- *lower = PyInt_FromLong(0);
+ *upper = PyLong_FromLongLong (G_MAXUINT32);
+ *lower = PyInt_FromLong (0);
break;
case GI_TYPE_TAG_INT64:
/* Note: On 32-bit archs, these numbers don't fit in a long. */
- *lower = PyLong_FromLongLong(G_MININT64);
- *upper = PyLong_FromLongLong(G_MAXINT64);
+ *lower = PyLong_FromLongLong (G_MININT64);
+ *upper = PyLong_FromLongLong (G_MAXINT64);
break;
case GI_TYPE_TAG_UINT64:
- *upper = PyLong_FromUnsignedLongLong(G_MAXUINT64);
- *lower = PyInt_FromLong(0);
+ *upper = PyLong_FromUnsignedLongLong (G_MAXUINT64);
+ *lower = PyInt_FromLong (0);
break;
case GI_TYPE_TAG_SHORT:
- *lower = PyInt_FromLong(G_MINSHORT);
- *upper = PyInt_FromLong(G_MAXSHORT);
+ *lower = PyInt_FromLong (G_MINSHORT);
+ *upper = PyInt_FromLong (G_MAXSHORT);
break;
case GI_TYPE_TAG_USHORT:
- *upper = PyInt_FromLong(G_MAXUSHORT);
- *lower = PyInt_FromLong(0);
+ *upper = PyInt_FromLong (G_MAXUSHORT);
+ *lower = PyInt_FromLong (0);
break;
case GI_TYPE_TAG_INT:
- *lower = PyInt_FromLong(G_MININT);
- *upper = PyInt_FromLong(G_MAXINT);
+ *lower = PyInt_FromLong (G_MININT);
+ *upper = PyInt_FromLong (G_MAXINT);
break;
case GI_TYPE_TAG_UINT:
/* Note: On 32-bit archs, this number doesn't fit in a long. */
- *upper = PyLong_FromLongLong(G_MAXUINT);
- *lower = PyInt_FromLong(0);
+ *upper = PyLong_FromLongLong (G_MAXUINT);
+ *lower = PyInt_FromLong (0);
break;
case GI_TYPE_TAG_LONG:
case GI_TYPE_TAG_SSIZE:
- *lower = PyInt_FromLong(G_MINLONG);
- *upper = PyInt_FromLong(G_MAXLONG);
+ *lower = PyInt_FromLong (G_MINLONG);
+ *upper = PyInt_FromLong (G_MAXLONG);
break;
case GI_TYPE_TAG_ULONG:
case GI_TYPE_TAG_SIZE:
- *upper = PyLong_FromUnsignedLongLong(G_MAXULONG);
- *lower = PyInt_FromLong(0);
+ *upper = PyLong_FromUnsignedLongLong (G_MAXULONG);
+ *lower = PyInt_FromLong (0);
break;
case GI_TYPE_TAG_FLOAT:
- *upper = PyFloat_FromDouble(G_MAXFLOAT);
- *lower = PyFloat_FromDouble(-G_MAXFLOAT);
+ *upper = PyFloat_FromDouble (G_MAXFLOAT);
+ *lower = PyFloat_FromDouble (-G_MAXFLOAT);
break;
case GI_TYPE_TAG_DOUBLE:
- *upper = PyFloat_FromDouble(G_MAXDOUBLE);
- *lower = PyFloat_FromDouble(-G_MAXDOUBLE);
+ *upper = PyFloat_FromDouble (G_MAXDOUBLE);
+ *lower = PyFloat_FromDouble (-G_MAXDOUBLE);
break;
default:
- PyErr_SetString(PyExc_TypeError, "Non-numeric type tag");
+ PyErr_SetString (PyExc_TypeError, "Non-numeric type tag");
*lower = *upper = NULL;
return;
}
@@ -124,47 +124,47 @@ _pygi_g_registered_type_info_check_object (GIRegisteredTypeInfo *info,
gchar *type_name_expected = NULL;
GIInfoType interface_type;
- interface_type = g_base_info_get_type(info);
- if ((interface_type == GI_INFO_TYPE_STRUCT) &&
- (g_struct_info_is_foreign((GIStructInfo*)info))) {
+ interface_type = g_base_info_get_type (info);
+ if ( (interface_type == GI_INFO_TYPE_STRUCT) &&
+ (g_struct_info_is_foreign ( (GIStructInfo*) info))) {
/* TODO: Could we check is the correct foreign type? */
return 1;
}
- g_type = g_registered_type_info_get_g_type(info);
+ g_type = g_registered_type_info_get_g_type (info);
if (g_type != G_TYPE_NONE) {
- py_type = _pygi_type_get_from_g_type(g_type);
+ py_type = _pygi_type_get_from_g_type (g_type);
} else {
- py_type = _pygi_type_import_by_gi_info((GIBaseInfo *)info);
+ py_type = _pygi_type_import_by_gi_info ( (GIBaseInfo *) info);
}
if (py_type == NULL) {
return 0;
}
- g_assert(PyType_Check(py_type));
+ g_assert (PyType_Check (py_type));
if (is_instance) {
- retval = PyObject_IsInstance(object, py_type);
+ retval = PyObject_IsInstance (object, py_type);
if (!retval) {
- type_name_expected = _pygi_g_base_info_get_fullname(
- (GIBaseInfo *)info);
+ type_name_expected = _pygi_g_base_info_get_fullname (
+ (GIBaseInfo *) info);
}
} else {
- if (!PyObject_Type(py_type)) {
+ if (!PyObject_Type (py_type)) {
type_name_expected = "type";
retval = 0;
- } else if (!PyType_IsSubtype((PyTypeObject *)object,
- (PyTypeObject *)py_type)) {
- type_name_expected = _pygi_g_base_info_get_fullname(
- (GIBaseInfo *)info);
+ } else if (!PyType_IsSubtype ( (PyTypeObject *) object,
+ (PyTypeObject *) py_type)) {
+ type_name_expected = _pygi_g_base_info_get_fullname (
+ (GIBaseInfo *) info);
retval = 0;
} else {
retval = 1;
}
}
- Py_DECREF(py_type);
+ Py_DECREF (py_type);
if (!retval) {
PyTypeObject *object_type;
@@ -173,15 +173,15 @@ _pygi_g_registered_type_info_check_object (GIRegisteredTypeInfo *info,
return -1;
}
- object_type = (PyTypeObject *)PyObject_Type(object);
+ object_type = (PyTypeObject *) PyObject_Type (object);
if (object_type == NULL) {
return -1;
}
- PyErr_Format(PyExc_TypeError, "Must be %s, not %s",
- type_name_expected, object_type->tp_name);
+ PyErr_Format (PyExc_TypeError, "Must be %s, not %s",
+ type_name_expected, object_type->tp_name);
- g_free(type_name_expected);
+ g_free (type_name_expected);
}
return retval;
@@ -199,7 +199,7 @@ _pygi_g_type_info_check_object (GITypeInfo *type_info,
return retval;
}
- type_tag = g_type_info_get_tag(type_info);
+ type_tag = g_type_info_get_tag (type_info);
switch (type_tag) {
case GI_TYPE_TAG_VOID:
@@ -229,20 +229,20 @@ _pygi_g_type_info_check_object (GITypeInfo *type_info,
{
PyObject *number, *lower, *upper;
- if (!PyNumber_Check(object)) {
- PyErr_Format(PyExc_TypeError, "Must be number, not %s",
- object->ob_type->tp_name);
+ if (!PyNumber_Check (object)) {
+ PyErr_Format (PyExc_TypeError, "Must be number, not %s",
+ object->ob_type->tp_name);
retval = 0;
break;
}
if (type_tag == GI_TYPE_TAG_FLOAT || type_tag == GI_TYPE_TAG_DOUBLE) {
- number = PyNumber_Float(object);
+ number = PyNumber_Float (object);
} else {
- number = PyNumber_Int(object);
+ number = PyNumber_Int (object);
}
- _pygi_g_type_tag_py_bounds(type_tag, &lower, &upper);
+ _pygi_g_type_tag_py_bounds (type_tag, &lower, &upper);
if (lower == NULL || upper == NULL || number == NULL) {
retval = -1;
@@ -250,8 +250,8 @@ _pygi_g_type_info_check_object (GITypeInfo *type_info,
}
/* Check bounds */
- if (PyObject_Compare(lower, number) > 0
- || PyObject_Compare(upper, number) < 0) {
+ if (PyObject_Compare (lower, number) > 0
+ || PyObject_Compare (upper, number) < 0) {
PyObject *lower_str;
PyObject *upper_str;
@@ -260,34 +260,34 @@ _pygi_g_type_info_check_object (GITypeInfo *type_info,
goto check_number_release;
}
- lower_str = PyObject_Str(lower);
- upper_str = PyObject_Str(upper);
+ lower_str = PyObject_Str (lower);
+ upper_str = PyObject_Str (upper);
if (lower_str == NULL || upper_str == NULL) {
retval = -1;
goto check_number_error_release;
}
- PyErr_Format(PyExc_ValueError, "Must range from %s to %s",
- PyString_AS_STRING(lower_str),
- PyString_AS_STRING(upper_str));
+ PyErr_Format (PyExc_ValueError, "Must range from %s to %s",
+ PyString_AS_STRING (lower_str),
+ PyString_AS_STRING (upper_str));
retval = 0;
check_number_error_release:
- Py_XDECREF(lower_str);
- Py_XDECREF(upper_str);
+ Py_XDECREF (lower_str);
+ Py_XDECREF (upper_str);
}
check_number_release:
- Py_XDECREF(number);
- Py_XDECREF(lower);
- Py_XDECREF(upper);
+ Py_XDECREF (number);
+ Py_XDECREF (lower);
+ Py_XDECREF (upper);
break;
}
case GI_TYPE_TAG_TIME_T:
- if (!PyDateTime_Check(object)) {
- PyErr_Format(PyExc_TypeError, "Must be datetime.datetime, not %s",
- object->ob_type->tp_name);
+ if (!PyDateTime_Check (object)) {
+ PyErr_Format (PyExc_TypeError, "Must be datetime.datetime, not %s",
+ object->ob_type->tp_name);
retval = 0;
}
break;
@@ -295,24 +295,24 @@ check_number_release:
{
gint is_instance;
- is_instance = PyObject_IsInstance(object, (PyObject *)&PyGTypeWrapper_Type);
+ is_instance = PyObject_IsInstance (object, (PyObject *) &PyGTypeWrapper_Type);
if (is_instance < 0) {
retval = -1;
break;
}
- if (!is_instance && (!PyType_Check(object) || pyg_type_from_object(object) == 0)) {
- PyErr_Format(PyExc_TypeError, "Must be gobject.GType, not %s",
- object->ob_type->tp_name);
+ if (!is_instance && (!PyType_Check (object) || pyg_type_from_object (object) == 0)) {
+ PyErr_Format (PyExc_TypeError, "Must be gobject.GType, not %s",
+ object->ob_type->tp_name);
retval = 0;
}
break;
}
case GI_TYPE_TAG_UTF8:
case GI_TYPE_TAG_FILENAME:
- if (!PyString_Check(object)) {
- PyErr_Format(PyExc_TypeError, "Must be string, not %s",
- object->ob_type->tp_name);
+ if (!PyString_Check (object)) {
+ PyErr_Format (PyExc_TypeError, "Must be string, not %s",
+ object->ob_type->tp_name);
retval = 0;
}
break;
@@ -323,53 +323,53 @@ check_number_release:
GITypeInfo *item_type_info;
Py_ssize_t i;
- if (!PySequence_Check(object)) {
- PyErr_Format(PyExc_TypeError, "Must be sequence, not %s",
- object->ob_type->tp_name);
+ if (!PySequence_Check (object)) {
+ PyErr_Format (PyExc_TypeError, "Must be sequence, not %s",
+ object->ob_type->tp_name);
retval = 0;
break;
}
- length = PySequence_Length(object);
+ length = PySequence_Length (object);
if (length < 0) {
retval = -1;
break;
}
- fixed_size = g_type_info_get_array_fixed_size(type_info);
+ fixed_size = g_type_info_get_array_fixed_size (type_info);
if (fixed_size >= 0 && length != fixed_size) {
- PyErr_Format(PyExc_ValueError, "Must contain %zd items, not %zd",
- fixed_size, length);
+ PyErr_Format (PyExc_ValueError, "Must contain %zd items, not %zd",
+ fixed_size, length);
retval = 0;
break;
}
- item_type_info = g_type_info_get_param_type(type_info, 0);
- g_assert(item_type_info != NULL);
+ item_type_info = g_type_info_get_param_type (type_info, 0);
+ g_assert (item_type_info != NULL);
for (i = 0; i < length; i++) {
PyObject *item;
- item = PySequence_GetItem(object, i);
+ item = PySequence_GetItem (object, i);
if (item == NULL) {
retval = -1;
break;
}
- retval = _pygi_g_type_info_check_object(item_type_info, item, TRUE);
+ retval = _pygi_g_type_info_check_object (item_type_info, item, TRUE);
- Py_DECREF(item);
+ Py_DECREF (item);
if (retval < 0) {
break;
}
if (!retval) {
- _PyGI_ERROR_PREFIX("Item %zd: ", i);
+ _PyGI_ERROR_PREFIX ("Item %zd: ", i);
break;
}
}
- g_base_info_unref((GIBaseInfo *)item_type_info);
+ g_base_info_unref ( (GIBaseInfo *) item_type_info);
break;
}
@@ -378,59 +378,59 @@ check_number_release:
GIBaseInfo *info;
GIInfoType info_type;
- info = g_type_info_get_interface(type_info);
- g_assert(info != NULL);
+ info = g_type_info_get_interface (type_info);
+ g_assert (info != NULL);
- info_type = g_base_info_get_type(info);
+ info_type = g_base_info_get_type (info);
switch (info_type) {
case GI_INFO_TYPE_CALLBACK:
- if (!PyCallable_Check(object)) {
- PyErr_Format(PyExc_TypeError, "Must be callable, not %s",
- object->ob_type->tp_name);
+ if (!PyCallable_Check (object)) {
+ PyErr_Format (PyExc_TypeError, "Must be callable, not %s",
+ object->ob_type->tp_name);
retval = 0;
}
break;
case GI_INFO_TYPE_ENUM:
- retval = _pygi_g_registered_type_info_check_object(
- (GIRegisteredTypeInfo *)info, TRUE, object);
+ retval = _pygi_g_registered_type_info_check_object (
+ (GIRegisteredTypeInfo *) info, TRUE, object);
break;
case GI_INFO_TYPE_FLAGS:
- if (PyNumber_Check(object)) {
+ if (PyNumber_Check (object)) {
/* Accept 0 as a valid flag value */
- PyObject *number = PyNumber_Int(object);
+ PyObject *number = PyNumber_Int (object);
if (number == NULL)
PyErr_Clear();
else {
- long value = PyInt_AsLong(number);
+ long value = PyInt_AsLong (number);
if (value == 0)
break;
else if (value == -1)
PyErr_Clear();
}
}
- retval = _pygi_g_registered_type_info_check_object(
- (GIRegisteredTypeInfo *)info, TRUE, object);
+ retval = _pygi_g_registered_type_info_check_object (
+ (GIRegisteredTypeInfo *) info, TRUE, object);
break;
case GI_INFO_TYPE_STRUCT:
{
GType type;
/* Handle special cases. */
- type = g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)info);
- if (g_type_is_a(type, G_TYPE_VALUE)) {
+ type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
+ if (g_type_is_a (type, G_TYPE_VALUE)) {
GType object_type;
- object_type = pyg_type_from_object((PyObject *)object->ob_type);
+ object_type = pyg_type_from_object ( (PyObject *) object->ob_type);
if (object_type == G_TYPE_INVALID) {
- PyErr_Format(PyExc_TypeError, "Must be of a known GType, not %s",
- object->ob_type->tp_name);
+ PyErr_Format (PyExc_TypeError, "Must be of a known GType, not %s",
+ object->ob_type->tp_name);
retval = 0;
}
break;
- } else if (g_type_is_a(type, G_TYPE_CLOSURE)) {
- if (!PyCallable_Check(object)) {
- PyErr_Format(PyExc_TypeError, "Must be callable, not %s",
- object->ob_type->tp_name);
+ } else if (g_type_is_a (type, G_TYPE_CLOSURE)) {
+ if (!PyCallable_Check (object)) {
+ PyErr_Format (PyExc_TypeError, "Must be callable, not %s",
+ object->ob_type->tp_name);
retval = 0;
}
break;
@@ -442,13 +442,13 @@ check_number_release:
case GI_INFO_TYPE_INTERFACE:
case GI_INFO_TYPE_OBJECT:
case GI_INFO_TYPE_UNION:
- retval = _pygi_g_registered_type_info_check_object((GIRegisteredTypeInfo *)info, TRUE, object);
+ retval = _pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) info, TRUE, object);
break;
default:
g_assert_not_reached();
}
- g_base_info_unref(info);
+ g_base_info_unref (info);
break;
}
case GI_TYPE_TAG_GLIST:
@@ -458,45 +458,45 @@ check_number_release:
GITypeInfo *item_type_info;
Py_ssize_t i;
- if (!PySequence_Check(object)) {
- PyErr_Format(PyExc_TypeError, "Must be sequence, not %s",
- object->ob_type->tp_name);
+ if (!PySequence_Check (object)) {
+ PyErr_Format (PyExc_TypeError, "Must be sequence, not %s",
+ object->ob_type->tp_name);
retval = 0;
break;
}
- length = PySequence_Length(object);
+ length = PySequence_Length (object);
if (length < 0) {
retval = -1;
break;
}
- item_type_info = g_type_info_get_param_type(type_info, 0);
- g_assert(item_type_info != NULL);
+ item_type_info = g_type_info_get_param_type (type_info, 0);
+ g_assert (item_type_info != NULL);
for (i = 0; i < length; i++) {
PyObject *item;
- item = PySequence_GetItem(object, i);
+ item = PySequence_GetItem (object, i);
if (item == NULL) {
retval = -1;
break;
}
- retval = _pygi_g_type_info_check_object(item_type_info, item, TRUE);
+ retval = _pygi_g_type_info_check_object (item_type_info, item, TRUE);
- Py_DECREF(item);
+ Py_DECREF (item);
if (retval < 0) {
break;
}
if (!retval) {
- _PyGI_ERROR_PREFIX("Item %zd: ", i);
+ _PyGI_ERROR_PREFIX ("Item %zd: ", i);
break;
}
}
- g_base_info_unref((GIBaseInfo *)item_type_info);
+ g_base_info_unref ( (GIBaseInfo *) item_type_info);
break;
}
case GI_TYPE_TAG_GHASH:
@@ -508,72 +508,72 @@ check_number_release:
GITypeInfo *value_type_info;
Py_ssize_t i;
- if (!PyMapping_Check(object)) {
- PyErr_Format(PyExc_TypeError, "Must be mapping, not %s",
- object->ob_type->tp_name);
+ if (!PyMapping_Check (object)) {
+ PyErr_Format (PyExc_TypeError, "Must be mapping, not %s",
+ object->ob_type->tp_name);
retval = 0;
break;
}
- length = PyMapping_Length(object);
+ length = PyMapping_Length (object);
if (length < 0) {
retval = -1;
break;
}
- keys = PyMapping_Keys(object);
+ keys = PyMapping_Keys (object);
if (keys == NULL) {
retval = -1;
break;
}
- values = PyMapping_Values(object);
+ values = PyMapping_Values (object);
if (values == NULL) {
retval = -1;
- Py_DECREF(keys);
+ Py_DECREF (keys);
break;
}
- key_type_info = g_type_info_get_param_type(type_info, 0);
- g_assert(key_type_info != NULL);
+ key_type_info = g_type_info_get_param_type (type_info, 0);
+ g_assert (key_type_info != NULL);
- value_type_info = g_type_info_get_param_type(type_info, 1);
- g_assert(value_type_info != NULL);
+ value_type_info = g_type_info_get_param_type (type_info, 1);
+ g_assert (value_type_info != NULL);
for (i = 0; i < length; i++) {
PyObject *key;
PyObject *value;
- key = PyList_GET_ITEM(keys, i);
- value = PyList_GET_ITEM(values, i);
+ key = PyList_GET_ITEM (keys, i);
+ value = PyList_GET_ITEM (values, i);
- retval = _pygi_g_type_info_check_object(key_type_info, key, TRUE);
+ retval = _pygi_g_type_info_check_object (key_type_info, key, TRUE);
if (retval < 0) {
break;
}
if (!retval) {
- _PyGI_ERROR_PREFIX("Key %zd :", i);
+ _PyGI_ERROR_PREFIX ("Key %zd :", i);
break;
}
- retval = _pygi_g_type_info_check_object(value_type_info, value, TRUE);
+ retval = _pygi_g_type_info_check_object (value_type_info, value, TRUE);
if (retval < 0) {
break;
}
if (!retval) {
- _PyGI_ERROR_PREFIX("Value %zd :", i);
+ _PyGI_ERROR_PREFIX ("Value %zd :", i);
break;
}
}
- g_base_info_unref((GIBaseInfo *)key_type_info);
- g_base_info_unref((GIBaseInfo *)value_type_info);
- Py_DECREF(values);
- Py_DECREF(keys);
+ g_base_info_unref ( (GIBaseInfo *) key_type_info);
+ g_base_info_unref ( (GIBaseInfo *) value_type_info);
+ Py_DECREF (values);
+ Py_DECREF (keys);
break;
}
case GI_TYPE_TAG_ERROR:
- PyErr_SetString(PyExc_NotImplementedError, "Error marshalling is not supported yet");
+ PyErr_SetString (PyExc_NotImplementedError, "Error marshalling is not supported yet");
/* TODO */
break;
}
@@ -596,23 +596,23 @@ _pygi_argument_to_array (GArgument *arg,
if (arg->v_pointer == NULL) {
return NULL;
}
-
- is_zero_terminated = g_type_info_is_zero_terminated(type_info);
- item_type_info = g_type_info_get_param_type(type_info, 0);
- item_size = _pygi_g_type_info_size(item_type_info);
+ is_zero_terminated = g_type_info_is_zero_terminated (type_info);
+ item_type_info = g_type_info_get_param_type (type_info, 0);
+
+ item_size = _pygi_g_type_info_size (item_type_info);
- g_base_info_unref((GIBaseInfo *)item_type_info);
+ g_base_info_unref ( (GIBaseInfo *) item_type_info);
if (is_zero_terminated) {
- length = g_strv_length(arg->v_pointer);
+ length = g_strv_length (arg->v_pointer);
} else {
- length = g_type_info_get_array_fixed_size(type_info);
+ length = g_type_info_get_array_fixed_size (type_info);
if (length < 0) {
gint length_arg_pos;
- length_arg_pos = g_type_info_get_array_length(type_info);
- g_assert(length_arg_pos >= 0);
+ length_arg_pos = g_type_info_get_array_length (type_info);
+ g_assert (length_arg_pos >= 0);
if (is_method) {
length_arg_pos--;
@@ -627,7 +627,7 @@ _pygi_argument_to_array (GArgument *arg,
g_assert (length >= 0);
- g_array = g_array_new(is_zero_terminated, FALSE, item_size);
+ g_array = g_array_new (is_zero_terminated, FALSE, item_size);
g_array->data = arg->v_pointer;
g_array->len = length;
@@ -643,16 +643,16 @@ _pygi_argument_from_object (PyObject *object,
GArgument arg;
GITypeTag type_tag;
- type_tag = g_type_info_get_tag(type_info);
+ type_tag = g_type_info_get_tag (type_info);
switch (type_tag) {
case GI_TYPE_TAG_VOID:
- g_warn_if_fail(transfer == GI_TRANSFER_NOTHING);
+ g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
arg.v_pointer = object;
break;
case GI_TYPE_TAG_BOOLEAN:
{
- arg.v_boolean = PyObject_IsTrue(object);
+ arg.v_boolean = PyObject_IsTrue (object);
break;
}
case GI_TYPE_TAG_INT8:
@@ -668,14 +668,14 @@ _pygi_argument_from_object (PyObject *object,
{
PyObject *int_;
- int_ = PyNumber_Int(object);
+ int_ = PyNumber_Int (object);
if (int_ == NULL) {
break;
}
- arg.v_long = PyInt_AsLong(int_);
+ arg.v_long = PyInt_AsLong (int_);
- Py_DECREF(int_);
+ Py_DECREF (int_);
break;
}
@@ -688,20 +688,20 @@ _pygi_argument_from_object (PyObject *object,
PyObject *number;
guint64 value;
- number = PyNumber_Int(object);
+ number = PyNumber_Int (object);
if (number == NULL) {
break;
}
- if (PyInt_Check(number)) {
- value = PyInt_AS_LONG(number);
+ if (PyInt_Check (number)) {
+ value = PyInt_AS_LONG (number);
} else {
- value = PyLong_AsUnsignedLongLong(number);
+ value = PyLong_AsUnsignedLongLong (number);
}
arg.v_uint64 = value;
- Py_DECREF(number);
+ Py_DECREF (number);
break;
}
@@ -710,20 +710,20 @@ _pygi_argument_from_object (PyObject *object,
PyObject *number;
gint64 value;
- number = PyNumber_Int(object);
+ number = PyNumber_Int (object);
if (number == NULL) {
break;
}
- if (PyInt_Check(number)) {
- value = PyInt_AS_LONG(number);
+ if (PyInt_Check (number)) {
+ value = PyInt_AS_LONG (number);
} else {
- value = PyLong_AsLongLong(number);
+ value = PyLong_AsLongLong (number);
}
arg.v_int64 = value;
- Py_DECREF(number);
+ Py_DECREF (number);
break;
}
@@ -731,13 +731,13 @@ _pygi_argument_from_object (PyObject *object,
{
PyObject *float_;
- float_ = PyNumber_Float(object);
+ float_ = PyNumber_Float (object);
if (float_ == NULL) {
break;
}
- arg.v_float = (float)PyFloat_AsDouble(float_);
- Py_DECREF(float_);
+ arg.v_float = (float) PyFloat_AsDouble (float_);
+ Py_DECREF (float_);
break;
}
@@ -745,13 +745,13 @@ _pygi_argument_from_object (PyObject *object,
{
PyObject *float_;
- float_ = PyNumber_Float(object);
+ float_ = PyNumber_Float (object);
if (float_ == NULL) {
break;
}
- arg.v_double = PyFloat_AsDouble(float_);
- Py_DECREF(float_);
+ arg.v_double = PyFloat_AsDouble (float_);
+ Py_DECREF (float_);
break;
}
@@ -760,25 +760,25 @@ _pygi_argument_from_object (PyObject *object,
PyDateTime_DateTime *py_datetime;
struct tm datetime;
- py_datetime = (PyDateTime_DateTime *)object;
+ py_datetime = (PyDateTime_DateTime *) object;
if (py_datetime->hastzinfo) {
- if (PyErr_WarnEx(NULL, "tzinfo ignored; only local time is supported", 1) < 0) {
+ if (PyErr_WarnEx (NULL, "tzinfo ignored; only local time is supported", 1) < 0) {
break;
}
}
- datetime.tm_sec = PyDateTime_DATE_GET_SECOND(py_datetime);
- datetime.tm_min = PyDateTime_DATE_GET_MINUTE(py_datetime);
- datetime.tm_hour = PyDateTime_DATE_GET_HOUR(py_datetime);
- datetime.tm_mday = PyDateTime_GET_DAY(py_datetime);
- datetime.tm_mon = PyDateTime_GET_MONTH(py_datetime) - 1;
- datetime.tm_year = PyDateTime_GET_YEAR(py_datetime) - 1900;
+ datetime.tm_sec = PyDateTime_DATE_GET_SECOND (py_datetime);
+ datetime.tm_min = PyDateTime_DATE_GET_MINUTE (py_datetime);
+ datetime.tm_hour = PyDateTime_DATE_GET_HOUR (py_datetime);
+ datetime.tm_mday = PyDateTime_GET_DAY (py_datetime);
+ datetime.tm_mon = PyDateTime_GET_MONTH (py_datetime) - 1;
+ datetime.tm_year = PyDateTime_GET_YEAR (py_datetime) - 1900;
datetime.tm_isdst = -1;
- arg.v_long = mktime(&datetime);
+ arg.v_long = mktime (&datetime);
if (arg.v_long == -1) {
- PyErr_SetString(PyExc_RuntimeError, "datetime conversion failed");
+ PyErr_SetString (PyExc_RuntimeError, "datetime conversion failed");
break;
}
@@ -786,7 +786,7 @@ _pygi_argument_from_object (PyObject *object,
}
case GI_TYPE_TAG_GTYPE:
{
- arg.v_long = pyg_type_from_object(object);
+ arg.v_long = pyg_type_from_object (object);
break;
}
@@ -794,15 +794,15 @@ _pygi_argument_from_object (PyObject *object,
{
const gchar *string;
- if (object == Py_None){
+ if (object == Py_None) {
arg.v_string = NULL;
break;
}
- string = PyString_AsString(object);
+ string = PyString_AsString (object);
/* Don't need to check for errors, since g_strdup is NULL-proof. */
- arg.v_string = g_strdup(string);
+ arg.v_string = g_strdup (string);
break;
}
case GI_TYPE_TAG_FILENAME:
@@ -810,14 +810,14 @@ _pygi_argument_from_object (PyObject *object,
GError *error = NULL;
const gchar *string;
- string = PyString_AsString(object);
+ string = PyString_AsString (object);
if (string == NULL) {
break;
}
- arg.v_string = g_filename_from_utf8(string, -1, NULL, NULL, &error);
+ arg.v_string = g_filename_from_utf8 (string, -1, NULL, NULL, &error);
if (arg.v_string == NULL) {
- PyErr_SetString(PyExc_Exception, error->message);
+ PyErr_SetString (PyExc_Exception, error->message);
/* TODO: Convert the error to an exception. */
}
@@ -833,24 +833,24 @@ _pygi_argument_from_object (PyObject *object,
GITransfer item_transfer;
Py_ssize_t i;
- if (object == Py_None){
+ if (object == Py_None) {
arg.v_pointer = NULL;
break;
}
- length = PySequence_Length(object);
+ length = PySequence_Length (object);
if (length < 0) {
break;
}
- is_zero_terminated = g_type_info_is_zero_terminated(type_info);
- item_type_info = g_type_info_get_param_type(type_info, 0);
+ is_zero_terminated = g_type_info_is_zero_terminated (type_info);
+ item_type_info = g_type_info_get_param_type (type_info, 0);
- item_size = _pygi_g_type_info_size(item_type_info);
+ item_size = _pygi_g_type_info_size (item_type_info);
- array = g_array_sized_new(is_zero_terminated, FALSE, item_size, length);
+ array = g_array_sized_new (is_zero_terminated, FALSE, item_size, length);
if (array == NULL) {
- g_base_info_unref((GIBaseInfo *)item_type_info);
+ g_base_info_unref ( (GIBaseInfo *) item_type_info);
PyErr_NoMemory();
break;
}
@@ -861,35 +861,35 @@ _pygi_argument_from_object (PyObject *object,
PyObject *py_item;
GArgument item;
- py_item = PySequence_GetItem(object, i);
+ py_item = PySequence_GetItem (object, i);
if (py_item == NULL) {
goto array_item_error;
}
- item = _pygi_argument_from_object(py_item, item_type_info, item_transfer);
+ item = _pygi_argument_from_object (py_item, item_type_info, item_transfer);
- Py_DECREF(py_item);
+ Py_DECREF (py_item);
if (PyErr_Occurred()) {
goto array_item_error;
}
- g_array_insert_val(array, i, item);
+ g_array_insert_val (array, i, item);
continue;
array_item_error:
/* Free everything we have converted so far. */
- _pygi_argument_release((GArgument *)&array, type_info,
- GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
+ _pygi_argument_release ( (GArgument *) &array, type_info,
+ GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
array = NULL;
- _PyGI_ERROR_PREFIX("Item %zd: ", i);
+ _PyGI_ERROR_PREFIX ("Item %zd: ", i);
break;
}
arg.v_pointer = array;
- g_base_info_unref((GIBaseInfo *)item_type_info);
+ g_base_info_unref ( (GIBaseInfo *) item_type_info);
break;
}
case GI_TYPE_TAG_INTERFACE:
@@ -897,8 +897,8 @@ array_item_error:
GIBaseInfo *info;
GIInfoType info_type;
- info = g_type_info_get_interface(type_info);
- info_type = g_base_info_get_type(info);
+ info = g_type_info_get_interface (type_info);
+ info_type = g_base_info_get_type (info);
switch (info_type) {
case GI_INFO_TYPE_CALLBACK:
@@ -916,65 +916,65 @@ array_item_error:
break;
}
- type = g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)info);
+ type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
/* Handle special cases first. */
- if (g_type_is_a(type, G_TYPE_VALUE)) {
+ if (g_type_is_a (type, G_TYPE_VALUE)) {
GValue *value;
GType object_type;
gint retval;
- object_type = pyg_type_from_object((PyObject *)object->ob_type);
+ object_type = pyg_type_from_object ( (PyObject *) object->ob_type);
if (object_type == G_TYPE_INVALID) {
- PyErr_SetString(PyExc_RuntimeError, "unable to retrieve object's GType");
+ PyErr_SetString (PyExc_RuntimeError, "unable to retrieve object's GType");
break;
}
- g_warn_if_fail(transfer == GI_TRANSFER_NOTHING);
+ g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
- value = g_slice_new0(GValue);
- g_value_init(value, object_type);
+ value = g_slice_new0 (GValue);
+ g_value_init (value, object_type);
- retval = pyg_value_from_pyobject(value, object);
+ retval = pyg_value_from_pyobject (value, object);
if (retval < 0) {
- g_slice_free(GValue, value);
- PyErr_SetString(PyExc_RuntimeError, "PyObject conversion to GValue failed");
+ g_slice_free (GValue, value);
+ PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GValue failed");
break;
}
arg.v_pointer = value;
- } else if (g_type_is_a(type, G_TYPE_CLOSURE)) {
+ } else if (g_type_is_a (type, G_TYPE_CLOSURE)) {
GClosure *closure;
- g_warn_if_fail(transfer == GI_TRANSFER_NOTHING);
+ g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
- closure = pyg_closure_new(object, NULL, NULL);
+ closure = pyg_closure_new (object, NULL, NULL);
if (closure == NULL) {
- PyErr_SetString(PyExc_RuntimeError, "PyObject conversion to GClosure failed");
+ PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GClosure failed");
break;
}
arg.v_pointer = closure;
- } else if (g_type_is_a(type, G_TYPE_BOXED)) {
- arg.v_pointer = pyg_boxed_get(object, void);
+ } else if (g_type_is_a (type, G_TYPE_BOXED)) {
+ arg.v_pointer = pyg_boxed_get (object, void);
if (transfer == GI_TRANSFER_EVERYTHING) {
- arg.v_pointer = g_boxed_copy(type, arg.v_pointer);
+ arg.v_pointer = g_boxed_copy (type, arg.v_pointer);
}
- } else if ((type == G_TYPE_NONE) && (g_struct_info_is_foreign (info))) {
+ } else if ( (type == G_TYPE_NONE) && (g_struct_info_is_foreign (info))) {
gint retval;
- retval = pygi_struct_foreign_convert_to_g_argument(
- object, type_info, transfer, &arg);
+ retval = pygi_struct_foreign_convert_to_g_argument (
+ object, type_info, transfer, &arg);
if (!retval) {
- PyErr_SetString(PyExc_RuntimeError, "PyObject conversion to foreign struct failed");
+ PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to foreign struct failed");
break;
}
- } else if (g_type_is_a(type, G_TYPE_POINTER) || type == G_TYPE_NONE) {
- g_warn_if_fail(!g_type_info_is_pointer(type_info) || transfer == GI_TRANSFER_NOTHING);
- arg.v_pointer = pyg_pointer_get(object, void);
+ } else if (g_type_is_a (type, G_TYPE_POINTER) || type == G_TYPE_NONE) {
+ g_warn_if_fail (!g_type_info_is_pointer (type_info) || transfer == GI_TRANSFER_NOTHING);
+ arg.v_pointer = pyg_pointer_get (object, void);
} else {
- PyErr_Format(PyExc_NotImplementedError, "structure type '%s' is not supported yet", g_type_name(type));
+ PyErr_Format (PyExc_NotImplementedError, "structure type '%s' is not supported yet", g_type_name (type));
}
break;
@@ -984,14 +984,14 @@ array_item_error:
{
PyObject *int_;
- int_ = PyNumber_Int(object);
+ int_ = PyNumber_Int (object);
if (int_ == NULL) {
break;
}
- arg.v_long = PyInt_AsLong(int_);
+ arg.v_long = PyInt_AsLong (int_);
- Py_DECREF(int_);
+ Py_DECREF (int_);
break;
}
@@ -1002,16 +1002,16 @@ array_item_error:
break;
}
- arg.v_pointer = pygobject_get(object);
+ arg.v_pointer = pygobject_get (object);
if (transfer == GI_TRANSFER_EVERYTHING) {
- g_object_ref(arg.v_pointer);
+ g_object_ref (arg.v_pointer);
}
break;
default:
g_assert_not_reached();
}
- g_base_info_unref(info);
+ g_base_info_unref (info);
break;
}
case GI_TYPE_TAG_GLIST:
@@ -1028,13 +1028,13 @@ array_item_error:
break;
}
- length = PySequence_Length(object);
+ length = PySequence_Length (object);
if (length < 0) {
break;
}
- item_type_info = g_type_info_get_param_type(type_info, 0);
- g_assert(item_type_info != NULL);
+ item_type_info = g_type_info_get_param_type (type_info, 0);
+ g_assert (item_type_info != NULL);
item_transfer = transfer == GI_TRANSFER_CONTAINER ? GI_TRANSFER_NOTHING : transfer;
@@ -1042,40 +1042,40 @@ array_item_error:
PyObject *py_item;
GArgument item;
- py_item = PySequence_GetItem(object, i);
+ py_item = PySequence_GetItem (object, i);
if (py_item == NULL) {
goto list_item_error;
}
- item = _pygi_argument_from_object(py_item, item_type_info, item_transfer);
+ item = _pygi_argument_from_object (py_item, item_type_info, item_transfer);
- Py_DECREF(py_item);
+ Py_DECREF (py_item);
if (PyErr_Occurred()) {
goto list_item_error;
}
if (type_tag == GI_TYPE_TAG_GLIST) {
- list = (GSList *)g_list_prepend((GList *)list, item.v_pointer);
+ list = (GSList *) g_list_prepend ( (GList *) list, item.v_pointer);
} else {
- list = g_slist_prepend(list, item.v_pointer);
+ list = g_slist_prepend (list, item.v_pointer);
}
continue;
list_item_error:
/* Free everything we have converted so far. */
- _pygi_argument_release((GArgument *)&list, type_info,
- GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
+ _pygi_argument_release ( (GArgument *) &list, type_info,
+ GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
list = NULL;
- _PyGI_ERROR_PREFIX("Item %zd: ", i);
+ _PyGI_ERROR_PREFIX ("Item %zd: ", i);
break;
}
arg.v_pointer = list;
- g_base_info_unref((GIBaseInfo *)item_type_info);
+ g_base_info_unref ( (GIBaseInfo *) item_type_info);
break;
}
@@ -1094,36 +1094,36 @@ list_item_error:
Py_ssize_t i;
- if (object == Py_None){
- arg.v_pointer = NULL;
+ if (object == Py_None) {
+ arg.v_pointer = NULL;
break;
}
- length = PyMapping_Length(object);
+ length = PyMapping_Length (object);
if (length < 0) {
break;
}
- keys = PyMapping_Keys(object);
+ keys = PyMapping_Keys (object);
if (keys == NULL) {
break;
}
- values = PyMapping_Values(object);
+ values = PyMapping_Values (object);
if (values == NULL) {
- Py_DECREF(keys);
+ Py_DECREF (keys);
break;
}
- key_type_info = g_type_info_get_param_type(type_info, 0);
- g_assert(key_type_info != NULL);
+ key_type_info = g_type_info_get_param_type (type_info, 0);
+ g_assert (key_type_info != NULL);
- value_type_info = g_type_info_get_param_type(type_info, 1);
- g_assert(value_type_info != NULL);
+ value_type_info = g_type_info_get_param_type (type_info, 1);
+ g_assert (value_type_info != NULL);
- key_type_tag = g_type_info_get_tag(key_type_info);
+ key_type_tag = g_type_info_get_tag (key_type_info);
- switch(key_type_tag) {
+ switch (key_type_tag) {
case GI_TYPE_TAG_UTF8:
case GI_TYPE_TAG_FILENAME:
hash_func = g_str_hash;
@@ -1134,7 +1134,7 @@ list_item_error:
equal_func = NULL;
}
- hash_table = g_hash_table_new(hash_func, equal_func);
+ hash_table = g_hash_table_new (hash_func, equal_func);
if (hash_table == NULL) {
PyErr_NoMemory();
goto hash_table_release;
@@ -1148,44 +1148,44 @@ list_item_error:
GArgument key;
GArgument value;
- py_key = PyList_GET_ITEM(keys, i);
- py_value = PyList_GET_ITEM(values, i);
+ py_key = PyList_GET_ITEM (keys, i);
+ py_value = PyList_GET_ITEM (values, i);
- key = _pygi_argument_from_object(py_key, key_type_info, item_transfer);
+ key = _pygi_argument_from_object (py_key, key_type_info, item_transfer);
if (PyErr_Occurred()) {
goto hash_table_item_error;
}
- value = _pygi_argument_from_object(py_value, value_type_info, item_transfer);
+ value = _pygi_argument_from_object (py_value, value_type_info, item_transfer);
if (PyErr_Occurred()) {
- _pygi_argument_release(&key, type_info, GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
+ _pygi_argument_release (&key, type_info, GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
goto hash_table_item_error;
}
- g_hash_table_insert(hash_table, key.v_pointer, value.v_pointer);
+ g_hash_table_insert (hash_table, key.v_pointer, value.v_pointer);
continue;
hash_table_item_error:
/* Free everything we have converted so far. */
- _pygi_argument_release((GArgument *)&hash_table, type_info,
- GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
+ _pygi_argument_release ( (GArgument *) &hash_table, type_info,
+ GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
hash_table = NULL;
- _PyGI_ERROR_PREFIX("Item %zd: ", i);
+ _PyGI_ERROR_PREFIX ("Item %zd: ", i);
break;
}
arg.v_pointer = hash_table;
hash_table_release:
- g_base_info_unref((GIBaseInfo *)key_type_info);
- g_base_info_unref((GIBaseInfo *)value_type_info);
- Py_DECREF(keys);
- Py_DECREF(values);
+ g_base_info_unref ( (GIBaseInfo *) key_type_info);
+ g_base_info_unref ( (GIBaseInfo *) value_type_info);
+ Py_DECREF (keys);
+ Py_DECREF (values);
break;
}
case GI_TYPE_TAG_ERROR:
- PyErr_SetString(PyExc_NotImplementedError, "error marshalling is not supported yet");
+ PyErr_SetString (PyExc_NotImplementedError, "error marshalling is not supported yet");
/* TODO */
break;
}
@@ -1201,110 +1201,110 @@ _pygi_argument_to_object (GArgument *arg,
GITypeTag type_tag;
PyObject *object = NULL;
- type_tag = g_type_info_get_tag(type_info);
+ type_tag = g_type_info_get_tag (type_info);
switch (type_tag) {
case GI_TYPE_TAG_VOID:
- if (g_type_info_is_pointer(type_info)) {
+ if (g_type_info_is_pointer (type_info)) {
/* Raw Python objects are passed to void* args */
- g_warn_if_fail(transfer == GI_TRANSFER_NOTHING);
+ g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
object = arg->v_pointer;
} else
object = Py_None;
- Py_XINCREF(object);
+ Py_XINCREF (object);
break;
case GI_TYPE_TAG_BOOLEAN:
{
- object = PyBool_FromLong(arg->v_boolean);
+ object = PyBool_FromLong (arg->v_boolean);
break;
}
case GI_TYPE_TAG_INT8:
{
- object = PyInt_FromLong(arg->v_int8);
+ object = PyInt_FromLong (arg->v_int8);
break;
}
case GI_TYPE_TAG_UINT8:
{
- object = PyInt_FromLong(arg->v_uint8);
+ object = PyInt_FromLong (arg->v_uint8);
break;
}
case GI_TYPE_TAG_INT16:
{
- object = PyInt_FromLong(arg->v_int16);
+ object = PyInt_FromLong (arg->v_int16);
break;
}
case GI_TYPE_TAG_UINT16:
{
- object = PyInt_FromLong(arg->v_uint16);
+ object = PyInt_FromLong (arg->v_uint16);
break;
}
case GI_TYPE_TAG_INT32:
{
- object = PyInt_FromLong(arg->v_int32);
+ object = PyInt_FromLong (arg->v_int32);
break;
}
case GI_TYPE_TAG_UINT32:
{
- object = PyLong_FromLongLong(arg->v_uint32);
+ object = PyLong_FromLongLong (arg->v_uint32);
break;
}
case GI_TYPE_TAG_INT64:
{
- object = PyLong_FromLongLong(arg->v_int64);
+ object = PyLong_FromLongLong (arg->v_int64);
break;
}
case GI_TYPE_TAG_UINT64:
{
- object = PyLong_FromUnsignedLongLong(arg->v_uint64);
+ object = PyLong_FromUnsignedLongLong (arg->v_uint64);
break;
}
case GI_TYPE_TAG_SHORT:
{
- object = PyInt_FromLong(arg->v_short);
+ object = PyInt_FromLong (arg->v_short);
break;
}
case GI_TYPE_TAG_USHORT:
{
- object = PyInt_FromLong(arg->v_ushort);
+ object = PyInt_FromLong (arg->v_ushort);
break;
}
case GI_TYPE_TAG_INT:
{
- object = PyInt_FromLong(arg->v_int);
+ object = PyInt_FromLong (arg->v_int);
break;
}
case GI_TYPE_TAG_UINT:
{
- object = PyLong_FromLongLong(arg->v_uint);
+ object = PyLong_FromLongLong (arg->v_uint);
break;
}
case GI_TYPE_TAG_LONG:
{
- object = PyInt_FromLong(arg->v_long);
+ object = PyInt_FromLong (arg->v_long);
break;
}
case GI_TYPE_TAG_ULONG:
{
- object = PyLong_FromUnsignedLongLong(arg->v_ulong);
+ object = PyLong_FromUnsignedLongLong (arg->v_ulong);
break;
}
case GI_TYPE_TAG_SSIZE:
{
- object = PyInt_FromLong(arg->v_ssize);
+ object = PyInt_FromLong (arg->v_ssize);
break;
}
case GI_TYPE_TAG_SIZE:
{
- object = PyLong_FromUnsignedLongLong(arg->v_size);
+ object = PyLong_FromUnsignedLongLong (arg->v_size);
break;
}
case GI_TYPE_TAG_FLOAT:
{
- object = PyFloat_FromDouble(arg->v_float);
+ object = PyFloat_FromDouble (arg->v_float);
break;
}
case GI_TYPE_TAG_DOUBLE:
{
- object = PyFloat_FromDouble(arg->v_double);
+ object = PyFloat_FromDouble (arg->v_double);
break;
}
case GI_TYPE_TAG_TIME_T:
@@ -1312,32 +1312,32 @@ _pygi_argument_to_object (GArgument *arg,
time_t *time_;
struct tm *datetime;
- time_ = (time_t *)&arg->v_long;
+ time_ = (time_t *) &arg->v_long;
- datetime = localtime(time_);
- object = PyDateTime_FromDateAndTime(
- datetime->tm_year + 1900,
- datetime->tm_mon + 1,
- datetime->tm_mday,
- datetime->tm_hour,
- datetime->tm_min,
- datetime->tm_sec,
- 0);
+ datetime = localtime (time_);
+ object = PyDateTime_FromDateAndTime (
+ datetime->tm_year + 1900,
+ datetime->tm_mon + 1,
+ datetime->tm_mday,
+ datetime->tm_hour,
+ datetime->tm_min,
+ datetime->tm_sec,
+ 0);
break;
}
case GI_TYPE_TAG_GTYPE:
{
- object = pyg_type_wrapper_new((GType)arg->v_long);
+ object = pyg_type_wrapper_new ( (GType) arg->v_long);
break;
}
case GI_TYPE_TAG_UTF8:
if (arg->v_string == NULL) {
object = Py_None;
- Py_INCREF(object);
+ Py_INCREF (object);
break;
}
- object = PyString_FromString(arg->v_string);
+ object = PyString_FromString (arg->v_string);
break;
case GI_TYPE_TAG_FILENAME:
{
@@ -1346,20 +1346,20 @@ _pygi_argument_to_object (GArgument *arg,
if (arg->v_string == NULL) {
object = Py_None;
- Py_INCREF(object);
+ Py_INCREF (object);
break;
}
- string = g_filename_to_utf8(arg->v_string, -1, NULL, NULL, &error);
+ string = g_filename_to_utf8 (arg->v_string, -1, NULL, NULL, &error);
if (string == NULL) {
- PyErr_SetString(PyExc_Exception, error->message);
+ PyErr_SetString (PyExc_Exception, error->message);
/* TODO: Convert the error to an exception. */
break;
}
- object = PyString_FromString(string);
+ object = PyString_FromString (string);
- g_free(string);
+ g_free (string);
break;
}
@@ -1373,58 +1373,58 @@ _pygi_argument_to_object (GArgument *arg,
if (arg->v_pointer == NULL) {
object = Py_None;
- Py_INCREF(object);
+ Py_INCREF (object);
break;
}
array = arg->v_pointer;
- object = PyTuple_New(array->len);
+ object = PyTuple_New (array->len);
if (object == NULL) {
break;
}
- item_type_info = g_type_info_get_param_type(type_info, 0);
- g_assert(item_type_info != NULL);
+ item_type_info = g_type_info_get_param_type (type_info, 0);
+ g_assert (item_type_info != NULL);
- item_type_tag = g_type_info_get_tag(item_type_info);
+ item_type_tag = g_type_info_get_tag (item_type_info);
item_transfer = transfer == GI_TRANSFER_CONTAINER ? GI_TRANSFER_NOTHING : transfer;
- item_size = g_array_get_element_size(array);
+ item_size = g_array_get_element_size (array);
- for(i = 0; i < array->len; i++) {
+ for (i = 0; i < array->len; i++) {
GArgument item;
PyObject *py_item;
gboolean is_struct = FALSE;
if (item_type_tag == GI_TYPE_TAG_INTERFACE) {
- GIBaseInfo *iface_info = g_type_info_get_interface(item_type_info);
- switch (g_base_info_get_type(iface_info)) {
+ GIBaseInfo *iface_info = g_type_info_get_interface (item_type_info);
+ switch (g_base_info_get_type (iface_info)) {
case GI_INFO_TYPE_STRUCT:
case GI_INFO_TYPE_BOXED:
is_struct = TRUE;
default:
break;
}
- g_base_info_unref((GIBaseInfo *)iface_info);
+ g_base_info_unref ( (GIBaseInfo *) iface_info);
}
if (is_struct) {
- item.v_pointer = &_g_array_index(array, GArgument, i);
+ item.v_pointer = &_g_array_index (array, GArgument, i);
} else {
- memcpy(&item, &_g_array_index(array, GArgument, i), item_size);
+ memcpy (&item, &_g_array_index (array, GArgument, i), item_size);
}
- py_item = _pygi_argument_to_object(&item, item_type_info, item_transfer);
+ py_item = _pygi_argument_to_object (&item, item_type_info, item_transfer);
if (py_item == NULL) {
- Py_CLEAR(object);
- _PyGI_ERROR_PREFIX("Item %zu: ", i);
+ Py_CLEAR (object);
+ _PyGI_ERROR_PREFIX ("Item %zu: ", i);
break;
}
- PyTuple_SET_ITEM(object, i, py_item);
+ PyTuple_SET_ITEM (object, i, py_item);
}
- g_base_info_unref((GIBaseInfo *)item_type_info);
+ g_base_info_unref ( (GIBaseInfo *) item_type_info);
break;
}
case GI_TYPE_TAG_INTERFACE:
@@ -1432,23 +1432,23 @@ _pygi_argument_to_object (GArgument *arg,
GIBaseInfo *info;
GIInfoType info_type;
- info = g_type_info_get_interface(type_info);
- info_type = g_base_info_get_type(info);
+ info = g_type_info_get_interface (type_info);
+ info_type = g_base_info_get_type (info);
switch (info_type) {
case GI_INFO_TYPE_CALLBACK:
{
- /* There is no way we can support a callback return
- * as we are never sure if the callback was set from C
- * or Python. API that return callbacks are broken
- * so we print a warning and send back a None
- */
-
- g_warning("You are trying to use an API which returns a callback."
- "Callback returns can not be supported. Returning None instead.");
- object = Py_None;
- Py_INCREF(object);
- break;
+ /* There is no way we can support a callback return
+ * as we are never sure if the callback was set from C
+ * or Python. API that return callbacks are broken
+ * so we print a warning and send back a None
+ */
+
+ g_warning ("You are trying to use an API which returns a callback."
+ "Callback returns can not be supported. Returning None instead.");
+ object = Py_None;
+ Py_INCREF (object);
+ break;
}
case GI_INFO_TYPE_BOXED:
case GI_INFO_TYPE_STRUCT:
@@ -1458,52 +1458,52 @@ _pygi_argument_to_object (GArgument *arg,
if (arg->v_pointer == NULL) {
object = Py_None;
- Py_INCREF(object);
+ Py_INCREF (object);
break;
}
- type = g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)info);
- if (g_type_is_a(type, G_TYPE_VALUE)) {
- object = pyg_value_as_pyobject(arg->v_pointer, FALSE);
- } else if (g_type_is_a(type, G_TYPE_BOXED)) {
+ type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
+ if (g_type_is_a (type, G_TYPE_VALUE)) {
+ object = pyg_value_as_pyobject (arg->v_pointer, FALSE);
+ } else if (g_type_is_a (type, G_TYPE_BOXED)) {
PyObject *py_type;
- py_type = _pygi_type_get_from_g_type(type);
+ py_type = _pygi_type_get_from_g_type (type);
if (py_type == NULL)
break;
- object = _pygi_boxed_new((PyTypeObject *)py_type, arg->v_pointer, transfer == GI_TRANSFER_EVERYTHING);
+ object = _pygi_boxed_new ( (PyTypeObject *) py_type, arg->v_pointer, transfer == GI_TRANSFER_EVERYTHING);
- Py_DECREF(py_type);
- } else if (g_type_is_a(type, G_TYPE_POINTER)) {
+ Py_DECREF (py_type);
+ } else if (g_type_is_a (type, G_TYPE_POINTER)) {
PyObject *py_type;
- py_type = _pygi_type_get_from_g_type(type);
+ py_type = _pygi_type_get_from_g_type (type);
- if (py_type == NULL || !PyType_IsSubtype((PyTypeObject *)type, &PyGIStruct_Type)) {
- g_warn_if_fail(transfer == GI_TRANSFER_NOTHING);
- object = pyg_pointer_new(type, arg->v_pointer);
+ if (py_type == NULL || !PyType_IsSubtype ( (PyTypeObject *) type, &PyGIStruct_Type)) {
+ g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
+ object = pyg_pointer_new (type, arg->v_pointer);
} else {
- object = _pygi_struct_new((PyTypeObject *)py_type, arg->v_pointer, transfer == GI_TRANSFER_EVERYTHING);
+ object = _pygi_struct_new ( (PyTypeObject *) py_type, arg->v_pointer, transfer == GI_TRANSFER_EVERYTHING);
}
- Py_XDECREF(py_type);
- } else if ((type == G_TYPE_NONE) && (g_struct_info_is_foreign (info))) {
- object = pygi_struct_foreign_convert_from_g_argument(type_info, arg->v_pointer);
+ Py_XDECREF (py_type);
+ } else if ( (type == G_TYPE_NONE) && (g_struct_info_is_foreign (info))) {
+ object = pygi_struct_foreign_convert_from_g_argument (type_info, arg->v_pointer);
} else if (type == G_TYPE_NONE) {
PyObject *py_type;
- py_type = _pygi_type_import_by_gi_info(info);
+ py_type = _pygi_type_import_by_gi_info (info);
if (py_type == NULL) {
break;
}
- object = _pygi_struct_new((PyTypeObject *)py_type, arg->v_pointer,
- transfer == GI_TRANSFER_EVERYTHING);
+ object = _pygi_struct_new ( (PyTypeObject *) py_type, arg->v_pointer,
+ transfer == GI_TRANSFER_EVERYTHING);
- Py_DECREF(py_type);
+ Py_DECREF (py_type);
} else {
- PyErr_Format(PyExc_NotImplementedError, "structure type '%s' is not supported yet", g_type_name(type));
+ PyErr_Format (PyExc_NotImplementedError, "structure type '%s' is not supported yet", g_type_name (type));
}
break;
@@ -1513,32 +1513,32 @@ _pygi_argument_to_object (GArgument *arg,
{
GType type;
- type = g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)info);
+ type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
if (type == G_TYPE_NONE) {
/* An enum with a GType of None is an enum without GType */
- PyObject *py_type = _pygi_type_import_by_gi_info(info);
+ PyObject *py_type = _pygi_type_import_by_gi_info (info);
PyObject *py_args = NULL;
if (!py_type)
return NULL;
- py_args = PyTuple_New(1);
- if (PyTuple_SetItem(py_args, 0, PyLong_FromLong(arg->v_long)) != 0) {
- Py_DECREF(py_args);
- Py_DECREF(py_type);
+ py_args = PyTuple_New (1);
+ if (PyTuple_SetItem (py_args, 0, PyLong_FromLong (arg->v_long)) != 0) {
+ Py_DECREF (py_args);
+ Py_DECREF (py_type);
return NULL;
}
- object = PyObject_CallFunction(py_type, "l", arg->v_long);
+ object = PyObject_CallFunction (py_type, "l", arg->v_long);
- Py_DECREF(py_args);
- Py_DECREF(py_type);
+ Py_DECREF (py_args);
+ Py_DECREF (py_type);
} else if (info_type == GI_INFO_TYPE_ENUM) {
- object = pyg_enum_from_gtype(type, arg->v_long);
+ object = pyg_enum_from_gtype (type, arg->v_long);
} else {
- object = pyg_flags_from_gtype(type, arg->v_long);
+ object = pyg_flags_from_gtype (type, arg->v_long);
}
break;
@@ -1547,16 +1547,16 @@ _pygi_argument_to_object (GArgument *arg,
case GI_INFO_TYPE_OBJECT:
if (arg->v_pointer == NULL) {
object = Py_None;
- Py_INCREF(object);
+ Py_INCREF (object);
break;
}
- object = pygobject_new(arg->v_pointer);
+ object = pygobject_new (arg->v_pointer);
break;
default:
g_assert_not_reached();
}
- g_base_info_unref(info);
+ g_base_info_unref (info);
break;
}
case GI_TYPE_TAG_GLIST:
@@ -1569,35 +1569,35 @@ _pygi_argument_to_object (GArgument *arg,
gsize i;
list = arg->v_pointer;
- length = g_slist_length(list);
+ length = g_slist_length (list);
- object = PyList_New(length);
+ object = PyList_New (length);
if (object == NULL) {
break;
}
- item_type_info = g_type_info_get_param_type(type_info, 0);
- g_assert(item_type_info != NULL);
+ item_type_info = g_type_info_get_param_type (type_info, 0);
+ g_assert (item_type_info != NULL);
item_transfer = transfer == GI_TRANSFER_CONTAINER ? GI_TRANSFER_NOTHING : transfer;
- for (i = 0; list != NULL; list = g_slist_next(list), i++) {
+ for (i = 0; list != NULL; list = g_slist_next (list), i++) {
GArgument item;
PyObject *py_item;
item.v_pointer = list->data;
- py_item = _pygi_argument_to_object(&item, item_type_info, item_transfer);
+ py_item = _pygi_argument_to_object (&item, item_type_info, item_transfer);
if (py_item == NULL) {
- Py_CLEAR(object);
- _PyGI_ERROR_PREFIX("Item %zu: ", i);
+ Py_CLEAR (object);
+ _PyGI_ERROR_PREFIX ("Item %zu: ", i);
break;
}
- PyList_SET_ITEM(object, i, py_item);
+ PyList_SET_ITEM (object, i, py_item);
}
- g_base_info_unref((GIBaseInfo *)item_type_info);
+ g_base_info_unref ( (GIBaseInfo *) item_type_info);
break;
}
case GI_TYPE_TAG_GHASH:
@@ -1611,7 +1611,7 @@ _pygi_argument_to_object (GArgument *arg,
if (arg->v_pointer == NULL) {
object = Py_None;
- Py_INCREF(object);
+ Py_INCREF (object);
break;
}
@@ -1620,44 +1620,44 @@ _pygi_argument_to_object (GArgument *arg,
break;
}
- key_type_info = g_type_info_get_param_type(type_info, 0);
- g_assert(key_type_info != NULL);
+ key_type_info = g_type_info_get_param_type (type_info, 0);
+ g_assert (key_type_info != NULL);
- value_type_info = g_type_info_get_param_type(type_info, 1);
- g_assert(value_type_info != NULL);
+ value_type_info = g_type_info_get_param_type (type_info, 1);
+ g_assert (value_type_info != NULL);
item_transfer = transfer == GI_TRANSFER_CONTAINER ? GI_TRANSFER_NOTHING : transfer;
- g_hash_table_iter_init(&hash_table_iter, (GHashTable *)arg->v_pointer);
- while (g_hash_table_iter_next(&hash_table_iter, &key.v_pointer, &value.v_pointer)) {
+ g_hash_table_iter_init (&hash_table_iter, (GHashTable *) arg->v_pointer);
+ while (g_hash_table_iter_next (&hash_table_iter, &key.v_pointer, &value.v_pointer)) {
PyObject *py_key;
PyObject *py_value;
int retval;
- py_key = _pygi_argument_to_object(&key, key_type_info, item_transfer);
+ py_key = _pygi_argument_to_object (&key, key_type_info, item_transfer);
if (py_key == NULL) {
break;
}
- py_value = _pygi_argument_to_object(&value, value_type_info, item_transfer);
+ py_value = _pygi_argument_to_object (&value, value_type_info, item_transfer);
if (py_value == NULL) {
- Py_DECREF(py_key);
+ Py_DECREF (py_key);
break;
}
- retval = PyDict_SetItem(object, py_key, py_value);
+ retval = PyDict_SetItem (object, py_key, py_value);
- Py_DECREF(py_key);
- Py_DECREF(py_value);
+ Py_DECREF (py_key);
+ Py_DECREF (py_value);
if (retval < 0) {
- Py_CLEAR(object);
+ Py_CLEAR (object);
break;
}
}
- g_base_info_unref((GIBaseInfo *)key_type_info);
- g_base_info_unref((GIBaseInfo *)value_type_info);
+ g_base_info_unref ( (GIBaseInfo *) key_type_info);
+ g_base_info_unref ( (GIBaseInfo *) value_type_info);
break;
}
case GI_TYPE_TAG_ERROR:
@@ -1676,9 +1676,9 @@ _pygi_argument_release (GArgument *arg,
{
GITypeTag type_tag;
- type_tag = g_type_info_get_tag(type_info);
+ type_tag = g_type_info_get_tag (type_info);
- switch(type_tag) {
+ switch (type_tag) {
case GI_TYPE_TAG_VOID:
/* Don't do anything, it's transparent to the C side */
break;
@@ -1707,10 +1707,10 @@ _pygi_argument_release (GArgument *arg,
case GI_TYPE_TAG_FILENAME:
case GI_TYPE_TAG_UTF8:
/* With allow-none support the string could be NULL */
- if (arg->v_string != NULL &&
- (direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING)
+ if (arg->v_string != NULL &&
+ (direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING)
|| (direction == GI_DIRECTION_OUT && transfer == GI_TRANSFER_EVERYTHING)) {
- g_free(arg->v_string);
+ g_free (arg->v_string);
}
break;
case GI_TYPE_TAG_ARRAY:
@@ -1724,28 +1724,28 @@ _pygi_argument_release (GArgument *arg,
array = arg->v_pointer;
- if ((direction == GI_DIRECTION_IN && transfer != GI_TRANSFER_EVERYTHING)
+ if ( (direction == GI_DIRECTION_IN && transfer != GI_TRANSFER_EVERYTHING)
|| (direction == GI_DIRECTION_OUT && transfer == GI_TRANSFER_EVERYTHING)) {
GITypeInfo *item_type_info;
GITransfer item_transfer;
- item_type_info = g_type_info_get_param_type(type_info, 0);
+ item_type_info = g_type_info_get_param_type (type_info, 0);
item_transfer = direction == GI_DIRECTION_IN ? GI_TRANSFER_NOTHING : GI_TRANSFER_EVERYTHING;
/* Free the items */
for (i = 0; i < array->len; i++) {
GArgument *item;
- item = &_g_array_index(array, GArgument, i);
- _pygi_argument_release(item, item_type_info, item_transfer, direction);
+ item = &_g_array_index (array, GArgument, i);
+ _pygi_argument_release (item, item_type_info, item_transfer, direction);
}
- g_base_info_unref((GIBaseInfo *)item_type_info);
+ g_base_info_unref ( (GIBaseInfo *) item_type_info);
}
- if ((direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING)
+ if ( (direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING)
|| (direction == GI_DIRECTION_OUT && transfer != GI_TRANSFER_NOTHING)) {
- g_array_free(array, TRUE);
+ g_array_free (array, TRUE);
}
break;
@@ -1755,8 +1755,8 @@ _pygi_argument_release (GArgument *arg,
GIBaseInfo *info;
GIInfoType info_type;
- info = g_type_info_get_interface(type_info);
- info_type = g_base_info_get_type(info);
+ info = g_type_info_get_interface (type_info);
+ info_type = g_base_info_get_type (info);
switch (info_type) {
case GI_INFO_TYPE_CALLBACK:
@@ -1772,33 +1772,33 @@ _pygi_argument_release (GArgument *arg,
return;
}
- type = g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)info);
+ type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
- if (g_type_is_a(type, G_TYPE_VALUE)) {
+ if (g_type_is_a (type, G_TYPE_VALUE)) {
GValue *value;
value = arg->v_pointer;
- if ((direction == GI_DIRECTION_IN && transfer != GI_TRANSFER_EVERYTHING)
+ if ( (direction == GI_DIRECTION_IN && transfer != GI_TRANSFER_EVERYTHING)
|| (direction == GI_DIRECTION_OUT && transfer == GI_TRANSFER_EVERYTHING)) {
- g_value_unset(value);
+ g_value_unset (value);
}
- if ((direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING)
+ if ( (direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING)
|| (direction == GI_DIRECTION_OUT && transfer != GI_TRANSFER_NOTHING)) {
- g_slice_free(GValue, value);
+ g_slice_free (GValue, value);
}
- } else if (g_type_is_a(type, G_TYPE_CLOSURE)) {
+ } else if (g_type_is_a (type, G_TYPE_CLOSURE)) {
if (direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING) {
- g_closure_unref(arg->v_pointer);
+ g_closure_unref (arg->v_pointer);
}
- } else if (g_struct_info_is_foreign((GIStructInfo*)info)) {
+ } else if (g_struct_info_is_foreign ( (GIStructInfo*) info)) {
if (direction == GI_DIRECTION_OUT && transfer == GI_TRANSFER_EVERYTHING) {
- pygi_struct_foreign_release_g_argument(transfer, type_info, arg);
+ pygi_struct_foreign_release_g_argument (transfer, type_info, arg);
}
- } else if (g_type_is_a(type, G_TYPE_BOXED)) {
- } else if (g_type_is_a(type, G_TYPE_POINTER) || type == G_TYPE_NONE) {
- g_warn_if_fail(!g_type_info_is_pointer(type_info) || transfer == GI_TRANSFER_NOTHING);
+ } else if (g_type_is_a (type, G_TYPE_BOXED)) {
+ } else if (g_type_is_a (type, G_TYPE_POINTER) || type == G_TYPE_NONE) {
+ g_warn_if_fail (!g_type_info_is_pointer (type_info) || transfer == GI_TRANSFER_NOTHING);
}
break;
@@ -1812,14 +1812,14 @@ _pygi_argument_release (GArgument *arg,
return;
}
if (direction == GI_DIRECTION_OUT && transfer == GI_TRANSFER_EVERYTHING) {
- g_object_unref(arg->v_pointer);
+ g_object_unref (arg->v_pointer);
}
break;
default:
g_assert_not_reached();
}
- g_base_info_unref(info);
+ g_base_info_unref (info);
break;
}
case GI_TYPE_TAG_GLIST:
@@ -1833,33 +1833,33 @@ _pygi_argument_release (GArgument *arg,
list = arg->v_pointer;
- if ((direction == GI_DIRECTION_IN && transfer != GI_TRANSFER_EVERYTHING)
+ if ( (direction == GI_DIRECTION_IN && transfer != GI_TRANSFER_EVERYTHING)
|| (direction == GI_DIRECTION_OUT && transfer == GI_TRANSFER_EVERYTHING)) {
GITypeInfo *item_type_info;
GITransfer item_transfer;
GSList *item;
- item_type_info = g_type_info_get_param_type(type_info, 0);
- g_assert(item_type_info != NULL);
+ item_type_info = g_type_info_get_param_type (type_info, 0);
+ g_assert (item_type_info != NULL);
item_transfer = direction == GI_DIRECTION_IN ? GI_TRANSFER_NOTHING : GI_TRANSFER_EVERYTHING;
/* Free the items */
- for (item = list; item != NULL; item = g_slist_next(item)) {
- _pygi_argument_release((GArgument *)&item->data, item_type_info,
- item_transfer, direction);
+ for (item = list; item != NULL; item = g_slist_next (item)) {
+ _pygi_argument_release ( (GArgument *) &item->data, item_type_info,
+ item_transfer, direction);
}
- g_base_info_unref((GIBaseInfo *)item_type_info);
+ g_base_info_unref ( (GIBaseInfo *) item_type_info);
}
- if ((direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING)
+ if ( (direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING)
|| (direction == GI_DIRECTION_OUT && transfer != GI_TRANSFER_NOTHING)) {
if (type_tag == GI_TYPE_TAG_GLIST) {
- g_list_free((GList *)list);
+ g_list_free ( (GList *) list);
} else {
/* type_tag == GI_TYPE_TAG_GSLIST */
- g_slist_free(list);
+ g_slist_free (list);
}
}
@@ -1885,11 +1885,11 @@ _pygi_argument_release (GArgument *arg,
gpointer key;
gpointer value;
- key_type_info = g_type_info_get_param_type(type_info, 0);
- g_assert(key_type_info != NULL);
+ key_type_info = g_type_info_get_param_type (type_info, 0);
+ g_assert (key_type_info != NULL);
- value_type_info = g_type_info_get_param_type(type_info, 1);
- g_assert(value_type_info != NULL);
+ value_type_info = g_type_info_get_param_type (type_info, 1);
+ g_assert (value_type_info != NULL);
if (direction == GI_DIRECTION_IN) {
item_transfer = GI_TRANSFER_NOTHING;
@@ -1897,25 +1897,25 @@ _pygi_argument_release (GArgument *arg,
item_transfer = GI_TRANSFER_EVERYTHING;
}
- g_hash_table_iter_init(&hash_table_iter, hash_table);
- while (g_hash_table_iter_next(&hash_table_iter, &key, &value)) {
- _pygi_argument_release((GArgument *)&key, key_type_info,
- item_transfer, direction);
- _pygi_argument_release((GArgument *)&value, value_type_info,
- item_transfer, direction);
+ g_hash_table_iter_init (&hash_table_iter, hash_table);
+ while (g_hash_table_iter_next (&hash_table_iter, &key, &value)) {
+ _pygi_argument_release ( (GArgument *) &key, key_type_info,
+ item_transfer, direction);
+ _pygi_argument_release ( (GArgument *) &value, value_type_info,
+ item_transfer, direction);
}
- g_base_info_unref((GIBaseInfo *)key_type_info);
- g_base_info_unref((GIBaseInfo *)value_type_info);
+ g_base_info_unref ( (GIBaseInfo *) key_type_info);
+ g_base_info_unref ( (GIBaseInfo *) value_type_info);
} else if (direction == GI_DIRECTION_OUT && transfer == GI_TRANSFER_CONTAINER) {
/* Be careful to avoid keys and values being freed if the
* callee gave a destroy function. */
- g_hash_table_steal_all(hash_table);
+ g_hash_table_steal_all (hash_table);
}
- if ((direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING)
+ if ( (direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING)
|| (direction == GI_DIRECTION_OUT && transfer != GI_TRANSFER_NOTHING)) {
- g_hash_table_unref(hash_table);
+ g_hash_table_unref (hash_table);
}
break;
@@ -1928,13 +1928,13 @@ _pygi_argument_release (GArgument *arg,
return;
}
- error = *(GError **)arg->v_pointer;
+ error = * (GError **) arg->v_pointer;
if (error != NULL) {
- g_error_free(error);
+ g_error_free (error);
}
- g_slice_free(GError *, arg->v_pointer);
+ g_slice_free (GError *, arg->v_pointer);
break;
}
}
diff --git a/gi/pygi-boxed.c b/gi/pygi-boxed.c
index c320796..4903834 100644
--- a/gi/pygi-boxed.c
+++ b/gi/pygi-boxed.c
@@ -31,20 +31,20 @@ _boxed_dealloc (PyGIBoxed *self)
{
GType g_type;
- PyObject_GC_UnTrack((PyObject *)self);
+ PyObject_GC_UnTrack ( (PyObject *) self);
- PyObject_ClearWeakRefs((PyObject *)self);
+ PyObject_ClearWeakRefs ( (PyObject *) self);
- if (((PyGBoxed *)self)->free_on_dealloc) {
+ if ( ( (PyGBoxed *) self)->free_on_dealloc) {
if (self->slice_allocated) {
- g_slice_free1(self->size, ((PyGBoxed *)self)->boxed);
+ g_slice_free1 (self->size, ( (PyGBoxed *) self)->boxed);
} else {
- g_type = pyg_type_from_object((PyObject *)self);
- g_boxed_free (g_type, ((PyGBoxed *)self)->boxed);
+ g_type = pyg_type_from_object ( (PyObject *) self);
+ g_boxed_free (g_type, ( (PyGBoxed *) self)->boxed);
}
}
- ((PyGObject *)self)->ob_type->tp_free((PyObject *)self);
+ ( (PyGObject *) self)->ob_type->tp_free ( (PyObject *) self);
}
static PyObject *
@@ -59,42 +59,42 @@ _boxed_new (PyTypeObject *type,
gpointer boxed;
PyGIBoxed *self = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "", kwlist)) {
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs, "", kwlist)) {
return NULL;
}
- info = _pygi_object_get_gi_info((PyObject *)type, &PyGIBaseInfo_Type);
+ info = _pygi_object_get_gi_info ( (PyObject *) type, &PyGIBaseInfo_Type);
if (info == NULL) {
- if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
- PyErr_Format(PyExc_TypeError, "missing introspection information");
+ if (PyErr_ExceptionMatches (PyExc_AttributeError)) {
+ PyErr_Format (PyExc_TypeError, "missing introspection information");
}
return NULL;
}
- switch (g_base_info_get_type(info)) {
+ switch (g_base_info_get_type (info)) {
case GI_INFO_TYPE_UNION:
- size = g_union_info_get_size((GIUnionInfo *)info);
+ size = g_union_info_get_size ( (GIUnionInfo *) info);
break;
case GI_INFO_TYPE_BOXED:
case GI_INFO_TYPE_STRUCT:
- size = g_struct_info_get_size((GIStructInfo *)info);
+ size = g_struct_info_get_size ( (GIStructInfo *) info);
break;
default:
- PyErr_Format(PyExc_TypeError,
- "info should be Boxed or Union, not '%d'",
- g_base_info_get_type(info));
+ PyErr_Format (PyExc_TypeError,
+ "info should be Boxed or Union, not '%d'",
+ g_base_info_get_type (info));
return NULL;
}
- boxed = g_slice_alloc0(size);
+ boxed = g_slice_alloc0 (size);
if (boxed == NULL) {
PyErr_NoMemory();
goto out;
}
- self = (PyGIBoxed *)_pygi_boxed_new(type, boxed, TRUE);
+ self = (PyGIBoxed *) _pygi_boxed_new (type, boxed, TRUE);
if (self == NULL) {
- g_slice_free1(size, boxed);
+ g_slice_free1 (size, boxed);
goto out;
}
@@ -102,15 +102,15 @@ _boxed_new (PyTypeObject *type,
self->slice_allocated = TRUE;
out:
- g_base_info_unref(info);
+ g_base_info_unref (info);
- return (PyObject *)self;
+ return (PyObject *) self;
}
static int
_boxed_init (PyObject *self,
- PyObject *args,
- PyObject *kwargs)
+ PyObject *args,
+ PyObject *kwargs)
{
/* Don't call PyGBoxed's init, which raises an exception. */
return 0;
@@ -118,38 +118,38 @@ _boxed_init (PyObject *self,
PyTypeObject PyGIBoxed_Type = {
- PyObject_HEAD_INIT(NULL)
+ PyObject_HEAD_INIT (NULL)
0,
"gi.Boxed", /* tp_name */
- sizeof(PyGIBoxed), /* tp_basicsize */
+ sizeof (PyGIBoxed), /* tp_basicsize */
0, /* tp_itemsize */
- (destructor)_boxed_dealloc, /* tp_dealloc */
- (printfunc)NULL, /* tp_print */
- (getattrfunc)NULL, /* tp_getattr */
- (setattrfunc)NULL, /* tp_setattr */
- (cmpfunc)NULL, /* tp_compare */
- (reprfunc)NULL, /* tp_repr */
+ (destructor) _boxed_dealloc, /* tp_dealloc */
+ (printfunc) NULL, /* tp_print */
+ (getattrfunc) NULL, /* tp_getattr */
+ (setattrfunc) NULL, /* tp_setattr */
+ (cmpfunc) NULL, /* tp_compare */
+ (reprfunc) NULL, /* tp_repr */
NULL, /* tp_as_number */
NULL, /* tp_as_sequence */
NULL, /* tp_as_mapping */
- (hashfunc)NULL, /* tp_hash */
- (ternaryfunc)NULL, /* tp_call */
- (reprfunc)NULL, /* tp_str */
- (getattrofunc)NULL, /* tp_getattro */
- (setattrofunc)NULL, /* tp_setattro */
+ (hashfunc) NULL, /* tp_hash */
+ (ternaryfunc) NULL, /* tp_call */
+ (reprfunc) NULL, /* tp_str */
+ (getattrofunc) NULL, /* tp_getattro */
+ (setattrofunc) NULL, /* tp_setattro */
NULL, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
NULL, /* tp_doc */
- (traverseproc)NULL, /* tp_traverse */
- (inquiry)NULL, /* tp_clear */
- (richcmpfunc)NULL, /* tp_richcompare */
+ (traverseproc) NULL, /* tp_traverse */
+ (inquiry) NULL, /* tp_clear */
+ (richcmpfunc) NULL, /* tp_richcompare */
0, /* tp_weaklistoffset */
- (getiterfunc)NULL, /* tp_iter */
- (iternextfunc)NULL, /* tp_iternext */
+ (getiterfunc) NULL, /* tp_iter */
+ (iternextfunc) NULL, /* tp_iternext */
NULL, /* tp_methods */
NULL, /* tp_members */
NULL, /* tp_getset */
- (PyTypeObject *)NULL, /* tp_base */
+ (PyTypeObject *) NULL, /* tp_base */
};
PyObject *
@@ -163,23 +163,23 @@ _pygi_boxed_new (PyTypeObject *type,
Py_RETURN_NONE;
}
- if (!PyType_IsSubtype(type, &PyGIBoxed_Type)) {
- PyErr_SetString(PyExc_TypeError, "must be a subtype of gi.Boxed");
+ if (!PyType_IsSubtype (type, &PyGIBoxed_Type)) {
+ PyErr_SetString (PyExc_TypeError, "must be a subtype of gi.Boxed");
return NULL;
}
- self = (PyGIBoxed *)type->tp_alloc(type, 0);
+ self = (PyGIBoxed *) type->tp_alloc (type, 0);
if (self == NULL) {
return NULL;
}
- ((PyGBoxed *)self)->gtype = pyg_type_from_object((PyObject *)type);
- ((PyGBoxed *)self)->boxed = boxed;
- ((PyGBoxed *)self)->free_on_dealloc = free_on_dealloc;
+ ( (PyGBoxed *) self)->gtype = pyg_type_from_object ( (PyObject *) type);
+ ( (PyGBoxed *) self)->boxed = boxed;
+ ( (PyGBoxed *) self)->free_on_dealloc = free_on_dealloc;
self->size = 0;
self->slice_allocated = FALSE;
- return (PyObject *)self;
+ return (PyObject *) self;
}
void
@@ -187,10 +187,10 @@ _pygi_boxed_register_types (PyObject *m)
{
PyGIBoxed_Type.ob_type = &PyType_Type;
PyGIBoxed_Type.tp_base = &PyGBoxed_Type;
- PyGIBoxed_Type.tp_new = (newfunc)_boxed_new;
- PyGIBoxed_Type.tp_init = (initproc)_boxed_init;
- if (PyType_Ready(&PyGIBoxed_Type))
+ PyGIBoxed_Type.tp_new = (newfunc) _boxed_new;
+ PyGIBoxed_Type.tp_init = (initproc) _boxed_init;
+ if (PyType_Ready (&PyGIBoxed_Type))
return;
- if (PyModule_AddObject(m, "Boxed", (PyObject *)&PyGIBoxed_Type))
+ if (PyModule_AddObject (m, "Boxed", (PyObject *) &PyGIBoxed_Type))
return;
}
diff --git a/gi/pygi-callbacks.c b/gi/pygi-callbacks.c
index 50bd62a..ac9ca6a 100644
--- a/gi/pygi-callbacks.c
+++ b/gi/pygi-callbacks.c
@@ -24,41 +24,41 @@
static PyGICClosure *global_destroy_notify;
static void
-_pygi_destroy_notify_callback_closure(ffi_cif *cif,
- void *result,
- void **args,
- void *data)
+_pygi_destroy_notify_callback_closure (ffi_cif *cif,
+ void *result,
+ void **args,
+ void *data)
{
- PyGICClosure *info = *(void**)(args[0]);
+ PyGICClosure *info = * (void**) (args[0]);
- g_assert(info);
+ g_assert (info);
- _pygi_invoke_closure_free(info);
+ _pygi_invoke_closure_free (info);
}
PyGICClosure*
-_pygi_destroy_notify_create(void)
+_pygi_destroy_notify_create (void)
{
if (!global_destroy_notify) {
-
+
ffi_status status;
- PyGICClosure *destroy_notify = g_slice_new0(PyGICClosure);
-
- g_assert(destroy_notify);
-
- GIBaseInfo* glib_destroy_notify = g_irepository_find_by_name(NULL, "GLib", "DestroyNotify");
- g_assert(glib_destroy_notify != NULL);
- g_assert(g_base_info_get_type(glib_destroy_notify) == GI_INFO_TYPE_CALLBACK);
-
- destroy_notify->closure = g_callable_info_prepare_closure((GICallableInfo*)glib_destroy_notify,
- &destroy_notify->cif,
- _pygi_destroy_notify_callback_closure,
- NULL);
+ PyGICClosure *destroy_notify = g_slice_new0 (PyGICClosure);
+
+ g_assert (destroy_notify);
+
+ GIBaseInfo* glib_destroy_notify = g_irepository_find_by_name (NULL, "GLib", "DestroyNotify");
+ g_assert (glib_destroy_notify != NULL);
+ g_assert (g_base_info_get_type (glib_destroy_notify) == GI_INFO_TYPE_CALLBACK);
+
+ destroy_notify->closure = g_callable_info_prepare_closure ( (GICallableInfo*) glib_destroy_notify,
+ &destroy_notify->cif,
+ _pygi_destroy_notify_callback_closure,
+ NULL);
global_destroy_notify = destroy_notify;
}
-
+
return global_destroy_notify;
}
@@ -76,7 +76,7 @@ _pygi_scan_for_callbacks (GIFunctionInfo *function_info,
*user_data_index = G_MAXUINT8;
*destroy_notify_index = G_MAXUINT8;
- n_args = g_callable_info_get_n_args((GICallableInfo *)function_info);
+ n_args = g_callable_info_get_n_args ( (GICallableInfo *) function_info);
for (i = 0; i < n_args; i++) {
GIDirection direction;
GIArgInfo *arg_info;
@@ -84,42 +84,42 @@ _pygi_scan_for_callbacks (GIFunctionInfo *function_info,
guint8 destroy, closure;
GITypeTag type_tag;
- arg_info = g_callable_info_get_arg((GICallableInfo*) function_info, i);
- type_info = g_arg_info_get_type(arg_info);
- type_tag = g_type_info_get_tag(type_info);
+ arg_info = g_callable_info_get_arg ( (GICallableInfo*) function_info, i);
+ type_info = g_arg_info_get_type (arg_info);
+ type_tag = g_type_info_get_tag (type_info);
if (type_tag == GI_TYPE_TAG_INTERFACE) {
GIBaseInfo* interface_info;
GIInfoType interface_type;
- interface_info = g_type_info_get_interface(type_info);
- interface_type = g_base_info_get_type(interface_info);
+ interface_info = g_type_info_get_interface (type_info);
+ interface_type = g_base_info_get_type (interface_info);
if (interface_type == GI_INFO_TYPE_CALLBACK &&
- !(strcmp(g_base_info_get_namespace((GIBaseInfo*) interface_info), "GLib") == 0 &&
- strcmp(g_base_info_get_name((GIBaseInfo*) interface_info), "DestroyNotify") == 0)) {
+ ! (strcmp (g_base_info_get_namespace ( (GIBaseInfo*) interface_info), "GLib") == 0 &&
+ strcmp (g_base_info_get_name ( (GIBaseInfo*) interface_info), "DestroyNotify") == 0)) {
if (*callback_index != G_MAXUINT8) {
- PyErr_Format(PyExc_TypeError, "Function %s.%s has multiple callbacks, not supported",
- g_base_info_get_namespace((GIBaseInfo*) function_info),
- g_base_info_get_name((GIBaseInfo*) function_info));
- g_base_info_unref(interface_info);
+ PyErr_Format (PyExc_TypeError, "Function %s.%s has multiple callbacks, not supported",
+ g_base_info_get_namespace ( (GIBaseInfo*) function_info),
+ g_base_info_get_name ( (GIBaseInfo*) function_info));
+ g_base_info_unref (interface_info);
return FALSE;
}
*callback_index = i;
}
- g_base_info_unref(interface_info);
+ g_base_info_unref (interface_info);
}
- destroy = g_arg_info_get_destroy(arg_info);
+ destroy = g_arg_info_get_destroy (arg_info);
if (is_method)
--destroy;
- closure = g_arg_info_get_closure(arg_info);
+ closure = g_arg_info_get_closure (arg_info);
if (is_method)
--closure;
- direction = g_arg_info_get_direction(arg_info);
+ direction = g_arg_info_get_direction (arg_info);
if (destroy > 0 && destroy < n_args) {
if (*destroy_notify_index != G_MAXUINT8) {
- PyErr_Format(PyExc_TypeError, "Function %s has multiple GDestroyNotify, not supported",
- g_base_info_get_name((GIBaseInfo*)function_info));
+ PyErr_Format (PyExc_TypeError, "Function %s has multiple GDestroyNotify, not supported",
+ g_base_info_get_name ( (GIBaseInfo*) function_info));
return FALSE;
}
*destroy_notify_index = destroy;
@@ -127,15 +127,15 @@ _pygi_scan_for_callbacks (GIFunctionInfo *function_info,
if (closure > 0 && closure < n_args) {
if (*user_data_index != G_MAXUINT8) {
- PyErr_Format(PyExc_TypeError, "Function %s has multiple user_data arguments, not supported",
- g_base_info_get_name((GIBaseInfo*)function_info));
+ PyErr_Format (PyExc_TypeError, "Function %s has multiple user_data arguments, not supported",
+ g_base_info_get_name ( (GIBaseInfo*) function_info));
return FALSE;
}
*user_data_index = closure;
}
- g_base_info_unref((GIBaseInfo*)arg_info);
- g_base_info_unref((GIBaseInfo*)type_info);
+ g_base_info_unref ( (GIBaseInfo*) arg_info);
+ g_base_info_unref ( (GIBaseInfo*) type_info);
}
return TRUE;
@@ -143,15 +143,15 @@ _pygi_scan_for_callbacks (GIFunctionInfo *function_info,
gboolean
_pygi_create_callback (GIBaseInfo *function_info,
- gboolean is_method,
- gboolean is_constructor,
- int n_args,
- Py_ssize_t py_argc,
- PyObject *py_argv,
- guint8 callback_index,
- guint8 user_data_index,
- guint8 destroy_notify_index,
- PyGICClosure **closure_out)
+ gboolean is_method,
+ gboolean is_constructor,
+ int n_args,
+ Py_ssize_t py_argc,
+ PyObject *py_argv,
+ guint8 callback_index,
+ guint8 user_data_index,
+ guint8 destroy_notify_index,
+ PyGICClosure **closure_out)
{
GIArgInfo *callback_arg;
GITypeInfo *callback_type;
@@ -162,20 +162,20 @@ _pygi_create_callback (GIBaseInfo *function_info,
guint8 i, py_argv_pos;
PyObject *py_user_data;
- callback_arg = g_callable_info_get_arg((GICallableInfo*) function_info, callback_index);
- scope = g_arg_info_get_scope(callback_arg);
+ callback_arg = g_callable_info_get_arg ( (GICallableInfo*) function_info, callback_index);
+ scope = g_arg_info_get_scope (callback_arg);
- callback_type = g_arg_info_get_type(callback_arg);
- g_assert(g_type_info_get_tag(callback_type) == GI_TYPE_TAG_INTERFACE);
+ callback_type = g_arg_info_get_type (callback_arg);
+ g_assert (g_type_info_get_tag (callback_type) == GI_TYPE_TAG_INTERFACE);
- callback_info = (GICallbackInfo*)g_type_info_get_interface(callback_type);
- g_assert(g_base_info_get_type((GIBaseInfo*)callback_info) == GI_INFO_TYPE_CALLBACK);
+ callback_info = (GICallbackInfo*) g_type_info_get_interface (callback_type);
+ g_assert (g_base_info_get_type ( (GIBaseInfo*) callback_info) == GI_INFO_TYPE_CALLBACK);
/* Find the Python function passed for the callback */
found_py_function = FALSE;
py_function = Py_None;
py_user_data = NULL;
-
+
/* if its a method then we need to skip over 'self' */
if (is_method || is_constructor)
py_argv_pos = 1;
@@ -184,33 +184,33 @@ _pygi_create_callback (GIBaseInfo *function_info,
for (i = 0; i < n_args && i < py_argc; i++) {
if (i == callback_index) {
- py_function = PyTuple_GetItem(py_argv, py_argv_pos);
+ py_function = PyTuple_GetItem (py_argv, py_argv_pos);
found_py_function = TRUE;
- } else if (i == user_data_index){
- py_user_data = PyTuple_GetItem(py_argv, py_argv_pos);
+ } else if (i == user_data_index) {
+ py_user_data = PyTuple_GetItem (py_argv, py_argv_pos);
}
py_argv_pos++;
}
if (!found_py_function
- || (py_function == Py_None || !PyCallable_Check(py_function))) {
- PyErr_Format(PyExc_TypeError, "Error invoking %s.%s: Invalid callback given for argument %s",
- g_base_info_get_namespace((GIBaseInfo*) function_info),
- g_base_info_get_name((GIBaseInfo*) function_info),
- g_base_info_get_name((GIBaseInfo*) callback_arg));
- g_base_info_unref((GIBaseInfo*) callback_info);
- g_base_info_unref((GIBaseInfo*) callback_type);
+ || (py_function == Py_None || !PyCallable_Check (py_function))) {
+ PyErr_Format (PyExc_TypeError, "Error invoking %s.%s: Invalid callback given for argument %s",
+ g_base_info_get_namespace ( (GIBaseInfo*) function_info),
+ g_base_info_get_name ( (GIBaseInfo*) function_info),
+ g_base_info_get_name ( (GIBaseInfo*) callback_arg));
+ g_base_info_unref ( (GIBaseInfo*) callback_info);
+ g_base_info_unref ( (GIBaseInfo*) callback_type);
return FALSE;
}
/** Now actually build the closure **/
- *closure_out = _pygi_make_native_closure((GICallableInfo *)callback_info,
- g_arg_info_get_scope(callback_arg),
- py_function,
- py_user_data);
-
- g_base_info_unref((GIBaseInfo*) callback_info);
- g_base_info_unref((GIBaseInfo*) callback_type);
+ *closure_out = _pygi_make_native_closure ( (GICallableInfo *) callback_info,
+ g_arg_info_get_scope (callback_arg),
+ py_function,
+ py_user_data);
+
+ g_base_info_unref ( (GIBaseInfo*) callback_info);
+ g_base_info_unref ( (GIBaseInfo*) callback_type);
return TRUE;
}
diff --git a/gi/pygi-callbacks.h b/gi/pygi-callbacks.h
index c2b137e..7535bba 100644
--- a/gi/pygi-callbacks.h
+++ b/gi/pygi-callbacks.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; c-basic-offset: 4 -*-
* vim: tabstop=4 shiftwidth=4 expandtab
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -22,9 +22,9 @@
G_BEGIN_DECLS
-void _pygi_callback_notify_info_free(gpointer user_data);
-
-PyGICClosure*_pygi_destroy_notify_create(void);
+void _pygi_callback_notify_info_free (gpointer user_data);
+
+PyGICClosure*_pygi_destroy_notify_create (void);
gboolean _pygi_scan_for_callbacks (GIFunctionInfo *self,
gboolean is_method,
diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
index d3e32fa..a752ae2 100644
--- a/gi/pygi-closure.c
+++ b/gi/pygi-closure.c
@@ -29,7 +29,7 @@ static GSList* async_free_list;
static GArgument *
-_pygi_closure_convert_ffi_arguments(GICallableInfo *callable_info, void **args)
+_pygi_closure_convert_ffi_arguments (GICallableInfo *callable_info, void **args)
{
gint num_args, i;
GIArgInfo *arg_info;
@@ -38,145 +38,145 @@ _pygi_closure_convert_ffi_arguments(GICallableInfo *callable_info, void **args)
GIDirection direction;
GArgument *g_args;
- num_args = g_callable_info_get_n_args(callable_info);
- g_args = g_new0(GArgument, num_args);
+ num_args = g_callable_info_get_n_args (callable_info);
+ g_args = g_new0 (GArgument, num_args);
for (i = 0; i < num_args; i++) {
- arg_info = g_callable_info_get_arg(callable_info, i);
- arg_type = g_arg_info_get_type(arg_info);
- tag = g_type_info_get_tag(arg_type);
- direction = g_arg_info_get_direction(arg_info);
+ arg_info = g_callable_info_get_arg (callable_info, i);
+ arg_type = g_arg_info_get_type (arg_info);
+ tag = g_type_info_get_tag (arg_type);
+ direction = g_arg_info_get_direction (arg_info);
if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) {
- g_args[i].v_pointer = *(gpointer *) args[i];
+ g_args[i].v_pointer = * (gpointer *) args[i];
} else {
switch (tag) {
case GI_TYPE_TAG_BOOLEAN:
- g_args[i].v_boolean = *(gboolean *) args[i];
+ g_args[i].v_boolean = * (gboolean *) args[i];
break;
case GI_TYPE_TAG_INT8:
- g_args[i].v_int8 = *(gint8 *) args[i];
+ g_args[i].v_int8 = * (gint8 *) args[i];
break;
case GI_TYPE_TAG_UINT8:
- g_args[i].v_uint8 = *(guint8 *) args[i];
+ g_args[i].v_uint8 = * (guint8 *) args[i];
break;
case GI_TYPE_TAG_INT16:
- g_args[i].v_int16 = *(gint16 *) args[i];
+ g_args[i].v_int16 = * (gint16 *) args[i];
break;
case GI_TYPE_TAG_UINT16:
- g_args[i].v_uint16 = *(guint16 *) args[i];
+ g_args[i].v_uint16 = * (guint16 *) args[i];
break;
case GI_TYPE_TAG_INT32:
- g_args[i].v_int32 = *(gint32 *) args[i];
+ g_args[i].v_int32 = * (gint32 *) args[i];
break;
case GI_TYPE_TAG_UINT32:
- g_args[i].v_uint32 = *(guint32 *) args[i];
+ g_args[i].v_uint32 = * (guint32 *) args[i];
break;
case GI_TYPE_TAG_LONG:
case GI_TYPE_TAG_INT64:
- g_args[i].v_int64 = *(glong *) args[i];
+ g_args[i].v_int64 = * (glong *) args[i];
break;
case GI_TYPE_TAG_ULONG:
case GI_TYPE_TAG_UINT64:
- g_args[i].v_uint64 = *(glong *) args[i];
+ g_args[i].v_uint64 = * (glong *) args[i];
break;
case GI_TYPE_TAG_INT:
case GI_TYPE_TAG_SSIZE:
case GI_TYPE_TAG_SIZE:
- g_args[i].v_int32 = *(gint *) args[i];
+ g_args[i].v_int32 = * (gint *) args[i];
break;
case GI_TYPE_TAG_UINT:
- g_args[i].v_uint32 = *(guint *) args[i];
+ g_args[i].v_uint32 = * (guint *) args[i];
break;
case GI_TYPE_TAG_FLOAT:
- g_args[i].v_float = *(gfloat *) args[i];
+ g_args[i].v_float = * (gfloat *) args[i];
break;
case GI_TYPE_TAG_DOUBLE:
- g_args[i].v_double = *(gdouble *) args[i];
+ g_args[i].v_double = * (gdouble *) args[i];
break;
case GI_TYPE_TAG_UTF8:
- g_args[i].v_string = *(gchar **) args[i];
+ g_args[i].v_string = * (gchar **) args[i];
break;
case GI_TYPE_TAG_INTERFACE:
- {
- GIBaseInfo *interface;
- GIInfoType interface_type;
-
- interface = g_type_info_get_interface(arg_type);
- interface_type = g_base_info_get_type(interface);
-
- if (interface_type == GI_INFO_TYPE_OBJECT ||
- interface_type == GI_INFO_TYPE_INTERFACE) {
- g_args[i].v_pointer = *(gpointer *) args[i];
- g_base_info_unref(interface);
- break;
- } else if (interface_type == GI_INFO_TYPE_ENUM ||
- interface_type == GI_INFO_TYPE_FLAGS) {
- g_args[i].v_double = *(double *) args[i];
- g_base_info_unref(interface);
- break;
- } else if (interface_type == GI_INFO_TYPE_STRUCT) {
- g_args[i].v_pointer = *(gpointer *) args[i];
- g_base_info_unref(interface);
- break;
- }
-
- g_base_info_unref(interface);
+ {
+ GIBaseInfo *interface;
+ GIInfoType interface_type;
+
+ interface = g_type_info_get_interface (arg_type);
+ interface_type = g_base_info_get_type (interface);
+
+ if (interface_type == GI_INFO_TYPE_OBJECT ||
+ interface_type == GI_INFO_TYPE_INTERFACE) {
+ g_args[i].v_pointer = * (gpointer *) args[i];
+ g_base_info_unref (interface);
+ break;
+ } else if (interface_type == GI_INFO_TYPE_ENUM ||
+ interface_type == GI_INFO_TYPE_FLAGS) {
+ g_args[i].v_double = * (double *) args[i];
+ g_base_info_unref (interface);
+ break;
+ } else if (interface_type == GI_INFO_TYPE_STRUCT) {
+ g_args[i].v_pointer = * (gpointer *) args[i];
+ g_base_info_unref (interface);
+ break;
}
+
+ g_base_info_unref (interface);
+ }
case GI_TYPE_TAG_GLIST:
case GI_TYPE_TAG_GSLIST:
- g_args[i].v_pointer = *(gpointer *) args[i];
+ g_args[i].v_pointer = * (gpointer *) args[i];
break;
default:
g_args[i].v_pointer = 0;
}
}
- g_base_info_unref((GIBaseInfo *) arg_info);
- g_base_info_unref((GIBaseInfo *) arg_type);
+ g_base_info_unref ( (GIBaseInfo *) arg_info);
+ g_base_info_unref ( (GIBaseInfo *) arg_type);
}
return g_args;
}
static gboolean
-_pygi_closure_convert_arguments(GICallableInfo *callable_info, void **args,
+_pygi_closure_convert_arguments (GICallableInfo *callable_info, void **args,
void *user_data, PyObject **py_args,
GArgument **out_args)
{
- int n_args = g_callable_info_get_n_args(callable_info);
+ int n_args = g_callable_info_get_n_args (callable_info);
int n_in_args = 0;
int n_out_args = 0;
int i;
GArgument *g_args = NULL;
*py_args = NULL;
- *py_args = PyTuple_New(n_args);
+ *py_args = PyTuple_New (n_args);
if (*py_args == NULL)
goto error;
*out_args = NULL;
- *out_args = g_new0(GArgument, n_args);
- g_args = _pygi_closure_convert_ffi_arguments(callable_info, args);
+ *out_args = g_new0 (GArgument, n_args);
+ g_args = _pygi_closure_convert_ffi_arguments (callable_info, args);
for (i = 0; i < n_args; i++) {
- GIArgInfo *arg_info = g_callable_info_get_arg(callable_info, i);
- GIDirection direction = g_arg_info_get_direction(arg_info);
+ GIArgInfo *arg_info = g_callable_info_get_arg (callable_info, i);
+ GIDirection direction = g_arg_info_get_direction (arg_info);
if (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT) {
- GITypeInfo *arg_type = g_arg_info_get_type(arg_info);
- GITypeTag arg_tag = g_type_info_get_tag(arg_type);
- GITransfer transfer = g_arg_info_get_ownership_transfer(arg_info);
+ GITypeInfo *arg_type = g_arg_info_get_type (arg_info);
+ GITypeTag arg_tag = g_type_info_get_tag (arg_type);
+ GITransfer transfer = g_arg_info_get_ownership_transfer (arg_info);
PyObject *value;
GArgument *arg;
if (direction == GI_DIRECTION_IN && arg_tag == GI_TYPE_TAG_VOID &&
- g_type_info_is_pointer(arg_type)) {
+ g_type_info_is_pointer (arg_type)) {
if (user_data == NULL) {
- Py_INCREF(Py_None);
+ Py_INCREF (Py_None);
value = Py_None;
} else {
value = user_data;
- Py_INCREF(value);
+ Py_INCREF (value);
}
} else {
if (direction == GI_DIRECTION_IN)
@@ -184,46 +184,46 @@ _pygi_closure_convert_arguments(GICallableInfo *callable_info, void **args,
else
arg = (GArgument*) g_args[i].v_pointer;
- value = _pygi_argument_to_object(arg, arg_type, transfer);
+ value = _pygi_argument_to_object (arg, arg_type, transfer);
if (value == NULL) {
- g_base_info_unref(arg_type);
- g_base_info_unref(arg_info);
+ g_base_info_unref (arg_type);
+ g_base_info_unref (arg_info);
goto error;
}
}
- PyTuple_SET_ITEM(*py_args, n_in_args, value);
+ PyTuple_SET_ITEM (*py_args, n_in_args, value);
n_in_args++;
- g_base_info_unref(arg_type);
+ g_base_info_unref (arg_type);
}
if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) {
- (*out_args)[n_out_args] = g_args[i];
+ (*out_args) [n_out_args] = g_args[i];
n_out_args++;
}
- g_base_info_unref(arg_info);
+ g_base_info_unref (arg_info);
}
- if (_PyTuple_Resize(py_args, n_in_args) == -1)
+ if (_PyTuple_Resize (py_args, n_in_args) == -1)
goto error;
return TRUE;
error:
- Py_CLEAR(*py_args);
+ Py_CLEAR (*py_args);
if (*out_args != NULL)
- g_free(*out_args);
+ g_free (*out_args);
if (g_args != NULL)
- g_free(g_args);
+ g_free (g_args);
return FALSE;
}
static void
-_pygi_closure_set_out_arguments(GICallableInfo *callable_info,
+_pygi_closure_set_out_arguments (GICallableInfo *callable_info,
PyObject *py_retval, GArgument *out_args,
void *resp)
{
@@ -232,48 +232,48 @@ _pygi_closure_set_out_arguments(GICallableInfo *callable_info,
GITypeTag return_type_tag;
i_py_retval = 0;
- return_type_info = g_callable_info_get_return_type(callable_info);
- return_type_tag = g_type_info_get_tag(return_type_info);
+ return_type_info = g_callable_info_get_return_type (callable_info);
+ return_type_tag = g_type_info_get_tag (return_type_info);
if (return_type_tag != GI_TYPE_TAG_VOID) {
GArgument arg;
- GITransfer transfer = g_callable_info_get_caller_owns(callable_info);
- if (PyTuple_Check(py_retval)) {
- PyObject *item = PyTuple_GET_ITEM(py_retval, 0);
- arg = _pygi_argument_from_object(item, return_type_info, transfer);
- *((GArgument*)resp) = arg;
+ GITransfer transfer = g_callable_info_get_caller_owns (callable_info);
+ if (PyTuple_Check (py_retval)) {
+ PyObject *item = PyTuple_GET_ITEM (py_retval, 0);
+ arg = _pygi_argument_from_object (item, return_type_info, transfer);
+ * ( (GArgument*) resp) = arg;
} else {
- arg = _pygi_argument_from_object(py_retval, return_type_info, transfer);
- *((GArgument*)resp) = arg;
+ arg = _pygi_argument_from_object (py_retval, return_type_info, transfer);
+ * ( (GArgument*) resp) = arg;
}
i_py_retval++;
}
- g_base_info_unref(return_type_info);
+ g_base_info_unref (return_type_info);
i_out_args = 0;
- n_args = g_callable_info_get_n_args(callable_info);
+ n_args = g_callable_info_get_n_args (callable_info);
for (i = 1; i < n_args; i++) {
- GIArgInfo *arg_info = g_callable_info_get_arg(callable_info, i);
- GITypeInfo *type_info = g_arg_info_get_type(arg_info);
- GIDirection direction = g_arg_info_get_direction(arg_info);
+ GIArgInfo *arg_info = g_callable_info_get_arg (callable_info, i);
+ GITypeInfo *type_info = g_arg_info_get_type (arg_info);
+ GIDirection direction = g_arg_info_get_direction (arg_info);
if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) {
- GITransfer transfer = g_arg_info_get_ownership_transfer(arg_info);
+ GITransfer transfer = g_arg_info_get_ownership_transfer (arg_info);
GArgument arg;
- if (PyTuple_Check(py_retval)) {
- PyObject *item = PyTuple_GET_ITEM(py_retval, i_py_retval);
- arg = _pygi_argument_from_object(item, type_info, transfer);
- *((GArgument*)out_args[i_out_args].v_pointer) = arg;
+ if (PyTuple_Check (py_retval)) {
+ PyObject *item = PyTuple_GET_ITEM (py_retval, i_py_retval);
+ arg = _pygi_argument_from_object (item, type_info, transfer);
+ * ( (GArgument*) out_args[i_out_args].v_pointer) = arg;
} else if (i_py_retval == 0) {
- arg = _pygi_argument_from_object(py_retval, type_info, transfer);
- *((GArgument*)out_args[i_out_args].v_pointer) = arg;
+ arg = _pygi_argument_from_object (py_retval, type_info, transfer);
+ * ( (GArgument*) out_args[i_out_args].v_pointer) = arg;
} else
g_assert_not_reached();
i_out_args++;
i_py_retval++;
}
- g_base_info_unref(type_info);
- g_base_info_unref(arg_info);
+ g_base_info_unref (type_info);
+ g_base_info_unref (arg_info);
}
}
@@ -296,69 +296,69 @@ _pygi_closure_handle (ffi_cif *cif,
may be executing python code */
state = PyGILState_Ensure();
- return_type = g_callable_info_get_return_type(closure->info);
- return_tag = g_type_info_get_tag(return_type);
- return_transfer = g_callable_info_get_caller_owns(closure->info);
+ return_type = g_callable_info_get_return_type (closure->info);
+ return_tag = g_type_info_get_tag (return_type);
+ return_transfer = g_callable_info_get_caller_owns (closure->info);
- if (!_pygi_closure_convert_arguments((GICallableInfo *)closure->info, args,
- closure->user_data,
- &py_args, &out_args)) {
+ if (!_pygi_closure_convert_arguments ( (GICallableInfo *) closure->info, args,
+ closure->user_data,
+ &py_args, &out_args)) {
if (PyErr_Occurred ())
PyErr_Print();
goto end;
}
- retval = PyObject_CallObject((PyObject *)closure->function, py_args);
- Py_DECREF(py_args);
+ retval = PyObject_CallObject ( (PyObject *) closure->function, py_args);
+ Py_DECREF (py_args);
if (retval == NULL) {
PyErr_Print();
goto end;
}
- _pygi_closure_set_out_arguments(closure->info, retval, out_args, result);
+ _pygi_closure_set_out_arguments (closure->info, retval, out_args, result);
end:
- g_base_info_unref((GIBaseInfo*)return_type);
+ g_base_info_unref ( (GIBaseInfo*) return_type);
- PyGILState_Release(state);
+ PyGILState_Release (state);
/* Now that the closure has finished we can make a decision about how
to free it. Scope call gets free'd at the end of wrap_g_function_info_invoke
- scope notified will be freed, when the notify is called and we can free async
+ scope notified will be freed, when the notify is called and we can free async
anytime we want as long as its after we return from this function (you can't free the closure
you are currently using!)
*/
switch (closure->scope) {
- case GI_SCOPE_TYPE_CALL:
- case GI_SCOPE_TYPE_NOTIFIED:
- break;
- case GI_SCOPE_TYPE_ASYNC:
- /* Append this PyGICClosure to a list of closure that we will free
- after we're done with this function invokation */
- async_free_list = g_slist_prepend(async_free_list, closure);
- break;
- default:
- g_error("Invalid scope reached inside %s. Possibly a bad annotation?",
- g_base_info_get_name(closure->info));
+ case GI_SCOPE_TYPE_CALL:
+ case GI_SCOPE_TYPE_NOTIFIED:
+ break;
+ case GI_SCOPE_TYPE_ASYNC:
+ /* Append this PyGICClosure to a list of closure that we will free
+ after we're done with this function invokation */
+ async_free_list = g_slist_prepend (async_free_list, closure);
+ break;
+ default:
+ g_error ("Invalid scope reached inside %s. Possibly a bad annotation?",
+ g_base_info_get_name (closure->info));
}
}
-void _pygi_invoke_closure_free(gpointer data)
+void _pygi_invoke_closure_free (gpointer data)
{
- PyGICClosure* invoke_closure = (PyGICClosure *)data;
+ PyGICClosure* invoke_closure = (PyGICClosure *) data;
- Py_DECREF(invoke_closure->function);
+ Py_DECREF (invoke_closure->function);
- g_callable_info_free_closure(invoke_closure->info,
- invoke_closure->closure);
+ g_callable_info_free_closure (invoke_closure->info,
+ invoke_closure->closure);
if (invoke_closure->info)
- g_base_info_unref((GIBaseInfo*)invoke_closure->info);
+ g_base_info_unref ( (GIBaseInfo*) invoke_closure->info);
- Py_XDECREF(invoke_closure->user_data);
+ Py_XDECREF (invoke_closure->user_data);
- g_slice_free(PyGICClosure, invoke_closure);
+ g_slice_free (PyGICClosure, invoke_closure);
}
@@ -372,25 +372,25 @@ _pygi_make_native_closure (GICallableInfo* info,
ffi_closure *fficlosure;
/* Begin by cleaning up old async functions */
- g_slist_foreach(async_free_list, (GFunc)_pygi_invoke_closure_free, NULL);
- g_slist_free(async_free_list);
+ g_slist_foreach (async_free_list, (GFunc) _pygi_invoke_closure_free, NULL);
+ g_slist_free (async_free_list);
async_free_list = NULL;
/* Build the closure itself */
- closure = g_slice_new0(PyGICClosure);
- closure->info = (GICallableInfo *) g_base_info_ref ((GIBaseInfo *) info);
+ closure = g_slice_new0 (PyGICClosure);
+ closure->info = (GICallableInfo *) g_base_info_ref ( (GIBaseInfo *) info);
closure->function = py_function;
closure->user_data = py_user_data;
- Py_INCREF(py_function);
+ Py_INCREF (py_function);
if (closure->user_data)
- Py_INCREF(closure->user_data);
+ Py_INCREF (closure->user_data);
fficlosure =
g_callable_info_prepare_closure (info, &closure->cif, _pygi_closure_handle,
closure);
closure->closure = fficlosure;
-
+
/* Give the closure the information it needs to determine when
to free itself later */
closure->scope = scope;
diff --git a/gi/pygi-closure.h b/gi/pygi-closure.h
index 550bf8a..6f98339 100644
--- a/gi/pygi-closure.h
+++ b/gi/pygi-closure.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; c-basic-offset: 4 -*-
* vim: tabstop=4 shiftwidth=4 expandtab
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -33,19 +33,19 @@ typedef struct _PyGICClosure
{
GICallableInfo *info;
PyObject *function;
-
+
ffi_closure *closure;
ffi_cif cif;
-
+
GIScopeType scope;
PyObject* user_data;
-} PyGICClosure;
-
-void _pygi_closure_handle(ffi_cif *cif, void *result, void
- **args, void *userdata);
-
-void _pygi_invoke_closure_free(gpointer user_data);
+} PyGICClosure;
+
+void _pygi_closure_handle (ffi_cif *cif, void *result, void
+ **args, void *userdata);
+
+void _pygi_invoke_closure_free (gpointer user_data);
PyGICClosure* _pygi_make_native_closure (GICallableInfo* info,
GIScopeType scope,
diff --git a/gi/pygi-foreign-cairo.c b/gi/pygi-foreign-cairo.c
index a051d33..7ec71c1 100644
--- a/gi/pygi-foreign-cairo.c
+++ b/gi/pygi-foreign-cairo.c
@@ -29,16 +29,16 @@ extern Pycairo_CAPI_t *Pycairo_CAPI;
#include "pygi-foreign-cairo.h"
gboolean
-cairo_context_to_arg(PyObject *value,
- GITypeInfo *type_info,
- GITransfer transfer,
- GArgument *arg)
+cairo_context_to_arg (PyObject *value,
+ GITypeInfo *type_info,
+ GITransfer transfer,
+ GArgument *arg)
{
cairo_t *cr;
g_assert (transfer == GI_TRANSFER_NOTHING);
- cr = PycairoContext_GET(value);
+ cr = PycairoContext_GET (value);
if (!cr)
return FALSE;
@@ -47,7 +47,7 @@ cairo_context_to_arg(PyObject *value,
}
PyObject *
-cairo_context_from_arg(GITypeInfo *type_info, GArgument *arg)
+cairo_context_from_arg (GITypeInfo *type_info, GArgument *arg)
{
cairo_t *context = (cairo_t*) arg;
@@ -57,25 +57,25 @@ cairo_context_from_arg(GITypeInfo *type_info, GArgument *arg)
}
gboolean
-cairo_context_release_arg(GITransfer transfer, GITypeInfo *type_info,
- GArgument *arg)
+cairo_context_release_arg (GITransfer transfer, GITypeInfo *type_info,
+ GArgument *arg)
{
- cairo_destroy((cairo_t*)arg->v_pointer);
+ cairo_destroy ( (cairo_t*) arg->v_pointer);
return TRUE;
}
gboolean
-cairo_surface_to_arg(PyObject *value,
- GITypeInfo *type_info,
- GITransfer transfer,
- GArgument *arg)
+cairo_surface_to_arg (PyObject *value,
+ GITypeInfo *type_info,
+ GITransfer transfer,
+ GArgument *arg)
{
cairo_surface_t *surface;
g_assert (transfer == GI_TRANSFER_NOTHING);
- surface = ((PycairoSurface*)value)->surface;
+ surface = ( (PycairoSurface*) value)->surface;
if (!surface)
return FALSE;
@@ -84,7 +84,7 @@ cairo_surface_to_arg(PyObject *value,
}
PyObject *
-cairo_surface_from_arg(GITypeInfo *type_info, GArgument *arg)
+cairo_surface_from_arg (GITypeInfo *type_info, GArgument *arg)
{
cairo_surface_t *surface = (cairo_surface_t*) arg;
@@ -94,10 +94,10 @@ cairo_surface_from_arg(GITypeInfo *type_info, GArgument *arg)
}
gboolean
-cairo_surface_release_arg(GITransfer transfer, GITypeInfo *type_info,
- GArgument *arg)
+cairo_surface_release_arg (GITransfer transfer, GITypeInfo *type_info,
+ GArgument *arg)
{
- cairo_surface_destroy((cairo_surface_t*)arg->v_pointer);
+ cairo_surface_destroy ( (cairo_surface_t*) arg->v_pointer);
return TRUE;
}
diff --git a/gi/pygi-foreign-cairo.h b/gi/pygi-foreign-cairo.h
index b8dbcaa..7bff01d 100644
--- a/gi/pygi-foreign-cairo.h
+++ b/gi/pygi-foreign-cairo.h
@@ -26,30 +26,30 @@
#include "pygi-foreign.h"
-gboolean cairo_context_to_arg(PyObject *value,
- GITypeInfo *type_info,
- GITransfer transfer,
- GArgument *arg);
+gboolean cairo_context_to_arg (PyObject *value,
+ GITypeInfo *type_info,
+ GITransfer transfer,
+ GArgument *arg);
-PyObject *cairo_context_from_arg(GITypeInfo *type_info,
- GArgument *arg);
+PyObject *cairo_context_from_arg (GITypeInfo *type_info,
+ GArgument *arg);
-gboolean cairo_context_release_arg(GITransfer transfer,
- GITypeInfo *type_info,
- GArgument *arg);
+gboolean cairo_context_release_arg (GITransfer transfer,
+ GITypeInfo *type_info,
+ GArgument *arg);
-gboolean cairo_surface_to_arg(PyObject *value,
- GITypeInfo *type_info,
- GITransfer transfer,
- GArgument *arg);
+gboolean cairo_surface_to_arg (PyObject *value,
+ GITypeInfo *type_info,
+ GITransfer transfer,
+ GArgument *arg);
-PyObject *cairo_surface_from_arg(GITypeInfo *type_info,
- GArgument *arg);
+PyObject *cairo_surface_from_arg (GITypeInfo *type_info,
+ GArgument *arg);
-gboolean cairo_surface_release_arg(GITransfer transfer,
- GITypeInfo *type_info,
- GArgument *arg);
+gboolean cairo_surface_release_arg (GITransfer transfer,
+ GITypeInfo *type_info,
+ GArgument *arg);
#endif /* __PYGI_FOREIGN_CAIRO_H__ */
diff --git a/gi/pygi-foreign.c b/gi/pygi-foreign.c
index cde56b0..d2613df 100644
--- a/gi/pygi-foreign.c
+++ b/gi/pygi-foreign.c
@@ -36,46 +36,48 @@ static struct {
PyGIArgOverrideFromGArgumentFunc from_func;
PyGIArgOverrideReleaseGArgumentFunc release_func;
} foreign_structs[] = {
- { "cairo", "Context", cairo_context_to_arg, cairo_context_from_arg,
- cairo_context_release_arg },
- { "cairo", "Surface", cairo_surface_to_arg, cairo_surface_from_arg,
- cairo_surface_release_arg },
+ { "cairo", "Context", cairo_context_to_arg, cairo_context_from_arg,
+ cairo_context_release_arg
+ },
+ { "cairo", "Surface", cairo_surface_to_arg, cairo_surface_from_arg,
+ cairo_surface_release_arg
+ },
{ NULL }
};
static gint
-pygi_struct_foreign_lookup(GITypeInfo *type_info)
+pygi_struct_foreign_lookup (GITypeInfo *type_info)
{
GIBaseInfo *base_info;
- base_info = g_type_info_get_interface(type_info);
+ base_info = g_type_info_get_interface (type_info);
if (base_info) {
gint i;
- const gchar *namespace = g_base_info_get_namespace(base_info);
- const gchar *name = g_base_info_get_name(base_info);
+ const gchar *namespace = g_base_info_get_namespace (base_info);
+ const gchar *name = g_base_info_get_name (base_info);
for (i = 0; foreign_structs[i].namespace; ++i) {
- if ((strcmp(namespace, foreign_structs[i].namespace) == 0) &&
- (strcmp(name, foreign_structs[i].name) == 0)) {
- g_base_info_unref(base_info);
+ if ( (strcmp (namespace, foreign_structs[i].namespace) == 0) &&
+ (strcmp (name, foreign_structs[i].name) == 0)) {
+ g_base_info_unref (base_info);
return i;
}
}
- PyErr_Format(PyExc_TypeError, "Couldn't find type %s.%s", namespace,
- name);
+ PyErr_Format (PyExc_TypeError, "Couldn't find type %s.%s", namespace,
+ name);
- g_base_info_unref(base_info);
+ g_base_info_unref (base_info);
}
return -1;
}
gboolean
-pygi_struct_foreign_convert_to_g_argument(PyObject *value,
- GITypeInfo *type_info,
- GITransfer transfer,
- GArgument *arg)
+pygi_struct_foreign_convert_to_g_argument (PyObject *value,
+ GITypeInfo *type_info,
+ GITransfer transfer,
+ GArgument *arg)
{
gint struct_index;
@@ -83,15 +85,15 @@ pygi_struct_foreign_convert_to_g_argument(PyObject *value,
if (struct_index < 0)
return FALSE;
- if (!foreign_structs[struct_index].to_func(value, type_info, transfer, arg))
+ if (!foreign_structs[struct_index].to_func (value, type_info, transfer, arg))
return FALSE;
return TRUE;
}
PyObject *
-pygi_struct_foreign_convert_from_g_argument(GITypeInfo *type_info,
- GArgument *arg)
+pygi_struct_foreign_convert_from_g_argument (GITypeInfo *type_info,
+ GArgument *arg)
{
gint struct_index;
@@ -99,13 +101,13 @@ pygi_struct_foreign_convert_from_g_argument(GITypeInfo *type_info,
if (struct_index < 0)
return NULL;
- return foreign_structs[struct_index].from_func(type_info, arg);
+ return foreign_structs[struct_index].from_func (type_info, arg);
}
gboolean
-pygi_struct_foreign_release_g_argument(GITransfer transfer,
- GITypeInfo *type_info,
- GArgument *arg)
+pygi_struct_foreign_release_g_argument (GITransfer transfer,
+ GITypeInfo *type_info,
+ GArgument *arg)
{
gint struct_index;
@@ -116,7 +118,7 @@ pygi_struct_foreign_release_g_argument(GITransfer transfer,
if (!foreign_structs[struct_index].release_func)
return TRUE;
- if (!foreign_structs[struct_index].release_func(transfer, type_info, arg))
+ if (!foreign_structs[struct_index].release_func (transfer, type_info, arg))
return FALSE;
return TRUE;
diff --git a/gi/pygi-foreign.h b/gi/pygi-foreign.h
index 2f13b0f..7962b49 100644
--- a/gi/pygi-foreign.h
+++ b/gi/pygi-foreign.h
@@ -43,10 +43,10 @@ gboolean pygi_struct_foreign_convert_to_g_argument (PyObject *value,
GITypeInfo *type_info,
GITransfer transfer,
GArgument *arg);
-PyObject *pygi_struct_foreign_convert_from_g_argument(GITypeInfo *type_info,
- GArgument *arg);
-gboolean pygi_struct_foreign_release_g_argument (GITransfer transfer,
- GITypeInfo *type_info,
- GArgument *arg);
+PyObject *pygi_struct_foreign_convert_from_g_argument (GITypeInfo *type_info,
+ GArgument *arg);
+gboolean pygi_struct_foreign_release_g_argument (GITransfer transfer,
+ GITypeInfo *type_info,
+ GArgument *arg);
#endif /* __PYGI_FOREIGN_H__ */
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index 9882fd7..c6b7bab 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -68,13 +68,13 @@ PyTypeObject Py##cname##_Type = { \
static void
_base_info_dealloc (PyGIBaseInfo *self)
{
- PyObject_GC_UnTrack((PyObject *)self);
+ PyObject_GC_UnTrack ( (PyObject *) self);
- PyObject_ClearWeakRefs((PyObject *)self);
+ PyObject_ClearWeakRefs ( (PyObject *) self);
- g_base_info_unref(self->info);
+ g_base_info_unref (self->info);
- self->ob_type->tp_free((PyObject *)self);
+ self->ob_type->tp_free ( (PyObject *) self);
}
static int
@@ -88,55 +88,55 @@ _base_info_traverse (PyGIBaseInfo *self,
static PyObject *
_base_info_repr (PyGIBaseInfo *self)
{
- return PyString_FromFormat("<%s object (%s) at 0x%p>",
- self->ob_type->tp_name, g_base_info_get_name(self->info), (void *)self);
+ return PyString_FromFormat ("<%s object (%s) at 0x%p>",
+ self->ob_type->tp_name, g_base_info_get_name (self->info), (void *) self);
}
static PyMethodDef _PyGIBaseInfo_methods[];
PyTypeObject PyGIBaseInfo_Type = {
- PyObject_HEAD_INIT(NULL)
+ PyObject_HEAD_INIT (NULL)
0,
"gi.BaseInfo", /* tp_name */
- sizeof(PyGIBaseInfo), /* tp_basicsize */
+ sizeof (PyGIBaseInfo), /* tp_basicsize */
0, /* tp_itemsize */
- (destructor)_base_info_dealloc, /* tp_dealloc */
- (printfunc)NULL, /* tp_print */
- (getattrfunc)NULL, /* tp_getattr */
- (setattrfunc)NULL, /* tp_setattr */
- (cmpfunc)NULL, /* tp_compare */
- (reprfunc)_base_info_repr, /* tp_repr */
+ (destructor) _base_info_dealloc, /* tp_dealloc */
+ (printfunc) NULL, /* tp_print */
+ (getattrfunc) NULL, /* tp_getattr */
+ (setattrfunc) NULL, /* tp_setattr */
+ (cmpfunc) NULL, /* tp_compare */
+ (reprfunc) _base_info_repr, /* tp_repr */
NULL, /* tp_as_number */
NULL, /* tp_as_sequence */
NULL, /* tp_as_mapping */
- (hashfunc)NULL, /* tp_hash */
- (ternaryfunc)NULL, /* tp_call */
- (reprfunc)NULL, /* tp_str */
- (getattrofunc)NULL, /* tp_getattro */
- (setattrofunc)NULL, /* tp_setattro */
+ (hashfunc) NULL, /* tp_hash */
+ (ternaryfunc) NULL, /* tp_call */
+ (reprfunc) NULL, /* tp_str */
+ (getattrofunc) NULL, /* tp_getattro */
+ (setattrofunc) NULL, /* tp_setattro */
NULL, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
- Py_TPFLAGS_HAVE_GC, /* tp_flags */
+ Py_TPFLAGS_HAVE_GC, /* tp_flags */
NULL, /* tp_doc */
- (traverseproc)_base_info_traverse, /* tp_traverse */
- (inquiry)NULL, /* tp_clear */
- (richcmpfunc)NULL, /* tp_richcompare */
- offsetof(PyGIBaseInfo, inst_weakreflist), /* tp_weaklistoffset */
- (getiterfunc)NULL, /* tp_iter */
- (iternextfunc)NULL, /* tp_iternext */
+ (traverseproc) _base_info_traverse, /* tp_traverse */
+ (inquiry) NULL, /* tp_clear */
+ (richcmpfunc) NULL, /* tp_richcompare */
+ offsetof (PyGIBaseInfo, inst_weakreflist), /* tp_weaklistoffset */
+ (getiterfunc) NULL, /* tp_iter */
+ (iternextfunc) NULL, /* tp_iternext */
_PyGIBaseInfo_methods, /* tp_methods */
};
static PyObject *
_wrap_g_base_info_get_name (PyGIBaseInfo *self)
{
- return PyString_FromString(g_base_info_get_name(self->info));
+ return PyString_FromString (g_base_info_get_name (self->info));
}
static PyObject *
_wrap_g_base_info_get_namespace (PyGIBaseInfo *self)
{
- return PyString_FromString(g_base_info_get_namespace(self->info));
+ return PyString_FromString (g_base_info_get_namespace (self->info));
}
static PyObject *
@@ -144,20 +144,20 @@ _wrap_g_base_info_get_container (PyGIBaseInfo *self)
{
GIBaseInfo *info;
- info = g_base_info_get_container(self->info);
+ info = g_base_info_get_container (self->info);
if (info == NULL) {
Py_RETURN_NONE;
}
- return _pygi_info_new(info);
+ return _pygi_info_new (info);
}
static PyMethodDef _PyGIBaseInfo_methods[] = {
- { "get_name", (PyCFunction)_wrap_g_base_info_get_name, METH_NOARGS },
- { "get_namespace", (PyCFunction)_wrap_g_base_info_get_namespace, METH_NOARGS },
- { "get_container", (PyCFunction)_wrap_g_base_info_get_container, METH_NOARGS },
+ { "get_name", (PyCFunction) _wrap_g_base_info_get_name, METH_NOARGS },
+ { "get_namespace", (PyCFunction) _wrap_g_base_info_get_namespace, METH_NOARGS },
+ { "get_container", (PyCFunction) _wrap_g_base_info_get_container, METH_NOARGS },
{ NULL, NULL, 0 }
};
@@ -168,24 +168,24 @@ _pygi_info_new (GIBaseInfo *info)
PyTypeObject *type = NULL;
PyGIBaseInfo *self;
- info_type = g_base_info_get_type(info);
+ info_type = g_base_info_get_type (info);
switch (info_type)
{
case GI_INFO_TYPE_INVALID:
- PyErr_SetString(PyExc_RuntimeError, "Invalid info type");
+ PyErr_SetString (PyExc_RuntimeError, "Invalid info type");
return NULL;
case GI_INFO_TYPE_FUNCTION:
type = &PyGIFunctionInfo_Type;
break;
case GI_INFO_TYPE_CALLBACK:
- PyErr_SetString(PyExc_NotImplementedError, "GICallbackInfo bindings not implemented");
+ PyErr_SetString (PyExc_NotImplementedError, "GICallbackInfo bindings not implemented");
return NULL;
case GI_INFO_TYPE_STRUCT:
type = &PyGIStructInfo_Type;
break;
case GI_INFO_TYPE_BOXED:
- PyErr_SetString(PyExc_NotImplementedError, "GIBoxedInfo bindings not implemented");
+ PyErr_SetString (PyExc_NotImplementedError, "GIBoxedInfo bindings not implemented");
return NULL;
case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS:
@@ -201,7 +201,7 @@ _pygi_info_new (GIBaseInfo *info)
type = &PyGIConstantInfo_Type;
break;
case GI_INFO_TYPE_ERROR_DOMAIN:
- PyErr_SetString(PyExc_NotImplementedError, "GIErrorDomainInfo bindings not implemented");
+ PyErr_SetString (PyExc_NotImplementedError, "GIErrorDomainInfo bindings not implemented");
return NULL;
case GI_INFO_TYPE_UNION:
type = &PyGIUnionInfo_Type;
@@ -210,36 +210,36 @@ _pygi_info_new (GIBaseInfo *info)
type = &PyGIValueInfo_Type;
break;
case GI_INFO_TYPE_SIGNAL:
- PyErr_SetString(PyExc_NotImplementedError, "GISignalInfo bindings not implemented");
+ PyErr_SetString (PyExc_NotImplementedError, "GISignalInfo bindings not implemented");
return NULL;
case GI_INFO_TYPE_VFUNC:
type = &PyGIVFuncInfo_Type;
break;
case GI_INFO_TYPE_PROPERTY:
- PyErr_SetString(PyExc_NotImplementedError, "GIPropertyInfo bindings not implemented");
+ PyErr_SetString (PyExc_NotImplementedError, "GIPropertyInfo bindings not implemented");
return NULL;
case GI_INFO_TYPE_FIELD:
type = &PyGIFieldInfo_Type;
break;
case GI_INFO_TYPE_ARG:
- PyErr_SetString(PyExc_NotImplementedError, "GIArgInfo bindings not implemented");
+ PyErr_SetString (PyExc_NotImplementedError, "GIArgInfo bindings not implemented");
return NULL;
case GI_INFO_TYPE_TYPE:
- PyErr_SetString(PyExc_NotImplementedError, "GITypeInfo bindings not implemented");
+ PyErr_SetString (PyExc_NotImplementedError, "GITypeInfo bindings not implemented");
return NULL;
case GI_INFO_TYPE_UNRESOLVED:
type = &PyGIUnresolvedInfo_Type;
break;
}
- self = (PyGIBaseInfo *)type->tp_alloc(type, 0);
+ self = (PyGIBaseInfo *) type->tp_alloc (type, 0);
if (self == NULL) {
return NULL;
}
- self->info = g_base_info_ref(info);
+ self->info = g_base_info_ref (info);
- return (PyObject *)self;
+ return (PyObject *) self;
}
GIBaseInfo *
@@ -249,28 +249,28 @@ _pygi_object_get_gi_info (PyObject *object,
PyObject *py_info;
GIBaseInfo *info = NULL;
- py_info = PyObject_GetAttrString(object, "__info__");
+ py_info = PyObject_GetAttrString (object, "__info__");
if (py_info == NULL) {
return NULL;
}
- if (!PyObject_TypeCheck(py_info, type)) {
- PyErr_Format(PyExc_TypeError, "attribute '__info__' must be %s, not %s",
- type->tp_name, py_info->ob_type->tp_name);
+ if (!PyObject_TypeCheck (py_info, type)) {
+ PyErr_Format (PyExc_TypeError, "attribute '__info__' must be %s, not %s",
+ type->tp_name, py_info->ob_type->tp_name);
goto out;
}
- info = ((PyGIBaseInfo *)py_info)->info;
- g_base_info_ref(info);
+ info = ( (PyGIBaseInfo *) py_info)->info;
+ g_base_info_ref (info);
out:
- Py_DECREF(py_info);
+ Py_DECREF (py_info);
return info;
}
/* CallableInfo */
-_PyGI_DEFINE_INFO_TYPE("CallableInfo", GICallableInfo, PyGIBaseInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("CallableInfo", GICallableInfo, PyGIBaseInfo_Type);
static PyMethodDef _PyGICallableInfo_methods[] = {
{ NULL, NULL, 0 }
@@ -278,7 +278,7 @@ static PyMethodDef _PyGICallableInfo_methods[] = {
/* FunctionInfo */
-_PyGI_DEFINE_INFO_TYPE("FunctionInfo", GIFunctionInfo, PyGICallableInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("FunctionInfo", GIFunctionInfo, PyGICallableInfo_Type);
static PyObject *
_wrap_g_function_info_is_constructor (PyGIBaseInfo *self)
@@ -286,10 +286,10 @@ _wrap_g_function_info_is_constructor (PyGIBaseInfo *self)
GIFunctionInfoFlags flags;
gboolean is_constructor;
- flags = g_function_info_get_flags((GIFunctionInfo*)self->info);
+ flags = g_function_info_get_flags ( (GIFunctionInfo*) self->info);
is_constructor = flags & GI_FUNCTION_IS_CONSTRUCTOR;
- return PyBool_FromLong(is_constructor);
+ return PyBool_FromLong (is_constructor);
}
static PyObject *
@@ -298,10 +298,10 @@ _wrap_g_function_info_is_method (PyGIBaseInfo *self)
GIFunctionInfoFlags flags;
gboolean is_method;
- flags = g_function_info_get_flags((GIFunctionInfo*)self->info);
+ flags = g_function_info_get_flags ( (GIFunctionInfo*) self->info);
is_method = flags & GI_FUNCTION_IS_METHOD;
- return PyBool_FromLong(is_method);
+ return PyBool_FromLong (is_method);
}
gsize
@@ -309,53 +309,53 @@ _pygi_g_type_tag_size (GITypeTag type_tag)
{
gsize size = 0;
- switch(type_tag) {
+ switch (type_tag) {
case GI_TYPE_TAG_BOOLEAN:
- size = sizeof(gboolean);
+ size = sizeof (gboolean);
break;
case GI_TYPE_TAG_INT8:
case GI_TYPE_TAG_UINT8:
- size = sizeof(gint8);
+ size = sizeof (gint8);
break;
case GI_TYPE_TAG_INT16:
case GI_TYPE_TAG_UINT16:
- size = sizeof(gint16);
+ size = sizeof (gint16);
break;
case GI_TYPE_TAG_INT32:
case GI_TYPE_TAG_UINT32:
- size = sizeof(gint32);
+ size = sizeof (gint32);
break;
case GI_TYPE_TAG_INT64:
case GI_TYPE_TAG_UINT64:
- size = sizeof(gint64);
+ size = sizeof (gint64);
break;
case GI_TYPE_TAG_SHORT:
case GI_TYPE_TAG_USHORT:
- size = sizeof(gshort);
+ size = sizeof (gshort);
break;
case GI_TYPE_TAG_INT:
case GI_TYPE_TAG_UINT:
- size = sizeof(gint);
+ size = sizeof (gint);
break;
case GI_TYPE_TAG_LONG:
case GI_TYPE_TAG_ULONG:
- size = sizeof(glong);
+ size = sizeof (glong);
break;
case GI_TYPE_TAG_SIZE:
case GI_TYPE_TAG_SSIZE:
- size = sizeof(gsize);
+ size = sizeof (gsize);
break;
case GI_TYPE_TAG_FLOAT:
- size = sizeof(gfloat);
+ size = sizeof (gfloat);
break;
case GI_TYPE_TAG_DOUBLE:
- size = sizeof(gdouble);
+ size = sizeof (gdouble);
break;
case GI_TYPE_TAG_TIME_T:
- size = sizeof(time_t);
+ size = sizeof (time_t);
break;
case GI_TYPE_TAG_GTYPE:
- size = sizeof(GType);
+ size = sizeof (GType);
break;
case GI_TYPE_TAG_VOID:
case GI_TYPE_TAG_UTF8:
@@ -366,9 +366,9 @@ _pygi_g_type_tag_size (GITypeTag type_tag)
case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH:
case GI_TYPE_TAG_ERROR:
- PyErr_Format(PyExc_TypeError,
- "Unable to know the size (assuming %s is not a pointer)",
- g_type_tag_to_string(type_tag));
+ PyErr_Format (PyExc_TypeError,
+ "Unable to know the size (assuming %s is not a pointer)",
+ g_type_tag_to_string (type_tag));
break;
}
@@ -382,8 +382,8 @@ _pygi_g_type_info_size (GITypeInfo *type_info)
GITypeTag type_tag;
- type_tag = g_type_info_get_tag(type_info);
- switch(type_tag) {
+ type_tag = g_type_info_get_tag (type_info);
+ switch (type_tag) {
case GI_TYPE_TAG_BOOLEAN:
case GI_TYPE_TAG_INT8:
case GI_TYPE_TAG_UINT8:
@@ -405,11 +405,11 @@ _pygi_g_type_info_size (GITypeInfo *type_info)
case GI_TYPE_TAG_DOUBLE:
case GI_TYPE_TAG_TIME_T:
case GI_TYPE_TAG_GTYPE:
- if (g_type_info_is_pointer(type_info)) {
- size = sizeof(gpointer);
+ if (g_type_info_is_pointer (type_info)) {
+ size = sizeof (gpointer);
} else {
- size = _pygi_g_type_tag_size(type_tag);
- g_assert(size > 0);
+ size = _pygi_g_type_tag_size (type_tag);
+ g_assert (size > 0);
}
break;
case GI_TYPE_TAG_INTERFACE:
@@ -417,40 +417,40 @@ _pygi_g_type_info_size (GITypeInfo *type_info)
GIBaseInfo *info;
GIInfoType info_type;
- info = g_type_info_get_interface(type_info);
- info_type = g_base_info_get_type(info);
+ info = g_type_info_get_interface (type_info);
+ info_type = g_base_info_get_type (info);
switch (info_type) {
case GI_INFO_TYPE_STRUCT:
- if (g_type_info_is_pointer(type_info)) {
- size = sizeof(gpointer);
+ if (g_type_info_is_pointer (type_info)) {
+ size = sizeof (gpointer);
} else {
- size = g_struct_info_get_size((GIStructInfo *)info);
+ size = g_struct_info_get_size ( (GIStructInfo *) info);
}
break;
case GI_INFO_TYPE_UNION:
- if (g_type_info_is_pointer(type_info)) {
- size = sizeof(gpointer);
+ if (g_type_info_is_pointer (type_info)) {
+ size = sizeof (gpointer);
} else {
- size = g_union_info_get_size((GIUnionInfo *)info);
+ size = g_union_info_get_size ( (GIUnionInfo *) info);
}
break;
case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS:
- if (g_type_info_is_pointer(type_info)) {
- size = sizeof(gpointer);
+ if (g_type_info_is_pointer (type_info)) {
+ size = sizeof (gpointer);
} else {
GITypeTag type_tag;
- type_tag = g_enum_info_get_storage_type((GIEnumInfo *)info);
- size = _pygi_g_type_tag_size(type_tag);
+ type_tag = g_enum_info_get_storage_type ( (GIEnumInfo *) info);
+ size = _pygi_g_type_tag_size (type_tag);
}
break;
case GI_INFO_TYPE_BOXED:
case GI_INFO_TYPE_OBJECT:
case GI_INFO_TYPE_INTERFACE:
case GI_INFO_TYPE_CALLBACK:
- size = sizeof(gpointer);
+ size = sizeof (gpointer);
break;
case GI_INFO_TYPE_VFUNC:
case GI_INFO_TYPE_INVALID:
@@ -468,7 +468,7 @@ _pygi_g_type_info_size (GITypeInfo *type_info)
break;
}
- g_base_info_unref(info);
+ g_base_info_unref (info);
break;
}
case GI_TYPE_TAG_ARRAY:
@@ -479,7 +479,7 @@ _pygi_g_type_info_size (GITypeInfo *type_info)
case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH:
case GI_TYPE_TAG_ERROR:
- size = sizeof(gpointer);
+ size = sizeof (gpointer);
break;
}
@@ -487,34 +487,34 @@ _pygi_g_type_info_size (GITypeInfo *type_info)
}
static PyMethodDef _PyGIFunctionInfo_methods[] = {
- { "is_constructor", (PyCFunction)_wrap_g_function_info_is_constructor, METH_NOARGS },
- { "is_method", (PyCFunction)_wrap_g_function_info_is_method, METH_NOARGS },
- { "invoke", (PyCFunction)_wrap_g_function_info_invoke, METH_VARARGS },
+ { "is_constructor", (PyCFunction) _wrap_g_function_info_is_constructor, METH_NOARGS },
+ { "is_method", (PyCFunction) _wrap_g_function_info_is_method, METH_NOARGS },
+ { "invoke", (PyCFunction) _wrap_g_function_info_invoke, METH_VARARGS },
{ NULL, NULL, 0 }
};
/* RegisteredTypeInfo */
-_PyGI_DEFINE_INFO_TYPE("RegisteredTypeInfo", GIRegisteredTypeInfo, PyGIBaseInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("RegisteredTypeInfo", GIRegisteredTypeInfo, PyGIBaseInfo_Type);
static PyObject *
_wrap_g_registered_type_info_get_g_type (PyGIBaseInfo *self)
{
GType type;
- type = g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)self->info);
+ type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) self->info);
- return pyg_type_wrapper_new(type);
+ return pyg_type_wrapper_new (type);
}
static PyMethodDef _PyGIRegisteredTypeInfo_methods[] = {
- { "get_g_type", (PyCFunction)_wrap_g_registered_type_info_get_g_type, METH_NOARGS },
+ { "get_g_type", (PyCFunction) _wrap_g_registered_type_info_get_g_type, METH_NOARGS },
{ NULL, NULL, 0 }
};
/* GIStructInfo */
-_PyGI_DEFINE_INFO_TYPE("StructInfo", GIStructInfo, PyGIRegisteredTypeInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("StructInfo", GIStructInfo, PyGIRegisteredTypeInfo_Type);
static PyObject *
_get_fields (PyGIBaseInfo *self, GIInfoType info_type)
@@ -525,16 +525,16 @@ _get_fields (PyGIBaseInfo *self, GIInfoType info_type)
switch (info_type) {
case GI_INFO_TYPE_STRUCT:
- n_infos = g_struct_info_get_n_fields((GIStructInfo *)self->info);
+ n_infos = g_struct_info_get_n_fields ( (GIStructInfo *) self->info);
break;
case GI_INFO_TYPE_OBJECT:
- n_infos = g_object_info_get_n_fields((GIObjectInfo *)self->info);
+ n_infos = g_object_info_get_n_fields ( (GIObjectInfo *) self->info);
break;
default:
g_assert_not_reached();
}
- infos = PyTuple_New(n_infos);
+ infos = PyTuple_New (n_infos);
if (infos == NULL) {
return NULL;
}
@@ -545,26 +545,26 @@ _get_fields (PyGIBaseInfo *self, GIInfoType info_type)
switch (info_type) {
case GI_INFO_TYPE_STRUCT:
- info = (GIBaseInfo *)g_struct_info_get_field((GIStructInfo *)self->info, i);
+ info = (GIBaseInfo *) g_struct_info_get_field ( (GIStructInfo *) self->info, i);
break;
case GI_INFO_TYPE_OBJECT:
- info = (GIBaseInfo *)g_object_info_get_field((GIObjectInfo *)self->info, i);
+ info = (GIBaseInfo *) g_object_info_get_field ( (GIObjectInfo *) self->info, i);
break;
default:
g_assert_not_reached();
}
- g_assert(info != NULL);
+ g_assert (info != NULL);
- py_info = _pygi_info_new(info);
+ py_info = _pygi_info_new (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
if (py_info == NULL) {
- Py_CLEAR(infos);
+ Py_CLEAR (infos);
break;
}
- PyTuple_SET_ITEM(infos, i, py_info);
+ PyTuple_SET_ITEM (infos, i, py_info);
}
return infos;
@@ -579,16 +579,16 @@ _get_methods (PyGIBaseInfo *self, GIInfoType info_type)
switch (info_type) {
case GI_INFO_TYPE_STRUCT:
- n_infos = g_struct_info_get_n_methods((GIStructInfo *)self->info);
+ n_infos = g_struct_info_get_n_methods ( (GIStructInfo *) self->info);
break;
case GI_INFO_TYPE_OBJECT:
- n_infos = g_object_info_get_n_methods((GIObjectInfo *)self->info);
+ n_infos = g_object_info_get_n_methods ( (GIObjectInfo *) self->info);
break;
default:
g_assert_not_reached();
}
- infos = PyTuple_New(n_infos);
+ infos = PyTuple_New (n_infos);
if (infos == NULL) {
return NULL;
}
@@ -599,26 +599,26 @@ _get_methods (PyGIBaseInfo *self, GIInfoType info_type)
switch (info_type) {
case GI_INFO_TYPE_STRUCT:
- info = (GIBaseInfo *)g_struct_info_get_method((GIStructInfo *)self->info, i);
+ info = (GIBaseInfo *) g_struct_info_get_method ( (GIStructInfo *) self->info, i);
break;
case GI_INFO_TYPE_OBJECT:
- info = (GIBaseInfo *)g_object_info_get_method((GIObjectInfo *)self->info, i);
+ info = (GIBaseInfo *) g_object_info_get_method ( (GIObjectInfo *) self->info, i);
break;
default:
g_assert_not_reached();
}
- g_assert(info != NULL);
+ g_assert (info != NULL);
- py_info = _pygi_info_new(info);
+ py_info = _pygi_info_new (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
if (py_info == NULL) {
- Py_CLEAR(infos);
+ Py_CLEAR (infos);
break;
}
- PyTuple_SET_ITEM(infos, i, py_info);
+ PyTuple_SET_ITEM (infos, i, py_info);
}
return infos;
@@ -633,16 +633,16 @@ _get_constants (PyGIBaseInfo *self, GIInfoType info_type)
switch (info_type) {
case GI_INFO_TYPE_INTERFACE:
- n_infos = g_interface_info_get_n_constants((GIInterfaceInfo *)self->info);
+ n_infos = g_interface_info_get_n_constants ( (GIInterfaceInfo *) self->info);
break;
case GI_INFO_TYPE_OBJECT:
- n_infos = g_object_info_get_n_constants((GIObjectInfo *)self->info);
+ n_infos = g_object_info_get_n_constants ( (GIObjectInfo *) self->info);
break;
default:
g_assert_not_reached();
}
- infos = PyTuple_New(n_infos);
+ infos = PyTuple_New (n_infos);
if (infos == NULL) {
return NULL;
}
@@ -653,26 +653,26 @@ _get_constants (PyGIBaseInfo *self, GIInfoType info_type)
switch (info_type) {
case GI_INFO_TYPE_INTERFACE:
- info = (GIBaseInfo *)g_interface_info_get_constant((GIInterfaceInfo *)self->info, i);
+ info = (GIBaseInfo *) g_interface_info_get_constant ( (GIInterfaceInfo *) self->info, i);
break;
case GI_INFO_TYPE_OBJECT:
- info = (GIBaseInfo *)g_object_info_get_constant((GIObjectInfo *)self->info, i);
+ info = (GIBaseInfo *) g_object_info_get_constant ( (GIObjectInfo *) self->info, i);
break;
default:
g_assert_not_reached();
}
- g_assert(info != NULL);
+ g_assert (info != NULL);
- py_info = _pygi_info_new(info);
+ py_info = _pygi_info_new (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
if (py_info == NULL) {
- Py_CLEAR(infos);
+ Py_CLEAR (infos);
break;
}
- PyTuple_SET_ITEM(infos, i, py_info);
+ PyTuple_SET_ITEM (infos, i, py_info);
}
return infos;
@@ -687,16 +687,16 @@ _get_vfuncs (PyGIBaseInfo *self, GIInfoType info_type)
switch (info_type) {
case GI_INFO_TYPE_INTERFACE:
- n_infos = g_interface_info_get_n_vfuncs((GIInterfaceInfo *)self->info);
+ n_infos = g_interface_info_get_n_vfuncs ( (GIInterfaceInfo *) self->info);
break;
case GI_INFO_TYPE_OBJECT:
- n_infos = g_object_info_get_n_vfuncs((GIObjectInfo *)self->info);
+ n_infos = g_object_info_get_n_vfuncs ( (GIObjectInfo *) self->info);
break;
default:
g_assert_not_reached();
}
- infos = PyTuple_New(n_infos);
+ infos = PyTuple_New (n_infos);
if (infos == NULL) {
return NULL;
}
@@ -707,26 +707,26 @@ _get_vfuncs (PyGIBaseInfo *self, GIInfoType info_type)
switch (info_type) {
case GI_INFO_TYPE_INTERFACE:
- info = (GIBaseInfo *)g_interface_info_get_vfunc((GIInterfaceInfo *)self->info, i);
+ info = (GIBaseInfo *) g_interface_info_get_vfunc ( (GIInterfaceInfo *) self->info, i);
break;
case GI_INFO_TYPE_OBJECT:
- info = (GIBaseInfo *)g_object_info_get_vfunc((GIObjectInfo *)self->info, i);
+ info = (GIBaseInfo *) g_object_info_get_vfunc ( (GIObjectInfo *) self->info, i);
break;
default:
g_assert_not_reached();
}
- g_assert(info != NULL);
+ g_assert (info != NULL);
- py_info = _pygi_info_new(info);
+ py_info = _pygi_info_new (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
if (py_info == NULL) {
- Py_CLEAR(infos);
+ Py_CLEAR (infos);
break;
}
- PyTuple_SET_ITEM(infos, i, py_info);
+ PyTuple_SET_ITEM (infos, i, py_info);
}
return infos;
@@ -735,18 +735,18 @@ _get_vfuncs (PyGIBaseInfo *self, GIInfoType info_type)
static PyObject *
_wrap_g_struct_info_get_fields (PyGIBaseInfo *self)
{
- return _get_fields(self, GI_INFO_TYPE_STRUCT);
+ return _get_fields (self, GI_INFO_TYPE_STRUCT);
}
static PyObject *
_wrap_g_struct_info_get_methods (PyGIBaseInfo *self)
{
- return _get_methods(self, GI_INFO_TYPE_STRUCT);
+ return _get_methods (self, GI_INFO_TYPE_STRUCT);
}
static PyMethodDef _PyGIStructInfo_methods[] = {
- { "get_fields", (PyCFunction)_wrap_g_struct_info_get_fields, METH_NOARGS },
- { "get_methods", (PyCFunction)_wrap_g_struct_info_get_methods, METH_NOARGS },
+ { "get_fields", (PyCFunction) _wrap_g_struct_info_get_fields, METH_NOARGS },
+ { "get_methods", (PyCFunction) _wrap_g_struct_info_get_methods, METH_NOARGS },
{ NULL, NULL, 0 }
};
@@ -759,18 +759,18 @@ pygi_g_struct_info_is_simple (GIStructInfo *struct_info)
is_simple = TRUE;
- n_field_infos = g_struct_info_get_n_fields(struct_info);
+ n_field_infos = g_struct_info_get_n_fields (struct_info);
for (i = 0; i < n_field_infos && is_simple; i++) {
GIFieldInfo *field_info;
GITypeInfo *field_type_info;
- field_info = g_struct_info_get_field(struct_info, i);
- field_type_info = g_field_info_get_type(field_info);
+ field_info = g_struct_info_get_field (struct_info, i);
+ field_type_info = g_field_info_get_type (field_info);
GITypeTag field_type_tag;
- field_type_tag = g_type_info_get_tag(field_type_info);
+ field_type_tag = g_type_info_get_tag (field_type_info);
switch (field_type_tag) {
case GI_TYPE_TAG_BOOLEAN:
@@ -793,7 +793,7 @@ pygi_g_struct_info_is_simple (GIStructInfo *struct_info)
case GI_TYPE_TAG_FLOAT:
case GI_TYPE_TAG_DOUBLE:
case GI_TYPE_TAG_TIME_T:
- if (g_type_info_is_pointer(field_type_info)) {
+ if (g_type_info_is_pointer (field_type_info)) {
is_simple = FALSE;
}
break;
@@ -813,15 +813,15 @@ pygi_g_struct_info_is_simple (GIStructInfo *struct_info)
GIBaseInfo *info;
GIInfoType info_type;
- info = g_type_info_get_interface(field_type_info);
- info_type = g_base_info_get_type(info);
+ info = g_type_info_get_interface (field_type_info);
+ info_type = g_base_info_get_type (info);
switch (info_type) {
case GI_INFO_TYPE_STRUCT:
- if (g_type_info_is_pointer(field_type_info)) {
+ if (g_type_info_is_pointer (field_type_info)) {
is_simple = FALSE;
} else {
- is_simple = pygi_g_struct_info_is_simple((GIStructInfo *)info);
+ is_simple = pygi_g_struct_info_is_simple ( (GIStructInfo *) info);
}
break;
case GI_INFO_TYPE_UNION:
@@ -830,7 +830,7 @@ pygi_g_struct_info_is_simple (GIStructInfo *struct_info)
break;
case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS:
- if (g_type_info_is_pointer(field_type_info)) {
+ if (g_type_info_is_pointer (field_type_info)) {
is_simple = FALSE;
}
break;
@@ -855,13 +855,13 @@ pygi_g_struct_info_is_simple (GIStructInfo *struct_info)
g_assert_not_reached();
}
- g_base_info_unref(info);
+ g_base_info_unref (info);
break;
}
}
- g_base_info_unref((GIBaseInfo *)field_type_info);
- g_base_info_unref((GIBaseInfo *)field_info);
+ g_base_info_unref ( (GIBaseInfo *) field_type_info);
+ g_base_info_unref ( (GIBaseInfo *) field_info);
}
return is_simple;
@@ -869,7 +869,7 @@ pygi_g_struct_info_is_simple (GIStructInfo *struct_info)
/* EnumInfo */
-_PyGI_DEFINE_INFO_TYPE("EnumInfo", GIEnumInfo, PyGIRegisteredTypeInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("EnumInfo", GIEnumInfo, PyGIRegisteredTypeInfo_Type);
static PyObject *
_wrap_g_enum_info_get_values (PyGIBaseInfo *self)
@@ -878,9 +878,9 @@ _wrap_g_enum_info_get_values (PyGIBaseInfo *self)
PyObject *infos;
gssize i;
- n_infos = g_enum_info_get_n_values((GIEnumInfo *)self->info);
+ n_infos = g_enum_info_get_n_values ( (GIEnumInfo *) self->info);
- infos = PyTuple_New(n_infos);
+ infos = PyTuple_New (n_infos);
if (infos == NULL) {
return NULL;
}
@@ -889,32 +889,32 @@ _wrap_g_enum_info_get_values (PyGIBaseInfo *self)
GIBaseInfo *info;
PyObject *py_info;
- info = (GIBaseInfo *)g_enum_info_get_value((GIEnumInfo *)self->info, i);
- g_assert(info != NULL);
+ info = (GIBaseInfo *) g_enum_info_get_value ( (GIEnumInfo *) self->info, i);
+ g_assert (info != NULL);
- py_info = _pygi_info_new(info);
+ py_info = _pygi_info_new (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
if (py_info == NULL) {
- Py_CLEAR(infos);
+ Py_CLEAR (infos);
break;
}
- PyTuple_SET_ITEM(infos, i, py_info);
+ PyTuple_SET_ITEM (infos, i, py_info);
}
return infos;
}
static PyMethodDef _PyGIEnumInfo_methods[] = {
- { "get_values", (PyCFunction)_wrap_g_enum_info_get_values, METH_NOARGS },
+ { "get_values", (PyCFunction) _wrap_g_enum_info_get_values, METH_NOARGS },
{ NULL, NULL, 0 }
};
/* ObjectInfo */
-_PyGI_DEFINE_INFO_TYPE("ObjectInfo", GIObjectInfo, PyGIRegisteredTypeInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("ObjectInfo", GIObjectInfo, PyGIRegisteredTypeInfo_Type);
static PyObject *
_wrap_g_object_info_get_parent (PyGIBaseInfo *self)
@@ -922,15 +922,15 @@ _wrap_g_object_info_get_parent (PyGIBaseInfo *self)
GIBaseInfo *info;
PyObject *py_info;
- info = (GIBaseInfo *)g_object_info_get_parent((GIObjectInfo*)self->info);
+ info = (GIBaseInfo *) g_object_info_get_parent ( (GIObjectInfo*) self->info);
if (info == NULL) {
Py_RETURN_NONE;
}
- py_info = _pygi_info_new(info);
+ py_info = _pygi_info_new (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
return py_info;
}
@@ -938,13 +938,13 @@ _wrap_g_object_info_get_parent (PyGIBaseInfo *self)
static PyObject *
_wrap_g_object_info_get_methods (PyGIBaseInfo *self)
{
- return _get_methods(self, GI_INFO_TYPE_OBJECT);
+ return _get_methods (self, GI_INFO_TYPE_OBJECT);
}
static PyObject *
_wrap_g_object_info_get_fields (PyGIBaseInfo *self)
{
- return _get_fields(self, GI_INFO_TYPE_OBJECT);
+ return _get_fields (self, GI_INFO_TYPE_OBJECT);
}
static PyObject *
@@ -954,9 +954,9 @@ _wrap_g_object_info_get_interfaces (PyGIBaseInfo *self)
PyObject *infos;
gssize i;
- n_infos = g_object_info_get_n_interfaces((GIObjectInfo *)self->info);
+ n_infos = g_object_info_get_n_interfaces ( (GIObjectInfo *) self->info);
- infos = PyTuple_New(n_infos);
+ infos = PyTuple_New (n_infos);
if (infos == NULL) {
return NULL;
}
@@ -965,19 +965,19 @@ _wrap_g_object_info_get_interfaces (PyGIBaseInfo *self)
GIBaseInfo *info;
PyObject *py_info;
- info = (GIBaseInfo *)g_object_info_get_interface((GIObjectInfo *)self->info, i);
- g_assert(info != NULL);
+ info = (GIBaseInfo *) g_object_info_get_interface ( (GIObjectInfo *) self->info, i);
+ g_assert (info != NULL);
- py_info = _pygi_info_new(info);
+ py_info = _pygi_info_new (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
if (py_info == NULL) {
- Py_CLEAR(infos);
+ Py_CLEAR (infos);
break;
}
- PyTuple_SET_ITEM(infos, i, py_info);
+ PyTuple_SET_ITEM (infos, i, py_info);
}
return infos;
@@ -986,28 +986,28 @@ _wrap_g_object_info_get_interfaces (PyGIBaseInfo *self)
static PyObject *
_wrap_g_object_info_get_constants (PyGIBaseInfo *self)
{
- return _get_constants(self, GI_INFO_TYPE_OBJECT);
+ return _get_constants (self, GI_INFO_TYPE_OBJECT);
}
static PyObject *
_wrap_g_object_info_get_vfuncs (PyGIBaseInfo *self)
{
- return _get_vfuncs(self, GI_INFO_TYPE_OBJECT);
+ return _get_vfuncs (self, GI_INFO_TYPE_OBJECT);
}
static PyMethodDef _PyGIObjectInfo_methods[] = {
- { "get_parent", (PyCFunction)_wrap_g_object_info_get_parent, METH_NOARGS },
- { "get_methods", (PyCFunction)_wrap_g_object_info_get_methods, METH_NOARGS },
- { "get_fields", (PyCFunction)_wrap_g_object_info_get_fields, METH_NOARGS },
- { "get_interfaces", (PyCFunction)_wrap_g_object_info_get_interfaces, METH_NOARGS },
- { "get_constants", (PyCFunction)_wrap_g_object_info_get_constants, METH_NOARGS },
- { "get_vfuncs", (PyCFunction)_wrap_g_object_info_get_vfuncs, METH_NOARGS },
+ { "get_parent", (PyCFunction) _wrap_g_object_info_get_parent, METH_NOARGS },
+ { "get_methods", (PyCFunction) _wrap_g_object_info_get_methods, METH_NOARGS },
+ { "get_fields", (PyCFunction) _wrap_g_object_info_get_fields, METH_NOARGS },
+ { "get_interfaces", (PyCFunction) _wrap_g_object_info_get_interfaces, METH_NOARGS },
+ { "get_constants", (PyCFunction) _wrap_g_object_info_get_constants, METH_NOARGS },
+ { "get_vfuncs", (PyCFunction) _wrap_g_object_info_get_vfuncs, METH_NOARGS },
{ NULL, NULL, 0 }
};
/* GIInterfaceInfo */
-_PyGI_DEFINE_INFO_TYPE("InterfaceInfo", GIInterfaceInfo, PyGIRegisteredTypeInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("InterfaceInfo", GIInterfaceInfo, PyGIRegisteredTypeInfo_Type);
static PyObject *
_wrap_g_interface_info_get_methods (PyGIBaseInfo *self)
@@ -1016,9 +1016,9 @@ _wrap_g_interface_info_get_methods (PyGIBaseInfo *self)
PyObject *infos;
gssize i;
- n_infos = g_interface_info_get_n_methods((GIInterfaceInfo *)self->info);
+ n_infos = g_interface_info_get_n_methods ( (GIInterfaceInfo *) self->info);
- infos = PyTuple_New(n_infos);
+ infos = PyTuple_New (n_infos);
if (infos == NULL) {
return NULL;
}
@@ -1027,19 +1027,19 @@ _wrap_g_interface_info_get_methods (PyGIBaseInfo *self)
GIBaseInfo *info;
PyObject *py_info;
- info = (GIBaseInfo *)g_interface_info_get_method((GIInterfaceInfo *)self->info, i);
- g_assert(info != NULL);
+ info = (GIBaseInfo *) g_interface_info_get_method ( (GIInterfaceInfo *) self->info, i);
+ g_assert (info != NULL);
- py_info = _pygi_info_new(info);
+ py_info = _pygi_info_new (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
if (py_info == NULL) {
- Py_CLEAR(infos);
+ Py_CLEAR (infos);
break;
}
- PyTuple_SET_ITEM(infos, i, py_info);
+ PyTuple_SET_ITEM (infos, i, py_info);
}
return infos;
@@ -1048,24 +1048,24 @@ _wrap_g_interface_info_get_methods (PyGIBaseInfo *self)
static PyObject *
_wrap_g_interface_info_get_constants (PyGIBaseInfo *self)
{
- return _get_constants(self, GI_INFO_TYPE_INTERFACE);
+ return _get_constants (self, GI_INFO_TYPE_INTERFACE);
}
static PyObject *
_wrap_g_interface_info_get_vfuncs (PyGIBaseInfo *self)
{
- return _get_vfuncs(self, GI_INFO_TYPE_INTERFACE);
+ return _get_vfuncs (self, GI_INFO_TYPE_INTERFACE);
}
static PyMethodDef _PyGIInterfaceInfo_methods[] = {
- { "get_methods", (PyCFunction)_wrap_g_interface_info_get_methods, METH_NOARGS },
- { "get_constants", (PyCFunction)_wrap_g_interface_info_get_constants, METH_NOARGS },
- { "get_vfuncs", (PyCFunction)_wrap_g_interface_info_get_vfuncs, METH_NOARGS },
+ { "get_methods", (PyCFunction) _wrap_g_interface_info_get_methods, METH_NOARGS },
+ { "get_constants", (PyCFunction) _wrap_g_interface_info_get_constants, METH_NOARGS },
+ { "get_vfuncs", (PyCFunction) _wrap_g_interface_info_get_vfuncs, METH_NOARGS },
{ NULL, NULL, 0 }
};
/* GIConstantInfo */
-_PyGI_DEFINE_INFO_TYPE("ConstantInfo", GIConstantInfo, PyGIBaseInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("ConstantInfo", GIConstantInfo, PyGIBaseInfo_Type);
static PyObject *
_wrap_g_constant_info_get_value (PyGIBaseInfo *self)
@@ -1074,47 +1074,47 @@ _wrap_g_constant_info_get_value (PyGIBaseInfo *self)
GArgument value;
PyObject *py_value;
- if (g_constant_info_get_value((GIConstantInfo *)self->info, &value) < 0) {
- PyErr_SetString(PyExc_RuntimeError, "unable to get value");
+ if (g_constant_info_get_value ( (GIConstantInfo *) self->info, &value) < 0) {
+ PyErr_SetString (PyExc_RuntimeError, "unable to get value");
return NULL;
}
- type_info = g_constant_info_get_type((GIConstantInfo *)self->info);
+ type_info = g_constant_info_get_type ( (GIConstantInfo *) self->info);
- py_value = _pygi_argument_to_object(&value, type_info, GI_TRANSFER_NOTHING);
+ py_value = _pygi_argument_to_object (&value, type_info, GI_TRANSFER_NOTHING);
- g_base_info_unref((GIBaseInfo *)type_info);
+ g_base_info_unref ( (GIBaseInfo *) type_info);
return py_value;
}
static PyMethodDef _PyGIConstantInfo_methods[] = {
- { "get_value", (PyCFunction)_wrap_g_constant_info_get_value, METH_NOARGS },
+ { "get_value", (PyCFunction) _wrap_g_constant_info_get_value, METH_NOARGS },
{ NULL, NULL, 0 }
};
/* GIValueInfo */
-_PyGI_DEFINE_INFO_TYPE("ValueInfo", GIValueInfo, PyGIBaseInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("ValueInfo", GIValueInfo, PyGIBaseInfo_Type);
static PyObject *
_wrap_g_value_info_get_value (PyGIBaseInfo *self)
{
glong value;
- value = g_value_info_get_value((GIValueInfo *)self->info);
+ value = g_value_info_get_value ( (GIValueInfo *) self->info);
- return PyInt_FromLong(value);
+ return PyInt_FromLong (value);
}
static PyMethodDef _PyGIValueInfo_methods[] = {
- { "get_value", (PyCFunction)_wrap_g_value_info_get_value, METH_NOARGS },
+ { "get_value", (PyCFunction) _wrap_g_value_info_get_value, METH_NOARGS },
{ NULL, NULL, 0 }
};
/* GIFieldInfo */
-_PyGI_DEFINE_INFO_TYPE("FieldInfo", GIFieldInfo, PyGIBaseInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("FieldInfo", GIFieldInfo, PyGIBaseInfo_Type);
static PyObject *
_wrap_g_field_info_get_value (PyGIBaseInfo *self,
@@ -1128,28 +1128,28 @@ _wrap_g_field_info_get_value (PyGIBaseInfo *self,
GArgument value;
PyObject *py_value = NULL;
- if (!PyArg_ParseTuple(args, "O:FieldInfo.get_value", &instance)) {
+ if (!PyArg_ParseTuple (args, "O:FieldInfo.get_value", &instance)) {
return NULL;
}
- container_info = g_base_info_get_container(self->info);
- g_assert(container_info != NULL);
+ container_info = g_base_info_get_container (self->info);
+ g_assert (container_info != NULL);
/* Check the instance. */
- if (!_pygi_g_registered_type_info_check_object((GIRegisteredTypeInfo *)container_info, TRUE, instance)) {
- _PyGI_ERROR_PREFIX("argument 1: ");
+ if (!_pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) container_info, TRUE, instance)) {
+ _PyGI_ERROR_PREFIX ("argument 1: ");
return NULL;
}
/* Get the pointer to the container. */
- container_info_type = g_base_info_get_type(container_info);
+ container_info_type = g_base_info_get_type (container_info);
switch (container_info_type) {
case GI_INFO_TYPE_UNION:
case GI_INFO_TYPE_STRUCT:
- pointer = pyg_boxed_get(instance, void);
+ pointer = pyg_boxed_get (instance, void);
break;
case GI_INFO_TYPE_OBJECT:
- pointer = pygobject_get(instance);
+ pointer = pygobject_get (instance);
break;
default:
/* Other types don't have fields. */
@@ -1157,34 +1157,34 @@ _wrap_g_field_info_get_value (PyGIBaseInfo *self,
}
/* Get the field's value. */
- field_type_info = g_field_info_get_type((GIFieldInfo *)self->info);
+ field_type_info = g_field_info_get_type ( (GIFieldInfo *) self->info);
/* A few types are not handled by g_field_info_get_field, so do it here. */
- if (!g_type_info_is_pointer(field_type_info)
- && g_type_info_get_tag(field_type_info) == GI_TYPE_TAG_INTERFACE) {
+ if (!g_type_info_is_pointer (field_type_info)
+ && g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_INTERFACE) {
GIBaseInfo *info;
GIInfoType info_type;
- if (!(g_field_info_get_flags((GIFieldInfo *)self->info) & GI_FIELD_IS_READABLE)) {
- PyErr_SetString(PyExc_RuntimeError, "field is not readable");
+ if (! (g_field_info_get_flags ( (GIFieldInfo *) self->info) & GI_FIELD_IS_READABLE)) {
+ PyErr_SetString (PyExc_RuntimeError, "field is not readable");
goto out;
}
- info = g_type_info_get_interface(field_type_info);
+ info = g_type_info_get_interface (field_type_info);
- info_type = g_base_info_get_type(info);
+ info_type = g_base_info_get_type (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
- switch(info_type) {
+ switch (info_type) {
case GI_INFO_TYPE_UNION:
- PyErr_SetString(PyExc_NotImplementedError, "getting an union is not supported yet");
+ PyErr_SetString (PyExc_NotImplementedError, "getting an union is not supported yet");
goto out;
case GI_INFO_TYPE_STRUCT:
{
gsize offset;
- offset = g_field_info_get_offset((GIFieldInfo *)self->info);
+ offset = g_field_info_get_offset ( (GIFieldInfo *) self->info);
value.v_pointer = pointer + offset;
@@ -1196,16 +1196,16 @@ _wrap_g_field_info_get_value (PyGIBaseInfo *self,
}
}
- if (!g_field_info_get_field((GIFieldInfo *)self->info, pointer, &value)) {
- PyErr_SetString(PyExc_RuntimeError, "unable to get the value");
+ if (!g_field_info_get_field ( (GIFieldInfo *) self->info, pointer, &value)) {
+ PyErr_SetString (PyExc_RuntimeError, "unable to get the value");
goto out;
}
argument_to_object:
- py_value = _pygi_argument_to_object(&value, field_type_info, GI_TRANSFER_NOTHING);
+ py_value = _pygi_argument_to_object (&value, field_type_info, GI_TRANSFER_NOTHING);
out:
- g_base_info_unref((GIBaseInfo *)field_type_info);
+ g_base_info_unref ( (GIBaseInfo *) field_type_info);
return py_value;
}
@@ -1223,70 +1223,70 @@ _wrap_g_field_info_set_value (PyGIBaseInfo *self,
GArgument value;
PyObject *retval = NULL;
- if (!PyArg_ParseTuple(args, "OO:FieldInfo.set_value", &instance, &py_value)) {
+ if (!PyArg_ParseTuple (args, "OO:FieldInfo.set_value", &instance, &py_value)) {
return NULL;
}
- container_info = g_base_info_get_container(self->info);
- g_assert(container_info != NULL);
+ container_info = g_base_info_get_container (self->info);
+ g_assert (container_info != NULL);
/* Check the instance. */
- if (!_pygi_g_registered_type_info_check_object((GIRegisteredTypeInfo *)container_info, TRUE, instance)) {
- _PyGI_ERROR_PREFIX("argument 1: ");
+ if (!_pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) container_info, TRUE, instance)) {
+ _PyGI_ERROR_PREFIX ("argument 1: ");
return NULL;
}
/* Get the pointer to the container. */
- container_info_type = g_base_info_get_type(container_info);
+ container_info_type = g_base_info_get_type (container_info);
switch (container_info_type) {
case GI_INFO_TYPE_UNION:
case GI_INFO_TYPE_STRUCT:
- pointer = pyg_boxed_get(instance, void);
+ pointer = pyg_boxed_get (instance, void);
break;
case GI_INFO_TYPE_OBJECT:
- pointer = pygobject_get(instance);
+ pointer = pygobject_get (instance);
break;
default:
/* Other types don't have fields. */
g_assert_not_reached();
}
- field_type_info = g_field_info_get_type((GIFieldInfo *)self->info);
+ field_type_info = g_field_info_get_type ( (GIFieldInfo *) self->info);
/* Check the value. */
{
gboolean retval;
- retval = _pygi_g_type_info_check_object(field_type_info, py_value, TRUE);
+ retval = _pygi_g_type_info_check_object (field_type_info, py_value, TRUE);
if (retval < 0) {
goto out;
}
if (!retval) {
- _PyGI_ERROR_PREFIX("argument 2: ");
+ _PyGI_ERROR_PREFIX ("argument 2: ");
goto out;
}
}
/* Set the field's value. */
/* A few types are not handled by g_field_info_set_field, so do it here. */
- if (!g_type_info_is_pointer(field_type_info)
- && g_type_info_get_tag(field_type_info) == GI_TYPE_TAG_INTERFACE) {
+ if (!g_type_info_is_pointer (field_type_info)
+ && g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_INTERFACE) {
GIBaseInfo *info;
GIInfoType info_type;
- if (!(g_field_info_get_flags((GIFieldInfo *)self->info) & GI_FIELD_IS_WRITABLE)) {
- PyErr_SetString(PyExc_RuntimeError, "field is not writable");
+ if (! (g_field_info_get_flags ( (GIFieldInfo *) self->info) & GI_FIELD_IS_WRITABLE)) {
+ PyErr_SetString (PyExc_RuntimeError, "field is not writable");
goto out;
}
- info = g_type_info_get_interface(field_type_info);
+ info = g_type_info_get_interface (field_type_info);
- info_type = g_base_info_get_type(info);
+ info_type = g_base_info_get_type (info);
switch (info_type) {
case GI_INFO_TYPE_UNION:
- PyErr_SetString(PyExc_NotImplementedError, "setting an union is not supported yet");
+ PyErr_SetString (PyExc_NotImplementedError, "setting an union is not supported yet");
goto out;
case GI_INFO_TYPE_STRUCT:
{
@@ -1294,28 +1294,28 @@ _wrap_g_field_info_set_value (PyGIBaseInfo *self,
gsize offset;
gssize size;
- is_simple = pygi_g_struct_info_is_simple((GIStructInfo *)info);
+ is_simple = pygi_g_struct_info_is_simple ( (GIStructInfo *) info);
if (!is_simple) {
- PyErr_SetString(PyExc_TypeError,
- "cannot set a structure which has no well-defined ownership transfer rules");
- g_base_info_unref(info);
+ PyErr_SetString (PyExc_TypeError,
+ "cannot set a structure which has no well-defined ownership transfer rules");
+ g_base_info_unref (info);
goto out;
}
- value = _pygi_argument_from_object(py_value, field_type_info, GI_TRANSFER_NOTHING);
+ value = _pygi_argument_from_object (py_value, field_type_info, GI_TRANSFER_NOTHING);
if (PyErr_Occurred()) {
- g_base_info_unref(info);
+ g_base_info_unref (info);
goto out;
}
- offset = g_field_info_get_offset((GIFieldInfo *)self->info);
- size = g_struct_info_get_size((GIStructInfo *)info);
- g_assert(size > 0);
+ offset = g_field_info_get_offset ( (GIFieldInfo *) self->info);
+ size = g_struct_info_get_size ( (GIStructInfo *) info);
+ g_assert (size > 0);
- g_memmove(pointer + offset, value.v_pointer, size);
+ g_memmove (pointer + offset, value.v_pointer, size);
- g_base_info_unref(info);
+ g_base_info_unref (info);
retval = Py_None;
goto out;
@@ -1325,45 +1325,45 @@ _wrap_g_field_info_set_value (PyGIBaseInfo *self,
break;
}
- g_base_info_unref(info);
+ g_base_info_unref (info);
}
- value = _pygi_argument_from_object(py_value, field_type_info, GI_TRANSFER_EVERYTHING);
+ value = _pygi_argument_from_object (py_value, field_type_info, GI_TRANSFER_EVERYTHING);
if (PyErr_Occurred()) {
goto out;
}
- if (!g_field_info_set_field((GIFieldInfo *)self->info, pointer, &value)) {
- _pygi_argument_release(&value, field_type_info, GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
- PyErr_SetString(PyExc_RuntimeError, "unable to set value for field");
+ if (!g_field_info_set_field ( (GIFieldInfo *) self->info, pointer, &value)) {
+ _pygi_argument_release (&value, field_type_info, GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
+ PyErr_SetString (PyExc_RuntimeError, "unable to set value for field");
goto out;
}
retval = Py_None;
out:
- g_base_info_unref((GIBaseInfo *)field_type_info);
+ g_base_info_unref ( (GIBaseInfo *) field_type_info);
- Py_XINCREF(retval);
+ Py_XINCREF (retval);
return retval;
}
static PyMethodDef _PyGIFieldInfo_methods[] = {
- { "get_value", (PyCFunction)_wrap_g_field_info_get_value, METH_VARARGS },
- { "set_value", (PyCFunction)_wrap_g_field_info_set_value, METH_VARARGS },
+ { "get_value", (PyCFunction) _wrap_g_field_info_get_value, METH_VARARGS },
+ { "set_value", (PyCFunction) _wrap_g_field_info_set_value, METH_VARARGS },
{ NULL, NULL, 0 }
};
/* GIUnresolvedInfo */
-_PyGI_DEFINE_INFO_TYPE("UnresolvedInfo", GIUnresolvedInfo, PyGIBaseInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("UnresolvedInfo", GIUnresolvedInfo, PyGIBaseInfo_Type);
static PyMethodDef _PyGIUnresolvedInfo_methods[] = {
{ NULL, NULL, 0 }
};
/* GIVFuncInfo */
-_PyGI_DEFINE_INFO_TYPE("VFuncInfo", GIVFuncInfo, PyGIBaseInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("VFuncInfo", GIVFuncInfo, PyGIBaseInfo_Type);
static PyMethodDef _PyGIVFuncInfo_methods[] = {
{ NULL, NULL, 0 }
@@ -1371,7 +1371,7 @@ static PyMethodDef _PyGIVFuncInfo_methods[] = {
/* GIUnionInfo */
-_PyGI_DEFINE_INFO_TYPE("UnionInfo", GIUnionInfo, PyGIRegisteredTypeInfo_Type);
+_PyGI_DEFINE_INFO_TYPE ("UnionInfo", GIUnionInfo, PyGIRegisteredTypeInfo_Type);
static PyObject *
_wrap_g_union_info_get_fields (PyGIBaseInfo *self)
@@ -1380,9 +1380,9 @@ _wrap_g_union_info_get_fields (PyGIBaseInfo *self)
PyObject *infos;
gssize i;
- n_infos = g_union_info_get_n_fields((GIUnionInfo *)self->info);
+ n_infos = g_union_info_get_n_fields ( (GIUnionInfo *) self->info);
- infos = PyTuple_New(n_infos);
+ infos = PyTuple_New (n_infos);
if (infos == NULL) {
return NULL;
}
@@ -1391,19 +1391,19 @@ _wrap_g_union_info_get_fields (PyGIBaseInfo *self)
GIBaseInfo *info;
PyObject *py_info;
- info = (GIBaseInfo *)g_union_info_get_field((GIUnionInfo *)self->info, i);
- g_assert(info != NULL);
+ info = (GIBaseInfo *) g_union_info_get_field ( (GIUnionInfo *) self->info, i);
+ g_assert (info != NULL);
- py_info = _pygi_info_new(info);
+ py_info = _pygi_info_new (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
if (py_info == NULL) {
- Py_CLEAR(infos);
+ Py_CLEAR (infos);
break;
}
- PyTuple_SET_ITEM(infos, i, py_info);
+ PyTuple_SET_ITEM (infos, i, py_info);
}
return infos;
@@ -1416,9 +1416,9 @@ _wrap_g_union_info_get_methods (PyGIBaseInfo *self)
PyObject *infos;
gssize i;
- n_infos = g_union_info_get_n_methods((GIUnionInfo *)self->info);
+ n_infos = g_union_info_get_n_methods ( (GIUnionInfo *) self->info);
- infos = PyTuple_New(n_infos);
+ infos = PyTuple_New (n_infos);
if (infos == NULL) {
return NULL;
}
@@ -1427,27 +1427,27 @@ _wrap_g_union_info_get_methods (PyGIBaseInfo *self)
GIBaseInfo *info;
PyObject *py_info;
- info = (GIBaseInfo *)g_union_info_get_method((GIUnionInfo *)self->info, i);
- g_assert(info != NULL);
+ info = (GIBaseInfo *) g_union_info_get_method ( (GIUnionInfo *) self->info, i);
+ g_assert (info != NULL);
- py_info = _pygi_info_new(info);
+ py_info = _pygi_info_new (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
if (py_info == NULL) {
- Py_CLEAR(infos);
+ Py_CLEAR (infos);
break;
}
- PyTuple_SET_ITEM(infos, i, py_info);
+ PyTuple_SET_ITEM (infos, i, py_info);
}
return infos;
}
static PyMethodDef _PyGIUnionInfo_methods[] = {
- { "get_fields", (PyCFunction)_wrap_g_union_info_get_fields, METH_NOARGS },
- { "get_methods", (PyCFunction)_wrap_g_union_info_get_methods, METH_NOARGS },
+ { "get_fields", (PyCFunction) _wrap_g_union_info_get_fields, METH_NOARGS },
+ { "get_methods", (PyCFunction) _wrap_g_union_info_get_methods, METH_NOARGS },
{ NULL, NULL, 0 }
};
@@ -1459,16 +1459,16 @@ _pygi_g_base_info_get_fullname (GIBaseInfo *info)
GIBaseInfo *container_info;
gchar *fullname;
- container_info = g_base_info_get_container(info);
+ container_info = g_base_info_get_container (info);
if (container_info != NULL) {
- fullname = g_strdup_printf("%s.%s.%s",
- g_base_info_get_namespace(container_info),
- g_base_info_get_name(container_info),
- g_base_info_get_name(info));
+ fullname = g_strdup_printf ("%s.%s.%s",
+ g_base_info_get_namespace (container_info),
+ g_base_info_get_name (container_info),
+ g_base_info_get_name (info));
} else {
- fullname = g_strdup_printf("%s.%s",
- g_base_info_get_namespace(info),
- g_base_info_get_name(info));
+ fullname = g_strdup_printf ("%s.%s",
+ g_base_info_get_namespace (info),
+ g_base_info_get_name (info));
}
if (fullname == NULL) {
@@ -1488,20 +1488,20 @@ _pygi_info_register_types (PyObject *m)
if (PyModule_AddObject(m, name, (PyObject *)&type)) \
return
- _PyGI_REGISTER_TYPE(m, PyGIBaseInfo_Type, "BaseInfo");
- _PyGI_REGISTER_TYPE(m, PyGIUnresolvedInfo_Type, "UnresolvedInfo");
- _PyGI_REGISTER_TYPE(m, PyGICallableInfo_Type, "CallableInfo");
- _PyGI_REGISTER_TYPE(m, PyGIFunctionInfo_Type, "FunctionInfo");
- _PyGI_REGISTER_TYPE(m, PyGIRegisteredTypeInfo_Type, "RegisteredTypeInfo");
- _PyGI_REGISTER_TYPE(m, PyGIStructInfo_Type, "StructInfo");
- _PyGI_REGISTER_TYPE(m, PyGIEnumInfo_Type, "EnumInfo");
- _PyGI_REGISTER_TYPE(m, PyGIObjectInfo_Type, "ObjectInfo");
- _PyGI_REGISTER_TYPE(m, PyGIInterfaceInfo_Type, "InterfaceInfo");
- _PyGI_REGISTER_TYPE(m, PyGIConstantInfo_Type, "ConstantInfo");
- _PyGI_REGISTER_TYPE(m, PyGIValueInfo_Type, "ValueInfo");
- _PyGI_REGISTER_TYPE(m, PyGIFieldInfo_Type, "FieldInfo");
- _PyGI_REGISTER_TYPE(m, PyGIVFuncInfo_Type, "VFuncInfo");
- _PyGI_REGISTER_TYPE(m, PyGIUnionInfo_Type, "UnionInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIBaseInfo_Type, "BaseInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIUnresolvedInfo_Type, "UnresolvedInfo");
+ _PyGI_REGISTER_TYPE (m, PyGICallableInfo_Type, "CallableInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIFunctionInfo_Type, "FunctionInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIRegisteredTypeInfo_Type, "RegisteredTypeInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIStructInfo_Type, "StructInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIEnumInfo_Type, "EnumInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIObjectInfo_Type, "ObjectInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIInterfaceInfo_Type, "InterfaceInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIConstantInfo_Type, "ConstantInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIValueInfo_Type, "ValueInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIFieldInfo_Type, "FieldInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIVFuncInfo_Type, "VFuncInfo");
+ _PyGI_REGISTER_TYPE (m, PyGIUnionInfo_Type, "UnionInfo");
#undef _PyGI_REGISTER_TYPE
}
diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c
index e5e3617..bf220e7 100644
--- a/gi/pygi-invoke.c
+++ b/gi/pygi-invoke.c
@@ -41,7 +41,7 @@ struct invocation_state
guint8 user_data_index;
guint8 destroy_notify_index;
PyGICClosure *closure;
-
+
glong error_arg_pos;
GIArgInfo **arg_infos;
@@ -68,27 +68,27 @@ _initialize_invocation_state (struct invocation_state *state,
{
GIFunctionInfoFlags flags;
- flags = g_function_info_get_flags(info);
+ flags = g_function_info_get_flags (info);
state->is_method = (flags & GI_FUNCTION_IS_METHOD) != 0;
state->is_constructor = (flags & GI_FUNCTION_IS_CONSTRUCTOR) != 0;
/* Count arguments. */
- state->n_args = g_callable_info_get_n_args((GICallableInfo *)info);
+ state->n_args = g_callable_info_get_n_args ( (GICallableInfo *) info);
state->n_in_args = 0;
state->n_out_args = 0;
state->n_backup_args = 0;
state->n_aux_in_args = 0;
state->n_aux_out_args = 0;
-
+
/* Check the argument count. */
- state->n_py_args = PyTuple_Size(py_args);
- g_assert(state->n_py_args >= 0);
+ state->n_py_args = PyTuple_Size (py_args);
+ g_assert (state->n_py_args >= 0);
state->error_arg_pos = -1;
- state->arg_infos = g_slice_alloc0(sizeof(gpointer) * state->n_args);
- state->arg_type_infos = g_slice_alloc0(sizeof(gpointer) * state->n_args);
- state->args_is_auxiliary = g_slice_alloc0(sizeof(gboolean) * state->n_args);
+ state->arg_infos = g_slice_alloc0 (sizeof (gpointer) * state->n_args);
+ state->arg_type_infos = g_slice_alloc0 (sizeof (gpointer) * state->n_args);
+ state->args_is_auxiliary = g_slice_alloc0 (sizeof (gboolean) * state->n_args);
state->return_value = NULL;
state->closure = NULL;
@@ -111,12 +111,12 @@ _prepare_invocation_state (struct invocation_state *state,
&state->callback_index, &state->user_data_index,
&state->destroy_notify_index))
return FALSE;
-
+
if (state->callback_index != G_MAXUINT8) {
if (!_pygi_create_callback (function_info,
state->is_method,
state->is_constructor,
- state->n_args, state->n_py_args,
+ state->n_args, state->n_py_args,
py_args, state->callback_index,
state->user_data_index,
state->destroy_notify_index, &state->closure))
@@ -141,15 +141,15 @@ _prepare_invocation_state (struct invocation_state *state,
GIDirection direction;
GITransfer transfer;
GITypeTag arg_type_tag;
-
- state->arg_infos[i] = g_callable_info_get_arg((GICallableInfo *)function_info,
- i);
- state->arg_type_infos[i] = g_arg_info_get_type(state->arg_infos[i]);
-
- direction = g_arg_info_get_direction(state->arg_infos[i]);
- transfer = g_arg_info_get_ownership_transfer(state->arg_infos[i]);
- arg_type_tag = g_type_info_get_tag(state->arg_type_infos[i]);
+ state->arg_infos[i] = g_callable_info_get_arg ( (GICallableInfo *) function_info,
+ i);
+
+ state->arg_type_infos[i] = g_arg_info_get_type (state->arg_infos[i]);
+
+ direction = g_arg_info_get_direction (state->arg_infos[i]);
+ transfer = g_arg_info_get_ownership_transfer (state->arg_infos[i]);
+ arg_type_tag = g_type_info_get_tag (state->arg_type_infos[i]);
if (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT) {
state->n_in_args += 1;
@@ -170,7 +170,7 @@ _prepare_invocation_state (struct invocation_state *state,
{
gint length_arg_pos;
- length_arg_pos = g_type_info_get_array_length(state->arg_type_infos[i]);
+ length_arg_pos = g_type_info_get_array_length (state->arg_type_infos[i]);
if (state->is_method)
length_arg_pos--; // length_arg_pos refers to C args
@@ -179,7 +179,7 @@ _prepare_invocation_state (struct invocation_state *state,
break;
}
- g_assert(length_arg_pos < state->n_args);
+ g_assert (length_arg_pos < state->n_args);
state->args_is_auxiliary[length_arg_pos] = TRUE;
if (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT) {
@@ -192,7 +192,7 @@ _prepare_invocation_state (struct invocation_state *state,
break;
}
case GI_TYPE_TAG_ERROR:
- g_warn_if_fail(state->error_arg_pos < 0);
+ g_warn_if_fail (state->error_arg_pos < 0);
state->error_arg_pos = i;
break;
default:
@@ -200,18 +200,18 @@ _prepare_invocation_state (struct invocation_state *state,
}
}
- state->return_type_info = g_callable_info_get_return_type((GICallableInfo *)function_info);
- state->return_type_tag = g_type_info_get_tag(state->return_type_info);
+ state->return_type_info = g_callable_info_get_return_type ( (GICallableInfo *) function_info);
+ state->return_type_tag = g_type_info_get_tag (state->return_type_info);
if (state->return_type_tag == GI_TYPE_TAG_ARRAY) {
gint length_arg_pos;
- length_arg_pos = g_type_info_get_array_length(state->return_type_info);
+ length_arg_pos = g_type_info_get_array_length (state->return_type_info);
if (state->is_method)
length_arg_pos--; // length_arg_pos refers to C args
if (length_arg_pos >= 0) {
- g_assert(length_arg_pos < state->n_args);
+ g_assert (length_arg_pos < state->n_args);
state->args_is_auxiliary[length_arg_pos] = TRUE;
state->n_aux_out_args += 1;
}
@@ -227,14 +227,14 @@ _prepare_invocation_state (struct invocation_state *state,
Py_ssize_t py_args_pos;
n_py_args_expected = state->n_in_args
- + (state->is_constructor ? 1 : 0)
- - state->n_aux_in_args
- - (state->error_arg_pos >= 0 ? 1 : 0);
+ + (state->is_constructor ? 1 : 0)
+ - state->n_aux_in_args
+ - (state->error_arg_pos >= 0 ? 1 : 0);
if (state->n_py_args != n_py_args_expected) {
- PyErr_Format(PyExc_TypeError,
- "takes exactly %zd argument(s) (%zd given)",
- n_py_args_expected, state->n_py_args);
+ PyErr_Format (PyExc_TypeError,
+ "takes exactly %zd argument(s) (%zd given)",
+ n_py_args_expected, state->n_py_args);
return FALSE;
}
@@ -251,8 +251,8 @@ _prepare_invocation_state (struct invocation_state *state,
gint retval;
gboolean allow_none;
- direction = g_arg_info_get_direction(state->arg_infos[i]);
- type_tag = g_type_info_get_tag(state->arg_type_infos[i]);
+ direction = g_arg_info_get_direction (state->arg_infos[i]);
+ type_tag = g_type_info_get_tag (state->arg_type_infos[i]);
if (direction == GI_DIRECTION_OUT
|| state->args_is_auxiliary[i]
@@ -260,33 +260,33 @@ _prepare_invocation_state (struct invocation_state *state,
continue;
}
- g_assert(py_args_pos < state->n_py_args);
- py_arg = PyTuple_GET_ITEM(py_args, py_args_pos);
+ g_assert (py_args_pos < state->n_py_args);
+ py_arg = PyTuple_GET_ITEM (py_args, py_args_pos);
- allow_none = g_arg_info_may_be_null(state->arg_infos[i]);
+ allow_none = g_arg_info_may_be_null (state->arg_infos[i]);
- retval = _pygi_g_type_info_check_object(state->arg_type_infos[i],
- py_arg,
- allow_none);
+ retval = _pygi_g_type_info_check_object (state->arg_type_infos[i],
+ py_arg,
+ allow_none);
if (retval < 0) {
return FALSE;
} else if (!retval) {
- _PyGI_ERROR_PREFIX("argument %zd: ", py_args_pos);
+ _PyGI_ERROR_PREFIX ("argument %zd: ", py_args_pos);
return FALSE;
}
py_args_pos += 1;
}
- g_assert(py_args_pos == state->n_py_args);
+ g_assert (py_args_pos == state->n_py_args);
}
- state->args = g_slice_alloc0(sizeof(gpointer) * state->n_args);
- state->in_args = g_slice_alloc0(sizeof(GArgument) * state->n_in_args);
- state->out_args = g_slice_alloc0(sizeof(GArgument) * state->n_out_args);
- state->out_values = g_slice_alloc0(sizeof(GArgument) * state->n_out_args);
- state->backup_args = g_slice_alloc0(sizeof(GArgument) * state->n_backup_args);
+ state->args = g_slice_alloc0 (sizeof (gpointer) * state->n_args);
+ state->in_args = g_slice_alloc0 (sizeof (GArgument) * state->n_in_args);
+ state->out_args = g_slice_alloc0 (sizeof (GArgument) * state->n_out_args);
+ state->out_values = g_slice_alloc0 (sizeof (GArgument) * state->n_out_args);
+ state->backup_args = g_slice_alloc0 (sizeof (GArgument) * state->n_backup_args);
/* Bind args so we can use an unique index. */
{
@@ -299,21 +299,21 @@ _prepare_invocation_state (struct invocation_state *state,
for (i = 0; i < state->n_args; i++) {
GIDirection direction;
- direction = g_arg_info_get_direction(state->arg_infos[i]);
+ direction = g_arg_info_get_direction (state->arg_infos[i]);
switch (direction) {
case GI_DIRECTION_IN:
- g_assert(in_args_pos < state->n_in_args);
+ g_assert (in_args_pos < state->n_in_args);
state->args[i] = &state->in_args[in_args_pos];
in_args_pos += 1;
break;
case GI_DIRECTION_INOUT:
- g_assert(in_args_pos < state->n_in_args);
- g_assert(out_args_pos < state->n_out_args);
+ g_assert (in_args_pos < state->n_in_args);
+ g_assert (out_args_pos < state->n_out_args);
state->in_args[in_args_pos].v_pointer = &state->out_values[out_args_pos];
in_args_pos += 1;
case GI_DIRECTION_OUT:
- g_assert(out_args_pos < state->n_out_args);
+ g_assert (out_args_pos < state->n_out_args);
state->out_args[out_args_pos].v_pointer = &state->out_values[out_args_pos];
state->out_values[out_args_pos].v_pointer = NULL;
state->args[i] = &state->out_values[out_args_pos];
@@ -321,8 +321,8 @@ _prepare_invocation_state (struct invocation_state *state,
}
}
- g_assert(in_args_pos == state->n_in_args);
- g_assert(out_args_pos == state->n_out_args);
+ g_assert (in_args_pos == state->n_in_args);
+ g_assert (out_args_pos == state->n_out_args);
}
/* Convert the input arguments. */
@@ -342,28 +342,28 @@ _prepare_invocation_state (struct invocation_state *state,
GIInfoType container_info_type;
PyObject *py_arg;
- container_info = g_base_info_get_container(function_info);
- container_info_type = g_base_info_get_type(container_info);
+ container_info = g_base_info_get_container (function_info);
+ container_info_type = g_base_info_get_type (container_info);
- g_assert(py_args_pos < state->n_py_args);
- py_arg = PyTuple_GET_ITEM(py_args, py_args_pos);
+ g_assert (py_args_pos < state->n_py_args);
+ py_arg = PyTuple_GET_ITEM (py_args, py_args_pos);
- switch(container_info_type) {
+ switch (container_info_type) {
case GI_INFO_TYPE_UNION:
case GI_INFO_TYPE_STRUCT:
{
GType type;
- type = g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)container_info);
+ type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) container_info);
- if (g_type_is_a(type, G_TYPE_BOXED)) {
- g_assert(state->n_in_args > 0);
- state->in_args[0].v_pointer = pyg_boxed_get(py_arg, void);
- } else if (g_type_is_a(type, G_TYPE_POINTER) || type == G_TYPE_NONE) {
- g_assert(state->n_in_args > 0);
- state->in_args[0].v_pointer = pyg_pointer_get(py_arg, void);
+ if (g_type_is_a (type, G_TYPE_BOXED)) {
+ g_assert (state->n_in_args > 0);
+ state->in_args[0].v_pointer = pyg_boxed_get (py_arg, void);
+ } else if (g_type_is_a (type, G_TYPE_POINTER) || type == G_TYPE_NONE) {
+ g_assert (state->n_in_args > 0);
+ state->in_args[0].v_pointer = pyg_pointer_get (py_arg, void);
} else {
- PyErr_Format(PyExc_TypeError, "unable to convert an instance of '%s'", g_type_name(type));
+ PyErr_Format (PyExc_TypeError, "unable to convert an instance of '%s'", g_type_name (type));
return FALSE;
}
@@ -371,8 +371,8 @@ _prepare_invocation_state (struct invocation_state *state,
}
case GI_INFO_TYPE_OBJECT:
case GI_INFO_TYPE_INTERFACE:
- g_assert(state->n_in_args > 0);
- state->in_args[0].v_pointer = pygobject_get(py_arg);
+ g_assert (state->n_in_args > 0);
+ state->in_args[0].v_pointer = pygobject_get (py_arg);
break;
default:
/* Other types don't have methods. */
@@ -398,36 +398,36 @@ _prepare_invocation_state (struct invocation_state *state,
state->args[i]->v_pointer = destroy_notify->closure;
continue;
}
-
+
if (state->args_is_auxiliary[i]) {
continue;
}
- direction = g_arg_info_get_direction(state->arg_infos[i]);
+ direction = g_arg_info_get_direction (state->arg_infos[i]);
if (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT) {
PyObject *py_arg;
GITypeTag arg_type_tag;
GITransfer transfer;
- arg_type_tag = g_type_info_get_tag(state->arg_type_infos[i]);
+ arg_type_tag = g_type_info_get_tag (state->arg_type_infos[i]);
if (arg_type_tag == GI_TYPE_TAG_ERROR) {
GError **error;
- error = g_slice_new(GError *);
+ error = g_slice_new (GError *);
*error = NULL;
state->args[i]->v_pointer = error;
continue;
}
- transfer = g_arg_info_get_ownership_transfer(state->arg_infos[i]);
+ transfer = g_arg_info_get_ownership_transfer (state->arg_infos[i]);
- g_assert(py_args_pos < state->n_py_args);
- py_arg = PyTuple_GET_ITEM(py_args, py_args_pos);
+ g_assert (py_args_pos < state->n_py_args);
+ py_arg = PyTuple_GET_ITEM (py_args, py_args_pos);
- *state->args[i] = _pygi_argument_from_object(py_arg, state->arg_type_infos[i], transfer);
+ *state->args[i] = _pygi_argument_from_object (py_arg, state->arg_type_infos[i], transfer);
if (PyErr_Occurred()) {
/* TODO: release previous input arguments. */
@@ -436,7 +436,7 @@ _prepare_invocation_state (struct invocation_state *state,
if (direction == GI_DIRECTION_INOUT && transfer == GI_TRANSFER_NOTHING) {
/* We need to keep a copy of the argument to be able to release it later. */
- g_assert(backup_args_pos < state->n_backup_args);
+ g_assert (backup_args_pos < state->n_backup_args);
state->backup_args[backup_args_pos] = *state->args[i];
backup_args_pos += 1;
} else if (transfer == GI_TRANSFER_CONTAINER) {
@@ -450,23 +450,23 @@ _prepare_invocation_state (struct invocation_state *state,
array = state->args[i]->v_pointer;
- item_size = g_array_get_element_size(array);
+ item_size = g_array_get_element_size (array);
- new_array = g_array_sized_new(FALSE, FALSE, item_size, array->len);
- g_array_append_vals(new_array, array->data, array->len);
+ new_array = g_array_sized_new (FALSE, FALSE, item_size, array->len);
+ g_array_append_vals (new_array, array->data, array->len);
- g_assert(backup_args_pos < state->n_backup_args);
+ g_assert (backup_args_pos < state->n_backup_args);
state->backup_args[backup_args_pos].v_pointer = new_array;
break;
}
case GI_TYPE_TAG_GLIST:
- g_assert(backup_args_pos < state->n_backup_args);
- state->backup_args[backup_args_pos].v_pointer = g_list_copy(state->args[i]->v_pointer);
+ g_assert (backup_args_pos < state->n_backup_args);
+ state->backup_args[backup_args_pos].v_pointer = g_list_copy (state->args[i]->v_pointer);
break;
case GI_TYPE_TAG_GSLIST:
- g_assert(backup_args_pos < state->n_backup_args);
- state->backup_args[backup_args_pos].v_pointer = g_slist_copy(state->args[i]->v_pointer);
+ g_assert (backup_args_pos < state->n_backup_args);
+ state->backup_args[backup_args_pos].v_pointer = g_slist_copy (state->args[i]->v_pointer);
break;
case GI_TYPE_TAG_GHASH:
{
@@ -476,11 +476,11 @@ _prepare_invocation_state (struct invocation_state *state,
hash_table = state->args[i]->v_pointer;
- keys = g_hash_table_get_keys(hash_table);
- values = g_hash_table_get_values(hash_table);
+ keys = g_hash_table_get_keys (hash_table);
+ values = g_hash_table_get_values (hash_table);
- g_assert(backup_args_pos < state->n_backup_args);
- state->backup_args[backup_args_pos].v_pointer = g_list_concat(keys, values);
+ g_assert (backup_args_pos < state->n_backup_args);
+ state->backup_args[backup_args_pos].v_pointer = g_list_concat (keys, values);
break;
}
@@ -497,26 +497,26 @@ _prepare_invocation_state (struct invocation_state *state,
array = state->args[i]->v_pointer;
- length_arg_pos = g_type_info_get_array_length(state->arg_type_infos[i]);
+ length_arg_pos = g_type_info_get_array_length (state->arg_type_infos[i]);
if (state->is_method)
length_arg_pos--; // length_arg_pos refers to C args
if (length_arg_pos >= 0) {
- int len = 0;
+ int len = 0;
/* Set the auxiliary argument holding the length. */
- if (array)
- len = array->len;
+ if (array)
+ len = array->len;
state->args[length_arg_pos]->v_size = len;
}
/* Get rid of the GArray. */
- if ((array != NULL) &&
- (g_type_info_get_array_type(state->arg_type_infos[i]) == GI_ARRAY_TYPE_C)) {
+ if ( (array != NULL) &&
+ (g_type_info_get_array_type (state->arg_type_infos[i]) == GI_ARRAY_TYPE_C)) {
state->args[i]->v_pointer = array->data;
if (direction != GI_DIRECTION_INOUT || transfer != GI_TRANSFER_NOTHING) {
/* The array hasn't been referenced anywhere, so free it to avoid losing memory. */
- g_array_free(array, FALSE);
+ g_array_free (array, FALSE);
}
}
}
@@ -525,8 +525,8 @@ _prepare_invocation_state (struct invocation_state *state,
}
}
- g_assert(py_args_pos == state->n_py_args);
- g_assert(backup_args_pos == state->n_backup_args);
+ g_assert (py_args_pos == state->n_py_args);
+ g_assert (backup_args_pos == state->n_backup_args);
}
return TRUE;
@@ -541,13 +541,13 @@ _invoke_function (struct invocation_state *state,
error = NULL;
- retval = g_function_info_invoke((GIFunctionInfo *)function_info,
- state->in_args, state->n_in_args, state->out_args, state->n_out_args, &state->return_arg, &error);
+ retval = g_function_info_invoke ( (GIFunctionInfo *) function_info,
+ state->in_args, state->n_in_args, state->out_args, state->n_out_args, &state->return_arg, &error);
if (!retval) {
- g_assert(error != NULL);
+ g_assert (error != NULL);
/* TODO: raise the right error, out of the error domain. */
- PyErr_SetString(PyExc_RuntimeError, error->message);
- g_error_free(error);
+ PyErr_SetString (PyExc_RuntimeError, error->message);
+ g_error_free (error);
/* TODO: release input arguments. */
@@ -561,8 +561,8 @@ _invoke_function (struct invocation_state *state,
if (*error != NULL) {
/* TODO: raise the right error, out of the error domain, if applicable. */
- PyErr_SetString(PyExc_Exception, (*error)->message);
- g_error_free(*error);
+ PyErr_SetString (PyExc_Exception, (*error)->message);
+ g_error_free (*error);
/* TODO: release input arguments. */
@@ -586,45 +586,45 @@ _process_invocation_state (struct invocation_state *state,
GIInfoType info_type;
GITransfer transfer;
- g_assert(state->n_py_args > 0);
- py_type = (PyTypeObject *)PyTuple_GET_ITEM(py_args, 0);
+ g_assert (state->n_py_args > 0);
+ py_type = (PyTypeObject *) PyTuple_GET_ITEM (py_args, 0);
- info = g_type_info_get_interface(state->return_type_info);
- g_assert(info != NULL);
+ info = g_type_info_get_interface (state->return_type_info);
+ g_assert (info != NULL);
- info_type = g_base_info_get_type(info);
+ info_type = g_base_info_get_type (info);
- transfer = g_callable_info_get_caller_owns((GICallableInfo *)function_info);
+ transfer = g_callable_info_get_caller_owns ( (GICallableInfo *) function_info);
switch (info_type) {
case GI_INFO_TYPE_UNION:
/* TODO */
- PyErr_SetString(PyExc_NotImplementedError, "creating unions is not supported yet");
- g_base_info_unref(info);
+ PyErr_SetString (PyExc_NotImplementedError, "creating unions is not supported yet");
+ g_base_info_unref (info);
return FALSE;
case GI_INFO_TYPE_STRUCT:
{
GType type;
- type = g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)info);
+ type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
- if (g_type_is_a(type, G_TYPE_BOXED)) {
+ if (g_type_is_a (type, G_TYPE_BOXED)) {
if (state->return_arg.v_pointer == NULL) {
- PyErr_SetString(PyExc_TypeError, "constructor returned NULL");
+ PyErr_SetString (PyExc_TypeError, "constructor returned NULL");
break;
}
- g_warn_if_fail(transfer == GI_TRANSFER_EVERYTHING);
- state->return_value = _pygi_boxed_new(py_type, state->return_arg.v_pointer, transfer == GI_TRANSFER_EVERYTHING);
- } else if (g_type_is_a(type, G_TYPE_POINTER) || type == G_TYPE_NONE) {
+ g_warn_if_fail (transfer == GI_TRANSFER_EVERYTHING);
+ state->return_value = _pygi_boxed_new (py_type, state->return_arg.v_pointer, transfer == GI_TRANSFER_EVERYTHING);
+ } else if (g_type_is_a (type, G_TYPE_POINTER) || type == G_TYPE_NONE) {
if (state->return_arg.v_pointer == NULL) {
- PyErr_SetString(PyExc_TypeError, "constructor returned NULL");
+ PyErr_SetString (PyExc_TypeError, "constructor returned NULL");
break;
}
- g_warn_if_fail(transfer == GI_TRANSFER_NOTHING);
- state->return_value = _pygi_struct_new(py_type, state->return_arg.v_pointer, transfer == GI_TRANSFER_EVERYTHING);
+ g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
+ state->return_value = _pygi_struct_new (py_type, state->return_arg.v_pointer, transfer == GI_TRANSFER_EVERYTHING);
} else {
- PyErr_Format(PyExc_TypeError, "cannot create '%s' instances", py_type->tp_name);
- g_base_info_unref(info);
+ PyErr_Format (PyExc_TypeError, "cannot create '%s' instances", py_type->tp_name);
+ g_base_info_unref (info);
return FALSE;
}
@@ -632,10 +632,10 @@ _process_invocation_state (struct invocation_state *state,
}
case GI_INFO_TYPE_OBJECT:
if (state->return_arg.v_pointer == NULL) {
- PyErr_SetString(PyExc_TypeError, "constructor returned NULL");
+ PyErr_SetString (PyExc_TypeError, "constructor returned NULL");
break;
}
- state->return_value = pygobject_new(state->return_arg.v_pointer);
+ state->return_value = pygobject_new (state->return_arg.v_pointer);
if (transfer == GI_TRANSFER_EVERYTHING) {
/* The new wrapper increased the reference count, so decrease it. */
g_object_unref (state->return_arg.v_pointer);
@@ -646,7 +646,7 @@ _process_invocation_state (struct invocation_state *state,
g_assert_not_reached();
}
- g_base_info_unref(info);
+ g_base_info_unref (info);
if (state->return_value == NULL) {
/* TODO: release arguments. */
@@ -655,26 +655,26 @@ _process_invocation_state (struct invocation_state *state,
} else {
GITransfer transfer;
- if ((state->return_type_tag == GI_TYPE_TAG_ARRAY) &&
- (g_type_info_get_array_type(state->return_type_info) == GI_ARRAY_TYPE_C)) {
+ if ( (state->return_type_tag == GI_TYPE_TAG_ARRAY) &&
+ (g_type_info_get_array_type (state->return_type_info) == GI_ARRAY_TYPE_C)) {
/* Create a #GArray. */
- state->return_arg.v_pointer = _pygi_argument_to_array(&state->return_arg, state->args, state->return_type_info, state->is_method);
+ state->return_arg.v_pointer = _pygi_argument_to_array (&state->return_arg, state->args, state->return_type_info, state->is_method);
}
- transfer = g_callable_info_get_caller_owns((GICallableInfo *)function_info);
+ transfer = g_callable_info_get_caller_owns ( (GICallableInfo *) function_info);
- state->return_value = _pygi_argument_to_object(&state->return_arg, state->return_type_info, transfer);
+ state->return_value = _pygi_argument_to_object (&state->return_arg, state->return_type_info, transfer);
if (state->return_value == NULL) {
/* TODO: release argument. */
return FALSE;
}
- _pygi_argument_release(&state->return_arg, state->return_type_info, transfer, GI_DIRECTION_OUT);
+ _pygi_argument_release (&state->return_arg, state->return_type_info, transfer, GI_DIRECTION_OUT);
if (state->return_type_tag == GI_TYPE_TAG_ARRAY
&& transfer == GI_TRANSFER_NOTHING) {
/* We created a #GArray, so free it. */
- state->return_arg.v_pointer = g_array_free(state->return_arg.v_pointer, FALSE);
+ state->return_arg.v_pointer = g_array_free (state->return_arg.v_pointer, FALSE);
}
}
@@ -690,7 +690,7 @@ _process_invocation_state (struct invocation_state *state,
/* Return a tuple. */
PyObject *return_values;
- return_values = PyTuple_New(state->n_return_values);
+ return_values = PyTuple_New (state->n_return_values);
if (return_values == NULL) {
/* TODO: release arguments. */
return FALSE;
@@ -698,11 +698,11 @@ _process_invocation_state (struct invocation_state *state,
if (state->return_type_tag == GI_TYPE_TAG_VOID) {
/* The current return value is None. */
- Py_DECREF(state->return_value);
+ Py_DECREF (state->return_value);
} else {
/* Put the return value first. */
- g_assert(state->return_value != NULL);
- PyTuple_SET_ITEM(return_values, return_values_pos, state->return_value);
+ g_assert (state->return_value != NULL);
+ PyTuple_SET_ITEM (return_values, return_values_pos, state->return_value);
return_values_pos += 1;
}
@@ -719,35 +719,35 @@ _process_invocation_state (struct invocation_state *state,
continue;
}
- direction = g_arg_info_get_direction(state->arg_infos[i]);
- transfer = g_arg_info_get_ownership_transfer(state->arg_infos[i]);
+ direction = g_arg_info_get_direction (state->arg_infos[i]);
+ transfer = g_arg_info_get_ownership_transfer (state->arg_infos[i]);
- type_tag = g_type_info_get_tag(state->arg_type_infos[i]);
+ type_tag = g_type_info_get_tag (state->arg_type_infos[i]);
- if ((type_tag == GI_TYPE_TAG_ARRAY) &&
- (g_type_info_get_array_type(state->arg_type_infos[i]) == GI_ARRAY_TYPE_C) &&
- (direction != GI_DIRECTION_IN || transfer == GI_TRANSFER_NOTHING)) {
+ if ( (type_tag == GI_TYPE_TAG_ARRAY) &&
+ (g_type_info_get_array_type (state->arg_type_infos[i]) == GI_ARRAY_TYPE_C) &&
+ (direction != GI_DIRECTION_IN || transfer == GI_TRANSFER_NOTHING)) {
/* Create a #GArray. */
- state->args[i]->v_pointer = _pygi_argument_to_array(state->args[i], state->args, state->arg_type_infos[i], state->is_method);
+ state->args[i]->v_pointer = _pygi_argument_to_array (state->args[i], state->args, state->arg_type_infos[i], state->is_method);
}
if (direction == GI_DIRECTION_INOUT || direction == GI_DIRECTION_OUT) {
/* Convert the argument. */
PyObject *obj;
- obj = _pygi_argument_to_object(state->args[i], state->arg_type_infos[i], transfer);
+ obj = _pygi_argument_to_object (state->args[i], state->arg_type_infos[i], transfer);
if (obj == NULL) {
/* TODO: release arguments. */
return FALSE;
}
- g_assert(return_values_pos < state->n_return_values);
+ g_assert (return_values_pos < state->n_return_values);
if (state->n_return_values > 1) {
- PyTuple_SET_ITEM(state->return_value, return_values_pos, obj);
+ PyTuple_SET_ITEM (state->return_value, return_values_pos, obj);
} else {
/* The current return value is None. */
- Py_DECREF(state->return_value);
+ Py_DECREF (state->return_value);
state->return_value = obj;
}
@@ -756,16 +756,16 @@ _process_invocation_state (struct invocation_state *state,
/* Release the argument. */
- if ((direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT)
+ if ( (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT)
&& transfer == GI_TRANSFER_CONTAINER) {
/* Release the items we kept in another container. */
switch (type_tag) {
case GI_TYPE_TAG_ARRAY:
case GI_TYPE_TAG_GLIST:
case GI_TYPE_TAG_GSLIST:
- g_assert(backup_args_pos < state->n_backup_args);
- _pygi_argument_release(&state->backup_args[backup_args_pos], state->arg_type_infos[i],
- transfer, GI_DIRECTION_IN);
+ g_assert (backup_args_pos < state->n_backup_args);
+ _pygi_argument_release (&state->backup_args[backup_args_pos], state->arg_type_infos[i],
+ transfer, GI_DIRECTION_IN);
break;
case GI_TYPE_TAG_GHASH:
{
@@ -775,25 +775,25 @@ _process_invocation_state (struct invocation_state *state,
gsize length;
gsize j;
- key_type_info = g_type_info_get_param_type(state->arg_type_infos[i], 0);
- value_type_info = g_type_info_get_param_type(state->arg_type_infos[i], 1);
+ key_type_info = g_type_info_get_param_type (state->arg_type_infos[i], 0);
+ value_type_info = g_type_info_get_param_type (state->arg_type_infos[i], 1);
- g_assert(backup_args_pos < state->n_backup_args);
+ g_assert (backup_args_pos < state->n_backup_args);
item = state->backup_args[backup_args_pos].v_pointer;
- length = g_list_length(item) / 2;
+ length = g_list_length (item) / 2;
- for (j = 0; j < length; j++, item = g_list_next(item)) {
- _pygi_argument_release((GArgument *)&item->data, key_type_info,
- GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
+ for (j = 0; j < length; j++, item = g_list_next (item)) {
+ _pygi_argument_release ( (GArgument *) &item->data, key_type_info,
+ GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
}
- for (j = 0; j < length; j++, item = g_list_next(item)) {
- _pygi_argument_release((GArgument *)&item->data, value_type_info,
- GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
+ for (j = 0; j < length; j++, item = g_list_next (item)) {
+ _pygi_argument_release ( (GArgument *) &item->data, value_type_info,
+ GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
}
- g_list_free(state->backup_args[backup_args_pos].v_pointer);
+ g_list_free (state->backup_args[backup_args_pos].v_pointer);
break;
}
@@ -803,34 +803,34 @@ _process_invocation_state (struct invocation_state *state,
if (direction == GI_DIRECTION_INOUT) {
/* Release the output argument. */
- _pygi_argument_release(state->args[i], state->arg_type_infos[i], GI_TRANSFER_CONTAINER,
- GI_DIRECTION_OUT);
+ _pygi_argument_release (state->args[i], state->arg_type_infos[i], GI_TRANSFER_CONTAINER,
+ GI_DIRECTION_OUT);
}
backup_args_pos += 1;
} else if (direction == GI_DIRECTION_INOUT) {
if (transfer == GI_TRANSFER_NOTHING) {
- g_assert(backup_args_pos < state->n_backup_args);
- _pygi_argument_release(&state->backup_args[backup_args_pos], state->arg_type_infos[i],
- GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
+ g_assert (backup_args_pos < state->n_backup_args);
+ _pygi_argument_release (&state->backup_args[backup_args_pos], state->arg_type_infos[i],
+ GI_TRANSFER_NOTHING, GI_DIRECTION_IN);
backup_args_pos += 1;
}
- _pygi_argument_release(state->args[i], state->arg_type_infos[i], transfer,
- GI_DIRECTION_OUT);
+ _pygi_argument_release (state->args[i], state->arg_type_infos[i], transfer,
+ GI_DIRECTION_OUT);
} else {
- _pygi_argument_release(state->args[i], state->arg_type_infos[i], transfer, direction);
+ _pygi_argument_release (state->args[i], state->arg_type_infos[i], transfer, direction);
}
if (type_tag == GI_TYPE_TAG_ARRAY
&& (direction != GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING)) {
/* We created a #GArray and it has not been released above, so free it. */
- state->args[i]->v_pointer = g_array_free(state->args[i]->v_pointer, FALSE);
+ state->args[i]->v_pointer = g_array_free (state->args[i]->v_pointer, FALSE);
}
}
- g_assert(state->n_return_values <= 1 || return_values_pos == state->n_return_values);
- g_assert(backup_args_pos == state->n_backup_args);
+ g_assert (state->n_return_values <= 1 || return_values_pos == state->n_return_values);
+ g_assert (backup_args_pos == state->n_backup_args);
}
return TRUE;
@@ -842,55 +842,55 @@ _free_invocation_state (struct invocation_state *state)
gsize i;
if (state->return_type_info != NULL) {
- g_base_info_unref((GIBaseInfo *)state->return_type_info);
+ g_base_info_unref ( (GIBaseInfo *) state->return_type_info);
}
if (state->closure != NULL) {
- if (state->closure->scope == GI_SCOPE_TYPE_CALL)
- _pygi_invoke_closure_free(state->closure);
+ if (state->closure->scope == GI_SCOPE_TYPE_CALL)
+ _pygi_invoke_closure_free (state->closure);
}
for (i = 0; i < state->n_args; i++) {
if (state->arg_type_infos[i] != NULL)
- g_base_info_unref((GIBaseInfo *)state->arg_type_infos[i]);
+ g_base_info_unref ( (GIBaseInfo *) state->arg_type_infos[i]);
if (state->arg_infos[i] != NULL)
- g_base_info_unref((GIBaseInfo *)state->arg_infos[i]);
+ g_base_info_unref ( (GIBaseInfo *) state->arg_infos[i]);
}
if (state->arg_infos != NULL) {
- g_slice_free1(sizeof(gpointer) * state->n_args, state->arg_infos);
+ g_slice_free1 (sizeof (gpointer) * state->n_args, state->arg_infos);
}
if (state->arg_type_infos != NULL) {
- g_slice_free1(sizeof(gpointer) * state->n_args, state->arg_type_infos);
+ g_slice_free1 (sizeof (gpointer) * state->n_args, state->arg_type_infos);
}
if (state->args != NULL) {
- g_slice_free1(sizeof(gpointer) * state->n_args, state->args);
+ g_slice_free1 (sizeof (gpointer) * state->n_args, state->args);
}
if (state->args_is_auxiliary != NULL) {
- g_slice_free1(sizeof(gboolean) * state->n_args, state->args_is_auxiliary);
+ g_slice_free1 (sizeof (gboolean) * state->n_args, state->args_is_auxiliary);
}
if (state->in_args != NULL) {
- g_slice_free1(sizeof(GArgument) * state->n_in_args, state->in_args);
+ g_slice_free1 (sizeof (GArgument) * state->n_in_args, state->in_args);
}
if (state->out_args != NULL) {
- g_slice_free1(sizeof(GArgument) * state->n_out_args, state->out_args);
+ g_slice_free1 (sizeof (GArgument) * state->n_out_args, state->out_args);
}
if (state->out_values != NULL) {
- g_slice_free1(sizeof(GArgument) * state->n_out_args, state->out_values);
+ g_slice_free1 (sizeof (GArgument) * state->n_out_args, state->out_values);
}
if (state->backup_args != NULL) {
- g_slice_free1(sizeof(GArgument) * state->n_backup_args, state->backup_args);
+ g_slice_free1 (sizeof (GArgument) * state->n_backup_args, state->backup_args);
}
if (PyErr_Occurred()) {
- Py_CLEAR(state->return_value);
+ Py_CLEAR (state->return_value);
}
}
diff --git a/gi/pygi-repository.c b/gi/pygi-repository.c
index f84fc7b..783b4aa 100644
--- a/gi/pygi-repository.c
+++ b/gi/pygi-repository.c
@@ -28,34 +28,34 @@ PyObject *PyGIRepositoryError;
static PyMethodDef _PyGIRepository_methods[];
PyTypeObject PyGIRepository_Type = {
- PyObject_HEAD_INIT(NULL)
+ PyObject_HEAD_INIT (NULL)
0,
"gi.Repository", /* tp_name */
- sizeof(PyGIRepository), /* tp_basicsize */
+ sizeof (PyGIRepository), /* tp_basicsize */
0, /* tp_itemsize */
- (destructor)NULL, /* tp_dealloc */
- (printfunc)NULL, /* tp_print */
- (getattrfunc)NULL, /* tp_getattr */
- (setattrfunc)NULL, /* tp_setattr */
- (cmpfunc)NULL, /* tp_compare */
- (reprfunc)NULL, /* tp_repr */
+ (destructor) NULL, /* tp_dealloc */
+ (printfunc) NULL, /* tp_print */
+ (getattrfunc) NULL, /* tp_getattr */
+ (setattrfunc) NULL, /* tp_setattr */
+ (cmpfunc) NULL, /* tp_compare */
+ (reprfunc) NULL, /* tp_repr */
NULL, /* tp_as_number */
NULL, /* tp_as_sequence */
NULL, /* tp_as_mapping */
- (hashfunc)NULL, /* tp_hash */
- (ternaryfunc)NULL, /* tp_call */
- (reprfunc)NULL, /* tp_str */
- (getattrofunc)NULL, /* tp_getattro */
- (setattrofunc)NULL, /* tp_setattro */
+ (hashfunc) NULL, /* tp_hash */
+ (ternaryfunc) NULL, /* tp_call */
+ (reprfunc) NULL, /* tp_str */
+ (getattrofunc) NULL, /* tp_getattro */
+ (setattrofunc) NULL, /* tp_setattro */
NULL, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
NULL, /* tp_doc */
- (traverseproc)NULL, /* tp_traverse */
- (inquiry)NULL, /* tp_clear */
- (richcmpfunc)NULL, /* tp_richcompare */
+ (traverseproc) NULL, /* tp_traverse */
+ (inquiry) NULL, /* tp_clear */
+ (richcmpfunc) NULL, /* tp_richcompare */
0, /* tp_weaklistoffset */
- (getiterfunc)NULL, /* tp_iter */
- (iternextfunc)NULL, /* tp_iternext */
+ (getiterfunc) NULL, /* tp_iter */
+ (iternextfunc) NULL, /* tp_iternext */
_PyGIRepository_methods, /* tp_methods */
};
@@ -65,7 +65,7 @@ _wrap_g_irepository_get_default (PyObject *self)
static PyGIRepository *repository = NULL;
if (!repository) {
- repository = (PyGIRepository *)PyObject_New(PyGIRepository, &PyGIRepository_Type);
+ repository = (PyGIRepository *) PyObject_New (PyGIRepository, &PyGIRepository_Type);
if (repository == NULL) {
return NULL;
}
@@ -73,8 +73,8 @@ _wrap_g_irepository_get_default (PyObject *self)
repository->repository = g_irepository_get_default();
}
- Py_INCREF((PyObject *)repository);
- return (PyObject *)repository;
+ Py_INCREF ( (PyObject *) repository);
+ return (PyObject *) repository;
}
static PyObject *
@@ -91,20 +91,20 @@ _wrap_g_irepository_require (PyGIRepository *self,
GTypelib *typelib;
GError *error;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|sO:Repository.require",
- kwlist, &namespace_, &version, &lazy)) {
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s|sO:Repository.require",
+ kwlist, &namespace_, &version, &lazy)) {
return NULL;
}
- if (lazy != NULL && PyObject_IsTrue(lazy)) {
+ if (lazy != NULL && PyObject_IsTrue (lazy)) {
flags |= G_IREPOSITORY_LOAD_FLAG_LAZY;
}
error = NULL;
- typelib = g_irepository_require(self->repository, namespace_, version, flags, &error);
+ typelib = g_irepository_require (self->repository, namespace_, version, flags, &error);
if (error != NULL) {
- PyErr_SetString(PyGIRepositoryError, error->message);
- g_error_free(error);
+ PyErr_SetString (PyGIRepositoryError, error->message);
+ g_error_free (error);
return NULL;
}
@@ -123,19 +123,19 @@ _wrap_g_irepository_find_by_name (PyGIRepository *self,
GIBaseInfo *info;
PyObject *py_info;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "ss:Repository.find_by_name", kwlist, &namespace_, &name)) {
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs,
+ "ss:Repository.find_by_name", kwlist, &namespace_, &name)) {
return NULL;
}
- info = g_irepository_find_by_name(self->repository, namespace_, name);
+ info = g_irepository_find_by_name (self->repository, namespace_, name);
if (info == NULL) {
Py_RETURN_NONE;
}
- py_info = _pygi_info_new(info);
+ py_info = _pygi_info_new (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
return py_info;
}
@@ -152,36 +152,36 @@ _wrap_g_irepository_get_infos (PyGIRepository *self,
PyObject *infos;
gssize i;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:Repository.get_infos",
- kwlist, &namespace_)) {
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s:Repository.get_infos",
+ kwlist, &namespace_)) {
return NULL;
}
- n_infos = g_irepository_get_n_infos(self->repository, namespace_);
+ n_infos = g_irepository_get_n_infos (self->repository, namespace_);
if (n_infos < 0) {
- PyErr_Format(PyExc_RuntimeError, "Namespace '%s' not loaded", namespace_);
+ PyErr_Format (PyExc_RuntimeError, "Namespace '%s' not loaded", namespace_);
return NULL;
}
- infos = PyTuple_New(n_infos);
+ infos = PyTuple_New (n_infos);
for (i = 0; i < n_infos; i++) {
GIBaseInfo *info;
PyObject *py_info;
- info = g_irepository_get_info(self->repository, namespace_, i);
- g_assert(info != NULL);
+ info = g_irepository_get_info (self->repository, namespace_, i);
+ g_assert (info != NULL);
- py_info = _pygi_info_new(info);
+ py_info = _pygi_info_new (info);
- g_base_info_unref(info);
+ g_base_info_unref (info);
if (py_info == NULL) {
- Py_CLEAR(infos);
+ Py_CLEAR (infos);
break;
}
- PyTuple_SET_ITEM(infos, i, py_info);
+ PyTuple_SET_ITEM (infos, i, py_info);
}
return infos;
@@ -196,26 +196,26 @@ _wrap_g_irepository_get_typelib_path (PyGIRepository *self,
const char *namespace_;
const gchar *typelib_path;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "s:Repository.get_typelib_path", kwlist, &namespace_)) {
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs,
+ "s:Repository.get_typelib_path", kwlist, &namespace_)) {
return NULL;
}
- typelib_path = g_irepository_get_typelib_path(self->repository, namespace_);
+ typelib_path = g_irepository_get_typelib_path (self->repository, namespace_);
if (typelib_path == NULL) {
- PyErr_Format(PyExc_RuntimeError, "Namespace '%s' not loaded", namespace_);
+ PyErr_Format (PyExc_RuntimeError, "Namespace '%s' not loaded", namespace_);
return NULL;
}
- return PyString_FromString(typelib_path);
+ return PyString_FromString (typelib_path);
}
static PyMethodDef _PyGIRepository_methods[] = {
- { "get_default", (PyCFunction)_wrap_g_irepository_get_default, METH_STATIC|METH_NOARGS },
- { "require", (PyCFunction)_wrap_g_irepository_require, METH_VARARGS|METH_KEYWORDS },
- { "get_infos", (PyCFunction)_wrap_g_irepository_get_infos, METH_VARARGS|METH_KEYWORDS },
- { "find_by_name", (PyCFunction)_wrap_g_irepository_find_by_name, METH_VARARGS|METH_KEYWORDS },
- { "get_typelib_path", (PyCFunction)_wrap_g_irepository_get_typelib_path, METH_VARARGS|METH_KEYWORDS },
+ { "get_default", (PyCFunction) _wrap_g_irepository_get_default, METH_STATIC | METH_NOARGS },
+ { "require", (PyCFunction) _wrap_g_irepository_require, METH_VARARGS | METH_KEYWORDS },
+ { "get_infos", (PyCFunction) _wrap_g_irepository_get_infos, METH_VARARGS | METH_KEYWORDS },
+ { "find_by_name", (PyCFunction) _wrap_g_irepository_find_by_name, METH_VARARGS | METH_KEYWORDS },
+ { "get_typelib_path", (PyCFunction) _wrap_g_irepository_get_typelib_path, METH_VARARGS | METH_KEYWORDS },
{ NULL, NULL, 0 }
};
@@ -223,15 +223,15 @@ void
_pygi_repository_register_types (PyObject *m)
{
PyGIRepository_Type.ob_type = &PyType_Type;
- if (PyType_Ready(&PyGIRepository_Type)) {
+ if (PyType_Ready (&PyGIRepository_Type)) {
return;
}
- if (PyModule_AddObject(m, "Repository", (PyObject *)&PyGIRepository_Type)) {
+ if (PyModule_AddObject (m, "Repository", (PyObject *) &PyGIRepository_Type)) {
return;
}
- PyGIRepositoryError = PyErr_NewException("gi.RepositoryError", NULL, NULL);
- if (PyModule_AddObject(m, "RepositoryError", PyGIRepositoryError)) {
+ PyGIRepositoryError = PyErr_NewException ("gi.RepositoryError", NULL, NULL);
+ if (PyModule_AddObject (m, "RepositoryError", PyGIRepositoryError)) {
return;
}
}
diff --git a/gi/pygi-struct.c b/gi/pygi-struct.c
index f15a6cd..2f1ce42 100644
--- a/gi/pygi-struct.c
+++ b/gi/pygi-struct.c
@@ -29,15 +29,15 @@
static void
_struct_dealloc (PyGIStruct *self)
{
- PyObject_GC_UnTrack((PyObject *)self);
+ PyObject_GC_UnTrack ( (PyObject *) self);
- PyObject_ClearWeakRefs((PyObject *)self);
+ PyObject_ClearWeakRefs ( (PyObject *) self);
if (self->free_on_dealloc) {
- g_free(((PyGPointer *)self)->pointer);
+ g_free ( ( (PyGPointer *) self)->pointer);
}
- ((PyGPointer *)self)->ob_type->tp_free((PyObject *)self);
+ ( (PyGPointer *) self)->ob_type->tp_free ( (PyObject *) self);
}
static PyObject *
@@ -53,34 +53,34 @@ _struct_new (PyTypeObject *type,
gpointer pointer;
PyObject *self = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "", kwlist)) {
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs, "", kwlist)) {
return NULL;
}
- info = _pygi_object_get_gi_info((PyObject *)type, &PyGIStructInfo_Type);
+ info = _pygi_object_get_gi_info ( (PyObject *) type, &PyGIStructInfo_Type);
if (info == NULL) {
- if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
- PyErr_Format(PyExc_TypeError, "missing introspection information");
+ if (PyErr_ExceptionMatches (PyExc_AttributeError)) {
+ PyErr_Format (PyExc_TypeError, "missing introspection information");
}
return NULL;
}
- size = g_struct_info_get_size((GIStructInfo *)info);
- pointer = g_try_malloc0(size);
+ size = g_struct_info_get_size ( (GIStructInfo *) info);
+ pointer = g_try_malloc0 (size);
if (pointer == NULL) {
PyErr_NoMemory();
goto out;
}
- self = _pygi_struct_new(type, pointer, TRUE);
+ self = _pygi_struct_new (type, pointer, TRUE);
if (self == NULL) {
- g_free(pointer);
+ g_free (pointer);
}
out:
- g_base_info_unref(info);
+ g_base_info_unref (info);
- return (PyObject *)self;
+ return (PyObject *) self;
}
static int
@@ -94,38 +94,38 @@ _struct_init (PyObject *self,
PyTypeObject PyGIStruct_Type = {
- PyObject_HEAD_INIT(NULL)
+ PyObject_HEAD_INIT (NULL)
0,
"gi.Struct", /* tp_name */
- sizeof(PyGIStruct), /* tp_basicsize */
+ sizeof (PyGIStruct), /* tp_basicsize */
0, /* tp_itemsize */
- (destructor)_struct_dealloc, /* tp_dealloc */
- (printfunc)NULL, /* tp_print */
- (getattrfunc)NULL, /* tp_getattr */
- (setattrfunc)NULL, /* tp_setattr */
- (cmpfunc)NULL, /* tp_compare */
- (reprfunc)NULL, /* tp_repr */
+ (destructor) _struct_dealloc, /* tp_dealloc */
+ (printfunc) NULL, /* tp_print */
+ (getattrfunc) NULL, /* tp_getattr */
+ (setattrfunc) NULL, /* tp_setattr */
+ (cmpfunc) NULL, /* tp_compare */
+ (reprfunc) NULL, /* tp_repr */
NULL, /* tp_as_number */
NULL, /* tp_as_sequence */
NULL, /* tp_as_mapping */
- (hashfunc)NULL, /* tp_hash */
- (ternaryfunc)NULL, /* tp_call */
- (reprfunc)NULL, /* tp_str */
- (getattrofunc)NULL, /* tp_getattro */
- (setattrofunc)NULL, /* tp_setattro */
+ (hashfunc) NULL, /* tp_hash */
+ (ternaryfunc) NULL, /* tp_call */
+ (reprfunc) NULL, /* tp_str */
+ (getattrofunc) NULL, /* tp_getattro */
+ (setattrofunc) NULL, /* tp_setattro */
NULL, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
NULL, /* tp_doc */
- (traverseproc)NULL, /* tp_traverse */
- (inquiry)NULL, /* tp_clear */
- (richcmpfunc)NULL, /* tp_richcompare */
+ (traverseproc) NULL, /* tp_traverse */
+ (inquiry) NULL, /* tp_clear */
+ (richcmpfunc) NULL, /* tp_richcompare */
0, /* tp_weaklistoffset */
- (getiterfunc)NULL, /* tp_iter */
- (iternextfunc)NULL, /* tp_iternext */
+ (getiterfunc) NULL, /* tp_iter */
+ (iternextfunc) NULL, /* tp_iternext */
NULL, /* tp_methods */
NULL, /* tp_members */
NULL, /* tp_getset */
- (PyTypeObject *)NULL, /* tp_base */
+ (PyTypeObject *) NULL, /* tp_base */
};
PyObject *
@@ -136,23 +136,23 @@ _pygi_struct_new (PyTypeObject *type,
PyGIStruct *self;
GType g_type;
- if (!PyType_IsSubtype(type, &PyGIStruct_Type)) {
- PyErr_SetString(PyExc_TypeError, "must be a subtype of gi.Struct");
+ if (!PyType_IsSubtype (type, &PyGIStruct_Type)) {
+ PyErr_SetString (PyExc_TypeError, "must be a subtype of gi.Struct");
return NULL;
}
- self = (PyGIStruct *)type->tp_alloc(type, 0);
+ self = (PyGIStruct *) type->tp_alloc (type, 0);
if (self == NULL) {
return NULL;
}
- g_type = pyg_type_from_object((PyObject *)type);
+ g_type = pyg_type_from_object ( (PyObject *) type);
- ((PyGPointer *)self)->gtype = g_type;
- ((PyGPointer *)self)->pointer = pointer;
+ ( (PyGPointer *) self)->gtype = g_type;
+ ( (PyGPointer *) self)->pointer = pointer;
self->free_on_dealloc = free_on_dealloc;
- return (PyObject *)self;
+ return (PyObject *) self;
}
void
@@ -160,10 +160,10 @@ _pygi_struct_register_types (PyObject *m)
{
PyGIStruct_Type.ob_type = &PyType_Type;
PyGIStruct_Type.tp_base = &PyGPointer_Type;
- PyGIStruct_Type.tp_new = (newfunc)_struct_new;
- PyGIStruct_Type.tp_init = (initproc)_struct_init;
- if (PyType_Ready(&PyGIStruct_Type))
+ PyGIStruct_Type.tp_new = (newfunc) _struct_new;
+ PyGIStruct_Type.tp_init = (initproc) _struct_init;
+ if (PyType_Ready (&PyGIStruct_Type))
return;
- if (PyModule_AddObject(m, "Struct", (PyObject *)&PyGIStruct_Type))
+ if (PyModule_AddObject (m, "Struct", (PyObject *) &PyGIStruct_Type))
return;
}
diff --git a/gi/pygi-type.c b/gi/pygi-type.c
index c95da86..410efe1 100644
--- a/gi/pygi-type.c
+++ b/gi/pygi-type.c
@@ -33,22 +33,22 @@ _pygi_type_import_by_gi_info (GIBaseInfo *info)
PyObject *py_module;
PyObject *py_object;
- namespace_ = g_base_info_get_namespace(info);
- name = g_base_info_get_name(info);
+ namespace_ = g_base_info_get_namespace (info);
+ name = g_base_info_get_name (info);
- module_name = g_strconcat("gi.repository.", namespace_, NULL);
+ module_name = g_strconcat ("gi.repository.", namespace_, NULL);
- py_module = PyImport_ImportModule(module_name);
+ py_module = PyImport_ImportModule (module_name);
+
+ g_free (module_name);
- g_free(module_name);
-
if (py_module == NULL) {
return NULL;
}
- py_object = PyObject_GetAttrString(py_module, name);
+ py_object = PyObject_GetAttrString (py_module, name);
- Py_DECREF(py_module);
+ Py_DECREF (py_module);
return py_object;
}
@@ -62,34 +62,34 @@ pygi_type_import_by_g_type (GType g_type)
repository = g_irepository_get_default();
- info = g_irepository_find_by_gtype(repository, g_type);
+ info = g_irepository_find_by_gtype (repository, g_type);
if (info == NULL) {
return NULL;
}
- type = _pygi_type_import_by_gi_info(info);
- g_base_info_unref(info);
+ type = _pygi_type_import_by_gi_info (info);
+ g_base_info_unref (info);
return type;
}
PyObject *
-_pygi_type_get_from_g_type(GType g_type)
+_pygi_type_get_from_g_type (GType g_type)
{
PyObject *py_g_type;
PyObject *py_type;
- py_g_type = pyg_type_wrapper_new(g_type);
+ py_g_type = pyg_type_wrapper_new (g_type);
if (py_g_type == NULL) {
return NULL;
}
- py_type = PyObject_GetAttrString(py_g_type, "pytype");
+ py_type = PyObject_GetAttrString (py_g_type, "pytype");
if (py_type == Py_None) {
- py_type = pygi_type_import_by_g_type(g_type);
+ py_type = pygi_type_import_by_g_type (g_type);
}
- Py_DECREF(py_g_type);
+ Py_DECREF (py_g_type);
return py_type;
}
diff --git a/gi/pygi.h b/gi/pygi.h
index 5ee8d94..a9c4665 100644
--- a/gi/pygi.h
+++ b/gi/pygi.h
@@ -73,27 +73,27 @@ pygi_import (void)
return 1;
}
- module = PyImport_ImportModule("gi");
+ module = PyImport_ImportModule ("gi");
if (module == NULL) {
return -1;
}
- api = PyObject_GetAttrString(module, "_API");
+ api = PyObject_GetAttrString (module, "_API");
if (api == NULL) {
- Py_DECREF(module);
+ Py_DECREF (module);
return -1;
}
- if (!PyCObject_Check(api)) {
- Py_DECREF(module);
- Py_DECREF(api);
- PyErr_Format(PyExc_TypeError, "gi._API must be cobject, not %s",
- api->ob_type->tp_name);
+ if (!PyCObject_Check (api)) {
+ Py_DECREF (module);
+ Py_DECREF (api);
+ PyErr_Format (PyExc_TypeError, "gi._API must be cobject, not %s",
+ api->ob_type->tp_name);
return -1;
}
- PyGI_API = (struct PyGI_API *)PyCObject_AsVoidPtr(api);
+ PyGI_API = (struct PyGI_API *) PyCObject_AsVoidPtr (api);
- Py_DECREF(api);
+ Py_DECREF (api);
return 0;
}
diff --git a/gi/pygobject-external.h b/gi/pygobject-external.h
index 9e9965b..00b8b6f 100644
--- a/gi/pygobject-external.h
+++ b/gi/pygobject-external.h
@@ -32,7 +32,7 @@ static PyTypeObject *_PyGTypeWrapper_Type;
#define PyGObject_Type (*_PyGObject_Type)
#define PyGTypeWrapper_Type (*_PyGTypeWrapper_Type)
-__attribute__((unused))
+__attribute__ ( (unused))
static int
_pygobject_import (void)
{
@@ -45,26 +45,26 @@ _pygobject_import (void)
return 1;
}
- from_list = Py_BuildValue("(ss)", "GObject", "GTypeWrapper");
+ from_list = Py_BuildValue ("(ss)", "GObject", "GTypeWrapper");
if (from_list == NULL) {
return -1;
}
- module = PyImport_ImportModuleEx("gobject", NULL, NULL, from_list);
+ module = PyImport_ImportModuleEx ("gobject", NULL, NULL, from_list);
- Py_DECREF(from_list);
+ Py_DECREF (from_list);
if (module == NULL) {
return -1;
}
- _PyGObject_Type = (PyTypeObject *)PyObject_GetAttrString(module, "GObject");
+ _PyGObject_Type = (PyTypeObject *) PyObject_GetAttrString (module, "GObject");
if (_PyGObject_Type == NULL) {
retval = -1;
goto out;
}
- _PyGTypeWrapper_Type = (PyTypeObject *)PyObject_GetAttrString(module, "GType");
+ _PyGTypeWrapper_Type = (PyTypeObject *) PyObject_GetAttrString (module, "GType");
if (_PyGTypeWrapper_Type == NULL) {
retval = -1;
goto out;
@@ -73,7 +73,7 @@ _pygobject_import (void)
imported = TRUE;
out:
- Py_DECREF(module);
+ Py_DECREF (module);
return retval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]