mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-22 05:33:45 -04:00
vt: remove dead code
This commit is contained in:
parent
d29de6f90a
commit
f36752f4d0
1 changed files with 0 additions and 495 deletions
495
vt.c
495
vt.c
|
|
@ -118,457 +118,6 @@ static const char *const action_names[] __attribute__((unused)) = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct state_transition {
|
|
||||||
enum action action;
|
|
||||||
enum state state;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
#if 0
|
|
||||||
static const struct state_transition state_anywhere[256] = {
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static const struct state_transition state_ground[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x19] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x1c ... 0x1f] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x20 ... 0x7f] = {.action = ACTION_PRINT},
|
|
||||||
|
|
||||||
[0xc0 ... 0xdf] = {.action = ACTION_UTF8_2_ENTRY, .state = STATE_UTF8_COLLECT},
|
|
||||||
[0xe0 ... 0xef] = {.action = ACTION_UTF8_3_ENTRY, .state = STATE_UTF8_COLLECT},
|
|
||||||
[0xf0 ... 0xf7] = {.action = ACTION_UTF8_4_ENTRY, .state = STATE_UTF8_COLLECT},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_escape[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x19] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x1c ... 0x1f] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x20 ... 0x2f] = {.action = ACTION_COLLECT, .state = STATE_ESCAPE_INTERMEDIATE},
|
|
||||||
[0x30 ... 0x4f] = {.action = ACTION_ESC_DISPATCH, .state = STATE_GROUND},
|
|
||||||
[0x50] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x51 ... 0x57] = {.action = ACTION_ESC_DISPATCH, .state = STATE_GROUND},
|
|
||||||
[0x58] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x59] = {.action = ACTION_ESC_DISPATCH, .state = STATE_GROUND},
|
|
||||||
[0x5a] = {.action = ACTION_ESC_DISPATCH, .state = STATE_GROUND},
|
|
||||||
[0x5b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x5c] = {.action = ACTION_ESC_DISPATCH, .state = STATE_GROUND},
|
|
||||||
[0x5d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x5e ... 0x5f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x60 ... 0x7e] = {.action = ACTION_ESC_DISPATCH, .state = STATE_GROUND},
|
|
||||||
[0x7f] = {.action = ACTION_IGNORE},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_escape_intermediate[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x19] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x1c ... 0x1f] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x20 ... 0x2f] = {.action = ACTION_COLLECT},
|
|
||||||
[0x30 ... 0x7e] = {.action = ACTION_ESC_DISPATCH, .state = STATE_GROUND},
|
|
||||||
[0x7f] = {.action = ACTION_IGNORE},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_csi_entry[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x19] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x1c ... 0x1f] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x20 ... 0x2f] = {.action = ACTION_COLLECT, .state = STATE_CSI_INTERMEDIATE},
|
|
||||||
[0x30 ... 0x39] = {.action = ACTION_PARAM, .state = STATE_CSI_PARAM},
|
|
||||||
[0x3a ... 0x3b] = { .state = STATE_CSI_PARAM},
|
|
||||||
[0x3c ... 0x3f] = {.action = ACTION_COLLECT, .state = STATE_CSI_PARAM},
|
|
||||||
[0x40 ... 0x7e] = {.action = ACTION_CSI_DISPATCH, .state = STATE_GROUND},
|
|
||||||
[0x7f] = {.action = ACTION_IGNORE},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_csi_param[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x19] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x1c ... 0x1f] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x20 ... 0x2f] = {.action = ACTION_COLLECT, .state = STATE_CSI_INTERMEDIATE},
|
|
||||||
[0x30 ... 0x39] = {.action = ACTION_PARAM},
|
|
||||||
[0x3a ... 0x3b] = {.action = ACTION_PARAM},
|
|
||||||
[0x3c ... 0x3f] = { .state = STATE_CSI_IGNORE},
|
|
||||||
[0x40 ... 0x7e] = {.action = ACTION_CSI_DISPATCH, .state = STATE_GROUND},
|
|
||||||
[0x7f] = {.action = ACTION_IGNORE},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_csi_intermediate[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x19] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x1c ... 0x1f] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x20 ... 0x2f] = {.action = ACTION_COLLECT},
|
|
||||||
[0x30 ... 0x3f] = { .state = STATE_CSI_IGNORE},
|
|
||||||
[0x40 ... 0x7e] = {.action = ACTION_CSI_DISPATCH, .state = STATE_GROUND},
|
|
||||||
[0x7f] = {.action = ACTION_IGNORE},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_csi_ignore[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x19] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x1c ... 0x1f] = {.action = ACTION_EXECUTE},
|
|
||||||
[0x20 ... 0x3f] = {.action = ACTION_IGNORE},
|
|
||||||
[0x40 ... 0x7e] = { .state = STATE_GROUND},
|
|
||||||
[0x7f] = {.action = ACTION_IGNORE},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_osc_string[256] = {
|
|
||||||
[0x00 ... 0x06] = {.action = ACTION_IGNORE},
|
|
||||||
[0x07] = { .state = STATE_GROUND},
|
|
||||||
[0x08 ... 0x17] = {.action = ACTION_IGNORE},
|
|
||||||
[0x19] = {.action = ACTION_IGNORE},
|
|
||||||
[0x1c ... 0x1f] = {.action = ACTION_IGNORE},
|
|
||||||
|
|
||||||
[0x20 ... 0xff] = {.action = ACTION_OSC_PUT},
|
|
||||||
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
#if 0
|
|
||||||
[0x20 ... 0x7f] = {.action = ACTION_OSC_PUT},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
|
|
||||||
[0xc0 ... 0xdf] = {.action = ACTION_OSC_PUT},
|
|
||||||
[0xe0 ... 0xef] = {.action = ACTION_OSC_PUT},
|
|
||||||
[0xf0 ... 0xf7] = {.action = ACTION_OSC_PUT},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_dcs_entry[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_IGNORE},
|
|
||||||
[0x19] = {.action = ACTION_IGNORE},
|
|
||||||
[0x1c ... 0x1f] = {.action = ACTION_IGNORE},
|
|
||||||
[0x20 ... 0x2f] = {.action = ACTION_COLLECT, .state = STATE_DCS_INTERMEDIATE},
|
|
||||||
[0x30 ... 0x39] = {.action = ACTION_PARAM, .state = STATE_DCS_PARAM},
|
|
||||||
[0x3a] = { .state = STATE_DCS_IGNORE},
|
|
||||||
[0x3b] = {.action = ACTION_PARAM, .state = STATE_DCS_PARAM},
|
|
||||||
[0x3c ... 0x3f] = {.action = ACTION_COLLECT, .state = STATE_DCS_PARAM},
|
|
||||||
[0x40 ... 0x7e] = { .state = STATE_DCS_PASSTHROUGH},
|
|
||||||
[0x7f] = {.action = ACTION_IGNORE},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_dcs_param[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_IGNORE},
|
|
||||||
[0x19] = {.action = ACTION_IGNORE},
|
|
||||||
[0x1c ... 0x1f] = {.action = ACTION_IGNORE},
|
|
||||||
[0x20 ... 0x2f] = {.action = ACTION_COLLECT, .state = STATE_DCS_INTERMEDIATE},
|
|
||||||
[0x30 ... 0x39] = {.action = ACTION_PARAM},
|
|
||||||
[0x3a] = { .state = STATE_DCS_IGNORE},
|
|
||||||
[0x3b] = {.action = ACTION_PARAM},
|
|
||||||
[0x3c ... 0x3f] = { .state = STATE_DCS_IGNORE},
|
|
||||||
[0x40 ... 0x7e] = { .state = STATE_DCS_PASSTHROUGH},
|
|
||||||
[0x7f] = {.action = ACTION_IGNORE},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_dcs_intermediate[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_IGNORE},
|
|
||||||
[0x19] = {.action = ACTION_IGNORE},
|
|
||||||
[0x1c ... 0x1f] = {.action = ACTION_IGNORE},
|
|
||||||
[0x20 ... 0x2f] = {.action = ACTION_COLLECT},
|
|
||||||
[0x30 ... 0x3f] = { .state = STATE_DCS_IGNORE},
|
|
||||||
[0x40 ... 0x7e] = { .state = STATE_DCS_PASSTHROUGH},
|
|
||||||
[0x7f] = {.action = ACTION_IGNORE},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_dcs_ignore[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_IGNORE},
|
|
||||||
[0x19] = {.action = ACTION_IGNORE},
|
|
||||||
[0x1c ... 0x1f] = {.action = ACTION_IGNORE},
|
|
||||||
[0x20 ... 0x7f] = {.action = ACTION_IGNORE},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_dcs_passthrough[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_PUT},
|
|
||||||
[0x19] = {.action = ACTION_PUT},
|
|
||||||
[0x1c ... 0x7e] = {.action = ACTION_PUT},
|
|
||||||
[0x7f] = {.action = ACTION_IGNORE},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct state_transition state_sos_pm_apc_string[256] = {
|
|
||||||
[0x00 ... 0x17] = {.action = ACTION_IGNORE},
|
|
||||||
[0x19] = {.action = ACTION_IGNORE},
|
|
||||||
[0x1c ... 0x7f] = {.action = ACTION_IGNORE},
|
|
||||||
[0x9c] = { .state = STATE_GROUND},
|
|
||||||
|
|
||||||
/* Anywhere */
|
|
||||||
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x1b] = { .state = STATE_ESCAPE},
|
|
||||||
[0x80 ... 0x8f] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x90] = { .state = STATE_DCS_ENTRY},
|
|
||||||
[0x91 ... 0x97] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x98] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
[0x99] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
|
|
||||||
[0x9b] = { .state = STATE_CSI_ENTRY},
|
|
||||||
[0x9d] = { .state = STATE_OSC_STRING},
|
|
||||||
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static const struct state_transition* states[] = {
|
|
||||||
[STATE_GROUND] = state_ground,
|
|
||||||
[STATE_ESCAPE] = state_escape,
|
|
||||||
[STATE_ESCAPE_INTERMEDIATE] = state_escape_intermediate,
|
|
||||||
[STATE_CSI_ENTRY] = state_csi_entry,
|
|
||||||
[STATE_CSI_PARAM] = state_csi_param,
|
|
||||||
[STATE_CSI_INTERMEDIATE] = state_csi_intermediate,
|
|
||||||
[STATE_CSI_IGNORE] = state_csi_ignore,
|
|
||||||
[STATE_OSC_STRING] = state_osc_string,
|
|
||||||
[STATE_DCS_ENTRY] = state_dcs_entry,
|
|
||||||
[STATE_DCS_PARAM] = state_dcs_param,
|
|
||||||
[STATE_DCS_INTERMEDIATE] = state_dcs_intermediate,
|
|
||||||
[STATE_DCS_IGNORE] = state_dcs_ignore,
|
|
||||||
[STATE_DCS_PASSTHROUGH] = state_dcs_passthrough,
|
|
||||||
[STATE_SOS_PM_APC_STRING] = state_sos_pm_apc_string,
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
#if 0
|
|
||||||
static const enum action entry_actions[] = {
|
|
||||||
[STATE_SAME] = ACTION_NONE,
|
|
||||||
[STATE_GROUND] = ACTION_NONE,
|
|
||||||
[STATE_ESCAPE] = ACTION_CLEAR,
|
|
||||||
[STATE_CSI_ENTRY] = ACTION_CLEAR,
|
|
||||||
[STATE_CSI_PARAM] = ACTION_NONE,
|
|
||||||
[STATE_CSI_INTERMEDIATE] = ACTION_NONE,
|
|
||||||
[STATE_CSI_IGNORE] = ACTION_NONE,
|
|
||||||
[STATE_OSC_STRING] = ACTION_OSC_START,
|
|
||||||
[STATE_UTF8_COLLECT] = ACTION_NONE,
|
|
||||||
[STATE_DCS_ENTRY] = ACTION_CLEAR,
|
|
||||||
[STATE_DCS_PARAM] = ACTION_NONE,
|
|
||||||
[STATE_DCS_INTERMEDIATE] = ACTION_NONE,
|
|
||||||
[STATE_DCS_IGNORE] = ACTION_NONE,
|
|
||||||
[STATE_DCS_PASSTHROUGH] = ACTION_HOOK,
|
|
||||||
[STATE_SOS_PM_APC_STRING] = ACTION_NONE,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const enum action exit_actions[] = {
|
|
||||||
[STATE_SAME] = ACTION_NONE,
|
|
||||||
[STATE_GROUND] = ACTION_NONE,
|
|
||||||
[STATE_ESCAPE] = ACTION_NONE,
|
|
||||||
[STATE_CSI_ENTRY] = ACTION_NONE,
|
|
||||||
[STATE_CSI_PARAM] = ACTION_NONE,
|
|
||||||
[STATE_CSI_INTERMEDIATE] = ACTION_NONE,
|
|
||||||
[STATE_CSI_IGNORE] = ACTION_NONE,
|
|
||||||
[STATE_OSC_STRING] = ACTION_OSC_END,
|
|
||||||
[STATE_UTF8_COLLECT] = ACTION_NONE,
|
|
||||||
[STATE_DCS_ENTRY] = ACTION_NONE,
|
|
||||||
[STATE_DCS_PARAM] = ACTION_NONE,
|
|
||||||
[STATE_DCS_INTERMEDIATE] = ACTION_NONE,
|
|
||||||
[STATE_DCS_IGNORE] = ACTION_NONE,
|
|
||||||
[STATE_DCS_PASSTHROUGH] = ACTION_UNHOOK,
|
|
||||||
[STATE_SOS_PM_APC_STRING] = ACTION_NONE,
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
#if defined(LOG_ENABLE_DBG) && LOG_ENABLE_DBG
|
#if defined(LOG_ENABLE_DBG) && LOG_ENABLE_DBG
|
||||||
static const char *
|
static const char *
|
||||||
esc_as_string(struct terminal *term, uint8_t final)
|
esc_as_string(struct terminal *term, uint8_t final)
|
||||||
|
|
@ -1047,16 +596,6 @@ action(struct terminal *term, enum action _action, uint8_t c)
|
||||||
term->vt.utf8.data[term->vt.utf8.idx++] = c;
|
term->vt.utf8.data[term->vt.utf8.idx++] = c;
|
||||||
term->vt.utf8.left--;
|
term->vt.utf8.left--;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if 0
|
|
||||||
case ACTION_UTF8_COLLECT:
|
|
||||||
term->vt.utf8.data[term->vt.utf8.idx++] = c;
|
|
||||||
if (--term->vt.utf8.left == 0) {
|
|
||||||
term->vt.state = STATE_GROUND;
|
|
||||||
action_print_utf8(term);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1560,16 +1099,6 @@ vt_from_slave(struct terminal *term, const uint8_t *data, size_t len)
|
||||||
enum state current_state = term->vt.state
|
enum state current_state = term->vt.state
|
||||||
;
|
;
|
||||||
for (size_t i = 0; i < len; i++) {
|
for (size_t i = 0; i < len; i++) {
|
||||||
#if 0
|
|
||||||
if (current_state == STATE_UTF8_COLLECT) {
|
|
||||||
action(term, ACTION_UTF8_COLLECT, data[i]);
|
|
||||||
|
|
||||||
current_state = term->vt.state;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const struct state_transition *table = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (current_state) {
|
switch (current_state) {
|
||||||
case STATE_GROUND: term->vt.state = current_state = state_ground_switch(term, data[i]); continue;
|
case STATE_GROUND: term->vt.state = current_state = state_ground_switch(term, data[i]); continue;
|
||||||
case STATE_ESCAPE: term->vt.state = current_state = state_escape_switch(term, data[i]); continue;
|
case STATE_ESCAPE: term->vt.state = current_state = state_escape_switch(term, data[i]); continue;
|
||||||
|
|
@ -1591,29 +1120,5 @@ vt_from_slave(struct terminal *term, const uint8_t *data, size_t len)
|
||||||
case STATE_UTF8_COLLECT_3: term->vt.state = current_state = state_utf8_collect_3_switch(term, data[i]); continue;
|
case STATE_UTF8_COLLECT_3: term->vt.state = current_state = state_utf8_collect_3_switch(term, data[i]); continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
assert(table != NULL);
|
|
||||||
const struct state_transition *transition = &table[data[i]];
|
|
||||||
|
|
||||||
if (transition->state != STATE_SAME) {
|
|
||||||
enum action exit_action = exit_actions[current_state];
|
|
||||||
action(term, exit_action, data[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
action(term, transition->action, data[i]);
|
|
||||||
|
|
||||||
if (transition->state != STATE_SAME) {
|
|
||||||
/*
|
|
||||||
* LOG_DBG("transition: %s -> %s", state_names[current_state],
|
|
||||||
* state_names[transition->state]);
|
|
||||||
*/
|
|
||||||
term->vt.state = transition->state;
|
|
||||||
current_state = transition->state;
|
|
||||||
|
|
||||||
enum action entry_action = entry_actions[transition->state];
|
|
||||||
action(term, entry_action, data[i]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue