mirror of
https://github.com/tmux/tmux.git
synced 2026-07-03 10:12:31 +00:00
Convert most of remaining bits.
This commit is contained in:
@@ -157,7 +157,7 @@ cmd_list_keys_format_add_key_binding(struct format_tree *ft,
|
||||
|
||||
format_add(ft, "key_string", "%s", key_string_lookup_key(bd->key, 0));
|
||||
|
||||
s = cmd_parse_print(bd->cmd); /* XXX: command parser conversion */
|
||||
s = cmd_parse_print(bd->cmd);
|
||||
format_add(ft, "key_command", "%s", s);
|
||||
free(s);
|
||||
}
|
||||
|
||||
21
control.c
21
control.c
@@ -556,10 +556,9 @@ control_read_callback(__unused struct bufferevent *bufev, void *data)
|
||||
struct control_state *cs = c->control_state;
|
||||
struct evbuffer *buffer = cs->read_event->input;
|
||||
char *line, *error;
|
||||
struct cmd_parse_tree *tree;
|
||||
struct cmdq_item *new_item;
|
||||
struct cmdq_state *state;
|
||||
#if 0 /* XXX: command parser conversion */
|
||||
enum cmd_parse_status status;
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
line = evbuffer_readln(buffer, NULL, EVBUFFER_EOL_LF);
|
||||
@@ -572,18 +571,16 @@ control_read_callback(__unused struct bufferevent *bufev, void *data)
|
||||
break;
|
||||
}
|
||||
|
||||
#if 0 /* XXX: command parser conversion */
|
||||
state = cmdq_new_state(NULL, NULL, CMDQ_STATE_CONTROL);
|
||||
status = cmd_parse_and_append(line, NULL, c, state, &error);
|
||||
if (status == CMD_PARSE_ERROR)
|
||||
tree = cmd_parse_from_string(line, NULL, &error);
|
||||
if (tree == NULL)
|
||||
cmdq_append(c, cmdq_get_callback(control_error, error));
|
||||
else {
|
||||
new_item = cmd_invoke_get(tree, state, NULL);
|
||||
cmdq_append(c, new_item);
|
||||
cmd_parse_free(tree);
|
||||
}
|
||||
cmdq_free_state(state);
|
||||
#else
|
||||
state = cmdq_new_state(NULL, NULL, CMDQ_STATE_CONTROL);
|
||||
error = xstrdup("XXX: command parser conversion not done for control mode");
|
||||
cmdq_append(c, cmdq_get_callback(control_error, error));
|
||||
cmdq_free_state(state);
|
||||
#endif
|
||||
|
||||
free(line);
|
||||
}
|
||||
|
||||
20
menu.c
20
menu.c
@@ -315,10 +315,9 @@ menu_key_cb(struct client *c, void *data, struct key_event *event)
|
||||
int count = menu->count, old = md->choice;
|
||||
const char *name = NULL;
|
||||
const struct menu_item *item;
|
||||
struct cmd_parse_tree *tree;
|
||||
struct cmdq_item *new_item;
|
||||
struct cmdq_state *state;
|
||||
#if 0 /* XXX: command parser conversion */
|
||||
enum cmd_parse_status status;
|
||||
#endif
|
||||
char *error;
|
||||
|
||||
if (KEYC_IS_MOUSE(event->key)) {
|
||||
@@ -498,18 +497,15 @@ chosen:
|
||||
else
|
||||
event = NULL;
|
||||
state = cmdq_new_state(&md->fs, event, 0);
|
||||
|
||||
#if 0 /* XXX: command parser conversion */
|
||||
status = cmd_parse_and_append(item->command, NULL, c, state, &error);
|
||||
if (status == CMD_PARSE_ERROR) {
|
||||
tree = cmd_parse_from_string(item->command, NULL, &error);
|
||||
if (tree == NULL) {
|
||||
cmdq_append(c, cmdq_get_error(error));
|
||||
free(error);
|
||||
} else {
|
||||
new_item = cmd_invoke_get(tree, state, NULL);
|
||||
cmdq_append(c, new_item);
|
||||
cmd_parse_free(tree);
|
||||
}
|
||||
#else
|
||||
error = xstrdup("XXX: command parser conversion not done for menu");
|
||||
cmdq_append(c, cmdq_get_error(error));
|
||||
free(error);
|
||||
#endif
|
||||
cmdq_free_state(state);
|
||||
|
||||
return (1);
|
||||
|
||||
22
mode-tree.c
22
mode-tree.c
@@ -1814,32 +1814,26 @@ void
|
||||
mode_tree_run_command(struct client *c, struct cmd_find_state *fs,
|
||||
const char *template, const char *name)
|
||||
{
|
||||
struct cmd_parse_tree *tree;
|
||||
struct cmdq_item *new_item;
|
||||
struct cmdq_state *state;
|
||||
char *command, *error;
|
||||
#if 0 /* XXX: command parser conversion */
|
||||
enum cmd_parse_status status;
|
||||
#endif
|
||||
|
||||
command = cmd_template_replace(template, name, 1);
|
||||
if (command != NULL && *command != '\0') {
|
||||
state = cmdq_new_state(fs, NULL, 0);
|
||||
#if 0 /* XXX: command parser conversion */
|
||||
status = cmd_parse_and_append(command, NULL, c, state, &error);
|
||||
if (status == CMD_PARSE_ERROR) {
|
||||
tree = cmd_parse_from_string(command, NULL, &error);
|
||||
if (tree == NULL) {
|
||||
if (c != NULL) {
|
||||
*error = toupper((u_char)*error);
|
||||
status_message_set(c, -1, 1, 0, 0, "%s", error);
|
||||
}
|
||||
free(error);
|
||||
} else {
|
||||
new_item = cmd_invoke_get(tree, state, NULL);
|
||||
cmdq_append(c, new_item);
|
||||
cmd_parse_free(tree);
|
||||
}
|
||||
#else
|
||||
error = xstrdup("XXX: command parser conversion not done for mode tree");
|
||||
if (c != NULL) {
|
||||
*error = toupper((u_char)*error);
|
||||
status_message_set(c, -1, 1, 0, 0, "%s", error);
|
||||
}
|
||||
free(error);
|
||||
#endif
|
||||
cmdq_free_state(state);
|
||||
}
|
||||
free(command);
|
||||
|
||||
26
notify.c
26
notify.c
@@ -62,6 +62,8 @@ notify_insert_hook(struct cmdq_item *item, struct notify_entry *ne)
|
||||
struct options_entry *o;
|
||||
struct options_array_item *a;
|
||||
struct cmd_parse_tree *tree;
|
||||
const char *value;
|
||||
char *cause;
|
||||
|
||||
log_debug("%s: inserting hook %s", __func__, ne->name);
|
||||
|
||||
@@ -93,26 +95,16 @@ notify_insert_hook(struct cmdq_item *item, struct notify_entry *ne)
|
||||
cmdq_add_formats(state, ne->formats);
|
||||
|
||||
if (*ne->name == '@') {
|
||||
#if 0 /* XXX: command parser conversion */
|
||||
struct cmd_parse_result *pr;
|
||||
const char *value;
|
||||
|
||||
value = options_get_string(oo, ne->name);
|
||||
pr = cmd_parse_from_string(value, NULL);
|
||||
switch (pr->status) {
|
||||
case CMD_PARSE_ERROR:
|
||||
tree = cmd_parse_from_string(value, NULL, &cause);
|
||||
if (tree == NULL) {
|
||||
log_debug("%s: can't parse hook %s: %s", __func__,
|
||||
ne->name, pr->error);
|
||||
free(pr->error);
|
||||
break;
|
||||
case CMD_PARSE_SUCCESS:
|
||||
notify_insert_one_hook(item, ne, pr->cmdlist, state);
|
||||
break;
|
||||
ne->name, cause);
|
||||
free(cause);
|
||||
} else {
|
||||
item = notify_insert_one_hook(item, ne, tree, state);
|
||||
cmd_parse_free(tree);
|
||||
}
|
||||
#else
|
||||
log_debug("%s: command parser conversion not done for hook %s",
|
||||
__func__, ne->name);
|
||||
#endif
|
||||
} else {
|
||||
a = options_array_first(o);
|
||||
while (a != NULL) {
|
||||
|
||||
@@ -490,7 +490,7 @@ window_customize_build_keys(struct window_customize_modedata *data,
|
||||
expanded, NULL, 0);
|
||||
free(expanded);
|
||||
|
||||
tmp = cmd_parse_print(bd->cmd); /* XXX: command parser conversion */
|
||||
tmp = cmd_parse_print(bd->cmd);
|
||||
xasprintf(&text, "#[ignore]%s", tmp);
|
||||
free(tmp);
|
||||
mti = mode_tree_add(data->data, child, item,
|
||||
@@ -625,7 +625,7 @@ window_customize_draw_key(__unused struct window_customize_modedata *data,
|
||||
if (s->cy >= cy + sy - 1)
|
||||
return;
|
||||
|
||||
cmd = cmd_parse_print(bd->cmd); /* XXX: command parser conversion */
|
||||
cmd = cmd_parse_print(bd->cmd);
|
||||
if (!screen_write_text(ctx, cx, sx, sy - (s->cy - cy), 0,
|
||||
&grid_default_cell, "Command: %s", cmd)) {
|
||||
free(cmd);
|
||||
@@ -1218,6 +1218,7 @@ window_customize_set_command_callback(struct client *c, void *itemdata,
|
||||
struct window_customize_itemdata *item = itemdata;
|
||||
struct window_customize_modedata *data = item->data;
|
||||
struct key_binding *bd;
|
||||
struct cmd_parse_tree *tree;
|
||||
char *error;
|
||||
|
||||
if (s == NULL || *s == '\0' || data->dead)
|
||||
@@ -1225,27 +1226,15 @@ window_customize_set_command_callback(struct client *c, void *itemdata,
|
||||
if (item == NULL || !window_customize_get_key(item, NULL, &bd))
|
||||
return (PROMPT_CLOSE);
|
||||
|
||||
#if 0 /* XXX: command parser conversion */
|
||||
struct cmd_parse_result *pr;
|
||||
|
||||
pr = cmd_parse_from_string(s, NULL);
|
||||
switch (pr->status) {
|
||||
case CMD_PARSE_ERROR:
|
||||
error = pr->error;
|
||||
tree = cmd_parse_from_string(s, NULL, &error);
|
||||
if (tree == NULL)
|
||||
goto fail;
|
||||
case CMD_PARSE_SUCCESS:
|
||||
break;
|
||||
}
|
||||
cmd_list_free(bd->cmdlist);
|
||||
bd->cmdlist = pr->cmdlist;
|
||||
|
||||
cmd_parse_free(bd->cmd);
|
||||
bd->cmd = tree;
|
||||
mode_tree_build(data->data);
|
||||
mode_tree_draw(data->data);
|
||||
data->wp->flags |= PANE_REDRAW;
|
||||
#else
|
||||
error = xstrdup("XXX: command parser conversion not done for customize");
|
||||
goto fail;
|
||||
#endif
|
||||
|
||||
return (PROMPT_CLOSE);
|
||||
|
||||
@@ -1298,7 +1287,7 @@ window_customize_set_key(struct client *c,
|
||||
bd->flags ^= KEY_BINDING_REPEAT;
|
||||
else if (strcmp(s, "Command") == 0) {
|
||||
xasprintf(&prompt, "(%s) ", key_string_lookup_key(key, 0));
|
||||
value = cmd_parse_print(bd->cmd); /* XXX: command parser conversion */
|
||||
value = cmd_parse_print(bd->cmd);
|
||||
|
||||
new_item = xcalloc(1, sizeof *new_item);
|
||||
new_item->data = data;
|
||||
@@ -1360,7 +1349,7 @@ window_customize_reset_key(struct window_customize_modedata *data,
|
||||
return;
|
||||
|
||||
dd = key_bindings_get_default(kt, bd->key);
|
||||
if (dd != NULL && bd->cmd == dd->cmd) /* XXX: command parser conversion */
|
||||
if (dd != NULL && bd->cmd == dd->cmd)
|
||||
return;
|
||||
if (dd == NULL && item == mode_tree_get_current(data->data)) {
|
||||
mode_tree_collapse_current(data->data);
|
||||
|
||||
@@ -431,12 +431,11 @@ window_switch_run_command(struct window_switch_modedata *data, struct client *c)
|
||||
struct cmd_find_state fs;
|
||||
struct session *s;
|
||||
struct winlink *wl;
|
||||
struct cmd_parse_tree *tree;
|
||||
struct cmdq_item *new_item;
|
||||
char *target = NULL;
|
||||
struct cmdq_state *state;
|
||||
char *command, *error;
|
||||
#if 0 /* XXX: command parser conversion */
|
||||
enum cmd_parse_status status;
|
||||
#endif
|
||||
|
||||
if (data->matches_size == 0)
|
||||
return (0);
|
||||
@@ -468,23 +467,18 @@ window_switch_run_command(struct window_switch_modedata *data, struct client *c)
|
||||
command = cmd_template_replace(data->command, target, 1);
|
||||
if (command != NULL && *command != '\0') {
|
||||
state = cmdq_new_state(&fs, NULL, 0);
|
||||
#if 0 /* XXX: command parser conversion */
|
||||
status = cmd_parse_and_append(command, NULL, c, state, &error);
|
||||
if (status == CMD_PARSE_ERROR) {
|
||||
tree = cmd_parse_from_string(command, NULL, &error);
|
||||
if (tree == NULL) {
|
||||
if (c != NULL) {
|
||||
*error = toupper((u_char)*error);
|
||||
status_message_set(c, -1, 1, 0, 0, "%s", error);
|
||||
}
|
||||
free(error);
|
||||
} else {
|
||||
new_item = cmd_invoke_get(tree, state, NULL);
|
||||
cmdq_append(c, new_item);
|
||||
cmd_parse_free(tree);
|
||||
}
|
||||
#else
|
||||
error = xstrdup("XXX: command parser conversion not done for window switch");
|
||||
if (c != NULL) {
|
||||
*error = toupper((u_char)*error);
|
||||
status_message_set(c, -1, 1, 0, 0, "%s", error);
|
||||
}
|
||||
free(error);
|
||||
#endif
|
||||
cmdq_free_state(state);
|
||||
}
|
||||
free(command);
|
||||
|
||||
Reference in New Issue
Block a user