36 #if !defined(lint) && !defined(SCCSID)
52 num_read = el_wgetc (el, &wc);
61 el_push(
EditLine *el,
const char *str)
65 el_wpush(el, ct_decode_string(str, &el->el_lgcyconv));
74 tmp = el_wgets(el, nread);
75 return ct_encode_string(tmp, &el->el_lgcyconv);
80 el_parse(
EditLine *el,
int argc,
const char *argv[])
83 const wchar_t **wargv;
85 wargv = (
const wchar_t **)
86 ct_decode_argv(argc, argv, &el->el_lgcyconv);
89 ret = el_wparse(el, argc, wargv);
109 el_pfunc_t p = va_arg(ap, el_pfunc_t);
110 ret = prompt_set(el, p, 0, op, 0);
115 el_zfunc_t p = va_arg(ap, el_zfunc_t);
116 void *arg = va_arg(ap,
void *);
117 ret = ch_resizefun(el, p, arg);
122 ret = el_wset(el, op, va_arg(ap,
char *));
126 ret = el_wset(el, op, ct_decode_string(va_arg(ap,
char *),
134 ret = el_wset(el, op, va_arg(ap,
int));
142 const char *argv[20];
144 const wchar_t **wargv;
145 for (i = 1; i < (int)__arraycount(argv); ++
i)
146 if ((argv[i] = va_arg(ap,
char *)) == NULL)
149 wargv = (
const wchar_t **)
150 ct_decode_argv(i, argv, &el->el_lgcyconv);
162 wargv[0] = STR(
"bind");
163 ret = map_bind(el, i, wargv);
166 wargv[0] = STR(
"telltc");
167 ret = terminal_telltc(el, i, wargv);
170 wargv[0] = STR(
"settc");
171 ret = terminal_settc(el, i, wargv);
174 wargv[0] = STR(
"echotc");
175 ret = terminal_echotc(el, i, wargv);
178 wargv[0] = STR(
"setty");
179 ret = tty_stty(el, i, wargv);
194 args[0] = va_arg(ap,
const char *);
195 args[1] = va_arg(ap,
const char *);
196 func = va_arg(ap, el_func_t);
198 wargv = ct_decode_argv(2, args, &el->el_lgcyconv);
204 ret = map_addfunc(el, Strdup(wargv[0]), Strdup(wargv[1]),
210 hist_fun_t fun = va_arg(ap, hist_fun_t);
211 void *ptr = va_arg(ap,
void *);
212 ret = hist_set(el, fun, ptr);
213 el->el_flags |= NARROW_HISTORY;
218 ret = el_wset(el, op, va_arg(ap, el_rfunc_t));
219 el->el_flags |= NARROW_READ;
222 ret = el_wset(el, op, va_arg(ap,
void *));
225 int what = va_arg(ap,
int);
226 FILE *fp = va_arg(ap, FILE *);
227 ret = el_wset(el, op, what, fp);
231 case EL_RPROMPT_ESC: {
232 el_pfunc_t p = va_arg(ap, el_pfunc_t);
233 char c = (char)va_arg(ap,
int);
234 ret = prompt_set(el, p, c, op, 0);
262 el_pfunc_t *p = va_arg(ap, el_pfunc_t *);
263 ret = prompt_get(el, p, 0, op);
268 case EL_RPROMPT_ESC: {
269 el_pfunc_t *p = va_arg(ap, el_pfunc_t *);
270 char *c = va_arg(ap,
char *);
272 ret = prompt_get(el, p, &wc, op);
278 const char **p = va_arg(ap,
const char **);
280 ret = el_wget(el, op, &pw);
281 *p = ct_encode_string(pw, &el->el_lgcyconv);
282 if (!el->el_lgcyconv.csize)
288 ret = el_wget(el, op, va_arg(ap,
const char **));
295 ret = el_wget(el, op, va_arg(ap,
int *));
300 static char gettc[] =
"gettc";
302 for (i = 1; i < (int)__arraycount(argv); ++
i)
303 if ((argv[i] = va_arg(ap,
char *)) == NULL)
306 ret = terminal_gettc(el, i, argv);
312 ret = el_wget(el, op, va_arg(ap, el_rfunc_t *));
316 ret = el_wget(el, op, va_arg(ap,
void **));
320 int what = va_arg(ap,
int);
321 FILE **fpp = va_arg(ap, FILE **);
322 ret = el_wget(el, op, what, fpp);
344 info->buffer = ct_encode_string(winfo->buffer, &el->el_lgcyconv);
347 for (p = winfo->buffer; p < winfo->
cursor; p++)
348 offset += ct_enc_width(*p);
349 info->cursor = info->buffer +
offset;
352 for (p = winfo->buffer; p < winfo->lastchar; p++)
353 offset += ct_enc_width(*p);
354 info->lastchar = info->buffer +
offset;
361 el_insertstr(
EditLine *el,
const char *str)
363 return el_winsertstr(el, ct_decode_string(str, &el->el_lgcyconv));