Compare commits
14 Commits
b30aaa4c4e
...
python-ren
| Author | SHA1 | Date | |
|---|---|---|---|
| b959f8282a | |||
| 22efe4f8ca | |||
| f135b42d8a | |||
| 058564326b | |||
| fd1eac7fda | |||
| 391789b812 | |||
| 98483da759 | |||
| 2c91956b32 | |||
| aafcb162b7 | |||
| 232d025211 | |||
| 1fac7d7721 | |||
| ceeb67355d | |||
| ba51a437a4 | |||
| e461b0be1d |
@@ -30,7 +30,7 @@ Development is done with the following library versions:
|
||||
|
||||
| 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
|
||||
@subsection linux-build General Linux Build Instruction
|
||||
@@ -47,7 +47,7 @@ Once cmake has finished, type
|
||||
make
|
||||
@endcode
|
||||
to build the program and
|
||||
|
||||
|
||||
@code
|
||||
make documentation
|
||||
@endcode
|
||||
@@ -59,7 +59,7 @@ The subfolder 'AUR' contains a PKGBUILD file to build an Archlinux/Pacman packag
|
||||
|
||||
@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 |
|
||||
| ------- | ---------- |
|
||||
|
||||
@@ -80,6 +80,7 @@ enum gds_record {
|
||||
STRANS = 0x1A01,
|
||||
BOX = 0x2D00,
|
||||
LAYER = 0x0D02,
|
||||
DATATYPE = 0x0E02,
|
||||
WIDTH = 0x0F03,
|
||||
PATHTYPE = 0x2102,
|
||||
COLROW = 0x1302,
|
||||
@@ -867,6 +868,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
case LIBNAME:
|
||||
case SNAME:
|
||||
case LAYER:
|
||||
case DATATYPE:
|
||||
case STRNAME:
|
||||
break;
|
||||
default:
|
||||
@@ -1003,6 +1005,16 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
}
|
||||
GDS_INF("\t\tAdded layer %d\n", (int)current_graphics->layer);
|
||||
break;
|
||||
case DATATYPE:
|
||||
if (!current_graphics) {
|
||||
GDS_WARN("Datatype has to be defined inside graphics object. Probably unknown object. Implement it yourself!");
|
||||
break;
|
||||
}
|
||||
current_graphics->datatype = gds_convert_signed_int16(workbuff);
|
||||
if (current_graphics->datatype < 0)
|
||||
GDS_WARN("Datatype negative!");
|
||||
GDS_INF("\t\tAdded datatype %d\n", (int)current_graphics->datatype);
|
||||
break;
|
||||
case MAG:
|
||||
if (rec_data_length != 8) {
|
||||
GDS_WARN("Magnification is not an 8 byte real. Results may be wrong");
|
||||
|
||||
@@ -65,7 +65,7 @@ void vector_2d_rotate(struct vector_2d *vec, double angle)
|
||||
sin_val = sin(angle);
|
||||
cos_val = cos(angle);
|
||||
|
||||
vector_2d_copy(&temp, vec);
|
||||
(void)vector_2d_copy(&temp, vec);
|
||||
|
||||
/* Apply rotation matrix */
|
||||
vec->x = (cos_val * temp.x) - (sin_val * temp.y);
|
||||
|
||||
@@ -101,7 +101,7 @@ struct gds_graphics {
|
||||
enum path_type path_render_type; /**< @brief Line cap */
|
||||
int width_absolute; /**< @brief Width. Not used for objects other than paths */
|
||||
int16_t layer; /**< @brief Layer the graphic object is on */
|
||||
uint16_t datatype;
|
||||
int16_t datatype; /**< @brief Data type of graphic object */
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,10 +35,17 @@
|
||||
#include <gds-render/gds-utils/gds-types.h>
|
||||
|
||||
/**
|
||||
* @brief calculate_cell_bounding_box Calculate bounding box of gds cell
|
||||
* @param box Resulting boundig box. Will be uüdated and not overwritten
|
||||
* @brief Calculate bounding box of a gds cell.
|
||||
*
|
||||
* This function updates a given bounding box with the dimensions of a
|
||||
* gds_cell. Please note that the handling of path miter points is not complete yet.
|
||||
* If a path object is the outmost object of your cell at any edge,
|
||||
* the resulting bounding box might be the wrong size. The devistion from the real size
|
||||
* is guaranteed to be within the width of the path object.
|
||||
*
|
||||
* @param box Resulting boundig box. Will be updated and not overwritten
|
||||
* @param cell Toplevel cell
|
||||
* @warning Path handling not yet implemented correctly.
|
||||
* @warning Handling of Path graphic objects not yet implemented correctly.
|
||||
*/
|
||||
void calculate_cell_bounding_box(union bounding_box *box, struct gds_cell *cell);
|
||||
|
||||
|
||||
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 <gds-render/gds-utils/gds-types.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,
|
||||
};
|
||||
#include <python-renderer/glist.h>
|
||||
|
||||
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()
|
||||
{
|
||||
if (PyType_Ready(&GdsPointType) < 0)
|
||||
if (!PyType_Ready(&GListType))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@@ -79,16 +65,16 @@ static int gds_render_module_add_types(PyObject *module)
|
||||
{
|
||||
int err;
|
||||
|
||||
Py_INCREF(&GdsPointType);
|
||||
err = PyModule_AddObject(module, "GdsPoint", (PyObject *)&GdsPointType);
|
||||
Py_INCREF(&GListType);
|
||||
err = PyModule_AddObject(module, "GdsPoint", (PyObject *)&GListType);
|
||||
if (err < 0) {
|
||||
goto decref_gds_point;
|
||||
goto decref_glist;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
decref_gds_point:
|
||||
Py_DECREF(&GdsPointType);
|
||||
decref_glist:
|
||||
Py_DECREF(&GListType);
|
||||
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