summaryrefslogtreecommitdiffstats
path: root/glib
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-07-26 14:46:58 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-07-26 14:46:58 +0000
commitd2f53eb32409ea9dbf654febc7853badc81a8e4b (patch)
tree4c6677c57a4fa99ac67a7000c65bed2cc826b0a1 /glib
parent130e20efbdc32e7b49960f24fac59c04fb613f87 (diff)
downloadpygobject-d2f53eb32409ea9dbf654febc7853badc81a8e4b.tar.gz
pygobject-d2f53eb32409ea9dbf654febc7853badc81a8e4b.tar.xz
pygobject-d2f53eb32409ea9dbf654febc7853badc81a8e4b.zip
reviewed by: <delete if not using a buddy>
2008-07-26 Johan Dahlin <johan@gnome.org> reviewed by: <delete if not using a buddy> * glib/pyglib-python-compat.h: * glib/pyglib.h: Make a few macros public * gobject/Makefile.am: * gobject/gobjectmodule.c (init_gobject): * gobject/pyginterface.c (pyg_interface_init), (pyg_interface_free), (pyg_register_interface), (pyg_register_interface_info), (pyg_lookup_interface_info), (pygobject_interface_register_types): * gobject/pyginterface.h: * gobject/pygobject-private.h: * gobject/pygobject.c: Move GInterface wrapper into its own file svn path=/trunk/; revision=875
Diffstat (limited to 'glib')
-rw-r--r--glib/pyglib-python-compat.h26
-rw-r--r--glib/pyglib.h21
2 files changed, 26 insertions, 21 deletions
diff --git a/glib/pyglib-python-compat.h b/glib/pyglib-python-compat.h
index b7a1970..4f062f4 100644
--- a/glib/pyglib-python-compat.h
+++ b/glib/pyglib-python-compat.h
@@ -28,27 +28,6 @@ typedef int Py_ssize_t;
/* Compilation on Python 2.x */
#if PY_VERSION_HEX < 0x03000000
-#define PYGLIB_MODULE_START(symbol, modname) \
-DL_EXPORT(void) init##symbol(void) \
-{ \
- PyObject *module; \
- module = Py_InitModule(modname, symbol##_functions);
-#define PYGLIB_MODULE_END }
-#define PYGLIB_DEFINE_TYPE(typename, symbol, csymbol) \
-PyTypeObject symbol = { \
- PyObject_HEAD_INIT(NULL) \
- 0, \
- typename, \
- sizeof(csymbol) \
-};
-#define PYGLIB_REGISTER_TYPE(d, type, name) \
- if (!type.tp_alloc) \
- type.tp_alloc = PyType_GenericAlloc; \
- if (!type.tp_new) \
- type.tp_new = PyType_GenericNew; \
- if (PyType_Ready(&type)) \
- return; \
- PyDict_SetItemString(d, name, (PyObject *)&type);
#define _PyUnicode_Check PyString_Check
#define _PyUnicode_AsString PyString_AsString
@@ -66,6 +45,11 @@ PyTypeObject symbol = { \
#define _PyLongObject PyIntObject
#define _PyLong_Type PyInt_Type
#else
+#undef PYGLIB_MODULE_START
+#undef PYGLIB_MODULE_END
+#undef PYGLIB_DEFINE_TYPE
+#undef PYGLIB_REGISTER_TYPE
+
#define PYGLIB_MODULE_START(symbol, modname) \
static struct PyModuleDef _##symbol##module = { \
PyModuleDef_HEAD_INIT, \
diff --git a/glib/pyglib.h b/glib/pyglib.h
index 384b60d..5659e77 100644
--- a/glib/pyglib.h
+++ b/glib/pyglib.h
@@ -60,6 +60,27 @@ GOptionGroup * pyglib_option_group_transfer_group(PyObject *self);
PyEval_RestoreThread(_save); \
} G_STMT_END
+#define PYGLIB_MODULE_START(symbol, modname) \
+DL_EXPORT(void) init##symbol(void) \
+{ \
+ PyObject *module; \
+ module = Py_InitModule(modname, symbol##_functions);
+#define PYGLIB_MODULE_END }
+#define PYGLIB_DEFINE_TYPE(typename, symbol, csymbol) \
+PyTypeObject symbol = { \
+ PyObject_HEAD_INIT(NULL) \
+ 0, \
+ typename, \
+ sizeof(csymbol) \
+};
+#define PYGLIB_REGISTER_TYPE(d, type, name) \
+ if (!type.tp_alloc) \
+ type.tp_alloc = PyType_GenericAlloc; \
+ if (!type.tp_new) \
+ type.tp_new = PyType_GenericNew; \
+ if (PyType_Ready(&type)) \
+ return; \
+ PyDict_SetItemString(d, name, (PyObject *)&type);
G_END_DECLS