changeset 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
files pads2gpcb/decals.c
diffstat 1 files changed, 17 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/pads2gpcb/decals.c	Sun Jan 31 03:29:33 2016 +0000
+++ b/pads2gpcb/decals.c	Sun Jan 31 05:02:49 2016 +0000
@@ -484,18 +484,6 @@
 	else
 		num_attr_labels = 0;
 
-	/* sanity checks */
-	if (fpbody.npins < 1) {
-		fprintf(stderr, "%s line %d: # of terminals %d < 1\n",
-			input_filename, input_lineno, fpbody.npins);
-		exit(1);
-	}
-	if (num_padstack_defs < 1) {
-		fprintf(stderr, "%s line %d: # of pad stack defs %d < 1\n",
-			input_filename, input_lineno, num_padstack_defs);
-		exit(1);
-	}
-
 	/* done parsing the header line, initialize some misc */
 	fpbody.refdes_scale = 100;
 	num_silk_lines = 0;
@@ -509,6 +497,23 @@
 	for (i = 0; i < num_attr_labels; i++)
 		one_attr_label();
 
+	/* deal with dummies */
+	if (fpbody.npins == 0 && num_padstack_defs == 0) {
+		printf("Dummy decal with no pins, skipping\n");
+		return;
+	}
+	if (fpbody.npins < 1) {
+		fprintf(stderr, "Error in decal %s: # of terminals %d < 1\n",
+			current_decal->name, fpbody.npins);
+		exit(1);
+	}
+	if (num_padstack_defs < 1) {
+		fprintf(stderr,
+			"Error in decal %s: # of pad stack defs %d < 1\n",
+			current_decal->name, num_padstack_defs);
+		exit(1);
+	}
+
 	/* the meat: allocate and fill the pins array */
 	pins_array = malloc(sizeof(struct footprint_pad) * fpbody.npins);
 	if (!pins_array) {