亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? display.c

?? 這是新華龍(www.xhl.xom.xn)開發的
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* ANSI display emulation
 *
 * This file emulates the IBM ANSI terminal display. It maintains a
 * display buffer and descriptor for each virtual display, of which there
 * can be many. All writes occur first into this display buffer, and then
 * any particular display buffer can be copied onto the real screen.
 * This allows many background tasks to run without blocking even though
 * only one task's display is actually being shown.
 *
 * This display driver is substantially faster than even the NANSI.SYS
 * loadable screen driver, particularly when large blocks are written.
 *
 * Extensions to handle displaying multiple small virtual windows should
 * be pretty straightforward.
 *
 * 
 */
#include <conio.h>
#include <string.h>
#include <sys/stat.h>
#include "global.h"
#include "display.h"
#include "proc.h"

#define	DCOL	67
#define	DSIZ	(81-DCOL)

uint8 fgattr[] = { 0, 4, 2, 14, 1, 5, 3, 7 };	/* Foreground attribs */
uint8 bgattr[] = { 0, 4, 2, 6, 1, 5, 3, 7 };	/* Background attribs */

static void dclrscr(struct display *dp);
static void desc(struct display *dp,uint8 c);
static void darg(struct display *dp,uint8 c);
static void dchar(struct display *dp,uint8 c);
static void dclreol(struct display *dp,int row,int col);
static void dattrib(struct display *dp,int val);
static uint8 *bufloc(struct display *dp,int row,int col);
static void dinsline(struct display *dp);
static void ddelline(struct display *dp);
static void ddelchar(struct display *dp);
static void dinsert(struct display *dp);
static void dclreod(struct display *dp,int row,int col);

extern struct proc *Display;

/* Create a new virtual display.
 * The "noscrol" flag, if set, causes lines to "wrap around" from the bottom
 * to the top of the screen instead of scrolling the entire screen upwards
 * with each new line. This can be handy for packet trace screens.
 */
struct display *
newdisplay(rows,cols,noscrol,sflimit)
int rows,cols;	/* Size of new screen. 0,0 defaults to whole screen */
int noscrol;	/* 1: old IBM-style wrapping instead of scrolling */
int sflimit;	/* Scrollback file size, lines */
{
	struct display *dp;
	struct text_info text_info;
	int i;

	gettextinfo(&text_info);
	if(rows == 0)
		rows = text_info.screenheight;
	if(cols == 0)
		cols = text_info.screenwidth;

	dp = (struct display *)calloc(1,sizeof(struct display) +
	 2*rows*cols + rows*sizeof(struct dirty) + cols);
	dp->cookie = D_COOKIE;
	dp->buf = (uint8 *)(dp + 1);
	dp->dirty = (struct dirty *)(dp->buf + 2*rows*cols);
	dp->tabstops = (uint8 *)(dp->dirty + rows);
	dp->rows = rows;
	dp->cols = cols;

	/* Set default tabs every 8 columns */
	for(i=0;i<cols;i+= 8)
		dp->tabstops[i] = 1;
	/* Default scrolling region is all but last line of display,
	 * which is reserved for a status display
	 */
	dp->slast = rows - 2;

	dp->attrib = 0x7;	/* White on black, no blink or intensity */
	dclrscr(dp);		/* Start with a clean slate */
	dclreol(dp,rows-1,0);	/* Clear status line too */
	dp->flags.dirty_cursor = 1;
	dp->flags.no_scroll = noscrol;
	if(sflimit != 0 && (dp->sfile = tmpfile()) == NULL)
		sflimit = 0;	/* Out of handles? */

	dp->sflimit = sflimit;
	return dp;
}

/* Close a display - simply get rid of the memory */
void
closedisplay(dp)
struct display *dp;
{
	if(dp == NULL || dp->cookie != D_COOKIE)
		return;
	if(dp->sfile != NULL)
		fclose(dp->sfile);
	free(dp);
}

