| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "functions.h" | ||
| 2 | #include <Python.h> | ||
| 3 | |||
| 4 | /* | ||
| 5 | - https://docs.python.org/3/extending/extending.html | ||
| 6 | */ | ||
| 7 | |||
| 8 | static PyMethodDef module_methods[] = { | ||
| 9 | {"title_case", py_convert, METH_VARARGS, | ||
| 10 | "Converts the given string formatted as a headline"}, | ||
| 11 | {"get_library_build_date", py_date, METH_NOARGS, | ||
| 12 | "Returns the build date of the module as a string."}, | ||
| 13 | {NULL, NULL, 0, NULL}}; | ||
| 14 | |||
| 15 | // defines MODULE name | ||
| 16 | static struct PyModuleDef func_module = { | ||
| 17 | PyModuleDef_HEAD_INIT, | ||
| 18 | "text_conversion", | ||
| 19 | "A module providing conversion functionality.", | ||
| 20 | -1, | ||
| 21 | module_methods, | ||
| 22 | NULL, | ||
| 23 | NULL, | ||
| 24 | NULL, | ||
| 25 | NULL}; | ||
| 26 | |||
| 27 | // has to be named PyInit_MODULE | ||
| 28 | 1 | PyMODINIT_FUNC PyInit_text_conversion(void) | |
| 29 | { | ||
| 30 | 1 | return PyModule_Create(&func_module); | |
| 31 | } | ||
| 32 |