texinfo-commits
[Top][All Lists]
Advanced

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

texinfo ChangeLog info/footnotes.c info/indices...


From: Sergey Poznyakoff
Subject: texinfo ChangeLog info/footnotes.c info/indices...
Date: Thu, 12 Apr 2012 10:38:30 +0000

CVSROOT:        /cvsroot/texinfo
Module name:    texinfo
Changes by:     Sergey Poznyakoff <gray>        12/04/12 10:38:30

Modified files:
        .              : ChangeLog 
        info           : footnotes.c indices.c info-utils.c info-utils.h 
                         info.c infodoc.c man.c nodes.c nodes.h search.c 
                         search.h session.c 

Log message:
        Improve parsing of node names containing dots.
        
        Node names containing dots are followed correctly, if they appear in
        menus or in single-argument xrefs (which produce references followed
        by double-column).
        
        * info-utils.h (PARSE_NODE_DFLT, PARSE_NODE_SKIP_NEWLINES)
        (PARSE_NODE_VERBATIM, PARSE_NODE_START): New constants.
        * info/info-utils.c (info_parse_node): Change the meaning of the second
        argument.  All uses updated.
        (save_string, saven_string): Allow for string_size_p==NULL.
        * info/nodes.c (info_get_node): Take three arguments, the last
        one instructing how to parse the node name.
        All uses updated.
        * info/nodes.h (info_get_node): Change signature.
        * info/search.c (skip_node_characters): Second argument controls
        what characters can end the node name.
        All uses updated.
        * info/search.h (DONT_SKIP_NEWLINES,SKIP_NEWLINES): Removed.
        All uses changed.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/ChangeLog?cvsroot=texinfo&r1=1.1344&r2=1.1345
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/footnotes.c?cvsroot=texinfo&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/indices.c?cvsroot=texinfo&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/info-utils.c?cvsroot=texinfo&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/info-utils.h?cvsroot=texinfo&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/info.c?cvsroot=texinfo&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/infodoc.c?cvsroot=texinfo&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/man.c?cvsroot=texinfo&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/nodes.c?cvsroot=texinfo&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/nodes.h?cvsroot=texinfo&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/search.c?cvsroot=texinfo&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/search.h?cvsroot=texinfo&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/session.c?cvsroot=texinfo&r1=1.53&r2=1.54

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/texinfo/texinfo/ChangeLog,v
retrieving revision 1.1344
retrieving revision 1.1345
diff -u -b -r1.1344 -r1.1345
--- ChangeLog   10 Apr 2012 18:08:18 -0000      1.1344
+++ ChangeLog   12 Apr 2012 10:38:28 -0000      1.1345
@@ -1,3 +1,26 @@
+2012-04-12  Sergey Poznyakoff  <address@hidden>
+
+       info: improve parsing of node names containing dots.
+
+       References to node names containing dots are followed correctly,
+       if they appear in menus or in single-argument xrefs (which produce
+       references followed by double-column).
+
+       * info-utils.h (PARSE_NODE_DFLT, PARSE_NODE_SKIP_NEWLINES)
+       (PARSE_NODE_VERBATIM, PARSE_NODE_START): New constants.
+       * info/info-utils.c (info_parse_node): Change the meaning of the
+       second argument.  All uses updated.
+       (save_string, saven_string): Allow for string_size_p==NULL.
+       * info/nodes.c (info_get_node): Take three arguments, the last
+       one instructing how to parse the node name.
+       All uses updated.
+       * info/nodes.h (info_get_node): Change signature.
+       * info/search.c (skip_node_characters): Second argument controls
+       what characters can end the node name.
+       All uses updated.
+       * info/search.h (DONT_SKIP_NEWLINES,SKIP_NEWLINES): Removed.
+       All uses changed.
+
 2012-04-10  Karl Berry  <address@hidden>
 
        * doc/texinfo.txi (History): amend texi2any description per Patrice.

