Commit | Line | Data |
---|---|---|
e7fe89d1 | 1 | #ifndef lint |
95f51977 | 2 | static char sccsid[] = "@(#)wwlabel.c 3.13 4/24/85"; |
e7fe89d1 EW |
3 | #endif |
4 | ||
60de5df9 EW |
5 | /* |
6 | * Copyright (c) 1983 Regents of the University of California, | |
7 | * All rights reserved. Redistribution permitted subject to | |
8 | * the terms of the Berkeley Software License Agreement. | |
9 | */ | |
10 | ||
e7fe89d1 | 11 | #include "ww.h" |
0e64e422 | 12 | #include "char.h" |
e7fe89d1 | 13 | |
85af59e4 EW |
14 | /* |
15 | * Label window w on f, | |
16 | * at 1 line above w and 'where' columns from it's left edge. | |
17 | * Gross, but it works. | |
18 | */ | |
19 | wwlabel(w, f, where, l, mode) | |
0896e17e | 20 | struct ww *w; |
85af59e4 EW |
21 | struct ww *f; |
22 | char *l; | |
e7fe89d1 | 23 | { |
d069a508 | 24 | int row; |
85af59e4 | 25 | register j; |
d069a508 | 26 | int jj; |
85af59e4 EW |
27 | register char *win; |
28 | register union ww_char *buf; | |
29 | register union ww_char *ns; | |
0896e17e | 30 | register char *fmap; |
d069a508 EW |
31 | register char *smap; |
32 | char touched; | |
33 | char *p; | |
e7fe89d1 | 34 | |
2357b64e | 35 | if (f->ww_fmap == 0) |
03e75950 | 36 | return; |
2357b64e | 37 | |
d069a508 EW |
38 | row = w->ww_w.t - 1; |
39 | if (row < f->ww_i.t || row >= f->ww_i.b) | |
03e75950 | 40 | return; |
d069a508 EW |
41 | win = f->ww_win[row]; |
42 | buf = f->ww_buf[row]; | |
43 | fmap = f->ww_fmap[row]; | |
44 | ns = wwns[row]; | |
45 | smap = wwsmap[row]; | |
46 | touched = wwtouched[row]; | |
47 | mode <<= WWC_MSHIFT; | |
85af59e4 | 48 | |
d069a508 EW |
49 | jj = MIN(w->ww_i.r, f->ww_i.r); |
50 | j = w->ww_i.l + where; | |
51 | while (j < jj && *l) | |
52 | for (p = unctrl(*l++); j < jj && *p; j++, p++) { | |
85af59e4 | 53 | /* can't label if not already framed */ |
d069a508 EW |
54 | if (win[j] & WWM_GLS) |
55 | continue; | |
56 | if (smap[j] != f->ww_index) | |
57 | buf[j].c_w = mode | *p; | |
58 | else { | |
59 | ns[j].c_w = (buf[j].c_w = mode | *p) | |
60 | ^ win[j] << WWC_MSHIFT; | |
04d70db4 | 61 | touched |= WWU_TOUCHED; |
0896e17e | 62 | } |
d069a508 | 63 | fmap[j] |= WWF_LABEL; |
85af59e4 | 64 | } |
d069a508 | 65 | wwtouched[row] = touched; |
e7fe89d1 | 66 | } |