~mdw
/
catacomb-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
*.c: Split the constant definitions into the various submodules.
[catacomb-python]
/
pyke
/
pyke.h
diff --git
a/pyke/pyke.h
b/pyke/pyke.h
index
3076bb5
..
a544f8d
100644
(file)
--- a/
pyke/pyke.h
+++ b/
pyke/pyke.h
@@
-208,11
+208,11
@@
extern void *newtype(PyTypeObject */*meta*/,
extern void typeready(PyTypeObject *);
/* The type object is now ready to be used. */
extern void typeready(PyTypeObject *);
/* The type object is now ready to be used. */
-extern PyTypeObject *inittype(PyTypeObject */*skel*/,
+extern PyTypeObject *inittype(const PyTypeObject */*skel*/,
+ PyTypeObject */*base*/,
PyTypeObject */*meta*/);
/* All-in-one function to construct a working type from a type skeleton
PyTypeObject */*meta*/);
/* All-in-one function to construct a working type from a type skeleton
- * SKEL, with metaclass META. The caller is expected to have filled in the
- * direct superclass in SKEL->tp_base.
+ * SKEL, with known base type BASE (null for `object') and metaclass.
*/
/* Alias for built-in types, to fit in with Pyke naming conventions. */
*/
/* Alias for built-in types, to fit in with Pyke naming conventions. */
@@
-220,8
+220,7
@@
extern PyTypeObject *inittype(PyTypeObject */*skel*/,
#define type_pytype &PyType_Type
#define INITTYPE_META(ty, base, meta) do { \
#define type_pytype &PyType_Type
#define INITTYPE_META(ty, base, meta) do { \
- ty##_pytype_skel.tp_base = base##_pytype; \
- ty##_pytype = inittype(&ty##_pytype_skel, meta##_pytype); \
+ ty##_pytype = inittype(&ty##_pytype_skel, base##_pytype, meta##_pytype); \
} while (0)
#define INITTYPE(ty, base) INITTYPE_META(ty, base, type)
/* Macros to initialize a type from its skeleton. */
} while (0)
#define INITTYPE(ty, base) INITTYPE_META(ty, base, type)
/* Macros to initialize a type from its skeleton. */
@@
-322,6
+321,8
@@
extern PyObject *mkexc(PyObject */*mod*/, PyObject */*base*/,
struct nameval { const char *name; unsigned f; unsigned long value; };
#define CF_SIGNED 1u
extern void setconstants(PyObject *, const struct nameval *);
struct nameval { const char *name; unsigned f; unsigned long value; };
#define CF_SIGNED 1u
extern void setconstants(PyObject *, const struct nameval *);
+#define CONST(x) { #x, 0, x }
+#define CONSTFLAG(f, x) { #x, f, x }
#define INSEXC(name, var, base, meth) \
INSERT(name, var = mkexc(mod, base, name, meth))
#define INSEXC(name, var, base, meth) \
INSERT(name, var = mkexc(mod, base, name, meth))