• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/Heimdal-398.1.2/lib/libedit/src/

Lines Matching defs:el

75 #include "el.h"
86 #define GoodStr(a) (el->el_term.t_str[a] != NULL && \
87 el->el_term.t_str[a][0] != '\0')
88 #define Str(a) el->el_term.t_str[a]
89 #define Val(a) el->el_term.t_val[a]
292 term_setflags(EditLine *el)
295 if (el->el_tty.t_tabs)
319 (void) fprintf(el->el_errfile,
321 (void) fprintf(el->el_errfile,
325 (void) fprintf(el->el_errfile, "no clear EOL capability.\n");
327 (void) fprintf(el->el_errfile, "no delete char capability.\n");
329 (void) fprintf(el->el_errfile, "no insert char capability.\n");
337 term_init(EditLine *el)
340 el->el_term.t_buf = (char *) el_malloc(TC_BUFSIZE);
341 if (el->el_term.t_buf == NULL)
343 el->el_term.t_cap = (char *) el_malloc(TC_BUFSIZE);
344 if (el->el_term.t_cap == NULL)
346 el->el_term.t_fkey = (fkey_t *) el_malloc(A_K_NKEYS * sizeof(fkey_t));
347 if (el->el_term.t_fkey == NULL)
349 el->el_term.t_loc = 0;
350 el->el_term.t_str = (char **) el_malloc(T_str * sizeof(char *));
351 if (el->el_term.t_str == NULL)
353 (void) memset(el->el_term.t_str, 0, T_str * sizeof(char *));
354 el->el_term.t_val = (int *) el_malloc(T_val * sizeof(int));
355 if (el->el_term.t_val == NULL)
357 (void) memset(el->el_term.t_val, 0, T_val * sizeof(int));
358 (void) term_set(el, NULL);
359 term_init_arrow(el);
367 term_end(EditLine *el)
370 el_free((ptr_t) el->el_term.t_buf);
371 el->el_term.t_buf = NULL;
372 el_free((ptr_t) el->el_term.t_cap);
373 el->el_term.t_cap = NULL;
374 el->el_term.t_loc = 0;
375 el_free((ptr_t) el->el_term.t_str);
376 el->el_term.t_str = NULL;
377 el_free((ptr_t) el->el_term.t_val);
378 el->el_term.t_val = NULL;
379 el_free((ptr_t) el->el_term.t_fkey);
380 el->el_term.t_fkey = NULL;
381 term_free_display(el);
389 term_alloc(EditLine *el, const struct termcapstr *t, const char *cap)
393 char **tlist = el->el_term.t_str;
415 if (el->el_term.t_loc + 3 < TC_BUFSIZE) {
417 (void) strcpy(*str = &el->el_term.t_buf[el->el_term.t_loc],
419 el->el_term.t_loc += (int)clen + 1; /* one for \0 */
435 memcpy(el->el_term.t_buf, termbuf, TC_BUFSIZE);
436 el->el_term.t_loc = (int)tlen;
437 if (el->el_term.t_loc + 3 >= TC_BUFSIZE) {
438 (void) fprintf(el->el_errfile,
443 (void) strcpy(*str = &el->el_term.t_buf[el->el_term.t_loc], cap);
444 el->el_term.t_loc += (int)clen + 1; /* one for \0 */
453 term_rebuffer_display(EditLine *el)
455 coord_t *c = &el->el_term.t_size;
457 term_free_display(el);
462 if (term_alloc_display(el) == -1)
472 term_alloc_display(EditLine *el)
476 coord_t *c = &el->el_term.t_size;
491 el->el_display = b;
506 el->el_vdisplay = b;
515 term_free_display(EditLine *el)
520 b = el->el_display;
521 el->el_display = NULL;
527 b = el->el_vdisplay;
528 el->el_vdisplay = NULL;
542 term_move_to_line(EditLine *el, int where)
546 if (where == el->el_cursor.v)
549 if (where > el->el_term.t_size.v) {
551 (void) fprintf(el->el_errfile,
556 if ((del = where - el->el_cursor.v) > 0) {
559 el->el_display[el->el_cursor.v][0] != '\0') {
560 size_t h = el->el_term.t_size.h - 1;
563 el->el_display[el->el_cursor.v][h] ==
569 term_move_to_char(el, (int)h);
570 term_overwrite(el, &el->el_display
571 [el->el_cursor.v][el->el_cursor.h],
572 (size_t)(el->el_term.t_size.h -
573 el->el_cursor.h));
578 term_tputs(el, tgoto(Str(T_DO), del,
583 term__putc(el, '\n');
585 el->el_cursor.h = 0;
591 term_tputs(el, tgoto(Str(T_UP), -del, -del), -del);
595 term_tputs(el, Str(T_up), 1);
598 el->el_cursor.v = where;/* now where is here */
606 term_move_to_char(EditLine *el, int where)
611 if (where == el->el_cursor.h)
614 if (where > el->el_term.t_size.h) {
616 (void) fprintf(el->el_errfile,
622 term__putc(el, '\r'); /* do a CR */
623 el->el_cursor.h = 0;
626 del = where - el->el_cursor.h;
630 term_tputs(el, tgoto(Str(T_ch), where, where), where);
634 term_tputs(el, tgoto(Str(T_RI), del, del), del);
638 if ((el->el_cursor.h & 0370) !=
641 && (el->el_display[
642 el->el_cursor.v][where & 0370] !=
648 (el->el_cursor.h & 0370);
651 term__putc(el, '\t');
653 el->el_cursor.h = where & ~0x7;
662 * el->el_cursor.h!!!
664 term_overwrite(el, &el->el_display[
665 el->el_cursor.v][el->el_cursor.h],
666 (size_t)(where - el->el_cursor.h));
671 term_tputs(el, tgoto(Str(T_LE), -del, -del),
683 term__putc(el, '\r'); /* do a CR */
684 el->el_cursor.h = 0;
688 term__putc(el, '\b');
692 el->el_cursor.h = where; /* now where is here */
701 term_overwrite(EditLine *el, const Char *cp, size_t n)
706 if (n > (size_t)el->el_term.t_size.h) {
708 (void) fprintf(el->el_errfile,
716 term__putc(el, *cp++);
717 el->el_cursor.h++;
720 if (el->el_cursor.h >= el->el_term.t_size.h) { /* wrap? */
722 el->el_cursor.h = 0;
723 el->el_cursor.v++;
728 if ((c = el->el_display[el->el_cursor.v]
729 [el->el_cursor.h]) != '\0') {
730 term_overwrite(el, &c, 1);
732 while (el->el_display[el->el_cursor.v]
733 [el->el_cursor.h] == MB_FILL_CHAR)
734 el->el_cursor.h++;
737 term__putc(el, ' ');
738 el->el_cursor.h = 1;
742 el->el_cursor.h = el->el_term.t_size.h - 1;
751 term_deletechars(EditLine *el, int num)
758 (void) fprintf(el->el_errfile, " ERROR: cannot delete \n");
762 if (num > el->el_term.t_size.h) {
764 (void) fprintf(el->el_errfile,
772 term_tputs(el, tgoto(Str(T_DC), num, num), num);
776 term_tputs(el, Str(T_dm), 1);
780 term_tputs(el, Str(T_dc), 1);
783 term_tputs(el, Str(T_ed), 1);
793 term_insertwrite(EditLine *el, Char *cp, int num)
799 (void) fprintf(el->el_errfile, " ERROR: cannot insert \n");
803 if (num > el->el_term.t_size.h) {
805 (void) fprintf(el->el_errfile,
813 term_tputs(el, tgoto(Str(T_IC), num, num), num);
814 term_overwrite(el, cp, (size_t)num);
819 term_tputs(el, Str(T_im), 1);
821 el->el_cursor.h += num;
823 term__putc(el, *cp++);
827 term_tputs(el, Str(T_ip), 1);
829 term_tputs(el, Str(T_ei), 1);
834 term_tputs(el, Str(T_ic), 1);
836 term__putc(el, *cp++);
838 el->el_cursor.h++;
841 term_tputs(el, Str(T_ip), 1);
852 term_clear_EOL(EditLine *el, int num)
857 term_tputs(el, Str(T_ce), 1);
860 term__putc(el, ' ');
861 el->el_cursor.h += num; /* have written num spaces */
870 term_clear_screen(EditLine *el)
875 term_tputs(el, Str(T_cl), Val(T_li));
877 term_tputs(el, Str(T_ho), Val(T_li)); /* home */
879 term_tputs(el, Str(T_cd), Val(T_li));
881 term__putc(el, '\r');
882 term__putc(el, '\n');
891 term_beep(EditLine *el)
895 term_tputs(el, Str(T_bl), 1);
897 term__putc(el, '\007'); /* an ASCII bell; ^G */
906 term_clear_to_bottom(EditLine *el)
909 term_tputs(el, Str(T_cd), Val(T_li));
911 term_tputs(el, Str(T_ce), Val(T_li));
916 term_get(EditLine *el, const char **term)
918 *term = el->el_term.t_name;
926 term_set(EditLine *el, const char *term)
949 el->el_flags |= EDIT_DISABLED;
951 memset(el->el_term.t_cap, 0, TC_BUFSIZE);
953 i = tgetent(el->el_term.t_cap, term);
957 (void) fprintf(el->el_errfile,
960 (void) fprintf(el->el_errfile,
962 (void) fprintf(el->el_errfile,
968 term_alloc(el, t, NULL);
984 term_alloc(el, t, tgetstr(strchr(t->name, *t->name),
994 el->el_term.t_size.v = Val(T_co);
995 el->el_term.t_size.h = Val(T_li);
997 term_setflags(el);
1000 (void) term_get_size(el, &lins, &cols);
1001 if (term_change_size(el, lins, cols) == -1)
1004 term_bind_arrow(el);
1005 el->el_term.t_name = term;
1015 term_get_size(EditLine *el, int *lins, int *cols)
1024 if (ioctl(el->el_infd, TIOCGWINSZ, (ioctl_t) & ws) != -1) {
1035 if (ioctl(el->el_infd, TIOCGSIZE, (ioctl_t) & ts) != -1) {
1051 term_change_size(EditLine *el, int lins, int cols)
1060 if (term_rebuffer_display(el) == -1)
1062 re_clear_display(el);
1071 term_init_arrow(EditLine *el)
1073 fkey_t *arrow = el->el_term.t_fkey;
1111 term_reset_arrow(EditLine *el)
1113 fkey_t *arrow = el->el_term.t_fkey;
1127 key_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
1128 key_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
1129 key_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
1130 key_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
1131 key_add(el, strH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
1132 key_add(el, strF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
1133 key_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
1134 key_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
1135 key_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
1136 key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
1137 key_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
1138 key_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
1140 if (el->el_map.type == MAP_VI) {
1141 key_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
1142 key_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
1143 key_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
1144 key_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
1145 key_add(el, &strH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
1146 key_add(el, &strF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
1147 key_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
1148 key_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
1149 key_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
1150 key_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
1151 key_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
1152 key_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
1161 term_set_arrow(EditLine *el, const Char *name, key_value_t *fun, int type)
1163 fkey_t *arrow = el->el_term.t_fkey;
1180 term_clear_arrow(EditLine *el, const Char *name)
1182 fkey_t *arrow = el->el_term.t_fkey;
1198 term_print_arrow(EditLine *el, const Char *name)
1201 fkey_t *arrow = el->el_term.t_fkey;
1206 key_kprint(el, arrow[i].name, &arrow[i].fun,
1215 term_bind_arrow(EditLine *el)
1221 fkey_t *arrow = el->el_term.t_fkey;
1224 if (el->el_term.t_buf == NULL || el->el_map.key == NULL)
1227 map = el->el_map.type == MAP_VI ? el->el_map.alt : el->el_map.key;
1228 dmap = el->el_map.type == MAP_VI ? el->el_map.vic : el->el_map.emacs;
1230 term_reset_arrow(el);
1237 p = el->el_term.t_str[arrow[i].key];
1257 key_clear(el, map, px);
1261 key_add(el, px, &arrow[i].fun,
1265 key_clear(el, map, px);
1269 key_add(el, px, &arrow[i].fun,
1288 term_tputs(EditLine *el, const char *cap, int affcnt)
1293 term_outfile = el->el_outfile;
1304 term__putc(EditLine *el, Int c)
1314 return fputs(buf, el->el_outfile);
1321 term__flush(EditLine *el)
1324 (void) fflush(el->el_outfile);
1331 term_writec(EditLine *el, Int c)
1336 term_overwrite(el, visbuf, (size_t)vcnt);
1337 term__flush(el);
1346 term_telltc(EditLine *el, int argc __attribute__((__unused__)),
1352 (void) fprintf(el->el_outfile, "\n\tYour terminal has the\n");
1353 (void) fprintf(el->el_outfile, "\tfollowing characteristics:\n\n");
1354 (void) fprintf(el->el_outfile, "\tIt has %d columns and %d lines\n",
1356 (void) fprintf(el->el_outfile,
1358 (void) fprintf(el->el_outfile,
1360 (void) fprintf(el->el_outfile, "\tIt %s automatic margins\n",
1363 (void) fprintf(el->el_outfile, "\tIt %s magic margins\n",
1366 for (t = tstr, ts = el->el_term.t_str; t->name != NULL; t++, ts++) {
1370 ct_decode_string(*ts, &el->el_scratch)),
1371 &el->el_scratch);
1375 (void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n",
1378 (void) fputc('\n', el->el_outfile);
1388 term_settc(EditLine *el, int argc __attribute__((__unused__)),
1398 strncpy(what, ct_encode_string(argv[1], &el->el_scratch), sizeof(what));
1400 strncpy(how, ct_encode_string(argv[2], &el->el_scratch), sizeof(how));
1411 term_alloc(el, ts, how);
1412 term_setflags(el);
1428 el->el_term.t_val[tv - tval] = 1;
1430 el->el_term.t_val[tv - tval] = 0;
1432 (void) fprintf(el->el_errfile,
1436 term_setflags(el);
1437 if (term_change_size(el, Val(T_li), Val(T_co)) == -1)
1446 (void) fprintf(el->el_errfile,
1450 el->el_term.t_val[tv - tval] = (int) i;
1451 el->el_term.t_size.v = Val(T_co);
1452 el->el_term.t_size.h = Val(T_li);
1454 if (term_change_size(el, Val(T_li), Val(T_co))
1467 term_gettc(EditLine *el, int argc __attribute__((__unused__)), char **argv)
1488 *(char **)how = el->el_term.t_str[ts - tstr];
1505 if (el->el_term.t_val[tv - tval])
1511 *(int *)how = el->el_term.t_val[tv - tval];
1521 term_echotc(EditLine *el, int argc __attribute__((__unused__)),
1557 (void) fprintf(el->el_outfile, fmts, EL_CAN_TAB ? "yes" : "no");
1560 (void) fprintf(el->el_outfile, fmts, Val(T_km) ? "yes" : "no");
1563 (void) fprintf(el->el_outfile, fmts, EL_HAS_MAGIC_MARGINS ?
1567 (void) fprintf(el->el_outfile, fmts, EL_HAS_AUTO_MARGINS ?
1575 if (el->el_tty.t_speed == baud_rate[i].b_rate) {
1576 (void) fprintf(el->el_outfile, fmts,
1580 (void) fprintf(el->el_outfile, fmtd, 0);
1582 (void) fprintf(el->el_outfile, fmtd, (int)el->el_tty.t_speed);
1587 (void) fprintf(el->el_outfile, fmtd, Val(T_li));
1590 (void) fprintf(el->el_outfile, fmtd, Val(T_co));
1599 ct_encode_string(*argv, &el->el_scratch)) == 0) {
1600 scap = el->el_term.t_str[t - tstr];
1605 scap = tgetstr(ct_encode_string(*argv, &el->el_scratch), &area);
1609 (void) fprintf(el->el_errfile,
1640 (void) fprintf(el->el_errfile,
1652 (void) fprintf(el->el_errfile,
1657 term_tputs(el, scap, 1);
1663 (void) fprintf(el->el_errfile,
1671 (void) fprintf(el->el_errfile,
1680 (void) fprintf(el->el_errfile,
1685 term_tputs(el, tgoto(scap, arg_cols, arg_rows), 1);
1690 (void) fprintf(el->el_errfile,
1698 (void) fprintf(el->el_errfile,
1705 (void) fprintf(el->el_errfile,
1714 (void) fprintf(el->el_errfile,
1721 (void) fprintf(el->el_errfile,
1729 (void) fprintf(el->el_errfile,
1736 (void) fprintf(el->el_errfile,
1741 term_tputs(el, tgoto(scap, arg_cols, arg_rows), arg_rows);