/* Write buffer to status line. Works independently of the ANSI
 * machinery so as to not upset a possible escape sequence in
 * progress. Maximum of one line allowed, no control sequences
 */
void
statwrite(dp,col,buf,cnt,attrib)
struct display *dp;	/* Virtual screen pointer */
int col;		/* Starting column of write */
void *buf;		/* Data to be written */
int cnt;		/* Count */
int attrib;		/* Screen attribute to be used */
{
	uint8 *buf1 = buf;
	uint8 *sp = bufloc(dp,dp->slast+1,col);
	struct dirty *dirtp = &dp->dirty[dp->slast+1];

	/* Clip debug area if activated */
	if(Kdebug && cnt > DCOL - col - 1)
		cnt = DCOL - col - 1;
	else if(cnt > dp->cols-col)
		cnt = dp->cols - col;	/* Limit write to line length */

	while(cnt-- != 0){
		if(sp[0] != *buf1 || sp[1] != attrib){
			if(col < dirtp->lcol)
				dirtp->lcol = col; 
			if(col > dirtp->rcol)
				dirtp->rcol = col;
			sp[0] = *buf1;
			sp[1] = attrib;
		}
		buf1++;
		sp += 2;
		col++;
	}
}
/* Write data to the virtual display. Does NOT affect the real screen -
 * dupdate(dp) must be called to copy the virtual screen to the real
 * screen.
 */
void
displaywrite(dp,buf,cnt)
struct display *dp;	/* Virtual screen pointer */
void *buf;		/* Data to be written */
int cnt;		/* Count */
{
	uint8 c;
	char *bufp = buf;

	if(dp == NULL || dp->cookie != D_COOKIE)
		return;

	while(cnt-- != 0){
		c = *bufp++;
		switch(dp->state){
		case DISP_ESCAPE:
			desc(dp,c);
			break;
		case DISP_ARG:
			darg(dp,c);
			break;
		case DISP_NORMAL:
			dchar(dp,c);
			break;
		}
	}
	ksignal(dp,1);
}
/* Make the real screen look like the virtual one. It attempts to do as
 * little work as possible unless the "dirty screen" flag is set -- then
 * the entire screen is updated. (This is useful when switching between
 * virtual display screens.)
 *
 * Note the different row and column numbering conventions -- I start
 * at zero, the puttext() and gotoxy() library functions start at 1.
 */
void
dupdate(dp)
struct display *dp;	/* Virtual screen pointer */
{
	int row,rows;
	long sp;
	uint8 *lbuf;
	struct dirty *dirtp;
	long offset;

	if(dp == NULL || dp->cookie != D_COOKIE)
		return;

	offset = dp->flags.scrollbk ? dp->sfoffs : 0;

