Compare commits
5 Commits
391789b812
...
b959f8282a
Author | SHA1 | Date | |
---|---|---|---|
b959f8282a | |||
22efe4f8ca | |||
f135b42d8a | |||
058564326b | |||
fd1eac7fda |
@@ -30,7 +30,7 @@ Development is done with the following library versions:
|
|||||||
|
|
||||||
| Cairographics | GLib2 | GTK3 |
|
| Cairographics | GLib2 | GTK3 |
|
||||||
| ------------- | ---------- | --------- |
|
| ------------- | ---------- | --------- |
|
||||||
| 1.17.3 | 2.60.6-1 | 3.24.10-1 |
|
| 1.17.2 | 2.64.2 | 3.24.18 |
|
||||||
|
|
||||||
@section comp-instr Compilation Instructions
|
@section comp-instr Compilation Instructions
|
||||||
@subsection linux-build General Linux Build Instruction
|
@subsection linux-build General Linux Build Instruction
|
||||||
@@ -59,7 +59,7 @@ The subfolder 'AUR' contains a PKGBUILD file to build an Archlinux/Pacman packag
|
|||||||
|
|
||||||
@subsection comp-warnings Compiler Warnings
|
@subsection comp-warnings Compiler Warnings
|
||||||
|
|
||||||
The compiler will throw the following warnings. Compiled with GCC 8.2.1.
|
The compiler will throw the following warnings. Compiled with GCC 9.3.0.
|
||||||
|
|
||||||
| Warning | Assessment |
|
| Warning | Assessment |
|
||||||
| ------- | ---------- |
|
| ------- | ---------- |
|
||||||
|
@@ -65,7 +65,7 @@ void vector_2d_rotate(struct vector_2d *vec, double angle)
|
|||||||
sin_val = sin(angle);
|
sin_val = sin(angle);
|
||||||
cos_val = cos(angle);
|
cos_val = cos(angle);
|
||||||
|
|
||||||
vector_2d_copy(&temp, vec);
|
(void)vector_2d_copy(&temp, vec);
|
||||||
|
|
||||||
/* Apply rotation matrix */
|
/* Apply rotation matrix */
|
||||||
vec->x = (cos_val * temp.x) - (sin_val * temp.y);
|
vec->x = (cos_val * temp.x) - (sin_val * temp.y);
|
||||||
|
50
plugins/python-renderer/include/python-renderer/glist.h
Normal file
50
plugins/python-renderer/include/python-renderer/glist.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* GDSII-Converter Python Plugin
|
||||||
|
* Copyright (C) 2020 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 python-renderer/glist.c
|
||||||
|
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup python-plugin-glist GList wrapper for python
|
||||||
|
* @ingroup python-plugin
|
||||||
|
* This is a wrapping class for GLists
|
||||||
|
* @addtogroup python-plugin-glist
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GLIST_H__
|
||||||
|
#define __GLIST_H__
|
||||||
|
|
||||||
|
#ifndef PY_SSIZE_T_CLEAN
|
||||||
|
#define PY_SSIZE_T_CLEAN
|
||||||
|
#endif
|
||||||
|
#include <Python.h>
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
extern PyTypeObject GListType;
|
||||||
|
|
||||||
|
typedef struct _GListObject GListObject;
|
||||||
|
|
||||||
|
void glist_set_head_ptr(GListObject *self, GList *head);
|
||||||
|
|
||||||
|
#endif /* __GLIST_H__ */
|
||||||
|
|
||||||
|
/** @} */
|
@@ -25,21 +25,7 @@
|
|||||||
|
|
||||||
#include <python-renderer/gds-render-module.h>
|
#include <python-renderer/gds-render-module.h>
|
||||||
#include <gds-render/gds-utils/gds-types.h>
|
#include <gds-render/gds-utils/gds-types.h>
|
||||||
|
#include <python-renderer/glist.h>
|
||||||
typedef struct {
|
|
||||||
PyObject_HEAD
|
|
||||||
/* TODO: Fill in type specific fields */
|
|
||||||
} GdsPointObject;
|
|
||||||
|
|
||||||
static PyTypeObject GdsPointType = {
|
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
|
||||||
.tp_name = GDS_RENDER_MOD_NAME ".GdsPoint",
|
|
||||||
.tp_doc = "2D Gds Database Point",
|
|
||||||
.tp_basicsize = sizeof(GdsPointObject),
|
|
||||||
.tp_itemsize = 0,
|
|
||||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
|
||||||
.tp_new = PyType_GenericNew,
|
|
||||||
};
|
|
||||||
|
|
||||||
static PyObject *test(PyObject *self, PyObject *args)
|
static PyObject *test(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
@@ -69,7 +55,7 @@ static PyModuleDef gds_render_module_def = {
|
|||||||
|
|
||||||
static int gds_render_module_check_types_ready()
|
static int gds_render_module_check_types_ready()
|
||||||
{
|
{
|
||||||
if (PyType_Ready(&GdsPointType) < 0)
|
if (!PyType_Ready(&GListType))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -79,16 +65,16 @@ static int gds_render_module_add_types(PyObject *module)
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
Py_INCREF(&GdsPointType);
|
Py_INCREF(&GListType);
|
||||||
err = PyModule_AddObject(module, "GdsPoint", (PyObject *)&GdsPointType);
|
err = PyModule_AddObject(module, "GdsPoint", (PyObject *)&GListType);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
goto decref_gds_point;
|
goto decref_glist;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
decref_gds_point:
|
decref_glist:
|
||||||
Py_DECREF(&GdsPointType);
|
Py_DECREF(&GListType);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
72
plugins/python-renderer/src/glist.c
Normal file
72
plugins/python-renderer/src/glist.c
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* GDSII-Converter Python Plugin
|
||||||
|
* Copyright (C) 2020 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 python-renderer/glist.c
|
||||||
|
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup python-plugin-glist GList wrapper for python
|
||||||
|
* @ingroup python-plugin
|
||||||
|
* This is a wrapping class for GLists
|
||||||
|
* This wrpper acts as a read only access to the lists
|
||||||
|
*
|
||||||
|
* @addtogroup python-plugin-glist
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <python-renderer/glist.h>
|
||||||
|
|
||||||
|
struct _GListObject {
|
||||||
|
PyObject_HEAD
|
||||||
|
GList *head;
|
||||||
|
size_t len;
|
||||||
|
};
|
||||||
|
|
||||||
|
static PyObject *glist_to_list(GListObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
|
{
|
||||||
|
return Py_BuildValue("");
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyMethodDef glist_methods[] = {
|
||||||
|
{"tolist", (PyCFunction)glist_to_list, METH_NOARGS, "Convert GList to editable list"}
|
||||||
|
};
|
||||||
|
|
||||||
|
void glist_set_head_ptr(GListObject *self, GList *head)
|
||||||
|
{
|
||||||
|
if (!self || !head)
|
||||||
|
return;
|
||||||
|
|
||||||
|
self->head = head;
|
||||||
|
self->len = g_list_length(self->head);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyTypeObject GListType = {
|
||||||
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
|
.tp_name = "gds_render.GList",
|
||||||
|
.tp_doc = "Read only GList",
|
||||||
|
.tp_basicsize = sizeof(GListObject),
|
||||||
|
.tp_itemsize = 0,
|
||||||
|
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||||
|
.tp_new = PyType_GenericNew,
|
||||||
|
.tp_methods = glist_methods
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @} */
|
Reference in New Issue
Block a user