Index: info/footnotes.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/footnotes.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- info/footnotes.c    14 Jan 2012 17:58:32 -0000      1.12
+++ info/footnotes.c    12 Apr 2012 10:38:28 -0000      1.13
@@ -1,5 +1,5 @@
 /* footnotes.c -- Some functions for manipulating footnotes.
-   $Id: footnotes.c,v 1.12 2012/01/14 17:58:32 gray Exp $
+   $Id: footnotes.c,v 1.13 2012/04/12 10:38:28 gray Exp $
 
    Copyright (C) 1993, 1997, 1998, 1999, 2002, 2004, 2007, 2008, 2011
    Free Software Foundation, Inc.
@@ -95,7 +95,7 @@
                 if (!filename)
                   filename = node->filename;
 
-                fn_node = info_get_node (filename, refname);
+                fn_node = info_get_node (filename, refname, PARSE_NODE_DFLT);
 
                 if (fn_node)
                   fn_start = 0;

Index: info/indices.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/indices.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- info/indices.c      14 Jan 2012 17:58:32 -0000      1.19
+++ info/indices.c      12 Apr 2012 10:38:28 -0000      1.20
@@ -1,5 +1,5 @@
 /* indices.c -- deal with an Info file index.
-   $Id: indices.c,v 1.19 2012/01/14 17:58:32 gray Exp $
+   $Id: indices.c,v 1.20 2012/04/12 10:38:28 gray Exp $
 
    Copyright (C) 1993, 1997, 1998, 1999, 2002, 2003, 2004, 2007, 2008, 2011
    Free Software Foundation, Inc.
@@ -138,7 +138,8 @@
               REFERENCE **menu;
 
               /* Found one.  Get its menu. */
-              node = info_get_node (tag->filename, tag->nodename);
+              node = info_get_node (tag->filename, tag->nodename, 
+                                    PARSE_NODE_VERBATIM);
               if (!node)
                 continue;
 
@@ -237,7 +238,8 @@
               NODE *node;
 
               node = info_get_node (initial_index_filename,
-                                    initial_index_nodename);
+                                    initial_index_nodename,
+                                    PARSE_NODE_DFLT);
               set_remembered_pagetop_and_point (window);
               window_set_node_of_window (window, node);
               remember_window_and_node (window, node);
@@ -486,7 +488,8 @@
   }
 
   /* Select the node corresponding to this index entry. */
