python-cnorxz/cnorxz/core/core.cpp
2024-02-08 01:01:47 +01:00

41 lines
808 B
C++

#include <Python.h>
#include "array_wrapper.h"
#include "range_wrapper.h"
using namespace CNORXZ;
static PyModuleDef cnorxz_core_module = {
PyModuleDef_HEAD_INIT,
"cnorxz",
"cnorxz core module",
-1,
NULL, NULL, NULL, NULL, NULL
};
PyMODINIT_FUNC PyInit_cnorxz()
{
PyObject* m;
PyTypeObject* cxarray_type = PyCxArrayBType_init();
PyTypeObject* cxrange_type = PyCxRangeType_init();
if(cxarray_type == NULL){
return NULL;
}
if(cxrange_type == NULL){
return NULL;
}
m = PyModule_Create(&cnorxz_core_module);
if(m == NULL){
return NULL;
}
Py_INCREF(cxarray_type);
Py_INCREF(cxrange_type);
PyModule_AddObject(m, "Array", (PyObject*) cxarray_type);
PyModule_AddObject(m, "Range", (PyObject*) cxrange_type);
return m;
}