texinfo-commits
[Top][All Lists]
Advanced

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

[5672] infokey program merged into info


From: Gavin D. Smith
Subject: [5672] infokey program merged into info
Date: Thu, 19 Jun 2014 18:52:51 +0000

Revision: 5672
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5672
Author:   gavin
Date:     2014-06-19 18:52:49 +0000 (Thu, 19 Jun 2014)
Log Message:
-----------
infokey program merged into info

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/Makefile.am
    trunk/info/echo-area.c
    trunk/info/footnotes.c
    trunk/info/indices.c
    trunk/info/infodoc.c
    trunk/info/infokey.c
    trunk/info/infokey.h
    trunk/info/infomap.c
    trunk/info/m-x.c
    trunk/info/nodemenu.c
    trunk/info/session.c
    trunk/info/t/Init-test.inc
    trunk/info/variables.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/ChangeLog     2014-06-19 18:52:49 UTC (rev 5672)
@@ -1,5 +1,28 @@
 2014-06-19  Gavin Smith  <address@hidden>
 
+       * info/Makefile.am (bin_PROGRAMS): infokey removed
+       (infokey_LDADD, infokey_SOURCES, nodist_infokey_SOURCES): Removed.
+       (check_DATA): Removed.
+       (ginfo_SOURCES): infokey.c, infokey.h, key.c, key.h added.
+
+       * info/infokey.c (program_name): Declared static to stop name conflict.
+       (main): Disabled.
+       (compile, error_message): No longer declared static.
+       * info/infokey.c, info/infokey.h (struct sect): Definition moved.
+       * info/infokey.h (INFOKEY_FILE): Change to .infokey (_infokey for
+       [__MSDOS__]).
+
+       * info/infomap.c (sections): New variable.
+       (fetch_user_maps): Call compile and set variables based on output.
+
+       * info/echo-area.c, info/footnotes.c, info/indices.c, info/infodoc.c,
+       info/m-x.c, info/nodemenu.c, info/session.c, info/variables.c: Warning
+       about reordering DECLARE_INFO_COMMAND's removed.
+
+       * info/t/Init-test.inc: Use uncompiled infokey file as init file.
+
+2014-06-19  Gavin Smith  <address@hidden>
+
        * info/infodoc.c, info/infomap.c, info/makedoc.c, info/pcterm.c,
        info/session.c, info/terminal.c, info/doc.h, info/info.h: [INFOKEY]:
        Made unconditional.

Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am      2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/Makefile.am      2014-06-19 18:52:49 UTC (rev 5672)
@@ -16,7 +16,7 @@
 # Use `ginfo' for building to avoid confusion with the standard `info'
 # target.  Removes the `g' in the install rule before applying any
 # user-specified name transformations.
-bin_PROGRAMS = ginfo infokey
+bin_PROGRAMS = ginfo
 transform = s/ginfo/info/; $(program_transform_name)
 
 AM_CPPFLAGS =                                   \
@@ -28,21 +28,18 @@
   -DINFODIR2=\"$(datadir)/info\"
 
 LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(TERMLIBS) $(LIBINTL)
-infokey_LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL)
 
 EXTRA_DIST = README pcterm.c
 
 ginfo_SOURCES = dir.c display.c display.h doc.h dribble.c dribble.h \
   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 \
-  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 \
+  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 \
+  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
-infokey_SOURCES = infokey.c infokey.h key.h
-nodist_infokey_SOURCES = key.c funs.h
 
 # The files `doc.c', `key.c' and `funs.h' are created by ./makedoc run over the
 # source files which contain DECLARE_INFO_COMMAND.  `funs.h' is a header file
@@ -82,10 +79,6 @@
 
 # Test suite
 
-check_DATA = t/Info-config
-t/Info-config: t/Infokey-config infokey
-       mkdir -p t && ./infokey --output $@ $<
-
 check_PROGRAMS = pseudotty
 pseudotty_SOURCES = pseudotty.c
 

Modified: trunk/info/echo-area.c
===================================================================
--- trunk/info/echo-area.c      2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/echo-area.c      2014-06-19 18:52:49 UTC (rev 5672)
@@ -21,11 +21,6 @@
 
 #include "info.h"
 
-/* Warning!  Any change to the order of the commands defined with
-   DECLARE_INFO_COMMAND in this file results in an incompatible .info
-   format, and key bindings will be incorrectly assigned until infokey
-   is rerun. */
-
 #if defined (FD_SET)
 #  if defined (hpux)
 #    define fd_set_cast(x) (int *)(x)

Modified: trunk/info/footnotes.c
===================================================================
--- trunk/info/footnotes.c      2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/footnotes.c      2014-06-19 18:52:49 UTC (rev 5672)
@@ -21,11 +21,6 @@
 
 #include "info.h"
 
-/* Warning!  Any change to the order of the commands defined with
-   DECLARE_INFO_COMMAND in this file results in an incompatible .info
-   format, and key bindings will be incorrectly assigned until infokey
-   is rerun. */
-
 /* Nonzero means attempt to show footnotes when displaying a new window. */
 int auto_footnotes_p = 0;
 

