aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--python/nissy_module.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/python/nissy_module.c b/python/nissy_module.c
new file mode 100644
index 0000000..b627300
--- /dev/null
+++ b/python/nissy_module.c
@@ -0,0 +1,34 @@
1#define PY_SSIZE_T_CLEAN
2#include <Python.h>
3
4#include "../src/nissy.h"
5
6/* TODO from here */
7
8static PyObject *compose(PyObject *self, PyObject *args) {
9 const char *cube, *permutation;
10 char result[NISSY_SIZE_B32];
11
12 if (!PyArg_ParseTuple(args, "ss", &cube, &permutation))
13 return NULL;
14
15 nissy_compose(cube, permutation, result);
16 return PyUnicode_FromString(result);
17}
18
19static PyMethodDef NissyMethods[] = {
20 { "compose", compose, METH_VARARGS, "Compose two cubes." },
21 { NULL, NULL, 0, NULL }
22};
23
24static struct PyModuleDef nissy_python_module = {
25 PyModuleDef_HEAD_INIT,
26 "nissy",
27 NULL,
28 -1,
29 NissyMethods
30};
31
32PyMODINIT_FUNC PyInit_nissy_python_module(void) {
33 return PyModule_Create(&nissy_python_module);
34}

Generated with cgit - Back to sebastiano.tronto.net