texinfo-commits
[Top][All Lists]
Advanced

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

[5674] use function_doc_array instead of function_key_array


From: Gavin D. Smith
Subject: [5674] use function_doc_array instead of function_key_array
Date: Thu, 19 Jun 2014 20:05:37 +0000

Revision: 5674
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5674
Author:   gavin
Date:     2014-06-19 20:05:33 +0000 (Thu, 19 Jun 2014)
Log Message:
-----------
use function_doc_array instead of function_key_array

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/Makefile.am
    trunk/info/infokey.c
    trunk/info/makedoc.c

Removed Paths:
-------------
    trunk/info/key.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-06-19 19:17:54 UTC (rev 5673)
+++ trunk/ChangeLog     2014-06-19 20:05:33 UTC (rev 5674)
@@ -1,5 +1,14 @@
 2014-06-19  Gavin Smith  <address@hidden>
 
+       * info/infokey.c (lookup_action): Use function_doc_array instead of
+       function_key_array.
+       * info/makeinfo.c (process_one_file): Argument removed.
+       (main, process_one_file): Don't create key.c.
+       (key_filename, key_header, key_header_1): Remove unused.
+       * info/key.h: File deleted.
+
+2014-06-19  Gavin Smith  <address@hidden>
+
        * info/infokey.c (program_name, print_version_p, print_help_p)
        (input_filename, output_filename, long_options, mkpath)
        (write_infokey_file, suggest_help, short_help, main): Remove unused.
@@ -10,9 +19,9 @@
        * info/infokey.h (INFOKEY_SRCFILE)
        (INFOKEY_NMAGIC, INFOKEY_MAGIC_SO, INFOKEY_MAGIC_S1)
        (INFOKEY_MAGIC_S2, INFOKEY_MAGIC_S3, INFOKEY_SECTION_INFO)
-       (INFOKEY_SECTION_EAe INFOKEY_SECTION_VAR, INFOKEY_MAGIC_EO)
+       (INFOKEY_SECTION_EA, INFOKEY_SECTION_VAR, INFOKEY_MAGIC_EO)
        (INFOKEY_MAGIC_E1, INFOKEY_MAGIC_E2, INFOKEY_MAGIC_E3)
-       (INFOKEY_MAX_DEFLEN) : Remove unused.
+       (INFOKEY_MAX_DEFLEN): Remove unused.
 
 2014-06-19  Gavin Smith  <address@hidden>
 

Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am      2014-06-19 19:17:54 UTC (rev 5673)
+++ trunk/info/Makefile.am      2014-06-19 20:05:33 UTC (rev 5674)
@@ -35,25 +35,24 @@
   echo-area.c echo-area.h \
   filesys.c filesys.h footnotes.c footnotes.h indices.c indices.h \
   info-utils.c info-utils.h info.c info.h infodoc.c infokey.c infokey.h \
-  infomap.c infomap.h infopath.c key.c key.h m-x.c man.c man.h nodemenu.c \
+  infomap.c infomap.h infopath.c m-x.c man.c man.h nodemenu.c \
   nodes.c nodes.h search.c search.h session.c session.h signals.c signals.h \
   tag.c tag.h termdep.h terminal.c terminal.h tilde.c tilde.h \
   variables.c variables.h window.c window.h
 nodist_ginfo_SOURCES = doc.c funs.h
 
-# The files `doc.c', `key.c' and `funs.h' are created by ./makedoc run over the
+# The files `doc.c' and `funs.h' are created by ./makedoc run over the
 # source files which contain DECLARE_INFO_COMMAND.  `funs.h' is a header file
 # listing the functions found.  `doc.c' is a structure containing pointers
 # to those functions along with completable names and documentation strings.
 #
-generated_sources = doc.c key.c funs.h
+generated_sources = doc.c funs.h
 
 # We need a linear ordering to prevent race condition in parallel make.
 # See the node ``(automake)Multiple Outputs'' for an explanation.
 # Make sure this matches with order in which makedoc.c creates these
 # files.
