Commit da28e900 authored by Christian Persch's avatar Christian Persch

parser: charset: Add a DEC private OCS

parent 05d7324a
......@@ -207,7 +207,7 @@ static uint8_t const charset_control_single[] = {
/* Non-ISO-2022 coding systems, with standard return:
* ESC 2/5 F
*/
static uint8_t const charset_ocs_with_return[] = {
static uint8_t const charset_ocs[] = {
/* 3/0..3/15 */
NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, DEC(IBM_PROPRINTER), NA, NA,
......@@ -216,10 +216,18 @@ static uint8_t const charset_ocs_with_return[] = {
IR(188)
};
/* Non-ISO-2022 coding systems, with standard return:
* ESC 2/5 SP F
*/
static uint8_t const charset_ocs_with_2_0[] = {
/* 03/00 */
DEC(BARCODE)
};
/* Non-ISO-2022 coding systems, without standard return:
* ESC 2/5 2/15 F
*/
static uint8_t const charset_ocs_without_return[] = {
static uint8_t const charset_ocs_with_2_15[] = {
/* 4/0..4/12 */
IR(162), IR(163), IR(125), IR(174), IR(175), IR(176), IR(177), IR(190),
IR(191), IR(192), IR(193), IR(194), IR(195)
......
......@@ -298,6 +298,7 @@ ALIAS(SUPPLEMENTAL_NAME(LATIN_CYRILLIC), IR_NAME(144))
/* Other coding systems */
DEC(IBM_PROPRINTER) /* DEC PPLV2; ESC 2/5 3/13 */
DEC(BARCODE) /* DEC PPLV2; ESC 2/5 2/0 3/0 */
#undef IR_NAME
#undef DEC_NAME
......
......@@ -573,17 +573,23 @@ test_seq_esc_charset_other(void)
{
uint32_t i[4];
/* Other coding systems: ESC 2/5 F or ESC 2/5 2/15 F */
/* Other coding systems: ESC 2/5 F or ESC 2/5 I F */
i[0] = 0x25;
test_seq_esc_charset(i, 1,
charset_ocs_with_return,
G_N_ELEMENTS(charset_ocs_with_return),
charset_ocs,
G_N_ELEMENTS(charset_ocs),
0x30, VTE_CMD_DOCS, VTE_CHARSET_NONE, 0);
i[1] = 0x20;
test_seq_esc_charset(i, 2,
charset_ocs_with_2_0,
G_N_ELEMENTS(charset_ocs_with_2_0),
0x30, VTE_CMD_DOCS, VTE_CHARSET_NONE, 0);
i[1] = 0x2f;
test_seq_esc_charset(i, 2,
charset_ocs_without_return,
G_N_ELEMENTS(charset_ocs_without_return),
charset_ocs_with_2_15,
G_N_ELEMENTS(charset_ocs_with_2_15),
0x40, VTE_CMD_DOCS, VTE_CHARSET_NONE, 0);
}
......
......@@ -253,14 +253,24 @@ static unsigned int vte_parse_charset_ocs(uint32_t raw,
switch (VTE_SEQ_INTERMEDIATE(intermediates)) {
case VTE_SEQ_INTERMEDIATE_NONE: /* OCS with standard return */
if (remaining_intermediates == 0 &&
raw >= 0x30 && raw < (0x30 + G_N_ELEMENTS(charset_ocs_with_return)))
return charset_ocs_with_return[raw - 0x30];
raw >= 0x30 && raw < (0x30 + G_N_ELEMENTS(charset_ocs)))
return charset_ocs[raw - 0x30];
break;
case VTE_SEQ_INTERMEDIATE_SPACE: /* OCS with standard return */
if (remaining_intermediates == 0 &&
raw >= 0x30 && raw < (0x30 + G_N_ELEMENTS(charset_ocs_with_2_0)))
return charset_ocs_with_2_0[raw - 0x30];
/* Or should this return VTE_CHARSET_DRCS; ? */
break;
case VTE_SEQ_INTERMEDIATE_BANG ... VTE_SEQ_INTERMEDIATE_DOT: /* OCS with standard return */
break;
case VTE_SEQ_INTERMEDIATE_SLASH: /* OCS without standard return */
if (remaining_intermediates == 0 &&
raw >= 0x40 && raw < (0x40 + G_N_ELEMENTS(charset_ocs_without_return)))
return charset_ocs_without_return[raw - 0x40];
raw >= 0x40 && raw < (0x40 + G_N_ELEMENTS(charset_ocs_with_2_15)))
return charset_ocs_with_2_15[raw - 0x40];
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment