texinfo-commits
[Top][All Lists]
Advanced

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

texinfo update (Wed Sep 26 16:53:01 EDT 2007)


From: Karl Berry
Subject: texinfo update (Wed Sep 26 16:53:01 EDT 2007)
Date: Wed, 26 Sep 2007 16:53:03 -0400

Index: ChangeLog
===================================================================
RCS file: /sources/texinfo/texinfo/ChangeLog,v
retrieving revision 1.765
retrieving revision 1.766
diff -u -r1.765 -r1.766
--- ChangeLog   25 Sep 2007 21:30:17 -0000      1.765
+++ ChangeLog   26 Sep 2007 20:53:39 -0000      1.766
@@ -1,3 +1,17 @@
+2007-09-26  Karl Berry  <address@hidden>
+
+       * makeinfo/index.c (count_strn_chars): new fn.
+       (insert_index_output_line_no): call it.
+       (cm_printindex): call it.
+       This is to fix off-by-one width computation due to @tie{},
+        reported by Werner Lember, 16 Sep 2007 16:48:47.
+
+       * makeinfo/cmds.c,
+       * makeinfo/xref.c: #include "index.h", instead of explicit      
+       extern printing_index.
+       * makeinfo/index.c (the_indices, index_element_compare): can be static.
+       * makeinfo/index.h: make order of decls match index.c.
+
 2007-09-25  Karl Berry  <address@hidden>
 
        * doc/texinfo.txi (Six Parts): End segment should not have toc anymore.
Index: makeinfo/.gdbinit
===================================================================
RCS file: /sources/texinfo/texinfo/makeinfo/.gdbinit,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- makeinfo/.gdbinit   20 Jun 2007 20:05:42 -0000      1.37
+++ makeinfo/.gdbinit   26 Sep 2007 20:53:39 -0000      1.38
@@ -242,9 +242,6 @@
 # local variables with split files
 set args --no-warn --enable-encoding --split-size=150000 $ttests/xe.tex
 
-# no info trailer on main file
-set args -I /usr/local/gnu/src/groff-1.19/doc --enable-encoding groff.texinfo
-
 # escape & in <link> titles
 set args -o $ttests/titleamp.out --html $ttests/titleamp.tex
 
@@ -262,3 +259,7 @@
 
 #set env LANG de
 set args -o - --no-headers $ttests/doclang.tex
+
+# misaligned index
+set args -I $ks/groff/doc --enable-encoding groff.texinfo
+#set args $ttests/idxalign.tex
Index: makeinfo/cmds.c
===================================================================
RCS file: /sources/texinfo/texinfo/makeinfo/cmds.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- makeinfo/cmds.c     15 Jul 2007 11:51:12 -0000      1.75
+++ makeinfo/cmds.c     26 Sep 2007 20:53:39 -0000      1.76
@@ -1,5 +1,5 @@
 /* cmds.c -- Texinfo commands.
-   $Id: cmds.c,v 1.75 2007/07/15 11:51:12 olegkat Exp $
+   $Id: cmds.c,v 1.76 2007/09/26 20:53:39 karl Exp $
 
    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
@@ -24,6 +24,7 @@
 #include "files.h"
 #include "footnote.h"
 #include "html.h"
+#include "index.h"
 #include "insertion.h"
 #include "lang.h"
 #include "macro.h"
@@ -1001,8 +1002,6 @@
     }
   else
     {
-      extern int printing_index;
-
       if (!printing_index)
         {
           if (arg == START)
@@ -1305,7 +1304,6 @@
 {
   /* Make use of <lineannotation> of Docbook, if we are
      inside an @example or similar.  */
-  extern int printing_index;
   if (docbook && !filling_enabled && !printing_index)
     xml_insert_element (LINEANNOTATION, arg);
   else if (xml)
