Lines Matching defs:el
51 * el->el_keymacro.map)
58 * are in el->el_keymacro.map, adding the key "abc" will cause
69 #include "el.h"
73 * The Nodes of the el->el_keymacro.map. The el->el_keymacro.map is a
105 keymacro_init(EditLine *el)
108 el->el_keymacro.buf = el_calloc(KEY_BUFSIZ,
109 sizeof(*el->el_keymacro.buf));
110 if (el->el_keymacro.buf == NULL)
112 el->el_keymacro.map = NULL;
113 keymacro_reset(el);
121 keymacro_end(EditLine *el)
124 el_free(el->el_keymacro.buf);
125 el->el_keymacro.buf = NULL;
126 node__free(el->el_keymacro.map);
134 keymacro_map_cmd(EditLine *el, int cmd)
137 el->el_keymacro.val.cmd = (el_action_t) cmd;
138 return &el->el_keymacro.val;
146 keymacro_map_str(EditLine *el, wchar_t *str)
149 el->el_keymacro.val.str = str;
150 return &el->el_keymacro.val;
155 * Takes all nodes on el->el_keymacro.map and puts them on free list.
156 * Then initializes el->el_keymacro.map with arrow keys
160 keymacro_reset(EditLine *el)
163 node__put(el, el->el_keymacro.map);
164 el->el_keymacro.map = NULL;
170 * Calls the recursive function with entry point el->el_keymacro.map
179 keymacro_get(EditLine *el, wchar_t *ch, keymacro_value_t *val)
182 return node_trav(el, el->el_keymacro.map, ch, val);
187 * Adds key to the el->el_keymacro.map and associates the value in
188 * val with it. If key is already is in el->el_keymacro.map, the new
193 keymacro_add(EditLine *el, const wchar_t *key, keymacro_value_t *val,
198 (void) fprintf(el->el_errfile,
203 (void) fprintf(el->el_errfile,
207 if (el->el_keymacro.map == NULL)
209 el->el_keymacro.map = node__get(key[0]);
212 /* Now recurse through el->el_keymacro.map */
213 (void) node__try(el, el->el_keymacro.map, key, val, ntype);
222 keymacro_clear(EditLine *el, el_action_t *map, const wchar_t *in)
227 ((map == el->el_map.key &&
228 el->el_map.alt[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN) ||
229 (map == el->el_map.alt &&
230 el->el_map.key[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN)))
231 (void) keymacro_delete(el, in);
240 keymacro_delete(EditLine *el, const wchar_t *key)
244 (void) fprintf(el->el_errfile,
248 if (el->el_keymacro.map == NULL)
251 (void) node__delete(el, &el->el_keymacro.map, key);
258 * Print entire el->el_keymacro.map if null
261 keymacro_print(EditLine *el, const wchar_t *key)
264 /* do nothing if el->el_keymacro.map is empty and null key specified */
265 if (el->el_keymacro.map == NULL && *key == 0)
268 el->el_keymacro.buf[0] = '"';
269 if (node_lookup(el, key, el->el_keymacro.map, (size_t)1) <= -1)
271 (void) fprintf(el->el_errfile, "Unbound extended key \"%ls"
282 node_trav(EditLine *el, keymacro_node_t *ptr, wchar_t *ch,
290 if (el_wgetc(el, ch) != 1)
292 return node_trav(el, ptr->next, ch, val);
303 return node_trav(el, ptr->sibling, ch, val);
317 node__try(EditLine *el, keymacro_node_t *ptr, const wchar_t *str,
334 node__put(el, ptr->next);
347 EL_ABORT((el->el_errfile, "Bad XK_ type %d\n",
360 EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype));
366 (void) node__try(el, ptr->next, str, val, ntype);
376 node__delete(EditLine *el, keymacro_node_t **inptr, const wchar_t *str)
401 node__put(el, ptr);
404 node__delete(el, &ptr->next, str) == 1) {
412 node__put(el, ptr);
424 node__put(EditLine *el, keymacro_node_t *ptr)
430 node__put(el, ptr->next);
433 node__put(el, ptr->sibling);
444 EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ptr->type));
484 node_lookup(EditLine *el, const wchar_t *str, keymacro_node_t *ptr,
494 (void) node_enum(el, ptr, cnt);
497 /* If match put this char into el->el_keymacro.buf. Recurse */
500 used = ct_visual_char(el->el_keymacro.buf + cnt,
506 return (node_lookup(el, str + 1, ptr->next,
512 el->el_keymacro.buf[px] = '"';
513 el->el_keymacro.buf[px + 1] = '\0';
514 keymacro_kprint(el, el->el_keymacro.buf,
524 return (node_lookup(el, str, ptr->sibling,
537 node_enum(EditLine *el, keymacro_node_t *ptr, size_t cnt)
542 el->el_keymacro.buf[++cnt] = '"';
543 el->el_keymacro.buf[++cnt] = '\0';
544 (void) fprintf(el->el_errfile,
546 (void) fprintf(el->el_errfile, " \"%ls...\"\n",
547 el->el_keymacro.buf);
552 (void) fprintf(el->el_errfile,
558 used = ct_visual_char(el->el_keymacro.buf + cnt, KEY_BUFSIZ - cnt,
562 el->el_keymacro.buf[cnt + (size_t)used ] = '"';
563 el->el_keymacro.buf[cnt + (size_t)used + 1] = '\0';
564 keymacro_kprint(el, el->el_keymacro.buf, &ptr->val, ptr->type);
566 (void) node_enum(el, ptr->next, cnt + (size_t)used);
570 (void) node_enum(el, ptr->sibling, cnt);
580 keymacro_kprint(EditLine *el, const wchar_t *key, keymacro_value_t *val,
593 (void) fprintf(el->el_outfile, fmt,
594 ct_encode_string(key, &el->el_scratch), unparsbuf);
597 for (fp = el->el_map.help; fp->name; fp++)
601 (void) fprintf(el->el_outfile, fmt,
602 ct_encode_string(key, &el->el_scratch), unparsbuf);
607 (void) fprintf(el->el_outfile,
613 EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype));
616 (void) fprintf(el->el_outfile, fmt, ct_encode_string(key,
617 &el->el_scratch), "no input");