diff options
author | Christian Persch <chpe@src.gnome.org> | 2021-02-05 00:43:02 +0100 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2021-02-05 00:51:49 +0100 |
commit | 40e065c60a0eb163a2d7d30cb8e1aa8755a3b617 (patch) | |
tree | 3d0399af3b1c83e67746042756ddd1c4143293fa | |
parent | 144bd35be3640612786bed3b087dfd99309abd02 (diff) | |
download | vte-wip/tek-data-syntax.tar.gz |
WIP: TEK (328)wip/tek-data-syntax
-rwxr-xr-x | src/modes.py | 21 | ||||
-rwxr-xr-x | src/parser-seq.py | 2 | ||||
-rw-r--r-- | src/vte.cc | 9 | ||||
-rw-r--r-- | src/vteinternal.hh | 5 | ||||
-rw-r--r-- | src/vteseq.cc | 38 |
5 files changed, 55 insertions, 20 deletions
diff --git a/src/modes.py b/src/modes.py index 9c308875..7c6d8aed 100755 --- a/src/modes.py +++ b/src/modes.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright © 2018, 2020 Christian Persch +# Copyright © 2018, 2020, 2021 Christian Persch # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published @@ -511,6 +511,16 @@ modes = [ # mode_WHAT('DECHEM', 36, default=False), + # DECTEK - TEK 4010/4014 personality + # If set, switches to TEK 4010/4014 personality. + # + # Default: reset + # + # References: VT330/340 + # WY370 + # + mode_WHAT('DECTEK', 38, default=False, flags=Flags.WRITABLE, alias=['WYTEK']), + mode_WHAT('XTERM_DECCOLM', 40, default=False, flags=Flags.WRITABLE), # DECNRCM - NRCS mode @@ -1084,15 +1094,6 @@ modes = [ # WYSE: - # WYTEK - TEK 4010/4014 personality - # If set, switches to TEK 4010/4014 personality. - # - # Default: reset - # - # References: WY370 - # - mode_WHAT('WYTEK', 38, default=False, alias=['DECTEK']), - # WY161 - 161 column mode # If set, switches the terminal to 161 columns; if reset, # to 80 columns. diff --git a/src/parser-seq.py b/src/parser-seq.py index 9f33781d..58a382ff 100755 --- a/src/parser-seq.py +++ b/src/parser-seq.py @@ -648,7 +648,7 @@ sequences = [ comment='set line spacing'), seq_CSI('SM_HP', 'h', pintro=(ParameterIntro.GT,), flags=Flags.NOP, comment='set mode hp'), - seq_CSI('SM_DEC', 'h', pintro=(ParameterIntro.WHAT,), + seq_CSI('SM_DEC', 'h', pintro=(ParameterIntro.WHAT,), flags=Flags.HANDLER_RV, comment='set mode dec'), seq_CSI('MC_ECMA', 'i', flags=Flags.NOP, comment='media copy ecma'), @@ -29,7 +29,6 @@ #include <sys/termios.h> #endif #ifdef HAVE_STROPTS_H -#include <stropts.h> #endif #ifdef HAVE_SYS_STREAM_H #include <sys/stream.h> @@ -3538,6 +3537,10 @@ Terminal::process_incoming() break; #endif + case DataSyntax::TEK: + /* process_incoming_tek(context, *chunk); */ + break; + default: g_assert_not_reached(); break; @@ -9896,6 +9899,10 @@ Terminal::reset_data_syntax() break; #endif + case DataSyntax::TEK: + /* do something maybe */ + break; + default: break; } diff --git a/src/vteinternal.hh b/src/vteinternal.hh index c4788412..2cdfbe97 100644 --- a/src/vteinternal.hh +++ b/src/vteinternal.hh @@ -294,6 +294,7 @@ public: /* The following can never be primary data syntax: */ DECSIXEL, + TEK, }; DataSyntax m_primary_data_syntax{DataSyntax::ECMA48_UTF8}; @@ -1289,9 +1290,9 @@ public: inline void set_mode_ecma(vte::parser::Sequence const& seq, bool set) noexcept; - inline void set_mode_private(vte::parser::Sequence const& seq, + inline bool set_mode_private(vte::parser::Sequence const& seq, bool set) noexcept; - inline void set_mode_private(int mode, + inline bool set_mode_private(int mode, bool set) noexcept; inline void save_mode_private(vte::parser::Sequence const& seq, bool save) noexcept; diff --git a/src/vteseq.cc b/src/vteseq.cc index be1e52bd..2e446e9e 100644 --- a/src/vteseq.cc +++ b/src/vteseq.cc @@ -475,12 +475,23 @@ Terminal::update_mouse_protocol() noexcept "Mouse protocol is now %d\n", (int)m_mouse_tracking_mode); } -void +bool Terminal::set_mode_private(int mode, bool set) noexcept { + auto rv = false; /* no data syntax switch */ + /* Pre actions */ switch (mode) { + case vte::terminal::modes::Private::eDECTEK: + if (!set) { + /* Exiting TEK mode. Since this is only called in ECMA48 mode, + * there is nothing to do here. The data syntax backswitch will + * have happened from process_incoming_tek(); this function + * only need to reset the mode flag, below. + */ + } + break; default: break; } @@ -588,14 +599,23 @@ Terminal::set_mode_private(int mode, maybe_apply_bidi_attributes(VTE_BIDI_FLAG_AUTO); break; + case vte::terminal::modes::Private::eDECTEK: + if (set) { + /* Entering TEK mode */ + push_data_syntax(DataSyntax::TEK); + rv = true; + } + break; default: break; } + + return rv; } -void +bool Terminal::set_mode_private(vte::parser::Sequence const& seq, - bool set) noexcept + bool set) noexcept { auto const n_params = seq.size(); for (unsigned int i = 0; i < n_params; i = seq.next(i)) { @@ -610,8 +630,14 @@ Terminal::set_mode_private(vte::parser::Sequence const& seq, if (mode < 0) continue; - set_mode_private(mode, set); + /* If a data syntax change occured, we need to ignore any + * remaining parameters, and return immediately. + */ + if (set_mode_private(mode, set)) + return true; } + + return false; } void @@ -7601,7 +7627,7 @@ Terminal::SM_ECMA(vte::parser::Sequence const& seq) set_mode_ecma(seq, true); } -void +bool Terminal::SM_DEC(vte::parser::Sequence const& seq) { /* @@ -7613,7 +7639,7 @@ Terminal::SM_DEC(vte::parser::Sequence const& seq) * References: VT525 */ - set_mode_private(seq, true); + return set_mode_private(seq, true); } void |