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