	if(offset > 0 && dp->flags.dirty_screen){
		/* Display from scrollback file */
		sp = dp->sfseek - 2*offset*dp->cols;
		if(sp < 0)
			sp += 2*dp->sfsize*dp->cols;	/* Wrap back */
		rows = min(offset,dp->slast+1);	/* # rows to read */
		lbuf = malloc(2*dp->cols*rows);
		fseek(dp->sfile,sp,SEEK_SET);
		/* row = actual # rows read */
		row = fread(lbuf,2*dp->cols,rows,dp->sfile);
		if(row != 0)
			puttext(1,1,dp->cols,row,lbuf);
		if(row != rows){
			/* Hit end of file; rewind and read the rest */
			fseek(dp->sfile,0L,SEEK_SET);
			fread(lbuf,2*dp->cols,rows-row,dp->sfile);
			puttext(1,row+1,dp->cols,rows,lbuf);
		}
		free(lbuf);
	}
	/* Display from memory image of current screen (if visible) */
	for(row = offset,dirtp = &dp->dirty[row];
	 row<=dp->slast;row++,dirtp++){
		if(dp->flags.dirty_screen){
			/* Force display of all columns */
			dirtp->lcol = 0;
			dirtp->rcol = dp->cols-1;
		}
		if(dirtp->lcol <= dirtp->rcol){
			puttext(dirtp->lcol+1,row+1,dirtp->rcol+1,row+1,
			 bufloc(dp,row-offset,dirtp->lcol));
			dirtp->lcol = dp->cols-1;
			dirtp->rcol = 0;
		}
	}
	/* Display unscrolled status region */
	for(row=dp->slast+1,dirtp = &dp->dirty[row];row<dp->rows;row++,dirtp++){
		if(dp->flags.dirty_screen){
			dirtp->lcol = 0;
			dirtp->rcol = dp->cols-1;
		}
		if(dirtp->lcol <= dirtp->rcol){
			puttext(dirtp->lcol+1,row+1,dirtp->rcol+1,row+1,
			 bufloc(dp,row,dirtp->lcol));
			dirtp->lcol = dp->cols-1;
			dirtp->rcol = 0;
		}
	}
	if(dp->flags.dirty_screen || (dp->flags.dirty_cursor)){
		/* Update cursor */
		if(dp->row+offset <= dp->slast){
			gotoxy(dp->col+1,dp->row+1+offset);
			_setcursortype(_NORMALCURSOR);
		} else {
			/* Turn off cursor entirely */
			_setcursortype(_NOCURSOR);
		}
	}
	dp->flags.dirty_cursor = 0;
	dp->flags.dirty_screen = 0;
}
void
dscrollmode(dp,flag)
struct display *dp;
int flag;
{
	if(dp == NULL || dp->cookie != D_COOKIE)
		return;

	if(flag != dp->flags.scrollbk){
		dp->flags.scrollbk = flag;
		if(dp->sfoffs != 0)
			dp->flags.dirty_screen = 1;
		alert(Display,1);
	}
}


void
dhome(dp)
struct display *dp;
{
	if(dp == NULL || dp->cookie != D_COOKIE)
		return;

	if(dp->sfoffs != dp->sfsize){
		dp->sfoffs = dp->sfsize;
		dp->flags.dirty_screen = 1;
		alert(Display,1);
	}
}
void
dend(dp)
struct display *dp;
{
	if(dp == NULL || dp->cookie != D_COOKIE)
		return;

	if(dp->sfoffs != 0){
		dp->sfoffs = 0;
		dp->flags.dirty_screen = 1;
		alert(Display,1);
	}
}
void
dpgup(dp)
struct display *dp;
{
	long newoffs;

	if(dp == NULL || dp->cookie != D_COOKIE)
		return;

	newoffs = dp->sfoffs + dp->slast + 1;
	newoffs = min(newoffs,dp->sfsize);
	if(newoffs != dp->sfoffs){
		dp->sfoffs = newoffs;
		dp->flags.dirty_screen = 1;
		alert(Display,1);
	}
}
void
dpgdown(dp)
struct display *dp;
{
	long newoffs;

	if(dp == NULL || dp->cookie != D_COOKIE)
		return;

	newoffs = dp->sfoffs - (dp->slast + 1);
	newoffs = max(0,newoffs);
	if(newoffs != dp->sfoffs){
		dp->sfoffs = newoffs;
		dp->flags.dirty_screen = 1; 
		alert(Display,1);
	}
}
void
dcursup(dp)
struct display *dp;
{
	if(dp == NULL || dp->cookie != D_COOKIE)
		return;

	if(dp->sfoffs < dp->sfsize){
		dp->sfoffs++;
		dp->flags.dirty_screen = 1; 
		alert(Display,1);
	}
}
void
dcursdown(dp)
struct display *dp;
{
	if(dp == NULL || dp->cookie != D_COOKIE)
		return;

	if(dp->sfoffs != 0){
		dp->sfoffs--;
		dp->flags.dirty_screen = 1; 
		alert(Display,1);
	}
}

