Commit e4b57b93 authored by Sven Schnelle's avatar Sven Schnelle Committed by Heiko Carstens

s390/tty3270: add support for VT100 graphics escape

Add support for ESC(B and ESC(0 to switch between character charset
and graphics charset. Used in vt100 and later terminal generations.
Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Tested-by: default avatarNiklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 94dbb0a7
...@@ -1557,7 +1557,7 @@ static void tty3270_goto_xy(struct tty3270 *tp, int cx, int cy) ...@@ -1557,7 +1557,7 @@ static void tty3270_goto_xy(struct tty3270 *tp, int cx, int cy)
*/ */
static void tty3270_escape_sequence(struct tty3270 *tp, char ch) static void tty3270_escape_sequence(struct tty3270 *tp, char ch)
{ {
enum { ESnormal, ESesc, ESsquare, ESgetpars }; enum { ESnormal, ESesc, ESsquare, ESparen, ESgetpars };
if (tp->esc_state == ESnormal) { if (tp->esc_state == ESnormal) {
if (ch == 0x1b) if (ch == 0x1b)
...@@ -1571,6 +1571,9 @@ static void tty3270_escape_sequence(struct tty3270 *tp, char ch) ...@@ -1571,6 +1571,9 @@ static void tty3270_escape_sequence(struct tty3270 *tp, char ch)
case '[': case '[':
tp->esc_state = ESsquare; tp->esc_state = ESsquare;
break; break;
case '(':
tp->esc_state = ESparen;
break;
case 'E': case 'E':
tty3270_cr(tp); tty3270_cr(tp);
tty3270_lf(tp); tty3270_lf(tp);
...@@ -1604,15 +1607,28 @@ static void tty3270_escape_sequence(struct tty3270 *tp, char ch) ...@@ -1604,15 +1607,28 @@ static void tty3270_escape_sequence(struct tty3270 *tp, char ch)
} }
return; return;
} }
if (tp->esc_state == ESsquare) {
switch (tp->esc_state) {
case ESparen:
tp->esc_state = ESnormal;
switch (ch) {
case 'B':
tp->attributes.alternate_charset = 0;
break;
case '0':
tp->attributes.alternate_charset = 1;
break;
}
return;
case ESsquare:
tp->esc_state = ESgetpars; tp->esc_state = ESgetpars;
memset(tp->esc_par, 0, sizeof(tp->esc_par)); memset(tp->esc_par, 0, sizeof(tp->esc_par));
tp->esc_npar = 0; tp->esc_npar = 0;
tp->esc_ques = (ch == '?'); tp->esc_ques = (ch == '?');
if (tp->esc_ques) if (tp->esc_ques)
return; return;
} fallthrough;
if (tp->esc_state == ESgetpars) { case ESgetpars:
if (ch == ';' && tp->esc_npar < ESCAPE_NPAR - 1) { if (ch == ';' && tp->esc_npar < ESCAPE_NPAR - 1) {
tp->esc_npar++; tp->esc_npar++;
return; return;
...@@ -1622,6 +1638,9 @@ static void tty3270_escape_sequence(struct tty3270 *tp, char ch) ...@@ -1622,6 +1638,9 @@ static void tty3270_escape_sequence(struct tty3270 *tp, char ch)
tp->esc_par[tp->esc_npar] += ch - '0'; tp->esc_par[tp->esc_npar] += ch - '0';
return; return;
} }
break;
default:
break;
} }
tp->esc_state = ESnormal; tp->esc_state = ESnormal;
if (ch == 'n' && !tp->esc_ques) { if (ch == 'n' && !tp->esc_ques) {
......
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