@@ -1321,7 +1319,6 @@
 {
   /* Make use of <lineannotation> of Docbook, if we are
      inside an @example or similar.  */
-  extern int printing_index;
   if (docbook && !filling_enabled && !printing_index)
     xml_insert_element (LINEANNOTATION, arg);
   else if (xml)
@@ -1336,7 +1333,6 @@
 cm_b (int arg)
 {
   /* See cm_i comments.  */
-  extern int printing_index;
   if (docbook && !filling_enabled && !printing_index)
     xml_insert_element (LINEANNOTATION, arg);
   else if (docbook && arg == START)
@@ -1353,7 +1349,6 @@
 cm_r (int arg)
 {
   /* See cm_i comments.  */
-  extern int printing_index;
   if (docbook && !filling_enabled && !printing_index)
     xml_insert_element (LINEANNOTATION, arg);
   else if (xml)
@@ -1368,7 +1363,6 @@
 cm_sansserif (int arg)
 {
   /* See cm_i comments.  */
-  extern int printing_index;
   if (docbook && !filling_enabled && !printing_index)
     xml_insert_element (LINEANNOTATION, arg);
   else if (xml)
Index: makeinfo/index.c
===================================================================
RCS file: /sources/texinfo/texinfo/makeinfo/index.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- makeinfo/index.c    1 Jul 2007 21:20:32 -0000       1.24
+++ makeinfo/index.c    26 Sep 2007 20:53:40 -0000      1.25
@@ -1,5 +1,5 @@
 /* index.c -- indexing for Texinfo.
-   $Id: index.c,v 1.24 2007/07/01 21:20:32 karl Exp $
+   $Id: index.c,v 1.25 2007/09/26 20:53:40 karl Exp $
 
    Copyright (C) 1998, 1999, 2002, 2003, 2004, 2007
    Free Software Foundation, Inc.
@@ -29,12 +29,8 @@
 #include "toc.h"
 #include "xml.h"
 
-INDEX_ALIST **name_index_alist = NULL;
-
-/* An array of pointers.  Each one is for a different index.  The
-   "synindex" command changes which array slot is pointed to by a
-   given "index". */
-INDEX_ELT **the_indices = NULL;
+/* Nonzero means that we are in the middle of printing an index. */
+int printing_index = 0;
 
 /* The number of defined indices. */
 int defined_indices = 0;
@@ -46,12 +42,14 @@
 COMMAND **user_command_array = NULL;
 int user_command_array_len = 0;
 
-/* How to compare index entries for sorting.  May be set to strcoll.  */
-int (*index_compare_fn) (const char *a, const char *b) = strcasecmp;
+INDEX_ALIST **name_index_alist = NULL;
 
-/* Function to compare index entries for sorting.  (Calls
-   `index_compare_fn' above.)  */
-int index_element_compare (const void *element1, const void *element2);
+/* An array of pointers.  Each one is for a different index.  The @synindex
+   command changes which array slot is pointed to by a given index.  */
+static INDEX_ELT **the_indices = NULL;
+
+/* How to compare index entries for sorting.  May be set to strcoll.  */
+static int (*index_compare_fn) (const char *a, const char *b) = strcasecmp;
 
 /* Find which element in the known list of indices has this name.
    Returns -1 if NAME isn't found. */
@@ -260,7 +258,7 @@
   if (xml)
     xml_insert_indexterm (index_entry, name);
 }
-
+
 /* The function which user defined index commands call. */
 static void
 gen_index (void)
@@ -271,7 +269,7 @@
   index_add_arg (name);
   free (name);
 }
-
+
 /* Define an index known as NAME.  We assign the slot number.
    If CODE is nonzero, make this a code index. */
 static void
@@ -503,8 +501,8 @@
 {
   index_add_arg ("tp");
 }
-
-int
+
+static int
 index_element_compare (const void *element1, const void *element2)
 {
   INDEX_ELT **elt1 = (INDEX_ELT **) element1;
@@ -653,6 +651,23 @@
 
   return array;
 }
+
+/* Return the number of times that the byte CH occurs in the LEN bytes
+   starting at STR.  Multibyte strings are not taken into account, which
+   is incorrect, but we need this for @tie; see more comments below.  */
+
+static int
+count_strn_chars (const char *str, int len, int ch)
+{
+  int count = 0;
+  int i;
+  
+  for (i = 0; i < len; i++)
+    if (str[i] == ch)
+      count++;
+
+  return count;
+}
 
 static void
 insert_index_output_line_no (int line_number, int output_line_number_len)
@@ -675,6 +690,8 @@
       i--;
     last_column = mbsnwidth ((char *)(output_paragraph + i),
                             output_paragraph_offset - i, 0);
+    last_column += count_strn_chars (output_paragraph + i,
+                              output_paragraph_offset - i, NON_BREAKING_SPACE);
   }
 
   out_line_no_width = mbswidth (out_line_no_str, 0);
@@ -695,10 +712,7 @@
 
   free (out_line_no_str);
 }
