2018-07-24 14:42:28 +02:00
/*
* GDSII - Converter
* Copyright ( C ) 2018 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 - types . h
* @ brief Defines types and macros used by the GDS - Parser
* @ author Mario Hüttel < mario . huettel @ gmx . net >
*/
/**
2019-03-05 19:38:07 +01:00
* @ addtogroup GDS - Utilities
2018-07-24 14:42:28 +02:00
* @ {
*/
2018-05-22 16:18:28 +02:00
# ifndef __GDS_TYPES_H__
# define __GDS_TYPES_H__
# include <stdint.h>
# include <glib.h>
2018-07-24 14:42:28 +02:00
# define CELL_NAME_MAX (100) /**< @brief Maximum length of a gds_cell::name or a gds_library::name */
2019-03-05 19:48:03 +01:00
/* Maybe use the macros that ship with the compiler? */
2018-07-27 21:00:30 +02:00
# define MIN(a,b) (((a) < (b)) ? (a) : (b)) /**< @brief Return smaller number */
# define MAX(a,b) (((a) > (b)) ? (a) : (b)) /**< @brief Return bigger number */
2018-05-22 16:18:28 +02:00
2019-03-05 20:08:10 +01:00
/** @brief Defintion of check counter default value
* that indicates that the corresponding check has not yet been executed */
enum { GDS_CELL_CHECK_NOT_RUN = - 1 } ;
2018-07-24 14:42:28 +02:00
/** @brief Types of graphic objects */
enum graphics_type
{
GRAPHIC_PATH = 0 , /**< @brief Path. Esentially a line */
GRAPHIC_POLYGON = 1 , /**< @brief An arbitrary polygon */
GRAPHIC_BOX = 2 /**< @brief A rectangle. @warning Implementation in renderers might be buggy!*/
} ;
/**
* @ brief Defines the line caps of a path
*/
enum path_type { PATH_FLUSH = 0 , PATH_ROUNDED = 1 , PATH_SQUARED = 2 } ; /**< Path line caps */
2018-05-22 16:18:28 +02:00
2018-07-24 14:42:28 +02:00
/**
* @ brief A point in the 2 D plane . Sometimes references as vertex
*/
2018-07-04 09:49:04 +02:00
struct gds_point {
int x ;
int y ;
2018-05-22 16:18:28 +02:00
} ;
2019-03-05 19:48:03 +01:00
/**
* @ brief Stores the result of the cell checks .
*/
struct gds_cell_checks {
2019-03-05 20:08:10 +01:00
int unresolved_child_count ; /**< @brief Number of unresolved cell instances inside this cell. Default: GDS_CELL_CHECK_NOT_RUN */
int affected_by_reference_loop ; /**< @brief 1 if the cell is affected by a reference loop and therefore not renderable. Default: GDS_CELL_CHECK_NOT_RUN*/
2019-03-05 19:48:03 +01:00
/**
* @ brief For the internal use of the checker .
* @ warning Do not use this structure and its contents !
*/
struct _check_internals {
int marker ;
} _internal ;
} ;
2018-07-24 14:42:28 +02:00
/**
* @ brief Date information for cells and libraries
*/
2018-07-04 09:49:04 +02:00
struct gds_time_field {
uint16_t year ;
uint16_t month ;
uint16_t day ;
uint16_t hour ;
uint16_t minute ;
uint16_t second ;
2018-05-22 16:18:28 +02:00
} ;
2018-07-24 14:42:28 +02:00
/**
* @ brief A GDS graphics object
*/
2018-05-22 16:18:28 +02:00
struct gds_graphics {
2018-07-24 14:42:28 +02:00
enum graphics_type gfx_type ; /**< \brief Type of graphic */
GList * vertices ; /**< @brief List of #gds_point */
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 */
2018-07-04 09:49:04 +02:00
uint16_t datatype ;
2018-05-22 16:18:28 +02:00
} ;
2018-07-24 14:42:28 +02:00
/**
* @ brief This represents an instanc of a cell inside another cell
*/
2018-05-22 16:18:28 +02:00
struct gds_cell_instance {
2018-07-24 14:42:28 +02:00
char ref_name [ CELL_NAME_MAX ] ; /**< @brief Name of referenced cell */
struct gds_cell * cell_ref ; /**< @brief Referenced gds_cell structure */
struct gds_point origin ; /**< @brief Origin */
int flipped ; /**< @brief Mirrored on x-axis before rotation */
double angle ; /**< @brief Angle of rotation (counter clockwise) in degrees */
double magnification ; /**< @brief magnification */
2018-05-22 16:18:28 +02:00
} ;
2018-07-24 14:42:28 +02:00
/**
* @ brief A Cell inside a gds_library
*/
2018-05-22 16:18:28 +02:00
struct gds_cell {
2018-07-04 09:49:04 +02:00
char name [ CELL_NAME_MAX ] ;
struct gds_time_field mod_time ;
struct gds_time_field access_time ;
2018-07-24 14:42:28 +02:00
GList * child_cells ; /**< @brief List of #gds_cell_instance elements */
GList * graphic_objs ; /**< @brief List of #gds_graphics */
2019-02-27 21:30:41 +01:00
struct gds_library * parent_library ; /**< @brief Pointer to parent library */
2019-03-05 19:48:03 +01:00
struct gds_cell_checks checks ; /**< @brief Checking results */
2018-05-22 16:18:28 +02:00
} ;
2018-07-24 14:42:28 +02:00
/**
* @ brief GDS Toplevel library
*/
2018-05-22 16:18:28 +02:00
struct gds_library {
2018-07-04 09:49:04 +02:00
char name [ CELL_NAME_MAX ] ;
struct gds_time_field mod_time ;
struct gds_time_field access_time ;
2018-12-22 19:11:09 +01:00
double unit_in_meters ; /**< Length of a database unit in meters */
2018-07-24 14:42:28 +02:00
GList * cells ; /**< List of #gds_cell that contains all cells in this library*/
GList * cell_names /**< List of strings that contains all cell names */ ;
2018-05-22 16:18:28 +02:00
} ;
2018-07-24 14:42:28 +02:00
/** @} */
2018-05-22 16:18:28 +02:00
# endif /* __GDS_TYPES_H__ */