8 #define _RPMPS_INTERNAL
11 #include "rpmdebug-py.c"
26 fprintf(stderr,
"*** rpmps_iter(%p)\n", s);
37 PyObject * result = NULL;
41 fprintf(stderr,
"*** rpmps_iternext(%p) ps %p ix %d active %d\n", s, s->
ps, s->
ix, s->
active);
51 if (s->
ix < ps->numProblems) {
73 char * kwlist[] = {
"debugLevel", NULL};
75 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i", kwlist, &
_rpmps_debug))
86 {
"Debug", (PyCFunction)
rpmps_Debug, METH_VARARGS|METH_KEYWORDS,
99 fprintf(stderr,
"*** rpmps_dealloc(%p)\n", s);
112 fprintf(stderr,
"*** rpmps_print(%p,%p,%x)\n", s, (
void *)fp, flags);
122 fprintf(stderr,
"*** rpmps_getattro(%p,%p)\n", o, n);
123 return PyObject_GenericGetAttr(o, n);
130 fprintf(stderr,
"*** rpmps_setattro(%p,%p,%p)\n", o, n, v);
131 return PyObject_GenericSetAttr(o, n, v);
141 fprintf(stderr,
"*** rpmps_length(%p) rc %d\n", s, rc);
150 PyObject * result = NULL;
154 if (!PyInt_Check(key)) {
156 fprintf(stderr,
"*** rpmps_subscript(%p[%s],%p[%s])\n", s, lbl(s), key, lbl(key));
157 PyErr_SetString(PyExc_TypeError,
"integer expected");
161 ix = (int) PyInt_AsLong(key);
164 if (ix < ps->numProblems) {
167 fprintf(stderr,
"*** rpmps_subscript(%p,%p) %s\n", s, key, PyString_AsString(result));
180 if (!PyArg_Parse(key,
"i:ass_sub", &ix)) {
181 PyErr_SetString(PyExc_TypeError,
"rpmps key type must be integer");
186 if (ix < 0) ix = -ix;
191 fprintf(stderr,
"*** rpmps_ass_sub(%p[%s],%p[%s],%p[%s]) ps %p[%d:%d:%d]\n", s, lbl(s), key, lbl(key), value, lbl(value), ps, ix, ps->numProblems, ps->numProblemsAlloced);
194 if (ix < ps->numProblems) {
197 op->pkgNEVR =
_free(op->pkgNEVR);
198 op->altNEVR =
_free(op->altNEVR);
199 op->str1 =
_free(op->str1);
201 if ((ix+1) == ps->numProblems)
202 memset(op, 0,
sizeof(*op));
204 memmove(op, op+1, (ps->numProblems - ix) *
sizeof(*op));
205 if (ps->numProblems > 0)
210 unsigned long ulong1 = p->ulong1;
212 if (!PyArg_ParseTuple(value,
"ssOiisN:rpmps value tuple",
213 &p->pkgNEVR, &p->altNEVR, &p->key,
214 &p->type, &p->ignoreProblem, &p->str1,
221 if (ix >= ps->numProblems) {
224 p->str1, NULL, p->altNEVR, ulong1);
228 op->pkgNEVR =
_free(op->pkgNEVR);
229 op->altNEVR =
_free(op->altNEVR);
230 op->str1 =
_free(op->str1);
232 p->pkgNEVR = (p->pkgNEVR && *p->pkgNEVR ?
xstrdup(p->pkgNEVR) : NULL);
233 p->altNEVR = (p->altNEVR && *p->altNEVR ?
xstrdup(p->altNEVR) : NULL);
234 p->str1 = (p->str1 && *p->str1 ?
xstrdup(p->str1) : NULL);
255 char * kwlist[] = {NULL};
258 fprintf(stderr,
"*** rpmps_init(%p,%p,%p)\n", s, args, kwds);
260 if (!PyArg_ParseTupleAndKeywords(args, kwds,
":rpmps_init", kwlist))
276 fprintf(stderr,
"%p -- ps %p\n", s, s->
ps);
279 PyObject_Del((PyObject *)s);
287 PyObject * s = PyType_GenericAlloc(subtype, nitems);
290 fprintf(stderr,
"*** rpmps_alloc(%p,%d) ret %p\n", subtype, nitems, s);
297 static PyObject *
rpmps_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
309 fprintf(stderr,
"%p ++ ps %p\n", s, s->
ps);
311 return (PyObject *)s;
322 PyObject_HEAD_INIT(&PyType_Type)
345 #if Py_TPFLAGS_HAVE_ITER