annotate pads2gpcb/partinst.c @ 65:2b71943a311b

pads2gpcb: PART section parsing implemented, compiles
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 31 Jan 2016 21:32:08 +0000
parents
children 68900e8dcda1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
65
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 #include <stdio.h>
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 #include <stdlib.h>
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 #include <ctype.h>
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4 #include <string.h>
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <strings.h>
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 #include "globals.h"
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 #include "struct.h"
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 extern struct part_type *find_parttype_by_name();
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 extern struct part_decal *find_decal_by_name();
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11 extern long convert_input_dim();
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 static struct part_instance *our_part;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 static void
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 enter_part_inst()
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18 struct part_instance *p, **pp;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 char *name = input_line_fields[0];
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 for (pp = &part_inst_list; p = *pp; pp = &p->next)
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 if (!strcmp(p->name, name)) {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23 fprintf(stderr,
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 "%s line %d: part instance \"%s\" already defined\n",
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 input_filename, input_lineno, name);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 exit(1);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 p = malloc(sizeof(struct part_instance) + strlen(name) + 1);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 if (!p) {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30 perror("malloc of struct part_instance");
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 exit(1);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 bzero(p, sizeof(struct part_instance));
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 p->name = (char *)(p + 1);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 strcpy(p->name, name);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 *pp = p;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 our_part = p;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
40 static void
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
41 select_decal_by_name(decalname)
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
42 char *decalname;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
43 {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
44 our_part->decal = find_decal_by_name(decalname);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
45 if (!our_part->decal) {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
46 fprintf(stderr,
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
47 "%s line %d: part instantiation refers to unknown decal name \"%s\"\n",
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
48 input_filename, input_lineno, decalname);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
49 exit(1);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
50 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
51 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
52
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
53 static void
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
54 select_decal_by_number()
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
55 {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
56 char *strnum = input_line_fields[7];
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
57 int num = atoi(strnum);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
58
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
59 if (num < 0 || num >= our_part->type->ndecals) {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
60 fprintf(stderr,
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
61 "%s line %d: invalid decal number \"%s\" in PART line\n",
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
62 input_filename, input_lineno, strnum);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
63 exit(1);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
64 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
65 our_part->decal = our_part->type->decals[num];
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
66 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
67
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
68 static void
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
69 find_type_and_decal()
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
70 {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
71 char *typename = input_line_fields[1];
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
72 char *decalname;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
73
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
74 decalname = index(typename, '@');
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
75 if (decalname)
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
76 *decalname++;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
77 our_part->type = find_parttype_by_name(typename);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
78 if (!our_part->type) {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
79 fprintf(stderr,
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
80 "%s line %d: part instantiation refers to unknown part type \"%s\"\n",
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
81 input_filename, input_lineno, typename);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
82 exit(1);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
83 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
84 if (decalname)
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
85 select_decal_by_name(decalname);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
86 else
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
87 select_decal_by_number();
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
88 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
89
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
90 static void
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
91 one_attr_label()
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
92 {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
93 int i;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
94
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
95 /* just skip it for now */
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
96 for (i = 0; i < 3; i++) {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
97 if (!get_input_line()) {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
98 fprintf(stderr,
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
99 "error: EOF when expecting a part label line\n");
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
100 exit(1);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
101 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
102 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
103 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
104
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
105 static void
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
106 read_one_part()
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
107 {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
108 int num_attr_labels, i;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
109
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
110 if (input_line_nfields < 8 || input_line_nfields > 12) {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
111 fprintf(stderr,
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
112 "%s line %d: expected beginning of part instance, wrong # of fields\n",
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
113 input_filename, input_lineno);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
114 exit(1);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
115 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
116 enter_part_inst();
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
117 printf("Processing part instance %s\n", our_part->name);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
118 find_type_and_decal();
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
119 our_part->mark_x = convert_input_dim(input_line_fields[2]);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
120 our_part->mark_y = -convert_input_dim(input_line_fields[3]);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
121 our_part->ori = parse_input_angle_90s(input_line_fields[4]);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
122 if (!strcmp(input_line_fields[6], "N"))
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
123 our_part->onbottom = 0;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
124 else if (!strcmp(input_line_fields[6], "M"))
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
125 our_part->onbottom = 1;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
126 else {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
127 fprintf(stderr, "%s line %d: expected 'N' or 'M' in field 6\n",
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
128 input_filename, input_lineno);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
129 exit(1);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
130 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
131 if (input_line_nfields > 11)
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
132 num_attr_labels = atoi(input_line_fields[11]);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
133 else
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
134 num_attr_labels = 0;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
135 for (i = 0; i < num_attr_labels; i++)
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
136 one_attr_label();
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
137 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
138
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
139 static void
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
140 process_one_part()
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
141 {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
142 read_one_part();
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
143 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
144
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
145 process_part_section()
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
146 {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
147 input_units_current = input_units_global;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
148 for (;;) {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
149 if (!get_input_line()) {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
150 fprintf(stderr, "error: EOF in PART section\n");
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
151 exit(1);
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
152 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
153 if (input_line_buf[0] == '*') {
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
154 parse_starline();
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
155 if (strcmp(input_line_starkw, "REMARK"))
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
156 break;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
157 else
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
158 continue;
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
159 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
160 parse_input_line_fields();
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
161 if (input_line_nfields)
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
162 process_one_part();
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
163 }
2b71943a311b pads2gpcb: PART section parsing implemented, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
164 }