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