GDS-Render v1.2.1
GDS-Utilities

Data Structures

struct  gds_cell_array_instance
 Struct representing an array instantiation. More...
 
struct  gds_point
 A point in the 2D plane. Sometimes referred to as vertex. More...
 
struct  gds_cell_checks
 Stores the result of the cell checks. More...
 
struct  gds_time_field
 Date information for cells and libraries. More...
 
struct  gds_graphics
 A GDS graphics object. More...
 
struct  gds_cell_instance
 This represents an instanc of a cell inside another cell. More...
 
struct  gds_cell
 A Cell inside a gds_library. More...
 
struct  gds_library
 GDS Toplevel library. More...
 

Macros

#define GDS_DEFAULT_UNITS   (10E-9)
 Default units assumed for library. More...
 
#define GDS_ERROR(fmt, ...)   printf("[PARSE_ERROR] " fmt "\n", ##__VA_ARGS__)
 Print GDS error. More...
 
#define GDS_WARN(fmt, ...)   printf("[PARSE_WARNING] " fmt "\n", ##__VA_ARGS__)
 Print GDS warning. More...
 
#define GDS_INF(fmt, ...)
 
#define GDS_PRINT_DEBUG_INFOS   (0)
 1: Print infos, 0: Don't print More...
 
#define CELL_NAME_MAX   (100)
 Maximum length of a gds_cell::name or a gds_library::name. More...
 
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
 Return smaller number. More...
 
#define MAX(a, b)   (((a) > (b)) ? (a) : (b))
 Return bigger number. More...
 

Enumerations

enum  gds_record {
  INVALID = 0x0000 , HEADER = 0x0002 , BGNLIB = 0x0102 , LIBNAME = 0x0206 ,
  UNITS = 0x0305 , ENDLIB = 0x0400 , BGNSTR = 0x0502 , STRNAME = 0x0606 ,
  ENDSTR = 0x0700 , BOUNDARY = 0x0800 , PATH = 0x0900 , SREF = 0x0A00 ,
  ENDEL = 0x1100 , XY = 0x1003 , MAG = 0x1B05 , ANGLE = 0x1C05 ,
  SNAME = 0x1206 , STRANS = 0x1A01 , BOX = 0x2D00 , LAYER = 0x0D02 ,
  DATATYPE = 0x0E02 , WIDTH = 0x0F03 , PATHTYPE = 0x2102 , COLROW = 0x1302 ,
  AREF = 0x0B00
}
 
enum  { GDS_CELL_CHECK_NOT_RUN = -1 }
 Defintion of check counter default value that indicates that the corresponding check has not yet been executed. More...
 
enum  graphics_type { GRAPHIC_PATH = 0 , GRAPHIC_POLYGON = 1 , GRAPHIC_BOX = 2 }
 Types of graphic objects. More...
 
enum  path_type { PATH_FLUSH = 0 , PATH_ROUNDED = 1 , PATH_SQUARED = 2 }
 Defines the line caps of a path. More...
 

Functions

static int name_cell_ref (struct gds_cell_instance *cell_inst, unsigned int bytes, char *data)
 Name cell reference. More...
 
static int name_array_cell_ref (struct gds_cell_array_instance *cell_inst, unsigned int bytes, char *data)
 Name cell reference. More...
 
static double gds_convert_double (const char *data)
 Convert GDS 8-byte real to double. More...
 
static signed int gds_convert_signed_int (const char *data)
 Convert GDS INT32 to int. More...
 
static int16_t gds_convert_signed_int16 (const char *data)
 Convert GDS INT16 to int16. More...
 
static uint16_t gds_convert_unsigned_int16 (const char *data)
 Convert GDS UINT16 String to uint16. More...
 
static GList * append_library (GList *curr_list, struct gds_library **library_ptr)
 Append library to list. More...
 
static GList * prepend_graphics (GList *curr_list, enum graphics_type type, struct gds_graphics **graphics_ptr)
 Prepend graphics to list. More...
 
