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

Lines Matching refs:el

53 #include "el.h"
67 read_init(EditLine *el)
70 el->el_read.read_char = read_char;
80 el_read_setfn(EditLine *el, el_rfunc_t rc)
82 el->el_read.read_char = (rc == EL_BUILTIN_GETCFN) ? read_char : rc;
92 el_read_getfn(EditLine *el)
94 return (el->el_read.read_char == read_char) ?
95 EL_BUILTIN_GETCFN : el->el_read.read_char;
105 read_debug(EditLine *el)
108 if (el->el_line.cursor > el->el_line.lastchar)
109 (void) fprintf(el->el_errfile, "cursor > lastchar\r\n");
110 if (el->el_line.cursor < el->el_line.buffer)
111 (void) fprintf(el->el_errfile, "cursor < buffer\r\n");
112 if (el->el_line.cursor > el->el_line.limit)
113 (void) fprintf(el->el_errfile, "cursor > limit\r\n");
114 if (el->el_line.lastchar > el->el_line.limit)
115 (void) fprintf(el->el_errfile, "lastchar > limit\r\n");
116 if (el->el_line.limit != &el->el_line.buffer[EL_BUFSIZ - 2])
117 (void) fprintf(el->el_errfile, "limit != &buffer[EL_BUFSIZ-2]\r\n");
188 read_preread(EditLine *el)
192 if (el->el_tty.t_mode == ED_IO)
199 (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs);
203 chrs = read(el->el_infd, buf,
207 el_push(el, buf);
220 FUN(el,push)(EditLine *el, const Char *str)
222 c_macro_t *ma = &el->el_chared.c_macro;
230 term_beep(el);
231 term__flush(el);
240 read_getcmd(EditLine *el, el_action_t *cmdnum, Char *ch)
245 el->el_errno = 0;
247 if ((num = FUN(el,getc)(el, ch)) != 1) {/* if EOF or error */
248 el->el_errno = num == 0 ? 0 : errno;
254 el->el_state.metanext = 0;
260 if (el->el_state.metanext) {
261 el->el_state.metanext = 0;
269 cmd = el->el_map.current[(unsigned char) *ch];
272 switch (key_get(el, ch, &val)) {
277 FUN(el,push)(el, val.str);
286 EL_ABORT((el->el_errfile, "Bad XK_ type \n"));
290 if (el->el_map.alt == NULL)
291 el->el_map.current = el->el_map.key;
313 read_char(EditLine *el, Char *cp)
322 el->el_signal->sig_no = 0;
323 while ((num_read = read(el->el_infd, cbuf + cbp, 1)) == -1) {
324 switch (el->el_signal->sig_no) {
326 el_set(el, EL_REFRESH);
329 sig_set(el);
334 if (!tried && read__fixio(el->el_infd, errno) == 0)
343 if (el->el_flags & CHARSET_IS_UTF8) {
359 if ((el->el_flags & IGNORE_EXTCHARS) && bytes > 1) {
386 FUN(el,getc)(EditLine *el, Char *cp)
389 c_macro_t *ma = &el->el_chared.c_macro;
391 term__flush(el);
394 if (!read_preread(el))
417 (void) fprintf(el->el_errfile, "Turning raw mode on\n");
419 if (tty_rawmode(el) < 0)/* make sure the tty is set up correctly */
423 (void) fprintf(el->el_errfile, "Reading a character\n");
425 num_read = (*el->el_read.read_char)(el, cp);
427 if (el->el_flags & NARROW_READ)
431 (void) fprintf(el->el_errfile, "Got it %c\n", *cp);
437 read_prepare(EditLine *el)
439 if (el->el_flags & HANDLE_SIGNALS)
440 sig_set(el);
441 if (el->el_flags & NO_TTY)
443 if ((el->el_flags & (UNBUFFERED|EDIT_DISABLED)) == UNBUFFERED)
444 tty_rawmode(el);
448 el_resize(el);
449 re_clear_display(el); /* reset the display stuff */
450 ch_reset(el, 0);
451 re_refresh(el); /* print the prompt */
453 if (el->el_flags & UNBUFFERED)
454 term__flush(el);
458 read_finish(EditLine *el)
460 if ((el->el_flags & UNBUFFERED) == 0)
461 (void) tty_cookedmode(el);
462 if (el->el_flags & HANDLE_SIGNALS)
463 sig_clr(el);
467 FUN(el,gets)(EditLine *el, int *nread)
476 c_macro_t *ma = &el->el_chared.c_macro;
483 if (el->el_flags & NO_TTY) {
486 cp = el->el_line.buffer;
487 while ((num = (*el->el_read.read_char)(el, cp)) == 1) {
489 if (cp + 1 >= el->el_line.limit) {
490 idx = (cp - el->el_line.buffer);
491 if (!ch_enlargebufs(el, 2))
493 cp = &el->el_line.buffer[idx];
496 if (el->el_flags & UNBUFFERED)
503 cp = el->el_line.buffer;
504 el->el_errno = errno;
512 if (el->el_tty.t_mode == EX_IO && ma->level < 0) {
515 (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs);
517 if (tty_rawmode(el) < 0) {
526 if ((el->el_flags & UNBUFFERED) == 0)
527 read_prepare(el);
529 if (el->el_flags & EDIT_DISABLED) {
532 if ((el->el_flags & UNBUFFERED) == 0)
533 cp = el->el_line.buffer;
535 cp = el->el_line.lastchar;
537 term__flush(el);
539 while ((num = (*el->el_read.read_char)(el, cp)) == 1) {
541 if (cp + 1 >= el->el_line.limit) {
542 idx = (cp - el->el_line.buffer);
543 if (!ch_enlargebufs(el, 2))
545 cp = &el->el_line.buffer[idx];
549 if (el->el_flags & UNBUFFERED)
557 cp = el->el_line.buffer;
558 el->el_errno = errno;
567 read_debug(el);
570 if ((num = read_getcmd(el, &cmdnum, &ch)) != OKCMD) {
572 (void) fprintf(el->el_errfile,
577 if (el->el_errno == EINTR) {
578 el->el_line.buffer[0] = '\0';
579 el->el_line.lastchar =
580 el->el_line.cursor = el->el_line.buffer;
583 if ((unsigned int)cmdnum >= (unsigned int)el->el_map.nfunc) { /* BUG CHECK command */
585 (void) fprintf(el->el_errfile,
594 for (b = el->el_map.help; b->name; b++)
598 (void) fprintf(el->el_errfile,
601 (void) fprintf(el->el_errfile,
606 el->el_state.thiscmd = cmdnum;
607 el->el_state.thisch = ch;
608 if (el->el_map.type == MAP_VI &&
609 el->el_map.current == el->el_map.key &&
610 el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) {
612 el->el_chared.c_redo.pos != el->el_chared.c_redo.buf
613 && Isprint(el->el_chared.c_redo.pos[-1]))
614 el->el_chared.c_redo.pos--;
616 *el->el_chared.c_redo.pos++ = ch;
618 retval = (*el->el_map.func[cmdnum]) (el, ch);
620 (void) fprintf(el->el_errfile,
625 el->el_state.lastcmd = cmdnum;
630 re_refresh_cursor(el);
634 re_clear_lines(el);
635 re_clear_display(el);
639 re_refresh(el);
643 re_refresh(el);
644 term_beep(el);
655 if ((el->el_flags & UNBUFFERED) == 0)
658 *el->el_line.lastchar++ = CONTROL('d');
659 el->el_line.cursor = el->el_line.lastchar;
665 num = (int)(el->el_line.lastchar - el->el_line.buffer);
670 (void) fprintf(el->el_errfile,
674 re_clear_display(el); /* reset the display stuff */
675 ch_reset(el, 1); /* reset the input pointers */
676 re_refresh(el); /* print the prompt again */
682 (void) fprintf(el->el_errfile,
685 term_beep(el);
686 term__flush(el);
689 el->el_state.argument = 1;
690 el->el_state.doingarg = 0;
691 el->el_chared.c_vcmd.action = NOP;
692 if (el->el_flags & UNBUFFERED)
696 term__flush(el); /* flush any buffered output */
698 if ((el->el_flags & UNBUFFERED) == 0) {
699 read_finish(el);
702 *nread = (int)(el->el_line.lastchar - el->el_line.buffer);
706 el->el_line.cursor = el->el_line.lastchar = cp;
708 *nread = (int)(el->el_line.cursor - el->el_line.buffer);
713 errno = el->el_errno;
717 return el->el_line.buffer;