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));
|
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);
|
format_add(ft, "key_command", "%s", s);
|
||||||
free(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 control_state *cs = c->control_state;
|
||||||
struct evbuffer *buffer = cs->read_event->input;
|
struct evbuffer *buffer = cs->read_event->input;
|
||||||
char *line, *error;
|
char *line, *error;
|
||||||
|
struct cmd_parse_tree *tree;
|
||||||
|
struct cmdq_item *new_item;
|
||||||
struct cmdq_state *state;
|
struct cmdq_state *state;
|
||||||
#if 0 /* XXX: command parser conversion */
|
|
||||||
enum cmd_parse_status status;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
line = evbuffer_readln(buffer, NULL, EVBUFFER_EOL_LF);
|
line = evbuffer_readln(buffer, NULL, EVBUFFER_EOL_LF);
|
||||||
@@ -572,18 +571,16 @@ control_read_callback(__unused struct bufferevent *bufev, void *data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* XXX: command parser conversion */
|
|
||||||
state = cmdq_new_state(NULL, NULL, CMDQ_STATE_CONTROL);
|
state = cmdq_new_state(NULL, NULL, CMDQ_STATE_CONTROL);
|
||||||
status = cmd_parse_and_append(line, NULL, c, state, &error);
|
tree = cmd_parse_from_string(line, NULL, &error);
|
||||||
if (status == CMD_PARSE_ERROR)
|
if (tree == NULL)
|
||||||
cmdq_append(c, cmdq_get_callback(control_error, error));
|
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);
|
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);
|
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;
|
int count = menu->count, old = md->choice;
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
const struct menu_item *item;
|
const struct menu_item *item;
|
||||||
|
struct cmd_parse_tree *tree;
|
||||||
|
struct cmdq_item *new_item;
|
||||||
struct cmdq_state *state;
|
struct cmdq_state *state;
|
||||||
#if 0 /* XXX: command parser conversion */
|
|
||||||
enum cmd_parse_status status;
|
|
||||||
#endif
|
|
||||||
char *error;
|
char *error;
|
||||||
|
|
||||||
if (KEYC_IS_MOUSE(event->key)) {
|
if (KEYC_IS_MOUSE(event->key)) {
|
||||||
@@ -498,18 +497,15 @@ chosen:
|
|||||||
else
|
else
|
||||||
event = NULL;
|
event = NULL;
|
||||||
state = cmdq_new_state(&md->fs, event, 0);
|
state = cmdq_new_state(&md->fs, event, 0);
|
||||||
|
tree = cmd_parse_from_string(item->command, NULL, &error);
|
||||||
#if 0 /* XXX: command parser conversion */
|
if (tree == NULL) {
|
||||||
status = cmd_parse_and_append(item->command, NULL, c, state, &error);
|
|
||||||
if (status == CMD_PARSE_ERROR) {
|
|
||||||
cmdq_append(c, cmdq_get_error(error));
|
cmdq_append(c, cmdq_get_error(error));
|
||||||
free(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);
|
cmdq_free_state(state);
|
||||||
|
|
||||||
return (1);
|
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,
|
mode_tree_run_command(struct client *c, struct cmd_find_state *fs,
|
||||||
const char *template, const char *name)
|
const char *template, const char *name)
|
||||||
{
|
{
|
||||||
|
struct cmd_parse_tree *tree;
|
||||||
|
struct cmdq_item *new_item;
|
||||||
struct cmdq_state *state;
|
struct cmdq_state *state;
|
||||||
char *command, *error;
|
char *command, *error;
|
||||||
#if 0 /* XXX: command parser conversion */
|
|
||||||
enum cmd_parse_status status;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
command = cmd_template_replace(template, name, 1);
|
command = cmd_template_replace(template, name, 1);
|
||||||
if (command != NULL && *command != '\0') {
|
if (command != NULL && *command != '\0') {
|
||||||
state = cmdq_new_state(fs, NULL, 0);
|
state = cmdq_new_state(fs, NULL, 0);
|
||||||
#if 0 /* XXX: command parser conversion */
|
tree = cmd_parse_from_string(command, NULL, &error);
|
||||||
status = cmd_parse_and_append(command, NULL, c, state, &error);
|
if (tree == NULL) {
|
||||||
if (status == CMD_PARSE_ERROR) {
|
|
||||||
if (c != NULL) {
|
if (c != NULL) {
|
||||||
*error = toupper((u_char)*error);
|
*error = toupper((u_char)*error);
|
||||||
status_message_set(c, -1, 1, 0, 0, "%s", error);
|
status_message_set(c, -1, 1, 0, 0, "%s", error);
|
||||||
}
|
}
|
||||||
free(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);
|
cmdq_free_state(state);
|
||||||
}
|
}
|
||||||
free(command);
|
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_entry *o;
|
||||||
struct options_array_item *a;
|
struct options_array_item *a;
|
||||||
struct cmd_parse_tree *tree;
|
struct cmd_parse_tree *tree;
|
||||||
|
const char *value;
|
||||||
|
char *cause;
|
||||||
|
|
||||||
log_debug("%s: inserting hook %s", __func__, ne->name);
|
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);
|
cmdq_add_formats(state, ne->formats);
|
||||||
|
|
||||||
if (*ne->name == '@') {
|
if (*ne->name == '@') {
|
||||||
#if 0 /* XXX: command parser conversion */
|
|
||||||
struct cmd_parse_result *pr;
|
|
||||||
const char *value;
|
|
||||||
|
|
||||||
value = options_get_string(oo, ne->name);
|
value = options_get_string(oo, ne->name);
|
||||||
pr = cmd_parse_from_string(value, NULL);
|
tree = cmd_parse_from_string(value, NULL, &cause);
|
||||||
switch (pr->status) {
|
if (tree == NULL) {
|
||||||
case CMD_PARSE_ERROR:
|
|
||||||
log_debug("%s: can't parse hook %s: %s", __func__,
|
log_debug("%s: can't parse hook %s: %s", __func__,
|
||||||
ne->name, pr->error);
|
ne->name, cause);
|
||||||
free(pr->error);
|
free(cause);
|
||||||
break;
|
} else {
|
||||||
case CMD_PARSE_SUCCESS:
|
item = notify_insert_one_hook(item, ne, tree, state);
|
||||||
notify_insert_one_hook(item, ne, pr->cmdlist, state);
|
cmd_parse_free(tree);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
log_debug("%s: command parser conversion not done for hook %s",
|
|
||||||
__func__, ne->name);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
a = options_array_first(o);
|
a = options_array_first(o);
|
||||||
while (a != NULL) {
|
while (a != NULL) {
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ window_customize_build_keys(struct window_customize_modedata *data,
|
|||||||
expanded, NULL, 0);
|
expanded, NULL, 0);
|
||||||
free(expanded);
|
free(expanded);
|
||||||
|
|
||||||
tmp = cmd_parse_print(bd->cmd); /* XXX: command parser conversion */
|
tmp = cmd_parse_print(bd->cmd);
|
||||||
xasprintf(&text, "#[ignore]%s", tmp);
|
xasprintf(&text, "#[ignore]%s", tmp);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
mti = mode_tree_add(data->data, child, item,
|
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)
|
if (s->cy >= cy + sy - 1)
|
||||||
return;
|
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,
|
if (!screen_write_text(ctx, cx, sx, sy - (s->cy - cy), 0,
|
||||||
&grid_default_cell, "Command: %s", cmd)) {
|
&grid_default_cell, "Command: %s", cmd)) {
|
||||||
free(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_itemdata *item = itemdata;
|
||||||
struct window_customize_modedata *data = item->data;
|
struct window_customize_modedata *data = item->data;
|
||||||
struct key_binding *bd;
|
struct key_binding *bd;
|
||||||
|
struct cmd_parse_tree *tree;
|
||||||
char *error;
|
char *error;
|
||||||
|
|
||||||
if (s == NULL || *s == '\0' || data->dead)
|
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))
|
if (item == NULL || !window_customize_get_key(item, NULL, &bd))
|
||||||
return (PROMPT_CLOSE);
|
return (PROMPT_CLOSE);
|
||||||
|
|
||||||
#if 0 /* XXX: command parser conversion */
|
tree = cmd_parse_from_string(s, NULL, &error);
|
||||||
struct cmd_parse_result *pr;
|
if (tree == NULL)
|
||||||
|
|
||||||
pr = cmd_parse_from_string(s, NULL);
|
|
||||||
switch (pr->status) {
|
|
||||||
case CMD_PARSE_ERROR:
|
|
||||||
error = pr->error;
|
|
||||||
goto fail;
|
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_build(data->data);
|
||||||
mode_tree_draw(data->data);
|
mode_tree_draw(data->data);
|
||||||
data->wp->flags |= PANE_REDRAW;
|
data->wp->flags |= PANE_REDRAW;
|
||||||
#else
|
|
||||||
error = xstrdup("XXX: command parser conversion not done for customize");
|
|
||||||
goto fail;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return (PROMPT_CLOSE);
|
return (PROMPT_CLOSE);
|
||||||
|
|
||||||
@@ -1298,7 +1287,7 @@ window_customize_set_key(struct client *c,
|
|||||||
bd->flags ^= KEY_BINDING_REPEAT;
|
bd->flags ^= KEY_BINDING_REPEAT;
|
||||||
else if (strcmp(s, "Command") == 0) {
|
else if (strcmp(s, "Command") == 0) {
|
||||||
xasprintf(&prompt, "(%s) ", key_string_lookup_key(key, 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 = xcalloc(1, sizeof *new_item);
|
||||||
new_item->data = data;
|
new_item->data = data;
|
||||||
@@ -1360,7 +1349,7 @@ window_customize_reset_key(struct window_customize_modedata *data,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
dd = key_bindings_get_default(kt, bd->key);
|
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;
|
return;
|
||||||
if (dd == NULL && item == mode_tree_get_current(data->data)) {
|
if (dd == NULL && item == mode_tree_get_current(data->data)) {
|
||||||
mode_tree_collapse_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 cmd_find_state fs;
|
||||||
struct session *s;
|
struct session *s;
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
|
struct cmd_parse_tree *tree;
|
||||||
|
struct cmdq_item *new_item;
|
||||||
char *target = NULL;
|
char *target = NULL;
|
||||||
struct cmdq_state *state;
|
struct cmdq_state *state;
|
||||||
char *command, *error;
|
char *command, *error;
|
||||||
#if 0 /* XXX: command parser conversion */
|
|
||||||
enum cmd_parse_status status;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (data->matches_size == 0)
|
if (data->matches_size == 0)
|
||||||
return (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);
|
command = cmd_template_replace(data->command, target, 1);
|
||||||
if (command != NULL && *command != '\0') {
|
if (command != NULL && *command != '\0') {
|
||||||
state = cmdq_new_state(&fs, NULL, 0);
|
state = cmdq_new_state(&fs, NULL, 0);
|
||||||
#if 0 /* XXX: command parser conversion */
|
tree = cmd_parse_from_string(command, NULL, &error);
|
||||||
status = cmd_parse_and_append(command, NULL, c, state, &error);
|
if (tree == NULL) {
|
||||||
if (status == CMD_PARSE_ERROR) {
|
|
||||||
if (c != NULL) {
|
if (c != NULL) {
|
||||||
*error = toupper((u_char)*error);
|
*error = toupper((u_char)*error);
|
||||||
status_message_set(c, -1, 1, 0, 0, "%s", error);
|
status_message_set(c, -1, 1, 0, 0, "%s", error);
|
||||||
}
|
}
|
||||||
free(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);
|
cmdq_free_state(state);
|
||||||
}
|
}
|
||||||
free(command);
|
free(command);
|
||||||
|
|||||||
Reference in New Issue
Block a user