/* Process incoming character while in ESCAPE state */
static void
desc(dp,c)
struct display *dp;
uint8 c;
{
	int i;

	switch(c){
	case 'O':
	case '[':	/* Always second char of ANSI escape sequence */
		/* Get ready for argument list */
		dp->state = DISP_ARG;
		dp->argi = 0;
		for(i=0;i<MAXARGS;i++)
			dp->arg[i] = 0;

		break;
	case '7':	/* Save cursor location (VT-100) */
		dp->savcol = dp->col;
		dp->savrow = dp->row;
		dp->state = DISP_NORMAL;
		break;
	case '8':	/* Restore cursor location (VT-100) */
		dp->col = dp->savcol;
		dp->row = dp->savrow;
		dp->flags.dirty_cursor = 1;
		dp->state = DISP_NORMAL;
		break;
	case ESC:
		break;	/* Remain in ESCAPE state */
	case 'H':	/* Set tab stop at current position (VT-100) */
		dp->tabstops[dp->col] = 1;
		break;
	default:
		dp->state = DISP_NORMAL;
		dchar(dp,c);
	}
}

/* Process characters after a ESC[ sequence */
static void
darg(dp,c)
struct display *dp;
uint8 c;
{
	int i;

	switch(c){
	case ESC:
		dp->state = DISP_ESCAPE;
		return;
	case '?':	/* Ignored */
	case '=':
		return;
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩精品欧美日韩精品一| 亚洲男同1069视频| 欧美欧美午夜aⅴ在线观看| 色成人在线视频| 91精品福利视频| 色婷婷国产精品综合在线观看| 91小视频免费观看| 色诱亚洲精品久久久久久| 色婷婷av一区二区三区之一色屋| 色综合天天综合网国产成人综合天| 91亚洲永久精品| 欧美二区乱c少妇| 欧美一区二区三区免费视频| 在线电影一区二区三区| 欧美一级xxx| 国产亚洲精品中文字幕| 国产精品久久久久久久久免费相片| 国产农村妇女毛片精品久久麻豆| 国产精品三级av| 亚洲国产成人porn| 免费成人在线播放| 成人免费看片app下载| 色综合色综合色综合色综合色综合| 色综合久久中文字幕| 在线播放/欧美激情| 精品日韩一区二区三区| 中文字幕精品一区| 亚洲国产欧美日韩另类综合| 强制捆绑调教一区二区| 成人综合日日夜夜| 欧美另类一区二区三区| 久久久久国产成人精品亚洲午夜| 亚洲欧美日韩在线不卡| 蜜臀久久99精品久久久久久9| 成人深夜在线观看| 欧美久久久久久久久中文字幕| 久久尤物电影视频在线观看| 亚洲精品亚洲人成人网| 美女免费视频一区| 色婷婷综合视频在线观看| 欧美成人综合网站| 亚洲乱码国产乱码精品精小说 | 日本视频一区二区三区| 国产成人免费在线| 337p亚洲精品色噜噜狠狠| 中文字幕欧美日本乱码一线二线| 亚洲成人免费影院| 欧美电影在线免费观看| 国产精品美女久久久久aⅴ国产馆| 一区二区三区国产豹纹内裤在线 | 久久久一区二区| 亚洲午夜久久久| 成人短视频下载| 精品久久久久久久人人人人传媒| 亚洲永久精品国产| 91影院在线观看| 国产欧美日韩中文久久| 日韩高清不卡一区二区三区| 色综合一区二区| 欧美高清一级片在线观看| 精品一二三四在线| 3d成人h动漫网站入口| 亚洲最大成人综合| eeuss鲁片一区二区三区| 久久久久9999亚洲精品| 奇米综合一区二区三区精品视频| 欧洲精品一区二区三区在线观看| 欧美激情在线一区二区三区| 久88久久88久久久| 666欧美在线视频| 午夜电影一区二区三区| 色狠狠色狠狠综合| 亚洲精品欧美在线| 91丝袜美腿高跟国产极品老师 | 欧美日韩黄色影视| 亚洲女女做受ⅹxx高潮| 白白色亚洲国产精品| 国产日韩精品一区二区三区| 国产一区二区在线视频| 久久综合久久99| 国产一区日韩二区欧美三区| 26uuu亚洲| 国产99精品视频| 国产午夜精品福利| 国产高清在线精品| 国产精品萝li| 色婷婷狠狠综合| 亚洲午夜羞羞片| 91精品欧美一区二区三区综合在 | 青草国产精品久久久久久| 日韩一区二区在线免费观看| 毛片av中文字幕一区二区| 精品精品国产高清a毛片牛牛 | 亚洲h动漫在线| 91精品国产一区二区| 久草在线在线精品观看| 欧美国产国产综合| 色嗨嗨av一区二区三区| 午夜av电影一区| 久久丝袜美腿综合| 91一区二区在线| 日日夜夜精品免费视频| 26uuu精品一区二区在线观看| 国产精品白丝av| 一区二区三区四区中文字幕| 91麻豆精品国产91久久久更新时间 | 精品国产123| 成人黄色777网| 五月婷婷久久丁香| 久久久一区二区三区| 91视频91自| 久久成人久久鬼色| 国产精品大尺度| 7777精品伊人久久久大香线蕉超级流畅| 麻豆精品一区二区| 欧美激情一区二区| 欧美日韩高清一区二区| 丁香另类激情小说| 日韩福利电影在线| 中文字幕永久在线不卡| 日韩精品一区二区三区在线观看| 成人午夜短视频| 久久不见久久见免费视频7 | 欧美日韩aaa| 99re66热这里只有精品3直播| 蜜臀av性久久久久蜜臀aⅴ| 亚洲欧洲精品天堂一级| 2021国产精品久久精品| 欧美四级电影在线观看| 成人精品视频一区二区三区| 麻豆国产精品777777在线| 一区二区免费视频| 中文字幕在线观看一区| 亚洲精品在线观看视频| 91精品国产色综合久久不卡电影| 91蝌蚪porny九色| 成人性色生活片| 国产很黄免费观看久久| 九色|91porny| 免费高清成人在线| 日韩高清一级片| 图片区小说区区亚洲影院| 亚洲精品国产精品乱码不99| 国产欧美一区二区精品秋霞影院| 日韩欧美在线观看一区二区三区| 欧美性大战xxxxx久久久| 99久久精品免费看| 从欧美一区二区三区| 国产精品1024久久| 国内精品免费**视频| 看国产成人h片视频| 日韩va亚洲va欧美va久久| 午夜久久久久久电影| 亚洲www啪成人一区二区麻豆| 一区二区不卡在线视频 午夜欧美不卡在| 国产日韩欧美高清| 欧美国产日韩一二三区| 中文字幕成人网| 国产精品另类一区| 综合激情成人伊人| 国产精品不卡在线| 亚洲色图丝袜美腿| 一区二区三区91| 日本亚洲欧美天堂免费| 九九久久精品视频| 国产高清在线精品| 99久久99久久综合| 欧美手机在线视频| 欧美一区二区在线播放| 26uuu国产日韩综合| 欧美国产1区2区| 亚洲一区二区3| 美女高潮久久久| 国产精品1区2区3区| 色综合久久精品| 欧美日韩久久不卡| 26uuu欧美| 一区二区久久久| 麻豆精品一区二区av白丝在线| 国产69精品一区二区亚洲孕妇| 91视频一区二区三区| 精品婷婷伊人一区三区三| 日韩免费视频一区二区| 国产精品久久久久影院老司| 夜夜嗨av一区二区三区| 激情都市一区二区| 91在线porny国产在线看| 91麻豆精品国产91久久久 | 日本道色综合久久| 日韩午夜激情av| 中文字幕一区二区三区在线不卡 | 从欧美一区二区三区| 欧美日韩高清影院| 中文字幕va一区二区三区| 亚洲五月六月丁香激情| 国产成人亚洲综合a∨婷婷图片| 欧美日韩一区二区三区在线| 久久久久9999亚洲精品| 日韩电影在线免费看| 91浏览器在线视频|