static GList * append_vertex (GList *curr_list, int x, int y)
 Appends vertext List. More...
 
static GList * append_cell (GList *curr_list, struct gds_cell **cell_ptr)
 append_cell Append a gds_cell to a list More...
 
static GList * append_cell_ref (GList *curr_list, struct gds_cell_instance **instance_ptr)
 Append a cell reference to the reference GList. More...
 
static int name_library (struct gds_library *current_library, unsigned int bytes, char *data)
 Name a gds_library. More...
 
static int name_cell (struct gds_cell *cell, unsigned int bytes, char *data, struct gds_library *lib)
 Names a gds_cell. More...
 
static void parse_reference_list (gpointer gcell_ref, gpointer glibrary)
 Search for cell reference gcell_ref in glibrary. More...
 
static void scan_cell_reference_dependencies (gpointer gcell, gpointer library)
 Scans cell references inside cell This function searches all the references in gcell and updates the gds_cell_instance::cell_ref field in each instance. More...
 
static void scan_library_references (gpointer library_list_item, gpointer user)
 Scans library's cell references. More...
 
static void gds_parse_date (const char *buffer, int length, struct gds_time_field *mod_date, struct gds_time_field *access_date)
 gds_parse_date More...
 
static void convert_aref_to_sref (struct gds_cell_array_instance *aref, struct gds_cell *container_cell)
 Convert AREF to a bunch of SREFs and append them to container_cell. More...
 
int parse_gds_from_file (const char *filename, GList **library_array)
 Parse a GDS file. More...
 
static void delete_cell_inst_element (struct gds_cell_instance *cell_inst)
 delete_cell_inst_element More...
 
static void delete_vertex (struct gds_point *vertex)
 delete_vertex More...
 
static void delete_graphics_obj (struct gds_graphics *gfx)
 delete_graphics_obj More...
 
static void delete_cell_element (struct gds_cell *cell)
 delete_cell_element More...
 
static void delete_library_element (struct gds_library *lib)
 delete_library_element More...
 
int clear_lib_list (GList **library_list)
 Deletes all libraries including cells, references etc. More...
 
int gds_tree_check_cell_references (struct gds_library *lib)
 gds_tree_check_cell_references checks if all child cell references can be resolved in the given library More...
 
static int gds_tree_check_list_contains_cell (GList *list, struct gds_cell *cell)
 Check if list contains a cell. More...
 
static int gds_tree_check_iterate_ref_and_check (struct gds_cell *cell_to_check, GList **visited_cells)
 This function follows down the reference list of a cell and marks each visited subcell and detects loops. More...
 
int gds_tree_check_reference_loops (struct gds_library *lib)
 gds_tree_check_reference_loops checks if the given library contains reference loops More...
 

Detailed Description

Macro Definition Documentation

◆ CELL_NAME_MAX

#define CELL_NAME_MAX   (100)

Maximum length of a gds_cell::name or a gds_library::name.

Definition at line 37 of file gds-types.h.

◆ GDS_DEFAULT_UNITS

#define GDS_DEFAULT_UNITS   (10E-9)

Default units assumed for library.

Note
This value is usually overwritten with the value defined in the library.

Definition at line 51 of file gds-parser.c.

◆ GDS_ERROR

#define GDS_ERROR (   fmt,
  ... 
)    printf("[PARSE_ERROR] " fmt "\n", ##__VA_ARGS__)

Print GDS error.

Definition at line 53 of file gds-parser.c.

◆ GDS_INF

#define GDS_INF (   fmt,
  ... 
)

Definition at line 60 of file gds-parser.c.

◆ GDS_PRINT_DEBUG_INFOS

#define GDS_PRINT_DEBUG_INFOS   (0)

1: Print infos, 0: Don't print

Definition at line 38 of file gds-parser.h.

◆ GDS_WARN

#define GDS_WARN (   fmt,
  ... 
)    printf("[PARSE_WARNING] " fmt "\n", ##__VA_ARGS__)

Print GDS warning.

Definition at line 54 of file gds-parser.c.

◆ MAX

#define MAX (   a,
 
)    (((a) > (b)) ? (a) : (b))

