texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/makeinfo float.c,1.24,1.25


From: dirt
Subject: texinfo/makeinfo float.c,1.24,1.25
Date: Sat, 28 Feb 2004 13:15:55 +0100

Update of /cvsroot/texinfo/texinfo/makeinfo
In directory sheep:/tmp/cvs-serv31400/makeinfo

Modified Files:
        float.c 
Log Message:
2004-02-28  Alper Ersoy  <address@hidden>

        * makeinfo/float.c (cm_listoffloats): simplified entry generation.



Index: float.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/float.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** float.c     24 Feb 2004 20:16:43 -0000      1.24
--- float.c     28 Feb 2004 12:15:53 -0000      1.25
***************
*** 251,255 ****
                  {
                    char *entry;
!                   char *number;
                    char *title = expansion (temp->title, 0);
  
--- 251,255 ----
                  {
                    char *entry;
!                   char *raw_entry;
                    char *title = expansion (temp->title, 0);
  
***************
*** 257,272 ****
                    int aux_chars_len; /* these are asterisk, colon, etc.  */
                    int column_width; /* width of the first column in menus.  */
                    int i = 0;
  
-                   /* Allocate enough space for possible expansion later.  */
-                   number = (char *) xmalloc (strlen (float_type)
-                       + strlen (temp->number) + sizeof (":  "));
- 
-                   sprintf (number, "%s %s", float_type, temp->number);
-                   if (strlen (title) > 0)
-                     strcat (number, ": ");
- 
-                   len = strlen (number) + strlen (title);
- 
                    /* Chosen widths are to match what @printindex produces.  */
                    if (no_headers)
--- 257,263 ----
                    int aux_chars_len; /* these are asterisk, colon, etc.  */
                    int column_width; /* width of the first column in menus.  */
+                   int number_len; /* length of Figure X.Y: etc.   */
                    int i = 0;
  
                    /* Chosen widths are to match what @printindex produces.  */
                    if (no_headers)
***************
*** 285,296 ****
                      }
  
                    /* If we have a @shortcaption, try it if @caption is
                       too long to fit on a line.  */
                    if (len + aux_chars_len > column_width
                        && strlen (temp->shorttitle) > 0)
!                     {
!                       title = expansion (temp->shorttitle, 0);
!                       len = strlen (number) + strlen (title);
!                     }
  
                    if (len + aux_chars_len > column_width)
--- 276,301 ----
                      }
  
+                   /* Allocate enough space for possible expansion later.  */
+                   raw_entry = (char *) xmalloc (strlen (float_type)
+                       + strlen (temp->number) + strlen (title)
+                       + sizeof (":  "));
+ 
+                   sprintf (raw_entry, "%s %s", float_type, temp->number);
+ 
+                   if (strlen (title) > 0)
+                     strcat (raw_entry, ": ");
+ 
+                   number_len = strlen (raw_entry);
+ 
+                   len = strlen (title) + strlen (raw_entry);
+ 
                    /* If we have a @shortcaption, try it if @caption is
                       too long to fit on a line.  */
                    if (len + aux_chars_len > column_width
                        && strlen (temp->shorttitle) > 0)
!                     title = expansion (temp->shorttitle, 0);
! 
!                   strcat (raw_entry, title);
!                   len = strlen (raw_entry);
  
                    if (len + aux_chars_len > column_width)
***************
*** 298,314 ****
                           column_width - strlen (" ...").  */
                        /* -1 is for NULL, which is already in aux_chars_len.  
*/
!                       aux_chars_len += sizeof (" ...") - 1;
!                       len = column_width - strlen (temp->number) - 
aux_chars_len;
!                       while (title[len] != ' ' && len >= 0)
                          len--;
!                       len += strlen (number);
                        entry = xmalloc (len + aux_chars_len);
  
!                       if (no_headers)
!                         snprintf (entry, len + sizeof (" "), "%s%s ...",
!                             number, title);
                        else
!                         snprintf (entry, len + sizeof ("*  "), "* %s%s ...:",
!                             number, title);
                      }
                    else
--- 303,338 ----
                           column_width - strlen (" ...").  */
                        /* -1 is for NULL, which is already in aux_chars_len.  
*/
!                       aux_chars_len += sizeof ("...") - 1;
!                       len = column_width - aux_chars_len;
!                       while (raw_entry[len] != ' ' && len >= 0)
                          len--;
! 
!                       /* Advance to the whitespace.  */
!                       len++;
! 
!                       /* If we are at the end of, say, Figure X.Y:, but
!                          we have a title, then this means title does not
!                          contain any whitespaces.  Or it may be that we
!                          went as far as the beginning.  Just print as much
!                          as possible of the title.  */
!                       if (len == 0
!                           || (len == number_len && strlen (title) > 0))
!                         len = column_width - sizeof ("...");
! 
!                       /* Break here.  */
!                       raw_entry[len] = 0;
! 
                        entry = xmalloc (len + aux_chars_len);
  
!                       if (!no_headers)
!                         strcpy (entry, "* ");
                        else
!                         entry[0] = 0;
! 
!                       strcat (entry, raw_entry);
!                       strcat (entry, "...");
! 
!                       if (!no_headers)
!                         strcat (entry, ":");
                      }
                    else
***************
*** 316,325 ****
                        entry = xmalloc (len + aux_chars_len);
  
!                       if (no_headers)
!                         snprintf (entry, len + aux_chars_len, "%s%s",
!                             number, title);
                        else
!                         snprintf (entry, len + aux_chars_len, "* %s%s:",
!                             number, title);
                      }
  
--- 340,352 ----
                        entry = xmalloc (len + aux_chars_len);
  
!                       if (!no_headers)
!                         strcpy (entry, "* ");
                        else
!                         entry[0] = 0;
! 
!                       strcat (entry, raw_entry);
! 
!                       if (!no_headers)
!                         strcat (entry, ":");
                      }
  



reply via email to

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