bug-texinfo
[Top][All Lists]
Advanced

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

Re: Using macros in @item


From: Karl Berry
Subject: Re: Using macros in @item
Date: Thu, 23 Oct 2003 22:10:36 -0400

1) Indeed, macros are not expanded in the @item of a @table.  I do not
   see an easy fix for this, see my comment in the diff below.

2) So, I changed makeinfo/macro.c to output the body of a macro to the
   macro expansion output.  (Bizarre!)  So texinfo.tex will have a
   chance at it.

3) It was not texi2dvi that was disabling @macro in the macro xp output.
   Makeinfo has never output the @macro commands there.

4) I'm not worrying about old versions of texinfo.tex that don't have
   @macro, although that's what red hat (and probably other
   distributions) still have :(.

In addition to this patch to macro.c, you'll need the very latest
texinfo.tex (updated tonight), or you'll get spurious warnings with your
test files.

Hope this helps a little.  I'm sorry I can't fix the real problems.

k

*** macro.c     21 Sep 2003 00:46:22 -0000      1.4
--- macro.c     24 Oct 2003 02:02:00 -0000      1.5
***************
*** 466,482 ****
       char *mactype;
       int recursive;
  {
!   int i;
!   char *name, **arglist, *body, *line, *last_end;
!   int body_size, body_index;
    int depth = 1;
-   int defining_line = line_number;
    int flags = 0;
! 
!   arglist = NULL;
!   body = NULL;
!   body_size = 0;
!   body_index = 0;
  
    if (macro_expansion_output_stream && !executing_string)
      me_append_before_this_command ();
--- 467,480 ----
       char *mactype;
       int recursive;
  {
!   int i, start;
!   char *name, *line, *last_end;
!   char *body = NULL;
!   char **arglist = NULL;
!   int body_size = 0, body_index = 0;
    int depth = 1;
    int flags = 0;
!   int defining_line = line_number;
  
    if (macro_expansion_output_stream && !executing_string)
      me_append_before_this_command ();
***************
*** 485,499 ****
  
    /* Get the name of the macro.  This is the set of characters which are
       not whitespace and are not `{' immediately following the @macro. */
    {
-     int start = input_text_offset;
      int len;
  
!     for (i = start;
!          (i < input_text_length) &&
!          (input_text[i] != '{') &&
!          (!cr_or_whitespace (input_text[i]));
!          i++);
  
      len = i - start;
      name = xmalloc (1 + len);
--- 483,495 ----
  
    /* Get the name of the macro.  This is the set of characters which are
       not whitespace and are not `{' immediately following the @macro. */
+   start = input_text_offset;
    {
      int len;
  
!     for (i = start; i < input_text_length && input_text[i] != '{'
!                     && !cr_or_whitespace (input_text[i]);
!          i++) ;
  
      len = i - start;
      name = xmalloc (1 + len);
***************
*** 697,703 ****
    add_macro (name, arglist, body, input_filename, defining_line, flags);
  
    if (macro_expansion_output_stream && !executing_string)
!     remember_itext (input_text, input_text_offset);
  }
  
  void 
--- 693,714 ----
    add_macro (name, arglist, body, input_filename, defining_line, flags);
  
    if (macro_expansion_output_stream && !executing_string)
!     {
!       /* Remember text for future expansions.  */
!       remember_itext (input_text, input_text_offset);
! 
!       /* Bizarrely, output the @macro itself.  This is so texinfo.tex
!          will have a chance to read it when texi2dvi calls makeinfo -E.
!          The problem is that we don't really expand macros in all
!          contexts; a @table's @item is one.  And a fix is not obvious to
!          me, since it appears virtually identical to any other internal
!          expansion.  Just setting a variable in cm_item caused other
!          strange expansion problems.  */
!       write_region_to_macro_output ("@", 0, 1);
!       write_region_to_macro_output (mactype, 0, strlen (mactype));
!       write_region_to_macro_output (" ", 0, 1);
!       write_region_to_macro_output (input_text, start, input_text_offset);
!     }
  }
  
  void 




reply via email to

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