Return bigger number.

Definition at line 41 of file gds-types.h.

◆ MIN

#define MIN (   a,
 
)    (((a) < (b)) ? (a) : (b))

Return smaller number.

Definition at line 40 of file gds-types.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Defintion of check counter default value that indicates that the corresponding check has not yet been executed.

Enumerator
GDS_CELL_CHECK_NOT_RUN 

Definition at line 45 of file gds-types.h.

◆ gds_record

enum gds_record
Enumerator
INVALID 
HEADER 
BGNLIB 
LIBNAME 
UNITS 
ENDLIB 
BGNSTR 
STRNAME 
ENDSTR 
BOUNDARY 
PATH 
SREF 
ENDEL 
XY 
MAG 
ANGLE 
SNAME 
STRANS 
BOX 
LAYER 
DATATYPE 
WIDTH 
PATHTYPE 
COLROW 
AREF 

Definition at line 62 of file gds-parser.c.

◆ graphics_type

Types of graphic objects.

Enumerator
GRAPHIC_PATH 

Path. Esentially a line.

GRAPHIC_POLYGON 

An arbitrary polygon.

GRAPHIC_BOX 

A rectangle.

Warning
Implementation in renderers might be buggy!

Definition at line 48 of file gds-types.h.

◆ path_type

enum path_type

Defines the line caps of a path.

Enumerator
PATH_FLUSH 
PATH_ROUNDED 
PATH_SQUARED 

Definition at line 58 of file gds-types.h.

Function Documentation

◆ append_cell()

static GList * append_cell ( GList *  curr_list,
struct gds_cell **  cell_ptr 
)
static

append_cell Append a gds_cell to a list

Usage similar to append_cell_ref().

Parameters
curr_listList containing gds_cell elements. May be NULL
cell_ptrnewly created cell
Returns
new pointer to list

Definition at line 344 of file gds-parser.c.

Here is the caller graph for this function:

◆ append_cell_ref()

static GList * append_cell_ref ( GList *  curr_list,
struct gds_cell_instance **  instance_ptr 
)
static

Append a cell reference to the reference GList.

Appends a new gds_cell_instance to curr_list and returns the new element via instance_ptr

Parameters
curr_listList of gds_cell_instance elements. May be NULL
instance_ptrnewly created element
Returns
new GList pointer

Definition at line 373 of file gds-parser.c.

Here is the caller graph for this function:

◆ append_library()

static GList * append_library ( GList *  curr_list,
struct gds_library **  library_ptr 
)
static

Append library to list.

Parameters
curr_listList containing gds_library elements. May be NULL.
library_ptrReturn of newly created library.
Returns
Newly created list pointer

Definition at line 269 of file gds-parser.c.

Here is the caller graph for this function:

◆ append_vertex()

static GList * append_vertex ( GList *  curr_list,
int  x,
int  y 
)
static

Appends vertext List.

Parameters
curr_listList containing gds_point elements. May be NULL.
xx-coordinate of new point
yy-coordinate of new point
Returns
new Pointer to List.

Definition at line 323 of file gds-parser.c.

Here is the caller graph for this function:

◆ clear_lib_list()

int clear_lib_list ( GList **  library_list)

Deletes all libraries including cells, references etc.

Parameters
library_listPointer to a list of gds_library. Is set to NULL after completion.
Returns
0

Definition at line 1146 of file gds-parser.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_aref_to_sref()

static void convert_aref_to_sref ( struct gds_cell_array_instance aref,
struct gds_cell container_cell 
)
static

Convert AREF to a bunch of SREFs and append them to container_cell.

This function converts a single array reference (aref) to gds_cell_array_instance::rows * gds_cell_array_instance::columns single references (SREFs). See gds_cell_instance.

Both gds_cell_array_instance::rows and gds_cell_array_instance::columns must be larger than zero.

