From d6e68ce761eff460e11f7a749001162e4f8967f0 Mon Sep 17 00:00:00 2001 From: true Date: Wed, 6 Nov 2024 22:03:59 -0800 Subject: [PATCH] initial command shell implementation almost all commands are not yet implemented. actual communication hooks are not yet implemented. --- gat_stand_fw/user/console/commands/about.h | 33 + gat_stand_fw/user/console/commands/cls.h | 25 + gat_stand_fw/user/console/commands/help.h | 65 + gat_stand_fw/user/console/console.c | 271 ++ gat_stand_fw/user/console/console.h | 64 + .../user/console/ntshell/core/ntconf.h | 52 + .../user/console/ntshell/core/ntint.h | 55 + .../user/console/ntshell/core/ntlibc.c | 254 ++ .../user/console/ntshell/core/ntlibc.h | 60 + .../user/console/ntshell/core/ntshell.c | 683 ++++ .../user/console/ntshell/core/ntshell.h | 94 + .../user/console/ntshell/core/text_editor.c | 250 ++ .../user/console/ntshell/core/text_editor.h | 74 + .../user/console/ntshell/core/text_history.c | 170 + .../user/console/ntshell/core/text_history.h | 84 + .../user/console/ntshell/core/vtrecv.c | 2823 +++++++++++++++++ .../user/console/ntshell/core/vtrecv.h | 130 + .../user/console/ntshell/core/vtsend.c | 270 ++ .../user/console/ntshell/core/vtsend.h | 92 + .../user/console/ntshell/util/ntopt.c | 156 + .../user/console/ntshell/util/ntopt.h | 70 + .../user/console/ntshell/util/ntstdio.c | 364 +++ .../user/console/ntshell/util/ntstdio.h | 82 + gat_stand_fw/user/main.c | 12 +- gat_stand_fw/user/periph/rgbled.c | 2 +- gat_stand_fw/user/version.h | 17 + 26 files changed, 6250 insertions(+), 2 deletions(-) create mode 100644 gat_stand_fw/user/console/commands/about.h create mode 100644 gat_stand_fw/user/console/commands/cls.h create mode 100644 gat_stand_fw/user/console/commands/help.h create mode 100644 gat_stand_fw/user/console/console.c create mode 100644 gat_stand_fw/user/console/console.h create mode 100644 gat_stand_fw/user/console/ntshell/core/ntconf.h create mode 100644 gat_stand_fw/user/console/ntshell/core/ntint.h create mode 100644 gat_stand_fw/user/console/ntshell/core/ntlibc.c create mode 100644 gat_stand_fw/user/console/ntshell/core/ntlibc.h create mode 100644 gat_stand_fw/user/console/ntshell/core/ntshell.c create mode 100644 gat_stand_fw/user/console/ntshell/core/ntshell.h create mode 100644 gat_stand_fw/user/console/ntshell/core/text_editor.c create mode 100644 gat_stand_fw/user/console/ntshell/core/text_editor.h create mode 100644 gat_stand_fw/user/console/ntshell/core/text_history.c create mode 100644 gat_stand_fw/user/console/ntshell/core/text_history.h create mode 100644 gat_stand_fw/user/console/ntshell/core/vtrecv.c create mode 100644 gat_stand_fw/user/console/ntshell/core/vtrecv.h create mode 100644 gat_stand_fw/user/console/ntshell/core/vtsend.c create mode 100644 gat_stand_fw/user/console/ntshell/core/vtsend.h create mode 100644 gat_stand_fw/user/console/ntshell/util/ntopt.c create mode 100644 gat_stand_fw/user/console/ntshell/util/ntopt.h create mode 100644 gat_stand_fw/user/console/ntshell/util/ntstdio.c create mode 100644 gat_stand_fw/user/console/ntshell/util/ntstdio.h create mode 100644 gat_stand_fw/user/version.h diff --git a/gat_stand_fw/user/console/commands/about.h b/gat_stand_fw/user/console/commands/about.h new file mode 100644 index 0000000..1d6b14c --- /dev/null +++ b/gat_stand_fw/user/console/commands/about.h @@ -0,0 +1,33 @@ +/* + * cons_about.h + * + * Created on: Nov 6, 2024 + * Author: true + */ + +#ifndef USER_SHELL_COMMANDS_ABOUT_H_ +#define USER_SHELL_COMMANDS_ABOUT_H_ + + + +static const char about[] = "true's GAT Stand\n" + "a device for displaying badge addons\n" + "compatible with GAT, SAOv1, SAOv1.69bis standards\n\n" + "code and hardware design by true\n" + "manual and info at https://basic.truecontrol.org\n\n"; + + + +void cons_about(int argc, char **argv) +{ + if (!argc) { + CONS_PRINT("...just do it."); + return; + } + + CONS_PRINT(about); +} + + + +#endif /* USER_SHELL_COMMANDS_ABOUT_H_ */ diff --git a/gat_stand_fw/user/console/commands/cls.h b/gat_stand_fw/user/console/commands/cls.h new file mode 100644 index 0000000..35b4150 --- /dev/null +++ b/gat_stand_fw/user/console/commands/cls.h @@ -0,0 +1,25 @@ +/* + * cons_cls.h + * + * Created on: Nov 6, 2024 + * Author: true + */ + +#ifndef USER_SHELL_COMMANDS_CLS_H_ +#define USER_SHELL_COMMANDS_CLS_H_ + + + +void cons_cls(int argc, char **argv) +{ + if (!argc) { + CONS_PRINT("...clears the screen. just try it."); + return; + } + + CONS_PRINT("\x1B[2J\x1B[0;0H"); +} + + + +#endif /* USER_SHELL_COMMANDS_CLS_H_ */ diff --git a/gat_stand_fw/user/console/commands/help.h b/gat_stand_fw/user/console/commands/help.h new file mode 100644 index 0000000..0c68432 --- /dev/null +++ b/gat_stand_fw/user/console/commands/help.h @@ -0,0 +1,65 @@ +/* + * cons_help.h + * + * Created on: Nov 6, 2024 + * Author: true + */ + +#ifndef USER_SHELL_COMMANDS_HELP_H_ +#define USER_SHELL_COMMANDS_HELP_H_ + + + +void cons_help_real(int argc, char **argv, command_table_t *p) +{ + int i; + + if (argc < 2) { + // print help list + if ((shell_flags & 0x02) == 0) { + CONS_PRINT("Tip: You only need to use the first two characters "); + CONS_PRINT("of a command.\r\n\r\n"); + shell_flags |= 0x02; + } + + while (p->cmd != 0) { + if (strlen(p->desc)) { + strcpy( console_line, "* "); + strncat(console_line, p->cmd, 12); + for (i = strlen(console_line); i <= 12; i++) { + console_line[i] = 0x20; + } + console_line[i] = 0x00; + strncat(console_line, p->desc, 77); + strncat(console_line, "\r\n", 79); + console_line[63] = 0; + CONS_PRINT(console_line); + } + p++; + } + } else { + while (p->cmd != 0) { + // calling the callback with argc/argv set to 0 should instruct it to print help/usage + if (strcmp(argv[1], p->cmd) == 0) { + p->go(0, (char **)0); + return; + } + p++; + } + + // looks like the command wasn't found + strcpy( console_line, "* no help found for command called '"); + strncat(console_line, argv[1], 60); + strncat(console_line, "'\r\n", 62); + CONS_PRINT(console_line); + } +} + +void cons_help(int argc, char **argv) +{ + cons_help_real(argc, argv, (command_table_t *)console_cmdlist); +} + + + +#endif /* USER_SHELL_COMMANDS_HELP_H_ */ diff --git a/gat_stand_fw/user/console/console.c b/gat_stand_fw/user/console/console.c new file mode 100644 index 0000000..67825b7 --- /dev/null +++ b/gat_stand_fw/user/console/console.c @@ -0,0 +1,271 @@ +/* + * console.c + * + * Created on: Nov 6, 2024 + * Author: true + */ + +#include "console.h" + +#include +#include + +#include "version.h" + + + +// console +ntshell_t ntshell; +text_history_t ntshell_history; +char ntshell_prompt_old[32]; +static uint16_t shell_flags; + +static int (*console_puts)(char *buf, int cnt); +static int (*console_gets)(char *buf, int cnt); + + +// console commands +#include "commands/about.h" +#include "commands/cls.h" + +void cons_help(int argc, char **argv); + + +// console command table +static const command_table_t console_cmdlist[] = { + {"-", 0, "General Commands", 0x00, 0}, + {"help", "", "prints this text. for command help, try help ", 0x00, cons_help}, + {"?", 0, 0, 0x00, cons_help}, + {"save", 0, "commits data to nvram", 0x00, 0}, + {"clear", 0, "clears the screen", 0x00, cons_cls}, + {"ver", 0, "prints firmware version number", 0x00, 0}, + {"about", 0, "prints info about this product", 0x00, cons_about}, + + {"-", 0, "I2C Commands", 0x00, 0}, + {"scan", 0, "scans i2c bus for responding slaves", 0x00, 0}, + {"read", " ", "reads from I2C slave", 0x00, 0}, + {"write", " ", "writes to I2C slave", 0x00, 0}, + + {"-", 0, "Clock Commands", 0x00, 0}, + {"time", "[hhmmss]", "prints current time. if time is provided, sets the time.", 0x00, 0}, + {"auto", "[on/off", "enables or disables all automatic schedules.", 0x00, 0}, + {"calendar", "[id] [on/off] [hhmmss]", "prints an auto schedule. if values set, sets a schedule.", 0x00, 0}, + + {"-", 0, "Light Level Commands", 0x00, 0}, + {"light", 0, "prints the detected light level", 0x00, 0}, + {"day", "[new-day-thresh]", "prints bright (on) threshold. if value set, sets threshold.", 0x00, 0}, + {"night", "[new-day-thresh]", "prints dark (off) threshold. if value set, sets threshold.", 0x00, 0}, +}; +command_table_t *ctbl; +command_table_t *ctbl_prev; + + +// help needs to reference the command table +#include "commands/help.h" + + +// additional +char console_line[256]; + +// hijack serial for custom text parsing +// todo: is this required anymore? wtf does it do? +ntshell_t hijack; + + +// ntshell handlers +static int console_read(char *buf, int cnt, void *extobj) +{ + if (console_gets != 0) + return console_gets(buf, cnt); + + return 0; +} + +int console_write(const char *buf, int cnt, void *extobj) +{ + if (console_puts != 0) { + console_puts((char *)buf, cnt); + return cnt; + } + + return 0; +} + +static int console_ntopt_cb(int argc, char **argv, void *extobj) +{ + // ntshell_t *ntshell = (ntshell_t *)extobj; + char cmd[2][4]; + command_table_t *p; + + if (argc == 0) { + return 0; + } + + cmd[0][2] = cmd[1][2] = 0; + strncpy(cmd[0], argv[0], 2); + + for (p = ctbl; p->cmd != NULL; p++) { + strncpy(cmd[1], p->cmd, 2); + if ((strcmp(cmd[0], cmd[1]) == 0) && (strlen(argv[0]) <= strlen(p->cmd))) { + p->go(argc, argv); + return 0; + } + } + + sprintf(console_line, "* '%s': ", argv[0]); + CONS_PRINT(console_line); + CONS_PRINT("command not found\r\n"); + return -1; +} + +static int console_cb(const char *text, void *extobj) +{ + // ntshell_t *ntshell = (ntshell_t *)extobj; + + if ((shell_flags & 0x01) == 0) { + sprintf(console_line, "trueControl GAT Stand, version %s\r\n", FW_VERSION); + CONS_PRINT(console_line); + CONS_PRINT("Use 'help' or '?' for the command list.\r\n"); + shell_flags |= 0x01; + return 0; + } + + if (strlen(text) > 0) { + return ntopt_parse(text, console_ntopt_cb, extobj); + } + + return 0; +} + + +// setup +void console_init() +{ + // set up command table pointer + ctbl = (command_table_t *)console_cmdlist; + + // set up the shell + ntshell_init( + &ntshell, + console_read, + console_write, + console_cb, + &ntshell_history, + (void *)&hijack); + + ntshell_set_prompt(&ntshell, CONS_PROMPT_DEFAULT); + // ntshell_execute(&ntshell); + + // set up the hijacker + ntshell_init( + &hijack, + console_read, + console_write, + NULL, + 0, + (void *)&ntshell); + ntshell_set_prompt(&hijack, ""); +} + +void console_set_puts(int (*puts)(char *buf, int cnt)) +{ + console_puts = puts; +} + +void console_set_gets(int (*gets)(char *buf, int cnt)) +{ + console_gets = gets; +} + +void console_start() +{ + ntshell_execute_start(&ntshell); +} + +void console_stop() +{ + shell_flags = 0; +} + +void console_process() +{ + ntshell_execute_process(hijack.func_callback ? &hijack : &ntshell); +} + +void console_hijack(int (*cb)(const char *text, void *extobj)) +{ + if (cb) { + // we are in the middle of processing our old shell, and we don't + // want to show the prompt. so back it up and unset it + // before enabling the hijack + strncpy(ntshell_prompt_old, ntshell.prompt, 15); + strcpy(ntshell.prompt, ""); + hijack.func_callback = cb; + return; + } + + // we're done, so recover our shell prompt and print it + hijack.func_callback = 0; + strncpy(ntshell.prompt, ntshell_prompt_old, 15); + CONS_PRINT("\r\n"); + CONS_PRINT(ntshell.prompt); +} + +/* +void console_cmd_credits(int argc, char **argv) +{ + if (!argc) { + CONS_PRINT("Just run the command."); + return; + } + + console_cmd_clear_screen(1, 0); + CONS_PRINT(" It seems you have a badge with our name on it. We are the"); + CONS_PRINT("\x1B[3;20H\x1B[01mWHISKEY PIRATE CREW\x1b[00m"); + CONS_PRINT("\x1B[5;18HBooze. Badges. Bullshit.\r\n"); +} + +void console_cmd_clear_screen(int argc, char **argv) +{ + if (!argc) { + CONS_PRINT("..."); + return; + } + + CONS_PRINT("\x1B[2J\x1B[0;0H"); +} + +void console_settings_save() +{ + CONS_PRINT("Saving settings..."); + CONS_PRINT("done.\r\n"); +} + +void console_cmd_save(int argc, char **argv) +{ + if (!argc) { + CONS_PRINT("Saves settings to flash. Run the 'save' command for arguments."); + } + + if (argc == 1) { + CONS_PRINT("Usage: save +#include + +// pirate tools +#include "ntshell/core/ntshell.h" +#include "ntshell/util/ntstdio.h" +#include "ntshell/util/ntopt.h" + + +#define CONS_PROMPT_DEFAULT "\r\ngat> " +#define CONS_PRINT(s) console_write(s, strlen(s), 0) + + +/* struct */ +typedef struct { + char *cmd; + char *usage; + char *desc; + uint8_t flags; + void (*go)(int argc, char **argv); + void (*help)(void); +} command_table_t; + + +/* extern variables */ +extern ntshell_t ntshell; +extern ntshell_t hijack; + +extern command_table_t *ctbl; +extern command_table_t *ctbl_prev; + +extern char console_line[256]; + + + +/* console prototypes */ +void console_init(); + +void console_set_puts(int (*puts)(char *buf, int cnt)); +void console_set_gets(int (*gets)(char *buf, int cnt)); + +void console_start(); +void console_stop(); +void console_process(); +void console_wait(); + +int console_write(const char *buf, int cnt, void *extobj); + + +/* hijack the console for per-line input handling */ +void console_hijack(int (*cb)(const char *text, void *extobj)); + + + +#endif /* USER_SHELL_CONSOLE_H_ */ diff --git a/gat_stand_fw/user/console/ntshell/core/ntconf.h b/gat_stand_fw/user/console/ntshell/core/ntconf.h new file mode 100644 index 0000000..35d79f4 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/ntconf.h @@ -0,0 +1,52 @@ +/** + * @file ntconf.h + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef NTCONF_H +#define NTCONF_H + +/** + * @note + * This file provides internal definitions for inner modules. + */ + +/** + * @brief Maximum length for the editor module. + */ +#define NTCONF_EDITOR_MAXLEN (250) + +/** + * @brief Maximum depth for the history module. + */ +#define NTCONF_HISTORY_DEPTH (20) + +#endif + diff --git a/gat_stand_fw/user/console/ntshell/core/ntint.h b/gat_stand_fw/user/console/ntshell/core/ntint.h new file mode 100644 index 0000000..86f0516 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/ntint.h @@ -0,0 +1,55 @@ +/** + * @file ntint.h + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef NTINT_H +#define NTINT_H + +/** + * @note + * This file provides integer definitions. + * You can use #include if your tool chain have the header. + */ + +#if 1 +# include +#else + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + typedef char int8_t; + typedef short int16_t; + typedef int int32_t; + typedef unsigned int size_t; +#endif + +#endif + diff --git a/gat_stand_fw/user/console/ntshell/core/ntlibc.c b/gat_stand_fw/user/console/ntshell/core/ntlibc.c new file mode 100644 index 0000000..a39c3ab --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/ntlibc.c @@ -0,0 +1,254 @@ +/** + * @file ntlibc.c + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "ntlibc.h" + +int ntlibc_strlen(const char *s) +{ + const char *p = s; + int cnt = 0; + while (*p) { + cnt++; + p++; + } + return cnt; +} + +char *ntlibc_strcpy(char *des, const char *src) +{ + char *d = des; + const char *s = src; + while (*s) { + *d = *s; + d++; + s++; + } + *d = '\0'; + return des; +} + +char *ntlibc_strcat(char *des, const char *src) +{ + char *d = des; + const char *s = src; + while (*d) { + d++; + } + while (*s) { + *d = *s; + d++; + s++; + } + *d = '\0'; + return des; +} + +int ntlibc_strcmp(const char *s1, const char *s2) +{ + char *p1 = (char *)s1; + char *p2 = (char *)s2; + while (*p1 || *p2) { + if (*p1 != *p2) { + return (*p1 < *p2) ? -1 : 1; + } + p1++; + p2++; + } + if (*p1 == *p2) { + return 0; + } else { + return (*p1 < *p2) ? -1 : 1; + } +} + +int ntlibc_stricmp(const char *s1, const char *s2) +{ + char *p1 = (char *)s1; + char *p2 = (char *)s2; + while (*p1 || *p2) { + if (ntlibc_toupper(*p1) != ntlibc_toupper(*p2)) { + return (*p1 < *p2) ? -1 : 1; + } + p1++; + p2++; + } + if (*p1 == *p2) { + return 0; + } else { + return (*p1 < *p2) ? -1 : 1; + } +} + +int ntlibc_strncmp(const char *s1, const char *s2, int n) +{ + char *p1 = (char *)s1; + char *p2 = (char *)s2; + int len = 0; + while (*p1 || *p2) { + if (n <= len) { + break; + } + if (*p1 != *p2) { + return (*p1 < *p2) ? -1 : 1; + } + p1++; + p2++; + len++; + } + return 0; +} + +int ntlibc_isdigit(int c) +{ + if (('0' <= c) && (c <= '9')) { + return 1; + } + return 0; +} + +int ntlibc_isalpha(int c) +{ + if (('A' <= c) && (c <= 'Z')) { + return 1; + } + if (('a' <= c) && (c <= 'z')) { + return 1; + } + return 0; +} + +int ntlibc_iscntrl(int c) +{ + if (c == 0x07) { return 0; } + if (c == 0x08) { return 0; } + if (c == 0x09) { return 0; } + if (c == 0x0a) { return 0; } + if (c == 0x0b) { return 0; } + if (c == 0x0c) { return 0; } + if (c == 0x0d) { return 0; } + if ((0x00 <= c) && (c <= 0x1f)) { + return 1; + } + return 0; +} + +int ntlibc_toupper(int c) +{ + if (('a' <= c) && (c <= 'z')) { + int diff = 'a' - 'A'; + return c - diff; + } + return c; +} + +int ntlibc_tolower(int c) +{ + if (('A' <= c) && (c <= 'Z')) { + int diff = 'a' - 'A'; + return c + diff; + } + return c; +} + +int ntlibc_atoi(const char *nptr) +{ + int cnt; + int num = 0; + int ofs = 0; + int sign = 0; + int scnt = 0; + char *p = (char *)nptr; + while (*p != '\0') { + if (!ntlibc_isdigit(*p)) { + if (*p == ' ') { + ofs++; + } + if (*p == '+') { + sign = 0; + ofs++; + if (scnt++ > 0) { + return 0; + } + } + if (*p == '-') { + sign = 1; + ofs++; + if (scnt++ > 0) { + return 0; + } + } + } + p++; + } + for (cnt = ofs; (nptr[cnt] >= '0') && (nptr[cnt] <= '9'); cnt++) { + num = 10 * num + (nptr[cnt] - '0'); + } + if (sign) { + return -num; + } else { + return num; + } +} + +char *ntlibc_strchr(const char *s, int c) +{ + char *p = (char *)s; + while (*p) { + if (*p == c) { + return p; + } + p++; + } + return 0; +} + +char *ntlibc_utoa(unsigned int value, char *s, int radix) +{ + char *s1 = s; + char *s2 = s; + + do { + *s2++ = "0123456789abcdefghijklmnopqrstuvwxyz"[value % radix]; + value /= radix; + } while (value > 0); + + *s2-- = '\0'; + + while (s1 < s2) { + char c = *s1; + *s1++ = *s2; + *s2-- = c; + } + + return s; +} + diff --git a/gat_stand_fw/user/console/ntshell/core/ntlibc.h b/gat_stand_fw/user/console/ntshell/core/ntlibc.h new file mode 100644 index 0000000..b528e70 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/ntlibc.h @@ -0,0 +1,60 @@ +/** + * @file ntlibc.h + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef NTLIBC_H +#define NTLIBC_H + +#ifdef __cplusplus +extern "C" { +#endif + +int ntlibc_strlen(const char *s); +char *ntlibc_strcpy(char *des, const char *src); +char *ntlibc_strcat(char *des, const char *src); +int ntlibc_strcmp(const char *s1, const char *s2); +int ntlibc_stricmp(const char *s1, const char *s2); +int ntlibc_strncmp(const char *s1, const char *s2, int n); +int ntlibc_isdigit(int c); +int ntlibc_isalpha(int c); +int ntlibc_iscntrl(int c); +int ntlibc_toupper(int c); +int ntlibc_tolower(int c); +int ntlibc_atoi(const char *nptr); +char *ntlibc_strchr(const char *s, int c); +char *ntlibc_utoa(unsigned int value, char *s, int radix); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/gat_stand_fw/user/console/ntshell/core/ntshell.c b/gat_stand_fw/user/console/ntshell/core/ntshell.c new file mode 100644 index 0000000..ccaf420 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/ntshell.c @@ -0,0 +1,683 @@ +/** + * @file ntshell.c + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "ntshell.h" +#include "ntlibc.h" + +#define VERSION_MAJOR (0) /**< Major number. */ +#define VERSION_MINOR (2) /**< Minor number. */ +#define VERSION_RELEASE (0) /**< Release number. */ + +/** + * @brief Initialization code. + */ +#define INITCODE (0x4367) + +/** + * @brief Unused variable wrapper. + * + * @param N A variable. + */ +#define UNUSED_VARIABLE(N) do { (void)(N); } while (0) + +/** + * @brief Index number of the suggestion. + * + * @param HANDLE A pointer of the handle. + */ +#define SUGGEST_INDEX(HANDLE) ((HANDLE)->suggest_index) + +/** + * @brief Source text string of the suggestion. + * + * @param HANDLE A pointer of the handle. + */ +#define SUGGEST_SOURCE(HANDLE) ((HANDLE)->suggest_source) + +/** + * @brief Get the text editor. + * + * @param HANDLE A pointer of the handle. + */ +#define GET_EDITOR(HANDLE) (&((HANDLE)->editor)) + +/** + * @brief Get the text history. + * + * @param HANDLE A pointer of the handle. + */ +#define GET_HISTORY(HANDLE) (((HANDLE)->history)) + +/** + * @brief Read from the serial port. + * + * @param HANDLE A pointer of the handle. + * @param BUF A pointer to the buffer. + * @param CNT Read length. + * + * @return The number of bytes read. + */ +#define SERIAL_READ(HANDLE, BUF, CNT) ((HANDLE)->func_read(BUF, CNT, (HANDLE)->extobj)) + +/** + * @brief Write to the serial port. + * + * @param HANDLE A pointer of the handle. + * @param BUF A pointer to the buffer. + * @param CNT Write length. + * + * @return The number of bytes written. + */ +#define SERIAL_WRITE(HANDLE, BUF, CNT) ((HANDLE)->func_write(BUF, CNT, (HANDLE)->extobj)) + +/** + * @brief Write the prompt to the serial port. + * + * @param HANDLE A pointer of the handle. + */ +#define PROMPT_WRITE(HANDLE) SERIAL_WRITE((HANDLE), (HANDLE)->prompt, ntlibc_strlen((HANDLE)->prompt)) + +/** + * @brief Write the newline to the serial port. + * + * @param HANDLE A pointer of the handle. + */ +#define PROMPT_NEWLINE(HANDLE) SERIAL_WRITE((HANDLE), NTSHELL_PROMPT_NEWLINE, ntlibc_strlen(NTSHELL_PROMPT_NEWLINE)) + +/** + * @brief Call the user callback function. + * + * @param HANDLE A pointer of the handle. + * @param TEXT A text string for the callback function. + */ +#define CALLBACK(HANDLE, TEXT) ((HANDLE)->func_callback((TEXT), (HANDLE)->extobj)) + +#define VTSEND_ERASE_LINE(HANDLE) (vtsend_erase_line(&((HANDLE)->vtsend))) +#define VTSEND_CURSOR_HEAD(HANDLE) (vtsend_cursor_backward(&((HANDLE)->vtsend), 80)) +#define VTSEND_CURSOR_PREV(HANDLE) (vtsend_cursor_backward(&((HANDLE)->vtsend), 1)) +#define VTSEND_CURSOR_NEXT(HANDLE) (vtsend_cursor_forward(&((HANDLE)->vtsend), 1)) + +/** + * @brief Search a previous input text on the history module. + * @details This function change the state of the logical text editor and the view. + * + * @param ntshell A handler of the NT-Shell. + * @param action An action. + * @param ch A input character. + */ +static void actfunc_history_prev(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch) +{ + UNUSED_VARIABLE(action); + UNUSED_VARIABLE(ch); + if (text_history_read_point_prev(GET_HISTORY(ntshell))) { + char txt[TEXTHISTORY_MAXLEN]; + int n = text_history_read(GET_HISTORY(ntshell), &txt[0], sizeof(txt)); + if (0 < n) { + VTSEND_ERASE_LINE(ntshell); + VTSEND_CURSOR_HEAD(ntshell); + PROMPT_WRITE(ntshell); + SERIAL_WRITE(ntshell, txt, n); + text_editor_set_text(GET_EDITOR(ntshell), txt); + } + } +} + +/** + * @brief Search a next input text on the history module. + * @details This function change the state of the logical text editor and the view. + * + * @param ntshell A handler of the NT-Shell. + * @param action An action. + * @param ch A input character. + */ +static void actfunc_history_next(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch) +{ + UNUSED_VARIABLE(action); + UNUSED_VARIABLE(ch); + if (text_history_read_point_next(GET_HISTORY(ntshell))) { + char txt[TEXTHISTORY_MAXLEN]; + int n = text_history_read(GET_HISTORY(ntshell), &txt[0], sizeof(txt)); + if (0 < n) { + VTSEND_ERASE_LINE(ntshell); + VTSEND_CURSOR_HEAD(ntshell); + PROMPT_WRITE(ntshell); + SERIAL_WRITE(ntshell, txt, n); + text_editor_set_text(GET_EDITOR(ntshell), txt); + } + } +} + +/** + * @brief Move the cursor to left. + * @details This function change the state of the logical text editor and the view. + * + * @param ntshell A handler of the NT-Shell. + * @param action An action. + * @param ch A input character. + */ +static void actfunc_cursor_left(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch) +{ + UNUSED_VARIABLE(action); + UNUSED_VARIABLE(ch); + if (text_editor_cursor_left(GET_EDITOR(ntshell))) { + VTSEND_CURSOR_PREV(ntshell); + } +} + +/** + * @brief Move the cursor to right. + * @details This function change the state of the logical text editor and the view. + * + * @param ntshell A handler of the NT-Shell. + * @param action An action. + * @param ch A input character. + */ +static void actfunc_cursor_right(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch) +{ + UNUSED_VARIABLE(action); + UNUSED_VARIABLE(ch); + if (text_editor_cursor_right(GET_EDITOR(ntshell))) { + VTSEND_CURSOR_NEXT(ntshell); + } +} + +/** + * @brief Process for the enter action. + * @details This function change the state of the logical text editor and the view. + * + * @param ntshell A handler of the NT-Shell. + * @param action An action. + * @param ch A input character. + */ +static void actfunc_enter(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch) +{ + char txt[TEXTEDITOR_MAXLEN]; + UNUSED_VARIABLE(action); + UNUSED_VARIABLE(ch); + text_editor_get_text(GET_EDITOR(ntshell), &txt[0], sizeof(txt)); + text_editor_clear(GET_EDITOR(ntshell)); + text_history_write(GET_HISTORY(ntshell), txt); + PROMPT_NEWLINE(ntshell); + CALLBACK(ntshell, txt); + PROMPT_WRITE(ntshell); +} + +/** + * @brief Process for the cancel action. + * @details This function change the state of the logical text editor and the view. + * + * @note + * The CTRL+C operation in the general OS uses a signal. + * In this cancel action, It simulate only the view. + * + * @param ntshell A handler of the NT-Shell. + * @param action An action. + * @param ch A input character. + */ +static void actfunc_cancel(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch) +{ + UNUSED_VARIABLE(action); + UNUSED_VARIABLE(ch); + text_editor_clear(GET_EDITOR(ntshell)); + SERIAL_WRITE(ntshell, "^C", 2); + PROMPT_NEWLINE(ntshell); + PROMPT_WRITE(ntshell); +} + +/** + * @brief Process for the insert action. + * @details This function change the state of the logical text editor and the view. + * + * @param ntshell A handler of the NT-Shell. + * @param action An action. + * @param ch A input character. + */ +static void actfunc_insert(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch) +{ + UNUSED_VARIABLE(action); + + /* + * Reject the suggestion index number if an input action occurred. + */ + SUGGEST_INDEX(ntshell) = -1; + + /* + * Insert the input character using the logical text editor. + * Update the view. + */ + if (text_editor_insert(GET_EDITOR(ntshell), ch)) { + char txt[TEXTEDITOR_MAXLEN]; + int len = text_editor_get_text(GET_EDITOR(ntshell), &txt[0], sizeof(txt)); + int pos = text_editor_cursor_get_position(GET_EDITOR(ntshell)); + int n = len - pos; + SERIAL_WRITE(ntshell, (char *)&ch, sizeof(ch)); + if (n > 0) { + int i; + SERIAL_WRITE(ntshell, txt + pos, len - pos); + for (i = 0; i < n; i++) { + VTSEND_CURSOR_PREV(ntshell); + } + } + } +} + +/** + * @brief Process for the backspace action. + * @details This function change the state of the logical text editor and the view. + * + * @param ntshell A handler of the NT-Shell. + * @param action An action. + * @param ch A input character. + */ +static void actfunc_backspace(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch) +{ + UNUSED_VARIABLE(action); + UNUSED_VARIABLE(ch); + if (text_editor_backspace(GET_EDITOR(ntshell))) { + char txt[TEXTEDITOR_MAXLEN]; + int len = text_editor_get_text(GET_EDITOR(ntshell), &txt[0], sizeof(txt)); + int pos = text_editor_cursor_get_position(GET_EDITOR(ntshell)); + int n = len - pos; + VTSEND_CURSOR_PREV(ntshell); + if (n > 0) { + int i; + SERIAL_WRITE(ntshell, txt + pos, n); + SERIAL_WRITE(ntshell, " ", 1); + for (i = 0; i < n + 1; i++) { + VTSEND_CURSOR_PREV(ntshell); + } + } else { + SERIAL_WRITE(ntshell, " ", 1); + VTSEND_CURSOR_PREV(ntshell); + } + } +} + +/** + * @brief Process for the delete action. + * @details This function change the state of the logical text editor and the view. + * + * @param ntshell A handler of the NT-Shell. + * @param action An action. + * @param ch A input character. + */ +static void actfunc_delete(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch) +{ + UNUSED_VARIABLE(action); + UNUSED_VARIABLE(ch); + if (text_editor_delete(GET_EDITOR(ntshell))) { + char txt[TEXTEDITOR_MAXLEN]; + int len = text_editor_get_text(GET_EDITOR(ntshell), &txt[0], sizeof(txt)); + int pos = text_editor_cursor_get_position(GET_EDITOR(ntshell)); + int n = len - pos; + if (n > 0) { + int i; + SERIAL_WRITE(ntshell, txt + pos, n); + SERIAL_WRITE(ntshell, " ", 1); + for (i = 0; i < n + 1; i++) { + VTSEND_CURSOR_PREV(ntshell); + } + } else { + SERIAL_WRITE(ntshell, " ", 1); + VTSEND_CURSOR_PREV(ntshell); + } + } +} + +/** + * @brief Process for the suggestion action. + * @details This function change the state of the logical text editor and the view. + * + * @param ntshell A handler of the NT-Shell. + * @param action An action. + * @param ch A input character. + */ +static void actfunc_suggest(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch) +{ + char buf[TEXTEDITOR_MAXLEN]; + UNUSED_VARIABLE(action); + UNUSED_VARIABLE(ch); + if (SUGGEST_INDEX(ntshell) < 0) { + /* + * Enter the input suggestion mode. + * Get the suggested text string with the current text string. + */ + if (text_editor_get_text( + GET_EDITOR(ntshell), + SUGGEST_SOURCE(ntshell), + sizeof(SUGGEST_SOURCE(ntshell))) > 0) { + SUGGEST_INDEX(ntshell) = 0; + if (text_history_find( + GET_HISTORY(ntshell), + SUGGEST_INDEX(ntshell), + SUGGEST_SOURCE(ntshell), + buf, + sizeof(buf)) == 0) { + /* + * Found the suggestion. + */ + int n = ntlibc_strlen((const char *)buf); + VTSEND_ERASE_LINE(ntshell); + VTSEND_CURSOR_HEAD(ntshell); + PROMPT_WRITE(ntshell); + SERIAL_WRITE(ntshell, buf, n); + text_editor_set_text(GET_EDITOR(ntshell), buf); + } else { + /* + * Not found the suggestion. + */ + SUGGEST_INDEX(ntshell) = -1; + } + } + } else { + /* + * Already the input suggestion mode. + * Search the next suggestion text string. + */ + SUGGEST_INDEX(ntshell) = SUGGEST_INDEX(ntshell) + 1; + if (text_history_find( + GET_HISTORY(ntshell), + SUGGEST_INDEX(ntshell), + SUGGEST_SOURCE(ntshell), + buf, + sizeof(buf)) == 0) { + /* + * Found the suggestion. + */ + int n = ntlibc_strlen((const char *)buf); + VTSEND_ERASE_LINE(ntshell); + VTSEND_CURSOR_HEAD(ntshell); + PROMPT_WRITE(ntshell); + SERIAL_WRITE(ntshell, buf, n); + text_editor_set_text(GET_EDITOR(ntshell), buf); + } else { + /* + * Not found the suggestion. + * Recall the previous input text string. + */ + int n = ntlibc_strlen(SUGGEST_SOURCE(ntshell)); + VTSEND_ERASE_LINE(ntshell); + VTSEND_CURSOR_HEAD(ntshell); + PROMPT_WRITE(ntshell); + SERIAL_WRITE(ntshell, SUGGEST_SOURCE(ntshell), n); + text_editor_set_text(GET_EDITOR(ntshell), SUGGEST_SOURCE(ntshell)); + SUGGEST_INDEX(ntshell) = -1; + } + } +} + +/** + * @brief Move the cursor to the head of the line. + * @details This function change the state of the logical text editor and the view. + * + * @param ntshell A handler of the NT-Shell. + * @param action An action. + * @param ch A input character. + */ +static void actfunc_cursor_head(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch) +{ + UNUSED_VARIABLE(action); + UNUSED_VARIABLE(ch); + VTSEND_CURSOR_HEAD(ntshell); + PROMPT_WRITE(ntshell); + text_editor_cursor_head(GET_EDITOR(ntshell)); +} + +/** + * @brief Move the cursor to the tail of the line. + * @details This function change the state of the logical text editor and the view. + * + * @param ntshell A handler of the NT-Shell. + * @param action An action. + * @param ch A input character. + */ +static void actfunc_cursor_tail(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch) +{ + char buf[TEXTEDITOR_MAXLEN]; + int len; + UNUSED_VARIABLE(action); + UNUSED_VARIABLE(ch); + text_editor_get_text(GET_EDITOR(ntshell), buf, sizeof(buf)); + len = ntlibc_strlen((const char *)buf); + VTSEND_CURSOR_HEAD(ntshell); + PROMPT_WRITE(ntshell); + SERIAL_WRITE(ntshell, buf, len); + text_editor_cursor_tail(GET_EDITOR(ntshell)); +} + +/** + * @brief The data structure of the action table. + * @details + * The action consists from the state and the input character. + * This definition also have the callback function. + */ +typedef struct { + vtrecv_action_t action; + unsigned char ch; + void (*func)(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch); +} ntshell_action_table_t; + +/** + * @brief Process function table for the actions. + * @details + * The action codes depends on the virtual terminals. + * So you should check some virtual terminal softwares and the environments. + * + * + * + * + * + * + * + * + * + * + * + * + * + *
+ * PlatformTools
WindowsHyper Terminal, Poderossa, TeraTerm
Linuxminicom, screen, kermit
+ */ +static const ntshell_action_table_t action_table[] = { + {VTRECV_ACTION_EXECUTE, 0x01, actfunc_cursor_head}, + {VTRECV_ACTION_EXECUTE, 0x02, actfunc_cursor_left}, + {VTRECV_ACTION_EXECUTE, 0x03, actfunc_cancel}, + {VTRECV_ACTION_EXECUTE, 0x04, actfunc_delete}, + {VTRECV_ACTION_EXECUTE, 0x05, actfunc_cursor_tail}, + {VTRECV_ACTION_EXECUTE, 0x06, actfunc_cursor_right}, + {VTRECV_ACTION_EXECUTE, 0x08, actfunc_backspace}, + {VTRECV_ACTION_EXECUTE, 0x09, actfunc_suggest}, + {VTRECV_ACTION_EXECUTE, 0x0d, actfunc_enter}, + {VTRECV_ACTION_EXECUTE, 0x0e, actfunc_history_next}, + {VTRECV_ACTION_EXECUTE, 0x10, actfunc_history_prev}, + {VTRECV_ACTION_CSI_DISPATCH, 0x41, actfunc_history_prev}, + {VTRECV_ACTION_CSI_DISPATCH, 0x42, actfunc_history_next}, + {VTRECV_ACTION_CSI_DISPATCH, 0x43, actfunc_cursor_right}, + {VTRECV_ACTION_CSI_DISPATCH, 0x44, actfunc_cursor_left}, + {VTRECV_ACTION_CSI_DISPATCH, 0x7e, actfunc_delete}, + {VTRECV_ACTION_PRINT, 0x7f, actfunc_backspace}, +}; + +/** + * @brief The callback function for the vtrecv module. + * + * @param vtrecv The vtrecv. + * @param action An action. + * @param ch A character. + */ +void vtrecv_callback(vtrecv_t *vtrecv, vtrecv_action_t action, unsigned char ch) +{ + ntshell_action_table_t *p; + int i; + const int ACTTBLSIZ = sizeof(action_table) / sizeof(action_table[0]); + + /* + * Search the process function for the control codes. + */ + p = (ntshell_action_table_t *)action_table; + for (i = 0; i < ACTTBLSIZ; i++) { + if ((p->action == action) && (p->ch == ch)) { + p->func(vtrecv->user_data, action, ch); + return; + } + p++; + } + + /* + * A general character is the input character. + */ + if (VTRECV_ACTION_PRINT == action) { + actfunc_insert(vtrecv->user_data, action, ch); + return; + } + + /* + * Other cases, there is no defined process function for the input codes. + * If you need to support the input action, you should update the action table. + */ +} + +/** + * @brief Initialize the NT-Shell. + * + * @param p A pointer to the handler of NT-Shell. + * @param func_read Serial read function. + * @param func_write Serial write function. + * @param func_callback Callback function. + * @param history History struct, optional. + * @param extobj An external object for the callback function. + */ +void ntshell_init(ntshell_t *p, + NTSHELL_SERIAL_READ func_read, + NTSHELL_SERIAL_WRITE func_write, + NTSHELL_USER_CALLBACK func_callback, + text_history_t *history, + void *extobj) +{ + /* + * The vtrecv module provides a pointer interface to an external object. + * NT-Shell uses the text editor, text history, read function, write function with the pointer interface. + */ + p->func_read = func_read; + p->func_write = func_write; + p->func_callback = func_callback; + p->extobj = extobj; + p->history = history; + ntlibc_strcpy(p->prompt, NTSHELL_PROMPT_DEFAULT); + + p->vtrecv.user_data = p; + + /* + * Initialize the modules. + */ + vtsend_init(&(p->vtsend), func_write, extobj); + vtrecv_init(&(p->vtrecv), vtrecv_callback); + text_editor_init(GET_EDITOR(p)); + text_history_init(GET_HISTORY(p)); + SUGGEST_INDEX(p) = -1; + + /* + * Set the initialization code. + */ + p->initcode = INITCODE; +} + +/** + * @brief Execute the NT-Shell. + * @details Never return from this function. + * + * @param p A pointer to the handler of the NT-Shell. + */ +void ntshell_execute(ntshell_t *p) +{ + /* + * Check the initialization code. + */ + if (p->initcode != INITCODE) { + return; + } + + /* + * User input loop. + */ + PROMPT_WRITE(p); + while (1) { + unsigned char ch; + SERIAL_READ(p, (char *)&ch, sizeof(ch)); + vtrecv_execute(&(p->vtrecv), &ch, sizeof(ch)); + } +} + +void ntshell_execute_start(ntshell_t *p) +{ + PROMPT_WRITE(p); +} + +void ntshell_execute_process(ntshell_t *p) +{ + unsigned char ch; + SERIAL_READ(p, (char *)&ch, sizeof(ch)); + vtrecv_execute(&(p->vtrecv), &ch, sizeof(ch)); +} + +/** + * @brief Set up the prompt of the NT-Shell. + * + * @param p A pointer to the handler of the NT-Shell. + * @param prompt A text string. + */ +void ntshell_set_prompt(ntshell_t *p, const char *prompt) +{ + /* + * Check the initialization code. + */ + if (p->initcode != INITCODE) { + return; + } + + ntlibc_strcpy(p->prompt, prompt); +} + +/** + * @brief Get the version. + * + * @param major Major number. + * @param minor Minor number. + * @param release Release number. + */ +void ntshell_version(int *major, int *minor, int *release) +{ + *major = VERSION_MAJOR; + *minor = VERSION_MINOR; + *release = VERSION_RELEASE; +} + diff --git a/gat_stand_fw/user/console/ntshell/core/ntshell.h b/gat_stand_fw/user/console/ntshell/core/ntshell.h new file mode 100644 index 0000000..095fc3d --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/ntshell.h @@ -0,0 +1,94 @@ +/** + * @file ntshell.h + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef NTSHELL_H +#define NTSHELL_H + +#include "vtrecv.h" +#include "vtsend.h" +#include "text_editor.h" +#include "text_history.h" + +#define NTSHELL_PROMPT_MAXLEN (32) +#define NTSHELL_PROMPT_DEFAULT ">" +#define NTSHELL_PROMPT_NEWLINE "\r\n" + +typedef int (*NTSHELL_SERIAL_READ)(char *buf, int cnt, void *extobj); +typedef int (*NTSHELL_SERIAL_WRITE)(const char *buf, int cnt, void *extobj); +typedef int (*NTSHELL_USER_CALLBACK)(const char *text, void *extobj); + +/** + * @brief The handler of NT-Shell. + * @details + * The best way to provide a handler, We should hide the implementation from the library users. + * But some small embedded environments can not use memory allocation dynamically. + * So this implementation open the fields of the handler in this header. + * You can use this handler on the stacks. + */ +typedef struct { + unsigned int initcode; /**< Initialization flag. */ + vtsend_t vtsend; /**< The handler of vtsend. */ + vtrecv_t vtrecv; /**< The handler of vtrecv. */ + text_editor_t editor; /**< The handler of text_editor. */ + text_history_t *history; /**< The handler of text_history. */ + int suggest_index; + char suggest_source[TEXTEDITOR_MAXLEN]; + NTSHELL_SERIAL_READ func_read; + NTSHELL_SERIAL_WRITE func_write; + NTSHELL_USER_CALLBACK func_callback; + void *extobj; + char prompt[NTSHELL_PROMPT_MAXLEN]; +} ntshell_t; + +#ifdef __cplusplus +extern "C" { +#endif + +void ntshell_init(ntshell_t *p, + NTSHELL_SERIAL_READ func_read, + NTSHELL_SERIAL_WRITE func_write, + NTSHELL_USER_CALLBACK func_callback, + text_history_t *history, + void *extobj); +void ntshell_execute(ntshell_t *p); +void ntshell_set_prompt(ntshell_t *p, const char *prompt); +void ntshell_version(int *major, int *minor, int *release); + +void ntshell_execute_start(ntshell_t *p); +void ntshell_execute_process(ntshell_t *p); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/gat_stand_fw/user/console/ntshell/core/text_editor.c b/gat_stand_fw/user/console/ntshell/core/text_editor.c new file mode 100644 index 0000000..656f222 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/text_editor.c @@ -0,0 +1,250 @@ +/** + * @file text_editor.c + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "text_editor.h" + +/** + * @brief Initialize the text editor module. + * + * @param p A pointer to the text editor handler. + */ +void text_editor_init(text_editor_t *p) +{ + p->pos = 0; + p->len = 0; + p->buffer[p->len] = '\0'; +} + +/** + * @brief Insert a character. + * + * @param p A pointer to the text editor handler. + * @param c A character. + */ +int text_editor_insert(text_editor_t *p, char c) +{ + if (p->len < (int)sizeof(p->buffer) - 1) { + int n = p->len - p->pos + 1; + int i; + char *src = p->buffer + p->len + 0; + char *des = p->buffer + p->len + 1; + for (i = 0; i < n; i++) { + *des = *src; + des--; + src--; + } + + p->buffer[p->pos] = c; + p->pos++; + p->len++; + p->buffer[p->len] = '\0'; + return 1; + } + return 0; +} + +/** + * @brief Delete a character. + * + * @param p A pointer to the text editor handler. + */ +int text_editor_backspace(text_editor_t *p) +{ + if (0 < p->pos) { + int n = p->len - p->pos; + int i; + char *src = p->buffer + p->pos - 0; + char *des = p->buffer + p->pos - 1; + p->pos--; + p->len--; + for (i = 0; i < n; i++) { + *des = *src; + des++; + src++; + } + *(p->buffer + p->len) = '\0'; + return 1; + } + return 0; +} + +/** + * @brief Delete a character. + * + * @param p A pointer to the text editor handler. + */ +int text_editor_delete(text_editor_t *p) +{ + if (p->pos < p->len) { + int n = p->len - p->pos - 1; + int i; + char *src = p->buffer + p->pos + 1; + char *des = p->buffer + p->pos + 0; + p->len--; + for (i = 0; i < n; i++) { + *des = *src; + des++; + src++; + } + *(p->buffer + p->len) = '\0'; + return 1; + } + return 0; +} + +/** + * @brief Get the cursor position. + * + * @param p A pointer to the text editor handler. + */ +int text_editor_cursor_get_position(text_editor_t *p) +{ + return p->pos; +} + +/** + * @brief Move to the cursor to the head of the line. + * + * @param p A pointer to the text editor handler. + */ +int text_editor_cursor_head(text_editor_t *p) +{ + if (0 < p->pos) { + p->pos = 0; + return 1; + } + return 0; +} + +/** + * @brief Move to the cursor to the tail of the line. + * + * @param p A pointer to the text editor handler. + */ +int text_editor_cursor_tail(text_editor_t *p) +{ + if (p->pos < p->len) { + p->pos = p->len; + return 1; + } + return 0; +} + +/** + * @brief Move to the cursor to left. + * + * @param p A pointer to the text editor handler. + */ +int text_editor_cursor_left(text_editor_t *p) +{ + if (0 < p->pos) { + p->pos--; + return 1; + } + return 0; +} + +/** + * @brief Move to the cursor to right. + * + * @param p A pointer to the text editor handler. + */ +int text_editor_cursor_right(text_editor_t *p) +{ + if (p->pos < p->len) { + p->pos++; + return 1; + } + return 0; +} + +/** + * @brief Set the edit line. + * + * @param p A pointer to the text editor handler. + * @param buf A text string. + */ +int text_editor_set_text(text_editor_t *p, char *buf) +{ + char *src = buf; + char *des = p->buffer; + int n = 0; + while (*src) { + *des = *src; + des++; + src++; + n++; + if ((int)sizeof(p->buffer) <= n - 1) { + break; + } + } + *des = '\0'; + p->len = n; + p->pos = p->len; + return n; +} + +/** + * @brief Get the edit line. + * + * @param p A pointer to the text editor handler. + * @param buf A text string. + * @param siz Size of the text string buffer. + */ +int text_editor_get_text(text_editor_t *p, char *buf, int siz) +{ + char *src = p->buffer; + char *des = buf; + int n = 0; + while (*src) { + *des++ = *src++; + n++; + if (siz <= n) { + break; + } + } + *des = '\0'; + return n; +} + +/** + * @brief Clear the text string. + * + * @param p A pointer to the text editor handler. + */ +void text_editor_clear(text_editor_t *p) +{ + p->pos = 0; + p->len = 0; + p->buffer[p->len] = '\0'; +} + diff --git a/gat_stand_fw/user/console/ntshell/core/text_editor.h b/gat_stand_fw/user/console/ntshell/core/text_editor.h new file mode 100644 index 0000000..54d1b95 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/text_editor.h @@ -0,0 +1,74 @@ +/** + * @file text_editor.h + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef TEXT_EDITOR_H +#define TEXT_EDITOR_H + +#include "ntconf.h" + +/** + * @brief Maximum length of the text string. + */ +#define TEXTEDITOR_MAXLEN (NTCONF_EDITOR_MAXLEN) + +/** + * @brief Text editor handler. + */ +typedef struct { + char buffer[TEXTEDITOR_MAXLEN]; /**< Buffer for the text string. */ + int pos; /**< Position of the logical cursor. */ + int len; /**< Length of the text string. */ +} text_editor_t; + +#ifdef __cplusplus +extern "C" { +#endif + +void text_editor_init(text_editor_t *p); +int text_editor_insert(text_editor_t *p, char c); +int text_editor_backspace(text_editor_t *p); +int text_editor_delete(text_editor_t *p); +int text_editor_cursor_get_position(text_editor_t *p); +int text_editor_cursor_head(text_editor_t *p); +int text_editor_cursor_tail(text_editor_t *p); +int text_editor_cursor_left(text_editor_t *p); +int text_editor_cursor_right(text_editor_t *p); +int text_editor_set_text(text_editor_t *p, char *buf); +int text_editor_get_text(text_editor_t *p, char *buf, int siz); +void text_editor_clear(text_editor_t *p); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/gat_stand_fw/user/console/ntshell/core/text_history.c b/gat_stand_fw/user/console/ntshell/core/text_history.c new file mode 100644 index 0000000..1965785 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/text_history.c @@ -0,0 +1,170 @@ +/** + * @file text_history.c + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "text_history.h" +#include "ntlibc.h" + +/** + * @brief Initialize this module. + * + * @param p A pointer to the handler. + */ +void text_history_init(text_history_t *p) +{ + int i; + p->rp = 0; + p->wp = 0; + for (i = 0; i < (int)sizeof(p->history); i++) { + p->history[i] = 0; + } +} + +/** + * @brief Write to the history. + * + * @param p A pointer to the handler. + * @param buf A pointer to the buffer. + */ +int text_history_write(text_history_t *p, char *buf) +{ + char *sp = p->history + (TEXTHISTORY_MAXLEN * p->wp); + if (buf[0] == '\0') { + return 0; + } + while (*buf) { + *sp = *buf; + sp++; + buf++; + } + *sp = '\0'; + p->wp = (p->wp + 1) % TEXTHISTORY_DEPTH; + p->rp = p->wp; + return 1; +} + +/** + * @brief Read from the history. + * + * @param p A pointer to the handler. + * @param buf A pointer to the buffer. + * @param siz A size of the buffer. + */ +int text_history_read(text_history_t *p, char *buf, const int siz) +{ + char *sp = p->history + (TEXTHISTORY_MAXLEN * p->rp); + int n = 0; + while (*sp) { + *buf = *sp; + buf++; + sp++; + n++; + if (siz - 1 <= n) { + break; + } + } + *buf = '\0'; + return n; +} + +/** + * @brief Change the pointing location to the next. + * + * @param p A pointer to the handler. + */ +int text_history_read_point_next(text_history_t *p) +{ + int n = (p->rp + 1) % TEXTHISTORY_DEPTH; + if (n != p->wp) { + p->rp = n; + return 1; + } + return 0; +} + +/** + * @brief Change the pointing location to the previous. + * + * @param p A pointer to the handler. + */ +int text_history_read_point_prev(text_history_t *p) +{ + int n = (p->rp == 0) ? (TEXTHISTORY_DEPTH - 1) : (p->rp - 1); + if (n != p->wp) { + char *sp = p->history + (TEXTHISTORY_MAXLEN * n); + if (*sp != '\0') { + p->rp = n; + return 1; + } + } + return 0; +} + +/** + * @brief Find the given text string from the text history. + * + * @param p A pointer to the handler. + * @param index An index number of the history. + * @param text The target text string. + * @param buf A pointer to the buffer. + * @param siz A size of the buffer. + * + * @retval 0 Success. + * @retval !0 Failure. + */ +int text_history_find(text_history_t *p, + const int index, const char *text, + char *buf, const int siz) +{ + const int text_len = ntlibc_strlen((const char *)text); + int found = 0; + int i; + for (i = 0; i < TEXTHISTORY_DEPTH; i++) { + int target = (p->rp + i) % TEXTHISTORY_DEPTH; + char *txtp = p->history + (TEXTHISTORY_MAXLEN * target); + const int target_len = ntlibc_strlen((const char *)txtp); + int comp_len = (target_len < text_len) ? target_len : text_len; + if ((ntlibc_strncmp( + (const char *)txtp, + (const char *)text, comp_len) == 0) && (comp_len > 0)) { + if (found == index) { + if (siz <= ntlibc_strlen(txtp)) { + return -1; + } + ntlibc_strcpy((char *)buf, (char *)txtp); + return 0; + } + found++; + } + } + return -1; +} + diff --git a/gat_stand_fw/user/console/ntshell/core/text_history.h b/gat_stand_fw/user/console/ntshell/core/text_history.h new file mode 100644 index 0000000..5001574 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/text_history.h @@ -0,0 +1,84 @@ +/** + * @file text_history.h + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef TEXT_HISTORY_H +#define TEXT_HISTORY_H + +#include "ntconf.h" + +/** + * @brief Maximum length per a history. + */ +#define TEXTHISTORY_MAXLEN (NTCONF_EDITOR_MAXLEN) + +/** + * @brief Depth of the history. + */ +#define TEXTHISTORY_DEPTH (NTCONF_HISTORY_DEPTH) + +/** + * @brief Structure of the text history module. + */ +typedef struct { + /** + * @brief History buffer. + */ + char history[TEXTHISTORY_MAXLEN * TEXTHISTORY_DEPTH]; + + /** + * @brief Read pointer. + */ + int rp; + + /** + * @brief Write pointer. + */ + int wp; +} text_history_t; + +#ifdef __cplusplus +extern "C" { +#endif + +void text_history_init(text_history_t *p); +int text_history_write(text_history_t *p, char *buf); +int text_history_read(text_history_t *p, char *buf, const int siz); +int text_history_read_point_next(text_history_t *p); +int text_history_read_point_prev(text_history_t *p); +int text_history_find(text_history_t *p, const int index, const char *text, char *buf, const int siz); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/gat_stand_fw/user/console/ntshell/core/vtrecv.c b/gat_stand_fw/user/console/ntshell/core/vtrecv.c new file mode 100644 index 0000000..e613106 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/vtrecv.c @@ -0,0 +1,2823 @@ +/** + * @file vtrecv.c + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * @note + * An implementation of Paul Williams' DEC compatible state machine parser. + * This code is in the public domain. + * + * @author Joshua Haberman + * @author Shinichiro Nakamura : Modified for Natural Tiny Shell (NT-Shell) + */ + +#include "vtrecv.h" + +static state_change_t GET_STATE_TABLE(const int state, const int ch); +static vtrecv_action_t GET_ENTRY_ACTIONS(const int state); +static vtrecv_action_t GET_EXIT_ACTIONS(const int state); + +#if (USE_ORIGINAL_LUT==1) +static const state_change_t STATE_TABLE[14][256] = { + { /* VTRECV_STATE_CSI_ENTRY = 0 */ + /*0 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*1 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*2 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*3 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*4 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*5 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*6 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*7 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*8 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*9 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*10 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*11 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*12 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*13 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*14 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*15 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*16 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*17 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*18 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*19 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*20 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*21 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*22 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*23 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*29 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*30 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*31 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*32 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*33 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*34 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*35 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*36 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*37 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*38 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*39 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*40 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*41 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*42 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*43 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*44 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*45 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*46 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*47 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*48 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4), + /*49 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4), + /*50 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4), + /*51 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4), + /*52 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4), + /*53 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4), + /*54 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4), + /*55 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4), + /*56 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4), + /*57 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4), + /*58 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*59 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4), + /*60 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_PARAM << 4), + /*61 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_PARAM << 4), + /*62 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_PARAM << 4), + /*63 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_PARAM << 4), + /*64 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*65 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*66 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*67 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*68 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*69 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*70 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*71 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*72 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*73 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*74 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*75 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*76 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*77 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*78 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*79 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*80 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*81 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*82 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*83 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*84 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*85 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*86 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*87 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*88 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*89 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*90 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*91 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*92 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*93 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*94 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*95 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*96 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*97 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*98 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*99 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*100*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*101*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*102*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*103*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*104*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*105*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*106*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*107*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*108*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*109*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*110*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*111*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*112*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*113*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*114*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*115*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*116*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*117*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*118*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*119*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*120*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*121*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*122*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*123*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*124*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*125*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*126*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*127*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_CSI_IGNORE = 1 */ + /*0 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*1 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*2 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*3 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*4 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*5 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*6 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*7 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*8 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*9 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*10 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*11 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*12 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*13 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*14 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*15 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*16 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*17 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*18 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*19 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*20 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*21 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*22 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*23 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*29 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*30 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*31 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*32 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*33 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*34 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*35 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*36 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*37 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*38 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*39 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*40 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*41 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*42 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*43 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*44 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*45 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*46 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*47 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*48 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*49 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*50 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*51 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*52 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*53 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*54 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*55 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*56 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*57 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*58 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*59 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*60 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*61 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*62 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*63 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*64 */ 0 | (VTRECV_STATE_GROUND << 4), + /*65 */ 0 | (VTRECV_STATE_GROUND << 4), + /*66 */ 0 | (VTRECV_STATE_GROUND << 4), + /*67 */ 0 | (VTRECV_STATE_GROUND << 4), + /*68 */ 0 | (VTRECV_STATE_GROUND << 4), + /*69 */ 0 | (VTRECV_STATE_GROUND << 4), + /*70 */ 0 | (VTRECV_STATE_GROUND << 4), + /*71 */ 0 | (VTRECV_STATE_GROUND << 4), + /*72 */ 0 | (VTRECV_STATE_GROUND << 4), + /*73 */ 0 | (VTRECV_STATE_GROUND << 4), + /*74 */ 0 | (VTRECV_STATE_GROUND << 4), + /*75 */ 0 | (VTRECV_STATE_GROUND << 4), + /*76 */ 0 | (VTRECV_STATE_GROUND << 4), + /*77 */ 0 | (VTRECV_STATE_GROUND << 4), + /*78 */ 0 | (VTRECV_STATE_GROUND << 4), + /*79 */ 0 | (VTRECV_STATE_GROUND << 4), + /*80 */ 0 | (VTRECV_STATE_GROUND << 4), + /*81 */ 0 | (VTRECV_STATE_GROUND << 4), + /*82 */ 0 | (VTRECV_STATE_GROUND << 4), + /*83 */ 0 | (VTRECV_STATE_GROUND << 4), + /*84 */ 0 | (VTRECV_STATE_GROUND << 4), + /*85 */ 0 | (VTRECV_STATE_GROUND << 4), + /*86 */ 0 | (VTRECV_STATE_GROUND << 4), + /*87 */ 0 | (VTRECV_STATE_GROUND << 4), + /*88 */ 0 | (VTRECV_STATE_GROUND << 4), + /*89 */ 0 | (VTRECV_STATE_GROUND << 4), + /*90 */ 0 | (VTRECV_STATE_GROUND << 4), + /*91 */ 0 | (VTRECV_STATE_GROUND << 4), + /*92 */ 0 | (VTRECV_STATE_GROUND << 4), + /*93 */ 0 | (VTRECV_STATE_GROUND << 4), + /*94 */ 0 | (VTRECV_STATE_GROUND << 4), + /*95 */ 0 | (VTRECV_STATE_GROUND << 4), + /*96 */ 0 | (VTRECV_STATE_GROUND << 4), + /*97 */ 0 | (VTRECV_STATE_GROUND << 4), + /*98 */ 0 | (VTRECV_STATE_GROUND << 4), + /*99 */ 0 | (VTRECV_STATE_GROUND << 4), + /*100*/ 0 | (VTRECV_STATE_GROUND << 4), + /*101*/ 0 | (VTRECV_STATE_GROUND << 4), + /*102*/ 0 | (VTRECV_STATE_GROUND << 4), + /*103*/ 0 | (VTRECV_STATE_GROUND << 4), + /*104*/ 0 | (VTRECV_STATE_GROUND << 4), + /*105*/ 0 | (VTRECV_STATE_GROUND << 4), + /*106*/ 0 | (VTRECV_STATE_GROUND << 4), + /*107*/ 0 | (VTRECV_STATE_GROUND << 4), + /*108*/ 0 | (VTRECV_STATE_GROUND << 4), + /*109*/ 0 | (VTRECV_STATE_GROUND << 4), + /*110*/ 0 | (VTRECV_STATE_GROUND << 4), + /*111*/ 0 | (VTRECV_STATE_GROUND << 4), + /*112*/ 0 | (VTRECV_STATE_GROUND << 4), + /*113*/ 0 | (VTRECV_STATE_GROUND << 4), + /*114*/ 0 | (VTRECV_STATE_GROUND << 4), + /*115*/ 0 | (VTRECV_STATE_GROUND << 4), + /*116*/ 0 | (VTRECV_STATE_GROUND << 4), + /*117*/ 0 | (VTRECV_STATE_GROUND << 4), + /*118*/ 0 | (VTRECV_STATE_GROUND << 4), + /*119*/ 0 | (VTRECV_STATE_GROUND << 4), + /*120*/ 0 | (VTRECV_STATE_GROUND << 4), + /*121*/ 0 | (VTRECV_STATE_GROUND << 4), + /*122*/ 0 | (VTRECV_STATE_GROUND << 4), + /*123*/ 0 | (VTRECV_STATE_GROUND << 4), + /*124*/ 0 | (VTRECV_STATE_GROUND << 4), + /*125*/ 0 | (VTRECV_STATE_GROUND << 4), + /*126*/ 0 | (VTRECV_STATE_GROUND << 4), + /*127*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_CSI_INTERMEDIATE = 2 */ + /*0 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*1 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*2 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*3 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*4 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*5 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*6 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*7 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*8 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*9 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*10 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*11 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*12 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*13 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*14 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*15 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*16 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*17 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*18 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*19 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*20 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*21 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*22 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*23 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*29 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*30 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*31 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*32 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*33 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*34 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*35 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*36 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*37 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*38 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*39 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*40 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*41 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*42 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*43 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*44 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*45 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*46 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*47 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*48 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*49 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*50 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*51 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*52 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*53 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*54 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*55 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*56 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*57 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*58 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*59 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*60 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*61 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*62 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*63 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*64 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*65 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*66 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*67 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*68 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*69 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*70 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*71 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*72 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*73 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*74 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*75 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*76 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*77 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*78 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*79 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*80 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*81 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*82 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*83 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*84 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*85 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*86 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*87 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*88 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*89 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*90 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*91 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*92 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*93 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*94 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*95 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*96 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*97 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*98 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*99 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*100*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*101*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*102*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*103*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*104*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*105*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*106*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*107*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*108*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*109*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*110*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*111*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*112*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*113*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*114*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*115*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*116*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*117*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*118*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*119*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*120*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*121*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*122*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*123*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*124*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*125*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*126*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*127*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_CSI_PARAM = 3 */ + /*0 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*1 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*2 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*3 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*4 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*5 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*6 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*7 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*8 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*9 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*10 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*11 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*12 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*13 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*14 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*15 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*16 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*17 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*18 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*19 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*20 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*21 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*22 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*23 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*29 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*30 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*31 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*32 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*33 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*34 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*35 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*36 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*37 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*38 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*39 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*40 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*41 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*42 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*43 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*44 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*45 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*46 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*47 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4), + /*48 */ VTRECV_ACTION_PARAM | (0 << 4), + /*49 */ VTRECV_ACTION_PARAM | (0 << 4), + /*50 */ VTRECV_ACTION_PARAM | (0 << 4), + /*51 */ VTRECV_ACTION_PARAM | (0 << 4), + /*52 */ VTRECV_ACTION_PARAM | (0 << 4), + /*53 */ VTRECV_ACTION_PARAM | (0 << 4), + /*54 */ VTRECV_ACTION_PARAM | (0 << 4), + /*55 */ VTRECV_ACTION_PARAM | (0 << 4), + /*56 */ VTRECV_ACTION_PARAM | (0 << 4), + /*57 */ VTRECV_ACTION_PARAM | (0 << 4), + /*58 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*59 */ VTRECV_ACTION_PARAM | (0 << 4), + /*60 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*61 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*62 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*63 */ 0 | (VTRECV_STATE_CSI_IGNORE << 4), + /*64 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*65 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*66 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*67 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*68 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*69 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*70 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*71 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*72 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*73 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*74 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*75 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*76 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*77 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*78 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*79 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*80 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*81 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*82 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*83 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*84 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*85 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*86 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*87 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*88 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*89 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*90 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*91 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*92 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*93 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*94 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*95 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*96 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*97 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*98 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*99 */ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*100*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*101*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*102*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*103*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*104*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*105*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*106*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*107*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*108*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*109*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*110*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*111*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*112*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*113*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*114*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*115*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*116*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*117*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*118*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*119*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*120*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*121*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*122*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*123*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*124*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*125*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*126*/ VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*127*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_DCS_ENTRY = 4 */ + /*0 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*1 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*2 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*3 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*4 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*5 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*6 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*7 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*8 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*9 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*10 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*11 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*12 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*13 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*14 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*15 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*16 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*17 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*18 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*19 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*20 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*21 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*22 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*23 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*29 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*30 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*31 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*32 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*33 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*34 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*35 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*36 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*37 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*38 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*39 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*40 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*41 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*42 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*43 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*44 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*45 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*46 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*47 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*48 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4), + /*49 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4), + /*50 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4), + /*51 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4), + /*52 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4), + /*53 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4), + /*54 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4), + /*55 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4), + /*56 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4), + /*57 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4), + /*58 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*59 */ VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4), + /*60 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_PARAM << 4), + /*61 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_PARAM << 4), + /*62 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_PARAM << 4), + /*63 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_PARAM << 4), + /*64 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*65 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*66 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*67 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*68 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*69 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*70 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*71 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*72 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*73 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*74 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*75 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*76 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*77 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*78 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*79 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*80 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*81 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*82 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*83 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*84 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*85 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*86 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*87 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*88 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*89 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*90 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*91 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*92 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*93 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*94 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*95 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*96 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*97 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*98 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*99 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*100*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*101*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*102*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*103*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*104*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*105*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*106*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*107*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*108*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*109*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*110*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*111*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*112*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*113*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*114*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*115*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*116*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*117*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*118*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*119*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*120*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*121*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*122*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*123*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*124*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*125*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*126*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*127*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_DCS_IGNORE = 5 */ + /*0 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*1 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*2 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*3 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*4 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*5 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*6 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*7 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*8 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*9 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*10 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*11 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*12 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*13 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*14 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*15 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*16 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*17 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*18 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*19 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*20 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*21 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*22 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*23 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*29 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*30 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*31 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*32 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*33 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*34 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*35 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*36 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*37 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*38 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*39 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*40 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*41 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*42 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*43 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*44 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*45 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*46 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*47 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*48 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*49 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*50 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*51 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*52 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*53 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*54 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*55 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*56 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*57 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*58 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*59 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*60 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*61 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*62 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*63 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*64 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*65 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*66 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*67 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*68 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*69 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*70 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*71 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*72 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*73 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*74 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*75 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*76 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*77 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*78 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*79 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*80 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*81 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*82 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*83 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*84 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*85 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*86 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*87 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*88 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*89 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*90 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*91 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*92 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*93 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*94 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*95 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*96 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*97 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*98 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*99 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*100*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*101*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*102*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*103*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*104*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*105*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*106*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*107*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*108*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*109*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*110*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*111*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*112*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*113*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*114*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*115*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*116*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*117*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*118*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*119*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*120*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*121*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*122*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*123*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*124*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*125*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*126*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*127*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_DCS_INTERMEDIATE = 6 */ + /*0 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*1 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*2 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*3 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*4 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*5 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*6 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*7 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*8 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*9 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*10 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*11 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*12 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*13 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*14 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*15 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*16 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*17 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*18 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*19 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*20 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*21 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*22 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*23 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*29 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*30 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*31 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*32 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*33 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*34 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*35 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*36 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*37 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*38 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*39 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*40 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*41 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*42 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*43 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*44 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*45 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*46 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*47 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*48 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*49 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*50 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*51 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*52 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*53 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*54 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*55 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*56 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*57 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*58 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*59 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*60 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*61 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*62 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*63 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*64 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*65 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*66 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*67 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*68 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*69 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*70 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*71 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*72 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*73 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*74 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*75 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*76 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*77 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*78 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*79 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*80 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*81 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*82 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*83 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*84 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*85 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*86 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*87 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*88 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*89 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*90 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*91 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*92 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*93 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*94 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*95 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*96 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*97 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*98 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*99 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*100*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*101*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*102*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*103*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*104*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*105*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*106*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*107*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*108*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*109*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*110*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*111*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*112*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*113*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*114*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*115*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*116*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*117*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*118*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*119*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*120*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*121*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*122*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*123*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*124*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*125*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*126*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*127*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_DCS_PARAM = 7 */ + /*0 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*1 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*2 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*3 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*4 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*5 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*6 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*7 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*8 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*9 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*10 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*11 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*12 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*13 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*14 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*15 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*16 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*17 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*18 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*19 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*20 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*21 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*22 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*23 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*29 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*30 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*31 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*32 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*33 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*34 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*35 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*36 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*37 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*38 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*39 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*40 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*41 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*42 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*43 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*44 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*45 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*46 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*47 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4), + /*48 */ VTRECV_ACTION_PARAM | (0 << 4), + /*49 */ VTRECV_ACTION_PARAM | (0 << 4), + /*50 */ VTRECV_ACTION_PARAM | (0 << 4), + /*51 */ VTRECV_ACTION_PARAM | (0 << 4), + /*52 */ VTRECV_ACTION_PARAM | (0 << 4), + /*53 */ VTRECV_ACTION_PARAM | (0 << 4), + /*54 */ VTRECV_ACTION_PARAM | (0 << 4), + /*55 */ VTRECV_ACTION_PARAM | (0 << 4), + /*56 */ VTRECV_ACTION_PARAM | (0 << 4), + /*57 */ VTRECV_ACTION_PARAM | (0 << 4), + /*58 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*59 */ VTRECV_ACTION_PARAM | (0 << 4), + /*60 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*61 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*62 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*63 */ 0 | (VTRECV_STATE_DCS_IGNORE << 4), + /*64 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*65 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*66 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*67 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*68 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*69 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*70 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*71 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*72 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*73 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*74 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*75 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*76 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*77 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*78 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*79 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*80 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*81 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*82 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*83 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*84 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*85 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*86 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*87 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*88 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*89 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*90 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*91 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*92 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*93 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*94 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*95 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*96 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*97 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*98 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*99 */ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*100*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*101*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*102*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*103*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*104*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*105*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*106*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*107*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*108*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*109*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*110*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*111*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*112*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*113*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*114*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*115*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*116*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*117*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*118*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*119*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*120*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*121*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*122*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*123*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*124*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*125*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*126*/ 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4), + /*127*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_DCS_PASSTHROUGH = 8 */ + /*0 */ VTRECV_ACTION_PUT | (0 << 4), + /*1 */ VTRECV_ACTION_PUT | (0 << 4), + /*2 */ VTRECV_ACTION_PUT | (0 << 4), + /*3 */ VTRECV_ACTION_PUT | (0 << 4), + /*4 */ VTRECV_ACTION_PUT | (0 << 4), + /*5 */ VTRECV_ACTION_PUT | (0 << 4), + /*6 */ VTRECV_ACTION_PUT | (0 << 4), + /*7 */ VTRECV_ACTION_PUT | (0 << 4), + /*8 */ VTRECV_ACTION_PUT | (0 << 4), + /*9 */ VTRECV_ACTION_PUT | (0 << 4), + /*10 */ VTRECV_ACTION_PUT | (0 << 4), + /*11 */ VTRECV_ACTION_PUT | (0 << 4), + /*12 */ VTRECV_ACTION_PUT | (0 << 4), + /*13 */ VTRECV_ACTION_PUT | (0 << 4), + /*14 */ VTRECV_ACTION_PUT | (0 << 4), + /*15 */ VTRECV_ACTION_PUT | (0 << 4), + /*16 */ VTRECV_ACTION_PUT | (0 << 4), + /*17 */ VTRECV_ACTION_PUT | (0 << 4), + /*18 */ VTRECV_ACTION_PUT | (0 << 4), + /*19 */ VTRECV_ACTION_PUT | (0 << 4), + /*20 */ VTRECV_ACTION_PUT | (0 << 4), + /*21 */ VTRECV_ACTION_PUT | (0 << 4), + /*22 */ VTRECV_ACTION_PUT | (0 << 4), + /*23 */ VTRECV_ACTION_PUT | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_PUT | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_PUT | (0 << 4), + /*29 */ VTRECV_ACTION_PUT | (0 << 4), + /*30 */ VTRECV_ACTION_PUT | (0 << 4), + /*31 */ VTRECV_ACTION_PUT | (0 << 4), + /*32 */ VTRECV_ACTION_PUT | (0 << 4), + /*33 */ VTRECV_ACTION_PUT | (0 << 4), + /*34 */ VTRECV_ACTION_PUT | (0 << 4), + /*35 */ VTRECV_ACTION_PUT | (0 << 4), + /*36 */ VTRECV_ACTION_PUT | (0 << 4), + /*37 */ VTRECV_ACTION_PUT | (0 << 4), + /*38 */ VTRECV_ACTION_PUT | (0 << 4), + /*39 */ VTRECV_ACTION_PUT | (0 << 4), + /*40 */ VTRECV_ACTION_PUT | (0 << 4), + /*41 */ VTRECV_ACTION_PUT | (0 << 4), + /*42 */ VTRECV_ACTION_PUT | (0 << 4), + /*43 */ VTRECV_ACTION_PUT | (0 << 4), + /*44 */ VTRECV_ACTION_PUT | (0 << 4), + /*45 */ VTRECV_ACTION_PUT | (0 << 4), + /*46 */ VTRECV_ACTION_PUT | (0 << 4), + /*47 */ VTRECV_ACTION_PUT | (0 << 4), + /*48 */ VTRECV_ACTION_PUT | (0 << 4), + /*49 */ VTRECV_ACTION_PUT | (0 << 4), + /*50 */ VTRECV_ACTION_PUT | (0 << 4), + /*51 */ VTRECV_ACTION_PUT | (0 << 4), + /*52 */ VTRECV_ACTION_PUT | (0 << 4), + /*53 */ VTRECV_ACTION_PUT | (0 << 4), + /*54 */ VTRECV_ACTION_PUT | (0 << 4), + /*55 */ VTRECV_ACTION_PUT | (0 << 4), + /*56 */ VTRECV_ACTION_PUT | (0 << 4), + /*57 */ VTRECV_ACTION_PUT | (0 << 4), + /*58 */ VTRECV_ACTION_PUT | (0 << 4), + /*59 */ VTRECV_ACTION_PUT | (0 << 4), + /*60 */ VTRECV_ACTION_PUT | (0 << 4), + /*61 */ VTRECV_ACTION_PUT | (0 << 4), + /*62 */ VTRECV_ACTION_PUT | (0 << 4), + /*63 */ VTRECV_ACTION_PUT | (0 << 4), + /*64 */ VTRECV_ACTION_PUT | (0 << 4), + /*65 */ VTRECV_ACTION_PUT | (0 << 4), + /*66 */ VTRECV_ACTION_PUT | (0 << 4), + /*67 */ VTRECV_ACTION_PUT | (0 << 4), + /*68 */ VTRECV_ACTION_PUT | (0 << 4), + /*69 */ VTRECV_ACTION_PUT | (0 << 4), + /*70 */ VTRECV_ACTION_PUT | (0 << 4), + /*71 */ VTRECV_ACTION_PUT | (0 << 4), + /*72 */ VTRECV_ACTION_PUT | (0 << 4), + /*73 */ VTRECV_ACTION_PUT | (0 << 4), + /*74 */ VTRECV_ACTION_PUT | (0 << 4), + /*75 */ VTRECV_ACTION_PUT | (0 << 4), + /*76 */ VTRECV_ACTION_PUT | (0 << 4), + /*77 */ VTRECV_ACTION_PUT | (0 << 4), + /*78 */ VTRECV_ACTION_PUT | (0 << 4), + /*79 */ VTRECV_ACTION_PUT | (0 << 4), + /*80 */ VTRECV_ACTION_PUT | (0 << 4), + /*81 */ VTRECV_ACTION_PUT | (0 << 4), + /*82 */ VTRECV_ACTION_PUT | (0 << 4), + /*83 */ VTRECV_ACTION_PUT | (0 << 4), + /*84 */ VTRECV_ACTION_PUT | (0 << 4), + /*85 */ VTRECV_ACTION_PUT | (0 << 4), + /*86 */ VTRECV_ACTION_PUT | (0 << 4), + /*87 */ VTRECV_ACTION_PUT | (0 << 4), + /*88 */ VTRECV_ACTION_PUT | (0 << 4), + /*89 */ VTRECV_ACTION_PUT | (0 << 4), + /*90 */ VTRECV_ACTION_PUT | (0 << 4), + /*91 */ VTRECV_ACTION_PUT | (0 << 4), + /*92 */ VTRECV_ACTION_PUT | (0 << 4), + /*93 */ VTRECV_ACTION_PUT | (0 << 4), + /*94 */ VTRECV_ACTION_PUT | (0 << 4), + /*95 */ VTRECV_ACTION_PUT | (0 << 4), + /*96 */ VTRECV_ACTION_PUT | (0 << 4), + /*97 */ VTRECV_ACTION_PUT | (0 << 4), + /*98 */ VTRECV_ACTION_PUT | (0 << 4), + /*99 */ VTRECV_ACTION_PUT | (0 << 4), + /*100*/ VTRECV_ACTION_PUT | (0 << 4), + /*101*/ VTRECV_ACTION_PUT | (0 << 4), + /*102*/ VTRECV_ACTION_PUT | (0 << 4), + /*103*/ VTRECV_ACTION_PUT | (0 << 4), + /*104*/ VTRECV_ACTION_PUT | (0 << 4), + /*105*/ VTRECV_ACTION_PUT | (0 << 4), + /*106*/ VTRECV_ACTION_PUT | (0 << 4), + /*107*/ VTRECV_ACTION_PUT | (0 << 4), + /*108*/ VTRECV_ACTION_PUT | (0 << 4), + /*109*/ VTRECV_ACTION_PUT | (0 << 4), + /*110*/ VTRECV_ACTION_PUT | (0 << 4), + /*111*/ VTRECV_ACTION_PUT | (0 << 4), + /*112*/ VTRECV_ACTION_PUT | (0 << 4), + /*113*/ VTRECV_ACTION_PUT | (0 << 4), + /*114*/ VTRECV_ACTION_PUT | (0 << 4), + /*115*/ VTRECV_ACTION_PUT | (0 << 4), + /*116*/ VTRECV_ACTION_PUT | (0 << 4), + /*117*/ VTRECV_ACTION_PUT | (0 << 4), + /*118*/ VTRECV_ACTION_PUT | (0 << 4), + /*119*/ VTRECV_ACTION_PUT | (0 << 4), + /*120*/ VTRECV_ACTION_PUT | (0 << 4), + /*121*/ VTRECV_ACTION_PUT | (0 << 4), + /*122*/ VTRECV_ACTION_PUT | (0 << 4), + /*123*/ VTRECV_ACTION_PUT | (0 << 4), + /*124*/ VTRECV_ACTION_PUT | (0 << 4), + /*125*/ VTRECV_ACTION_PUT | (0 << 4), + /*126*/ VTRECV_ACTION_PUT | (0 << 4), + /*127*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_ESCAPE = 9 */ + /*0 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*1 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*2 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*3 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*4 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*5 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*6 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*7 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*8 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*9 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*10 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*11 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*12 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*13 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*14 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*15 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*16 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*17 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*18 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*19 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*20 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*21 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*22 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*23 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*29 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*30 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*31 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*32 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*33 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*34 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*35 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*36 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*37 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*38 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*39 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*40 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*41 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*42 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*43 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*44 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*45 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*46 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*47 */ VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4), + /*48 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*49 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*50 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*51 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*52 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*53 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*54 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*55 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*56 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*57 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*58 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*59 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*60 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*61 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*62 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*63 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*64 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*65 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*66 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*67 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*68 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*69 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*70 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*71 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*72 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*73 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*74 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*75 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*76 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*77 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*78 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*79 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*80 */ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*81 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*82 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*83 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*84 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*85 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*86 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*87 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*88 */ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*89 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*90 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*91 */ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*92 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*93 */ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*94 */ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*95 */ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*96 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*97 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*98 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*99 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*100*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*101*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*102*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*103*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*104*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*105*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*106*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*107*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*108*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*109*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*110*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*111*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*112*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*113*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*114*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*115*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*116*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*117*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*118*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*119*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*120*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*121*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*122*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*123*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*124*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*125*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*126*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*127*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_ESCAPE_INTERMEDIATE = 10 */ + /*0 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*1 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*2 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*3 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*4 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*5 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*6 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*7 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*8 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*9 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*10 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*11 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*12 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*13 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*14 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*15 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*16 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*17 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*18 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*19 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*20 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*21 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*22 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*23 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*29 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*30 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*31 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*32 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*33 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*34 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*35 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*36 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*37 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*38 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*39 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*40 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*41 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*42 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*43 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*44 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*45 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*46 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*47 */ VTRECV_ACTION_COLLECT | (0 << 4), + /*48 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*49 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*50 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*51 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*52 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*53 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*54 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*55 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*56 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*57 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*58 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*59 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*60 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*61 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*62 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*63 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*64 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*65 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*66 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*67 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*68 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*69 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*70 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*71 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*72 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*73 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*74 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*75 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*76 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*77 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*78 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*79 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*80 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*81 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*82 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*83 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*84 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*85 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*86 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*87 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*88 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*89 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*90 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*91 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*92 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*93 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*94 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*95 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*96 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*97 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*98 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*99 */ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*100*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*101*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*102*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*103*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*104*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*105*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*106*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*107*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*108*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*109*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*110*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*111*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*112*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*113*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*114*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*115*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*116*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*117*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*118*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*119*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*120*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*121*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*122*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*123*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*124*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*125*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*126*/ VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4), + /*127*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_GROUND = 11 */ + /*0 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*1 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*2 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*3 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*4 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*5 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*6 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*7 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*8 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*9 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*10 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*11 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*12 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*13 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*14 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*15 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*16 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*17 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*18 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*19 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*20 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*21 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*22 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*23 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*29 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*30 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*31 */ VTRECV_ACTION_EXECUTE | (0 << 4), + /*32 */ VTRECV_ACTION_PRINT | (0 << 4), + /*33 */ VTRECV_ACTION_PRINT | (0 << 4), + /*34 */ VTRECV_ACTION_PRINT | (0 << 4), + /*35 */ VTRECV_ACTION_PRINT | (0 << 4), + /*36 */ VTRECV_ACTION_PRINT | (0 << 4), + /*37 */ VTRECV_ACTION_PRINT | (0 << 4), + /*38 */ VTRECV_ACTION_PRINT | (0 << 4), + /*39 */ VTRECV_ACTION_PRINT | (0 << 4), + /*40 */ VTRECV_ACTION_PRINT | (0 << 4), + /*41 */ VTRECV_ACTION_PRINT | (0 << 4), + /*42 */ VTRECV_ACTION_PRINT | (0 << 4), + /*43 */ VTRECV_ACTION_PRINT | (0 << 4), + /*44 */ VTRECV_ACTION_PRINT | (0 << 4), + /*45 */ VTRECV_ACTION_PRINT | (0 << 4), + /*46 */ VTRECV_ACTION_PRINT | (0 << 4), + /*47 */ VTRECV_ACTION_PRINT | (0 << 4), + /*48 */ VTRECV_ACTION_PRINT | (0 << 4), + /*49 */ VTRECV_ACTION_PRINT | (0 << 4), + /*50 */ VTRECV_ACTION_PRINT | (0 << 4), + /*51 */ VTRECV_ACTION_PRINT | (0 << 4), + /*52 */ VTRECV_ACTION_PRINT | (0 << 4), + /*53 */ VTRECV_ACTION_PRINT | (0 << 4), + /*54 */ VTRECV_ACTION_PRINT | (0 << 4), + /*55 */ VTRECV_ACTION_PRINT | (0 << 4), + /*56 */ VTRECV_ACTION_PRINT | (0 << 4), + /*57 */ VTRECV_ACTION_PRINT | (0 << 4), + /*58 */ VTRECV_ACTION_PRINT | (0 << 4), + /*59 */ VTRECV_ACTION_PRINT | (0 << 4), + /*60 */ VTRECV_ACTION_PRINT | (0 << 4), + /*61 */ VTRECV_ACTION_PRINT | (0 << 4), + /*62 */ VTRECV_ACTION_PRINT | (0 << 4), + /*63 */ VTRECV_ACTION_PRINT | (0 << 4), + /*64 */ VTRECV_ACTION_PRINT | (0 << 4), + /*65 */ VTRECV_ACTION_PRINT | (0 << 4), + /*66 */ VTRECV_ACTION_PRINT | (0 << 4), + /*67 */ VTRECV_ACTION_PRINT | (0 << 4), + /*68 */ VTRECV_ACTION_PRINT | (0 << 4), + /*69 */ VTRECV_ACTION_PRINT | (0 << 4), + /*70 */ VTRECV_ACTION_PRINT | (0 << 4), + /*71 */ VTRECV_ACTION_PRINT | (0 << 4), + /*72 */ VTRECV_ACTION_PRINT | (0 << 4), + /*73 */ VTRECV_ACTION_PRINT | (0 << 4), + /*74 */ VTRECV_ACTION_PRINT | (0 << 4), + /*75 */ VTRECV_ACTION_PRINT | (0 << 4), + /*76 */ VTRECV_ACTION_PRINT | (0 << 4), + /*77 */ VTRECV_ACTION_PRINT | (0 << 4), + /*78 */ VTRECV_ACTION_PRINT | (0 << 4), + /*79 */ VTRECV_ACTION_PRINT | (0 << 4), + /*80 */ VTRECV_ACTION_PRINT | (0 << 4), + /*81 */ VTRECV_ACTION_PRINT | (0 << 4), + /*82 */ VTRECV_ACTION_PRINT | (0 << 4), + /*83 */ VTRECV_ACTION_PRINT | (0 << 4), + /*84 */ VTRECV_ACTION_PRINT | (0 << 4), + /*85 */ VTRECV_ACTION_PRINT | (0 << 4), + /*86 */ VTRECV_ACTION_PRINT | (0 << 4), + /*87 */ VTRECV_ACTION_PRINT | (0 << 4), + /*88 */ VTRECV_ACTION_PRINT | (0 << 4), + /*89 */ VTRECV_ACTION_PRINT | (0 << 4), + /*90 */ VTRECV_ACTION_PRINT | (0 << 4), + /*91 */ VTRECV_ACTION_PRINT | (0 << 4), + /*92 */ VTRECV_ACTION_PRINT | (0 << 4), + /*93 */ VTRECV_ACTION_PRINT | (0 << 4), + /*94 */ VTRECV_ACTION_PRINT | (0 << 4), + /*95 */ VTRECV_ACTION_PRINT | (0 << 4), + /*96 */ VTRECV_ACTION_PRINT | (0 << 4), + /*97 */ VTRECV_ACTION_PRINT | (0 << 4), + /*98 */ VTRECV_ACTION_PRINT | (0 << 4), + /*99 */ VTRECV_ACTION_PRINT | (0 << 4), + /*100*/ VTRECV_ACTION_PRINT | (0 << 4), + /*101*/ VTRECV_ACTION_PRINT | (0 << 4), + /*102*/ VTRECV_ACTION_PRINT | (0 << 4), + /*103*/ VTRECV_ACTION_PRINT | (0 << 4), + /*104*/ VTRECV_ACTION_PRINT | (0 << 4), + /*105*/ VTRECV_ACTION_PRINT | (0 << 4), + /*106*/ VTRECV_ACTION_PRINT | (0 << 4), + /*107*/ VTRECV_ACTION_PRINT | (0 << 4), + /*108*/ VTRECV_ACTION_PRINT | (0 << 4), + /*109*/ VTRECV_ACTION_PRINT | (0 << 4), + /*110*/ VTRECV_ACTION_PRINT | (0 << 4), + /*111*/ VTRECV_ACTION_PRINT | (0 << 4), + /*112*/ VTRECV_ACTION_PRINT | (0 << 4), + /*113*/ VTRECV_ACTION_PRINT | (0 << 4), + /*114*/ VTRECV_ACTION_PRINT | (0 << 4), + /*115*/ VTRECV_ACTION_PRINT | (0 << 4), + /*116*/ VTRECV_ACTION_PRINT | (0 << 4), + /*117*/ VTRECV_ACTION_PRINT | (0 << 4), + /*118*/ VTRECV_ACTION_PRINT | (0 << 4), + /*119*/ VTRECV_ACTION_PRINT | (0 << 4), + /*120*/ VTRECV_ACTION_PRINT | (0 << 4), + /*121*/ VTRECV_ACTION_PRINT | (0 << 4), + /*122*/ VTRECV_ACTION_PRINT | (0 << 4), + /*123*/ VTRECV_ACTION_PRINT | (0 << 4), + /*124*/ VTRECV_ACTION_PRINT | (0 << 4), + /*125*/ VTRECV_ACTION_PRINT | (0 << 4), + /*126*/ VTRECV_ACTION_PRINT | (0 << 4), + /*127*/ VTRECV_ACTION_PRINT | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_OSC_STRING = 12 */ + /*0 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*1 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*2 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*3 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*4 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*5 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*6 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*7 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*8 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*9 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*10 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*11 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*12 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*13 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*14 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*15 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*16 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*17 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*18 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*19 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*20 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*21 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*22 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*23 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*29 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*30 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*31 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*32 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*33 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*34 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*35 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*36 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*37 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*38 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*39 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*40 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*41 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*42 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*43 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*44 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*45 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*46 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*47 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*48 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*49 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*50 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*51 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*52 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*53 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*54 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*55 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*56 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*57 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*58 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*59 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*60 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*61 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*62 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*63 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*64 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*65 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*66 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*67 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*68 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*69 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*70 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*71 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*72 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*73 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*74 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*75 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*76 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*77 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*78 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*79 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*80 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*81 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*82 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*83 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*84 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*85 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*86 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*87 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*88 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*89 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*90 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*91 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*92 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*93 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*94 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*95 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*96 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*97 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*98 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*99 */ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*100*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*101*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*102*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*103*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*104*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*105*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*106*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*107*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*108*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*109*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*110*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*111*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*112*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*113*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*114*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*115*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*116*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*117*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*118*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*119*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*120*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*121*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*122*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*123*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*124*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*125*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*126*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*127*/ VTRECV_ACTION_OSC_PUT | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, + { /* VTRECV_STATE_SOS_PM_APC_STRING = 13 */ + /*0 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*1 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*2 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*3 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*4 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*5 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*6 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*7 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*8 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*9 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*10 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*11 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*12 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*13 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*14 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*15 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*16 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*17 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*18 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*19 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*20 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*21 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*22 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*23 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*24 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*25 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*26 */ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*27 */ 0 | (VTRECV_STATE_ESCAPE << 4), + /*28 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*29 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*30 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*31 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*32 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*33 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*34 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*35 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*36 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*37 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*38 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*39 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*40 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*41 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*42 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*43 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*44 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*45 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*46 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*47 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*48 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*49 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*50 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*51 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*52 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*53 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*54 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*55 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*56 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*57 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*58 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*59 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*60 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*61 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*62 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*63 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*64 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*65 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*66 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*67 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*68 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*69 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*70 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*71 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*72 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*73 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*74 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*75 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*76 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*77 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*78 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*79 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*80 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*81 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*82 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*83 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*84 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*85 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*86 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*87 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*88 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*89 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*90 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*91 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*92 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*93 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*94 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*95 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*96 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*97 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*98 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*99 */ VTRECV_ACTION_IGNORE | (0 << 4), + /*100*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*101*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*102*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*103*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*104*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*105*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*106*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*107*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*108*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*109*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*110*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*111*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*112*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*113*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*114*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*115*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*116*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*117*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*118*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*119*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*120*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*121*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*122*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*123*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*124*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*125*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*126*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*127*/ VTRECV_ACTION_IGNORE | (0 << 4), + /*128*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*129*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*130*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*131*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*132*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*133*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*134*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*135*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*136*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*137*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*138*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*139*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*140*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*141*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*142*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*143*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*144*/ 0 | (VTRECV_STATE_DCS_ENTRY << 4), + /*145*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*146*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*147*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*148*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*149*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*150*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*151*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*152*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*153*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*154*/ VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4), + /*155*/ 0 | (VTRECV_STATE_CSI_ENTRY << 4), + /*156*/ 0 | (VTRECV_STATE_GROUND << 4), + /*157*/ 0 | (VTRECV_STATE_OSC_STRING << 4), + /*158*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + /*159*/ 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4), + }, +}; +#else +typedef struct { + int state; + unsigned char code_start; + unsigned char code_end; + state_change_t state_change; +} state_table_t; + +static const state_table_t table[] = { + /* + */ + { VTRECV_STATE_CSI_ENTRY, 0, 23, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_CSI_ENTRY, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_ENTRY, 25, 25, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_CSI_ENTRY, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_ENTRY, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_CSI_ENTRY, 28, 31, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_CSI_ENTRY, 32, 47, VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4) }, + { VTRECV_STATE_CSI_ENTRY, 48, 57, VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4) }, + { VTRECV_STATE_CSI_ENTRY, 58, 58, 0 | (VTRECV_STATE_CSI_IGNORE << 4) }, + { VTRECV_STATE_CSI_ENTRY, 59, 59, VTRECV_ACTION_PARAM | (VTRECV_STATE_CSI_PARAM << 4) }, + { VTRECV_STATE_CSI_ENTRY, 60, 63, VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_PARAM << 4) }, + { VTRECV_STATE_CSI_ENTRY, 64, 126, VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_ENTRY, 127, 127, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_CSI_ENTRY, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_ENTRY, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_CSI_ENTRY, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_ENTRY, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_CSI_ENTRY, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_ENTRY, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_CSI_ENTRY, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_ENTRY, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_CSI_ENTRY, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_CSI_IGNORE, 0, 23, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_CSI_IGNORE, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_IGNORE, 25, 25, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_CSI_IGNORE, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_IGNORE, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_CSI_IGNORE, 28, 31, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_CSI_IGNORE, 32, 63, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_CSI_IGNORE, 64, 126, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_IGNORE, 127, 127, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_CSI_IGNORE, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_IGNORE, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_CSI_IGNORE, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_IGNORE, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_CSI_IGNORE, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_IGNORE, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_CSI_IGNORE, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_IGNORE, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_CSI_IGNORE, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_CSI_INTERMEDIATE, 0, 23, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 25, 25, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 28, 31, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 32, 47, VTRECV_ACTION_COLLECT | (0 << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 48, 63, 0 | (VTRECV_STATE_CSI_IGNORE << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 64, 126, VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 127, 127, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_CSI_INTERMEDIATE, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_CSI_PARAM, 0, 23, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_CSI_PARAM, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_PARAM, 25, 25, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_CSI_PARAM, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_PARAM, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_CSI_PARAM, 28, 31, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_CSI_PARAM, 32, 47, VTRECV_ACTION_COLLECT | (VTRECV_STATE_CSI_INTERMEDIATE << 4) }, + { VTRECV_STATE_CSI_PARAM, 48, 57, VTRECV_ACTION_PARAM | (0 << 4) }, + { VTRECV_STATE_CSI_PARAM, 58, 58, 0 | (VTRECV_STATE_CSI_IGNORE << 4) }, + { VTRECV_STATE_CSI_PARAM, 59, 59, VTRECV_ACTION_PARAM | (0 << 4) }, + { VTRECV_STATE_CSI_PARAM, 60, 63, 0 | (VTRECV_STATE_CSI_IGNORE << 4) }, + { VTRECV_STATE_CSI_PARAM, 64, 126, VTRECV_ACTION_CSI_DISPATCH | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_PARAM, 127, 127, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_CSI_PARAM, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_PARAM, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_CSI_PARAM, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_PARAM, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_CSI_PARAM, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_PARAM, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_CSI_PARAM, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_CSI_PARAM, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_CSI_PARAM, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_DCS_ENTRY, 0, 23, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_ENTRY, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_ENTRY, 25, 25, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_ENTRY, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_ENTRY, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_DCS_ENTRY, 28, 31, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_ENTRY, 32, 47, VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4) }, + { VTRECV_STATE_DCS_ENTRY, 48, 57, VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4) }, + { VTRECV_STATE_DCS_ENTRY, 58, 58, 0 | (VTRECV_STATE_DCS_IGNORE << 4) }, + { VTRECV_STATE_DCS_ENTRY, 59, 59, VTRECV_ACTION_PARAM | (VTRECV_STATE_DCS_PARAM << 4) }, + { VTRECV_STATE_DCS_ENTRY, 60, 63, VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_PARAM << 4) }, + { VTRECV_STATE_DCS_ENTRY, 64, 126, 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4) }, + { VTRECV_STATE_DCS_ENTRY, 127, 127, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_ENTRY, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_ENTRY, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_DCS_ENTRY, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_ENTRY, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_DCS_ENTRY, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_ENTRY, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_DCS_ENTRY, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_ENTRY, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_DCS_ENTRY, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_DCS_IGNORE, 0, 23, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_IGNORE, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_IGNORE, 25, 25, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_IGNORE, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_IGNORE, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_DCS_IGNORE, 28, 127, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_IGNORE, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_IGNORE, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_DCS_IGNORE, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_IGNORE, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_DCS_IGNORE, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_IGNORE, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_DCS_IGNORE, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_IGNORE, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_DCS_IGNORE, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_DCS_INTERMEDIATE, 0, 23, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 25, 25, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 28, 31, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 32, 47, VTRECV_ACTION_COLLECT | (0 << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 48, 63, 0 | (VTRECV_STATE_DCS_IGNORE << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 64, 126, 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 127, 127, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_DCS_INTERMEDIATE, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_DCS_PARAM, 0, 23, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_PARAM, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_PARAM, 25, 25, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_PARAM, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_PARAM, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_DCS_PARAM, 28, 31, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_PARAM, 32, 47, VTRECV_ACTION_COLLECT | (VTRECV_STATE_DCS_INTERMEDIATE << 4) }, + { VTRECV_STATE_DCS_PARAM, 48, 57, VTRECV_ACTION_PARAM | (0 << 4) }, + { VTRECV_STATE_DCS_PARAM, 58, 58, 0 | (VTRECV_STATE_DCS_IGNORE << 4) }, + { VTRECV_STATE_DCS_PARAM, 59, 59, VTRECV_ACTION_PARAM | (0 << 4) }, + { VTRECV_STATE_DCS_PARAM, 60, 63, 0 | (VTRECV_STATE_DCS_IGNORE << 4) }, + { VTRECV_STATE_DCS_PARAM, 64, 126, 0 | (VTRECV_STATE_DCS_PASSTHROUGH << 4) }, + { VTRECV_STATE_DCS_PARAM, 127, 127, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_PARAM, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_PARAM, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_DCS_PARAM, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_PARAM, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_DCS_PARAM, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_PARAM, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_DCS_PARAM, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_PARAM, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_DCS_PARAM, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_DCS_PASSTHROUGH, 0, 23, VTRECV_ACTION_PUT | (0 << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 25, 25, VTRECV_ACTION_PUT | (0 << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 28, 126, VTRECV_ACTION_PUT | (0 << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 127, 127, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_DCS_PASSTHROUGH, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_ESCAPE, 0, 23, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_ESCAPE, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE, 25, 25, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_ESCAPE, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_ESCAPE, 28, 31, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_ESCAPE, 32, 47, VTRECV_ACTION_COLLECT | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4) }, + { VTRECV_STATE_ESCAPE, 48, 79, VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE, 80, 80, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_ESCAPE, 81, 87, VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE, 88, 88, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_ESCAPE, 89, 90, VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE, 91, 91, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_ESCAPE, 92, 92, VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE, 93, 93, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_ESCAPE, 94, 95, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_ESCAPE, 96, 126, VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE, 127, 127, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_ESCAPE, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_ESCAPE, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_ESCAPE, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_ESCAPE, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_ESCAPE, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 0, 23, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 25, 25, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 28, 31, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 32, 47, VTRECV_ACTION_COLLECT | (0 << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 48, 126, VTRECV_ACTION_ESC_DISPATCH | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 127, 127, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_ESCAPE_INTERMEDIATE, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_GROUND, 0, 23, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_GROUND, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_GROUND, 25, 25, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_GROUND, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_GROUND, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_GROUND, 28, 31, VTRECV_ACTION_EXECUTE | (0 << 4) }, + { VTRECV_STATE_GROUND, 32, 127, VTRECV_ACTION_PRINT | (0 << 4) }, + { VTRECV_STATE_GROUND, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_GROUND, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_GROUND, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_GROUND, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_GROUND, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_GROUND, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_GROUND, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_GROUND, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_GROUND, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_OSC_STRING, 0, 23, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_OSC_STRING, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_OSC_STRING, 25, 25, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_OSC_STRING, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_OSC_STRING, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_OSC_STRING, 28, 31, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_OSC_STRING, 32, 127, VTRECV_ACTION_OSC_PUT | (0 << 4) }, + { VTRECV_STATE_OSC_STRING, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_OSC_STRING, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_OSC_STRING, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_OSC_STRING, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_OSC_STRING, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_OSC_STRING, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_OSC_STRING, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_OSC_STRING, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_OSC_STRING, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + /* + */ + { VTRECV_STATE_SOS_PM_APC_STRING, 0, 23, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 24, 24, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 25, 25, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 26, 26, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 27, 27, 0 | (VTRECV_STATE_ESCAPE << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 28, 127, VTRECV_ACTION_IGNORE | (0 << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 128, 143, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 144, 144, 0 | (VTRECV_STATE_DCS_ENTRY << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 145, 151, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 152, 152, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 153, 154, VTRECV_ACTION_EXECUTE | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 155, 155, 0 | (VTRECV_STATE_CSI_ENTRY << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 156, 156, 0 | (VTRECV_STATE_GROUND << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 157, 157, 0 | (VTRECV_STATE_OSC_STRING << 4) }, + { VTRECV_STATE_SOS_PM_APC_STRING, 158, 159, 0 | (VTRECV_STATE_SOS_PM_APC_STRING << 4) }, +}; +#endif + +static const vtrecv_action_t ENTRY_ACTIONS[] = { + VTRECV_ACTION_CLEAR, /* CSI_ENTRY */ + 0 /* none for CSI_IGNORE */, + 0 /* none for CSI_INTERMEDIATE */, + 0 /* none for CSI_PARAM */, + VTRECV_ACTION_CLEAR, /* DCS_ENTRY */ + 0 /* none for DCS_IGNORE */, + 0 /* none for DCS_INTERMEDIATE */, + 0 /* none for DCS_PARAM */, + VTRECV_ACTION_HOOK, /* DCS_PASSTHROUGH */ + VTRECV_ACTION_CLEAR, /* ESCAPE */ + 0 /* none for ESCAPE_INTERMEDIATE */, + 0 /* none for GROUND */, + VTRECV_ACTION_OSC_START, /* OSC_STRING */ + 0 /* none for SOS_PM_APC_STRING */, +}; + +static const vtrecv_action_t EXIT_ACTIONS[] = { + 0 /* none for CSI_ENTRY */, + 0 /* none for CSI_IGNORE */, + 0 /* none for CSI_INTERMEDIATE */, + 0 /* none for CSI_PARAM */, + 0 /* none for DCS_ENTRY */, + 0 /* none for DCS_IGNORE */, + 0 /* none for DCS_INTERMEDIATE */, + 0 /* none for DCS_PARAM */, + VTRECV_ACTION_UNHOOK, /* DCS_PASSTHROUGH */ + 0 /* none for ESCAPE */, + 0 /* none for ESCAPE_INTERMEDIATE */, + 0 /* none for GROUND */, + VTRECV_ACTION_OSC_END, /* OSC_STRING */ + 0 /* none for SOS_PM_APC_STRING */, +}; + +state_change_t GET_STATE_TABLE(const int state, const int ch) +{ +#if (USE_ORIGINAL_LUT==1) + /* + * テーブル参照による実現。 + * 固定時間で動作するが、コードサイズは比較的大きい。 + */ + return STATE_TABLE[state - 1][ch]; +#else + /* + * プログラムによる線形探索バージョン。 + * テーブルの後方にあるデータになるほど動作は遅い。 + * コードサイズはテーブル参照よりも小さい。 + */ + const int N = sizeof(table) / sizeof(table[0]); + const state_table_t *tp = &table[0]; + int i; + for (i = 0; i < N; i++) { + if (tp->state == state) { + if ((tp->code_start <= ch) && (ch <= tp->code_end)) { + return tp->state_change; + } + } + tp++; + } + return 0; +#endif +} + +vtrecv_action_t GET_ENTRY_ACTIONS(const int state) +{ + return ENTRY_ACTIONS[state]; +} + +vtrecv_action_t GET_EXIT_ACTIONS(const int state) +{ + return EXIT_ACTIONS[state]; +} + +void vtrecv_init(vtrecv_t *parser, vtrecv_callback_t cb) +{ + parser->state = VTRECV_STATE_GROUND; + parser->num_intermediate_chars = 0; + parser->num_params = 0; + parser->ignore_flagged = 0; + parser->cb = cb; +} + +static void do_action(vtrecv_t *parser, vtrecv_action_t action, char ch) +{ + /* Some actions we handle internally (like parsing parameters), others + * we hand to our client for processing */ + + switch (action) { + case VTRECV_ACTION_PRINT: + case VTRECV_ACTION_EXECUTE: + case VTRECV_ACTION_HOOK: + case VTRECV_ACTION_PUT: + case VTRECV_ACTION_OSC_START: + case VTRECV_ACTION_OSC_PUT: + case VTRECV_ACTION_OSC_END: + case VTRECV_ACTION_UNHOOK: + case VTRECV_ACTION_CSI_DISPATCH: + case VTRECV_ACTION_ESC_DISPATCH: + parser->cb(parser, action, ch); + break; + + case VTRECV_ACTION_IGNORE: + /* do nothing */ + break; + + case VTRECV_ACTION_COLLECT: + { + /* Append the character to the intermediate params */ + if (parser->num_intermediate_chars + 1 > MAX_INTERMEDIATE_CHARS) { + parser->ignore_flagged = 1; + } else { + parser->intermediate_chars[parser->num_intermediate_chars++] = ch; + } + + break; + } + + case VTRECV_ACTION_PARAM: + { + /* process the param character */ + if (ch == ';') { + parser->num_params += 1; + parser->params[parser->num_params-1] = 0; + } else { + /* the character is a digit */ + int current_param; + + if (parser->num_params == 0) { + parser->num_params = 1; + parser->params[0] = 0; + } + + current_param = parser->num_params - 1; + parser->params[current_param] *= 10; + parser->params[current_param] += (ch - '0'); + } + + break; + } + + case VTRECV_ACTION_CLEAR: + parser->num_intermediate_chars = 0; + parser->num_params = 0; + parser->ignore_flagged = 0; + break; + + default: + parser->cb(parser, VTRECV_ACTION_ERROR, 0); + break; + } +} + +static void do_state_change(vtrecv_t *parser, state_change_t change, char ch) +{ + /* A state change is an action and/or a new state to transition to. */ + + vtrecv_state_t new_state = STATE(change); + vtrecv_action_t action = ACTION(change); + + if (new_state) { + /* + * Perform up to three actions: + * 1. the exit action of the old state + * 2. the action associated with the transition + * 3. the entry action of the new state + */ + + vtrecv_action_t exit_action = GET_EXIT_ACTIONS(parser->state - 1); + vtrecv_action_t entry_action = GET_ENTRY_ACTIONS(new_state - 1); + + if (exit_action) { + do_action(parser, exit_action, 0); + } + + if (action) { + do_action(parser, action, ch); + } + + if (entry_action) { + do_action(parser, entry_action, 0); + } + + parser->state = new_state; + } else { + do_action(parser, action, ch); + } +} + +void vtrecv_execute(vtrecv_t *parser, unsigned char *data, int len) +{ + int i; + for (i = 0; i < len; i++) { + unsigned char ch = data[i]; + state_change_t change = GET_STATE_TABLE(parser->state, ch); + do_state_change(parser, change, ch); + } +} + diff --git a/gat_stand_fw/user/console/ntshell/core/vtrecv.h b/gat_stand_fw/user/console/ntshell/core/vtrecv.h new file mode 100644 index 0000000..e2c64c9 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/vtrecv.h @@ -0,0 +1,130 @@ +/** + * @file vtrecv.h + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * @note + * An implementation of Paul Williams' DEC compatible state machine parser. + * This code is in the public domain. + * + * @author Joshua Haberman + * @author Shinichiro Nakamura : Modified for Natural Tiny Shell (NT-Shell) + */ + +#ifndef VTRECV_H +#define VTRECV_H + +/** + * @brief オリジナルに含まれるLUTを使うかどうかを決定する。 + * @details + * オリジナルでは、シーケンスの遷移をテーブル参照で実装してあった。 + * 15のステートで取りうる256パターンの入力を全網羅するテーブルである。 + * これは3840個のテーブルデータを持つことになる。 + * + * テーブル参照はメモリに対してリニアアクセス可能なプロセッサにおいて + * 固定時間で動作する。テーブル参照のメリットは固定時間での処理である。 + * + * 一方、新たに実装した方法は、重複するデータが多数存在する事に着目した + * もので、区間毎に適用するシーケンスを定義したテーブルを用いる。 + * これはテーブルを線形探索するため後方にあるデータになるほど動作は遅い。 + * しかし、コードサイズはオリジナルの全網羅形式のテーブルよりも小さい。 + * + * @retval 0 使わない。 + * @retval 1 使う。 + */ +#define USE_ORIGINAL_LUT (0) + +#define MAX_INTERMEDIATE_CHARS 2 +#define ACTION(state_change) (vtrecv_action_t)((state_change & 0x0F) >> 0) +#define STATE(state_change) (vtrecv_state_t)((state_change & 0xF0) >> 4) + +typedef enum { + VTRECV_STATE_CSI_ENTRY = 1, + VTRECV_STATE_CSI_IGNORE = 2, + VTRECV_STATE_CSI_INTERMEDIATE = 3, + VTRECV_STATE_CSI_PARAM = 4, + VTRECV_STATE_DCS_ENTRY = 5, + VTRECV_STATE_DCS_IGNORE = 6, + VTRECV_STATE_DCS_INTERMEDIATE = 7, + VTRECV_STATE_DCS_PARAM = 8, + VTRECV_STATE_DCS_PASSTHROUGH = 9, + VTRECV_STATE_ESCAPE = 10, + VTRECV_STATE_ESCAPE_INTERMEDIATE = 11, + VTRECV_STATE_GROUND = 12, + VTRECV_STATE_OSC_STRING = 13, + VTRECV_STATE_SOS_PM_APC_STRING = 14, +} vtrecv_state_t; + +typedef enum { + VTRECV_ACTION_CLEAR = 1, + VTRECV_ACTION_COLLECT = 2, + VTRECV_ACTION_CSI_DISPATCH = 3, + VTRECV_ACTION_ESC_DISPATCH = 4, + VTRECV_ACTION_EXECUTE = 5, + VTRECV_ACTION_HOOK = 6, + VTRECV_ACTION_IGNORE = 7, + VTRECV_ACTION_OSC_END = 8, + VTRECV_ACTION_OSC_PUT = 9, + VTRECV_ACTION_OSC_START = 10, + VTRECV_ACTION_PARAM = 11, + VTRECV_ACTION_PRINT = 12, + VTRECV_ACTION_PUT = 13, + VTRECV_ACTION_UNHOOK = 14, + VTRECV_ACTION_ERROR = 15, +} vtrecv_action_t; + +typedef unsigned char state_change_t; +struct vtrecv; +typedef void (*vtrecv_callback_t)(struct vtrecv*, vtrecv_action_t, unsigned char); +typedef struct vtrecv { + vtrecv_state_t state; + vtrecv_callback_t cb; + unsigned char intermediate_chars[MAX_INTERMEDIATE_CHARS+1]; + int num_intermediate_chars; + char ignore_flagged; + int params[16]; + int num_params; + void* user_data; +} vtrecv_t; + +#ifdef __cplusplus +extern "C" { +#endif + +void vtrecv_init(vtrecv_t *parser, vtrecv_callback_t cb); +void vtrecv_execute(vtrecv_t *parser, unsigned char *data, int len); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/gat_stand_fw/user/console/ntshell/core/vtsend.c b/gat_stand_fw/user/console/ntshell/core/vtsend.c new file mode 100644 index 0000000..93dfddd --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/vtsend.c @@ -0,0 +1,270 @@ +/** + * @file vtsend.c + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "vtsend.h" + +#define ESC (0x1B) +#define UART_WRITE(P, BUF, SIZ) (P)->uart_write(BUF, SIZ, (P)->extobj) + +int vtsend_init(vtsend_t *p, VTSEND_SERIAL_WRITE uart_write, void *extobj) +{ + p->uart_write = uart_write; + p->extobj = extobj; + return 0; +} + +int vtsend_cursor_position(vtsend_t *p, const int column, const int line) +{ + char buf[8]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '0' + (line / 10); + buf[3] = '0' + (line % 10); + buf[4] = ';'; + buf[5] = '0' + (column / 10); + buf[6] = '0' + (column % 10); + buf[7] = 'H'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_cursor_up(vtsend_t *p, const int n) +{ + char buf[5]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '0' + (n / 10); + buf[3] = '0' + (n % 10); + buf[4] = 'A'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_cursor_down(vtsend_t *p, const int n) +{ + char buf[5]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '0' + (n / 10); + buf[3] = '0' + (n % 10); + buf[4] = 'B'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_cursor_forward(vtsend_t *p, const int n) +{ + char buf[5]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '0' + (n / 10); + buf[3] = '0' + (n % 10); + buf[4] = 'C'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_cursor_backward(vtsend_t *p, const int n) +{ + char buf[5]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '0' + (n / 10); + buf[3] = '0' + (n % 10); + buf[4] = 'D'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_cursor_position_save(vtsend_t *p) +{ + char buf[3]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = 's'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_cursor_position_restore(vtsend_t *p) +{ + char buf[3]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = 'u'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_erase_display(vtsend_t *p) +{ + char buf[4]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '2'; + buf[3] = 'J'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_erase_line(vtsend_t *p) +{ + char buf[4]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '2'; + buf[3] = 'K'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_set_color_foreground(vtsend_t *p, const int color) +{ + char buf[5]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '0' + ((30 + color) / 10); + buf[3] = '0' + ((30 + color) % 10); + buf[4] = 'm'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_set_color_background(vtsend_t *p, const int color) +{ + char buf[5]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '0' + ((40 + color) / 10); + buf[3] = '0' + ((40 + color) % 10); + buf[4] = 'm'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_set_attribute(vtsend_t *p, const int attr) +{ + char buf[5]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '0' + ((attr) / 10); + buf[3] = '0' + ((attr) % 10); + buf[4] = 'm'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_set_scroll_region(vtsend_t *p, const int top, const int bottom) +{ + char buf[8]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '0' + (top / 10); + buf[3] = '0' + (top % 10); + buf[4] = ';'; + buf[5] = '0' + (bottom / 10); + buf[6] = '0' + (bottom % 10); + buf[7] = 'r'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_set_cursor(vtsend_t *p, const int visible) +{ + if (visible) { + char buf[6]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '?'; + buf[3] = '2'; + buf[4] = '5'; + buf[5] = 'h'; + UART_WRITE(p, buf, sizeof(buf)); + } else { + char buf[6]; + buf[0] = ESC; + buf[1] = '['; + buf[2] = '?'; + buf[3] = '2'; + buf[4] = '5'; + buf[5] = 'l'; + UART_WRITE(p, buf, sizeof(buf)); + } + return 0; +} + +int vtsend_reset(vtsend_t *p) +{ + char buf[2]; + buf[0] = ESC; + buf[1] = 'c'; + UART_WRITE(p, buf, sizeof(buf)); + return 0; +} + +int vtsend_draw_box( + vtsend_t *p, + const int x1, const int y1, const int x2, const int y2) +{ + int i; + + vtsend_cursor_position(p, x1, y1); + for (i = x1; i <= x2; i++) { + UART_WRITE(p, " ", 1); + } + vtsend_cursor_position(p, x1, y2); + for (i = x1; i <= x2; i++) { + UART_WRITE(p, " ", 1); + } + for (i = y1; i <= y2; i++) { + vtsend_cursor_position(p, x1, i); + UART_WRITE(p, " ", 1); + vtsend_cursor_position(p, x2, i); + UART_WRITE(p, " ", 1); + } + return 0; +} + +int vtsend_fill_box( + vtsend_t *p, + const int x1, const int y1, const int x2, const int y2) +{ + int i, j; + for (i = y1; i <= y2; i++) { + vtsend_cursor_position(p, x1, i); + for (j = x1; j <= x2; j++) { + UART_WRITE(p, " ", 1); + } + } + return 0; +} + diff --git a/gat_stand_fw/user/console/ntshell/core/vtsend.h b/gat_stand_fw/user/console/ntshell/core/vtsend.h new file mode 100644 index 0000000..3835571 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/core/vtsend.h @@ -0,0 +1,92 @@ +/** + * @file vtsend.h + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef VTSEND_H +#define VTSEND_H + +#define VTSEND_COLOR_BLACK (0) +#define VTSEND_COLOR_RED (1) +#define VTSEND_COLOR_GREEN (2) +#define VTSEND_COLOR_YELLOW (3) +#define VTSEND_COLOR_BLUE (4) +#define VTSEND_COLOR_MAGENTA (5) +#define VTSEND_COLOR_CYAN (6) +#define VTSEND_COLOR_WHITE (7) + +#define VTSEND_ATTR_OFF (0) +#define VTSEND_ATTR_BOLD_ON (1) +#define VTSEND_ATTR_UNDERSCORE (4) +#define VTSEND_ATTR_BLINK_ON (5) +#define VTSEND_ATTR_REVERSE (7) +#define VTSEND_ATTR_CONCEALED_ON (8) + +typedef int (*VTSEND_SERIAL_WRITE)(const char *buf, const int siz, void *extobj); + +typedef struct { + VTSEND_SERIAL_WRITE uart_write; + void *extobj; +} vtsend_t; + +#ifdef __cplusplus +extern "C" { +#endif + +int vtsend_init(vtsend_t *p, VTSEND_SERIAL_WRITE uart_write, void *extobj); +int vtsend_cursor_position(vtsend_t *p, const int column, const int line); +int vtsend_cursor_up(vtsend_t *p, const int n); +int vtsend_cursor_down(vtsend_t *p, const int n); +int vtsend_cursor_forward(vtsend_t *p, const int n); +int vtsend_cursor_backward(vtsend_t *p, const int n); +int vtsend_cursor_position_save(vtsend_t *p); +int vtsend_cursor_position_restore(vtsend_t *p); +int vtsend_erase_display(vtsend_t *p); +int vtsend_erase_line(vtsend_t *p); +int vtsend_set_color_foreground(vtsend_t *p, const int color); +int vtsend_set_color_background(vtsend_t *p, const int color); +int vtsend_set_attribute(vtsend_t *p, const int attr); +int vtsend_set_scroll_region(vtsend_t *p, const int top, const int bottom); +int vtsend_set_cursor(vtsend_t *p, const int visible); +int vtsend_reset(vtsend_t *p); + +int vtsend_draw_box( + vtsend_t *p, + const int x1, const int y1, const int x2, const int y2); +int vtsend_fill_box( + vtsend_t *p, + const int x1, const int y1, const int x2, const int y2); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/gat_stand_fw/user/console/ntshell/util/ntopt.c b/gat_stand_fw/user/console/ntshell/util/ntopt.c new file mode 100644 index 0000000..f9feb40 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/util/ntopt.c @@ -0,0 +1,156 @@ +/** + * @file ntopt.c + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "ntopt.h" + +/** + * @brief Is the character delimiter? + * @param c The character. + * @retval true It's a delimiter. + * @retval false It's not a delimiter. + */ +#define IS_DELIM(c) \ + (((c) == '\r') || ((c) == '\n') || ((c) == '\t') || ((c) == '\0') || ((c) == ' ')) + +static int ntopt_get_count(const char *str); +static char *ntopt_get_text( + const char *str, const int n, char *buf, int siz, int *len); + +/** + * @brief Get the sentence count of the given text string. + * @param str A text string. + * @return Count of the given sentence. + */ +static int ntopt_get_count(const char *str) +{ + int cnt = 0; + int wc = 0; + char *p = (char *)str; + while (*p) { + if (!IS_DELIM(*p)) { + wc++; + if (wc == 1) { + cnt++; + } + } else { + wc = 0; + } + p++; + } + return cnt; +} + +/** + * @brief Get the sentence of the given text string. + * @param str A text string. + * @param n Index number. (0 to ntopt-get_count(str) - 1) + * @param buf The pointer to a stored buffer. + * @param siz The size of the stored buffer. + * @param len The stored string length. + * @retval !NULL Success. The pointer to the buffer. + * @retval NULL Failure. + */ +static char *ntopt_get_text( + const char *str, const int n, char *buf, int siz, int *len) +{ + int cnt = 0; + int wc = 0; + char *p = (char *)str; + *len = 0; + while (*p) { + if (!IS_DELIM(*p)) { + wc++; + if (wc == 1) { + if (cnt == n) { + char *des = buf; + int cc = 0; + while (!IS_DELIM(*p)) { + cc++; + if (siz <= cc) { + break; + } + *des = *p; + des++; + p++; + } + *des = '\0'; + *len = cc; + return buf; + } + cnt++; + } + } else { + wc = 0; + } + p++; + } + return (char *)0; +} + +/** + * @brief Parse the given text string. + * @param str A text string. + * @param func The callback function. + * @param extobj An external object for the callback function. + * @return The return value from the callback. + */ +int ntopt_parse(const char *str, NTOPT_CALLBACK func, void *extobj) +{ + int argc; + char argv[NTOPT_TEXT_MAXLEN]; + char *argvp[NTOPT_TEXT_MAXARGS]; + int i; + int total; + char *p; + + argc = ntopt_get_count(str); + if (NTOPT_TEXT_MAXARGS <= argc) { + argc = NTOPT_TEXT_MAXARGS; + } + + total = 0; + p = &argv[0]; + for (i = 0; i < argc; i++) { + int len; + argvp[i] = ntopt_get_text( + str, i, p, NTOPT_TEXT_MAXLEN - total, &len); + if (total + len + 1 < NTOPT_TEXT_MAXLEN) { + p += len + 1; + total += len + 1; + } else { + break; + } + } + + return func(argc, &argvp[0], extobj); +} + diff --git a/gat_stand_fw/user/console/ntshell/util/ntopt.h b/gat_stand_fw/user/console/ntshell/util/ntopt.h new file mode 100644 index 0000000..6874792 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/util/ntopt.h @@ -0,0 +1,70 @@ +/** + * @file ntopt.h + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef NTOPT_H +#define NTOPT_H + +#include "../core/ntconf.h" + +/** + * @brief The text maximum length. + */ +#define NTOPT_TEXT_MAXLEN (NTCONF_EDITOR_MAXLEN) + +/** + * @brief The text maximum arguments. + */ +#define NTOPT_TEXT_MAXARGS (NTCONF_EDITOR_MAXLEN / 2) + +/** + * @brief The callback function. + * + * @param argc The number of the parameters. + * @param argv The pointer to the parameters. + * @param extobj The external object. + * + * @return A return value. + */ +typedef int (*NTOPT_CALLBACK)(int argc, char **argv, void *extobj); + +#ifdef __cplusplus +extern "C" { +#endif + +int ntopt_parse(const char *str, NTOPT_CALLBACK func, void *extobj); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/gat_stand_fw/user/console/ntshell/util/ntstdio.c b/gat_stand_fw/user/console/ntshell/util/ntstdio.c new file mode 100644 index 0000000..bf4615e --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/util/ntstdio.c @@ -0,0 +1,364 @@ +/** + * @file ntstdio.c + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/*------------------------------------------------------------------------/ +/ Universal string handler for user console interface +/-------------------------------------------------------------------------/ +/ +/ Copyright (C) 2011, ChaN, all right reserved. +/ +/ * This software is a free software and there is NO WARRANTY. +/ * No restriction on use. You can use, modify and redistribute it for +/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY. +/ * Redistributions of source code must retain the above copyright notice. +/ +/-------------------------------------------------------------------------*/ + +#include +#include "ntstdio.h" + +#define FLAG_ZERO_PADDED (1 << 0) +#define FLAG_LEFT_JUSTIFIED (1 << 1) +#define FLAG_SIZE_LONG_INT (1 << 2) +#define FLAG_SIGNED_DECIMAL (1 << 3) + +/* + * ntstdio_printf("%d", 1234); "1234" + * ntstdio_printf("%6d,%3d%%", -200, 5); " -200, 5%" + * ntstdio_printf("%-6u", 100); "100 " + * ntstdio_printf("%ld", 12345678L); "12345678" + * ntstdio_printf("%04x", 0xA3); "00a3" + * ntstdio_printf("%08LX", 0x123ABC); "00123ABC" + * ntstdio_printf("%016b", 0x550F); "0101010100001111" + * ntstdio_printf("%s", "String"); "String" + * ntstdio_printf("%-4s", "abc"); "abc " + * ntstdio_printf("%4s", "abc"); " abc" + * ntstdio_printf("%c", 'a'); "a" + * ntstdio_printf("%f", 10.0); + */ + +static void xvprintf(ntstdio_t *handle, const char *fmt, va_list arp) +{ + unsigned int i, j; + unsigned int flag, radix, width; + unsigned long value; + char s[16], c, d, *p; + + while (1) { + /* + * Get a character. + */ + c = *fmt++; + if (!c) { + /* + * End of the format. + */ + break; + } + if (c != '%') { + /* + * Pass through it if not a % sequense + */ + ntstdio_putc(handle, c); + continue; + } + + /* + * Reset the flag. + */ + flag = 0; + + /* + * Get the first character of the sequense. + */ + c = *fmt++; + if (c == '0') { + flag = FLAG_ZERO_PADDED; + c = *fmt++; + } else { + if (c == '-') { + flag = FLAG_LEFT_JUSTIFIED; + c = *fmt++; + } + } + /* + * Calculate the minimum width. + */ + for (width = 0; (c >= '0') && (c <= '9'); c = *fmt++) { + width = (width * 10) + (c - '0'); + } + if ((c == 'l') || (c == 'L')) { + flag |= FLAG_SIZE_LONG_INT; + c = *fmt++; + } + if (!c) { + /* + * End of the format. + */ + break; + } + d = c; + if (d >= 'a') { + d -= 0x20; + } + /* Type is... */ + switch (d) { + case 'S' : + /* String */ + p = va_arg(arp, char*); + for (j = 0; p[j]; j++) { + } + while (!(flag & FLAG_LEFT_JUSTIFIED) && (j++ < width)) { + ntstdio_putc(handle, ' '); + } + ntstdio_puts(handle, p); + while (j++ < width) { + ntstdio_putc(handle, ' '); + } + continue; + case 'C' : + /* Character */ + ntstdio_putc(handle, (char)va_arg(arp, int)); + continue; + case 'B' : + /* Binary */ + radix = 2; + break; + case 'O' : + /* Octal */ + radix = 8; + break; + case 'D' : + /* Signed decimal */ + radix = 10; + break; + case 'U' : + /* Unsigned decimal */ + radix = 10; + break; + case 'X' : + /* Hexdecimal */ + radix = 16; + break; + default: + /* Unknown type (passthrough) */ + ntstdio_putc(handle, c); + continue; + } + + /* + * Get an argument and put it in numeral. + */ + value = (flag & FLAG_SIZE_LONG_INT) ? va_arg(arp, long) : ((d == 'D') ? (long)va_arg(arp, int) : (long)va_arg(arp, unsigned int)); + if ((d == 'D') && (value & 0x80000000)) { + value = 0 - value; + flag |= FLAG_SIGNED_DECIMAL; + } + i = 0; + do { + d = (char)(value % radix); + value /= radix; + if (d > 9) { + d += (c == 'x') ? 0x27 : 0x07; + } + s[i++] = d + '0'; + } while (value && (i < sizeof(s))); + if (flag & FLAG_SIGNED_DECIMAL) { + s[i++] = '-'; + } + j = i; + d = (flag & FLAG_ZERO_PADDED) ? '0' : ' '; + while (!(flag & FLAG_LEFT_JUSTIFIED) && (j++ < width)) { + ntstdio_putc(handle, d); + } + do { + ntstdio_putc(handle, s[--i]); + } while(i); + while (j++ < width) { + ntstdio_putc(handle, ' '); + } + } +} + +void ntstdio_init(ntstdio_t *handle, unsigned int option, NTSTDIO_XI xi, NTSTDIO_XO xo) +{ + handle->xi = xi; + handle->xo = xo; + handle->outptr = 0; + handle->option = option; +} + +void ntstdio_putc(ntstdio_t *handle, char c) +{ + if ((handle->option & NTSTDIO_OPTION_CR_CRLF) && (c == '\n')) { + ntstdio_putc(handle, '\r'); + } + + if (handle->outptr) { + *(handle->outptr)++ = (unsigned char)c; + return; + } + + if (handle->xo) { + handle->xo((unsigned char)c); + } +} + +void ntstdio_puts(ntstdio_t *handle, const char *str) +{ + while (*str) { + ntstdio_putc(handle, *str++); + } +} + +void ntstdio_fputs(ntstdio_t *handle, NTSTDIO_XO xo, const char *str) +{ + void (*pf)(unsigned char); + + /* Save current output device */ + pf = handle->xo; + /* Switch output to specified device */ + handle->xo = xo; + + while (*str) { + ntstdio_putc(handle, *str++); + } + + /* Restore output device */ + handle->xo = pf; +} + +void ntstdio_printf(ntstdio_t *handle, const char *fmt, ...) +{ + va_list arp; + va_start(arp, fmt); + xvprintf(handle, fmt, arp); + va_end(arp); +} + +void ntstdio_sprintf(ntstdio_t *handle, char *buf, const char *fmt, ...) +{ + va_list arp; + /* Switch destination for memory */ + handle->outptr = buf; + va_start(arp, fmt); + xvprintf(handle, fmt, arp); + va_end(arp); + + /* Terminate output string with a \0 */ + *(handle->outptr) = 0; + /* Switch destination for device */ + handle->outptr = 0; +} + +void ntstdio_fprintf(ntstdio_t *handle, NTSTDIO_XO xo, const char *fmt, ...) +{ + va_list arp; + void (*pf)(unsigned char); + + /* Save current output device */ + pf = handle->xo; + /* Switch output to specified device */ + handle->xo = xo; + + va_start(arp, fmt); + xvprintf(handle, fmt, arp); + va_end(arp); + + /* Restore output device */ + handle->xo = pf; +} + +/* 0:End of stream, 1:A line arrived */ +int ntstdio_gets(ntstdio_t *handle, char *buf, int len) +{ + int c, i; + + if (!handle->xi) { + /* No input function specified */ + return 0; + } + + i = 0; + for (;;) { + /* Get a char from the incoming stream */ + c = handle->xi(); + if (!c) { + /* End of stream */ + return 0; + } + if (c == '\r') { + /* End of line */ + break; + } + if ((c == '\b') && i) { + /* Back space */ + i--; + if (handle->option & NTSTDIO_OPTION_LINE_ECHO) { + ntstdio_putc(handle, c); + } + continue; + } + if ((c >= ' ') && (i < len - 1)) { + /* Visible chars */ + buf[i++] = c; + if (handle->option & NTSTDIO_OPTION_LINE_ECHO) { + ntstdio_putc(handle, c); + } + } + } + buf[i] = 0; + /* Terminate with a \0 */ + if (handle->option & NTSTDIO_OPTION_LINE_ECHO) { + ntstdio_putc(handle, '\n'); + } + return 1; +} + +/* 0:End of stream, 1:A line arrived */ +int ntstdio_fgets(ntstdio_t *handle, NTSTDIO_XI xi, char *buf, int len) +{ + unsigned char (*pf)(void); + int n; + + /* Save current input device */ + pf = handle->xi; + /* Switch input to specified device */ + handle->xi = xi; + /* Get a line */ + n = ntstdio_gets(handle, buf, len); + /* Restore input device */ + handle->xi = pf; + + return n; +} + diff --git a/gat_stand_fw/user/console/ntshell/util/ntstdio.h b/gat_stand_fw/user/console/ntshell/util/ntstdio.h new file mode 100644 index 0000000..0134c93 --- /dev/null +++ b/gat_stand_fw/user/console/ntshell/util/ntstdio.h @@ -0,0 +1,82 @@ +/** + * @file ntstdio.h + * @author CuBeatSystems + * @author Shinichiro Nakamura + * @copyright + * =============================================================== + * Natural Tiny Shell (NT-Shell) Version 0.3.1 + * =============================================================== + * Copyright (c) 2010-2016 Shinichiro Nakamura + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/*------------------------------------------------------------------------/ +/ Universal string handler for user console interface +/-------------------------------------------------------------------------/ +/ +/ Copyright (C) 2011, ChaN, all right reserved. +/ +/ * This software is a free software and there is NO WARRANTY. +/ * No restriction on use. You can use, modify and redistribute it for +/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY. +/ * Redistributions of source code must retain the above copyright notice. +/ +/-------------------------------------------------------------------------*/ + +#ifndef NTSTDIO_H +#define NTSTDIO_H + +/** + * 1: Convert \n ==> \r\n in the output char. + */ +#define NTSTDIO_OPTION_CR_CRLF (1 << 0) + +/** + * 1: Echo back input chars in ntstdio_gets function. + */ +#define NTSTDIO_OPTION_LINE_ECHO (1 << 1) + +typedef unsigned char (*NTSTDIO_XI)(void); +typedef void (*NTSTDIO_XO)(unsigned char c); + +typedef struct { + NTSTDIO_XI xi; + NTSTDIO_XO xo; + char *outptr; + unsigned int option; +} ntstdio_t; + +void ntstdio_init(ntstdio_t *handle, unsigned int option, NTSTDIO_XI xi, NTSTDIO_XO xo); + +void ntstdio_putc(ntstdio_t *handle, char c); +void ntstdio_puts(ntstdio_t *handle, const char *str); +void ntstdio_fputs(ntstdio_t *handle, NTSTDIO_XO xo, const char *str); +void ntstdio_printf(ntstdio_t *handle, const char *fmt, ...); +void ntstdio_sprintf(ntstdio_t *handle, char *buf, const char *fmt, ...); +void ntstdio_fprintf(ntstdio_t *handle, NTSTDIO_XO xo, const char *fmt, ...); + +int ntstdio_gets(ntstdio_t *handle, char *buf, int len); +int ntstdio_fgets(ntstdio_t *handle, NTSTDIO_XI xi, char *buf, int len); + +#endif + diff --git a/gat_stand_fw/user/main.c b/gat_stand_fw/user/main.c index e4834c2..52b8a95 100644 --- a/gat_stand_fw/user/main.c +++ b/gat_stand_fw/user/main.c @@ -15,7 +15,7 @@ * * - implement config storage * - * - implement USB CDC commmand shell + * - implement USB CDC command shell * * - when USB is not active, go into super low power state * - light sensor is only checked once every two seconds or so @@ -33,6 +33,7 @@ #include "periph/usb/cdc.h" #include "usb_lib.h" +#include "console/console.h" @@ -194,8 +195,17 @@ int main(void) USB_Init(); usb_intr_init(); + console_init(); + // let's do this while (1) { + // todo: add check to see if USB is connected + if (1) { + console_process(); + } else { + console_stop(); + } + __WFI(); } } diff --git a/gat_stand_fw/user/periph/rgbled.c b/gat_stand_fw/user/periph/rgbled.c index b97cd2b..17986b8 100644 --- a/gat_stand_fw/user/periph/rgbled.c +++ b/gat_stand_fw/user/periph/rgbled.c @@ -120,7 +120,7 @@ void rgbled_update() void rgbled_init() { - TIM_TimeBaseInitTypeDef timer ={0}; + TIM_TimeBaseInitTypeDef timer = {0}; TIM_OCInitTypeDef pwm = {0}; timer.TIM_Period = (1 << 10) - 1; // 10-bit diff --git a/gat_stand_fw/user/version.h b/gat_stand_fw/user/version.h new file mode 100644 index 0000000..b5f865e --- /dev/null +++ b/gat_stand_fw/user/version.h @@ -0,0 +1,17 @@ +/* + * version.h + * + * Created on: Nov 6, 2024 + * Author: true + */ + +#ifndef USER_VERSION_H_ +#define USER_VERSION_H_ + + + +#define FW_VERSION "20241106.0" + + + +#endif /* USER_VERSION_H_ */