1 /* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Edward Wang at The University of California, Berkeley. 7 * 8 * %sccs.include.redist.c% 9 */ 10 11 #ifndef lint 12 static char sccsid[] = "@(#)wwlabel.c 8.1 (Berkeley) 06/06/93"; 13 #endif /* not lint */ 14 15 #include "ww.h" 16 #include "char.h" 17 18 /* 19 * Label window w on f, 20 * at 1 line above w and 'where' columns from it's left edge. 21 * Gross, but it works. 22 */ 23 wwlabel(w, f, where, l, mode) 24 struct ww *w; 25 struct ww *f; 26 char *l; 27 { 28 int row; 29 register j; 30 int jj; 31 register char *win; 32 register union ww_char *buf; 33 register union ww_char *ns; 34 register char *fmap; 35 register char *smap; 36 char touched; 37 char *p; 38 39 if (f->ww_fmap == 0) 40 return; 41 42 row = w->ww_w.t - 1; 43 if (row < f->ww_i.t || row >= f->ww_i.b) 44 return; 45 win = f->ww_win[row]; 46 buf = f->ww_buf[row]; 47 fmap = f->ww_fmap[row]; 48 ns = wwns[row]; 49 smap = wwsmap[row]; 50 touched = wwtouched[row]; 51 mode <<= WWC_MSHIFT; 52 53 jj = MIN(w->ww_i.r, f->ww_i.r); 54 j = w->ww_i.l + where; 55 while (j < jj && *l) 56 for (p = unctrl(*l++); j < jj && *p; j++, p++) { 57 /* can't label if not already framed */ 58 if (win[j] & WWM_GLS) 59 continue; 60 if (smap[j] != f->ww_index) 61 buf[j].c_w = mode | *p; 62 else { 63 ns[j].c_w = (buf[j].c_w = mode | *p) 64 ^ win[j] << WWC_MSHIFT; 65 touched |= WWU_TOUCHED; 66 } 67 fmap[j] |= WWF_LABEL; 68 } 69 wwtouched[row] = touched; 70 } 71