diff options
40 files changed, 146 insertions, 164 deletions
diff --git a/gi/Makefile.am b/gi/Makefile.am index 314fd413..5e73d707 100644 --- a/gi/Makefile.am +++ b/gi/Makefile.am @@ -88,8 +88,7 @@ _gi_la_SOURCES = \ pygi-closure.h \ pygi-ccallback.c \ pygi-ccallback.h \ - pygi.h \ - pygi-private.h \ + pygi-util.h \ pygi-property.c \ pygi-property.h \ pygi-signal-closure.c \ diff --git a/gi/gimodule.c b/gi/gimodule.c index 44f09013..aa1b8a7b 100644 --- a/gi/gimodule.c +++ b/gi/gimodule.c @@ -24,11 +24,18 @@ #include "pyglib-private.h" #include "pygobject-private.h" #include "pyginterface.h" -#include "pygi-private.h" -#include "pygi.h" +#include "pygi-repository.h" #include "pyglib.h" #include "pygi-error.h" #include "pygi-foreign.h" +#include "pygi-resulttuple.h" +#include "pygi-source.h" +#include "pygi-ccallback.h" +#include "pygi-closure.h" +#include "pygi-type.h" +#include "pygi-boxed.h" +#include "pygi-info.h" +#include "pygi-struct.h" #include <pyglib-python-compat.h> diff --git a/gi/pygboxed.c b/gi/pygboxed.c index cdb766c2..814cdb95 100644 --- a/gi/pygboxed.c +++ b/gi/pygboxed.c @@ -26,7 +26,6 @@ #include "pygobject-private.h" #include "pygboxed.h" -#include "pygi.h" #include "pygi-type.h" GQuark pygboxed_type_key; diff --git a/gi/pygenum.c b/gi/pygenum.c index fe78fb97..fb0873de 100644 --- a/gi/pygenum.c +++ b/gi/pygenum.c @@ -24,8 +24,8 @@ #endif #include <pyglib.h> +#include "pyglib-python-compat.h" #include "pygobject-private.h" -#include "pygi.h" #include "pygi-type.h" #include "pygenum.h" diff --git a/gi/pygflags.c b/gi/pygflags.c index ce146ae2..0be3097e 100644 --- a/gi/pygflags.c +++ b/gi/pygflags.c @@ -24,12 +24,10 @@ #endif #include <pyglib.h> +#include "pygi-type.h" #include "pygobject-private.h" #include "pygflags.h" -#include "pygi.h" -#include "pygi-type.h" - GQuark pygflags_class_key; PYGLIB_DEFINE_TYPE("gobject.GFlags", PyGFlags_Type, PyGFlags); diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c index fdd461a7..2e4dd400 100644 --- a/gi/pygi-argument.c +++ b/gi/pygi-argument.c @@ -19,20 +19,31 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "pygi-private.h" -#include "pygobject-private.h" - #include <string.h> #include <time.h> +#include "pygobject-private.h" + #include <pyglib-python-compat.h> #include <pyglib.h> +#include "pygi-argument.h" +#include "pygi-info.h" #include "pygi-value.h" #include "pygi-basictype.h" #include "pygi-object.h" #include "pygi-struct-marshal.h" #include "pygi-error.h" +#include "pygi-foreign.h" +#include "pygi-type.h" +#include "pygi-util.h" + +/* Redefine g_array_index because we want it to return the i-th element, casted + * to the type t, of the array a, and not the i-th element of the array a + * casted to the type t. */ +#define _g_array_index(a,t,i) \ + *(t *)((a)->data + g_array_get_element_size(a) * (i)) + gboolean pygi_argument_to_gssize (GIArgument *arg_in, diff --git a/gi/pygi-array.c b/gi/pygi-array.c index 5c344674..61d06175 100644 --- a/gi/pygi-array.c +++ b/gi/pygi-array.c @@ -23,9 +23,10 @@ #include <pyglib-python-compat.h> #include "pygi-array.h" -#include "pygi-private.h" +#include "pygi-info.h" #include "pygi-marshal-cleanup.h" #include "pygi-basictype.h" +#include "pygi-util.h" /* Needed for _pygi_marshal_cleanup_from_py_interface_struct_gvalue hack */ #include "pygi-struct-marshal.h" diff --git a/gi/pygi-basictype.c b/gi/pygi-basictype.c index 432559dc..470547d4 100644 --- a/gi/pygi-basictype.c +++ b/gi/pygi-basictype.c @@ -23,7 +23,7 @@ #include "pygi-basictype.h" #include "pygi-argument.h" -#include "pygi-private.h" +#include "pygobject-private.h" #ifdef G_OS_WIN32 #include <math.h> diff --git a/gi/pygi-boxed.c b/gi/pygi-boxed.c index d5faeb1a..c1e4b0ea 100644 --- a/gi/pygi-boxed.c +++ b/gi/pygi-boxed.c @@ -19,7 +19,8 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "pygi-private.h" +#include "pygi-boxed.h" +#include "pygi-info.h" #include "pygobject-private.h" #include <girepository.h> diff --git a/gi/pygi-boxed.h b/gi/pygi-boxed.h index c8f40b76..89942d07 100644 --- a/gi/pygi-boxed.h +++ b/gi/pygi-boxed.h @@ -21,9 +21,17 @@ #define __PYGI_BOXED_H__ #include <Python.h> +#include <girepository.h> +#include "pygobject-private.h" G_BEGIN_DECLS +typedef struct { + PyGBoxed base; + gboolean slice_allocated; + gsize size; +} PyGIBoxed; + extern PyTypeObject PyGIBoxed_Type; PyObject * _pygi_boxed_new (PyTypeObject *pytype, diff --git a/gi/pygi-cache.c b/gi/pygi-cache.c index 62b09615..263dc8ef 100644 --- a/gi/pygi-cache.c +++ b/gi/pygi-cache.c @@ -35,6 +35,8 @@ #include "pygi-object.h" #include "pygi-struct-marshal.h" #include "pygi-enum-marshal.h" +#include "pygi-resulttuple.h" +#include "pygi-invoke.h" /* _arg_info_default_value diff --git a/gi/pygi-ccallback.c b/gi/pygi-ccallback.c index 9c6e47ea..c7f3ecfe 100644 --- a/gi/pygi-ccallback.c +++ b/gi/pygi-ccallback.c @@ -19,8 +19,8 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "pygi-private.h" #include "pygobject-private.h" +#include "pygi-ccallback.h" #include <girepository.h> #include <pyglib-python-compat.h> diff --git a/gi/pygi-ccallback.h b/gi/pygi-ccallback.h index f2861713..dcd9e6b4 100644 --- a/gi/pygi-ccallback.h +++ b/gi/pygi-ccallback.h @@ -21,9 +21,20 @@ #define __PYGI_CCLOSURE_H__ #include <Python.h> +#include "pygi-cache.h" G_BEGIN_DECLS +typedef struct { + PyObject_HEAD + GCallback callback; + GIFunctionInfo *info; + gpointer user_data; + GIScopeType scope; + GDestroyNotify destroy_notify_func; + PyGICCallbackCache *cache; +} PyGICCallback; + extern PyTypeObject PyGICCallback_Type; PyObject * _pygi_ccallback_new (GCallback callback, diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c index 6a68e2b1..a75e3583 100644 --- a/gi/pygi-closure.c +++ b/gi/pygi-closure.c @@ -17,11 +17,14 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "pygi-private.h" #include "pygi-closure.h" #include "pygi-error.h" #include "pygi-marshal-cleanup.h" +#include "pygi-invoke.h" +#include "pygi-ccallback.h" +#include "pygi-info.h" +extern PyObject *_PyGIDefaultArgPlaceholder; typedef struct _PyGICallbackCache { diff --git a/gi/pygi-enum-marshal.c b/gi/pygi-enum-marshal.c index e1a7028e..945a8e0b 100644 --- a/gi/pygi-enum-marshal.c +++ b/gi/pygi-enum-marshal.c @@ -23,7 +23,8 @@ #include <pyglib-python-compat.h> #include "pygi-enum-marshal.h" -#include "pygi-private.h" +#include "pygobject-private.h" +#include "pygi-type.h" static gboolean gi_argument_from_c_long (GIArgument *arg_out, diff --git a/gi/pygi-error.c b/gi/pygi-error.c index d86021c2..45ca2ebf 100644 --- a/gi/pygi-error.c +++ b/gi/pygi-error.c @@ -21,9 +21,9 @@ */ #include "pyglib.h" -#include "pygi-private.h" #include "pygi-error.h" #include "pygtype.h" +#include <pyglib-python-compat.h> PyObject *PyGError = NULL; diff --git a/gi/pygi-hashtable.c b/gi/pygi-hashtable.c index d785daa2..84155d7b 100644 --- a/gi/pygi-hashtable.c +++ b/gi/pygi-hashtable.c @@ -21,7 +21,7 @@ #include <Python.h> #include "pygi-hashtable.h" #include "pygi-argument.h" -#include "pygi-private.h" +#include "pygi-util.h" typedef struct _PyGIHashCache { diff --git a/gi/pygi-info.c b/gi/pygi-info.c index cc8656b4..3422ea96 100644 --- a/gi/pygi-info.c +++ b/gi/pygi-info.c @@ -20,8 +20,12 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "pygi-private.h" +#include "pygi-info.h" #include "pygi-cache.h" +#include "pygi-invoke.h" +#include "pygi-type.h" +#include "pygi-argument.h" +#include "pygi-util.h" #include "pygobject-private.h" #include <pyglib-python-compat.h> diff --git a/gi/pygi-info.h b/gi/pygi-info.h index a0c66805..16371c86 100644 --- a/gi/pygi-info.h +++ b/gi/pygi-info.h @@ -23,9 +23,31 @@ #include <Python.h> #include <girepository.h> +#include "pygi-cache.h" G_BEGIN_DECLS +typedef struct { + PyObject_HEAD + GIBaseInfo *info; + PyObject *inst_weakreflist; + PyGICallableCache *cache; +} PyGIBaseInfo; + +typedef struct { + PyGIBaseInfo base; + + /* Reference the unbound version of this struct. + * We use this for the actual call to invoke because it manages the cache. + */ + struct PyGICallableInfo *py_unbound_info; + + /* Holds bound argument for instance, class, and vfunc methods. */ + PyObject *py_bound_arg; + +} PyGICallableInfo; + + gboolean pygi_g_struct_info_is_simple (GIStructInfo *struct_info); diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c index 02de46ee..619fe401 100644 --- a/gi/pygi-invoke.c +++ b/gi/pygi-invoke.c @@ -24,6 +24,11 @@ #include "pygi-invoke.h" #include "pygi-marshal-cleanup.h" #include "pygi-error.h" +#include "pygi-resulttuple.h" +#include "pygi-foreign.h" +#include "pygi-boxed.h" + +extern PyObject *_PyGIDefaultArgPlaceholder; static gboolean _check_for_unexpected_kwargs (PyGICallableCache *cache, diff --git a/gi/pygi-invoke.h b/gi/pygi-invoke.h index dfed2e01..aa51f3f2 100644 --- a/gi/pygi-invoke.h +++ b/gi/pygi-invoke.h @@ -24,7 +24,7 @@ #include <girepository.h> -#include "pygi-private.h" +#include "pygi-info.h" #include "pygi-invoke-state-struct.h" G_BEGIN_DECLS diff --git a/gi/pygi-list.c b/gi/pygi-list.c index 41a3d323..3eee8494 100644 --- a/gi/pygi-list.c +++ b/gi/pygi-list.c @@ -21,7 +21,7 @@ #include <Python.h> #include "pygi-list.h" #include "pygi-argument.h" -#include "pygi-private.h" +#include "pygi-util.h" typedef PyGISequenceCache PyGIArgGList; diff --git a/gi/pygi-marshal-cleanup.c b/gi/pygi-marshal-cleanup.c index b2e91eb2..b4d04bc5 100644 --- a/gi/pygi-marshal-cleanup.c +++ b/gi/pygi-marshal-cleanup.c @@ -16,9 +16,11 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ - - #include "pygi-marshal-cleanup.h" - #include <glib.h> + +#include "pygi-marshal-cleanup.h" +#include "pygi-foreign.h" +#include <glib.h> + static inline void _cleanup_caller_allocates (PyGIInvokeState *state, PyGIArgCache *cache, diff --git a/gi/pygi-marshal-cleanup.h b/gi/pygi-marshal-cleanup.h index 56bf383d..18ba0072 100644 --- a/gi/pygi-marshal-cleanup.h +++ b/gi/pygi-marshal-cleanup.h @@ -20,7 +20,9 @@ #ifndef __PYGI_MARSHAL_CLEANUP_H__ #define __PYGI_MARSHAL_CLEANUP_H__ -#include "pygi-private.h" +#include "pygi-struct.h" +#include "pygi-invoke-state-struct.h" +#include "pygi-cache.h" G_BEGIN_DECLS diff --git a/gi/pygi-object.c b/gi/pygi-object.c index a082992f..11ea2261 100644 --- a/gi/pygi-object.c +++ b/gi/pygi-object.c @@ -23,7 +23,7 @@ #include <pyglib-python-compat.h> #include "pygi-object.h" -#include "pygi-private.h" +#include "pygobject-private.h" #include "pygparamspec.h" /* diff --git a/gi/pygi-property.c b/gi/pygi-property.c index cc4e839f..4eb9ca8a 100644 --- a/gi/pygi-property.c +++ b/gi/pygi-property.c @@ -21,8 +21,9 @@ * IN THE SOFTWARE. */ -#include "pygi-private.h" +#include "pygi-property.h" #include "pygi-value.h" +#include "pygi-argument.h" #include "pygparamspec.h" #include <girepository.h> diff --git a/gi/pygi-property.h b/gi/pygi-property.h index 064a062c..19c720fb 100644 --- a/gi/pygi-property.h +++ b/gi/pygi-property.h @@ -27,7 +27,7 @@ #include <Python.h> #include <girepository.h> -#include "pygobject.h" +#include "pygobject-private.h" PyObject * pygi_get_property_value (PyGObject *instance, diff --git a/gi/pygi-repository.c b/gi/pygi-repository.c index 16356f9a..62ef3b60 100644 --- a/gi/pygi-repository.c +++ b/gi/pygi-repository.c @@ -19,7 +19,8 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "pygi-private.h" +#include "pygi-repository.h" +#include "pygi-info.h" #include <pyglib-python-compat.h> diff --git a/gi/pygi-repository.h b/gi/pygi-repository.h index 6f0928bd..61997120 100644 --- a/gi/pygi-repository.h +++ b/gi/pygi-repository.h @@ -21,9 +21,15 @@ #define __PYGI_REPOSITORY_H__ #include <Python.h> +#include <girepository.h> G_BEGIN_DECLS +typedef struct { + PyObject_HEAD + GIRepository *repository; +} PyGIRepository; + /* Private */ extern PyTypeObject PyGIRepository_Type; diff --git a/gi/pygi-signal-closure.c b/gi/pygi-signal-closure.c index 652ac99a..bd9b402a 100644 --- a/gi/pygi-signal-closure.c +++ b/gi/pygi-signal-closure.c @@ -16,8 +16,10 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "pygi-private.h" +#include "pygi-signal-closure.h" #include "pygi-value.h" +#include "pygi-argument.h" +#include "pygi-boxed.h" static GISignalInfo * _pygi_lookup_signal_from_g_type (GType g_type, diff --git a/gi/pygi-signal-closure.h b/gi/pygi-signal-closure.h index 5cc191b8..80bc58c5 100644 --- a/gi/pygi-signal-closure.h +++ b/gi/pygi-signal-closure.h @@ -24,7 +24,8 @@ #ifndef __PYGI_SIGNAL_CLOSURE_H__ #define __PYGI_SIGNAL_CLOSURE_H__ -#include "pygobject.h" +#include <girepository.h> +#include "pygobject-private.h" G_BEGIN_DECLS diff --git a/gi/pygi-source.c b/gi/pygi-source.c index afc43e63..c1d318c3 100644 --- a/gi/pygi-source.c +++ b/gi/pygi-source.c @@ -25,7 +25,9 @@ #include "pygobject-private.h" -#include "pygi-private.h" +#include "pygi-info.h" +#include "pygi-boxed.h" +#include "pygi-type.h" #include "pyglib.h" #include "pyglib-private.h" #include "pygi-source.h" diff --git a/gi/pygi-struct-marshal.c b/gi/pygi-struct-marshal.c index 353a2d16..0d365217 100644 --- a/gi/pygi-struct-marshal.c +++ b/gi/pygi-struct-marshal.c @@ -23,8 +23,12 @@ #include <pyglib-python-compat.h> #include "pygi-struct-marshal.h" -#include "pygi-private.h" +#include "pygi-struct.h" +#include "pygi-foreign.h" #include "pygi-value.h" +#include "pygi-type.h" +#include "pygi-boxed.h" +#include "pygi-info.h" /* * _is_union_member - check to see if the py_arg is actually a member of the diff --git a/gi/pygi-struct.c b/gi/pygi-struct.c index c379a881..5bbb7899 100644 --- a/gi/pygi-struct.c +++ b/gi/pygi-struct.c @@ -19,7 +19,10 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "pygi-private.h" +#include "pygi-struct.h" +#include "pygi-foreign.h" +#include "pygi-info.h" +#include "pygi-type.h" #include "pygobject-private.h" #include <girepository.h> diff --git a/gi/pygi-struct.h b/gi/pygi-struct.h index 347c55fa..dde42dd4 100644 --- a/gi/pygi-struct.h +++ b/gi/pygi-struct.h @@ -21,9 +21,15 @@ #define __PYGI_STRUCT_H__ #include <Python.h> +#include <pygobject-private.h> G_BEGIN_DECLS +typedef struct { + PyGPointer base; + gboolean free_on_dealloc; +} PyGIStruct; + extern PyTypeObject PyGIStruct_Type; PyObject * diff --git a/gi/pygi-type.c b/gi/pygi-type.c index 924e0b80..a1213f71 100644 --- a/gi/pygi-type.c +++ b/gi/pygi-type.c @@ -19,7 +19,8 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "pygi-private.h" +#include "pygobject-private.h" +#include "pygi-type.h" #include <pyglib-python-compat.h> diff --git a/gi/pygi-private.h b/gi/pygi-util.h index f70aec44..3144d6e4 100644 --- a/gi/pygi-private.h +++ b/gi/pygi-util.h @@ -1,40 +1,8 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - */ -#ifndef __PYGI_PRIVATE_H__ -#define __PYGI_PRIVATE_H__ - -#ifdef __PYGI_H__ -# error "Import pygi.h or pygi-private.h, but not both" -#endif - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <Python.h> - -#include "pygi.h" - -#include "pygobject-private.h" - -#include "pygi-repository.h" -#include "pygi-info.h" -#include "pygi-struct.h" -#include "pygi-boxed.h" -#include "pygi-argument.h" -#include "pygi-type.h" -#include "pygi-foreign.h" -#include "pygi-closure.h" -#include "pygi-ccallback.h" -#include "pygi-property.h" -#include "pygi-signal-closure.h" -#include "pygi-invoke.h" -#include "pygi-cache.h" -#include "pygi-source.h" -#include "pygi-resulttuple.h" +#ifndef __PYGI_UTIL_H__ +#define __PYGI_UTIL_H__ G_BEGIN_DECLS + #if PY_VERSION_HEX >= 0x03000000 #define _PyGI_ERROR_PREFIX(format, ...) G_STMT_START { \ @@ -76,13 +44,6 @@ G_BEGIN_DECLS #endif -/* Redefine g_array_index because we want it to return the i-th element, casted - * to the type t, of the array a, and not the i-th element of the array a - * casted to the type t. */ -#define _g_array_index(a,t,i) \ - *(t *)((a)->data + g_array_get_element_size(a) * (i)) - - G_END_DECLS -#endif /* __PYGI_PRIVATE_H__ */ +#endif /* __PYGI_UTIL_H__ */ diff --git a/gi/pygi.h b/gi/pygi.h deleted file mode 100644 index 3caf6f38..00000000 --- a/gi/pygi.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - * - * Copyright (C) 2005-2009 Johan Dahlin <johan@gnome.org> - * - * 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 - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __PYGI_H__ -#define __PYGI_H__ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <pygobject-private.h> - -#include <girepository.h> -#include "pygi-cache.h" - -extern PyObject *PyGIDeprecationWarning; -extern PyObject *_PyGIDefaultArgPlaceholder; - -typedef struct { - PyObject_HEAD - GIRepository *repository; -} PyGIRepository; - -typedef struct { - PyObject_HEAD - GIBaseInfo *info; - PyObject *inst_weakreflist; - PyGICallableCache *cache; -} PyGIBaseInfo; - -typedef struct { - PyGIBaseInfo base; - - /* Reference the unbound version of this struct. - * We use this for the actual call to invoke because it manages the cache. - */ - struct PyGICallableInfo *py_unbound_info; - - /* Holds bound argument for instance, class, and vfunc methods. */ - PyObject *py_bound_arg; - -} PyGICallableInfo; - -typedef struct { - PyGPointer base; - gboolean free_on_dealloc; -} PyGIStruct; - -typedef struct { - PyGBoxed base; - gboolean slice_allocated; - gsize size; -} PyGIBoxed; - -typedef struct { - PyObject_HEAD - GCallback callback; - GIFunctionInfo *info; - gpointer user_data; - GIScopeType scope; - GDestroyNotify destroy_notify_func; - PyGICCallbackCache *cache; -} PyGICCallback; - - -#endif /* __PYGI_H__ */ diff --git a/gi/pygobject.c b/gi/pygobject.c index a09ae367..e7ea5edc 100644 --- a/gi/pygobject.c +++ b/gi/pygobject.c @@ -27,12 +27,13 @@ #include "pyginterface.h" #include "pygparamspec.h" -#include "pygi.h" #include "pygi-value.h" #include "pygi-type.h" #include "pygi-property.h" #include "pygi-signal-closure.h" +extern PyObject *PyGIDeprecationWarning; + static void pygobject_dealloc(PyGObject *self); static int pygobject_traverse(PyGObject *self, visitproc visit, void *arg); static int pygobject_clear(PyGObject *self); diff --git a/gi/pygpointer.c b/gi/pygpointer.c index d728a402..d160fff1 100644 --- a/gi/pygpointer.c +++ b/gi/pygpointer.c @@ -26,7 +26,6 @@ #include "pygobject-private.h" #include "pygpointer.h" -#include "pygi.h" #include "pygi-type.h" |