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

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

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

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

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

示例1: get_abil

 /*  * The ability field is read-only  */ int get_abil(void *vp, WINDOW *win) {	 int *abil = (int *) vp;     register int oy, ox, ny, nx;     register int op_bad;      op_bad = TRUE;     getyx(win, oy, ox);     put_abil(abil, win);     getyx(win, ny, nx);     while(op_bad)	     { 	wmove(win, oy, ox); 	draw(win); 	switch (readchar(win)) 	{ 	    case '/n': 	    case '/r': 		op_bad = FALSE; 		break; 	    case '/033': 	    case '/007': 		return QUIT; 	    case '-': 		return MINUS; 	    default: 		mvwaddstr(win, ny, nx + 5, "(no change allowed)"); 	}     }     wmove(win, ny, nx + 5);     wclrtoeol(win);     wmove(win, ny, nx);     waddch(win, '/n');     return NORM; }
开发者ID:RoguelikeRestorationProject,项目名称:urogue1.02,代码行数:39,


示例2: print_line

/* * Print a new line of text. Called by dialog_textbox() and print_page(). */static voidprint_line (WINDOW * win, int row, int width){    int y, x;    char *line;    line = get_line ();    line += MIN (strlen (line), hscroll);	/* Scroll horizontally */    wmove (win, row, 0);	/* move cursor to correct line */    waddch (win, ' ');    waddnstr (win, line, MIN (strlen (line), width - 2));    getyx (win, y, x);    /* Clear 'residue' of previous line */#if OLD_NCURSES    {	int i;	for (i = 0; i < width - x; i++)	    waddch (win, ' ');    }#else    wclrtoeol(win);#endif}
开发者ID:InfraSIM,项目名称:idic,代码行数:27,


示例3: lua_paint_info

static void lua_paint_info(struct window *wnd, const struct state *st){    struct lua_State *L = paint_state;    int nx = st->cursor.x, ny = st->cursor.y;    pnormalize(&nx, &ny, st->cursor.pl);    lua_rawgeti(L, LUA_REGISTRYINDEX, paint_handle);    lua_pushinteger(L, nx);    lua_pushinteger(L, ny);    if (lua_pcall(L, 2, 1, 0) != 0) {        const char *error = lua_tostring(L, -1);        log_error("paint function failed: %s/n", error);        lua_pop(L, 1);        tolua_error(L, TOLUA_CAST "event handler call failed", NULL);    }    else {        const char *result = lua_tostring(L, -1);        WINDOW *win = wnd->handle;        int size = getmaxx(win) - 2;        int line = 0, maxline = getmaxy(win) - 2;        const char *str = result;        wxborder(win);        while (*str && line < maxline) {            const char *end = strchr(str, '/n');            if (!end)                break;            else {                int bytes = (int)(end - str);                if (bytes < size) bytes = size;                mvwaddnstr(win, line++, 1, str, bytes);                wclrtoeol(win);                str = end + 1;            }        }    }}
开发者ID:eressea,项目名称:server,代码行数:36,


示例4: padTest

void padTest(WINDOW *dummy){    WINDOW *pad, *spad;    pad = newpad(50, 100);    wattron(pad, A_REVERSE);    mvwaddstr(pad, 5, 2, "This is a new pad");    wattrset(pad, 0);    mvwaddstr(pad, 8, 0,        "The end of this line should be truncated here:except  now");    mvwaddstr(pad, 11, 1, "This line should not appear.It will now");    wmove(pad, 10, 1);    wclrtoeol(pad);    mvwaddstr(pad, 10, 1, " Press any key to continue");    prefresh(pad, 0, 0, 0, 0, 10, 45);    keypad(pad, TRUE);    raw();    wgetch(pad);    spad = subpad(pad, 12, 25, 7, 52);    mvwaddstr(spad, 2, 2, "This is a new subpad");    box(spad, 0, 0);    prefresh(pad, 0, 0, 0, 0, 15, 75);    keypad(pad, TRUE);    raw();    wgetch(pad);    mvwaddstr(pad, 35, 2, "This is displayed at line 35 in the pad");    mvwaddstr(pad, 40, 1, " Press any key to continue");    prefresh(pad, 30, 0, 0, 0, 10, 45);    keypad(pad, TRUE);    raw();    wgetch(pad);    delwin(pad);}
开发者ID:okuoku,项目名称:nmosh-pdcurses,代码行数:36,


示例5: update_status_window

/* Update status and title window. */static boolupdate_status_window(struct view *view, const char *context, const char *msg, va_list args){	if (input_mode)		return false;	if (!status_empty || *msg) {		wmove(status_win, 0, 0);		if (view && view->has_scrolled && use_scroll_status_wclear)			wclear(status_win);		if (*msg) {			vwprintw(status_win, msg, args);			status_empty = false;		} else {			status_empty = true;		}		wclrtoeol(status_win);		if (context && *context) {			size_t contextlen = strlen(context);			int x, y, width, ___;			getyx(status_win, y, x);			getmaxyx(status_win, ___, width);			(void) ___;			if (contextlen < width - x) {				mvwprintw(status_win, 0, width - contextlen, "%s", context);				wmove(status_win, y, x);			}		}		return true;	}	return false;}
开发者ID:phschoen,项目名称:tig,代码行数:37,


示例6: pfind_sectors_per_cluster

static int pfind_sectors_per_cluster(disk_t *disk, partition_t *partition, const int verbose, unsigned int *sectors_per_cluster, uint64_t *offset_org, alloc_data_t *list_search_space){  uint64_t offset=0;  unsigned int nbr_subdir=0;  sector_cluster_t sector_cluster[10];  alloc_data_t *current_search_space;  unsigned char *buffer_start=(unsigned char *)MALLOC(READ_SIZE);  unsigned char *buffer=buffer_start;  current_search_space=td_list_entry(list_search_space->list.next, alloc_data_t, list);  if(current_search_space!=list_search_space)    offset=current_search_space->start;  if(verbose>0)    info_list_search_space(list_search_space, current_search_space, disk->sector_size, 0, verbose);#ifdef HAVE_NCURSES  wmove(stdscr,22,0);  wattrset(stdscr, A_REVERSE);  waddstr(stdscr,"  Stop  ");  wattroff(stdscr, A_REVERSE);#endif  disk->pread(disk, buffer_start, READ_SIZE, offset);  while(current_search_space!=list_search_space && nbr_subdir<10)  {    const uint64_t old_offset=offset;#ifdef HAVE_NCURSES    if((offset&(1024*disk->sector_size-1))==0)    {      wmove(stdscr,9,0);      wclrtoeol(stdscr);      wprintw(stdscr,"Search subdirectory %10lu/%lu %u",(unsigned long)(offset/disk->sector_size),(unsigned long)(partition->part_size/disk->sector_size),nbr_subdir);      wrefresh(stdscr);    }#endif    if(memcmp(buffer,         ".          ", 8+3)==0 &&	memcmp(&buffer[0x20], "..         ", 8+3)==0)    {      const unsigned long int cluster=(buffer[0*0x20+0x15]<<24) + (buffer[0*0x20+0x14]<<16) +	(buffer[0*0x20+0x1B]<<8) + buffer[0*0x20+0x1A];      log_info("sector %lu, cluster %lu/n",	  (unsigned long)(offset/disk->sector_size), cluster);      sector_cluster[nbr_subdir].cluster=cluster;      sector_cluster[nbr_subdir].sector=offset/disk->sector_size;      log_flush();      nbr_subdir++;    }    get_next_sector(list_search_space, &current_search_space, &offset, 512);    buffer+=512;    if( old_offset+512!=offset ||        buffer+512>buffer_start+READ_SIZE)    {      buffer=buffer_start;      if(verbose>1)      {        log_verbose("Reading sector %10llu/%llu/n",	    (unsigned long long)((offset-partition->part_offset)/disk->sector_size),	    (unsigned long long)((partition->part_size-1)/disk->sector_size));      }      if(disk->pread(disk, buffer_start, READ_SIZE, offset) != READ_SIZE)      {      }    }  } /* end while(current_search_space!=list_search_space) */  free(buffer_start);  return find_sectors_per_cluster_aux(sector_cluster,nbr_subdir,sectors_per_cluster,offset_org,verbose,partition->part_size/disk->sector_size, UP_UNK);}
开发者ID:foreverlikeyou9999,项目名称:TestDisk,代码行数:64,


示例7: lome6_timer

/** lome6 periodical timer function for display and one wire convert command** if onewire is supported start onewire temperature convert* if lcd is supported display various information*/void lome6_timer(void) {#ifdef LOME6_ONEWIRE_SUPPORT	// read 1w temperatures	iTemperaturePSU = lome6_get_temperature(&romcodePSU);	iTemperatureAIR = lome6_get_temperature(&romcodeAIR);	iTemperatureRAM = lome6_get_temperature(&romcodeRAM);#endif // LOME6_ONEWIRE_SUPPORT#ifdef LOME6_LCD_SUPPORT	wclear(ttyWindow);		if (iLCDPage == 0) {		// display uptime and date+time		uint32_t working_hours = (clock_get_time() - clock_get_startup()) / 60;		struct clock_datetime_t datetime;		clock_current_localtime(&datetime);		wprintw_P(ttyWindow, PSTR("%02d:%02d %02d.%02d.%04d"), datetime.hour, datetime.min, datetime.day, datetime.month, (datetime.year + 1900));		wclrtoeol(ttyWindow);		wmove(ttyWindow, 1, 0);		wprintw_P(ttyWindow, PSTR("Uptime: %02lu:%02d"), working_hours / 60, working_hours % 60);		wclrtoeol(ttyWindow);		#ifndef LOME6_ONEWIRE_SUPPORT		if (!PIN_HIGH(POWER_STATE))			iLCDPage = 4;		else			iLCDPage = 0;#else		iLCDPage++;#endif#ifdef LOME6_ONEWIRE_SUPPORT	} else if (iLCDPage == 1) {		// display onewire temperature sensor data		wprintw_P(ttyWindow, PSTR("Temperature"));		wclrtoeol(ttyWindow);		wmove(ttyWindow, 1, 0);		wprintw_P(ttyWindow, PSTR("AIR: %02d.%d"), iTemperatureAIR / 10, iTemperatureAIR % 10);		wclrtoeol(ttyWindow);		iLCDPage++;	} else if (iLCDPage == 2) {		// display onewire temperature sensor data		wprintw_P(ttyWindow, PSTR("Temperature:"));		wclrtoeol(ttyWindow);		wmove(ttyWindow, 1, 0);		wprintw_P(ttyWindow, PSTR("RAM: %02d.%d"), iTemperatureRAM / 10, iTemperatureRAM % 10);		wclrtoeol(ttyWindow);		iLCDPage++;	} else if (iLCDPage == 3) {		// display onewire temperature sensor data		wprintw_P(ttyWindow, PSTR("Temperature"));		wclrtoeol(ttyWindow);		wmove(ttyWindow, 1, 0);		wprintw_P(ttyWindow, PSTR("PSU: %02d.%d"), iTemperaturePSU / 10, iTemperaturePSU % 10);		wclrtoeol(ttyWindow);		iLCDPage++;#endif //LOME6_ONEWIRE_SUPPORT	} else if (iLCDPage == 4) {			// display temperature data		wprintw_P(ttyWindow, PSTR("Temperature"));		wclrtoeol(ttyWindow);		wmove(ttyWindow, 1, 0);		wprintw_P(ttyWindow, PSTR("CPU: %02d.%d"), iTemperatureCPU / 10, iTemperatureCPU % 10);		wclrtoeol(ttyWindow);		iLCDPage++;	} else if (iLCDPage == 5) {		// display temperature data		wprintw_P(ttyWindow, PSTR("Temperature"));		wclrtoeol(ttyWindow);		wmove(ttyWindow, 1, 0);		wprintw_P(ttyWindow, PSTR("SB: %02d.%d"), iTemperatureSB / 10, iTemperatureSB % 10);		wclrtoeol(ttyWindow);		iLCDPage = 0;	}	// start a new convert in next round	ow_temp_start_convert_nowait(NULL);//.........这里部分代码省略.........
开发者ID:videopix,项目名称:ethersex,代码行数:101,


示例8: display

/* * Display a symbol on somebody's window, processing some control * characters while we are at it. */voiddisplay(xwin_t *win, wchar_t *wc){	/*	 * Alas, can't use variables in C switch statement.	 * Workaround these 3 cases with goto.	 */	if (*wc == win->kill)		goto kill;	else if (*wc == win->cerase)		goto cerase;	else if (*wc == win->werase)		goto werase;	switch (*wc) {	case L'/n':	case L'/r':		wadd_wch(win->x_win, makecchar(L'/n'));		getyx(win->x_win, win->x_line, win->x_col);		wrefresh(win->x_win);		return;	case 004:		if (win == &my_win) {			/* Ctrl-D clears the screen. */			werase(my_win.x_win);			getyx(my_win.x_win, my_win.x_line, my_win.x_col);			wrefresh(my_win.x_win);			werase(his_win.x_win);			getyx(his_win.x_win, his_win.x_line, his_win.x_col);			wrefresh(his_win.x_win);		}		return;	/* Erase character. */	case 010:	/* BS */	case 0177:	/* DEL */cerase:		wmove(win->x_win, win->x_line, max(--win->x_col, 0));		getyx(win->x_win, win->x_line, win->x_col);		waddch(win->x_win, ' ');		wmove(win->x_win, win->x_line, win->x_col);		getyx(win->x_win, win->x_line, win->x_col);		wrefresh(win->x_win);		return;	case 027:	/* ^W */werase:	    {		/*		 * On word erase search backwards until we find		 * the beginning of a word or the beginning of		 * the line.		 */		int endcol, xcol, c;		endcol = win->x_col;		xcol = endcol - 1;		while (xcol >= 0) {			c = readwin(win->x_win, win->x_line, xcol);			if (c != ' ')				break;			xcol--;		}		while (xcol >= 0) {			c = readwin(win->x_win, win->x_line, xcol);			if (c == ' ')				break;			xcol--;		}		wmove(win->x_win, win->x_line, xcol + 1);		for (int i = xcol + 1; i < endcol; i++)			waddch(win->x_win, ' ');		wmove(win->x_win, win->x_line, xcol + 1);		getyx(win->x_win, win->x_line, win->x_col);		wrefresh(win->x_win);		return;	    }	case 025:	/* ^U */kill:		wmove(win->x_win, win->x_line, 0);		wclrtoeol(win->x_win);		getyx(win->x_win, win->x_line, win->x_col);		wrefresh(win->x_win);		return;	case L'/f':		if (win == &my_win)			wrefresh(curscr);		return;	case L'/7':		write(STDOUT_FILENO, wc, sizeof(*wc));		return;//.........这里部分代码省略.........
开发者ID:2trill2spill,项目名称:freebsd,代码行数:101,


示例9: inputTest

void inputTest(WINDOW *win){    int w, h, bx, by, sw, sh, i, c, num = 0;    int line_to_use = 3;    char buffer[80];    WINDOW *subWin;    static const char spinner[4] = "/-//|";    int spinner_count = 0;    wclear(win);    getmaxyx(win, h, w);    getbegyx(win, by, bx);    sw = w / 3;    sh = h / 3;    if ((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2))        == NULL)        return;#ifdef A_COLOR    if (has_colors())    {        init_pair(2, COLOR_WHITE, COLOR_RED);        wbkgd(subWin, COLOR_PAIR(2) | A_BOLD);    }    else#endif        wbkgd(subWin, A_BOLD);    box(subWin, ACS_VLINE, ACS_HLINE);    wrefresh(win);    nocbreak();    wclear (win);    mvwaddstr(win, 1, 1,        "Press keys (or mouse buttons) to show their names");    mvwaddstr(win, 2, 1, "Press spacebar to finish");    wrefresh(win);    keypad(win, TRUE);    raw();    noecho();    wtimeout(win, 200);#ifdef PDCURSES    mouse_set(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION);    PDC_save_key_modifiers(TRUE);//  PDC_return_key_modifiers(TRUE);#endif    curs_set(0);        /* turn cursor off */    while (1)    {        while (1)        {            c = wgetch(win);            if (c == ERR)            {                spinner_count++;                if (spinner_count == 4)                    spinner_count = 0;                mvwaddch(win, line_to_use, 3, spinner[spinner_count]);                wrefresh(win);            }            else                break;        }#ifdef PDCURSES//      wmove(win, line_to_use + 1, 18);//      wclrtoeol(win);#endif        mvwaddstr(win, line_to_use, 5, "Key Pressed: ");        wclrtoeol(win);        wprintw( win, "(%x) ", c);        if( has_key( c))            wprintw(win, "%s", keyname(c));        else if (isprint(c) || c > 0xff)            waddch( win, c);        else            wprintw(win, "%s", unctrl(c));#ifdef PDCURSES        if (c == KEY_MOUSE)        {            int button = 0, status = 0;            request_mouse_pos();            if (BUTTON_CHANGED(1))                button = 1;            else if (BUTTON_CHANGED(2))                button = 2;            else if (BUTTON_CHANGED(3))                button = 3;            else if (BUTTON_CHANGED(4))   /* added 21 Jan 2011: BJG */                button = 4;//.........这里部分代码省略.........
开发者ID:Bill-Gray,项目名称:PDCurses,代码行数:101,


示例10: main_set_status_text

void main_set_status_text(char *txt){	mvwprintw(status_wnd, 0, 0, txt);	wclrtoeol(status_wnd);	wrefresh(status_wnd);}
开发者ID:sba1,项目名称:simplemail,代码行数:6,


示例11: printCode

/*         sonst i8086_ERR_ILGOPCODE              */int printCode(i8086core *core, i8086command **cmds, codeView *cv){  unsigned char opcode, i, pos, read=0;  //unsigned char dispLn=0;  //i8086Parameter para, data;  //unsigned char str[6];  //unsigned short ret=0;  unsigned short startAdr;  unsigned short cs;  unsigned char *cmddata;  char *output;  unsigned char cmdsize;   if (args & HIDE_CODE_VIEWER) /* pruefen ob Codeviewer aktiviert ist */    return i8086_SUC_EXECCMD;  cs = i8086GetSegRegister_fast(core, i8086_REG_CS, 1);  if ( (core->pc+cs > cv->endAdr) || (core->pc+cs < cv->startAdr) ) /* Viewersegment setzen */    startAdr = core->pc+cs;                                 /* pc ist ueber bzw. unter Windowgrenzen gekommen */  else    startAdr = cv->startAdr;  for (pos=0; pos<16; pos++)  {    opcode = core->mem[startAdr+read];         /* opcode lesen     */    if (core->pc+cs==startAdr+read)               /* aktuellen OpCode sichtbar machen */    {      wattron(codeWin, A_STANDOUT);    }    if (startAdr+read==breakpoint)    mvwprintw(codeWin, 1+pos, 1, ".");    else    mvwprintw(codeWin, 1+pos, 1, " ");    mvwprintw(codeWin, 1+pos, 2, "%0004x", startAdr+read); /* Adressen ausgeben */    wclrtoeol(codeWin);    wattroff(codeWin, A_STANDOUT);    if (cmds[opcode]==NULL)                    /* illegaler Opcode */    {      int j;      //sprintf(str, "%hd", opcode);      //i8086error(i8086_ERR_STR_ILGOPCODE, str);      mvwprintw(codeWin, 1+pos, 7, "%s", "ILGOPC"); /* Befehlname ausgeben */      for (j=pos+2; j<17; j++) /* folgende Zeilen loeschen. */      {        wmove(codeWin, j, 2);        wclrtoeol(codeWin);      }      box(codeWin, ACS_VLINE, ACS_HLINE);      mvwprintw(codeWin, 0, 2, "[Code]");      wrefresh(codeWin);      return i8086_ERR_ILGOPCODE;    }	cmddata=malloc(10);	output=malloc(40);    	cmddata[0]=opcode;	cmdsize=cmds[opcode]->size;	for (i=1; i<cmdsize; i++)            /* Parameter byteweise einlesen */	{      		cmddata[i] = core->mem[startAdr+read+i];    	}	if (cmds[opcode]->hasMod!=0)	{		cmdsize+=getAdditionalCmdLength(core, opcode, cmddata[1]);		for (i=cmds[opcode]->size; i<cmdsize; i++)            /* Parameter byteweise einlesen */		{	     		cmddata[i] = core->mem[startAdr+read+i];	    	}	} 	disasm (cmddata, output, 16, startAdr+read, 0, 0);;	mvwprintw(codeWin, 1+pos, 7, "%s",  output);	free(output);	free(cmddata);	read+=cmdsize;	if (pos == 14)		cv->endAdr = startAdr+read;       /* Endadresse fuer naechsten Durchlauf setzen */    //mvwprintw(codeWin, 1+pos, 7, "%s", cmds[opcode]->name); /* Befehlname ausgeben */  }  cv->startAdr = startAdr;              /* Startadresse fuer naechsten Durchlauf setzen */  box(codeWin, ACS_VLINE, ACS_HLINE);  mvwprintw(codeWin, 0, 2, "[Code]");  wrefresh(codeWin);  return i8086_SUC_EXECCMD;}
开发者ID:garvitdelhi,项目名称:emulate,代码行数:100,


示例12: interface_editor_ncurses

static void interface_editor_ncurses(disk_t *disk){  int done = 0;  uint64_t hd_offset=0;  unsigned char *buffer=(unsigned char *)MALLOC(disk->sector_size);  log_info("%s/n",disk->description(disk));  aff_copy(stdscr);  wmove(stdscr,4,0);  wprintw(stdscr,"%s", disk->description_short(disk));  while (done==0)  {    static const struct MenuItem menuEditor[]=    {      { 'C', "Change location", "" },      { 'D', "Dump", "Dump sector" },      { 'Q', "Quit",""},      { 0, NULL, NULL }    };    switch ( wmenuSelect(stdscr, INTER_EDIT_Y+1, INTER_EDIT_Y, INTER_EDIT_X, menuEditor, 8, "CDQ", MENU_HORIZ | MENU_BUTTON, 0))    {      case 'c':      case 'C':	interface_editor_location(disk,&hd_offset);	break;      case 'd':      case 'D':	{	  int menu_pos=KEY_DOWN;	  while(done==0)	  {	    wmove(stdscr,5,0);	    wclrtoeol(stdscr);	    wprintw(stdscr,"%lu ", (unsigned long)(hd_offset/disk->sector_size));	    aff_LBA2CHS(disk, hd_offset/disk->sector_size);	    if((unsigned)disk->pread(disk, buffer, disk->sector_size, hd_offset) != disk->sector_size)	    {	      wprintw(stdscr,msg_PART_RD_ERR);	    }	    {	      menu_pos=dump_editor(buffer, disk->sector_size, menu_pos);	      switch(menu_pos)	      {		case KEY_UP:		  if(hd_offset>0)		    hd_offset-=disk->sector_size;		  else		    menu_pos=KEY_DOWN;		  break;		case KEY_DOWN:		  if(hd_offset<disk->disk_size)		    hd_offset+=disk->sector_size;		  else		    menu_pos=KEY_UP;		  break;		default:		  done = 1;		  break;	      }	    }	  }	  done = 0;	}	break;      case key_ESC:      case 'q':      case 'Q':	done = 1;	break;    }  }  free(buffer);}
开发者ID:AndrewSmart,项目名称:testdisk,代码行数:72,


示例13: dump_editor

static int dump_editor(const unsigned char *nom_dump,const unsigned int lng, const int menu_pos){  unsigned int pos;  int done=0;  unsigned int menu;  const struct MenuItem menuDump[]=  {	{ 'P', "Previous",""},	{ 'N', "Next","" },	{ 'Q',"Quit","Quit dump section"},	{ 0, NULL, NULL }  };  /* write dump to log file*/  dump_log(nom_dump, lng);  /* ncurses interface */  pos=(menu_pos==KEY_DOWN?0:lng/0x10-EDIT_MAX_LINES);  menu=(menu_pos==KEY_DOWN?1:0);  mvwaddstr(stdscr, EDIT_Y, EDIT_X, msg_DUMP_HEXA);  do  {    	unsigned int i,j;  	unsigned char car;	for (i=pos; (i<lng/0x10)&&((i-pos)<EDIT_MAX_LINES); i++)	{	  wmove(stdscr,EDIT_Y+i-pos,EDIT_X);	  wclrtoeol(stdscr);	  wprintw(stdscr,"%04X ",i*0x10);	  for(j=0; j< 0x10;j++)	  {		car=*(nom_dump+i*0x10+j);		wprintw(stdscr,"%02x", car);		if(j%4==(4-1))		  wprintw(stdscr," ");	  }	  wprintw(stdscr,"  ");	  for(j=0; j< 0x10;j++)	  {		car=*(nom_dump+i*0x10+j);		if ((car<32)||(car >= 127))		  wprintw(stdscr,".");		else		  wprintw(stdscr,"%c",  car);	  }	}	switch (wmenuSelect(stdscr, INTER_EDIT_Y+1, INTER_EDIT_Y, INTER_EDIT_X, menuDump, 8, "PNQ", MENU_HORIZ | MENU_BUTTON | MENU_ACCEPT_OTHERS, menu))	{	  case 'p':	  case 'P':	  case KEY_UP:		menu=0;		if(pos>0)		  pos--;		else		  done=KEY_UP;		break;	  case 'n':	  case 'N':	  case KEY_DOWN:		menu=1;		if(pos<lng/0x10-EDIT_MAX_LINES)		  pos++;		else		  done = KEY_DOWN;		break;	  case KEY_PPAGE:		menu=0;		if(pos==0)		  done=KEY_UP;		if(pos>EDIT_MAX_LINES-1)		  pos-=EDIT_MAX_LINES-1;		else		  pos=0;		break;	  case KEY_NPAGE:		menu=1;		if(pos==lng/0x10-EDIT_MAX_LINES)		  done=KEY_DOWN;		if(pos<lng/0x10-EDIT_MAX_LINES-(EDIT_MAX_LINES-1))		  pos+=EDIT_MAX_LINES-1;		else		  pos=lng/0x10-EDIT_MAX_LINES;		break;	  case key_ESC:	  case 'q':	  case 'Q':		done = 'Q';		break;	}  } while(done==0);  return done;}
开发者ID:AndrewSmart,项目名称:testdisk,代码行数:91,


示例14: interface_editor_location

static void interface_editor_location(const disk_t *disk, uint64_t *lba){  const struct MenuItem menuGeometry[]=  {    { 'c', "Cylinders", "Change cylinder" },    { 'h', "Heads", "Change head" },    { 's', "Sectors", "Change sector" },    { 'l', "Logical Sectors", "Change logical sector" },    { 'd', "Done", "Done with changing" },    { 0, NULL, NULL }  };  int default_option=4;  while (1)  {    CHS_t location;    char def[128];    char response[128];    unsigned long int tmp_val;    int command;    wmove(stdscr,5,0);    wclrtoeol(stdscr);    wprintw(stdscr,"%lu ", (unsigned long)(*lba/disk->sector_size));    aff_LBA2CHS(disk, *lba / disk->sector_size);    offset2CHS(disk, *lba, &location);    wmove(stdscr,INTER_GEOM_Y, INTER_GEOM_X);    wclrtoeol(stdscr);    wrefresh(stdscr);    command=wmenuSimple(stdscr, menuGeometry, default_option);    switch (command) {      case 'c':      case 'C':	sprintf(def, "%lu", location.cylinder);	mvwaddstr(stdscr,INTER_GEOM_Y, INTER_GEOM_X, "Enter the number of cylinders: ");	if (get_string(stdscr, response, sizeof(response), def) > 0) {	  tmp_val = atol(response);	  if (tmp_val < disk->geom.cylinders) {	    location.cylinder = tmp_val;	    *lba=CHS2offset(disk,&location);	  } else	    wprintw(stdscr,"Illegal cylinders value");	}	default_option=1;	break;      case 'h':      case 'H':	sprintf(def, "%u", location.head);	mvwaddstr(stdscr,INTER_GEOM_Y, INTER_GEOM_X, "Enter the number of heads: ");	if (get_string(stdscr, response, sizeof(response), def) > 0) {	  tmp_val = atoi(response);	  if (tmp_val < disk->geom.heads_per_cylinder) {	    location.head = tmp_val;	    *lba=CHS2offset(disk,&location);	  } else	    wprintw(stdscr,"Illegal heads value");	}	default_option=2;	break;      case 's':      case 'S':	sprintf(def, "%u", location.sector);	mvwaddstr(stdscr,INTER_GEOM_Y, INTER_GEOM_X, "Enter the number of sectors per track: ");	if (get_string(stdscr, response, sizeof(response), def) > 0) {	  tmp_val = atoi(response);	  if (tmp_val > 0 && tmp_val <= disk->geom.sectors_per_head ) {	    location.sector = tmp_val;	    *lba=CHS2offset(disk,&location);	  } else	    wprintw(stdscr,"Illegal sectors value");	}	default_option=3;	break;      case 'l':      case 'L':	{	  sprintf(def, "%lu", (unsigned long)(*lba / disk->sector_size));	  mvwaddstr(stdscr,INTER_GEOM_Y, INTER_GEOM_X, "Enter the logical sector offset: ");	  if (get_string(stdscr, response, sizeof(response), def) > 0) {	    uint64_t l_sector;	    l_sector= strtoul(response, NULL, 10);	    l_sector*=disk->sector_size;	    if (l_sector <= disk->disk_size) {	      *lba=l_sector;	    } else	      wprintw(stdscr,"Illegal logical sector value");	  }	  default_option=4;	}	break;      case key_ESC:      case 'd':      case 'D':	return;    }  }}
开发者ID:AndrewSmart,项目名称:testdisk,代码行数:95,


示例15: get_str

intget_str(void *vopt, WINDOW *win){    char *opt = (char *) vopt;    char *sp;    int oy, ox;    int i;    signed char c;    static char buf[MAXSTR];    getyx(win, oy, ox);    wrefresh(win);    /*     * loop reading in the string, and put it in a temporary buffer     */    for (sp = buf; (c = readchar()) != '/n' && c != '/r' && c != ESCAPE;	wclrtoeol(win), wrefresh(win))    {	if (c == -1)	    continue;	else if (c == erasechar() || c == 8 || c == 127)	/* process erase character */	{	    if (sp > buf)	    {		sp--;		for (i = (int) strlen(unctrl(*sp)); i; i--)		    waddch(win, '/b');	    }	    continue;	}	else if (c == killchar())	/* process kill character */	{	    sp = buf;	    wmove(win, oy, ox);	    continue;	}	else if (sp == buf)	{	    if (c == '-' && win != stdscr)		break;	    else if (c == '~')	    {		strcpy(buf, home);		waddstr(win, home);		sp += strlen(home);		continue;	    }	}	if (sp >= &buf[MAXINP] || !(isprint(c) || c == ' '))	    putchar(CTRL('G'));	else	{	    *sp++ = c;	    waddstr(win, unctrl(c));	}    }    *sp = '/0';    if (sp > buf)	/* only change option if something has been typed */	strucpy(opt, buf, (int) strlen(buf));    mvwprintw(win, oy, ox, "%s/n", opt);    wrefresh(win);    if (win == stdscr)	mpos += (int)(sp - buf);    if (c == '-')	return MINUS;    else if (c == ESCAPE)	return QUIT;    else	return NORM;}
开发者ID:ashaindlin,项目名称:rogue,代码行数:70,


示例16: display_calibration

void display_calibration(){  char line[COLS];  s_mouse_cal* mcal = cal_get_mouse(current_mouse, current_conf);  if(current_cal == NONE)  {    mvaddstr(CAL_Y_P, CAL_X_P + 1, _("Mouse calibration (Ctrl+F1 to edit)"));  }  else  {    mvaddstr(CAL_Y_P, CAL_X_P + 1, _("Mouse calibration (Ctrl+F1 to save)(mouse wheel to change values)"));  }  clrtoeol();  wmove(wcal, 1, 1);  if(GE_GetMKMode() == GE_MK_MODE_MULTIPLE_INPUTS)  {    waddstr(wcal, "Mouse:");    if(current_cal == MC)    {      wattron(wcal, COLOR_PAIR(4));    }    snprintf(line, COLS, " %s (%d) (F1) ", GE_MouseName(current_mouse), GE_MouseVirtualId(current_mouse));    waddstr(wcal, line);    if(current_cal == MC)    {      wattron(wcal, COLOR_PAIR(1));    }  }  waddstr(wcal, _("Profile:"));  if(current_cal == CC)  {    wattron(wcal, COLOR_PAIR(4));  }  snprintf(line, COLS, " %d (F2)", current_conf + 1);  waddstr(wcal, line);  if(current_cal == CC)  {    wattron(wcal, COLOR_PAIR(1));  }  wclrtoeol(wcal);  mvwaddstr(wcal, 2, 1, _("Dead zone:"));  if(current_cal == DZX)  {    wattron(wcal, COLOR_PAIR(4));  }  waddstr(wcal, " x=");  if(mcal->dzx)  {    snprintf(line, COLS, "%d", *mcal->dzx);    waddstr(wcal, line);  }  else  {    waddstr(wcal, _("N/A"));  }  waddstr(wcal, " (F3)");  if(current_cal == DZX)  {    wattron(wcal, COLOR_PAIR(1));  }  if(current_cal == DZY)  {    wattron(wcal, COLOR_PAIR(4));  }  waddstr(wcal, " y=");  if(mcal->dzy)  {    snprintf(line, COLS, "%d", *mcal->dzy);    waddstr(wcal, line);  }  else  {    waddstr(wcal, _("N/A"));  }  waddstr(wcal, " (F4)");  if(current_cal == DZY)  {    wattron(wcal, COLOR_PAIR(1));  }  if(current_cal == DZS)  {    wattron(wcal, COLOR_PAIR(4));  }  waddstr(wcal, _(" shape="));  if(mcal->dzs)  {    if (*mcal->dzs == E_SHAPE_CIRCLE)    {      waddstr(wcal, _("circle"));    }    else    {      waddstr(wcal, _("rectangle"));    }  }  else  {    waddstr(wcal, _(" N/A"));  }//.........这里部分代码省略.........
开发者ID:alama,项目名称:GIMX,代码行数:101,


示例17: wadd_wch_nosync

static NCURSES_INLINE intwadd_wch_nosync(WINDOW *win, cchar_t ch)/* the workhorse function -- add a character to the given window */{    NCURSES_SIZE_T x, y;    wchar_t *s;    int tabsize = 8;#if USE_REENTRANT    SCREEN *sp = _nc_screen_of(win);#endif    /*     * If we are using the alternate character set, forget about locale.     * Otherwise, if the locale claims the code is printable, treat it that     * way.     */    if ((AttrOf(ch) & A_ALTCHARSET)	|| iswprint((wint_t) CharOf(ch)))	return wadd_wch_literal(win, ch);    /*     * Handle carriage control and other codes that are not printable, or are     * known to expand to more than one character according to unctrl().     */    x = win->_curx;    y = win->_cury;    switch (CharOf(ch)) {    case '/t':#if USE_REENTRANT	tabsize = *ptrTabsize(sp);#else	tabsize = TABSIZE;#endif	x = (NCURSES_SIZE_T) (x + (tabsize - (x % tabsize)));	/*	 * Space-fill the tab on the bottom line so that we'll get the	 * "correct" cursor position.	 */	if ((!win->_scroll && (y == win->_regbottom))	    || (x <= win->_maxx)) {	    cchar_t blank = blankchar;	    AddAttr(blank, AttrOf(ch));	    while (win->_curx < x) {		if (wadd_wch_literal(win, blank) == ERR)		    return (ERR);	    }	    break;	} else {	    wclrtoeol(win);	    win->_flags |= _WRAPPED;	    if (newline_forces_scroll(win, &y)) {		x = win->_maxx;		if (win->_scroll) {		    scroll(win);		    x = 0;		}	    } else {		x = 0;	    }	}	break;    case '/n':	wclrtoeol(win);	if (newline_forces_scroll(win, &y)) {	    if (win->_scroll)		scroll(win);	    else		return (ERR);	}	/* FALLTHRU */    case '/r':	x = 0;	win->_flags &= ~_WRAPPED;	break;    case '/b':	if (x == 0)	    return (OK);	x--;	win->_flags &= ~_WRAPPED;	break;    default:	if ((s = wunctrl(&ch)) != 0) {	    while (*s) {		cchar_t sch;		SetChar(sch, *s++, AttrOf(ch));		if_EXT_COLORS(SetPair(sch, GetPair(ch)));		if (wadd_wch_literal(win, sch) == ERR)		    return ERR;	    }	    return OK;	}	return ERR;    }    win->_curx = x;    win->_cury = y;    return OK;}
开发者ID:ThomasDickey,项目名称:ncurses-snapshots,代码行数:100,


示例18: prompt_onInit

static void prompt_onInit(ToxWindow* self) {  scrollok(self->window, 1);  print_usage(self);  wclrtoeol(self->window);}
开发者ID:AMDmi3,项目名称:ProjectTox-Core,代码行数:6,


示例19: save

save() {	reg char	*sp;	reg int		outf;	reg time_t	*tp;	char		buf[80];	time_t		tme;	STAT		junk;	tp = &tme;	if (Fromfile && getyn(SAMEFILEPROMPT))		strcpy(buf, Fromfile);	else {over:		prompt(FILEPROMPT);		leaveok(Board, FALSE);		refresh();		sp = buf;		while ((*sp = readch()) != '/n') {			if (*sp == killchar())				goto over;			else if (*sp == erasechar()) {				if (--sp < buf)					sp = buf;				else {					addch('/b');					/*					 * if the previous char was a control					 * char, cover up two characters.					 */					if (*sp < ' ')						addch('/b');					clrtoeol();				}			}			else				addstr(unctrl(*sp++));			refresh();		}		*sp = '/0';		leaveok(Board, TRUE);	}	/*	 * check for existing files, and confirm overwrite if needed	 */	if (sp == buf || (!Fromfile && stat(buf, &junk) > -1	    && getyn(OVERWRITEFILEPROMPT) == FALSE))		return FALSE;	if ((outf = creat(buf, 0644)) < 0) {		error(strerror(errno));		return FALSE;	}	mvwaddstr(Score, ERR_Y, ERR_X, buf);	wrefresh(Score);	time(tp);			/* get current time		*/	strcpy(buf, ctime(tp));	for (sp = buf; *sp != '/n'; sp++)		continue;	*sp = '/0';	varpush(outf, write);	close(outf);	wprintw(Score, " [%s]", buf);	wclrtoeol(Score);	wrefresh(Score);	return TRUE;}
开发者ID:AtomSoftTech,项目名称:retrobsd,代码行数:69,


示例20: outputTest

void outputTest(WINDOW *win){    WINDOW *win1;    char Buffer[80];    chtype ch;    int by, bx;    nl();    wclear(win);    mvwaddstr(win, 1, 1, "You should now have a screen in the upper "                         "left corner, and this text should have wrapped");    waddstr(win,"/nThis text should be down/n");    waddstr(win,  "and broken into two here ^");    Continue(win);    wclear(win);    wattron(win, A_BOLD);    mvwaddstr(win, 1, 1, "A new window will appear with this text in it");    mvwaddstr(win, 8, 1, "Press any key to continue");    wrefresh(win);    wgetch(win);    getbegyx(win, by, bx);    if (LINES < 24 || COLS < 75)    {        mvwaddstr(win, 5, 1, "Some tests have been skipped as they require a");        mvwaddstr(win, 6, 1, "display of at least 24 LINES by 75 COLUMNS");        Continue(win);    }    else    {        win1 = newwin(10, 50, 14, 25);        if (win1 == NULL)        {            endwin();            return;        }#ifdef A_COLOR        if (has_colors())        {            init_pair(3, COLOR_BLUE, COLOR_WHITE);            wbkgd(win1, COLOR_PAIR(3));        }        else#endif            wbkgd(win1, A_NORMAL);        wclear(win1);        mvwaddstr(win1, 5, 1, "This text should appear; using overlay option");        copywin(win, win1, 0, 0, 0, 0, 9, 49, TRUE);        box(win1, ACS_VLINE, ACS_HLINE);        wmove(win1, 8, 26);        wrefresh(win1);        wgetch(win1);        wclear(win1);        wattron(win1, A_BLINK);        mvwaddstr(win1, 4, 1,                  "This blinking text should appear in only the second window");        wattroff(win1, A_BLINK);        mvwin(win1, by, bx);        overlay(win, win1);        mvwin(win1, 14, 25);        wmove(win1, 8, 26);        wrefresh(win1);        wgetch(win1);        delwin(win1);    }    clear();    wclear(win);    wrefresh(win);    mvwaddstr(win, 6, 2, "This line shouldn't appear");    mvwaddstr(win, 4, 2, "Only half of the next line is visible");    mvwaddstr(win, 5, 2, "Only half of the next line is visible");    wmove(win, 6, 1);    wclrtobot(win);    wmove(win, 5, 20);    wclrtoeol(win);    mvwaddstr(win, 8, 2, "This line also shouldn't appear");    wmove(win, 8, 1);    winsdelln(win, -1);    Continue(win);    wmove(win, 5, 9);    ch = winch(win);    wclear(win);    wmove(win, 6, 2);    waddstr(win, "The next char should be l:  ");    winsch(win, ch);    Continue(win);    mvwinsstr(win, 6, 2, "A1B2C3D4E5");//.........这里部分代码省略.........
开发者ID:Bill-Gray,项目名称:PDCurses,代码行数:101,


示例21: MIN

void mrutils::ColChooser::Column::highlight(int hid, bool refreshInput,    bool selectFirst, bool refreshWindow) {    mrutils::mutexAcquire(cc.updateMutex);    int start, end, d, id; bool addMatches = false;    if (hid > tail) {        start = tail + 1;        end  = choices.size();        headMatches += tail == -1 ? 0 : MIN(cc.lines-1,(unsigned)searchMatches.size()-headMatches);        if (headMatches+1 >= searchMatches.size()) {            addMatches = true;            head = tail = -1;        } else {            head = searchMatches[headMatches];            tail = searchMatches[MIN((unsigned)searchMatches.size()-1,headMatches + cc.lines-2)];        }    } else {        if (hid < head) {            headMatches = MAX(0u, headMatches - cc.lines+1);            head = searchMatches[headMatches];            tail = searchMatches[MIN((unsigned)searchMatches.size()-1,headMatches + cc.lines-2)];        }        start = headMatches;        end = searchMatches.size();    }    d = headMatches;    selMatches = -1;    wattrset((WINDOW*)chooserWin,ATR_BLANK);    for (int i = start; i < end && d-headMatches < cc.lines-1; ++i) {        if (addMatches) {            if (applySearch && !mrutils::stristr(choices[i].c_str(), search)) {                continue;            }            if (d == headMatches) head = i; tail = i;            searchMatches.push_back(i);        }        id = searchMatches[d];        wmove((WINDOW*)chooserWin,d++ - headMatches,cc.colStart); wclrtoeol((WINDOW*)chooserWin);        if (id == hid) {            selMatches = d-1;            wattrset((WINDOW*)chooserWin,ATR_SELECTED);            waddnstr((WINDOW*)chooserWin,choices[id].c_str(), colWidth);            wattrset((WINDOW*)chooserWin,ATR_BLANK);            int left = colWidth - choices[id].size();            if (left > 0)                wchgat((WINDOW*)chooserWin,left, 0, COL_SELECTED, NULL);        } else {            bool targeted = colNumber+1 == cc.data.size() && cc.targeted[id];            if (targeted)                wattrset((WINDOW*)chooserWin,ATR_TARGETED);            waddnstr((WINDOW*)chooserWin,choices[id].c_str(), colWidth);            wattrset((WINDOW*)chooserWin,ATR_BLANK);            int left = colWidth - choices[id].size();            if (left > 0) {                if (targeted)                    wchgat((WINDOW*)chooserWin,left, 0, COL_TARGETED, NULL);                else                     wchgat((WINDOW*)chooserWin,left, 0, COL_BLANK, NULL);            }        }    }    if (selMatches == -1 && selectFirst) {        selMatches = headMatches;        wmove((WINDOW*)chooserWin,0,cc.colStart);        wchgat((WINDOW*)chooserWin, colWidth, A_BLINK, COL_SELECTED, NULL);    }    for (int i = d - headMatches; i < cc.lines-1; ++i) {         wmove((WINDOW*)chooserWin,i,cc.colStart); wclrtoeol((WINDOW*)chooserWin);    }    // set the depth selection    if ( selMatches < 0 ||         selMatches >= searchMatches.size() )        cc.depth[colNumber] = -1;    else         cc.depth[colNumber] = searchMatches[selMatches] + cc.startIndex;    // build next column    if (cc.data.size() > colNumber + 1         && hid >= 0 && cc.depth[colNumber] >= 0) {        mvwvline((WINDOW*)chooserWin, 0,                 cc.colStart + colWidth, ACS_VLINE, cc.lines-1);//.........这里部分代码省略.........
开发者ID:mikerobe,项目名称:mrutils,代码行数:101,


示例22: c_ecurses_wclrtoeol

EIF_INTEGER c_ecurses_wclrtoeol (EIF_POINTER w){    return  wclrtoeol  ((WINDOW *)w) ;};
开发者ID:Eiffel-World,项目名称:safe-lib,代码行数:4,


示例23: menu_photorec

void menu_photorec(struct ph_param *params, struct ph_options *options, alloc_data_t*list_search_space){  list_part_t *list_part;#ifdef HAVE_NCURSES  list_part_t *current_element;  unsigned int current_element_num;  int done=0;  int command;  unsigned int offset=0;  unsigned int menu=0;  static const struct MenuItem menuMain[]=  {	{'S',"Search","Start file recovery"},	{'O',"Options","Modify options"},	{'F',"File Opt","Modify file options"},	{'G',"Geometry", "Change disk geometry" },	{'Q',"Quit","Return to disk selection"},	{0,NULL,NULL}  };#endif  params->blocksize=0;  list_part=init_list_part(params->disk, options);  if(list_part==NULL)    return;  log_all_partitions(params->disk, list_part);  if(params->cmd_run!=NULL)  {    if(menu_photorec_cli(list_part, params, options, list_search_space) > 0)    {      if(params->recup_dir==NULL)      {	char *res;#ifdef HAVE_NCURSES	res=ask_location("Please select a destination to save the recovered files./nDo not choose to write the files to the same partition they were stored on.", "", NULL);#else	res=get_default_location();#endif	if(res!=NULL)	{	  params->recup_dir=(char *)MALLOC(strlen(res)+1+strlen(DEFAULT_RECUP_DIR)+1);	  strcpy(params->recup_dir,res);	  strcat(params->recup_dir,"/");	  strcat(params->recup_dir,DEFAULT_RECUP_DIR);	  free(res);	}      }      if(params->recup_dir!=NULL)	photorec(params, options, list_search_space);    }  }  if(params->cmd_run!=NULL)  {    part_free_list(list_part);    return;  }#ifdef HAVE_NCURSES  if(list_part->next!=NULL)  {    current_element_num=1;    current_element=list_part->next;  }  else  {    current_element_num=0;    current_element=list_part;  }  while(done==0)  { /* ncurses interface */    list_part_t *element;    unsigned int i;    aff_copy(stdscr);    wmove(stdscr,4,0);    wprintw(stdscr,"%s",params->disk->description_short(params->disk));    mvwaddstr(stdscr,6,0,msg_PART_HEADER_LONG);#if defined(KEY_MOUSE) && defined(ENABLE_MOUSE)    mousemask(ALL_MOUSE_EVENTS, NULL);#endif    for(i=0,element=list_part; element!=NULL && i<offset+INTER_SELECT;element=element->next,i++)    {      if(i<offset)	continue;      wmove(stdscr,7+i-offset,0);      wclrtoeol(stdscr);	/* before addstr for BSD compatibility */      if(element==current_element)      {	wattrset(stdscr, A_REVERSE);	waddstr(stdscr, ">");	aff_part(stdscr,AFF_PART_ORDER|AFF_PART_STATUS,params->disk,element->part);	wattroff(stdscr, A_REVERSE);      } else      {	waddstr(stdscr, " ");	aff_part(stdscr,AFF_PART_ORDER|AFF_PART_STATUS,params->disk,element->part);      }    }    wmove(stdscr,7+INTER_SELECT,5);    wclrtoeol(stdscr);    if(element!=NULL)      wprintw(stdscr, "Next");    command = wmenuSelect(stdscr, INTER_SELECT_Y+1, INTER_SELECT_Y, INTER_SELECT_X, menuMain, 8,//.........这里部分代码省略.........
开发者ID:AndychenCL,项目名称:TestDisk,代码行数:101,


示例24: while

static list_part_t *ask_structure_ncurses(disk_t *disk_car,list_part_t *list_part, const int verbose, char **current_cmd){  int offset=0;  int pos_num=0;  list_part_t *pos=list_part;  int rewrite=1;  int old_LINES=LINES;  while(1)  {    int i;    int command;    list_part_t *parts;    int structure_status;    if(old_LINES!=LINES)    {      rewrite=1;      old_LINES=LINES;    }    if(rewrite)    {      aff_copy(stdscr);      wmove(stdscr,4,0);      wprintw(stdscr,"%s",disk_car->description(disk_car));      mvwaddstr(stdscr,5,0,msg_PART_HEADER);      rewrite=0;    }    structure_status=disk_car->arch->test_structure(list_part);    for(i=0,parts=list_part;	parts!=NULL && i<offset+INTER_STRUCTURE;	i++, parts=parts->next)    {      if(i<offset)	continue;      wmove(stdscr,6+i-offset,0);      wclrtoeol(stdscr);	/* before addstr for BSD compatibility */      if(parts==pos)	wattrset(stdscr, A_REVERSE);      if(structure_status==0 && parts->part->status!=STATUS_DELETED && has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(2));      if(parts==pos)	waddstr(stdscr, ">");      else	waddstr(stdscr, " ");      aff_part(stdscr, AFF_PART_STATUS, disk_car, parts->part);      if(structure_status==0 && parts->part->status!=STATUS_DELETED && has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(0));      if(parts==pos)      {	char buffer_part_size[100];	wattroff(stdscr, A_REVERSE);	wmove(stdscr,LINES-1,0);	wclrtoeol(stdscr);	/* before addstr for BSD compatibility */	if(parts->part->info[0]!='/0')	{	  wprintw(stdscr,"%s, ",parts->part->info);	}	size_to_unit(parts->part->part_size, buffer_part_size);	wprintw(stdscr,"%s", buffer_part_size);      }    }    if(structure_status==0)    {      if(list_part!=NULL)	mvwaddstr(stdscr,LINES-6,0,msg_STRUCT_OK);    }    else    {      if(has_colors())	wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(1));      mvwaddstr(stdscr,LINES-6,0,msg_STRUCT_BAD);      if(has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(0));    }    if(list_part!=NULL && disk_car->arch->msg_part_type!=NULL)    {      mvwaddstr(stdscr,LINES-6,16,"Use ");      if(has_colors())	wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(0));      waddstr(stdscr,"Up");      if(has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(0));      waddstr(stdscr,"/");      if(has_colors())	wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(0));      waddstr(stdscr,"Down");      if(has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(0));      waddstr(stdscr," Arrow keys to select partition.");      mvwaddstr(stdscr,LINES-5,0,"Use ");      if(has_colors())	wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(0));      waddstr(stdscr,"Left");      if(has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(0));      waddstr(stdscr,"/");      if(has_colors())	wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(0));      waddstr(stdscr,"Right");      if(has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(0));//.........这里部分代码省略.........
开发者ID:dennyfeng,项目名称:testdisk,代码行数:101,


示例25: prompt_onDraw

static void prompt_onDraw(ToxWindow *self, Tox *m){    curs_set(1);    int x, y, x2, y2;    getyx(self->window, y, x);    getmaxyx(self->window, y2, x2);    size_t i;    for (i = 0; i < prompt_buf_pos; ++i) {        if ((prompt_buf[i] == '/n') && (y != 0))            --y;    }    StatusBar *statusbar = (StatusBar *) self->stb;    werase(statusbar->topline);    mvwhline(statusbar->topline, 1, 0, '-', x2);    wmove(statusbar->topline, 0, 0);    if (statusbar->is_online) {        int colour = WHITE;        char *status_text = "Unknown";        switch(statusbar->status) {        case TOX_USERSTATUS_NONE:            status_text = "Online";            colour = GREEN;            break;        case TOX_USERSTATUS_AWAY:            status_text = "Away";            colour = YELLOW;            break;        case TOX_USERSTATUS_BUSY:            status_text = "Busy";            colour = RED;            break;        }        wattron(statusbar->topline, A_BOLD);        wprintw(statusbar->topline, " %s ", statusbar->nick);        wattron(statusbar->topline, A_BOLD);        wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);        wprintw(statusbar->topline, "[%s]", status_text);        wattroff(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);    } else {        wattron(statusbar->topline, A_BOLD);        wprintw(statusbar->topline, "%s ", statusbar->nick);        wattroff(statusbar->topline, A_BOLD);        wprintw(statusbar->topline, "[Offline]");    }    wattron(statusbar->topline, A_BOLD);    wprintw(statusbar->topline, " | %s |", statusbar->statusmsg);    wattroff(statusbar->topline, A_BOLD);    wprintw(statusbar->topline, "/n");    wattron(self->window, COLOR_PAIR(GREEN));    mvwprintw(self->window, y, 0, "# ");    wattroff(self->window, COLOR_PAIR(GREEN));    mvwprintw(self->window, y, 2, "%s", prompt_buf);    wclrtoeol(self->window);        wrefresh(self->window);}
开发者ID:rayslava,项目名称:toxic,代码行数:66,


示例26: fat_unformat_aux

static int fat_unformat_aux(struct ph_param *params, const struct ph_options *options, const uint64_t start_offset, alloc_data_t *list_search_space){  int ind_stop=0;  uint64_t offset;  uint64_t offset_end;  unsigned char *buffer_start;  unsigned char *buffer;  time_t start_time;  time_t previous_time;  const unsigned int blocksize=params->blocksize;  const unsigned int read_size=(blocksize>65536?blocksize:65536);  alloc_data_t *current_search_space;  file_recovery_t file_recovery;  disk_t *disk=params->disk;  const partition_t *partition=params->partition;  reset_file_recovery(&file_recovery);  file_recovery.blocksize=blocksize;  buffer_start=(unsigned char *)MALLOC(READ_SIZE);  buffer=buffer_start;  start_time=time(NULL);  previous_time=start_time;  current_search_space=td_list_entry(list_search_space->list.prev, alloc_data_t, list);  if(current_search_space==list_search_space)  {    free(buffer_start);    return 0;  }  offset_end=current_search_space->end;  current_search_space=td_list_entry(list_search_space->list.next, alloc_data_t, list);  offset=set_search_start(params, &current_search_space, list_search_space);  if(options->verbose>0)    info_list_search_space(list_search_space, current_search_space, disk->sector_size, 0, options->verbose);  disk->pread(disk, buffer, READ_SIZE, offset);  for(;offset < offset_end; offset+=blocksize)  {    if(memcmp(buffer,         ".          ", 8+3)==0 &&	memcmp(&buffer[0x20], "..         ", 8+3)==0)    {      file_data_t *dir_list;      dir_list=dir_fat_aux(buffer,read_size,0,0);      if(dir_list!=NULL)      {	const file_data_t *current_file;	log_info("Sector %llu/n", (long long unsigned)offset/disk->sector_size);	dir_aff_log(NULL, dir_list);	del_search_space(list_search_space, offset, offset + blocksize -1);	current_file=dir_list;	while(current_file!=NULL)	{	  if(strcmp(current_file->name,".")==0 &&	      LINUX_S_ISDIR(current_file->stat.st_mode)!=0 &&	      current_file!=dir_list)	    current_file=NULL;	  else if(current_file->stat.st_ino>2 &&	      LINUX_S_ISREG(current_file->stat.st_mode)!=0)	  {	    const uint64_t file_start=start_offset + (uint64_t)(current_file->stat.st_ino - 2) * blocksize;#ifdef DJGPP	    const uint64_t file_end=file_start+(current_file->file_size+blocksize-1)/blocksize*blocksize - 1;#else	    const uint64_t file_end=file_start+(current_file->stat.st_size+blocksize-1)/blocksize*blocksize - 1;#endif	    if(file_end < partition->part_offset + partition->part_size)	    {	      if(fat_copy_file(disk, partition, blocksize, start_offset, params->recup_dir, params->dir_num, current_file)==0)	      {		params->file_nbr++;		del_search_space(list_search_space, file_start, file_end);	      }	      current_file=current_file->next;	    }	    else	      current_file=NULL;	  }	  else	    current_file=current_file->next;	}	delete_list_file(dir_list);      }    }    buffer+=blocksize;    if(buffer+read_size>buffer_start+READ_SIZE)    {      buffer=buffer_start;      if(options->verbose>1)      {        log_verbose("Reading sector %10llu/%llu/n",	    (unsigned long long)((offset-partition->part_offset)/disk->sector_size),	    (unsigned long long)((partition->part_size-1)/disk->sector_size));      }      if(disk->pread(disk, buffer, READ_SIZE, offset) != READ_SIZE)      {#ifdef HAVE_NCURSES	wmove(stdscr,11,0);	wclrtoeol(stdscr);	wprintw(stdscr,"Error reading sector %10lu/n",	    (unsigned long)((offset-partition->part_offset)/disk->sector_size));#endif      }//.........这里部分代码省略.........
开发者ID:foreverlikeyou9999,项目名称:TestDisk,代码行数:101,


示例27: prompt_onInit

static void prompt_onInit(ToxWindow *self, Tox *m){    scrollok(self->window, true);    print_prompt_help(self);    wclrtoeol(self->window);}
开发者ID:rayslava,项目名称:toxic,代码行数:6,


示例28: clrtoeol

int clrtoeol(void){    PDC_LOG(("clrtoeol() - called/n"));    return wclrtoeol(stdscr);}
开发者ID:bugengine,项目名称:BugEngine,代码行数:6,


示例29: load_properties

void Scrollpad::flush(){	auto &w = static_cast<Window &>(*this);	const auto &s = m_buffer.str();	const auto &ps = m_buffer.properties();	auto p = ps.begin();	size_t i = 0;		auto load_properties = [&]() {		for (; p != ps.end() && p->position() == i; ++p)			w << *p;	};	auto write_whitespace = [&]() {		for (; i < s.length() && iswspace(s[i]); ++i)		{			load_properties();			w << s[i];		}	};	auto write_word = [&](bool load_properties_) {		for (; i < s.length() && !iswspace(s[i]); ++i)		{			if (load_properties_)				load_properties();			w << s[i];		}	};	auto write_buffer = [&](bool generate_height_only) -> size_t {		int new_y;		size_t height = 1;		size_t old_i;		auto old_p = p;		int x, y;		i = 0;		p = ps.begin();		y = getY();		while (i < s.length())		{			// write all whitespaces.			write_whitespace();						// if we are generating height, check difference			// between previous Y coord and current one and			// update height accordingly.			if (generate_height_only)			{				new_y = getY();				height += new_y - y;				y = new_y;			}						if (i == s.length())				break;						// save current string position state and get current			// coordinates as we are before the beginning of a word.			old_i = i;			old_p = p;			x = getX();			y = getY();						// write word to test if it overflows, but do not load properties			// yet since if it overflows, we do not want to load them twice.			write_word(false);						// restore previous indexes state			i = old_i;			p = old_p;						// get new Y coord to see if word overflew into next line.			new_y = getY();			if (new_y != y)			{				if (generate_height_only)				{					// if it did, let's update height...					++height;				}				else				{					// ...or go to old coordinates, erase					// part of the string from previous line...					goToXY(x, y);					wclrtoeol(m_window);				}								// ...start at the beginning of next line...				++y;				goToXY(0, y);								// ...write word again, this time with properties...				write_word(true);								if (generate_height_only)				{					// ... and check for potential					// difference in Y coordinates again.					new_y = getY();					height += new_y - y;				}//.........这里部分代码省略.........
开发者ID:greenbagels,项目名称:ncmpcpp,代码行数:101,



注:本文中的wclrtoeol函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


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