Debian Codegraph @

tests/cmodule/cmodule.c

raw symbols SCIP
1 #include <Python.h>
2 #include <py3cairo.h>
3 #include "cmodulelib.h"
4
5 #ifdef __GNUC__
6 #define PYCAIRO_MODINIT_FUNC __attribute__((visibility("default"))) PyMODINIT_FUNC
7 #else
8 #define PYCAIRO_MODINIT_FUNC PyMODINIT_FUNC
9 #endif
10
11 static PyMethodDef cmod_functions[] = {
12 {"create_image_surface", create_image_surface, METH_NOARGS, NULL},
13 {"create_context", create_context, METH_NOARGS, NULL},
14 {"check_status", check_status, METH_VARARGS, NULL},
15 {"test_capi", test_capi, METH_NOARGS, NULL},
16 {NULL, NULL, 0, NULL}};
17
18 static int exec_cmod(PyObject *m)
19 {
20 if (import_cairo() < 0) {
21 return -1;
22 }
23 return 0;
24 }
25
26 static PyModuleDef_Slot cmod_slots[] = {
27 {Py_mod_exec, exec_cmod},
28 #if PY_VERSION_HEX >= 0x030D0000
29 {Py_mod_gil, Py_MOD_GIL_NOT_USED},
30 #endif
31 {0, NULL}};
32
33 static struct PyModuleDef cmod_module = {
34 PyModuleDef_HEAD_INIT,
35 "cmod",
36 NULL,
37 0,
38 cmod_functions,
39 cmod_slots,
40 NULL,
41 NULL,
42 NULL};
43
44 PYCAIRO_MODINIT_FUNC PyInit_cmod(void)
45 {
46 return PyModuleDef_Init(&cmod_module);
47 }