FreeCalypso > hg > ueda-linux
annotate pads2gpcb/parttype.c @ 152:d41cdd682db5
m4-fp: support for CUI DS04-254-SMT DIP switch series
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 24 Jun 2021 05:13:16 +0000 |
parents | ac13abc7dc0d |
children |
rev | line source |
---|---|
63
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 #include <stdio.h> |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 #include <stdlib.h> |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 #include <ctype.h> |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 #include <string.h> |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 #include <strings.h> |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #include "globals.h" |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include "struct.h" |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 extern struct part_decal *find_decal_by_name(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 extern char *savestr(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 static struct part_type *our_parttype; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 static int ngates, nsignals; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 static void |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 enter_parttype() |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 struct part_type *p, **pp; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 char *name = input_line_fields[0]; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 for (pp = &part_type_list; p = *pp; pp = &p->next) |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 if (!strcmp(p->name, name)) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 fprintf(stderr, |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 "%s line %d: part type name \"%s\" already defined\n", |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 input_filename, input_lineno, name); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 exit(1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 p = malloc(sizeof(struct part_type) + strlen(name) + 1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 if (!p) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 perror("malloc of struct part_type"); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 exit(1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 bzero(p, sizeof(struct part_type)); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 p->name = (char *)(p + 1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 strcpy(p->name, name); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 *pp = p; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 our_parttype = p; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 static void |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 find_decals() |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 char *cp, *np; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 struct part_decal *decal; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 for (cp = input_line_fields[1]; cp; cp = np) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 np = index(cp, ':'); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 if (np) |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 *np++ = '\0'; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 if (!*cp) |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 continue; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 decal = find_decal_by_name(cp); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 if (!decal) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 fprintf(stderr, |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 "%s line %d: part type definition refers to unknown decal name \"%s\"\n", |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 input_filename, input_lineno, cp); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 exit(1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 if (our_parttype->ndecals >= MAX_DECALS_PER_PART_TYPE) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 fprintf(stderr, |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 "%s line %d: MAX_DECALS_PER_PART_TYPE exceeded\n", |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 input_filename, input_lineno); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 exit(1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 our_parttype->decals[our_parttype->ndecals++] = decal; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 if (!our_parttype->ndecals) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 fprintf(stderr, |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 "%s line %d: empty list of decals in part type def\n", |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 input_filename, input_lineno); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 exit(1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 static void |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 process_header_line() |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 if (input_line_nfields < 6) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 fprintf(stderr, |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 "%s line %d: expected beginning of part type definition, wrong # of fields\n", |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 input_filename, input_lineno); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 exit(1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 enter_parttype(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 printf("Processing part type %s\n", our_parttype->name); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 find_decals(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 ngates = atoi(input_line_fields[3]); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 nsignals = atoi(input_line_fields[4]); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 our_parttype->num_alpha_pins = atoi(input_line_fields[5]); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 static void |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 get_line_internal() |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 if (!get_input_line()) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 fprintf(stderr, |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 "error: EOF in the middle of a part type definition\n"); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 exit(1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 static void |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 process_one_gate_def() |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 int gatepins; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 get_line_internal(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 parse_input_line_fields(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 if (input_line_nfields != 3 || strcmp(input_line_fields[0], "G")) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 fprintf(stderr, "%s line %d: expected gate def header line\n", |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 input_filename, input_lineno); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 exit(1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 gatepins = atoi(input_line_fields[2]); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 while (gatepins > 0) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 get_line_internal(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 parse_input_line_fields(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 gatepins -= input_line_nfields; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 static void |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 alloc_alpha_pins_array() |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 our_parttype->alpha_pins = |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 malloc(sizeof(char *) * our_parttype->num_alpha_pins); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 if (!our_parttype->alpha_pins) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 perror("malloc of alpha_pins array"); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 exit(1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 static void |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 read_alpha_pins() |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 int idx, i; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 for (idx = 0; idx < our_parttype->num_alpha_pins; ) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 get_line_internal(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 parse_input_line_fields(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 for (i = 0; i < input_line_nfields; i++) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 if (idx >= our_parttype->num_alpha_pins) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 fprintf(stderr, |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 "%s line %d: alpha_pins array overflow\n", |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 input_filename, input_lineno); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 exit(1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
148 our_parttype->alpha_pins[idx++] = |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 savestr(input_line_fields[i]); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
153 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
154 static void |
79
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
155 write_alpha_pins_footprint() |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
156 { |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
157 struct footprint_body *fpbody; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
158 char *filename, *cp, *dp; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
159 int c; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
160 FILE *outf; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
161 |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
162 if (our_parttype->ndecals != 1) { |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
163 printf( |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
164 "Warning: part type with alpha pins and multiple decals: save not supported\n"); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
165 return; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
166 } |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
167 fpbody = our_parttype->decals[0]->body; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
168 if (!fpbody) |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
169 return; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
170 if (our_parttype->num_alpha_pins != fpbody->npins) { |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
171 printf("Error: # of alpha pin names != # of actual pins\n"); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
172 return; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
173 } |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
174 |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
175 filename = malloc(strlen(our_parttype->name) * 3 + 11); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
176 if (!filename) { |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
177 perror("malloc for output file name"); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
178 exit(1); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
179 } |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
180 strcpy(filename, "alphapins/"); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
181 dp = filename + 10; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
182 for (cp = our_parttype->name; *cp; ) { |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
183 c = *cp++; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
184 if (isalnum(c) || c == '-' || c == '.' || c == '_') |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
185 *dp++ = c; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
186 else { |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
187 sprintf(dp, "%%%02X", c); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
188 dp += 3; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
189 } |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
190 } |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
191 *dp = '\0'; |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
192 outf = fopen(filename, "w"); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
193 if (!outf) { |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
194 perror(filename); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
195 exit(1); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
196 } |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
197 write_gpcb_element(outf, fpbody, our_parttype->alpha_pins, |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
198 "", "", "", 0); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
199 fclose(outf); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
200 printf("Written to %s\n", filename); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
201 free(filename); |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
202 } |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
203 |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
204 static void |
63
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
205 process_one_parttype() |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
206 { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
207 int i; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
208 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
209 process_header_line(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
210 for (i = 0; i < ngates; i++) |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
211 process_one_gate_def(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
212 for (i = 0; i < nsignals; i++) |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
213 get_line_internal(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
214 if (our_parttype->num_alpha_pins) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
215 alloc_alpha_pins_array(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
216 read_alpha_pins(); |
79
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
217 if (write_footprint_files) |
ac13abc7dc0d
pads2gpcb -f: saving of alphapins footprints implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
65
diff
changeset
|
218 write_alpha_pins_footprint(); |
63
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
219 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
220 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
221 |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
222 process_parttype_section() |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
223 { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
224 for (;;) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
225 if (!get_input_line()) { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
226 fprintf(stderr, "error: EOF in PARTTYPE section\n"); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
227 exit(1); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
228 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
229 if (input_line_buf[0] == '*') { |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
230 parse_starline(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
231 if (strcmp(input_line_starkw, "REMARK")) |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
232 break; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
233 else |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
234 continue; |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
235 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
236 parse_input_line_fields(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
237 if (input_line_nfields) |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
238 process_one_parttype(); |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
239 } |
455a0051f9d2
pads2gpcb: PARTTYPE parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
240 } |
65
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
63
diff
changeset
|
241 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
63
diff
changeset
|
242 struct part_type * |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
63
diff
changeset
|
243 find_parttype_by_name(name) |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
63
diff
changeset
|
244 char *name; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
63
diff
changeset
|
245 { |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
63
diff
changeset
|
246 struct part_type *p; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
63
diff
changeset
|
247 |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
63
diff
changeset
|
248 for (p = part_type_list; p; p = p->next) |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
63
diff
changeset
|
249 if (!strcmp(p->name, name)) |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
63
diff
changeset
|
250 break; |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
63
diff
changeset
|
251 return(p); |
2b71943a311b
pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
63
diff
changeset
|
252 } |