|
|
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: overlay(win1, win2)
11: reg WINDOW *win1, *win2; {
12:
13: reg char *sp, *end;
14: reg int x, y, endy, endx, starty, startx, y_top,
15: y_bot, x_left, x_right;
16:
17: # ifdef DEBUG
18: fprintf(outf, "OVERLAY(%0.2o, %0.2o);\n", win1, win2);
19: # endif
20: y_top = max(win1->_begy, win2->_begy);
21: y_bot = min(win1->_maxy, win2->_maxy);
22: x_left = max(win1->_begx, win2->_begx);
23: x_right = min(win1->_maxx, win2->_maxx);
24: starty = y_top - win1->_begy;
25: startx = x_left - win1->_begx;
26: endy = y_bot - win1->_begy;
27: endx = x_right - win1->_begx;
28: for (y = starty; y < endy; y++) {
29: end = &win1->_y[y][endx];
30: x = startx + win1->_begx;
31: for (sp = &win1->_y[y][startx]; sp <= end; sp++) {
32: if (!isspace(*sp))
33: mvwaddch(win2, y + win1->_begy, x, *sp);
34: x++;
35: }
36: }
37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.