texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/makeinfo index.c,1.9,1.10 xml.c,1.14,1.15


From: dirt
Subject: texinfo/makeinfo index.c,1.9,1.10 xml.c,1.14,1.15
Date: Wed, 21 Jan 2004 04:01:28 +0100

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

Modified Files:
        index.c xml.c 
Log Message:
2004-01-21  Alper Ersoy  <address@hidden>

        * makeinfo/xml.c (xml_begin_index): move data to a temporary location
        for delayed use and insert back when handling delayed writes.

        * makeinfo/index.c (cm_printindex): call xml_begin_index when not
        handling delayed writes too.



Index: index.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/index.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** index.c     18 Jan 2004 12:13:07 -0000      1.9
--- index.c     21 Jan 2004 03:01:25 -0000      1.10
***************
*** 675,679 ****
        xml_insert_element (PRINTINDEX, END);
      }
!   else if (!handling_delayed_writes && !docbook)
      {
        int command_len = sizeof ("@ ") + strlen (command) + strlen 
(index_name);
--- 675,679 ----
        xml_insert_element (PRINTINDEX, END);
      }
!   else if (!handling_delayed_writes)
      {
        int command_len = sizeof ("@ ") + strlen (command) + strlen 
(index_name);
***************
*** 681,684 ****
--- 681,686 ----
  
        close_paragraph ();
+       if (docbook)
+         xml_begin_index ();
  
        snprintf (index_command, command_len, "@%s %s", command, index_name);

Index: xml.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/xml.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** xml.c       15 Jan 2004 22:35:19 -0000      1.14
--- xml.c       21 Jan 2004 03:01:25 -0000      1.15
***************
*** 23,26 ****
--- 23,27 ----
  #include "makeinfo.h"
  #include "insertion.h"
+ #include "files.h"
  #include "float.h"
  #include "macro.h"
***************
*** 1725,1780 ****
  xml_begin_index ()
  {
!   /*
!      We assume that we just opened a section, and so that the last output is
!      <SECTION ID="node-name"><TITLE>Title</TITLE>
!      where SECTION can be CHAPTER, ...
!    */
  
!   xml_section *temp = last_section;
  
!   int l = output_paragraph_offset-xml_last_section_output_position;
!   char *tmp = xmalloc (l+1);
!   char *p = tmp;
!   strncpy (tmp, output_paragraph, l);
  
!   /* We remove <SECTION */
!   tmp[l] = '\0';
!   while (*p != '<')
!     p++;
!   while (*p != ' ')
!     p++;
!   /* ... and its label attribute.  */
!   if (strncmp (p, " label=", 7) == 0)
!     {
!       p++;
        while (*p != ' ')
          p++;
!     }
  
!   output_paragraph_offset = xml_last_section_output_position;
!   xml_last_section_output_position = 0;
  
!   xml_pop_current_element (); /* remove section element from elements stack */
  
!   if (last_section)
!     last_section = last_section->prev; /* remove section from sections stack 
*/
!   if (temp)
!     {
!       free (temp->name);
!       free (temp);
      }
  
!   /* We put <INDEX> */
!   xml_insert_element (PRINTINDEX, START);
!   /* Remove the final > */
!   output_paragraph_offset--;
  
!   /* and put  ID="node-name"><TITLE>Title</TITLE> */
!   insert_string (p);
  
!   if (xml_index_divisions)
!     {
!       xml_insert_element (INDEXDIV, START);
!       indexdivempty = 1;
      }
  }
--- 1726,1807 ----
  xml_begin_index ()
  {
!   typedef struct xml_index_title {
!       struct xml_index_title *next;
!       char *title;
!   } XML_INDEX_TITLE;
  
!   static XML_INDEX_TITLE *xml_index_titles = NULL;
  
!   if (!handling_delayed_writes)
!     { /* We assume that we just opened a section, and so that the last output 
is
!          <SECTION ID="node-name"><TITLE>Title</TITLE>
!          where SECTION can be CHAPTER, ...  */
  
!       XML_INDEX_TITLE *new = xmalloc (sizeof (XML_INDEX_TITLE));
!       xml_section *temp = last_section;
! 
!       int l = output_paragraph_offset-xml_last_section_output_position;
!       char *tmp = xmalloc (l+1);
!       char *p = tmp;
!       strncpy (tmp, output_paragraph, l);
! 
!       /* We remove <SECTION */
!       tmp[l] = '\0';
!       while (*p != '<')
!         p++;
        while (*p != ' ')
          p++;
!       /* ... and its label attribute.  */
!       if (strncmp (p, " label=", 7) == 0)
!         {
!           p++;
!           while (*p != ' ')
!             p++;
!         }
  
!       output_paragraph_offset = xml_last_section_output_position;
!       xml_last_section_output_position = 0;
  
!       xml_pop_current_element (); /* remove section element from elements 
stack */
  
!       if (last_section)
!         last_section = last_section->prev; /* remove section from sections 
stack */
!       if (temp)
!         {
!           free (temp->name);
!           free (temp);
!         }
! 
!       new->title = xstrdup (p);
!       new->next = xml_index_titles;
!       xml_index_titles = new;
      }
+   else
+     {
+       static int xml_index_titles_reversed = 0;
  
!       if (!xml_index_titles_reversed)
!         {
!           xml_index_titles = (XML_INDEX_TITLE *) reverse_list 
(xml_index_titles);
!           xml_index_titles_reversed = 1;
!         }
  
!       /* We put <INDEX> */
!       xml_insert_element (PRINTINDEX, START);
!       if (xml_index_titles)
!         {
!           /* Remove the final > */
!           output_paragraph_offset--;
!           /* and put  ID="node-name"><TITLE>Title</TITLE> */
!           insert_string (xml_index_titles->title);
!           free (xml_index_titles->title);
!           xml_index_titles = xml_index_titles->next;
!         }
  
!       if (xml_index_divisions)
!         {
!           xml_insert_element (INDEXDIV, START);
!           indexdivempty = 1;
!         }
      }
  }



reply via email to

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