[vte/wip/tek-data-syntax] WIP: #328




commit 8c7b78945d655f4bceb5ad01a7f93a3a4fa3369b
Author: Christian Persch <chpe src gnome org>
Date:   Thu Feb 4 23:59:46 2021 +0100

    WIP: #328

 src/modes.py       | 21 +++++++++++----------
 src/parser-seq.py  |  2 +-
 src/vte.cc         |  9 ++++++++-
 src/vteinternal.hh |  5 +++--
 src/vteseq.cc      | 23 +++++++++++++++++------
 5 files changed, 40 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'),
diff --git a/src/vte.cc b/src/vte.cc
index 48742d83..619ee4c2 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -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;
@@ -9897,6 +9900,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..0c017960 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -475,10 +475,12 @@ 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) {
         default:
@@ -588,15 +590,22 @@ Terminal::set_mode_private(int mode,
                 maybe_apply_bidi_attributes(VTE_BIDI_FLAG_AUTO);
                 break;
 
+       case vte::terminal::modes::Private::eDECTEK:
+                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 rv = false;
         auto const n_params = seq.size();
         for (unsigned int i = 0; i < n_params; i = seq.next(i)) {
                 auto const param = seq.collect1(i);
@@ -610,8 +619,10 @@ Terminal::set_mode_private(vte::parser::Sequence const& seq,
                 if (mode < 0)
                         continue;
 
-                set_mode_private(mode, set);
+                rv |= set_mode_private(mode, set);
         }
+
+        return rv;
 }
 
 void
@@ -7601,7 +7612,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 +7624,7 @@ Terminal::SM_DEC(vte::parser::Sequence const& seq)
          * References: VT525
          */
 
-        set_mode_private(seq, true);
+        return set_mode_private(seq, true);
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]