这篇教程C++ tgoto函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tgoto函数的典型用法代码示例。如果您正苦于以下问题:C++ tgoto函数的具体用法?C++ tgoto怎么用?C++ tgoto使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tgoto函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: apply_movedownvoid apply_movedown(t_historic **historic){ int col; struct winsize size; ioctl(0, TIOCGWINSZ, &size); if (check_pos(historic, size.ws_col, -1)) { tputs(tgetstr("do", NULL), 1, aff_c); tputs(tgoto(tgetstr("ch", NULL), 0, (*historic)->copy->comline->col % size.ws_col + 1), 1, aff_c); col = (*historic)->copy->comline->col + size.ws_col; while ((*historic)->copy->comline->col != col) (*historic)->copy->comline = (*historic)->copy->comline->right; } else if (check_pos(historic, size.ws_col, -2) && (*historic)->copy->comline->right->right) { tputs(tgetstr("do", NULL), 1, aff_c); while ((*historic)->copy->comline->right) (*historic)->copy->comline = (*historic)->copy->comline->right; tputs(tgoto(tgetstr("ch", NULL), 0, (*historic)->copy->comline->col % size.ws_col + 1), 1, aff_c); }}
开发者ID:kasou,项目名称:42sh,代码行数:25,
示例2: term_CS_scroll/* * term_CS_scroll: should be used if the terminal has the CS capability by * setting term_scroll equal to it */static intterm_CS_scroll(int line1, int line2, int n){ int i; u_char *thing; if (n > 0) thing = UP(SF ? SF : NL); else if (n < 0) { if (SR) thing = UP(SR); else return 1; } else return 0; tputs_x(tgoto(CS, line2, line1)); /* shouldn't do this each time */ if (n < 0) { term_move_cursor(0, line1); n = -n; } else term_move_cursor(0, line2); for (i = 0; i < n; i++) tputs_x(CP(thing)); tputs_x(tgoto(CS, get_li() - 1, 0)); /* shouldn't do this each time */ return (0);}
开发者ID:choppsv1,项目名称:ircii,代码行数:34,
示例3: term_upint term_up(char **send, unsigned long int buff, t_comp *count, t_tab *stock){ char *cp; char *s1; (void)buff; if (!stock->list) return (0); cp = tgetstr("dl", NULL); s1 = tgoto(cp, 0, 0); if (my_tputs(s1, 0, my_putchar) == -1) return (-1); cp = tgetstr("ch", NULL); s1 = tgoto(cp, 0, 0); if (my_tputs(s1, 0, my_putchar) == -1) return (-1); prompt(stock); if (stock && stock->move && stock->list->next) stock->list = stock->list->next; free(*send); my_putstr(stock->list->data); *send = my_strdup(stock->list->data); count->save = my_strlen(stock->list->data); count->compt = count->save; stock->move = 1; return (0);}
开发者ID:gregballot,项目名称:42sh,代码行数:28,
示例4: print_outputsstatic void print_outputs(t_j *j){ int i; int y; t_hist *tmp; PS(j->caps.cl); y = j->term.height - 1; i = -1; while (++i < OUTPUT_MAX) { tmp = j->output[i]; while (y > 0 && tmp != NULL) { PS(tgoto(j->caps.cm, 3, --y)); put_hightlight(SUB(tmp->str, tmp->length), SUB(j->ctrl_p_prompt.line.str, j->ctrl_p_prompt.line.length)); PC('/n'); tmp = tmp->prev; } y--; } PS(tgoto(j->caps.cm, 0, j->term.height - 1)); PS("SEARCH > "); PS(tgoto(j->caps.ch, 0, ft_promptput(&(j->ctrl_p_prompt), j->term.width - 9) + 9)); FL;}
开发者ID:Julow,项目名称:J,代码行数:28,
示例5: ttinsl/* * Insert nchunk blank line(s) onto the * screen, scrolling the last line on the * screen off the bottom. Use the scrolling * region if possible for a smoother display. * If no scrolling region, use a set * of insert and delete line sequences */ttinsl(row, bot, nchunk) { register int i, nl; if (row == bot) { /* Case of one line insert is */ ttmove(row, 0); /* special */ tteeol(); return; } if (CS && SR) { /* Use scroll region and back index */ nl = bot - row; ttwindow(row,bot); ttmove(row, 0); while (nchunk--) putpad(SR, nl); ttnowindow(); return; } else if (insdel) { ttmove(1+bot-nchunk, 0); nl = nrow - ttrow; if (pDL) putpad(tgoto(pDL, 0, nchunk), nl); else for (i=0; i<nchunk; i++) /* For all lines in the chunk */ putpad(DL, nl); ttmove(row, 0); nl = nrow - ttrow; /* ttmove() changes ttrow */ if (pAL) putpad(tgoto(pAL, 0, nchunk), nl); else for (i=0; i<nchunk; i++) /* For all lines in the chunk */ putpad(AL, nl); ttrow = HUGE; ttcol = HUGE; } else panic("ttinsl: Can't insert/delete line");}
开发者ID:axelmuhr,项目名称:Helios-NG,代码行数:38,
示例6: ttdell/* * Delete nchunk line(s) from "row", replacing the * bottom line on the screen with a blank line. * Unless we're using the scrolling region, this is * done with a crafty sequences of insert and delete * lines. The presence of the echo area makes a * boundry condition go away. */ttdell(row, bot, nchunk){ register int i, nl; if (row == bot) { /* One line special case */ ttmove(row, 0); tteeol(); return; } if (CS) { /* scrolling region */ nl = bot - row; ttwindow(row, bot); ttmove(bot, 0); while (nchunk--) putpad(SF, nl); ttnowindow(); } else if(insdel) { ttmove(row, 0); /* Else use insert/delete line */ nl = nrow - ttrow; if (pDL) putpad(tgoto(pDL, 0, nchunk), nl); else for (i=0; i<nchunk; i++) /* For all lines in the chunk */ putpad(DL, nl); ttmove(1+bot-nchunk,0); nl = nrow - ttrow; /* ttmove() changes ttrow */ if (pAL) putpad(tgoto(pAL, 0, nchunk), nl); else for (i=0; i<nchunk; i++) /* For all lines in the chunk */ putpad(AL, nl); ttrow = HUGE; ttcol = HUGE; } else panic("ttdell: Can't insert/delete line");}
开发者ID:axelmuhr,项目名称:Helios-NG,代码行数:39,
示例7: print_restvoid print_rest(int cursor, t_line *list){ t_ws ws; int i; ioctl(0, TIOCGWINSZ, &ws); i = 0; list = obtain_list(cursor, list); cursor += len_prompt(); while (list) { ft_putchar(list->data); list = list->next; i++; } if ((cursor % ws.ws_col) != 0) { if ((cursor % ws.ws_col) > ws.ws_col - i) tputs(tgetstr("up", NULL), 1, tputs_putchar); i = (cursor % ws.ws_col); tputs(tgoto(tgetstr("ch", NULL), 0, i), 1, tputs_putchar); } else tputs(tgoto(tgetstr("ch", NULL), 0, 0), 1, tputs_putchar);}
开发者ID:BenjaminRepingon,项目名称:42SH,代码行数:25,
示例8: re_draw2void re_draw2(t_caps *caps){ int li; t_select *choices; choices = caps->head; tputs(tgoto(tgetstr("cm", NULL), 0, 0), 1, my_putchar); tputs(tgetstr("cd", NULL), 1, my_putchar); while (1) { li = choices->li; tputs(tgoto(tgetstr("cm", NULL), choices->co, li ), 1, my_putchar); if (choices->cursor == 1) tputs(tgetstr("us", NULL), 1, my_putchar); if (choices->select == 1) tputs(tgetstr("mr", NULL), 1, my_putchar); my_putstr(choices->name); if (choices->cursor == 1) tputs(tgetstr("ue", NULL), 1, my_putchar); if (choices->select == 1) tputs(tgetstr("me", NULL), 1, my_putchar); if (caps->tail == choices) break ; choices = choices->next; } choices = caps->cursor; tputs(tgoto(tgetstr("cm", NULL), choices->co, choices->li), 1, my_putchar); choices = caps->head;}
开发者ID:Edmond-XavierCollot,项目名称:select,代码行数:29,
示例9: apply_inputint apply_input(unsigned int* choice, unsigned int size_list, t_list_proc* list, char** path){ int ret; fd_set fds; struct timeval timeout; char c; unsigned int i; FD_ZERO(&fds); FD_SET(0, &fds); timeout.tv_sec = 0; timeout.tv_usec = 0; ret = select(1, &fds, 0, 0, &timeout); if (ret == -1) return fatal(2, strerror(errno), 1); else if (ret != 0 && FD_ISSET(0, &fds)) { if (read(0, &c, 1) == -1) return fatal(2, strerror(errno), 1); if (c == 'A') { tputs(tgoto(tgetstr("cm", 0), 1, *choice + 1), 1, id_print_char); id_print_char(' '); *choice = *choice - 1; if (*choice < 1) *choice = size_list; } else if (c == 'B') { tputs(tgoto(tgetstr("cm", 0), 1, *choice + 1), 1, id_print_char); id_print_char(' '); *choice = *choice + 1; if (*choice > size_list) *choice = 1; } else if (c == '/n') { i = 1; while (i < *choice) { list = list->next; i = i + 1; } *path = malloc(sizeof(char) * (strlen("/proc//") + strlen(list->pid) + 1)); if (*path == 0) return fatal(2, "Malloc fail", 1); strcpy(*path, "/proc/"); strcat(*path, list->pid); strcat(*path, "/"); } } return 0;}
开发者ID:Glordim,项目名称:Topy,代码行数:57,
示例10: aff_screenvoid aff_screen(t_node *node, int i){ tputs(tgoto(tgetstr("cm", NULL), 0, i), 1, my_putchar); if (node->back == 0) tputs(tgetstr("us", NULL), 1, my_putchar); else tputs(tgetstr("mr", NULL), 1, my_putchar); my_putstr(node->choice); tputs(tgoto(tgetstr("cm", NULL), 0, i), 1, my_putchar);}
开发者ID:Kafei59,项目名称:epitech-projects,代码行数:10,
示例11: move_ballevoid move_balle(t_env* env){ tputs(tgoto(env->cm, env->balle.x, env->balle.y), 1, id_put); id_print_str("/033[01;40m "); env->balle.x = env->balle.x + env->balle.addx; env->balle.y = env->balle.y + env->balle.addy; tputs(tgoto(env->cm, env->balle.x, env->balle.y), 1, id_put); id_print_str("/033[01;40m0"); usleep(10000);}
开发者ID:Sereniiity,项目名称:Arakanoid,代码行数:10,
示例12: ShowSignstatic voidShowSign(char *string){ char *base = string; int ch, first, last; if (moveit != 0) { tputs(tgoto(moveit, 0, height - 1), 1, outc); tputs(wipeit, 1, outc); } while (*string != 0) { ch = *string; if (ch != ' ') { if (moveit != 0) { for (first = length - 2; first >= (string - base); first--) { if (first < length - 1) { tputs(tgoto(moveit, first + 1, height - 1), 1, outc); PutChar(' '); } tputs(tgoto(moveit, first, height - 1), 1, outc); PutChar(ch); } } else { last = ch; if (isalpha(ch)) { first = isupper(ch) ? 'A' : 'a'; } else if (isdigit(ch)) { first = '0'; } else { first = ch; } if (first < last) { Underline(1); while (first < last) { PutChar(first); Backup(); first++; } Underline(0); } } if (moveit != 0) Backup(); } StandOut(1); PutChar(ch); StandOut(0); fflush(stdout); string++; } if (moveit != 0) tputs(wipeit, 1, outc); putchar('/n');}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:55,
示例13: ft_up_bisstatic void ft_up_bis(t_sh *sh, t_window window){ tputs(tgoto((tgetstr("up", NULL)), 0, 0), 0, tputs_putchar); if (sh->prompt->x < window.col - 1) sh->prompt->x = -2; else sh->prompt->x = -1; while (sh->prompt->x++ < 0) tputs(tgoto((tgetstr("nd", NULL)), 0, 0), 0, tputs_putchar); sh->prompt->y = 1;}
开发者ID:eebersol,项目名称:21_sh,代码行数:11,
示例14: bonus_downvoid bonus_down(t_env* env){ tputs(tgoto(env->cm, env->bonusx, env->bonusy - 1), 1, id_put); id_print_char(' '); tputs(tgoto(env->cm, env->bonusx, env->bonusy), 1, id_put); id_print_char('#'); env->bonusy = env->bonusy + 1; if ( env->bonusy == env->h - 1) env->bonus = 0;}
开发者ID:Sereniiity,项目名称:Arakanoid,代码行数:12,
示例15: numberFUNCTION CODE t_pos ( FUNINT line, /* in: line number (start at 1) */ /* -1 means use current line */ FUNINT column /* in: column number (start at 1) */ ) { FAST TEXT *cursor_string;#ifdef TERMINAL_TOL TEXT outstr[100]; /* formatted string for term. log */#endif if ( line == 0xFFFFFFFF ) line = -1; if (ltype == T_CRT) { if (line < 0) { if (hcursor == NULL || creturn == NULL) { line = llines; /* go to screen bottom */ cursor_string = tgoto(cursor, column-1, line-1); tputs(cursor_string, 1, t_outc); } else /* use most recent line */ { tputs(creturn, 1, t_outc); if (column > 1) { cursor_string = tgoto(hcursor, 0, column-1); tputs(cursor_string, 1, t_outc); } } } else { cursor_string = tgoto(cursor, column-1, line-1); tputs(cursor_string, 1, t_outc); } }#ifdef TERMINAL_TOL if (term_log) { if (line < 0) line = 0; /* pick some reasonable number */ sprintf(outstr, "%%POS%02d%02d",line,column); /* format for %POSLLCC */ f_write(&tsf, outstr); }#endif return (SUCCESS); }
开发者ID:E-LLP,项目名称:VICAR,代码行数:52,
示例16: ft_arrow_rightvoid ft_arrow_right(t_terminfo **info){ struct winsize w; ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); if ((*info)->pos_x == w.ws_col - 1) tputs(tgoto(tgetstr("do", NULL), 0, 0), 1, ft_int_putchar); else tputs(tgoto(tgetstr("nd", NULL), 0, 0), 1, ft_int_putchar); (*info)->pos_x++; if ((*info)->hl != 0 && (*info)->pos_x < (*info)->max_x) ft_ctrl_i(info);}
开发者ID:fsacrepe,项目名称:mnshl,代码行数:13,
示例17: ft_spacestatic void ft_space(sel_list *lalist, co_list *coord, char *pos){ tputs(tgetstr("ce", NULL), 1, ft_putc); tputs(tgoto(pos, (*coord).x, (*coord).y), 1, ft_putc); if ((*lalist).select == 0) { (*lalist).select = 1; tputs(tgetstr("mr", NULL), 1, ft_putc); tputs(tgetstr("us", NULL), 1, ft_putc); ft_putstr((*lalist).word); tputs(tgetstr("me", NULL), 1, ft_putc); tputs(tgoto(pos, (*coord).x, (*coord).y), 1, ft_putc); }}
开发者ID:pielo,项目名称:select,代码行数:14,
示例18: wi_terminal_set_scrollvoid wi_terminal_set_scroll(wi_terminal_t *terminal, wi_range_t range) { terminal->scroll = range; tputs(tgoto(terminal->cs, range.length, range.location), 0, _wi_terminal_putc); _wi_terminal_flush();}
开发者ID:ProfDrLuigi,项目名称:zanka,代码行数:7,
示例19: ft_print_lstvoid ft_print_lst(t_lst **lst){ t_lst *tmp; int xy[2]; ft_bzero(xy, sizeof(int) * 2); tmp = *lst; if (((tgetnum("co") / (tmp->max_l + 3)) * tgetnum("li") < tmp->nbr_w)) print_word_fd("too small too print the argument list"); else { while (tmp->next != *lst) { while ((xy[1] < tgetnum("li")) && (tmp->next != *lst)) { tputs(tgoto(tgetstr("cm", NULL), xy[0], xy[1]++), 1, ft_putint); video_underl(tmp); tmp = tmp->next; } if (tmp->next != *lst) { xy[1] = 0; xy[0] = xy[0] + (tmp->max_l + 3); } } print_last_link(xy[1], xy[0], tmp); }}
开发者ID:42MrPiou42,项目名称:Ft_select,代码行数:28,
示例20: promptvoid prompt(void){ int i; char *logname; char *pwd; char *home; i = 0; logname = NULL; pwd = NULL; home = NULL; tputs(tgoto(tgetstr("ch", NULL), 0, 0), 1, tputs_putchar); ft_putstr("/033[40m"); if ((logname = ft_getenv("LOGNAME"))) ft_putstr(logname); ft_putstr("/033[m/033[44m/033[30m"); if ((pwd = ft_getenv("PWD")) && (home = ft_getenv("HOME")) && !ft_strncmp(pwd, home, ft_strlen(home))) { ft_putstr("~"); i = ft_strlen(home); } if (pwd) ft_putstr(pwd + i); print_error(logname, pwd, home);}
开发者ID:BenjaminRepingon,项目名称:42SH,代码行数:27,
示例21: tcapclosestatic void tcapclose(void){ putpad(tgoto(CM, 0, term.t_nrow)); putpad(TE); tioflush(); tiorestore();}
开发者ID:ajaysusarla,项目名称:cgol,代码行数:7,
示例22: ft_write_listvoid ft_write_list(t_dlist *arg, t_dlist_node *node, struct termios term, t_dlist_node *ls_n){ arg->index = -1; arg->line = 0; arg->cur_col = 1; node = ft_write_start(arg, node, term); while (++arg->index != (int)arg->size) { if (tgetnum("li") <= 2) { ft_terminal_small(arg); break ; } ft_calc_size(arg, node); if (arg->cur_col + arg->size_col > tgetnum("co") && arg->cur_col != 1) { ft_terminal_small(arg); break ; } if (arg->line == 0 && arg->cur_col != 1) arg->size_col = 0; arg->line = ft_define_x_y(arg, node, arg->line, arg->cur_col); node = ft_write_line(arg, node); } tputs(tgoto(tgetstr("cm", NULL), ls_n->pos_x, ls_n->pos_y), 1, ft_putchar); if (arg->index == (int)arg->size) ft_underline(arg, ls_n);}
开发者ID:Mavrick91,项目名称:ft_select,代码行数:29,
示例23: tgoto_cmdstatic TACommandVerdict tgoto_cmd(TAThread thread, TAInputStream stream){ char* cap; int col; int row; char* res; // Prepare cap = readString(&stream); col = readInt(&stream); row = readInt(&stream); START_TARGET_OPERATION(thread); // Execute res = tgoto(cap, col, row); END_TARGET_OPERATION(thread); // Response writePointer(thread, res); sendResponse(thread); return taDefaultVerdict;}
开发者ID:levenkov,项目名称:olver,代码行数:25,
示例24: apply_deletevoid apply_delete(t_historic **historic){ int win_size; t_comline *tmp; if ((*historic)->copy->comline->c != '/0') { tmp = (*historic)->copy->comline->right; (*historic)->copy->comline = (*historic)->copy->comline->left; (*historic)->copy->comline->right = tmp; if (tmp) tmp->left = (*historic)->copy->comline; if ((win_size = check_beginning((*historic)->copy->comline))) { tputs(tgetstr("up", NULL), 1, aff_c); tputs(tgoto(tgetstr("ch", NULL), 0, win_size), 1, aff_c); } else tputs(tgetstr("le", NULL), 1, aff_c); tputs(tgetstr("dc", NULL), 1, aff_c); (*historic)->copy->size--; edit_line(historic); update_linecol(historic); print_comline(historic); }}
开发者ID:kasou,项目名称:42sh,代码行数:26,
示例25: tstp/* * tstp: * Handle stop and start signals */static voidtstp(int dummy){ int y, x; y = cur_row; x = cur_col; mvcur(cur_row, cur_col, HEIGHT, 0); cur_row = HEIGHT; cur_col = 0; _puts(VE); _puts(TE); fflush(stdout); tcsetattr(0, TCSADRAIN, &__orig_termios); kill(getpid(), SIGSTOP); signal(SIGTSTP, tstp); tcsetattr(0, TCSADRAIN, &saved_tty); _puts(TI); _puts(VS); cur_row = y; cur_col = x; _puts(tgoto(CM, cur_row, cur_col)); display_redraw_screen(); fflush(stdout);}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:29,
示例26: my_show_listint my_show_list(t_list *list, t_tools tool, char *command){ struct winsize argp; t_param par; par.length = 0; par.my_cmpt = 2; if ((list = my_keep_list(list)) == NULL) return (-1); tool = my_keep_tool(tool); argp = init_my_ioctl(); while (list && list->cmpt != 0) list = list->next; if (my_screen(argp, list) == -1 || (tputs(tgoto(tool.set_cursor, 0, 0), 1, &my_putchar_int)) == -1) return (-1); prompt(NULL); my_putstr(command); my_putchar('/n'); my_printer(&list, tool); while (list->cmpt != 0) { par.length = par.length + my_show(&list, tool, argp, par); if (par.my_cmpt == 2) par.my_cmpt = 1; } return (0);}
开发者ID:Saursinet,项目名称:42sh,代码行数:28,
示例27: apply_moveprevvoid apply_moveprev(t_historic **historic){ struct winsize size; t_comline *tmp; ioctl(0, TIOCGWINSZ, &size); tmp = (*historic)->copy->comline; if (tmp->c != '/0') { while (tmp->c != '/0' && tmp->c == ' ') tmp = tmp->left; while (tmp->c != '/0' && tmp->c != ' ') tmp = tmp->left; while ((*historic)->copy->comline->col != tmp->col) { (*historic)->copy->comline = (*historic)->copy->comline->left; if (check_beginning((*historic)->copy->comline)) { tputs(tgetstr("up", NULL), 1, aff_c); tputs(tgoto(tgetstr("ch", NULL), 0, size.ws_col), 1, aff_c); } else tputs(tgetstr("le", NULL), 1, aff_c); } }}
开发者ID:kasou,项目名称:42sh,代码行数:26,
示例28: ft_select_printvoid ft_select_print(t_select *select, t_list *list){ t_list *cur; t_selector *selector; int y; int x; int index; y = 1; x = 0; index = 0; select->cols = 1; tputs(tgetstr("cl", NULL), 0, tputs_putchar); tputs(tgetstr("ho", NULL), 0, tputs_putchar); cur = ft_lstget_at(list, ft_selected_get_page_offset()); if (ft_select_get_max_words_by_page() == 0) ft_putstr_fd("Window size is too small", select->tty); while (cur && index < ft_select_get_max_words_by_page()) { selector = cur->content; ft_select_print_one(selector, index, &x, &y); y++; index++; cur = cur->next; } tputs(tgoto(tgetstr("cm", NULL), select->cursor_x, select->cursor_y), 1, tputs_putchar);}
开发者ID:mywaystar,项目名称:ft_select,代码行数:28,
示例29: wi_terminal_movevoid wi_terminal_move(wi_terminal_t *terminal, wi_point_t point) { terminal->location = point; tputs(tgoto(terminal->cm, point.x, point.y), 0, _wi_terminal_putc); _wi_terminal_flush();}
开发者ID:ProfDrLuigi,项目名称:zanka,代码行数:7,
注:本文中的tgoto函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tgsi_dump函数代码示例 C++ tgetstr函数代码示例 |