pyke/mapping.c, key.c: Make the mapping code more intrusive and complete.
[catacomb-python] / field.c
diff --git a/field.c b/field.c
index 1ff5ed2..ba7badb 100644 (file)
--- a/field.c
+++ b/field.c
@@ -393,7 +393,7 @@ static const PyNumberMethods fe_pynumber = {
   0,                                   /* @nb_inplace_true_divide@ */
 };
 
-static PyTypeObject fe_pytype_skel = {
+static const PyTypeObject fe_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "FE",                                        /* @tp_name@ */
   sizeof(fe_pyobj),                    /* @tp_basicsize@ */
@@ -539,7 +539,7 @@ static const PyMethodDef field_pymethods[] = {
   { 0 }
 };
 
-static PyTypeObject field_pytype_skel = {
+static const PyTypeObject field_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "Field",                             /* @tp_name@ */
   sizeof(field_pyobj),                 /* @tp_basicsize@ */
@@ -617,7 +617,7 @@ static const PyGetSetDef primefield_pygetset[] = {
 #undef GETSETNAME
 };
 
-static PyTypeObject primefield_pytype_skel = {
+static const PyTypeObject primefield_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "PrimeField",                                /* @tp_name@ */
   sizeof(field_pyobj),                 /* @tp_basicsize@ */
@@ -684,7 +684,7 @@ end:
   return (0);
 }
 
-static PyTypeObject niceprimefield_pytype_skel = {
+static const PyTypeObject niceprimefield_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "NicePrimeField",                    /* @tp_name@ */
   sizeof(field_pyobj),                 /* @tp_basicsize@ */
@@ -748,7 +748,7 @@ static const PyGetSetDef binfield_pygetset[] = {
   { 0 }
 };
 
-static PyTypeObject binfield_pytype_skel = {
+static const PyTypeObject binfield_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "BinField",                          /* @tp_name@ */
   sizeof(field_pyobj),                 /* @tp_basicsize@ */
@@ -814,7 +814,7 @@ end:
   return (0);
 }
 
-static PyTypeObject binpolyfield_pytype_skel = {
+static const PyTypeObject binpolyfield_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "BinPolyField",                      /* @tp_name@ */
   sizeof(field_pyobj),                 /* @tp_basicsize@ */
@@ -893,7 +893,7 @@ static const PyGetSetDef binnormfield_pygetset[] = {
   { 0 }
 };
 
-static PyTypeObject binnormfield_pytype_skel = {
+static const PyTypeObject binnormfield_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "BinNormField",                      /* @tp_name@ */
   sizeof(field_pyobj),                 /* @tp_basicsize@ */
@@ -943,6 +943,11 @@ static PyTypeObject binnormfield_pytype_skel = {
 
 /*----- Setup -------------------------------------------------------------*/
 
+static const struct nameval consts[] = {
+  CONST(FTY_PRIME), CONST(FTY_BINARY),
+  { 0 }
+};
+
 void field_pyinit(void)
 {
   INITTYPE(fe, root);
@@ -963,6 +968,7 @@ void field_pyinsert(PyObject *mod)
   INSERT("BinField", binfield_pytype);
   INSERT("BinPolyField", binpolyfield_pytype);
   INSERT("BinNormField", binnormfield_pytype);
+  setconstants(mod, consts);
 }
 
 /*----- That's all, folks -------------------------------------------------*/