Annotation of researchv10no/libcurses/overlay.c, revision 1.1

1.1     ! root        1: # include      "curses.h"
        !             2: # include      <ctype.h>
        !             3: 
        !             4: # define       min(a,b)        (a < b ? a : b)
        !             5: # define       max(a,b)        (a < b ? a : b)
        !             6: 
        !             7: /*
        !             8:  *     This routine writes win1 on win2 non-destructively.
        !             9:  *
        !            10:  * 1/26/81 (Berkeley) @(#)overlay.c    1.1
        !            11:  */
        !            12: overlay(win1, win2)
        !            13: reg WINDOW     *win1, *win2; {
        !            14: 
        !            15:        reg char        *sp, *end;
        !            16:        reg int         x, y, endy, endx, starty, startx, y_top,
        !            17:                        y_bot, x_left, x_right;
        !            18: 
        !            19: # ifdef DEBUG
        !            20:        fprintf(outf, "OVERLAY(%0.2o, %0.2o);\n", win1, win2);
        !            21: # endif
        !            22:        y_top = max(win1->_begy, win2->_begy);
        !            23:        y_bot = min(win1->_maxy, win2->_maxy);
        !            24:        x_left = max(win1->_begx, win2->_begx);
        !            25:        x_right = min(win1->_maxx, win2->_maxx);
        !            26:        starty = y_top - win1->_begy;
        !            27:        startx = x_left - win1->_begx;
        !            28:        endy = y_bot - win1->_begy;
        !            29:        endx = x_right - win1->_begx;
        !            30:        for (y = starty; y < endy; y++) {
        !            31:                end = &win1->_y[y][endx];
        !            32:                x = startx + win1->_begx;
        !            33:                for (sp = &win1->_y[y][startx]; sp <= end; sp++) {
        !            34:                        if (!isspace(*sp))
        !            35:                                mvwaddch(win2, y + win1->_begy, x, *sp);
        !            36:                        x++;
        !            37:                }
        !            38:        }
        !            39: }

unix.superglobalmegacorp.com

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