gds-render/plugins/python-renderer/src/gds-render-module.c

57 lines
1.5 KiB
C

/*
* GDSII-Converter Python Plugin
* Copyright (C) 2019 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of GDSII-Converter.
*
* GDSII-Converter is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* GDSII-Converter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file gds-render-module.c
* @brief Gds-render python module implementation
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
#include <python-renderer/gds-render-module.h>
static PyObject *test(PyObject *self, PyObject *args)
{
long int i;
if(!PyArg_ParseTuple(args, "l:get_number", &i))
return NULL;
i *= 2;
return PyLong_FromLong(i);
}
static PyMethodDef gds_render_methods[] = {
{"get_number", test, METH_VARARGS, "Return the number of arguments received by the process."},
{NULL, NULL, 0, NULL}
};
static PyModuleDef gds_render_module = {
PyModuleDef_HEAD_INIT, "gds_render", NULL, -1, gds_render_methods,
NULL, NULL, NULL, NULL
};
PyObject *init_gds_render_module(void)
{
PyObject *this_module;
this_module = PyModule_Create(&gds_render_module);
return this_module;
}