Annotation of coherent/g/usr/lib/ncurses/lib_erase.c, revision 1.1.1.1

1.1       root        1: /*********************************************************************
                      2: *                         COPYRIGHT NOTICE                           *
                      3: **********************************************************************
                      4: *        This software is copyright (C) 1982 by Pavel Curtis         *
                      5: *                                                                    *
                      6: *        Permission is granted to reproduce and distribute           *
                      7: *        this file by any means so long as no fee is charged         *
                      8: *        above a nominal handling fee and so long as this            *
                      9: *        notice is always included in the copies.                    *
                     10: *                                                                    *
                     11: *        Other rights are reserved except as explicitly granted      *
                     12: *        by written permission of the author.                        *
                     13: *                Pavel Curtis                                        *
                     14: *                Computer Science Dept.                              *
                     15: *                405 Upson Hall                                      *
                     16: *                Cornell University                                  *
                     17: *                Ithaca, NY 14853                                    *
                     18: *                                                                    *
                     19: *                Ph- (607) 256-4934                                  *
                     20: *                                                                    *
                     21: *                Pavel.Cornell@Udel-Relay   (ARPAnet)                *
                     22: *                decvax!cornell!pavel       (UUCPnet)                *
                     23: *********************************************************************/
                     24: 
                     25: /*
                     26: **     lib_erase.c
                     27: **
                     28: **     The routine werase().
                     29: **
                     30: ** $Log:       lib_erase.c,v $
                     31:  * Revision 1.8  93/04/12  14:13:38  bin
                     32:  * Udo: third color update
                     33:  * 
                     34:  * Revision 1.2  92/04/13  14:37:27  bin
                     35:  * update by vlad
                     36:  * 
                     37:  * Revision 2.3  91/04/20  18:32:50  munk
                     38:  * Usage of register variables
                     39:  *
                     40:  * Revision 2.2  82/11/03  12:27:41  pavel
                     41:  * Fixed off-by-one error...  If only I had used an invariant...
                     42:  * 
                     43:  * Revision 2.1  82/10/25  14:47:17  pavel
                     44:  * Added Copyright Notice
                     45:  * 
                     46:  * Revision 2.0  82/10/25  13:45:12  pavel
                     47:  * Beta-one Test Release
                     48:  * 
                     49: **
                     50: */
                     51: 
                     52: #ifdef RCSHDR
                     53: static char RCSid[] =
                     54:        "$Header: /src386/usr/lib/ncurses/RCS/lib_erase.c,v 1.8 93/04/12 14:13:38 bin Exp Locker: bin $";
                     55: #endif
                     56: 
                     57: #include "curses.h"
                     58: #include "curses.priv.h"
                     59: 
                     60: 
                     61: werase(win)
                     62: register WINDOW        *win;
                     63: {
                     64:        register int    y;
                     65:        chtype          *sp, *end, *start, *maxx;
                     66:        int             minx;
                     67:        chtype          blank = ' ' | win->_attrs;
                     68: 
                     69: #ifdef TRACE
                     70:        if (_tracing)
                     71:            _tracef("werase(%o) called", win);
                     72: #endif
                     73: 
                     74:        for (y = win->_regtop; y <= win->_regbottom; y++)
                     75:        {
                     76:            minx = _NOCHANGE;
                     77:            start = win->_line[y];
                     78:            end = &start[win->_maxx];
                     79: 
                     80:            for (sp = start; sp <= end; sp++)
                     81:            {
                     82:                if (*sp != blank)
                     83:                {
                     84:                    maxx = sp;
                     85:                    if (minx == _NOCHANGE)
                     86:                        minx = sp - start;
                     87: 
                     88:                    *sp = blank;
                     89: 
                     90:                    win->_numchngd[y] += 1;
                     91:                }
                     92:            }
                     93: 
                     94:            if (minx != _NOCHANGE)
                     95:            {
                     96:                if (win->_firstchar[y] > minx
                     97:                                            ||  win->_firstchar[y] == _NOCHANGE)
                     98:                    win->_firstchar[y] = minx;
                     99: 
                    100:                if (win->_lastchar[y] < maxx - win->_line[y])
                    101:                    win->_lastchar[y] = maxx - win->_line[y];
                    102:            }
                    103:        }
                    104: 
                    105:        win->_curx = win->_cury = 0;
                    106: }

unix.superglobalmegacorp.com

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