texinfo-commits
[Top][All Lists]
Advanced

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

[5835] InfoFunction macro removed


From: Gavin D. Smith
Subject: [5835] InfoFunction macro removed
Date: Wed, 24 Sep 2014 12:01:58 +0000

Revision: 5835
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5835
Author:   gavin
Date:     2014-09-24 12:01:56 +0000 (Wed, 24 Sep 2014)
Log Message:
-----------
InfoFunction macro removed

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/doc.h
    trunk/info/infodoc.c
    trunk/info/m-x.c
    trunk/info/session.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-09-22 16:39:04 UTC (rev 5834)
+++ trunk/ChangeLog     2014-09-24 12:01:56 UTC (rev 5835)
@@ -1,3 +1,8 @@
+2014-09-24  Gavin Smith  <address@hidden>
+
+       * info/doc.h (InfoCommand): Removed.  All uses updated.
+       (FUNCTION_DOC): Comments added.
+
 2014-09-22  Gavin Smith  <address@hidden>
 
        * info/session.c (info_dispatch_on_key): Don't set 

Modified: trunk/info/doc.h
===================================================================
--- trunk/info/doc.h    2014-09-22 16:39:04 UTC (rev 5834)
+++ trunk/info/doc.h    2014-09-24 12:01:56 UTC (rev 5835)
@@ -43,28 +43,20 @@
   int *keyseq;
 } FUNCTION_KEYSEQ;
 
-/* An array of FUNCTION_DOC structures is defined in doc.c, which is
-   automagically generated by the makedoc utility, whose job is to scan
-   through the source files for command function declarations and
-   compile a list of all the ones it finds.  This saves tedious
-   housekeeping and avoids errors of omission.  */
+/* Structure describing an Info command. */
 typedef struct
 {
-  VFunction *func;
-  char *func_name;
-  FUNCTION_KEYSEQ *keys;
-  char *doc;
+  VFunction *func;        /* Pointer to function implementing command. */
+  char *func_name;        /* Name of this command. */
+  FUNCTION_KEYSEQ *keys;  /* Key sequences that could invoke this command. */
+  char *doc;              /* Documentation string. */
 } FUNCTION_DOC;
 
+/* Array of FUNCTION_DOC structures defined in doc.c, generated
+   by the makedoc utility. */
 extern FUNCTION_DOC function_doc_array[];
 
-/* An Info command is specified by a pointer to the command's FUNCTION_DOC
-   structure, defined in doc.c, from which the pointer to the function can be
-   easily divined using the InfoFunction() extractor.  */
 typedef FUNCTION_DOC InfoCommand;
-/* The cast to VFunction * prevents pgcc from complaining about
-   dereferencing a void *.  */
-#define InfoFunction(ic) ((ic) ? (ic)->func : (VFunction *) NULL)
 #define InfoCmd(fn) (&function_doc_array[A_##fn])
 
 #include "infomap.h" /* for Keymap.  */

Modified: trunk/info/infodoc.c
===================================================================
--- trunk/info/infodoc.c        2014-09-22 16:39:04 UTC (rev 5834)
+++ trunk/info/infodoc.c        2014-09-24 12:01:56 UTC (rev 5835)
@@ -121,10 +121,9 @@
           /* Hide some key mappings.  Do not display "Run command bound to
              this key's lowercase variant" in help window, and omit lines
              like "M-: .. M->(echo-area-insert)    Insert this character". */
-          if (InfoFunction (map[i].function)
-               == (VFunction *) info_do_lowercase_version
-              || InfoFunction (map[i].function)
-               == (VFunction *) ea_insert)
+          if (map[i].function
+              && (map[i].function->func == info_do_lowercase_version
+                  || map[i].function->func == ea_insert))
             continue;
 
           doc = function_documentation (map[i].function);
@@ -233,7 +232,7 @@
         {
           InfoCommand *cmd = &function_doc_array[i];
 
-          if (InfoFunction(cmd) != (VFunction *) info_do_lowercase_version
+          if (cmd->func != info_do_lowercase_version
               && !where_is_internal (info_keymap, cmd)
               && !where_is_internal (echo_area_keymap, cmd))
             {
@@ -513,8 +512,8 @@
              edit keys that emit an escape sequence: it's terribly
              confusing to see a message "Home (do-lowercase-version)"
              or some such when Home is unbound.  */
-          if (InfoFunction(map[keystroke].function)
-              == (VFunction *) info_do_lowercase_version)
+          if (map[keystroke].function
+              && map[keystroke].function->func == info_do_lowercase_version)
             {
               int lowerkey;
 

Modified: trunk/info/m-x.c
===================================================================
--- trunk/info/m-x.c    2014-09-22 16:39:04 UTC (rev 5834)
+++ trunk/info/m-x.c    2014-09-24 12:01:56 UTC (rev 5835)
@@ -143,8 +143,8 @@
     if (!command)
       return;
 
-    if (InfoFunction(command))
-      (*InfoFunction(command)) (active_window, count, 0);
+    if (command->func)
+      (*command->func) (active_window, count, 0);
     else
       info_error (_("Undefined command: %s"), line);
   }

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-09-22 16:39:04 UTC (rev 5834)
+++ trunk/info/session.c        2014-09-24 12:01:56 UTC (rev 5835)
@@ -4568,10 +4568,11 @@
         {
           /* If this key is not a keymap, get its associated function,
              if any. */
-          type = info_keymap[key].type;
-          func = type == ISFUNC
-            ? InfoFunction(info_keymap[key].function)
-            : NULL;  /* function member is a Keymap if ISKMAP */
+          KEYMAP_ENTRY k = info_keymap[key];
+          type = k.type;
+          func = type == ISFUNC && k.function
+            ? k.function->func
+            : NULL;
         }
 
       if (key == DEL || key == Control ('h'))
@@ -4932,11 +4933,10 @@
       {
         VFunction *func;
 
-        func = InfoFunction(map[key].function);
+        func = map[key].function ? map[key].function->func : 0;
         if (func != NULL)
           {
-            /* Special case info_do_lowercase_version (). */
-            if (func == (VFunction *) info_do_lowercase_version)
+            if (func == info_do_lowercase_version)
               {
                 int lowerkey;
 
@@ -4964,7 +4964,7 @@
             if (info_keyseq_displayed_p)
               display_info_keyseq (0);
 
-            return InfoFunction(map[key].function);
+            return func;
           }
         else
           {
@@ -5060,8 +5060,8 @@
           add_char_to_keyseq (key);
         }
 
-      if (keymap[key].type == ISFUNC
-          && InfoFunction(keymap[key].function) == info_universal_argument)
+      if (keymap[key].type == ISFUNC && keymap[key].function
+          && keymap[key].function->func == info_universal_argument)
         {
           *which_numeric_arg *= 4;
           key = 0;




reply via email to

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