OSDN Git Service

チケット #30491 Natural Tiny Shell (NT-Shell)の追加を実施。
authorShinichiro Nakamura <shinta.main.jp@gmail.com>
Sat, 12 Jan 2013 13:04:37 +0000 (22:04 +0900)
committerShinichiro Nakamura <shinta.main.jp@gmail.com>
Sat, 12 Jan 2013 13:04:37 +0000 (22:04 +0900)
Natural Tiny Shell (NT-Shell)をUZUMEシステムで選択して使用可能なサービス
として追加する。
Natural Tiny Shell (NT-Shell)を用いる事で、ホストからターゲットに対する
指令がやりやすくなる。
結果的にUZUMEを使用して開発するフレームワーク・ユーザがUZUMEを使ったアプ
リケーション開発に注力できるようになる。

実際に使用する場合、kernel/config/blackfin下にある各BSPのMakefile.config
に、これらNT-ShellのCソースから生成されるオブジェクトファイルのリストを
KERNEL_COBJSに追加すること。
また、同ファイルのINCLUDESに-I$(SRCDIR)/uzume/ntshellの追加も必要である


21 files changed:
uzumeapp/kernel/uzume/ntshell/ntconf.h [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/ntint.h [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/ntlibc.c [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/ntlibc.h [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/ntopt.c [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/ntopt.h [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/ntshell.c [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/ntshell.h [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/ntshell_task.c [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/ntshell_task.cfg [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/ntshell_task.h [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/text_editor.c [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/text_editor.h [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/text_history.c [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/text_history.h [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/vtrecv.c [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/vtrecv.h [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/vtsend.c [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/vtsend.h [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/xprintf.c [new file with mode: 0644]
uzumeapp/kernel/uzume/ntshell/xprintf.h [new file with mode: 0644]

diff --git a/uzumeapp/kernel/uzume/ntshell/ntconf.h b/uzumeapp/kernel/uzume/ntshell/ntconf.h
new file mode 100644 (file)
index 0000000..490c49f
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+ * @file ntconf.h
+ * @author Shinichiro Nakamura
+ * @brief NT-Shellのコンフィギュレーション。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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
+ * ここでは、NT-Shellの内部実装で使用する共通の定義を行なう。
+ * NT-Shell内部では、複数のモジュールが互いに緩い依存関係を持つ。
+ * これはNT-Shellの最上位モジュールであるntshellが各モジュールを
+ * 使って機能を実現するためである。
+ */
+
+/**
+ * @brief 1行あたりの最大文字数。
+ */
+#define NTCONF_EDITOR_MAXLEN    (32)
+
+/**
+ * @brief テキストヒストリ数。
+ */
+#define NTCONF_HISTORY_DEPTH    (8)
+
+#endif
+
diff --git a/uzumeapp/kernel/uzume/ntshell/ntint.h b/uzumeapp/kernel/uzume/ntshell/ntint.h
new file mode 100644 (file)
index 0000000..868b156
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * @file ntint.h
+ * @author Shinichiro Nakamura
+ * @brief 整数型定義。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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
+ * このファイルでは整数型定義を行なう。
+ * 整数型定義は、比較的新しいツールチェインで
+ * #include <stdint.h>を期待しても良いが、
+ * これが使用できない場合もあるだろう。
+ * 例えば小規模組み込みシステム向け開発環境として
+ * libcやその他に依存させたくないケースも考えられる。
+ * ここではNT-Shellが使用する型定義を宣言する事にする。
+ * 既存の型定義を使用する場合、単に#include <stdint.h>
+ * のように既存の定義ファイルへのインクルードを宣言すれば良い。
+ */
+
+#if 1
+#   include <stdint.h>
+#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/uzumeapp/kernel/uzume/ntshell/ntlibc.c b/uzumeapp/kernel/uzume/ntshell/ntlibc.c
new file mode 100644 (file)
index 0000000..8cd13c4
--- /dev/null
@@ -0,0 +1,239 @@
+/**
+ * @file ntlibc.c
+ * @author Shinichiro Nakamura
+ * @brief 小規模組み込みシステム向けのlibcライクライブラリの実装。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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_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/uzumeapp/kernel/uzume/ntshell/ntlibc.h b/uzumeapp/kernel/uzume/ntshell/ntlibc.h
new file mode 100644 (file)
index 0000000..72d0e0e
--- /dev/null
@@ -0,0 +1,62 @@
+/**
+ * @file ntlibc.h
+ * @author Shinichiro Nakamura
+ * @brief 小規模組み込みシステム向けのlibcライクライブラリの定義。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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_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/uzumeapp/kernel/uzume/ntshell/ntopt.c b/uzumeapp/kernel/uzume/ntshell/ntopt.c
new file mode 100644 (file)
index 0000000..8c16588
--- /dev/null
@@ -0,0 +1,159 @@
+/**
+ * @file ntopt.c
+ * @author Shinichiro Nakamura
+ * @brief NT-Shell用オプション解析モジュールの実装。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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 与えられた文字がデリミタであるかどうかを判定する。
+ * @param c 文字。
+ * @retval true デリミタである。
+ * @retval false デリミタでない。
+ */
+#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 与えられた文字列のセンテンス数を取得する。
+ * @param str 文字列。
+ * @return センテンス数。
+ */
+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 与えられた文字列のセンテンスを取得する。
+ * @param str 文字列。
+ * @param n センテンス。(0からntopt-get_count(str) - 1までの値。)
+ * @param buf 格納バッファ。
+ * @param siz 格納バッファのサイズ。
+ * @param len 格納した文字列のサイズ。
+ * @retval !NULL 取得成功。格納バッファへのポインタ。
+ * @retval NULL 取得失敗。
+ */
+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 '\0';
+}
+
+/**
+ * @brief 与えられた文字列をデリミタで分割する。
+ * @param str 文字列。
+ * @param func コールバック関数。
+ * @param extobj 拡張オブジェクト。
+ * @return コールバック関数が返した値。
+ */
+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/uzumeapp/kernel/uzume/ntshell/ntopt.h b/uzumeapp/kernel/uzume/ntshell/ntopt.h
new file mode 100644 (file)
index 0000000..4b760bd
--- /dev/null
@@ -0,0 +1,82 @@
+/**
+ * @file ntopt.h
+ * @author Shinichiro Nakamura
+ * @brief NT-Shell用オプション解析モジュールの定義。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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 "ntconf.h"
+
+/**
+ * @brief パース可能な最大文字列長。
+ */
+#define NTOPT_TEXT_MAXLEN   (NTCONF_EDITOR_MAXLEN)
+
+/**
+ * @brief パース可能な最大パラメータ数。
+ */
+#define NTOPT_TEXT_MAXARGS  (NTCONF_EDITOR_MAXLEN / 2)
+
+/**
+ * @brief コールバック関数。
+ *
+ * @param argc パラメータの数。
+ * @param argv パラメータ。
+ * @param extobj 外部オブジェクト。
+ *
+ * @return 返値。
+ */
+typedef int (*NTOPT_CALLBACK)(int argc, char **argv, void *extobj);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief 与えられた文字列をデリミタで分割する。
+ *
+ * @param str 文字列。
+ * @param func コールバック関数。
+ * @param extobj 拡張オブジェクト。
+ *
+ * @return コールバック関数が返した値。
+ */
+int ntopt_parse(const char *str, NTOPT_CALLBACK func, void *extobj);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/uzumeapp/kernel/uzume/ntshell/ntshell.c b/uzumeapp/kernel/uzume/ntshell/ntshell.c
new file mode 100644 (file)
index 0000000..d7ac3fe
--- /dev/null
@@ -0,0 +1,688 @@
+/**
+ * @file ntshell.c
+ * @author Shinichiro Nakamura
+ * @brief 小規模組み込みシステム向けのシェルシステムの実装。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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   /**< メジャー番号。 */
+#define VERSION_MINOR   2   /**< マイナー番号。 */
+#define VERSION_RELEASE 0   /**< リリース番号。 */
+
+#define INITCODE    (0x4367)    /**< 初期化確認コード。 */
+
+/**
+ * @brief 未使用変数宣言。
+ *
+ * @param N 未使用変数。
+ */
+#define UNUSED_VARIABLE(N)      do { (void)(N); } while (0)
+
+/**
+ * @brief サジェストのインデックス番号。
+ *
+ * @param HANDLE ハンドル。
+ */
+#define SUGGEST_INDEX(HANDLE)   ((HANDLE)->suggest_index)
+
+/**
+ * @brief サジェストのソース文字列。
+ *
+ * @param HANDLE ハンドル。
+ */
+#define SUGGEST_SOURCE(HANDLE)  ((HANDLE)->suggest_source)
+
+/**
+ * @brief テキストエディタを取得する。
+ *
+ * @param HANDLE ハンドル。
+ */
+#define GET_EDITOR(HANDLE)      (&((HANDLE)->editor))
+
+/**
+ * @brief テキストヒストリを取得する。
+ *
+ * @param HANDLE ハンドル。
+ */
+#define GET_HISTORY(HANDLE)     (&((HANDLE)->history))
+
+/**
+ * @brief シリアルポートから読み込む。
+ *
+ * @param HANDLE ハンドル。
+ * @param BUF 読み込みバッファ。
+ * @param CNT 読み込み文字数。
+ *
+ * @return 実際に読み込んだ文字数。
+ */
+#define SERIAL_READ(HANDLE, BUF, CNT)   ((HANDLE)->func_read(BUF, CNT, (HANDLE)->extobj))
+
+/**
+ * @brief シリアルポートへ書き込む。
+ *
+ * @param HANDLE ハンドル。
+ * @param BUF 書き込みバッファ。
+ * @param CNT 書き込み文字数。
+ *
+ * @return 実際に書き込んだ文字数。
+ */
+#define SERIAL_WRITE(HANDLE, BUF, CNT)  ((HANDLE)->func_write(BUF, CNT, (HANDLE)->extobj))
+
+/**
+ * @brief シリアルポートへプロンプトを書き込む。
+ *
+ * @param HANDLE ハンドル。
+ */
+#define PROMPT_WRITE(HANDLE)            SERIAL_WRITE((HANDLE), (HANDLE)->prompt, ntlibc_strlen((HANDLE)->prompt))
+
+/**
+ * @brief シリアルポートへ改行を書き込む。
+ *
+ * @param HANDLE ハンドル。
+ */
+#define PROMPT_NEWLINE(HANDLE)          SERIAL_WRITE((HANDLE), NTSHELL_PROMPT_NEWLINE, ntlibc_strlen(NTSHELL_PROMPT_NEWLINE))
+
+/**
+ * @brief コールバックを呼び出す。
+ *
+ * @param HANDLE ハンドル。
+ * @param TEXT コールバック関数へ渡す文字列。
+ */
+#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 テキストヒストリで1つ後ろを辿る。
+ * @details
+ * 論理上のテキスト編集装置内でのテキスト編集と編集結果をビューの更新を行なう。
+ * text_editorは論理上のテキスト編集装置であり、ビューに関して一切感知しない。
+ *
+ * @param ntshell ハンドラ。
+ * @param action アクション。
+ * @param ch 入力文字。
+ */
+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 テキストヒストリで1つ前を辿る。
+ * @details
+ * 論理上のテキスト編集装置内でのテキスト編集と編集結果をビューの更新を行なう。
+ * text_editorは論理上のテキスト編集装置であり、ビューに関して一切感知しない。
+ *
+ * @param ntshell ハンドラ。
+ * @param action アクション。
+ * @param ch 入力文字。
+ */
+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 カーソルを左へ移動させる。
+ * @details
+ * 論理上のテキスト編集装置内でのテキスト編集と編集結果をビューの更新を行なう。
+ * text_editorは論理上のテキスト編集装置であり、ビューに関して一切感知しない。
+ *
+ * @param ntshell ハンドラ。
+ * @param action アクション。
+ * @param ch 入力文字。
+ */
+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 カーソルを右へ移動させる。
+ * @details
+ * 論理上のテキスト編集装置内でのテキスト編集と編集結果をビューの更新を行なう。
+ * text_editorは論理上のテキスト編集装置であり、ビューに関して一切感知しない。
+ *
+ * @param ntshell ハンドラ。
+ * @param action アクション。
+ * @param ch 入力文字。
+ */
+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 エンターキーの処理を実行する。
+ * @details
+ * 論理上のテキスト編集装置内でのテキスト編集と編集結果をビューの更新を行なう。
+ * text_editorは論理上のテキスト編集装置であり、ビューに関して一切感知しない。
+ *
+ * @param ntshell ハンドラ。
+ * @param action アクション。
+ * @param ch 入力文字。
+ */
+static void actfunc_enter(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch)
+{
+    UNUSED_VARIABLE(action);
+    UNUSED_VARIABLE(ch);
+    char txt[TEXTEDITOR_MAXLEN];
+    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 キャンセルキーの処理を実行する。
+ * @details
+ * 論理上のテキスト編集装置内でのテキスト編集と編集結果をビューの更新を行なう。
+ * text_editorは論理上のテキスト編集装置であり、ビューに関して一切感知しない。
+ *
+ * 一般的なOSのCTRL+C処理はシグナルを発行し、受信したプロセスが
+ * 中断処理を実行する。
+ * ここでのキャンセルは見た目を再現したもので、
+ * 入力中の文字列を破棄してカーソルを新しい入力に備えて復帰させるものだ。
+ *
+ * @param ntshell ハンドラ。
+ * @param action アクション。
+ * @param ch 入力文字。
+ */
+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 挿入処理を実行する。
+ * @details
+ * 論理上のテキスト編集装置内でのテキスト編集と編集結果をビューの更新を行なう。
+ * text_editorは論理上のテキスト編集装置であり、ビューに関して一切感知しない。
+ *
+ * @param ntshell ハンドラ。
+ * @param action アクション。
+ * @param ch 入力文字。
+ */
+static void actfunc_insert(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch)
+{
+    UNUSED_VARIABLE(action);
+    /*
+     * 入力があった場合、入力補完状態から抜ける。
+     */
+    SUGGEST_INDEX(ntshell) = -1;
+
+    /*
+     * テキストエディタを使って文字を文字列に挿入する。
+     */
+    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 バックスペース処理を実行する。
+ * @details
+ * 論理上のテキスト編集装置内でのテキスト編集と編集結果をビューの更新を行なう。
+ * text_editorは論理上のテキスト編集装置であり、ビューに関して一切感知しない。
+ *
+ * @param ntshell ハンドラ。
+ * @param action アクション。
+ * @param ch 入力文字。
+ */
+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 デリート処理を実行する。
+ * @details
+ * 論理上のテキスト編集装置内でのテキスト編集と編集結果をビューの更新を行なう。
+ * text_editorは論理上のテキスト編集装置であり、ビューに関して一切感知しない。
+ *
+ * @param ntshell ハンドラ。
+ * @param action アクション。
+ * @param ch 入力文字。
+ */
+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 入力補完処理を実行する。
+ * @details
+ * 論理上のテキスト編集装置内でのテキスト編集と編集結果をビューの更新を行なう。
+ * text_editorは論理上のテキスト編集装置であり、ビューに関して一切感知しない。
+ *
+ * @param ntshell ハンドラ。
+ * @param action アクション。
+ * @param ch 入力文字。
+ */
+static void actfunc_suggest(ntshell_t *ntshell, vtrecv_action_t action, unsigned char ch)
+{
+    UNUSED_VARIABLE(action);
+    UNUSED_VARIABLE(ch);
+    char buf[TEXTEDITOR_MAXLEN];
+    if (SUGGEST_INDEX(ntshell) < 0) {
+        /*
+         * 入力補完モードにこれから入る場合。
+         * 現在の入力文字列を元に補完候補を取得する。
+         */
+        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) {
+                // 候補が見つかればテキストを設定して、インデックスをメモする。
+                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 {
+                // 候補がなければ入力補完モードから抜ける。
+                SUGGEST_INDEX(ntshell) = -1;
+            }
+        }
+    } else {
+        /*
+         * 既に入力補完モードに入っている場合、
+         * 次の候補を探して見つかればテキストとして設定する。
+         */
+        SUGGEST_INDEX(ntshell) = SUGGEST_INDEX(ntshell) + 1;
+        if (text_history_find(
+                    GET_HISTORY(ntshell),
+                    SUGGEST_INDEX(ntshell),
+                    SUGGEST_SOURCE(ntshell),
+                    buf,
+                    sizeof(buf)) == 0) {
+            // 候補が見つかればテキストを設定する。
+            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 {
+            // 候補が見つからなければ元の入力文字列に戻し、入力補完モードから抜ける。
+            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 カーソルを行頭へ移動させる。
+ * @details
+ * 論理上のテキスト編集装置内でのテキスト編集と編集結果をビューの更新を行なう。
+ * text_editorは論理上のテキスト編集装置であり、ビューに関して一切感知しない。
+ *
+ * @param ntshell ハンドラ。
+ * @param action アクション。
+ * @param ch 入力文字。
+ */
+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 カーソルを行末へ移動させる。
+ * @details
+ * 論理上のテキスト編集装置内でのテキスト編集と編集結果をビューの更新を行なう。
+ * text_editorは論理上のテキスト編集装置であり、ビューに関して一切感知しない。
+ *
+ * @param ntshell ハンドラ。
+ * @param action アクション。
+ * @param ch 入力文字。
+ */
+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 アクションテーブルのデータ構造体。
+ * @details
+ * アクションは状態と入力文字によって与えられる。
+ * アクションに対する関数もここで定義する。
+ */
+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 アクションに対する処理関数テーブル。
+ * @details
+ * やってくるコードは仮想端末側の処理に依存する。
+ * よって様々なプラットフォームの様々な仮想端末で試すと良い。
+ *
+ * <table>
+ *   <th>
+ *     <td>Platform</td>
+ *     <td>Tools</td>
+ *   </th>
+ *   <tr>
+ *     <td>Windows</td>
+ *     <td>Hyper Terminal, Poderossa, TeraTerm</td>
+ *   </tr>
+ *   <tr>
+ *     <td>Linux</td>
+ *     <td>minicom, screen, kermit</td>
+ *   </tr>
+ * </table>
+ */
+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 パーサーに対するコールバック関数。
+ * @details vtrecvモジュールのコールバック関数に従った実装である。
+ *
+ * @param vtrecv パーサー。
+ * @param action アクション。
+ * @param ch キャラクタ。
+ */
+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]);
+
+    /*
+     * 制御コードに対する処理はテーブルから探す。
+     */
+    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++;
+    }
+
+    /*
+     * 通常の文字列は入力として扱う。
+     */
+    if (VTRECV_ACTION_PRINT == action) {
+        actfunc_insert(vtrecv->user_data, action, ch);
+        return;
+    }
+
+    /*
+     * ここに到達する場合、
+     * テーブルに含まれない制御コードか、
+     * 通常の文字でない事が考えられる。
+     *
+     * 必要なキー入力に対する動作を加えたい場合、
+     * vtrecvによって得られるコードを調べるために
+     * ここにテストコードを加える事ができる。
+     */
+}
+
+/**
+ * @brief Natural Tiny Shellを初期化する。
+ *
+ * @param p NT-Shellハンドラ。
+ * @param func_read シリアルリード関数。
+ * @param func_write シリアルライト関数。
+ * @param func_callback コールバック関数。
+ * @param extobj コールバック関数呼び出し時に渡す拡張オブジェクト。
+ */
+void ntshell_init(ntshell_t *p,
+    NTSHELL_SERIAL_READ func_read,
+    NTSHELL_SERIAL_WRITE func_write,
+    NTSHELL_USER_CALLBACK func_callback,
+    void *extobj)
+{
+    /*
+     * vtrecvはユーザデータへのポインタを設定できるようになっている。
+     * Natural Tiny Shellはこれを利用してテキストエディタやヒストリ、
+     * リード関数やライト関数、コールバック関数を処理の中で使用できる
+     * ようにしてある。
+     */
+    p->func_read = func_read;
+    p->func_write = func_write;
+    p->func_callback = func_callback;
+    p->extobj = extobj;
+    ntlibc_strcpy(p->prompt, NTSHELL_PROMPT_DEFAULT);
+
+    p->vtrecv.user_data = p;
+
+    /*
+     * 各モジュールを初期化する。
+     */
+    vtsend_init(&(p->vtsend), func_write, 0);
+    vtrecv_init(&(p->vtrecv), vtrecv_callback);
+    text_editor_init(GET_EDITOR(p));
+    text_history_init(GET_HISTORY(p));
+    SUGGEST_INDEX(p) = -1;
+
+    /*
+     * 初期化確認コードを設定する。
+     */
+    p->initcode = INITCODE;
+}
+
+/**
+ * @brief Natural Tiny Shellを実行する。
+ * @details この関数は実行を返さない。
+ *
+ * @param p NT-Shellハンドラ。
+ */
+void ntshell_execute(ntshell_t *p)
+{
+    /*
+     * 初期化確認コードを検証する。
+     */
+    if (p->initcode != INITCODE) {
+      return;
+    }
+
+    /*
+     * ユーザ入力ループ。
+     */
+    PROMPT_WRITE(p);
+    while (1) {
+        unsigned char ch;
+        SERIAL_READ(p, (char *)&ch, sizeof(ch));
+        vtrecv_execute(&(p->vtrecv), &ch, sizeof(ch));
+    }
+}
+
+/**
+ * @brief Natural Tiny Shellのプロンプトを設定する。
+ */
+void ntshell_set_prompt(ntshell_t *p, const char *prompt)
+{
+    /*
+     * 初期化確認コードを検証する。
+     */
+    if (p->initcode != INITCODE) {
+      return;
+    }
+
+    ntlibc_strcpy(p->prompt, prompt);
+}
+
+/**
+ * @brief Natural Tiny Shellのバージョンを返す。
+ * @details 返すバージョンはリリースバージョンである。
+ *
+ * @param major メージャーバージョン。
+ * @param minor マイナーバージョン。
+ * @param release リリースバージョン。
+ */
+void ntshell_version(int *major, int *minor, int *release)
+{
+    *major = VERSION_MAJOR;
+    *minor = VERSION_MINOR;
+    *release = VERSION_RELEASE;
+}
+
diff --git a/uzumeapp/kernel/uzume/ntshell/ntshell.h b/uzumeapp/kernel/uzume/ntshell/ntshell.h
new file mode 100644 (file)
index 0000000..0d50203
--- /dev/null
@@ -0,0 +1,92 @@
+/**
+ * @file ntshell.h
+ * @author Shinichiro Nakamura
+ * @brief 小規模組み込みシステム向けのシェルシステムの定義。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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 NT-Shelハンドラの実装。
+ * @details
+ * 本来このハンドラは定義のみを公開し、実装の詳細を隠蔽すべきだが、
+ * ヒープからメモリを確保するインターフェースのない環境も有り得る事を考慮して公開してある。
+ * このため、スタックに置いた構造体を使って制御する事も可能である。
+ */
+typedef struct {
+    unsigned int initcode;  /**< 初期化確認コード。 */
+    vtsend_t vtsend;        /**< vtsendハンドラ。 */
+    vtrecv_t vtrecv;        /**< vtrecvハンドラ。 */
+    text_editor_t editor;   /**< text_editorハンドラ。 */
+    text_history_t history; /**< 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,
+    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);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/uzumeapp/kernel/uzume/ntshell/ntshell_task.c b/uzumeapp/kernel/uzume/ntshell/ntshell_task.c
new file mode 100644 (file)
index 0000000..352034c
--- /dev/null
@@ -0,0 +1,103 @@
+/**
+ * @file ntshell_task.c
+ * @author Shinichiro Nakamura
+ * @brief NT-Shell\e$B%?%9%/!#\e(B
+ * @details
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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 <t_services.h>
+#include "ntshell.h"
+#include "ntshell_task.h"
+#include "ntlibc.h"
+#include "xprintf.h"
+
+#define SERIAL_PORT_ID  (1)
+
+static ntshell_t ntshell;
+
+static int func_read(char *buf, int cnt, void *extobj)
+{
+    int i;
+    for (i = 0; i < cnt; i++) {
+        char c;
+        syscall(serial_rea_dat(SERIAL_PORT_ID, &c, 1));
+        buf[i] = c;
+    }
+    return cnt;
+}
+
+static int func_write(const char *buf, int cnt, void *extobj)
+{
+    int i;
+    for (i = 0; i < cnt; i++) {
+        char c = buf[i];
+        syscall(serial_wri_dat(SERIAL_PORT_ID, &c, 1));
+
+    }
+    return cnt;
+}
+
+static void uxo(unsigned char c)
+{
+    syscall(serial_wri_dat(SERIAL_PORT_ID, &c, 1));
+}
+
+static unsigned char uxi(void)
+{
+    char c;
+    syscall(serial_rea_dat(SERIAL_PORT_ID, &c, 1));
+    return c;
+}
+
+void (*xfunc_out)(unsigned char) = uxo;
+unsigned char (*xfunc_in)(void) = uxi;
+
+static int func_callback(const char *text, void *extobj)
+{
+    if (ntlibc_strlen(text) > 0) {
+        xprintf("User command is '%s'\r\n", text);
+    }
+    return 0;
+}
+
+void ntshell_task(VP_INT exinf)
+{
+    syscall(
+            serial_ctl_por(SERIAL_PORT_ID,
+                (IOCTL_CRLF | IOCTL_FCSND | IOCTL_FCRCV))
+            );
+
+    ntshell_init(&ntshell, func_read, func_write, func_callback, (void *)&ntshell);
+    ntshell_set_prompt(&ntshell, "BlueTank>");
+    ntshell_execute(&ntshell);
+}
+
diff --git a/uzumeapp/kernel/uzume/ntshell/ntshell_task.cfg b/uzumeapp/kernel/uzume/ntshell/ntshell_task.cfg
new file mode 100644 (file)
index 0000000..a1aa0df
--- /dev/null
@@ -0,0 +1,15 @@
+
+#define _MACRO_ONLY
+
+INCLUDE("\"ntshell_task.h\"");
+
+CRE_TSK( NTSHELL_TASK,
+            {
+                TA_HLNG|TA_ACT,             /* 初期状態からアクティブ */
+                0,                          /* タスク引数 */
+                ntshell_task,               /* タスク本体 */
+                NTSHELL_TASK_PRIORITY,      /* タスク優先順位 */
+                NTSHELL_TASK_STACK_SIZE,    /* タスク・スタックサイズ */
+                NULL                        /* タスク・スタック。NULLならシステムが準備 */
+             });
+
diff --git a/uzumeapp/kernel/uzume/ntshell/ntshell_task.h b/uzumeapp/kernel/uzume/ntshell/ntshell_task.h
new file mode 100644 (file)
index 0000000..6880cde
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+ * @file ntshell_task.h
+ * @author Shinichiro Nakamura
+ * @brief NT-Shellタスク。
+ * @details
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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_TASK_H
+#define NTSHELL_TASK_H
+
+#include <t_services.h>
+#include <s_services.h>
+
+#ifndef NTSHELL_TASK_PRIORITY
+#   define NTSHELL_TASK_PRIORITY    (7)
+#endif
+
+#ifndef NTSHELL_TASK_STACK_SIZE
+#   define NTSHELL_TASK_STACK_SIZE  (2048)
+#endif
+
+#ifndef _MACRO_ONLY
+void ntshell_task(VP_INT exinf);
+#endif
+
+#endif
+
diff --git a/uzumeapp/kernel/uzume/ntshell/text_editor.c b/uzumeapp/kernel/uzume/ntshell/text_editor.c
new file mode 100644 (file)
index 0000000..a990bfb
--- /dev/null
@@ -0,0 +1,256 @@
+/**
+ * @file text_editor.c
+ * @author Shinichiro Nakamura
+ * @brief NT-Shell用テキストエディタモジュールの実装。
+ * @details
+ * 文字列の編集を論理的に扱うためのモジュール。
+ * このモジュールはビューに関して一切感知しない。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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 テキストエディタを初期化する。
+ *
+ * @param p テキストエディタ構造体。
+ */
+void text_editor_init(text_editor_t *p)
+{
+    p->pos = 0;
+    p->len = 0;
+    p->buffer[p->len] = '\0';
+}
+
+/**
+ * @brief 文字を挿入する。
+ *
+ * @param p テキストエディタ構造体。
+ * @param c 文字。
+ */
+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 文字を削除する。
+ *
+ * @param p テキストエディタ構造体。
+ */
+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 文字を削除する。
+ *
+ * @param p テキストエディタ構造体。
+ */
+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 カーソル位置を取得する。
+ *
+ * @param p テキストエディタ構造体。
+ */
+int text_editor_cursor_get_position(text_editor_t *p)
+{
+    return p->pos;
+}
+
+/**
+ * @brief カーソルを先頭に移動させる。
+ *
+ * @param p テキストエディタ構造体。
+ */
+int text_editor_cursor_head(text_editor_t *p)
+{
+    if (0 < p->pos) {
+        p->pos = 0;
+        return 1;
+    }
+    return 0;
+}
+
+/**
+ * @brief カーソルを最後尾に移動させる。
+ *
+ * @param p テキストエディタ構造体。
+ */
+int text_editor_cursor_tail(text_editor_t *p)
+{
+    if (p->pos < p->len) {
+        p->pos = p->len;
+        return 1;
+    }
+    return 0;
+}
+
+/**
+ * @brief カーソルを左へ移動させる。
+ *
+ * @param p テキストエディタ構造体。
+ */
+int text_editor_cursor_left(text_editor_t *p)
+{
+    if (0 < p->pos) {
+        p->pos--;
+        return 1;
+    }
+    return 0;
+}
+
+/**
+ * @brief カーソルを右へ移動させる。
+ *
+ * @param p テキストエディタ構造体。
+ */
+int text_editor_cursor_right(text_editor_t *p)
+{
+    if (p->pos < p->len) {
+        p->pos++;
+        return 1;
+    }
+    return 0;
+}
+
+/**
+ * @brief 文字列を設定する。
+ *
+ * @param p テキストエディタ構造体。
+ * @param buf 文字列が格納されたバッファ。
+ */
+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 文字列を取得する。
+ *
+ * @param p テキストエディタ構造体。
+ * @param buf 文字列を格納するバッファ。
+ * @param siz バッファサイズ。
+ */
+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 文字列を消去する。
+ *
+ * @param p テキストエディタ構造体。
+ */
+void text_editor_clear(text_editor_t *p)
+{
+    p->pos = 0;
+    p->len = 0;
+    p->buffer[p->len] = '\0';
+}
+
diff --git a/uzumeapp/kernel/uzume/ntshell/text_editor.h b/uzumeapp/kernel/uzume/ntshell/text_editor.h
new file mode 100644 (file)
index 0000000..d610c47
--- /dev/null
@@ -0,0 +1,80 @@
+/**
+ * @file text_editor.h
+ * @author Shinichiro Nakamura
+ * @brief NT-Shell用テキストエディタモジュールの定義。
+ * @details
+ * 文字列の編集を論理的に扱うためのモジュール。
+ * このモジュールはビューに関して一切感知しない。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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 編集可能な文字列最大長。
+ */
+#define TEXTEDITOR_MAXLEN   (NTCONF_EDITOR_MAXLEN)
+
+/**
+ * @brief テキストエディタ構造体の実装。
+ */
+typedef struct {
+    char buffer[TEXTEDITOR_MAXLEN]; /**< バッファ。 */
+    int pos;                        /**< カーソル位置。 */
+    int len;                        /**< テキスト長さ。 */
+} 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/uzumeapp/kernel/uzume/ntshell/text_history.c b/uzumeapp/kernel/uzume/ntshell/text_history.c
new file mode 100644 (file)
index 0000000..9d8aeff
--- /dev/null
@@ -0,0 +1,180 @@
+/**
+ * @file text_history.c
+ * @author Shinichiro Nakamura
+ * @brief NT-Shell用テキストヒストリモジュールの実装。
+ * @details
+ * 文字列の入力履歴を論理的に扱うためのモジュール。
+ * このモジュールはビューに関して一切感知しない。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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 初期化する。
+ *
+ * @param p テキストヒストリ構造体。
+ */
+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 テキストヒストリに対して書き込みを実行する。
+ *
+ * @param p テキストヒストリ構造体。
+ * @param buf バッファ。
+ */
+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 テキストヒストリから読み出しを実行する。
+ * @details
+ * 得られる文字列が与えられたバッファサイズよりも大きい場合、
+ * バッファに格納される文字列は途中で途切れるものとする。
+ *
+ * @param p テキストヒストリ構造体。
+ * @param buf バッファ。
+ * @param siz バッファサイズ。
+ */
+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 読み出しポインタを次に進める。
+ *
+ * @param p テキストヒストリ構造体。
+ */
+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 読み出しポインタを前に戻す。
+ *
+ * @param p テキストヒストリ構造体。
+ */
+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 与えられたテキストで始まる文字列を探す。
+ * @details このインターフェースはテキスト入力補完のために作られた。
+ *
+ * @param p テキストヒストリオブジェクト。
+ * @param index ヒストリ中で見つかる文字列のindex個目。
+ * @param text 検索する文字列。
+ * @param buf 格納先バッファ。
+ * @param siz 格納先バッファサイズ。
+ *
+ * @retval 0 成功。
+ * @retval 0以外 失敗。
+ */
+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/uzumeapp/kernel/uzume/ntshell/text_history.h b/uzumeapp/kernel/uzume/ntshell/text_history.h
new file mode 100644 (file)
index 0000000..e6b95be
--- /dev/null
@@ -0,0 +1,90 @@
+/**
+ * @file text_history.h
+ * @author Shinichiro Nakamura
+ * @brief NT-Shell用テキストヒストリモジュールの定義。
+ * @details
+ * 文字列の入力履歴を論理的に扱うためのモジュール。
+ * このモジュールはビューに関して一切感知しない。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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 1履歴あたりの文字列最大長。
+ */
+#define TEXTHISTORY_MAXLEN  (NTCONF_EDITOR_MAXLEN)
+
+/**
+ * @brief 履歴管理数。
+ */
+#define TEXTHISTORY_DEPTH   (NTCONF_HISTORY_DEPTH)
+
+/**
+ * @brief テキストヒストリ構造体。
+ */
+typedef struct {
+    /**
+     * @brief 履歴文字列バッファ。
+     */
+    char history[TEXTHISTORY_MAXLEN * TEXTHISTORY_DEPTH];
+
+    /**
+     * @brief リード位置。
+     */
+    int rp;
+
+    /**
+     * @brief ライト位置。
+     */
+    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/uzumeapp/kernel/uzume/ntshell/vtrecv.c b/uzumeapp/kernel/uzume/ntshell/vtrecv.c
new file mode 100644 (file)
index 0000000..a9b2cb1
--- /dev/null
@@ -0,0 +1,2573 @@
+/**
+ * @file vtrecv.c
+ * @brief VT100互換の受信用パーサの実装。
+ * @details
+ * An implementation of Paul Williams' DEC compatible state machine parser
+ * This code is in the public domain.
+ *
+ * @author Joshua Haberman <joshua@reverberate.org>
+ * @author Shinichiro Nakamura : Modified for Natural Tiny Shell (NT-Shell)
+ */
+
+#include "vtrecv.h"
+
+/**
+ * @brief オリジナルに含まれるLUTを使うかどうかを決定する。
+ * @details
+ * オリジナルでは、シーケンスの遷移をテーブル参照で実装してあった。
+ * 15のステートで取りうる256パターンの入力を全網羅するテーブルである。
+ * これは3840個のテーブルデータを持つことになる。
+ *
+ * テーブル参照はメモリに対してリニアアクセス可能なプロセッサにおいて
+ * 固定時間で動作する。テーブル参照のメリットは固定時間での処理である。
+ *
+ * 一方、新たに実装した方法は、重複するデータが多数存在する事に着目した
+ * もので、区間毎に適用するシーケンスを定義したテーブルを用いる。
+ * これはテーブルを線形探索するため後方にあるデータになるほど動作は遅い。
+ * しかし、コードサイズはオリジナルの全網羅形式のテーブルよりも小さい。
+ *
+ * @retval 0 使わない。
+ * @retval 1 使う。
+ */
+#define USE_ORIGINAL_LUT (0)
+
+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);
+
+static int vtrecv_strlen(const char *s)
+{
+    const char *p = s;
+    int cnt = 0;
+    while (*p) {
+        cnt++;
+        p++;
+    }
+    return cnt;
+}
+
+#if (USE_ORIGINAL_LUT==1)
+static const state_change_t STATE_TABLE[15][256] = {
+    {  /* VTRECV_STATE_ANYWHERE */
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        /*24 */  VTRECV_ACTION_EXECUTE            | (VTRECV_STATE_GROUND              << 4),
+        0,
+        /*26 */  VTRECV_ACTION_EXECUTE            | (VTRECV_STATE_GROUND              << 4),
+        /*27 */  0                                | (VTRECV_STATE_ESCAPE              << 4),
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        /*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*/  VTRECV_ACTION_EXECUTE            | (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_ENTRY */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        0,
+        0,
+        /*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),
+    },
+    {  /* VTRECV_STATE_CSI_IGNORE */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        0,
+        0,
+        /*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),
+    },
+    {  /* VTRECV_STATE_CSI_INTERMEDIATE */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        0,
+        0,
+        /*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),
+    },
+    {  /* VTRECV_STATE_CSI_PARAM */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        0,
+        0,
+        /*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),
+    },
+    {  /* VTRECV_STATE_DCS_ENTRY */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_IGNORE             | (0                                 << 4),
+        0,
+        0,
+        /*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),
+    },
+    {  /* VTRECV_STATE_DCS_IGNORE */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_IGNORE             | (0                                 << 4),
+        0,
+        0,
+        /*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),
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        /*156*/  0                                | (VTRECV_STATE_GROUND              << 4),
+    },
+    {  /* VTRECV_STATE_DCS_INTERMEDIATE */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_IGNORE             | (0                                 << 4),
+        0,
+        0,
+        /*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),
+    },
+    {  /* VTRECV_STATE_DCS_PARAM */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_IGNORE             | (0                                 << 4),
+        0,
+        0,
+        /*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),
+    },
+    {  /* VTRECV_STATE_DCS_PASSTHROUGH */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_PUT                | (0                                 << 4),
+        0,
+        0,
+        /*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),
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        /*156*/  0                                | (VTRECV_STATE_GROUND              << 4),
+    },
+    {  /* VTRECV_STATE_ESCAPE */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        0,
+        0,
+        /*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),
+    },
+    {  /* VTRECV_STATE_ESCAPE_INTERMEDIATE */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        0,
+        0,
+        /*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),
+    },
+    {  /* VTRECV_STATE_GROUND */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        0,
+        0,
+        /*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            | (0                                 << 4),
+        /*129*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*130*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*131*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*132*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*133*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*134*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*135*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*136*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*137*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*138*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*139*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*140*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*141*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*142*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*143*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        0,
+        /*145*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*146*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*147*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*148*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*149*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*150*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*151*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*152*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*153*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        /*154*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+        0,
+        /*156*/  VTRECV_ACTION_EXECUTE            | (0                                 << 4),
+    },
+    {  /* VTRECV_STATE_OSC_STRING */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_IGNORE             | (0                                 << 4),
+        0,
+        0,
+        /*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),
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        /*156*/  0                                | (VTRECV_STATE_GROUND              << 4),
+    },
+    {  /* VTRECV_STATE_SOS_PM_APC_STRING */
+        /*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),
+        0,
+        /*25 */  VTRECV_ACTION_IGNORE             | (0                                 << 4),
+        0,
+        0,
+        /*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),
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        /*156*/  0                                | (VTRECV_STATE_GROUND              << 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[] = {
+    /*
+     * ANYWHERE
+     */
+    {VTRECV_STATE_ANYWHERE,             0x18, 0x18, VTRECV_ACTION_EXECUTE       | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x1a, 0x1a, VTRECV_ACTION_EXECUTE       | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x80, 0x8f, VTRECV_ACTION_EXECUTE       | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x91, 0x97, VTRECV_ACTION_EXECUTE       | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x99, 0x99, VTRECV_ACTION_EXECUTE       | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x9a, 0x9a, VTRECV_ACTION_EXECUTE       | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x9c, 0x9c, VTRECV_ACTION_EXECUTE       | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x1b, 0x1b, 0                           | (VTRECV_STATE_ESCAPE              << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x98, 0x98, 0                           | (VTRECV_STATE_SOS_PM_APC_STRING   << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x9e, 0x9e, 0                           | (VTRECV_STATE_SOS_PM_APC_STRING   << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x9f, 0x9f, 0                           | (VTRECV_STATE_SOS_PM_APC_STRING   << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x90, 0x90, 0                           | (VTRECV_STATE_DCS_ENTRY           << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x9d, 0x9d, 0                           | (VTRECV_STATE_OSC_STRING          << 4)},
+    {VTRECV_STATE_ANYWHERE,             0x9b, 0x9b, 0                           | (VTRECV_STATE_CSI_ENTRY           << 4)},
+    /*
+     * GROUND
+     */
+    {VTRECV_STATE_GROUND,               0x00, 0x17, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_GROUND,               0x19, 0x19, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_GROUND,               0x1c, 0x1f, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_GROUND,               0x20, 0x7f, VTRECV_ACTION_PRINT         | (0                                << 4)},
+    {VTRECV_STATE_GROUND,               0x80, 0x8f, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_GROUND,               0x91, 0x9a, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_GROUND,               0x9c, 0x9c, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    /*
+     * ESCAPE
+     */
+    {VTRECV_STATE_ESCAPE,               0x00, 0x17, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_ESCAPE,               0x19, 0x19, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_ESCAPE,               0x1c, 0x1f, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_ESCAPE,               0x7f, 0x7f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_ESCAPE,               0x20, 0x2f, VTRECV_ACTION_COLLECT       | (VTRECV_STATE_ESCAPE_INTERMEDIATE << 4)},
+    {VTRECV_STATE_ESCAPE,               0x30, 0x4f, VTRECV_ACTION_ESC_DISPATCH  | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ESCAPE,               0x51, 0x57, VTRECV_ACTION_ESC_DISPATCH  | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ESCAPE,               0x59, 0x59, VTRECV_ACTION_ESC_DISPATCH  | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ESCAPE,               0x5a, 0x5a, VTRECV_ACTION_ESC_DISPATCH  | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ESCAPE,               0x5c, 0x5c, VTRECV_ACTION_ESC_DISPATCH  | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ESCAPE,               0x60, 0x7e, VTRECV_ACTION_ESC_DISPATCH  | (VTRECV_STATE_GROUND              << 4)},
+    {VTRECV_STATE_ESCAPE,               0x5b, 0x5b, 0                           | (VTRECV_STATE_CSI_ENTRY           << 4)},
+    {VTRECV_STATE_ESCAPE,               0x5d, 0x5d, 0                           | (VTRECV_STATE_OSC_STRING          << 4)},
+    {VTRECV_STATE_ESCAPE,               0x50, 0x50, 0                           | (VTRECV_STATE_DCS_ENTRY           << 4)},
+    {VTRECV_STATE_ESCAPE,               0x58, 0x58, 0                           | (VTRECV_STATE_SOS_PM_APC_STRING   << 4)},
+    {VTRECV_STATE_ESCAPE,               0x5e, 0x5e, 0                           | (VTRECV_STATE_SOS_PM_APC_STRING   << 4)},
+    {VTRECV_STATE_ESCAPE,               0x5f, 0x5f, 0                           | (VTRECV_STATE_SOS_PM_APC_STRING   << 4)},
+    /*
+     * ESCAPE_INTERMEDIATE
+     */
+    {VTRECV_STATE_ESCAPE_INTERMEDIATE,  0x00, 0x17, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_ESCAPE_INTERMEDIATE,  0x19, 0x19, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_ESCAPE_INTERMEDIATE,  0x1c, 0x1f, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_ESCAPE_INTERMEDIATE,  0x20, 0x2f, VTRECV_ACTION_COLLECT       | (0                                << 4)},
+    {VTRECV_STATE_ESCAPE_INTERMEDIATE,  0x7f, 0x7f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_ESCAPE_INTERMEDIATE,  0x30, 0x7e, VTRECV_ACTION_ESC_DISPATCH  | (VTRECV_STATE_GROUND              << 4)},
+    /*
+     * CSI_ENTRY
+     */
+    {VTRECV_STATE_CSI_ENTRY,            0x00, 0x17, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_CSI_ENTRY,            0x19, 0x19, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_CSI_ENTRY,            0x1c, 0x1f, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_CSI_ENTRY,            0x7f, 0x7f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_CSI_ENTRY,            0x20, 0x2f, VTRECV_ACTION_COLLECT       | (VTRECV_STATE_CSI_INTERMEDIATE    << 4)},
+    {VTRECV_STATE_CSI_ENTRY,            0x3a, 0x3a, 0                           | (VTRECV_STATE_CSI_IGNORE          << 4)},
+    {VTRECV_STATE_CSI_ENTRY,            0x30, 0x39, VTRECV_ACTION_PARAM         | (VTRECV_STATE_CSI_PARAM           << 4)},
+    {VTRECV_STATE_CSI_ENTRY,            0x3b, 0x3b, VTRECV_ACTION_PARAM         | (VTRECV_STATE_CSI_PARAM           << 4)},
+    {VTRECV_STATE_CSI_ENTRY,            0x3c, 0x3f, VTRECV_ACTION_COLLECT       | (VTRECV_STATE_CSI_PARAM           << 4)},
+    {VTRECV_STATE_CSI_ENTRY,            0x40, 0x7e, VTRECV_ACTION_CSI_DISPATCH  | (VTRECV_STATE_GROUND              << 4)},
+    /*
+     * CSI_IGNORE
+     */
+    {VTRECV_STATE_CSI_IGNORE,           0x00, 0x17, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_CSI_IGNORE,           0x19, 0x19, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_CSI_IGNORE,           0x1c, 0x1f, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_CSI_IGNORE,           0x20, 0x3f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_CSI_IGNORE,           0x7f, 0x7f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_CSI_IGNORE,           0x40, 0x7e, 0                           | (VTRECV_STATE_GROUND              << 4)},
+    /*
+     * CSI_PARAM
+     */
+    {VTRECV_STATE_CSI_PARAM,            0x00, 0x17, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_CSI_PARAM,            0x19, 0x19, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_CSI_PARAM,            0x1c, 0x1f, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_CSI_PARAM,            0x30, 0x39, VTRECV_ACTION_PARAM         | (0                                << 4)},
+    {VTRECV_STATE_CSI_PARAM,            0x3b, 0x3b, VTRECV_ACTION_PARAM         | (0                                << 4)},
+    {VTRECV_STATE_CSI_PARAM,            0x7f, 0x7f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_CSI_PARAM,            0x3a, 0x3a, 0                           | (VTRECV_STATE_CSI_IGNORE          << 4)},
+    {VTRECV_STATE_CSI_PARAM,            0x3c, 0x3f, 0                           | (VTRECV_STATE_CSI_IGNORE          << 4)},
+    {VTRECV_STATE_CSI_PARAM,            0x20, 0x2f, VTRECV_ACTION_COLLECT       | (VTRECV_STATE_CSI_INTERMEDIATE    << 4)},
+    {VTRECV_STATE_CSI_PARAM,            0x40, 0x7e, VTRECV_ACTION_CSI_DISPATCH  | (VTRECV_STATE_GROUND              << 4)},
+    /*
+     * CSI_INTERMEDIATE
+     */
+    {VTRECV_STATE_CSI_INTERMEDIATE,     0x00, 0x17, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_CSI_INTERMEDIATE,     0x19, 0x19, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_CSI_INTERMEDIATE,     0x1c, 0x1f, VTRECV_ACTION_EXECUTE       | (0                                << 4)},
+    {VTRECV_STATE_CSI_INTERMEDIATE,     0x20, 0x2f, VTRECV_ACTION_COLLECT       | (0                                << 4)},
+    {VTRECV_STATE_CSI_INTERMEDIATE,     0x7f, 0x7f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_CSI_INTERMEDIATE,     0x30, 0x3f, 0                           | (VTRECV_STATE_CSI_IGNORE          << 4)},
+    {VTRECV_STATE_CSI_INTERMEDIATE,     0x40, 0x7e, VTRECV_ACTION_CSI_DISPATCH  | (VTRECV_STATE_GROUND              << 4)},
+    /*
+     * DCS_ENTRY
+     */
+    {VTRECV_STATE_DCS_ENTRY,            0x00, 0x17, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_ENTRY,            0x19, 0x19, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_ENTRY,            0x1c, 0x1f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_ENTRY,            0x7f, 0x7f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_ENTRY,            0x3a, 0x3a, 0                           | (VTRECV_STATE_DCS_IGNORE          << 4)},
+    {VTRECV_STATE_DCS_ENTRY,            0x20, 0x2f, VTRECV_ACTION_COLLECT       | (VTRECV_STATE_DCS_INTERMEDIATE    << 4)},
+    {VTRECV_STATE_DCS_ENTRY,            0x30, 0x39, VTRECV_ACTION_PARAM         | (VTRECV_STATE_DCS_PARAM           << 4)},
+    {VTRECV_STATE_DCS_ENTRY,            0x3b, 0x3b, VTRECV_ACTION_PARAM         | (VTRECV_STATE_DCS_PARAM           << 4)},
+    {VTRECV_STATE_DCS_ENTRY,            0x3c, 0x3f, VTRECV_ACTION_COLLECT       | (VTRECV_STATE_DCS_PARAM           << 4)},
+    {VTRECV_STATE_DCS_ENTRY,            0x40, 0x7e, 0                           | (VTRECV_STATE_DCS_PASSTHROUGH     << 4)},
+    /*
+     * DCS_INTERMEDIATE
+     */
+    {VTRECV_STATE_DCS_INTERMEDIATE,     0x00, 0x17, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_INTERMEDIATE,     0x19, 0x19, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_INTERMEDIATE,     0x1c, 0x1f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_INTERMEDIATE,     0x20, 0x2f, VTRECV_ACTION_COLLECT       | (0                                << 4)},
+    {VTRECV_STATE_DCS_INTERMEDIATE,     0x7f, 0x7f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_INTERMEDIATE,     0x30, 0x3f, 0                           | (VTRECV_STATE_DCS_IGNORE          << 4)},
+    {VTRECV_STATE_DCS_INTERMEDIATE,     0x40, 0x7e, 0                           | (VTRECV_STATE_DCS_PASSTHROUGH     << 4)},
+    /*
+     * DCS_IGNORE
+     */
+    {VTRECV_STATE_DCS_IGNORE,           0x00, 0x17, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_IGNORE,           0x19, 0x19, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_IGNORE,           0x1c, 0x1f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_IGNORE,           0x20, 0x7f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_IGNORE,           0x9c, 0x9c, 0                           | (VTRECV_STATE_GROUND              << 4)},
+    /*
+     * DCS_PARAM
+     */
+    {VTRECV_STATE_DCS_PARAM,            0x00, 0x17, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_PARAM,            0x19, 0x19, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_PARAM,            0x1c, 0x1f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_PARAM,            0x30, 0x39, VTRECV_ACTION_PARAM         | (0                                << 4)},
+    {VTRECV_STATE_DCS_PARAM,            0x3b, 0x3b, VTRECV_ACTION_PARAM         | (0                                << 4)},
+    {VTRECV_STATE_DCS_PARAM,            0x7f, 0x7f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_PARAM,            0x3a, 0x3a, 0                           | (VTRECV_STATE_DCS_IGNORE          << 4)},
+    {VTRECV_STATE_DCS_PARAM,            0x3c, 0x3f, 0                           | (VTRECV_STATE_DCS_IGNORE          << 4)},
+    {VTRECV_STATE_DCS_PARAM,            0x20, 0x2f, VTRECV_ACTION_COLLECT       | (VTRECV_STATE_DCS_INTERMEDIATE    << 4)},
+    {VTRECV_STATE_DCS_PARAM,            0x40, 0x7e, 0                           | (VTRECV_STATE_DCS_PASSTHROUGH     << 4)},
+    /*
+     * DCS_PASSTHROUGH
+     */
+    {VTRECV_STATE_DCS_PASSTHROUGH,      0x00, 0x17, VTRECV_ACTION_PUT           | (0                                << 4)},
+    {VTRECV_STATE_DCS_PASSTHROUGH,      0x19, 0x19, VTRECV_ACTION_PUT           | (0                                << 4)},
+    {VTRECV_STATE_DCS_PASSTHROUGH,      0x1c, 0x1f, VTRECV_ACTION_PUT           | (0                                << 4)},
+    {VTRECV_STATE_DCS_PASSTHROUGH,      0x20, 0x7e, VTRECV_ACTION_PUT           | (0                                << 4)},
+    {VTRECV_STATE_DCS_PASSTHROUGH,      0x7f, 0x7f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_DCS_PASSTHROUGH,      0x9c, 0x9c, 0                           | (VTRECV_STATE_GROUND              << 4)},
+    /*
+     * SOS_PM_APC_STRING
+     */
+    {VTRECV_STATE_SOS_PM_APC_STRING,    0x00, 0x17, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_SOS_PM_APC_STRING,    0x19, 0x19, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_SOS_PM_APC_STRING,    0x1c, 0x1f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_SOS_PM_APC_STRING,    0x20, 0x7f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_SOS_PM_APC_STRING,    0x9c, 0x9c, 0                           | (VTRECV_STATE_GROUND              << 4)},
+    /*
+     * OSC_STRING
+     */
+    {VTRECV_STATE_OSC_STRING,           0x00, 0x17, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_OSC_STRING,           0x19, 0x19, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_OSC_STRING,           0x1c, 0x1f, VTRECV_ACTION_IGNORE        | (0                                << 4)},
+    {VTRECV_STATE_OSC_STRING,           0x20, 0x7f, VTRECV_ACTION_OSC_PUT       | (0                                << 4)},
+    {VTRECV_STATE_OSC_STRING,           0x9c, 0x9c, 0                           | (VTRECV_STATE_GROUND              << 4)},
+};
+#endif
+
+static const vtrecv_action_t ENTRY_ACTIONS[] = {
+    (vtrecv_action_t)0  /* none for ANYWHERE */,
+    VTRECV_ACTION_CLEAR, /* CSI_ENTRY */
+    (vtrecv_action_t)0  /* none for CSI_IGNORE */,
+    (vtrecv_action_t)0  /* none for CSI_INTERMEDIATE */,
+    (vtrecv_action_t)0  /* none for CSI_PARAM */,
+    VTRECV_ACTION_CLEAR, /* DCS_ENTRY */
+    (vtrecv_action_t)0  /* none for DCS_IGNORE */,
+    (vtrecv_action_t)0  /* none for DCS_INTERMEDIATE */,
+    (vtrecv_action_t)0  /* none for DCS_PARAM */,
+    VTRECV_ACTION_HOOK, /* DCS_PASSTHROUGH */
+    VTRECV_ACTION_CLEAR, /* ESCAPE */
+    (vtrecv_action_t)0  /* none for ESCAPE_INTERMEDIATE */,
+    (vtrecv_action_t)0  /* none for GROUND */,
+    VTRECV_ACTION_OSC_START, /* OSC_STRING */
+    (vtrecv_action_t)0  /* none for SOS_PM_APC_STRING */,
+};
+
+static const vtrecv_action_t EXIT_ACTIONS[] = {
+    (vtrecv_action_t)0  /* none for ANYWHERE */,
+    (vtrecv_action_t)0  /* none for CSI_ENTRY */,
+    (vtrecv_action_t)0  /* none for CSI_IGNORE */,
+    (vtrecv_action_t)0  /* none for CSI_INTERMEDIATE */,
+    (vtrecv_action_t)0  /* none for CSI_PARAM */,
+    (vtrecv_action_t)0  /* none for DCS_ENTRY */,
+    (vtrecv_action_t)0  /* none for DCS_IGNORE */,
+    (vtrecv_action_t)0  /* none for DCS_INTERMEDIATE */,
+    (vtrecv_action_t)0  /* none for DCS_PARAM */,
+    VTRECV_ACTION_UNHOOK, /* DCS_PASSTHROUGH */
+    (vtrecv_action_t)0  /* none for ESCAPE */,
+    (vtrecv_action_t)0  /* none for ESCAPE_INTERMEDIATE */,
+    (vtrecv_action_t)0  /* none for GROUND */,
+    VTRECV_ACTION_OSC_END, /* OSC_STRING */
+    (vtrecv_action_t)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][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->intermediate_chars[0] = '\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 */
+                int num_intermediate_chars = vtrecv_strlen((char*)parser->intermediate_chars);
+
+                if(num_intermediate_chars + 1 > MAX_INTERMEDIATE_CHARS)
+                    parser->ignore_flagged = 1;
+                else
+                    parser->intermediate_chars[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->intermediate_chars[0] = '\0';
+            parser->num_params            = 0;
+            parser->ignore_flagged        = 0;
+            break;
+
+        default:
+            // Internal error: Unknown action.
+            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 actionk of the new action
+         */
+
+        vtrecv_action_t exit_action = GET_EXIT_ACTIONS(parser->state);
+        vtrecv_action_t entry_action = GET_ENTRY_ACTIONS(new_state);
+
+        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];
+
+        /* If a transition is defined from the "anywhere" state, always
+         * use that.  Otherwise use the transition from the current state. */
+
+        state_change_t change = GET_STATE_TABLE(VTRECV_STATE_ANYWHERE, ch);
+
+        if(!change)
+            change = GET_STATE_TABLE(parser->state, ch);
+
+        do_state_change(parser, change, data[i]);
+    }
+}
+
diff --git a/uzumeapp/kernel/uzume/ntshell/vtrecv.h b/uzumeapp/kernel/uzume/ntshell/vtrecv.h
new file mode 100644 (file)
index 0000000..84b2f4a
--- /dev/null
@@ -0,0 +1,82 @@
+/**
+ * @file vtrecv.h
+ * @brief VT100互換の受信用パーサの定義。
+ * @details
+ * An implementation of Paul Williams' DEC compatible state machine parser
+ * This code is in the public domain.
+ *
+ * @author Joshua Haberman <joshua@reverberate.org>
+ * @author Shinichiro Nakamura : Modified for Natural Tiny Shell (NT-Shell)
+ */
+
+#ifndef VTRECV_H
+#define VTRECV_H
+
+#define MAX_INTERMEDIATE_CHARS 2
+#define ACTION(state_change) (vtrecv_action_t)(state_change & 0x0F)
+#define STATE(state_change)  (vtrecv_state_t)(state_change >> 4)
+
+typedef enum {
+    VTRECV_STATE_ANYWHERE = 0,
+    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_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];
+    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/uzumeapp/kernel/uzume/ntshell/vtsend.c b/uzumeapp/kernel/uzume/ntshell/vtsend.c
new file mode 100644 (file)
index 0000000..5362a46
--- /dev/null
@@ -0,0 +1,273 @@
+/**
+ * @file vtsend.c
+ * @author Shinichiro Nakamura
+ * @brief VT100 Senderの実装。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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/uzumeapp/kernel/uzume/ntshell/vtsend.h b/uzumeapp/kernel/uzume/ntshell/vtsend.h
new file mode 100644 (file)
index 0000000..b451be8
--- /dev/null
@@ -0,0 +1,95 @@
+/**
+ * @file vtsend.h
+ * @author Shinichiro Nakamura
+ * @brief VT100 Senderの定義。
+ */
+
+/*
+ * ===============================================================
+ *  Natural Tiny Shell (NT-Shell)
+ * ===============================================================
+ * Copyright (c) 2010-2012 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/uzumeapp/kernel/uzume/ntshell/xprintf.c b/uzumeapp/kernel/uzume/ntshell/xprintf.c
new file mode 100644 (file)
index 0000000..fde70b2
--- /dev/null
@@ -0,0 +1,395 @@
+/*------------------------------------------------------------------------/\r
+  /  Universal string handler for user console interface\r
+  /-------------------------------------------------------------------------/\r
+  /\r
+  /  Copyright (C) 2011, ChaN, all right reserved.\r
+  /\r
+  / * This software is a free software and there is NO WARRANTY.\r
+  / * No restriction on use. You can use, modify and redistribute it for\r
+  /   personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.\r
+  / * Redistributions of source code must retain the above copyright notice.\r
+  /\r
+  /-------------------------------------------------------------------------*/\r
+\r
+#include "xprintf.h"\r
+\r
+\r
+#if _USE_XFUNC_OUT\r
+#include <stdarg.h>\r
+void (*xfunc_out)(unsigned char); /* Pointer to the output stream */\r
+static char *outptr;\r
+\r
+/*----------------------------------------------*/\r
+/* Put a character                              */\r
+/*----------------------------------------------*/\r
+\r
+void xputc (char c)\r
+{\r
+    if (_CR_CRLF && c == '\n') xputc('\r');  /* CR -> CRLF */\r
+\r
+    if (outptr) {\r
+        *outptr++ = (unsigned char)c;\r
+        return;\r
+    }\r
+\r
+    if (xfunc_out) xfunc_out((unsigned char)c);\r
+}\r
+\r
+\r
+\r
+/*----------------------------------------------*/\r
+/* Put a null-terminated string                 */\r
+/*----------------------------------------------*/\r
+\r
+void xputs (     /* Put a string to the default device */\r
+        const char* str    /* Pointer to the string */\r
+        )\r
+{\r
+    while (*str)\r
+        xputc(*str++);\r
+}\r
+\r
+\r
+    void xfputs (     /* Put a string to the specified device */\r
+            void(*func)(unsigned char), /* Pointer to the output function */\r
+            const char* str    /* Pointer to the string */\r
+            )\r
+{\r
+    void (*pf)(unsigned char);\r
+\r
+\r
+    pf = xfunc_out;  /* Save current output device */\r
+    xfunc_out = func; /* Switch output to specified device */\r
+    while (*str)  /* Put the string */\r
+        xputc(*str++);\r
+    xfunc_out = pf;  /* Restore output device */\r
+}\r
+\r
+\r
+\r
+/*----------------------------------------------*/\r
+/* Formatted string output                      */\r
+/*----------------------------------------------*/\r
+/*  xprintf("%d", 1234);   "1234"\r
+    xprintf("%6d,%3d%%", -200, 5); "  -200,  5%"\r
+    xprintf("%-6u", 100);   "100   "\r
+    xprintf("%ld", 12345678L);  "12345678"\r
+    xprintf("%04x", 0xA3);   "00a3"\r
+    xprintf("%08LX", 0x123ABC);  "00123ABC"\r
+    xprintf("%016b", 0x550F);  "0101010100001111"\r
+    xprintf("%s", "String");  "String"\r
+    xprintf("%-4s", "abc");   "abc "\r
+    xprintf("%4s", "abc");   " abc"\r
+    xprintf("%c", 'a');    "a"\r
+    xprintf("%f", 10.0);            <xprintf lacks floating point support>\r
+    */\r
+\r
+    static\r
+void xvprintf (\r
+        const char* fmt, /* Pointer to the format string */\r
+        va_list arp   /* Pointer to arguments */\r
+        )\r
+{\r
+    unsigned int r, i, j, w, f;\r
+    unsigned long v;\r
+    char s[16], c, d, *p;\r
+\r
+\r
+    for (;;) {\r
+        c = *fmt++;     /* Get a char */\r
+        if (!c) break;    /* End of format? */\r
+        if (c != '%') {    /* Pass through it if not a % sequense */\r
+            xputc(c); continue;\r
+        }\r
+        f = 0;\r
+        c = *fmt++;     /* Get first char of the sequense */\r
+        if (c == '0') {    /* Flag: '0' padded */\r
+            f = 1; c = *fmt++;\r
+        } else {\r
+            if (c == '-') {   /* Flag: left justified */\r
+                f = 2; c = *fmt++;\r
+            }\r
+        }\r
+        for (w = 0; c >= '0' && c <= '9'; c = *fmt++) /* Minimum width */\r
+            w = w * 10 + c - '0';\r
+        if (c == 'l' || c == 'L') { /* Prefix: Size is long int */\r
+            f |= 4; c = *fmt++;\r
+        }\r
+        if (!c) break;    /* End of format? */\r
+        d = c;\r
+        if (d >= 'a') d -= 0x20;\r
+        switch (d) {    /* Type is... */\r
+            case 'S' :     /* String */\r
+                p = va_arg(arp, char*);\r
+                for (j = 0; p[j]; j++) ;\r
+                while (!(f & 2) && j++ < w) xputc(' ');\r
+                xputs(p);\r
+                while (j++ < w) xputc(' ');\r
+                continue;\r
+            case 'C' :     /* Character */\r
+                xputc((char)va_arg(arp, int)); continue;\r
+            case 'B' :     /* Binary */\r
+                r = 2; break;\r
+            case 'O' :     /* Octal */\r
+                r = 8; break;\r
+            case 'D' :     /* Signed decimal */\r
+            case 'U' :     /* Unsigned decimal */\r
+                r = 10; break;\r
+            case 'X' :     /* Hexdecimal */\r
+                r = 16; break;\r
+            default:     /* Unknown type (passthrough) */\r
+                xputc(c); continue;\r
+        }\r
+\r
+        /* Get an argument and put it in numeral */\r
+        v = (f & 4) ? va_arg(arp, long) : ((d == 'D') ? (long)va_arg(arp, int) : (long)va_arg(arp, unsigned int));\r
+        if (d == 'D' && (v & 0x80000000)) {\r
+            v = 0 - v;\r
+            f |= 8;\r
+        }\r
+        i = 0;\r
+        do {\r
+            d = (char)(v % r); v /= r;\r
+            if (d > 9) d += (c == 'x') ? 0x27 : 0x07;\r
+            s[i++] = d + '0';\r
+        } while (v && i < sizeof(s));\r
+        if (f & 8) s[i++] = '-';\r
+        j = i; d = (f & 1) ? '0' : ' ';\r
+        while (!(f & 2) && j++ < w) xputc(d);\r
+        do xputc(s[--i]); while(i);\r
+        while (j++ < w) xputc(' ');\r
+    }\r
+}\r
+\r
+\r
+void xprintf (   /* Put a formatted string to the default device */\r
+        const char* fmt, /* Pointer to the format string */\r
+        ...     /* Optional arguments */\r
+        )\r
+{\r
+    va_list arp;\r
+\r
+\r
+    va_start(arp, fmt);\r
+    xvprintf(fmt, arp);\r
+    va_end(arp);\r
+}\r
+\r
+\r
+void xsprintf (   /* Put a formatted string to the memory */\r
+        char* buff,   /* Pointer to the output buffer */\r
+        const char* fmt, /* Pointer to the format string */\r
+        ...     /* Optional arguments */\r
+        )\r
+{\r
+    va_list arp;\r
+\r
+\r
+    outptr = buff;  /* Switch destination for memory */\r
+\r
+    va_start(arp, fmt);\r
+    xvprintf(fmt, arp);\r
+    va_end(arp);\r
+\r
+    *outptr = 0;  /* Terminate output string with a \0 */\r
+    outptr = 0;   /* Switch destination for device */\r
+}\r
+\r
+\r
+    void xfprintf (     /* Put a formatted string to the specified device */\r
+            void(*func)(unsigned char), /* Pointer to the output function */\r
+            const char* fmt,   /* Pointer to the format string */\r
+            ...       /* Optional arguments */\r
+            )\r
+{\r
+    va_list arp;\r
+    void (*pf)(unsigned char);\r
+\r
+\r
+    pf = xfunc_out;  /* Save current output device */\r
+    xfunc_out = func; /* Switch output to specified device */\r
+\r
+    va_start(arp, fmt);\r
+    xvprintf(fmt, arp);\r
+    va_end(arp);\r
+\r
+    xfunc_out = pf;  /* Restore output device */\r
+}\r
+\r
+\r
+\r
+/*----------------------------------------------*/\r
+/* Dump a line of binary dump                   */\r
+/*----------------------------------------------*/\r
+\r
+void put_dump (\r
+        const void* buff,  /* Pointer to the array to be dumped */\r
+        unsigned long addr,  /* Heading address value */\r
+        int len,    /* Number of items to be dumped */\r
+        int width    /* Size of the items (DF_CHAR, DF_SHORT, DF_LONG) */\r
+        )\r
+{\r
+    int i;\r
+    const unsigned char *bp;\r
+    const unsigned short *sp;\r
+    const unsigned long *lp;\r
+\r
+\r
+    xprintf("%08lX ", addr);  /* address */\r
+\r
+    switch (width) {\r
+        case DW_CHAR:\r
+            bp = buff;\r
+            for (i = 0; i < len; i++)  /* Hexdecimal dump */\r
+                xprintf(" %02X", bp[i]);\r
+            xputc(' ');\r
+            for (i = 0; i < len; i++)  /* ASCII dump */\r
+                xputc((bp[i] >= ' ' && bp[i] <= '~') ? bp[i] : '.');\r
+            break;\r
+        case DW_SHORT:\r
+            sp = buff;\r
+            do        /* Hexdecimal dump */\r
+                xprintf(" %04X", *sp++);\r
+            while (--len);\r
+            break;\r
+        case DW_LONG:\r
+            lp = buff;\r
+            do        /* Hexdecimal dump */\r
+                xprintf(" %08LX", *lp++);\r
+            while (--len);\r
+            break;\r
+    }\r
+\r
+    xputc('\n');\r
+}\r
+\r
+#endif /* _USE_XFUNC_OUT */\r
+\r
+\r
+\r
+#if _USE_XFUNC_IN\r
+unsigned char (*xfunc_in)(void); /* Pointer to the input stream */\r
+\r
+/*----------------------------------------------*/\r
+/* Get a line from the input                    */\r
+/*----------------------------------------------*/\r
+\r
+int xgets (  /* 0:End of stream, 1:A line arrived */\r
+        char* buff, /* Pointer to the buffer */\r
+        int len  /* Buffer length */\r
+        )\r
+{\r
+    int c, i;\r
+\r
+\r
+    if (!xfunc_in) return 0;  /* No input function specified */\r
+\r
+    i = 0;\r
+    for (;;) {\r
+        c = xfunc_in();    /* Get a char from the incoming stream */\r
+        if (!c) return 0;   /* End of stream? */\r
+        if (c == '\r') break;  /* End of line? */\r
+        if (c == '\b' && i) {  /* Back space? */\r
+            i--;\r
+            if (_LINE_ECHO) xputc(c);\r
+            continue;\r
+        }\r
+        if (c >= ' ' && i < len - 1) { /* Visible chars */\r
+            buff[i++] = c;\r
+            if (_LINE_ECHO) xputc(c);\r
+        }\r
+    }\r
+    buff[i] = 0; /* Terminate with a \0 */\r
+    if (_LINE_ECHO) xputc('\n');\r
+    return 1;\r
+}\r
+\r
+\r
+    int xfgets ( /* 0:End of stream, 1:A line arrived */\r
+            unsigned char (*func)(void), /* Pointer to the input stream function */\r
+            char* buff, /* Pointer to the buffer */\r
+            int len  /* Buffer length */\r
+            )\r
+{\r
+    unsigned char (*pf)(void);\r
+    int n;\r
+\r
+\r
+    pf = xfunc_in;   /* Save current input device */\r
+    xfunc_in = func;  /* Switch input to specified device */\r
+    n = xgets(buff, len); /* Get a line */\r
+    xfunc_in = pf;   /* Restore input device */\r
+\r
+    return n;\r
+}\r
+\r
+\r
+/*----------------------------------------------*/\r
+/* Get a value of the string                    */\r
+/*----------------------------------------------*/\r
+/* "123 -5   0x3ff 0b1111 0377  w "\r
+   ^                           1st call returns 123 and next ptr\r
+   ^                        2nd call returns -5 and next ptr\r
+   ^                3rd call returns 1023 and next ptr\r
+   ^         4th call returns 15 and next ptr\r
+   ^    5th call returns 255 and next ptr\r
+   ^ 6th call fails and returns 0\r
+   */\r
+\r
+int xatoi (   /* 0:Failed, 1:Successful */\r
+        char **str,  /* Pointer to pointer to the string */\r
+        long *res  /* Pointer to the valiable to store the value */\r
+        )\r
+{\r
+    unsigned long val;\r
+    unsigned char c, r, s = 0;\r
+\r
+\r
+    *res = 0;\r
+\r
+    while ((c = **str) == ' ') (*str)++; /* Skip leading spaces */\r
+\r
+    if (c == '-') {  /* negative? */\r
+        s = 1;\r
+        c = *(++(*str));\r
+    }\r
+\r
+    if (c == '0') {\r
+        c = *(++(*str));\r
+        switch (c) {\r
+            case 'x':  /* hexdecimal */\r
+                r = 16; c = *(++(*str));\r
+                break;\r
+            case 'b':  /* binary */\r
+                r = 2; c = *(++(*str));\r
+                break;\r
+            default:\r
+                if (c <= ' ') return 1; /* single zero */\r
+                if (c < '0' || c > '9') return 0; /* invalid char */\r
+                r = 8;  /* octal */\r
+        }\r
+    } else {\r
+        if (c < '0' || c > '9') return 0; /* EOL or invalid char */\r
+        r = 10;   /* decimal */\r
+    }\r
+\r
+    val = 0;\r
+    while (c > ' ') {\r
+        if (c >= 'a') c -= 0x20;\r
+        c -= '0';\r
+        if (c >= 17) {\r
+            c -= 7;\r
+            if (c <= 9) return 0; /* invalid char */\r
+        }\r
+        if (c >= r) return 0;  /* invalid char for current radix */\r
+        val = val * r + c;\r
+        c = *(++(*str));\r
+    }\r
+    if (s) val = 0 - val;   /* apply sign if needed */\r
+\r
+    *res = val;\r
+    return 1;\r
+}\r
+\r
+#endif /* _USE_XFUNC_IN */\r
+\r
diff --git a/uzumeapp/kernel/uzume/ntshell/xprintf.h b/uzumeapp/kernel/uzume/ntshell/xprintf.h
new file mode 100644 (file)
index 0000000..4a8af14
--- /dev/null
@@ -0,0 +1,39 @@
+/*------------------------------------------------------------------------*/\r
+/* Universal string handler for user console interface  (C)ChaN, 2011     */\r
+/*------------------------------------------------------------------------*/\r
+\r
+#ifndef _STRFUNC\r
+#define _STRFUNC\r
+\r
+#define _USE_XFUNC_OUT  1 /* 1: Use output functions */\r
+#define _CR_CRLF        1 /* 1: Convert \n ==> \r\n in the output char */\r
+\r
+#define _USE_XFUNC_IN   1 /* 1: Use input function */\r
+#define _LINE_ECHO      1 /* 1: Echo back input chars in xgets function */\r
+\r
+\r
+#if _USE_XFUNC_OUT\r
+#define xdev_out(func) xfunc_out = (void(*)(unsigned char))(func)\r
+extern void (*xfunc_out)(unsigned char);\r
+void xputc (char c);\r
+void xputs (const char* str);\r
+void xfputs (void (*func)(unsigned char), const char* str);\r
+void xprintf (const char* fmt, ...);\r
+void xsprintf (char* buff, const char* fmt, ...);\r
+void xfprintf (void (*func)(unsigned char), const char* fmt, ...);\r
+void put_dump (const void* buff, unsigned long addr, int len, int width);\r
+#define DW_CHAR  sizeof(char)\r
+#define DW_SHORT sizeof(short)\r
+#define DW_LONG  sizeof(long)\r
+#endif\r
+\r
+#if _USE_XFUNC_IN\r
+#define xdev_in(func) xfunc_in = (unsigned char(*)(void))(func)\r
+extern unsigned char (*xfunc_in)(void);\r
+int xgets (char* buff, int len);\r
+int xfgets (unsigned char (*func)(void), char* buff, int len);\r
+int xatoi (char** str, long* res);\r
+#endif\r
+\r
+#endif\r
+\r