Compare commits
3 Commits
8455491c11
...
27cb06afe2
Author | SHA1 | Date | |
---|---|---|---|
27cb06afe2 | |||
1c4ccd9153 | |||
dc208c6ad3 |
@ -387,7 +387,7 @@ void gds_parse_date(const char *buffer, int length, struct gds_time_field *mod_d
|
||||
|
||||
int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
{
|
||||
char workbuff[1024];
|
||||
char *workbuff;
|
||||
int read;
|
||||
int i;
|
||||
int run = 1;
|
||||
@ -404,6 +404,12 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
|
||||
lib_list = *library_list;
|
||||
|
||||
/* Allocate working buffer */
|
||||
workbuff = (char *)malloc(sizeof(char)*128*1024);
|
||||
|
||||
if(!workbuff)
|
||||
return -100;
|
||||
|
||||
/* open File */
|
||||
gds_file = fopen(filename, "r");
|
||||
if (gds_file == NULL) {
|
||||
@ -428,8 +434,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
break;
|
||||
}
|
||||
|
||||
rec_data_length = (uint16_t)((((uint16_t)(workbuff[0])) << 8) |
|
||||
(uint16_t)(workbuff[1]));
|
||||
rec_data_length = gds_convert_unsigend_int16(workbuff);
|
||||
|
||||
if (rec_data_length < 4) {
|
||||
/* Possible Zero-Padding: */
|
||||
@ -452,8 +457,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
GDS_ERROR("Unexpected end of file");
|
||||
break;
|
||||
}
|
||||
rec_type = (uint16_t)((((uint16_t)(workbuff[0])) << 8) |
|
||||
(uint16_t)(workbuff[1]));
|
||||
rec_type = gds_convert_unsigend_int16(workbuff);
|
||||
|
||||
/* if begin: Allocate structures */
|
||||
switch (rec_type) {
|
||||
@ -595,7 +599,8 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
read = fread(workbuff, sizeof(char), rec_data_length, gds_file);
|
||||
|
||||
if (read != rec_data_length) {
|
||||
GDS_ERROR("Could not read enough data");
|
||||
GDS_ERROR("Could not read enough data: requested: %u, read: %u | Type: %04x\n",
|
||||
(unsigned int)rec_data_length, (unsigned int)read, (unsigned int)rec_type);
|
||||
run = -5;
|
||||
break;
|
||||
}
|
||||
@ -696,10 +701,15 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
fclose(gds_file);
|
||||
|
||||
|
||||
/* Iterate and find references to cells */
|
||||
g_list_foreach(lib_list, scan_library_references, NULL);
|
||||
if (!run) {
|
||||
/* Iterate and find references to cells */
|
||||
g_list_foreach(lib_list, scan_library_references, NULL);
|
||||
}
|
||||
|
||||
*library_list = lib_list;
|
||||
|
||||
free(workbuff);
|
||||
|
||||
return run;
|
||||
}
|
||||
|
||||
|
@ -164,6 +164,16 @@ void render_cell_to_code(struct gds_cell *cell, GList *layer_infos, FILE *tex_fi
|
||||
/* 10 kB Line working buffer should be enough */
|
||||
working_line = g_string_new_len(NULL, LATEX_LINE_BUFFER_KB*1024);
|
||||
|
||||
/* standalone foo */
|
||||
g_string_printf(working_line, "\\newif\\iftestmode\n\\testmodefalse %% Change to true for standalone rendering\n");
|
||||
WRITEOUT_BUFFER(working_line);
|
||||
g_string_printf(working_line, "\\iftestmode\n");
|
||||
WRITEOUT_BUFFER(working_line);
|
||||
g_string_printf(working_line, "\\documentclass[tikz]{standalone}\n\\usepackage{xcolor}\n\\usetikzlibrary{ocgx}\n\\begin{document}\n");
|
||||
WRITEOUT_BUFFER(working_line);
|
||||
g_string_printf(working_line, "\\fi\n");
|
||||
WRITEOUT_BUFFER(working_line);
|
||||
|
||||
/* Write layer definitions */
|
||||
write_layer_definitions(tex_file, layer_infos, working_line);
|
||||
|
||||
@ -178,6 +188,13 @@ void render_cell_to_code(struct gds_cell *cell, GList *layer_infos, FILE *tex_fi
|
||||
g_string_printf(working_line, "\\end{tikzpicture}\n");
|
||||
WRITEOUT_BUFFER(working_line);
|
||||
|
||||
g_string_printf(working_line, "\\iftestmode\n");
|
||||
WRITEOUT_BUFFER(working_line);
|
||||
g_string_printf(working_line, "\\end{document}\n");
|
||||
WRITEOUT_BUFFER(working_line);
|
||||
g_string_printf(working_line, "\\fi\n");
|
||||
WRITEOUT_BUFFER(working_line);
|
||||
|
||||
fflush(tex_file);
|
||||
g_string_free(working_line, TRUE);
|
||||
}
|
||||
|
4
test-data/.gitignore
vendored
4
test-data/.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
layout.tex
|
||||
toplevel.pdf
|
||||
*.log
|
||||
*.aux
|
||||
|
2
test-data/layer-mapping.map
Normal file
2
test-data/layer-mapping.map
Normal file
@ -0,0 +1,2 @@
|
||||
2,0.203922,0.396078,0.643137,1.000000,1,BOTTOM-Layer
|
||||
1,0.450980,0.823529,0.086275,1.000000,1,TOP-Layer
|
BIN
test-data/test.gds
Normal file
BIN
test-data/test.gds
Normal file
Binary file not shown.
BIN
test-data/test.pdf
Normal file
BIN
test-data/test.pdf
Normal file
Binary file not shown.
9023
test-data/test.tex
Normal file
9023
test-data/test.tex
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user