summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2018-10-28 19:44:28 +0100
committerChristian Persch <chpe@src.gnome.org>2018-10-28 19:44:28 +0100
commitda28e9007b2ad10ef9d200a999997fc228ea88b9 (patch)
tree2a142e1887b3f11fe6f118993aee117ab25edf5f /src
parent05d7324a8cf9cb5af32a4ced094a308139cfd34e (diff)
downloadvte-da28e9007b2ad10ef9d200a999997fc228ea88b9.tar.gz
parser: charset: Add a DEC private OCS
Diffstat (limited to 'src')
-rw-r--r--src/parser-charset-tables.hh12
-rw-r--r--src/parser-charset.hh1
-rw-r--r--src/parser-test.cc16
-rw-r--r--src/parser.cc18
4 files changed, 36 insertions, 11 deletions
diff --git a/src/parser-charset-tables.hh b/src/parser-charset-tables.hh
index 48762464..07088750 100644
--- a/src/parser-charset-tables.hh
+++ b/src/parser-charset-tables.hh
@@ -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)
diff --git a/src/parser-charset.hh b/src/parser-charset.hh
index 2605f327..18e6ddaf 100644
--- a/src/parser-charset.hh
+++ b/src/parser-charset.hh
@@ -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
diff --git a/src/parser-test.cc b/src/parser-test.cc
index d5339bb1..c7522546 100644
--- a/src/parser-test.cc
+++ b/src/parser-test.cc
@@ -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);
}
diff --git a/src/parser.cc b/src/parser.cc
index 340ba15d..4c3bf2f7 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -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;
}