texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/makeinfo float.c,1.3,1.4


From: dirt
Subject: texinfo/makeinfo float.c,1.3,1.4
Date: Tue, 30 Dec 2003 13:24:50 +0100

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

Modified Files:
        float.c 
Log Message:
2003-12-30  Alper Ersoy  <address@hidden>

        * makeinfo/float.c (cm_listoffloats): substituted fixed numbers with
        the sizeof operator where possible, and commented code where not, to
        improve code readability.



Index: float.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/float.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** float.c     2003/12/23 10:28:13     1.3
--- float.c     2003/12/30 12:24:47     1.4
***************
*** 176,200 ****
  
                    int len = strlen (temp->number) + strlen (title);
                    int aux_chars_len;
                    int column_width;
                    int i = 0;
  
                    if (no_headers)
                      {
                        column_width = 48;
!                       /* Add the width of " :\0" */
!                       aux_chars_len = 3;
                      }
                    else
                      {
                        column_width = 37;
!                       /* Add the width of "*  :\0" */
!                       aux_chars_len = 5;
                      }
  
                    if (len + aux_chars_len > column_width)
!                     { /* Shorten long titles by looking for a space before the
!                          45.  char.  */
!                       aux_chars_len += 4;
                        len = column_width - strlen (temp->number) - 
aux_chars_len;
                        while (title[len] != ' ')
--- 176,205 ----
  
                    int len = strlen (temp->number) + strlen (title);
+                   /* Auxiliary chars are asterisk, colon, and the like.  */
                    int aux_chars_len;
+                   /* This refers to the width of the first column in menus.  
*/
                    int column_width;
                    int i = 0;
  
+                   /* Chosen widths are to match what @printindex produces.  */
                    if (no_headers)
                      {
                        column_width = 48;
!                       /* Width of " :\0" */
!                       aux_chars_len = sizeof (" :");
                      }
                    else
                      {
                        column_width = 37;
!                       /* Width of "*  :\0".  One of the spaces is after
!                          the asterisk, the other is before the colon.  */
!                       aux_chars_len = sizeof ("*  :");
                      }
  
                    if (len + aux_chars_len > column_width)
!                     { /* Shorten long titles by looking for a space before
!                          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] != ' ')
***************
*** 204,210 ****
  
                        if (no_headers)
!                         snprintf (entry, len + 2, "%s %s", temp->number, 
title);
                        else
!                         snprintf (entry, len + 4, "* %s %s", temp->number, 
title);
  
                        strcat (entry, " ...:");
--- 209,217 ----
  
                        if (no_headers)
!                         snprintf (entry, len + sizeof (" "), "%s %s",
!                             temp->number, title);
                        else
!                         snprintf (entry, len + sizeof ("*  "), "* %s %s",
!                             temp->number, title);
  
                        strcat (entry, " ...:");
***************
*** 225,229 ****
  
                    i = strlen (entry);
!                   while (i < column_width + 4)
                      {
                        insert (' ');
--- 232,240 ----
  
                    i = strlen (entry);
!                   /* We insert space chars until ``column_width + four 
spaces''
!                      is reached, to make the layout the same with what we 
produce
!                      for @printindex.  This is of course not obligatory, 
though
!                      easier on the eye.  -1 is for NULL.  */
!                   while (i < column_width + sizeof ("    ") - 1)
                      {
                        insert (' ');



reply via email to

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