Annotation of 43BSDTahoe/ucb/window/wwlabel.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1983 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms are permitted
                      6:  * provided that the above copyright notice and this paragraph are
                      7:  * duplicated in all such forms and that any documentation,
                      8:  * advertising materials, and other materials related to such
                      9:  * distribution and use acknowledge that the software was developed
                     10:  * by the University of California, Berkeley.  The name of the
                     11:  * University may not be used to endorse or promote products derived
                     12:  * from this software without specific prior written permission.
                     13:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
                     14:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
                     15:  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     16:  */
                     17: 
                     18: #ifndef lint
                     19: static char sccsid[] = "@(#)wwlabel.c  3.15 (Berkeley) 6/29/88";
                     20: #endif /* not lint */
                     21: 
                     22: #include "ww.h"
                     23: #include "char.h"
                     24: 
                     25: /*
                     26:  * Label window w on f,
                     27:  * at 1 line above w and 'where' columns from it's left edge.
                     28:  * Gross, but it works.
                     29:  */
                     30: wwlabel(w, f, where, l, mode)
                     31: struct ww *w;
                     32: struct ww *f;
                     33: char *l;
                     34: {
                     35:        int row;
                     36:        register j;
                     37:        int jj;
                     38:        register char *win;
                     39:        register union ww_char *buf;
                     40:        register union ww_char *ns;
                     41:        register char *fmap;
                     42:        register char *smap;
                     43:        char touched;
                     44:        char *p;
                     45: 
                     46:        if (f->ww_fmap == 0)
                     47:                return;
                     48: 
                     49:        row = w->ww_w.t - 1;
                     50:        if (row < f->ww_i.t || row >= f->ww_i.b)
                     51:                return;
                     52:        win = f->ww_win[row];
                     53:        buf = f->ww_buf[row];
                     54:        fmap = f->ww_fmap[row];
                     55:        ns = wwns[row];
                     56:        smap = wwsmap[row];
                     57:        touched = wwtouched[row];
                     58:        mode <<= WWC_MSHIFT;
                     59: 
                     60:        jj = MIN(w->ww_i.r, f->ww_i.r);
                     61:        j = w->ww_i.l + where;
                     62:        while (j < jj && *l)
                     63:                for (p = unctrl(*l++); j < jj && *p; j++, p++) {
                     64:                        /* can't label if not already framed */
                     65:                        if (win[j] & WWM_GLS)
                     66:                                continue;
                     67:                        if (smap[j] != f->ww_index)
                     68:                                buf[j].c_w = mode | *p;
                     69:                        else {
                     70:                                ns[j].c_w = (buf[j].c_w = mode | *p)
                     71:                                                ^ win[j] << WWC_MSHIFT;
                     72:                                touched |= WWU_TOUCHED;
                     73:                        }
                     74:                        fmap[j] |= WWF_LABEL;
                     75:                }
                     76:        wwtouched[row] = touched;
                     77: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.