1: #ifndef lint
   2: static char sccsid[] = "@(#)wwdelete.c	3.13 4/24/85";
   3: #endif
   4: 
   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: 
  11: #include "ww.h"
  12: 
  13: /*
  14:  * Pull w free from the cover list.
  15:  */
  16: wwdelete(w)
  17: register struct ww *w;
  18: {
  19:     register i;
  20: 
  21:     for (i = w->ww_i.t; i < w->ww_i.b; i++) {
  22:         register j;
  23:         register char *smap = wwsmap[i];
  24:         register struct ww_char *ns = wwns[i];
  25:         register int nchanged = 0;
  26: 
  27:         for (j = w->ww_i.l; j < w->ww_i.r; j++)
  28:             if (smap[j] == w->ww_index) {
  29:                 smap[j] = WWX_NOBODY;
  30:                 ns[j].c_w = ' ';
  31:                 nchanged++;
  32:             }
  33:         if (nchanged > 4)
  34:             wwtouched[i] |= WWU_MAJOR|WWU_TOUCHED;
  35:         else if (nchanged > 0)
  36:             wwtouched[i] |= WWU_TOUCHED;
  37:     }
  38: 
  39:     {
  40:         register struct ww *wp;
  41: 
  42:         for (wp = w->ww_forw; wp != &wwhead; wp = wp->ww_forw)
  43:             wp->ww_order--;
  44:     }
  45: 
  46:     if (w->ww_forw != &wwhead)
  47:         wwdelete1(w->ww_forw,
  48:             w->ww_i.t, w->ww_i.b, w->ww_i.l, w->ww_i.r);
  49: 
  50:     w->ww_back->ww_forw = w->ww_forw;
  51:     w->ww_forw->ww_back = w->ww_back;
  52:     w->ww_forw = w->ww_back = 0;
  53: }
  54: 
  55: wwdelete1(w, t, b, l, r)
  56: register struct ww *w;
  57: {
  58:     int i;
  59:     int tt, bb, ll, rr;
  60:     char hasglass;
  61: 
  62: again:
  63:     hasglass = 0;
  64:     tt = MAX(t, w->ww_i.t);
  65:     bb = MIN(b, w->ww_i.b);
  66:     ll = MAX(l, w->ww_i.l);
  67:     rr = MIN(r, w->ww_i.r);
  68:     if (tt >= bb || ll >= rr) {
  69:         if ((w = w->ww_forw) == &wwhead)
  70:             return;
  71:         goto again;
  72:     }
  73:     for (i = tt; i < bb; i++) {
  74:         register j;
  75:         register char *smap = wwsmap[i];
  76:         register union ww_char *ns = wwns[i];
  77:         register char *win = w->ww_win[i];
  78:         register union ww_char *buf = w->ww_buf[i];
  79:         int nvis = w->ww_nvis[i];
  80:         int nchanged = 0;
  81: 
  82:         for (j = ll; j < rr; j++) {
  83:             if (smap[j] != WWX_NOBODY)
  84:                 continue;
  85:             if (win[j] & WWM_GLS) {
  86:                 hasglass = 1;
  87:                 continue;
  88:             }
  89:             smap[j] = w->ww_index;
  90:             ns[j].c_w = buf[j].c_w ^ win[j] << WWC_MSHIFT;
  91:             nchanged++;
  92:             if (win[j] == 0)
  93:                 nvis++;
  94:         }
  95:         if (nchanged > 4)
  96:             wwtouched[i] |= WWU_MAJOR|WWU_TOUCHED;
  97:         else if (nchanged > 0)
  98:             wwtouched[i] |= WWU_TOUCHED;
  99:         w->ww_nvis[i] = nvis;
 100:     }
 101:     if ((w = w->ww_forw) == &wwhead)
 102:         return;
 103:     if (hasglass)
 104:         goto again;
 105:     if (tt > t)
 106:         wwdelete1(w, t, tt, l, r);
 107:     if (bb < b)
 108:         wwdelete1(w, bb, b, l, r);
 109:     if (ll > l)
 110:         wwdelete1(w, tt, bb, l, ll);
 111:     if (rr < r)
 112:         wwdelete1(w, tt, bb, rr, r);
 113: }

Defined functions

wwdelete1 defined in line 55; used 6 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1985-04-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1067
Valid CSS Valid XHTML 1.0 Strict