-
-/* Nonzero means that we are in the middle of printing an index. */
-int printing_index = 0;
-
+
 /* Takes one arg, a short name of an index to print.
    Outputs a menu of the sorted elements of the index. */
 void
@@ -893,16 +907,25 @@
                  @@ has turned into @. */
               if (!no_headers)
                 {
-                 int width;
-
-                 width = mbswidth (index->entry, 0);
-                  sprintf (line, "* %*s  ", width < MIN_ENTRY_COLUMNS
-                          ? -(strlen (index->entry)
-                              + (MIN_ENTRY_COLUMNS - width))
-                          : 0, index->entry);
+                  int nspaces;
+                 int width = mbswidth (index->entry, 0);
+                 
+                 /* Unfortunately, our @tie{} / @w{ } magic is an
+                     unprintable character, and so mbswidth doesn't
+                     count it.  If that byte value occurs in a multibyte
+                     string, we'd lose, but at least it's only a
+                     question of minor formatting, not functionality.  */
+                 width += count_strn_chars (index->entry,
+                                    strlen (index->entry), NON_BREAKING_SPACE);
+                 
+                 nspaces = -(strlen (index->entry)
+                              + (MIN_ENTRY_COLUMNS - width));
+                  sprintf (line, "* %*s  ",
+                           width < MIN_ENTRY_COLUMNS ? nspaces : 0, 
+                          index->entry);
                   line[2 + strlen (index->entry)] = ':';
                   insert_string (line);
-                  /* Make sure any non-macros in the node name are expanded.  
*/
+                  /* Expand any non-macros in the node name.  */
                   in_fixed_width_font++;
                   execute_string ("%s. ", index_node);
                   insert_index_output_line_no (index->output_line,
@@ -915,7 +938,8 @@
                      there's little sense in referring to them in the
                      index.  Instead, output the number or name of the
                      section that corresponds to that node.  */
-                  sprintf (line, "%-*s ", number_sections ? 46 : 1, 
index->entry);
+                  sprintf (line, "%-*s ", number_sections ? 46 : 1,
+                           index->entry);
                   line[strlen (index->entry)] = ':';
                   insert_string (line);
 
Index: makeinfo/index.h
===================================================================
RCS file: /sources/texinfo/texinfo/makeinfo/index.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- makeinfo/index.h    1 Jul 2007 21:20:32 -0000       1.5
+++ makeinfo/index.h    26 Sep 2007 20:53:40 -0000      1.6
@@ -1,5 +1,5 @@
 /* index.h -- declarations for index.c.
-   $Id: index.h,v 1.5 2007/07/01 21:20:32 karl Exp $
+   $Id: index.h,v 1.6 2007/09/26 20:53:40 karl Exp $
 
    Copyright (C) 1998, 1999, 2007 Free Software Foundation, Inc.
 
@@ -22,6 +22,10 @@
 #include "makeinfo.h"
 #include "cmds.h"
 
+extern int printing_index;
+extern int defined_indices;
+extern int index_counter;
+
 /* User commands are only new indices.  (Macros are handled separately.)  */
 extern COMMAND **user_command_array;
 extern int user_command_array_len;
@@ -83,10 +87,6 @@
 /* Initialize all indices.  */
 extern void init_indices (void);
 
-extern int defined_indices;
-extern int printing_index;
-extern int index_counter;
-
 INDEX_ELT *index_list (char *name);
 
 #endif /* !INDEX_H */
Index: makeinfo/xref.c
===================================================================
RCS file: /sources/texinfo/texinfo/makeinfo/xref.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- makeinfo/xref.c     15 Sep 2007 23:48:46 -0000      1.13
+++ makeinfo/xref.c     26 Sep 2007 20:53:40 -0000      1.14
@@ -1,5 +1,5 @@
 /* xref.c -- cross references for Texinfo.
-   $Id: xref.c,v 1.13 2007/09/15 23:48:46 karl Exp $
+   $Id: xref.c,v 1.14 2007/09/26 20:53:40 karl Exp $
 
    Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
 
@@ -490,7 +490,6 @@
 {
   if (arg == START)
     {
-      extern int printing_index;
       char *url  = get_xref_token (1); /* expands all macros in uref */
       char *desc = get_xref_token (0);
       char *replacement = get_xref_token (0);
P ChangeLog
P makeinfo/.gdbinit
P makeinfo/cmds.c
P makeinfo/index.c
P makeinfo/index.h
P makeinfo/xref.c




reply via email to

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