Modified: trunk/info/indices.c
===================================================================
--- trunk/info/indices.c        2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/indices.c        2014-06-19 18:52:49 UTC (rev 5672)
@@ -23,11 +23,6 @@
 #include "indices.h"
 #include "variables.h"
 
-/* Warning!  Any change to the order of the commands defined with
-   DECLARE_INFO_COMMAND in this file results in an incompatible .info
-   format, and key bindings will be incorrectly assigned until infokey
-   is rerun. */
-
 /* User-visible variable controls the output of info-index-next. */
 int show_index_match = 1;
 

Modified: trunk/info/infodoc.c
===================================================================
--- trunk/info/infodoc.c        2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/infodoc.c        2014-06-19 18:52:49 UTC (rev 5672)
@@ -22,11 +22,6 @@
 #include "info.h"
 #include "funs.h"
 
-/* Warning!  Any change to the order of the commands defined with
-   DECLARE_INFO_COMMAND in this file results in an incompatible .info
-   format, and key bindings will be incorrectly assigned until infokey
-   is rerun. */
-
 /* HELP_NODE_GETS_REGENERATED is always defined now that keys may get
    rebound, or other changes in the help text may occur.  */
 #define HELP_NODE_GETS_REGENERATED 1

Modified: trunk/info/infokey.c
===================================================================
--- trunk/info/infokey.c        2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/infokey.c        2014-06-19 18:52:49 UTC (rev 5672)
@@ -25,7 +25,7 @@
 #include "key.h"
 #include "getopt.h"
 
-char *program_name = "infokey";
+static char *program_name = "infokey";
 
 /* Non-zero means print version info only. */
 static int print_version_p = 0;
@@ -62,19 +62,14 @@
     ea = 1,
     var = 2
   };
-struct sect
-  {
-    unsigned int cur;
-    unsigned char data[INFOKEY_MAX_SECTIONLEN];
-  };
 
 /* Some "forward" declarations. */
 static char *mkpath (const char *dir, const char *file);
-static int compile (FILE *fp, const char *filename, struct sect *sections);
+int compile (FILE *fp, const char *filename, struct sect *sections);
 static int write_infokey_file (FILE *fp, struct sect *sections);
 static void syntax_error (const char *filename, unsigned int linenum,
                          const char *fmt, ...) TEXINFO_PRINTFLIKE(3,4);
-static void error_message (int error_code, const char *fmt, ...)
+void error_message (int error_code, const char *fmt, ...)
   TEXINFO_PRINTFLIKE(2,3);
 static void suggest_help (void);
 static void short_help (void);
@@ -86,6 +81,9 @@
 /*                                                                  */
 /* **************************************************************** */
 
+/* Disabled - this file is being linked into the main "info" program. */
+#if 0
+
 int
 main (int argc, char **argv)
 {
@@ -244,6 +242,7 @@
 
   return 0;
 }
+#endif
 
 static char *
 mkpath (const char *dir, const char *file)
@@ -379,7 +378,7 @@
 /* Compile the input file into its various sections.  Return true if no
    error was encountered.
  */
-static int
+int
 compile (FILE *fp, const char *filename, struct sect *sections)
 {
   int error = 0;
@@ -854,7 +853,7 @@
 /* Give the user a "syntax error" message in the form
        progname: "filename", line N: message
  */
-static void
+void
 error_message (int error_code, const char *fmt, ...)
 {
   va_list ap;

Modified: trunk/info/infokey.h
===================================================================
--- trunk/info/infokey.h        2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/infokey.h        2014-06-19 18:52:49 UTC (rev 5672)
@@ -37,12 +37,12 @@
 #define INFOKEY_SRCFILE                ".infokey"
 #endif
 
-/* Default "infokey file", where compiled user defs are kept and
-   read by Info.  MS-DOS doesn't allow leading dots in file names.  */
+/* Default "infokey file", where user defs are kept and read by
+   Info.  MS-DOS doesn't allow leading dots in file names.  */
 #ifdef __MSDOS__
-#define INFOKEY_FILE           "_info"
+#define INFOKEY_FILE           "_infokey"
 #else
-#define INFOKEY_FILE           ".info"
+#define INFOKEY_FILE           ".infokey"
 #endif
 
 /*
@@ -126,3 +126,11 @@
 #define SK_CTL_DELETE          13
 #define SK_BACK_TAB            14
 #define SK_LITERAL             40
+
+/* Data for a section of a compiled .info file. */
+struct sect
+  {
+    unsigned int cur;
+    unsigned char data[INFOKEY_MAX_SECTIONLEN];
+  };
+

Modified: trunk/info/infomap.c
===================================================================
--- trunk/info/infomap.c        2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/infomap.c        2014-06-19 18:52:49 UTC (rev 5672)
@@ -831,6 +831,9 @@
 };
 
 
+/* Used to hold output data from compile(). */
+struct sect sections[3];
+
 static unsigned char *user_info_keys;
 static unsigned int user_info_keys_len;
 static unsigned char *user_ea_keys;
@@ -869,7 +872,6 @@
   return n;
 }
 