Parameters
[in]arefArray reference to parse
[in]container_cellcell to add the converted single references to.

Definition at line 575 of file gds-parser.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete_cell_element()

static void delete_cell_element ( struct gds_cell cell)
static

delete_cell_element

Parameters
cell

Definition at line 1122 of file gds-parser.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete_cell_inst_element()

static void delete_cell_inst_element ( struct gds_cell_instance cell_inst)
static

delete_cell_inst_element

Parameters
cell_inst

Definition at line 1089 of file gds-parser.c.

Here is the caller graph for this function:

◆ delete_graphics_obj()

static void delete_graphics_obj ( struct gds_graphics gfx)
static

delete_graphics_obj

Parameters
gfx

Definition at line 1109 of file gds-parser.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete_library_element()

static void delete_library_element ( struct gds_library lib)
static

delete_library_element

Parameters
lib

Definition at line 1136 of file gds-parser.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete_vertex()

static void delete_vertex ( struct gds_point vertex)
static

delete_vertex

Parameters
vertex

Definition at line 1099 of file gds-parser.c.

Here is the caller graph for this function:

◆ gds_convert_double()

static double gds_convert_double ( const char *  data)
static

Convert GDS 8-byte real to double.

Parameters
data8 Byte GDS real
Returns
result

Definition at line 172 of file gds-parser.c.

Here is the caller graph for this function:

◆ gds_convert_signed_int()

static signed int gds_convert_signed_int ( const char *  data)
static

Convert GDS INT32 to int.

Parameters
dataBuffer containing the int
Returns
result

Definition at line 217 of file gds-parser.c.

Here is the caller graph for this function:

◆ gds_convert_signed_int16()

static int16_t gds_convert_signed_int16 ( const char *  data)
static

Convert GDS INT16 to int16.

Parameters
dataBuffer containing the INT16
Returns
result

Definition at line 238 of file gds-parser.c.

Here is the caller graph for this function:

◆ gds_convert_unsigned_int16()

static uint16_t gds_convert_unsigned_int16 ( const char *  data)
static

Convert GDS UINT16 String to uint16.

Parameters
dataBuffer containing the uint16
Returns
result

Definition at line 253 of file gds-parser.c.

Here is the caller graph for this function:

◆ gds_parse_date()

static void gds_parse_date ( const char *  buffer,
int  length,
struct gds_time_field mod_date,
struct gds_time_field access_date 
)
static

gds_parse_date

Parameters
bufferBuffer that contains the GDS Date field
lengthLength of buffer
mod_dateModification Date
access_dateLast Access Date

Definition at line 530 of file gds-parser.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gds_tree_check_cell_references()

int gds_tree_check_cell_references ( struct gds_library lib)

gds_tree_check_cell_references checks if all child cell references can be resolved in the given library

This function will only mark cells that directly contain unresolved references.

If a cell contains a reference to a cell with unresolved references, it is not flagged.

Parameters
libThe GDS library to check
Returns
less than 0 if an error occured during processing; 0 if all child cells could be resolved; greater than zero if the processing was successful but not all cell references could be resolved. In this case the number of unresolved references is returned

Definition at line 40 of file gds-tree-checker.c.

Here is the caller graph for this function:

◆ gds_tree_check_iterate_ref_and_check()

static int gds_tree_check_iterate_ref_and_check ( struct gds_cell cell_to_check,
GList **  visited_cells 
)
static

This function follows down the reference list of a cell and marks each visited subcell and detects loops.

Parameters
cell_to_checkThe cell to check for reference loops
visited_cellsPointer to list head. May be zero.
Returns
0 if no loops exist; error in processing: <0; loop found: >0

Definition at line 111 of file gds-tree-checker.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gds_tree_check_list_contains_cell()

static int gds_tree_check_list_contains_cell ( GList *  list,
struct gds_cell cell 
)
static

Check if list contains a cell.

Parameters
listGList to check. May be a null pointer
cellCell to check for
Returns
0 if cell is not in list. 1 if cell is in list

