您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ tparm函数代码示例

51自学网 2021-06-03 08:55:59
  C++
这篇教程C++ tparm函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中tparm函数的典型用法代码示例。如果您正苦于以下问题:C++ tparm函数的具体用法?C++ tparm怎么用?C++ tparm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了tparm函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: set_color

void	set_color(int bgcolor, int fgcolor){  char	*afstr;  char	*abstr;  char	t[4096];  char	*area;  char	*term;  char	bp[1024];    if ((term = my_get_env("TERM")) == NULL)    {      my_putstr_error("can't determine terminal/n");      exit(-1);    }  if (tgetent(bp, term) != 1)    {      my_putstr_error("problem with tgetent/n");      exit(-1);    }  area = t;  afstr = xtgetstr("AF", &area);  abstr = xtgetstr("AB", &area);  if (tputs(tparm(afstr, fgcolor), 1, my_outc) == ERR)    exit(-1);  if (bgcolor != 0)    if (tputs(tparm(abstr, bgcolor), 1, my_outc) ==  ERR)      exit(-1);}
开发者ID:Sun42,项目名称:my_select,代码行数:28,


示例2: show_line

void show_line() {	char 	*p = line;	char 	*s = syntax;	int		cur_col = 0;	//	putp(tparm(set_a_foreground, 0));	while(*p) {		if(*s != 127 && *s != cur_col) {			putp(tparm(set_a_foreground, *s));			cur_col = *s;		}		s++;		putchar(*p++);		col++;		if(col == width) {			col = 0;			row++;		}	}	// If we ended on the end of a row, then if we eat newlines then	// we need to move to the right place	// output a space and then go back to get us in the right place	if(col == 0 && auto_right_margin && eat_newline_glitch) {		putp(carriage_return);		putp(cursor_down);	}	if(cur_col != 0) putp(tparm(set_a_foreground, 0));}
开发者ID:carriercomm,项目名称:opentik,代码行数:31,


示例3: _move_relative

/* Move cursor from a known position */static void _move_relative(TERM_REC *term, int oldx, int oldy, int x, int y){	if (oldx == 0 && x == 0 && y == oldy+1) {		/* move to beginning of next line -		   hope this works everywhere */		tput("/r/n");                return;	}	if (oldx > 0 && y == oldy) {                /* move cursor left/right */		if (x == oldx-1 && term->TI_cub1) {			tput(tparm(term->TI_cub1));                        return;		}		if (x == oldx+1 && y == oldy && term->TI_cuf1) {			tput(tparm(term->TI_cuf1));                        return;		}	}        /* fallback to absolute positioning */	if (term->TI_cup) {		tput(tparm(term->TI_cup, y, x));                return;	}	if (oldy != y)		tput(tparm(term->TI_vpa, y));        if (oldx != x)		tput(tparm(term->TI_hpa, x));}
开发者ID:svn2github,项目名称:irssi,代码行数:33,


示例4: funkey_local

/***	funkey_local(test_list, status, ch)****	Test program local function keys (pfloc)*/static voidfunkey_local(	struct test_list *t,	int *state,	int *ch){	int fk;	fk = 1;	if (pkey_local) {		/* test local function key */		sprintf(temp,			"(pfloc) Set function key %d to execute a clear and print /"Done!/"", fk);		ptextln(temp);		sprintf(temp, "%sDone!", liberated(clear_screen));		tc_putp(tparm(pkey_local, fk, temp));		sprintf(temp, "Hit function key %d.  Then hit return.", fk);		ptextln(temp);		(void) wait_here();		flush_input();		if (key_f1 && pkey_xmit) {			tc_putp(tparm(pkey_xmit, fk, key_f1));		}	} else {		ptextln("Function key execute local (pfloc), not present.");	}	generic_done_message(t, state, ch);}
开发者ID:enthought,项目名称:ncurses-5.5,代码行数:34,


示例5: getchoice

int getchoice(char *greet, char *choices[], FILE *in, FILE *out){	int chosen = 0;	int selected;	char **option;		int screenrow = 0, screencol = 10;	char *cursor, *clear;	output_stream = out;	setupterm(NULL, fileno(out), (int *)0);	cursor = tigetstr("cup");	clear = tigetstr("clear");	screenrow = 4;	tputs(clear, 1, (int *) char_to_terminal);	tputs(tparm(cursor, screenrow, screencol), 1, char_to_terminal);	fprintf(out, "Choice: %s", greet);	screenrow += 2;	option = choices;	while(*option){		tputs(tparm(cursor, screenrow, screencol), 1, char_to_terminal);		fprintf(out, "%s", *option);		screenrow ++;		option ++;	}		fprintf(out, "/n");	do{		fflush(out);		selected = fgetc(in);		option = choices;			while(*option){			if(selected == *option[0]){				chosen = 1;				break;			}			option ++;		}		if(!chosen){			tputs(tparm(cursor, screenrow, screencol), 1, char_to_terminal);			fprintf(out, "Incorrect choice, select again/n");		}	}while(!chosen);			tputs(clear, 1, char_to_terminal);			return selected;}
开发者ID:BlueCabbage,项目名称:BeginningLinuxProgramming,代码行数:59,


示例6: curboth

static void curboth(rl_t *rl, int n){int curx=rl->curpos%rl->width;int cury=rl->curpos/rl->width;int newx=(rl->curpos+n)%rl->width;int newy=(rl->curpos+n)/rl->width;	if(newy > cury) cliPutStr(rl->cliIdx,tparm(downN, newy-cury));	else if(cury > newy) cliPutStr(rl->cliIdx,tparm(upN, cury-newy));	if(newx > curx) cliPutStr(rl->cliIdx,tparm(rightN, newx-curx));	else if(curx > newx) cliPutStr(rl->cliIdx,tparm(leftN, curx-newx));	rl->curpos+=n;}
开发者ID:lucchouina,项目名称:RimComponents,代码行数:13,


示例7: set_foreground_color

static void set_foreground_color(int fg, int  (*outc)(int)){	if (set_a_foreground)	{	    TPUTS_TRACE("set_a_foreground");	    tputs(tparm(set_a_foreground, fg), 1, outc);	}	else	{	    TPUTS_TRACE("set_foreground");	    tputs(tparm(set_foreground, toggled_colors(fg)), 1, outc);	}}
开发者ID:vocho,项目名称:openqnx,代码行数:13,


示例8: set_background_color

static void set_background_color(int bg, int  (*outc)(int)){	if (set_a_background)	{	    TPUTS_TRACE("set_a_background");	    tputs(tparm(set_a_background, bg), 1, outc);	}	else	{	    TPUTS_TRACE("set_background");	    tputs(tparm(set_background, toggled_colors(bg)), 1, outc);	}}
开发者ID:vocho,项目名称:openqnx,代码行数:13,


示例9: terminfo_setup_colors

/* Setup colors - if force is set, use ANSI-style colors if   terminal capabilities don't contain color codes */void terminfo_setup_colors(TERM_REC *term, int force){	static char ansitab[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };	const char *bold, *blink;	int i;	terminfo_colors_deinit(term);        term->has_colors = term->TI_setf || term->TI_setaf;	if (term->TI_setf) {		for (i = 0; i < 8; i++)                        term->TI_fg[i] = g_strdup(tparm(term->TI_setf, i, 0));	} else if (term->TI_setaf) {		for (i = 0; i < 8; i++)                        term->TI_fg[i] = g_strdup(tparm(term->TI_setaf, ansitab[i], 0));	} else if (force) {		for (i = 0; i < 8; i++)                        term->TI_fg[i] = g_strdup_printf("/033[%dm", 30+ansitab[i]);	}	if (term->TI_setb) {		for (i = 0; i < 8; i++)                        term->TI_bg[i] = g_strdup(tparm(term->TI_setb, i, 0));	} else if (term->TI_setab) {		for (i = 0; i < 8; i++)                        term->TI_bg[i] = g_strdup(tparm(term->TI_setab, ansitab[i], 0));	} else if (force) {		for (i = 0; i < 8; i++)                        term->TI_bg[i] = g_strdup_printf("/033[%dm", 40+ansitab[i]);	}	if (term->TI_setf || term->TI_setaf || force) {                term->set_fg = _set_fg;                term->set_bg = _set_bg;		/* bold fg, blink bg */		bold = term->TI_bold ? term->TI_bold : "";		for (i = 0; i < 8; i++)			term->TI_fg[i+8] = g_strconcat(bold, term->TI_fg[i], NULL);		blink = term->TI_blink ? term->TI_blink : "";		for (i = 0; i < 8; i++)			term->TI_bg[i+8] = g_strconcat(blink, term->TI_bg[i], NULL);	} else {		/* no colors */                term->set_fg = term->set_bg = _ignore_parm;	}}
开发者ID:svn2github,项目名称:irssi,代码行数:50,


示例10: init_pair

intinit_pair(short pair, short f, short b){	int code = ERR;	if (pair < 0 || max_pairs <= pair ||		f < 0 || max_colors <= f ||		b < 0 || max_colors <= b)		goto error;	/* Remember color-pair settings for future queries. */	cur_term->_pair[pair][0] = f;	cur_term->_pair[pair][1] = b;	code = OK;	/* Set color-pair (foreground-background). */	if (initialize_pair != (char *) 0) {		code = tputs(tparm(initialize_pair,			(long) cur_term->_color[f][0],			(long) cur_term->_color[f][1],			(long) cur_term->_color[f][2],			(long) cur_term->_color[b][0],			(long) cur_term->_color[b][1],			(long) cur_term->_color[b][2],			0L, 0L, 0L), 1, __m_outc);	}error:	return (code);}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:30,


示例11: rt_tparm

/* * TermInfo#tparm(str, ...) => str * * TermInfo#tparm expands parameters in str returned by tigetstr. */static VALUErt_tparm(int argc, VALUE *argv, VALUE self){  char *capname, *ret;  setup(self);  VALUE v_capname, v1, v2, v3, v4, v5, v6, v7, v8, v9;  long p1, p2, p3, p4, p5, p6, p7, p8, p9;  setup(self);  if (rb_scan_args(argc, argv, "19", &v_capname, &v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8, &v9) == 0) {    rb_raise(rb_eArgError, "capname required");  }  capname = StringValueCStr(v_capname);#define conv(p, v) do { if (v == Qnil) p = 0; else p = NUM2LONG(v); } while(0)  conv(p1, v1);  conv(p2, v2);  conv(p3, v3);  conv(p4, v4);  conv(p5, v5);  conv(p6, v6);  conv(p7, v7);  conv(p8, v8);  conv(p9, v9);  ret = tparm(capname, p1, p2, p3, p4, p5, p6, p7, p8, p9);  if (ret == NULL) { rb_raise(eTermInfoError, "tparm failed"); }  return rb_str_new2(ret);}
开发者ID:akr,项目名称:ruby-terminfo,代码行数:36,


示例12: tt_putparm

/***	tt_putparm(string, reps, arg1, arg2, ...)****	Send tt_tputs(tparm(string, args...), reps)**	Use this function inside timing tests.*/voidtt_putparm(	NCURSES_CONST char *string,	int reps,	int arg1,	int arg2){	int i;	if (string) {		for (i = 0; i < TT_MAX; i++) {			if (i >= ttp) {				tt_cap[i] = string;				tt_affected[i] = reps;				tt_count[i] = 1;				tt_delay[i] = msec_cost(string, reps);				ttp++;				break;			}			if (string == tt_cap[i] && reps == tt_affected[i]) {				tt_count[i]++;				tt_delay_used += tt_delay[i];				break;			}		}		(void) tputs(tparm((NCURSES_CONST char *)string, arg1, arg2), reps, tc_putch);	}}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:34,


示例13: put_change_scroll_region

万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。