-doc.c: key.c
-key.c: funs.h
+doc.c: funs.h
 
 # These files are not distributed.
 DISTCLEANFILES = $(generated_sources)

Modified: trunk/info/infokey.c
===================================================================
--- trunk/info/infokey.c        2014-06-19 19:17:54 UTC (rev 5673)
+++ trunk/info/infokey.c        2014-06-19 20:05:33 UTC (rev 5674)
@@ -22,7 +22,7 @@
 #include "info.h"
 #include "infomap.h"
 #include "infokey.h"
-#include "key.h"
+#include "doc.h"
 #include "getopt.h"
 
 extern char *program_name;  /* in info.c */
@@ -563,19 +563,18 @@
   return 1;
 }
 
-/* Translate from an action name to its numeric code.  This uses the
-   auto-generated array in key.c.
- */
+/* Return the numeric code of an Info command given its name.  If not found,
+   return -1.  This uses the auto-generated array in doc.c. */
 static int
-lookup_action (const char *actname)
+lookup_action (const char *name)
 {
   int i;
 
-  if (strcmp ("invalid", actname) == 0)
+  if (!strcmp (name, "invalid"))
     return A_INVALID;
-  for (i = 0; function_key_array[i].name != NULL; i++)
-    if (strcmp (function_key_array[i].name, actname) == 0)
-      return function_key_array[i].code;
+  for (i = 0; function_doc_array[i].func_name; i++)
+    if (!strcmp (function_doc_array[i].func_name, name))
+      return i;
   return -1;
 }
 

Deleted: trunk/info/key.h
===================================================================
--- trunk/info/key.h    2014-06-19 19:17:54 UTC (rev 5673)
+++ trunk/info/key.h    2014-06-19 20:05:33 UTC (rev 5674)
@@ -1,32 +0,0 @@
-/* key.h -- Structure associating function names with numeric codes.
-   $Id$
-
-   Copyright 1993, 2007, 2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-   Originally written by Andrew Bettison. */
-
-#if !defined (KEY_H)
-#define KEY_H
-
-typedef struct {
-       char *name;
-       unsigned char   code;
-}
-       FUNCTION_KEY;
-
-extern FUNCTION_KEY function_key_array[];
-
-#endif /* !KEY_H */

Modified: trunk/info/makedoc.c
===================================================================
--- trunk/info/makedoc.c        2014-06-19 19:17:54 UTC (rev 5673)
+++ trunk/info/makedoc.c        2014-06-19 20:05:33 UTC (rev 5674)
@@ -36,7 +36,6 @@
 
 /* Name of the documentation to function pointer file. */
 static char *doc_filename = "doc.c";
-static char *key_filename = "key.c";
 
 static char *doc_header[] = {
   "/* doc.c -- Generated structure containing function names and doc strings.",
@@ -61,28 +60,6 @@
   NULL
 };
 
-static char *key_header[] = {
-  "/* key.c -- Generated array containing function names.",
-  "",
-  "   This file was automatically made from various source files with the",
-  "   command \"%s\".  DO NOT EDIT THIS FILE, only \"%s.c\".",
-  "",
-  NULL
-};
-
-static char *key_header_1[] = {
-  "   An entry in the array FUNCTION_KEY_ARRAY is made for each command",
-  "   found in the above files; each entry consists of",
-  "   a string which is the user-visible name of the function.  */",
-  "",
-  "#include \"key.h\"",
-  "#include \"funs.h\"",
-  "",
-  "FUNCTION_KEY function_key_array[] = {",
-  "",
-  NULL
-};
-
 /* How to remember the locations of the functions found so that Emacs
    can use the information in a tag table. */
 typedef struct {
@@ -106,7 +83,7 @@
 #define DECLARATION_STRING "\nDECLARE_INFO_COMMAND"
 
 static void process_one_file (char *filename, FILE *doc_stream,
-    FILE *key_stream, FILE *funs_stream);
+                              FILE *funs_stream);
 static void maybe_dump_tags (FILE *stream);
 static FILE *must_fopen (char *filename, char *mode);
 static void init_func_key (unsigned int val);
