Debian Codegraph @

texk/web2c/cwebdir/twinx.ch

raw
1 Changes for the TWINX utility from the CTWILL tarball.
2
3 This minimal set of changes tries to satisfy the GCC compiler
4 and it fixes a few minor issues. See the comments after '@x'.
5
6 This file is not copyrighted and can be used freely.
7
8 Limbo.
9
10 @x l.1
11 \datethis
12 @y
13 \datethis
14 \let\maybe=\iffalse % print only sections that change
15 @z
16
17 Section 1.
18
19 @x l.10 Standard C interface.
20 #include <stdio.h>
21 @y
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include <ctype.h>
26 @z
27
28 @x l.15
29 main(argc,argv)
30 int argc;
31 char *argv[];
32 @y
33 int main(
34 int argc,
35 char *argv[])
36 @z
37
38 @x l.21
39 f=fopen(*++argv,"r");
40 if (!f)
41 @y
42 if((f=fopen(*++argv,"r"))==NULL)
43 @z
44
45 @x l.27
46 strncpy(*argv+strlen(*argv)-3,"idx",3);
47 f=fopen(*argv,"r");
48 if (!f)
49 @y
50 memcpy(*argv+strlen(*argv)-3,"idx",3);
51 if((f=fopen(*argv,"r"))==NULL)
52 @z
53
54 Section 3.
55
56 @x l.49 Document minor change in behavior.
57 @ @<Scan file |f|...@>=
58 @y
59 @ For your convenience, \.{TWINX} grabs the first ``word'' in \.{\\title} and
60 turns it into uppercase form.
61
62 @<Scan file |f|...@>=
63 @z
64
65 @x l.56 C++17 removed 'register' storage class.
66 if (strncmp(buf,"\\def\\title\{",11)==0) {@+register char *p,*q;
67 @y
68 if (strncmp(buf,"\\def\\title\{",11)==0) {@+char *p,*q;
69 @z
70
71 @x l.57 FIX: Fetch only the first word from the '\title'.
72 for (p=buf+11,q=title;*p && *p!='}';p++) *q++=*p;
73 @y
74 for (p=buf+11,q=title;*p&&*p!=' '&&*p!='}';p++) *q++=toupper(*p);
75 @z
76
77 Section 4.
78
79 @x l.96
80 @<Type...@>=
81 @y
82 @s node_struct int
83
84 @<Type...@>=
85 @z
86
87 @x l.102 Compiler warning.
88 char *id;
89 @y
90 const char *id;
91 @z
92
93 Section 5.
94
95 @x l.115
96 char *save_string(s)
97 char *s;
98 @y
99 char *save_string(
100 char *s)
101 @z
102
103 @x l.118 C++17 removed 'register' storage class.
104 register char *p,*q; register int l;
105 @y
106 char *p,*q; int l;
107 @z
108
109 Section 6.
110
111 @x l.145
112 node *new_node()
113 @y
114 node *new_node(void)
115 @z
116
117 @x l.181 C++17 removed 'register' storage class.
118 register node* main_node; /* current end of main list */
119 @y
120 node* main_node; /* current end of main list */
121 @z
122
123 @x l.195 C++17 removed 'register' storage class.
124 while (1) {@+register node *cur_node;
125 @y
126 while (1) {@+node *cur_node;
127 @z
128
129 @x l.213 C++17 removed 'register' storage class.
130 {@+register char *p,*q;@+register int bal=1;
131 @y
132 {@+char *p,*q;@+int bal=1;
133 @z
134
135 Section 11.
136
137 @x l.216 FIX: Don't count masked braces.
138 if (*p=='{') bal++;
139 else if (*p=='}') bal--;
140 @y
141 switch (*p) {
142 case '\\': *q++=*p++; break;
143 case '{': bal++; break;
144 case '}': bal--; break;
145 }
146 @z
147
148 Section 12.
149
150 @x l.246
151 do@+{
152 @y
153 do {
154 @z
155
156 @x l.256
157 }@+while(fgets(buf,buf_size,f));
158 @y
159 } while(fgets(buf,buf_size,f));
160 @z
161
162 Section 14.
163
164 @x l.289 C++17 removed 'register' storage class.
165 while (1) {@+register node *p,*q,*r,*s,*t;
166 @y
167 while (1) {@+node *p,*q,*r,*s,*t;
168 @z
169
170 Section 15.
171
172 @x l.308 C++17 removed 'register' storage class.
173 do@+{@+register int d;
174 @y
175 do {@+int d;
176 @z
177
178 @x l.316
179 }@+while(1);
180 @y
181 } while(1);
182 @z
183
184 Section 16.
185
186 @x l.323 C++17 removed 'register' storage class.
187 do@+{@+register int d;
188 @y
189 do {@+int d;
190 @z
191
192 @x l.338
193 }@+while(1);
194 @y
195 } while(1);
196 @z
197
198 Section 17.
199
200 @x l.347
201 int compare(p,q)
202 node *p,*q;
203 @y
204 int compare(
205 node *p, node *q)
206 @z
207
208
209 @x l.349 C++17 removed 'register' storage class.
210 {@+register unsigned char *pp,*qq;
211 @y
212 {@+unsigned char *pp,*qq;
213 @z
214
215 Section 19.
216
217 @x l.378 C++17 removed 'register' storage class.
218 {@+register int j;
219 @y
220 {@+int j;
221 @z
222
223 @x l.379 Compiler warning.
224 for (j=1;collate[j];j++) ord[collate[j]]=j;
225 @y
226 for (j=1;collate[j];j++) ord[(int)collate[j]]=j;
227 @z
228
229 Section 20.
230
231 @x l.390
232 collapse(p,q)
233 node *p,*q;
234 @y
235 void collapse(
236 node *p, node *q)
237 @z
238
239 @x l.392 C++17 removed 'register' storage class.
240 {@+register node *x;
241 @y
242 {@+node *x;
243 @z
244
245 Section 21.
246
247 @x l.403 C++17 removed 'register' storage class.
248 {@+register node *x;
249 @y
250 {@+node *x;
251 @z
252
253 Section 22.
254
255 @x l.414 Compiler warning.
256 {@+register char *p=x->id;
257 @y
258 {@+const char *p=x->id;
259 @z
260
261 @x l.434 FIX: Don't mask already masked underscore.
262 if (*p=='_') putchar('\\');
263 @y
264 if (*p=='_'&&*(p-1)!='\\') putchar('\\');
265 @z
266
267 @x l.441 C++17 removed 'register' storage class.
268 {@+register node *y=x->data.n,*z=NULL;
269 while (y) {@+register node *w;
270 @y
271 {@+node *y=x->data.n,*z=NULL;
272 while (y) {@+node *w;
273 @z