summaryrefslogtreecommitdiff
path: root/dev-tex/rail/files/rail-1.2_p1-C23.patch
blob: cdfc10264aae084c823da9fa6ba5542f62af58d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
Fix includes and function definitions and signatures
until whole thing compiles with C23.
https://bugs.gentoo.org/738854
https://bugs.gentoo.org/883267
https://bugs.gentoo.org/947155
--- a/gram.y
+++ b/gram.y
@@ -5,6 +5,7 @@
 #include <stdio.h>
 
 #include "rail.h"
+extern int yylex (void);
 
 char optchar;
 
--- a/rail.c
+++ b/rail.c
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "patchlevel.h"
 #include "rail.h"
@@ -54,9 +55,7 @@
 
 int anonymous;		/* anonymous rules */
 
-main(argc,argv)
-unsigned argc;
-char *argv[];
+int main(int argc, char *argv[])
 {
 	char *arg, **argp;
 	unsigned len;
@@ -122,8 +121,7 @@
 	/*NOTREACHED*/
 }
 
-int setopt(c,s)
-char c, *s;
+int setopt(char c, char *s)
 {
 	int set;
 
@@ -167,7 +165,7 @@
 	return 1;
 }
 
-usage()
+void usage(void)
 {
 	fprintf(stderr,USAGE,myname);
 	exit(1);
@@ -175,23 +173,21 @@
 
 /* error routine for yyparse() */
 
-yyerror(s)
-char *s;
+void yyerror(char *s)
 {
 	fatal("%s",s);
 }
 
 /* wrap-up routine for yylex() */
 
-yywrap()
+int yywrap(void)
 {
 	return(1);
 }
 
 /* check for non-NULL pointer */
 
-char *mcheck(s)
-char *s;
+char *mcheck(char *s)
 {
 	if(s==NULL)
 		fatal("out of memory",(char *)NULL);
@@ -201,9 +197,7 @@
 
 /* make a new body */
 
-BODYTYPE *newbody(kind,body1,body2)
-int kind;
-BODYTYPE *body1, *body2;
+BODYTYPE *newbody(int kind, BODYTYPE *body1, BODYTYPE *body2)
 {
 	BODYTYPE *body;
 
@@ -226,8 +220,7 @@
 
 /* free a body recursively */
 
-freebody(body)
-BODYTYPE *body;
+void freebody(BODYTYPE *body)
 {
 	int i;
 
@@ -246,16 +239,14 @@
 
 /* test if a body is empty */
 
-int isemptybody(body)
-BODYTYPE *body;
+int isemptybody(BODYTYPE *body)
 {
 	return(body==NULL || body->kind==EMPTY);
 }
 
 /* add to a body list */
 
-static addlist(body1,body2)
-BODYTYPE *body1, *body2;
+void static addlist(BODYTYPE *body1, BODYTYPE *body2)
 {
 	if(body1->nlist>=MAXLIST) {
 		yyerror("list too long");
@@ -265,9 +256,7 @@
 
 /* add two body lists (for CAT, BAR, PLUS) */
 
-BODYTYPE *addbody(kind,body1,body2)
-int kind;
-BODYTYPE *body1, *body2;
+BODYTYPE *addbody(int kind, BODYTYPE *body1, BODYTYPE *body2)
 {
 	BODYTYPE *body;
 	int i;
@@ -292,8 +281,7 @@
 
 /* reverse all concatenations (for PLUS) */
 
-BODYTYPE *revbody(body)
-BODYTYPE *body;
+BODYTYPE *revbody(BODYTYPE *body)
 {
 	int i,j;
 	BODYTYPE *tmp;
@@ -314,9 +302,7 @@
 
 /* print a body for debugging */
 
-prtbody(indent,body)
-int indent;
-BODYTYPE *body;
+void prtbody(int indent, BODYTYPE *body)
 {
 	int i;
 
@@ -376,9 +362,7 @@
 
 /* output a body */
 
-outbody(id,body)
-IDTYPE *id;
-BODYTYPE *body;
+void outbody(IDTYPE *id, BODYTYPE *body)
 {
 	posbody(body,0);
 
@@ -403,10 +387,7 @@
 
 /* format a body */
 
-fmtbody(body,cent,arrow)
-BODYTYPE *body;
-char *cent;
-char arrow;
+void fmtbody(BODYTYPE *body, char *cent, char arrow)
 {
 	BODYTYPE *body1;
 	int i;
@@ -494,8 +475,7 @@
 
 /* position body (fill in height and ystart) */
 
-posbody(body,ystart)
-BODYTYPE *body;
+void posbody(BODYTYPE *body, int ystart)
 {
 	BODYTYPE *body1;
 	int i;
@@ -551,8 +531,7 @@
 
 /* output an index entry */
 
-outindex(id)
-IDTYPE *id;
+int outindex(IDTYPE *id)
 {
 	if(id!=NULL)
 		fprintf(outf,"\\rail@index{%s}\n",id->name);
@@ -560,9 +539,7 @@
 
 /* make a new rule list */
 
-RULETYPE *newrule(id,body)
-IDTYPE *id;
-BODYTYPE *body;
+RULETYPE *newrule(IDTYPE *id, BODYTYPE *body)
 {
 	RULETYPE *rule;
 
@@ -576,8 +553,7 @@
 
 /* free a rule list */
 
-freerule(rule)
-RULETYPE *rule;
+void freerule(RULETYPE *rule)
 {
 	RULETYPE *rulep;
 
@@ -591,8 +567,7 @@
 
 /* add two rule lists */
 
-RULETYPE *addrule(rule1,rule2)
-RULETYPE *rule1, *rule2;
+RULETYPE *addrule(RULETYPE *rule1, RULETYPE *rule2)
 {
 	RULETYPE *rulep;
 
@@ -609,8 +584,7 @@
 
 /* output a rule list */
 
-outrule(rule)
-RULETYPE *rule;
+void outrule(RULETYPE *rule)
 {
 	while(rule!=NULL) {
 
@@ -625,8 +599,7 @@
 
 /* look up an identifier */
 
-IDTYPE *lookup(name)
-char *name;
+IDTYPE *lookup(char *name)
 {
 	IDTYPE *idp, **idq;
 
@@ -648,8 +621,7 @@
 
 /* delete an identifier */
 
-delete(id)
-IDTYPE *id;
+void delete(IDTYPE *id)
 {
 	IDTYPE *idp, **idq;
 
@@ -665,7 +637,7 @@
 
 /* check that there are no undefined identifiers */
 
-checkdefs()
+void checkdefs(void)
 {
 	IDTYPE *id;
 
@@ -676,8 +648,7 @@
 
 /* complain about an undefined identifier */
 
-undef(id)
-IDTYPE *id;
+void undef(IDTYPE *id)
 {
 	if(chkgram)
 		error("undefined identifier '%s'",id->name);
@@ -685,8 +656,7 @@
 
 /* complain about a redefined identifier */
 
-redef(id)
-IDTYPE *id;
+void redef(IDTYPE *id)
 {
 	if(chkgram)
 		error("redefined identifier '%s'",id->name);
@@ -694,8 +664,7 @@
 
 /* display an error */
 
-error(f,s)
-char *f, *s;
+void error(char *f, char *s)
 {
 	if(newline) {
 		printf("\n");
@@ -713,8 +682,7 @@
 	fprintf(stderr,"\n");
 }
 
-fatal(f,s)
-char *f,*s;
+void fatal(char *f, char *s)
 {
 	error(f,s);
 
--- a/rail.h
+++ b/rail.h
@@ -68,22 +68,31 @@
 
 extern IDTYPE *errorid;
 
-extern char *mcheck();
+extern char *mcheck(char *s);
 
-extern BODYTYPE *newbody();
-extern freebody();
-extern int isemptybody();
-extern BODYTYPE *addbody();
-extern BODYTYPE *revbody();
-
-extern RULETYPE *newrule();
-extern freerule();
-extern RULETYPE *addrule();
-extern outrule();
-
-extern IDTYPE *lookup();
-extern delete();
-
-extern undef();
-extern redef();
-extern error();
+extern BODYTYPE *newbody(int kind, BODYTYPE *body1, BODYTYPE *body2);
+extern void freebody(BODYTYPE *body);
+extern int isemptybody(BODYTYPE *body);
+extern BODYTYPE *addbody(int kind, BODYTYPE *body1, BODYTYPE *body2);
+extern BODYTYPE *revbody(BODYTYPE *body);
+extern void posbody(BODYTYPE *body, int ystart);
+extern void fmtbody(BODYTYPE *body, char *cent, char arrow);
+
+extern RULETYPE *newrule(IDTYPE *id, BODYTYPE *body);
+extern void freerule(RULETYPE *rule);
+extern RULETYPE *addrule(RULETYPE *rule1, RULETYPE *rule2);
+extern void outrule(RULETYPE *rule);
+
+extern IDTYPE *lookup(char *name);
+extern void delete(IDTYPE *id);
+
+extern void undef(IDTYPE *id);
+extern void redef(IDTYPE *id);
+extern void error(char *f, char *s);
+extern void yyerror(char *s);
+extern int yywrap(void);
+
+int setopt(char c, char *s);
+void usage(void);
+void checkdefs(void);
+void fatal(char *f, char *s);