Annotation of coherent/g/usr/lib/ncurses/lib_refresh.c, revision 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_refresh.c
        !            27:  *
        !            28:  *     The routines wrefresh() and wnoutrefresh().
        !            29:  *
        !            30:  *  $Log:      lib_refresh.c,v $
        !            31:  * Revision 3.2  91/04/20  21:37:40  munk
        !            32:  * Usage of register variables
        !            33:  *
        !            34:  * Revision 3.1  84/12/13  11:20:51  john
        !            35:  * Revisions by Mark Horton
        !            36:  * 
        !            37:  * Revision 2.1  82/10/25  14:48:45  pavel
        !            38:  * Added Copyright Notice
        !            39:  * 
        !            40:  * Revision 2.0  82/10/25  13:48:47  pavel
        !            41:  * Beta-one Test Release
        !            42:  * 
        !            43:  *
        !            44:  */
        !            45: 
        !            46: #ifdef RCSHDR
        !            47: static char RCSid[] =
        !            48:        "$Header: lib_refresh.c,v 3.2 91/04/20 21:37:40 munk Exp $";
        !            49: #endif
        !            50: 
        !            51: #include "curses.h"
        !            52: #include "curses.priv.h"
        !            53: 
        !            54: 
        !            55: wrefresh(win)
        !            56: WINDOW *win;
        !            57: {
        !            58: #ifdef TRACE
        !            59:        if (_tracing)
        !            60:            _tracef("wrefresh(%o) called", win);
        !            61: #endif
        !            62: 
        !            63:        if (win == curscr)
        !            64:        {
        !            65:            curscr->_clear = TRUE;
        !            66:            doupdate();
        !            67:        }
        !            68:        else
        !            69:        {
        !            70:            wnoutrefresh(win);
        !            71:            doupdate();
        !            72:        }
        !            73: }
        !            74: 
        !            75: 
        !            76: wnoutrefresh(win)
        !            77: register WINDOW        *win;
        !            78: {
        !            79:        register int    i, j;
        !            80:        int             begx = win->_begx;
        !            81:        int             begy = win->_begy;
        !            82:        int             m, n;
        !            83: 
        !            84: #ifdef TRACE
        !            85:        if (_tracing)
        !            86:            _tracef("wnoutrefresh(%o) called", win);
        !            87: #endif
        !            88: 
        !            89:        for (i=0, m=begy; i <= win->_maxy; i++, m++)
        !            90:        {
        !            91: #ifdef TRACE
        !            92:            if (_tracing)
        !            93:            {
        !            94:                _tracef("win->_firstchar[%d]= %d\t_lastchar= %d\t_numchngd= %d",
        !            95:                            i, win->_firstchar[i],
        !            96:                               win->_lastchar[i],
        !            97:                               win->_numchngd[i]);
        !            98:            }
        !            99: #endif
        !           100: 
        !           101:            if (win->_numchngd[i])
        !           102:            {
        !           103:                j = win->_firstchar[i];
        !           104:                n = j + begx;
        !           105:                for (; j <= win->_lastchar[i]; j++, n++)
        !           106:                {
        !           107:                    if (win->_line[i][j] != newscr->_line[m][n])
        !           108:                    {
        !           109:                        newscr->_line[m][n] = win->_line[i][j];
        !           110:                        newscr->_numchngd[m] += 1;
        !           111: 
        !           112:                        if (newscr->_firstchar[m] == _NOCHANGE)
        !           113:                            newscr->_firstchar[m] = newscr->_lastchar[m] = n;
        !           114:                        else if (n < newscr->_firstchar[m])
        !           115:                            newscr->_firstchar[m] = n;
        !           116:                        else if (n > newscr->_lastchar[m])
        !           117:                            newscr->_lastchar[m] = n;
        !           118:                    }
        !           119:                }
        !           120:            }
        !           121: 
        !           122:            win->_numchngd[i] = 0;
        !           123:            win->_firstchar[i] = win->_lastchar[i] = _NOCHANGE;
        !           124:        }
        !           125: 
        !           126:        if (win->_clear)
        !           127:        {
        !           128:            win->_clear = FALSE;
        !           129:            newscr->_clear = TRUE;
        !           130:        }
        !           131: 
        !           132:        if (! win->_leave)
        !           133:        {
        !           134:            newscr->_cury = win->_cury + win->_begy;
        !           135:            newscr->_curx = win->_curx + win->_begx;
        !           136:        }
        !           137: }

unix.superglobalmegacorp.com

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