FreeCalypso > hg > ueda-linux
annotate pads2gpcb/partinst.c @ 154:2328205328a9 default tip
m4-fp: WR-FPC 1mm pitch FFC/FPC connectors
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 25 Oct 2022 07:36:09 +0000 |
parents | a3d47129ebdc |
children |
rev | line source |
---|---|
65
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 #include <stdio.h> |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 #include <stdlib.h> |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 #include <ctype.h> |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 #include <string.h> |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 #include <strings.h> |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #include "globals.h" |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include "struct.h" |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 extern struct part_type *find_parttype_by_name(); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 extern struct part_decal *find_decal_by_name(); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 extern long convert_input_dim(); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 |
71
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
13 extern void coordpair_mirror_x(); |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
14 extern void coordpair_rot_90(); |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
15 extern void coordpair_rot_180(); |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
16 extern void coordpair_rot_270(); |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
17 |
65
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 static struct part_instance *our_part; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 static void |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 enter_part_inst() |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 struct part_instance *p, **pp; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 char *name = input_line_fields[0]; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 for (pp = &part_inst_list; p = *pp; pp = &p->next) |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 if (!strcmp(p->name, name)) { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 fprintf(stderr, |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 "%s line %d: part instance \"%s\" already defined\n", |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 input_filename, input_lineno, name); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 exit(1); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 p = malloc(sizeof(struct part_instance) + strlen(name) + 1); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 if (!p) { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 perror("malloc of struct part_instance"); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 exit(1); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 bzero(p, sizeof(struct part_instance)); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 p->name = (char *)(p + 1); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 strcpy(p->name, name); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 *pp = p; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 our_part = p; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 static void |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 select_decal_by_name(decalname) |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 char *decalname; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 our_part->decal = find_decal_by_name(decalname); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 if (!our_part->decal) { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 fprintf(stderr, |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 "%s line %d: part instantiation refers to unknown decal name \"%s\"\n", |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 input_filename, input_lineno, decalname); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 exit(1); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 static void |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 select_decal_by_number() |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 char *strnum = input_line_fields[7]; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 int num = atoi(strnum); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 if (num < 0 || num >= our_part->type->ndecals) { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 fprintf(stderr, |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 "%s line %d: invalid decal number \"%s\" in PART line\n", |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 input_filename, input_lineno, strnum); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 exit(1); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 our_part->decal = our_part->type->decals[num]; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 static void |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 find_type_and_decal() |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 char *typename = input_line_fields[1]; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 char *decalname; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 decalname = index(typename, '@'); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 if (decalname) |
66
68900e8dcda1
pads2gpcb/partinst.c: buglet fixed, swallows GTA02*.asc now
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
81 *decalname++ = '\0'; |
65
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 our_part->type = find_parttype_by_name(typename); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 if (!our_part->type) { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 fprintf(stderr, |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 "%s line %d: part instantiation refers to unknown part type \"%s\"\n", |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 input_filename, input_lineno, typename); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 exit(1); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 if (decalname) |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 select_decal_by_name(decalname); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 else |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 select_decal_by_number(); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 static void |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 one_attr_label() |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 int i; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 /* just skip it for now */ |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 for (i = 0; i < 3; i++) { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 if (!get_input_line()) { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 fprintf(stderr, |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 "error: EOF when expecting a part label line\n"); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 exit(1); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 static void |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 read_one_part() |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 int num_attr_labels, i; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 if (input_line_nfields < 8 || input_line_nfields > 12) { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 fprintf(stderr, |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 "%s line %d: expected beginning of part instance, wrong # of fields\n", |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 input_filename, input_lineno); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 exit(1); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 enter_part_inst(); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 printf("Processing part instance %s\n", our_part->name); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 find_type_and_decal(); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 our_part->mark_x = convert_input_dim(input_line_fields[2]); |
68
b7f49f029bc3
pads2gpcb: use Cartesian Y axis direction internally
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
67
diff
changeset
|
125 our_part->mark_y = convert_input_dim(input_line_fields[3]); |
65
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 our_part->ori = parse_input_angle_90s(input_line_fields[4]); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 if (!strcmp(input_line_fields[6], "N")) |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 our_part->onbottom = 0; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 else if (!strcmp(input_line_fields[6], "M")) |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 our_part->onbottom = 1; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 else { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 fprintf(stderr, "%s line %d: expected 'N' or 'M' in field 6\n", |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 input_filename, input_lineno); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 exit(1); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 if (input_line_nfields > 11) |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 num_attr_labels = atoi(input_line_fields[11]); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 else |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 num_attr_labels = 0; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 for (i = 0; i < num_attr_labels; i++) |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 one_attr_label(); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 static void |
67
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
145 copy_footprint_body() |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
146 { |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
147 struct footprint_body *origfp = our_part->decal->body; |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
148 struct footprint_body *newbody; |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
149 |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
150 newbody = malloc(sizeof(struct footprint_body)); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
151 if (!newbody) { |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
152 perror("malloc to copy footprint body"); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
153 exit(1); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
154 } |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
155 bcopy(origfp, newbody, sizeof(struct footprint_body)); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
156 newbody->pins = malloc(sizeof(struct footprint_pad) * origfp->npins); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
157 if (!newbody->pins) { |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
158 perror("malloc to copy footprint pads"); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
159 exit(1); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
160 } |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
161 bcopy(origfp->pins, newbody->pins, |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
162 sizeof(struct footprint_pad) * origfp->npins); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
163 if (origfp->silk_lines) { |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
164 newbody->silk_lines = |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
165 malloc(sizeof(struct element_line) * |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
166 origfp->num_silk_lines); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
167 if (!newbody->silk_lines) { |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
168 perror("malloc to copy footprint silk lines"); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
169 exit(1); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
170 } |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
171 bcopy(origfp->silk_lines, newbody->silk_lines, |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
172 sizeof(struct element_line) * origfp->num_silk_lines); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
173 } |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
174 if (origfp->silk_arcs) { |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
175 newbody->silk_arcs = |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
176 malloc(sizeof(struct element_arc) * |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
177 origfp->num_silk_arcs); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
178 if (!newbody->silk_arcs) { |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
179 perror("malloc to copy footprint silk arcs"); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
180 exit(1); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
181 } |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
182 bcopy(origfp->silk_arcs, newbody->silk_arcs, |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
183 sizeof(struct element_arc) * origfp->num_silk_arcs); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
184 } |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
185 our_part->body = newbody; |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
186 } |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
187 |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
188 static void |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
189 part_inst_fail(reason) |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
190 char *reason; |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
191 { |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
192 printf("Omitting component %s: %s\n", our_part->name, reason); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
193 } |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
194 |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
195 static void |
65
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
196 process_one_part() |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
197 { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
198 read_one_part(); |
67
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
199 /* analyze it */ |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
200 if (!our_part->decal->body) { |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
201 part_inst_fail("bad decal"); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
202 return; |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
203 } |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
204 if (our_part->type->num_alpha_pins && |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
205 our_part->type->num_alpha_pins != our_part->decal->body->npins) { |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
206 part_inst_fail("alpha pins count mismatch"); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
207 return; |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
208 } |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
209 if (our_part->ori < 0) { |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
210 part_inst_fail("non-rectangular orientation"); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
211 return; |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
212 } |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
213 |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
214 /* subsetting and renaming logic will go here */ |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
215 our_part->newname = our_part->name; |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
216 copy_footprint_body(); |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
217 our_part->body->mark_x = our_part->mark_x; |
e14cd5433e83
pads2gpcb/partinst.c: checkpoint before adding mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
66
diff
changeset
|
218 our_part->body->mark_y = our_part->mark_y; |
71
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
219 switch (our_part->ori) { |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
220 case 0: |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
221 break; |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
222 case 90: |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
223 manipulate_footprint_coord_pairs(our_part->body, |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
224 coordpair_rot_90); |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
225 break; |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
226 case 180: |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
227 manipulate_footprint_coord_pairs(our_part->body, |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
228 coordpair_rot_180); |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
229 break; |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
230 case 270: |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
231 manipulate_footprint_coord_pairs(our_part->body, |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
232 coordpair_rot_270); |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
233 } |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
234 if (our_part->onbottom) |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
235 manipulate_footprint_coord_pairs(our_part->body, |
a3d47129ebdc
pads2gpcb: implemented mirroring and rotation of instantiated parts
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
236 coordpair_mirror_x); |
65
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
237 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
238 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
239 process_part_section() |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
240 { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
241 input_units_current = input_units_global; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
242 for (;;) { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
243 if (!get_input_line()) { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
244 fprintf(stderr, "error: EOF in PART section\n"); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
245 exit(1); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
246 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
247 if (input_line_buf[0] == '*') { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
248 parse_starline(); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
249 if (strcmp(input_line_starkw, "REMARK")) |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
250 break; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
251 else |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
252 continue; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
253 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
254 parse_input_line_fields(); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
255 if (input_line_nfields) |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
256 process_one_part(); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
257 } |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
258 } |