#define MEMBER(name, ty, f, doc) \
{ #name, ty, offsetof(MEMBERSTRUCT, name), f, doc },
+/* Wrappers for filling in pointers in a `PyTypeObject' structure, (a)
+ * following Pyke naming convention, and (b) stripping `const' from the types
+ * without losing type safety.
+ */
+#define UNCONST_TYPE_SLOT(type, suffix, op, ty) \
+ CONVERT_CAREFULLY(type *, const type *, op ty##_py##suffix)
+#define PYGETSET(ty) UNCONST_TYPE_SLOT(PyGetSetDef, getset, NOTHING, ty)
+#define PYMETHODS(ty) UNCONST_TYPE_SLOT(PyMethodDef, methods, NOTHING, ty)
+#define PYMEMBERS(ty) UNCONST_TYPE_SLOT(PyMemberDef, members, NOTHING, ty)
+#define PYNUMBER(ty) UNCONST_TYPE_SLOT(PyNumberMethods, number, &, ty)
+#define PYSEQUENCE(ty) UNCONST_TYPE_SLOT(PySequenceMethods, sequence, &, ty)
+#define PYMAPPING(ty) UNCONST_TYPE_SLOT(PyMappingMethods, mapping, &, ty)
+#define PYBUFFER(ty) UNCONST_TYPE_SLOT(PyBufferProcs, buffer, &, ty)
+
/*----- Populating modules ------------------------------------------------*/
extern PyObject *modname;
/* The overall module object. */
extern PyObject *mkexc(PyObject */*mod*/, PyObject */*base*/,
- const char */*name*/, PyMethodDef */*methods*/);
+ const char */*name*/, const PyMethodDef */*methods*/);
/* Make and return an exception class called NAME, which will end up in
* module MOD (though it is not added at this time). The new class is a
* subclass of BASE. Attach the METHODS to it.
/* Mapping protocol implementation. */
extern Py_ssize_t gmap_pysize(PyObject *); /* for `mp_length' */
-extern PySequenceMethods gmap_pysequence; /* for `tp_as_sequence' */
-extern PyMethodDef gmap_pymethods[]; /* all the standard methods */
+extern const PySequenceMethods gmap_pysequence; /* for `tp_as_sequence' */
+extern const PyMethodDef gmap_pymethods[]; /* all the standard methods */
/*----- That's all, folks -------------------------------------------------*/