Enabled parser to detect path-types, fix indentation
This commit is contained in:
parent
d1a1cb762a
commit
0f4de608a2
@ -59,6 +59,7 @@ enum record {
|
||||
BOX = 0x2D00,
|
||||
LAYER = 0x0D02,
|
||||
WIDTH = 0x0F03,
|
||||
PATHTYPE = 0x2102
|
||||
};
|
||||
|
||||
static int name_cell_ref(struct gds_cell_instance *cell_inst,
|
||||
@ -189,7 +190,8 @@ static GList *append_graphics(GList *curr_list, enum graphics_type type,
|
||||
gfx->layer = 0;
|
||||
gfx->vertices = NULL;
|
||||
gfx->width_absolute = 0;
|
||||
gfx->type = type;
|
||||
gfx->gfx_type = type;
|
||||
gfx->path_render_type = PATH_FLUSH;
|
||||
} else
|
||||
return NULL;
|
||||
|
||||
@ -561,7 +563,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
case ENDEL:
|
||||
if (current_graphics != NULL) {
|
||||
|
||||
printf("\tLeaving %s\n", (current_graphics->type == GRAPHIC_POLYGON ? "boundary" : "path"));
|
||||
printf("\tLeaving %s\n", (current_graphics->gfx_type == GRAPHIC_POLYGON ? "boundary" : "path"));
|
||||
current_graphics = NULL;
|
||||
}
|
||||
if (current_s_reference != NULL) {
|
||||
@ -587,6 +589,8 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
break;
|
||||
case WIDTH:
|
||||
break;
|
||||
case PATHTYPE:
|
||||
break;
|
||||
default:
|
||||
//GDS_WARN("Record: %04x, len: %u", (unsigned int)rec_type, (unsigned int)rec_data_length);
|
||||
break;
|
||||
@ -693,6 +697,18 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
printf("\t\tAngle defined: %lf\n", current_s_reference->angle);
|
||||
}
|
||||
break;
|
||||
case PATHTYPE:
|
||||
if (current_graphics == NULL) {
|
||||
GDS_WARN("Path type defined outside of path. Ignoring");
|
||||
break;
|
||||
}
|
||||
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);
|
||||
} else {
|
||||
GDS_WARN("Path type defined inside non-path graphics object. Ignoring");
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define CELL_NAME_MAX (100)
|
||||
|
||||
enum graphics_type {GRAPHIC_PATH = 0, GRAPHIC_POLYGON = 1};
|
||||
enum path_type {PATH_FLUSH = 0, PATH_ROUNDED = 1, PATH_SQUARED = 2};
|
||||
|
||||
struct gds_time_field {
|
||||
uint16_t year;
|
||||
@ -23,9 +24,9 @@ struct gds_point {
|
||||
};
|
||||
|
||||
struct gds_graphics {
|
||||
enum graphics_type type;
|
||||
enum graphics_type gfx_type;
|
||||
GList *vertices;
|
||||
unsigned int path_width;
|
||||
enum path_type path_render_type;
|
||||
int width_absolute;
|
||||
int16_t layer;
|
||||
uint16_t datatype;
|
||||
|
@ -95,7 +95,7 @@ static void generate_graphics(FILE *tex_file, GList *graphics, GList *linfo, GSt
|
||||
if (write_layer_env(tex_file, &color, (int)gfx->layer, linfo, buffer) == TRUE) {
|
||||
|
||||
/* Layer is defined => create graphics */
|
||||
if (gfx->type == GRAPHIC_POLYGON) {
|
||||
if (gfx->gfx_type == GRAPHIC_POLYGON) {
|
||||
g_string_printf(buffer, "\\draw[line width=0.00001 pt, draw={c%d}, fill={c%d}, fill opacity={%lf}] ",
|
||||
gfx->layer, gfx->layer, color.alpha);
|
||||
WRITEOUT_BUFFER(buffer);
|
||||
@ -107,7 +107,7 @@ static void generate_graphics(FILE *tex_file, GList *graphics, GList *linfo, GSt
|
||||
}
|
||||
g_string_printf(buffer, "cycle;\n");
|
||||
WRITEOUT_BUFFER(buffer);
|
||||
} else if(gfx->type == GRAPHIC_PATH) {
|
||||
} else if(gfx->gfx_type == GRAPHIC_PATH) {
|
||||
g_string_printf(buffer, "\\draw[line width=%lf pt, draw={c%d}, opacity={%lf}] ",
|
||||
gfx->width_absolute/1000.0, gfx->layer, gfx->layer, color.alpha);
|
||||
WRITEOUT_BUFFER(buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user