"Fossies" - the Fresh Open Source Software Archive

Member "cheetah3-3.2.6.post2/Cheetah/c/_filters.c" (20 Apr 2021, 2789 Bytes) of package /linux/www/cheetah3-3.2.6.post2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "_filters.c" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * C-version of the src/Filters.py module
    3  *
    4  * (c) 2009, R. Tyler Ballance <tyler@slide.com>
    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,                         /*ob_size*/
   37     "_filters.Filter",             /*tp_name*/
   38     sizeof(PyFilter), /*tp_basicsize*/
   39     0,                         /*tp_itemsize*/
   40     0,                         /*tp_dealloc*/
   41     0,                         /*tp_print*/
   42     0,                         /*tp_getattr*/
   43     0,                         /*tp_setattr*/
   44     0,                         /*tp_compare*/
   45     0,                         /*tp_repr*/
   46     0,                         /*tp_as_number*/
   47     0,                         /*tp_as_sequence*/
   48     0,                         /*tp_as_mapping*/
   49     0,                         /*tp_hash */
   50     0,                         /*tp_call*/
   51     0,                         /*tp_str*/
   52     0,                         /*tp_getattro*/
   53     0,                         /*tp_setattro*/
   54     0,                         /*tp_as_buffer*/
   55     Py_TPFLAGS_DEFAULT,        /*tp_flags*/
   56     "Filter object",           /* tp_doc */
   57     0,                     /* tp_traverse */
   58     0,                     /* tp_clear */
   59     0,                     /* tp_richcompare */
   60     0,                     /* tp_weaklistoffset */
   61     0,                     /* tp_iter */
   62     0,                     /* tp_iternext */
   63     py_filtermethods,             /* tp_methods */
   64 #if 0
   65     py_filtermembers,             /* tp_members */
   66     0,                         /* tp_getset */
   67     0,                         /* tp_base */
   68     0,                         /* tp_dict */
   69     0,                         /* tp_descr_get */
   70     0,                         /* tp_descr_set */
   71     0,                         /* tp_dictoffset */
   72     (initproc)Noddy_init,      /* tp_init */
   73     0,                         /* tp_alloc */
   74     NULL,                 /* tp_new */
   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