|
Packit Service |
779887 |
Currently (2011-05), include/report/*.h are:
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
dump_dir.h
|
|
Packit Service |
779887 |
event_config.h
|
|
Packit Service |
779887 |
problem_data.h
|
|
Packit Service |
779887 |
report.h
|
|
Packit Service |
779887 |
run_event.h
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
and we wrap all of them except event_config.h.
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
Python wrappers for C types and functions declared in include/report/FOO.h
|
|
Packit Service |
779887 |
should be implemented in corresponding FOO.c file in this directory.
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
Their (C-level) declarations should go to common.h.
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
Note that methods don't have to be declared in common.h:
|
|
Packit Service |
779887 |
they can be static functions inside FOO.c, and exposed to the rest
|
|
Packit Service |
779887 |
of the world via PyTypeObject instance. In FOO.c:
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
static PyObject *p_method_name(PyObject *pself, PyObject *args)
|
|
Packit Service |
779887 |
...
|
|
Packit Service |
779887 |
static PyMethodDef p_FOO_methods[] = {
|
|
Packit Service |
779887 |
{ "method_name", p_method_name, METH_VARARGS, NULL }
|
|
Packit Service |
779887 |
...
|
|
Packit Service |
779887 |
};
|
|
Packit Service |
779887 |
PyTypeObject p_FOO_type = {
|
|
Packit Service |
779887 |
.tp_methods = p_FOO_methods,
|
|
Packit Service |
779887 |
...
|
|
Packit Service |
779887 |
};
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
and only p_FOO_type needs to be declared in common.h.
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
Similarly, (de)allocators, attr getters/setters also can be static functions
|
|
Packit Service |
779887 |
and be hooked into p_FOO_type.
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
However, non-method functions can't be static.
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
File reportmodule.c contains the initialization function which should
|
|
Packit Service |
779887 |
initialize types (p_FOO_type objects) and hook up finctions from every
|
|
Packit Service |
779887 |
FOO.c so that they are usable from python code.
|
|
Packit Service |
779887 |
|
|
Packit Service |
779887 |
Python wrappers for C constants (enums, defines) are created directly
|
|
Packit Service |
779887 |
by reportmodule.c.
|