annotate pads2gpcb/decals.c @ 54:a930e05cf908

pads2gpcb/decals.c: silk circle extraction implemented
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 31 Jan 2016 01:57:38 +0000
parents 0e18818206e5
children e93375570f91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 #include <stdio.h>
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 #include <stdlib.h>
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 #include <ctype.h>
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4 #include <string.h>
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <strings.h>
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 #include "globals.h"
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 #include "struct.h"
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 extern long convert_input_dim();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11 static struct part_decal *current_decal;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 static struct footprint_body fpbody;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 static struct footprint_pad *pins_array;
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
14
52
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
15 #define MAX_SILK_LINES 16
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
16 static struct element_line silk_lines[MAX_SILK_LINES];
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
17 static struct element_arc silk_arcs[MAX_SILK_LINES];
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
18 static int num_silk_lines;
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
19 static int num_silk_arcs;
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
20
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
21 #define SOLDERMASK_DELTA (600 * 254)
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
22 #define CLEARANCE_SETTING (2000 * 254)
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 static void
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 enter_decal()
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27 struct part_decal *p, **pp;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 char *name = input_line_fields[0];
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30 for (pp = &part_decal_list; p = *pp; pp = &p->next)
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 if (!strcmp(p->name, name)) {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 fprintf(stderr,
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 "%s line %d: decal name \"%s\" already defined\n",
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 input_filename, input_lineno, name);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 p = malloc(sizeof(struct part_decal) + strlen(name) + 1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38 if (!p) {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39 perror("malloc of struct part_decal");
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
40 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
41 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
42 p->name = (char *)(p + 1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
43 strcpy(p->name, name);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
44 p->body = 0;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
45 p->next = 0;
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
46 *pp = p;
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
47 current_decal = p;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
48 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
49
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
50 static void
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
51 get_line_internal()
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
52 {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
53 if (!get_input_line()) {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
54 fprintf(stderr,
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
55 "error: EOF in the middle of a part decal definition\n");
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
56 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
57 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
58 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
59
52
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
60 static
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
61 try_silk_open_closed()
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
62 {
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
63 int ncoord, i, bad;
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
64 long x[MAX_SILK_LINES+1], y[MAX_SILK_LINES+1];
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
65 long thickness;
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
66
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
67 if (strcmp(input_line_fields[0], "OPEN") &&
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
68 strcmp(input_line_fields[0], "CLOSED"))
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
69 return(0);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
70 if (input_line_nfields != 5)
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
71 return(0);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
72 if (strcmp(input_line_fields[4], "0"))
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
73 return(0);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
74 ncoord = atoi(input_line_fields[1]);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
75 if (ncoord < 2) {
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
76 printf("line %d: silk %s piece ncoord < 2\n", input_lineno,
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
77 input_line_fields[0]);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
78 return(0);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
79 }
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
80 if (ncoord > MAX_SILK_LINES + 1) {
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
81 printf("line %d: silk %s piece ncoord too big\n", input_lineno,
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
82 input_line_fields[0]);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
83 return(0);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
84 }
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
85 thickness = convert_input_dim(input_line_fields[2]);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
86
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
87 bad = 0;
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
88 for (i = 0; i < ncoord; i++) {
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
89 get_line_internal();
53
0e18818206e5 pads2gpcb/decals.c: silk line extraction appears to work
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 52
diff changeset
90 parse_input_line_fields();
52
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
91 if (input_line_nfields != 2) {
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
92 printf("line %d: silk line coord not 2 numbers\n",
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
93 input_lineno);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
94 bad = 1;
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
95 continue;
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
96 }
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
97 x[i] = convert_input_dim(input_line_fields[0]);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
98 y[i] = -convert_input_dim(input_line_fields[1]);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
99 }
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
100 if (bad)
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
101 return(1);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
102
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
103 for (i = 0; i < ncoord - 1; i++) {
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
104 if (num_silk_lines >= MAX_SILK_LINES) {
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
105 printf("Too many silk lines!\n");
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
106 return(1);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
107 }
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
108 silk_lines[num_silk_lines].x1 = x[i];
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
109 silk_lines[num_silk_lines].y1 = y[i];
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
110 silk_lines[num_silk_lines].x2 = x[i+1];
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
111 silk_lines[num_silk_lines].y2 = y[i+1];
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
112 silk_lines[num_silk_lines].thickness = thickness;
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
113 num_silk_lines++;
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
114 }
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
115 return(1);
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
116 }
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
117
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
118 static
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
119 try_silk_circle()
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
120 {
54
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
121 int i, bad;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
122 long x[2], y[2];
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
123 long centre_x, centre_y, diameter, thickness;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
124
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
125 if (strcmp(input_line_fields[0], "CIRCLE"))
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
126 return(0);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
127 if (input_line_nfields != 5)
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
128 return(0);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
129 if (strcmp(input_line_fields[4], "0"))
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
130 return(0);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
131 if (strcmp(input_line_fields[1], "2")) {
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
132 printf("line %d: silk CIRCLE piece ncoord != 2\n",
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
133 input_lineno);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
134 return(0);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
135 }
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
136 thickness = convert_input_dim(input_line_fields[2]);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
137
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
138 bad = 0;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
139 for (i = 0; i < 2; i++) {
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
140 get_line_internal();
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
141 parse_input_line_fields();
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
142 if (input_line_nfields != 2) {
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
143 printf("line %d: silk CIRCLE coord not 2 numbers\n",
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
144 input_lineno);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
145 bad = 1;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
146 continue;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
147 }
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
148 x[i] = convert_input_dim(input_line_fields[0]);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
149 y[i] = -convert_input_dim(input_line_fields[1]);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
150 }
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
151 if (bad)
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
152 return(1);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
153
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
154 /* find the centre and diameter */
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
155 if (x[0] == x[1]) {
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
156 centre_x = x[0];
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
157 if (y[0] < y[1]) {
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
158 diameter = y[1] - y[0];
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
159 centre_y = y[0] + diameter / 2;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
160 } else if (y[1] < y[0]) {
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
161 diameter = y[0] - y[1];
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
162 centre_y = y[1] + diameter / 2;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
163 } else
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
164 goto centre_diam_fail;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
165 } else if (y[0] == y[1]) {
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
166 centre_y = y[0];
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
167 if (x[0] < x[1]) {
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
168 diameter = x[1] - x[0];
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
169 centre_x = x[0] + diameter / 2;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
170 } else if (x[1] < x[0]) {
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
171 diameter = x[0] - x[1];
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
172 centre_x = x[1] + diameter / 2;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
173 } else
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
174 goto centre_diam_fail;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
175 } else {
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
176 centre_diam_fail:
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
177 printf("line %d: unable to find circle centre and diameter\n",
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
178 input_lineno);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
179 return(1);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
180 }
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
181 if (diameter % 2)
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
182 printf("warning: line %d: circle diameter in nm is odd!\n",
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
183 input_lineno);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
184
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
185 if (num_silk_arcs >= MAX_SILK_LINES) {
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
186 printf("Too many silk arcs!\n");
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
187 return(1);
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
188 }
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
189 silk_arcs[num_silk_arcs].centre_x = centre_x;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
190 silk_arcs[num_silk_arcs].centre_y = centre_y;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
191 silk_arcs[num_silk_arcs].width = diameter;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
192 silk_arcs[num_silk_arcs].height = diameter;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
193 silk_arcs[num_silk_arcs].start_angle = 0;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
194 silk_arcs[num_silk_arcs].delta_angle = 360;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
195 silk_arcs[num_silk_arcs].thickness = thickness;
a930e05cf908 pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 53
diff changeset
196 return(1);
52
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
197 }
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
198
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
199 static void
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
200 one_drawing_piece()
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
201 {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
202 int ncoord, i;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
203
52
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
204 /* extract silk lines and arcs if enabled, otherwise skip */
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
205 get_line_internal();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
206 parse_input_line_fields();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
207 if (input_line_nfields < 2) {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
208 fprintf(stderr,
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
209 "%s line %d: expected piece header line giving # of coords\n",
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
210 input_filename, input_lineno);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
211 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
212 }
52
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
213 if (do_footprint_silk) {
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
214 if (try_silk_open_closed())
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
215 return;
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
216 if (try_silk_circle())
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
217 return;
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
218 }
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
219 ncoord = atoi(input_line_fields[1]);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
220 for (i = 0; i < ncoord; i++)
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
221 get_line_internal();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
222 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
223
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
224 static void
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
225 one_text_item()
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
226 {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
227 /* just skip it for now */
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
228 get_line_internal();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
229 get_line_internal();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
230 get_line_internal();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
231 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
232
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
233 static void
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
234 one_attr_label()
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
235 {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
236 /* just skip it for now */
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
237 get_line_internal();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
238 get_line_internal();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
239 get_line_internal();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
240 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
241
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
242 static void
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
243 read_pindef_line(idx)
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
244 {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
245 get_line_internal();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
246 if (input_line_buf[0] != 'T') {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
247 fprintf(stderr, "%s line %d: 'T' line expected\n",
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
248 input_filename, input_lineno);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
249 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
250 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
251 parse_input_line_fields();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
252 if (input_line_nfields != 5) {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
253 fprintf(stderr, "%s line %d: expected 5 fields in 'T' line\n",
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
254 input_filename, input_lineno);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
255 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
256 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
257 input_line_fields[0]++;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
258
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
259 if (atoi(input_line_fields[4]) != idx + 1) {
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
260 fprintf(stderr,
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
261 "%s line %d: expected %d in the pin number field\n",
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
262 input_filename, input_lineno);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
263 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
264 }
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
265 pins_array[idx].x1 = convert_input_dim(input_line_fields[0]);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
266 pins_array[idx].y1 = -convert_input_dim(input_line_fields[1]);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
267 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
268
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
269 static void
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
270 process_pad_shape(padptr)
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
271 struct pad_shape_info *padptr;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
272 {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
273 padptr->short_dim = convert_input_dim(input_line_fields[1]);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
274 if (padptr->short_dim <= 0) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
275 printf("line %d: pad short dim <= 0\n", input_lineno);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
276 return;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
277 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
278 if (!strcmp(input_line_fields[2], "R")) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
279 padptr->rounded = 1;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
280 padptr->elongated = 0;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
281 } else if (!strcmp(input_line_fields[2], "S")) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
282 padptr->rounded = 0;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
283 padptr->elongated = 0;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
284 } else if (!strcmp(input_line_fields[2], "OF")) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
285 padptr->rounded = 1;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
286 padptr->elongated = 1;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
287 } else if (!strcmp(input_line_fields[2], "RF")) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
288 padptr->rounded = 0;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
289 padptr->elongated = 1;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
290 } else {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
291 printf("line %d: unsupported pad shape %s\n", input_lineno,
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
292 input_line_fields[2]);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
293 return;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
294 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
295 if (padptr->elongated) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
296 if (input_line_nfields < 6) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
297 fprintf(stderr,
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
298 "%s line %d: too few fields in OF/RF pad stack line\n",
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
299 input_filename, input_lineno);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
300 exit(1);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
301 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
302 padptr->angle = parse_input_angle_90s(input_line_fields[3]);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
303 if (padptr->angle != 0 && padptr->angle != 90) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
304 printf("line %d: unsupported OF/RF angle\n",
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
305 input_lineno);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
306 return;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
307 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
308 padptr->long_dim = convert_input_dim(input_line_fields[4]);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
309 if (strcmp(input_line_fields[5], "0")) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
310 printf("line %d: unsupported nonzero finoffset\n",
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
311 input_lineno);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
312 return;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
313 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
314 if (padptr->long_dim <= padptr->short_dim) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
315 printf("line %d: OF/RF long dim <= short dim\n",
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
316 input_lineno);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
317 return;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
318 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
319 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
320 padptr->valid = 1;
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
321 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
322
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
323 static void
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
324 one_padstack_def()
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
325 {
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
326 int pinno, stacklines, i;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
327 struct pad_shape_info *padptr;
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
328
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
329 get_line_internal();
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
330 parse_input_line_fields();
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
331 if (input_line_nfields != 3 || strcmp(input_line_fields[0], "PAD")) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
332 fprintf(stderr, "%s line %d: expected PAD header line\n",
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
333 input_filename, input_lineno);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
334 exit(1);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
335 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
336 pinno = atoi(input_line_fields[1]);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
337 stacklines = atoi(input_line_fields[2]);
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
338
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
339 if (pinno < 0 || pinno > fpbody.npins) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
340 fprintf(stderr, "%s line %d: PAD pinno field invalid\n",
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
341 input_filename, input_lineno);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
342 exit(1);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
343 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
344 if (pinno)
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
345 padptr = &pins_array[pinno-1].shape;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
346 else
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
347 padptr = &fpbody.default_pad;
43
4a50888d09ce pads2gpcb: handle error cases when the default pad is defined, but failed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 41
diff changeset
348 padptr->defined = 1;
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
349
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
350 for (i = 0; i < stacklines; i++) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
351 get_line_internal();
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
352 parse_input_line_fields();
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
353 if (input_line_nfields < 3) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
354 fprintf(stderr,
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
355 "%s line %d: too few fields in pad stack line\n",
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
356 input_filename, input_lineno);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
357 exit(1);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
358 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
359 if (!strcmp(input_line_fields[0], "-2"))
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
360 process_pad_shape(padptr);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
361 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
362 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
363
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
364 static void
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
365 apply_default_padstack()
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
366 {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
367 int i;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
368
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
369 if (!fpbody.default_pad.valid)
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
370 return;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
371 for (i = 0; i < fpbody.npins; i++)
43
4a50888d09ce pads2gpcb: handle error cases when the default pad is defined, but failed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 41
diff changeset
372 if (!pins_array[i].shape.defined)
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
373 pins_array[i].shape = fpbody.default_pad;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
374 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
375
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
376 static
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
377 convert_pad_to_gpcb(pinidx)
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
378 {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
379 struct footprint_pad *pin = pins_array + pinidx;
44
bf1be6c97c28 pads2gpcb: fixed conversion of elongated pads
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 43
diff changeset
380 long long_minus_short, delta;
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
381
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
382 if (!pin->shape.valid) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
383 printf("error: no pad shape for pin #%d\n", pinidx + 1);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
384 return(-1);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
385 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
386 pin->thickness = pin->shape.short_dim;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
387 pin->clearance = CLEARANCE_SETTING;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
388 pin->mask = pin->thickness + SOLDERMASK_DELTA;
44
bf1be6c97c28 pads2gpcb: fixed conversion of elongated pads
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 43
diff changeset
389 pin->x2 = pin->x1;
bf1be6c97c28 pads2gpcb: fixed conversion of elongated pads
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 43
diff changeset
390 pin->y2 = pin->y1;
bf1be6c97c28 pads2gpcb: fixed conversion of elongated pads
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 43
diff changeset
391 if (!pin->shape.elongated)
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
392 return(0);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
393 long_minus_short = pin->shape.long_dim - pin->shape.short_dim;
44
bf1be6c97c28 pads2gpcb: fixed conversion of elongated pads
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 43
diff changeset
394 delta = long_minus_short / 2;
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
395 switch (pin->shape.angle) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
396 case 0:
44
bf1be6c97c28 pads2gpcb: fixed conversion of elongated pads
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 43
diff changeset
397 pin->x1 -= delta;
bf1be6c97c28 pads2gpcb: fixed conversion of elongated pads
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 43
diff changeset
398 pin->x2 += delta;
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
399 return(0);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
400 case 90:
44
bf1be6c97c28 pads2gpcb: fixed conversion of elongated pads
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 43
diff changeset
401 pin->y1 -= delta;
bf1be6c97c28 pads2gpcb: fixed conversion of elongated pads
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 43
diff changeset
402 pin->y2 += delta;
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
403 return(0);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
404 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
405 return(-1);
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
406 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
407
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
408 static void
48
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
409 write_decal_as_element()
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
410 {
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
411 char *filename, *cp, *dp;
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
412 int c;
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
413 FILE *outf;
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
414
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
415 filename = malloc(strlen(current_decal->name) * 3 + 8);
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
416 if (!filename) {
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
417 perror("malloc for output file name");
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
418 exit(1);
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
419 }
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
420 strcpy(filename, "decals/");
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
421 dp = filename + 7;
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
422 for (cp = current_decal->name; *cp; ) {
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
423 c = *cp++;
49
b3b7013d9228 pads2gpcb.c/decals.c: allow underscores in written decal file names
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 48
diff changeset
424 if (isalnum(c) || c == '-' || c == '.' || c == '_')
48
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
425 *dp++ = c;
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
426 else {
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
427 sprintf(dp, "%%%02X", c);
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
428 dp += 3;
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
429 }
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
430 }
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
431 *dp = '\0';
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
432 outf = fopen(filename, "w");
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
433 if (!outf) {
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
434 perror(filename);
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
435 exit(1);
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
436 }
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
437 write_gpcb_element(outf, current_decal->body, 0, "", "", "", 0);
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
438 fclose(outf);
49
b3b7013d9228 pads2gpcb.c/decals.c: allow underscores in written decal file names
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 48
diff changeset
439 printf("Written to %s\n", filename);
48
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
440 free(filename);
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
441 }
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
442
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
443 static void
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
444 process_one_decal()
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
445 {
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
446 int num_drawing_pieces, num_padstack_defs;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
447 int num_text_items, num_attr_labels;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
448 int i, valid;
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
449
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
450 if (input_line_nfields < 7 || input_line_nfields > 9) {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
451 fprintf(stderr,
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
452 "%s line %d: expected beginning of part decal definition, wrong # of fields\n",
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
453 input_filename, input_lineno);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
454 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
455 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
456 enter_decal();
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
457 printf("Processing decal %s\n", current_decal->name);
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
458 bzero(&fpbody, sizeof fpbody);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
459 if (input_line_fields[1][0] != 'I' && input_line_fields[1][0] != 'M'
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
460 || input_line_fields[1][1]) {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
461 fprintf(stderr, "%s line %d: expected 'I' or 'M' in field 1\n",
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
462 input_filename, input_lineno);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
463 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
464 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
465 fpbody.src_units = input_line_fields[1][0];
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
466 if (input_units_global == 'B')
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
467 input_units_current = 'B';
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
468 else
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
469 input_units_current = fpbody.src_units;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
470 fpbody.mark_x = convert_input_dim(input_line_fields[2]);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
471 fpbody.mark_y = -convert_input_dim(input_line_fields[3]);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
472 num_drawing_pieces = atoi(input_line_fields[4]);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
473 fpbody.npins = atoi(input_line_fields[5]);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
474 num_padstack_defs = atoi(input_line_fields[6]);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
475 if (input_line_nfields > 7)
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
476 num_text_items = atoi(input_line_fields[7]);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
477 else
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
478 num_text_items = 0;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
479 if (input_line_nfields > 8)
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
480 num_attr_labels = atoi(input_line_fields[8]);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
481 else
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
482 num_attr_labels = 0;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
483
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
484 /* sanity checks */
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
485 if (fpbody.npins < 1) {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
486 fprintf(stderr, "%s line %d: # of terminals %d < 1\n",
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
487 input_filename, input_lineno, fpbody.npins);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
488 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
489 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
490 if (num_padstack_defs < 1) {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
491 fprintf(stderr, "%s line %d: # of pad stack defs %d < 1\n",
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
492 input_filename, input_lineno, num_padstack_defs);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
493 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
494 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
495
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
496 /* done parsing the header line, initialize some misc */
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
497 fpbody.refdes_scale = 100;
52
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
498 num_silk_lines = 0;
727d4e56d5c8 pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 49
diff changeset
499 num_silk_arcs = 0;
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
500
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
501 /* read and process the miscellany */
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
502 for (i = 0; i < num_drawing_pieces; i++)
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
503 one_drawing_piece();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
504 for (i = 0; i < num_text_items; i++)
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
505 one_text_item();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
506 for (i = 0; i < num_attr_labels; i++)
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
507 one_attr_label();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
508
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
509 /* the meat: allocate and fill the pins array */
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
510 pins_array = malloc(sizeof(struct footprint_pad) * fpbody.npins);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
511 if (!pins_array) {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
512 perror("malloc of the pins array");
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
513 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
514 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
515 fpbody.pins = pins_array;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
516 bzero(pins_array, sizeof(struct footprint_pad) * fpbody.npins);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
517 for (i = 0; i < fpbody.npins; i++)
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
518 read_pindef_line(i);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
519 /* read and process the pad stack definitions */
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
520 for (i = 0; i < num_padstack_defs; i++)
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
521 one_padstack_def();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
522
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
523 /* post-processing */
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
524 apply_default_padstack();
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
525 valid = 1;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
526 for (i = 0; i < fpbody.npins; i++)
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
527 if (convert_pad_to_gpcb(i) < 0)
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
528 valid = 0;
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
529 if (valid) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
530 /* good, save it */
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
531 current_decal->body = malloc(sizeof(struct footprint_body));
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
532 if (!current_decal->body) {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
533 perror("malloc to save footprint body");
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
534 exit(1);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
535 }
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
536 *current_decal->body = fpbody;
48
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
537 if (write_decal_files)
c977d637f038 pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 44
diff changeset
538 write_decal_as_element();
41
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
539 } else {
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
540 printf("decal to gpcb fp conversion FAILED\n");
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
541 free(pins_array);
a2d304ec3817 pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 40
diff changeset
542 }
40
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
543 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
544
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
545 process_partdecal_section()
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
546 {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
547 for (;;) {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
548 if (!get_input_line()) {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
549 fprintf(stderr, "error: EOF in PARTDECAL section\n");
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
550 exit(1);
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
551 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
552 if (input_line_buf[0] == '*') {
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
553 parse_starline();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
554 if (strcmp(input_line_starkw, "REMARK"))
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
555 break;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
556 else
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
557 continue;
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
558 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
559 parse_input_line_fields();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
560 if (input_line_nfields)
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
561 process_one_decal();
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
562 }
1c37bec20596 pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
563 }