@@ -118,7 +95,6 @@
   register int i;
   int tags_only = 0;
   FILE *funs_stream, *doc_stream;
-  FILE *key_stream;
 
 #if STRIP_DOT_EXE
   {
@@ -140,14 +116,12 @@
     {
       funs_filename = NULL_DEVICE;
       doc_filename = NULL_DEVICE;
-      key_filename = NULL_DEVICE;
     }
 
   /* The order of these calls depends exactly on the order in the
      Makefile.{in,am}, or they might fail on filesystems with
      high-precision times; see also the fclose calls below.  */
   funs_stream = must_fopen (funs_filename, "w");
-  key_stream = must_fopen (key_filename, "w");
   doc_stream = must_fopen (doc_filename, "w");
 
   fprintf (funs_stream,
@@ -164,28 +138,13 @@
   fprintf (doc_stream,
            _("   Source files groveled to make this file include:\n\n"));
 
-  for (i = 0; key_header[i]; i++)
-    {
-      fprintf (key_stream, key_header[i], argv[0], argv[0]);
-      fprintf (key_stream, "\n");
-    }
-  fprintf (key_stream,
-           _("   Source files groveled to make this file include:\n\n"));
-
   for (i = 1; i < argc; i++)
-    {
-      fprintf (doc_stream, "\t%s\n", argv[i]);
-      fprintf (key_stream, "\t%s\n", argv[i]);
-    }
+    fprintf (doc_stream, "\t%s\n", argv[i]);
 
   fprintf (doc_stream, "\n");
   for (i = 0; doc_header_1[i]; i++)
     fprintf (doc_stream, "%s\n", doc_header_1[i]);
 
-  fprintf (key_stream, "\n");
-  for (i = 0; key_header_1[i]; i++)
-    fprintf (key_stream, "%s\n", key_header_1[i]);
-
   init_func_key(0);
 
   for (i = 1; i < argc; i++)
@@ -197,21 +156,18 @@
         continue;
 
       fprintf (doc_stream, "/* Commands found in \"%s\". */\n", curfile);
-      fprintf (key_stream, "/* Commands found in \"%s\". */\n", curfile);
       fprintf (funs_stream, "\n/* Functions declared in \"%s\". */\n",
                curfile);
 
-      process_one_file (curfile, doc_stream, key_stream, funs_stream);
+      process_one_file (curfile, doc_stream, funs_stream);
     }
 
   fprintf (doc_stream, "   { NULL, NULL, NULL, NULL }\n};\n");
-  fprintf (key_stream, "   { NULL, 0 }\n};\n");
   fprintf (funs_stream, "\n#define A_NCOMMANDS %u\n", next_func_key());
 
   /* The order of these calls also depends exactly on the order in the
    * Makefile.{in,am}; see the must_fopen calls above.  */
   fclose (funs_stream);
-  fclose (key_stream);
   fclose (doc_stream);
 
   if (tags_only)
@@ -298,10 +254,9 @@
 
 /* Read the file represented by FILENAME into core, and search it for Info
    function declarations.  Output the declarations in various forms to the
-   DOC_STREAM, KEY_STREAM, and FUNS_STREAM. */
+   DOC_STREAM and FUNS_STREAM. */
 static void
-process_one_file (char *filename, FILE *doc_stream,
-    FILE *key_stream, FILE *funs_stream)
+process_one_file (char *filename, FILE *doc_stream, FILE *funs_stream)
 {
   int descriptor, decl_len;
   char *buffer, *decl_str;
@@ -480,8 +435,6 @@
           "   { (VFunction *)%s, \"%s\", (FUNCTION_KEYSEQ *)0, %s },\n",
           func, func_name, doc);
 
-      fprintf (key_stream, "   { \"%s\", A_%s },\n", func_name, func);
-
       free (func_name);
 
       fprintf (funs_stream, "#define A_%s %u\n", func, next_func_key());
@@ -537,3 +490,5 @@
 {
        return func_key++;
 }
+
+




reply via email to

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