enum tty_cmd is only used as an index into the array of command function

pointers, so remove it and use the function pointers directly to represent
themselves.
This commit is contained in:
Nicholas Marriott
2009-07-22 18:02:23 +00:00
parent 6a309c53a8
commit 2ec2837daa
4 changed files with 89 additions and 134 deletions

46
tty.c
View File

@ -38,39 +38,10 @@ void tty_attributes(struct tty *, const struct grid_cell *);
void tty_attributes_fg(struct tty *, const struct grid_cell *);
void tty_attributes_bg(struct tty *, const struct grid_cell *);
void tty_cmd_alignmenttest(struct tty *, struct tty_ctx *);
void tty_cmd_cell(struct tty *, struct tty_ctx *);
void tty_cmd_clearendofline(struct tty *, struct tty_ctx *);
void tty_cmd_clearendofscreen(struct tty *, struct tty_ctx *);
void tty_cmd_clearline(struct tty *, struct tty_ctx *);
void tty_cmd_clearscreen(struct tty *, struct tty_ctx *);
void tty_cmd_clearstartofline(struct tty *, struct tty_ctx *);
void tty_cmd_clearstartofscreen(struct tty *, struct tty_ctx *);
void tty_cmd_deletecharacter(struct tty *, struct tty_ctx *);
void tty_cmd_deleteline(struct tty *, struct tty_ctx *);
void tty_cmd_insertcharacter(struct tty *, struct tty_ctx *);
void tty_cmd_insertline(struct tty *, struct tty_ctx *);
void tty_cmd_linefeed(struct tty *, struct tty_ctx *);
void tty_cmd_utf8character(struct tty *, struct tty_ctx *);
void tty_cmd_reverseindex(struct tty *, struct tty_ctx *);
void (*tty_cmds[])(struct tty *, struct tty_ctx *) = {
tty_cmd_alignmenttest,
tty_cmd_cell,
tty_cmd_clearendofline,
tty_cmd_clearendofscreen,
tty_cmd_clearline,
tty_cmd_clearscreen,
tty_cmd_clearstartofline,
tty_cmd_clearstartofscreen,
tty_cmd_deletecharacter,
tty_cmd_deleteline,
tty_cmd_insertcharacter,
tty_cmd_insertline,
tty_cmd_linefeed,
tty_cmd_utf8character,
tty_cmd_reverseindex,
};
void tty_emulate_repeat(
struct tty *, enum tty_code_code, enum tty_code_code, u_int);
void tty_cell(struct tty *,
const struct grid_cell *, const struct grid_utf8 *);
void
tty_init(struct tty *tty, char *path, char *term)
@ -544,15 +515,6 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
}
}
void
tty_write(struct tty *tty, enum tty_cmd cmd, struct tty_ctx *ctx)
{
if (tty->flags & TTY_FREEZE || tty->term == NULL)
return;
if (tty_cmds[cmd] != NULL)
tty_cmds[cmd](tty, ctx);
}
void
tty_cmd_insertcharacter(struct tty *tty, struct tty_ctx *ctx)
{