texinfo-commits
[Top][All Lists]
Advanced

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

[5833] return function pointer from info_dispatch_on_key


From: Gavin D. Smith
Subject: [5833] return function pointer from info_dispatch_on_key
Date: Sun, 21 Sep 2014 20:18:24 +0000

Revision: 5833
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5833
Author:   gavin
Date:     2014-09-21 20:18:22 +0000 (Sun, 21 Sep 2014)
Log Message:
-----------
return function pointer from info_dispatch_on_key

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/echo-area.c
    trunk/info/session.c
    trunk/info/session.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-09-18 15:02:12 UTC (rev 5832)
+++ trunk/ChangeLog     2014-09-21 20:18:22 UTC (rev 5833)
@@ -1,3 +1,8 @@
+2014-09-21  Gavin Smith  <address@hidden>
+
+       * info/session.c (info_read_dispatch): Return pointer to function 
+       implementing Info command instead of calling it.  All callers updated.
+
 2014-09-18  Gavin Smith  <address@hidden>
 
        * info/session.c (info_select_reference): When following a reference

Modified: trunk/info/echo-area.c
===================================================================
--- trunk/info/echo-area.c      2014-09-18 15:02:12 UTC (rev 5832)
+++ trunk/info/echo-area.c      2014-09-21 20:18:22 UTC (rev 5833)
@@ -171,6 +171,7 @@
 
   while (1)
     {
+      VFunction *cmd;
       int lk = 0;
 
       lk = echo_area_last_command_was_kill;
@@ -186,7 +187,11 @@
       key = get_input_key ();
 
       /* Do the selected command. */
-      info_dispatch_on_key (key, echo_area_keymap);
+      cmd = info_dispatch_on_key (key, echo_area_keymap);
+      if (cmd)
+        {
+          (*cmd) (the_echo_area, 1, key);
+        }
 
       /* Echo area commands that do killing increment the value of
          ECHO_AREA_LAST_COMMAND_WAS_KILL.  Thus, if there is no

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-09-18 15:02:12 UTC (rev 5832)
+++ trunk/info/session.c        2014-09-21 20:18:22 UTC (rev 5833)
@@ -244,8 +244,14 @@
       if (key == KEY_MOUSE)
         mouse_event_handler ();
       else
-        /* Do the selected command. */
-        info_dispatch_on_key (key, info_keymap);
+        {
+          /* Do the selected command. */
+          VFunction *cmd = info_dispatch_on_key (key, info_keymap);
+          if (cmd)
+            {
+              (*cmd) (active_window, 1, key);
+            }
+        }
     }
 }
 
@@ -4915,9 +4921,9 @@
   return get_input_key ();
 }
 
-/* Do the command associated with KEY in MAP.  If the associated command is
-   really a keymap, then read another key, and dispatch into that map. */
-void
+/* Look up the command associated with KEY in MAP.  If the associated command 
+   is really a keymap, then read another key, and dispatch into that map. */
+VFunction *
 info_dispatch_on_key (int key, Keymap map)
 {
   switch (map[key].type)
@@ -4950,8 +4956,7 @@
                     dispatch_error (info_keyseq);
                     return;
                   }
-                info_dispatch_on_key (lowerkey, map);
-                return;
+                return info_dispatch_on_key (lowerkey, map);
               }
 
             add_char_to_keyseq (key);
@@ -4964,25 +4969,18 @@
 
               where = active_window;
 
-              if (!echo_area_is_active)
-                (*InfoFunction(map[key].function))
-                  (active_window, info_numeric_arg * info_numeric_arg_sign,
-                  key);
-              else
-                (*InfoFunction(map[key].function))
-                  (active_window, ea_numeric_arg * ea_numeric_arg_sign,
-                  key);
-
               /* If in the echo area, remember the last command executed. */
               if (where == the_echo_area)
                 ea_last_executed_command = InfoFunction(map[key].function);
+
+              return InfoFunction(map[key].function);
             }
           }
         else
           {
             add_char_to_keyseq (key);
             dispatch_error (info_keyseq);
-            return;
+            return 0;
           }
       }
       break;
@@ -4994,12 +4992,12 @@
           int newkey;
 
           newkey = get_another_input_key ();
-          info_dispatch_on_key (newkey, (Keymap)map[key].function);
+          return info_dispatch_on_key (newkey, (Keymap)map[key].function);
         }
       else
         {
           dispatch_error (info_keyseq);
-          return;
+          return 0;
         }
       break;
     }
@@ -5100,8 +5098,15 @@
             }
           else
             {
+              VFunction *cmd;
               info_keyseq_index--;
-              info_dispatch_on_key (pure_key, keymap);
+              cmd = info_dispatch_on_key (pure_key, keymap);
+              if (cmd)
+                {
+                  (*cmd) (active_window,
+                          *which_numeric_arg * *which_numeric_arg_sign,
+                          key);
+                }
               return;
             }
         }

Modified: trunk/info/session.h
===================================================================
--- trunk/info/session.h        2014-09-18 15:02:12 UTC (rev 5832)
+++ trunk/info/session.h        2014-09-21 20:18:22 UTC (rev 5833)
@@ -66,7 +66,7 @@
 int get_another_input_key (void);
 
 /* Utility functions found in session.c */
-extern void info_dispatch_on_key (int key, Keymap map);
+extern VFunction *info_dispatch_on_key (int key, Keymap map);
 extern unsigned char info_input_pending_p (void);
 extern void info_set_node_of_window (WINDOW *window, NODE *node);
 extern void initialize_keyseq (void);




reply via email to

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