Disable prints in GDS renderer. Wrote documentation
This commit is contained in:
parent
5c3b299eb0
commit
5526e403a3
6
doxygen/main-application.h
Normal file
6
doxygen/main-application.h
Normal file
@ -0,0 +1,6 @@
|
||||
/* This file only contains help information for doxygen */
|
||||
|
||||
/**
|
||||
* @defgroup MainApplication Main Application
|
||||
*
|
||||
*/
|
@ -51,6 +51,11 @@
|
||||
#define GDS_ERROR(fmt, ...) printf("[PARSE_ERROR] " fmt "\n", ##__VA_ARGS__) /**< @brief Print GDS error*/
|
||||
#define GDS_WARN(fmt, ...) printf("[PARSE_WARNING] " fmt "\n", ##__VA_ARGS__) /**< @brief Print GDS warning */
|
||||
|
||||
#if GDS_PRINT_DEBUG_INFOS
|
||||
#define GDS_INF(fmt, ...) printf(fmt, ##__VA_ARGS__) /**< @brief standard printf. But cna be disabled in code */
|
||||
#else
|
||||
#define GDS_INF(fmt, ...)
|
||||
#endif
|
||||
enum gds_record {
|
||||
INVALID = 0x0000,
|
||||
HEADER = 0x0002,
|
||||
@ -101,7 +106,7 @@ static int name_cell_ref(struct gds_cell_instance *cell_inst,
|
||||
|
||||
/* else: */
|
||||
strcpy(cell_inst->ref_name, data);
|
||||
printf("\tCell referenced: %s\n", cell_inst->ref_name);
|
||||
GDS_INF("\tCell referenced: %s\n", cell_inst->ref_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -355,7 +360,7 @@ static int name_library(struct gds_library *current_library,
|
||||
}
|
||||
|
||||
strcpy(current_library->name, data);
|
||||
printf("Named library: %s\n", current_library->name);
|
||||
GDS_INF("Named library: %s\n", current_library->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -385,7 +390,7 @@ static int name_cell(struct gds_cell *cell, unsigned int bytes,
|
||||
}
|
||||
|
||||
strcpy(cell->name, data);
|
||||
printf("Named cell: %s\n", cell->name);
|
||||
GDS_INF("Named cell: %s\n", cell->name);
|
||||
|
||||
/* Append cell name to lib's list of names */
|
||||
lib->cell_names = g_list_append(lib->cell_names, cell->name);
|
||||
@ -407,7 +412,7 @@ static void parse_reference_list(gpointer gcell_ref, gpointer glibrary)
|
||||
GList *cell_item;
|
||||
struct gds_cell *cell;
|
||||
|
||||
printf("\t\t\tReference: %s: ", inst->ref_name);
|
||||
GDS_INF("\t\t\tReference: %s: ", inst->ref_name);
|
||||
/* Find cell */
|
||||
for (cell_item = lib->cells; cell_item != NULL;
|
||||
cell_item = cell_item->next) {
|
||||
@ -415,14 +420,14 @@ static void parse_reference_list(gpointer gcell_ref, gpointer glibrary)
|
||||
cell = (struct gds_cell *)cell_item->data;
|
||||
/* Check if cell is found */
|
||||
if (!strcmp(cell->name, inst->ref_name)) {
|
||||
printf("found\n");
|
||||
GDS_INF("found\n");
|
||||
/* update reference link */
|
||||
inst->cell_ref = cell;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
printf("MISSING!\n");
|
||||
GDS_INF("MISSING!\n");
|
||||
GDS_WARN("referenced cell could not be found in library");
|
||||
}
|
||||
|
||||
@ -436,7 +441,7 @@ static void scan_cell_reference_dependencies(gpointer gcell, gpointer library)
|
||||
{
|
||||
struct gds_cell *cell = (struct gds_cell *)gcell;
|
||||
|
||||
printf("\tScanning cell: %s\n", cell->name);
|
||||
GDS_INF("\tScanning cell: %s\n", cell->name);
|
||||
|
||||
/* Scan all library references */
|
||||
g_list_foreach(cell->child_cells, parse_reference_list, library);
|
||||
@ -454,7 +459,7 @@ static void scan_library_references(gpointer library_list_item, gpointer user)
|
||||
{
|
||||
struct gds_library *lib = (struct gds_library *)library_list_item;
|
||||
|
||||
printf("Scanning Library: %s\n", lib->name);
|
||||
GDS_INF("Scanning Library: %s\n", lib->name);
|
||||
g_list_foreach(lib->cells, scan_cell_reference_dependencies, lib);
|
||||
}
|
||||
|
||||
@ -583,7 +588,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
break;
|
||||
|
||||
}
|
||||
printf("Entering Lib\n");
|
||||
GDS_INF("Entering Lib\n");
|
||||
break;
|
||||
case ENDLIB:
|
||||
if (current_lib == NULL) {
|
||||
@ -599,7 +604,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
break;
|
||||
}
|
||||
current_lib = NULL;
|
||||
printf("Leaving Library\n");
|
||||
GDS_INF("Leaving Library\n");
|
||||
break;
|
||||
case BGNSTR:
|
||||
current_lib->cells = append_cell(current_lib->cells, ¤t_cell);
|
||||
@ -608,7 +613,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
run = -3;
|
||||
break;
|
||||
}
|
||||
printf("Entering Cell\n");
|
||||
GDS_INF("Entering Cell\n");
|
||||
break;
|
||||
case ENDSTR:
|
||||
if (current_cell == NULL) {
|
||||
@ -623,7 +628,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
break;
|
||||
}
|
||||
current_cell = NULL;
|
||||
printf("Leaving Cell\n");
|
||||
GDS_INF("Leaving Cell\n");
|
||||
break;
|
||||
case BOX:
|
||||
case BOUNDARY:
|
||||
@ -640,7 +645,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
run = -4;
|
||||
break;
|
||||
}
|
||||
printf("\tEntering boundary/Box\n");
|
||||
GDS_INF("\tEntering boundary/Box\n");
|
||||
break;
|
||||
case SREF:
|
||||
if (current_cell == NULL) {
|
||||
@ -656,7 +661,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
break;
|
||||
}
|
||||
|
||||
printf("\tEntering reference\n");
|
||||
GDS_INF("\tEntering reference\n");
|
||||
break;
|
||||
case PATH:
|
||||
if (current_cell == NULL) {
|
||||
@ -671,16 +676,16 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
run = -4;
|
||||
break;
|
||||
}
|
||||
printf("\tEntering Path\n");
|
||||
GDS_INF("\tEntering Path\n");
|
||||
break;
|
||||
case ENDEL:
|
||||
if (current_graphics != NULL) {
|
||||
|
||||
printf("\tLeaving %s\n", (current_graphics->gfx_type == GRAPHIC_POLYGON ? "boundary" : "path"));
|
||||
GDS_INF("\tLeaving %s\n", (current_graphics->gfx_type == GRAPHIC_POLYGON ? "boundary" : "path"));
|
||||
current_graphics = NULL;
|
||||
}
|
||||
if (current_s_reference != NULL) {
|
||||
printf("\tLeaving Reference\n");
|
||||
GDS_INF("\tLeaving Reference\n");
|
||||
current_s_reference = NULL;
|
||||
}
|
||||
break;
|
||||
@ -755,7 +760,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
/* Get origin of reference */
|
||||
current_s_reference->origin.x = gds_convert_signed_int(workbuff);
|
||||
current_s_reference->origin.y = gds_convert_signed_int(&workbuff[4]);
|
||||
printf("\t\tSet origin to: %d/%d\n", current_s_reference->origin.x,
|
||||
GDS_INF("\t\tSet origin to: %d/%d\n", current_s_reference->origin.x,
|
||||
current_s_reference->origin.y);
|
||||
} else if (current_graphics) {
|
||||
for (i = 0; i < read/8; i++) {
|
||||
@ -763,7 +768,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
y = gds_convert_signed_int(&workbuff[i*8+4]);
|
||||
current_graphics->vertices =
|
||||
append_vertex(current_graphics->vertices, x, y);
|
||||
printf("\t\tSet coordinate: %d/%d\n", x, y);
|
||||
GDS_INF("\t\tSet coordinate: %d/%d\n", x, y);
|
||||
|
||||
}
|
||||
}
|
||||
@ -794,7 +799,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
if (current_graphics->layer < 0) {
|
||||
GDS_WARN("Layer negative!\n");
|
||||
}
|
||||
printf("\t\tAdded layer %d\n", (int)current_graphics->layer);
|
||||
GDS_INF("\t\tAdded layer %d\n", (int)current_graphics->layer);
|
||||
break;
|
||||
case MAG:
|
||||
if (rec_data_length != 8) {
|
||||
@ -807,7 +812,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
}
|
||||
if (current_s_reference != NULL) {
|
||||
current_s_reference->magnification = gds_convert_double(workbuff);
|
||||
printf("\t\tMagnification defined: %lf\n", current_s_reference->magnification);
|
||||
GDS_INF("\t\tMagnification defined: %lf\n", current_s_reference->magnification);
|
||||
}
|
||||
break;
|
||||
case ANGLE:
|
||||
@ -821,7 +826,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
}
|
||||
if (current_s_reference != NULL) {
|
||||
current_s_reference->angle = gds_convert_double(workbuff);
|
||||
printf("\t\tAngle defined: %lf\n", current_s_reference->angle);
|
||||
GDS_INF("\t\tAngle defined: %lf\n", current_s_reference->angle);
|
||||
}
|
||||
break;
|
||||
case PATHTYPE:
|
||||
@ -831,7 +836,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
}
|
||||
if (current_graphics->gfx_type == GRAPHIC_PATH) {
|
||||
current_graphics->path_render_type = (int)gds_convert_signed_int16(workbuff);
|
||||
printf("\t\tPathtype: %d\n", current_graphics->path_render_type);
|
||||
GDS_INF("\t\tPathtype: %d\n", current_graphics->path_render_type);
|
||||
} else {
|
||||
GDS_WARN("Path type defined inside non-path graphics object. Ignoring");
|
||||
}
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include <glib.h>
|
||||
#include "gds-types.h"
|
||||
|
||||
#define GDS_PRINT_DEBUG_INFOS (0) /**< @brief 1: Print infos, 0: Don't print */
|
||||
|
||||
int parse_gds_from_file(const char *filename, GList **library_array);
|
||||
/**
|
||||
* @brief Deletes all libraries including cells, references etc.
|
||||
|
@ -17,11 +17,35 @@
|
||||
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file latex-output.c
|
||||
* @brief LaTeX output renderer
|
||||
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||
*/
|
||||
|
||||
#include "latex-output.h"
|
||||
#include <math.h>
|
||||
|
||||
/**
|
||||
* @addtogroup LaTeX-Renderer
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Writes a GString \p buffer to the fixed file tex_file */
|
||||
#define WRITEOUT_BUFFER(buff) fwrite((buff)->str, sizeof(char), (buff)->len, tex_file)
|
||||
|
||||
/**
|
||||
* @brief Write the layer declarration to TeX file
|
||||
*
|
||||
* This writes the declaration of the layers and the mapping in which order
|
||||
* the layers shall be rendered by TikZ. Layers are written in the order they are
|
||||
* positioned inside the \p layer_infos list.
|
||||
*
|
||||
* @param tex_file TeX-File to write to
|
||||
* @param layer_infos List containing layer_info structs.
|
||||
* @param buffer
|
||||
* @note The field layer_info::stacked_position is ignored. Stack depends on list order.
|
||||
*/
|
||||
static void write_layer_definitions(FILE *tex_file, GList *layer_infos, GString *buffer)
|
||||
{
|
||||
GList *list;
|
||||
@ -53,11 +77,30 @@ static void write_layer_definitions(FILE *tex_file, GList *layer_infos, GString
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief write_layer_env
|
||||
* @param tex_file
|
||||
* @param layer
|
||||
* @param buffer
|
||||
* @return TRUE if layer is placeable
|
||||
* @brief Write layer Envirmonment
|
||||
*
|
||||
* If the requested layer shall be rendered, this code writes the necessary code
|
||||
* to open the layer. It also returns the color the layer shall be rendered in.
|
||||
*
|
||||
* The followingenvironments are generated:
|
||||
*
|
||||
* @code{.tex}
|
||||
* \begin{pgfonlayer}{<layer>}
|
||||
* % If pdf layers shall be used also this is enabled:
|
||||
* \begin{scope}[ocg={ref=<layer>, status=visible,name={<Layer Name>}}]
|
||||
* @endcode
|
||||
*
|
||||
*
|
||||
* If the layer shall not be rendered, FALSE is returned and the color is not filled in and
|
||||
* the cod eis not written to the file.
|
||||
*
|
||||
* @param tex_file TeX file to write to
|
||||
* @param color Return of the layer's color
|
||||
* @param layer Requested layer number
|
||||
* @param linfo Layer information list containing layer_info structs
|
||||
* @param buffer Some working buffer
|
||||
* @return TRUE, if the layer shall be rendered.
|
||||
* @note The opened environments have to be closed afterwards
|
||||
*/
|
||||
static gboolean write_layer_env(FILE *tex_file, GdkRGBA *color, int layer, GList *linfo, GString *buffer)
|
||||
{
|
||||
@ -80,7 +123,17 @@ static gboolean write_layer_env(FILE *tex_file, GdkRGBA *color, int layer, GList
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Writes a graphics object to the specified tex_file
|
||||
*
|
||||
* This function opens the layer, writes a graphics object and closes the layer
|
||||
*
|
||||
* @param tex_file File to write to
|
||||
* @param graphics Object to render
|
||||
* @param linfo Layer information
|
||||
* @param buffer Working buffer
|
||||
* @param scale Scale abject down by this value
|
||||
*/
|
||||
static void generate_graphics(FILE *tex_file, GList *graphics, GList *linfo, GString *buffer, double scale)
|
||||
{
|
||||
GList *temp;
|
||||
@ -144,7 +197,14 @@ static void generate_graphics(FILE *tex_file, GList *graphics, GList *linfo, GSt
|
||||
} /* For graphics */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Render cell to file
|
||||
* @param cell Cell to render
|
||||
* @param layer_infos Layer information
|
||||
* @param tex_file File to write to
|
||||
* @param buffer Working buffer
|
||||
* @param scale Scale output down by this value
|
||||
*/
|
||||
static void render_cell(struct gds_cell *cell, GList *layer_infos, FILE *tex_file, GString *buffer, double scale)
|
||||
{
|
||||
|
||||
@ -238,3 +298,5 @@ void latex_render_cell_to_code(struct gds_cell *cell, GList *layer_infos, FILE *
|
||||
fflush(tex_file);
|
||||
g_string_free(working_line, TRUE);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "../gds-parser/gds-types.h"
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include "../layer-selector.h"
|
||||
#include "../mapping-parser.h"
|
||||
|
||||
#define LATEX_LINE_BUFFER_KB (10) /**< @brief Buffer for LaTeX Code line in KiB */
|
||||
|
||||
|
@ -18,18 +18,19 @@
|
||||
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "mapping-parser.h"
|
||||
/**
|
||||
* @file mapping-parser.c
|
||||
* @brief Function to read a mapping file line and parse it.
|
||||
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief load_csv_line
|
||||
* @param file
|
||||
* @param export
|
||||
* @param name
|
||||
* @param layer
|
||||
* @param color
|
||||
* @param opacity
|
||||
* @return 0 if succesfull, 1 if line was malformatted or parameters are broken, -1 if file end
|
||||
* @addtogroup MainApplication
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "mapping-parser.h"
|
||||
|
||||
int load_csv_line(GDataInputStream *stream, gboolean *export, char **name, int *layer, GdkRGBA *color)
|
||||
{
|
||||
int ret;
|
||||
@ -93,3 +94,5 @@ ret_direct:
|
||||
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
@ -17,19 +17,46 @@
|
||||
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file mapping-parser.h
|
||||
* @brief Function to read a mapping file line and parse it.
|
||||
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||
*/
|
||||
|
||||
#ifndef __MAPPING_PARSER_H__
|
||||
#define __MAPPING_PARSER_H__
|
||||
|
||||
/**
|
||||
* @addtogroup MainApplication
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/**
|
||||
* @brief Layer information.
|
||||
*
|
||||
* This structs contains information on how to render a layer
|
||||
*/
|
||||
struct layer_info
|
||||
{
|
||||
int layer;
|
||||
char *name;
|
||||
int stacked_position; ///< Lower is bottom, higher is top
|
||||
GdkRGBA color;
|
||||
int layer; /**< @brief Layer number */
|
||||
char *name; /**< @brief Layer name */
|
||||
int stacked_position; ///< @brief Position of layer in output @warning This parameter is not used by any renderer so far @note Lower is bottom, higher is top
|
||||
GdkRGBA color; /**< @brief RGBA color used to render this layer */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Load a line from \p stream and parse try to parse it as layer information
|
||||
* @param stream Input data stream
|
||||
* @param export Layer shall be exported
|
||||
* @param name Layer name. Free returned pointer after using.
|
||||
* @param layer Layer number
|
||||
* @param color RGBA color.
|
||||
* @return 1 if malformatted line, 0 if parsing was successful and parameters are valid, -1 if file end
|
||||
*/
|
||||
int load_csv_line(GDataInputStream *stream, gboolean *export, char **name, int *layer, GdkRGBA *color);
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* __MAPPING_PARSER_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user