ยปCore Development>Code coverage>Doc/includes/noddy.c

Python code coverage for Doc/includes/noddy.c

#countcontent
1n/a#include <Python.h>
2n/a
3n/atypedef struct {
4n/a PyObject_HEAD
5n/a /* Type-specific fields go here. */
6n/a} noddy_NoddyObject;
7n/a
8n/astatic PyTypeObject noddy_NoddyType = {
9n/a PyVarObject_HEAD_INIT(NULL, 0)
10n/a "noddy.Noddy", /* tp_name */
11n/a sizeof(noddy_NoddyObject), /* tp_basicsize */
12n/a 0, /* tp_itemsize */
13n/a 0, /* tp_dealloc */
14n/a 0, /* tp_print */
15n/a 0, /* tp_getattr */
16n/a 0, /* tp_setattr */
17n/a 0, /* tp_reserved */
18n/a 0, /* tp_repr */
19n/a 0, /* tp_as_number */
20n/a 0, /* tp_as_sequence */
21n/a 0, /* tp_as_mapping */
22n/a 0, /* tp_hash */
23n/a 0, /* tp_call */
24n/a 0, /* tp_str */
25n/a 0, /* tp_getattro */
26n/a 0, /* tp_setattro */
27n/a 0, /* tp_as_buffer */
28n/a Py_TPFLAGS_DEFAULT, /* tp_flags */
29n/a "Noddy objects", /* tp_doc */
30n/a};
31n/a
32n/astatic PyModuleDef noddymodule = {
33n/a PyModuleDef_HEAD_INIT,
34n/a "noddy",
35n/a "Example module that creates an extension type.",
36n/a -1,
37n/a NULL, NULL, NULL, NULL, NULL
38n/a};
39n/a
40n/aPyMODINIT_FUNC
41n/aPyInit_noddy(void)
42n/a{
43n/a PyObject* m;
44n/a
45n/a noddy_NoddyType.tp_new = PyType_GenericNew;
46n/a if (PyType_Ready(&noddy_NoddyType) < 0)
47n/a return NULL;
48n/a
49n/a m = PyModule_Create(&noddymodule);
50n/a if (m == NULL)
51n/a return NULL;
52n/a
53n/a Py_INCREF(&noddy_NoddyType);
54n/a PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType);
55n/a return m;
56n/a}