-  node = info_get_node (index_index[i]->filename, index_index[i]->nodename);
+  node = info_get_node (index_index[i]->filename, index_index[i]->nodename,
+                        PARSE_NODE_DFLT);
 
   if (!node)
     {
@@ -537,7 +540,7 @@
   REFERENCE **dir_menu = NULL;
   NODE *dir_node;
 
-  dir_node = info_get_node ("dir", "Top");
+  dir_node = info_get_node ("dir", "Top", PARSE_NODE_DFLT);
   if (dir_node)
     dir_menu = info_menu_of_node (dir_node);
 
@@ -567,11 +570,12 @@
 
       /* Find this node.  If we cannot find it, try using the label of the
          entry as a file (i.e., "(LABEL)Top"). */
-      this_node = info_get_node (this_item->filename, this_item->nodename);
+      this_node = info_get_node (this_item->filename, this_item->nodename,
+                                 PARSE_NODE_VERBATIM);
 
       if (!this_node && this_item->nodename &&
           (strcmp (this_item->label, this_item->nodename) == 0))
-        this_node = info_get_node (this_item->label, "Top");
+        this_node = info_get_node (this_item->label, "Top", PARSE_NODE_DFLT);
 
       if (!this_node)
        {

Index: info/info-utils.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/info-utils.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- info/info-utils.c   17 Nov 2011 10:04:59 -0000      1.17
+++ info/info-utils.c   12 Apr 2012 10:38:28 -0000      1.18
@@ -1,5 +1,5 @@
 /* info-utils.c -- miscellanous.
-   $Id: info-utils.c,v 1.17 2011/11/17 10:04:59 gray Exp $
+   $Id: info-utils.c,v 1.18 2012/04/12 10:38:28 gray Exp $
 
    Copyright (C) 1993, 1998, 2003, 2004, 2007, 2008, 2009, 2011
    Free Software Foundation, Inc.
@@ -41,6 +41,9 @@
    calling info_parse_xxx (). */
 int info_parsed_line_number = 0;
 
+static void save_string (char *string, char **string_p, int *string_size_p);
+static void saven_string (char *string, int len, char **string_p,
+    int *string_size_p);
 /* Functions to remember a filename or nodename for later return. */
 static void save_filename (char *filename);
 static void saven_filename (char *filename, int len);
@@ -53,11 +56,16 @@
 
 /* Parse the filename and nodename out of STRING.  If STRING doesn't
    contain a filename (i.e., it is NOT (FILENAME)NODENAME) then set
-   INFO_PARSED_FILENAME to NULL.  If second argument NEWLINES_OKAY is
-   non-zero, it says to allow the nodename specification to cross a
-   newline boundary (i.e., only `,', `.', or `TAB' can end the spec). */
+   INFO_PARSED_FILENAME to NULL.  The second argument is one of
+   the PARSE_NODE_* constants.  It specifies how to parse the node name:
+
+   PARSE_NODE_DFLT             Node name stops at LF, `,', `.', or `TAB'
+   PARSE_NODE_SKIP_NEWLINES    Node name stops at `,', `.', or `TAB'
+   PARSE_NODE_VERBATIM         Don't parse nodename
+*/ 
+   
 void
-info_parse_node (char *string, int newlines_okay)
+info_parse_node (char *string, int flag)
 {
   register int i = 0;
 
@@ -113,7 +121,7 @@
     }
 
   /* Parse out nodename. */
-  i = skip_node_characters (string, newlines_okay);
+  i = skip_node_characters (string, flag);
   saven_nodename (string, i);
   canonicalize_whitespace (info_parsed_nodename);
   if (info_parsed_nodename && !*info_parsed_nodename)
@@ -177,7 +185,7 @@
 
   nodeline += i;
   nodeline += skip_whitespace (nodeline);
-  info_parse_node (nodeline, DONT_SKIP_NEWLINES);
+  info_parse_node (nodeline, PARSE_NODE_DFLT);
 }
 
 /* **************************************************************** */
@@ -329,9 +337,9 @@
           refdef += skip_whitespace_and_newlines (refdef);
 
           if (searching_for_menu_items)
-            info_parse_node (refdef, DONT_SKIP_NEWLINES);
+            info_parse_node (refdef, PARSE_NODE_DFLT);
           else
-            info_parse_node (refdef, SKIP_NEWLINES);
+            info_parse_node (refdef, PARSE_NODE_SKIP_NEWLINES);
 
           if (info_parsed_filename)
             entry->filename = xstrdup (info_parsed_filename);
@@ -594,10 +602,6 @@
 /* Amount of space allocated to INFO_PARSED_NODENAME via xmalloc (). */
 static int parsed_nodename_size = 0;
 
-static void save_string (char *string, char **string_p, int *string_size_p);
-static void saven_string (char *string, int len, char **string_p,
-    int *string_size_p);
-
 /* Remember FILENAME in PARSED_FILENAME.  An empty FILENAME is translated
    to a NULL pointer in PARSED_FILENAME. */
 static void
@@ -644,14 +648,19 @@
       *string_p = NULL;
       *string_size_p = 0;
     }
-  else
+  else if (string_size_p)
     {
       if (strlen (string) >= (unsigned int) *string_size_p)
-        *string_p = xrealloc
-          (*string_p, (*string_size_p = 1 + strlen (string)));
+        *string_p = xrealloc (*string_p,
+                             (*string_size_p = 1 + strlen (string)));
 
       strcpy (*string_p, string);
     }
+  else
+    {
+      free (*string_p);
+      *string_p = xstrdup (string);
+    }
 }
 
 /* Just like save_string (), but you also pass the length of STRING. */
@@ -668,9 +677,16 @@
     }
   else
     {
+      if (string_size_p)
+       {
       if (len >= *string_size_p)
         *string_p = xrealloc (*string_p, (*string_size_p = 1 + len));
-
+       }
+      else
+       {
+         free (*string_p);
+         *string_p = xmalloc (1 + len);
+       }
       strncpy (*string_p, string, len);
       (*string_p)[len] = '\0';
     }

Index: info/info-utils.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/info-utils.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- info/info-utils.h   17 Nov 2011 10:04:59 -0000      1.11
+++ info/info-utils.h   12 Apr 2012 10:38:29 -0000      1.12
@@ -1,5 +1,5 @@
 /* info-utils.h -- Exported functions and variables from info-utils.c.
-   $Id: info-utils.h,v 1.11 2011/11/17 10:04:59 gray Exp $   
+   $Id: info-utils.h,v 1.12 2012/04/12 10:38:29 gray Exp $   
 
    Copyright (C) 1993, 1996, 1998, 2002, 2003, 2004, 2007, 2011
    Free Software Foundation, Inc.
@@ -49,12 +49,23 @@
    calling info_parse_xxx (). */
 extern char *info_parsed_nodename;
 
+#define PARSE_NODE_DFLT          0
+#define PARSE_NODE_SKIP_NEWLINES 1
+#define PARSE_NODE_VERBATIM      2
+#define PARSE_NODE_START         3
+
 /* Parse the filename and nodename out of STRING.  If STRING doesn't
    contain a filename (i.e., it is NOT (FILENAME)NODENAME) then set
-   INFO_PARSED_FILENAME to NULL.  If second argument NEWLINES_OKAY is
-   non-zero, it says to allow the nodename specification to cross a
-   newline boundary (i.e., only `,', `.', or `TAB' can end the spec). */
-void info_parse_node (char *string, int newlines_okay);
+   INFO_PARSED_FILENAME to NULL.  The second argument is one of
+   the PARSE_NODE_* constants.  It specifies how to parse the node name:
+   
+   PARSE_NODE_DFLT             Node name stops at LF, `,', `.', or `TAB'
+   PARSE_NODE_SKIP_NEWLINES    Node name stops at `,', `.', or `TAB'
+   PARSE_NODE_VERBATIM         Don't parse nodename
+   PARSE_NODE_START            The STRING argument is retrieved from a node
+                               start line, and therefore ends in `,' only.
+*/ 
+void info_parse_node (char *string, int flag);
 
 /* Return a NULL terminated array of REFERENCE * which represents the menu
    found in NODE.  If there is no menu in NODE, just return a NULL pointer. */

Index: info/info.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/info.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- info/info.c 1 Jan 2012 17:09:11 -0000       1.39
+++ info/info.c 12 Apr 2012 10:38:29 -0000      1.40
@@ -1,5 +1,5 @@
 /* info.c -- Display nodes of Info files in multiple windows.
-   $Id: info.c,v 1.39 2012/01/01 17:09:11 karl Exp $
+   $Id: info.c,v 1.40 2012/04/12 10:38:29 gray Exp $
 
    Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
    2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
@@ -364,7 +364,8 @@
   /* Get the initial Info node.  It is either "(dir)Top", or what the user
      specifed with values in user_filename and user_nodenames. */
   initial_node = info_get_node (user_filename,
-                                user_nodenames ? user_nodenames[0] : 0);
+                                user_nodenames ? user_nodenames[0] : 0,
+                                PARSE_NODE_DFLT);
 
   /* If we couldn't get the initial node, this user is in trouble. */
   if (!initial_node)

Index: info/infodoc.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/infodoc.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- info/infodoc.c      27 Dec 2011 19:34:17 -0000      1.30
+++ info/infodoc.c      12 Apr 2012 10:38:29 -0000      1.31
@@ -1,5 +1,5 @@
 /* infodoc.c -- functions which build documentation nodes.
-   $Id: infodoc.c,v 1.30 2011/12/27 19:34:17 karl Exp $
+   $Id: infodoc.c,v 1.31 2012/04/12 10:38:29 gray Exp $
 
    Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
    2007, 2008, 2011
@@ -515,7 +515,7 @@
     nodename = "Help";
 
   /* Try to get the info file for Info. */
-  node = info_get_node ("Info", nodename);
+  node = info_get_node ("Info", nodename, PARSE_NODE_DFLT);
 
   if (!node)
     {

Index: info/man.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/man.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- info/man.c  18 Oct 2011 18:47:21 -0000      1.18
+++ info/man.c  12 Apr 2012 10:38:29 -0000      1.19
@@ -1,5 +1,5 @@
 /*  man.c: How to read and format man files.
-    $Id: man.c,v 1.18 2011/10/18 18:47:21 karl Exp $
+    $Id: man.c,v 1.19 2012/04/12 10:38:29 gray Exp $
 
    Copyright (C) 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 
    2007, 2008, 2009, 2011 Free Software Foundation, Inc.
@@ -60,7 +60,8 @@
 NODE *
 make_manpage_node (char *pagename)
 {
-  return info_get_node (MANPAGE_FILE_BUFFER_NAME, pagename);
+  return info_get_node (MANPAGE_FILE_BUFFER_NAME, pagename,
+                        PARSE_NODE_VERBATIM);
 }
 
 NODE *

Index: info/nodes.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/nodes.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- info/nodes.c        14 Jan 2012 17:58:31 -0000      1.18
+++ info/nodes.c        12 Apr 2012 10:38:29 -0000      1.19
@@ -1,5 +1,5 @@
 /* nodes.c -- how to get an Info file and node.
-   $Id: nodes.c,v 1.18 2012/01/14 17:58:31 gray Exp $
+   $Id: nodes.c,v 1.19 2012/04/12 10:38:29 gray Exp $
 
    Copyright (C) 1993, 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2007,
    2008, 2009, 2011 Free Software Foundation, Inc.
@@ -75,16 +75,19 @@
 
 /* Return a pointer to a NODE structure for the Info node (FILENAME)NODENAME.
    If FILENAME is NULL, `dir' is used.
