Compare commits
No commits in common. "d81c6d1037278f78653874875a9a9e49d2f1ac2f" and "3882f3944e8e427ad55409b7ec9244514aa8136f" have entirely different histories.
d81c6d1037
...
3882f3944e
@ -35,7 +35,6 @@
|
||||
#include "cairo-output/cairo-output.h"
|
||||
#include "latex-output/latex-output.h"
|
||||
#include "external-renderer.h"
|
||||
#include "gds-parser/gds-tree-checker.h"
|
||||
|
||||
/**
|
||||
* @brief Delete layer_info and free nem element.
|
||||
@ -70,10 +69,8 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
|
||||
GList *layer_info_list = NULL;
|
||||
GList *cell_list;
|
||||
struct layer_info *linfo_temp;
|
||||
struct gds_library *first_lib;
|
||||
struct gds_cell *toplevel_cell = NULL, *temp_cell;
|
||||
|
||||
|
||||
/* Check if parameters are valid */
|
||||
if (!gds_name || (!pdf_name && pdf) || (!tex_name && tex) || !layer_file || !cell_name) {
|
||||
printf("Probably missing argument. Check --help option\n");
|
||||
@ -84,14 +81,14 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
|
||||
clear_lib_list(&libs);
|
||||
res = parse_gds_from_file(gds_name, &libs);
|
||||
if (res)
|
||||
goto ret_destroy_library_list;
|
||||
return;
|
||||
|
||||
file = g_file_new_for_path(layer_file);
|
||||
stream = g_file_read(file, NULL, NULL);
|
||||
|
||||
if (!stream) {
|
||||
printf("Layer mapping not readable!\n");
|
||||
goto ret_destroy_file;
|
||||
goto destroy_file;
|
||||
}
|
||||
dstream = g_data_input_stream_new(G_INPUT_STREAM(stream));
|
||||
i = 0;
|
||||
@ -103,7 +100,7 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
|
||||
linfo_temp = (struct layer_info *)malloc(sizeof(struct layer_info));
|
||||
if (!linfo_temp) {
|
||||
printf("Out of memory\n");
|
||||
goto ret_clear_layer_list;
|
||||
goto ret_clear_list;
|
||||
}
|
||||
linfo_temp->color.alpha = layer_color.alpha;
|
||||
linfo_temp->color.red = layer_color.red;
|
||||
@ -119,15 +116,9 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
|
||||
|
||||
/* find_cell in first library. */
|
||||
if (!libs)
|
||||
goto ret_clear_layer_list;
|
||||
goto ret_clear_list;
|
||||
|
||||
first_lib = (struct gds_library *)libs->data;
|
||||
if (!first_lib) {
|
||||
fprintf(stderr, "No library in library list. This should not happen.\n");
|
||||
goto ret_clear_layer_list;
|
||||
}
|
||||
|
||||
for (cell_list = first_lib->cells; cell_list != NULL; cell_list = g_list_next(cell_list)) {
|
||||
for (cell_list = ((struct gds_library *)libs->data)->cells; cell_list != NULL; cell_list = g_list_next(cell_list)) {
|
||||
temp_cell = (struct gds_cell *)cell_list->data;
|
||||
if (!strcmp(temp_cell->name, cell_name)) {
|
||||
toplevel_cell = temp_cell;
|
||||
@ -137,31 +128,9 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
|
||||
|
||||
if (!toplevel_cell) {
|
||||
printf("Couldn't find cell in first library!\n");
|
||||
goto ret_clear_layer_list;
|
||||
goto ret_clear_list;
|
||||
}
|
||||
|
||||
/* Check if cell passes vital checks */
|
||||
res = gds_tree_check_reference_loops(toplevel_cell->parent_library);
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "Checking library %s failed.\n", first_lib->name);
|
||||
goto ret_clear_layer_list;
|
||||
} else if (res > 0) {
|
||||
fprintf(stderr, "%d reference loops found.\n", res);
|
||||
|
||||
/* do further checking if the specified cell and/or its subcells are affected */
|
||||
if (toplevel_cell->checks.affected_by_reference_loop == 1) {
|
||||
fprintf(stderr, "Cell is affected by reference loop. Abort!\n");
|
||||
goto ret_clear_layer_list;
|
||||
}
|
||||
}
|
||||
|
||||
if (toplevel_cell->checks.affected_by_reference_loop == GDS_CELL_CHECK_NOT_RUN)
|
||||
fprintf(stderr, "Cell was not checked. This should not happen. Please report this issue. Will continue either way.\n");
|
||||
|
||||
/* Note: unresolved references are not an abort condition.
|
||||
* Deal with it.
|
||||
*/
|
||||
|
||||
/* Render outputs */
|
||||
if (pdf == TRUE || svg == TRUE) {
|
||||
cairo_render_cell_to_vector_file(toplevel_cell, layer_info_list, (pdf == TRUE ? pdf_name : NULL),
|
||||
@ -171,14 +140,14 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
|
||||
if (tex == TRUE) {
|
||||
tex_file = fopen(tex_name, "w");
|
||||
if (!tex_file)
|
||||
goto ret_clear_layer_list;
|
||||
goto ret_clear_list;
|
||||
latex_render_cell_to_code(toplevel_cell, layer_info_list, tex_file, scale, pdf_layers, pdf_standalone);
|
||||
fclose(tex_file);
|
||||
}
|
||||
|
||||
if (so_name && so_out_file) {
|
||||
if (strlen(so_name) == 0 || strlen(so_out_file) == 0)
|
||||
goto ret_clear_layer_list;
|
||||
goto ret_clear_list;
|
||||
|
||||
/* Render output using external renderer */
|
||||
printf("Invoking external renderer!\n");
|
||||
@ -186,16 +155,15 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
|
||||
printf("External renderer finished!\n");
|
||||
}
|
||||
|
||||
ret_clear_layer_list:
|
||||
ret_clear_list:
|
||||
g_list_free_full(layer_info_list, (GDestroyNotify)delete_layer_info_with_name);
|
||||
|
||||
g_object_unref(dstream);
|
||||
g_object_unref(stream);
|
||||
ret_destroy_file:
|
||||
destroy_file:
|
||||
g_object_unref(file);
|
||||
/* Delete all allocated libraries */
|
||||
ret_destroy_library_list:
|
||||
clear_lib_list(&libs);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
@ -4,5 +4,5 @@
|
||||
* @defgroup trigonometric Trigonometric Helper Functions
|
||||
*
|
||||
* The trigonometric helper function are used to calculate bounding boxes
|
||||
* @warning Code is incomplete. Please double check for functionality!
|
||||
* @warning Code is incomplete. Please double check the functionality!
|
||||
*/
|
||||
|
@ -6,7 +6,7 @@ To use the application on the command line check 'gds-render --help'.
|
||||
Application Options:
|
||||
- -t, --tikz Output TikZ code
|
||||
- -p, --pdf Output PDF document
|
||||
- -s, --scale=SCALE Divide output coordinates by SCALE
|
||||
- -s, --scale=<SCALE> Divide output coordinates by <SCALE>
|
||||
- -o, --tex-output=PATH Optional path for TeX file
|
||||
- -O, --pdf-output=PATH Optional path for PDF file
|
||||
- -m, --mapping=PATH Path for Layer Mapping File
|
||||
|
@ -36,8 +36,7 @@
|
||||
|
||||
/**
|
||||
* @brief function name expected to be found in external library.
|
||||
*
|
||||
* The function has to be defined as follows:
|
||||
* @detail The function has to be defined as follows:
|
||||
* @code
|
||||
* int function_name(gds_cell *toplevel, GList *layer_info_list, char *output_file_name)
|
||||
* @endcode
|
||||
|
@ -894,7 +894,6 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
*/
|
||||
static void delete_cell_inst_element(struct gds_cell_instance *cell_inst)
|
||||
{
|
||||
if (cell_inst)
|
||||
free(cell_inst);
|
||||
}
|
||||
|
||||
@ -904,7 +903,6 @@ static void delete_cell_inst_element(struct gds_cell_instance *cell_inst)
|
||||
*/
|
||||
static void delete_vertex(struct gds_point *vertex)
|
||||
{
|
||||
if (vertex)
|
||||
free(vertex);
|
||||
}
|
||||
|
||||
@ -914,9 +912,6 @@ static void delete_vertex(struct gds_point *vertex)
|
||||
*/
|
||||
static void delete_graphics_obj(struct gds_graphics *gfx)
|
||||
{
|
||||
if (!gfx)
|
||||
return;
|
||||
|
||||
g_list_free_full(gfx->vertices, (GDestroyNotify)delete_vertex);
|
||||
free(gfx);
|
||||
}
|
||||
@ -927,9 +922,6 @@ static void delete_graphics_obj(struct gds_graphics *gfx)
|
||||
*/
|
||||
static void delete_cell_element(struct gds_cell *cell)
|
||||
{
|
||||
if (!cell)
|
||||
return;
|
||||
|
||||
g_list_free_full(cell->child_cells, (GDestroyNotify)delete_cell_inst_element);
|
||||
g_list_free_full(cell->graphic_objs, (GDestroyNotify)delete_graphics_obj);
|
||||
free(cell);
|
||||
@ -941,9 +933,6 @@ static void delete_cell_element(struct gds_cell *cell)
|
||||
*/
|
||||
static void delete_library_element(struct gds_library *lib)
|
||||
{
|
||||
if (!lib)
|
||||
return;
|
||||
|
||||
g_list_free(lib->cell_names);
|
||||
g_list_free_full(lib->cells, (GDestroyNotify)delete_cell_element);
|
||||
free(lib);
|
||||
@ -951,12 +940,8 @@ static void delete_library_element(struct gds_library *lib)
|
||||
|
||||
int clear_lib_list(GList **library_list)
|
||||
{
|
||||
if (!library_list)
|
||||
return 0;
|
||||
|
||||
if (*library_list == NULL)
|
||||
return 0;
|
||||
|
||||
g_list_free_full(*library_list, (GDestroyNotify)delete_library_element);
|
||||
*library_list = NULL;
|
||||
return 0;
|
||||
|
@ -65,7 +65,7 @@ int gds_tree_check_cell_references(struct gds_library *lib)
|
||||
instance_iter = g_list_next(instance_iter)) {
|
||||
cell_inst = (struct gds_cell_instance *)instance_iter->data;
|
||||
|
||||
/* Check if broken. This should not happen */
|
||||
/* Check if broken. This should also not happen */
|
||||
if (!cell_inst) {
|
||||
fprintf(stderr, "Broken cell list item found in cell %s. Will continue.\n",
|
||||
cell->name);
|
||||
@ -83,29 +83,6 @@ int gds_tree_check_cell_references(struct gds_library *lib)
|
||||
return total_unresolved_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function sets the marker element in the check structure of each cell to zero.
|
||||
* @param lib Library to work with
|
||||
* @return 0 if successful; negative if a fault (null pointer, ...) occured.
|
||||
*/
|
||||
static int gds_tree_check_clear_cell_check_marker(struct gds_library *lib)
|
||||
{
|
||||
GList *cell_iter;
|
||||
struct gds_cell *cell;
|
||||
|
||||
if (!lib)
|
||||
return -1;
|
||||
|
||||
for (cell_iter = lib->cells; cell_iter != NULL; cell_iter = g_list_next(cell_iter)) {
|
||||
cell = (struct gds_cell *)cell_iter->data;
|
||||
|
||||
if (!cell)
|
||||
return -2;
|
||||
|
||||
cell->checks._internal.marker = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int gds_tree_check_reference_loops(struct gds_library *lib)
|
||||
{
|
||||
return 0;
|
||||
|
@ -40,7 +40,7 @@ enum cell_store_columns {
|
||||
CELL_SEL_CELL_ERROR_STATE, /**< Used for cell color and selectability */
|
||||
CELL_SEL_MODDATE,
|
||||
CELL_SEL_ACCESSDATE,
|
||||
CELL_SEL_COLUMN_COUNT /**< @brief Not a column. Used to determine count of columns */
|
||||
CELL_SEL_COLUMN_COUNT /**< Not a column. Used to determine count of coumns **/
|
||||
};
|
||||
|
||||
struct tree_stores {
|
||||
|
@ -180,11 +180,10 @@ void bounding_box_update_point(union bounding_box *destination, conv_generic_to_
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Apply transformations onto bounding box.
|
||||
* @param scale Scaling factor
|
||||
* @param rotation_deg Roation of bounding box around the origin in degrees (counterclockwise)
|
||||
* @param flip_at_x Flip the boundig box on the x axis before rotating.
|
||||
* @param box Bounding box the operations should be applied to.
|
||||
* @brief bounding_box_apply_transform
|
||||
* @param scale scaling factor
|
||||
* @param rotation roation of bounding box around the origin in degrees (counterclockwise)
|
||||
* @param box bounding box the operations should be applied to
|
||||
*/
|
||||
void bounding_box_apply_transform(double scale, double rotation_deg, bool flip_at_x, union bounding_box *box)
|
||||
{
|
||||
|
@ -38,9 +38,9 @@ static void convert_gds_point_to_2d_vector(struct gds_point *pt, struct vector_2
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update the given bounding box with the bounding box of a graphics element.
|
||||
* @param box box to update
|
||||
* @param gfx Graphics element
|
||||
* @brief update_box_with_gfx
|
||||
* @param box
|
||||
* @param gfx_list
|
||||
*/
|
||||
static void update_box_with_gfx(union bounding_box *box, struct gds_graphics *gfx)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file conv-settings-dialog.c
|
||||
* @file conv-settings-dilaog.c
|
||||
* @brief Implementation of the setting dialog
|
||||
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user