if (!PyArg_ParseTuple(arg, "Os:parse", &me, &p)) goto end;
qd.p = p;
qd.e = 0;
- if (parse(&qd, &gp)) SYNERR(qd.e);
+ if (parse(&qd, &gp)) VALERR(qd.e);
rc = fginfo_pywrap(&gp, ty);
end:
return (rc);
static PyTypeObject fginfo_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.FGInfo", /* @tp_name@ */
+ "FGInfo", /* @tp_name@ */
sizeof(fginfo_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject dhinfo_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.DHInfo", /* @tp_name@ */
+ "DHInfo", /* @tp_name@ */
sizeof(fginfo_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject bindhinfo_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.BinDHInfo", /* @tp_name@ */
+ "BinDHInfo", /* @tp_name@ */
sizeof(fginfo_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
sc.buf = PyString_AS_STRING(x);
sc.lim = sc.buf + PyString_GET_SIZE(x);
if (G_READ(g, xx, &mptext_stringops, &sc) || sc.buf < sc.lim)
- SYNERR("malformed group element string");
+ VALERR("malformed group element string");
} else
TYERR("can't convert to group element");
return (ge_pywrap((PyObject *)ty, xx));
gobj->ty.ht_type.tp_alloc = PyType_GenericAlloc;
gobj->ty.ht_type.tp_free = 0;
gobj->ty.ht_type.tp_new = ge_pynew;
- PyType_Ready(&gobj->ty.ht_type);
+ typeready(&gobj->ty.ht_type);
return ((PyObject *)gobj);
}
g = GROUP_G(me);
x = G_CREATE(g);
if (G_READ(g, x, &mptext_stringops, &sc))
- SYNERR("bad group element string");
+ VALERR("bad group element string");
return (Py_BuildValue("(Ns#)", ge_pywrap(me, x),
sc.buf, (int)(sc.lim - sc.buf)));
end:
qd.p = p;
qd.e = 0;
if ((g = group_parse(&qd)) == 0)
- SYNERR(qd.e);
+ VALERR(qd.e);
return (group_pywrap(g));
end:
return (0);
G_COPY(g, x, g->g); return (ge_pywrap(me, x));
}
+static long ge_pyhash(PyObject *me)
+{
+ buf b;
+ size_t sz = GE_G(me)->noctets + 4;
+ uint32 h = 0xf672c776 + GE_G(me)->ops->ty;
+ octet *p = xmalloc(sz);
+ buf_init(&b, p, sz);
+ G_TOBUF(GE_G(me), &b, GE_X(me));
+ assert(BOK(&b));
+ h = unihash_hash(&unihash_global, h, BBASE(&b), BLEN(&b));
+ xfree(p);
+ return (h % LONG_MAX);
+}
+
static PyObject *gget_r(PyObject *me, void *hunoz)
{ return (mp_pywrap(MP_COPY(GROUP_G(me)->r))); }
static PyTypeObject ge_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.GE", /* @tp_name@ */
+ "GE", /* @tp_name@ */
sizeof(ge_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
&ge_pynumber, /* @tp_as_number@ */
0, /* @tp_as_sequence@ */
0, /* @tp_as_mapping@ */
- 0, /* @tp_hash@ */
+ ge_pyhash, /* @tp_hash@ */
0, /* @tp_call@ */
ge_pystr, /* @tp_str@ */
0, /* @tp_getattro@ */
static PyTypeObject group_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.Group", /* @tp_name@ */
+ "Group", /* @tp_name@ */
sizeof(group_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject primegroup_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.PrimeGroup", /* @tp_name@ */
+ "PrimeGroup", /* @tp_name@ */
sizeof(group_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject bingroup_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.BinGroup", /* @tp_name@ */
+ "BinGroup", /* @tp_name@ */
sizeof(group_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject ecgroup_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.ECGroup", /* @tp_name@ */
+ "ECGroup", /* @tp_name@ */
sizeof(group_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */