comparison pads2gpcb/decals.c @ 61:ff1d565d233c

pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 31 Jan 2016 05:02:49 +0000
parents 0444db01fa4a
children 9d7e2937883d
comparison
equal deleted inserted replaced
60:0444db01fa4a 61:ff1d565d233c
482 if (input_line_nfields > 8) 482 if (input_line_nfields > 8)
483 num_attr_labels = atoi(input_line_fields[8]); 483 num_attr_labels = atoi(input_line_fields[8]);
484 else 484 else
485 num_attr_labels = 0; 485 num_attr_labels = 0;
486 486
487 /* sanity checks */
488 if (fpbody.npins < 1) {
489 fprintf(stderr, "%s line %d: # of terminals %d < 1\n",
490 input_filename, input_lineno, fpbody.npins);
491 exit(1);
492 }
493 if (num_padstack_defs < 1) {
494 fprintf(stderr, "%s line %d: # of pad stack defs %d < 1\n",
495 input_filename, input_lineno, num_padstack_defs);
496 exit(1);
497 }
498
499 /* done parsing the header line, initialize some misc */ 487 /* done parsing the header line, initialize some misc */
500 fpbody.refdes_scale = 100; 488 fpbody.refdes_scale = 100;
501 num_silk_lines = 0; 489 num_silk_lines = 0;
502 num_silk_arcs = 0; 490 num_silk_arcs = 0;
503 491
506 one_drawing_piece(); 494 one_drawing_piece();
507 for (i = 0; i < num_text_items; i++) 495 for (i = 0; i < num_text_items; i++)
508 one_text_item(); 496 one_text_item();
509 for (i = 0; i < num_attr_labels; i++) 497 for (i = 0; i < num_attr_labels; i++)
510 one_attr_label(); 498 one_attr_label();
499
500 /* deal with dummies */
501 if (fpbody.npins == 0 && num_padstack_defs == 0) {
502 printf("Dummy decal with no pins, skipping\n");
503 return;
504 }
505 if (fpbody.npins < 1) {
506 fprintf(stderr, "Error in decal %s: # of terminals %d < 1\n",
507 current_decal->name, fpbody.npins);
508 exit(1);
509 }
510 if (num_padstack_defs < 1) {
511 fprintf(stderr,
512 "Error in decal %s: # of pad stack defs %d < 1\n",
513 current_decal->name, num_padstack_defs);
514 exit(1);
515 }
511 516
512 /* the meat: allocate and fill the pins array */ 517 /* the meat: allocate and fill the pins array */
513 pins_array = malloc(sizeof(struct footprint_pad) * fpbody.npins); 518 pins_array = malloc(sizeof(struct footprint_pad) * fpbody.npins);
514 if (!pins_array) { 519 if (!pins_array) {
515 perror("malloc of the pins array"); 520 perror("malloc of the pins array");