t6.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881
  1. /*
  2. * t6.c
  3. *
  4. * width functions, sizes and fonts
  5. */
  6. #include "tdef.h"
  7. #include "fns.h"
  8. #include "ext.h"
  9. int fontlab[MAXFONTS+1];
  10. int cstab[MAXFONTS+1];
  11. int ccstab[MAXFONTS+1];
  12. int bdtab[MAXFONTS+1];
  13. int sbold = 0;
  14. t_width(Tchar j)
  15. {
  16. int i, k;
  17. if (iszbit(j))
  18. return 0;
  19. if (ismot(j)) {
  20. if (isvmot(j))
  21. return(0);
  22. k = absmot(j);
  23. if (isnmot(j))
  24. k = -k;
  25. return(k);
  26. }
  27. i = cbits(j);
  28. if (i < ' ') {
  29. if (i == '\b')
  30. return(-widthp);
  31. if (i == PRESC)
  32. i = eschar;
  33. else if (i == HX)
  34. return(0);
  35. }
  36. if (i == ohc)
  37. return(0);
  38. i = trtab[i];
  39. if (i < ' ')
  40. return(0);
  41. if (sfbits(j) == oldbits) {
  42. xfont = pfont;
  43. xpts = ppts;
  44. } else
  45. xbits(j, 0);
  46. if (i < nchnames + ALPHABET && widcache[i].fontpts == (xfont<<8) + xpts && !setwdf)
  47. k = widcache[i].width;
  48. else {
  49. k = getcw(i);
  50. if (bd)
  51. k += (bd - 1) * HOR;
  52. if (cs)
  53. k = cs;
  54. }
  55. widthp = k;
  56. return(k);
  57. }
  58. /*
  59. * clear width cache-- s means just space
  60. */
  61. void zapwcache(int s)
  62. {
  63. int i;
  64. if (s) {
  65. widcache[' '].fontpts = 0;
  66. return;
  67. }
  68. for (i=0; i<NWIDCACHE; i++)
  69. widcache[i].fontpts = 0;
  70. }
  71. onfont(int n, int f) /* is char n on font f? */
  72. {
  73. int i;
  74. Font *fp = &fonts[f];
  75. Chwid *cp, *ep;
  76. char *np;
  77. if (n < ALPHABET) {
  78. if (fp->wp[n].num == n) /* ascii at front */
  79. return n;
  80. else
  81. return -1;
  82. }
  83. cp = &fp->wp[ALPHABET];
  84. ep = &fp->wp[fp->nchars];
  85. for ( ; cp < ep; cp++) /* search others */
  86. if (cp->num == n)
  87. return cp - &fp->wp[0];
  88. /* maybe it was a \N... */
  89. np = chname(n);
  90. if (*np == Number) {
  91. i = atoi(np+1); /* sscanf(np+1, "%d", &i); */
  92. cp = &fp->wp[0];
  93. ep = &fp->wp[fp->nchars];
  94. for ( ; cp < ep; cp++) { /* search others */
  95. if (cp->code == i)
  96. return cp - &fp->wp[0];
  97. }
  98. return -2; /* a \N that doesn't have an entry */
  99. }
  100. return -1; /* vanilla not found */
  101. }
  102. getcw(int i)
  103. {
  104. int k, n, x;
  105. Font *fp;
  106. int nocache = 0;
  107. if (i < ' ')
  108. return 0;
  109. bd = 0;
  110. fp = &fonts[xfont];
  111. if (i == ' ') { /* a blank */
  112. k = (fp->spacewidth * spacesz + 6) / 12;
  113. /* this nonsense because .ss cmd uses 1/36 em as its units */
  114. /* and default is 12 */
  115. } else if ((n = onfont(i, xfont)) >= 0) { /* on this font at n */
  116. k = fp->wp[n].wid;
  117. if (setwdf)
  118. numtabp[CT].val |= fp->wp[n].kern;
  119. } else if (n == -2) { /* \N with default width */
  120. k = fp->defaultwidth;
  121. } else { /* not on current font */
  122. nocache = 1;
  123. k = fp->defaultwidth; /* default-size space */
  124. if (smnt) {
  125. int ii, jj;
  126. for (ii=smnt, jj=0; jj < nfonts; jj++, ii=ii % nfonts + 1) {
  127. if ((n = onfont(i, ii)) >= 0) {
  128. k = fonts[ii].wp[n].wid;
  129. if (xfont == sbold)
  130. bd = bdtab[ii];
  131. if (setwdf)
  132. numtabp[CT].val |= fonts[ii].wp[n].kern;
  133. break;
  134. }
  135. }
  136. }
  137. }
  138. if (!bd)
  139. bd = bdtab[xfont];
  140. if (cs = cstab[xfont]) {
  141. nocache = 1;
  142. if (ccs = ccstab[xfont])
  143. x = ccs;
  144. else
  145. x = xpts;
  146. cs = (cs * EMPTS(x)) / 36;
  147. }
  148. /* was (k & BYTEMASK); since .wid is unsigned, should never happen */
  149. if (k < 0)
  150. ERROR "can't happen: negative width %d in getcw %d\n", k, i WARN;
  151. k = (k * xpts + (Unitwidth / 2)) / Unitwidth;
  152. if (nocache|bd)
  153. widcache[i].fontpts = 0;
  154. else {
  155. widcache[i].fontpts = (xfont<<8) + xpts;
  156. widcache[i].width = k;
  157. }
  158. return(k);
  159. /* Unitwidth is Units/Point, where
  160. /* Units is the fundamental digitization
  161. /* of the character set widths, and
  162. /* Point is the number of goobies in a point
  163. /* e.g., for cat, Units=36, Point=6, so Unitwidth=36/6=6
  164. /* In effect, it's the size at which the widths
  165. /* translate directly into units.
  166. */
  167. }
  168. void xbits(Tchar i, int bitf)
  169. {
  170. int k;
  171. if(TROFF) {
  172. xfont = fbits(i);
  173. k = sbits(i);
  174. if(k) {
  175. xpts = pstab[k-1];
  176. oldbits = sfbits(i);
  177. pfont = xfont;
  178. ppts = xpts;
  179. return;
  180. }
  181. switch(bitf) {
  182. case 0:
  183. xfont = font;
  184. xpts = pts;
  185. break;
  186. case 1:
  187. xfont = pfont;
  188. xpts = ppts;
  189. break;
  190. case 2:
  191. xfont = mfont;
  192. xpts = mpts;
  193. }
  194. }
  195. }
  196. /* these next two functions ought to be the same in troff and nroff, */
  197. /* but the data structures they search are different. */
  198. /* silly historical problem. */
  199. Tchar t_setch(int c)
  200. {
  201. int j;
  202. char temp[50];
  203. char *s;
  204. s = temp;
  205. if (c == '(') { /* \(xx */
  206. if ((*s++ = getach()) == 0 || (*s++ = getach()) == 0)
  207. return(0);
  208. } else { /* \C'...' */
  209. c = getach();
  210. while ((*s = getach()) != c && *s != 0 && s < temp + sizeof(temp) - 1)
  211. s++;
  212. }
  213. *s = '\0';
  214. #ifdef UNICODE
  215. return chadd(temp, Troffchar, Install) | chbits; /* add name even if haven't seen it */
  216. #else
  217. if (NROFF) {
  218. j = chadd(temp, Troffchar, Lookup);
  219. if ( j == -1)
  220. return 0;
  221. else
  222. return j | chbits;
  223. } else
  224. return chadd(temp, Troffchar, Install) | chbits; /* add name even if haven't seen it */
  225. #endif /*UNICODE*/
  226. }
  227. Tchar t_setabs(void) /* set absolute char from \N'...' */
  228. {
  229. int n;
  230. char temp[10];
  231. getch(); /* delim */
  232. n = 0;
  233. n = inumb(&n);
  234. getch(); /* delim */
  235. if (nonumb)
  236. return 0;
  237. sprintf(temp, "%d", n); /* convert into "#n" */
  238. n = chadd(temp, Number, Install);
  239. return n | chbits;
  240. }
  241. /*
  242. * fontlab[] is a cache that contains font information
  243. * for each font.
  244. * fontlab[] contains the 1- or 2-character name of the
  245. * font current associated with that font.
  246. * fonts 1..nfonts correspond to the mounted fonts;
  247. * the last of these are the special fonts.
  248. * If we don't use the (named) font in one of the
  249. * standard positions, we install the name in the next
  250. * free slot of fontlab[] and font[].
  251. * Whenever we need info about the font, we
  252. * read in the data into the next free slot with getfont.
  253. * The ptfont() (t10.c) routine will tell
  254. * the device filter to put the font always at position
  255. * zero if xfont > nfonts, so no need to change these filters.
  256. * Yes, this is a bit kludgy.
  257. *
  258. * This gives the new specs of findft:
  259. * find the font name i, where i also can be a number.
  260. * Installs the font(name) i when not present
  261. * returns -1 on error
  262. */
  263. t_findft(int i)
  264. {
  265. int k;
  266. Uchar *p;
  267. p = unpair(i);
  268. if (isdigit(p[0])) { /* first look for numbers */
  269. k = p[0] - '0';
  270. if (p[1] > 0 && isdigit(p[1]))
  271. k = 10 * k + p[1] - '0';
  272. if (k > 0 && k <= nfonts && k < smnt)
  273. return(k); /* mounted font: .ft 3 */
  274. if (fontlab[k] && k <= MAXFONTS) { /* translate */
  275. return(k); /*number to a name */
  276. } else {
  277. fprintf(stderr, "troff: no font at position %d\n", k);
  278. return(-1); /* wild number */
  279. }
  280. }
  281. /*
  282. * Now we look for font names
  283. */
  284. for (k = 1; fontlab[k] != i; k++) {
  285. if (k > MAXFONTS)
  286. return(-1); /* running out of fontlab space */
  287. if (fontlab[k] == 0) { /* passed all existing names */
  288. if (setfp(k, i, (char *) 0, 1) == -1)
  289. return(-1);
  290. else {
  291. fontlab[k] = i; /* install the name */
  292. return(k);
  293. }
  294. }
  295. }
  296. return(k); /* was one of the existing names */
  297. }
  298. void caseps(void)
  299. {
  300. int i;
  301. if (TROFF) {
  302. if(skip())
  303. i = apts1;
  304. else {
  305. noscale++;
  306. i = inumb(&apts); /* this is a disaster for fractional point sizes */
  307. noscale = 0;
  308. if(nonumb)
  309. i = apts1;
  310. }
  311. casps1(i);
  312. }
  313. }
  314. void casps1(int i)
  315. {
  316. /*
  317. * in olden times, it used to ignore changes to 0 or negative.
  318. * this is meant to allow the requested size to be anything,
  319. * in particular so eqn can generate lots of \s-3's and still
  320. * get back by matching \s+3's.
  321. if (i <= 0)
  322. return;
  323. */
  324. apts1 = apts;
  325. apts = i;
  326. pts1 = pts;
  327. pts = findps(i);
  328. mchbits();
  329. }
  330. findps(int i)
  331. {
  332. int j, k;
  333. for (j=k=0 ; pstab[j] != 0 ; j++)
  334. if (abs(pstab[j]-i) < abs(pstab[k]-i))
  335. k = j;
  336. return(pstab[k]);
  337. }
  338. void t_mchbits(void)
  339. {
  340. int i, j, k;
  341. i = pts;
  342. for (j = 0; i > (k = pstab[j]); j++)
  343. if (!k) {
  344. j--;
  345. break;
  346. }
  347. chbits = 0;
  348. setsbits(chbits, ++j);
  349. setfbits(chbits, font);
  350. sps = width(' ' | chbits);
  351. zapwcache(1);
  352. }
  353. void t_setps(void)
  354. {
  355. int i, j;
  356. i = cbits(getch());
  357. if (isdigit(i)) { /* \sd or \sdd */
  358. i -= '0';
  359. if (i == 0) /* \s0 */
  360. j = apts1;
  361. else if (i <= 3 && (ch=getch()) && isdigit(j = cbits(ch))) { /* \sdd */
  362. j = 10 * i + j - '0';
  363. ch = 0;
  364. } else /* \sd */
  365. j = i;
  366. } else if (i == '(') { /* \s(dd */
  367. j = cbits(getch()) - '0';
  368. j = 10 * j + cbits(getch()) - '0';
  369. if (j == 0) /* \s(00 */
  370. j = apts1;
  371. } else if (i == '+' || i == '-') { /* \s+, \s- */
  372. j = cbits(getch());
  373. if (isdigit(j)) { /* \s+d, \s-d */
  374. j -= '0';
  375. } else if (j == '(') { /* \s+(dd, \s-(dd */
  376. j = cbits(getch()) - '0';
  377. j = 10 * j + cbits(getch()) - '0';
  378. }
  379. if (i == '-')
  380. j = -j;
  381. j += apts;
  382. }
  383. casps1(j);
  384. }
  385. Tchar t_setht(void) /* set character height from \H'...' */
  386. {
  387. int n;
  388. Tchar c;
  389. getch();
  390. n = inumb(&apts);
  391. getch();
  392. if (n == 0 || nonumb)
  393. n = apts; /* does this work? */
  394. c = CHARHT;
  395. c |= ZBIT;
  396. setsbits(c, n);
  397. setfbits(c, pts); /* sneaky, CHARHT font bits are size bits */
  398. return(c);
  399. }
  400. Tchar t_setslant(void) /* set slant from \S'...' */
  401. {
  402. int n;
  403. Tchar c;
  404. getch();
  405. n = 0;
  406. n = inumb(&n);
  407. getch();
  408. if (nonumb)
  409. n = 0;
  410. c = SLANT;
  411. c |= ZBIT;
  412. setsfbits(c, n+180);
  413. return(c);
  414. }
  415. void caseft(void)
  416. {
  417. if (!TROFF) {
  418. n_caseft();
  419. return;
  420. }
  421. skip();
  422. setfont(1);
  423. }
  424. void t_setfont(int a)
  425. {
  426. int i, j;
  427. if (a)
  428. i = getrq();
  429. else
  430. i = getsn();
  431. if (!i || i == 'P') {
  432. j = font1;
  433. goto s0;
  434. }
  435. if (/* i == 'S' || */ i == '0') /* an experiment -- why can't we change to it? */
  436. return;
  437. if ((j = findft(i)) == -1)
  438. if ((j = setfp(0, i, (char*) 0, 1)) == -1) /* try to put it in position 0 */
  439. return;
  440. s0:
  441. font1 = font;
  442. font = j;
  443. mchbits();
  444. }
  445. void t_setwd(void)
  446. {
  447. int base, wid;
  448. Tchar i;
  449. int delim, emsz, k;
  450. int savhp, savapts, savapts1, savfont, savfont1, savpts, savpts1;
  451. base = numtabp[ST].val = numtabp[SB].val = wid = numtabp[CT].val = 0;
  452. if (ismot(i = getch()))
  453. return;
  454. delim = cbits(i);
  455. savhp = numtabp[HP].val;
  456. numtabp[HP].val = 0;
  457. savapts = apts;
  458. savapts1 = apts1;
  459. savfont = font;
  460. savfont1 = font1;
  461. savpts = pts;
  462. savpts1 = pts1;
  463. setwdf++;
  464. while (cbits(i = getch()) != delim && !nlflg) {
  465. k = width(i);
  466. wid += k;
  467. numtabp[HP].val += k;
  468. if (!ismot(i)) {
  469. emsz = (INCH/72) * xpts;
  470. } else if (isvmot(i)) {
  471. k = absmot(i);
  472. if (isnmot(i))
  473. k = -k;
  474. base -= k;
  475. emsz = 0;
  476. } else
  477. continue;
  478. if (base < numtabp[SB].val)
  479. numtabp[SB].val = base;
  480. if ((k = base + emsz) > numtabp[ST].val)
  481. numtabp[ST].val = k;
  482. }
  483. setn1(wid, 0, (Tchar) 0);
  484. numtabp[HP].val = savhp;
  485. apts = savapts;
  486. apts1 = savapts1;
  487. font = savfont;
  488. font1 = savfont1;
  489. pts = savpts;
  490. pts1 = savpts1;
  491. mchbits();
  492. setwdf = 0;
  493. }
  494. Tchar t_vmot(void)
  495. {
  496. dfact = lss;
  497. vflag++;
  498. return t_mot();
  499. }
  500. Tchar t_hmot(void)
  501. {
  502. dfact = EM;
  503. return t_mot();
  504. }
  505. Tchar t_mot(void)
  506. {
  507. int j, n;
  508. Tchar i;
  509. j = HOR;
  510. getch(); /*eat delim*/
  511. if (n = atoi0()) {
  512. if (vflag)
  513. j = VERT;
  514. i = makem(quant(n, j));
  515. } else
  516. i = 0;
  517. getch();
  518. vflag = 0;
  519. dfact = 1;
  520. return(i);
  521. }
  522. Tchar t_sethl(int k)
  523. {
  524. int j;
  525. Tchar i;
  526. j = EM / 2;
  527. if (k == 'u')
  528. j = -j;
  529. else if (k == 'r')
  530. j = -2 * j;
  531. vflag++;
  532. i = makem(j);
  533. vflag = 0;
  534. return(i);
  535. }
  536. Tchar t_makem(int i)
  537. {
  538. Tchar j;
  539. if (i >= 0)
  540. j = i;
  541. else
  542. j = -i;
  543. if (Hor > 1 && !vflag)
  544. j = (j + Hor/2)/Hor * Hor;
  545. j |= MOT;
  546. if (i < 0)
  547. j |= NMOT;
  548. if (vflag)
  549. j |= VMOT;
  550. return(j);
  551. }
  552. Tchar getlg(Tchar i)
  553. {
  554. Tchar j, k;
  555. int lf;
  556. if (!TROFF)
  557. return i;
  558. if ((lf = fonts[fbits(i)].ligfont) == 0) /* font lacks ligatures */
  559. return(i);
  560. j = getch0();
  561. if (cbits(j) == 'i' && (lf & LFI))
  562. j = LIG_FI;
  563. else if (cbits(j) == 'l' && (lf & LFL))
  564. j = LIG_FL;
  565. else if (cbits(j) == 'f' && (lf & LFF)) {
  566. if ((lf & (LFFI|LFFL)) && lg != 2) {
  567. k = getch0();
  568. if (cbits(k)=='i' && (lf&LFFI))
  569. j = LIG_FFI;
  570. else if (cbits(k)=='l' && (lf&LFFL))
  571. j = LIG_FFL;
  572. else {
  573. *pbp++ = k;
  574. j = LIG_FF;
  575. }
  576. } else
  577. j = LIG_FF;
  578. } else {
  579. *pbp++ = j;
  580. j = i;
  581. }
  582. return(i & SFMASK | j);
  583. }
  584. void caselg(void)
  585. {
  586. if(TROFF) {
  587. skip();
  588. lg = atoi0();
  589. if (nonumb)
  590. lg = 1;
  591. }
  592. }
  593. void casefp(void)
  594. {
  595. int i, j;
  596. if (!TROFF) {
  597. n_casefp();
  598. return;
  599. }
  600. skip();
  601. i = cbits(getch());
  602. if (isdigit(i)) {
  603. i -= '0';
  604. j = cbits(getch());
  605. if (isdigit(j))
  606. i = 10 * i + j - '0';
  607. }
  608. if (i <= 0 || i > nfonts)
  609. ERROR "fp: bad font position %d", i WARN;
  610. else if (skip() || !(j = getrq()))
  611. ERROR "fp: no font name" WARN;
  612. else if (skip() || !getname())
  613. setfp(i, j, (char*) 0, 1);
  614. else /* 3rd argument = filename */
  615. setfp(i, j, nextf, 1);
  616. }
  617. char *strdupl(const char *s) /* make a copy of s */
  618. {
  619. char *t;
  620. t = (char *) malloc(strlen(s) + 1);
  621. if (t == NULL)
  622. ERROR "out of space in strdupl(%s)", s FATAL;
  623. strcpy(t, s);
  624. return t;
  625. }
  626. setfp(int pos, int f, char *truename, int print) /* mount font f at position pos[0...nfonts] */
  627. {
  628. char pathname[NS], shortname[NS], *sl;
  629. zapwcache(0);
  630. if (truename)
  631. strcpy(shortname, truename);
  632. else
  633. strcpy(shortname, (char *) unpair(f));
  634. if (truename && strrchr(truename, '/')) { /* .fp 1 R dir/file: use verbatim */
  635. sprintf(pathname, "%s", truename);
  636. if (fonts[pos].truename)
  637. free(fonts[pos].truename);
  638. fonts[pos].truename = strdupl(truename);
  639. } else if (truename) { /* synonym: .fp 1 R Avant */
  640. sprintf(pathname, "%s/dev%s/%s", fontdir, devname, truename);
  641. truename = 0; /* so doesn't get repeated by ptfpcmd */
  642. } else /* vanilla: .fp 5 XX */
  643. sprintf(pathname, "%s/dev%s/%s", fontdir, devname, shortname);
  644. if (truename == 0 && fonts[pos].truename != 0) {
  645. free(fonts[pos].truename);
  646. fonts[pos].truename = 0;
  647. }
  648. if (getfont(pathname, pos) < 0) {
  649. ERROR "Can't open font file %s", pathname WARN;
  650. return -1;
  651. }
  652. if (print && !ascii) {
  653. ptfpcmd(pos, fonts[pos].longname, truename);
  654. ptfont();
  655. }
  656. if (pos == smnt) {
  657. smnt = 0;
  658. sbold = 0;
  659. }
  660. fontlab[pos] = f;
  661. if (smnt == 0 && fonts[pos].specfont)
  662. smnt = pos;
  663. bdtab[pos] = cstab[pos] = ccstab[pos] = 0;
  664. return pos;
  665. }
  666. /*
  667. * .cs request; don't check legality of optional arguments
  668. */
  669. void casecs(void)
  670. {
  671. int i, j;
  672. if (TROFF) {
  673. int savtr = trace;
  674. trace = 0;
  675. noscale++;
  676. skip();
  677. if (!(i = getrq()) || (i = findft(i)) < 0)
  678. goto rtn;
  679. skip();
  680. cstab[i] = atoi0();
  681. skip();
  682. j = atoi0();
  683. if(nonumb)
  684. ccstab[i] = 0;
  685. else
  686. ccstab[i] = findps(j);
  687. rtn:
  688. zapwcache(0);
  689. noscale = 0;
  690. trace = savtr;
  691. }
  692. }
  693. void casebd(void)
  694. {
  695. int i, j, k;
  696. if (!TROFF) {
  697. n_casebd();
  698. return;
  699. }
  700. zapwcache(0);
  701. k = 0;
  702. bd0:
  703. if (skip() || !(i = getrq()) || (j = findft(i)) == -1) {
  704. if (k)
  705. goto bd1;
  706. else
  707. return;
  708. }
  709. if (j == smnt) {
  710. k = smnt;
  711. goto bd0;
  712. }
  713. if (k) {
  714. sbold = j;
  715. j = k;
  716. }
  717. bd1:
  718. skip();
  719. noscale++;
  720. bdtab[j] = atoi0();
  721. noscale = 0;
  722. }
  723. void casevs(void)
  724. {
  725. int i;
  726. if (!TROFF) {
  727. n_casevs();
  728. return;
  729. }
  730. skip();
  731. vflag++;
  732. dfact = INCH; /* default scaling is points! */
  733. dfactd = 72;
  734. res = VERT;
  735. i = inumb(&lss);
  736. if (nonumb)
  737. i = lss1;
  738. if (i < VERT)
  739. i = VERT;
  740. lss1 = lss;
  741. lss = i;
  742. }
  743. void casess(void)
  744. {
  745. int i;
  746. if(TROFF) {
  747. noscale++;
  748. skip();
  749. if(i = atoi0()) {
  750. spacesz = i & 0177;
  751. zapwcache(0);
  752. sps = width(' ' | chbits);
  753. }
  754. noscale = 0;
  755. }
  756. }
  757. Tchar t_xlss(void)
  758. {
  759. /* stores \x'...' into two successive Tchars.
  760. /* the first contains HX, the second the value,
  761. /* encoded as a vertical motion.
  762. /* decoding is done in n2.c by pchar().
  763. */
  764. int i;
  765. getch();
  766. dfact = lss;
  767. i = quant(atoi0(), VERT);
  768. dfact = 1;
  769. getch();
  770. if (i >= 0)
  771. *pbp++ = MOT | VMOT | i;
  772. else
  773. *pbp++ = MOT | VMOT | NMOT | -i;
  774. return(HX);
  775. }
  776. Uchar *unpair(int i)
  777. {
  778. static Uchar name[3];
  779. name[0] = i & SHORTMASK;
  780. name[1] = (i >> SHORT) & SHORTMASK;
  781. name[2] = 0;
  782. return name;
  783. }