poke-devel
[Top][All Lists]
Advanced

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

[PATCH] Remove '#' preceeding the IOS IDs.


From: Egeyar Bagcioglu
Subject: [PATCH] Remove '#' preceeding the IOS IDs.
Date: Mon, 11 May 2020 00:41:41 +0200

2020-05-11  Egeyar Bagcioglu  <address@hidden>

        * libpoke/libpoke.c (pk_ios_completion_function): Remove '#'
        preceeding ios IDs.
        * poke/pk-ios.c (pk_cmd_ios): Expect integer, rather than a tag.
        (pk_cmd_close): Likewise.
        (print_info_ios): Remove '#' preceeding ios IDs.
        (pk_cmd_file): Suggest using .ios without '#'.
        (pk_cmd_mem): Likewise.
        (pk_cmd_nbd): Likewise.
        (ios_cmd): Convert the arguments of .ios and .close from tags
        to integers. Remove '#' preceeding ios IDs.
        * testsuite/poke.cmd/file-mode.pk: Adjust the test.
        * testsuite/poke.cmd/file-relative.pk: Likewise.
        * testsuite/poke.cmd/ios-1.pk: Likewise.
        * testsuite/poke.pkl/ios-cur-1.pk: Likewise.
        * testsuite/poke.repl/repl.exp: Likewise.
---
 libpoke/libpoke.c                   |  2 +-
 poke/pk-ios.c                       | 32 ++++++++++++++---------------
 testsuite/poke.cmd/file-mode.pk     |  4 ++--
 testsuite/poke.cmd/file-relative.pk |  2 +-
 testsuite/poke.cmd/ios-1.pk         |  4 ++--
 testsuite/poke.pkl/ios-cur-1.pk     |  4 ++--
 testsuite/poke.repl/repl.exp        |  2 +-
 7 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/libpoke/libpoke.c b/libpoke/libpoke.c
