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

📄 eeterm.c

📁 操作系统源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
t_curpos (lin, col)register int lin, col;{	if(col > scr_wid)		/* Easiest to catch here */		col = scr_wid;	/* Do absolute positioning */	switch(tv_type)	  {#if TX_TERMCAP		case TN_TERMCAP:			putpad(tgoto(TC_cm, col, lin));			break;#endif /*TX_TERMCAP*/#if TX_DM2500		case TN_DM2500:			tput(014);			tput(col^0140);			tput(lin^0140);			break;#endif /*TX_DM2500*/#if TX_COHIBM		case TN_COHIBM:		/* If this exists, TN_H19 will too */#endif /*TX_COHIBM*/#if TX_H19		case TN_H19:			tputz("\033Y");			tput(lin+040);			tput(col+040);			break;#endif /*TX_H19*/#if TX_OM8025		case TN_OM8025:			tputz("\033\175");			tput(0100+((lin+1)>>4));			tput(0100+((lin+1)&017));			tput(0100+((col+1)>>4));			tput(0100+((col+1)&017));			break;#endif /*TX_OM8025*/#if TX_TVI925		case TN_TVI925:			tputz("\033=");			tput(lin+040);			tput(col+040);			break;#endif /*TX_TVI925*/	  }	curs_lin = lin;	curs_col = col;}/* T_BACKSPACE() - Back up 1 character position. *	Updates curs_col. *	Only valid if tvc_bs has a "reasonable" value ( < 1000) */t_backspace(){#if TX_TERMCAP	if(BC) tputz(BC);	/* Use alternate BS */	else#endif	tput('\010');		/* Send BS */	--curs_col;}/* T_BELL() - Ring terminal's bell (or flash something, or whatever). *	Forces out all output thus far, to ensure immediate attention. *	This used to be an unbuffered feep, but was changed to use normal *	output path in order to avoid messing up terminal escape sequences. */t_bell(){#if TXC_VISBEL && TX_TERMCAP	if(TC_vb)	        tputz(TC_vb);		/* Do visible bell if possible */	else#endif        tput(BELL);        tbufls();       /* Force it out */}/* T_CLEOL() - Clear to End Of Line. *	Only valid if trm_flags has TF_CLEOL set. */t_cleol (){	switch(tv_type)	  {#if TX_TERMCAP		case TN_TERMCAP:			putpad(TC_ce);			break;#endif /*TX_TERMCAP*/#if TX_DM2500		case TN_DM2500:			tput(027);			break;#endif /*TX_DM2500*/#if TX_COHIBM		case TN_COHIBM:		/* If this exists, TN_H19 will too */#endif /*TX_COHIBM*/#if TX_H19		case TN_H19:			tputz("\033K");			break;#endif /*TX_H19*/#if TX_OM8025		case TN_OM8025:			tputz("\033K");			tpad(41);	/* 1/25 sec padding */			break;#endif /*TX_OM8025*/#if TX_TVI925		case TN_TVI925:			tputz("\033T");			break;#endif /*TX_TVI925*/	  }}/* T_INSLIN(n, bot) - Insert lines in window. *	n   - # blank lines to insert. *	bot - # of last line of current window * *		The current line is moved down and N blank lines inserted. *	Lines which are moved past bot are lost. *	May leave cursor in random place. *	Only valid if trm_flags has TF_IDLIN set. */t_inslin (n, bot)int   n;			/* number of lines */int   bot;			/* line number of last line in window */{	register  i, j;	int savc,savl;	if((i = n) <= 0) return;	if(bot < (scr_ht-1))	  {	savc = curs_col;		savl = curs_lin;		t_curpos(bot-i, 0);		t_dellin(i, scr_ht);		t_curpos(savl, savc);	  }	switch(tv_type)	  {#if TX_TERMCAP		case TN_TERMCAP:			if(TC_AL)				putpar(TC_AL, i, i);			else if(TC_ia)			  {	putpad(TC_im);				do { putpad(TC_ia);				  } while(--i);				putpad(TC_ei);			  }			else				do { putnpad(TC_al, scr_ht - curs_lin);				  } while(--i);			break;#endif /*TX_TERMCAP*/#if TX_DM2500		case TN_DM2500:			tput(020);		/* Enter I/D mode */			do {	tput(012);		/* Insert line */			  	switch(trm_ospeed)				  {	case 13: j = 17; break;	/* 9600 */					case 12: j = 8; break;	/* 4800 */					case 11: j = 4; break;	/* 2400 */					case 9:  j = 2; break;	/* 1200 */					default: j = 0; break;				  }				tpadn(j);			  } while(--i);			tput(030);			/* Exit I/D mode */			break;#endif /*TX_DM2500*/#if TX_H19	/* NOTE: H19 supposedly requires 19 ms for each line during line I/D	 * operations.	 * In actual practice, at 9600 baud 25 pads are necessary (24 wont work!)	 * for both I and D.  Plus esc-E needs 9 pads.	 */		case TN_H19:			do {	tputz("\033L");				switch(trm_ospeed)				  {	case 13: j = 25; break;					case 9:	j = 4; break;					case 7: j = 1; break;					default: j = 0; break;				  }				tpadn(j);			  } while(--i);			break;#endif /*TX_H19*/#if TX_COHIBM		case TN_COHIBM:			do {	tputz("\033L");  /* no padding required */		  	  } while(--i);			break;#endif /*TX_COHIBM*/#if TX_OM8025		case TN_OM8025:			do {	tputz("\033L");				tpad(100*(scr_ht - curs_lin));	/* .1 per moved line*/			  } while(--i);			break;#endif /*TX_OM8025*/#if TX_TVI925		case TN_TVI925:			do tputz("\033E");			while(--i);			break;#endif /*TX_TVI925*/	  }}/* T_DELLIN(n, bot) - Delete lines from window. *	n   - # lines to delete. *	bot - # of last line of current window. *		The current line, and N-1 following lines, are deleted. *	Blank lines are inserted past bot. *	Cursor should be left at original position. *	Only valid if trm_flags has TF_IDLIN set. */t_dellin (n, bot)int   n;			/* number of lines */int   bot;			/* line number of last line in window */{	register  i, j;	int savl, savc;	if((i = n) <= 0) return;	switch(tv_type)	  {#if TX_TERMCAP		case TN_TERMCAP:			if(TC_DL)				putpar(TC_DL, i, i);			else if(TC_id)			  {	putpad(TC_dm);				do putpad(TC_id);				while(--i);				putpad(TC_ed);			  }			else				do { putnpad(TC_dl,scr_ht - curs_lin);				  } while(--i);			break;#endif /*TX_TERMCAP*/#if TX_DM2500		case TN_DM2500:			tput(020);			do {	tput(032);			  	if(trm_ospeed >= 13)	/* 9600 */					tput(0177);			  } while(--i);			tput(030);			break;#endif /*TX_DM2500*/#if TX_H19		case TN_H19:			do {	tputz("\033M");				switch(trm_ospeed){					case 13: j = 25; break;					case 9:	j = 4; break;					case 7: j = 1; break;					default: j = 0; break;					}				tpadn(j);			  } while(--i);			break;#endif /*TX_H19*/#if TX_COHIBM		case TN_COHIBM:			do {	tputz("\033M");	  /* no padding required */			  } while(--i);			break;#endif /*TX_COHIBM*/#if TX_OM8025		case TN_OM8025:			do {	tputz("\033M");				tpad(100*(scr_ht - curs_lin));			  } while(--i);			break;#endif /*TX_OM8025*/#if TX_TVI925		case TN_TVI925:			do {	tputz("\033R");			  } while(--i);			break;#endif /*TX_TVI925*/	  }	if(bot < (scr_ht-1))	  {	savl = curs_lin;		savc = curs_col;		t_curpos(bot-n,0);		t_inslin(n,scr_ht);		t_curpos(savl,savc);	  }}/* T_INSCHR(n, str) - Insert n chars in current line *	n   - # characters to insert *	str - Pointer to char string.  If 0, insert spaces. * *	Insert N characters from string str at current position. *	The cursor may move but curs_col must be updated. *	Only valid if trm_flags has TF_IDCHR set. */t_inschr(n, str)int n;char *str;{	register int i;	register char *cp;	if((i = n) <= 0) return;	cp = str;	switch(tv_type)	  {#if TX_TERMCAP		case TN_TERMCAP:			putpad(TC_im);		/* Go into insert mode */			if(TC_IC)			  {	putpar(TC_IC, i, 1);				if(cp) tputn(cp, i);				else do tput(SP); while(--i);			  }			else do {				if(TC_ic) putpad(TC_ic);				if(cp) tput(*cp++);				else tput(SP);				if(TC_ip) putpad(TC_ip);			  } while(--i);			putpad(TC_ei);		/* Exit insert mode */			curs_col += n;			break;#endif /*TX_TERMCAP*/#if TX_COHIBM		case TN_COHIBM:		/* If this exists, TN_H19 will too */#endif /*TX_COHIBM*/#if TX_H19		case TN_H19:			tputz("\033@");		/* Enter ins char mode */			do {	if(cp) tput(*cp++);				else tput(SP);			  } while(--i);			tputz("\033O");		/* Exit ins char mode */			curs_col += n;			break;#endif /*TX_H19*/#if TX_DM2500		case TN_DM2500:			tput(020);		/* Enter I/D mode */			if(trm_ospeed == 13)	/* 9600 baud lossage */			  {	do {					tputz(" \177");	/* SP and DEL */				  } while(--i);				tput(030);				i = n;				if(i < 3)	/* If close enough, */					tputn("\010\010", i);	/* use BSes */				else t_curpos(curs_lin, curs_col);			  }			else			/* Not 9600, can win */			  {	do { tput(034);				  } while(--i);				tput(030);				if(cp == 0) return;				i = n;			  }			do {	if(cp) tput(*cp++);				else tput(SP);			  } while(--i);			curs_col += n;			break;#endif /*TX_DM2500*/#if TX_OM8025		case TN_OM8025:			do {				tputz("\033@");				if(cp) tput(*cp++);				else tput(SP);			  } while(--i);			curs_col += n;			break;#endif /*TX_OM8025*/#if TX_TVI925		case TN_TVI925:			do {	tputz("\033Q");			  } while(--i);			if(cp)			  {	tputn(cp, n);				curs_col += n;			  }			break;#endif /*TX_TVI925*/	  }}/* T_DELCHR(n) - Delete N chars in current line. *	Deletes the N characters to the right of the cursor.  Remaining *	chars are shifted left.  The cursor should not move. *	Only valid if trm_flags has TF_IDCHR set. */t_delchr(n)		/* Delete N chars at current loc */int n;{	register int i;	if((i = n) <= 0) return;	switch(tv_type)	  {#if TX_TERMCAP		case TN_TERMCAP:			putpad(TC_dm);	/* Enter delete mode */			if(TC_DC)				putpar(TC_DC, i, 1);			else do {	/* Delete char while in del mode */				putpad(TC_dc);			} while(--i);			putpad(TC_ed);	/* Exit delete mode */			break;#endif /*TX_TERMCAP*/#if TX_COHIBM

⌨️ 快捷键说明

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