[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/makeinfo index.c,1.2,1.3
From: |
dirt |
Subject: |
texinfo/makeinfo index.c,1.2,1.3 |
Date: |
Thu, 8 Jan 2004 01:18:17 +0100 |
Update of /cvsroot/texinfo/texinfo/makeinfo
In directory sheep:/tmp/cvs-serv25297/makeinfo
Modified Files:
index.c
Log Message:
2004-01-08 Alper Ersoy <address@hidden>
* makeinfo/index.c (index_add_arg): keep line number of the index
entry where it appears in the output.
(insert_index_output_line_no): new function.
(cm_printindex): call insert_index_output_line_no for info and
plaintext outputs.
Index: index.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/index.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** index.c 28 Dec 2003 11:48:52 -0000 1.2
--- index.c 8 Jan 2004 00:18:15 -0000 1.3
***************
*** 38,41 ****
--- 38,42 ----
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;
***************
*** 220,223 ****
--- 221,228 ----
{
INDEX_ELT *new = xmalloc (sizeof (INDEX_ELT));
+
+ /* Get output line number updated before doing anything. */
+ flush_output ();
+
new->next = the_indices[which];
new->entry_text = index_entry;
***************
*** 234,237 ****
--- 239,243 ----
new->code = tem->code;
new->defining_line = line_number - 1;
+ new->output_line = output_line_number;
/* We need to make a copy since input_filename may point to
something that goes away, for example, inside a macro.
***************
*** 656,659 ****
--- 662,703 ----
}
+ void
+ insert_index_output_line_no (line_number, output_line_number_len)
+ int line_number;
+ int output_line_number_len;
+ {
+ int last_column;
+ int str_size = output_line_number_len + strlen (_("(line )"))
+ + sizeof (NULL);
+ char *out_line_no_str = (char *) xmalloc (str_size);
+
+ snprintf (out_line_no_str, str_size, _("(line %*d)"),
+ output_line_number_len, line_number);
+
+ {
+ int i = output_paragraph_offset;
+ while (output_paragraph[i-1] != '\n' && i > 0)
+ i--;
+ last_column = output_paragraph_offset - i;
+ }
+
+ if (last_column + strlen (out_line_no_str) > fill_column)
+ {
+ insert ('\n');
+ last_column = 0;
+ }
+
+ while (last_column + strlen (out_line_no_str) < fill_column)
+ {
+ insert (' ');
+ last_column++;
+ }
+
+ insert_string (out_line_no_str);
+ insert ('\n');
+
+ free (out_line_no_str);
+ }
+
/* Nonzero means that we are in the middle of printing an index. */
int printing_index = 0;
***************
*** 685,688 ****
--- 729,733 ----
int saved_line_number = line_number;
char *saved_input_filename = input_filename;
+ unsigned output_line_number_len;
close_paragraph ();
***************
*** 721,724 ****
--- 766,777 ----
line = xmalloc (line_length);
+ {
+ char *max_output_line_number = (char *) xmalloc (25 * sizeof (char));
+ snprintf (max_output_line_number, 25 * sizeof (char), "%d",
+ output_line_number);
+ output_line_number_len = strlen (max_output_line_number);
+ free (max_output_line_number);
+ }
+
for (item = 0; (index = array[item]); item++)
{
***************
*** 822,826 ****
/* Make sure any non-macros in the node name are expanded.
*/
in_fixed_width_font++;
! execute_string ("%s.\n", index_node);
in_fixed_width_font--;
}
--- 875,881 ----
/* Make sure any non-macros in the node name are expanded.
*/
in_fixed_width_font++;
! execute_string ("%s. ", index_node);
! insert_index_output_line_no (index->output_line,
! output_line_number_len);
in_fixed_width_font--;
}
***************
*** 849,853 ****
}
! insert_string (".\n");
}
}
--- 904,910 ----
}
! insert_string (". ");
! insert_index_output_line_no (index->output_line,
! output_line_number_len);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/makeinfo index.c,1.2,1.3,
dirt <=