Definition at line 93 of file gds-tree-checker.c.

Here is the caller graph for this function:

◆ gds_tree_check_reference_loops()

int gds_tree_check_reference_loops ( struct gds_library lib)

gds_tree_check_reference_loops checks if the given library contains reference loops

Parameters
libGDS library
Returns
negative if an error occured, zero if there are no reference loops, else a positive number representing the number of affected cells

Definition at line 158 of file gds-tree-checker.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ name_array_cell_ref()

static int name_array_cell_ref ( struct gds_cell_array_instance cell_inst,
unsigned int  bytes,
char *  data 
)
static

Name cell reference.

Parameters
cell_instCell reference
bytesLength of name
dataName
Returns
0 if successful

Definition at line 144 of file gds-parser.c.

Here is the caller graph for this function:

◆ name_cell()

static int name_cell ( struct gds_cell cell,
unsigned int  bytes,
char *  data,
struct gds_library lib 
)
static

Names a gds_cell.

Parameters
cellCell to name
bytesLength of name
dataName
libLibrary in which cell is located
Returns
0 id successful

Definition at line 432 of file gds-parser.c.

Here is the caller graph for this function:

◆ name_cell_ref()

static int name_cell_ref ( struct gds_cell_instance cell_inst,
unsigned int  bytes,
char *  data 
)
static

Name cell reference.

Parameters
cell_instCell reference
bytesLength of name
dataName
Returns
0 if successful

Definition at line 114 of file gds-parser.c.

Here is the caller graph for this function:

◆ name_library()

static int name_library ( struct gds_library current_library,
unsigned int  bytes,
char *  data 
)
static

Name a gds_library.

Parameters
current_libraryLibrary to name
bytesLenght of name
dataName
Returns
0 if successful

Definition at line 401 of file gds-parser.c.

Here is the caller graph for this function:

◆ parse_gds_from_file()

int parse_gds_from_file ( const char *  filename,
GList **  library_array 
)

Parse a GDS file.

This function parses a GDS File and creates a list of libraries, which then contain the different cells.

The function appends The detected libraries to the library_array list. The library array may be empty, meaning *library_list may be NULL.

Parameters
[in]filenamePath to the GDS file
[in,out]library_arrayGList Pointer.
Returns
0 if successful

Definition at line 620 of file gds-parser.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_reference_list()

static void parse_reference_list ( gpointer  gcell_ref,
gpointer  glibrary 
)
static

Search for cell reference gcell_ref in glibrary.

Search cell referenced by gcell_ref inside glibrary and update gds_cell_instance::cell_ref with found gds_cell

Parameters
gcell_refgpointer cast of struct gds_cell_instance *
glibrarygpointer cast of struct gds_library *

Definition at line 464 of file gds-parser.c.

Here is the caller graph for this function:

◆ prepend_graphics()

static GList * prepend_graphics ( GList *  curr_list,
enum graphics_type  type,
struct gds_graphics **  graphics_ptr 
)
static

Prepend graphics to list.

Parameters
curr_listList containing gds_graphics elements. May be NULL
typeType of graphics
graphics_ptrnewly created graphic is written here
Returns
new list pointer

Definition at line 294 of file gds-parser.c.

Here is the caller graph for this function:

◆ scan_cell_reference_dependencies()

static void scan_cell_reference_dependencies ( gpointer  gcell,
gpointer  library 
)
static

Scans cell references inside cell This function searches all the references in gcell and updates the gds_cell_instance::cell_ref field in each instance.

Parameters
gcellpointer cast of gds_cell *
libraryLibrary where the cell references are searched in

Definition at line 496 of file gds-parser.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scan_library_references()

static void scan_library_references ( gpointer  library_list_item,
gpointer  user 
)
static

Scans library's cell references.

This function searches all the references between cells and updates the gds_cell_instance::cell_ref field in each instance

Parameters
library_list_itemList containing gds_library elements
usernot used

Definition at line 514 of file gds-parser.c.

Here is the call graph for this function:
Here is the caller graph for this function: