python-cnorxz/cnorxz/core/core.cpp

42 lines
808 B
C++
Raw Normal View History

#include <Python.h>
#include "array_wrapper.h"
2024-02-08 01:01:47 +01:00
#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;
2024-02-08 01:01:47 +01:00
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;
}
2024-02-08 01:01:47 +01:00
Py_INCREF(cxarray_type);
Py_INCREF(cxrange_type);
2024-02-08 01:01:47 +01:00
PyModule_AddObject(m, "Array", (PyObject*) cxarray_type);
PyModule_AddObject(m, "Range", (PyObject*) cxrange_type);
return m;
}