texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/makeinfo xref.c,1.2,1.3


From: dirt
Subject: texinfo/makeinfo xref.c,1.2,1.3
Date: Mon, 2 Feb 2004 15:15:39 +0100

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

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

        * makeinfo/xml.c (add_xref_punctuation): new function that inserts
        necessary punctuation after @ref and @pxref commands.
        (cm_xref): call add_xref_punctuation when multiple parameters are
        given, make use of next_nonwhitespace_character function in the END
        case.
        (cm_ref): do not call cm_xref in the END case.



Index: xref.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/xref.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** xref.c      2 Feb 2004 12:04:56 -0000       1.2
--- xref.c      2 Feb 2004 14:15:37 -0000       1.3
***************
*** 30,33 ****
--- 30,52 ----
  int ref_flag = 0;
  
+ static void
+ add_xref_punctuation ()
+ {
+   if (px_ref_flag)
+     add_char ('.');
+   else if (ref_flag)
+     {
+       /* Check if there's already punctuation.  */
+       int next_char = next_nonwhitespace_character ();
+ 
+       if (next_char == -1)
+         /* EOF while looking for punctuation, let's
+            insert a period instead of crying.  */
+         add_char ('.');
+       else if (next_char != ',' && next_char != '.')
+         add_char (',');
+     }
+ }
+ 
  /* Return next comma-delimited argument, but do not cross a close-brace
     boundary.  Clean up whitespace, too.  If EXPAND is nonzero, replace
***************
*** 238,242 ****
                    execute_string ("%s:", ref_name);
                    in_fixed_width_font++;
!                   execute_string (" (%s)%s%s", arg4, arg1, px_ref_flag ? "." 
: "");
                    in_fixed_width_font--;
                  }
--- 257,262 ----
                    execute_string ("%s:", ref_name);
                    in_fixed_width_font++;
!                   execute_string (" (%s)%s", arg4, arg1);
!                   add_xref_punctuation ();
                    in_fixed_width_font--;
                  }
***************
*** 271,275 ****
                    execute_string ("%s:", *arg2 ? arg2 : arg3);
                    in_fixed_width_font++;
!                   execute_string (" %s%s", arg1, px_ref_flag ? "." : "");
                    in_fixed_width_font--;
                  }
--- 291,296 ----
                    execute_string ("%s:", *arg2 ? arg2 : arg3);
                    in_fixed_width_font++;
!                   execute_string (" %s", arg1);
!                   add_xref_punctuation ();
                    in_fixed_width_font--;
                  }
***************
*** 302,306 ****
                        execute_string ("%s:", arg2);
                        in_fixed_width_font++;
!                       execute_string (" %s%s", arg1, px_ref_flag ? "." : "");
                        in_fixed_width_font--;
                      }
--- 323,328 ----
                        execute_string ("%s:", arg2);
                        in_fixed_width_font++;
!                       execute_string (" %s", arg1);
!                       add_xref_punctuation ();
                        in_fixed_width_font--;
                      }
***************
*** 312,316 ****
                            execute_string ("%s:", fref);
                            in_fixed_width_font++;
!                           execute_string (" %s%s", arg1, px_ref_flag ? "." : 
"");
                            in_fixed_width_font--;
                          }
--- 334,339 ----
                            execute_string ("%s:", fref);
                            in_fixed_width_font++;
!                           execute_string (" %s", arg1);
!                           add_xref_punctuation ();
                            in_fixed_width_font--;
                          }
***************
*** 336,358 ****
           valid to follow an xref (so info readers can find the node
           names).  `input_text_offset' is pointing at the "}" which ended
!          the xref or ref command.  This is not used for @pxref, since we
!          insert the necessary periods above if needed.  And for @ref, we
!          also allow ), which doesn't make sense for @xref.  */
!       int temp;
  
!       for (temp = input_text_offset + 1; temp < input_text_length; )
!         {
!           if (cr_or_whitespace (input_text[temp]))
!             temp++;
!           else {
!             /* sorry to switch indentation styles, but it's just too
!                much nesting.  --karl.  */
!             if (input_text[temp] != '.' && input_text[temp] != ',') {
!               warning (_("`.' or `,' must follow ref, not %c"),
!                            input_text[temp]);
!             }
!             break;
!           }
!         }
      }
  }
--- 359,371 ----
           valid to follow an xref (so info readers can find the node
           names).  `input_text_offset' is pointing at the "}" which ended
!          the xref or ref command.  This is not used for @pxref or @ref,
!          since we insert the necessary periods above if needed.  And for
!          @ref, we also allow ), which doesn't make sense for @xref.  */
!       int temp = next_nonwhitespace_character ();
  
!       if (temp == -1)
!         warning (_("End of file reached while looking for `.' or `,'"));
!       else if (temp != '.' && temp != ',')
!         warning (_("`.' or `,' must follow ref, not %c"), temp);
      }
  }
***************
*** 378,385 ****
       int arg;
  {
!   /* Call cm_xref for both START and END, so we get the checking.  */
!   ref_flag++;
!   cm_xref (arg);
!   ref_flag--;
  }
  
--- 391,401 ----
       int arg;
  {
!   /* See the comments in cm_pxref about the checks for punctuation.  */
!   if (arg == START)
!     {
!       ref_flag++;
!       cm_xref (arg);
!       ref_flag--;
!     }
  }
  



reply via email to

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