1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #if !defined(lint) && !defined(NOSCCS)
   8: static char sccsid[] = "@(#)overlay.c	5.2 (Berkeley) 2/12/86";
   9: #endif
  10: 
  11: # include   "curses.ext"
  12: # include   <ctype.h>
  13: 
  14: # define    min(a,b)    (a < b ? a : b)
  15: # define    max(a,b)    (a > b ? a : b)
  16: 
  17: /*
  18:  *	This routine writes win1 on win2 non-destructively.
  19:  *
  20:  */
  21: overlay(win1, win2)
  22: reg WINDOW  *win1, *win2; {
  23: 
  24:     reg char    *sp, *end;
  25:     reg int     x, y, endy, endx, starty, startx;
  26:     reg int     y1,y2;
  27: 
  28: # ifdef DEBUG
  29:     fprintf(outf, "OVERLAY(%0.2o, %0.2o);\n", win1, win2);
  30: # endif
  31:     starty = max(win1->_begy, win2->_begy);
  32:     startx = max(win1->_begx, win2->_begx);
  33:     endy = min(win1->_maxy + win1->_begy, win2->_maxy + win2->_begx);
  34:     endx = min(win1->_maxx + win1->_begx, win2->_maxx + win2->_begx);
  35: # ifdef DEBUG
  36:     fprintf(outf, "OVERLAY:from (%d,%d) to (%d,%d)\n", starty, startx, endy, endx);
  37: # endif
  38:     if (starty >= endy || startx >= endx)
  39:         return;
  40:     x = endx - startx;
  41:     for (y = starty; y < endy; y++) {
  42:         bcopy(&win1->_y[y - win1->_begy][startx - win1->_begx],
  43:               &win2->_y[y - win2->_begy][startx - win2->_begx], x);
  44:         touchline(win2, y, startx - win2->_begx, endx - win2->_begx);
  45:     }
  46:     y1 = starty - win1->_begy;
  47:     y2 = starty - win2->_begy;
  48:     for (y = starty; y < endy; y++, y1++, y2++) {
  49:         end = &win1->_y[y1][endx - win1->_begx];
  50:         x = startx - win2->_begx;
  51:         for (sp = &win1->_y[y1][startx - win1->_begx]; sp < end; sp++) {
  52:             if (!isspace(*sp))
  53:                 mvwaddch(win2, y2, x, *sp);
  54:             x++;
  55:         }
  56:     }
  57: }

Defined functions

overlay defined in line 21; used 1 times

Defined variables

sccsid defined in line 8; never used

Defined macros

max defined in line 15; used 2 times
min defined in line 14; used 2 times
Last modified: 1987-07-26
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1548
Valid CSS Valid XHTML 1.0 Strict