[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/makeinfo cmds.c,1.17,1.18 files.c,1.1.1.1,1.2 makeinfo.c,1.28,1.
From: |
dirt |
Subject: |
texinfo/makeinfo cmds.c,1.17,1.18 files.c,1.1.1.1,1.2 makeinfo.c,1.28,1.29 files.h,1.1.1.1,1.2 toc.h,1.1.1.1,1.2 |
Date: |
Thu, 8 Jan 2004 16:12:23 +0100 |
Update of /cvsroot/texinfo/texinfo/makeinfo
In directory sheep:/tmp/cvs-serv1213/makeinfo
Modified Files:
cmds.c files.c makeinfo.c files.h toc.h
Log Message:
2004-01-08 Alper Ersoy <address@hidden>
* makeinfo/cmds.c: use cm_contents for @shortcontents
and @summarycontents too.
* makeinfo/files.c (register_delayed_write)
(handle_delayed_writes): new functions.
* makeinfo/files.h: new delayed_write struct and
handling_delayed_writes variable.
* makeinfo/makeinfo.c (insert): use whitespace macro instead of
testing characters manually.
(convert_from_loaded_file): call handle_delayed_writes when finished.
* makeinfo/toc.c (contents_update_html, contents_update_info)
(shortcontents_update_html, shortcontents_update_info): changed file
read/writes with insert and insert_string.
(rewrite_top, contents_update, shortcontents_update)
(toc_update, cm_shortcontents): removed functions.
(cm_contents): for HTML and Info, only call register_delayed_write if
handling_delayed_writes is not true. Call contents_update_html and
other variants according to output format and command name.
* makeinfo/toc.h: removed obsolete variables and functions.
Index: cmds.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/cmds.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** cmds.c 6 Jan 2004 23:33:24 -0000 1.17
--- cmds.c 8 Jan 2004 15:12:21 -0000 1.18
***************
*** 328,332 ****
{ "settitle", cm_settitle, NO_BRACE_ARGS },
{ "shortcaption", cm_caption, BRACE_ARGS },
! { "shortcontents", cm_shortcontents, NO_BRACE_ARGS },
{ "shorttitlepage", cm_ignore_line, NO_BRACE_ARGS },
{ "smallbook", cm_ignore_line, NO_BRACE_ARGS },
--- 328,332 ----
{ "settitle", cm_settitle, NO_BRACE_ARGS },
{ "shortcaption", cm_caption, BRACE_ARGS },
! { "shortcontents", cm_contents, NO_BRACE_ARGS },
{ "shorttitlepage", cm_ignore_line, NO_BRACE_ARGS },
{ "smallbook", cm_ignore_line, NO_BRACE_ARGS },
***************
*** 343,347 ****
{ "subsubsection", cm_subsubsection, NO_BRACE_ARGS },
{ "subtitle", cm_titlepage_cmds, NO_BRACE_ARGS },
! { "summarycontents", cm_shortcontents, NO_BRACE_ARGS },
{ "syncodeindex", cm_synindex, NO_BRACE_ARGS },
{ "synindex", cm_synindex, NO_BRACE_ARGS },
--- 343,347 ----
{ "subsubsection", cm_subsubsection, NO_BRACE_ARGS },
{ "subtitle", cm_titlepage_cmds, NO_BRACE_ARGS },
! { "summarycontents", cm_contents, NO_BRACE_ARGS },
{ "syncodeindex", cm_synindex, NO_BRACE_ARGS },
{ "synindex", cm_synindex, NO_BRACE_ARGS },
Index: files.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/files.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** files.c 6 Dec 2003 01:33:21 -0000 1.1.1.1
--- files.c 8 Jan 2004 15:12:21 -0000 1.2
***************
*** 574,575 ****
--- 574,671 ----
return fname;
}
+
+ /* Delayed writing functions. A few of the commands
+ needs to be handled at the end, namely @contents,
+ @shortcontents, @printindex and @listoffloats.
+ These functions take care of that. */
+ static DELAYED_WRITE *delayed_writes = NULL;
+ int handling_delayed_writes = 0;
+
+ void
+ register_delayed_write (delayed_command)
+ char *delayed_command;
+ {
+ DELAYED_WRITE *new;
+
+ if (STREQ (current_output_filename, "-")
+ || FILENAME_CMP (current_output_filename, NULL_DEVICE) == 0
+ || FILENAME_CMP (current_output_filename, ALSO_NULL_DEVICE) == 0)
+ return;
+
+ flush_output ();
+
+ new = xmalloc (sizeof (DELAYED_WRITE));
+ new->command = xstrdup (delayed_command);
+ new->filename = xstrdup (current_output_filename);
+ new->position = output_position;
+ new->next = delayed_writes;
+ delayed_writes = new;
+ }
+
+ void
+ handle_delayed_writes ()
+ {
+ DELAYED_WRITE *temp = (DELAYED_WRITE *) reverse_list (delayed_writes);
+ int position_shift_amount, line_number_shift_amount;
+ char *delayed_buf;
+
+ handling_delayed_writes = 1;
+
+ while (temp)
+ {
+ delayed_buf = find_and_load (temp->filename);
+
+ /* FIXME provide feedback why we are returning. */
+ if (output_paragraph_offset > 0)
+ return;
+
+ if (!delayed_buf)
+ {
+ fs_error (temp->filename);
+ return;
+ }
+
+ output_stream = fopen (temp->filename, "w");
+ if (!output_stream)
+ {
+ fs_error (temp->filename);
+ return;
+ }
+
+ if (fwrite (delayed_buf, 1, temp->position, output_stream) !=
temp->position)
+ {
+ fs_error (temp->filename);
+ return;
+ }
+
+ {
+ 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;
+ }
+
+ if (fwrite (delayed_buf + temp->position, 1,
+ input_text_length - temp->position, output_stream)
+ != input_text_length - temp->position
+ || fclose (output_stream) != 0)
+ fs_error (temp->filename);
+
+ free (delayed_buf);
+ temp = temp->next;
+
+ /* Shift remaining delayed positions
+ by the length of this write. */
+ {
+ DELAYED_WRITE *future_write = temp;
+ while (future_write)
+ {
+ if (STREQ (temp->filename, future_write->filename))
+ future_write->position += position_shift_amount;
+ future_write = future_write->next;
+ }
+ }
+ }
+ }
Index: makeinfo.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/makeinfo.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** makeinfo.c 8 Jan 2004 00:15:45 -0000 1.28
--- makeinfo.c 8 Jan 2004 15:12:21 -0000 1.29
***************
*** 1771,1777 ****
validate_file (tag_table);
! /* If we need to output the table of contents, do it now. */
! if (contents_filename || shortcontents_filename)
! toc_update ();
if (splitting && !html && (!errors_printed || force))
--- 1771,1775 ----
validate_file (tag_table);
! handle_delayed_writes ();
if (splitting && !html && (!errors_printed || force))
***************
*** 2829,2834 ****
{
if (character == '\n')
! while (output_paragraph[output_paragraph_offset-1] == ' '
! || output_paragraph[output_paragraph_offset-1] == '\t')
output_paragraph_offset--;
--- 2827,2831 ----
{
if (character == '\n')
! while (whitespace (output_paragraph[output_paragraph_offset-1]))
output_paragraph_offset--;
Index: files.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/files.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** files.h 6 Dec 2003 01:33:21 -0000 1.1.1.1
--- files.h 8 Jan 2004 15:12:21 -0000 1.2
***************
*** 45,47 ****
--- 45,57 ----
extern char *normalize_filename ();
+ typedef struct delayed_write
+ {
+ struct delayed_write *next;
+ char *command;
+ char *filename;
+ int position;
+ } DELAYED_WRITE;
+
+ extern int handling_delayed_writes;
+
#endif /* !FILES_H */
Index: toc.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/toc.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** toc.h 6 Dec 2003 01:33:53 -0000 1.1.1.1
--- toc.h 8 Jan 2004 15:12:21 -0000 1.2
***************
*** 23,32 ****
#define TOC_H
- /* the file where we found the @contents directive */
- extern char *contents_filename;
-
- /* the file where we found the @shortcontents directive */
- extern char *shortcontents_filename;
-
/* Structure to hold one entry for the toc. */
typedef struct toc_entry_elt {
--- 23,26 ----
***************
*** 46,50 ****
extern char *toc_find_section_of_node ();
! extern void cm_contents (), cm_shortcontents ();
#endif /* not TOC_H */
--- 40,44 ----
extern char *toc_find_section_of_node ();
! extern void cm_contents ();
#endif /* not TOC_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/makeinfo cmds.c,1.17,1.18 files.c,1.1.1.1,1.2 makeinfo.c,1.28,1.29 files.h,1.1.1.1,1.2 toc.h,1.1.1.1,1.2,
dirt <=