*.c: Split the constant definitions into the various submodules.
[catacomb-python] / rand.c
diff --git a/rand.c b/rand.c
index 58c851c..2f69336 100644 (file)
--- a/rand.c
+++ b/rand.c
@@ -282,7 +282,7 @@ static const PyMethodDef grand_pymethods[] = {
   { 0 }
 };
 
-static PyTypeObject grand_pytype_skel = {
+static const PyTypeObject grand_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "GRand",                             /* @tp_name@ */
   sizeof(grand_pyobj),                 /* @tp_basicsize@ */
@@ -339,7 +339,7 @@ static PyObject *lcrand_pynew(PyTypeObject *me, PyObject *arg, PyObject *kw)
   return (grand_dopywrap(lcrand_pytype, lcrand_create(n), f_freeme));
 }
 
-static PyTypeObject lcrand_pytype_skel = {
+static const PyTypeObject lcrand_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "LCRand",                            /* @tp_name@ */
   sizeof(grand_pyobj),                 /* @tp_basicsize@ */
@@ -396,7 +396,7 @@ static PyObject *fibrand_pynew(PyTypeObject *me, PyObject *arg, PyObject *kw)
   return (grand_dopywrap(fibrand_pytype, fibrand_create(n), f_freeme));
 }
 
-static PyTypeObject fibrand_pytype_skel = {
+static const PyTypeObject fibrand_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "FibRand",                           /* @tp_name@ */
   sizeof(grand_pyobj),                 /* @tp_basicsize@ */
@@ -526,7 +526,7 @@ static const PyGetSetDef truerand_pygetset[] = {
   { 0 }
 };
 
-static PyTypeObject truerand_pytype_skel = {
+static const PyTypeObject truerand_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "TrueRand",                          /* @tp_name@ */
   sizeof(grand_pyobj),                 /* @tp_basicsize@ */
@@ -774,7 +774,7 @@ static const PyMethodDef gclatinrand_pymethods[] = {
   { 0 }
 };
 
-static PyTypeObject gccrand_pytype_skel = {
+static const PyTypeObject gccrand_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "GCCRand",                           /* @tp_name@ */
   sizeof(gccrand_pyobj),               /* @tp_basicsize@ */
@@ -822,7 +822,7 @@ static PyTypeObject gccrand_pytype_skel = {
   0                                    /* @tp_is_gc@ */
 };
 
-static PyTypeObject gcrand_pytype_skel = {
+static const PyTypeObject gcrand_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "GCRand",                            /* @tp_name@ */
   sizeof(grand_pyobj),                 /* @tp_basicsize@ */
@@ -870,7 +870,7 @@ static PyTypeObject gcrand_pytype_skel = {
   0                                    /* @tp_is_gc@ */
 };
 
-static PyTypeObject gclatinrand_pytype_skel = {
+static const PyTypeObject gclatinrand_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "GCLatinRand",                       /* @tp_name@ */
   sizeof(grand_pyobj),                 /* @tp_basicsize@ */
@@ -971,7 +971,7 @@ end:
   return (rc);
 }
 
-static PyTypeObject sslprf_pytype_skel = {
+static const PyTypeObject sslprf_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "SSLRand",                           /* @tp_name@ */
   sizeof(grand_pyobj),                 /* @tp_basicsize@ */
@@ -1020,7 +1020,7 @@ static PyTypeObject sslprf_pytype_skel = {
   0                                    /* @tp_is_gc@ */
 };
 
-static PyTypeObject tlsdx_pytype_skel = {
+static const PyTypeObject tlsdx_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "TLSDataExpansion",                  /* @tp_name@ */
   sizeof(grand_pyobj),                 /* @tp_basicsize@ */
@@ -1069,7 +1069,7 @@ static PyTypeObject tlsdx_pytype_skel = {
   0                                    /* @tp_is_gc@ */
 };
 
-static PyTypeObject tlsprf_pytype_skel = {
+static const PyTypeObject tlsprf_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "TLSPRF",                            /* @tp_name@ */
   sizeof(grand_pyobj),                 /* @tp_basicsize@ */
@@ -1150,7 +1150,7 @@ static const PyGetSetDef dsarand_pygetset[] = {
   { 0 }
 };
 
-static PyTypeObject dsarand_pytype_skel = {
+static const PyTypeObject dsarand_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "DSARand",                           /* @tp_name@ */
   sizeof(grand_pyobj),                 /* @tp_basicsize@ */
@@ -1276,7 +1276,7 @@ static const PyGetSetDef bbs_pygetset[] = {
   { 0 }
 };
 
-static PyTypeObject bbs_pytype_skel = {
+static const PyTypeObject bbs_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "BlumBlumShub",                      /* @tp_name@ */
   sizeof(grand_pyobj),                 /* @tp_basicsize@ */
@@ -1438,7 +1438,7 @@ static const PyGetSetDef bbspriv_pygetset[] = {
   { 0 }
 };
 
-static PyTypeObject bbspriv_pytype_skel = {
+static const PyTypeObject bbspriv_pytype_skel = {
   PyObject_HEAD_INIT(0) 0,             /* Header */
   "BBSPriv",                           /* @tp_name@ */
   sizeof(bbspriv_pyobj),               /* @tp_basicsize@ */
@@ -1489,6 +1489,11 @@ static PyTypeObject bbspriv_pytype_skel = {
 
 /*----- Global stuff ------------------------------------------------------*/
 
+static const struct nameval consts[] = {
+  CONST(RAND_IBITS),
+  { 0 }
+};
+
 void rand_pyinit(void)
 {
   INITTYPE(grand, root);
@@ -1530,6 +1535,7 @@ void rand_pyinsert(PyObject *mod)
   gccrands_dict = gccrands(); Py_INCREF(gccrands_dict);
   INSERT("gccrands", gccrands_dict);
   INSERT("rand", rand_pyobj);
+  setconstants(mod, consts);
 }
 
 /*----- That's all, folks -------------------------------------------------*/