Print this page
5083 avoid undefined order of operations in assignments
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/troff/troff.d/t6.c
+++ new/usr/src/cmd/troff/troff.d/t6.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.
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 23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 28 /* All Rights Reserved */
29 29
↓ open down ↓ |
29 lines elided |
↑ open up ↑ |
30 30 /*
31 31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 32 * The Regents of the University of California
33 33 * All Rights Reserved
34 34 *
35 35 * University Acknowledgment- Portions of this document are derived from
36 36 * software developed by the University of California, Berkeley, and its
37 37 * contributors.
38 38 */
39 39
40 -#pragma ident "%Z%%M% %I% %E% SMI"
41 -
42 40 /*
43 41 * t6.c
44 - *
42 + *
45 43 * width functions, sizes and fonts
46 44 */
47 45
48 46 #include "tdef.h"
49 47 #include "dev.h"
50 48 #include <ctype.h>
51 49 #include "ext.h"
52 50
53 51 /* fitab[f][c] is 0 if c is not on font f */
54 52 /* if it's non-zero, c is in fontab[f] at position
55 53 * fitab[f][c].
56 54 */
57 55 extern struct Font *fontbase[NFONT+1];
58 56 extern char *codetab[NFONT+1];
59 57 extern int nchtab;
60 58
61 59 int fontlab[NFONT+1];
62 60 short *pstab;
63 61 int cstab[NFONT+1];
64 62 int ccstab[NFONT+1];
65 63 int bdtab[NFONT+1];
66 64 int sbold = 0;
67 65
68 66 int
69 67 width(j)
70 68 tchar j;
71 69 {
72 70 int i, k;
73 71
74 72 if (j & (ZBIT|MOT)) {
75 73 if (iszbit(j))
76 74 return(0);
77 75 if (isvmot(j))
78 76 return(0);
79 77 k = absmot(j);
80 78 if (isnmot(j))
81 79 k = -k;
82 80 return(k);
83 81 }
84 82 i = cbits(j);
85 83 if (i < ' ') {
86 84 if (i == '\b')
87 85 return(-widthp);
88 86 if (i == PRESC)
89 87 i = eschar;
90 88 else if (iscontrol(i))
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
91 89 return(0);
92 90 }
93 91 if (i==ohc)
94 92 return(0);
95 93 i = trtab[i];
96 94 if (i < 32)
97 95 return(0);
98 96 if (sfbits(j) == oldbits) {
99 97 xfont = pfont;
100 98 xpts = ppts;
101 - } else
99 + } else
102 100 xbits(j, 0);
103 101 if (widcache[i-32].fontpts == (xfont<<8) + xpts && !setwdf)
104 102 k = widcache[i-32].width;
105 103 else {
106 104 k = getcw(i-32);
107 105 if (bd)
108 106 k += (bd - 1) * HOR;
109 107 if (cs)
110 108 k = cs;
111 109 }
112 110 widthp = k;
113 111 return(k);
114 112 }
115 113
116 114 /*
117 115 * clear width cache-- s means just space
118 116 */
119 117 int
120 118 zapwcache(s)
121 119 {
122 120 int i;
123 121
124 122 if (s) {
125 123 widcache[0].fontpts = 0;
126 124 return (0);
127 125 }
128 126 for (i=0; i<NWIDCACHE; i++)
129 127 widcache[i].fontpts = 0;
130 128
131 129 return (0);
132 130 }
133 131
134 132 int
135 133 getcw(i)
136 134 int i;
137 135 {
138 136 int k;
139 137 char *p;
140 138 int x, j;
141 139 int nocache = 0;
142 140
143 141 bd = 0;
144 142 if (i >= nchtab + 128-32) {
145 143 j = abscw(i + 32 - (nchtab+128));
146 144 goto g0;
147 145 }
148 146 if (i == 0) { /* a blank */
149 147 k = (fontab[xfont][0] * spacesz + 6) / 12;
150 148 /* this nonsense because .ss cmd uses 1/36 em as its units */
151 149 /* and default is 12 */
152 150 goto g1;
153 151 }
154 152 if ((j = fitab[xfont][i] & BYTEMASK) == 0) { /* it's not on current font */
155 153 /* search through search list of xfont
156 154 * to see what font it ought to be on.
157 155 * searches S, then remaining fonts in wraparound order.
158 156 */
159 157 nocache = 1;
160 158 if (smnt) {
161 159 int ii, jj;
162 160 for (ii=smnt, jj=0; jj < nfonts; jj++, ii=ii % nfonts + 1) {
163 161 j = fitab[ii][i] & BYTEMASK;
164 162 if (j != 0) {
165 163 p = fontab[ii];
166 164 k = *(p + j);
167 165 if (xfont == sbold)
168 166 bd = bdtab[ii];
169 167 if (setwdf)
170 168 numtab[CT].val |= kerntab[ii][j];
171 169 goto g1;
172 170 }
173 171 }
174 172 }
175 173 k = fontab[xfont][0]; /* leave a space-size space */
176 174 goto g1;
177 175 }
178 176 g0:
↓ open down ↓ |
67 lines elided |
↑ open up ↑ |
179 177 p = fontab[xfont];
180 178 if (setwdf)
181 179 numtab[CT].val |= kerntab[xfont][j];
182 180 k = *(p + j);
183 181 g1:
184 182 if (!bd)
185 183 bd = bdtab[xfont];
186 184 if (cs = cstab[xfont]) {
187 185 nocache = 1;
188 186 if (ccs = ccstab[xfont])
189 - x = ccs;
190 - else
187 + x = ccs;
188 + else
191 189 x = xpts;
192 190 cs = (cs * EMPTS(x)) / 36;
193 191 }
194 192 k = ((k&BYTEMASK) * xpts + (Unitwidth / 2)) / Unitwidth;
195 193 if (nocache|bd)
196 194 widcache[i].fontpts = 0;
197 195 else {
198 196 widcache[i].fontpts = (xfont<<8) + xpts;
199 197 widcache[i].width = k;
200 198 }
201 199 return(k);
202 200 /* Unitwidth is Units/Point, where
203 201 * Units is the fundamental digitization
204 202 * of the character set widths, and
205 203 * Point is the number of goobies in a point
206 204 * e.g., for cat, Units=36, Point=6, so Unitwidth=36/6=6
207 205 * In effect, it's the size at which the widths
208 206 * translate directly into units.
209 207 */
210 208 }
211 209
212 210 int
213 211 abscw(n) /* return index of abs char n in fontab[], etc. */
214 212 { int i, ncf;
215 213
216 214 ncf = fontbase[xfont]->nwfont & BYTEMASK;
217 215 for (i = 0; i < ncf; i++)
218 216 if (codetab[xfont][i] == n)
219 217 return i;
220 218 return 0;
221 219 }
222 220
223 221 int
224 222 xbits(i, bitf)
225 223 tchar i;
226 224 {
227 225 int k;
228 226
229 227 xfont = fbits(i);
230 228 k = sbits(i);
231 229 if (k) {
232 230 xpts = pstab[--k];
233 231 oldbits = sfbits(i);
234 232 pfont = xfont;
235 233 ppts = xpts;
236 234 return (0);
237 235 }
238 236 switch (bitf) {
239 237 case 0:
240 238 xfont = font;
241 239 xpts = pts;
242 240 break;
243 241 case 1:
244 242 xfont = pfont;
245 243 xpts = ppts;
246 244 break;
247 245 case 2:
248 246 xfont = mfont;
249 247 xpts = mpts;
250 248 }
251 249
252 250 return (0);
253 251 }
254 252
255 253
256 254 tchar setch()
257 255 {
258 256 int j;
259 257 char temp[10];
260 258 char *s;
261 259 extern char *chname;
262 260 extern short *chtab;
263 261 extern int nchtab;
264 262
265 263 s = temp;
266 264 if ((*s++ = getach()) == 0 || (*s++ = getach()) == 0)
267 265 return(0);
268 266 *s = '\0';
269 267 for (j = 0; j < nchtab; j++)
270 268 if (strcmp(&chname[chtab[j]], temp) == 0)
271 269 return(j + 128 | chbits);
272 270 return(0);
273 271 }
274 272
275 273 tchar setabs() /* set absolute char from \C'...' */
276 274 {
277 275 int i, n, nf;
278 276 extern int nchtab;
279 277
280 278 getch();
281 279 n = 0;
282 280 n = inumb(&n);
283 281 getch();
284 282 if (nonumb)
285 283 return 0;
286 284 return n + nchtab + 128;
287 285 }
288 286
289 287
290 288
291 289 int
292 290 findft(i)
293 291 int i;
294 292 {
295 293 int k;
296 294
297 295 if ((k = i - '0') >= 0 && k <= nfonts && k < smnt)
298 296 return(k);
299 297 for (k = 0; fontlab[k] != i; k++)
300 298 if (k > nfonts)
301 299 return(-1);
302 300 return(k);
303 301 }
304 302
305 303
306 304 int
307 305 caseps()
308 306 {
309 307 int i;
310 308
311 309 if (skip())
312 310 i = apts1;
313 311 else {
314 312 noscale++;
315 313 i = inumb(&apts); /* this is a disaster for fractional point sizes */
316 314 noscale = 0;
317 315 if (nonumb)
318 316 return (0);
319 317 }
320 318 casps1(i);
321 319
322 320 return (0);
323 321 }
324 322
325 323
326 324 int
327 325 casps1(i)
328 326 int i;
329 327 {
330 328
331 329 /*
332 330 * in olden times, it used to ignore changes to 0 or negative.
333 331 * this is meant to allow the requested size to be anything,
334 332 * in particular so eqn can generate lots of \s-3's and still
335 333 * get back by matching \s+3's.
336 334
337 335 if (i <= 0)
338 336 return (0);
339 337 */
340 338 apts1 = apts;
341 339 apts = i;
342 340 pts1 = pts;
343 341 pts = findps(i);
344 342 mchbits();
345 343
346 344 return (0);
347 345 }
348 346
349 347
350 348 int
351 349 findps(i)
352 350 int i;
353 351 {
354 352 int j, k;
355 353
356 354 for (j=k=0 ; pstab[j] != 0 ; j++)
357 355 if (abs(pstab[j]-i) < abs(pstab[k]-i))
358 356 k = j;
359 357
360 358 return(pstab[k]);
361 359 }
362 360
363 361
364 362 int
365 363 mchbits()
366 364 {
367 365 int i, j, k;
368 366
369 367 i = pts;
370 368 for (j = 0; i > (k = pstab[j]); j++)
371 369 if (!k) {
372 370 k = pstab[--j];
373 371 break;
374 372 }
375 373 chbits = 0;
376 374 setsbits(chbits, ++j);
377 375 setfbits(chbits, font);
378 376 sps = width(' ' | chbits);
379 377 zapwcache(1);
380 378
381 379 return (0);
382 380 }
383 381
384 382 int
385 383 setps()
386 384 {
387 385 int i, j;
388 386
389 387 i = cbits(getch());
390 388 if (ischar(i) && isdigit(i)) { /* \sd or \sdd */
391 389 i -= '0';
392 390 if (i == 0) /* \s0 */
393 391 j = apts1;
394 392 else if (i <= 3 && ischar(j = cbits(ch = getch())) &&
395 393 isdigit(j)) { /* \sdd */
396 394 j = 10 * i + j - '0';
397 395 ch = 0;
398 396 } else /* \sd */
399 397 j = i;
400 398 } else if (i == '(') { /* \s(dd */
401 399 j = cbits(getch()) - '0';
402 400 j = 10 * j + cbits(getch()) - '0';
403 401 if (j == 0) /* \s(00 */
404 402 j = apts1;
405 403 } else if (i == '+' || i == '-') { /* \s+, \s- */
406 404 j = cbits(getch());
407 405 if (ischar(j) && isdigit(j)) { /* \s+d, \s-d */
408 406 j -= '0';
409 407 } else if (j == '(') { /* \s+(dd, \s-(dd */
410 408 j = cbits(getch()) - '0';
411 409 j = 10 * j + cbits(getch()) - '0';
412 410 }
413 411 if (i == '-')
414 412 j = -j;
415 413 j += apts;
416 414 }
417 415 casps1(j);
418 416
419 417 return (0);
420 418 }
421 419
422 420
423 421 tchar setht() /* set character height from \H'...' */
424 422 {
425 423 int n;
426 424 tchar c;
427 425
428 426 getch();
429 427 n = inumb(&apts);
430 428 getch();
431 429 if (n == 0 || nonumb)
432 430 n = apts; /* does this work? */
433 431 c = CHARHT;
434 432 c |= ZBIT;
435 433 setsbits(c, n);
436 434 return(c);
437 435 }
438 436
439 437 tchar setslant() /* set slant from \S'...' */
440 438 {
441 439 int n;
442 440 tchar c;
443 441
444 442 getch();
445 443 n = 0;
446 444 n = inumb(&n);
447 445 getch();
448 446 if (nonumb)
449 447 n = 0;
450 448 c = SLANT;
451 449 c |= ZBIT;
452 450 setsfbits(c, n+180);
453 451 return(c);
454 452 }
455 453
456 454
457 455 int
458 456 caseft()
459 457 {
460 458 skip();
461 459 setfont(1);
462 460
463 461 return (0);
464 462 }
↓ open down ↓ |
264 lines elided |
↑ open up ↑ |
465 463
466 464
467 465 int
468 466 setfont(a)
469 467 int a;
470 468 {
471 469 int i, j;
472 470
473 471 if (a)
474 472 i = getrq();
475 - else
473 + else
476 474 i = getsn();
477 475 if (!i || i == 'P') {
478 476 j = font1;
479 477 goto s0;
480 478 }
481 479 if (i == 'S' || i == '0')
482 480 return (0);
483 481 if ((j = findft(i)) == -1)
484 482 if ((j = setfp(0, i, 0)) == -1) /* try to put it in position 0 */
485 483 return (0);
486 484 s0:
487 485 font1 = font;
488 486 font = j;
489 487 mchbits();
490 488
491 489 return (0);
492 490 }
↓ open down ↓ |
7 lines elided |
↑ open up ↑ |
493 491
494 492
495 493 int
496 494 setwd()
497 495 {
498 496 int base, wid;
499 497 tchar i;
500 498 int delim, emsz, k;
501 499 int savhp, savapts, savapts1, savfont, savfont1, savpts, savpts1;
502 500
503 - base = numtab[ST].val = numtab[ST].val = wid = numtab[CT].val = 0;
501 + base = numtab[ST].val = wid = numtab[CT].val = 0;
504 502 if (ismot(i = getch()))
505 503 return (0);
506 504 delim = cbits(i);
507 505 savhp = numtab[HP].val;
508 506 numtab[HP].val = 0;
509 507 savapts = apts;
510 508 savapts1 = apts1;
511 509 savfont = font;
512 510 savfont1 = font1;
513 511 savpts = pts;
514 512 savpts1 = pts1;
515 513 setwdf++;
516 514 while (cbits(i = getch()) != delim && !nlflg) {
517 515 k = width(i);
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
518 516 wid += k;
519 517 numtab[HP].val += k;
520 518 if (!ismot(i)) {
521 519 emsz = POINT * xpts;
522 520 } else if (isvmot(i)) {
523 521 k = absmot(i);
524 522 if (isnmot(i))
525 523 k = -k;
526 524 base -= k;
527 525 emsz = 0;
528 - } else
526 + } else
529 527 continue;
530 528 if (base < numtab[SB].val)
531 529 numtab[SB].val = base;
532 530 if ((k = base + emsz) > numtab[ST].val)
533 531 numtab[ST].val = k;
534 532 }
535 533 setn1(wid, 0, (tchar) 0);
536 534 numtab[HP].val = savhp;
537 535 apts = savapts;
538 536 apts1 = savapts1;
539 537 font = savfont;
540 538 font1 = savfont1;
541 539 pts = savpts;
542 540 pts1 = savpts1;
543 541 mchbits();
544 542 setwdf = 0;
545 543
546 544 return (0);
547 545 }
548 546
549 547
550 548 tchar vmot()
551 549 {
552 550 dfact = lss;
553 551 vflag++;
554 552 return(mot());
555 553 }
556 554
557 555
558 556 tchar hmot()
559 557 {
560 558 dfact = EM;
561 559 return(mot());
562 560 }
563 561
564 562
565 563 tchar mot()
566 564 {
567 565 int j, n;
568 566 tchar i;
569 567
570 568 j = HOR;
571 569 getch(); /*eat delim*/
572 570 if (n = atoi()) {
573 571 if (vflag)
574 572 j = VERT;
575 573 i = makem(quant(n, j));
576 574 } else
577 575 i = 0;
578 576 getch();
579 577 vflag = 0;
580 578 dfact = 1;
581 579 return(i);
582 580 }
583 581
584 582
585 583 tchar sethl(k)
586 584 int k;
587 585 {
588 586 int j;
589 587 tchar i;
590 588
591 589 j = EM / 2;
592 590 if (k == 'u')
593 591 j = -j;
594 592 else if (k == 'r')
595 593 j = -2 * j;
596 594 vflag++;
597 595 i = makem(j);
598 596 vflag = 0;
599 597 return(i);
600 598 }
601 599
602 600
603 601 tchar makem(i)
604 602 int i;
605 603 {
606 604 tchar j;
607 605
608 606 if ((j = i) < 0)
609 607 j = -j;
610 608 j |= MOT;
611 609 if (i < 0)
612 610 j |= NMOT;
613 611 if (vflag)
614 612 j |= VMOT;
615 613 return(j);
616 614 }
617 615
618 616
619 617 tchar getlg(i)
620 618 tchar i;
621 619 {
622 620 tchar j, k;
623 621 int lf;
624 622
625 623 if ((lf = fontbase[fbits(i)]->ligfont) == 0) /* font lacks ligatures */
626 624 return(i);
627 625 j = getch0();
628 626 if (cbits(j) == 'i' && (lf & LFI))
629 627 j = LIG_FI;
630 628 else if (cbits(j) == 'l' && (lf & LFL))
631 629 j = LIG_FL;
632 630 else if (cbits(j) == 'f' && (lf & LFF)) {
↓ open down ↓ |
94 lines elided |
↑ open up ↑ |
633 631 if ((lf & (LFFI|LFFL)) && lg != 2) {
634 632 k = getch0();
635 633 if (cbits(k)=='i' && (lf&LFFI))
636 634 j = LIG_FFI;
637 635 else if (cbits(k)=='l' && (lf&LFFL))
638 636 j = LIG_FFL;
639 637 else {
640 638 *pbp++ = k;
641 639 j = LIG_FF;
642 640 }
643 - } else
641 + } else
644 642 j = LIG_FF;
645 643 } else {
646 644 *pbp++ = j;
647 645 j = i;
648 646 }
649 647 return(i & SFMASK | j);
650 648 }
651 649
652 650
653 651 int
654 652 caselg()
655 653 {
656 654
657 655 lg = 1;
658 656 if (skip())
659 657 return (0);
660 658 lg = atoi();
661 659
662 660 return (0);
663 661 }
664 662
665 663
666 664 int
667 665 casefp()
668 666 {
669 667 int i, j;
670 668 char *s;
671 669
672 670 skip();
673 671 if ((i = cbits(getch()) - '0') <= 0 || i > nfonts)
674 672 errprint(gettext("fp: bad font position %d"), i);
675 673 else if (skip() || !(j = getrq()))
676 674 errprint(gettext("fp: no font name"));
677 675 else if (skip() || !getname())
678 676 setfp(i, j, 0);
679 677 else /* 3rd argument = filename */
680 678 setfp(i, j, nextf);
681 679
682 680 return (0);
683 681 }
684 682
685 683 int
686 684 setfp(pos, f, truename) /* mount font f at position pos[0...nfonts] */
687 685 int pos, f;
688 686 char *truename;
689 687 {
690 688 int k;
691 689 int n;
692 690 char longname[NS], shortname[20];
693 691 extern int nchtab;
694 692
695 693 zapwcache(0);
696 694 if (truename)
697 695 strcpy(shortname, truename);
698 696 else {
699 697 shortname[0] = f & BYTEMASK;
700 698 shortname[1] = f >> BYTE;
701 699 shortname[2] = '\0';
702 700 }
703 701 sprintf(longname, "%s/dev%s/%s.out", fontfile, devname, shortname);
704 702 if ((k = open(longname, 0)) < 0) {
705 703 errprint(gettext("Can't open %s"), longname);
706 704 return(-1);
707 705 }
708 706 n = fontbase[pos]->nwfont & BYTEMASK;
709 707 read(k, (char *) fontbase[pos], 3*n + nchtab + 128 - 32 + sizeof(struct Font));
710 708 kerntab[pos] = (char *) fontab[pos] + (fontbase[pos]->nwfont & BYTEMASK);
↓ open down ↓ |
57 lines elided |
↑ open up ↑ |
711 709 /* have to reset the fitab pointer because the width may be different */
712 710 fitab[pos] = (char *) fontab[pos] + 3 * (fontbase[pos]->nwfont & BYTEMASK);
713 711 if ((fontbase[pos]->nwfont & BYTEMASK) > n) {
714 712 errprint(gettext("Font %s too big for position %d"), shortname,
715 713 pos);
716 714 return(-1);
717 715 }
718 716 fontbase[pos]->nwfont = n; /* so can load a larger one again later */
719 717 close(k);
720 718 if (pos == smnt) {
721 - smnt = 0;
722 - sbold = 0;
719 + smnt = 0;
720 + sbold = 0;
723 721 }
724 722 if ((fontlab[pos] = f) == 'S')
725 723 smnt = pos;
726 724 bdtab[pos] = cstab[pos] = ccstab[pos] = 0;
727 725 /* if there is a directory, no place to store its name. */
728 726 /* if position isn't zero, no place to store its value. */
729 727 /* only time a FONTPOS is pushed back is if it's a */
730 728 /* standard font on position 0 (i.e., mounted implicitly. */
731 729 /* there's a bug here: if there are several input lines */
732 730 /* that look like .ft XX in short successtion, the output */
733 731 /* will all be in the last one because the "x font ..." */
734 732 /* comes out too soon. pushing back FONTPOS doesn't work */
735 733 /* with .ft commands because input is flushed after .xx cmds */
736 734 ptfpcmd(pos, shortname);
737 735 if (pos == 0)
738 736 ch = (tchar) FONTPOS | (tchar) f << 16;
739 737 return(pos);
740 738 }
741 739
742 740
743 741 int
744 742 casecs()
745 743 {
746 744 int i, j;
747 745
748 746 noscale++;
749 747 skip();
750 748 if (!(i = getrq()) || (i = findft(i)) < 0)
751 749 goto rtn;
752 750 skip();
753 751 cstab[i] = atoi();
754 752 skip();
755 753 j = atoi();
756 754 if (nonumb)
757 755 ccstab[i] = 0;
758 756 else
759 757 ccstab[i] = findps(j);
760 758 rtn:
761 759 zapwcache(0);
762 760 noscale = 0;
763 761
764 762 return (0);
765 763 }
766 764
767 765
768 766 int
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
769 767 casebd()
770 768 {
771 769 int i, j, k;
772 770
773 771 zapwcache(0);
774 772 k = 0;
775 773 bd0:
776 774 if (skip() || !(i = getrq()) || (j = findft(i)) == -1) {
777 775 if (k)
778 776 goto bd1;
779 - else
777 + else
780 778 return (0);
781 779 }
782 780 if (j == smnt) {
783 781 k = smnt;
784 782 goto bd0;
785 783 }
786 784 if (k) {
787 785 sbold = j;
788 786 j = k;
789 787 }
790 788 bd1:
791 789 skip();
792 790 noscale++;
793 791 bdtab[j] = atoi();
794 792 noscale = 0;
795 793
796 794 return (0);
797 795 }
798 796
799 797
800 798 int
801 799 casevs()
802 800 {
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
803 801 int i;
804 802
805 803 skip();
806 804 vflag++;
807 805 dfact = INCH; /* default scaling is points! */
808 806 dfactd = 72;
809 807 res = VERT;
810 808 i = inumb(&lss);
811 809 if (nonumb)
812 810 i = lss1;
813 - if (i < VERT)
811 + if (i < VERT)
814 812 i = VERT;
815 813 lss1 = lss;
816 814 lss = i;
817 815
818 816 return (0);
819 817 }
820 818
821 819
822 820 int
823 821 casess()
824 822 {
825 823 int i;
826 824
827 825 noscale++;
828 826 skip();
829 827 if (i = atoi()) {
830 828 spacesz = i & 0177;
831 829 zapwcache(0);
832 830 sps = width(' ' | chbits);
833 831 }
834 832 noscale = 0;
835 833
836 834 return (0);
837 835 }
838 836
839 837
840 838 tchar xlss()
841 839 {
842 840 /* stores \x'...' into
843 841 * two successive tchars.
844 842 * the first contains HX, the second the value,
845 843 * encoded as a vertical motion.
846 844 * decoding is done in n2.c by pchar().
847 845 */
848 846 int i;
849 847
850 848 getch();
851 849 dfact = lss;
852 850 i = quant(atoi(), VERT);
853 851 dfact = 1;
854 852 getch();
855 853 if (i >= 0)
856 854 *pbp++ = MOT | VMOT | i;
857 855 else
858 856 *pbp++ = MOT | VMOT | NMOT | -i;
859 857 return(HX);
860 858 }
↓ open down ↓ |
37 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX