texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/makeinfo files.c,1.3,1.4 float.c,1.12,1.13 index.c,1.3,1.4 makei


From: dirt
Subject: texinfo/makeinfo files.c,1.3,1.4 float.c,1.12,1.13 index.c,1.3,1.4 makeinfo.c,1.29,1.30 node.c,1.9,1.10 files.h,1.2,1.3 index.h,1.1.1.1,1.2
Date: Thu, 8 Jan 2004 20:15:51 +0100

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

Modified Files:
        files.c float.c index.c makeinfo.c node.c files.h index.h 
Log Message:
2004-01-08  Alper Ersoy  <address@hidden>

        * makeinfo/index.c: moved INDEX_ELT and INDEX_ALIST typedefs to ...

        * makeinfo/index.h: here

        * makeinfo/files.h:
        * makeinfo/files.c (register_delayed_write): save line number in input
        document that the calling command is in.
        (handle_delayed_writes): adjust byte offsets in tag table and output
        line numbers in all of the indices, 

        * makeinfo/makeinfo.c (convert_from_loaded_file): when finished, write
        the tag table after handling delayed writes.

        * makeinfo/node.c (write_tag_table): accept a filename argument, and
        open the file in append mode.



Index: files.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/files.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** files.c     8 Jan 2004 16:07:37 -0000       1.3
--- files.c     8 Jan 2004 19:15:49 -0000       1.4
***************
*** 21,26 ****
--- 21,28 ----
  #include "system.h"
  #include "files.h"
+ #include "index.h"
  #include "macro.h"
  #include "makeinfo.h"
+ #include "node.h"
  
  FSTACK *filestack = NULL;
***************
*** 604,607 ****
--- 606,610 ----
    new->filename = xstrdup (current_output_filename);
    new->position = output_position;
+   new->calling_line = line_number - 1;
    new->next = delayed_writes;
    delayed_writes = new;
***************
*** 621,627 ****
        delayed_buf = find_and_load (temp->filename);
  
-       /* FIXME provide feedback why we are returning.  */
        if (output_paragraph_offset > 0)
!         return;
  
        if (!delayed_buf)
--- 624,632 ----
        delayed_buf = find_and_load (temp->filename);
  
        if (output_paragraph_offset > 0)
!         {
!           error (_("Output buffer not empty."));
!           return;
!         }
  
        if (!delayed_buf)
***************
*** 646,654 ****
        {
          int output_position_at_start = output_position;
!         int line_number_at_start = line_number;
          execute_string ("%s", temp->command);
          flush_output ();
          position_shift_amount = output_position - output_position_at_start;
!         line_number_shift_amount = line_number - line_number_at_start;
        }
  
--- 651,659 ----
        {
          int output_position_at_start = output_position;
!         int line_number_at_start = output_line_number;
          execute_string ("%s", temp->command);
          flush_output ();
          position_shift_amount = output_position - output_position_at_start;
!         line_number_shift_amount = output_line_number - line_number_at_start;
        }
  
***************
*** 659,662 ****
--- 664,691 ----
          fs_error (temp->filename);
  
+       /* Update positions in tag table for nodes that are defined after
+          the line this delayed write is registered.  */
+       {
+         TAG_ENTRY *node;
+         for (node = tag_table; node; node = node->next_ent)
+           if (node->line_no > temp->calling_line)
+             node->position += position_shift_amount;
+       }
+ 
+       /* Something similar for the line numbers in all of the defined
+          indices.  */
+       {
+         int i;
+         for (i = 0; i < defined_indices; i++)
+           if (name_index_alist[i])
+             {
+               char *name = ((INDEX_ALIST *) name_index_alist[i])->name;
+               INDEX_ELT *index;
+               for (index = index_list (name); index; index = index->next)
+                 if (index->defining_line > temp->calling_line)
+                   index->output_line += line_number_shift_amount;
+             }
+       }
+ 
        free (delayed_buf);
        temp = temp->next;

Index: float.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/float.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** float.c     8 Jan 2004 16:11:26 -0000       1.12
--- float.c     8 Jan 2004 19:15:49 -0000       1.13
***************
*** 339,346 ****
        temp = new_start;
        float_stack = (FLOAT_ELT *) reverse_list (temp);
      } /* handling_delayed_writes */
  
    free (float_type);
-   node_has_listoffloats = 1;
  }
  
--- 339,346 ----
        temp = new_start;
        float_stack = (FLOAT_ELT *) reverse_list (temp);
+       node_has_listoffloats = 1;
      } /* handling_delayed_writes */
  
    free (float_type);
  }
  

Index: index.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/index.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** index.c     8 Jan 2004 00:18:15 -0000       1.3
--- index.c     8 Jan 2004 19:15:49 -0000       1.4
***************
*** 26,79 ****
  #include "xml.h"
  
- /* An index element... */
- typedef struct index_elt
- {
-   struct index_elt *next;
-   char *entry;                  /* The index entry itself, after expansion. */
-   char *entry_text;             /* The original, non-expanded entry text. */
-   char *node;                   /* The node from whence it came. */
-   char *section;                /* Current section number we are in, */
-   char *section_name;           /* ... and its title.  */
-   int code;                     /* Nonzero means add address@hidden' when
-                                    printing this element. */
-   int defining_line;            /* Line number where this entry was written. 
*/
-   int output_line;              /* And line number where it is in the output. 
*/
-   char *defining_file;          /* Source file for defining_line. */
- } INDEX_ELT;
- 
- 
- /* A list of short-names for each index.
-    There are two indices into the the_indices array.
-    * read_index is the index that points to the list of index
-      entries that we will find if we ask for the list of entries for
-      this name.
-    * write_index is the index that points to the list of index entries
-      that we will add new entries to.
- 
-    Initially, read_index and write_index are the same, but the
-    @syncodeindex and @synindex commands can change the list we add
-    entries to.
- 
-    For example, after the commands
-      @cindex foo
-      @defindex ii
-      @synindex cp ii
-      @cindex bar
- 
-    the cp index will contain the entry `foo', and the new ii
-    index will contain the entry `bar'.  This is consistent with the
-    way texinfo.tex handles the same situation.
- 
-    In addition, for each index, it is remembered whether that index is
-    a code index or not.  Code indices have @code{} inserted around the
-    first word when they are printed with printindex. */
- typedef struct
- {
-   char *name;
-   int read_index;   /* index entries for `name' */
-   int write_index;  /* store index entries here, @synindex can change it */
-   int code;
- } INDEX_ALIST;
- 
  INDEX_ALIST **name_index_alist = NULL;
  
--- 26,29 ----

Index: makeinfo.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/makeinfo.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** makeinfo.c  8 Jan 2004 15:12:21 -0000       1.29
--- makeinfo.c  8 Jan 2004 19:15:49 -0000       1.30
***************
*** 1733,1742 ****
      {
        output_pending_notes ();
-       if (tag_table)
-         {
-           tag_table = (TAG_ENTRY *) reverse_list (tag_table);
-           if (!no_headers && !html)
-             write_tag_table ();
-         }
  
        if (html)
--- 1733,1736 ----
***************
*** 1773,1776 ****
--- 1767,1777 ----
        handle_delayed_writes ();
  
+       if (tag_table)
+         {
+           tag_table = (TAG_ENTRY *) reverse_list (tag_table);
+           if (!no_headers && !html)
+             write_tag_table (real_output_filename);
+         }
+ 
        if (splitting && !html && (!errors_printed || force))
          {

Index: node.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/node.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** node.c      6 Jan 2004 22:26:08 -0000       1.9
--- node.c      8 Jan 2004 19:15:49 -0000       1.10
***************
*** 114,120 ****
  
  void
! write_tag_table ()
  {
    write_tag_table_internal (0); /* Not indirect. */
  }
  
--- 114,131 ----
  
  void
! write_tag_table (filename)
!      char *filename;
  {
+   output_stream = fopen (filename, "a");
+   if (!output_stream)
+     {
+       fs_error (filename);
+       return;
+     }
+ 
    write_tag_table_internal (0); /* Not indirect. */
+ 
+   if (fclose (output_stream) != 0)
+     fs_error (filename);
  }
  

Index: files.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/files.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** files.h     8 Jan 2004 15:12:21 -0000       1.2
--- files.h     8 Jan 2004 19:15:49 -0000       1.3
***************
*** 51,54 ****
--- 51,55 ----
    char *filename;
    int position;
+   int calling_line;
  } DELAYED_WRITE;
  

Index: index.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/index.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** index.h     6 Dec 2003 01:33:30 -0000       1.1.1.1
--- index.h     8 Jan 2004 19:15:49 -0000       1.2
***************
*** 28,31 ****
--- 28,83 ----
  extern int user_command_array_len;
  
+ /* An index element... */
+ typedef struct index_elt
+ {
+   struct index_elt *next;
+   char *entry;                  /* The index entry itself, after expansion. */
+   char *entry_text;             /* The original, non-expanded entry text. */
+   char *node;                   /* The node from whence it came. */
+   char *section;                /* Current section number we are in, */
+   char *section_name;           /* ... and its title.  */
+   int code;                     /* Nonzero means add address@hidden' when
+                                    printing this element. */
+   int defining_line;            /* Line number where this entry was written. 
*/
+   int output_line;              /* And line number where it is in the output. 
*/
+   char *defining_file;          /* Source file for defining_line. */
+ } INDEX_ELT;
+ 
+ 
+ /* A list of short-names for each index.
+    There are two indices into the the_indices array.
+    * read_index is the index that points to the list of index
+      entries that we will find if we ask for the list of entries for
+      this name.
+    * write_index is the index that points to the list of index entries
+      that we will add new entries to.
+ 
+    Initially, read_index and write_index are the same, but the
+    @syncodeindex and @synindex commands can change the list we add
+    entries to.
+ 
+    For example, after the commands
+      @cindex foo
+      @defindex ii
+      @synindex cp ii
+      @cindex bar
+ 
+    the cp index will contain the entry `foo', and the new ii
+    index will contain the entry `bar'.  This is consistent with the
+    way texinfo.tex handles the same situation.
+ 
+    In addition, for each index, it is remembered whether that index is
+    a code index or not.  Code indices have @code{} inserted around the
+    first word when they are printed with printindex. */
+ typedef struct
+ {
+   char *name;
+   int read_index;   /* index entries for `name' */
+   int write_index;  /* store index entries here, @synindex can change it */
+   int code;
+ } INDEX_ALIST;
+ 
+ extern INDEX_ALIST **name_index_alist;
+ 
  /* Initialize all indices.  */
  extern void init_indices ();
***************
*** 34,36 ****
--- 86,92 ----
  extern int (*index_compare_fn) ();
  
+ extern int defined_indices;
+ 
+ INDEX_ELT *index_list ();
+ 
  #endif /* !INDEX_H */



reply via email to

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