1: # include "curses.ext"
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: * 11/5/82 (Berkeley) @(#)overlay.c 1.4
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;
17:
18: # ifdef DEBUG
19: fprintf(outf, "OVERLAY(%0.2o, %0.2o);\n", win1, win2);
20: # endif
21: starty = max(win1->_begy, win2->_begy) - win1->_begy;
22: startx = max(win1->_begx, win2->_begx) - win1->_begx;
23: endy = min(win1->_maxy, win2->_maxy) - win1->_begy - 1;
24: endx = min(win1->_maxx, win2->_maxx) - win1->_begx - 1;
25: for (y = starty; y < endy; y++) {
26: end = &win1->_y[y][endx];
27: x = startx + win1->_begx;
28: for (sp = &win1->_y[y][startx]; sp <= end; sp++) {
29: if (!isspace(*sp))
30: mvwaddch(win2, y + win1->_begy, x, *sp);
31: x++;
32: }
33: }
34: }
Defined functions
Defined macros
max
defined in line
5; used 2 times
min
defined in line
4; used 2 times