Print this page
8485 Remove set but unused variables in usr/src/cmd
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/troff/nroff.d/n6.c
+++ new/usr/src/cmd/troff/nroff.d/n6.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 + * Copyright 2017 Gary Mills
23 24 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24 25 * Use is subject to license terms.
25 26 */
26 27
27 28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 29 /* All Rights Reserved */
29 30
30 31 /*
31 32 * University Copyright- Copyright (c) 1982, 1986, 1988
32 33 * The Regents of the University of California
33 34 * All Rights Reserved
34 35 *
35 36 * University Acknowledgment- Portions of this document are derived from
36 37 * software developed by the University of California, Berkeley, and its
37 38 * contributors.
38 39 */
39 40
40 41 #include "tdef.h"
41 42 #include "tw.h"
42 43 #include "ext.h"
43 44 #include <ctype.h>
44 45
45 46 /*
46 47 * n6.c -- width functions, sizes and fonts
47 48 */
48 49
49 50 int bdtab[NFONT+1] ={ 0, 0, 0, 3, 3, 0, };
50 51 int sbold = 0;
51 52 int fontlab[NFONT+1] = { 0, 'R', 'I', 'B', PAIR('B','I'), 'S', 0 };
52 53
53 54 extern int nchtab;
54 55
55 56 int
56 57 width(j)
57 58 tchar j;
58 59 {
59 60 int i, k;
60 61
61 62 if (j & (ZBIT|MOT)) {
62 63 if (iszbit(j))
63 64 return(0);
64 65 if (isvmot(j))
65 66 return(0);
66 67 k = absmot(j);
67 68 if (isnmot(j))
68 69 k = -k;
69 70 return(k);
70 71 }
71 72 i = cbits(j);
72 73 if (i < ' ') {
73 74 if (i == '\b')
74 75 return(-widthp);
75 76 if (i == PRESC)
76 77 i = eschar;
77 78 else if (iscontrol(i))
78 79 return(0);
79 80 }
80 81 if (i==ohc)
81 82 return(0);
82 83 #ifdef EUC
83 84 #ifdef NROFF
84 85 if (multi_locale) {
85 86 if ((j & MBMASK) || (j & CSMASK)) {
86 87 switch(j & MBMASK) {
87 88 case BYTE_CHR:
88 89 case LASTOFMB:
89 90 k = t.Char * csi_width[cs(j)];
90 91 break;
91 92 default:
92 93 k = 0;
93 94 break;
94 95 }
95 96 widthp = k;
96 97 return(k);
97 98 }
98 99 }
99 100 i &= 0x1ff;
100 101 #endif /* NROFF */
101 102 #endif /* EUC */
102 103 i = trtab[i];
103 104 if (i < 32)
104 105 return(0);
105 106 k = t.width[i] * t.Char;
106 107 widthp = k;
107 108 return(k);
108 109 }
109 110
110 111
111 112 tchar setch()
112 113 {
113 114 int j;
114 115 char temp[10];
115 116 char *s;
116 117
117 118 s = temp;
118 119 if ((*s++ = getach()) == 0 || (*s++ = getach()) == 0)
119 120 return(0);
120 121 *s = '\0';
121 122 if ((j = findch(temp)) > 0)
122 123 return j | chbits;
123 124 else
124 125 return 0;
125 126 }
126 127
127 128 tchar setabs() /* set absolute char from \C'...' */
128 129 { /* for now, a no-op */
129 130 int i, n, nf;
130 131
131 132 getch();
132 133 n = 0;
133 134 n = inumb(&n);
134 135 getch();
135 136 if (nonumb)
136 137 return 0;
137 138 return n + nchtab + _SPECCHAR_ST;
138 139 }
139 140
140 141 int
141 142 findft(i)
142 143 int i;
143 144 {
144 145 int k;
145 146
146 147 if ((k = i - '0') >= 0 && k <= nfonts && k < smnt)
147 148 return(k);
148 149 for (k = 0; fontlab[k] != i; k++)
149 150 if (k > nfonts)
150 151 return(-1);
151 152 return(k);
152 153 }
153 154
154 155 int
155 156 caseps()
156 157 {
157 158 return (0);
158 159 }
159 160
160 161 int
161 162 mchbits()
162 163 {
163 164 chbits = 0;
164 165 setfbits(chbits, font);
165 166 sps = width(' ' | chbits);
166 167
167 168 return (0);
168 169 }
169 170
170 171
171 172 int
172 173 setps()
173 174 {
174 175 int i, j;
175 176
176 177 i = cbits(getch());
177 178 if (ischar(i) && isdigit(i)) { /* \sd or \sdd */
178 179 i -= '0';
179 180 if (i == 0) /* \s0 */
180 181 ;
181 182 else if (i <= 3 && ischar(j = cbits(ch = getch())) &&
182 183 isdigit(j)) { /* \sdd */
183 184 ch = 0;
184 185 }
185 186 } else if (i == '(') { /* \s(dd */
186 187 getch();
187 188 getch();
188 189 } else if (i == '+' || i == '-') { /* \s+, \s- */
189 190 j = cbits(getch());
190 191 if (ischar(j) && isdigit(j)) { /* \s+d, \s-d */
191 192 ;
192 193 } else if (j == '(') { /* \s+(dd, \s-(dd */
193 194 getch();
↓ open down ↓ |
161 lines elided |
↑ open up ↑ |
194 195 getch();
195 196 }
196 197 }
197 198
198 199 return (0);
199 200 }
200 201
201 202
202 203 tchar setht() /* set character height from \H'...' */
203 204 {
204 - int n;
205 205 tchar c;
206 206
207 207 getch();
208 - n = inumb(&apts);
208 + (void) inumb(&apts);
209 209 getch();
210 210 return(0);
211 211 }
212 212
213 213
214 214 tchar setslant() /* set slant from \S'...' */
215 215 {
216 216 int n;
217 217 tchar c;
218 218
219 219 getch();
220 220 n = 0;
221 221 n = inumb(&n);
222 222 getch();
223 223 return(0);
224 224 }
225 225
226 226
227 227 int
228 228 caseft()
229 229 {
230 230 skip();
231 231 setfont(1);
232 232
233 233 return (0);
234 234 }
235 235
236 236
237 237 int
238 238 setfont(a)
239 239 int a;
240 240 {
241 241 int i, j;
242 242
243 243 if (a)
244 244 i = getrq();
245 245 else
246 246 i = getsn();
247 247 if (!i || i == 'P') {
248 248 j = font1;
249 249 goto s0;
250 250 }
251 251 if (i == 'S' || i == '0')
252 252 return (0);
253 253 if ((j = findft(i, fontlab)) == -1)
254 254 return (0);
255 255 s0:
256 256 font1 = font;
257 257 font = j;
258 258 mchbits();
259 259
260 260 return (0);
261 261 }
262 262
263 263
264 264 int
265 265 setwd()
266 266 {
267 267 int base, wid;
268 268 tchar i;
269 269 int delim, emsz, k;
270 270 int savhp, savapts, savapts1, savfont, savfont1, savpts, savpts1;
271 271
272 272 base = numtab[ST].val = wid = numtab[CT].val = 0;
273 273 if (ismot(i = getch()))
274 274 return (0);
275 275 delim = cbits(i);
276 276 savhp = numtab[HP].val;
277 277 numtab[HP].val = 0;
278 278 savapts = apts;
279 279 savapts1 = apts1;
280 280 savfont = font;
281 281 savfont1 = font1;
282 282 savpts = pts;
283 283 savpts1 = pts1;
284 284 setwdf++;
285 285 while (cbits(i = getch()) != delim && !nlflg) {
286 286 k = width(i);
287 287 wid += k;
288 288 numtab[HP].val += k;
289 289 if (!ismot(i)) {
290 290 emsz = (INCH * pts + 36) / 72;
291 291 } else if (isvmot(i)) {
292 292 k = absmot(i);
293 293 if (isnmot(i))
294 294 k = -k;
295 295 base -= k;
296 296 emsz = 0;
297 297 } else
298 298 continue;
299 299 if (base < numtab[SB].val)
300 300 numtab[SB].val = base;
301 301 if ((k = base + emsz) > numtab[ST].val)
302 302 numtab[ST].val = k;
303 303 }
304 304 setn1(wid, 0, (tchar) 0);
305 305 numtab[HP].val = savhp;
306 306 apts = savapts;
307 307 apts1 = savapts1;
308 308 font = savfont;
309 309 font1 = savfont1;
310 310 pts = savpts;
311 311 pts1 = savpts1;
312 312 mchbits();
313 313 setwdf = 0;
314 314
315 315 return (0);
316 316 }
317 317
318 318
319 319 tchar vmot()
320 320 {
321 321 dfact = lss;
322 322 vflag++;
323 323 return(mot());
324 324 }
325 325
326 326
327 327 tchar hmot()
328 328 {
329 329 dfact = EM;
330 330 return(mot());
331 331 }
332 332
333 333
334 334 tchar mot()
335 335 {
336 336 int j, n;
337 337 tchar i;
338 338
339 339 j = HOR;
340 340 getch(); /*eat delim*/
341 341 if (n = atoi()) {
342 342 if (vflag)
343 343 j = VERT;
344 344 i = makem(quant(n, j));
345 345 } else
346 346 i = 0;
347 347 getch();
348 348 vflag = 0;
349 349 dfact = 1;
350 350 return(i);
351 351 }
352 352
353 353
354 354 tchar sethl(k)
355 355 int k;
356 356 {
357 357 int j;
358 358 tchar i;
359 359
360 360 j = t.Halfline;
361 361 if (k == 'u')
362 362 j = -j;
363 363 else if (k == 'r')
364 364 j = -2 * j;
365 365 vflag++;
366 366 i = makem(j);
367 367 vflag = 0;
368 368 return(i);
369 369 }
370 370
371 371
372 372 tchar makem(i)
373 373 int i;
374 374 {
375 375 tchar j;
376 376
377 377 if ((j = i) < 0)
378 378 j = -j;
379 379 j |= MOT;
380 380 if (i < 0)
381 381 j |= NMOT;
382 382 if (vflag)
383 383 j |= VMOT;
384 384 return(j);
385 385 }
386 386
387 387
388 388 tchar getlg(i)
389 389 tchar i;
390 390 {
391 391 return(i);
392 392 }
393 393
394 394
395 395 int
396 396 caselg()
397 397 {
398 398 return (0);
399 399 }
400 400
401 401
402 402 int
403 403 casefp()
404 404 {
405 405 int i, j;
406 406
407 407 skip();
408 408 if ((i = cbits(getch()) - '0') < 0 || i > nfonts)
409 409 return (0);
410 410 if (skip() || !(j = getrq()))
411 411 return (0);
412 412 fontlab[i] = j;
413 413
414 414 return (0);
415 415 }
416 416
417 417
418 418 int
419 419 casecs()
420 420 {
421 421 return (0);
422 422 }
423 423
424 424
425 425 int
426 426 casebd()
427 427 {
428 428 int i, j, k;
429 429
430 430 k = 0;
431 431 bd0:
432 432 if (skip() || !(i = getrq()) || (j = findft(i)) == -1) {
433 433 if (k)
434 434 goto bd1;
435 435 else
436 436 return (0);
437 437 }
438 438 if (j == smnt) {
439 439 k = smnt;
440 440 goto bd0;
441 441 }
442 442 if (k) {
443 443 sbold = j;
444 444 j = k;
445 445 }
446 446 bd1:
447 447 skip();
448 448 noscale++;
449 449 bdtab[j] = atoi();
450 450 noscale = 0;
451 451
452 452 return (0);
453 453 }
454 454
455 455
456 456 int
457 457 casevs()
458 458 {
459 459 int i;
460 460
461 461 skip();
462 462 vflag++;
463 463 dfact = INCH; /*default scaling is points!*/
464 464 dfactd = 72;
465 465 res = VERT;
466 466 i = inumb(&lss);
467 467 if (nonumb)
468 468 i = lss1;
469 469 if (i < VERT)
470 470 i = VERT; /* was VERT */
471 471 lss1 = lss;
472 472 lss = i;
473 473
474 474 return (0);
475 475 }
476 476
477 477
478 478
479 479 int
480 480 casess()
481 481 {
482 482 return (0);
483 483 }
484 484
485 485
486 486 tchar xlss()
487 487 {
488 488 /* stores \x'...' into
489 489 * two successive tchars.
490 490 * the first contains HX, the second the value,
491 491 * encoded as a vertical motion.
492 492 * decoding is done in n2.c by pchar().
493 493 */
494 494 int i;
495 495
496 496 getch();
497 497 dfact = lss;
498 498 i = quant(atoi(), VERT);
499 499 dfact = 1;
500 500 getch();
501 501 if (i >= 0)
502 502 *pbp++ = MOT | VMOT | i;
503 503 else
504 504 *pbp++ = MOT | VMOT | NMOT | -i;
505 505 return(HX);
506 506 }
↓ open down ↓ |
288 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX