found it
Now my c++ is quite rusty, but if I read this right, it is simply looking for a series of keyword arguments in the form of:
start=some_function, end=some_other_function, text=another_one,value=yet_another
or
some_function, some_other_function, another_one, yet_another
But as I said my C++ is quite rusty, so it's still under review...
pygimp_progress_install(PyObject *self, PyObject *args, PyObject *kwargs)
{
GimpProgressVtable vtable = { 0, };
const gchar *ret;
ProgressData *pdata;
static char *kwlist[] = { "start", "end", "text", "value", "data", NULL };
pdata = g_new0(ProgressData, 1);
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO|O:progress_install",
kwlist,
&pdata->start, &pdata->end,
&pdata->text, &pdata->value,
&pdata->user_data))
goto cleanup;
#define PROCESS_FUNC(n) G_STMT_START { \
if (!PyCallable_Check(pdata->n)) { \
PyErr_SetString(pygimp_error, #n "argument must be callable"); \
goto cleanup; \
} \
Py_INCREF(pdata->n); \
} G_STMT_END
PROCESS_FUNC(start);
PROCESS_FUNC(end);
PROCESS_FUNC(text);
PROCESS_FUNC(value);
Py_XINCREF(pdata->user_data);
#undef PROCESS_FUNC
vtable.start = pygimp_progress_start;
vtable.end = pygimp_progress_end;
vtable.set_text = pygimp_progress_text;
vtable.set_value = pygimp_progress_value;
ret = gimp_progress_install_vtable(&vtable, pdata);
if (!ret) {
PyErr_SetString(pygimp_error,
"error occurred while installing progress functions");
Py_DECREF(pdata->start);
Py_DECREF(pdata->end);
Py_DECREF(pdata->text);
Py_DECREF(pdata->value);
goto cleanup;
}
return PyString_FromString(ret);
cleanup:
g_free(pdata);
return NULL;
}
The call to
PyArg_ParseTupleAndKeywords is an internal system call of the python interpreter. It's function is just as it's name says, to parse tuples and kw arguments.
Time for some experimentation....(I wont bother finding the source for the interpreter to check it out...)
_________________
The answer was 42. The question is long forgotten. The computer that solved it is now destroyed.
The MK-2 has been built. Should this be the next question?
(Solve if you can ...
)