index 448ea40a..3f602705 100644
--- a/libpoke/libpoke.c
+++ b/libpoke/libpoke.c
@@ -268,7 +268,7 @@ pk_ios_completion_function (pk_compiler pkc __attribute__ 
((unused)),
         break;
 
       char buf[16];
-      snprintf (buf, 16, "#%d", ios_get_id (io));
+      snprintf (buf, 16, "%d", ios_get_id (io));
 
       int match = strncmp (buf, text, len);
       if (match != 0)
diff --git a/poke/pk-ios.c b/poke/pk-ios.c
index ffc8fa2e..16924636 100644
--- a/poke/pk-ios.c
+++ b/poke/pk-ios.c
@@ -36,19 +36,19 @@
 static int
 pk_cmd_ios (int argc, struct pk_cmd_arg argv[], uint64_t uflags)
 {
-  /* ios #ID */
+  /* ios ID */
 
   int io_id;
   pk_ios io;
 
   assert (argc == 1);
-  assert (PK_CMD_ARG_TYPE (argv[0]) == PK_CMD_ARG_TAG);
+  assert (PK_CMD_ARG_TYPE (argv[0]) == PK_CMD_ARG_INT);
 
-  io_id = PK_CMD_ARG_TAG (argv[0]);
+  io_id = PK_CMD_ARG_INT (argv[0]);
   io = pk_ios_search_by_id (poke_compiler, io_id);
   if (io == NULL)
     {
-      pk_printf (_("No IOS with tag #%d\n"), io_id);
+      pk_printf (_("No IOS with id %d\n"), io_id);
       return 0;
     }
 
@@ -81,7 +81,7 @@ pk_cmd_file (int argc, struct pk_cmd_arg argv[], uint64_t 
uflags)
 
   if (pk_ios_search (poke_compiler, filename) != NULL)
     {
-      printf (_("File %s already opened.  Use `.ios #N' to switch.\n"),
+      printf (_("File %s already opened.  Use `.ios N' to switch.\n"),
               filename);
       return 0;
     }
@@ -104,7 +104,7 @@ pk_cmd_file (int argc, struct pk_cmd_arg argv[], uint64_t 
uflags)
 static int
 pk_cmd_close (int argc, struct pk_cmd_arg argv[], uint64_t uflags)
 {
-  /* close [#ID]  */
+  /* close [ID]  */
   pk_ios io;
   int changed;
 
@@ -114,12 +114,12 @@ pk_cmd_close (int argc, struct pk_cmd_arg argv[], 
uint64_t uflags)
     io = pk_ios_cur (poke_compiler);
   else
     {
-      int io_id = PK_CMD_ARG_TAG (argv[0]);
+      int io_id = PK_CMD_ARG_INT (argv[0]);
 
       io = pk_ios_search_by_id (poke_compiler, io_id);
       if (io == NULL)
         {
-          pk_printf (_("No such file #%d\n"), io_id);
+          pk_printf (_("No IO device with ID %d\n"), io_id);
           return 0;
         }
     }
@@ -130,11 +130,11 @@ pk_cmd_close (int argc, struct pk_cmd_arg argv[], 
uint64_t uflags)
   if (changed)
     {
       if (pk_ios_cur (poke_compiler) == NULL)
-        puts (_("No more IO spaces."));
+        puts (_("No more IO devices."));
       else
         {
           if (poke_interactive_p && !poke_quiet_p)
-            pk_printf (_("The current file is now `%s'.\n"),
+            pk_printf (_("The current IO device is `%s' now.\n"),
                        pk_ios_handler (pk_ios_cur (poke_compiler)));
         }
     }
@@ -151,7 +151,7 @@ print_info_ios (pk_ios io, void *data)
   mode[1] = flags & PK_IOS_F_WRITE ? 'w' : ' ';
   mode[2] = '\0';
 
-  pk_printf ("%s#%d\t%s\t",
+  pk_printf ("%s%d\t%s\t",
              io == pk_ios_cur (poke_compiler) ? "* " : "  ",
              pk_ios_get_id (io),
              mode);
@@ -181,7 +181,7 @@ print_info_ios (pk_ios io, void *data)
     char *cmd;
     char *hyperlink;
 
-    asprintf (&cmd, ".ios #%d", pk_ios_get_id (io));
+    asprintf (&cmd, ".ios %d", pk_ios_get_id (io));
     hyperlink = pk_hserver_make_hyperlink ('e', cmd);
     free (cmd);
 
@@ -275,7 +275,7 @@ pk_cmd_mem (int argc, struct pk_cmd_arg argv[], uint64_t 
uflags)
 
   if (pk_ios_search (poke_compiler, mem_name) != NULL)
     {
-      printf (_("Buffer %s already opened.  Use `.ios #N' to switch.\n"),
+      printf (_("Buffer %s already opened.  Use `.ios N' to switch.\n"),
               mem_name);
       free (mem_name);
       return 0;
@@ -312,7 +312,7 @@ pk_cmd_nbd (int argc, struct pk_cmd_arg argv[], uint64_t 
uflags)
 
   if (pk_ios_search (poke_compiler, nbd_name) != NULL)
     {
-      printf (_("Buffer %s already opened.  Use `.ios #N' to switch.\n"),
+      printf (_("Buffer %s already opened.  Use `.ios ID' to switch.\n"),
               nbd_name);
       free (nbd_name);
       return 0;
@@ -340,7 +340,7 @@ ios_completion_function (const char *x, int state)
 }
 
 const struct pk_cmd ios_cmd =
-  {"ios", "t", "", 0, NULL, pk_cmd_ios, "ios #ID", ios_completion_function};
+  {"ios", "i", "", 0, NULL, pk_cmd_ios, "ios ID", ios_completion_function};
 
 const struct pk_cmd file_cmd =
   {"file", "f", "", 0, NULL, pk_cmd_file, "file FILE-NAME", 
rl_filename_completion_function};
@@ -354,7 +354,7 @@ const struct pk_cmd nbd_cmd =
 #endif
 
 const struct pk_cmd close_cmd =
-  {"close", "?t", "", PK_CMD_F_REQ_IO, NULL, pk_cmd_close, "close [#ID]", 
ios_completion_function};
+  {"close", "?i", "", PK_CMD_F_REQ_IO, NULL, pk_cmd_close, "close [ID]", 
ios_completion_function};
 
 const struct pk_cmd info_ios_cmd =
   {"ios", "", "", 0, NULL, pk_cmd_info_ios, "info ios", NULL};
diff --git a/testsuite/poke.cmd/file-mode.pk b/testsuite/poke.cmd/file-mode.pk
index dfe44632..e9934bae 100644
--- a/testsuite/poke.cmd/file-mode.pk
+++ b/testsuite/poke.cmd/file-mode.pk
@@ -4,5 +4,5 @@
 /* { dg-command { .file /dev/null } } */
 /* { dg-command { .info ios } } */
 /* { dg-output "  Id\tMode\tSize\t\tName" } */
-/* { dg-output {\n. #1\trw\t0x00000000#B\t/dev/null} } */
-/* { dg-output {\n  #0\tr[w ]\t0x[0-9a-f]*#B\t/etc/passwd} } */
+/* { dg-output {\n. 1\trw\t0x00000000#B\t/dev/null} } */
+/* { dg-output {\n  0\tr[w ]\t0x[0-9a-f]*#B\t/etc/passwd} } */
diff --git a/testsuite/poke.cmd/file-relative.pk 
b/testsuite/poke.cmd/file-relative.pk
index ca816d9e..e929eab2 100644
--- a/testsuite/poke.cmd/file-relative.pk
+++ b/testsuite/poke.cmd/file-relative.pk
@@ -4,4 +4,4 @@
 /* { dg-command { .file "a#b" } } */
 /* { dg-command { .info ios } } */
 /* { dg-output "  Id\tMode\tSize\t\tName" } */
-/* { dg-output "\n\\* #0\trw\t0x00000008#B\t./a#b" } */
+/* { dg-output "\n\\* 0\trw\t0x00000008#B\t./a#b" } */
diff --git a/testsuite/poke.cmd/ios-1.pk b/testsuite/poke.cmd/ios-1.pk
index 24a158a9..b8cbd233 100644
--- a/testsuite/poke.cmd/ios-1.pk
+++ b/testsuite/poke.cmd/ios-1.pk
@@ -3,9 +3,9 @@
 
 /* { dg-command { .file foo.data } } */
 /* { dg-command { .mem bar } } */
-/* { dg-command { .ios #0 } } */
+/* { dg-command { .ios 0 } } */
 /* { dg-command { get_ios } } */
 /* { dg-output "0" } */
-/* { dg-command { .ios #1 } } */
+/* { dg-command { .ios 1 } } */
 /* { dg-command { get_ios } } */
 /* { dg-output "\n1" } */
diff --git a/testsuite/poke.pkl/ios-cur-1.pk b/testsuite/poke.pkl/ios-cur-1.pk
index 590606b6..abacc499 100644
--- a/testsuite/poke.pkl/ios-cur-1.pk
+++ b/testsuite/poke.pkl/ios-cur-1.pk
@@ -3,10 +3,10 @@
 /* { dg-command { .mem foo } } */
 /* { dg-command { .mem bar } } */
 /* { dg-command { byte @ 2#B = 20 } } */
-/* { dg-command { .ios #0 } } */
+/* { dg-command { .ios 0 } } */
 /* { dg-command { byte @ 2#B = 10 } } */
 /* { dg-command { byte @ 2#B } } */
 /* { dg-output "10UB" } */
-/* { dg-command { .ios #1 } } */
+/* { dg-command { .ios 1 } } */
 /* { dg-command { byte @ 2#B } } */
 /* { dg-output "\n20UB" } */
diff --git a/testsuite/poke.repl/repl.exp b/testsuite/poke.repl/repl.exp
index 1036e107..b7b9523c 100644
--- a/testsuite/poke.repl/repl.exp
+++ b/testsuite/poke.repl/repl.exp
@@ -58,7 +58,7 @@ for {set index 0}  {$index < 12}  {incr index} {
     poke_test_cmd ".file $file0"  {}
     file delete $file0
 }
-poke_send ".ios #1\t\t" "#1   #10  #11"
+poke_send ".ios 1\t\t" "1   10  11"
 poke_exit
 
 set test "sigint-returns-to-prompt-1"
-- 
2.25.4




reply via email to

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