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[] = "@(#)overwrite.c	5.1 (Berkeley) 6/7/85";
   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 destructively.
  19:  *
  20:  */
  21: overwrite(win1, win2)
  22: reg WINDOW  *win1, *win2; {
  23: 
  24:     reg char    *sp, *end;
  25:     reg int     x, y, endy, endx, starty, startx;
  26: 
  27: # ifdef DEBUG
  28:     fprintf(outf, "OVERWRITE(%0.2o, %0.2o);\n", win1, win2);
  29: # endif
  30:     starty = max(win1->_begy, win2->_begy);
  31:     startx = max(win1->_begx, win2->_begx);
  32:     endy = min(win1->_maxy + win1->_begy, win2->_maxy + win2->_begx);
  33:     endx = min(win1->_maxx + win1->_begx, win2->_maxx + win2->_begx);
  34:     if (starty >= endy || startx >= endx)
  35:         return;
  36: # ifdef DEBUG
  37:     fprintf(outf, "OVERWRITE:from (%d,%d) to (%d,%d)\n", starty, startx, endy, endx);
  38: # endif
  39:     x = endx - startx;
  40:     for (y = starty; y < endy; y++) {
  41:         bcopy(&win1->_y[y - win1->_begy][startx - win1->_begx],
  42:               &win2->_y[y - win2->_begy][startx - win2->_begx], x);
  43:         touchline(win2, y, startx - win2->_begx, endx - win2->_begx);
  44:     }
  45: }

Defined functions

overwrite 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: 2490
Valid CSS Valid XHTML 1.0 Strict