-
 /* Fetch the contents of the init file at INIT_FILE, or the standard
    infokey file "$HOME/.info".  Return non-zero on success. */
 static int
@@ -877,13 +879,16 @@
 {
   char *filename = NULL;
   char *homedir;
-  int f;
+  FILE *inf;
   unsigned char *buf;
   unsigned long len;
   long nread;
   unsigned char *p;
   int n;
-  
+
+  /* In infokey.c */
+  int compile (FILE *fp, const char *filename, struct sect *sections);
+
   /* Find and open file. */
   if (init_file)
     filename = xstrdup (init_file);
@@ -899,17 +904,33 @@
   else
     filename = xstrdup (INFOKEY_FILE); /* try current directory */
 #endif
-  if (filename == NULL || (f = open (filename, O_RDONLY)) == -1)
+  inf = fopen (filename, "r");
+  if (!inf)
     {
-      if (filename && errno != ENOENT)
-       {
-         info_error ("%s", filesys_error_string (filename, errno));
-         free (filename);
-       }
+      error_message (errno, _("cannot open input file `%s'"), filename);
       return 0;
     }
-  SET_BINARY (f);
 
+  compile (inf, filename, sections);
+  user_info_keys = sections[0].data;
+  user_info_keys_len = sections[0].cur;
+  user_ea_keys = sections[1].data;
+  user_ea_keys_len = sections[1].cur;
+  user_vars = sections[2].data;
+  user_vars_len = sections[2].cur;
+
+  /* This is done in read_init_file. */
+#if 0
+
+  /* Set Info variables from init file. */
+  if (user_vars_len)
+    section_to_vars (user_vars, user_vars_len);
+#endif
+
+
+  /* Disable - we do not read the .info binary file any more, but .infokey
+     directly. */
+#if 0
   /* Ensure that the file is a reasonable size. */
   len = filesize (f);
   if (len < INFOKEY_NMAGIC + 2 || len > 100 * 1024)
@@ -1005,6 +1026,7 @@
          return 0;
        }
     }
+#endif
   
   free (filename);
   return 1;

Modified: trunk/info/m-x.c
===================================================================
--- trunk/info/m-x.c    2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/m-x.c    2014-06-19 18:52:49 UTC (rev 5672)
@@ -22,11 +22,6 @@
 #include "info.h"
 #include "funs.h"
 
-/* Warning!  Any change to the order of the commands defined with
-   DECLARE_INFO_COMMAND in this file results in an incompatible .info
-   format, and key bindings will be incorrectly assigned until infokey
-   is rerun. */
-
 /* **************************************************************** */
 /*                                                                  */
 /*                     Reading Named Commands                       */

Modified: trunk/info/nodemenu.c
===================================================================
--- trunk/info/nodemenu.c       2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/nodemenu.c       2014-06-19 18:52:49 UTC (rev 5672)
@@ -22,11 +22,6 @@
 #include "info.h"
 #include "variables.h"
 
-/* Warning!  Any change to the order of the commands defined with
-   DECLARE_INFO_COMMAND in this file results in an incompatible .info
-   format, and key bindings will be incorrectly assigned until infokey
-   is rerun. */
-
 static NODE *get_visited_nodes (void);
 
 /* Return a line describing the format of a node information line. */

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/session.c        2014-06-19 18:52:49 UTC (rev 5672)
@@ -46,11 +46,6 @@
 static REFERENCE *select_menu_digit (WINDOW *window, unsigned char key);
 static void gc_file_buffers_and_nodes (void);
 
-/* Warning!  Any change to the order of the commands defined with
-   DECLARE_INFO_COMMAND in this file results in an incompatible .info
-   format, and key bindings will be incorrectly assigned until infokey
-   is rerun. */
-
 /* **************************************************************** */
 /*                                                                  */
 /*                   Running an Info Session                        */

Modified: trunk/info/t/Init-test.inc
===================================================================
--- trunk/info/t/Init-test.inc  2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/t/Init-test.inc  2014-06-19 18:52:49 UTC (rev 5672)
@@ -4,7 +4,7 @@
 # Allow running with "make check" and individual tests at the command-line
 srcdir=${srcdir:-.}
 
-GINFO="./ginfo --init-file $srcdir/t/Info-config"
+GINFO="./ginfo --init-file $srcdir/t/Infokey-config"
 
 # Only look for Info files in our test directory
 export infodir=$srcdir/t/infodir

Modified: trunk/info/variables.c
===================================================================
--- trunk/info/variables.c      2014-06-19 16:18:37 UTC (rev 5671)
+++ trunk/info/variables.c      2014-06-19 18:52:49 UTC (rev 5672)
@@ -22,11 +22,6 @@
 #include "info.h"
 #include "variables.h"
 
-/* Warning!  Any change to the order of the commands defined with
-   DECLARE_INFO_COMMAND in this file results in an incompatible .info
-   format, and key bindings will be incorrectly assigned until infokey
-   is rerun. */
-
 /* **************************************************************** */
 /*                                                                  */
 /*                  User Visible Variables in Info                  */




reply via email to

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