| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#include <Python.h> |
| 7 |
|
| 8 |
#include "_filters.h" |
| 9 |
|
| 10 |
#if __STDC_VERSION__ >= 199901L |
| 11 |
#include <stdbool.h> |
| 12 |
#else |
| 13 |
typedef enum { false, true } bool; |
| 14 |
#endif |
| 15 |
|
| 16 |
#ifdef __cplusplus |
| 17 |
extern "C" { |
| 18 |
#endif |
| 19 |
|
| 20 |
|
| 21 |
static PyObject *py_filter(PyObject *self, PyObject *args, PyObject *kwargs) |
| 22 |
{ |
| 23 |
Py_RETURN_FALSE; |
| 24 |
} |
| 25 |
|
| 26 |
static const char _filtersdoc[] = "\ |
| 27 |
\n\ |
| 28 |
"; |
| 29 |
static struct PyMethodDef py_filtermethods[] = { |
| 30 |
{"filter", (PyCFunction)(py_filter), METH_VARARGS | METH_KEYWORDS, |
| 31 |
PyDoc_STR("Filter stuff")}, |
| 32 |
{NULL}, |
| 33 |
}; |
| 34 |
static PyTypeObject PyFilterType = { |
| 35 |
PyObject_HEAD_INIT(NULL) |
| 36 |
0, |
| 37 |
"_filters.Filter", |
| 38 |
sizeof(PyFilter), |
| 39 |
0, |
| 40 |
0, |
| 41 |
0, |
| 42 |
0, |
| 43 |
0, |
| 44 |
0, |
| 45 |
0, |
| 46 |
0, |
| 47 |
0, |
| 48 |
0, |
| 49 |
0, |
| 50 |
0, |
| 51 |
0, |
| 52 |
0, |
| 53 |
0, |
| 54 |
0, |
| 55 |
Py_TPFLAGS_DEFAULT, |
| 56 |
"Filter object", |
| 57 |
0, |
| 58 |
0, |
| 59 |
0, |
| 60 |
0, |
| 61 |
0, |
| 62 |
0, |
| 63 |
py_filtermethods, |
| 64 |
#if 0 |
| 65 |
py_filtermembers, |
| 66 |
0, |
| 67 |
0, |
| 68 |
0, |
| 69 |
0, |
| 70 |
0, |
| 71 |
0, |
| 72 |
(initproc)Noddy_init, |
| 73 |
0, |
| 74 |
NULL, |
| 75 |
#endif |
| 76 |
}; |
| 77 |
|
| 78 |
PyMODINIT_FUNC init_filters() |
| 79 |
{ |
| 80 |
PyObject *module = Py_InitModule3("_filters", py_filtermethods, _filtersdoc); |
| 81 |
|
| 82 |
PyFilterType.tp_new = PyType_GenericNew; |
| 83 |
if (PyType_Ready(&PyFilterType) < 0) |
| 84 |
return; |
| 85 |
|
| 86 |
Py_INCREF(&PyFilterType); |
| 87 |
|
| 88 |
PyModule_AddObject(module, "Filter", (PyObject *)(&PyFilterType)); |
| 89 |
} |
| 90 |
|
| 91 |
#ifdef __cplusplus |
| 92 |
} |
| 93 |
#endif |