Annotation of 43BSDReno/usr.bin/window/wwdelete.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1983 Regents of the University of California.
        !             3:  * 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:  * Redistribution and use in source and binary forms are permitted provided
        !             9:  * that: (1) source distributions retain this entire copyright notice and
        !            10:  * comment, and (2) distributions including binaries display the following
        !            11:  * acknowledgement:  ``This product includes software developed by the
        !            12:  * University of California, Berkeley and its contributors'' in the
        !            13:  * documentation or other materials provided with the distribution and in
        !            14:  * all advertising materials mentioning features or use of this software.
        !            15:  * Neither the name of the University nor the names of its contributors may
        !            16:  * be used to endorse or promote products derived from this software without
        !            17:  * specific prior written permission.
        !            18:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            19:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            20:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            21:  */
        !            22: 
        !            23: #ifndef lint
        !            24: static char sccsid[] = "@(#)wwdelete.c 3.19 (Berkeley) 6/6/90";
        !            25: #endif /* not lint */
        !            26: 
        !            27: #include "ww.h"
        !            28: 
        !            29: /*
        !            30:  * Pull w free from the cover list.
        !            31:  */
        !            32: wwdelete(w)
        !            33: register struct ww *w;
        !            34: {
        !            35:        register i;
        !            36: 
        !            37:        for (i = w->ww_i.t; i < w->ww_i.b; i++) {
        !            38:                register j;
        !            39:                register char *smap = wwsmap[i];
        !            40:                register union ww_char *ns = wwns[i];
        !            41:                register int nchanged = 0;
        !            42: 
        !            43:                for (j = w->ww_i.l; j < w->ww_i.r; j++)
        !            44:                        if (smap[j] == w->ww_index) {
        !            45:                                smap[j] = WWX_NOBODY;
        !            46:                                ns[j].c_w = ' ';
        !            47:                                nchanged++;
        !            48:                        }
        !            49:                if (nchanged > 0)
        !            50:                        wwtouched[i] |= WWU_TOUCHED;
        !            51:        }
        !            52: 
        !            53:        {
        !            54:                register struct ww *wp;
        !            55: 
        !            56:                for (wp = w->ww_forw; wp != &wwhead; wp = wp->ww_forw)
        !            57:                        wp->ww_order--;
        !            58:        }
        !            59: 
        !            60:        if (w->ww_forw != &wwhead)
        !            61:                wwdelete1(w->ww_forw,
        !            62:                        w->ww_i.t, w->ww_i.b, w->ww_i.l, w->ww_i.r);
        !            63: 
        !            64:        w->ww_back->ww_forw = w->ww_forw;
        !            65:        w->ww_forw->ww_back = w->ww_back;
        !            66:        w->ww_forw = w->ww_back = 0;
        !            67: }
        !            68: 
        !            69: wwdelete1(w, t, b, l, r)
        !            70: register struct ww *w;
        !            71: {
        !            72:        int i;
        !            73:        int tt, bb, ll, rr;
        !            74:        char hasglass;
        !            75: 
        !            76: again:
        !            77:        hasglass = 0;
        !            78:        tt = MAX(t, w->ww_i.t);
        !            79:        bb = MIN(b, w->ww_i.b);
        !            80:        ll = MAX(l, w->ww_i.l);
        !            81:        rr = MIN(r, w->ww_i.r);
        !            82:        if (tt >= bb || ll >= rr) {
        !            83:                if ((w = w->ww_forw) == &wwhead)
        !            84:                        return;
        !            85:                goto again;
        !            86:        }
        !            87:        for (i = tt; i < bb; i++) {
        !            88:                register j;
        !            89:                register char *smap = wwsmap[i];
        !            90:                register union ww_char *ns = wwns[i];
        !            91:                register char *win = w->ww_win[i];
        !            92:                register union ww_char *buf = w->ww_buf[i];
        !            93:                int nvis = w->ww_nvis[i];
        !            94:                int nchanged = 0;
        !            95: 
        !            96:                for (j = ll; j < rr; j++) {
        !            97:                        if (smap[j] != WWX_NOBODY)
        !            98:                                continue;
        !            99:                        if (win[j] & WWM_GLS) {
        !           100:                                hasglass = 1;
        !           101:                                continue;
        !           102:                        }
        !           103:                        smap[j] = w->ww_index;
        !           104:                        ns[j].c_w = buf[j].c_w ^ win[j] << WWC_MSHIFT;
        !           105:                        nchanged++;
        !           106:                        if (win[j] == 0)
        !           107:                                nvis++;
        !           108:                }
        !           109:                if (nchanged > 0)
        !           110:                        wwtouched[i] |= WWU_TOUCHED;
        !           111:                w->ww_nvis[i] = nvis;
        !           112:        }
        !           113:        if ((w = w->ww_forw) == &wwhead)
        !           114:                return;
        !           115:        if (hasglass)
        !           116:                goto again;
        !           117:        if (tt > t)
        !           118:                wwdelete1(w, t, tt, l, r);
        !           119:        if (bb < b)
        !           120:                wwdelete1(w, bb, b, l, r);
        !           121:        if (ll > l)
        !           122:                wwdelete1(w, tt, bb, l, ll);
        !           123:        if (rr < r)
        !           124:                wwdelete1(w, tt, bb, rr, r);
        !           125: }

unix.superglobalmegacorp.com

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