FreeCalypso > hg > ueda-linux
annotate pads2gpcb/decals.c @ 94:73029295c4dd
ifctf-part-lib/uschem-symbols: added Si1032R.pinout and ipc-diode.pinout
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 24 Aug 2019 08:54:11 +0000 |
parents | f673b6ad2a78 |
children |
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 |
62
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
15 #define MAX_SILK_LINES 64 |
52
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 |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 static void |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 enter_decal() |
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 struct part_decal *p, **pp; |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 char *name = input_line_fields[0]; |
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 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
|
28 if (!strcmp(p->name, name)) { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 fprintf(stderr, |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 "%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
|
31 input_filename, input_lineno, name); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 exit(1); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 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
|
35 if (!p) { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 perror("malloc of struct part_decal"); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 exit(1); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 p->name = (char *)(p + 1); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 strcpy(p->name, name); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 p->body = 0; |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 p->next = 0; |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
43 *pp = p; |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 current_decal = p; |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 static void |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 get_line_internal() |
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 if (!get_input_line()) { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 fprintf(stderr, |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 "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
|
53 exit(1); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 |
52
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
57 static |
62
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
58 drawpiece_silk_candidate() |
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
59 { |
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
60 int level; |
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
61 |
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
62 if (input_line_nfields != 5) |
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
63 return(0); |
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
64 level = atoi(input_line_fields[4]); |
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
65 return is_drawlevel_selected(level); |
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
66 } |
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
67 |
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
68 static |
52
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
69 try_silk_open_closed() |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
70 { |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
71 int ncoord, i, bad; |
69
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
72 struct coord_pair coord[MAX_SILK_LINES+1]; |
52
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
73 long thickness; |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
74 |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
75 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
|
76 strcmp(input_line_fields[0], "CLOSED")) |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
77 return(0); |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
78 ncoord = atoi(input_line_fields[1]); |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
79 if (ncoord < 2) { |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
80 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
|
81 input_line_fields[0]); |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
82 return(0); |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
83 } |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
84 if (ncoord > MAX_SILK_LINES + 1) { |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
85 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
|
86 input_line_fields[0]); |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
87 return(0); |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
88 } |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
89 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
|
90 |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
91 bad = 0; |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
92 for (i = 0; i < ncoord; i++) { |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
93 get_line_internal(); |
53
0e18818206e5
pads2gpcb/decals.c: silk line extraction appears to work
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
52
diff
changeset
|
94 parse_input_line_fields(); |
52
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
95 if (input_line_nfields != 2) { |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
96 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
|
97 input_lineno); |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
98 bad = 1; |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
99 continue; |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
100 } |
69
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
101 coord[i].x = convert_input_dim(input_line_fields[0]); |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
102 coord[i].y = convert_input_dim(input_line_fields[1]); |
52
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
103 } |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
104 if (bad) |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
105 return(1); |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
106 |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
107 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
|
108 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
|
109 printf("Too many silk lines!\n"); |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
110 return(1); |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
111 } |
69
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
112 silk_lines[num_silk_lines].end1 = coord[i]; |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
113 silk_lines[num_silk_lines].end2 = coord[i+1]; |
52
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
114 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
|
115 num_silk_lines++; |
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 return(1); |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
118 } |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
119 |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
120 static |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
121 try_silk_circle() |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
122 { |
54
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
123 int i, bad; |
69
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
124 struct coord_pair coord[2], centre; |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
125 long diameter, thickness; |
54
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
126 |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
127 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
|
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[1], "2")) { |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
130 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
|
131 input_lineno); |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
132 return(0); |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
133 } |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
134 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
|
135 |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
136 bad = 0; |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
137 for (i = 0; i < 2; i++) { |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
138 get_line_internal(); |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
139 parse_input_line_fields(); |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
140 if (input_line_nfields != 2) { |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
141 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
|
142 input_lineno); |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
143 bad = 1; |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
144 continue; |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
145 } |
69
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
146 coord[i].x = convert_input_dim(input_line_fields[0]); |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
147 coord[i].y = convert_input_dim(input_line_fields[1]); |
54
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
148 } |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
149 if (bad) |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
150 return(1); |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
151 |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
152 /* find the centre and diameter */ |
69
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
153 if (coord[0].x == coord[1].x) { |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
154 centre.x = coord[0].x; |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
155 if (coord[0].y < coord[1].y) { |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
156 diameter = coord[1].y - coord[0].y; |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
157 centre.y = coord[0].y + diameter / 2; |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
158 } else if (coord[1].y < coord[0].y) { |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
159 diameter = coord[0].y - coord[1].y; |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
160 centre.y = coord[1].y + diameter / 2; |
54
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
161 } else |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
162 goto centre_diam_fail; |
69
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
163 } else if (coord[0].y == coord[1].y) { |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
164 centre.y = coord[0].y; |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
165 if (coord[0].x < coord[1].x) { |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
166 diameter = coord[1].x - coord[0].x; |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
167 centre.x = coord[0].x + diameter / 2; |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
168 } else if (coord[1].x < coord[0].x) { |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
169 diameter = coord[0].x - coord[1].x; |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
170 centre.x = coord[1].x + diameter / 2; |
54
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
171 } else |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
172 goto centre_diam_fail; |
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 centre_diam_fail: |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
175 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
|
176 input_lineno); |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
177 return(1); |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
178 } |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
179 if (diameter % 2) |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
180 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
|
181 input_lineno); |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
182 |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
183 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
|
184 printf("Too many silk arcs!\n"); |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
185 return(1); |
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
186 } |
69
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
187 silk_arcs[num_silk_arcs].centre = centre; |
59
aeef205f7580
pads2gpcb: width and height in ElementArc need be radius, not diameter
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
58
diff
changeset
|
188 silk_arcs[num_silk_arcs].width = diameter / 2; |
aeef205f7580
pads2gpcb: width and height in ElementArc need be radius, not diameter
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
58
diff
changeset
|
189 silk_arcs[num_silk_arcs].height = diameter / 2; |
54
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
190 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
|
191 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
|
192 silk_arcs[num_silk_arcs].thickness = thickness; |
58
05fd0b432e8c
pads2gpcb/decals.c: forgot to increment num_silk_arcs
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
193 num_silk_arcs++; |
54
a930e05cf908
pads2gpcb/decals.c: silk circle extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
53
diff
changeset
|
194 return(1); |
52
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
195 } |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
196 |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
197 static void |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
198 one_drawing_piece() |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
199 { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
200 int ncoord, i; |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
201 |
52
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
202 /* 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
|
203 get_line_internal(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
204 parse_input_line_fields(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
205 if (input_line_nfields < 2) { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
206 fprintf(stderr, |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
207 "%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
|
208 input_filename, input_lineno); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
209 exit(1); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
210 } |
62
9d7e2937883d
pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
61
diff
changeset
|
211 if (do_footprint_silk && drawpiece_silk_candidate()) { |
52
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
212 if (try_silk_open_closed()) |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
213 return; |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
214 if (try_silk_circle()) |
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 } |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
217 ncoord = atoi(input_line_fields[1]); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
218 for (i = 0; i < ncoord; i++) |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
219 get_line_internal(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
220 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
221 |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
222 static void |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
223 one_text_item() |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
224 { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
225 /* just skip it for now */ |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
226 get_line_internal(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
227 get_line_internal(); |
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 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
230 |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
231 static void |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
232 one_attr_label() |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
233 { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
234 /* just skip it for now */ |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
235 get_line_internal(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
236 get_line_internal(); |
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 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
239 |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
240 static void |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
241 read_pindef_line(idx) |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
242 { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
243 get_line_internal(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
244 if (input_line_buf[0] != 'T') { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
245 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
|
246 input_filename, input_lineno); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
247 exit(1); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
248 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
249 parse_input_line_fields(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
250 if (input_line_nfields != 5) { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
251 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
|
252 input_filename, input_lineno); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
253 exit(1); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
254 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
255 input_line_fields[0]++; |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
256 |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
257 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
|
258 fprintf(stderr, |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
259 "%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
|
260 input_filename, input_lineno); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
261 exit(1); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
262 } |
69
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
263 pins_array[idx].end1.x = convert_input_dim(input_line_fields[0]); |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
264 pins_array[idx].end1.y = convert_input_dim(input_line_fields[1]); |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
265 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
266 |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
267 static void |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
268 process_pad_shape(padptr) |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
269 struct pad_shape_info *padptr; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
270 { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
271 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
|
272 if (padptr->short_dim <= 0) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
273 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
|
274 return; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
275 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
276 if (!strcmp(input_line_fields[2], "R")) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
277 padptr->rounded = 1; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
278 padptr->elongated = 0; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
279 } else if (!strcmp(input_line_fields[2], "S")) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
280 padptr->rounded = 0; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
281 padptr->elongated = 0; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
282 } else if (!strcmp(input_line_fields[2], "OF")) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
283 padptr->rounded = 1; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
284 padptr->elongated = 1; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
285 } else if (!strcmp(input_line_fields[2], "RF")) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
286 padptr->rounded = 0; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
287 padptr->elongated = 1; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
288 } else { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
289 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
|
290 input_line_fields[2]); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
291 return; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
292 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
293 if (padptr->elongated) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
294 if (input_line_nfields < 6) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
295 fprintf(stderr, |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
296 "%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
|
297 input_filename, input_lineno); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
298 exit(1); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
299 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
300 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
|
301 if (padptr->angle != 0 && padptr->angle != 90) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
302 printf("line %d: unsupported OF/RF angle\n", |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
303 input_lineno); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
304 return; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
305 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
306 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
|
307 if (strcmp(input_line_fields[5], "0")) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
308 printf("line %d: unsupported nonzero finoffset\n", |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
309 input_lineno); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
310 return; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
311 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
312 if (padptr->long_dim <= padptr->short_dim) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
313 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
|
314 input_lineno); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
315 return; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
316 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
317 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
318 padptr->valid = 1; |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
319 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
320 |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
321 static void |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
322 one_padstack_def() |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
323 { |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
324 int pinno, stacklines, i; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
325 struct pad_shape_info *padptr; |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
326 |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
327 get_line_internal(); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
328 parse_input_line_fields(); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
329 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
|
330 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
|
331 input_filename, input_lineno); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
332 exit(1); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
333 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
334 pinno = atoi(input_line_fields[1]); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
335 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
|
336 |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
337 if (pinno < 0 || pinno > fpbody.npins) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
338 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
|
339 input_filename, input_lineno); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
340 exit(1); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
341 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
342 if (pinno) |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
343 padptr = &pins_array[pinno-1].shape; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
344 else |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
345 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
|
346 padptr->defined = 1; |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
347 |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
348 for (i = 0; i < stacklines; i++) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
349 get_line_internal(); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
350 parse_input_line_fields(); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
351 if (input_line_nfields < 3) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
352 fprintf(stderr, |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
353 "%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
|
354 input_filename, input_lineno); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
355 exit(1); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
356 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
357 if (!strcmp(input_line_fields[0], "-2")) |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
358 process_pad_shape(padptr); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
359 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
360 } |
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 static void |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
363 apply_default_padstack() |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
364 { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
365 int i; |
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 if (!fpbody.default_pad.valid) |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
368 return; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
369 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
|
370 if (!pins_array[i].shape.defined) |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
371 pins_array[i].shape = fpbody.default_pad; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
372 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
373 |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
374 static |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
375 convert_pad_to_gpcb(pinidx) |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
376 { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
377 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
|
378 long long_minus_short, delta; |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
379 |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
380 if (!pin->shape.valid) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
381 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
|
382 return(-1); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
383 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
384 pin->thickness = pin->shape.short_dim; |
76
f673b6ad2a78
pads2gpcb: soldermask delta and clearance setting moved to variables
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
72
diff
changeset
|
385 pin->clearance = clearance_setting; |
f673b6ad2a78
pads2gpcb: soldermask delta and clearance setting moved to variables
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
72
diff
changeset
|
386 pin->mask = pin->thickness + soldermask_delta; |
69
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
387 pin->end2 = pin->end1; |
44
bf1be6c97c28
pads2gpcb: fixed conversion of elongated pads
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
43
diff
changeset
|
388 if (!pin->shape.elongated) |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
389 return(0); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
390 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
|
391 delta = long_minus_short / 2; |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
392 switch (pin->shape.angle) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
393 case 0: |
69
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
394 pin->end1.x -= delta; |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
395 pin->end2.x += delta; |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
396 return(0); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
397 case 90: |
69
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
398 pin->end1.y -= delta; |
a7f0e9bb3fb7
pads2gpcb: struct coord_pair introduced
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
68
diff
changeset
|
399 pin->end2.y += delta; |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
400 return(0); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
401 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
402 return(-1); |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
403 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
404 |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
405 static void |
48
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
406 write_decal_as_element() |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
407 { |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
408 char *filename, *cp, *dp; |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
409 int c; |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
410 FILE *outf; |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
411 |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
412 filename = malloc(strlen(current_decal->name) * 3 + 8); |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
413 if (!filename) { |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
414 perror("malloc for output file name"); |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
415 exit(1); |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
416 } |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
417 strcpy(filename, "decals/"); |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
418 dp = filename + 7; |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
419 for (cp = current_decal->name; *cp; ) { |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
420 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
|
421 if (isalnum(c) || c == '-' || c == '.' || c == '_') |
48
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
422 *dp++ = c; |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
423 else { |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
424 sprintf(dp, "%%%02X", c); |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
425 dp += 3; |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
426 } |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
427 } |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
428 *dp = '\0'; |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
429 outf = fopen(filename, "w"); |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
430 if (!outf) { |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
431 perror(filename); |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
432 exit(1); |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
433 } |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
434 write_gpcb_element(outf, current_decal->body, 0, "", "", "", 0); |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
435 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
|
436 printf("Written to %s\n", filename); |
48
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
437 free(filename); |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
438 } |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
439 |
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
440 static void |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
441 process_one_decal() |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
442 { |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
443 int num_drawing_pieces, num_padstack_defs; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
444 int num_text_items, num_attr_labels; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
445 int i, valid; |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
446 |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
447 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
|
448 fprintf(stderr, |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
449 "%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
|
450 input_filename, input_lineno); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
451 exit(1); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
452 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
453 enter_decal(); |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
454 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
|
455 bzero(&fpbody, sizeof fpbody); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
456 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
|
457 || input_line_fields[1][1]) { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
458 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
|
459 input_filename, input_lineno); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
460 exit(1); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
461 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
462 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
|
463 if (input_units_global == 'B') |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
464 input_units_current = 'B'; |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
465 else |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
466 input_units_current = fpbody.src_units; |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
467 fpbody.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:
63
diff
changeset
|
468 fpbody.mark_y = convert_input_dim(input_line_fields[3]); |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
469 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
|
470 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
|
471 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
|
472 if (input_line_nfields > 7) |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
473 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
|
474 else |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
475 num_text_items = 0; |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
476 if (input_line_nfields > 8) |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
477 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
|
478 else |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
479 num_attr_labels = 0; |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
480 |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
481 /* 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
|
482 fpbody.refdes_scale = 100; |
52
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
483 num_silk_lines = 0; |
727d4e56d5c8
pads2gpcb/decals.c: silk line extraction implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
49
diff
changeset
|
484 num_silk_arcs = 0; |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
485 |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
486 /* read and process the miscellany */ |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
487 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
|
488 one_drawing_piece(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
489 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
|
490 one_text_item(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
491 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
|
492 one_attr_label(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
493 |
61
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
494 /* deal with dummies */ |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
495 if (fpbody.npins == 0 && num_padstack_defs == 0) { |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
496 printf("Dummy decal with no pins, skipping\n"); |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
497 return; |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
498 } |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
499 if (fpbody.npins < 1) { |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
500 fprintf(stderr, "Error in decal %s: # of terminals %d < 1\n", |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
501 current_decal->name, fpbody.npins); |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
502 exit(1); |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
503 } |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
504 if (num_padstack_defs < 1) { |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
505 fprintf(stderr, |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
506 "Error in decal %s: # of pad stack defs %d < 1\n", |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
507 current_decal->name, num_padstack_defs); |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
508 exit(1); |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
509 } |
ff1d565d233c
pads2gpcb: handle dummy decals with no pins (found in the E-Sample PCB)
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
60
diff
changeset
|
510 |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
511 /* 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
|
512 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
|
513 if (!pins_array) { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
514 perror("malloc of the pins array"); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
515 exit(1); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
516 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
517 fpbody.pins = pins_array; |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
518 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
|
519 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
|
520 read_pindef_line(i); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
521 /* 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
|
522 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
|
523 one_padstack_def(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
524 |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
525 /* post-processing */ |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
526 apply_default_padstack(); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
527 valid = 1; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
528 for (i = 0; i < fpbody.npins; i++) |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
529 if (convert_pad_to_gpcb(i) < 0) |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
530 valid = 0; |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
531 if (valid) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
532 /* good, save it */ |
55
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
533 if (num_silk_lines) { |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
534 fpbody.silk_lines = |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
535 malloc(sizeof(struct element_line) * num_silk_lines); |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
536 if (!fpbody.silk_lines) { |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
537 perror("malloc to save silk lines"); |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
538 exit(1); |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
539 } |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
540 bcopy(silk_lines, fpbody.silk_lines, |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
541 sizeof(struct element_line) * num_silk_lines); |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
542 fpbody.num_silk_lines = num_silk_lines; |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
543 } |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
544 if (num_silk_arcs) { |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
545 fpbody.silk_arcs = |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
546 malloc(sizeof(struct element_arc) * num_silk_arcs); |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
547 if (!fpbody.silk_arcs) { |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
548 perror("malloc to save silk arcs"); |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
549 exit(1); |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
550 } |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
551 bcopy(silk_arcs, fpbody.silk_arcs, |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
552 sizeof(struct element_arc) * num_silk_arcs); |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
553 fpbody.num_silk_arcs = num_silk_arcs; |
e93375570f91
pads2gpcb/decals.c: saving of silk lines and arcs implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
54
diff
changeset
|
554 } |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
555 current_decal->body = malloc(sizeof(struct footprint_body)); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
556 if (!current_decal->body) { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
557 perror("malloc to save footprint body"); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
558 exit(1); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
559 } |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
560 *current_decal->body = fpbody; |
72
fab9fc646044
pads2gpcb: single -f option to write loose footprint files
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
69
diff
changeset
|
561 if (write_footprint_files) |
48
c977d637f038
pads2gpcb: decals/* writing implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
44
diff
changeset
|
562 write_decal_as_element(); |
41
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
563 } else { |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
564 printf("decal to gpcb fp conversion FAILED\n"); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
565 free(pins_array); |
a2d304ec3817
pads2gpcb: decal processing code compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
40
diff
changeset
|
566 } |
40
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
567 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
568 |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
569 process_partdecal_section() |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
570 { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
571 for (;;) { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
572 if (!get_input_line()) { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
573 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
|
574 exit(1); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
575 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
576 if (input_line_buf[0] == '*') { |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
577 parse_starline(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
578 if (strcmp(input_line_starkw, "REMARK")) |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
579 break; |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
580 else |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
581 continue; |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
582 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
583 parse_input_line_fields(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
584 if (input_line_nfields) |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
585 process_one_decal(); |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
586 } |
1c37bec20596
pads2gpcb: slowly working on the decal processing logic
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
587 } |
63
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
62
diff
changeset
|
588 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
62
diff
changeset
|
589 struct part_decal * |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
62
diff
changeset
|
590 find_decal_by_name(name) |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
62
diff
changeset
|
591 char *name; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
62
diff
changeset
|
592 { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
62
diff
changeset
|
593 struct part_decal *p; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
62
diff
changeset
|
594 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
62
diff
changeset
|
595 for (p = part_decal_list; p; p = p->next) |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
62
diff
changeset
|
596 if (!strcmp(p->name, name)) |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
62
diff
changeset
|
597 break; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
62
diff
changeset
|
598 return(p); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
62
diff
changeset
|
599 } |