Index: trunk/src_plugins/io_tedax/footprint.c =================================================================== --- trunk/src_plugins/io_tedax/footprint.c (revision 30800) +++ trunk/src_plugins/io_tedax/footprint.c (revision 30801) @@ -656,3 +656,42 @@ fclose(f); return ret; } + +pcb_plug_fp_map_t *tedax_fp_map(pcb_plug_io_t *ctx, FILE *f, const char *fn, pcb_plug_fp_map_t *head, int need_tags) +{ + char *s, line[515]; + int n; + + /* find tEDAx main header */ + for(n = 0; ;n++) { + if (n > 128) return NULL; + s = fgets(line, sizeof(line), f); + if (s == NULL) return NULL; + while(isspace(*s)) s++; + if ((*s == '\0') || (*s == '#')) continue; /* empty line or comment */ + if (strncmp(s, "tEDAx v", 7) == 0) break; /* accept */ + /* non-tedax content */ + return NULL; + } + + /* pick up all footprints */ + while((s = fgets(line, sizeof(line), f)) != NULL) { + while(isspace(*s)) s++; + if ((*s == '\0') || (*s == '#')) continue; /* empty line or comment */ + if (strncmp(s, "begin", 5) == 0) { + s += 5; + while(isspace(*s)) s++; + if (strncmp(s, "footprint", 9) == 0) { + s += 9; + while(isspace(*s)) s++; + /* footprint name is in s */ + TODO("don't return the first only"); + head->type = PCB_FP_FILE; + return head; + } + } + } + + /* no footprint found in the file */ + return NULL; +} Index: trunk/src_plugins/io_tedax/footprint.h =================================================================== --- trunk/src_plugins/io_tedax/footprint.h (revision 30800) +++ trunk/src_plugins/io_tedax/footprint.h (revision 30801) @@ -1,5 +1,6 @@ #include "data.h" #include +#include "plug_io.h" int tedax_fp_save(pcb_data_t *data, const char *fn, long subc_idx); int tedax_fp_fsave(pcb_data_t *data, FILE *f, long subc_idx); @@ -14,6 +15,8 @@ int tedax_pstk_fsave(pcb_pstk_t *padstack, pcb_coord_t ox, pcb_coord_t oy, FILE *f); +pcb_plug_fp_map_t *tedax_fp_map(pcb_plug_io_t *ctx, FILE *f, const char *fn, pcb_plug_fp_map_t *head, int need_tags); + Index: trunk/src_plugins/io_tedax/io_tedax.c =================================================================== --- trunk/src_plugins/io_tedax/io_tedax.c (revision 30800) +++ trunk/src_plugins/io_tedax/io_tedax.c (revision 30801) @@ -263,6 +263,7 @@ io_tedax.test_parse = pcb_io_tedax_test_parse; io_tedax.parse_pcb = io_tedax_parse_pcb; io_tedax.parse_footprint = io_tedax_parse_element; + io_tedax.map_footprint = tedax_fp_map; io_tedax.parse_font = NULL; io_tedax.write_buffer = NULL; io_tedax.write_subcs_head = io_tedax_fp_write_subcs_head;