FreeCalypso > hg > ueda-linux
comparison pads2gpcb/partinst.c @ 67:e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sun, 31 Jan 2016 22:59:36 +0000 |
parents | 68900e8dcda1 |
children | b7f49f029bc3 |
comparison
equal
deleted
inserted
replaced
66:68900e8dcda1 | 67:e14cd5433e83 |
---|---|
135 for (i = 0; i < num_attr_labels; i++) | 135 for (i = 0; i < num_attr_labels; i++) |
136 one_attr_label(); | 136 one_attr_label(); |
137 } | 137 } |
138 | 138 |
139 static void | 139 static void |
140 copy_footprint_body() | |
141 { | |
142 struct footprint_body *origfp = our_part->decal->body; | |
143 struct footprint_body *newbody; | |
144 | |
145 newbody = malloc(sizeof(struct footprint_body)); | |
146 if (!newbody) { | |
147 perror("malloc to copy footprint body"); | |
148 exit(1); | |
149 } | |
150 bcopy(origfp, newbody, sizeof(struct footprint_body)); | |
151 newbody->pins = malloc(sizeof(struct footprint_pad) * origfp->npins); | |
152 if (!newbody->pins) { | |
153 perror("malloc to copy footprint pads"); | |
154 exit(1); | |
155 } | |
156 bcopy(origfp->pins, newbody->pins, | |
157 sizeof(struct footprint_pad) * origfp->npins); | |
158 if (origfp->silk_lines) { | |
159 newbody->silk_lines = | |
160 malloc(sizeof(struct element_line) * | |
161 origfp->num_silk_lines); | |
162 if (!newbody->silk_lines) { | |
163 perror("malloc to copy footprint silk lines"); | |
164 exit(1); | |
165 } | |
166 bcopy(origfp->silk_lines, newbody->silk_lines, | |
167 sizeof(struct element_line) * origfp->num_silk_lines); | |
168 } | |
169 if (origfp->silk_arcs) { | |
170 newbody->silk_arcs = | |
171 malloc(sizeof(struct element_arc) * | |
172 origfp->num_silk_arcs); | |
173 if (!newbody->silk_arcs) { | |
174 perror("malloc to copy footprint silk arcs"); | |
175 exit(1); | |
176 } | |
177 bcopy(origfp->silk_arcs, newbody->silk_arcs, | |
178 sizeof(struct element_arc) * origfp->num_silk_arcs); | |
179 } | |
180 our_part->body = newbody; | |
181 } | |
182 | |
183 static void | |
184 part_inst_fail(reason) | |
185 char *reason; | |
186 { | |
187 printf("Omitting component %s: %s\n", our_part->name, reason); | |
188 } | |
189 | |
190 static void | |
140 process_one_part() | 191 process_one_part() |
141 { | 192 { |
142 read_one_part(); | 193 read_one_part(); |
194 /* analyze it */ | |
195 if (!our_part->decal->body) { | |
196 part_inst_fail("bad decal"); | |
197 return; | |
198 } | |
199 if (our_part->type->num_alpha_pins && | |
200 our_part->type->num_alpha_pins != our_part->decal->body->npins) { | |
201 part_inst_fail("alpha pins count mismatch"); | |
202 return; | |
203 } | |
204 if (our_part->ori < 0) { | |
205 part_inst_fail("non-rectangular orientation"); | |
206 return; | |
207 } | |
208 | |
209 /* subsetting and renaming logic will go here */ | |
210 our_part->newname = our_part->name; | |
211 copy_footprint_body(); | |
212 our_part->body->mark_x = our_part->mark_x; | |
213 our_part->body->mark_y = our_part->mark_y; | |
214 /* rotation and mirroring to be implemented */ | |
143 } | 215 } |
144 | 216 |
145 process_part_section() | 217 process_part_section() |
146 { | 218 { |
147 input_units_current = input_units_global; | 219 input_units_current = input_units_global; |