FreeCalypso > hg > ueda-linux
changeset 79:ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Feb 2016 06:11:57 +0000 |
parents | be1fe110b6ab |
children | df98a82b807e |
files | pads2gpcb/parttype.c |
diffstat | 1 files changed, 52 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/pads2gpcb/parttype.c Mon Feb 01 02:22:37 2016 +0000 +++ b/pads2gpcb/parttype.c Mon Feb 01 06:11:57 2016 +0000 @@ -152,6 +152,56 @@ } static void +write_alpha_pins_footprint() +{ + struct footprint_body *fpbody; + char *filename, *cp, *dp; + int c; + FILE *outf; + + if (our_parttype->ndecals != 1) { + printf( +"Warning: part type with alpha pins and multiple decals: save not supported\n"); + return; + } + fpbody = our_parttype->decals[0]->body; + if (!fpbody) + return; + if (our_parttype->num_alpha_pins != fpbody->npins) { + printf("Error: # of alpha pin names != # of actual pins\n"); + return; + } + + filename = malloc(strlen(our_parttype->name) * 3 + 11); + if (!filename) { + perror("malloc for output file name"); + exit(1); + } + strcpy(filename, "alphapins/"); + dp = filename + 10; + for (cp = our_parttype->name; *cp; ) { + c = *cp++; + if (isalnum(c) || c == '-' || c == '.' || c == '_') + *dp++ = c; + else { + sprintf(dp, "%%%02X", c); + dp += 3; + } + } + *dp = '\0'; + outf = fopen(filename, "w"); + if (!outf) { + perror(filename); + exit(1); + } + write_gpcb_element(outf, fpbody, our_parttype->alpha_pins, + "", "", "", 0); + fclose(outf); + printf("Written to %s\n", filename); + free(filename); +} + +static void process_one_parttype() { int i; @@ -164,6 +214,8 @@ if (our_parttype->num_alpha_pins) { alloc_alpha_pins_array(); read_alpha_pins(); + if (write_footprint_files) + write_alpha_pins_footprint(); } }