-   IF NODENAME is NULL, `Top' is used.
+   If NODENAME is NULL, `Top' is used.
+   The FLAG argument (one of the PARSE_NODE_* constants) instructs how to
+   parse NODENAME.
+   
    If the node cannot be found, return NULL. */
 NODE *
-info_get_node (char *filename, char *nodename)
+info_get_node (char *filename, char *nodename, int flag)
 {
   NODE *node;
   FILE_BUFFER *file_buffer = NULL;
 
   info_recent_file_error = NULL;
-  info_parse_node (nodename, DONT_SKIP_NEWLINES);
+  info_parse_node (nodename, flag);
   nodename = NULL;
 
   if (info_parsed_filename)
@@ -555,7 +558,7 @@
 
       /* Find the end of the nodename. */
       end = start +
-        skip_node_characters (nodeline + start, DONT_SKIP_NEWLINES);
+        skip_node_characters (nodeline + start, PARSE_NODE_DFLT);
 
       /* Okay, we have isolated the node name, and we know where the
          node starts.  Remember this information. */
@@ -1254,7 +1257,7 @@
             {
               nodedef += offset;
               nodedef += skip_whitespace (nodedef);
-              offset = skip_node_characters (nodedef, DONT_SKIP_NEWLINES);
+              offset = skip_node_characters (nodedef, PARSE_NODE_START);
               if (((unsigned int) offset == strlen (node->nodename)) &&
                   (strncmp (node->nodename, nodedef, offset) == 0))
                 {

Index: info/nodes.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/nodes.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- info/nodes.h        18 Oct 2011 18:47:21 -0000      1.8
+++ info/nodes.h        12 Apr 2012 10:38:29 -0000      1.9
@@ -1,5 +1,5 @@
 /* nodes.h -- How we represent nodes internally.
-   $Id: nodes.h,v 1.8 2011/10/18 18:47:21 karl Exp $
+   $Id: nodes.h,v 1.9 2012/04/12 10:38:29 gray Exp $
 
    Copyright (C) 1993, 1997, 1998, 2002, 2004, 2007, 2011
    Free Software Foundation, Inc.
@@ -134,8 +134,12 @@
 /* Return a pointer to a NODE structure for the Info node (FILENAME)NODENAME.
    FILENAME can be passed as NULL, in which case the filename of "dir" is used.
    NODENAME can be passed as NULL, in which case the nodename of "Top" is used.
+
+   The FLAG argument (one of the PARSE_NODE_* constants) instructs how to
+   parse NODENAME.
+   
    If the node cannot be found, return a NULL pointer. */
-extern NODE *info_get_node (char *filename, char *nodename);
+extern NODE *info_get_node (char *filename, char *nodename, int flag);
 
 /* Return a pointer to a NODE structure for the Info node NODENAME in
    FILE_BUFFER.  NODENAME can be passed as NULL, in which case the

Index: info/search.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/search.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- info/search.c       18 Oct 2011 18:47:21 -0000      1.13
+++ info/search.c       12 Apr 2012 10:38:29 -0000      1.14
@@ -1,5 +1,5 @@
 /* search.c -- searching large bodies of text.
-   $Id: search.c,v 1.13 2011/10/18 18:47:21 karl Exp $
+   $Id: search.c,v 1.14 2012/04/12 10:38:29 gray Exp $
 
    Copyright (C) 1993, 1997, 1998, 2002, 2004, 2007, 2008, 2009, 2011
    Free Software Foundation, Inc.
@@ -491,35 +491,51 @@
   return i;
 }
 
-/* Return the index of the first non-node character in STRING.  Note that
-   this function contains quite a bit of hair to ignore periods in some
-   special cases.  This is because we here at GNU ship some info files which
-   contain nodenames that contain periods.  No such nodename can start with
-   a period, or continue with whitespace, newline, or ')' immediately following
-   the period.  If second argument NEWLINES_OKAY is non-zero, newlines should
+/* Return the index of the first non-node character in STRING.
+
+   The second argument instructs how to parse the node name:
+
+   PARSE_NODE_DFLT             Node name stops at LF, `,', `.', or `TAB'
+   PARSE_NODE_SKIP_NEWLINES    Node name stops at `,', `.', or `TAB'
+   PARSE_NODE_VERBATIM         Don't parse nodename
+   PARSE_NODE_START            The STRING argument is retrieved from a node
+                               start line, and therefore ends in `,' only.
+   
+   Note that if FLAG is PARSE_NODE_DFLT or PARSE_NODE_SKIP_NEWLINES, this
+   function contains quite a bit of hair to ignore periods in some special
+   cases.  This is because we here at GNU ship some info files which contain
+   nodenames that contain periods.  No such nodename can start with a period,
+   or continue with whitespace, newline, or ')' immediately following the
+   period.  If second argument NEWLINES_OKAY is non-zero, newlines should
    be skipped while parsing out the nodename specification. */
 int
-skip_node_characters (char *string, int newlines_okay)
+skip_node_characters (char *string, int flag)
 {
   register int c, i = 0;
   int paren_seen = 0;
   int paren = 0;
 
+  if (!string)
+    return 0;
+
+  if (flag == PARSE_NODE_VERBATIM)
+    return strlen (string);
+  
   /* Handle special case.  This is when another function has parsed out the
      filename component of the node name, and we just want to parse out the
      nodename proper.  In that case, a period at the start of the nodename
      indicates an empty nodename. */
-  if (string && *string == '.')
+  if (*string == '.')
     return 0;
 
-  if (string && *string == '(')
+  if (*string == '(')
     {
       paren++;
       paren_seen++;
       i++;
     }
 
-  for (; string && (c = string[i]); i++)
+  for (; (c = string[i]); i++)
     {
       if (paren)
         {
@@ -536,9 +552,10 @@
       if (c == '\t' ||
           c == ','  ||
           c == INFO_TAGSEP ||
-          ((!newlines_okay) && (c == '\n')) ||
+          (!(flag == PARSE_NODE_SKIP_NEWLINES) && (c == '\n')) ||
           ((paren_seen && string[i - 1] == ')') &&
            (c == ' ' || c == '.')) ||
+         (flag != PARSE_NODE_START &&
           (c == '.' &&
            (
 #if 0
@@ -548,7 +565,7 @@
            (!string[i + 1]) ||
 #endif
             (whitespace_or_newline (string[i + 1])) ||
-            (string[i + 1] == ')'))))
+          (string[i + 1] == ')')))))
         break;
     }
   return i;
@@ -685,7 +702,7 @@
       tmp_search.start += offset;
       tmp_search.start += skip_whitespace (tmp_search.buffer + 
tmp_search.start);
       offset = skip_node_characters
-        (tmp_search.buffer + tmp_search.start, DONT_SKIP_NEWLINES);
+        (tmp_search.buffer + tmp_search.start, PARSE_NODE_DFLT);
 
       /* Notice that this is an exact match.  You cannot grovel through
          the buffer with this function looking for random nodes. */

Index: info/search.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/search.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- info/search.h       18 Oct 2011 18:47:21 -0000      1.11
+++ info/search.h       12 Apr 2012 10:38:30 -0000      1.12
@@ -1,5 +1,5 @@
 /* search.h -- Structure used to search large bodies of text, with bounds.
-   $Id: search.h,v 1.11 2011/10/18 18:47:21 karl Exp $
+   $Id: search.h,v 1.12 2012/04/12 10:38:30 gray Exp $
 
    Copyright (C) 1993, 1997, 1998, 2002, 2004, 2007, 2009, 2011
    Free Software Foundation, Inc.
@@ -80,9 +80,6 @@
 extern int skip_node_characters (char *string, int newlines_okay);
 extern int skip_node_separator (char *body);
 
-#define DONT_SKIP_NEWLINES 0
-#define SKIP_NEWLINES 1
-
 extern long find_node_separator (SEARCH_BINDING *binding);
 extern long find_tags_table (SEARCH_BINDING *binding);
 extern long find_node_in_binding (char *nodename, SEARCH_BINDING *binding);

Index: info/session.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/session.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- info/session.c      14 Jan 2012 17:58:32 -0000      1.53
+++ info/session.c      12 Apr 2012 10:38:30 -0000      1.54
@@ -1,5 +1,5 @@
 /* session.c -- user windowing interface to Info.
-   $Id: session.c,v 1.53 2012/01/14 17:58:32 gray Exp $
+   $Id: session.c,v 1.54 2012/04/12 10:38:30 gray Exp $
 
    Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
    2004, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
@@ -86,7 +86,7 @@
     {
       NODE *node;
 
-      node = info_get_node (filename, nodenames[i]);
+      node = info_get_node (filename, nodenames[i], PARSE_NODE_DFLT);
 
       if (!node)
         break;
@@ -1830,7 +1830,8 @@
                     else
                       filename = iw->nodes[j]->filename;
 
-                    node = info_get_node (filename, iw->nodes[j]->nodename);
+                    node = info_get_node (filename, iw->nodes[j]->nodename,
+                                          PARSE_NODE_DFLT);
                     if (node)
                       {
                         window_set_node_of_window (split, node);
@@ -2052,7 +2053,7 @@
   else
     nodename = xstrdup ("Top");
 
-  node = info_get_node (filename, nodename);
+  node = info_get_node (filename, nodename, PARSE_NODE_VERBATIM);
 
   /* Try something a little weird.  If the node couldn't be found, and the
      reference was of the form "foo::", see if the entry->label can be found
@@ -2064,7 +2065,7 @@
 
       if (entry->nodename && (strcmp (entry->nodename, entry->label) == 0))
         {
-          node = info_get_node (entry->label, "Top");
+          node = info_get_node (entry->label, "Top", PARSE_NODE_DFLT);
           if (!node && info_recent_file_error)
             {
               maybe_free (file_system_error);
@@ -2097,7 +2098,7 @@
 {
   REFERENCE entry;
 
-  info_parse_node (line, DONT_SKIP_NEWLINES);
+  info_parse_node (line, PARSE_NODE_DFLT);
 
   entry.nodename = info_parsed_nodename;
   entry.filename = info_parsed_filename;
@@ -2135,7 +2136,7 @@
       else
         nodename = xstrdup ("Top");
 
-      node = info_get_node (filename, nodename);
+      node = info_get_node (filename, nodename, PARSE_NODE_DFLT);
 
       if (node)
         {
@@ -2214,7 +2215,8 @@
       if (count > 0)
         i = last_node_tag_idx + 1;
       if (i > 0)
-        node = info_get_node (fb->filename, fb->tags[i - 1]->nodename);
+        node = info_get_node (fb->filename, fb->tags[i - 1]->nodename,
+                              PARSE_NODE_DFLT);
     }
 
   if (!node)
@@ -2247,7 +2249,8 @@
       if (count > 0)
         i = last_node_tag_idx + 1;
       if (i > 0)
-        node = info_get_node (fb->filename, fb->tags[i - 1]->nodename);
+        node = info_get_node (fb->filename, fb->tags[i - 1]->nodename,
+                              PARSE_NODE_DFLT);
     }
 
   if (!node)
@@ -2860,7 +2863,7 @@
           if (arg == first_arg)
             {
               /* Maybe they typed "info foo" instead of "info -f foo".  */
-              node = info_get_node (first_arg, 0);
+              node = info_get_node (first_arg, NULL, PARSE_NODE_DFLT);
               if (node)
                 add_file_directory_to_path (first_arg);
               else
@@ -2884,7 +2887,8 @@
                                                      : initial_node->filename);
 
       /* Try to find this node.  */
-      node = info_get_node (entry->filename, entry->nodename);
+      node = info_get_node (entry->filename, entry->nodename, 
+                            PARSE_NODE_VERBATIM);
       if (!node && arg == first_arg)
         {
           node = make_manpage_node (first_arg);
@@ -2896,7 +2900,7 @@
          file, i.e., "(LABEL)Top".  */
       if (!node && entry->nodename
           && strcmp (entry->label, entry->nodename) == 0)
-        node = info_get_node (entry->label, "Top");
+        node = info_get_node (entry->label, "Top", PARSE_NODE_DFLT);
 
     maybe_got_node:
       if (!node)
@@ -2969,7 +2973,7 @@
   if (*line)
     {
       NODE *err_node;
-      NODE *dir_node = info_get_node (NULL, NULL);
+      NODE *dir_node = info_get_node (NULL, NULL, PARSE_NODE_DFLT);
       char **nodes = split_list_of_nodenames (line);
       NODE *node = NULL;
 
@@ -2981,7 +2985,7 @@
 
           if (!file_name)
             file_name = window->node->filename;
-          dir_node = info_get_node (file_name, NULL);
+          dir_node = info_get_node (file_name, NULL, PARSE_NODE_DFLT);
         }
 
       /* If we still cannot find the starting point, give up.
@@ -3110,7 +3114,8 @@
         entry->filename = xstrdup (initial_node->parent ? initial_node->parent
                                    : initial_node->filename);
       /* Try to find this node.  */
-      node = info_get_node (entry->filename, entry->nodename);
+      node = info_get_node (entry->filename, entry->nodename, 
+                            PARSE_NODE_VERBATIM);
       info_free_references (menu);
       if (!node)
         break;
@@ -3177,7 +3182,7 @@
 
   /* In interactive usage they'd probably expect us to begin looking
      from the Top node.  */
-  top_node = info_get_node (file_name, NULL);
+  top_node = info_get_node (file_name, NULL, PARSE_NODE_DFLT);
   if (!top_node)
     info_error (msg_cant_find_node, "Top");
 
@@ -3423,7 +3428,7 @@
     {
       NODE *node;
 
-      node = info_get_node (line, "*");
+      node = info_get_node (line, "*", PARSE_NODE_DFLT);
       if (!node)
         {
           if (info_recent_file_error)
@@ -3510,7 +3515,7 @@
   register int i;
   NODE *node;
 
-  node = info_get_node (filename, nodename);
+  node = info_get_node (filename, nodename, PARSE_NODE_DFLT);
 
   if (!node)
     {
@@ -3980,7 +3985,8 @@
               last_subfile = tag->filename;
             }
 
-          node = info_get_node (file_buffer->filename, tag->nodename);
+          node = info_get_node (file_buffer->filename, tag->nodename,
+                                PARSE_NODE_VERBATIM);
 
           if (!node)
             {



reply via email to

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