-static int npgroups = -1, nbingroups = -1;
-
-static PyObject *namedgroups(const pentry *pp, int *ne)
-{
- int i, j;
- const char *p;
- PyObject *d, *c;
-
- d = PyDict_New();
- for (i = 0; pp[i].name; i++) {
- p = pp[i].name;
- for (j = 0; j < i; j++) {
- if (pp[i].data == pp[j].data) {
- c = PyDict_GetItemString(d, (/*unconst*/ char *)pp[j].name);
- Py_INCREF(c);
- goto found;
- }
- }
- c = PyInt_FromLong(i);
- found:
- PyDict_SetItemString(d, (/*unconst*/ char *)p, c);
- Py_DECREF(c);
- }
- *ne = i;
- return (d);
-}
-
-static PyObject *meth__groupn(PyObject *me, PyObject *arg,
- PyTypeObject *ty, const pentry *pp, int ne)
-{
- int i;
- gprime_param gp;
- PyObject *rc = 0;
-
- if (!PyArg_ParseTuple(arg, "i:_groupn", &i)) goto end;
- if (i < 0 || i >= ne) VALERR("group index out of range");
- dh_infofromdata(&gp, pp[i].data);
- rc = fginfo_pywrap(&gp, ty);
-end:
- return (rc);
-}
-
-static PyObject *dimeth__groupn(PyObject *me, PyObject *arg)
- { return (meth__groupn(me, arg, dhinfo_pytype, ptab, npgroups)); }
-
-static PyObject *bimeth__groupn(PyObject *me, PyObject *arg)
- { return (meth__groupn(me, arg, bindhinfo_pytype, bintab, nbingroups)); }
-