⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 overlay.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
字号:
#ifndef lintstatic	char	*sccsid = "@(#)overlay.c	4.1	(ULTRIX)	7/2/90";#endif lint/************************************************************************ *									* *			Copyright (c) 1984 by				* *		Digital Equipment Corporation, Maynard, MA		* *			All rights reserved.				* *									* *   This software is furnished under a license and may be used and	* *   copied  only  in accordance with the terms of such license and	* *   with the  inclusion  of  the  above  copyright  notice.   This	* *   software  or  any  other copies thereof may not be provided or	* *   otherwise made available to any other person.  No title to and	* *   ownership of the software is hereby transferred.			* *									* *   This software is  derived  from  software  received  from  the	* *   University    of   California,   Berkeley,   and   from   Bell	* *   Laboratories.  Use, duplication, or disclosure is  subject  to	* *   restrictions  under  license  agreements  with  University  of	* *   California and with AT&T.						* *									* *   The information in this software is subject to change  without	* *   notice  and should not be construed as a commitment by Digital	* *   Equipment Corporation.						* *									* *   Digital assumes no responsibility for the use  or  reliability	* *   of its software on equipment which is not supplied by Digital.	* *									* ************************************************************************/# include	"curses.ext"# include	<ctype.h># define	min(a,b)	(a < b ? a : b)# define	max(a,b)	(a > b ? a : b)/* *	This routine writes win1 on win2 non-destructively. * * 11/5/82 (Berkeley) @(#)overlay.c	1.4 */overlay(win1, win2)reg WINDOW	*win1, *win2; {	reg char	*sp, *end;	reg int		x, y, endy, endx, starty, startx;# ifdef DEBUG	fprintf(outf, "OVERLAY(%0.2o, %0.2o);\n", win1, win2);# endif	starty = max(win1->_begy, win2->_begy) - win1->_begy;	startx = max(win1->_begx, win2->_begx) - win1->_begx;	endy = min(win1->_maxy, win2->_maxy) - win1->_begy - 1;	endx = min(win1->_maxx, win2->_maxx) - win1->_begx - 1;/*The bug found in overlay() is where the last line of the windowbeing overlayed is not overlayed.   It seems that theextraction of this library from "vi" has bitten us again.The problem is that the computation of "endy" takes into accountthe fact that "_maxy" is "1 relative".  The subtraction of 1 now makesit "0 relative", but the for-loop is treating it as "1 relative".*/	for (y = starty; y <= endy; y++) {		end = &win1->_y[y][endx];		x = startx + win1->_begx;		for (sp = &win1->_y[y][startx]; sp <= end; sp++) {			if (!isspace(*sp))				mvwaddch(win2, y + win1->_begy, x, *sp);			x++;		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -