From 007f372a86653605d72852e22dcd423d0276786c Mon Sep 17 00:00:00 2001
From: ru
Date: Wed, 18 Jun 2003 13:01:08 +0000
Subject: Removed files not present in v4.6 import.
---
contrib/texinfo/COPYING.DOC | 397 --------------------------------------------
1 file changed, 397 deletions(-)
delete mode 100644 contrib/texinfo/COPYING.DOC
(limited to 'contrib/texinfo')
diff --git a/contrib/texinfo/COPYING.DOC b/contrib/texinfo/COPYING.DOC
deleted file mode 100644
index 32a6b2f..0000000
--- a/contrib/texinfo/COPYING.DOC
+++ /dev/null
@@ -1,397 +0,0 @@
- GNU Free Documentation License
- Version 1.2, November 2002
-
-
- Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
-0. PREAMBLE
-
-The purpose of this License is to make a manual, textbook, or other
-functional and useful document "free" in the sense of freedom: to
-assure everyone the effective freedom to copy and redistribute it,
-with or without modifying it, either commercially or noncommercially.
-Secondarily, this License preserves for the author and publisher a way
-to get credit for their work, while not being considered responsible
-for modifications made by others.
-
-This License is a kind of "copyleft", which means that derivative
-works of the document must themselves be free in the same sense. It
-complements the GNU General Public License, which is a copyleft
-license designed for free software.
-
-We have designed this License in order to use it for manuals for free
-software, because free software needs free documentation: a free
-program should come with manuals providing the same freedoms that the
-software does. But this License is not limited to software manuals;
-it can be used for any textual work, regardless of subject matter or
-whether it is published as a printed book. We recommend this License
-principally for works whose purpose is instruction or reference.
-
-
-1. APPLICABILITY AND DEFINITIONS
-
-This License applies to any manual or other work, in any medium, that
-contains a notice placed by the copyright holder saying it can be
-distributed under the terms of this License. Such a notice grants a
-world-wide, royalty-free license, unlimited in duration, to use that
-work under the conditions stated herein. The "Document", below,
-refers to any such manual or work. Any member of the public is a
-licensee, and is addressed as "you". You accept the license if you
-copy, modify or distribute the work in a way requiring permission
-under copyright law.
-
-A "Modified Version" of the Document means any work containing the
-Document or a portion of it, either copied verbatim, or with
-modifications and/or translated into another language.
-
-A "Secondary Section" is a named appendix or a front-matter section of
-the Document that deals exclusively with the relationship of the
-publishers or authors of the Document to the Document's overall subject
-(or to related matters) and contains nothing that could fall directly
-within that overall subject. (Thus, if the Document is in part a
-textbook of mathematics, a Secondary Section may not explain any
-mathematics.) The relationship could be a matter of historical
-connection with the subject or with related matters, or of legal,
-commercial, philosophical, ethical or political position regarding
-them.
-
-The "Invariant Sections" are certain Secondary Sections whose titles
-are designated, as being those of Invariant Sections, in the notice
-that says that the Document is released under this License. If a
-section does not fit the above definition of Secondary then it is not
-allowed to be designated as Invariant. The Document may contain zero
-Invariant Sections. If the Document does not identify any Invariant
-Sections then there are none.
-
-The "Cover Texts" are certain short passages of text that are listed,
-as Front-Cover Texts or Back-Cover Texts, in the notice that says that
-the Document is released under this License. A Front-Cover Text may
-be at most 5 words, and a Back-Cover Text may be at most 25 words.
-
-A "Transparent" copy of the Document means a machine-readable copy,
-represented in a format whose specification is available to the
-general public, that is suitable for revising the document
-straightforwardly with generic text editors or (for images composed of
-pixels) generic paint programs or (for drawings) some widely available
-drawing editor, and that is suitable for input to text formatters or
-for automatic translation to a variety of formats suitable for input
-to text formatters. A copy made in an otherwise Transparent file
-format whose markup, or absence of markup, has been arranged to thwart
-or discourage subsequent modification by readers is not Transparent.
-An image format is not Transparent if used for any substantial amount
-of text. A copy that is not "Transparent" is called "Opaque".
-
-Examples of suitable formats for Transparent copies include plain
-ASCII without markup, Texinfo input format, LaTeX input format, SGML
-or XML using a publicly available DTD, and standard-conforming simple
-HTML, PostScript or PDF designed for human modification. Examples of
-transparent image formats include PNG, XCF and JPG. Opaque formats
-include proprietary formats that can be read and edited only by
-proprietary word processors, SGML or XML for which the DTD and/or
-processing tools are not generally available, and the
-machine-generated HTML, PostScript or PDF produced by some word
-processors for output purposes only.
-
-The "Title Page" means, for a printed book, the title page itself,
-plus such following pages as are needed to hold, legibly, the material
-this License requires to appear in the title page. For works in
-formats which do not have any title page as such, "Title Page" means
-the text near the most prominent appearance of the work's title,
-preceding the beginning of the body of the text.
-
-A section "Entitled XYZ" means a named subunit of the Document whose
-title either is precisely XYZ or contains XYZ in parentheses following
-text that translates XYZ in another language. (Here XYZ stands for a
-specific section name mentioned below, such as "Acknowledgements",
-"Dedications", "Endorsements", or "History".) To "Preserve the Title"
-of such a section when you modify the Document means that it remains a
-section "Entitled XYZ" according to this definition.
-
-The Document may include Warranty Disclaimers next to the notice which
-states that this License applies to the Document. These Warranty
-Disclaimers are considered to be included by reference in this
-License, but only as regards disclaiming warranties: any other
-implication that these Warranty Disclaimers may have is void and has
-no effect on the meaning of this License.
-
-
-2. VERBATIM COPYING
-
-You may copy and distribute the Document in any medium, either
-commercially or noncommercially, provided that this License, the
-copyright notices, and the license notice saying this License applies
-to the Document are reproduced in all copies, and that you add no other
-conditions whatsoever to those of this License. You may not use
-technical measures to obstruct or control the reading or further
-copying of the copies you make or distribute. However, you may accept
-compensation in exchange for copies. If you distribute a large enough
-number of copies you must also follow the conditions in section 3.
-
-You may also lend copies, under the same conditions stated above, and
-you may publicly display copies.
-
-
-3. COPYING IN QUANTITY
-
-If you publish printed copies (or copies in media that commonly have
-printed covers) of the Document, numbering more than 100, and the
-Document's license notice requires Cover Texts, you must enclose the
-copies in covers that carry, clearly and legibly, all these Cover
-Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
-the back cover. Both covers must also clearly and legibly identify
-you as the publisher of these copies. The front cover must present
-the full title with all words of the title equally prominent and
-visible. You may add other material on the covers in addition.
-Copying with changes limited to the covers, as long as they preserve
-the title of the Document and satisfy these conditions, can be treated
-as verbatim copying in other respects.
-
-If the required texts for either cover are too voluminous to fit
-legibly, you should put the first ones listed (as many as fit
-reasonably) on the actual cover, and continue the rest onto adjacent
-pages.
-
-If you publish or distribute Opaque copies of the Document numbering
-more than 100, you must either include a machine-readable Transparent
-copy along with each Opaque copy, or state in or with each Opaque copy
-a computer-network location from which the general network-using
-public has access to download using public-standard network protocols
-a complete Transparent copy of the Document, free of added material.
-If you use the latter option, you must take reasonably prudent steps,
-when you begin distribution of Opaque copies in quantity, to ensure
-that this Transparent copy will remain thus accessible at the stated
-location until at least one year after the last time you distribute an
-Opaque copy (directly or through your agents or retailers) of that
-edition to the public.
-
-It is requested, but not required, that you contact the authors of the
-Document well before redistributing any large number of copies, to give
-them a chance to provide you with an updated version of the Document.
-
-
-4. MODIFICATIONS
-
-You may copy and distribute a Modified Version of the Document under
-the conditions of sections 2 and 3 above, provided that you release
-the Modified Version under precisely this License, with the Modified
-Version filling the role of the Document, thus licensing distribution
-and modification of the Modified Version to whoever possesses a copy
-of it. In addition, you must do these things in the Modified Version:
-
-A. Use in the Title Page (and on the covers, if any) a title distinct
- from that of the Document, and from those of previous versions
- (which should, if there were any, be listed in the History section
- of the Document). You may use the same title as a previous version
- if the original publisher of that version gives permission.
-B. List on the Title Page, as authors, one or more persons or entities
- responsible for authorship of the modifications in the Modified
- Version, together with at least five of the principal authors of the
- Document (all of its principal authors, if it has fewer than five),
- unless they release you from this requirement.
-C. State on the Title page the name of the publisher of the
- Modified Version, as the publisher.
-D. Preserve all the copyright notices of the Document.
-E. Add an appropriate copyright notice for your modifications
- adjacent to the other copyright notices.
-F. Include, immediately after the copyright notices, a license notice
- giving the public permission to use the Modified Version under the
- terms of this License, in the form shown in the Addendum below.
-G. Preserve in that license notice the full lists of Invariant Sections
- and required Cover Texts given in the Document's license notice.
-H. Include an unaltered copy of this License.
-I. Preserve the section Entitled "History", Preserve its Title, and add
- to it an item stating at least the title, year, new authors, and
- publisher of the Modified Version as given on the Title Page. If
- there is no section Entitled "History" in the Document, create one
- stating the title, year, authors, and publisher of the Document as
- given on its Title Page, then add an item describing the Modified
- Version as stated in the previous sentence.
-J. Preserve the network location, if any, given in the Document for
- public access to a Transparent copy of the Document, and likewise
- the network locations given in the Document for previous versions
- it was based on. These may be placed in the "History" section.
- You may omit a network location for a work that was published at
- least four years before the Document itself, or if the original
- publisher of the version it refers to gives permission.
-K. For any section Entitled "Acknowledgements" or "Dedications",
- Preserve the Title of the section, and preserve in the section all
- the substance and tone of each of the contributor acknowledgements
- and/or dedications given therein.
-L. Preserve all the Invariant Sections of the Document,
- unaltered in their text and in their titles. Section numbers
- or the equivalent are not considered part of the section titles.
-M. Delete any section Entitled "Endorsements". Such a section
- may not be included in the Modified Version.
-N. Do not retitle any existing section to be Entitled "Endorsements"
- or to conflict in title with any Invariant Section.
-O. Preserve any Warranty Disclaimers.
-
-If the Modified Version includes new front-matter sections or
-appendices that qualify as Secondary Sections and contain no material
-copied from the Document, you may at your option designate some or all
-of these sections as invariant. To do this, add their titles to the
-list of Invariant Sections in the Modified Version's license notice.
-These titles must be distinct from any other section titles.
-
-You may add a section Entitled "Endorsements", provided it contains
-nothing but endorsements of your Modified Version by various
-parties--for example, statements of peer review or that the text has
-been approved by an organization as the authoritative definition of a
-standard.
-
-You may add a passage of up to five words as a Front-Cover Text, and a
-passage of up to 25 words as a Back-Cover Text, to the end of the list
-of Cover Texts in the Modified Version. Only one passage of
-Front-Cover Text and one of Back-Cover Text may be added by (or
-through arrangements made by) any one entity. If the Document already
-includes a cover text for the same cover, previously added by you or
-by arrangement made by the same entity you are acting on behalf of,
-you may not add another; but you may replace the old one, on explicit
-permission from the previous publisher that added the old one.
-
-The author(s) and publisher(s) of the Document do not by this License
-give permission to use their names for publicity for or to assert or
-imply endorsement of any Modified Version.
-
-
-5. COMBINING DOCUMENTS
-
-You may combine the Document with other documents released under this
-License, under the terms defined in section 4 above for modified
-versions, provided that you include in the combination all of the
-Invariant Sections of all of the original documents, unmodified, and
-list them all as Invariant Sections of your combined work in its
-license notice, and that you preserve all their Warranty Disclaimers.
-
-The combined work need only contain one copy of this License, and
-multiple identical Invariant Sections may be replaced with a single
-copy. If there are multiple Invariant Sections with the same name but
-different contents, make the title of each such section unique by
-adding at the end of it, in parentheses, the name of the original
-author or publisher of that section if known, or else a unique number.
-Make the same adjustment to the section titles in the list of
-Invariant Sections in the license notice of the combined work.
-
-In the combination, you must combine any sections Entitled "History"
-in the various original documents, forming one section Entitled
-"History"; likewise combine any sections Entitled "Acknowledgements",
-and any sections Entitled "Dedications". You must delete all sections
-Entitled "Endorsements".
-
-
-6. COLLECTIONS OF DOCUMENTS
-
-You may make a collection consisting of the Document and other documents
-released under this License, and replace the individual copies of this
-License in the various documents with a single copy that is included in
-the collection, provided that you follow the rules of this License for
-verbatim copying of each of the documents in all other respects.
-
-You may extract a single document from such a collection, and distribute
-it individually under this License, provided you insert a copy of this
-License into the extracted document, and follow this License in all
-other respects regarding verbatim copying of that document.
-
-
-7. AGGREGATION WITH INDEPENDENT WORKS
-
-A compilation of the Document or its derivatives with other separate
-and independent documents or works, in or on a volume of a storage or
-distribution medium, is called an "aggregate" if the copyright
-resulting from the compilation is not used to limit the legal rights
-of the compilation's users beyond what the individual works permit.
-When the Document is included an aggregate, this License does not
-apply to the other works in the aggregate which are not themselves
-derivative works of the Document.
-
-If the Cover Text requirement of section 3 is applicable to these
-copies of the Document, then if the Document is less than one half of
-the entire aggregate, the Document's Cover Texts may be placed on
-covers that bracket the Document within the aggregate, or the
-electronic equivalent of covers if the Document is in electronic form.
-Otherwise they must appear on printed covers that bracket the whole
-aggregate.
-
-
-8. TRANSLATION
-
-Translation is considered a kind of modification, so you may
-distribute translations of the Document under the terms of section 4.
-Replacing Invariant Sections with translations requires special
-permission from their copyright holders, but you may include
-translations of some or all Invariant Sections in addition to the
-original versions of these Invariant Sections. You may include a
-translation of this License, and all the license notices in the
-Document, and any Warrany Disclaimers, provided that you also include
-the original English version of this License and the original versions
-of those notices and disclaimers. In case of a disagreement between
-the translation and the original version of this License or a notice
-or disclaimer, the original version will prevail.
-
-If a section in the Document is Entitled "Acknowledgements",
-"Dedications", or "History", the requirement (section 4) to Preserve
-its Title (section 1) will typically require changing the actual
-title.
-
-
-9. TERMINATION
-
-You may not copy, modify, sublicense, or distribute the Document except
-as expressly provided for under this License. Any other attempt to
-copy, modify, sublicense or distribute the Document is void, and will
-automatically terminate your rights under this License. However,
-parties who have received copies, or rights, from you under this
-License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-
-10. FUTURE REVISIONS OF THIS LICENSE
-
-The Free Software Foundation may publish new, revised versions
-of the GNU Free Documentation License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns. See
-http://www.gnu.org/copyleft/.
-
-Each version of the License is given a distinguishing version number.
-If the Document specifies that a particular numbered version of this
-License "or any later version" applies to it, you have the option of
-following the terms and conditions either of that specified version or
-of any later version that has been published (not as a draft) by the
-Free Software Foundation. If the Document does not specify a version
-number of this License, you may choose any version ever published (not
-as a draft) by the Free Software Foundation.
-
-
-ADDENDUM: How to use this License for your documents
-
-To use this License in a document you have written, include a copy of
-the License in the document and put the following copyright and
-license notices just after the title page:
-
- Copyright (c) YEAR YOUR NAME.
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.2
- or any later version published by the Free Software Foundation;
- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
- A copy of the license is included in the section entitled "GNU
- Free Documentation License".
-
-If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
-replace the "with...Texts." line with this:
-
- with the Invariant Sections being LIST THEIR TITLES, with the
- Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
-
-If you have Invariant Sections without Cover Texts, or some other
-combination of the three, merge those two alternatives to suit the
-situation.
-
-If your document contains nontrivial examples of program code, we
-recommend releasing these examples in parallel under your choice of
-free software license, such as the GNU General Public License,
-to permit their use in free software.
--
cgit v1.1
From 212fa58b27874a1ac997e85e3f696ffad810e44c Mon Sep 17 00:00:00 2001
From: ru
Date: Mon, 23 May 2005 10:46:22 +0000
Subject: Import of stripped down GNU texinfo 4.8
---
contrib/texinfo/AUTHORS | 13 +-
contrib/texinfo/ChangeLog | 14597 ++++++++------------------------
contrib/texinfo/ChangeLog.46 | 12516 +++++++++++++++++++++++++++
contrib/texinfo/INSTALL | 26 +-
contrib/texinfo/INTRODUCTION | 2 +-
contrib/texinfo/NEWS | 108 +-
contrib/texinfo/README | 7 +-
contrib/texinfo/README.dev | 44 +
contrib/texinfo/TODO | 135 +-
contrib/texinfo/config.h.in | 92 +-
contrib/texinfo/doc/README | 2 +-
contrib/texinfo/doc/info-stnd.texi | 81 +-
contrib/texinfo/doc/info.1 | 28 +-
contrib/texinfo/doc/info.5 | 2 +-
contrib/texinfo/doc/info.texi | 369 +-
contrib/texinfo/doc/infokey.1 | 41 +
contrib/texinfo/doc/install-info.1 | 20 +-
contrib/texinfo/doc/makeinfo.1 | 35 +-
contrib/texinfo/doc/texindex.1 | 10 +-
contrib/texinfo/doc/texinfo.5 | 2 +-
contrib/texinfo/doc/texinfo.txi | 8507 +++++++++++--------
contrib/texinfo/doc/version-stnd.texi | 8 +-
contrib/texinfo/doc/version.texi | 8 +-
contrib/texinfo/info/README | 2 +-
contrib/texinfo/info/dir.c | 28 +-
contrib/texinfo/info/display.c | 115 +-
contrib/texinfo/info/display.h | 19 +-
contrib/texinfo/info/doc.c | 224 +-
contrib/texinfo/info/doc.h | 32 +-
contrib/texinfo/info/dribble.c | 11 +-
contrib/texinfo/info/dribble.h | 8 +-
contrib/texinfo/info/echo-area.c | 155 +-
contrib/texinfo/info/echo-area.h | 53 +-
contrib/texinfo/info/filesys.c | 85 +-
contrib/texinfo/info/filesys.h | 28 +-
contrib/texinfo/info/footnotes.c | 25 +-
contrib/texinfo/info/footnotes.h | 6 +-
contrib/texinfo/info/funs.h | 224 +-
contrib/texinfo/info/gc.c | 13 +-
contrib/texinfo/info/gc.h | 8 +-
contrib/texinfo/info/indices.c | 83 +-
contrib/texinfo/info/indices.h | 19 +-
contrib/texinfo/info/info-utils.c | 197 +-
contrib/texinfo/info/info-utils.h | 41 +-
contrib/texinfo/info/info.c | 100 +-
contrib/texinfo/info/info.h | 20 +-
contrib/texinfo/info/infodoc.c | 161 +-
contrib/texinfo/info/infokey.c | 160 +-
contrib/texinfo/info/infokey.h | 2 +-
contrib/texinfo/info/infomap.c | 154 +-
contrib/texinfo/info/infomap.h | 13 +-
contrib/texinfo/info/key.c | 4 +-
contrib/texinfo/info/m-x.c | 21 +-
contrib/texinfo/info/man.c | 83 +-
contrib/texinfo/info/man.h | 18 +-
contrib/texinfo/info/nodemenu.c | 38 +-
contrib/texinfo/info/nodes.c | 155 +-
contrib/texinfo/info/nodes.h | 17 +-
contrib/texinfo/info/search.c | 108 +-
contrib/texinfo/info/search.h | 30 +-
contrib/texinfo/info/session.c | 649 +-
contrib/texinfo/info/session.h | 193 +-
contrib/texinfo/info/signals.c | 62 +-
contrib/texinfo/info/signals.h | 11 +-
contrib/texinfo/info/termdep.h | 2 +-
contrib/texinfo/info/terminal.c | 67 +-
contrib/texinfo/info/terminal.h | 40 +-
contrib/texinfo/info/tilde.c | 26 +-
contrib/texinfo/info/tilde.h | 12 +-
contrib/texinfo/info/variables.c | 20 +-
contrib/texinfo/info/variables.h | 11 +-
contrib/texinfo/info/window.c | 132 +-
contrib/texinfo/info/window.h | 82 +-
contrib/texinfo/lib/README | 2 +-
contrib/texinfo/lib/gettext.h | 17 +-
contrib/texinfo/lib/substring.c | 10 +-
contrib/texinfo/lib/system.h | 93 +-
contrib/texinfo/lib/xalloc.h | 103 +-
contrib/texinfo/lib/xexit.c | 7 +-
contrib/texinfo/lib/xmalloc.c | 41 +-
contrib/texinfo/lib/xstrdup.c | 13 +-
contrib/texinfo/makeinfo/README | 2 +-
contrib/texinfo/makeinfo/cmds.c | 1012 ++-
contrib/texinfo/makeinfo/cmds.h | 168 +-
contrib/texinfo/makeinfo/defun.c | 396 +-
contrib/texinfo/makeinfo/defun.h | 6 +-
contrib/texinfo/makeinfo/files.c | 407 +-
contrib/texinfo/makeinfo/files.h | 45 +-
contrib/texinfo/makeinfo/float.c | 430 +
contrib/texinfo/makeinfo/float.h | 56 +
contrib/texinfo/makeinfo/footnote.c | 58 +-
contrib/texinfo/makeinfo/footnote.h | 13 +-
contrib/texinfo/makeinfo/html.c | 591 +-
contrib/texinfo/makeinfo/html.h | 32 +-
contrib/texinfo/makeinfo/index.c | 432 +-
contrib/texinfo/makeinfo/index.h | 65 +-
contrib/texinfo/makeinfo/insertion.c | 1076 ++-
contrib/texinfo/makeinfo/insertion.h | 46 +-
contrib/texinfo/makeinfo/lang.c | 393 +-
contrib/texinfo/makeinfo/lang.h | 66 +-
contrib/texinfo/makeinfo/macro.c | 146 +-
contrib/texinfo/makeinfo/macro.h | 38 +-
contrib/texinfo/makeinfo/makeinfo.c | 1705 ++--
contrib/texinfo/makeinfo/makeinfo.h | 116 +-
contrib/texinfo/makeinfo/multi.c | 513 +-
contrib/texinfo/makeinfo/multi.h | 28 +
contrib/texinfo/makeinfo/node.c | 334 +-
contrib/texinfo/makeinfo/node.h | 28 +-
contrib/texinfo/makeinfo/sectioning.c | 406 +-
contrib/texinfo/makeinfo/sectioning.h | 61 +-
contrib/texinfo/makeinfo/toc.c | 286 +-
contrib/texinfo/makeinfo/toc.h | 17 +-
contrib/texinfo/makeinfo/xml.c | 1915 +++--
contrib/texinfo/makeinfo/xml.h | 113 +-
contrib/texinfo/makeinfo/xref.c | 620 ++
contrib/texinfo/makeinfo/xref.h | 30 +
contrib/texinfo/util/README | 2 +-
contrib/texinfo/util/install-info.c | 295 +-
contrib/texinfo/util/texindex.c | 241 +-
119 files changed, 31792 insertions(+), 21102 deletions(-)
create mode 100644 contrib/texinfo/ChangeLog.46
create mode 100644 contrib/texinfo/README.dev
create mode 100644 contrib/texinfo/doc/infokey.1
create mode 100644 contrib/texinfo/makeinfo/float.c
create mode 100644 contrib/texinfo/makeinfo/float.h
create mode 100644 contrib/texinfo/makeinfo/multi.h
create mode 100644 contrib/texinfo/makeinfo/xref.c
create mode 100644 contrib/texinfo/makeinfo/xref.h
(limited to 'contrib/texinfo')
diff --git a/contrib/texinfo/AUTHORS b/contrib/texinfo/AUTHORS
index 1c5bfad..ce8ee85 100644
--- a/contrib/texinfo/AUTHORS
+++ b/contrib/texinfo/AUTHORS
@@ -1,26 +1,31 @@
-$Id: AUTHORS,v 1.5 2003/05/08 00:51:55 karl Exp $
+$Id: AUTHORS,v 1.10 2004/04/11 17:56:45 karl Exp $
Texinfo authors.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
Akim Demaille texi2dvi.
+Alper Ersoy makeinfo: enhancements in all files, especially
+ html-, xml-, and docbook-related.
Andreas Schwab texinfo.tex, configure.ac, most makeinfo files.
Bob Chassell texinfo.tex, original texinfo.txi.
Brian Fox all makeinfo/* and info/* files, info-stnd.texi.
Dave Love original makeinfo/html.[ch].
Eli Zaretskii all files.
Karl Berry all files.
+Karl Heinz Marbaise original makeinfo language support, most files.
Noah Friedman original texi2dvi.
Paul Rubin original makeinfo/multi.c.
Philippe Martin original makeinfo xml/docbook output.
Richard Stallman original texinfo.tex, install-info.c,
texindex.c, texinfo.txi.
-Zack Weinberg texinfo.tex (@macro implementation).
+Zack Weinberg texinfo.tex: @macro implementation.
See http://www.iro.umontreal.ca/contrib/po/HTML/team-LL.html for the
translation teams for a given language LL.
-Many files included in Texinfo distribution are copied from other
-locations. See util/srclist*.
+Many files included in the Texinfo distribution are copied from other
+locations, no author information is given for those. See util/srclist*.
diff --git a/contrib/texinfo/ChangeLog b/contrib/texinfo/ChangeLog
index fbbaff6..7c53a09 100644
--- a/contrib/texinfo/ChangeLog
+++ b/contrib/texinfo/ChangeLog
@@ -1,12504 +1,4999 @@
-2003-06-10
-
- * version 4.6.
-
-2003-06-04
-
- * config.sub: update from gnulib.
-
-2003-06-03
-
- * mkinstalldirs: update from gnulib.
-
-2003-06-02 Akim Demaille
+2004-12-31 Karl Berry
- * util/texi2dvi (tex_envvars): New.
- Use it to forward -I directories to BIBINPUTS and BSTINPUTS, in
- addition of INDEXSTYLE and TEXINPUTS.
+ * Version 4.8.
-2003-06-02
+2004-12-21 Karl Berry
- * makeinfo/html.c (html_output_head): don't output the , to
- avoid having mozilla put up a document navigation bar when
- we don't have anything else to support it yet. Report from:
- Per Bothner.
- * makeinfo/makeinfo.c: no need to declare add_link or
- add_escaped_anchor_name, since they are not used.
+ * pretest version 4.7.94.
- * doc/texinfo.txi (Contents): recommend @contents at the beginning
- more strongly. Suggestions from Kevin Ryde.
+ * makeinfo/xref.c: doc fix.
-2003-06-01
+2004-12-20 Karl Berry
- * makeinfo/macro.c (apply): make \\ expand to \ even if the macro
- has no arguments. Report from: Jesper Harder ,
- 31 May 2003 02:56:20 +0200.
+ * makeinfo/html.c (cm_node) : need old-style names in the normal
+ (not no_headers) html case, too, of course.
+ (add_html_names): canon_white the new name, too.
-2003-05-31
+2004-12-19 Karl Berry
- * util/dir-example (C++ libraries): new category, suggested by Bruno.
+ * pretest version 4.7.93.
-2003-05-29
+ * automake 1.9.4.
- * configure.ac: pretest version 4.5.93.
+ * makeinfo/xml.c (try_docbook_image): new fn.
+ (xml_insert_docbook_image): call it, trying additional formats
+ pdf, svg, etc.
+ * makeinfo/makeinfo.c (cm_image): check for gif too.
+ http://www.gnu.org/philosophy/gif.html says:
+ "we can and will include support for displaying GIF files in GNU
+ software." Leaving it undocumented, though.
+ Based on patch from Jens Elkner, 18 Dec 2004 01:56:28 +0100.
-2003-05-29 gettextize
+2004-12-19 Torsten Bronger
- * configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.12.1.
+ * util/texinfo.dtd: define most entities, add .
-2003-05-26
+2004-12-17 Juan M. Guerrero
- * util/texi2dvi: spurious \ in tex_args assignment.
+ * djgpp/config.bat: remove files like coXXXXXX.tmp created
+ in the top_srcdir by the gl_FUNC_MKSTEMP test.
- * doc/texinfo.txi (Contents): trim excess words.
+2004-12-15 Karl Berry
-2003-05-25
+ * pretest version 4.7.92.
- * util/texi2dvi: extra quotes for the tex_args assignment in
- --batch mode.
+ * util/texinfo.dtd: merge with makeinfo/texinfo.dtd.
+ * makeinfo/texinfo.dtd, makeinfo/texinfo.xsl: remove.
-2003-05-19
+2004-12-15 Stepan Kasal
- * lib/xexit.c: translate fflush error messages, add newlines
- (report from Jim Meyering).
- * util/{texindex.c,install-info.c},
- * makeinfo/makeinfo.c,
- * info/info.c: use xexit again, with redundant return to avoid
- warnings.
+ * Makefile.am (EXTRA_DIST): Removed po/Makevars.template, sorry.
-2003-05-18
+2004-12-15 Juan M. Guerrero
- * lib/xexit.c (xexit): fputs not fprintf, so we get newline;
- translate the messages, too. Report from Jim Meyering.
+ * djgpp/config.sed: adjust for new autoconf.
+ * makeinfo/node.c (enumerate_filename): make dos_file_names const
+ instead of static, since it may involve a fn call to pathconf.
- * util/dir-example: move gcc/automake entries.
+2004-12-15 Karl Berry
- * pretest version 4.5.92.
+ * Makefile.am (EXTRA_DIST): include ChangeLog.46, README.dev,
+ and po/Makevars.template. From Stepan.
- * update to automake 1.7.5.
+2004-12-14 Karl Berry
- * makeinfo/html.c (append_char): forgot to increment length, duh.
- Report from: "Torsten Bronger" ,
- 18 May 2003 14:36:23 +0200.
+ * doc/texinfo.txi (inforef): try to explain possible uses more
+ thoroughly.
+ From: Luc Teirlinck, 13 Dec 2004 21:45:58 -0600.
-2003-05-17
+ * doc/texinfo.txi (pxref): more explanation.
+ * doc/info-stnd.texi (Basic Windows): put pxref in parens.
+ help-texinfo mail from adl, 13 Dec 2004 17:07:50 +0100.
- * makeinfo/makeinfo.c (defining_copying): new fn.
- (add_char): call it, when testing if we should
- call html_output_head.
- Report from: Torsten Bronger ,
- 17 May 2003 22:10:42 +0200.
+2004-12-13 Andreas Schwab
- * configure.ac: pretest version 4.5.91.
+ * info/echo-area.c (DECLARE_INFO_COMMAND): Add intermediate cast
+ to avoid warning.
+ * info/infokey.c (compile): Likewise.
+ * info/session.c (forward_move_node_structure): Likewise.
+ (DECLARE_INFO_COMMAND): Likewise.
-2003-05-16
+ * makeinfo/makeinfo.c (init_paragraph): Don't use free_and_clear
+ to avoid strict aliasing issue.
- * makeinfo/index.c (sort_index): don't deref NULL. Report from Jan.
+ * makeinfo/cmds.c (cm_center): Avoid strict aliasing issue.
-2003-05-13
+2004-12-13 Karl Berry
- * makeinfo/html.c (append_char): appease sgi compiler.
- * makeinfo/html.c (insert_html_tag): remove spurious arg to pop_tag,
- From: ezra peisach , 13
- May 2003 12:13:40 -0400.
+ * doc/texinfo.txi (HTML Cross-reference Command Expansion): add
+ @euro{} -> U+20AC. texinfo-pretest mail from Patrice,
+ 12 Dec 2004 23:49:50 +0100.
- Fix a few GCC warnings, reported by Jim Meyering:
+2004-12-12 Karl Berry
- * info/nodes.c: parenthesize assignment used as truth value.
- * info/nodemenu.c (format_node_info): strcpy instead of sprintf,
- since there's no format.
- * makeinfo/makeinfo.c (isolate_nodename): remove spurious decl.
- * makeinfo/xml.c (xml_insert_indexterm): declare as void.
- * info/key.c: initialize with 0,0 at end.
- * info/infokey.c (main): return instead of xexit, and remove
- unused variable.
- * makeinfo/html.c (init_buffer): forgot to return buf.
- * info/info.c (remember_info_program_name): remove spurious
- declaration.
-
- * makeinfo/sectioning.c,
- * info/infomap.c: remove unused variables.
-
- * makeinfo/makeinfo.c (insert_toplevel_subdirectory),
- * info/man.c,
- * info/infodoc.c (info_find_or_create_help_window): parenthesize
- && within ||.
- * info/display.c (display_update_one_window): initialize rep to
- NULL, parenthesize && within ||.
-
- * util/install-info.c,
- * info/info.c (main),
- * info/makedoc.c (main): return instead of xexit.
+ * doc/texinfo.txi (makeinfo options): don't be so suggestive about
+ skipping xref validation.
+ emacs-devel mail from: Luc Teirlinck, 12 Dec 2004 13:02:11 -0600.
-2003-05-13 Akim Demaille
+2004-12-08 Karl Berry
- * util/texi2dvi (get_xref_files): Pass --file-line-error-style
- to TeX when supported.
+ * pretest version 4.7.91.
-2003-05-12
+ * info/echo-area.c, info/infokey.c, info/session.c: omit useless
+ casts to intptr_t, since we're just casting to (void *) next.
+ intptr_t is not defined with gcc 3.04 on Tru64 Unix V5.1
+ (This whole vararg stuff needs to be redone correctly.)
+ Report from: Svend Tollak Munkejord (via te)
+ 8 Dec 2004 17:15:17 +0100.
- * configure.ac: pretest version 4.5.90.
+ * doc/texinfo.txi (ref): rewrite last two redundant paragraphs.
- * Makefile.am (EXTRA_DIST): add onceonly.m4.
+2004-12-07 Karl Berry
- * makeinfo/tests/accentenc: must discard stderr since we expect
- two errors in this case.
+ * doc/texinfo.txi (Macro Details): document @c kludge in macro
+ definitions to work around some newline problems. (From Werner.)
- * makeinfo/makeinfo.c (main): new option --css-include.
- (usage): add to --help message.
- * makeinfo/makeinfo.h (css_include): new global.
- * makeinfo/html.c (append_char, process_css_file): new fns
- implementing it.
- (html_output_head): call it.
- * doc/texinfo.txi (HTML CSS): new node describing it.
- Also split up the Generating HTML node into subnodes.
+2004-12-05 Karl Berry
- * config.{guess,sub}: update from gnulib.
+ * makeinfo/html.c (add_escaped_anchor_name): prefix g_t if the
+ nodename begins with a nonletter. Ugh.
+ * doc/texinfo.txi (HTML Xref Node Name Expansion): document this.
+ http://ff0.org/pipermail/texinfo-pretest/2004-December/000210.html
+
+ * doc/texinfo.txi (HTML Xref 8-bit Character Expansion): define
+ behavior for Unicode code points above 0xfff.
-2003-05-10
+ * makeinfo/makeinfo.c (reader_loop): didn't make it into
+ HTML 4, remove it. Sigh.
+ texinfo-pretest mail from wl, 05 Dec 2004 23:39:05 +0100.
- * makeinfo/index.c (sort_index): allocate the sorted index in new
- memory, and set the original index to that, to avoid problems with
- @printindex being called twice on the same index.
- (cm_printindex): do not free the returned index.
- Report from: Dumas Patrice , 9 May 2003
- 15:12:21 +0200.
+2004-12-02 Karl Berry
-2003-05-09
+ * configure.ac (install-warnings): simplify default case. From te.
- * makeinfo/defun.c (cm_defun): issue error message without extra
- x's. Report from: Dumas Patrice , 9 May
- 2003 17:24:25 +0200.
+2004-12-01 Karl Berry
-2003-05-07 Akim Demaille
+ * pretest version 4.7.90.
- * util/texi2dvi (textra_cmd): New.
- (textra): Escape escapes from sed's evaluation.
- Use them to support additional TeX/LaTeX commands.
- Support --command as a synonym for --texinfo.
+ * util/texi2dvi (recode): new option, off by default.
+ Unconditionally calling recode seems problematic, when there
+ hasn't been a release for years and its Texinfo support is less than
+ perfect.
-2003-05-06
+2004-11-30 Karl Berry
- * util/dir-example: finish getting rid of GNU packages.
+ * doc/texinfo.txi (Quotations and Examples): @quotation does not
+ reduce interparagraph spacing.
+
+ * makeinfo/node.c (cm_node) : do not bother calling
+ add_html_nodes in the split case, the filename is wrong.
-2003-05-04
+2004-11-29 Karl Berry
- * doc/texinfo.tex (\itemizey): if no arg to @itemize, default to
- @bullet. Fix from: Stepan Kasal 2 May 2003
- 09:32:11 +0200, report from: Jesper Harder .
+ Support for writing using the old-style node name
+ to HTML name conversion, to keep the gcc folks happy.
+ * makeinfo/node.c (add_html_names): new routine, factoring out
+ common code (plus new code) from cm_node.
+ (cm_node) : call it.
+ * makeinfo/makeinfo.h (OLD_HTML_SAFE, OLD_URL_SAFE_CHAR):
+ (re)define these.
+ * makeinfo/html.c (add_escaped_anchor_name): take new argument to
+ optionally output the old-style conversion.
+ (add_anchor_name): change call.
+ * index.c: change calls.
+ * makeinfo/html.h (add_escaped_anchor_name): change decl.
-2003-04-30
+2004-11-26 Karl Berry
- * makeinfo/.gdbinit: no colon on local variables.
+ * makeinfo/makeinfo.c (reader_loop): allow after —
- * doc/texinfo.txi (documentencoding): Document new Info output feature.
- makeinfo/lang.h (encoding_type): rename `ecname' member to `encname'.
- makeinfo/html.c, lang.c: change usage.
- makeinfo/lang.c (cm_documentencoding): fix typo in warning.
- makeinfo/makeinfo.h (SPLIT_SIZE_THRESHOLD): remove.
- (info_trailer): declare.
- makeinfo/makeinfo.c (info_trailer): new fn to generate Local
- Variables: section if --enable-encoding and
- @documentencoding are given.
- (convert_from_loaded_file): call it.
- * makeinfo/node.c (split_file): write trailer into each split
- file. Also, simply split files if file size is less than
- --split-size, removing SPLIT_SIZE_THRESHOLD.
-
- * doc/texinfo.tex: remove trailing whitespace.
-
-2003-04-29
-
- * makeinfo/node.c (cm_anchor): normalize_node_name so that an
- anchor named "TOP" or "top" or whatever is not allowed. Report
- from: Dumas Patrice , 29 Apr 2003 18:56:51
- +0200.
+2004-11-25 Karl Berry
-2003-04-28
+ * doc/texinfo.txi (Fonts): document new command @sansserif.
+ * doc/texinfo.tex (\sansserif): new command.
+ * makeinfo/cmds.h (cm_sansserif): new cmd.
+ * makeinfo/cmds.c (cm_sansserif): new cmd.
+ (command_table): add it.
+ * makeinfo/texinfo.dtd (Inline.fonts): add it; also slanted.
+ * makeinfo/xml.h (SANSSERIF, SLANTED): define these new elements.
+ * makeinfo/xml.c (texinfoml_element_list): add them.
+ From: Frank Küster, 21 Oct 2004 23:27:33 +0200, Debian bug#277754.
- * makeinfo/makeinfo.c: whitespace cleanup.
+ * doc/texinfo.txi (Quotations and Examples, end titlepage): state
+ that there must be only one space between the @end and its
+ argument. Report from: christoph.sobotka, 26 Oct 2004 22:04:03 +0200.
- * doc/texinfo.tex (\doprintindex): don't \kern-\parindent, it makes
- the first index entry stick out to the left.
- Report from: Jesper Harder ,
- 28 Apr 2003 03:10:36 +0200.
+2004-11-22 Karl Berry
- From Akim Demaille :
- * makeinfo/makeinfo.c (cm_value): Warn for undefined flags.
+ * doc/texinfo.txi (euro): new node, documenting new command,
+ @euro{}, for the Euro currency symbol.
+ * doc/texinfo.tex (\euro): new command, along with \eurofont to
+ support it. The following extra font support is also related to
+ supporting @euro{}:
+ (\bfstylename): define this.
+ (\textnominalsize .. \ssecnominalsize): new macros.
+ (\textfonts .. \ssecfonts): define \curfontsize.
+ * makeinfo/cmds.c (command_table): add euro.
+ * makeinfo/lang.c (cm_special_char): handle euro.
+ (iso8859_15_map): new global.
-2003-04-27
+2004-11-18 Stepan Kasal
- * doc/texinfo.tex (\footnote, \smartitalicx): use \ptexslash
- for italic correction instead of \/, since we've redefined \/ now.
- Report from: Jesper Harder , 27 Apr 2003
- 23:30:29 +0200.
+ * doc/texinfo.tex (\ptexnewwrite): Save \newwrite.
+ (\newwrite): Call it.
- * util/dir-example (mailutils): more from Wojciech Polak.
- (autoconf): align/edit/sort entries.
+2004-11-17 Karl Berry
-2003-04-26
+ * configure.ac (install-warnings): new --enable option, requested
+ by te.
- * doc/texinfo.txi (Image Syntax): second and following @image args
- optional. Report from: Max Techter , 26 Apr 2003
- 15:50:02 +0200.
+2004-11-11 Karl Berry
- * util/dir-example (anubis): request from Wojciech Polak.
+ * texinfo.dtd (metainformation): add documentdescription.
+ (documentdescription): define.
+ * xml.h (DOCUMENTDESCRIPTION): new value for xml_element.
+ * xml.c (texinfoml_element_list): define documentdescription.
+ (docbook_element_list): likewise, but don't know how to handle it.
+ * cmds.c (cm_documentdescription): insert opening xml tag.
+ * insertion.c (end_insertion): insert closing xml tag.
-2003-04-25
+ * makeinfo/makeinfo.c (insert_string): declare const char * arg.
+ * makeinfo/makeinfo.h: likewise.
+ Report from: Vincent Lefevre, 20 Oct 2004 15:40:39 +0200,
+ noting a spurious after .
- * makeinfo/defun.c (defun_internal): whitespace needed in docbook
- output for deftype*. From: José Fonseca
- , 25 Apr 2003 13:07:13 +0100.
+2004-11-08 Karl Berry
-2003-04-21
+ * doc/texinfo.tex (\pdfmakeoutlines): in the first run through the
+ toc, define \thischapnum...\thissubsecnum as 0, rather than \empty.
+ This is so \expnumber doesn't end up trying to expand
+ \csname sec\empty\endcsname, i.e., \sec, which is the secant function.
+ Report from: Oliver Beck, help-texinfo, 8 Nov 2004 08:05:55 +0100.
- * doc/texinfo.tex (\dofirstparagraphindent): forgot to rename the
- \...word's.
- (\suppressfirstparagraphindent): forgot to rename
- to \dosuppress... Reported by Simon.
+2004-11-07 Karl Berry
-2003-04-20
+ * makeinfo/makeinfo.c (main) [LC_MESSAGES]: #ifdef the setlocale
+ using LC_MESSAGES. From te, 6 Nov 2004 23:36:10 +0100.
- * Installed changes from Simon for suppressing indentation on the
- first paragraph after section headings, and for new @indent command:
+2004-11-06 Karl Berry
- 2003-04-12 Simon Law
- * doc/texinfo.tex (\firstparagraphindent): implement suppression
- of the indentation of the first paragraph.
- (\dofirstparagraphindent): for parsing arguments.
- (\suppressfirstparagraphindent): suppress, or don't suppress.
- (\dosuppressfirstparagraphindent): the actual gobbling of indentation.
- (\footnote): Compensate for the hanging-indent side-effect.
- (\numhead, \apphead, \unnmhead): call \dosuppress...
- * makeinfo/cmds.c (command_table): add "firstparagraphindent"
- (as cm_firstparagraphindent)
- (set_firstparagraphindent, cm_firstparagraphindent): implement
- @firstparagraphindent parsing of options.
- * makeinfo/makeinfo.h: declare "do_first_par_indent".
- * makeinfo/sectioning.c (sectioning_underscore): suppress
- indentation if requested.
- * doc/texinfo.txi: document it.
+ * lib/Makefile.am (libtxi_a_SOURCES): add strdup.h.
+ Report from: Thomas Esser ,
+ 6 Nov 2004 18:11:51 +0100.
- * doc/texinfo.tex (\indent): override \indent primitive to
- clear \everypar.
- (\ptexindent): for saving/restoring \indent in @tex.
- (\footnote): Neutralise the effect of @indent
- within a footnote.
- * makeinfo/cmds.c (command_table): add "indent" (as cm_indent).
- (cm_indent): un-inhibit_paragraph_indentation.
- * doc/texinfo.txi: document it.
+2004-11-01 Karl Berry
- * doc/texinfo.txi (Conventions): remove spurious extra vertical space
- from bulleted itemize which starts with a quote.
+ * makeinfo/xref.c (cm_xref): don't include the external file name
+ in the HTML output, since it's pretty traditional not to
+ distinguish internal and external links in HTML, and it disturbs
+ the flow of reading.
+ From: Han-Wen Nienhuys , 31 Oct 2004 00:13:36 +0200.
+ (For lilypond.)
- * makeinfo/cmds.c (command_table): fix @novalidate definition.
+2004-10-31 Karl Berry
+ * doc/texinfo.tex (\setmultitablespacing): just let \multistrut be
+ the same as \strut. Its previous computation was wrong.
+ See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
- * Installed changes from Jan for @image support in Info format:
+2004-10-22 Stepan Kasal
- 2003-04-14 Jan Nieuwenhuizen
- * info/display.c (display_update_one_window): Skip new style
- image tag/cookie.
+ * info/Makefile.am (generated_sources): Add dependencies defining
+ a total order on the files, to prevent race conditions with
+ parallel make.
+ Move the code about generated sources to the end of the file.
- 2003-04-09 Jan Nieuwenhuizen
- * makeinfo/makeinfo.c (cm_image): Write ^@^H[image ...^@^H] tag.
+2004-10-20 Stepan Kasal
+ * info/Makefile.am (doc.c, key.c, funs.h): Don't distribute them.
+ of these three files.
+ (ginfo_SOURCES, nodist_ginfo_SOURCES): Move files.
+ (infokey_SOURCES, nodist_infokey_SOURCES): Likewise.
+ (DISTCLEANFILES): Include generated_sources.
- * makeinfo/html.c (html_output_head): use \n");
- }
-
- add_word ("\n\n");
-
- if (title && !html_title_written && titlepage_cmd_present)
- {
- add_word_args ("
");
+ else if (removed_empty_elt == 2)
+ add_html_block_elt_args ("\n
");
+ }
}
+
if (xml)
xml_insert_indexterm (index_entry, name);
}
/* The function which user defined index commands call. */
static void
-gen_index ()
+gen_index (void)
{
char *name = xstrdup (command);
if (strlen (name) >= strlen ("index"))
@@ -257,9 +275,7 @@ gen_index ()
/* Define an index known as NAME. We assign the slot number.
If CODE is nonzero, make this a code index. */
static void
-defindex (name, code)
- char *name;
- int code;
+defindex (char *name, int code)
{
int i, slot;
@@ -299,9 +315,7 @@ defindex (name, code)
/* Define an index NAME, implicitly @code if CODE is nonzero. */
static void
-top_defindex (name, code)
- char *name;
- int code;
+top_defindex (char *name, int code)
{
char *temp;
@@ -314,7 +328,7 @@ top_defindex (name, code)
/* Set up predefined indices. */
void
-init_indices ()
+init_indices (void)
{
int i;
@@ -364,9 +378,8 @@ init_indices ()
/* Given an index name, return the offset in the_indices of this index,
or -1 if there is no such index. */
-int
-translate_index (name)
- char *name;
+static int
+translate_index (char *name)
{
INDEX_ALIST *which = find_index (name);
@@ -378,8 +391,7 @@ translate_index (name)
/* Return the index list which belongs to NAME. */
INDEX_ELT *
-index_list (name)
- char *name;
+index_list (char *name)
{
int which = translate_index (name);
if (which < 0)
@@ -390,8 +402,7 @@ index_list (name)
/* Define a new index command. Arg is name of index. */
static void
-gen_defindex (code)
- int code;
+gen_defindex (int code)
{
char *name;
get_rest_of_line (0, &name);
@@ -413,13 +424,13 @@ gen_defindex (code)
}
void
-cm_defindex ()
+cm_defindex (void)
{
gen_defindex (0);
}
void
-cm_defcodeindex ()
+cm_defcodeindex (void)
{
gen_defindex (1);
}
@@ -428,7 +439,7 @@ cm_defcodeindex ()
Make the first one be a synonym for the second one, i.e. make the
first one have the same index as the second one. */
void
-cm_synindex ()
+cm_synindex (void)
{
int source, target;
char *abbrev1, *abbrev2;
@@ -446,8 +457,11 @@ cm_synindex ()
}
else
{
- name_index_alist[target]->write_index
- = name_index_alist[source]->write_index;
+ if (xml && !docbook)
+ xml_synindex (abbrev1, abbrev2);
+ else
+ name_index_alist[target]->write_index
+ = name_index_alist[source]->write_index;
}
free (abbrev1);
@@ -455,53 +469,53 @@ cm_synindex ()
}
void
-cm_pindex () /* Pinhead index. */
+cm_pindex (void) /* Pinhead index. */
{
index_add_arg ("pg");
}
void
-cm_vindex () /* Variable index. */
+cm_vindex (void) /* Variable index. */
{
index_add_arg ("vr");
}
void
-cm_kindex () /* Key index. */
+cm_kindex (void) /* Key index. */
{
index_add_arg ("ky");
}
void
-cm_cindex () /* Concept index. */
+cm_cindex (void) /* Concept index. */
{
index_add_arg ("cp");
}
void
-cm_findex () /* Function index. */
+cm_findex (void) /* Function index. */
{
index_add_arg ("fn");
}
void
-cm_tindex () /* Data Type index. */
+cm_tindex (void) /* Data Type index. */
{
index_add_arg ("tp");
}
int
-index_element_compare (element1, element2)
- INDEX_ELT **element1, **element2;
+index_element_compare (const void *element1, const void *element2)
{
- return index_compare_fn ((*element1)->entry, (*element2)->entry);
+ INDEX_ELT **elt1 = (INDEX_ELT **) element1;
+ INDEX_ELT **elt2 = (INDEX_ELT **) element2;
+
+ return index_compare_fn ((*elt1)->entry, (*elt2)->entry);
}
/* Force all index entries to be unique. */
-void
-make_index_entries_unique (array, count)
- INDEX_ELT **array;
- int count;
+static void
+make_index_entries_unique (INDEX_ELT **array, int count)
{
int i, j;
INDEX_ELT **copy;
@@ -560,9 +574,8 @@ make_index_entries_unique (array, count)
/* Sort the index passed in INDEX, returning an array of pointers to
elements. The array is terminated with a NULL pointer. */
-INDEX_ELT **
-sort_index (index)
- INDEX_ELT *index;
+static INDEX_ELT **
+sort_index (INDEX_ELT *index)
{
INDEX_ELT **array;
INDEX_ELT *temp;
@@ -641,38 +654,95 @@ sort_index (index)
return array;
}
+static void
+insert_index_output_line_no (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 + 1);
+
+ /* Do not translate ``(line NNN)'' below for !no_headers case (Info output),
+ because it's something like the ``* Menu'' strings. For plaintext output
+ it should be translated though. */
+ sprintf (out_line_no_str,
+ no_headers ? _("(line %*d)") : "(line %*d)",
+ output_line_number_len, line_number);
+
+ {
+ int i = output_paragraph_offset;
+ while (0 < i && output_paragraph[i-1] != '\n')
+ 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;
/* Takes one arg, a short name of an index to print.
Outputs a menu of the sorted elements of the index. */
void
-cm_printindex ()
+cm_printindex (void)
{
+ char *index_name;
+ get_rest_of_line (0, &index_name);
+
+ /* get_rest_of_line increments the line number by one,
+ so to make warnings/errors point to the correct line,
+ we decrement the line_number again. */
+ if (!handling_delayed_writes)
+ line_number--;
+
if (xml && !docbook)
{
- char *index_name;
- get_rest_of_line (0, &index_name);
xml_insert_element (PRINTINDEX, START);
insert_string (index_name);
xml_insert_element (PRINTINDEX, END);
}
+ else if (!handling_delayed_writes)
+ {
+ int command_len = sizeof ("@ ") + strlen (command) + strlen (index_name);
+ char *index_command = xmalloc (command_len + 1);
+
+ close_paragraph ();
+ if (docbook)
+ xml_begin_index ();
+
+ sprintf (index_command, "@%s %s", command, index_name);
+ register_delayed_write (index_command);
+ free (index_command);
+ }
else
{
int item;
INDEX_ELT *index;
INDEX_ELT *last_index = 0;
INDEX_ELT **array;
- char *index_name;
unsigned line_length;
char *line;
int saved_inhibit_paragraph_indentation = inhibit_paragraph_indentation;
int saved_filling_enabled = filling_enabled;
int saved_line_number = line_number;
char *saved_input_filename = input_filename;
-
- close_paragraph ();
- get_rest_of_line (0, &index_name);
+ unsigned output_line_number_len;
index = index_list (index_name);
if (index == (INDEX_ELT *)-1)
@@ -696,9 +766,17 @@ cm_printindex ()
xml_sort_index = 0;
close_paragraph ();
if (html)
- add_word_args ("
", index_name);
+ add_html_block_elt_args ("
",
+ index_name);
else if (!no_headers && !docbook)
- add_word ("* Menu:\n\n");
+ { /* Info. Add magic cookie for info readers (to treat this
+ menu differently), and the usual start-of-menu. */
+ add_char ('\0');
+ add_word ("\010[index");
+ add_char ('\0');
+ add_word ("\010]\n");
+ add_word ("* Menu:\n\n");
+ }
me_inhibit_expansion++;
@@ -706,11 +784,29 @@ cm_printindex ()
line_length = 100;
line = xmalloc (line_length);
+ {
+ char *max_output_line_number = (char *) xmalloc (25 * sizeof (char));
+
+ if (no_headers)
+ sprintf (max_output_line_number, "%d", output_line_number);
+ else
+ {
+ INDEX_ELT *tmp_entry = index;
+ unsigned tmp = 0;
+ for (tmp_entry = index; tmp_entry; tmp_entry = tmp_entry->next)
+ tmp = tmp_entry->output_line > tmp ? tmp_entry->output_line : tmp;
+ sprintf (max_output_line_number, "%d", tmp);
+ }
+
+ output_line_number_len = strlen (max_output_line_number);
+ free (max_output_line_number);
+ }
+
for (item = 0; (index = array[item]); item++)
{
/* A pathological document might have an index entry outside of any
node. Don't crash; try using the section name instead. */
- const char *index_node = index->node;
+ char *index_node = index->node;
line_number = index->defining_line;
input_filename = index->defining_file;
@@ -723,44 +819,39 @@ cm_printindex ()
line_error (_("Entry for index `%s' outside of any node"),
index_name);
if (html || !no_headers)
- index_node = _("(outside of any node)");
+ index_node = (char *) _("(outside of any node)");
}
if (html)
- /* fixme: html: we should use specific index anchors pointing
- to the actual location of the indexed position (but then we
- have to find something to wrap the anchor around). */
{
- if (last_index
- && STREQ (last_index->entry_text, index->entry_text))
- add_word (", "); /* Don't repeat the previous entry. */
- else
- {
- /* In the HTML case, the expanded index entry is not
- good for us, since it was expanded for non-HTML mode
- inside sort_index. So we need to HTML-escape and
- expand the original entry text here. */
- char *escaped_entry = xstrdup (index->entry_text);
- char *expanded_entry;
-
- /* expansion() doesn't HTML-escape the argument, so need
- to do it separately. */
- escaped_entry = escape_string (escaped_entry);
- expanded_entry = expansion (escaped_entry, index->code);
- add_word_args ("\n
%s: ", expanded_entry);
- free (escaped_entry);
- free (expanded_entry);
- }
+ /* For HTML, we need to expand and HTML-escape the
+ original entry text, at the same time. Consider
+ @cindex J@"urgen. We want Jüurgen. We can't
+ expand and then escape since we'll end up with
+ Jürgen. We can't escape and then expand
+ because then `expansion' will see J@"urgen, and
+ @"urgen is not a command. */
+ char *html_entry =
+ maybe_escaped_expansion (index->entry_text, index->code, 1);
+
+ add_html_block_elt_args ("\n
", index_node);
+
+ add_html_block_elt ("");
}
else if (xml && docbook)
{
@@ -806,7 +899,9 @@ cm_printindex ()
insert_string (line);
/* Make sure any non-macros in the node name are expanded. */
in_fixed_width_font++;
- execute_string ("%s.\n", index_node);
+ execute_string ("%s. ", index_node);
+ insert_index_output_line_no (index->output_line,
+ output_line_number_len);
in_fixed_width_font--;
}
else
@@ -815,40 +910,27 @@ cm_printindex ()
there's little sense in referring to them in the
index. Instead, output the number or name of the
section that corresponds to that node. */
- char *section_name = toc_find_section_of_node (index_node);
-
- sprintf (line, "%-*s ", number_sections ? 50 : 1, index->entry);
+ sprintf (line, "%-*s ", number_sections ? 46 : 1, index->entry);
line[strlen (index->entry)] = ':';
insert_string (line);
- if (section_name)
- {
- int idx = 0;
- unsigned ref_len = strlen (section_name) + 30;
-
- if (ref_len > line_length)
- {
- line_length = ref_len;
- line = xrealloc (line, line_length);
- }
-
- if (number_sections)
- {
- while (section_name[idx]
- && (isdigit (section_name[idx])
- || (idx && section_name[idx] == '.')))
- idx++;
- }
- if (idx)
- sprintf (line, " See %.*s.\n", idx, section_name);
- else
- sprintf (line, "\n See ``%s''.\n", section_name);
- insert_string (line);
+
+ if (strlen (index->section) > 0)
+ { /* We got your number. */
+ insert_string ((char *) _("See "));
+ insert_string (index->section);
}
else
- {
- insert_string (" "); /* force a blank */
- execute_string ("See node %s.\n", index_node);
+ { /* Sigh, index in an @unnumbered. :-\ */
+ insert_string ("\n ");
+ insert_string ((char *) _("See "));
+ insert_string ("``");
+ insert_string (expansion (index->section_name, 0));
+ insert_string ("''");
}
+
+ insert_string (". ");
+ insert_index_output_line_no (index->output_line,
+ output_line_number_len);
}
}
@@ -859,7 +941,6 @@ cm_printindex ()
}
free (line);
- free (index_name);
me_inhibit_expansion--;
printing_index = 0;
@@ -871,8 +952,13 @@ cm_printindex ()
line_number = saved_line_number;
if (html)
- add_word ("");
+ add_html_block_elt ("");
else if (xml && docbook)
xml_end_index ();
}
+
+ free (index_name);
+ /* Re-increment the line number, because get_rest_of_line
+ left us looking at the next line after the command. */
+ line_number++;
}
diff --git a/contrib/texinfo/makeinfo/index.h b/contrib/texinfo/makeinfo/index.h
index 3279a24..3ff723d 100644
--- a/contrib/texinfo/makeinfo/index.h
+++ b/contrib/texinfo/makeinfo/index.h
@@ -1,5 +1,5 @@
/* index.h -- declarations for index.c.
- $Id: index.h,v 1.1 2002/08/25 23:38:38 karl Exp $
+ $Id: index.h,v 1.2 2004/04/11 17:56:47 karl Exp $
Copyright (C) 1998, 99 Free Software Foundation, Inc.
@@ -27,10 +27,67 @@
extern COMMAND **user_command_array;
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 `@code{...}' 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. */
+ char *output_file; /* Output file for output_line. */
+ int entry_number; /* Entry number. */
+} 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 ();
+extern void init_indices (void);
+
+extern int defined_indices;
+extern int printing_index;
+extern int index_counter;
-/* Function to compare index entries for sorting. */
-extern int (*index_compare_fn) ();
+INDEX_ELT *index_list (char *name);
#endif /* !INDEX_H */
diff --git a/contrib/texinfo/makeinfo/insertion.c b/contrib/texinfo/makeinfo/insertion.c
index 95c0be2..05a2044 100644
--- a/contrib/texinfo/makeinfo/insertion.c
+++ b/contrib/texinfo/makeinfo/insertion.c
@@ -1,7 +1,7 @@
/* insertion.c -- insertions for Texinfo.
- $Id: insertion.c,v 1.21 2003/04/01 14:34:18 karl Exp $
+ $Id: insertion.c,v 1.55 2004/11/11 18:34:28 karl Exp $
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -21,25 +21,29 @@
#include "system.h"
#include "cmds.h"
#include "defun.h"
+#include "float.h"
+#include "html.h"
#include "insertion.h"
#include "macro.h"
#include "makeinfo.h"
+#include "multi.h"
#include "xml.h"
/* Must match list in insertion.h. */
static char *insertion_type_names[] =
{
"cartouche", "copying", "defcv", "deffn", "defivar", "defmac",
- "defmethod", "defop", "defopt", "defspec", "deftp", "deftypefn",
- "deftypefun", "deftypeivar", "deftypemethod", "deftypeop",
- "deftypevar", "deftypevr", "defun", "defvar", "defvr", "detailmenu",
- "direntry", "display", "documentdescription", "enumerate", "example",
- "flushleft", "flushright", "format", "ftable", "group", "ifclear",
- "ifhtml", "ifinfo", "ifnothtml", "ifnotinfo", "ifnotplaintext", "ifnottex", "ifnotxml",
- "ifplaintext", "ifset", "iftex", "ifxml", "itemize", "lisp", "menu",
- "multitable", "quotation", "rawhtml", "rawtex", "smalldisplay",
- "smallexample", "smallformat", "smalllisp", "verbatim", "table",
- "tex", "vtable", "bad_type"
+ "defmethod", "defop", "defopt", "defspec", "deftp", "deftypecv",
+ "deftypefn", "deftypefun", "deftypeivar", "deftypemethod",
+ "deftypeop", "deftypevar", "deftypevr", "defun", "defvar", "defvr",
+ "detailmenu", "direntry", "display", "documentdescription",
+ "enumerate", "example", "float", "flushleft", "flushright", "format",
+ "ftable", "group", "ifclear", "ifdocbook", "ifhtml", "ifinfo",
+ "ifnotdocbook", "ifnothtml", "ifnotinfo", "ifnotplaintext", "ifnottex",
+ "ifnotxml", "ifplaintext", "ifset", "iftex", "ifxml", "itemize", "lisp",
+ "menu", "multitable", "quotation", "rawdocbook", "rawhtml", "rawtex",
+ "rawxml", "smalldisplay", "smallexample", "smallformat", "smalllisp",
+ "verbatim", "table", "tex", "vtable", "titlepage", "bad_type"
};
/* All nested environments. */
@@ -62,19 +66,29 @@ int in_menu = 0;
Used for menu and itemize. */
int in_paragraph = 0;
-static const char dl_tag[] = "
\n";
-extern void cm_insert_copying ();
+/* Since an insertion is already in the stack before we reach the switch
+ statement, we cannot use is_in_insertion_of_type (always returns true.) Also
+ making it return the level found, and comparing it with the current level is
+ no use, due to the order of stack. */
+static int float_active = 0;
+/* Unsetting escape_html blindly causes text inside @html/etc. to be escaped if
+ used within a rmacro. */
+static int raw_output_block = 0;
+
+/* Non-zero if a
\n");
else
{
/* with close_single_paragraph, we get no blank line above
@@ -524,32 +555,39 @@ begin_insertion (type)
inhibit_paragraph_indentation = 1;
}
current_indent += default_indentation_increment;
+ if (xml)
+ xml_insert_quotation (insertion_stack->item_function, START);
+ else if (strlen(insertion_stack->item_function))
+ execute_string ("@b{%s:} ", insertion_stack->item_function);
break;
- case display:
- case smalldisplay:
case example:
case smallexample:
case lisp:
case smalllisp:
+ in_fixed_width_font++;
+ /* fall through */
+
+ /* Like @example but no fixed width font. */
+ case display:
+ case smalldisplay:
/* Like @display but without indentation. */
case smallformat:
case format:
close_single_paragraph ();
inhibit_paragraph_indentation = 1;
- in_fixed_width_font++;
filling_enabled = 0;
last_char_was_newline = 0;
if (html)
- /* Kludge alert: if
is followed by a newline, IE3
- renders an extra blank line before the pre-formatted block.
- Other browsers seem to not mind one way or the other. */
- add_word_args ("
", command);
+ /* Kludge alert: if
is followed by a newline, IE3,
+ mozilla, maybe others render an extra blank line before the
+ pre-formatted block. So don't output a newline. */
+ add_html_block_elt_args ("
", command);
if (type != format && type != smallformat)
{
- current_indent += default_indentation_increment;
+ current_indent += example_indentation_increment;
if (html)
{
/* Since we didn't put \n after
, we need to insert
@@ -559,7 +597,6 @@ begin_insertion (type)
add_char (' ');
}
}
-
break;
case multitable:
@@ -599,14 +636,26 @@ begin_insertion (type)
{
if (type == itemize)
{
- add_word ("
\n");
+ add_html_block_elt ("
\n");
in_paragraph = 0;
}
else
- add_word (dl_tag);
+ { /* We are just starting, so this
+ has no
children yet. */
+ html_deflist_has_term = 0;
+ add_html_block_elt ("
\n");
+ }
}
if (xml)
xml_begin_table (type, insertion_stack->item_function);
+
+ while (input_text[input_text_offset] == '\n'
+ && input_text[input_text_offset+1] == '\n')
+ {
+ line_number++;
+ input_text_offset++;
+ }
+
break;
case enumerate:
@@ -636,7 +685,7 @@ begin_insertion (type)
start_enumerating (*enumeration_arg, ENUM_ALPHA);
break;
- /* @group does nothing special in makeinfo. */
+ /* @group produces no output in info. */
case group:
/* Only close the paragraph if we are not inside of an
@example-like environment. */
@@ -658,15 +707,157 @@ begin_insertion (type)
case cartouche:
if (html)
- add_word ("
\n");
+ add_html_block_elt ("
\n");
if (in_menu)
no_discard++;
break;
+ case floatenv:
+ /* Cannot nest floats, so complain. */
+ if (float_active)
+ {
+ line_error (_("%cfloat environments cannot be nested"), COMMAND_PREFIX);
+ pop_insertion ();
+ break;
+ }
+
+ float_active++;
+
+ { /* Collect data about this float. */
+ /* Example: @float [FLOATTYPE][,XREFLABEL][,POSITION] */
+ char floattype[200] = "";
+ char xreflabel[200] = "";
+ char position[200] = "";
+ char *text;
+ char *caption;
+ char *shortcaption;
+ int start_of_end;
+ int save_line_number = line_number;
+ int save_input_text_offset = input_text_offset;
+ int i;
+
+ if (strlen (insertion_stack->item_function) > 0)
+ {
+ int i = 0, t = 0, c = 0;
+ while (insertion_stack->item_function[i])
+ {
+ if (insertion_stack->item_function[i] == ',')
+ {
+ switch (t)
+ {
+ case 0:
+ floattype[c] = '\0';
+ break;
+ case 1:
+ xreflabel[c] = '\0';
+ break;
+ case 2:
+ position[c] = '\0';
+ break;
+ }
+ c = 0;
+ t++;
+ i++;
+ continue;
+ }
+
+ switch (t)
+ {
+ case 0:
+ floattype[c] = insertion_stack->item_function[i];
+ break;
+ case 1:
+ xreflabel[c] = insertion_stack->item_function[i];
+ break;
+ case 2:
+ position[c] = insertion_stack->item_function[i];
+ break;
+ }
+ c++;
+ i++;
+ }
+ }
+
+ skip_whitespace_and_newlines ();
+
+ start_of_end = get_until ("\n@end float", &text);
+
+ /* Get also the @caption. */
+ i = search_forward_until_pos ("\n@caption{",
+ save_input_text_offset, start_of_end);
+ if (i > -1)
+ {
+ input_text_offset = i + sizeof ("\n@caption{") - 1;
+ get_until_in_braces ("\n@end float", &caption);
+ input_text_offset = save_input_text_offset;
+ }
+ else
+ caption = "";
+
+ /* ... and the @shortcaption. */
+ i = search_forward_until_pos ("\n@shortcaption{",
+ save_input_text_offset, start_of_end);
+ if (i > -1)
+ {
+ input_text_offset = i + sizeof ("\n@shortcaption{") - 1;
+ get_until_in_braces ("\n@end float", &shortcaption);
+ input_text_offset = save_input_text_offset;
+ }
+ else
+ shortcaption = "";
+
+ canon_white (xreflabel);
+ canon_white (floattype);
+ canon_white (position);
+ canon_white (caption);
+ canon_white (shortcaption);
+
+ add_new_float (xstrdup (xreflabel),
+ xstrdup (caption), xstrdup (shortcaption),
+ xstrdup (floattype), xstrdup (position));
+
+ /* Move to the start of the @float so the contents get processed as
+ usual. */
+ input_text_offset = save_input_text_offset;
+ line_number = save_line_number;
+ }
+
+ if (html)
+ add_html_block_elt ("
\n");
+ else if (docbook)
+ xml_insert_element (FLOAT, START);
+ else if (xml)
+ {
+ xml_insert_element_with_attribute (FLOAT, START,
+ "name=\"%s\"", current_float_id ());
+
+ xml_insert_element (FLOATTYPE, START);
+ execute_string ("%s", current_float_type ());
+ xml_insert_element (FLOATTYPE, END);
+
+ xml_insert_element (FLOATPOS, START);
+ execute_string ("%s", current_float_position ());
+ xml_insert_element (FLOATPOS, END);
+ }
+ else
+ { /* Info */
+ close_single_paragraph ();
+ inhibit_paragraph_indentation = 1;
+ }
+
+ /* Anchor now. Note that XML documents get their
+ anchors with tag. */
+ if ((!xml || docbook) && strlen (current_float_id ()) > 0)
+ execute_string ("@anchor{%s}", current_float_id ());
+
+ break;
+
/* Insertions that are no-ops in info, but do something in TeX. */
case ifclear:
+ case ifdocbook:
case ifhtml:
case ifinfo:
+ case ifnotdocbook:
case ifnothtml:
case ifnotinfo:
case ifnotplaintext:
@@ -681,8 +872,25 @@ begin_insertion (type)
no_discard++;
break;
+ case rawdocbook:
case rawhtml:
- escape_html = 0;
+ case rawxml:
+ raw_output_block++;
+
+ if (raw_output_block > 0)
+ {
+ xml_no_para = 1;
+ escape_html = 0;
+ xml_keep_space++;
+ }
+
+ {
+ /* Some deuglification for improved readability. */
+ extern int xml_in_para;
+ if (xml && !xml_in_para && xml_indentation_increment > 0)
+ add_char ('\n');
+ }
+
break;
case defcv:
@@ -694,6 +902,7 @@ begin_insertion (type)
case defopt:
case defspec:
case deftp:
+ case deftypecv:
case deftypefn:
case deftypefun:
case deftypeivar:
@@ -708,6 +917,8 @@ begin_insertion (type)
filling_enabled = indented_fill = 1;
current_indent += default_indentation_increment;
no_indent = 0;
+ if (xml)
+ xml_begin_definition ();
break;
case flushleft:
@@ -715,7 +926,7 @@ begin_insertion (type)
inhibit_paragraph_indentation = 1;
filling_enabled = indented_fill = no_indent = 0;
if (html)
- add_word ("
");
+ add_html_block_elt ("
");
break;
case flushright:
@@ -724,12 +935,15 @@ begin_insertion (type)
inhibit_paragraph_indentation = 1;
force_flush_right++;
if (html)
- add_word ("
");
+ add_html_block_elt ("
");
+ break;
+
+ case titlepage:
+ xml_insert_element (TITLEPAGE, START);
break;
default:
line_error ("begin_insertion internal error: type=%d", type);
-
}
if (!no_discard)
@@ -740,11 +954,10 @@ begin_insertion (type)
`bad_type', TYPE gets translated to match the value currently on top
of the stack. Otherwise, if TYPE doesn't match the top of the
insertion stack, give error. */
-void
-end_insertion (type)
- enum insertion_type type;
+static void
+end_insertion (int type)
{
- enum insertion_type temp_type;
+ int temp_type;
if (!insertion_level)
return;
@@ -771,23 +984,28 @@ end_insertion (type)
case ifinfo:
case documentdescription:
break;
- case copying:
- xml_insert_element (COPYING, END);
- break;
case quotation:
- xml_insert_element (QUOTATION, END);
+ xml_insert_quotation ("", END);
break;
case example:
xml_insert_element (EXAMPLE, END);
+ if (docbook && current_insertion_type () == floatenv)
+ xml_insert_element (FLOATEXAMPLE, END);
break;
case smallexample:
xml_insert_element (SMALLEXAMPLE, END);
+ if (docbook && current_insertion_type () == floatenv)
+ xml_insert_element (FLOATEXAMPLE, END);
break;
case lisp:
xml_insert_element (LISP, END);
+ if (docbook && current_insertion_type () == floatenv)
+ xml_insert_element (FLOATEXAMPLE, END);
break;
case smalllisp:
xml_insert_element (SMALLLISP, END);
+ if (docbook && current_insertion_type () == floatenv)
+ xml_insert_element (FLOATEXAMPLE, END);
break;
case cartouche:
xml_insert_element (CARTOUCHE, END);
@@ -817,21 +1035,28 @@ end_insertion (type)
xml_end_table (type);
break;
case enumerate:
- xml_end_enumerate (type);
+ xml_end_enumerate ();
break;
case group:
xml_insert_element (GROUP, END);
break;
+ case titlepage:
+ xml_insert_element (TITLEPAGE, END);
+ break;
}
}
switch (type)
{
/* Insertions which have no effect on paragraph formatting. */
case copying:
- case documentdescription:
+ line_number--;
+ break;
+
case ifclear:
+ case ifdocbook:
case ifinfo:
case ifhtml:
+ case ifnotdocbook:
case ifnothtml:
case ifnotinfo:
case ifnotplaintext:
@@ -842,13 +1067,29 @@ end_insertion (type)
case iftex:
case ifxml:
case rawtex:
+ case titlepage:
break;
+ case rawdocbook:
case rawhtml:
- escape_html = 1;
+ case rawxml:
+ raw_output_block--;
+
+ if (raw_output_block <= 0)
+ {
+ xml_no_para = 0;
+ escape_html = 1;
+ xml_keep_space--;
+ }
+
+ if ((xml || html) && output_paragraph[output_paragraph_offset-1] == '\n')
+ output_paragraph_offset--;
break;
case detailmenu:
+ if (xml)
+ xml_insert_element (DETAILMENU, END);
+
in_detailmenu--; /* No longer hacking menus. */
if (!in_menu)
{
@@ -862,11 +1103,17 @@ end_insertion (type)
close_insertion_paragraph ();
break;
+ case documentdescription:
+ if (xml)
+ insert_string (document_description);
+ xml_insert_element (DOCUMENTDESCRIPTION, END);
+ break;
+
case menu:
in_menu--; /* No longer hacking menus. */
if (html && !no_headers)
- add_word ("\n");
- else if (!no_headers)
+ add_html_block_elt ("\n");
+ else if (!no_headers && !xml)
close_insertion_paragraph ();
break;
@@ -879,23 +1126,76 @@ end_insertion (type)
close_insertion_paragraph ();
current_indent -= default_indentation_increment;
if (html)
- add_word ("\n");
+ add_html_block_elt ("\n");
break;
case flushleft:
if (html)
- add_word ("
\n");
+ add_html_block_elt ("
\n");
close_insertion_paragraph ();
break;
case cartouche:
if (html)
- add_word ("
\n");
+ add_html_block_elt ("
\n");
close_insertion_paragraph ();
break;
case group:
- close_insertion_paragraph ();
+ if (!xml || docbook)
+ close_insertion_paragraph ();
+ break;
+
+ case floatenv:
+ if (xml)
+ xml_insert_element (FLOAT, END);
+ else
+ {
+ if (html)
+ add_html_block_elt ("
\n");
+ else
+ close_paragraph ();
+ }
+ float_active--;
break;
case format:
@@ -909,15 +1209,30 @@ end_insertion (type)
case quotation:
/* @format and @smallformat are the only fixed_width insertion
without a change in indentation. */
- if (type != format && type != smallformat)
+ if (type != format && type != smallformat && type != quotation)
+ current_indent -= example_indentation_increment;
+ else if (type == quotation)
current_indent -= default_indentation_increment;
if (html)
- add_word (type == quotation ? "
\n" : "\n");
+ { /* The complex code in close_paragraph that kills whitespace
+ does not function here, since we've inserted non-whitespace
+ (the ) before it. The indentation already got
+ inserted at the end of the last example line, so we have to
+ delete it, or browsers wind up showing an extra blank line. */
+ kill_self_indent (default_indentation_increment);
+ add_html_block_elt (type == quotation
+ ? "
\n" : "\n");
+ }
/* The ending of one of these insertions always marks the
- start of a new paragraph. */
- close_insertion_paragraph ();
+ start of a new paragraph, except for the XML output. */
+ if (!xml || docbook)
+ close_insertion_paragraph ();
+
+ /* closes paragraph without messing with
. */
+ if (html && type != quotation)
+ paragraph_is_open = 0;
break;
case table:
@@ -925,28 +1240,28 @@ end_insertion (type)
case vtable:
current_indent -= default_indentation_increment;
if (html)
- add_word ("\n");
+ add_html_block_elt ("\n");
close_insertion_paragraph ();
break;
case itemize:
current_indent -= default_indentation_increment;
if (html)
- add_word ("\n");
+ add_html_block_elt ("\n");
close_insertion_paragraph ();
break;
case flushright:
force_flush_right--;
if (html)
- add_word ("\n");
+ add_html_block_elt ("\n");
close_insertion_paragraph ();
break;
/* Handle the @defun insertions with this default clause. */
default:
{
- enum insertion_type base_type;
+ int base_type;
if (type < defcv || type > defvr)
line_error ("end_insertion internal error: type=%d", type);
@@ -957,6 +1272,7 @@ end_insertion (type)
case deffn:
case defvr:
case deftp:
+ case deftypecv:
case deftypefn:
case deftypevr:
case defcv:
@@ -965,8 +1281,16 @@ end_insertion (type)
case deftypeop:
case deftypeivar:
if (html)
- /* close the tables which has been opened in defun.c */
- add_word ("\n\n");
+ {
+ if (paragraph_is_open)
+ add_html_block_elt ("
");
+ /* close the div and blockquote which has been opened in defun.c */
+ if (!rollback_empty_tag ("blockquote"))
+ add_html_block_elt ("");
+ add_html_block_elt ("\n");
+ }
+ if (xml)
+ xml_end_definition ();
break;
} /* switch (base_type)... */
@@ -991,8 +1315,7 @@ end_insertion (type)
@if... conditionals, otherwise not. This is because conditionals can
cross node boundaries. Always happens with the @top node, for example. */
void
-discard_insertions (specials_ok)
- int specials_ok;
+discard_insertions (int specials_ok)
{
int real_line_number = line_number;
while (insertion_stack)
@@ -1000,7 +1323,9 @@ discard_insertions (specials_ok)
if (specials_ok
&& ((ifclear <= insertion_stack->insertion
&& insertion_stack->insertion <= iftex)
+ || insertion_stack->insertion == rawdocbook
|| insertion_stack->insertion == rawhtml
+ || insertion_stack->insertion == rawxml
|| insertion_stack->insertion == rawtex))
break;
else
@@ -1020,71 +1345,125 @@ discard_insertions (specials_ok)
/* Insertion (environment) commands. */
void
-cm_quotation ()
+cm_quotation (void)
{
- if (xml)
- xml_insert_element (QUOTATION, START);
+ /* We start the blockquote element in the insertion. */
begin_insertion (quotation);
}
void
-cm_example ()
+cm_example (void)
{
+ if (docbook && current_insertion_type () == floatenv)
+ xml_begin_docbook_float (FLOATEXAMPLE);
+
if (xml)
- xml_insert_element (EXAMPLE, START);
+ {
+ /* Rollback previous newlines. These occur between
+ and . */
+ if (output_paragraph[output_paragraph_offset-1] == '\n')
+ output_paragraph_offset--;
+
+ xml_insert_element (EXAMPLE, START);
+
+ /* Make sure example text is starting on a new line
+ for improved readability. */
+ if (docbook)
+ add_char ('\n');
+ }
+
begin_insertion (example);
}
void
-cm_smallexample ()
+cm_smallexample (void)
{
+ if (docbook && current_insertion_type () == floatenv)
+ xml_begin_docbook_float (FLOATEXAMPLE);
+
if (xml)
- xml_insert_element (SMALLEXAMPLE, START);
+ {
+ /* See cm_example comments about newlines. */
+ if (output_paragraph[output_paragraph_offset-1] == '\n')
+ output_paragraph_offset--;
+ xml_insert_element (SMALLEXAMPLE, START);
+ if (docbook)
+ add_char ('\n');
+ }
+
begin_insertion (smallexample);
}
void
-cm_lisp ()
+cm_lisp (void)
{
+ if (docbook && current_insertion_type () == floatenv)
+ xml_begin_docbook_float (FLOATEXAMPLE);
+
if (xml)
- xml_insert_element (LISP, START);
+ {
+ /* See cm_example comments about newlines. */
+ if (output_paragraph[output_paragraph_offset-1] == '\n')
+ output_paragraph_offset--;
+ xml_insert_element (LISP, START);
+ if (docbook)
+ add_char ('\n');
+ }
+
begin_insertion (lisp);
}
void
-cm_smalllisp ()
+cm_smalllisp (void)
{
+ if (docbook && current_insertion_type () == floatenv)
+ xml_begin_docbook_float (FLOATEXAMPLE);
+
if (xml)
- xml_insert_element (SMALLLISP, START);
+ {
+ /* See cm_example comments about newlines. */
+ if (output_paragraph[output_paragraph_offset-1] == '\n')
+ output_paragraph_offset--;
+ xml_insert_element (SMALLLISP, START);
+ if (docbook)
+ add_char ('\n');
+ }
+
begin_insertion (smalllisp);
}
void
-cm_cartouche ()
+cm_cartouche (void)
{
+ if (docbook && current_insertion_type () == floatenv)
+ xml_begin_docbook_float (CARTOUCHE);
+
if (xml)
xml_insert_element (CARTOUCHE, START);
begin_insertion (cartouche);
}
void
-cm_copying ()
+cm_copying (void)
{
- if (xml)
- xml_insert_element (COPYING, START);
begin_insertion (copying);
}
/* Not an insertion, despite the name, but it goes with cm_copying. */
void
-cm_insert_copying ()
+cm_insert_copying (void)
{
- if (copying_text)
- { /* insert_string rather than add_word because we've already done
- full expansion on copying_text when we saved it. */
- insert_string (copying_text);
- insert ('\n');
-
+ if (!copying_text)
+ {
+ warning ("@copying not used before %s", command);
+ return;
+ }
+
+ execute_string ("%s", copying_text);
+
+ if (!xml && !html)
+ {
+ add_word ("\n\n");
/* Update output_position so that the node positions in the tag
tables will take account of the copying text. */
flush_output ();
@@ -1092,7 +1471,7 @@ cm_insert_copying ()
}
void
-cm_format ()
+cm_format (void)
{
if (xml)
{
@@ -1102,56 +1481,94 @@ cm_format ()
xml_in_abstract = 1;
}
else
- xml_insert_element (FORMAT, START);
+ {
+ /* See cm_example comments about newlines. */
+ if (output_paragraph[output_paragraph_offset-1] == '\n')
+ output_paragraph_offset--;
+ xml_insert_element (FORMAT, START);
+ if (docbook)
+ add_char ('\n');
+ }
}
begin_insertion (format);
}
void
-cm_smallformat ()
+cm_smallformat (void)
{
if (xml)
- xml_insert_element (SMALLFORMAT, START);
+ {
+ /* See cm_example comments about newlines. */
+ if (output_paragraph[output_paragraph_offset-1] == '\n')
+ output_paragraph_offset--;
+ xml_insert_element (SMALLFORMAT, START);
+ if (docbook)
+ add_char ('\n');
+ }
+
begin_insertion (smallformat);
}
void
-cm_display ()
+cm_display (void)
{
if (xml)
- xml_insert_element (DISPLAY, START);
+ {
+ /* See cm_example comments about newlines. */
+ if (output_paragraph[output_paragraph_offset-1] == '\n')
+ output_paragraph_offset--;
+ xml_insert_element (DISPLAY, START);
+ if (docbook)
+ add_char ('\n');
+ }
+
begin_insertion (display);
}
void
-cm_smalldisplay ()
+cm_smalldisplay (void)
{
if (xml)
- xml_insert_element (SMALLDISPLAY, START);
+ {
+ /* See cm_example comments about newlines. */
+ if (output_paragraph[output_paragraph_offset-1] == '\n')
+ output_paragraph_offset--;
+ xml_insert_element (SMALLDISPLAY, START);
+ if (docbook)
+ add_char ('\n');
+ }
+
begin_insertion (smalldisplay);
}
void
-cm_direntry ()
+cm_direntry (void)
{
- if (html || xml)
+ if (html || xml || no_headers)
command_name_condition ();
else
begin_insertion (direntry);
}
void
-cm_documentdescription ()
+cm_documentdescription (void)
{
- if (html || xml)
+ if (html)
begin_insertion (documentdescription);
+
+ else if (xml)
+ {
+ xml_insert_element (DOCUMENTDESCRIPTION, START);
+ begin_insertion (documentdescription);
+ }
+
else
command_name_condition ();
}
void
-cm_itemize ()
+cm_itemize (void)
{
begin_insertion (itemize);
}
@@ -1159,9 +1576,7 @@ cm_itemize ()
/* Start an enumeration insertion of type TYPE. If the user supplied
no argument on the line, then use DEFAULT_STRING as the initial string. */
static void
-do_enumeration (type, default_string)
- int type;
- char *default_string;
+do_enumeration (int type, char *default_string)
{
get_until_in_line (0, ".", &enumeration_arg);
canon_white (enumeration_arg);
@@ -1188,7 +1603,7 @@ do_enumeration (type, default_string)
}
void
-cm_enumerate ()
+cm_enumerate (void)
{
do_enumeration (enumerate, "1");
}
@@ -1202,15 +1617,16 @@ cm_enumerate ()
verbatim environment may be encapsulated in an @example environment,
for example. */
void
-handle_verbatim_environment (find_end_verbatim)
- int find_end_verbatim;
+handle_verbatim_environment (int find_end_verbatim)
{
int character;
int seen_end = 0;
int save_filling_enabled = filling_enabled;
int save_inhibit_paragraph_indentation = inhibit_paragraph_indentation;
+ int save_escape_html = escape_html;
- close_single_paragraph ();
+ if (!insertion_stack)
+ close_single_paragraph (); /* no blank lines if not at outer level */
inhibit_paragraph_indentation = 1;
filling_enabled = 0;
in_fixed_width_font++;
@@ -1222,7 +1638,22 @@ handle_verbatim_environment (find_end_verbatim)
*/
if (html)
- add_word ("
");
+ { /* If inside @example, we'll be preceded by the indentation
+ already. Browsers will ignore those spaces because we're about
+ to start another
(don't ask me). So, wipe them out for
+ cleanliness, and re-insert. */
+ int i;
+ kill_self_indent (default_indentation_increment);
+ add_html_block_elt ("
");
+ for (i = current_indent; i > 0; i--)
+ add_char (' ');
+ }
+ else if (xml)
+ {
+ xml_insert_element (VERBATIM, START);
+ escape_html = 0;
+ add_word (" sizeof (END_VERBATIM))
&& !strncmp (&input_text[input_text_offset+1], END_VERBATIM,
@@ -1257,7 +1687,16 @@ handle_verbatim_environment (find_end_verbatim)
warning (_("end of file inside verbatim block"));
if (html)
- add_word ("
");
+ { /* See comments in example case above. */
+ kill_self_indent (default_indentation_increment);
+ add_word ("
");
+ }
+ else if (xml)
+ {
+ add_word ("]]>");
+ xml_insert_element (VERBATIM, END);
+ escape_html = save_escape_html;
+ }
in_fixed_width_font--;
filling_enabled = save_filling_enabled;
@@ -1265,53 +1704,89 @@ handle_verbatim_environment (find_end_verbatim)
}
void
-cm_verbatim ()
+cm_verbatim (void)
{
handle_verbatim_environment (1);
}
void
-cm_table ()
+cm_table (void)
{
begin_insertion (table);
}
void
-cm_multitable ()
+cm_multitable (void)
{
begin_insertion (multitable); /* @@ */
}
void
-cm_ftable ()
+cm_ftable (void)
{
begin_insertion (ftable);
}
void
-cm_vtable ()
+cm_vtable (void)
{
begin_insertion (vtable);
}
void
-cm_group ()
+cm_group (void)
{
begin_insertion (group);
}
/* Insert raw HTML (no escaping of `<' etc.). */
void
-cm_html ()
+cm_html (int arg)
{
- if (process_html || process_xml)
+ if (process_html)
begin_insertion (rawhtml);
else
command_name_condition ();
}
void
-cm_ifhtml ()
+cm_xml (int arg)
+{
+ if (process_xml)
+ begin_insertion (rawxml);
+ else
+ command_name_condition ();
+}
+
+void
+cm_docbook (int arg)
+{
+ if (process_docbook)
+ begin_insertion (rawdocbook);
+ else
+ command_name_condition ();
+}
+
+void
+cm_ifdocbook (void)
+{
+ if (process_docbook)
+ begin_insertion (ifdocbook);
+ else
+ command_name_condition ();
+}
+
+void
+cm_ifnotdocbook (void)
+{
+ if (!process_docbook)
+ begin_insertion (ifnotdocbook);
+ else
+ command_name_condition ();
+}
+
+void
+cm_ifhtml (void)
{
if (process_html)
begin_insertion (ifhtml);
@@ -1320,7 +1795,7 @@ cm_ifhtml ()
}
void
-cm_ifnothtml ()
+cm_ifnothtml (void)
{
if (!process_html)
begin_insertion (ifnothtml);
@@ -1330,7 +1805,7 @@ cm_ifnothtml ()
void
-cm_ifinfo ()
+cm_ifinfo (void)
{
if (process_info)
begin_insertion (ifinfo);
@@ -1339,7 +1814,7 @@ cm_ifinfo ()
}
void
-cm_ifnotinfo ()
+cm_ifnotinfo (void)
{
if (!process_info)
begin_insertion (ifnotinfo);
@@ -1349,7 +1824,7 @@ cm_ifnotinfo ()
void
-cm_ifplaintext ()
+cm_ifplaintext (void)
{
if (process_plaintext)
begin_insertion (ifplaintext);
@@ -1358,7 +1833,7 @@ cm_ifplaintext ()
}
void
-cm_ifnotplaintext ()
+cm_ifnotplaintext (void)
{
if (!process_plaintext)
begin_insertion (ifnotplaintext);
@@ -1368,7 +1843,7 @@ cm_ifnotplaintext ()
void
-cm_tex ()
+cm_tex (void)
{
if (process_tex)
begin_insertion (rawtex);
@@ -1377,7 +1852,7 @@ cm_tex ()
}
void
-cm_iftex ()
+cm_iftex (void)
{
if (process_tex)
begin_insertion (iftex);
@@ -1386,7 +1861,7 @@ cm_iftex ()
}
void
-cm_ifnottex ()
+cm_ifnottex (void)
{
if (!process_tex)
begin_insertion (ifnottex);
@@ -1395,7 +1870,7 @@ cm_ifnottex ()
}
void
-cm_ifxml ()
+cm_ifxml (void)
{
if (process_xml)
begin_insertion (ifxml);
@@ -1404,7 +1879,7 @@ cm_ifxml ()
}
void
-cm_ifnotxml ()
+cm_ifnotxml (void)
{
if (!process_xml)
begin_insertion (ifnotxml);
@@ -1413,9 +1888,47 @@ cm_ifnotxml ()
}
+/* Generic xrefable block with a caption. */
+void
+cm_float (void)
+{
+ begin_insertion (floatenv);
+}
+
+void
+cm_caption (int arg)
+{
+ char *temp;
+
+ /* This is a no_op command for most formats, as we handle it during @float
+ insertion. For XML though, we handle it here to keep document structure
+ as close as possible, to the Texinfo source. */
+
+ /* Everything is already handled at START. */
+ if (arg == END)
+ return;
+
+ /* Check if it's mislocated. */
+ if (current_insertion_type () != floatenv)
+ line_error (_("@%s not meaningful outside `@float' environment"), command);
+
+ get_until_in_braces ("\n@end float", &temp);
+
+ if (xml)
+ {
+ int elt = STREQ (command, "shortcaption") ? SHORTCAPTION : CAPTION;
+ xml_insert_element (elt, START);
+ if (!docbook)
+ execute_string ("%s", temp);
+ xml_insert_element (elt, END);
+ }
+
+ free (temp);
+}
+
/* Begin an insertion where the lines are not filled or indented. */
void
-cm_flushleft ()
+cm_flushleft (void)
{
begin_insertion (flushleft);
}
@@ -1423,15 +1936,15 @@ cm_flushleft ()
/* Begin an insertion where the lines are not filled, and each line is
forced to the right-hand side of the page. */
void
-cm_flushright ()
+cm_flushright (void)
{
begin_insertion (flushright);
}
void
-cm_menu ()
+cm_menu (void)
{
- if (current_node == NULL)
+ if (current_node == NULL && !macro_expansion_output_stream)
{
warning (_("@menu seen before first @node, creating `Top' node"));
warning (_("perhaps your @top node should be wrapped in @ifnottex rather than @ifinfo?"));
@@ -1442,22 +1955,108 @@ cm_menu ()
}
void
-cm_detailmenu ()
+cm_detailmenu (void)
{
- if (current_node == NULL)
+ if (current_node == NULL && !macro_expansion_output_stream)
{ /* Problems anyway, @detailmenu should always be inside @menu. */
warning (_("@detailmenu seen before first node, creating `Top' node"));
execute_string ("@node top\n@top Top\n");
}
begin_insertion (detailmenu);
}
+
+/* Title page commands. */
+
+void
+cm_titlepage (void)
+{
+ titlepage_cmd_present = 1;
+ if (xml && !docbook)
+ begin_insertion (titlepage);
+ else
+ command_name_condition ();
+}
+
+void
+cm_author (void)
+{
+ char *rest;
+ get_rest_of_line (1, &rest);
+
+ if (is_in_insertion_of_type (quotation))
+ {
+ if (html)
+ add_word_args ("— %s", rest);
+ else if (docbook)
+ {
+ /* FIXME Ideally, we should use an attribution element,
+ but they are supposed to be at the start of quotation
+ blocks. So to avoid looking ahead mess, let's just
+ use mdash like HTML for now. */
+ xml_insert_entity ("mdash");
+ add_word (rest);
+ }
+ else if (xml)
+ {
+ xml_insert_element (AUTHOR, START);
+ add_word (rest);
+ xml_insert_element (AUTHOR, END);
+ }
+ else
+ add_word_args ("-- %s", rest);
+ }
+ else if (is_in_insertion_of_type (titlepage))
+ {
+ if (xml && !docbook)
+ {
+ xml_insert_element (AUTHOR, START);
+ add_word (rest);
+ xml_insert_element (AUTHOR, END);
+ }
+ }
+ else
+ line_error (_("@%s not meaningful outside `@titlepage' and `@quotation' environments"),
+ command);
+
+ free (rest);
+}
+
+void
+cm_titlepage_cmds (void)
+{
+ char *rest;
+
+ get_rest_of_line (1, &rest);
+
+ if (!is_in_insertion_of_type (titlepage))
+ line_error (_("@%s not meaningful outside `@titlepage' environment"),
+ command);
+
+ if (xml && !docbook)
+ {
+ int elt = 0;
+
+ if (STREQ (command, "title"))
+ elt = BOOKTITLE;
+ else if (STREQ (command, "subtitle"))
+ elt = BOOKSUBTITLE;
+
+ xml_insert_element (elt, START);
+ add_word (rest);
+ xml_insert_element (elt, END);
+ }
+
+ free (rest);
+}
/* End existing insertion block. */
void
-cm_end ()
+cm_end (void)
{
char *temp;
- enum insertion_type type;
+ int type;
+
+ get_rest_of_line (0, &temp);
if (!insertion_level)
{
@@ -1465,8 +2064,6 @@ cm_end ()
return;
}
- get_rest_of_line (0, &temp);
-
if (temp[0] == 0)
line_error (_("`%c%s' needs something after it"), COMMAND_PREFIX, command);
@@ -1474,8 +2071,8 @@ cm_end ()
if (type == bad_type)
{
- line_error (_("Bad argument to `%s', `%s', using `%s'"),
- command, temp, insertion_type_pname (current_insertion_type ()));
+ line_error (_("Bad argument `%s' to `@%s', using `%s'"),
+ temp, command, insertion_type_pname (current_insertion_type ()));
}
if (xml && type == menu) /* fixme */
{
@@ -1490,9 +2087,8 @@ cm_end ()
static int itemx_flag = 0;
/* Return whether CMD takes a brace-delimited {arg}. */
-/*static */int
-command_needs_braces (cmd)
- char *cmd;
+int
+command_needs_braces (char *cmd)
{
int i;
for (i = 0; command_table[i].name; i++)
@@ -1506,7 +2102,7 @@ command_needs_braces (cmd)
void
-cm_item ()
+cm_item (void)
{
char *rest_of_line, *item_func;
@@ -1548,7 +2144,9 @@ cm_item ()
case ifset:
case iftex:
case ifxml:
+ case rawdocbook:
case rawhtml:
+ case rawxml:
case rawtex:
case tex:
case cartouche:
@@ -1585,14 +2183,7 @@ cm_item ()
else
{
if (html)
- {
- if (in_paragraph)
- {
- add_word ("");
- in_paragraph = 0;
- }
- add_word ("
");
- }
+ add_html_block_elt ("
");
else if (xml)
xml_begin_item ();
else
@@ -1646,17 +2237,11 @@ cm_item ()
case ftable:
case vtable:
if (html)
- {
- static int last_html_output_position = 0;
-
- /* If nothing has been output since the last
,
+ { /* If nothing has been output since the last
,
remove the empty
element. Some browsers render
an extra empty line for
, which makes @itemx
conversion look ugly. */
- if (last_html_output_position == output_position
- && strncmp ((char *) output_paragraph, "
",
- output_paragraph_offset) == 0)
- output_paragraph_offset = 0;
+ rollback_empty_tag ("dd");
/* Force the browser to render one blank line before
each new @item in a table. But don't do that if
@@ -1666,14 +2251,14 @@ cm_item ()
Note that there are some browsers which ignore
in this context, but I cannot find any way to force
them all render exactly one blank line. */
- if (!itemx_flag
- && ((output_paragraph_offset < sizeof (dl_tag) + 1)
- || strncmp ((char *) output_paragraph
- + output_paragraph_offset - sizeof (dl_tag) + 1,
- dl_tag, sizeof (dl_tag) - 1) != 0))
- add_word (" ");
+ if (!itemx_flag && html_deflist_has_term)
+ add_html_block_elt (" ");
+
+ /* We are about to insert a
, so this
has a term.
+ Feel free to insert a next time. :) */
+ html_deflist_has_term = 1;
- add_word ("
");
+ add_html_block_elt ("
");
if (item_func && *item_func)
execute_string ("%s{%s}", item_func, rest_of_line);
else
@@ -1684,15 +2269,19 @@ cm_item ()
if (current_insertion_type () == vtable)
execute_string ("%cvindex %s\n", COMMAND_PREFIX, rest_of_line);
- /* Make sure output_position is updated, so we could
- remember it. */
- close_single_paragraph ();
- last_html_output_position = output_position;
- add_word ("
");
+
+ add_html_block_elt ("
");
}
else if (xml) /* && docbook)*/ /* 05-08 */
{
xml_begin_table_item ();
+
+ if (!docbook && current_insertion_type () == ftable)
+ execute_string ("%cfindex %s\n", COMMAND_PREFIX, rest_of_line);
+
+ if (!docbook && current_insertion_type () == vtable)
+ execute_string ("%cvindex %s\n", COMMAND_PREFIX, rest_of_line);
+
if (item_func && *item_func)
execute_string ("%s{%s}", item_func, rest_of_line);
else
@@ -1770,9 +2359,18 @@ cm_item ()
}
void
-cm_itemx ()
+cm_itemx (void)
{
itemx_flag++;
cm_item ();
itemx_flag--;
}
+
+int headitem_flag = 0;
+
+void
+cm_headitem (void)
+{
+ headitem_flag = 1;
+ cm_item ();
+}
diff --git a/contrib/texinfo/makeinfo/insertion.h b/contrib/texinfo/makeinfo/insertion.h
index 17916e7..ace5571 100644
--- a/contrib/texinfo/makeinfo/insertion.h
+++ b/contrib/texinfo/makeinfo/insertion.h
@@ -1,7 +1,7 @@
/* insertion.h -- declarations for insertion.c.
- $Id: insertion.h,v 1.2 2002/09/29 19:15:20 karl Exp $
+ $Id: insertion.h,v 1.10 2004/04/11 17:56:47 karl Exp $
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,14 +24,15 @@
enum insertion_type
{
cartouche, copying, defcv, deffn, defivar, defmac, defmethod, defop,
- defopt, defspec, deftp, deftypefn, deftypefun, deftypeivar,
+ defopt, defspec, deftp, deftypecv, deftypefn, deftypefun, deftypeivar,
deftypemethod, deftypeop, deftypevar, deftypevr, defun, defvar, defvr,
detailmenu, direntry, display, documentdescription, enumerate,
- example, flushleft, flushright, format, ftable, group, ifclear,
- ifhtml, ifinfo, ifnothtml, ifnotinfo, ifnotplaintext, ifnottex, ifnotxml,
- ifplaintext, ifset, iftex, ifxml, itemize, lisp, menu, multitable, quotation,
- rawhtml, rawtex, smalldisplay, smallexample, smallformat, smalllisp,
- verbatim, table, tex, vtable, bad_type
+ example, floatenv, flushleft, flushright, format, ftable, group,
+ ifclear, ifdocbook, ifhtml, ifinfo, ifnotdocbook, ifnothtml, ifnotinfo,
+ ifnotplaintext, ifnottex, ifnotxml, ifplaintext, ifset, iftex, ifxml,
+ itemize, lisp, menu, multitable, quotation, rawdocbook, rawhtml, rawtex,
+ rawxml, smalldisplay, smallexample, smallformat, smalllisp, verbatim,
+ table, tex, vtable, titlepage, bad_type
};
typedef struct istack_elt
@@ -42,12 +43,11 @@ typedef struct istack_elt
int line_number;
int filling_enabled;
int indented_fill;
- enum insertion_type insertion;
+ int insertion;
int inhibited;
int in_fixed_width_font;
} INSERTION_ELT;
-
extern int insertion_level;
extern INSERTION_ELT *insertion_stack;
extern int in_menu;
@@ -55,10 +55,24 @@ extern int in_detailmenu;
extern int had_menu_commentary;
extern int in_paragraph;
-extern void command_name_condition ();
-extern void cm_ifhtml (), cm_ifnothtml(), cm_html ();
-extern void cm_ifinfo (), cm_ifnotinfo ();
-extern void cm_ifplaintext (), cm_ifnotplaintext();
-extern void cm_iftex (), cm_ifnottex (), cm_tex ();
-extern void cm_ifxml (), cm_ifnotxml ();
+extern int headitem_flag;
+extern int after_headitem;
+
+extern void init_insertion_stack (void);
+extern void command_name_condition (void);
+extern void cm_ifdocbook (void), cm_ifnotdocbook(void), cm_docbook (int arg);
+extern void cm_ifhtml (void), cm_ifnothtml(void), cm_html (int arg);
+extern void cm_ifinfo (void), cm_ifnotinfo (void);
+extern void cm_ifplaintext (void), cm_ifnotplaintext(void);
+extern void cm_iftex (void), cm_ifnottex (void), cm_tex (void);
+extern void cm_ifxml (void), cm_ifnotxml (void), cm_xml (int arg);
+extern void handle_verbatim_environment (int find_end_verbatim);
+extern void begin_insertion (enum insertion_type type);
+extern void pop_insertion (void);
+extern void discard_insertions (int specials_ok);
+
+extern int is_in_insertion_of_type (int type);
+extern int command_needs_braces (char *cmd);
+
+extern enum insertion_type find_type_from_name (char *name);
#endif /* !INSERTION_H */
diff --git a/contrib/texinfo/makeinfo/lang.c b/contrib/texinfo/makeinfo/lang.c
index 2938196..c72e8db 100644
--- a/contrib/texinfo/makeinfo/lang.c
+++ b/contrib/texinfo/makeinfo/lang.c
@@ -1,7 +1,8 @@
/* lang.c -- language-dependent support.
- $Id: lang.c,v 1.8 2003/05/01 00:05:27 karl Exp $
+ $Id: lang.c,v 1.14 2004/11/22 23:57:33 karl Exp $
- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+ Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,6 +22,7 @@
#include "system.h"
#include "cmds.h"
+#include "files.h"
#include "lang.h"
#include "makeinfo.h"
#include "xml.h"
@@ -31,6 +33,9 @@ encoding_code_type document_encoding_code = no_encoding;
/* Current language code; default is English. */
language_code_type language_code = en;
+/* By default, unsupported encoding is an empty string. */
+char *unknown_encoding = NULL;
+
static iso_map_type us_ascii_map [] = {{NULL, 0, 0}}; /* ASCII map is trivial */
/* Translation table between HTML and ISO Codes. The last item is
@@ -137,6 +142,126 @@ static iso_map_type iso8859_1_map [] = {
{ NULL, 0, 0 }
};
+
+/* ISO 8859-15, also known as Latin 9, differs from Latin 1 in only a
+ few positions. http://www.cs.tut.fi/~jkorpela/latin9.html has a good
+ explanation and listing, summarized here. The names are abbreviated
+ from the official Unicode names, to fit in a decent line length.
+
+ code position
+ dec oct hex latin1 latin1 name latin9 latin9 name
+
+ 164 0244 0xA4 U+00A4 currency symbol U+20AC euro sign
+ 166 0246 0xA6 U+00A6 broken bar U+0160 S with caron
+ 168 0250 0xA8 U+00A8 diaeresis U+0161 s with caron
+ 180 0264 0xB4 U+00B4 acute accent U+017D Z with caron
+ 184 0270 0xB8 U+00B8 cedilla U+017E z with caron
+ 188 0274 0xBC U+00BC fraction 1/4 U+0152 ligature OE
+ 189 0275 0xBD U+00BD fraction 1/2 U+0153 ligature oe
+ 190 0276 0xBE U+00BE fraction 3/4 U+0178 Y with diaeresis
+*/
+
+static iso_map_type iso8859_15_map [] = {
+ { "nbsp", 0xA0, 0x00A0 },
+ { "iexcl", 0xA1, 0x00A1 },
+ { "cent", 0xA2, 0x00A2 },
+ { "pound", 0xA3, 0x00A3 },
+ { "euro", 0xA4, 0x20AC },
+ { "yen", 0xA5, 0x00A5 },
+ { "Scaron", 0xA6, 0x0160 },
+ { "sect", 0xA7, 0x00A7 },
+ { "scaron", 0xA8, 0x0161 },
+ { "copy", 0xA9, 0x00A9 },
+ { "ordf", 0xAA, 0x00AA },
+ { "laquo", 0xAB, 0x00AB },
+ { "not", 0xAC, 0x00AC },
+ { "shy", 0xAD, 0x00AD },
+ { "reg", 0xAE, 0x00AE },
+ { "hibar", 0xAF, 0x00AF },
+ { "deg", 0xB0, 0x00B0 },
+ { "plusmn", 0xB1, 0x00B1 },
+ { "sup2", 0xB2, 0x00B2 },
+ { "sup3", 0xB3, 0x00B3 },
+ { "Zcaron", 0xB4, 0x017D },
+ { "micro", 0xB5, 0x00B5 },
+ { "para", 0xB6, 0x00B6 },
+ { "middot", 0xB7, 0x00B7 },
+ { "zcaron", 0xB8, 0x017E },
+ { "sup1", 0xB9, 0x00B9 },
+ { "ordm", 0xBA, 0x00BA },
+ { "raquo", 0xBB, 0x00BB },
+ { "OElig", 0xBC, 0x0152 },
+ { "oelig", 0xBD, 0x0153 },
+ { "Yuml", 0xBE, 0x0178 },
+ { "iquest", 0xBF, 0x00BF },
+ { "Agrave", 0xC0, 0x00C0 },
+ { "Aacute", 0xC1, 0x00C1 },
+ { "Acirc", 0xC2, 0x00C2 },
+ { "Atilde", 0xC3, 0x00C3 },
+ { "Auml", 0xC4, 0x00C4 },
+ { "Aring", 0xC5, 0x00C5 },
+ { "AElig", 0xC6, 0x00C6 },
+ { "Ccedil", 0xC7, 0x00C7 },
+ { "Ccedil", 0xC7, 0x00C7 },
+ { "Egrave", 0xC8, 0x00C8 },
+ { "Eacute", 0xC9, 0x00C9 },
+ { "Ecirc", 0xCA, 0x00CA },
+ { "Euml", 0xCB, 0x00CB },
+ { "Igrave", 0xCC, 0x00CC },
+ { "Iacute", 0xCD, 0x00CD },
+ { "Icirc", 0xCE, 0x00CE },
+ { "Iuml", 0xCF, 0x00CF },
+ { "ETH", 0xD0, 0x00D0 },
+ { "Ntilde", 0xD1, 0x00D1 },
+ { "Ograve", 0xD2, 0x00D2 },
+ { "Oacute", 0xD3, 0x00D3 },
+ { "Ocirc", 0xD4, 0x00D4 },
+ { "Otilde", 0xD5, 0x00D5 },
+ { "Ouml", 0xD6, 0x00D6 },
+ { "times", 0xD7, 0x00D7 },
+ { "Oslash", 0xD8, 0x00D8 },
+ { "Ugrave", 0xD9, 0x00D9 },
+ { "Uacute", 0xDA, 0x00DA },
+ { "Ucirc", 0xDB, 0x00DB },
+ { "Uuml", 0xDC, 0x00DC },
+ { "Yacute", 0xDD, 0x00DD },
+ { "THORN", 0xDE, 0x00DE },
+ { "szlig", 0xDF, 0x00DF },
+ { "agrave", 0xE0, 0x00E0 },
+ { "aacute", 0xE1, 0x00E1 },
+ { "acirc", 0xE2, 0x00E2 },
+ { "atilde", 0xE3, 0x00E3 },
+ { "auml", 0xE4, 0x00E4 },
+ { "aring", 0xE5, 0x00E5 },
+ { "aelig", 0xE6, 0x00E6 },
+ { "ccedil", 0xE7, 0x00E7 },
+ { "egrave", 0xE8, 0x00E8 },
+ { "eacute", 0xE9, 0x00E9 },
+ { "ecirc", 0xEA, 0x00EA },
+ { "euml", 0xEB, 0x00EB },
+ { "igrave", 0xEC, 0x00EC },
+ { "iacute", 0xED, 0x00ED },
+ { "icirc", 0xEE, 0x00EE },
+ { "iuml", 0xEF, 0x00EF },
+ { "eth", 0xF0, 0x00F0 },
+ { "ntilde", 0xF1, 0x00F1 },
+ { "ograve", 0xF2, 0x00F2 },
+ { "oacute", 0xF3, 0x00F3 },
+ { "ocirc", 0xF4, 0x00F4 },
+ { "otilde", 0xF5, 0x00F5 },
+ { "ouml", 0xF6, 0x00F6 },
+ { "divide", 0xF7, 0x00F7 },
+ { "oslash", 0xF8, 0x00F8 },
+ { "ugrave", 0xF9, 0x00F9 },
+ { "uacute", 0xFA, 0x00FA },
+ { "ucirc", 0xFB, 0x00FB },
+ { "uuml", 0xFC, 0x00FC },
+ { "yacute", 0xFD, 0x00FD },
+ { "thorn", 0xFE, 0x00FE },
+ { "yuml", 0xFF, 0x00FF },
+ { NULL, 0, 0 }
+};
+
/* Date: Mon, 31 Mar 2003 00:19:28 +0200
@@ -262,21 +387,21 @@ static iso_map_type iso8859_2_map [] = {
encoding_type encoding_table[] = {
{ no_encoding, "(no encoding)", NULL },
{ US_ASCII, "US-ASCII", us_ascii_map },
- { ISO_8859_1, "ISO-8859-1", (iso_map_type *) iso8859_1_map },
- { ISO_8859_2, "ISO-8859-2", (iso_map_type *) iso8859_2_map },
- { ISO_8859_3, "ISO-8859-3", NULL },
- { ISO_8859_4, "ISO-8859-4", NULL },
- { ISO_8859_5, "ISO-8859-5", NULL },
- { ISO_8859_6, "ISO-8859-6", NULL },
- { ISO_8859_7, "ISO-8859-7", NULL },
- { ISO_8859_8, "ISO-8859-8", NULL },
- { ISO_8859_9, "ISO-8859-9", NULL },
- { ISO_8859_10, "ISO-8859-10", NULL },
- { ISO_8859_11, "ISO-8859-11", NULL },
- { ISO_8859_12, "ISO-8859-12", NULL },
- { ISO_8859_13, "ISO-8859-13", NULL },
- { ISO_8859_14, "ISO-8859-14", NULL },
- { ISO_8859_15, "ISO-8859-15", NULL },
+ { ISO_8859_1, "iso-8859-1", (iso_map_type *) iso8859_1_map },
+ { ISO_8859_2, "iso-8859-2", (iso_map_type *) iso8859_2_map },
+ { ISO_8859_3, "iso-8859-3", NULL },
+ { ISO_8859_4, "iso-8859-4", NULL },
+ { ISO_8859_5, "iso-8859-5", NULL },
+ { ISO_8859_6, "iso-8859-6", NULL },
+ { ISO_8859_7, "iso-8859-7", NULL },
+ { ISO_8859_8, "iso-8859-8", NULL },
+ { ISO_8859_9, "iso-8859-9", NULL },
+ { ISO_8859_10, "iso-8859-10", NULL },
+ { ISO_8859_11, "iso-8859-11", NULL },
+ { ISO_8859_12, "iso-8859-12", NULL },
+ { ISO_8859_13, "iso-8859-13", NULL },
+ { ISO_8859_14, "iso-8859-14", NULL },
+ { ISO_8859_15, "iso-8859-15", (iso_map_type *) iso8859_15_map },
{ last_encoding_code, NULL, NULL }
};
@@ -423,13 +548,16 @@ language_type language_table[] = {
{ zu, "zu", "Zulu" },
{ last_language_code, NULL, NULL }
};
-
-
/* @documentlanguage. Maybe we'll do something useful with this in the
future. For now, we just recognize it. */
+
+/* XML documents can make use of this data. Unfortunately, it clashes with
+ the structure currently used. So instead of enclosing content into
+ a language block, we just output an empty element. Anyways, a stream based
+ parser can make good use of it. */
void
-cm_documentlanguage ()
+cm_documentlanguage (void)
{
language_code_type c;
char *lang_arg;
@@ -451,6 +579,12 @@ cm_documentlanguage ()
if (c == last_language_code)
warning (_("%s is not a valid ISO 639 language code"), lang_arg);
+ if (xml && !docbook)
+ {
+ xml_insert_element_with_attribute (DOCUMENTLANGUAGE, START, "xml:lang=\"%s\"", lang_arg);
+ xml_insert_element (DOCUMENTLANGUAGE, END);
+ }
+
free (lang_arg);
}
@@ -460,8 +594,7 @@ cm_documentlanguage ()
its equivalent. */
static int
-cm_search_iso_map (html)
- char *html;
+cm_search_iso_map (char *html)
{
int i;
iso_map_type *iso = encoding_table[document_encoding_code].isotab;
@@ -483,43 +616,88 @@ cm_search_iso_map (html)
/* @documentencoding. Set the translation table. */
void
-cm_documentencoding ()
+cm_documentencoding (void)
{
- encoding_code_type enc;
- char *enc_arg;
-
- get_rest_of_line (1, &enc_arg);
-
- /* See if we have this encoding. */
- for (enc = no_encoding+1; enc != last_encoding_code; enc++)
+ if (!handling_delayed_writes)
{
- if (strcasecmp (enc_arg, encoding_table[enc].encname) == 0)
+ encoding_code_type enc;
+ char *enc_arg;
+
+ /* This is ugly and probably needs to apply to other commands'
+ argument parsing as well. When we're doing @documentencoding,
+ we're generally in the frontmatter of the document, and so the.
+ expansion in html/xml/docbook would generally be the empty string.
+ (Because those modes wait until the first normal text of the
+ document to start outputting.) The result would thus be a warning
+ "unrecognized encoding name `'". Sigh. */
+ int save_html = html;
+ int save_xml = xml;
+
+ html = 0;
+ xml = 0;
+ get_rest_of_line (1, &enc_arg);
+ html = save_html;
+ xml = save_xml;
+
+ /* See if we have this encoding. */
+ for (enc = no_encoding+1; enc != last_encoding_code; enc++)
{
- document_encoding_code = enc;
- break;
+ if (strcasecmp (enc_arg, encoding_table[enc].encname) == 0)
+ {
+ document_encoding_code = enc;
+ break;
+ }
+ }
+
+ /* If we didn't find this code, complain. */
+ if (enc == last_encoding_code)
+ {
+ warning (_("unrecognized encoding name `%s'"), enc_arg);
+ /* Let the previous one go. */
+ if (unknown_encoding && *unknown_encoding)
+ free (unknown_encoding);
+ unknown_encoding = xstrdup (enc_arg);
}
+
+ else if (encoding_table[document_encoding_code].isotab == NULL)
+ warning (_("sorry, encoding `%s' not supported"), enc_arg);
+
+ free (enc_arg);
}
+ else if (xml)
+ {
+ char *encoding = current_document_encoding ();
- /* If we didn't find this code, complain. */
- if (enc == last_encoding_code)
- warning (_("unrecognized encoding name `%s'"), enc_arg);
+ if (encoding && *encoding)
+ {
+ insert_string (" encoding=\"");
+ insert_string (encoding);
+ insert_string ("\"");
+ }
- else if (encoding_table[document_encoding_code].isotab == NULL)
- warning (_("sorry, encoding `%s' not supported"), enc_arg);
+ free (encoding);
+ }
+}
- free (enc_arg);
+char *
+current_document_encoding (void)
+{
+ if (document_encoding_code != no_encoding)
+ return xstrdup (encoding_table[document_encoding_code].encname);
+ else if (unknown_encoding && *unknown_encoding)
+ return xstrdup (unknown_encoding);
+ else
+ return xstrdup ("");
}
-/* If html or xml output, add HTML_STR to the output. If not html and
+/* If html or xml output, add &HTML_STR; to the output. If not html and
the user requested encoded output, add the real 8-bit character
corresponding to HTML_STR from the translation tables. Otherwise,
add INFO_STR. */
-void
-add_encoded_char (html_str, info_str)
- char *html_str;
- char *info_str;
+static void
+add_encoded_char (char *html_str, char *info_str)
{
if (html)
add_word_args ("&%s;", html_str);
@@ -547,13 +725,8 @@ add_encoded_char (html_str, info_str)
/* Output an accent for HTML or XML. */
static void
-cm_accent_generic_html (arg, start, end, html_supported, single,
- html_solo_standalone, html_solo)
- int arg, start, end;
- char *html_supported;
- int single;
- int html_solo_standalone;
- char *html_solo;
+cm_accent_generic_html (int arg, int start, int end, char *html_supported,
+ int single, int html_solo_standalone, char *html_solo)
{
static int valid_html_accent; /* yikes */
@@ -569,20 +742,39 @@ cm_accent_generic_html (arg, start, end, html_supported, single,
escape_html = saved_escape_html;
}
else
- {
- valid_html_accent = 0;
- if (html_solo_standalone)
- { /* No special HTML support, so produce standalone char. */
- if (xml)
- xml_insert_entity (html_solo);
+ { /* @dotless{i} is not listed in html_supported but HTML entities
+ starting with `i' can be used, such as î. */
+ int save_input_text_offset = input_text_offset;
+ char *accent_contents;
+
+ get_until_in_braces ("\n", &accent_contents);
+ canon_white (accent_contents);
+
+ if (strstr (accent_contents, "@dotless{i"))
+ {
+ add_word_args ("&%c", accent_contents[9]);
+ valid_html_accent = 1;
+ }
+ else
+ {
+ /* Search for @dotless{} wasn't successful, so rewind. */
+ input_text_offset = save_input_text_offset;
+ valid_html_accent = 0;
+ if (html_solo_standalone)
+ { /* No special HTML support, so produce standalone char. */
+ if (xml)
+ xml_insert_entity (html_solo);
+ else
+ add_word_args ("&%s;", html_solo);
+ }
else
- add_word_args ("&%s;", html_solo);
- }
- else
- /* If the html_solo does not exist as standalone character
- (namely ˆ ` ˜), then we use
- the single character version instead. */
- add_char (single);
+ /* If the html_solo does not exist as standalone character
+ (namely ˆ ` ˜), then we use
+ the single character version instead. */
+ add_char (single);
+ }
+
+ free (accent_contents);
}
}
else if (arg == END)
@@ -598,10 +790,8 @@ cm_accent_generic_html (arg, start, end, html_supported, single,
static void
-cm_accent_generic_no_headers (arg, start, end, single, html_solo)
- int arg, start, end;
- int single;
- char *html_solo;
+cm_accent_generic_no_headers (int arg, int start, int end, int single,
+ char *html_solo)
{
if (arg == END)
{
@@ -628,8 +818,11 @@ cm_accent_generic_no_headers (arg, start, end, single, html_solo)
{ /* If we didn't find a translation for this character,
put the single instead. E.g., &Xuml; does not exist so X¨
should be produced. */
- warning (_("%s is an invalid ISO code, using %c"),
- buffer, single);
+ /* When the below warning is issued, an author has nothing
+ wrong in their document, let alone anything ``fixable''
+ on their side. So it is commented out for now. */
+ /* warning (_("%s is an invalid ISO code, using %c"),
+ buffer, single); */
add_char (single);
}
@@ -644,8 +837,7 @@ cm_accent_generic_no_headers (arg, start, end, single, html_solo)
special HTML support. */
void
-cm_accent (arg)
- int arg;
+cm_accent (int arg)
{
int old_escape_html = escape_html;
escape_html = 0;
@@ -687,14 +879,14 @@ cm_accent (arg)
exists as valid standalone character in HTML, e.g., ¨. */
static void
-cm_accent_generic (arg, start, end, html_supported, single,
- html_solo_standalone, html_solo)
- int arg, start, end;
- char *html_supported;
- int single;
- int html_solo_standalone;
- char *html_solo;
+cm_accent_generic (int arg, int start, int end, char *html_supported,
+ int single, int html_solo_standalone, char *html_solo)
{
+ /* Accentuating space characters makes no sense, so issue a warning. */
+ if (arg == START && isspace (input_text[input_text_offset]))
+ warning ("Accent command `@%s' must not be followed by whitespace",
+ command);
+
if (html || xml)
cm_accent_generic_html (arg, start, end, html_supported,
single, html_solo_standalone, html_solo);
@@ -712,43 +904,37 @@ cm_accent_generic (arg, start, end, html_supported, single,
}
void
-cm_accent_umlaut (arg, start, end)
- int arg, start, end;
+cm_accent_umlaut (int arg, int start, int end)
{
cm_accent_generic (arg, start, end, "aouAOUEeIiy", '"', 1, "uml");
}
void
-cm_accent_acute (arg, start, end)
- int arg, start, end;
+cm_accent_acute (int arg, int start, int end)
{
cm_accent_generic (arg, start, end, "AEIOUYaeiouy", '\'', 1, "acute");
}
void
-cm_accent_cedilla (arg, start, end)
- int arg, start, end;
+cm_accent_cedilla (int arg, int start, int end)
{
cm_accent_generic (arg, start, end, "Cc", ',', 1, "cedil");
}
void
-cm_accent_hat (arg, start, end)
- int arg, start, end;
+cm_accent_hat (int arg, int start, int end)
{
cm_accent_generic (arg, start, end, "AEIOUaeiou", '^', 0, "circ");
}
void
-cm_accent_grave (arg, start, end)
- int arg, start, end;
+cm_accent_grave (int arg, int start, int end)
{
cm_accent_generic (arg, start, end, "AEIOUaeiou", '`', 0, "grave");
}
void
-cm_accent_tilde (arg, start, end)
- int arg, start, end;
+cm_accent_tilde (int arg, int start, int end)
{
cm_accent_generic (arg, start, end, "ANOano", '~', 0, "tilde");
}
@@ -757,7 +943,7 @@ cm_accent_tilde (arg, start, end)
/* Non-English letters/characters that don't insert themselves. */
void
-cm_special_char (arg)
+cm_special_char (int arg)
{
int old_escape_html = escape_html;
escape_html = 0;
@@ -769,27 +955,35 @@ cm_special_char (arg)
&& command[1] == 0)
{ /* Lslash lslash Oslash oslash.
Lslash and lslash aren't supported in HTML. */
- if ((html || xml) && command[0] == 'O')
+ if (command[0] == 'O')
add_encoded_char ("Oslash", "/O");
- else if ((html || xml) && command[0] == 'o')
+ else if (command[0] == 'o')
add_encoded_char ("oslash", "/o");
else
add_word_args ("/%c", command[0]);
}
else if (strcmp (command, "exclamdown") == 0)
add_encoded_char ("iexcl", "!");
- else if (strcmp (command, "pounds") == 0)
- add_encoded_char ("pound" , "#");
else if (strcmp (command, "questiondown") == 0)
add_encoded_char ("iquest", "?");
+ else if (strcmp (command, "euro") == 0)
+ /* http://www.cs.tut.fi/~jkorpela/html/euro.html suggests that
+ € degrades best in old browsers. */
+ add_encoded_char ("euro", "Euro ");
+ else if (strcmp (command, "pounds") == 0)
+ add_encoded_char ("pound" , "#");
+ else if (strcmp (command, "ordf") == 0)
+ add_encoded_char ("ordf" , "a");
+ else if (strcmp (command, "ordm") == 0)
+ add_encoded_char ("ordm" , "o");
else if (strcmp (command, "AE") == 0)
add_encoded_char ("AElig", command);
else if (strcmp (command, "ae") == 0)
add_encoded_char ("aelig", command);
else if (strcmp (command, "OE") == 0)
- add_encoded_char ("#140", command);
+ add_encoded_char ("OElig", command);
else if (strcmp (command, "oe") == 0)
- add_encoded_char ("#156", command);
+ add_encoded_char ("oelig", command);
else if (strcmp (command, "AA") == 0)
add_encoded_char ("Aring", command);
else if (strcmp (command, "aa") == 0)
@@ -804,8 +998,7 @@ cm_special_char (arg)
/* Dotless i or j. */
void
-cm_dotless (arg, start, end)
- int arg, start, end;
+cm_dotless (int arg, int start, int end)
{
if (arg == END)
{
diff --git a/contrib/texinfo/makeinfo/lang.h b/contrib/texinfo/makeinfo/lang.h
index a1e9489..b231455 100644
--- a/contrib/texinfo/makeinfo/lang.h
+++ b/contrib/texinfo/makeinfo/lang.h
@@ -1,5 +1,5 @@
/* lang.h -- declarations for language codes etc.
- $Id: lang.h,v 1.4 2003/05/01 00:05:27 karl Exp $
+ $Id: lang.h,v 1.6 2004/04/11 17:56:47 karl Exp $
Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
@@ -73,34 +73,35 @@ extern language_type language_table[];
-/* The document encoding. This is usefull if we working e.g.
- * with german Texinfo so we can produce correct german umlaut
- * while creating output (--no-headers ASCII like).
- */
+/* The document encoding. This is useful to produce true 8-bit
+ characters according to the @documentencoding. */
+
typedef enum {
- no_encoding,
- US_ASCII,
- ISO_8859_1,
- ISO_8859_2,
- ISO_8859_3, /* this and none of the rest are supported. */
- ISO_8859_4,
- ISO_8859_5,
- ISO_8859_6,
- ISO_8859_7,
- ISO_8859_8,
- ISO_8859_9,
- ISO_8859_10,
- ISO_8859_11,
- ISO_8859_12,
- ISO_8859_13,
- ISO_8859_14,
- ISO_8859_15,
- last_encoding_code
+ no_encoding,
+ US_ASCII,
+ ISO_8859_1,
+ ISO_8859_2,
+ ISO_8859_3, /* this and none of the rest are supported. */
+ ISO_8859_4,
+ ISO_8859_5,
+ ISO_8859_6,
+ ISO_8859_7,
+ ISO_8859_8,
+ ISO_8859_9,
+ ISO_8859_10,
+ ISO_8859_11,
+ ISO_8859_12,
+ ISO_8859_13,
+ ISO_8859_14,
+ ISO_8859_15,
+ last_encoding_code
} encoding_code_type;
/* The current document encoding, or null if not set. */
extern encoding_code_type document_encoding_code;
+/* If an encoding is not supported, just keep it as a string. */
+extern char *unknown_encoding;
/* Maps an HTML abbreviation to ISO and Unicode codes for a given code. */
@@ -118,7 +119,8 @@ typedef struct
typedef struct
{
encoding_code_type ec; /* document encoding type (see above enum) */
- char *encname; /* encoding name like "ISO-8859-1", valid in Emacs */
+ char *encname; /* encoding name like "iso-8859-1", valid in
+ HTML and Emacs */
iso_map_type *isotab; /* address of ISO translation table */
} encoding_type;
@@ -127,12 +129,20 @@ extern encoding_type encoding_table[];
/* The commands. */
-extern void cm_documentlanguage (), cm_documentencoding ();
+extern void cm_documentlanguage (void),
+ cm_documentencoding (void);
/* Accents, other non-English characters. */
-void cm_accent (), cm_special_char (), cm_dotless ();
+void cm_accent (int arg), cm_special_char (int arg),
+ cm_dotless (int arg, int start, int end);
+
+extern void cm_accent_umlaut (int arg, int start, int end),
+ cm_accent_acute (int arg, int start, int end),
+ cm_accent_cedilla (int arg, int start, int end),
+ cm_accent_hat (int arg, int start, int end),
+ cm_accent_grave (int arg, int start, int end),
+ cm_accent_tilde (int arg, int start, int end);
-extern void cm_accent_umlaut (), cm_accent_acute (), cm_accent_cedilla (),
- cm_accent_hat (), cm_accent_grave (), cm_accent_tilde ();
+extern char *current_document_encoding (void);
#endif /* not LANG_H */
diff --git a/contrib/texinfo/makeinfo/macro.c b/contrib/texinfo/makeinfo/macro.c
index ef33a53..65ac0da 100644
--- a/contrib/texinfo/makeinfo/macro.c
+++ b/contrib/texinfo/makeinfo/macro.c
@@ -1,5 +1,5 @@
/* macro.c -- user-defined macros for Texinfo.
- $Id: macro.c,v 1.2 2003/06/01 23:41:23 karl Exp $
+ $Id: macro.c,v 1.6 2004/04/11 17:56:47 karl Exp $
Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
@@ -19,6 +19,7 @@
#include "system.h"
#include "cmds.h"
+#include "files.h"
#include "macro.h"
#include "makeinfo.h"
#include "insertion.h"
@@ -54,8 +55,7 @@ int macro_list_size = 0; /* Number of slots in total. */
/* Return the length of the array in ARRAY. */
int
-array_len (array)
- char **array;
+array_len (char **array)
{
int i = 0;
@@ -66,8 +66,7 @@ array_len (array)
}
void
-free_array (array)
- char **array;
+free_array (char **array)
{
if (array)
{
@@ -81,8 +80,7 @@ free_array (array)
/* Return the macro definition of NAME or NULL if NAME is not defined. */
MACRO_DEF *
-find_macro (name)
- char *name;
+find_macro (char *name)
{
int i;
MACRO_DEF *def;
@@ -101,13 +99,9 @@ find_macro (name)
and SOURCE_LINENO is the line number within that file. If a macro already
exists with NAME, then a warning is produced, and that previous
definition is overwritten. */
-void
-add_macro (name, arglist, body, source_file, source_lineno, flags)
- char *name;
- char **arglist;
- char *body;
- char *source_file;
- int source_lineno, flags;
+static void
+add_macro (char *name, char **arglist, char *body, char *source_file,
+ int source_lineno, int flags)
{
MACRO_DEF *def;
@@ -163,8 +157,7 @@ add_macro (name, arglist, body, source_file, source_lineno, flags)
char **
-get_brace_args (quote_single)
- int quote_single;
+get_brace_args (int quote_single)
{
char **arglist, *word;
int arglist_index, arglist_size;
@@ -243,9 +236,8 @@ get_brace_args (quote_single)
return arglist;
}
-char **
-get_macro_args (def)
- MACRO_DEF *def;
+static char **
+get_macro_args (MACRO_DEF *def)
{
int i;
char *word;
@@ -298,9 +290,8 @@ get_macro_args (def)
/* Substitute actual parameters for named parameters in body.
The named parameters which appear in BODY must by surrounded
reverse slashes, as in \foo\. */
-char *
-apply (named, actuals, body)
- char **named, **actuals, *body;
+static char *
+apply (char **named, char **actuals, char *body)
{
int i;
int new_body_index, new_body_size;
@@ -391,8 +382,7 @@ apply (named, actuals, body)
/* Expand macro passed in DEF, a pointer to a MACRO_DEF, and
return its expansion as a string. */
char *
-expand_macro (def)
- MACRO_DEF *def;
+expand_macro (MACRO_DEF *def)
{
char **arglist;
int num_args;
@@ -422,8 +412,7 @@ expand_macro (def)
/* Execute the macro passed in DEF, a pointer to a MACRO_DEF. */
void
-execute_macro (def)
- MACRO_DEF *def;
+execute_macro (MACRO_DEF *def)
{
char *execution_string;
int start_line = line_number, end_line;
@@ -444,7 +433,8 @@ execute_macro (def)
end_line = line_number;
line_number = start_line;
- if (macro_expansion_output_stream && !executing_string && !me_inhibit_expansion)
+ if (macro_expansion_output_stream
+ && !executing_string && !me_inhibit_expansion)
{
remember_itext (input_text, input_text_offset);
me_execute_string (execution_string);
@@ -462,21 +452,17 @@ execute_macro (def)
set the ME_RECURSE flag. MACTYPE is either "macro" or "rmacro", and
tells us what the matching @end should be. */
static void
-define_macro (mactype, recursive)
- char *mactype;
- int recursive;
+define_macro (char *mactype, int recursive)
{
- int i;
- char *name, **arglist, *body, *line, *last_end;
- int body_size, body_index;
+ int i, start;
+ char *name, *line;
+ char *last_end = NULL;
+ char *body = NULL;
+ char **arglist = NULL;
+ int body_size = 0, body_index = 0;
int depth = 1;
- int defining_line = line_number;
int flags = 0;
-
- arglist = NULL;
- body = NULL;
- body_size = 0;
- body_index = 0;
+ int defining_line = line_number;
if (macro_expansion_output_stream && !executing_string)
me_append_before_this_command ();
@@ -485,15 +471,13 @@ define_macro (mactype, recursive)
/* 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 start = input_text_offset;
int len;
- for (i = start;
- (i < input_text_length) &&
- (input_text[i] != '{') &&
- (!cr_or_whitespace (input_text[i]));
- i++);
+ for (i = start; i < input_text_length && input_text[i] != '{'
+ && !cr_or_whitespace (input_text[i]);
+ i++) ;
len = i - start;
name = xmalloc (1 + len);
@@ -653,7 +637,7 @@ define_macro (mactype, recursive)
depth--;
last_end = "macro";
}
- if (*line == COMMAND_PREFIX && strncmp (line + 1, "end rmacro", 9) == 0)
+ if (*line == COMMAND_PREFIX && strncmp (line + 1, "end rmacro", 10) == 0)
{
depth--;
last_end = "rmacro";
@@ -697,17 +681,32 @@ define_macro (mactype, recursive)
add_macro (name, arglist, body, input_filename, defining_line, flags);
if (macro_expansion_output_stream && !executing_string)
- remember_itext (input_text, input_text_offset);
+ {
+ /* 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
-cm_macro ()
+cm_macro (void)
{
define_macro ("macro", 0);
}
void
-cm_rmacro ()
+cm_rmacro (void)
{
define_macro ("rmacro", 1);
}
@@ -717,8 +716,7 @@ cm_rmacro ()
returned. */
static MACRO_DEF *
-delete_macro (name)
- char *name;
+delete_macro (char *name)
{
int i;
MACRO_DEF *def;
@@ -737,7 +735,7 @@ delete_macro (name)
}
void
-cm_unmacro ()
+cm_unmacro (void)
{
int i;
char *line, *name;
@@ -785,9 +783,7 @@ cm_unmacro ()
/* Set the value of POINTER's offset to OFFSET. */
ITEXT *
-remember_itext (pointer, offset)
- char *pointer;
- int offset;
+remember_itext (char *pointer, int offset)
{
int i;
ITEXT *itext = NULL;
@@ -841,8 +837,7 @@ remember_itext (pointer, offset)
/* Forget the input text associated with POINTER. */
void
-forget_itext (pointer)
- char *pointer;
+forget_itext (char *pointer)
{
int i;
@@ -858,7 +853,7 @@ forget_itext (pointer)
/* Append the text which appeared in input_text from the last offset to
the character just before the command that we are currently executing. */
void
-me_append_before_this_command ()
+me_append_before_this_command (void)
{
int i;
@@ -870,8 +865,7 @@ me_append_before_this_command ()
/* Similar to execute_string, but only takes a single string argument,
and remembers the input text location, etc. */
void
-me_execute_string (execution_string)
- char *execution_string;
+me_execute_string (char *execution_string)
{
int saved_escape_html = escape_html;
int saved_in_paragraph = in_paragraph;
@@ -903,8 +897,7 @@ me_execute_string (execution_string)
when we need to produce macro-expanded output for input which
leaves no traces in the Info output. */
void
-me_execute_string_keep_state (execution_string, append_string)
- char *execution_string, *append_string;
+me_execute_string_keep_state (char *execution_string, char *append_string)
{
int op_orig, opcol_orig, popen_orig;
int fill_orig, newline_orig, indent_orig, meta_pos_orig;
@@ -934,8 +927,7 @@ me_execute_string_keep_state (execution_string, append_string)
/* Append the text which appears in input_text from the last offset to
the current OFFSET. */
void
-append_to_expansion_output (offset)
- int offset;
+append_to_expansion_output (int offset)
{
int i;
ITEXT *itext = NULL;
@@ -959,9 +951,7 @@ append_to_expansion_output (offset)
/* Only write this input text iff it appears in our itext list. */
void
-maybe_write_itext (pointer, offset)
- char *pointer;
- int offset;
+maybe_write_itext (char *pointer, int offset)
{
int i;
ITEXT *itext = NULL;
@@ -981,9 +971,7 @@ maybe_write_itext (pointer, offset)
}
void
-write_region_to_macro_output (string, start, end)
- char *string;
- int start, end;
+write_region_to_macro_output (char *string, int start, int end)
{
if (macro_expansion_output_stream)
fwrite (string + start, 1, end - start, macro_expansion_output_stream);
@@ -1000,14 +988,15 @@ typedef struct alias_struct
static alias_type *aliases;
-/* @alias */
+/* @alias aname = cmdname */
+
void
-cm_alias ()
+cm_alias (void)
{
alias_type *a = xmalloc (sizeof (alias_type));
skip_whitespace ();
- get_until_in_line (1, "=", &(a->alias));
+ get_until_in_line (0, "=", &(a->alias));
canon_white (a->alias);
discard_until ("=");
@@ -1020,8 +1009,7 @@ cm_alias ()
/* Perform an alias expansion. Called from read_command. */
char *
-alias_expand (tok)
- char *tok;
+alias_expand (char *tok)
{
alias_type *findit = aliases;
@@ -1062,7 +1050,7 @@ static enclosure_stack_type *enclosure_stack;
/* @definfoenclose */
void
-cm_definfoenclose ()
+cm_definfoenclose (void)
{
enclosure_type *e = xmalloc (sizeof (enclosure_type));
@@ -1081,8 +1069,7 @@ cm_definfoenclose ()
return 1. Else return 0. */
int
-enclosure_command (tok)
- char *tok;
+enclosure_command (char *tok)
{
enclosure_type *findit = enclosures;
@@ -1104,8 +1091,7 @@ enclosure_command (tok)
/* actually perform the enclosure expansion */
void
-enclosure_expand (arg, start, end)
- int arg, start, end;
+enclosure_expand (int arg, int start, int end)
{
if (arg == START)
add_word (enclosure_stack->current->before);
diff --git a/contrib/texinfo/makeinfo/macro.h b/contrib/texinfo/makeinfo/macro.h
index 5161084..fbc0e59 100644
--- a/contrib/texinfo/makeinfo/macro.h
+++ b/contrib/texinfo/makeinfo/macro.h
@@ -1,5 +1,5 @@
/* macro.h -- declarations for macro.c.
- $Id: macro.h,v 1.1 2002/08/25 23:38:38 karl Exp $
+ $Id: macro.h,v 1.2 2004/04/11 17:56:47 karl Exp $
Copyright (C) 1998, 99 Free Software Foundation, Inc.
@@ -48,24 +48,30 @@ typedef struct {
#define ME_RECURSE 0x01
#define ME_QUOTE_ARG 0x02
-extern void execute_macro ();
-extern MACRO_DEF *find_macro ();
-extern char *expand_macro ();
+extern void execute_macro (MACRO_DEF *def);
+extern MACRO_DEF *find_macro (char *name);
+extern char *expand_macro (MACRO_DEF *def);
-extern ITEXT *remember_itext ();
-extern void forget_itext ();
-extern void maybe_write_itext ();
-extern void write_region_to_macro_output ();
-extern void append_to_expansion_output ();
-extern void me_append_before_this_command ();
-extern void me_execute_string ();
+extern ITEXT *remember_itext (char *pointer, int offset);
+extern void forget_itext (char *pointer);
+extern void maybe_write_itext (char *pointer, int offset);
+extern void write_region_to_macro_output (char *string, int start, int end);
+extern void append_to_expansion_output (int offset);
+extern void me_append_before_this_command (void);
+extern void me_execute_string (char *execution_string);
+extern void me_execute_string_keep_state (char *execution_string,
+ char *append_string);
-extern char *alias_expand ();
-extern int enclosure_command ();
-extern void enclosure_expand ();
+extern char *alias_expand (char *tok);
+extern int enclosure_command (char *tok);
+extern void enclosure_expand (int arg, int start, int end);
/* The @commands. */
-extern void cm_macro (), cm_rmacro (), cm_unmacro ();
-extern void cm_alias (), cm_definfoenclose ();
+extern void cm_macro (void), cm_rmacro (void), cm_unmacro (void);
+extern void cm_alias (void), cm_definfoenclose (void);
+
+extern int array_len (char **array);
+extern void free_array (char **array);
+extern char **get_brace_args (int quote_single);
#endif /* not MACRO_H */
diff --git a/contrib/texinfo/makeinfo/makeinfo.c b/contrib/texinfo/makeinfo/makeinfo.c
index a5e63fc..22ed4c4 100644
--- a/contrib/texinfo/makeinfo/makeinfo.c
+++ b/contrib/texinfo/makeinfo/makeinfo.c
@@ -1,8 +1,8 @@
/* makeinfo -- convert Texinfo source into other formats.
- $Id: makeinfo.c,v 1.34 2003/06/02 12:32:29 karl Exp $
+ $Id: makeinfo.c,v 1.74 2004/12/19 17:15:42 karl Exp $
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- Makeinfo was authored by Brian Fox (bfox@ai.mit.edu). */
+ Original author of makeinfo: Brian Fox (bfox@ai.mit.edu). */
#include "system.h"
#include "getopt.h"
@@ -27,6 +27,7 @@
#include "makeinfo.h"
#include "cmds.h"
#include "files.h"
+#include "float.h"
#include "footnote.h"
#include "html.h"
#include "index.h"
@@ -34,6 +35,7 @@
#include "lang.h"
#include "macro.h"
#include "node.h"
+#include "sectioning.h"
#include "toc.h"
#include "xml.h"
@@ -69,10 +71,6 @@ char *output_filename = NULL;
char *command_output_filename = NULL;
static char *save_command_output_filename = NULL;
-/* Flags which control initial output string for xrefs. */
-int px_ref_flag = 0;
-int ref_flag = 0;
-
#define INITIAL_PARAGRAPH_SPACE 5000
int paragraph_buffer_len = INITIAL_PARAGRAPH_SPACE;
@@ -135,9 +133,16 @@ int do_justification = 0;
/* Nonzero means don't replace whitespace with in HTML mode. */
int in_html_elt = 0;
+/* Nonzero means we are inserting a block level HTML element that must not be
+ enclosed in a
, such as
, and . */
+int in_html_block_level_elt = 0;
+
/* True when expanding a macro definition. */
static int executing_macro = 0;
+/* True when we are inside a
block of a menu. */
+static int in_menu_item = 0;
+
typedef struct brace_element
{
struct brace_element *next;
@@ -149,64 +154,44 @@ typedef struct brace_element
BRACE_ELEMENT *brace_stack = NULL;
-extern void do_multitable (), end_multitable ();
-
-void push_node_filename (), pop_node_filename ();
-void remember_error ();
-void convert_from_stream (), convert_from_file (), convert_from_loaded_file ();
-void init_internals (), init_paragraph (), init_brace_stack ();
-void init_insertion_stack (), init_indices ();
-void init_tag_table (), write_tag_table (), write_tag_table_internal ();
-void validate_file (), validate_other_references (), split_file ();
-void free_node_references (), handle_variable ();
-void handle_variable_internal ();
-void normalize_node_name ();
-void add_anchor_name ();
-void free_node_node_references (), remember_node_node_reference ();
-
-char **get_brace_args ();
-int array_len ();
-void free_array ();
-static int end_of_sentence_p ();
-void reader_loop ();
-void remember_brace (), remember_brace_1 ();
-void pop_and_call_brace (), discard_braces ();
-void add_word (), add_char (), insert (), flush_output ();
-void insert_string ();
-void close_paragraph ();
-void ignore_blank_line ();
-void do_flush_right_indentation (), discard_insertions ();
-void start_paragraph (), indent ();
-void inhibit_output_flushing (), uninhibit_output_flushing ();
-int set_paragraph_indent ();
-int self_delimiting (), search_forward ();
-int multitable_item (), number_of_node ();
-
-void me_execute_string_keep_state ();
-void maybe_update_execution_strings ();
-
-extern char *escape_string ();
-extern void insert_html_tag ();
-extern void sectioning_html ();
-
-#if defined (VA_FPRINTF) && __STDC__
-/* Unfortunately we must use prototypes if we are to use . */
-void add_word_args (const char *, ...);
-void execute_string (char *, ...);
-#else
-void add_word_args ();
-void execute_string ();
-#endif /* no prototypes */
+static void convert_from_file (char *name);
+static void convert_from_loaded_file (char *name);
+static void convert_from_stream (FILE *stream, char *name);
+static void do_flush_right_indentation (void);
+static void handle_variable (int action);
+static void handle_variable_internal (int action, char *name);
+static void init_brace_stack (void);
+static void init_internals (void);
+static void pop_and_call_brace (void);
+static void remember_brace (COMMAND_FUNCTION (*proc));
+static int end_of_sentence_p (void);
+
+void maybe_update_execution_strings (char **text, unsigned int new_len);
/* Error handling. */
/* Number of errors encountered. */
int errors_printed = 0;
+/* Remember that an error has been printed. If more than
+ max_error_level have been printed, then exit the program. */
+static void
+remember_error (void)
+{
+ errors_printed++;
+ if (max_error_level && (errors_printed > max_error_level))
+ {
+ fprintf (stderr, _("Too many errors! Gave up.\n"));
+ flush_file_stack ();
+ if (errors_printed - max_error_level < 2)
+ cm_bye ();
+ xexit (1);
+ }
+}
+
/* Print the last error gotten from the file system. */
int
-fs_error (filename)
- char *filename;
+fs_error (char *filename)
{
remember_error ();
perror (filename);
@@ -329,24 +314,9 @@ warning (format, va_alist)
}
-/* Remember that an error has been printed. If more than
- max_error_level have been printed, then exit the program. */
-void
-remember_error ()
-{
- errors_printed++;
- if (max_error_level && (errors_printed > max_error_level))
- {
- fprintf (stderr, _("Too many errors! Gave up.\n"));
- flush_file_stack ();
- cm_bye ();
- xexit (1);
- }
-}
-
/* The other side of a malformed expression. */
-void
-misplaced_brace ()
+static void
+misplaced_brace (void)
{
line_error (_("Misplaced %c"), '}');
}
@@ -355,7 +325,7 @@ misplaced_brace ()
/* Display the version info of this invocation of Makeinfo. */
static void
-print_version_info ()
+print_version_info (void)
{
printf ("makeinfo (GNU %s) %s\n", PACKAGE, VERSION);
}
@@ -364,8 +334,7 @@ print_version_info ()
Otherwise, just say to use --help for more info.
Then exit with EXIT_VALUE. */
static void
-usage (exit_value)
- int exit_value;
+usage (int exit_value)
{
if (exit_value != 0)
fprintf (stderr, _("Try `%s --help' for more information.\n"), progname);
@@ -389,14 +358,15 @@ General options:\n\
-v, --verbose explain what is being done.\n\
--version display version information and exit.\n"),
max_error_level, reference_warning_limit);
- puts ("\n");
+ puts ("");
/* xgettext: no-wrap */
puts (_("\
Output format selection (default is to produce Info):\n\
- --docbook output DocBook XML rather than Info.\n\
+ --docbook output Docbook XML rather than Info.\n\
--html output HTML rather than Info.\n\
--xml output Texinfo XML rather than Info.\n\
+ --plaintext output plain text rather than Info.\n\
"));
puts (_("\
@@ -428,7 +398,7 @@ Options for Info and plain text:\n\
--split-size=NUM split Info files at size NUM (default %d).\n"),
fill_column, paragraph_start_indent,
DEFAULT_SPLIT_SIZE);
- puts ("\n");
+ puts ("");
puts (_("\
Options for HTML:\n\
@@ -436,6 +406,13 @@ Options for HTML:\n\
read stdin if FILE is -.\n\
"));
+ printf (_("\
+Options for XML and Docbook:\n\
+ --output-indent=VAL indent XML elements by VAL spaces (default %d).\n\
+ If VAL is 0, ignorable whitespace is dropped.\n\
+"), xml_indentation_increment);
+ puts ("");
+
puts (_("\
Input file options:\n\
--commands-in-node-names allow @ commands in node names.\n\
@@ -447,16 +424,21 @@ Input file options:\n\
puts (_("\
Conditional processing in input:\n\
+ --ifdocbook process @ifdocbook and @docbook even if\n\
+ not generating Docbook.\n\
--ifhtml process @ifhtml and @html even if not generating HTML.\n\
--ifinfo process @ifinfo even if not generating Info.\n\
--ifplaintext process @ifplaintext even if not generating plain text.\n\
--iftex process @iftex and @tex; implies --no-split.\n\
--ifxml process @ifxml and @xml.\n\
+ --no-ifdocbook do not process @ifdocbook and @docbook text.\n\
--no-ifhtml do not process @ifhtml and @html text.\n\
--no-ifinfo do not process @ifinfo text.\n\
--no-ifplaintext do not process @ifplaintext text.\n\
--no-iftex do not process @iftex and @tex text.\n\
--no-ifxml do not process @ifxml and @xml text.\n\
+\n\
+ Also, for the --no-ifFORMAT options, do process @ifnotFORMAT text.\n\
"));
puts (_("\
@@ -502,6 +484,7 @@ struct option long_options[] =
{ "force", 0, &force, 1 },
{ "help", 0, 0, 'h' },
{ "html", 0, 0, 'w' },
+ { "ifdocbook", 0, &process_docbook, 1 },
{ "ifhtml", 0, &process_html, 1 },
{ "ifinfo", 0, &process_info, 1 },
{ "ifplaintext", 0, &process_plaintext, 1 },
@@ -509,6 +492,7 @@ struct option long_options[] =
{ "ifxml", 0, &process_xml, 1 },
{ "macro-expand", 1, 0, 'E' },
{ "no-headers", 0, &no_headers, 1 },
+ { "no-ifdocbook", 0, &process_docbook, 0 },
{ "no-ifhtml", 0, &process_html, 0 },
{ "no-ifinfo", 0, &process_info, 0 },
{ "no-ifplaintext", 0, &process_plaintext, 0 },
@@ -523,7 +507,9 @@ struct option long_options[] =
{ "number-footnotes", 0, &number_footnotes, 1 },
{ "number-sections", 0, &number_sections, 1 },
{ "output", 1, 0, 'o' },
+ { "output-indent", 1, 0, 'i' },
{ "paragraph-indent", 1, 0, 'p' },
+ { "plaintext", 0, 0, 't' },
{ "reference-limit", 1, 0, 'r' },
{ "split-size", 1, 0, 'S'},
{ "verbose", 0, &verbose_mode, 1 },
@@ -532,14 +518,24 @@ struct option long_options[] =
{NULL, 0, NULL, 0}
};
+/* We use handle_variable_internal for -D and -U, and it depends on
+ execute_string, which depends on input_filename, which is not defined
+ while we are handling options. :-\ So we save these defines in this
+ struct, and handle them later. */
+typedef struct command_line_define
+{
+ struct command_line_define *next;
+ int action;
+ char *define;
+} COMMAND_LINE_DEFINE;
+
+static COMMAND_LINE_DEFINE *command_line_defines = NULL;
+
/* For each file mentioned in the command line, process it, turning
Texinfo commands into wonderfully formatted output text. */
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
- extern int errors_printed;
int c, ind;
int reading_from_stdin = 0;
@@ -547,17 +543,69 @@ main (argc, argv)
/* Do not use LC_ALL, because LC_NUMERIC screws up the scanf parsing
of the argument to @multicolumn. */
setlocale (LC_TIME, "");
+#ifdef LC_MESSAGES /* ultrix */
setlocale (LC_MESSAGES, "");
+#endif
setlocale (LC_CTYPE, "");
setlocale (LC_COLLATE, "");
#endif
+#ifdef ENABLE_NLS
/* Set the text message domain. */
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+#endif
+
+ /* If TEXINFO_OUTPUT_FORMAT envvar is set, use it to set default output.
+ Can be overridden with one of the output options. */
+ if (getenv ("TEXINFO_OUTPUT_FORMAT") != NULL)
+ {
+ if (STREQ (getenv ("TEXINFO_OUTPUT_FORMAT"), "docbook"))
+ {
+ splitting = 0;
+ html = 0;
+ docbook = 1;
+ xml = 1;
+ process_docbook = 1;
+ }
+ else if (STREQ (getenv ("TEXINFO_OUTPUT_FORMAT"), "html"))
+ {
+ html = 1;
+ docbook = 0;
+ xml = 0;
+ process_html = 1;
+ }
+ else if (STREQ (getenv ("TEXINFO_OUTPUT_FORMAT"), "info"))
+ {
+ html = 0;
+ docbook = 0;
+ xml = 0;
+ }
+ else if (STREQ (getenv ("TEXINFO_OUTPUT_FORMAT"), "plaintext"))
+ {
+ splitting = 0;
+ no_headers = 1;
+ html = 0;
+ docbook = 0;
+ xml = 0;
+ process_plaintext = 1;
+ }
+ else if (STREQ (getenv ("TEXINFO_OUTPUT_FORMAT"), "xml"))
+ {
+ splitting = 0;
+ html = 0;
+ docbook = 0;
+ xml = 1;
+ process_xml = 1;
+ }
+ else
+ fprintf (stderr,
+ _("%s: Ignoring unrecognized TEXINFO_OUTPUT_FORMAT value `%s'.\n"),
+ progname, getenv ("TEXINFO_OUTPUT_FORMAT"));
+ }
/* Parse argument flags from the input line. */
- while ((c = getopt_long (argc, argv, "D:de:E:f:hI:o:p:P:r:s:U:vV:wx",
+ while ((c = getopt_long (argc, argv, "D:de:E:f:hI:i:o:p:P:r:s:t:U:vV:wx",
long_options, &ind)) != EOF)
{
if (c == 0 && long_options[ind].flag == 0)
@@ -572,13 +620,24 @@ main (argc, argv)
case 'D':
case 'U':
/* User specified variable to set or clear. */
- handle_variable_internal ((c == 'D') ? SET : CLEAR, optarg);
+ if (xml && !docbook)
+ {
+ COMMAND_LINE_DEFINE *new = xmalloc (sizeof (COMMAND_LINE_DEFINE));
+ new->action = (c == 'D') ? SET : CLEAR;
+ new->define = xstrdup (optarg);
+ new->next = command_line_defines;
+ command_line_defines = new;
+ }
+ else
+ handle_variable_internal ((c == 'D' ? SET : CLEAR), optarg);
break;
case 'd': /* --docbook */
splitting = 0;
xml = 1;
docbook = 1;
+ html = 0;
+ process_docbook = 1;
break;
case 'e': /* --error-limit */
@@ -586,7 +645,7 @@ main (argc, argv)
{
fprintf (stderr,
_("%s: %s arg must be numeric, not `%s'.\n"),
- "--error-limit", progname, optarg);
+ progname, "--error-limit", optarg);
usage (1);
}
break;
@@ -598,10 +657,13 @@ main (argc, argv)
macro_expansion_output_stream
= strcmp (optarg, "-") == 0 ? stdout : fopen (optarg, "w");
if (!macro_expansion_output_stream)
- error (_("Couldn't open macro expansion output `%s'"), optarg);
+ error (_("%s: could not open macro expansion output `%s'"),
+ progname, optarg);
}
else
- error (_("Cannot specify more than one macro expansion output"));
+ fprintf (stderr,
+ _("%s: ignoring second macro expansion output `%s'.\n"),
+ progname, optarg);
break;
case 'f': /* --fill-column */
@@ -609,7 +671,7 @@ main (argc, argv)
{
fprintf (stderr,
_("%s: %s arg must be numeric, not `%s'.\n"),
- "--fill-column", progname, optarg);
+ progname, "--fill-column", optarg);
usage (1);
}
break;
@@ -620,14 +682,17 @@ main (argc, argv)
case 'I':
/* Append user-specified dir to include file path. */
- if (!include_files_path)
- include_files_path = xstrdup (".");
-
- include_files_path = (char *)
- xrealloc (include_files_path,
- 2 + strlen (include_files_path) + strlen (optarg));
- strcat (include_files_path, PATH_SEP);
- strcat (include_files_path, optarg);
+ append_to_include_path (optarg);
+ break;
+
+ case 'i':
+ if (sscanf (optarg, "%d", &xml_indentation_increment) != 1)
+ {
+ fprintf (stderr,
+ _("%s: %s arg must be numeric, not `%s'.\n"),
+ progname, "--output-indent", optarg);
+ usage (1);
+ }
break;
case 'o': /* --output */
@@ -647,23 +712,7 @@ main (argc, argv)
case 'P':
/* Prepend user-specified include dir to include path. */
- if (!include_files_path)
- {
- include_files_path = xstrdup (optarg);
- include_files_path = xrealloc (include_files_path,
- strlen (include_files_path) + 3); /* 3 for ":.\0" */
- strcat (strcat (include_files_path, PATH_SEP), ".");
- }
- else
- {
- char *tmp = xstrdup (include_files_path);
- include_files_path = xrealloc (include_files_path,
- strlen (include_files_path) + strlen (optarg) + 2); /* 2 for ":\0" */
- strcpy (include_files_path, optarg);
- strcat (include_files_path, ":");
- strcat (include_files_path, tmp);
- free (tmp);
- }
+ prepend_to_include_path (optarg);
break;
case 'r': /* --reference-limit */
@@ -671,7 +720,7 @@ main (argc, argv)
{
fprintf (stderr,
_("%s: %s arg must be numeric, not `%s'.\n"),
- "--reference-limit", progname, optarg);
+ progname, "--reference-limit", optarg);
usage (1);
}
break;
@@ -680,7 +729,7 @@ main (argc, argv)
if (set_footnote_style (optarg) < 0)
{
fprintf (stderr,
- _("%s: --footnote-style arg must be `separate' or `end', not `%s'.\n"),
+ _("%s: --footnote-style arg must be `separate' or `end', not `%s'.\n"),
progname, optarg);
usage (1);
}
@@ -692,11 +741,20 @@ main (argc, argv)
{
fprintf (stderr,
_("%s: %s arg must be numeric, not `%s'.\n"),
- "--split-size", progname, optarg);
+ progname, "--split-size", optarg);
usage (1);
}
break;
+ case 't': /* --plaintext */
+ splitting = 0;
+ no_headers = 1;
+ html = 0;
+ docbook = 0;
+ xml = 0;
+ process_plaintext = 1;
+ break;
+
case 'v':
verbose_mode++;
break;
@@ -704,21 +762,24 @@ main (argc, argv)
case 'V': /* --version */
print_version_info ();
puts ("");
- printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\
-There is NO warranty. You may redistribute this software\n\
+ puts ("Copyright (C) 2004 Free Software Foundation, Inc.");
+ printf (_("There is NO warranty. You may redistribute this software\n\
under the terms of the GNU General Public License.\n\
-For more information about these matters, see the files named COPYING.\n"),
- "2003");
+For more information about these matters, see the files named COPYING.\n"));
xexit (0);
break;
case 'w': /* --html */
+ xml = 0;
+ docbook = 0;
html = 1;
process_html = 1;
break;
case 'x': /* --xml */
splitting = 0;
+ html = 0;
+ docbook = 0;
xml = 1;
process_xml = 1;
break;
@@ -729,6 +790,9 @@ For more information about these matters, see the files named COPYING.\n"),
}
}
+ if (macro_expansion_output_stream)
+ validating = 0;
+
if (!validating)
expensive_validation = 0;
@@ -746,6 +810,10 @@ For more information about these matters, see the files named COPYING.\n"),
if (no_headers)
{
+ /* If the user did not specify an output file, use stdout. */
+ if (!command_output_filename)
+ command_output_filename = xstrdup ("-");
+
if (html && splitting && !STREQ (command_output_filename, "-"))
{ /* --no-headers --no-split --html indicates confusion. */
fprintf (stderr,
@@ -756,10 +824,6 @@ For more information about these matters, see the files named COPYING.\n"),
/* --no-headers implies --no-split. */
splitting = 0;
-
- /* If the user did not specify an output file, use stdout. */
- if (!command_output_filename)
- command_output_filename = xstrdup ("-");
}
if (process_info == -1)
@@ -790,7 +854,6 @@ For more information about these matters, see the files named COPYING.\n"),
xexit (errors_printed ? 2 : 0);
return 0; /* Avoid bogus warnings. */
}
-
/* Hacking tokens and strings. */
@@ -808,8 +871,8 @@ For more information about these matters, see the files named COPYING.\n"),
&& (c) != '^' \
)
-char *
-read_token ()
+static char *
+read_token (void)
{
int i, character;
char *result;
@@ -841,8 +904,7 @@ read_token ()
/* Return nonzero if CHARACTER is self-delimiting. */
int
-self_delimiting (character)
- int character;
+self_delimiting (int character)
{
/* @; and @\ are not Texinfo commands, but they are listed here
anyway. I don't know why. --karl, 10aug96. */
@@ -851,35 +913,35 @@ self_delimiting (character)
/* Clear whitespace from the front and end of string. */
void
-canon_white (string)
- char *string;
+canon_white (char *string)
{
- int len = strlen (string);
- int x;
+ char *p = string;
+ unsigned len;
- if (!len)
+ if (!*p)
return;
- for (x = 0; x < len; x++)
+ do
{
- if (!cr_or_whitespace (string[x]))
- {
- strcpy (string, string + x);
- break;
- }
+ if (!cr_or_whitespace (*p))
+ break;
+ ++p;
}
- len = strlen (string);
- if (len)
- len--;
- while (len > -1 && cr_or_whitespace (string[len]))
- len--;
- string[len + 1] = 0;
+ while (*p);
+
+ len = strlen (p);
+ while (len && cr_or_whitespace (p[len-1]))
+ --len;
+
+ if (p != string)
+ memmove (string, p, len);
+
+ string[len] = 0;
}
/* Bash STRING, replacing all whitespace with just one space. */
void
-fix_whitespace (string)
- char *string;
+fix_whitespace (char *string)
{
char *temp = xmalloc (strlen (string) + 1);
int string_index = 0;
@@ -909,8 +971,7 @@ fix_whitespace (string)
/* Discard text until the desired string is found. The string is
included in the discarded text. */
void
-discard_until (string)
- char *string;
+discard_until (char *string)
{
int temp = search_forward (string, input_text_offset);
@@ -924,18 +985,26 @@ discard_until (string)
if (temp < 0)
{
- input_text_offset = input_text_length - strlen (string);
-
+ /* not found, move current position to end of string */
+ input_text_offset = input_text_length;
if (strcmp (string, "\n") != 0)
- {
- line_error (_("Expected `%s'"), string);
+ { /* Give a more descriptive feedback, if we are looking for ``@end ''
+ during macro execution. That means someone used a multiline
+ command as an argument to, say, @section ... style commands. */
+ char *end_block = xmalloc (8);
+ sprintf (end_block, "\n%cend ", COMMAND_PREFIX);
+ if (executing_string && strstr (string, end_block))
+ line_error (_("Multiline command %c%s used improperly"),
+ COMMAND_PREFIX, command);
+ else
+ line_error (_("Expected `%s'"), string);
+ free (end_block);
return;
}
}
else
- input_text_offset = temp;
-
- input_text_offset += strlen (string);
+ /* found, move current position to after the found string */
+ input_text_offset = temp + strlen (string);
}
/* Read characters from the file until we are at MATCH.
@@ -943,8 +1012,7 @@ discard_until (string)
On exit input_text_offset is after the match string.
Return the offset where the string starts. */
int
-get_until (match, string)
- char *match, **string;
+get_until (char *match, char **string)
{
int len, current_point, x, new_point, tem;
@@ -977,8 +1045,7 @@ get_until (match, string)
/* Replace input_text[FROM .. TO] with its expansion. */
void
-replace_with_expansion (from, to)
- int from, *to;
+replace_with_expansion (int from, int *to)
{
char *xp;
unsigned xp_len, new_len;
@@ -1054,9 +1121,7 @@ replace_with_expansion (from, to)
expand the text before looking for MATCH for those cases where
MATCH might be produced by some macro. */
void
-get_until_in_line (expand, match, string)
- int expand;
- char *match, **string;
+get_until_in_line (int expand, char *match, char **string)
{
int real_bottom = input_text_length;
int limit = search_forward ("\n", input_text_offset);
@@ -1088,9 +1153,7 @@ get_until_in_line (expand, match, string)
}
void
-get_rest_of_line (expand, string)
- int expand;
- char **string;
+get_rest_of_line (int expand, char **string)
{
xml_no_para ++;
if (expand)
@@ -1121,7 +1184,7 @@ get_rest_of_line (expand, string)
/* Backup the input pointer to the previous character, keeping track
of the current line number. */
void
-backup_input_pointer ()
+backup_input_pointer (void)
{
if (input_text_offset)
{
@@ -1134,8 +1197,7 @@ backup_input_pointer ()
/* Read characters from the file until we are at MATCH or closing brace.
Place the characters read into STRING. */
void
-get_until_in_braces (match, string)
- char *match, **string;
+get_until_in_braces (char *match, char **string)
{
char *temp;
int i, brace = 0;
@@ -1192,8 +1254,8 @@ static char *suffixes[] = {
NULL
};
-void
-initialize_conversion ()
+static void
+initialize_conversion (void)
{
init_tag_table ();
init_indices ();
@@ -1207,16 +1269,11 @@ initialize_conversion ()
output_position = 0;
}
-typedef struct generic_list {
- struct generic_list *next;
-} GENERIC_LIST;
-
/* Reverse the chain of structures in LIST. Output the new head
of the chain. You should always assign the output value of this
function to something, or you will lose the chain. */
GENERIC_LIST *
-reverse_list (list)
- GENERIC_LIST *list;
+reverse_list (GENERIC_LIST *list)
{
GENERIC_LIST *next;
GENERIC_LIST *prev = NULL;
@@ -1237,10 +1294,8 @@ reverse_list (list)
/* Convert the Texinfo file coming from the open stream STREAM. Assume the
source of the stream is named NAME. */
-void
-convert_from_stream (stream, name)
- FILE *stream;
- char *name;
+static void
+convert_from_stream (FILE *stream, char *name)
{
char *buffer = NULL;
int buffer_offset = 0, buffer_size = 0;
@@ -1287,13 +1342,15 @@ convert_from_stream (stream, name)
convert_from_loaded_file (name);
}
-void
-convert_from_file (name)
- char *name;
+static void
+convert_from_file (char *name)
{
int i;
char *filename = xmalloc (strlen (name) + 50);
+ /* Prepend file directory to the search path, so relative links work. */
+ prepend_to_include_path (pathname_part (name));
+
initialize_conversion ();
/* Try to load the file specified by NAME, concatenated with our
@@ -1304,7 +1361,7 @@ convert_from_file (name)
strcpy (filename, name);
strcat (filename, suffixes[i]);
- if (find_and_load (filename))
+ if (find_and_load (filename, 1))
break;
if (!suffixes[i][0] && strrchr (filename, '.'))
@@ -1325,6 +1382,38 @@ convert_from_file (name)
input_filename = filename;
convert_from_loaded_file (name);
+
+ /* Pop the prepended path, so multiple filenames in the
+ command line do not screw each others include paths. */
+ pop_path_from_include_path ();
+}
+
+static int
+create_html_directory (char *dir, int can_remove_file)
+{
+ struct stat st;
+
+ /* Already exists. */
+ if (stat (dir, &st) == 0)
+ {
+ /* And it's a directory, so silently reuse it. */
+ if (S_ISDIR (st.st_mode))
+ return 1;
+ /* Not a directory, so move it out of the way if we are allowed. */
+ else if (can_remove_file)
+ {
+ if (unlink (dir) != 0)
+ return 0;
+ }
+ else
+ return 0;
+ }
+
+ if (mkdir (dir, 0777) == 0)
+ /* Success! */
+ return 1;
+ else
+ return 0;
}
/* Given OUTPUT_FILENAME == ``/foo/bar/baz.html'', return
@@ -1339,13 +1428,11 @@ convert_from_file (name)
foo.whatever unchanged. */
static char *
-insert_toplevel_subdirectory (output_filename)
- char *output_filename;
+insert_toplevel_subdirectory (char *output_filename)
{
static const char index_name[] = "index.html";
char *dir, *subdir, *base, *basename, *p;
char buf[PATH_MAX];
- struct stat st;
const int index_len = sizeof (index_name) - 1;
strcpy (buf, output_filename);
@@ -1375,41 +1462,34 @@ insert_toplevel_subdirectory (output_filename)
if (strlen (dir))
strcat (output_filename, "/");
strcat (output_filename, subdir);
- if ((mkdir (output_filename, 0777) == -1 && errno != EEXIST)
- /* output_filename might exist, but be a non-directory. */
- || (stat (output_filename, &st) == 0 && !S_ISDIR (st.st_mode)))
- { /* that failed, try subdir name with .html */
+
+ /* First try, do not remove existing file. */
+ if (!create_html_directory (output_filename, 0))
+ {
+ /* That failed, try subdir name with .html.
+ Remove it if it exists. */
strcpy (output_filename, dir);
if (strlen (dir))
strcat (output_filename, "/");
strcat (output_filename, basename);
- if (mkdir (output_filename, 0777) == -1)
- {
- const char *errmsg = strerror (errno);
- if ((errno == EEXIST
-#ifdef __MSDOS__
- || errno == EACCES
-#endif
- )
- && (stat (output_filename, &st) == 0 && !S_ISDIR (st.st_mode)))
- errmsg = _("File exists, but is not a directory");
+ if (!create_html_directory (output_filename, 1))
+ {
+ /* Last try failed too :-\ */
line_error (_("Can't create directory `%s': %s"),
- output_filename, errmsg);
+ output_filename, strerror (errno));
xexit (1);
}
- strcat (output_filename, "/");
}
- else if (strlen (subdir))
- strcat (output_filename, "/");
+
+ strcat (output_filename, "/");
strcat (output_filename, index_name);
return output_filename;
}
/* FIXME: this is way too hairy */
-void
-convert_from_loaded_file (name)
- char *name;
+static void
+convert_from_loaded_file (char *name)
{
char *real_output_filename = NULL;
@@ -1476,8 +1556,6 @@ convert_from_loaded_file (name)
if (!command_output_filename)
{
get_until ("\n", &output_filename); /* read rest of line */
- if (xml && !docbook)
- xml_begin_document (output_filename);
if (html || xml)
{ /* Change any extension to .html or .xml. */
char *html_name, *directory_part, *basename_part, *temp;
@@ -1553,6 +1631,9 @@ convert_from_loaded_file (name)
set_current_output_filename (real_output_filename);
+ if (xml && !docbook)
+ xml_begin_document (filename_part (output_filename));
+
if (verbose_mode)
printf (_("Making %s file `%s' from `%s'.\n"),
no_headers ? "text"
@@ -1593,6 +1674,19 @@ convert_from_loaded_file (name)
output_filename, VERSION, input_filename);
close_paragraph ();
+
+ if (xml && !docbook)
+ {
+ /* Just before the real main loop, let's handle the defines. */
+ COMMAND_LINE_DEFINE *temp;
+
+ for (temp = command_line_defines; temp; temp = temp->next)
+ {
+ handle_variable_internal (temp->action, temp->define);
+ free(temp->define);
+ }
+ }
+
reader_loop ();
if (xml)
xml_end_document ();
@@ -1611,7 +1705,8 @@ finished:
&& FILENAME_CMP (macro_expansion_filename, NULL_DEVICE) != 0
&& FILENAME_CMP (macro_expansion_filename, ALSO_NULL_DEVICE) != 0)
{
- fprintf (stderr, _("%s: Removing macro output file `%s' due to errors; use --force to preserve.\n"),
+ fprintf (stderr,
+_("%s: Removing macro output file `%s' due to errors; use --force to preserve.\n"),
progname, macro_expansion_filename);
if (unlink (macro_expansion_filename) < 0)
perror (macro_expansion_filename);
@@ -1621,15 +1716,10 @@ finished:
if (output_stream)
{
output_pending_notes ();
- if (tag_table)
- {
- tag_table = (TAG_ENTRY *) reverse_list (tag_table);
- if (!no_headers && !html)
- write_tag_table ();
- }
if (html)
{
+ no_indent = 1;
start_paragraph ();
add_word ("\n");
close_paragraph ();
@@ -1638,14 +1728,19 @@ finished:
/* maybe we want local variables in info output. */
{
char *trailer = info_trailer ();
- if (trailer)
+ if (!xml && !docbook && trailer)
{
+ if (html)
+ insert_string ("\n");
}
}
- flush_output (); /* in case there was no @bye */
+ /* Write stuff makeinfo generates after @bye, ie. info_trailer. */
+ flush_output ();
if (output_stream != stdout)
fclose (output_stream);
@@ -1654,19 +1749,28 @@ finished:
if (validating)
validate_file (tag_table);
- /* If we need to output the table of contents, do it now. */
- if (contents_filename || shortcontents_filename)
- toc_update ();
+ handle_delayed_writes ();
+
+ if (tag_table)
+ {
+ tag_table = (TAG_ENTRY *) reverse_list ((GENERIC_LIST *) tag_table);
+ if (!no_headers && !html && !STREQ (current_output_filename, "-"))
+ write_tag_table (real_output_filename);
+ }
if (splitting && !html && (!errors_printed || force))
- split_file (real_output_filename, split_size);
+ {
+ clean_old_split_files (real_output_filename);
+ split_file (real_output_filename, split_size);
+ }
else if (errors_printed
&& !force
&& strcmp (real_output_filename, "-") != 0
&& FILENAME_CMP (real_output_filename, NULL_DEVICE) != 0
&& FILENAME_CMP (real_output_filename, ALSO_NULL_DEVICE) != 0)
{ /* If there were errors, and no --force, remove the output. */
- fprintf (stderr, _("%s: Removing output file `%s' due to errors; use --force to preserve.\n"),
+ fprintf (stderr,
+ _("%s: Removing output file `%s' due to errors; use --force to preserve.\n"),
progname, real_output_filename);
if (unlink (real_output_filename) < 0)
perror (real_output_filename);
@@ -1674,33 +1778,35 @@ finished:
}
free (real_output_filename);
}
-
-
-/* If enable_encoding and document_encoding are both set, return a Local
- Variables section (as a malloc-ed string) so that Emacs' locale
- features can work. Else return NULL. */
-
+/* If enable_encoding is set and @documentencoding is used, return a
+ Local Variables section (as a malloc-ed string) so that Emacs'
+ locale features can work. Else return NULL. */
char *
-info_trailer ()
+info_trailer (void)
{
- if (!enable_encoding || document_encoding_code <= US_ASCII)
+ char *encoding;
+
+ if (!enable_encoding)
return NULL;
- {
-#define LV_FMT "\n\037\nLocal Variables:\ncoding: %s\nEnd:\n"
- char *enc_name = encoding_table[document_encoding_code].encname;
- char *lv = xmalloc (sizeof (LV_FMT) + strlen (enc_name));
- sprintf (lv, LV_FMT, enc_name);
- return lv;
- }
-}
+ encoding = current_document_encoding ();
+ if (encoding && *encoding)
+ {
+#define LV_FMT "\n\037\nLocal Variables:\ncoding: %s\nEnd:\n"
+ char *lv = xmalloc (sizeof (LV_FMT) + strlen (encoding));
+ sprintf (lv, LV_FMT, encoding);
+ free (encoding);
+ return lv;
+ }
+ free (encoding);
+ return NULL;
+}
void
-free_and_clear (pointer)
- char **pointer;
+free_and_clear (char **pointer)
{
if (*pointer)
{
@@ -1710,8 +1816,8 @@ free_and_clear (pointer)
}
/* Initialize some state. */
-void
-init_internals ()
+static void
+init_internals (void)
{
free_and_clear (&output_filename);
free_and_clear (&command);
@@ -1731,9 +1837,9 @@ init_internals ()
}
void
-init_paragraph ()
+init_paragraph (void)
{
- free_and_clear (&output_paragraph);
+ free (output_paragraph);
output_paragraph = xmalloc (paragraph_buffer_len);
output_paragraph[0] = 0;
output_paragraph_offset = 0;
@@ -1747,7 +1853,7 @@ init_paragraph ()
menu line. */
static void
-handle_menu_entry ()
+handle_menu_entry (void)
{
char *tem;
@@ -1773,23 +1879,21 @@ handle_menu_entry ()
if (had_menu_commentary)
{
- add_word ("
");
}
else if (xml && docbook)
xml_insert_docbook_image (name_arg);
else if (xml)
{
- xml_insert_element_with_attribute (IMAGE, START, "width=\"%s\" height=\"%s\" alttext=\"%s\" extension=\"%s\"",
- w_arg, h_arg, alt_arg, ext_arg);
- add_word (name_arg);
- xml_insert_element (IMAGE, END);
+ extern int xml_in_para;
+ extern int xml_no_para;
+ int elt = xml_in_para ? INLINEIMAGE : IMAGE;
+
+ if (!xml_in_para)
+ xml_no_para++;
+
+ xml_insert_element_with_attribute (elt,
+ START, "width=\"%s\" height=\"%s\" name=\"%s\" extension=\"%s\"",
+ w_arg, h_arg, name_arg, ext_arg);
+ xml_insert_element (IMAGEALTTEXT, START);
+ execute_string ("%s", alt_arg);
+ xml_insert_element (IMAGEALTTEXT, END);
+ xml_insert_element (elt, END);
+
+ if (!xml_in_para)
+ xml_no_para--;
}
else
{ /* Try to open foo.EXT or foo.txt. */
@@ -3568,7 +3360,7 @@ cm_image (arg)
char *txtpath = NULL;
char *txtname = xmalloc (strlen (name_arg)
+ (ext_arg && *ext_arg
- ? strlen (ext_arg) + 1 : 4) + 1);
+ ? strlen (ext_arg) : 4) + 1);
strcpy (txtname, name_arg);
strcat (txtname, ".txt");
image_file = fopen (txtname, "r");
@@ -3587,49 +3379,72 @@ cm_image (arg)
int ch;
int save_inhibit_indentation = inhibit_paragraph_indentation;
int save_filling_enabled = filling_enabled;
+ int image_in_brackets = paragraph_is_open;
+
+ /* Write magic ^@^H[image ...^@^H] cookie in the info file, if
+ there's an accompanying bitmap. Otherwise just include the
+ text image. In the plaintext output, always include the text
+ image without the magic cookie. */
+ int use_magic_cookie = !no_headers
+ && access (fullname, R_OK) == 0 && !STREQ (fullname, txtname);
inhibit_paragraph_indentation = 1;
filling_enabled = 0;
last_char_was_newline = 0;
- /* Write magic ^@^H[image ...^@^H] cookie in the info file. */
- add_char ('\0');
- add_word ("\010[image");
+ if (use_magic_cookie)
+ {
+ add_char ('\0');
+ add_word ("\010[image");
- if (access (fullname, R_OK) == 0
- || (pathname != NULL && access (pathname, R_OK) == 0))
- add_word_args (" src=%s", fullname);
+ if (access (fullname, R_OK) == 0
+ || (pathname != NULL && access (pathname, R_OK) == 0))
+ add_word_args (" src=\"%s\"", fullname);
- if (*alt_arg)
- add_word_args (" alt=\"%s\"", alt_arg);
+ if (*alt_arg)
+ add_word_args (" alt=\"%s\"", alt_arg);
+ }
if (image_file != NULL)
{
- add_word (" text=\"");
+ if (use_magic_cookie)
+ add_word (" text=\"");
+
+ if (image_in_brackets)
+ add_char ('[');
+
/* Maybe we need to remove the final newline if the image
file is only one line to allow in-line images. On the
other hand, they could just make the file without a
final newline. */
while ((ch = getc (image_file)) != EOF)
{
- if (ch == '"' || ch == '\\')
+ if (use_magic_cookie && (ch == '"' || ch == '\\'))
add_char ('\\');
add_char (ch);
}
- add_char ('"');
+
+ if (image_in_brackets)
+ add_char (']');
+
+ if (use_magic_cookie)
+ add_char ('"');
if (fclose (image_file) != 0)
perror (txtname);
}
+ if (use_magic_cookie)
+ {
+ add_char ('\0');
+ add_word ("\010]");
+ }
+
inhibit_paragraph_indentation = save_inhibit_indentation;
filling_enabled = save_filling_enabled;
-
- add_char ('\0');
- add_word ("\010]");
}
else
- line_error (_("@image file `%s' (for text) unreadable: %s"),
+ warning (_("@image file `%s' (for text) unreadable: %s"),
txtname, strerror (errno));
}
@@ -3665,10 +3480,8 @@ typedef struct defines {
DEFINE *defines = NULL;
/* Add NAME to the list of `set' defines. */
-void
-set (name, value)
- char *name;
- char *value;
+static void
+set (char *name, char *value)
{
DEFINE *temp;
@@ -3685,12 +3498,18 @@ set (name, value)
temp->name = xstrdup (name);
temp->value = xstrdup (value);
defines = temp;
+
+ if (xml && !docbook)
+ {
+ xml_insert_element_with_attribute (SETVALUE, START, "name=\"%s\"", name);
+ execute_string ("%s", value);
+ xml_insert_element (SETVALUE, END);
+ }
}
/* Remove NAME from the list of `set' defines. */
-void
-clear (name)
- char *name;
+static void
+clear (char *name)
{
DEFINE *temp, *last;
@@ -3714,12 +3533,17 @@ clear (name)
last = temp;
temp = temp->next;
}
+
+ if (xml && !docbook)
+ {
+ xml_insert_element_with_attribute (CLEARVALUE, START, "name=\"%s\"", name);
+ xml_insert_element (CLEARVALUE, END);
+ }
}
/* Return the value of NAME. The return value is NULL if NAME is unset. */
-char *
-set_p (name)
- char *name;
+static char *
+set_p (char *name)
{
DEFINE *temp;
@@ -3732,26 +3556,26 @@ set_p (name)
/* Create a variable whose name appears as the first word on this line. */
void
-cm_set ()
+cm_set (void)
{
handle_variable (SET);
}
/* Remove a variable whose name appears as the first word on this line. */
void
-cm_clear ()
+cm_clear (void)
{
handle_variable (CLEAR);
}
void
-cm_ifset ()
+cm_ifset (void)
{
handle_variable (IFSET);
}
void
-cm_ifclear ()
+cm_ifclear (void)
{
handle_variable (IFCLEAR);
}
@@ -3763,7 +3587,7 @@ cm_ifclear ()
if ARG1 and ARG2 caselessly string compare to the same string, otherwise,
it produces no output. */
void
-cm_ifeq ()
+cm_ifeq (void)
{
char **arglist;
@@ -3783,11 +3607,16 @@ cm_ifeq ()
}
void
-cm_value (arg, start_pos, end_pos)
- int arg, start_pos, end_pos;
+cm_value (int arg, int start_pos, int end_pos)
{
static int value_level = 0, saved_meta_pos = -1;
+ /* xml_add_char() skips any content inside menus when output format is
+ Docbook, so @value{} is no use there. Also start_pos and end_pos does not
+ get updated, causing name to be empty string. So just return. */
+ if (docbook && in_menu)
+ return;
+
/* All the text after @value{ upto the matching } will eventually
disappear from output_paragraph, when this function is called
with ARG == END. If the text produced until then sets
@@ -3833,11 +3662,18 @@ cm_value (arg, start_pos, end_pos)
among other things. */
if (value)
- execute_string ("%s", value);
+ {
+ /* We need to get past the closing brace since the value may
+ expand to a context-sensitive macro (e.g. @xref) and produce
+ spurious warnings */
+ input_text_offset++;
+ execute_string ("%s", value);
+ input_text_offset--;
+ }
else
{
- warning (_("undefined flag: %s"), name);
- add_word_args (_("{No value for `%s'}"), name);
+ warning (_("undefined flag: %s"), name);
+ add_word_args (_("{No value for `%s'}"), name);
}
free (name);
@@ -3845,9 +3681,8 @@ cm_value (arg, start_pos, end_pos)
}
/* Set, clear, or conditionalize based on ACTION. */
-void
-handle_variable (action)
- int action;
+static void
+handle_variable (int action)
{
char *name;
@@ -3861,10 +3696,8 @@ handle_variable (action)
free (name);
}
-void
-handle_variable_internal (action, name)
- int action;
- char *name;
+static void
+handle_variable_internal (int action, char *name)
{
char *temp;
int delimiter, additional_text_present = 0;
@@ -4020,7 +3853,6 @@ handle_variable_internal (action, name)
}
/* Execution of random text not in file. */
-
typedef struct {
char *string; /* The string buffer. */
int size; /* The size of the buffer. */
@@ -4031,9 +3863,8 @@ static EXECUTION_STRING **execution_strings = NULL;
static int execution_strings_index = 0;
static int execution_strings_slots = 0;
-EXECUTION_STRING *
-get_execution_string (initial_size)
- int initial_size;
+static EXECUTION_STRING *
+get_execution_string (int initial_size)
{
int i = 0;
EXECUTION_STRING *es = NULL;
@@ -4081,9 +3912,7 @@ get_execution_string (initial_size)
entry in the execution_strings[] array and change the .STRING and
.SIZE members of that entry as appropriate. */
void
-maybe_update_execution_strings (text, new_len)
- char **text;
- unsigned new_len;
+maybe_update_execution_strings (char **text, unsigned int new_len)
{
int i = 0;
@@ -4127,10 +3956,11 @@ execute_string (format, va_alist)
#endif
{
EXECUTION_STRING *es;
- char *temp_string;
+ char *temp_string, *temp_input_filename;
#ifdef VA_FPRINTF
va_list ap;
#endif
+ int insertion_level_at_start = insertion_level;
es = get_execution_string (EXECUTE_STRING_MAX);
temp_string = es->string;
@@ -4147,28 +3977,50 @@ execute_string (format, va_alist)
pushfile ();
input_text_offset = 0;
input_text = temp_string;
- input_filename = xstrdup (input_filename);
input_text_length = strlen (temp_string);
+ input_filename = xstrdup (input_filename);
+ temp_input_filename = input_filename;
executing_string++;
reader_loop ();
- free (input_filename);
+
+ /* If insertion stack level changes during execution, that means a multiline
+ command is used inside braces or @section ... kind of commands. */
+ if (insertion_level_at_start != insertion_level && !executing_macro)
+ {
+ line_error (_("Multiline command %c%s used improperly"),
+ COMMAND_PREFIX,
+ command);
+ /* We also need to keep insertion_level intact to make sure warnings are
+ issued for @end ... command. */
+ while (insertion_level > insertion_level_at_start)
+ pop_insertion ();
+ }
popfile ();
executing_string--;
es->in_use = 0;
+ free (temp_input_filename);
}
/* Return what would be output for STR (in newly-malloced memory), i.e.,
- expand Texinfo commands. If IMPLICIT_CODE is set, expand @code{STR}.
- This is generally used for short texts; filling, indentation, and
- html escapes are disabled. */
+ expand Texinfo commands according to the current output format. If
+ IMPLICIT_CODE is set, expand @code{STR}. This is generally used for
+ short texts; filling, indentation, and html escapes are disabled. */
+
+char *
+expansion (char *str, int implicit_code)
+{
+ return maybe_escaped_expansion (str, implicit_code, 0);
+}
+
+
+/* Do HTML escapes according to DO_HTML_ESCAPE. Needed in
+ cm_printindex, q.v. */
char *
-expansion (str, implicit_code)
- char *str;
- int implicit_code;
+maybe_escaped_expansion (char *str, int implicit_code, int do_html_escape)
{
char *result;
@@ -4183,7 +4035,7 @@ expansion (str, implicit_code)
filling_enabled = 0;
indented_fill = 0;
no_indent = 1;
- escape_html = 0;
+ escape_html = do_html_escape;
result = full_expansion (str, implicit_code);
@@ -4198,12 +4050,10 @@ expansion (str, implicit_code)
/* Expand STR (or @code{STR} if IMPLICIT_CODE is nonzero). No change to
any formatting parameters -- filling, indentation, html escapes,
- etc., are not reset. */
+ etc., are not reset. Always returned in new memory. */
char *
-full_expansion (str, implicit_code)
- char *str;
- int implicit_code;
+full_expansion (char *str, int implicit_code)
{
int length;
char *result;
@@ -4260,18 +4110,20 @@ full_expansion (str, implicit_code)
format is. */
char *
-text_expansion (str)
- char *str;
+text_expansion (char *str)
{
char *ret;
int save_html = html;
int save_xml = xml;
+ int save_docbook = docbook;
html = 0;
xml = 0;
+ docbook = 0;
ret = expansion (str, 0);
html = save_html;
xml = save_xml;
+ docbook = save_docbook;
return ret;
}
@@ -4285,8 +4137,7 @@ text_expansion (str)
If NUM is zero, we assume `none'.
Returns 0 if successful, or nonzero if STRING isn't one of the above. */
int
-set_paragraph_indent (string)
- char *string;
+set_paragraph_indent (char *string)
{
if (strcmp (string, "asis") == 0 || strcmp (string, _("asis")) == 0)
paragraph_start_indent = 0;
diff --git a/contrib/texinfo/makeinfo/makeinfo.h b/contrib/texinfo/makeinfo/makeinfo.h
index dd77fe6..de4d423 100644
--- a/contrib/texinfo/makeinfo/makeinfo.h
+++ b/contrib/texinfo/makeinfo/makeinfo.h
@@ -1,7 +1,7 @@
/* makeinfo.h -- declarations for Makeinfo.
- $Id: makeinfo.h,v 1.10 2003/05/12 13:12:32 karl Exp $
+ $Id: makeinfo.h,v 1.17 2004/11/30 02:03:23 karl Exp $
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -31,13 +31,6 @@
/* Hardcoded per GNU standards, not dependent on argv[0]. */
DECLARE (char *, progname, "makeinfo");
-
-enum reftype
-{
- menu_reference, followed_reference
-};
-
-extern char *get_xref_token ();
/* Nonzero means a string is in execution, as opposed to a file. */
DECLARE (int, executing_string, 0);
@@ -45,8 +38,6 @@ DECLARE (int, executing_string, 0);
/* Nonzero means to inhibit writing macro expansions to the output
stream, because it has already been written. */
DECLARE (int, me_inhibit_expansion, 0);
-
-extern char *expansion (), *text_expansion (), *full_expansion ();
/* Current output stream. */
DECLARE (FILE *, output_stream, NULL);
@@ -68,6 +59,10 @@ DECLARE (int, output_column, 0);
/* Position in the output file. */
DECLARE (int, output_position, 0);
+/* Number of lines in the output. */
+DECLARE (int, output_line_number, 1);
+DECLARE (int, node_line_number, 0);
+
/* The offset into OUTPUT_PARAGRAPH where we have a meta character
produced by a markup such as @code or @dfn. */
DECLARE (int, meta_char_pos, -1);
@@ -96,8 +91,15 @@ DECLARE (int, current_indent, 0);
DECLARE (int, do_first_par_indent, 0);
/* Amount by which @example indentation increases/decreases. */
+DECLARE (int, example_indentation_increment, 5);
+
+/* Amount by which @table, @defun, etc. indentation increases/decreases. */
DECLARE (int, default_indentation_increment, 5);
+/* Amount by which xml indentation increases/decreases.
+ Zero means unnecessary whitespace is compressed. */
+DECLARE (int, xml_indentation_increment, 2);
+
/* Nonzero indicates that filling a line also indents the new line. */
DECLARE (int, indented_fill, 0);
@@ -133,7 +135,6 @@ DECLARE (int, enable_encoding, 0);
/* Nonzero means escape characters in HTML output. */
DECLARE (int, escape_html, 1);
-extern char *escape_string (); /* do HTML escapes */
/* Access key number for next menu entry to be generated (1 to 9, or 10 to
mean no access key) */
@@ -154,6 +155,9 @@ DECLARE (char *, current_node, NULL);
/* Command name in the process of being hacked. */
DECLARE (char *, command, NULL);
+/* Nonzero if we have seen an @titlepage command. */
+DECLARE (int, titlepage_cmd_present, 0);
+
/* @copying ... @end copying. */
DECLARE (char *, copying_text, NULL);
@@ -186,6 +190,9 @@ DECLARE (char *, css_include, NULL);
is, generate plain text. (--no-headers) */
DECLARE (int, no_headers, 0);
+/* Nonzero means that we process @docbook and @ifdocbook. (--ifdocbook) */
+DECLARE (int, process_docbook, 0);
+
/* Nonzero means that we process @html and @rawhtml even when not
generating HTML. (--ifhtml) */
DECLARE (int, process_html, 0);
@@ -218,7 +225,7 @@ DECLARE (int, verbose_mode, 0);
/* Nonzero means prefix each @chapter, ... with a number like
1, 1.1, etc. (--number-sections) */
-DECLARE (int, number_sections, 0);
+DECLARE (int, number_sections, 1);
/* Nonzero means split size. When zero, DEFAULT_SPLIT_SIZE is used. */
DECLARE (int, split_size, 0);
@@ -262,8 +269,16 @@ DECLARE (int, expensive_validation, 0);
#define digit_value(c) ((c) - '0')
#endif
-#define HTML_SAFE "$-_.+!*'()"
-#define URL_SAFE_CHAR(ch) (isalnum (ch) || strchr (HTML_SAFE, ch))
+/* These characters are not really HTML-safe (with strict XHTML),
+ and also there are possible collisions. That's the whole reason we
+ designed a new conversion scheme in the first place. But we
+ nevertheless need to generate the old names. See
+ `add_escaped_anchor_name' in html.c. */
+#define OLD_HTML_SAFE "$-_.+!*'()"
+#define OLD_URL_SAFE_CHAR(ch) (strchr (OLD_HTML_SAFE, ch))
+
+/* For the current/stable scheme. */
+#define URL_SAFE_CHAR(ch) (isalnum (ch))
#define COMMAND_PREFIX '@'
@@ -296,7 +311,76 @@ DECLARE (int, splitting, 1); /* Defaults to true for now. */
#define looking_at(string) \
(strncmp (input_text + input_text_offset, string, strlen (string)) == 0)
+/* Any list with a member named `next'. */
+typedef struct generic_list {
+ struct generic_list *next;
+} GENERIC_LIST;
+
+/* Reverse the order of a list. */
+extern GENERIC_LIST * reverse_list (GENERIC_LIST *list);
+
/* Possibly return Local Variables trailer for Info output. */
-extern char *info_trailer ();
+extern char *info_trailer (void),
+ *expansion (char *str, int implicit_code),
+ *text_expansion (char *str),
+ *maybe_escaped_expansion (char *str, int implicit_code, int do_escape_html),
+ *full_expansion (char *str, int implicit_code);
+
+extern void free_and_clear (char **pointer),
+ add_word (char *string),
+ add_char (int character),
+ add_meta_char (int character),
+ close_single_paragraph (void),
+ insert_string (const char *),
+ insert (int character),
+ get_rest_of_line (int expand, char **string),
+ add_html_block_elt (char *string),
+ get_until_in_braces (char *match, char **string),
+ get_until_in_line (int expand, char *match, char **string),
+ canon_white (char *string),
+ discard_until (char *string),
+ indent (int amount),
+ kill_self_indent (int count),
+ backup_input_pointer (void),
+ inhibit_output_flushing (void),
+ uninhibit_output_flushing (void),
+ flush_output (void),
+ start_paragraph (void),
+ close_paragraph (void),
+ close_insertion_paragraph (void),
+ init_paragraph (void),
+ ignore_blank_line (void),
+ reader_loop (void),
+ discard_braces (void),
+ replace_with_expansion (int from, int *to),
+ fix_whitespace (char *string),
+ add_html_elt (char *string);
+
+extern int get_until (char *match, char **string),
+ set_paragraph_indent (char *string),
+ self_delimiting (int character),
+ search_forward (char *string, int from),
+ search_forward_until_pos (char *string, int from, int end_pos),
+ next_nonwhitespace_character (void),
+ fs_error (char *filename);
+
+#if defined (VA_FPRINTF) && __STDC__
+/* Unfortunately we must use prototypes if we are to use . */
+extern void add_word_args (const char *, ...),
+ add_html_block_elt_args (const char *, ...),
+ execute_string (char *, ...),
+ warning (const char *format, ...),
+ error (const char *format, ...),
+ line_error (const char *format, ...),
+ file_line_error (char *infile, int lno, const char *format, ...);
+#else
+extern void add_word_args (),
+ add_html_block_elt_args (),
+ execute_string (),
+ warning (),
+ error (),
+ line_error (),
+ file_line_error ();
+#endif /* no prototypes */
#endif /* not MAKEINFO_H */
diff --git a/contrib/texinfo/makeinfo/multi.c b/contrib/texinfo/makeinfo/multi.c
index d5cc19c..06c548f 100644
--- a/contrib/texinfo/makeinfo/multi.c
+++ b/contrib/texinfo/makeinfo/multi.c
@@ -1,7 +1,7 @@
/* multi.c -- multiple-column tables (@multitable) for makeinfo.
- $Id: multi.c,v 1.4 2002/11/04 21:28:10 karl Exp $
+ $Id: multi.c,v 1.8 2004/04/11 17:56:47 karl Exp $
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -18,11 +18,13 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- Written by phr@gnu.org (Paul Rubin). */
+ Originally written by phr@gnu.org (Paul Rubin). */
#include "system.h"
+#include "cmds.h"
#include "insertion.h"
#include "makeinfo.h"
+#include "multi.h"
#include "xml.h"
#define MAXCOLS 100 /* remove this limit later @@ */
@@ -66,6 +68,13 @@ struct env
/* index in environment table of currently selected environment */
static int current_env_no;
+/* current column number */
+static int current_column_no;
+
+/* We need to make a difference between template based widths and
+ @columnfractions for HTML tables' sake. Sigh. */
+static int seen_column_fractions;
+
/* column number of last column in current multitable */
static int last_column;
@@ -75,133 +84,13 @@ static int hsep, vsep;
/* whether this is the first row. */
static int first_row;
-
-static void output_multitable_row ();
-/* Output a row. Calls insert, but also flushes the buffered output
- when we see a newline, since in multitable every line is a separate
- paragraph. */
-static void
-out_char (ch)
- int ch;
-{
- if (html)
- add_char (ch);
- else
- {
- int env = select_output_environment (0);
- insert (ch);
- if (ch == '\n')
- {
- uninhibit_output_flushing ();
- flush_output ();
- inhibit_output_flushing ();
- }
- select_output_environment (env);
- }
-}
-
-
-void
-draw_horizontal_separator ()
-{
- int i, j, s;
-
- if (html)
- {
- add_word ("");
- return;
- }
- if (xml)
- return;
-
- for (s = 0; s < envs[0].current_indent; s++)
- out_char (' ');
- if (vsep)
- out_char ('+');
- for (i = 1; i <= last_column; i++) {
- for (j = 0; j <= envs[i].fill_column; j++)
- out_char ('-');
- if (vsep)
- out_char ('+');
- }
- out_char ('\n');
-}
-
-
-/* multitable strategy:
- for each item {
- for each column in an item {
- initialize a new paragraph
- do ordinary formatting into the new paragraph
- save the paragraph away
- repeat if there are more paragraphs in the column
- }
- dump out the saved paragraphs and free the storage
- }
-
- For HTML we construct a simple HTML 3.2 table with s inserted
- to help non-tables browsers. `@item' inserts a
and `@tab'
- inserts
; we also try to close
. The only real
- alternative is to rely on the info formatting engine and present
- preformatted text. */
-
-void
-do_multitable ()
-{
- int ncolumns;
-
- if (multitable_active)
- {
- line_error ("Multitables cannot be nested");
- return;
- }
-
- close_single_paragraph ();
-
- /* scan the current item function to get the field widths
- and number of columns, and set up the output environment list
- accordingly. */
- /* if (docbook)*/ /* 05-08 */
- if (xml)
- xml_no_para = 1;
- ncolumns = setup_multitable_parameters ();
- first_row = 1;
-
- /*
for non-tables browsers. @multitable implicitly ends the
- current paragraph, so this is ok. */
- if (html)
- add_word ("
");
- /* else if (docbook)*/ /* 05-08 */
- else if (xml)
- {
- int *widths = xmalloc (ncolumns * sizeof (int));
- int i;
- for (i=0; ioutput_paragraph = output_paragraph;
+ e->output_paragraph_offset = output_paragraph_offset;
+ e->meta_char_pos = meta_char_pos;
+ e->output_column = output_column;
+ e->paragraph_is_open = paragraph_is_open;
+ e->current_indent = current_indent;
+ e->fill_column = fill_column;
+
+ /* now copy new environment into global vars */
+ current_env_no = n;
+ e = &envs[current_env_no];
+ output_paragraph = e->output_paragraph;
+ output_paragraph_offset = e->output_paragraph_offset;
+ meta_char_pos = e->meta_char_pos;
+ output_column = e->output_column;
+ paragraph_is_open = e->paragraph_is_open;
+ current_indent = e->current_indent;
+ fill_column = e->fill_column;
+ return old_env_no;
+}
+
+/* Initialize environment number ENV_NO, of width WIDTH.
+ The idea is that we're going to use one environment for each column of
+ a multitable, so we can build them up separately and print them
+ all out at the end. */
+static int
+setup_output_environment (int env_no, int width)
+{
+ int old_env = select_output_environment (env_no);
+
+ /* clobber old environment and set width of new one */
+ init_paragraph ();
+
+ /* make our change */
+ fill_column = width;
+
+ /* Save new environment and restore previous one. */
+ select_output_environment (old_env);
+
+ return env_no;
+}
/* Read the parameters for a multitable from the current command
line, save the parameters away, and return the
number of columns. */
-int
-setup_multitable_parameters ()
+static int
+setup_multitable_parameters (void)
{
char *params = insertion_stack->item_function;
int nchars;
@@ -259,6 +199,9 @@ setup_multitable_parameters ()
but TeX doesn't either. */
hsep = vsep = 0;
+ /* Assume no @columnfractions per default. */
+ seen_column_fractions = 0;
+
while (*params) {
while (whitespace (*params))
params++;
@@ -272,6 +215,7 @@ setup_multitable_parameters ()
else if (strcmp (command, "@vsep") == 0)
vsep++;
else if (strcmp (command, "@columnfractions") == 0) {
+ seen_column_fractions = 1;
/* Clobber old environments and create new ones, starting at #1.
Environment #0 is the normal output, so don't mess with it. */
for ( ; i <= MAXCOLS; i++) {
@@ -282,19 +226,26 @@ setup_multitable_parameters ()
number) and then non-whitespace (the number). */
while (*params && (*params == ' ' || *params == '\t'))
params++;
- /* Hmm, but what about @columnfractions 3foo. Well, I suppose
+ /* Hmm, but what about @columnfractions 3foo. Oh well,
it's invalid input anyway. */
while (*params && *params != ' ' && *params != '\t'
&& *params != '\n' && *params != '@')
params++;
- setup_output_environment (i,
- (int) (columnfrac * (fill_column - current_indent) + .5));
+
+ {
+ /* For html/xml/docbook, translate fractions into integer
+ percentages, adding .005 to avoid rounding problems. For
+ info, we want the character width. */
+ int width = xml || html ? (columnfrac + .005) * 100
+ : (columnfrac * (fill_column - current_indent) + .5);
+ setup_output_environment (i, width);
+ }
}
}
} else if (*params == '{') {
unsigned template_width = find_template_width (¶ms);
-
+
/* This gives us two spaces between columns. Seems reasonable.
How to take into account current_indent here? */
setup_output_environment (i++, template_width + 2);
@@ -313,64 +264,130 @@ done:
return last_column;
}
-/* Initialize environment number ENV_NO, of width WIDTH.
- The idea is that we're going to use one environment for each column of
- a multitable, so we can build them up separately and print them
- all out at the end. */
-int
-setup_output_environment (env_no, width)
- int env_no;
- int width;
+/* Output a row. Calls insert, but also flushes the buffered output
+ when we see a newline, since in multitable every line is a separate
+ paragraph. */
+static void
+out_char (int ch)
{
- int old_env = select_output_environment (env_no);
+ if (html || xml)
+ add_char (ch);
+ else
+ {
+ int env = select_output_environment (0);
+ insert (ch);
+ if (ch == '\n')
+ {
+ uninhibit_output_flushing ();
+ flush_output ();
+ inhibit_output_flushing ();
+ }
+ select_output_environment (env);
+ }
+}
- /* clobber old environment and set width of new one */
- init_paragraph ();
- /* make our change */
- fill_column = width;
+static void
+draw_horizontal_separator (void)
+{
+ int i, j, s;
- /* Save new environment and restore previous one. */
- select_output_environment (old_env);
+ if (html)
+ {
+ add_word ("");
+ return;
+ }
+ if (xml)
+ return;
- return env_no;
+ for (s = 0; s < envs[0].current_indent; s++)
+ out_char (' ');
+ if (vsep)
+ out_char ('+');
+ for (i = 1; i <= last_column; i++) {
+ for (j = 0; j <= envs[i].fill_column; j++)
+ out_char ('-');
+ if (vsep)
+ out_char ('+');
+ }
+ out_char (' ');
+ out_char ('\n');
}
-/* Direct current output to environment number N. Used when
- switching work from one column of a multitable to the next.
- Returns previous environment number. */
-int
-select_output_environment (n)
- int n;
+
+/* multitable strategy:
+ for each item {
+ for each column in an item {
+ initialize a new paragraph
+ do ordinary formatting into the new paragraph
+ save the paragraph away
+ repeat if there are more paragraphs in the column
+ }
+ dump out the saved paragraphs and free the storage
+ }
+
+ For HTML we construct a simple HTML 3.2 table with s inserted
+ to help non-tables browsers. `@item' inserts a
and `@tab'
+ inserts
; we also try to close
. The only real
+ alternative is to rely on the info formatting engine and present
+ preformatted text. */
+
+void
+do_multitable (void)
{
- struct env *e = &envs[current_env_no];
- int old_env_no = current_env_no;
+ int ncolumns;
- /* stash current env info from global vars into the old environment */
- e->output_paragraph = output_paragraph;
- e->output_paragraph_offset = output_paragraph_offset;
- e->meta_char_pos = meta_char_pos;
- e->output_column = output_column;
- e->paragraph_is_open = paragraph_is_open;
- e->current_indent = current_indent;
- e->fill_column = fill_column;
+ if (multitable_active)
+ {
+ line_error ("Multitables cannot be nested");
+ return;
+ }
- /* now copy new environment into global vars */
- current_env_no = n;
- e = &envs[current_env_no];
- output_paragraph = e->output_paragraph;
- output_paragraph_offset = e->output_paragraph_offset;
- meta_char_pos = e->meta_char_pos;
- output_column = e->output_column;
- paragraph_is_open = e->paragraph_is_open;
- current_indent = e->current_indent;
- fill_column = e->fill_column;
- return old_env_no;
+ close_single_paragraph ();
+
+ if (xml)
+ {
+ xml_no_para = 1;
+ if (output_paragraph[output_paragraph_offset-1] == '\n')
+ output_paragraph_offset--;
+ }
+
+ /* scan the current item function to get the field widths
+ and number of columns, and set up the output environment list
+ accordingly. */
+ ncolumns = setup_multitable_parameters ();
+ first_row = 1;
+
+ /*
for non-tables browsers. @multitable implicitly ends the
+ current paragraph, so this is ok. */
+ if (html)
+ add_html_block_elt ("
");
+ /* else if (docbook)*/ /* 05-08 */
+ else if (xml)
+ {
+ int *widths = xmalloc (ncolumns * sizeof (int));
+ int i;
+ for (i=0; i= last_column) {
line_error (_("Too many columns in multitable item (max %d)"), last_column);
@@ -382,8 +399,8 @@ nselect_next_environment ()
/* do anything needed at the beginning of processing a
multitable column. */
-void
-init_column ()
+static void
+init_column (void)
{
/* don't indent 1st paragraph in the item */
cm_noindent ();
@@ -392,50 +409,8 @@ init_column ()
skip_whitespace ();
}
-/* start a new item (row) of a multitable */
-int
-multitable_item ()
-{
- if (!multitable_active) {
- line_error ("multitable_item internal error: no active multitable");
- xexit (1);
- }
-
- if (html)
- {
- if (!first_row)
- add_word (" "); /* for non-tables browsers. */
- add_word ("
");
- first_row = 0;
- return 0;
- }
- /* else if (docbook)*/ /* 05-08 */
- else if (xml)
- {
- xml_end_multitable_row (first_row);
- first_row = 0;
- return 0;
- }
- first_row = 0;
-
- if (current_env_no > 0) {
- output_multitable_row ();
- }
- /* start at column 1 */
- select_output_environment (1);
- if (!output_paragraph) {
- line_error (_("[unexpected] cannot select column #%d in multitable"),
- current_env_no);
- xexit (1);
- }
-
- init_column ();
-
- return 0;
-}
-
static void
-output_multitable_row ()
+output_multitable_row (void)
{
/* offset in the output paragraph of the next char needing
to be output for that column. */
@@ -520,18 +495,108 @@ output_multitable_row ()
}
}
+int after_headitem = 0;
+int headitem_row = 0;
+
+/* start a new item (row) of a multitable */
+int
+multitable_item (void)
+{
+ if (!multitable_active) {
+ line_error ("multitable_item internal error: no active multitable");
+ xexit (1);
+ }
+
+ current_column_no = 1;
+
+ if (html)
+ {
+ if (!first_row)
+ /* for non-tables browsers. */
+ add_word_args (" %s>
\n", headitem_row ? "th" : "td");
/* else if (docbook)*/ /* 05-08 */
else if (xml)
xml_end_multitable ();
diff --git a/contrib/texinfo/makeinfo/multi.h b/contrib/texinfo/makeinfo/multi.h
new file mode 100644
index 0000000..64311e0
--- /dev/null
+++ b/contrib/texinfo/makeinfo/multi.h
@@ -0,0 +1,28 @@
+/* multi.h -- declarations for multi.c.
+ $Id: multi.h,v 1.1 2004/04/11 17:56:47 karl Exp $
+
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MULTI_H
+#define MULTI_H
+
+extern void do_multitable (void);
+extern void end_multitable (void);
+extern int multitable_item (void);
+
+#endif /* !MULTI_H */
diff --git a/contrib/texinfo/makeinfo/node.c b/contrib/texinfo/makeinfo/node.c
index 2215d4c..07a37fe 100644
--- a/contrib/texinfo/makeinfo/node.c
+++ b/contrib/texinfo/makeinfo/node.c
@@ -1,7 +1,7 @@
/* node.c -- nodes for Texinfo.
- $Id: node.c,v 1.12 2003/05/01 00:30:07 karl Exp $
+ $Id: node.c,v 1.27 2004/12/20 23:56:07 karl Exp $
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -21,6 +21,7 @@
#include "system.h"
#include "cmds.h"
#include "files.h"
+#include "float.h"
#include "footnote.h"
#include "macro.h"
#include "makeinfo.h"
@@ -30,12 +31,12 @@
#include "insertion.h"
#include "xml.h"
-
/* See comments in node.h. */
NODE_REF *node_references = NULL;
NODE_REF *node_node_references = NULL;
TAG_ENTRY *tag_table = NULL;
int node_number = -1;
+int node_order = 0;
int current_section = 0;
int outstanding_node = 0;
@@ -43,7 +44,7 @@ int outstanding_node = 0;
/* Start a new tag table. */
void
-init_tag_table ()
+init_tag_table (void)
{
while (tag_table)
{
@@ -61,8 +62,7 @@ init_tag_table ()
INDIRECT_P says how to format the output (it depends on whether the
table is direct or indirect). */
static void
-write_tag_table_internal (indirect_p)
- int indirect_p;
+write_tag_table_internal (int indirect_p)
{
TAG_ENTRY *node;
int old_indent = no_indent;
@@ -112,29 +112,37 @@ write_tag_table_internal (indirect_p)
}
void
-write_tag_table ()
+write_tag_table (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);
}
-void
-write_tag_table_indirect ()
+static void
+write_tag_table_indirect (void)
{
write_tag_table_internal (1);
}
/* Convert "top" and friends into "Top". */
static void
-normalize_node_name (string)
- char *string;
+normalize_node_name (char *string)
{
if (strcasecmp (string, "Top") == 0)
strcpy (string, "Top");
}
-char *
-get_node_token (expand)
- int expand;
+static char *
+get_node_token (int expand)
{
char *string;
@@ -154,8 +162,7 @@ get_node_token (expand)
/* Expand any macros and other directives in a node name, and
return the expanded name as an malloc'ed string. */
char *
-expand_node_name (node)
- char *node;
+expand_node_name (char *node)
{
char *result = node;
@@ -175,8 +182,7 @@ expand_node_name (node)
/* Look up NAME in the tag table, and return the associated
tag_entry. If the node is not in the table return NULL. */
TAG_ENTRY *
-find_node (name)
- char *name;
+find_node (char *name)
{
TAG_ENTRY *tag = tag_table;
char *expanded_name;
@@ -223,9 +229,8 @@ find_node (name)
/* Look in the tag table for a node whose file name is FNAME, and
return the associated tag_entry. If there's no such node in the
table, return NULL. */
-TAG_ENTRY *
-find_node_by_fname (fname)
- char *fname;
+static TAG_ENTRY *
+find_node_by_fname (char *fname)
{
TAG_ENTRY *tag = tag_table;
while (tag)
@@ -241,8 +246,7 @@ find_node_by_fname (fname)
/* Remember next, prev, etc. references in a @node command, where we
don't care about most of the entries. */
static void
-remember_node_node_reference (node)
- char *node;
+remember_node_node_reference (char *node)
{
NODE_REF *temp = xmalloc (sizeof (NODE_REF));
int number;
@@ -263,10 +267,9 @@ remember_node_node_reference (node)
}
/* Remember NODE and associates. */
-void
-remember_node (node, prev, next, up, position, line_no, fname, flags)
- char *node, *prev, *next, *up, *fname;
- int position, line_no, flags;
+static void
+remember_node (char *node, char *prev, char *next, char *up,
+ int position, int line_no, char *fname, int flags)
{
/* Check for existence of this tag already. */
if (validating)
@@ -314,6 +317,11 @@ remember_node (node, prev, next, up, position, line_no, fname, flags)
new->html_fname
= normalize_filename (filename_part (current_output_filename));
new->next_ent = tag_table;
+
+ /* Increment the order counter, and save it. */
+ node_order++;
+ new->order = node_order;
+
tag_table = new;
}
@@ -330,10 +338,7 @@ remember_node (node, prev, next, up, position, line_no, fname, flags)
output file has been written, if validation is on, then we use the
contents of `node_references' as a list of nodes to validate. */
void
-remember_node_reference (node, line, type)
- char *node;
- int line;
- enum reftype type;
+remember_node_reference (char *node, int line, enum reftype type)
{
NODE_REF *temp = xmalloc (sizeof (NODE_REF));
int number = number_of_node (node);
@@ -357,8 +362,7 @@ remember_node_reference (node, line, type)
}
static void
-isolate_nodename (nodename)
- char *nodename;
+isolate_nodename (char *nodename)
{
int i, c;
int paren_seen, paren;
@@ -417,9 +421,7 @@ isolate_nodename (nodename)
just before the menu line. If REMEMBER_REF is zero, REF_TYPE is unused. */
#define MENU_STARTER "* "
char *
-glean_node_from_menu (remember_ref, ref_type)
- int remember_ref;
- enum reftype ref_type;
+glean_node_from_menu (int remember_ref, enum reftype ref_type)
{
int i, orig_offset = input_text_offset;
char *nodename;
@@ -473,14 +475,60 @@ glean_node_from_menu (remember_ref, ref_type)
/* Set the name of the current output file. */
void
-set_current_output_filename (fname)
- const char *fname;
+set_current_output_filename (const char *fname)
{
if (current_output_filename)
free (current_output_filename);
current_output_filename = xstrdup (fname);
}
+
+/* Output the constructs for NODE. We output both
+ the new-style conversion and the old-style, if they are different.
+ See comments at `add_escaped_anchor_name' in html.c. */
+
+static void
+add_html_names (char *node)
+{
+ char *tem = expand_node_name (node);
+ char *otem = xstrdup (tem);
+
+ /* Determine if the old and new schemes come up with different names;
+ only output the old scheme if that is so. We don't want to output
+ the same name twice. */
+ canon_white (otem);
+ {
+ char *optr = otem;
+ int need_old = 0;
+
+ for (; *optr; optr++)
+ {
+ if (!cr_or_whitespace (*optr) && !URL_SAFE_CHAR (*optr))
+ {
+ need_old = 1;
+ break;
+ }
+ }
+
+ if (need_old)
+ {
+ add_word ("\n");
+ }
+ free (otem);
+ }
+
+ /* Always output the new scheme. */
+ canon_white (tem);
+ add_word ("\n");
+
+ free (tem);
+}
+
+
/* The order is: nodename, nextnode, prevnode, upnode.
If all of the NEXT, PREV, and UP fields are empty, they are defaulted.
You must follow a node command which has those fields defaulted
@@ -488,7 +536,7 @@ set_current_output_filename (fname)
It is an error not to do so.
The defaults come from the menu in this node's parent. */
void
-cm_node ()
+cm_node (void)
{
static long epilogue_len = 0L;
char *node, *prev, *next, *up;
@@ -510,7 +558,6 @@ cm_node ()
if (!html && !already_outputting_pending_notes)
{
- if (!xml)
close_paragraph ();
output_pending_notes ();
}
@@ -586,6 +633,7 @@ cm_node ()
epilogue_len = ftell (output_stream) - pos1;
fclose (output_stream);
output_stream = NULL;
+ output_position = 0;
tag = find_node_by_fname (fname_for_this_node);
}
free (fname_for_prev_node);
@@ -602,6 +650,10 @@ cm_node ()
if (macro_expansion_output_stream && !executing_string)
remember_itext (input_text, input_text_offset);
+ /* Reset the line number in each node for Info output, so that
+ index entries will save the line numbers of parent node. */
+ node_line_number = 0;
+
no_indent = 1;
if (xml)
{
@@ -621,6 +673,9 @@ cm_node ()
}
else if (!no_headers && !html)
{
+ /* Emacs Info reader cannot grok indented escape sequence. */
+ kill_self_indent (-1);
+
add_word_args ("\037\nFile: %s, Node: ", pretty_output_filename);
if (macro_expansion_output_stream && !executing_string)
@@ -633,7 +688,7 @@ cm_node ()
/* Check for defaulting of this node's next, prev, and up fields. */
defaulting = (*next == 0 && *prev == 0 && *up == 0);
- this_section = what_section (input_text + input_text_offset);
+ this_section = what_section (input_text + input_text_offset, NULL);
/* If we are defaulting, then look at the immediately following
sectioning command (error if none) to determine the node's
@@ -679,6 +734,8 @@ cm_node ()
int orig_offset, orig_size;
+ int bye_offset = search_forward ("\n@bye", input_text_offset);
+
/* No matter what, make this file point back at `(dir)'. */
free (up);
up = xstrdup ("(dir)"); /* html fixxme */
@@ -694,6 +751,7 @@ cm_node ()
input_text_offset = search_forward ("\n@menu", orig_offset);
if (input_text_offset > -1
+ && (bye_offset > -1 && input_text_offset < bye_offset)
&& cr_or_whitespace (input_text[input_text_offset + 6]))
{
char *nodename_from_menu = NULL;
@@ -911,61 +969,66 @@ cm_node ()
}
if (!splitting && no_headers)
- { /* cross refs need a name="#anchor" even if we're not writing headers*/
- add_word ("");
- free (tem);
+ { /* cross refs need a name="#anchor" even if not writing headers */
+ add_html_names (node);
}
if (splitting || !no_headers)
{ /* Navigation bar. */
- add_word ("
\n");
+ add_html_block_elt ("
\n");
/* The
avoids the links area running on with old Lynxen. */
add_word_args ("
%s\n", splitting ? "" : "
");
- add_word_args ("%s%s%s", tem);
- free (tem);
+
+ /* In the split HTML case, the filename is wrong for the
+ old-style converted names, but we'll add them anyway, for
+ consistency. (And we need them in the normal (not
+ no_headers) nonsplit case.) */
+ add_html_names (node);
if (next)
{
tem = expansion (next, 0);
- add_word (",\n");
- add_word (_("Next:"));
+ add_word ((char *) _("Next:"));
add_word (" ");
+
add_word ("%s", tem);
+
free (tem);
+
+ if (prev || up)
+ add_word (",\n");
}
if (prev)
{
tem = expansion (prev, 0);
- add_word (",\n");
- add_word (_("Previous:"));
+ add_word ((char *) _("Previous:"));
add_word (" ");
add_word ("%s", tem);
free (tem);
+
+ if (up)
+ add_word (",\n");
}
if (up)
{
tem = expansion (up, 0);
- add_word (",\n");
- add_word (_("Up:"));
+ add_word ((char *) _("Up:"));
add_word (" ");
add_word ("%s", tem);
free (tem);
}
/* html fixxme: we want a `top' or `contents' link here. */
- add_word_args ("\n%s \n", splitting ? "" : "");
+ add_word_args ("\n%s\n", splitting ? "" : "");
add_word ("
\n");
}
}
@@ -1033,8 +1096,7 @@ cm_node ()
/* Cross-reference target at an arbitrary spot. */
void
-cm_anchor (arg)
- int arg;
+cm_anchor (int arg)
{
char *anchor;
char *fname_for_anchor = NULL;
@@ -1170,9 +1232,7 @@ cm_anchor (arg)
/* Find NODE in REF_LIST. */
static NODE_REF *
-find_node_reference (node, ref_list)
- char *node;
- NODE_REF *ref_list;
+find_node_reference (char *node, NODE_REF *ref_list)
{
NODE_REF *orig_ref_list = ref_list;
char *expanded_node;
@@ -1210,7 +1270,7 @@ find_node_reference (node, ref_list)
}
void
-free_node_references ()
+free_node_references (void)
{
NODE_REF *list, *temp;
@@ -1228,7 +1288,7 @@ free_node_references ()
}
void
-free_node_node_references ()
+free_node_node_references (void)
{
NODE_REF *list, *temp;
@@ -1247,8 +1307,7 @@ free_node_node_references ()
/* Return the number assigned to a named node in either the tag_table
or node_references list or zero if no number has been assigned. */
int
-number_of_node (node)
- char *node;
+number_of_node (char *node)
{
NODE_REF *temp_ref;
TAG_ENTRY *temp_node = find_node (node);
@@ -1270,10 +1329,7 @@ number_of_node (node)
Menu, Cross, Next, etc. */
static int
-validate (tag, line, label)
- char *tag;
- int line;
- char *label;
+validate (char *tag, int line, const char *label)
{
TAG_ENTRY *result;
@@ -1299,8 +1355,7 @@ validate (tag, line, label)
the `validate' routine. They are only used in messages, thus are
translated. */
static const char *
-reftype_type_string (type)
- enum reftype type;
+reftype_type_string (enum reftype type)
{
switch (type)
{
@@ -1314,8 +1369,7 @@ reftype_type_string (type)
}
static void
-validate_other_references (ref_list)
- NODE_REF *ref_list;
+validate_other_references (NODE_REF *ref_list)
{
char *old_input_filename = input_filename;
@@ -1344,8 +1398,7 @@ validate_other_references (ref_list)
If the Next is different from the Next of the Up,
then the Next node must have a Prev pointing at this node. */
void
-validate_file (tag_table)
- TAG_ENTRY *tag_table;
+validate_file (TAG_ENTRY *tag_table)
{
char *old_input_filename = input_filename;
TAG_ENTRY *tags = tag_table;
@@ -1384,7 +1437,7 @@ validate_file (tag_table)
tem1 = expand_node_name (prev);
tem2 = expand_node_name (tags->node);
- if (STREQ (tem1, tem2))
+ if (tem1 && tem2 && STREQ (tem1, tem2))
you_lose = 0;
free (tem1);
free (tem2);
@@ -1590,8 +1643,7 @@ validate_file (tag_table)
This means only anchors follow. */
static int
-last_node_p (tags)
- TAG_ENTRY *tags;
+last_node_p (TAG_ENTRY *tags)
{
int last = 1;
while (tags->next_ent) {
@@ -1609,23 +1661,91 @@ last_node_p (tags)
}
+static char *
+enumerate_filename (char *pathname, char *basename, int number)
+{
+ /* Do we need to generate names of subfiles which don't exceed 8+3 limits? */
+ const int dos_file_names = !HAVE_LONG_FILENAMES (pathname ? pathname : ".");
+ unsigned name_len = strlen (basename);
+ char *filename = xmalloc (10 + strlen (pathname) + name_len);
+ char *base_filename = xmalloc (10 + name_len);
+
+ sprintf (base_filename, "%s-%d", basename, number);
+
+ if (dos_file_names)
+ {
+ char *dot = strchr (base_filename, '.');
+ unsigned base_len = strlen (base_filename);
+
+ if (dot)
+ { /* Make foobar.i1, .., foobar.i99, foobar.100, ... */
+ dot[1] = 'i';
+ memmove (number <= 99 ? dot + 2 : dot + 1,
+ base_filename + name_len + 1,
+ strlen (base_filename + name_len + 1) + 1);
+ }
+ else if (base_len > 8)
+ {
+ /* Make foobar-1, .., fooba-10, .., foob-100, ... */
+ unsigned numlen = base_len - name_len;
+
+ memmove (base_filename + 8 - numlen, base_filename + name_len, numlen + 1);
+ }
+ }
+
+ sprintf (filename, "%s%s", pathname, base_filename);
+
+ return filename;
+}
+
+/* Remove previously split files, to avoid
+ lingering parts of shrinked documents. */
+void
+clean_old_split_files (char *filename)
+{
+ char *root_filename = filename_part (filename);
+ char *root_pathname = pathname_part (filename);
+ int i;
+
+ /* We break as soon as we hit an inexistent file,
+ so looping until large numbers is harmless. */
+ for (i = 1; i < 1000; i++)
+ {
+ struct stat st;
+ char *check_file = enumerate_filename (root_pathname, root_filename, i);
+
+ if (stat (check_file, &st) != 0)
+ break;
+ else if (!S_ISDIR (st.st_mode))
+ {
+ /* Give feedback if requested, removing a file is important. */
+ if (verbose_mode)
+ printf (_("Removing %s\n"), check_file);
+
+ /* Warn user that we cannot remove the file. */
+ if (unlink (check_file) != 0)
+ warning (_("Can't remove file `%s': %s"), check_file, strerror (errno));
+ }
+
+ free (check_file);
+ }
+}
+
+
/* Split large output files into a series of smaller files. Each file
is pointed to in the tag table, which then gets written out as the
original file. The new files have the same name as the original file
with a "-num" attached. SIZE is the largest number of bytes to allow
in any single split file. */
void
-split_file (filename, size)
- char *filename;
- int size;
+split_file (char *filename, int size)
{
char *root_filename, *root_pathname;
- char *the_file, *filename_part ();
+ char *the_file;
struct stat fileinfo;
long file_size;
char *the_header;
int header_size;
- int dos_file_names = 0; /* if nonzero, don't exceed 8+3 limits */
/* Can only do this to files with tag tables. */
if (!tag_table)
@@ -1639,16 +1759,13 @@ split_file (filename, size)
return;
file_size = (long) fileinfo.st_size;
- the_file = find_and_load (filename);
+ the_file = find_and_load (filename, 0);
if (!the_file)
return;
root_filename = filename_part (filename);
root_pathname = pathname_part (filename);
- /* Do we need to generate names of subfiles which don't exceed 8+3 limits? */
- dos_file_names = !HAVE_LONG_FILENAMES (root_pathname ? root_pathname : ".");
-
if (!root_pathname)
root_pathname = xstrdup ("");
@@ -1751,36 +1868,9 @@ split_file (filename, size)
write_region:
{
int fd;
- char *split_filename, *split_basename;
- unsigned root_len = strlen (root_filename);
-
- split_filename = xmalloc (10 + strlen (root_pathname)
- + root_len);
- split_basename = xmalloc (10 + root_len);
- sprintf (split_basename, "%s-%d", root_filename, which_file);
- if (dos_file_names)
- {
- char *dot = strchr (split_basename, '.');
- unsigned base_len = strlen (split_basename);
-
- if (dot)
- { /* Make foobar.i1, .., foobar.i99, foobar.100, ... */
- dot[1] = 'i';
- memmove (which_file <= 99 ? dot + 2 : dot + 1,
- split_basename + root_len + 1,
- strlen (split_basename + root_len + 1) + 1);
- }
- else if (base_len > 8)
- {
- /* Make foobar-1, .., fooba-10, .., foob-100, ... */
- unsigned numlen = base_len - root_len;
-
- memmove (split_basename + 8 - numlen,
- split_basename + root_len, numlen + 1);
- }
- }
- sprintf (split_filename, "%s%s", root_pathname,
- split_basename);
+ char *split_filename = enumerate_filename (root_pathname,
+ root_filename, which_file);
+ char *split_basename = filename_part (split_filename);
fd = open (split_filename, O_WRONLY|O_TRUNC|O_CREAT, 0666);
if (fd < 0
@@ -1840,7 +1930,7 @@ split_file (filename, size)
/* preserve local variables in info output. */
if (trailer)
{
- insert_string (trailer);
+ fwrite (trailer, 1, trailer_len, output_stream);
free (trailer);
}
diff --git a/contrib/texinfo/makeinfo/node.h b/contrib/texinfo/makeinfo/node.h
index a625e88..766c503 100644
--- a/contrib/texinfo/makeinfo/node.h
+++ b/contrib/texinfo/makeinfo/node.h
@@ -1,5 +1,5 @@
/* node.h -- declarations for Node.
- $Id: node.h,v 1.1 2002/08/25 23:38:39 karl Exp $
+ $Id: node.h,v 1.2 2004/04/11 17:56:47 karl Exp $
Copyright (C) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
@@ -22,6 +22,8 @@
#ifndef NODE_H
#define NODE_H
+#include "xref.h"
+
/* The various references that we know about. */
/* What we remember for each node. */
typedef struct tentry
@@ -39,6 +41,7 @@ typedef struct tentry
int number; /* Number for this node, relevant for HTML
splitting -- from use+define order, not just
define. */
+ int order; /* The order of the tag, starting from zero. */
char *html_fname; /* The HTML file to which this node is written
(non-NULL only for HTML splitting). */
} TAG_ENTRY;
@@ -85,6 +88,9 @@ extern TAG_ENTRY *tag_table;
/* Counter for setting node_ref.number; zero is Top. */
extern int node_number;
+/* Node order counter. */
+extern int node_order;
+
/* The current node's section level. */
extern int current_section;
@@ -92,22 +98,32 @@ extern int current_section;
corresponding to the current node in HTML mode. */
extern int outstanding_node;
-extern TAG_ENTRY *find_node ();
+extern TAG_ENTRY *find_node (char *name);
/* A search string which is used to find a line defining a node. */
DECLARE (char *, node_search_string, "\n@node ");
/* Extract node name from a menu item. */
-extern char *glean_node_from_menu ();
+extern char *glean_node_from_menu (int remember_ref, enum reftype ref_type);
/* Remember a node for later validation. */
-extern void remember_node_reference ();
+extern void remember_node_reference (char *node, int line, enum reftype type);
/* Remember the name of the current output file. */
-extern void set_current_output_filename ();
+extern void set_current_output_filename (const char *fname);
/* Expand macros and commands in the node name and canonicalize
whitespace in the resulting expansion. */
-extern char *expand_node_name ();
+extern char *expand_node_name (char *node);
+
+extern int number_of_node (char *node);
+
+extern void init_tag_table (void);
+extern void write_tag_table (char *filename);
+extern void free_node_references (void);
+extern void free_node_node_references (void);
+extern void validate_file (TAG_ENTRY *tag_table);
+extern void split_file (char *filename, int size);
+extern void clean_old_split_files (char *filename);
#endif /* NODE_H */
diff --git a/contrib/texinfo/makeinfo/sectioning.c b/contrib/texinfo/makeinfo/sectioning.c
index cd04dfa..ce32aeb 100644
--- a/contrib/texinfo/makeinfo/sectioning.c
+++ b/contrib/texinfo/makeinfo/sectioning.c
@@ -1,7 +1,7 @@
/* sectioning.c -- for @chapter, @section, ..., @contents ...
- $Id: sectioning.c,v 1.10 2003/05/13 16:37:54 karl Exp $
+ $Id: sectioning.c,v 1.25 2004/07/05 22:23:23 karl Exp $
- Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@ section_alist_type section_alist[] = {
{ "unnumberedsubsec", 4, ENUM_SECT_NO, TOC_YES },
{ "unnumberedsec", 3, ENUM_SECT_NO, TOC_YES },
{ "unnumbered", 2, ENUM_SECT_NO, TOC_YES },
+ { "centerchap", 2, ENUM_SECT_NO, TOC_YES },
{ "appendixsubsubsec", 5, ENUM_SECT_APP, TOC_YES }, /* numbered like A.X.X.X */
{ "appendixsubsec", 4, ENUM_SECT_APP, TOC_YES },
@@ -81,14 +82,18 @@ static char *scoring_characters = "*=-.";
/* Amount to offset the name of sectioning commands to levels by. */
static int section_alist_offset = 0;
+/* These two variables are for @float, @cindex like commands that need to know
+ in which section they are used. */
+/* Last value returned by get_sectioning_number. */
+static char *last_sectioning_number = "";
+/* Last title used by sectioning_underscore, etc. */
+static char *last_sectioning_title = "";
/* num == ENUM_SECT_NO means unnumbered (should never call this)
num == ENUM_SECT_YES means numbered
num == ENUM_SECT_APP means numbered like A.1 and so on */
-char *
-get_sectioning_number (level, num)
- int level;
- int num;
+static char *
+get_sectioning_number (int level, int num)
{
static char s[100]; /* should ever be enough for 99.99.99.99
Appendix A.1 */
@@ -114,9 +119,14 @@ get_sectioning_number (level, num)
if ((num == ENUM_SECT_APP)
&& (i == 0)
&& (enum_marker == APPENDIX_MAGIC))
- sprintf (p, _("Appendix %c "), numbers[i] + 64);
+ sprintf (p, _("Appendix %c"), numbers[i] + 64);
else
- sprintf (p, "%d ", numbers[i]);
+ sprintf (p, "%d", numbers[i]);
+
+ /* Poor man's cache :-) */
+ if (strlen (last_sectioning_number))
+ free (last_sectioning_number);
+ last_sectioning_number = xstrdup (s);
return s;
}
@@ -124,8 +134,7 @@ get_sectioning_number (level, num)
/* Set the level of @top to LEVEL. Return the old level of @top. */
int
-set_top_section_level (level)
- int level;
+set_top_section_level (int level)
{
int i, result = -1;
@@ -141,9 +150,8 @@ set_top_section_level (level)
/* return the index of the given sectioning command in section_alist */
-int
-search_sectioning (text)
- char *text;
+static int
+search_sectioning (char *text)
{
int i;
char *t;
@@ -162,10 +170,13 @@ search_sectioning (text)
return -1;
}
-/* Return an integer which identifies the type section present in TEXT. */
+/* Return an integer which identifies the type of section present in
+ TEXT -- 1 for @top, 2 for chapters, ..., 5 for subsubsections (as
+ specified in section_alist). We take into account any @lowersections
+ and @raisesections. If SECNAME is non-NULL, also return the
+ corresponding section name. */
int
-what_section (text)
- char *text;
+what_section (char *text, char **secname)
{
int index, j;
char *temp;
@@ -205,126 +216,213 @@ what_section (text)
if (return_val < 0)
return_val = 0;
else if (return_val > 5)
- return_val = 5;
+ return_val = 5;
+
+ if (secname)
+ {
+ int i;
+ int alist_size = sizeof (section_alist) / sizeof(section_alist_type);
+ /* Find location of offset sectioning entry, but don't go off
+ either end of the array. */
+ int index_offset = MAX (index - section_alist_offset, 0);
+ index_offset = MIN (index_offset, alist_size - 1);
+
+ /* Also make sure we don't go into the next "group" of
+ sectioning changes, e.g., change from an @appendix to an
+ @heading or some such. */
+#define SIGN(expr) ((expr) < 0 ? -1 : 1)
+ for (i = index; i != index_offset; i -= SIGN (section_alist_offset))
+ {
+ /* As it happens, each group has unique .num/.toc values. */
+ if (section_alist[i].num != section_alist[index_offset].num
+ || section_alist[i].toc != section_alist[index_offset].toc)
+ break;
+ }
+ *secname = section_alist[i].name;
+ }
return return_val;
}
return -1;
}
-void
-sectioning_underscore (cmd)
- char *cmd;
+/* Returns current top level division (ie. chapter, unnumbered) number.
+ - For chapters, returns the number.
+ - For unnumbered sections, returns empty string.
+ - For appendices, returns A, B, etc. */
+char *
+current_chapter_number (void)
{
- /* If we're not indenting the first paragraph, we shall make it behave
- like @noindent is called directly after the section heading. */
- if (! do_first_par_indent)
- cm_noindent ();
-
- if (xml)
+ if (enum_marker == UNNUMBERED_MAGIC)
+ return xstrdup ("");
+ else if (enum_marker == APPENDIX_MAGIC)
{
- char *temp;
- int level;
- temp = xmalloc (2 + strlen (cmd));
- temp[0] = COMMAND_PREFIX;
- strcpy (&temp[1], cmd);
- level = what_section (temp);
- level -= 2;
- free (temp);
- xml_close_sections (level);
- /* Mark the beginning of the section
- If the next command is printindex, we will remove
- the section and put an Index instead */
- flush_output ();
- xml_last_section_output_position = output_paragraph_offset;
-
- xml_insert_element (xml_element (cmd), START);
- xml_insert_element (TITLE, START);
- xml_open_section (level, cmd);
- get_rest_of_line (0, &temp);
- execute_string ("%s\n", temp);
- free (temp);
- xml_insert_element (TITLE, END);
+ char s[1];
+ sprintf (s, "%c", numbers[0] + 64);
+ return xstrdup (s);
}
else
{
- char character;
- char *temp;
+ char s[5];
+ sprintf (s, "%d", numbers[0]);
+ return xstrdup (s);
+ }
+}
+
+/* Returns number of the last sectioning command used. */
+char *
+current_sectioning_number (void)
+{
+ if (enum_marker == UNNUMBERED_MAGIC || !number_sections)
+ return xstrdup ("");
+ else
+ return xstrdup (last_sectioning_number);
+}
+
+/* Returns arguments of the last sectioning command used. */
+char *
+current_sectioning_name (void)
+{
+ return xstrdup (last_sectioning_title);
+}
+
+/* insert_and_underscore, sectioning_underscore and sectioning_html call this. */
+
+static char *
+handle_enum_increment (int level, int index)
+{
+ /* Here is how TeX handles enumeration:
+ - Anything starting with @unnumbered is not enumerated.
+ - @majorheading and the like are not enumberated. */
+ int i;
+
+ /* First constraint above. */
+ if (enum_marker == UNNUMBERED_MAGIC && level == 0)
+ return xstrdup ("");
+
+ /* Second constraint. */
+ if (section_alist[index].num == ENUM_SECT_NO)
+ return xstrdup ("");
+
+ /* reset all counters which are one level deeper */
+ for (i = level; i < 3; i++)
+ numbers [i + 1] = 0;
+
+ numbers[level]++;
+ if (section_alist[index].num == ENUM_SECT_NO || enum_marker == UNNUMBERED_MAGIC
+ || !number_sections)
+ return xstrdup ("");
+ else
+ return xstrdup (get_sectioning_number (level, section_alist[index].num));
+}
+
+
+void
+sectioning_underscore (char *cmd)
+{
+ char *temp, *secname;
int level;
+
+ /* If we're not indenting the first paragraph, we shall make it behave
+ like @noindent is called directly after the section heading. */
+ if (! do_first_par_indent)
+ cm_noindent ();
temp = xmalloc (2 + strlen (cmd));
temp[0] = COMMAND_PREFIX;
strcpy (&temp[1], cmd);
- level = what_section (temp);
- free (temp);
+ level = what_section (temp, &secname);
level -= 2;
-
if (level < 0)
level = 0;
+ free (temp);
- if (html)
- sectioning_html (level, cmd);
- else
+ /* If the argument to @top is empty, we try using the one from @settitle.
+ Warn if both are unusable. */
+ if (STREQ (command, "top"))
{
- character = scoring_characters[level];
- insert_and_underscore (level, character, cmd);
- }
- }
-}
+ int save_input_text_offset = input_text_offset;
-/* insert_and_underscore and sectioning_html are the
- only functions which call this.
- I have created this, because it was exactly the same
- code in both functions. */
-static char *
-handle_enum_increment (level, index)
- int level;
- int index;
-{
- /* special for unnumbered */
- if (number_sections && section_alist[index].num == ENUM_SECT_NO)
- {
- if (level == 0
- && enum_marker != UNNUMBERED_MAGIC)
- enum_marker = UNNUMBERED_MAGIC;
+ get_rest_of_line (0, &temp);
+
+ /* Due to get_rest_of_line ... */
+ line_number--;
+
+ if (strlen (temp) == 0 && (!title || strlen (title) == 0))
+ warning ("Must specify a title with least one of @settitle or @top");
+
+ input_text_offset = save_input_text_offset;
}
- /* enumerate only things which are allowed */
- if (number_sections && section_alist[index].num)
+
+ if (xml)
{
- /* reset the marker if we get into enumerated areas */
- if (section_alist[index].num == ENUM_SECT_YES
- && level == 0
- && enum_marker == UNNUMBERED_MAGIC)
- enum_marker = 0;
- /* This is special for appendix; if we got the first
- time an appendix command then we are entering appendix.
- Thats the point we have to start countint with A, B and so on. */
- if (section_alist[index].num == ENUM_SECT_APP
- && level == 0
- && enum_marker != APPENDIX_MAGIC)
- {
- enum_marker = APPENDIX_MAGIC;
- numbers [0] = 0; /* this means we start with Appendix A */
- }
+ /* If the section appears in the toc, it means it's a real section
+ unlike majorheading, chapheading etc. */
+ if (section_alist[search_sectioning (cmd)].toc == TOC_YES)
+ {
+ xml_close_sections (level);
+ /* Mark the beginning of the section
+ If the next command is printindex, we will remove
+ the section and put an Index instead */
+ flush_output ();
+ xml_last_section_output_position = output_paragraph_offset;
+
+ get_rest_of_line (0, &temp);
+
+ /* Use @settitle value if @top parameter is empty. */
+ if (STREQ (command, "top") && strlen(temp) == 0)
+ temp = xstrdup (title ? title : "");
+
+ /* Docbook does not support @unnumbered at all. So we provide numbers
+ that other formats use. @appendix seems to be fine though, so we let
+ Docbook handle that as usual. */
+ if (docbook && enum_marker != APPENDIX_MAGIC)
+ {
+ if (section_alist[search_sectioning (cmd)].num == ENUM_SECT_NO
+ && section_alist[search_sectioning (cmd)].toc == TOC_YES)
+ xml_insert_element_with_attribute (xml_element (secname),
+ START, "label=\"%s\" xreflabel=\"%s\"",
+ handle_enum_increment (level, search_sectioning (cmd)),
+ text_expansion (temp));
+ else
+ xml_insert_element_with_attribute (xml_element (secname),
+ START, "label=\"%s\"",
+ handle_enum_increment (level, search_sectioning (cmd)));
+ }
+ else
+ xml_insert_element (xml_element (secname), START);
+
+ xml_insert_element (TITLE, START);
+ xml_open_section (level, secname);
+ execute_string ("%s", temp);
+ xml_insert_element (TITLE, END);
- /* only increment counters if we are not in unnumbered
- area. This handles situations like this:
- @unnumbered .... This sets enum_marker to UNNUMBERED_MAGIC
- @section .... */
- if (enum_marker != UNNUMBERED_MAGIC)
+ free (temp);
+ }
+ else
{
- int i;
+ if (docbook)
+ {
+ if (level > 0)
+ xml_insert_element_with_attribute (xml_element (secname), START,
+ "renderas=\"sect%d\"", level);
+ else
+ xml_insert_element_with_attribute (xml_element (secname), START,
+ "renderas=\"other\"");
+ }
+ else
+ xml_insert_element (xml_element (secname), START);
- /* reset all counters which are one level deeper */
- for (i = level; i < 3; i++)
- numbers [i + 1] = 0;
+ get_rest_of_line (0, &temp);
+ execute_string ("%s", temp);
+ free (temp);
- numbers[level]++;
- return xstrdup
- (get_sectioning_number (level, section_alist[index].num));
+ xml_insert_element (xml_element (secname), END);
}
- } /* if (number_sections)... */
-
- return xstrdup ("");
+ }
+ else if (html)
+ sectioning_html (level, secname);
+ else
+ insert_and_underscore (level, secname);
}
@@ -332,16 +430,14 @@ handle_enum_increment (level, index)
in a new, separate paragraph. Directly underneath it, insert a
line of WITH_CHAR, the same length of the inserted text. */
void
-insert_and_underscore (level, with_char, cmd)
- int level;
- int with_char;
- char *cmd;
+insert_and_underscore (int level, char *cmd)
{
int i, len;
int index;
int old_no_indent;
unsigned char *starting_pos, *ending_pos;
char *temp;
+ char with_char = scoring_characters[level];
close_paragraph ();
filling_enabled = indented_fill = 0;
@@ -352,13 +448,23 @@ insert_and_underscore (level, with_char, cmd)
append_to_expansion_output (input_text_offset + 1);
get_rest_of_line (0, &temp);
+
+ /* Use @settitle value if @top parameter is empty. */
+ if (STREQ (command, "top") && strlen(temp) == 0)
+ temp = xstrdup (title ? title : "");
+
starting_pos = output_paragraph + output_paragraph_offset;
+ /* Poor man's cache for section title. */
+ if (strlen (last_sectioning_title))
+ free (last_sectioning_title);
+ last_sectioning_title = xstrdup (temp);
+
index = search_sectioning (cmd);
if (index < 0)
{
/* should never happen, but a poor guy, named Murphy ... */
- warning (_("Internal error (search_sectioning) \"%s\"!"), cmd);
+ warning (_("Internal error (search_sectioning) `%s'!"), cmd);
return;
}
@@ -367,7 +473,7 @@ insert_and_underscore (level, with_char, cmd)
output. */
/* Step 1: produce "X.Y" and add it to Info output. */
- add_word (handle_enum_increment (level, index));
+ add_word_args ("%s ", handle_enum_increment (level, index));
/* Step 2: add "SECTION-NAME" to both Info and macro-expanded output. */
if (macro_expansion_output_stream && !executing_string)
@@ -404,9 +510,7 @@ insert_and_underscore (level, with_char, cmd)
tagged as an anchor for the current node.. */
void
-sectioning_html (level, cmd)
- int level;
- char *cmd;
+sectioning_html (int level, char *cmd)
{
static int toc_ref_count = 0;
int index;
@@ -419,10 +523,8 @@ sectioning_html (level, cmd)
old_no_indent = no_indent;
no_indent = 1;
- /* level 0 (chapter) is
, everything else is
. We don't want
- to go lower than that because browsers then start rendering the
- headings smaller than the text. */
- add_word_args ("", MIN (3, level + 2), cmd);
+ /* level 0 (chapter) is
, and we go down from there. */
+ add_html_block_elt_args ("", level + 2, cmd);
/* If we are outside of any node, produce an anchor that
the TOC could refer to. */
@@ -449,6 +551,10 @@ sectioning_html (level, cmd)
get_rest_of_line (0, &temp);
+ /* Use @settitle value if @top parameter is empty. */
+ if (STREQ (command, "top") && strlen(temp) == 0)
+ temp = xstrdup (title ? title : "");
+
index = search_sectioning (cmd);
if (index < 0)
{
@@ -458,7 +564,11 @@ sectioning_html (level, cmd)
}
/* Produce "X.Y" and add it to HTML output. */
- add_word (handle_enum_increment (level, index));
+ {
+ char *title_number = handle_enum_increment (level, index);
+ if (strlen (title_number) > 0)
+ add_word_args ("%s ", title_number);
+ }
/* add the section name to both HTML and macro-expanded output. */
if (macro_expansion_output_stream && !executing_string)
@@ -492,7 +602,7 @@ sectioning_html (level, cmd)
/* Shift the meaning of @section to @chapter. */
void
-cm_raisesections ()
+cm_raisesections (void)
{
discard_until ("\n");
section_alist_offset--;
@@ -500,7 +610,7 @@ cm_raisesections ()
/* Shift the meaning of @chapter to @section. */
void
-cm_lowersections ()
+cm_lowersections (void)
{
discard_until ("\n");
section_alist_offset++;
@@ -508,8 +618,7 @@ cm_lowersections ()
/* The command still works, but prints a warning message in addition. */
void
-cm_ideprecated (arg, start, end)
- int arg, start, end;
+cm_ideprecated (int arg, int start, int end)
{
warning (_("%c%s is obsolete; use %c%s instead"),
COMMAND_PREFIX, command, COMMAND_PREFIX, command + 1);
@@ -520,7 +629,7 @@ cm_ideprecated (arg, start, end)
/* Treat this just like @unnumbered. The only difference is
in node defaulting. */
void
-cm_top ()
+cm_top (void)
{
/* It is an error to have more than one @top. */
if (top_node_seen && strcmp (current_node, "Top") != 0)
@@ -584,7 +693,8 @@ cm_top ()
if (input_text_offset < input_text_length)
input_text_offset++;
- this_section = what_section (input_text + input_text_offset);
+ this_section = what_section (input_text + input_text_offset,
+ NULL);
/* If we found a sectioning command, then give the top section
a level of this section - 1. */
@@ -598,42 +708,44 @@ cm_top ()
/* The remainder of the text on this line is a chapter heading. */
void
-cm_chapter ()
+cm_chapter (void)
{
+ enum_marker = 0;
sectioning_underscore ("chapter");
}
/* The remainder of the text on this line is a section heading. */
void
-cm_section ()
+cm_section (void)
{
sectioning_underscore ("section");
}
/* The remainder of the text on this line is a subsection heading. */
void
-cm_subsection ()
+cm_subsection (void)
{
sectioning_underscore ("subsection");
}
/* The remainder of the text on this line is a subsubsection heading. */
void
-cm_subsubsection ()
+cm_subsubsection (void)
{
sectioning_underscore ("subsubsection");
}
/* The remainder of the text on this line is an unnumbered heading. */
void
-cm_unnumbered ()
+cm_unnumbered (void)
{
+ enum_marker = UNNUMBERED_MAGIC;
sectioning_underscore ("unnumbered");
}
/* The remainder of the text on this line is an unnumbered section heading. */
void
-cm_unnumberedsec ()
+cm_unnumberedsec (void)
{
sectioning_underscore ("unnumberedsec");
}
@@ -641,7 +753,7 @@ cm_unnumberedsec ()
/* The remainder of the text on this line is an unnumbered
subsection heading. */
void
-cm_unnumberedsubsec ()
+cm_unnumberedsubsec (void)
{
sectioning_underscore ("unnumberedsubsec");
}
@@ -649,28 +761,32 @@ cm_unnumberedsubsec ()
/* The remainder of the text on this line is an unnumbered
subsubsection heading. */
void
-cm_unnumberedsubsubsec ()
+cm_unnumberedsubsubsec (void)
{
sectioning_underscore ("unnumberedsubsubsec");
}
/* The remainder of the text on this line is an appendix heading. */
void
-cm_appendix ()
+cm_appendix (void)
{
+ /* Reset top level number so we start from Appendix A */
+ if (enum_marker != APPENDIX_MAGIC)
+ numbers [0] = 0;
+ enum_marker = APPENDIX_MAGIC;
sectioning_underscore ("appendix");
}
/* The remainder of the text on this line is an appendix section heading. */
void
-cm_appendixsec ()
+cm_appendixsec (void)
{
sectioning_underscore ("appendixsec");
}
/* The remainder of the text on this line is an appendix subsection heading. */
void
-cm_appendixsubsec ()
+cm_appendixsubsec (void)
{
sectioning_underscore ("appendixsubsec");
}
@@ -678,38 +794,38 @@ cm_appendixsubsec ()
/* The remainder of the text on this line is an appendix
subsubsection heading. */
void
-cm_appendixsubsubsec ()
+cm_appendixsubsubsec (void)
{
sectioning_underscore ("appendixsubsubsec");
}
/* Compatibility functions substitute for chapter, section, etc. */
void
-cm_majorheading ()
+cm_majorheading (void)
{
sectioning_underscore ("majorheading");
}
void
-cm_chapheading ()
+cm_chapheading (void)
{
sectioning_underscore ("chapheading");
}
void
-cm_heading ()
+cm_heading (void)
{
sectioning_underscore ("heading");
}
void
-cm_subheading ()
+cm_subheading (void)
{
sectioning_underscore ("subheading");
}
void
-cm_subsubheading ()
+cm_subsubheading (void)
{
sectioning_underscore ("subsubheading");
}
diff --git a/contrib/texinfo/makeinfo/sectioning.h b/contrib/texinfo/makeinfo/sectioning.h
index 455fc32..8c3f220 100644
--- a/contrib/texinfo/makeinfo/sectioning.h
+++ b/contrib/texinfo/makeinfo/sectioning.h
@@ -1,7 +1,7 @@
/* sectioning.h -- all related stuff @chapter, @section... @contents
- $Id: sectioning.h,v 1.1 2002/08/25 23:38:39 karl Exp $
+ $Id: sectioning.h,v 1.5 2004/04/11 17:56:47 karl Exp $
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,28 +23,51 @@
#define SECTIONING_H
/* Sectioning. */
-extern void
- cm_chapter (), cm_unnumbered (), cm_appendix (), cm_top (),
- cm_section (), cm_unnumberedsec (), cm_appendixsec (),
- cm_subsection (), cm_unnumberedsubsec (), cm_appendixsubsec (),
- cm_subsubsection (), cm_unnumberedsubsubsec (), cm_appendixsubsubsec (),
- cm_heading (), cm_chapheading (), cm_subheading (), cm_subsubheading (),
- cm_majorheading (), cm_raisesections (), cm_lowersections (),
- cm_ideprecated ();
+/* Level 4. */
+extern void cm_chapter (void),
+ cm_unnumbered (void),
+ cm_appendix (void),
+ cm_top (void);
+
+/* Level 3. */
+extern void cm_section (void),
+ cm_unnumberedsec (void),
+ cm_appendixsec (void);
+
+/* Level 2. */
+extern void cm_subsection (void),
+ cm_unnumberedsubsec (void),
+ cm_appendixsubsec (void);
+
+/* Level 1. */
+extern void cm_subsubsection (void),
+ cm_unnumberedsubsubsec (void),
+ cm_appendixsubsubsec (void);
+
+/* Headings. */
+extern void cm_heading (void),
+ cm_chapheading (void),
+ cm_subheading (void),
+ cm_subsubheading (void),
+ cm_majorheading (void);
+
+extern void cm_raisesections (void),
+ cm_lowersections (void),
+ cm_ideprecated (int arg, int start, int end);
extern void
- sectioning_underscore (), insert_and_underscore ();
-
-extern int what_section ();
-
-
+ sectioning_underscore (char *cmd),
+ insert_and_underscore (int level, char *cmd);
-/* is needed in node.c */
-extern int set_top_section_level ();
+/* needed in node.c */
+extern int set_top_section_level (int level);
-extern void sectioning_html ();
-extern int what_section ();
+extern void sectioning_html (int level, char *cmd);
+extern int what_section (char *text, char **secname);
+extern char *current_chapter_number (void),
+ *current_sectioning_number (void),
+ *current_sectioning_name (void);
/* The argument of @settitle, used for HTML. */
extern char *title;
diff --git a/contrib/texinfo/makeinfo/toc.c b/contrib/texinfo/makeinfo/toc.c
index 394a480..fa3d8e0 100644
--- a/contrib/texinfo/makeinfo/toc.c
+++ b/contrib/texinfo/makeinfo/toc.c
@@ -1,7 +1,7 @@
/* toc.c -- table of contents handling.
- $Id: toc.c,v 1.3 2002/11/07 16:13:59 karl Exp $
+ $Id: toc.c,v 1.6 2004/04/11 17:56:47 karl Exp $
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,36 +30,20 @@
#include "makeinfo.h"
#include "sectioning.h"
#include "toc.h"
+#include "xml.h"
-
-
/* array of toc entries */
static TOC_ENTRY_ELT **toc_entry_alist = NULL;
/* toc_counter start from 0 ... n for every @chapter, @section ... */
static int toc_counter = 0;
-
-/* the file where we found the @contents directive */
-char *contents_filename;
-
-/* the file where we found the @shortcontents directive */
-char *shortcontents_filename;
-
-static const char contents_placebo[] = "\n...Table of Contents...\n";
-static const char shortcontents_placebo[] = "\n...Short Contents...\n";
-static const char lots_of_stars[] =
-"***************************************************************************";
-
/* Routine to add an entry to the table of contents */
int
-toc_add_entry (tocname, level, node_name, anchor)
- char *tocname;
- int level;
- char *node_name;
- char *anchor;
+toc_add_entry (char *tocname, int level, char *node_name, char *anchor)
{
- char *tocname_and_node, *expanded_node, *s, *d;
+ char *tocname_and_node, *expanded_node, *d;
+ char *s = NULL;
char *filename = NULL;
if (!node_name)
@@ -107,14 +91,11 @@ toc_add_entry (tocname, level, node_name, anchor)
{
for (; *s; s++)
{
- if (*s == '&')
- {
- strcpy (d, "&");
- d += 5;
- }
+ if (cr_or_whitespace (*s))
+ *d++ = '-';
else if (! URL_SAFE_CHAR (*s))
{
- sprintf (d, "%%%x", (unsigned char) *s);
+ sprintf (d, "_00%x", (unsigned char) *s);
/* do this manually since sprintf returns char * on
SunOS 4 and other old systems. */
while (*d)
@@ -165,8 +146,7 @@ toc_add_entry (tocname, level, node_name, anchor)
more than a single chapter structioning command in a node,
or if they have a node without any structuring commands. */
char *
-toc_find_section_of_node (node)
- char *node;
+toc_find_section_of_node (char *node)
{
int i;
@@ -181,7 +161,7 @@ toc_find_section_of_node (node)
/* free up memory used by toc entries */
void
-toc_free ()
+toc_free (void)
{
int i;
@@ -199,13 +179,11 @@ toc_free ()
toc_counter = 0; /* to be absolutley sure ;-) */
}
}
-
/* Print table of contents in HTML. */
static void
-contents_update_html (fp)
- FILE *fp;
+contents_update_html (void)
{
int i;
int k;
@@ -216,9 +194,7 @@ contents_update_html (fp)
/* no, so return to sender ;-) */
return;
- flush_output (); /* in case we are writing stdout */
-
- fprintf (fp, "\n
\n
%s
\n
\n", _("Table of Contents"));
+ add_html_block_elt_args ("\n
\n
%s
\n
\n", _("Table of Contents"));
last_level = toc_entry_alist[0]->level;
@@ -230,14 +206,14 @@ contents_update_html (fp)
@chapter ...
@subsubsection ... ? */
for (k = 0; k < (toc_entry_alist[i]->level-last_level); k++)
- fputs ("
\n", fp);
+ add_html_block_elt ("
\n");
}
else if (toc_entry_alist[i]->level < last_level)
{
/* @subsubsection ...
@chapter ... this IS usual.*/
for (k = 0; k < (last_level-toc_entry_alist[i]->level); k++)
- fputs ("
\n", fp);
+ add_word ("
\n");
}
/* No double entries in TOC. */
@@ -245,11 +221,11 @@ contents_update_html (fp)
toc_entry_alist[i-1]->name) == 0))
{
/* each toc entry is a list item. */
- fputs ("
\n\n");
}
/* print table of contents in ASCII (--no-headers)
May be we should create a new command line switch --ascii ? */
static void
-contents_update_info (fp)
- FILE *fp;
+contents_update_info (void)
{
int i;
int k;
@@ -293,41 +268,40 @@ contents_update_info (fp)
if (!toc_counter)
return;
- flush_output (); /* in case we are writing stdout */
-
- fprintf (fp, "%s\n%.*s\n\n", _("Table of Contents"),
- (int) strlen (_("Table of Contents")), lots_of_stars);
+ insert_string ((char *) _("Table of Contents"));
+ insert ('\n');
+ for (i = 0; i < strlen (_("Table of Contents")); i++)
+ insert ('*');
+ insert_string ("\n\n");
for (i = 0; i < toc_counter; i++)
{
if (toc_entry_alist[i]->level == 0)
- fputs ("\n", fp);
+ add_char ('\n');
/* indention with two spaces per level, should this
changed? */
for (k = 0; k < toc_entry_alist[i]->level; k++)
- fputs (" ", fp);
+ insert_string (" ");
- fprintf (fp, "%s\n", toc_entry_alist[i]->name);
+ insert_string (toc_entry_alist[i]->name);
+ insert ('\n');
}
- fputs ("\n\n", fp);
+ insert_string ("\n\n");
}
/* shortcontents in HTML; Should this produce a standalone file? */
static void
-shortcontents_update_html (fp)
- FILE *fp;
+shortcontents_update_html (char *contents_filename)
{
int i;
- char *toc_file;
+ char *toc_file = NULL;
/* does exist any toc? */
if (!toc_counter)
return;
- flush_output (); /* in case we are writing stdout */
-
- fprintf (fp, "\n