123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- /** @file lsup_rdf_mod.c
- *
- * @brief LSUP_RDF package.
- *
- * This "package" module includes all RDF modules in a monolithic compiled
- * object, in order to resolve internal symbol dependencies. Individual modules
- * are extracted and exposed by the package __init__.py .
- */
- #define PY_SSIZE_T_CLEAN
- #include <Python.h>
- #include "py_graph.h"
- static PyModuleDef lsup_rdf_pkg = {
- PyModuleDef_HEAD_INIT,
- .m_name = "lsup_rdf",
- .m_doc = "Lakesuperior RDF package.",
- .m_size = -1,
- };
- PyMODINIT_FUNC
- PyInit__lsup_rdf (void)
- { return PyModule_Create (&lsup_rdf_pkg); }
- PyModuleDef term_mod = {
- PyModuleDef_HEAD_INIT,
- .m_name = "term",
- .m_doc = "RDF term module.",
- .m_size = -1,
- };
- PyMODINIT_FUNC
- PyInit_term()
- {
- if (PyType_Ready (&TermType) < 0) return NULL;
- PyObject *m = PyModule_Create(&term_mod);
- if (m == NULL) return NULL;
- #define ENTRY(a, b) \
- if (PyModule_AddIntConstant (m, "TERM_" #a, b) < 0) return NULL;
- TTYPE_TBL
- #undef ENTRY
- Py_INCREF(&TermType);
- if (PyModule_AddObject(m, "Term", (PyObject *) &TermType) < 0) {
- Py_DECREF(&TermType);
- Py_DECREF(m);
- return NULL;
- }
- return m;
- }
- PyModuleDef triple_mod = {
- PyModuleDef_HEAD_INIT,
- .m_name = "triple",
- .m_doc = "RDF triple module.",
- .m_size = -1,
- };
- PyMODINIT_FUNC
- PyInit_triple()
- {
- if (PyType_Ready (&TripleType) < 0) return NULL;
- PyObject *m = PyModule_Create(&triple_mod);
- if (m == NULL) return NULL;
- Py_INCREF(&TripleType);
- if (PyModule_AddObject(m, "Triple", (PyObject *) &TripleType) < 0) {
- Py_DECREF(&TripleType);
- Py_DECREF(m);
- return NULL;
- }
- return m;
- }
- static PyModuleDef graph_mod = {
- PyModuleDef_HEAD_INIT,
- .m_name = "graph",
- .m_doc = "RDF graph module.",
- .m_size = -1,
- };
- PyMODINIT_FUNC
- PyInit_graph()
- {
- if (PyType_Ready (&GraphType) < 0) return NULL;
- PyObject *m = PyModule_Create(&graph_mod);
- if (m == NULL) return NULL;
- #define ENTRY(a, b) \
- if (PyModule_AddIntConstant (m, "STORE_" #a, b) < 0) return NULL;
- BACKEND_TBL
- #undef ENTRY
- Py_INCREF(&GraphType);
- if (PyModule_AddObject(m, "Graph", (PyObject *) &GraphType) < 0) {
- Py_DECREF(&GraphType);
- Py_DECREF(m);
- return NULL;
- }
- return m;
- }
|