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

📄 addch.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
字号:
#ifndef lintstatic char *sccsid = "@(#)addch.c	4.1	(ULTRIX)	7/2/90";#endif lint/************************************************************************ *									* *			Copyright (c) 1988, 1990 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.	* *									* ************************************************************************/ /* * Modification History * * 02/20/90 GWS	removed code which reset 'c' to same value as 'rawc', because *		 old code caused passed character attributes to be stripped. */# include	"curses.ext"/* *	This routine prints the character in the current position. *	Think of it as putc. * * 3/5/81 (Berkeley) @(#)addch.c	1.3 */waddch(win, c)register WINDOW	*win;register chtype		c;{	register int		x, y;	char *uctr;	register chtype rawc = c & A_CHARTEXT;	x = win->_curx;	y = win->_cury;# ifdef DEBUG	if (outf)		if (c == rawc)			fprintf(outf, "'%c'", rawc);		else			fprintf(outf, "'%c' %o, raw %o", c, c, rawc);# endif	if (y >= win->_maxy || x >= win->_maxx || y < 0 || x < 0)	{# ifdef DEBUGif(outf){fprintf(outf,"off edge, (%d,%d) not in (%d,%d)\n",y,x,win->_maxy,win->_maxx);}# endif		return ERR;	}	switch( rawc )	{	case '\t':		{			register int newx;			for( newx = x + (8 - (x & 07)); x < newx; x++ )			{				if( waddch(win, ' ') == ERR )				{					return ERR;				}			}			return OK;		}	  default:		if( rawc < ' ')		{			uctr = unctrl(rawc);			waddch(win, (chtype)uctr[0]|(c & 0x7F));			waddch(win, (chtype)uctr[1]|(c & 0x7F));			return OK;		}		if( win->_attrs )		{#ifdef	DEBUGif(outf) fprintf(outf, "(attrs %o, %o=>%o)", win->_attrs, c, c | win->_attrs);#endif	DEBUG			c |= win->_attrs;;		}		if( win->_y[y][x] != c )		{			if( win->_firstch[y] == _NOCHANGE )			{				win->_firstch[y] = win->_lastch[y] = x;			}			else			{				if( x < win->_firstch[y] )				{					win->_firstch[y] = x;				}				else				{					if( x > win->_lastch[y] )					{						win->_lastch[y] = x;					}				}			}		}		win->_y[y][x++] = c;		if (x >= win->_maxx)		{			x = 0;new_line:			if (++y > win->_bmarg)			{				if (win->_scroll && !(win->_flags&_ISPAD))				{#ifdef	DEBUG	if(outf)	{		fprintf( outf, "Calling wrefresh( 0%o ) & _tscroll(  0%o  )\n",				win, win );	}#endif	DEBUG					wrefresh(win);					_tscroll( win );					--y;				}				else				{# ifdef DEBUG					int i;					if(outf)					{					    fprintf(outf,					    "ERR because (%d,%d) > (%d,%d)\n",					    x, y, win->_maxx, win->_maxy);					    fprintf(outf, "line: '");					    for (i=0; i<win->_maxy; i++)						fprintf(outf, "%c",							win->_y[y-1][i]);					    fprintf(outf, "'\n");					}# endif	DEBUG					return ERR;				}			}		}# ifdef DEBUG		if(outf) fprintf(outf, "ADDCH: 2: y = %d, x = %d, firstch = %d, lastch = %d\n", y, x, win->_firstch[y], win->_lastch[y]);# endif	DEBUG		break;	  case '\n':		wclrtoeol(win);		x = 0;		goto new_line;	  case '\r':		x = 0;		break;	  case '\b':		if (--x < 0)			x = 0;		break;	}	win->_curx = x;	win->_cury = y;	return OK;}

⌨️ 快捷键说明

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