poke-devel
[Top][All Lists]
Advanced

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

[COMMITTED] poked: more simplification and unification


From: Mohammad-Reza Nabipoor
Subject: [COMMITTED] poked: more simplification and unification
Date: Wed, 18 Jan 2023 23:50:31 +0100

2023-01-18  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>

        * poked/poked.c (VUCMD_*): Re-enumerate the view (vu) commands.
        * poked/poked.pk (plet_vu): Simplify the dump format. We can
        make it more flexible again later.
        (plet_vu_highlight): Simplify array allocation.
---
 ChangeLog      |  7 +++++++
 poked/poked.c  | 16 +++++++++-------
 poked/poked.pk | 11 ++++-------
 3 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4a93f631..cb33df44 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-01-18  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
+
+       * poked/poked.c (VUCMD_*): Re-enumerate the view (vu) commands.
+       * poked/poked.pk (plet_vu): Simplify the dump format. We can
+       make it more flexible again later.
+       (plet_vu_highlight): Simplify array allocation.
+
 2023-01-18  Jose E. Marchesi  <jemarch@gnu.org>
 
        * cfg.mk (sc_pvm_wrappers): Remove empty lines.
diff --git a/poked/poked.c b/poked/poked.c
index 18981cb3..e025a0bd 100644
--- a/poked/poked.c
+++ b/poked/poked.c
@@ -40,6 +40,7 @@ struct usock *srv;
 static int poked_init (int pdap_version);
 static void poked_free (void);
 
+/* Terminal output  */
 #define OUTCMD_ITER_BEGIN 1
 #define OUTCMD_ITER_END 2
 #define OUTCMD_ERR 3
@@ -48,11 +49,12 @@ static void poked_free (void);
 #define OUTCMD_CLS_END 6
 #define OUTCMD_EVAL 7
 
-#define VUCMD_CLEAR 1
-#define VUCMD_APPEND 2
-#define VUCMD_HIGHLIGHT 3
-#define VUCMD_FILTER 4
-#define VUCMD_FINISH 5
+/* View (vu)  */
+#define VUCMD_ITER_BEGIN 1
+#define VUCMD_ITER_END 2
+#define VUCMD_CLEAR 3
+#define VUCMD_APPEND 4
+#define VUCMD_HIGHLIGHT 5
 
 /* Auto-completion  */
 #define AUTOCMPL_ITER_BEGIN OUTCMD_ITER_BEGIN
@@ -451,14 +453,14 @@ poked_compile (const char *src, uint8_t chan, int 
*poked_restart_p,
     {
       const char *filt = pk_string_str (pk_decl_val (pkc, "__plet_vu_filter"));
 
-      usock_out (srv, USOCK_CHAN_OUT_VU, VUCMD_FILTER, filt,
+      usock_out (srv, USOCK_CHAN_OUT_VU, VUCMD_ITER_BEGIN, filt,
                  strlen (filt) + 1);
       usock_out (srv, USOCK_CHAN_OUT_VU, VUCMD_CLEAR, "", 1);
       termout_vu_append ();
       (void)pk_call (pkc, pk_decl_val (pkc, "__plet_vu_dump"), NULL, &exc, 0);
       assert (exc == PK_NULL);
       termout_restore ();
-      usock_out (srv, USOCK_CHAN_OUT_VU, VUCMD_FINISH, "", 1);
+      usock_out (srv, USOCK_CHAN_OUT_VU, VUCMD_ITER_END, "", 1);
     }
   if (pk_int_value (pk_decl_val (pkc, "__poked_chan_send_p")))
     poked_buf_send ();
diff --git a/poked/poked.pk b/poked/poked.pk
index 57260ee0..9436e53e 100644
--- a/poked/poked.pk
+++ b/poked/poked.pk
@@ -196,14 +196,11 @@ fun plet_vu = (string filt = __plet_vu_filter,
                string[] filts = string[] (),
                int<32> ios = get_ios,
                offset<long,B> from = pk_dump_get_offset (ios),
-               offset<long,B> size = pk_dump_size,
-               offset<long,B> group_by = pk_dump_group_by,
-               int cluster_by = pk_dump_cluster_by,
-               int ascii = pk_dump_ascii) void:
+               offset<long,B> size = pk_dump_size) void:
   {
     __plet_vu_args = __Poked_VuArgs {
-        ios = ios, from = from, size = size, group_by = group_by,
-        cluster_by = cluster_by, ascii = ascii,
+        ios = ios, from = from, size = size, group_by = 2#B,
+        cluster_by = 8, ascii = 1,
       };
     if (filts'length != 0)
       {
@@ -260,7 +257,7 @@ fun plet_vu_highlight = (offset<long,N> from = plet_vu_dot,
 //                                                                    , l4  , 
c31 , c32 , c33 , c34  ,
     
"%u64d,%u64d,%u64d,%u64d,%u64d,%u64d,%u64d,%u64d,%u64d,%u64d,%u64d,%u64d,%u64d,%u64d,%u64d,%u64d",
     l1, c11, c12, c13, c14, l2, l3, c21, c22, c23, c24, l4, c31, c32, c33, 
c34);
-    var payload = byte[payload_str'length + 1] ();
+    var payload = byte[payload_str'size] ();
 
     stoca (payload_str, payload);
     poked_chan_send (2, [3UB] + payload);
-- 
2.39.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]