This commit was generated by cvs2svn to compensate for changes in r146515,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
425ad50cfe
@ -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*.
|
||||
|
File diff suppressed because it is too large
Load Diff
12516
contrib/texinfo/ChangeLog.46
Normal file
12516
contrib/texinfo/ChangeLog.46
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
$Id: INSTALL,v 1.2 2002/09/11 16:32:09 karl Exp $
|
||||
$Id: INSTALL,v 1.5 2004/11/19 13:08:47 karl Exp $
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
@ -9,6 +9,27 @@ Automake-based distribution, please read the file `INSTALL.generic'.
|
||||
|
||||
Installation notes specific to Texinfo:
|
||||
|
||||
* texinfo.tex and the other *.tex files are not installed by `make
|
||||
install'. This is because there is no reliable way to know where to
|
||||
install them. Instead, you have to run an additional make command
|
||||
after the normal make install:
|
||||
make TEXMF=/your/texmf install-tex
|
||||
texinfo.tex is installed in ${TEXMF}/tex/texinfo/texinfo.tex, etc.
|
||||
|
||||
* On the other hand, if you're maintaining a TeX distribution, you don't
|
||||
want your users to see the installation warnings, because you already
|
||||
have the files installed. (And you're keeping them up to date, right?)
|
||||
In this case, run configure --disable-install-warnings, or set
|
||||
enable_install_warnings=no in the environment.
|
||||
|
||||
* On MacOSX, if configure fails with the error:
|
||||
ac_cv_build='config.sub: invalid option -apple-darwin7.2.0
|
||||
this is probably because your uname -p is returning "unknown". Use
|
||||
/usr/bin/uname instead.
|
||||
|
||||
* For instructions on compiling this distribution with DJGPP tools
|
||||
for MS-DOS and MS-Windows, see the file djgpp/README.
|
||||
|
||||
* The Info tree uses a file `dir' as its root node; the `dir-example'
|
||||
file in this distribution is included as a possible starting point.
|
||||
Use it, modify it, or ignore it just as you like.
|
||||
@ -22,6 +43,3 @@ Installation notes specific to Texinfo:
|
||||
* If your info files are not in $prefix/info, you may wish to add a line
|
||||
#define DEFAULT_INFOPATH "/mydir1:/mydir2:..."
|
||||
to config.h after running configure.
|
||||
|
||||
* For instructions on compiling this distribution with DJGPP tools
|
||||
for MS-DOS and MS-Windows, see the file djgpp/README.
|
||||
|
@ -1,4 +1,4 @@
|
||||
$Id: INTRODUCTION,v 1.2 2002/09/11 16:32:09 karl Exp $
|
||||
$Id: INTRODUCTION,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
Getting started with Texinfo.
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
|
@ -1,8 +1,9 @@
|
||||
$Id: NEWS,v 1.57 2003/06/10 20:50:03 karl Exp $
|
||||
This file records noteworthy changes.
|
||||
$Id: NEWS,v 1.103 2004/12/24 16:43:58 karl Exp $
|
||||
This file records noteworthy changes, very tersely.
|
||||
See the manual for detailed information.
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2003,
|
||||
2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
@ -18,10 +19,107 @@ because the historical method of doing copyright permissions using
|
||||
@ifinfo failed to output copyright information in the HTML (or XML)
|
||||
formats. The manual has detailed explanations and examples. For
|
||||
convenience, here's a url to one of the relevant sections:
|
||||
http://texinfo.org/manual/Document-Permissions.html
|
||||
http://www.gnu.org/software/texinfo/manual/texinfo/html_node/Document-Permissions.html
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
4.8 (31 December 2004)
|
||||
* Language:
|
||||
. new command @euro for the Euro currency symbol, and
|
||||
@documentencoding has some support for ISO-8859-15.
|
||||
. new command @abbr for general abbreviations.
|
||||
. new command @slanted to typeset text in a slanted font,
|
||||
and @sansserif to typeset in a sans serif font.
|
||||
* makeinfo:
|
||||
. An empty first argument to cross-reference commands, such as @xref,
|
||||
causes an error. This change was made in 4.1, but not mentioned in NEWS.
|
||||
. HTML output:
|
||||
- <a name="..."> constructs are added for the old-style
|
||||
conversion of node names to HTML names, so that external references
|
||||
to them can continue to work.
|
||||
- "g_t" prefixed to targets for node names beginning with a
|
||||
nonletter, for XHTML compatibility.
|
||||
. Docbook output: recognize more image formats.
|
||||
* texi2dvi:
|
||||
. new option --recode, to call recode for input character translation.
|
||||
* Distribution:
|
||||
. new convenience script texi2pdf, equivalent to texi2dvi --pdf (from tetex).
|
||||
. some cross-compiling support in configure && make.
|
||||
. new configure option --disable-install-warnings, for TeX.
|
||||
distributions which do have the files installed.
|
||||
. automake 1.9.4.
|
||||
|
||||
|
||||
4.7 (9 April 2004)
|
||||
* Language:
|
||||
. new commands @float, @caption, @shortcaption, @listoffloats for
|
||||
initial implementation of floating material (figures, tables, etc).
|
||||
Ironically, they do not yet actually float anywhere.
|
||||
. new commands @docbook, @ifdocbook, @ifnotdocbook for conditional Docbook.
|
||||
. new commands @ordf{} and @ordm{} for Spanish feminine/masculine ordinals.
|
||||
. new commands @deftypecv[x] for class variables in typed OO languages.
|
||||
. new command @registeredsymbol for the r-in-a-circle symbol.
|
||||
. new command @headitem to make a heading row in @multitable.
|
||||
. new command @LaTeX{} for the LaTeX logo.
|
||||
. new command @comma{} to avoid comma-parsing problems.
|
||||
. @url is now a synonym for @uref; new command @indicateurl has the
|
||||
old meaning of just displaying a url as text.
|
||||
. @quotation now accepts an optional argument for labelling the text
|
||||
as a `Note', `Tip', etc.
|
||||
. @defun (et al.) heading lines can now be continued with a lone @.
|
||||
. @acronym accepts an optional argument for the meaning of the acronym.
|
||||
* makeinfo:
|
||||
. New environment variable TEXINFO_OUTPUT_FORMAT determines the output
|
||||
format at runtime, if no options are specified.
|
||||
. New option --plaintext, equivalent to --no-headers with Info output.
|
||||
. All outputs:
|
||||
- sections are numbered by default.
|
||||
. Info output:
|
||||
- punctuation is inserted after @pxref and @ref, if needed to make
|
||||
cross-references valid.
|
||||
- line numbers included in index menus, so Info readers can go to
|
||||
the exact line of an entry, not just a node. Also in plaintext output.
|
||||
- ^@^H[index^@^H] cookie included in index menus, so Info readers
|
||||
can handle the ] etc. commands better.
|
||||
. HTML output:
|
||||
- new algorithm for cross-references to other manuals, for maximum
|
||||
portability and stability.
|
||||
- include node name in <title> with split output.
|
||||
- @multicolumn fractions become percentages.
|
||||
- entities used for bullets, quotes, dashes, and others.
|
||||
- index entries are links to the exact locations.
|
||||
- <h4> and <h5> used for @sub and @subsubsections again.
|
||||
- accented dotless i supported.
|
||||
. XML output: many new tags and structure to preserve more source features.
|
||||
. Docbook output:
|
||||
- upgraded DTD to Docbook XML 4.2, no longer using Docbook SGML.
|
||||
- improved translation in general, for instance:
|
||||
- line annotations and marked quotations.
|
||||
* texi2dvi:
|
||||
. if available, use etex (pdfetex if --pdf) by default.
|
||||
. if the input file includes thumbpdf.sty (for LaTeX), then run thumbpdf.
|
||||
. more output if --debug.
|
||||
* texinfo.tex:
|
||||
. @defun names are now printed in typewriter (instead of bold), and
|
||||
within the arguments, @var text is printed in slanted typewriter.
|
||||
. @tex code is executed inside a TeX group, so that any changes must
|
||||
be prefixed with \global (or the equivalent) to be effective. (This
|
||||
change was actually made years ago, but never made it into the NEWS.)
|
||||
* info:
|
||||
. new option --where (aka --location, -w) to report where an Info file
|
||||
would be found, instead of reading it.
|
||||
. by default, output ANSI terminal escape sequences as-is; new option
|
||||
--no-raw-escapes overrides this.
|
||||
. use the newly-generated index line numbers.
|
||||
* Distribution:
|
||||
. new script gendocs.sh (not installed), for use by GNU maintainers in
|
||||
getting their manuals on the GNU web site. Documented in
|
||||
maintain.texi (http://www.gnu.org/prep/maintain/).
|
||||
. Most code uses ANSI C prototypes, to some extent.
|
||||
. New translation: nb.
|
||||
. automake 1.8.3, autoconf 2.59, gettext 0.14.1.
|
||||
|
||||
|
||||
4.6 (10 June 2003)
|
||||
* Language:
|
||||
. new command @/ specifies an allowable breakpoint within a line.
|
||||
|
@ -1,8 +1,9 @@
|
||||
$Id: README,v 1.14 2003/01/03 20:17:37 karl Exp $
|
||||
This is the README file for the GNU Texinfo distribution.
|
||||
$Id: README,v 1.16 2004/12/13 13:36:32 karl Exp $
|
||||
This is the README file for the GNU Texinfo distribution. Texinfo is
|
||||
the preferred documentation format for GNU software.
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
|
44
contrib/texinfo/README.dev
Normal file
44
contrib/texinfo/README.dev
Normal file
@ -0,0 +1,44 @@
|
||||
$Id: README.dev,v 1.7 2003/11/24 15:11:06 karl Exp $
|
||||
README.dev - Texinfo developer information.
|
||||
|
||||
Copyright (C) 2002, 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.
|
||||
|
||||
The development sources for Texinfo is available through anonymous cvs
|
||||
at Savannah, see
|
||||
http://savannah.gnu.org/cvs/?group=texinfo
|
||||
|
||||
This distribution uses whatever versions of automake, autoconf, and
|
||||
gettext are listed in NEWS; usually the latest ones released. If you
|
||||
are getting the Texinfo sources from cvs, or change the Texinfo
|
||||
configure.ac, you'll need to have these tools installed to (re)build.
|
||||
You'll also need help2man. (All of these are available from
|
||||
ftp://ftp.gnu.org/gnu.)
|
||||
|
||||
Here's the order in which to run the tools for a fresh build:
|
||||
|
||||
autoheader # creates config.in, not necessarily needed every time
|
||||
aclocal -I m4 # for a new version of automake
|
||||
automake
|
||||
autoconf
|
||||
configure CFLAGS=-g --enable-maintainer-mode
|
||||
make
|
||||
|
||||
(with arguments to taste, of course.) Or you can run
|
||||
|
||||
./bootstrap
|
||||
|
||||
instead of the various auto* tools.
|
||||
|
||||
|
||||
One final note: If you would like to contribute to the GNU project by
|
||||
implementing additional documentation output formats for Texinfo, that
|
||||
would be great. But please do not write a separate translator texi2foo
|
||||
for your favorite format foo! That is the hard way to do the job, and
|
||||
makes extra work in subsequent maintenance, since the Texinfo language
|
||||
is continually being enhanced and updated. Instead, the best approach
|
||||
is modify Makeinfo to generate the new format, as it does now for Info,
|
||||
HTML, XML, and DocBook.
|
@ -1,84 +1,119 @@
|
||||
$Id: TODO,v 1.8 2003/04/27 13:12:24 karl Exp $
|
||||
$Id: TODO,v 1.26 2004/11/22 23:57:32 karl Exp $
|
||||
This is the todo list for GNU Texinfo.
|
||||
If you are interested in working on any of these, email bug-texinfo@gnu.org.
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003 Free Software Foundation.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2003,
|
||||
2001, 2002, 2003, 2004 Free Software Foundation.
|
||||
|
||||
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.
|
||||
|
||||
* General:
|
||||
- Test for memory leaks, e.g., with valgrind:
|
||||
http://developer.kde.org/~sewardj/
|
||||
- Rationalize and improve the dir categories in existing manuals.
|
||||
See http://mail.gnu.org/pipermail/emacs-devel/2002-October/013094.html
|
||||
(and the containing thread).
|
||||
- Extend and improve the tests.
|
||||
- @euro{}.
|
||||
- Support installation of manuals in different languages, along these lines:
|
||||
. support a LINGUAS file or variable saying which subdirs LL in the
|
||||
source to descend into (under doc/).
|
||||
. within each subdir LL, install the info files into $infodir/LL,
|
||||
and run install-info on $infodir/LL/dir.
|
||||
. info (both emacs and standalone) should read $infodir/$LANG/dir
|
||||
as the first dir file, and likewise read info files first from
|
||||
$infodir/$LANG, before falling back to $infodir.
|
||||
. consider ways to avoid installing images in both places.
|
||||
In fact, images probably need to be installed in a subdir
|
||||
$infodir/MANUAL/ in the first place, to avoid conflicts of having
|
||||
the same image name in different manuals.
|
||||
For a test case, see texinfo cvs, with its one translated manual
|
||||
(info-fr.texi).
|
||||
From Wojciech Polak.
|
||||
- Monitor and improve the dir categories in existing manuals,
|
||||
following the Free Software Directory categories. Much mail to
|
||||
developers has already been sent, what's needed now is to check new
|
||||
releases and make sure they are using the right categories.
|
||||
See the util/dir-example in the Texinfo distribution for our current
|
||||
recommended categories.
|
||||
For background, see the thread (which discusses a lot of other
|
||||
issues too) at
|
||||
http://mail.gnu.org/pipermail/emacs-devel/2002-10/msg00011.html,
|
||||
especially
|
||||
http://mail.gnu.org/archive/html/emacs-devel/2002-10/msg00090.html
|
||||
http://mail.gnu.org/archive/html/emacs-devel/2002-10/msg00137.html
|
||||
- Get Info declared as a MIME Content-Type.
|
||||
- Likewise the `info:' URI scheme; a library consortium has proposed a
|
||||
completely different purpose for the URI scheme, but I don't know
|
||||
how to send comments, despite it being a "request for comments". Sigh.
|
||||
There is mail about this in the bug-texinfo archives:
|
||||
http://mail.gnu.org/archive/html/bug-texinfo/2003-09/msg00086.html
|
||||
- Support compressed image files.
|
||||
- Handle reference card creation, perhaps by only paying attention to
|
||||
- Support reference card creation, perhaps by only paying attention to
|
||||
sectioning and @def... commands.
|
||||
- Allow @end (and other?) commands to be indented in the source.
|
||||
- Test for memory leaks, e.g., with valgrind:
|
||||
http://developer.kde.org/~sewardj/
|
||||
- Extend and improve the tests.
|
||||
|
||||
* Language:
|
||||
- @figure, something like:
|
||||
@figure [xref-label]
|
||||
@figureinclude <filename>, [<height>], [<width>]
|
||||
@figurehsize <dimen>
|
||||
@figurevsize <dimen>
|
||||
@caption ... @end caption
|
||||
<arbitrary Texinfo commands>
|
||||
@end figure
|
||||
- @else for the @if... conditionals.
|
||||
- @xindexterm [def] primary [,secondary [,tertiary]] or some such?
|
||||
- Allow subitems and `see' and `see also' in indices.
|
||||
- multicolumn * width to take up `the rest'.
|
||||
- another table command to take N succeeding items and split them
|
||||
into M columns (see eplain).
|
||||
- support bibliographies with BibTeX (see web2c/doc for kludge prototype).
|
||||
- @flushboth to combine @flushleft and @flushright, for RFC's.
|
||||
- @part sectioning command.
|
||||
- Allow subitems and `see' and `see also' in indices.
|
||||
- @exercise/@answer command for, e.g., gawk.
|
||||
- Allow @hsep/@vsep at @item, instead of just in template.
|
||||
- Support automatic line numbering of examples.
|
||||
- Better macro syntax.
|
||||
- Better def... command syntax.
|
||||
- Allow : in node names for info files, for names like
|
||||
`class::method'. Likewise index entries. A quoting mechanism such
|
||||
as surrounding node names with SPACE BACKSPACE is probably the best
|
||||
solution, although this is an incompatible change to Info format, sigh.
|
||||
- Change bars. This is difficult or impossible in TeX,
|
||||
unfortunately. To do it right requires device driver support.
|
||||
wdiff or ediff may be all we can do.
|
||||
- @LaTeX{} command to produce the LaTeX logo.
|
||||
- Glossary/general definition support (dumas msg 28 Nov 2003 17:09:57 +0100).
|
||||
- Add support for other Latin 9 (and Latin 2 and Latin 1) characters.
|
||||
|
||||
* Makeinfo:
|
||||
- Translation of "Appendix" etc. should depend on @doclang not $LANG.
|
||||
- Try directory of main source file.
|
||||
- Support @`{@dotless{i}} et al. in HTML.
|
||||
- Make makeinfo -E just do macro expansion, avoiding all error checks.
|
||||
That way, texi2dvi could run makeinfo --iftex -E.
|
||||
- A detexinfo program, like detex or delatex. This command would
|
||||
strip all the texinfo commands out, and would be used as a filter on
|
||||
the way to a speller. An option would be to NOT strip comments out.
|
||||
makeinfo --no-headers comes close.
|
||||
- If node name contains an @ command, complain explicitly.
|
||||
- Call Ghostscript to get ASCII/jpg output for the @image command.
|
||||
- Better HTML output: allow settable background color, table colors
|
||||
and spacing, <head> meta tags, back link from footnote marker, etc.
|
||||
- Use @documentlanguage instead of LANG for many translations.
|
||||
- HTML: split output by chapter to improve context, per Akim.
|
||||
Generate dummy files for all nodes for the sake of cross-references.
|
||||
- HTML: support thumbnails.
|
||||
- HTML: make images of math, maybe.
|
||||
- HTML: allow settable background color, table colors and spacing,
|
||||
<head> meta tags, etc. A la http://texi2html.cvshome.org. In fact:
|
||||
- HTML: have a library of different CSS styles.
|
||||
http://mail.gnu.org/archive/html/bug-texinfo/2004-01/msg00025.html
|
||||
- XML: cannot be loaded directly in a browser; why not?
|
||||
- Docbook: € and other entities do not work; does anything work?
|
||||
- Rewrite completely to simplify generation of different formats.
|
||||
|
||||
* TeX:
|
||||
- Use @ as the escape character, and Texinfo syntax generally, in the
|
||||
table of contents, aux, and index files. Eliminate all the crazy
|
||||
table of contents and index files. Eliminate all the crazy
|
||||
multiple redefinitions of every Texinfo command in different contexts.
|
||||
- Handle @hsep and @vsep in @multitables.
|
||||
- Introduce new command to change \bindingoffset.
|
||||
- Support input in any encoding and language, via ec or Latin Modern fonts.
|
||||
- Reasonable way to change fonts from the default (some work has been
|
||||
done), to allow for PostScript fonts, for example.
|
||||
- @multitable: handle @hsep and @vsep.
|
||||
- @multitable: repeat table headings if multiple pages long.
|
||||
- @multitable: support a heading line concept (<thead> in HTML).
|
||||
- Introduce new command to change \bindingoffset.
|
||||
- How about using latex2html to produce HTML?
|
||||
- Support 8-bit input characters, perhaps via the ec fonts.
|
||||
- Repeat table headings if a @multitable is multiple pages long.
|
||||
- Table of contents gets misaligned if there are 10 or more [sub]sections.
|
||||
- Use url.sty (or something) to allow linebreak of url's.
|
||||
- Include hyperlink \special's in the DVI output for xdvi, etc.
|
||||
- PDF: make each letter of the index (A, B, ...) a section in the TOC.
|
||||
From Carsten Dominik <dominik@astro.uva.nl>.
|
||||
|
||||
* Doc:
|
||||
- Include a complete functional summary, as in a reference card, in
|
||||
@ -96,29 +131,37 @@ If you are interested in working on any of these, email bug-texinfo@gnu.org.
|
||||
- Search all nodes of dir file at startup, then can have
|
||||
INFO-DIR-SEPARATE-GROUPS and other such.
|
||||
- Better dir file merging.
|
||||
- Global dir file (as in /etc/conf/dir) and texinfo config file
|
||||
specifying which info directories to search. From Dale Mellor.
|
||||
http://mail.gnu.org/mailman/private/gnu-prog-discuss/2003q4/000439.html
|
||||
- Steal interface ideas from Lynx: number links, use color, etc.
|
||||
Perhaps code from the pinfo viewer can be reused:
|
||||
http://zeus.polsl.gliwice.pl/~pborys/.
|
||||
- More sample .infokey files, so people can choose without writing their own.
|
||||
- q within help should quit help like C-x 0.
|
||||
- Incorporate an X-based viewer, perhaps tkinfo
|
||||
- Incorporate an X-based viewer, perhaps saxinfo or tkinfo
|
||||
http://www.math.ucsb.edu/~boldt/tkinfo/
|
||||
or saxinfo.
|
||||
- Make "info foo bar" search for bar in foo's index(es) if no menu match.
|
||||
- Handle M-n, C-u m, and C-u g like Emacs Info (opening new windows).
|
||||
- Write technical definition of Info format.
|
||||
|
||||
* PDF:
|
||||
- make each letter of the index (A, B, ...) a section in the TOC.
|
||||
From Carsten Dominik <dominik@astro.uva.nl>.
|
||||
|
||||
* install-info:
|
||||
- be able to copy the info file to compile-time $(infodir), to
|
||||
- be able to copy the info file to compile-time $infodir, to
|
||||
simplify by-hand installation.
|
||||
- also support installing HTML files, etc., along with subsidiary
|
||||
@image (or other) files. In subdirs. Or something.
|
||||
- support info dir entries for other than the current info file name;
|
||||
see comments in menu_item_equal.
|
||||
- merge features with Debian install-info, so we can have one program.
|
||||
|
||||
* texindex:
|
||||
- read source file (specified by new option) for @documentlanguage
|
||||
and/or @documentencoding, and change the sorting appropriately.
|
||||
From: Wojciech Polak <polak@gnu.org>, 26 Apr 2003 11:30:59 +0200.
|
||||
and/or @documentencoding, and change the sorting appropriately.
|
||||
From: Wojciech Polak, 26 Apr 2003 11:30:59 +0200.
|
||||
|
||||
* Distribution:
|
||||
- generate txi-??.tex from .po's to make translators' jobs easier.
|
||||
From Akim and Karl E.
|
||||
|
||||
Ideas that will not be implemented:
|
||||
- Process Texinfo files directly instead of converting to Info:
|
||||
@ -128,5 +171,11 @@ Ideas that will not be implemented:
|
||||
[This has the disadvantage of needing to be updated when the
|
||||
Texinfo language changes, so don't.]
|
||||
|
||||
- Split HTML output by chapter.
|
||||
[Then cross-references in HTML cannot be generated consistently.]
|
||||
- Call Ghostscript to get ASCII/jpg output for the @image command.
|
||||
[makeinfo should not try to be make, or assume it knows how the user
|
||||
wants to generate images. Too many different methods are possible.]
|
||||
|
||||
- Change bars. This is difficult or impossible in TeX,
|
||||
unfortunately. To do it right requires device driver support.
|
||||
wdiff or ediff may be all we can do. Merely specifying what should be
|
||||
changed is not obvious.
|
||||
|
@ -25,6 +25,9 @@
|
||||
/* Define to 1 if you have the <argz.h> header file. */
|
||||
#undef HAVE_ARGZ_H
|
||||
|
||||
/* Define to 1 if you have the `asprintf' function. */
|
||||
#undef HAVE_ASPRINTF
|
||||
|
||||
/* Define to 1 if you have the `bzero' function. */
|
||||
#undef HAVE_BZERO
|
||||
|
||||
@ -32,21 +35,41 @@
|
||||
*/
|
||||
#undef HAVE_DCGETTEXT
|
||||
|
||||
/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_FEOF_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_FGETS_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_GETC_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_GETENV
|
||||
|
||||
/* Define if this function is declared. */
|
||||
#undef HAVE_DECL_STRCASECMP
|
||||
/* Define to 1 if you have the declaration of `memchr', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_MEMCHR
|
||||
|
||||
/* Define if this function is declared. */
|
||||
/* Define to 1 if you have the declaration of `strcoll', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRCOLL
|
||||
|
||||
/* Define if this function is declared. */
|
||||
/* Define to 1 if you have the declaration of `strerror', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRERROR
|
||||
|
||||
/* Define if this function is declared. */
|
||||
#undef HAVE_DECL_STRNCASECMP
|
||||
/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL__SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL__SNWPRINTF
|
||||
|
||||
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
|
||||
#undef HAVE_DOPRNT
|
||||
@ -54,18 +77,12 @@
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `feof_unlocked' function. */
|
||||
#undef HAVE_FEOF_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the `fgets_unlocked' function. */
|
||||
#undef HAVE_FGETS_UNLOCKED
|
||||
/* Define to 1 if you have the `fwprintf' function. */
|
||||
#undef HAVE_FWPRINTF
|
||||
|
||||
/* Define to 1 if you have the `getcwd' function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* Define to 1 if you have the `getc_unlocked' function. */
|
||||
#undef HAVE_GETC_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the `getegid' function. */
|
||||
#undef HAVE_GETEGID
|
||||
|
||||
@ -90,6 +107,9 @@
|
||||
/* Define if you have the iconv() function. */
|
||||
#undef HAVE_ICONV
|
||||
|
||||
/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */
|
||||
#undef HAVE_INTMAX_T
|
||||
|
||||
/* Define if <inttypes.h> exists and doesn't clash with <sys/types.h>. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
@ -115,6 +135,12 @@
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define if you have the 'long double' type. */
|
||||
#undef HAVE_LONG_DOUBLE
|
||||
|
||||
/* Define if you have the 'long long' type. */
|
||||
#undef HAVE_LONG_LONG
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
@ -148,6 +174,9 @@
|
||||
/* Define to 1 if you have the <nl_types.h> header file. */
|
||||
#undef HAVE_NL_TYPES_H
|
||||
|
||||
/* Define if your printf() function supports format strings with positions. */
|
||||
#undef HAVE_POSIX_PRINTF
|
||||
|
||||
/* Define to 1 if you have the `putenv' function. */
|
||||
#undef HAVE_PUTENV
|
||||
|
||||
@ -172,6 +201,9 @@
|
||||
/* Define to 1 if you have the `sigsetmask' function. */
|
||||
#undef HAVE_SIGSETMASK
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#undef HAVE_STDDEF_H
|
||||
|
||||
@ -270,6 +302,15 @@
|
||||
/* Define to 1 if you have the `vprintf' function. */
|
||||
#undef HAVE_VPRINTF
|
||||
|
||||
/* Define if you have the 'wchar_t' type. */
|
||||
#undef HAVE_WCHAR_T
|
||||
|
||||
/* Define to 1 if you have the `wcslen' function. */
|
||||
#undef HAVE_WCSLEN
|
||||
|
||||
/* Define if you have the 'wint_t' type. */
|
||||
#undef HAVE_WINT_T
|
||||
|
||||
/* Define to 1 if you have the `__argz_count' function. */
|
||||
#undef HAVE___ARGZ_COUNT
|
||||
|
||||
@ -315,12 +356,16 @@
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define as the maximum value of type 'size_t', if the system doesn't define
|
||||
it. */
|
||||
#undef SIZE_MAX
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||
@ -348,9 +393,11 @@
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
|
||||
if it is not supported. */
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to rpl_mkstemp if the replacement function should be used. */
|
||||
#undef mkstemp
|
||||
@ -358,6 +405,13 @@
|
||||
/* Define to `long' if <sys/types.h> does not define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define as the type of the result of subtracting two pointers, if the system
|
||||
doesn't define it. */
|
||||
#undef ptrdiff_t
|
||||
|
||||
/* Define to empty if the C compiler doesn't support this keyword. */
|
||||
#undef signed
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$Id: README,v 1.3 2002/12/05 21:42:23 karl Exp $
|
||||
$Id: README,v 1.4 2004/04/11 17:56:45 karl Exp $
|
||||
texinfo/doc/README
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
@ -1,5 +1,8 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@comment $Id: info-stnd.texi,v 1.5 2003/02/19 13:32:54 karl Exp $
|
||||
\input texinfo.tex @c -*-texinfo-*-
|
||||
@comment $Id: info-stnd.texi,v 1.9 2004/12/14 16:58:15 karl Exp $
|
||||
@c We must \input texinfo.tex instead of texinfo, otherwise make
|
||||
@c distcheck in the Texinfo distribution fails, because the texinfo Info
|
||||
@c file is made first, and texi2dvi must include . first in the path.
|
||||
@comment %**start of header
|
||||
@setfilename info-stnd.info
|
||||
@include version-stnd.texi
|
||||
@ -14,8 +17,8 @@ This manual is for GNU Info (version @value{VERSION}, @value{UPDATED}),
|
||||
a program for viewing documents in Info format (usually created from
|
||||
Texinfo source files).
|
||||
|
||||
Copyright @copyright{} 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003
|
||||
Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002,
|
||||
2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
@ -201,7 +204,7 @@ Produces a relatively brief description of the available Info options.
|
||||
@cindex index search, selecting from the command line
|
||||
@cindex online help, using Info as
|
||||
After processing all command-line arguments, go to the index in the Info
|
||||
file and search for index entries which matche @var{string}. If such an
|
||||
file and search for index entries which match @var{string}. If such an
|
||||
entry is found, the Info session begins with displaying the node pointed
|
||||
to by the first matching index entry; press @kbd{,} to step through the
|
||||
rest of the matching entries. If no such entry exists, print @samp{no
|
||||
@ -235,17 +238,17 @@ Each node that Info visits will be output to @var{filename} instead of
|
||||
interactively viewed. A value of @code{-} for @var{filename} specifies
|
||||
the standard output.
|
||||
|
||||
@cindex colors in man pages
|
||||
@cindex ANSI escape sequences in man pages
|
||||
@cindex colors in documents
|
||||
@cindex ANSI escape sequences in documents
|
||||
@item --raw-escapes
|
||||
@itemx --no-raw-escapes
|
||||
@itemx -R
|
||||
Do not remove ANSI escape sequences from man pages. Some versions of
|
||||
Do not remove ANSI escape sequences from documents. Some versions of
|
||||
Groff, the GNU document formatter, produce man pages with ANSI escape
|
||||
sequences for bold, italics, and underlined characters, and for
|
||||
colorized text. By default, Info removes those escape sequences
|
||||
before it displays the man page. If your terminal supports these
|
||||
escapes, use @code{--raw-escapes} to let the terminal handle them and
|
||||
display the man pages with those attributes.
|
||||
colorized text. By default, Info lets those escape sequences pass
|
||||
through directly to the terminal. If your terminal does not support
|
||||
these escapes, use @code{--no-raw-escapes} to make Info remove them.
|
||||
|
||||
@cindex replaying recorded keystrokes
|
||||
@item --restore=@var{dribble-file}
|
||||
@ -299,6 +302,14 @@ modeled after Emacs.
|
||||
(@xref{Custom Key Bindings},
|
||||
for a more general way of altering GNU Info's key bindings.)
|
||||
|
||||
@cindex Info manual location
|
||||
@cindex Where is an Info manual?
|
||||
@item --where
|
||||
@itemx --location
|
||||
@itemx -w
|
||||
Show the filename that would be read and exit, instead of actually
|
||||
reading it and starting Info.
|
||||
|
||||
@item @var{menu-item}
|
||||
@cindex menu, following
|
||||
@anchor{command-line menu items}
|
||||
@ -337,19 +348,19 @@ following all the menu items given on the command line. This is so
|
||||
@cindex moving the cursor
|
||||
|
||||
Many people find that reading screens of text page by page is made
|
||||
easier when one is able to indicate particular pieces of text with some
|
||||
kind of pointing device. Since this is the case, GNU Info (both the
|
||||
Emacs and standalone versions) have several commands which allow you to
|
||||
move the cursor about the screen. The notation used in this manual to
|
||||
describe keystrokes is identical to the notation used within the Emacs
|
||||
manual, and the GNU Readline manual. @xref{Characters, , Character
|
||||
Conventions, emacs, the GNU Emacs Manual}, if you are unfamiliar with the
|
||||
notation@footnote{
|
||||
Here's a short summary. @kbd{C-@var{x}} means press the @kbd{CTRL} key
|
||||
and the key @var{x}. @kbd{M-@var{x}} means press the @kbd{META} key and
|
||||
the key @var{x}. On many terminals th @kbd{META} key is known as the
|
||||
@kbd{ALT} key. @kbd{SPC} is the space bar. The other keys are usually
|
||||
called by the names imprinted on them.}.
|
||||
easier when one is able to indicate particular pieces of text with
|
||||
some kind of pointing device. Since this is the case, GNU Info (both
|
||||
the Emacs and standalone versions) have several commands which allow
|
||||
you to move the cursor about the screen. The notation used in this
|
||||
manual to describe keystrokes is identical to the notation used within
|
||||
the Emacs manual, and the GNU Readline manual. @xref{User Input,,,
|
||||
emacs, the GNU Emacs Manual}, if you are unfamiliar with the
|
||||
notation.@footnote{Here's a short summary. @kbd{C-@var{x}} means
|
||||
press the @kbd{CTRL} key and the key @var{x}. @kbd{M-@var{x}} means
|
||||
press the @kbd{META} key and the key @var{x}. On many terminals th
|
||||
@kbd{META} key is known as the @kbd{ALT} key. @kbd{SPC} is the space
|
||||
bar. The other keys are usually called by the names imprinted on
|
||||
them.}
|
||||
|
||||
The following table lists the basic cursor movement commands in Info.
|
||||
Each entry consists of the key sequence you should type to execute the
|
||||
@ -699,7 +710,7 @@ Select the `Up' node.
|
||||
@end table
|
||||
|
||||
You can easily select a node that you have already viewed in this window
|
||||
by using the @samp{l} command -- this name stands for "last", and
|
||||
by using the @samp{l} command---this name stands for ``last'', and
|
||||
actually moves backwards through the history of visited nodes for this
|
||||
window. This is handy when you followed a reference to another node,
|
||||
possibly to read about a related issue, and would like then to resume
|
||||
@ -977,7 +988,7 @@ is case-sensitive; otherwise Info ignores the letter case.
|
||||
@cindex index, searching
|
||||
@cindex searching, in the indices
|
||||
Look up a string in the indices for this Info file, and select a node
|
||||
where the found index entry points to.
|
||||
to which the found index entry points.
|
||||
|
||||
@item @key{,} (@code{next-index-match})
|
||||
@kindex ,
|
||||
@ -1028,9 +1039,10 @@ has all of its important concepts indexed, so the @samp{i} command
|
||||
lets you use a manual as a reference.
|
||||
|
||||
If you don't know what manual documents something, try the @kbd{M-x
|
||||
index-apropos}. It prompts for a string and then looks up that string
|
||||
in all the indices of all the Info documents installed on your system.
|
||||
It can also be invoked from the command line; see @ref{--apropos}.
|
||||
index-apropos} command. It prompts for a string and then looks up
|
||||
that string in all the indices of all the Info documents installed on
|
||||
your system. It can also be invoked from the command line; see
|
||||
@ref{--apropos}.
|
||||
|
||||
|
||||
@node Xref Commands
|
||||
@ -1290,8 +1302,7 @@ Split the current window into two windows, both showing the same node.
|
||||
Each window is one half the size of the original window, and the cursor
|
||||
remains in the original window. The variable @code{automatic-tiling}
|
||||
can cause all of the windows on the screen to be resized for you
|
||||
automatically, please @pxref{Variables, , automatic-tiling} for more
|
||||
information.
|
||||
automatically (@pxref{Variables, , automatic-tiling}).
|
||||
|
||||
@item @kbd{C-x @key{0}} (@code{delete-window})
|
||||
@cindex windows, deleting
|
||||
@ -1311,7 +1322,7 @@ Delete all of the windows excepting the current one.
|
||||
@findex scroll-other-window
|
||||
Scroll the other window, in the same fashion that @samp{C-v} might
|
||||
scroll the current window. Given a negative argument, scroll the
|
||||
"other" window backward.
|
||||
``other'' window backward.
|
||||
|
||||
@item @kbd{C-x @key{^}} (@code{grow-window})
|
||||
@kindex C-x ^
|
||||
@ -1567,7 +1578,7 @@ with @samp{fol}.
|
||||
@item @key{ESC C-v} (@code{echo-area-scroll-completions-window})
|
||||
@kindex ESC C-v, in the echo area
|
||||
@findex echo-area-scroll-completions-window
|
||||
Scroll the completions window, if that is visible, or the "other"
|
||||
Scroll the completions window, if that is visible, or the ``other''
|
||||
window if not.
|
||||
@end table
|
||||
|
||||
@ -1894,7 +1905,7 @@ nonzero value, Info attempts to scroll the node text by that many lines;
|
||||
if that is enough to bring the cursor back into the window, that is what
|
||||
is done. The default value of this variable is 0, thus placing the
|
||||
cursor (and the text it is attached to) in the center of the window.
|
||||
Setting this variable to 1 causes a kind of "smooth scrolling" which
|
||||
Setting this variable to 1 causes a kind of ``smooth scrolling'' which
|
||||
some people prefer.
|
||||
|
||||
@item show-index-match
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.29.
|
||||
.TH INFO "1" "June 2003" "info 4.6" "User Commands"
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.34.
|
||||
.TH INFO "1" "December 2004" "info 4.8" "User Commands"
|
||||
.SH NAME
|
||||
info \- read Info documents
|
||||
.SH SYNOPSIS
|
||||
@ -34,24 +34,30 @@ specify nodes in first visited Info file.
|
||||
output selected nodes to FILENAME.
|
||||
.TP
|
||||
\fB\-R\fR, \fB\-\-raw\-escapes\fR
|
||||
don't remove ANSI escapes from man pages.
|
||||
output "raw" ANSI escapes (default).
|
||||
.TP
|
||||
\fB\-\-no\-raw\-escapes\fR
|
||||
output escapes as literal text.
|
||||
.TP
|
||||
\fB\-\-restore\fR=\fIFILENAME\fR
|
||||
read initial keystrokes from FILENAME.
|
||||
.TP
|
||||
\fB\-O\fR, \fB\-\-show\-options\fR, \fB\-\-usage\fR
|
||||
go to command-line options node.
|
||||
go to command\-line options node.
|
||||
.TP
|
||||
\fB\-\-subnodes\fR
|
||||
recursively output menu items.
|
||||
.TP
|
||||
\fB\-w\fR, \fB\-\-where\fR, \fB\-\-location\fR
|
||||
print physical location of Info file.
|
||||
.TP
|
||||
\fB\-\-vi\-keys\fR
|
||||
use vi-like and less-like key bindings.
|
||||
use vi\-like and less\-like key bindings.
|
||||
.TP
|
||||
\fB\-\-version\fR
|
||||
display version information and exit.
|
||||
.PP
|
||||
The first non-option argument, if present, is the menu entry to start from;
|
||||
The first non\-option argument, if present, is the menu entry to start from;
|
||||
it is searched for in all `dir' files along INFOPATH.
|
||||
If it is not present, info merges all `dir' files and shows the result.
|
||||
Any remaining arguments are treated as the names of menu
|
||||
@ -59,10 +65,10 @@ items relative to the initial node visited.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
info
|
||||
show top-level dir menu
|
||||
show top\-level dir menu
|
||||
.TP
|
||||
info emacs
|
||||
start at emacs node from top-level dir
|
||||
start at emacs node from top\-level dir
|
||||
.TP
|
||||
info emacs buffers
|
||||
start at buffers node within emacs manual
|
||||
@ -73,11 +79,11 @@ start at node with emacs' command line options
|
||||
info \fB\-f\fR ./foo.info
|
||||
show file ./foo.info, not searching dir
|
||||
.SH "REPORTING BUGS"
|
||||
Email bug reports to bug-texinfo@gnu.org,
|
||||
general questions and discussion to help-texinfo@gnu.org.
|
||||
Email bug reports to bug\-texinfo@gnu.org,
|
||||
general questions and discussion to help\-texinfo@gnu.org.
|
||||
Texinfo home page: http://www.gnu.org/software/texinfo/
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2003 Free Software Foundation, Inc.
|
||||
Copyright \(co 2004 Free Software Foundation, Inc.
|
||||
There is NO warranty. You may redistribute this software
|
||||
under the terms of the GNU General Public License.
|
||||
For more information about these matters, see the files named COPYING.
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" info(5)
|
||||
.\" $Id: info.5,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
.\" $Id: info.5,v 1.2 2004/04/11 17:56:45 karl Exp $
|
||||
.\"
|
||||
.\" Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
.\"
|
||||
|
@ -1,4 +1,7 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
\input texinfo.tex @c -*-texinfo-*-
|
||||
@c We must \input texinfo.tex instead of texinfo, otherwise make
|
||||
@c distcheck in the Texinfo distribution fails, because the texinfo Info
|
||||
@c file is made first, and texi2dvi must include . first in the path.
|
||||
@comment %**start of header
|
||||
@setfilename info.info
|
||||
@settitle Info
|
||||
@ -6,13 +9,12 @@
|
||||
@syncodeindex vr cp
|
||||
@syncodeindex ky cp
|
||||
@comment %**end of header
|
||||
@comment $Id: info.texi,v 1.3 2002/11/06 00:45:36 karl Exp $
|
||||
|
||||
@copying
|
||||
This file describes how to use Info, the on-line, menu-driven GNU
|
||||
documentation system.
|
||||
|
||||
Copyright (C) 1989, 1992, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
Copyright (C) 1989, 1992, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
@ -50,6 +52,8 @@ license to the document, as described in section 6 of the license.
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
@contents
|
||||
|
||||
@ifnottex
|
||||
@node Top
|
||||
@top Info: An Introduction
|
||||
@ -58,6 +62,11 @@ The GNU Project distributes most of its on-line manuals in the
|
||||
@dfn{Info format}, which you read using an @dfn{Info reader}. You are
|
||||
probably using an Info reader to read this now.
|
||||
|
||||
There are two primary Info readers: @code{info}, a stand-alone program
|
||||
designed just to read Info files, and the @code{info} package in GNU
|
||||
Emacs, a general-purpose editor. At present, only the Emacs reader
|
||||
supports using a mouse.
|
||||
|
||||
@ifinfo
|
||||
If you are new to the Info reader and want to learn how to use it,
|
||||
type the command @kbd{h} now. It brings you to a programmed
|
||||
@ -80,7 +89,7 @@ Started' chapter.
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Getting Started
|
||||
|
||||
This first part of the Info manual describes how to get around inside
|
||||
This first part of this Info manual describes how to get around inside
|
||||
of Info. The second part of the manual describes various advanced
|
||||
Info commands, and how to write an Info as distinct from a Texinfo
|
||||
file. The third part briefly explains how to generate Info files from
|
||||
@ -107,7 +116,7 @@ stand-alone program designed just to read Info files.
|
||||
@item
|
||||
Type @code{emacs} at the command line; then type @kbd{C-h i}
|
||||
(@kbd{Control-h}, followed by @kbd{i}). This approach uses the Info
|
||||
mode of the Emacs program, an editor with many other capabilities.
|
||||
mode of the Emacs editor.
|
||||
@end enumerate
|
||||
|
||||
In either case, then type @kbd{mInfo} (just the letters), followed by
|
||||
@ -121,14 +130,15 @@ the screen.
|
||||
@end ifnotinfo
|
||||
|
||||
@menu
|
||||
* Help-Small-Screen:: Starting Info on a Small Screen
|
||||
* Help:: How to use Info
|
||||
* Help-P:: Returning to the Previous node
|
||||
* Help-Small-Screen:: Starting Info on a Small Screen.
|
||||
* Help:: How to use Info.
|
||||
* Help-P:: Returning to the Previous node.
|
||||
* Help-^L:: The Space, DEL, B and ^L commands.
|
||||
* Help-M:: Menus
|
||||
* Help-Xref:: Following cross-references
|
||||
* Help-Int:: Some intermediate Info commands
|
||||
* Help-Q:: Quitting Info
|
||||
* Help-Inv:: Invisible text in Emacs Info.
|
||||
* Help-M:: Menus.
|
||||
* Help-Xref:: Following cross-references.
|
||||
* Help-Int:: Some intermediate Info commands.
|
||||
* Help-Q:: Quitting Info.
|
||||
@end menu
|
||||
|
||||
@node Help-Small-Screen
|
||||
@ -202,8 +212,8 @@ This is line 59
|
||||
If you have managed to get here, go back to the beginning with
|
||||
@kbd{DEL} (or @key{BACKSPACE}), and come back here again, then you
|
||||
understand the about the @samp{Space} and @samp{Backspace} keys. So
|
||||
now type an @kbd{n} ---just one character; don't type the quotes and
|
||||
don't type the Return key afterward--- to get to the normal start of
|
||||
now type an @kbd{n}---just one character; don't type the quotes and
|
||||
don't type the Return key afterward---to get to the normal start of
|
||||
the course.
|
||||
@end ifinfo
|
||||
|
||||
@ -213,6 +223,10 @@ the course.
|
||||
|
||||
You are talking to the program Info, for reading documentation.
|
||||
|
||||
There are two ways to use Info: from within Emacs or as a
|
||||
stand-alone reader that you can invoke from a shell using the command
|
||||
@command{info}.
|
||||
|
||||
@cindex node, in Info documents
|
||||
Right now you are looking at one @dfn{Node} of Information.
|
||||
A node contains text describing a specific topic at a specific
|
||||
@ -229,8 +243,8 @@ well. In Emacs, the header line is duplicated in a special typeface,
|
||||
and the duplicate remains at the top of the window all the time even
|
||||
if you scroll through the node.
|
||||
|
||||
Besides a @samp{Next}, a node can have a @samp{Previous} or an
|
||||
@samp{Up} links, or both. As you can see, this node has all of these
|
||||
Besides a @samp{Next}, a node can have a @samp{Previous} link, or an
|
||||
@samp{Up} link, or both. As you can see, this node has all of these
|
||||
links.
|
||||
|
||||
@kindex n @r{(Info mode)}
|
||||
@ -261,9 +275,10 @@ command. Another @kbd{n} command now would take you to the next
|
||||
node, @samp{Help-^L}.
|
||||
|
||||
@format
|
||||
>> But do not type @kbd{n} yet. First, try the @kbd{p} command,
|
||||
or click the middle mouse button on the @samp{Prev} link. That
|
||||
takes you to the @samp{Previous} node. Then use @kbd{n} to return here.
|
||||
>> But do not type @kbd{n} yet. First, try the @kbd{p} command, or
|
||||
(in Emacs) click the middle mouse button on the @samp{Prev} link.
|
||||
That takes you to the @samp{Previous} node. Then use @kbd{n} to
|
||||
return here.
|
||||
@end format
|
||||
|
||||
If you read this in Emacs, you will see an @samp{Info} item in the
|
||||
@ -279,13 +294,13 @@ to. You could make Info skip past an important warning that was
|
||||
coming up.
|
||||
|
||||
@format
|
||||
>> Now do an @kbd{n}, or click the middle mouse button on the @samp{Next}
|
||||
link, to get to the node @samp{Help-^L} and learn more.
|
||||
>> Now do an @kbd{n}, or (in Emacs) click the middle mouse button on
|
||||
the @samp{Next} link, to get to the node @samp{Help-^L} and learn more.
|
||||
@end format
|
||||
|
||||
@node Help-^L, Help-M, Help-P, Getting Started
|
||||
@node Help-^L, Help-Inv, Help-P, Getting Started
|
||||
@comment node-name, next, previous, up
|
||||
@section The Space, DEL, B and ^L commands.
|
||||
@section The Space, DEL, B and ^L commands
|
||||
|
||||
This node's mode line tells you that you are now at node
|
||||
@samp{Help-^L}, and the header line tells you that @kbd{p} would get
|
||||
@ -360,7 +375,7 @@ scroll beyond the beginning or the end of the current node.
|
||||
|
||||
@kindex C-l @r{(Info mode)}
|
||||
If your screen is ever garbaged, you can tell Info to display it
|
||||
again by typing @kbd{C-l} (@kbd{Control-L}, that is---hold down
|
||||
again by typing @kbd{C-l} (@kbd{Control-L}---that is, hold down
|
||||
@key{CTRL} and type @kbd{L} or @kbd{l}).
|
||||
|
||||
@format
|
||||
@ -399,8 +414,8 @@ the list, make it go away by typing a @key{SPC} repeatedly.
|
||||
|
||||
(If you are using the stand-alone Info reader, type @kbd{C-x 0} to
|
||||
return here, that is---press and hold @key{CTRL}, type an @kbd{x},
|
||||
then release @key{CTRL} and @kbd{x}, and press @kbd{0}---a zero, not
|
||||
the letter ``o''.)
|
||||
then release @key{CTRL} and @kbd{x}, and press @kbd{0}; that's a zero,
|
||||
not the letter ``o''.)
|
||||
|
||||
From now on, you will encounter large nodes without warning, and
|
||||
will be expected to know how to use @key{SPC} and @key{BACKSPACE} to
|
||||
@ -409,30 +424,103 @@ the same size screen, it would be impossible to warn you anyway.
|
||||
|
||||
@format
|
||||
>> Now type @kbd{n}, or click the middle mouse button on the @samp{Next} link,
|
||||
to see the description of the @kbd{m} command.
|
||||
to visit the next node.
|
||||
@end format
|
||||
|
||||
@node Help-M, Help-Xref, Help-^L, Getting Started
|
||||
@node Help-Inv, Help-M, Help-^L, Getting Started
|
||||
@comment node-name, next, previous, up
|
||||
@section Invisible text in Emacs Info
|
||||
|
||||
Before discussing menus, we need to make some remarks that are only
|
||||
relevant to users reading Info using Emacs. Users of the stand-alone
|
||||
version can skip this node by typing @kbd{]} now.
|
||||
|
||||
@cindex invisible text in Emacs
|
||||
In Emacs, certain text that appears in the stand-alone version is
|
||||
normally hidden, technically because it has the @samp{invisibility}
|
||||
property. Invisible text is really a part of the text. It becomes
|
||||
visible (by default) after killing and yanking, it appears in printed
|
||||
output, it gets saved to file just like any other text, and so on.
|
||||
Thus it is useful to know it is there.
|
||||
|
||||
@findex visible-mode
|
||||
You can make invisible text visible by using the command @kbd{M-x
|
||||
visible-mode}. Visible mode is a minor mode, so using the command a
|
||||
second time will make the text invisible again. Watch the effects of
|
||||
the command on the ``menu'' below and the top line of this node.
|
||||
|
||||
If you prefer to @emph{always} see the invisible text, you can set
|
||||
@code{Info-hide-note-references} to @code{nil}. Enabling Visible mode
|
||||
permanently is not a real alternative, because Emacs Info also uses
|
||||
(although less extensively) another text property that can change the
|
||||
text being displayed, the @samp{display} property. Only the
|
||||
invisibility property is affected by Visible mode. When, in this
|
||||
tutorial, we refer to the @samp{Emacs} behavior, we mean the
|
||||
@emph{default} Emacs behavior.
|
||||
|
||||
Now type @kbd{]}, to learn about the @kbd{]} and @kbd{[} commands.
|
||||
|
||||
@menu
|
||||
* ]: Help-]. Node telling about ].
|
||||
* stuff: Help-]. Same node.
|
||||
* Help-]:: Yet again, same node.
|
||||
@end menu
|
||||
|
||||
@node Help-], , , Help-Inv
|
||||
@subsection The @kbd{]} and @kbd{[} commands
|
||||
|
||||
If you type @kbd{n} now, you get an error message saying that this
|
||||
node has no next node. Similarly, if you type @kbd{p}, the error
|
||||
message tells you that there is no previous node. (The exact message
|
||||
depends on the Info reader you use.) This is because @kbd{n} and
|
||||
@kbd{p} carry you to the next and previous node @emph{at the same
|
||||
level}. The present node is contained in a menu (see next) of the
|
||||
node you came from, and hence is considered to be at a lower level.
|
||||
It is the only node in the previous node's menu (even though it was
|
||||
listed three times). Hence it has no next or previous node that
|
||||
@kbd{n} or @kbd{p} could move to.
|
||||
|
||||
If you systematically move through a manual by typing @kbd{n}, you run
|
||||
the risk of skipping many nodes. You do not run this risk if you
|
||||
systematically use @kbd{@key{SPC}}, because, when you scroll to the
|
||||
bottom of a node and type another @kbd{@key{SPC}}, then this carries
|
||||
you to the following node in the manual @emph{regardless of level}.
|
||||
If you immediately want to go to that node, without having to scroll
|
||||
to the bottom of the screen first, you can type @kbd{]}.
|
||||
|
||||
Similarly, @kbd{@key{BACKSPACE}} carries you to the preceding node
|
||||
regardless of level, after you scrolled to the beginning of the
|
||||
present node. If you want to go to the preceding node immediately,
|
||||
you can type @kbd{[}.
|
||||
|
||||
For instance, typing this sequence will come back here in three steps:
|
||||
@kbd{[ n [}. To do the same backward, type @kbd{] p ]}.
|
||||
|
||||
Now type @kbd{]} to go to the next node and learn about menus.
|
||||
|
||||
@node Help-M, Help-Xref, Help-Inv, Getting Started
|
||||
@comment node-name, next, previous, up
|
||||
@section Menus and the @kbd{m} command
|
||||
|
||||
@cindex menus in an Info document
|
||||
@cindex Info menus
|
||||
With only the @kbd{n} (next) and @kbd{p} (previous) commands for
|
||||
moving between nodes, nodes are restricted to a linear sequence.
|
||||
Menus allow a branching structure. A menu is a list of other nodes
|
||||
you can move to. It is actually just part of the text of the node
|
||||
formatted specially so that Info can interpret it. The beginning of a
|
||||
menu is always identified by a line which starts with @samp{* Menu:}.
|
||||
A node contains a menu if and only if it has a line in it which starts
|
||||
that way. The only menu you can use at any moment is the one in the
|
||||
node you are in. To use a menu in any other node, you must move to
|
||||
that node first.
|
||||
With only the @kbd{n} (next), @kbd{p} (previous), @kbd{@key{SPC}},
|
||||
@kbd{@key{BACKSPACE}}, @kbd{]} and @kbd{[} commands for moving between
|
||||
nodes, nodes are restricted to a linear sequence. Menus allow a
|
||||
branching structure. A menu is a list of other nodes you can move to.
|
||||
It is actually just part of the text of the node formatted specially
|
||||
so that Info can interpret it. The beginning of a menu is always
|
||||
identified by a line which starts with @w{@samp{* Menu:}}. A node
|
||||
contains a menu if and only if it has a line in it which starts that
|
||||
way. The only menu you can use at any moment is the one in the node
|
||||
you are in. To use a menu in any other node, you must move to that
|
||||
node first.
|
||||
|
||||
After the start of the menu, each line that starts with a @samp{*}
|
||||
identifies one subtopic. The line usually contains a brief name
|
||||
for the subtopic (followed by a @samp{:}), the name of the node that talks
|
||||
about that subtopic, and optionally some further description of the
|
||||
identifies one subtopic. The line usually contains a brief name for
|
||||
the subtopic (followed by a @samp{:}, normally hidden in Emacs), the
|
||||
name of the node that talks about that subtopic (again, normally
|
||||
hidden in Emacs), and optionally some further description of the
|
||||
subtopic. Lines in the menu that do not start with a @samp{*} have no
|
||||
special meaning---they are only for the human reader's benefit and do
|
||||
not define additional subtopics. Here is an example:
|
||||
@ -444,7 +532,11 @@ not define additional subtopics. Here is an example:
|
||||
The subtopic name is Foo, and the node describing it is @samp{Node
|
||||
about FOO}. The rest of the line is just for the reader's
|
||||
Information. [[ But this line is not a real menu item, simply because
|
||||
there is no line above it which starts with @samp{* Menu:}.]]
|
||||
there is no line above it which starts with @w{@samp{* Menu:}}. Also,
|
||||
in a real menu item, the @samp{*} would appear at the very start of
|
||||
the line. This is why the ``normally hidden'' text in Emacs, namely
|
||||
@samp{: Node about FOO.}, is actually visible in this example, even
|
||||
when Visible mode is off.]]
|
||||
|
||||
When you use a menu to go to another node (in a way that will be
|
||||
described soon), what you specify is the subtopic name, the first
|
||||
@ -463,7 +555,7 @@ abbreviation for this:
|
||||
|
||||
@noindent
|
||||
This means that the subtopic name and node name are the same; they are
|
||||
both @samp{Foo}.
|
||||
both @samp{Foo}. (The @samp{::} is normally hidden in Emacs.)
|
||||
|
||||
@format
|
||||
>> Now use @key{SPC} to find the menu in this node, then come back to
|
||||
@ -488,16 +580,18 @@ another command. The @kbd{m} command is different: it needs to know
|
||||
the @dfn{name of the subtopic}. Once you have typed @kbd{m}, Info
|
||||
tries to read the subtopic name.
|
||||
|
||||
Now look for the line containing many dashes near the bottom of the
|
||||
screen. There is one more line beneath that one, but usually it is
|
||||
blank. When it is blank, Info is ready for a command, such as @kbd{n}
|
||||
or @kbd{b} or @key{SPC} or @kbd{m}. If that line contains text ending
|
||||
in a colon, it means Info is reading more input for the last command.
|
||||
You can't type an Info command then, because Info is trying to read
|
||||
input, not commands. You must either give the input and finish the
|
||||
command you started, or type @kbd{Control-g} to cancel the command.
|
||||
When you have done one of those things, the input entry line becomes
|
||||
blank again. Then you can type Info commands again.
|
||||
Now, in the stand-alone Info, look for the line containing many
|
||||
dashes near the bottom of the screen. (This is the stand-alone
|
||||
equivalent for the mode line in Emacs.) There is one more line
|
||||
beneath that one, but usually it is blank. (In Emacs, this is the
|
||||
echo area.) When it is blank, Info is ready for a command, such as
|
||||
@kbd{n} or @kbd{b} or @key{SPC} or @kbd{m}. If that line contains
|
||||
text ending in a colon, it means Info is reading more input for the
|
||||
last command. You can't type an Info command then, because Info is
|
||||
trying to read input, not commands. You must either give the input
|
||||
and finish the command you started, or type @kbd{Control-g} to cancel
|
||||
the command. When you have done one of those things, the input entry
|
||||
line becomes blank again. Then you can type Info commands again.
|
||||
|
||||
@findex Info-menu
|
||||
The command to go to a subnode via a menu is @kbd{m}. After you type
|
||||
@ -535,6 +629,8 @@ three ways of going to one place, Help-FOO:
|
||||
* Help-FOO:: And yet another!
|
||||
@end menu
|
||||
|
||||
(Turn Visible mode on if you are using Emacs.)
|
||||
|
||||
@format
|
||||
>> Now type just an @kbd{m} and see what happens:
|
||||
@end format
|
||||
@ -610,14 +706,6 @@ node's header line it acts like @kbd{n}, @kbd{p}, or @kbd{u}, etc. At
|
||||
end of the node's text @kbd{Mouse-2} moves to the next node, or up if
|
||||
there's no next node.
|
||||
|
||||
Here is another way to get to Help-FOO, a menu. You can ignore this
|
||||
if you want, or else try it by typing @key{TAB} and then @key{RET}, or
|
||||
clicking @kbd{Mouse-2} on it (but then please come back to here).
|
||||
|
||||
@menu
|
||||
* Help-FOO::
|
||||
@end menu
|
||||
|
||||
@format
|
||||
>> Type @kbd{n} to see more commands.
|
||||
@end format
|
||||
@ -656,7 +744,8 @@ pointer shown in the header line (provided that you have a mouse).
|
||||
In Info documentation, you will see many @dfn{cross references}.
|
||||
Cross references look like this: @xref{Help-Cross, Cross}. That text
|
||||
is a real, live cross reference, whose name is @samp{Cross} and which
|
||||
points to the node named @samp{Help-Cross}.
|
||||
points to the node named @samp{Help-Cross}. (The node name is hidden
|
||||
in Emacs. Do @kbd{M-x visible-mode} to show or hide it.)
|
||||
|
||||
@kindex f @r{(Info mode)}
|
||||
@findex Info-follow-reference
|
||||
@ -699,6 +788,48 @@ to cancel the @kbd{f}.
|
||||
The @key{TAB} and @kbd{M-@key{TAB}} key, which move between menu
|
||||
items in a menu, also move between cross references outside of menus.
|
||||
|
||||
Sometimes a cross reference (or a node) can lead to another file (in
|
||||
other words another ``manual''), or, on occasion, even a file on a
|
||||
remote machine (although Info files distributed with Emacs or the
|
||||
stand-alone Info avoid using remote links). Such a cross reference
|
||||
looks like this: @xref{Top,, Overview of Texinfo, texinfo, Texinfo:
|
||||
The GNU Documentation Format}. (After following this link, type
|
||||
@kbd{l} to get back to this node.) Here the name @samp{texinfo}
|
||||
between parentheses (shown in the stand-alone version) refers to the
|
||||
file name. This file name appears in cross references and node names
|
||||
if it differs from the current file. In Emacs, the file name is
|
||||
hidden (along with other text). (Use @kbd{M-x visible-mode} to show
|
||||
or hide it.)
|
||||
|
||||
The remainder of this node applies only to the Emacs version. If
|
||||
you use the stand-alone version, you can type @kbd{n} immediately.
|
||||
|
||||
To some users, switching manuals is a much bigger switch than
|
||||
switching sections. These users like to know that they are going to
|
||||
be switching to another manual (and which one) before actually doing
|
||||
so, especially given that, if one does not notice, Info commands like
|
||||
@kbd{t} (see the next node) can have confusing results.
|
||||
|
||||
If you put your mouse over the cross reference and if the cross
|
||||
reference leads to a different manual, then the information appearing
|
||||
in a separate box (tool tip) or in the echo area, will mention the
|
||||
file the cross reference will carry you to (between parentheses).
|
||||
This is also true for menu subtopic names. If you have a mouse, just
|
||||
leave it over the @samp{Overview} cross reference above and watch what
|
||||
happens.
|
||||
|
||||
If you always like to have that information available without having
|
||||
to move your mouse over the cross reference, set
|
||||
@code{Info-hide-note-references} to a value other than t (@pxref{Emacs
|
||||
Info Variables}). You might also want to do that if you have a lot of
|
||||
cross references to files on remote machines and have non-permanent or
|
||||
slow access, since otherwise you might not be able to distinguish
|
||||
between local and remote links.
|
||||
|
||||
@format
|
||||
>> Now type @kbd{n} to learn more commands.
|
||||
@end format
|
||||
|
||||
@node Help-Int, Help-Q, Help-Xref, Getting Started
|
||||
@comment node-name, next, previous, up
|
||||
@section Some intermediate Info commands
|
||||
@ -706,12 +837,16 @@ items in a menu, also move between cross references outside of menus.
|
||||
The introductory course is almost over; please continue
|
||||
a little longer to learn some intermediate-level commands.
|
||||
|
||||
Most Info files have an index, which is actually a large node that
|
||||
contains nothing but a menu. The menu has one menu item for each
|
||||
topic listed in the index. You can find the index node from the main
|
||||
menu of the file, with the @kbd{m} command; then you can use the
|
||||
@kbd{m} command again in the index node to go to the node that
|
||||
describes the topic.
|
||||
Most Info files have an index, which is actually a large node
|
||||
containing little but a menu. The menu has one menu item for each
|
||||
topic listed in the index. (As a special feature, menus for indices
|
||||
may also include the line number within the node of the index entry.
|
||||
This allows Info readers to go to the exact line of an entry, not just
|
||||
the start of the containing node.)
|
||||
|
||||
You can get to the index from the main menu of the file with the
|
||||
@kbd{m} command; then you can use the @kbd{m} command again in the
|
||||
index node to go to the node that describes the topic you want.
|
||||
|
||||
There is also a short-cut Info command, @kbd{i}, which does all of
|
||||
that for you. It searches the index for a given topic (a string) and
|
||||
@ -728,23 +863,17 @@ records the nodes where you have been in a special history list. The
|
||||
@kbd{l} command revisits nodes in the history list; each successive
|
||||
@kbd{l} command moves one step back through the history.
|
||||
|
||||
If you have been following directions, an @kbd{l} command now will get
|
||||
you back to @samp{Help-M}. Another @kbd{l} command would undo the
|
||||
@kbd{u} and get you back to @samp{Help-FOO}. Another @kbd{l} would undo
|
||||
the @kbd{m} and get you back to @samp{Help-M}.
|
||||
|
||||
In Emacs, @kbd{l} runs the command @code{Info-last}.
|
||||
|
||||
@format
|
||||
>> Try typing three @kbd{l}'s, pausing in between to see what each
|
||||
@kbd{l} does. Then follow directions again and you will end up
|
||||
back here.
|
||||
>> Try typing @kbd{p p n} and then three @kbd{l}'s, pausing in between
|
||||
to see what each @kbd{l} does. You should wind up right back here.
|
||||
@end format
|
||||
|
||||
Note the difference between @kbd{l} and @kbd{p}: @kbd{l} moves to
|
||||
where @emph{you} last were, whereas @kbd{p} always moves to the node
|
||||
which the header says is the @samp{Previous} node (from this node, the
|
||||
@samp{Prev} link leads to @samp{Help-M}).
|
||||
@samp{Prev} link leads to @samp{Help-Xref}).
|
||||
|
||||
@kindex d @r{(Info mode)}
|
||||
@findex Info-directory
|
||||
@ -796,10 +925,10 @@ Texinfo file. (However, in most cases, writing a Texinfo file is
|
||||
better, since you can use it to make a printed manual or produce other
|
||||
formats, such as HTML and DocBook, as well as for generating Info
|
||||
files.) @xref{Top,, Overview of Texinfo, texinfo, Texinfo: The GNU
|
||||
Documentation Format}.)
|
||||
Documentation Format}.
|
||||
|
||||
@menu
|
||||
* Advanced:: Advanced Info commands: g, s, e, and 1 - 5.
|
||||
* Advanced:: Advanced Info commands: g, e, and 1 - 9.
|
||||
* Info Search:: How to search Info documents for specific subjects.
|
||||
* Add:: Describes how to add new nodes to the hierarchy.
|
||||
Also tells what nodes look like.
|
||||
@ -816,7 +945,7 @@ Documentation Format}.)
|
||||
|
||||
Here are some more Info commands that make it easier to move around.
|
||||
|
||||
@unnumberedsubsec @kbd{g} goes to a node by name
|
||||
@subheading @kbd{g} goes to a node by name
|
||||
|
||||
@kindex g @r{(Info mode)}
|
||||
@findex Info-goto-node
|
||||
@ -842,7 +971,7 @@ the node @samp{Top} in the Info file @file{dir}. Likewise,
|
||||
all of the current file by typing @kbd{g*@key{RET}} or all of any
|
||||
other file with @kbd{g(@var{filename})@key{RET}}.
|
||||
|
||||
@unnumberedsubsec @kbd{1} -- @kbd{9} choose a menu subtopic by its number
|
||||
@subheading @kbd{1}--@kbd{9} choose a menu subtopic by its number
|
||||
|
||||
@kindex 1 @r{through} 9 @r{(Info mode)}
|
||||
@findex Info-nth-menu-item
|
||||
@ -856,17 +985,18 @@ In the stand-alone reader, @kbd{0} goes through the last menu item;
|
||||
this is so you need not count how many entries are there. In Emacs,
|
||||
the digit keys run the command @code{Info-nth-menu-item}.
|
||||
|
||||
If your display supports multiple fonts, and you are using Emacs'
|
||||
Info mode to read Info files, the @samp{*} for the fifth menu item
|
||||
stands out, either in color or in some other attribute, such as
|
||||
underline, and so is the @samp{*} for the ninth item; this makes it
|
||||
easy to see at a glance which number to use for an item.
|
||||
If your display supports multiple fonts, colors or underlining, and
|
||||
you are using Emacs' Info mode to read Info files, the third, sixth
|
||||
and ninth menu items have a @samp{*} that stands out, either in color
|
||||
or in some other attribute, such as underline; this makes it easy to
|
||||
see at a glance which number to use for an item.
|
||||
|
||||
Some terminals don't support colors or underlining. If you need to
|
||||
actually count items, it is better to use @kbd{m} instead, and specify
|
||||
the name, or use @key{TAB} to quickly move between menu items.
|
||||
Some terminals don't support either multiple fonts, colors or
|
||||
underlining. If you need to actually count items, it is better to use
|
||||
@kbd{m} instead, and specify the name, or use @key{TAB} to quickly
|
||||
move between menu items.
|
||||
|
||||
@unnumberedsubsec @kbd{e} makes Info document editable
|
||||
@subheading @kbd{e} makes Info document editable
|
||||
|
||||
@kindex e @r{(Info mode)}
|
||||
@findex Info-edit
|
||||
@ -881,6 +1011,23 @@ only if the variable @code{Info-enable-edit} is non-@code{nil}.
|
||||
edit the Info file, so typing @kbd{e} there goes to the end of the
|
||||
current node.
|
||||
|
||||
@subheading @kbd{M-n} creates a new independent Info buffer in Emacs
|
||||
|
||||
@kindex M-n @r{(Info mode)}
|
||||
@findex clone-buffer
|
||||
@cindex multiple Info buffers
|
||||
If you are reading Info in Emacs, you can select a new independent
|
||||
Info buffer in another window by typing @kbd{M-n}. The new buffer
|
||||
starts out as an exact copy of the old one, but you will be able to
|
||||
move independently between nodes in the two buffers. (In Info mode,
|
||||
@kbd{M-n} runs the Emacs command @code{clone-buffer}.)
|
||||
|
||||
In Emacs Info, you can also produce new Info buffers by giving a
|
||||
numeric prefix argument to the @kbd{m} and @kbd{g} commands. @kbd{C-u
|
||||
m} and @kbd{C-u g} go to a new node in exactly the same way that
|
||||
@kbd{m} and @kbd{g} do, but they do so in a new Info buffer which they
|
||||
select in another window.
|
||||
|
||||
@node Info Search, Add, Advanced, Expert Info
|
||||
@comment node-name, next, previous, up
|
||||
@section How to search Info documents for specific subjects
|
||||
@ -914,7 +1061,7 @@ you typed @emph{as a substring}. For each match, Info shows in the
|
||||
echo area the full index entry it found. Often, the text of the full
|
||||
index entry already gives you enough information to decide whether it
|
||||
is relevant to what you are looking for, so we recommend that you read
|
||||
what Emacs shows in the echo are before looking at the node it
|
||||
what Info shows in the echo area before looking at the node it
|
||||
displays.
|
||||
|
||||
Since @kbd{i} looks for a substring, you can search for subjects even
|
||||
@ -929,12 +1076,18 @@ options, and key sequences that the program provides. If you are
|
||||
looking for a description of a command, an option, or a key, just type
|
||||
their names when @kbd{i} prompts you for a topic. For example, if you
|
||||
want to read the description of what the @kbd{C-f} key does, type
|
||||
@kbd{iC-f@key{RET}}. Here @kbd{C-f} are 3 literal characters
|
||||
@kbd{i C - f @key{RET}}. Here @kbd{C-f} are 3 literal characters
|
||||
@samp{C}, @samp{-}, and @samp{f}, not the ``Control-f'' command key
|
||||
you type inside Emacs to run the command bound to @kbd{C-f}.
|
||||
|
||||
In Emacs, @kbd{i} runs the command @code{Info-index}.
|
||||
|
||||
@findex info-apropos
|
||||
If you don't know what manual documents something, try the @kbd{M-x
|
||||
info-apropos} command. It prompts for a string and then looks up that
|
||||
string in all the indices of all the Info documents installed on your
|
||||
system.
|
||||
|
||||
@kindex s @r{(Info mode)}
|
||||
@findex Info-search
|
||||
The @kbd{s} command allows you to search a whole file for a string.
|
||||
@ -1049,15 +1202,15 @@ The @kbd{m} command searches the current node's menu for the topic which it
|
||||
reads from the terminal.
|
||||
|
||||
@cindex menu and menu entry format
|
||||
A menu begins with a line starting with @samp{* Menu:}. The rest of the
|
||||
line is a comment. After the starting line, every line that begins
|
||||
with a @samp{* } lists a single topic. The name of the topic--what
|
||||
the user must type at the @kbd{m}'s command prompt to select this
|
||||
topic---comes right after the star and space, and is followed by a
|
||||
colon, spaces and tabs, and the name of the node which discusses that
|
||||
topic. The node name, like node names following @samp{Next}, @samp{Previous}
|
||||
and @samp{Up}, may be terminated with a tab, comma, or newline; it may also
|
||||
be terminated with a period.
|
||||
A menu begins with a line starting with @w{@samp{* Menu:}}. The
|
||||
rest of the line is a comment. After the starting line, every line
|
||||
that begins with a @samp{* } lists a single topic. The name of the
|
||||
topic---what the user must type at the @kbd{m}'s command prompt to
|
||||
select this topic---comes right after the star and space, and is
|
||||
followed by a colon, spaces and tabs, and the name of the node which
|
||||
discusses that topic. The node name, like node names following
|
||||
@samp{Next}, @samp{Previous} and @samp{Up}, may be terminated with a
|
||||
tab, comma, or newline; it may also be terminated with a period.
|
||||
|
||||
If the node name and topic name are the same, then rather than
|
||||
giving the name twice, the abbreviation @samp{* @var{name}::} may be
|
||||
@ -1278,6 +1431,14 @@ the @samp{Next}, @samp{Prev}, and @samp{Up} links. A header line does
|
||||
not scroll with the rest of the buffer, making these links always
|
||||
visible.
|
||||
|
||||
@item Info-hide-note-references
|
||||
As explained in earlier nodes, the Emacs version of Info normally
|
||||
hides some text in menus and cross-references. You can completely
|
||||
disable this feature, by setting this option to @code{nil}. Setting
|
||||
it to a value that is neither @code{nil} nor @code{t} produces an
|
||||
intermediate behavior, hiding a limited amount of text, but showing
|
||||
all text that could potentially be useful.
|
||||
|
||||
@item Info-scroll-prefer-subnodes
|
||||
If set to a non-@code{nil} value, @key{SPC} and @key{BACKSPACE} (or
|
||||
@key{DEL}) keys in a menu visit subnodes of the current node before
|
||||
@ -1286,7 +1447,7 @@ node's menu appears on the screen, the next @key{SPC} moves to a
|
||||
subnode indicated by the following menu item. Setting this option to
|
||||
@code{nil} results in behavior similar to the stand-alone Info reader
|
||||
program, which visits the first subnode from the menu only when you
|
||||
hit the end of the current node. The default is @code{t}.
|
||||
hit the end of the current node. The default is @code{nil}.
|
||||
|
||||
@item Info-enable-active-nodes
|
||||
When set to a non-@code{nil} value, allows Info to execute Lisp code
|
||||
@ -1331,3 +1492,7 @@ topics discussed in this document.
|
||||
@printindex cp
|
||||
|
||||
@bye
|
||||
|
||||
@ignore
|
||||
arch-tag: 965c1638-01d6-4156-9227-b10418b9d8e8
|
||||
@end ignore
|
||||
|
41
contrib/texinfo/doc/infokey.1
Normal file
41
contrib/texinfo/doc/infokey.1
Normal file
@ -0,0 +1,41 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.34.
|
||||
.TH INFOKEY "1" "December 2004" "infokey 4.8" "User Commands"
|
||||
.SH NAME
|
||||
infokey \- compile customizations for Info
|
||||
.SH SYNOPSIS
|
||||
.B infokey
|
||||
[\fIOPTION\fR]... [\fIINPUT-FILE\fR]
|
||||
.SH DESCRIPTION
|
||||
Compile infokey source file to infokey file. Reads INPUT\-FILE (default
|
||||
$HOME/.infokey) and writes compiled key file to (by default) $HOME/.info.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-\-output\fR FILE
|
||||
output to FILE instead of $HOME/.info
|
||||
.TP
|
||||
\fB\-\-help\fR
|
||||
display this help and exit.
|
||||
.TP
|
||||
\fB\-\-version\fR
|
||||
display version information and exit.
|
||||
.SH "REPORTING BUGS"
|
||||
Email bug reports to bug\-texinfo@gnu.org,
|
||||
general questions and discussion to help\-texinfo@gnu.org.
|
||||
Texinfo home page: http://www.gnu.org/software/texinfo/
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2003 Free Software Foundation, Inc.
|
||||
There is NO warranty. You may redistribute this software
|
||||
under the terms of the GNU General Public License.
|
||||
For more information about these matters, see the files named COPYING.
|
||||
.SH "SEE ALSO"
|
||||
The full documentation for
|
||||
.B infokey
|
||||
is maintained as a Texinfo manual. If the
|
||||
.B info
|
||||
and
|
||||
.B infokey
|
||||
programs are properly installed at your site, the command
|
||||
.IP
|
||||
.B info infokey
|
||||
.PP
|
||||
should give you access to the complete manual.
|
@ -1,22 +1,22 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.29.
|
||||
.TH INSTALL-INFO "1" "June 2003" "install-info 4.6" "User Commands"
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.34.
|
||||
.TH INSTALL-INFO "1" "December 2004" "install-info 4.8" "User Commands"
|
||||
.SH NAME
|
||||
install-info \- update info/dir entries
|
||||
.SH SYNOPSIS
|
||||
.B install-info
|
||||
[\fIOPTION\fR]... [\fIINFO-FILE \fR[\fIDIR-FILE\fR]]
|
||||
.SH DESCRIPTION
|
||||
Install or delete dir entries from INFO-FILE in the Info directory file
|
||||
DIR-FILE.
|
||||
Install or delete dir entries from INFO\-FILE in the Info directory file
|
||||
DIR\-FILE.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-\-delete\fR
|
||||
delete existing entries for INFO-FILE from DIR-FILE;
|
||||
delete existing entries for INFO\-FILE from DIR\-FILE;
|
||||
don't insert any new entries.
|
||||
.TP
|
||||
\fB\-\-dir\-file\fR=\fINAME\fR
|
||||
specify file name of Info directory file.
|
||||
This is equivalent to using the DIR-FILE argument.
|
||||
This is equivalent to using the DIR\-FILE argument.
|
||||
.TP
|
||||
\fB\-\-entry\fR=\fITEXT\fR
|
||||
insert TEXT as an Info directory entry.
|
||||
@ -31,7 +31,7 @@ display this help and exit.
|
||||
.TP
|
||||
\fB\-\-info\-file\fR=\fIFILE\fR
|
||||
specify Info file to install in the directory.
|
||||
This is equivalent to using the INFO-FILE argument.
|
||||
This is equivalent to using the INFO\-FILE argument.
|
||||
.TP
|
||||
\fB\-\-info\-dir\fR=\fIDIR\fR
|
||||
same as \fB\-\-dir\-file\fR=\fIDIR\fR/dir.
|
||||
@ -56,11 +56,11 @@ from information in the Info file itself.
|
||||
\fB\-\-version\fR
|
||||
display version information and exit.
|
||||
.SH "REPORTING BUGS"
|
||||
Email bug reports to bug-texinfo@gnu.org,
|
||||
general questions and discussion to help-texinfo@gnu.org.
|
||||
Email bug reports to bug\-texinfo@gnu.org,
|
||||
general questions and discussion to help\-texinfo@gnu.org.
|
||||
Texinfo home page: http://www.gnu.org/software/texinfo/
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2003 Free Software Foundation, Inc.
|
||||
Copyright \(co 2004 Free Software Foundation, Inc.
|
||||
There is NO warranty. You may redistribute this software
|
||||
under the terms of the GNU General Public License.
|
||||
For more information about these matters, see the files named COPYING.
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.29.
|
||||
.TH MAKEINFO "1" "June 2003" "makeinfo 4.6" "User Commands"
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.34.
|
||||
.TH MAKEINFO "1" "December 2004" "makeinfo 4.8" "User Commands"
|
||||
.SH NAME
|
||||
makeinfo \- translate Texinfo documents
|
||||
.SH SYNOPSIS
|
||||
@ -20,7 +20,7 @@ preserve output even if errors.
|
||||
display this help and exit.
|
||||
.TP
|
||||
\fB\-\-no\-validate\fR
|
||||
suppress node cross-reference validation.
|
||||
suppress node cross\-reference validation.
|
||||
.TP
|
||||
\fB\-\-no\-warn\fR
|
||||
suppress warnings (but not errors).
|
||||
@ -36,17 +36,20 @@ display version information and exit.
|
||||
.SS "Output format selection (default is to produce Info):"
|
||||
.TP
|
||||
\fB\-\-docbook\fR
|
||||
output DocBook XML rather than Info.
|
||||
output Docbook XML rather than Info.
|
||||
.TP
|
||||
\fB\-\-html\fR
|
||||
output HTML rather than Info.
|
||||
.TP
|
||||
\fB\-\-xml\fR
|
||||
output Texinfo XML rather than Info.
|
||||
.TP
|
||||
\fB\-\-plaintext\fR
|
||||
output plain text rather than Info.
|
||||
.SS "General output options:"
|
||||
.TP
|
||||
\fB\-E\fR, \fB\-\-macro\-expand\fR FILE
|
||||
output macro-expanded source to FILE.
|
||||
output macro\-expanded source to FILE.
|
||||
ignoring any @setfilename.
|
||||
.TP
|
||||
\fB\-\-no\-headers\fR
|
||||
@ -91,7 +94,12 @@ split Info files at size NUM (default 300000).
|
||||
.TP
|
||||
\fB\-\-css\-include\fR=\fIFILE\fR
|
||||
include FILE in HTML <style> output;
|
||||
read stdin if FILE is -.
|
||||
read stdin if FILE is \-.
|
||||
.SS "Options for XML and Docbook:"
|
||||
.TP
|
||||
\fB\-\-output\-indent\fR=\fIVAL\fR
|
||||
indent XML elements by VAL spaces (default 2).
|
||||
If VAL is 0, ignorable whitespace is dropped.
|
||||
.SS "Input file options:"
|
||||
.TP
|
||||
\fB\-\-commands\-in\-node\-names\fR
|
||||
@ -110,6 +118,10 @@ prepend DIR to the @include search path.
|
||||
undefine the variable VAR, as with @clear.
|
||||
.SS "Conditional processing in input:"
|
||||
.TP
|
||||
\fB\-\-ifdocbook\fR
|
||||
process @ifdocbook and @docbook even if
|
||||
not generating Docbook.
|
||||
.TP
|
||||
\fB\-\-ifhtml\fR
|
||||
process @ifhtml and @html even if not generating HTML.
|
||||
.TP
|
||||
@ -125,6 +137,9 @@ process @iftex and @tex; implies \fB\-\-no\-split\fR.
|
||||
\fB\-\-ifxml\fR
|
||||
process @ifxml and @xml.
|
||||
.TP
|
||||
\fB\-\-no\-ifdocbook\fR
|
||||
do not process @ifdocbook and @docbook text.
|
||||
.TP
|
||||
\fB\-\-no\-ifhtml\fR
|
||||
do not process @ifhtml and @html text.
|
||||
.TP
|
||||
@ -140,6 +155,8 @@ do not process @iftex and @tex text.
|
||||
\fB\-\-no\-ifxml\fR
|
||||
do not process @ifxml and @xml text.
|
||||
.IP
|
||||
Also, for the \fB\-\-no\-ifFORMAT\fR options, do process @ifnotFORMAT text.
|
||||
.IP
|
||||
The defaults for the @if... conditionals depend on the output format:
|
||||
if generating HTML, \fB\-\-ifhtml\fR is on and the others are off;
|
||||
if generating Info, \fB\-\-ifinfo\fR is on and the others are off;
|
||||
@ -166,11 +183,11 @@ makeinfo \fB\-\-html\fR \fB\-\-no\-headers\fR foo.texi write html without node l
|
||||
makeinfo \fB\-\-number\-sections\fR foo.texi write Info with numbered sections
|
||||
makeinfo \fB\-\-no\-split\fR foo.texi write one Info file however big
|
||||
.SH "REPORTING BUGS"
|
||||
Email bug reports to bug-texinfo@gnu.org,
|
||||
general questions and discussion to help-texinfo@gnu.org.
|
||||
Email bug reports to bug\-texinfo@gnu.org,
|
||||
general questions and discussion to help\-texinfo@gnu.org.
|
||||
Texinfo home page: http://www.gnu.org/software/texinfo/
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2003 Free Software Foundation, Inc.
|
||||
Copyright \(co 2004 Free Software Foundation, Inc.
|
||||
There is NO warranty. You may redistribute this software
|
||||
under the terms of the GNU General Public License.
|
||||
For more information about these matters, see the files named COPYING.
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.29.
|
||||
.TH TEXINDEX "1" "June 2003" "texindex 4.6" "User Commands"
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.34.
|
||||
.TH TEXINDEX "1" "December 2004" "texindex 4.8" "User Commands"
|
||||
.SH NAME
|
||||
texindex \- sort Texinfo index files
|
||||
.SH SYNOPSIS
|
||||
@ -25,11 +25,11 @@ send output to FILE
|
||||
\fB\-\-version\fR
|
||||
display version information and exit
|
||||
.SH "REPORTING BUGS"
|
||||
Email bug reports to bug-texinfo@gnu.org,
|
||||
general questions and discussion to help-texinfo@gnu.org.
|
||||
Email bug reports to bug\-texinfo@gnu.org,
|
||||
general questions and discussion to help\-texinfo@gnu.org.
|
||||
Texinfo home page: http://www.gnu.org/software/texinfo/
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2003 Free Software Foundation, Inc.
|
||||
Copyright \(co 2004 Free Software Foundation, Inc.
|
||||
There is NO warranty. You may redistribute this software
|
||||
under the terms of the GNU General Public License.
|
||||
For more information about these matters, see the files named COPYING.
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" texinfo(5)
|
||||
.\" $Id: texinfo.5,v 1.1 2002/09/03 23:44:57 karl Exp $
|
||||
.\" $Id: texinfo.5,v 1.2 2004/04/11 17:56:45 karl Exp $
|
||||
.\"
|
||||
.\" Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
.\"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
@set UPDATED 19 February 2003
|
||||
@set UPDATED-MONTH February 2003
|
||||
@set EDITION 4.6
|
||||
@set VERSION 4.6
|
||||
@set UPDATED 14 December 2004
|
||||
@set UPDATED-MONTH December 2004
|
||||
@set EDITION 4.8
|
||||
@set VERSION 4.8
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set UPDATED 2 June 2003
|
||||
@set UPDATED-MONTH June 2003
|
||||
@set EDITION 4.6
|
||||
@set VERSION 4.6
|
||||
@set UPDATED 29 December 2004
|
||||
@set UPDATED-MONTH December 2004
|
||||
@set EDITION 4.8
|
||||
@set VERSION 4.8
|
||||
|
@ -1,4 +1,4 @@
|
||||
$Id: README,v 1.2 2002/09/11 16:32:09 karl Exp $
|
||||
$Id: README,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
texinfo/info/README
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* dir.c -- how to build a special "dir" node from "localdir" files.
|
||||
$Id: dir.c,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: dir.c,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 1998, 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
|
||||
@ -28,7 +28,11 @@
|
||||
with the addition of the menus of every file named in the array
|
||||
dirs_to_add which are found in INFOPATH. */
|
||||
|
||||
static void add_menu_to_file_buffer (), insert_text_into_fb_at_binding ();
|
||||
static void add_menu_to_file_buffer (char *contents, long int size,
|
||||
FILE_BUFFER *fb);
|
||||
static void insert_text_into_fb_at_binding (FILE_BUFFER *fb,
|
||||
SEARCH_BINDING *binding, char *text, int textlen);
|
||||
void maybe_build_dir_node (char *dirname);
|
||||
|
||||
static char *dirs_to_add[] = {
|
||||
"dir", "localdir", (char *)NULL
|
||||
@ -45,8 +49,7 @@ typedef struct
|
||||
} dir_file_list_entry_type;
|
||||
|
||||
static int
|
||||
new_dir_file_p (test)
|
||||
struct stat *test;
|
||||
new_dir_file_p (struct stat *test)
|
||||
{
|
||||
static unsigned dir_file_list_len = 0;
|
||||
static dir_file_list_entry_type *dir_file_list = NULL;
|
||||
@ -70,8 +73,7 @@ new_dir_file_p (test)
|
||||
|
||||
|
||||
void
|
||||
maybe_build_dir_node (dirname)
|
||||
char *dirname;
|
||||
maybe_build_dir_node (char *dirname)
|
||||
{
|
||||
int path_index, update_tags;
|
||||
char *this_dir;
|
||||
@ -162,10 +164,7 @@ maybe_build_dir_node (dirname)
|
||||
to the menu found in FB->contents. Second argument SIZE is the total
|
||||
size of CONTENTS. */
|
||||
static void
|
||||
add_menu_to_file_buffer (contents, size, fb)
|
||||
char *contents;
|
||||
long size;
|
||||
FILE_BUFFER *fb;
|
||||
add_menu_to_file_buffer (char *contents, long int size, FILE_BUFFER *fb)
|
||||
{
|
||||
SEARCH_BINDING contents_binding, fb_binding;
|
||||
long contents_offset, fb_offset;
|
||||
@ -271,11 +270,8 @@ add_menu_to_file_buffer (contents, size, fb)
|
||||
}
|
||||
|
||||
static void
|
||||
insert_text_into_fb_at_binding (fb, binding, text, textlen)
|
||||
FILE_BUFFER *fb;
|
||||
SEARCH_BINDING *binding;
|
||||
char *text;
|
||||
int textlen;
|
||||
insert_text_into_fb_at_binding (FILE_BUFFER *fb,
|
||||
SEARCH_BINDING *binding, char *text, int textlen)
|
||||
{
|
||||
char *contents;
|
||||
long start, end;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* display.c -- How to display Info windows.
|
||||
$Id: display.c,v 1.4 2003/05/13 16:20:44 karl Exp $
|
||||
$Id: display.c,v 1.7 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 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
|
||||
@ -17,15 +17,19 @@
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
Originally written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "display.h"
|
||||
|
||||
extern int info_any_buffered_input_p (); /* Found in session.c. */
|
||||
extern int info_any_buffered_input_p (void); /* Found in session.c. */
|
||||
|
||||
static void free_display ();
|
||||
static DISPLAY_LINE **make_display ();
|
||||
static void free_display (DISPLAY_LINE **display);
|
||||
static DISPLAY_LINE **make_display (int width, int height);
|
||||
|
||||
void handle_tag (char *tag);
|
||||
void handle_tag_start (char *tag);
|
||||
void handle_tag_end (char *tag);
|
||||
|
||||
/* An array of display lines which tell us what is currently visible on
|
||||
the display. */
|
||||
@ -36,8 +40,7 @@ int display_inhibited = 0;
|
||||
|
||||
/* Initialize THE_DISPLAY to WIDTH and HEIGHT, with nothing in it. */
|
||||
void
|
||||
display_initialize_display (width, height)
|
||||
int width, height;
|
||||
display_initialize_display (int width, int height)
|
||||
{
|
||||
free_display (the_display);
|
||||
the_display = make_display (width, height);
|
||||
@ -46,13 +49,11 @@ display_initialize_display (width, height)
|
||||
|
||||
/* Clear all of the lines in DISPLAY making the screen blank. */
|
||||
void
|
||||
display_clear_display (display)
|
||||
DISPLAY_LINE **display;
|
||||
display_clear_display (DISPLAY_LINE **display)
|
||||
{
|
||||
register int i;
|
||||
register DISPLAY_LINE *display_line;
|
||||
|
||||
for (i = 0; (display_line = display[i]); i++)
|
||||
for (i = 0; display[i]; i++)
|
||||
{
|
||||
display[i]->text[0] = '\0';
|
||||
display[i]->textlen = 0;
|
||||
@ -66,8 +67,7 @@ int display_was_interrupted_p = 0;
|
||||
/* Update the windows pointed to by WINDOW in the_display. This actually
|
||||
writes the text on the screen. */
|
||||
void
|
||||
display_update_display (window)
|
||||
WINDOW *window;
|
||||
display_update_display (WINDOW *window)
|
||||
{
|
||||
register WINDOW *win;
|
||||
|
||||
@ -91,11 +91,36 @@ display_update_display (window)
|
||||
display_update_one_window (the_echo_area);
|
||||
}
|
||||
|
||||
void
|
||||
handle_tag_start (char *tag)
|
||||
{
|
||||
/* TODO really handle this tag. */
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
handle_tag_end (char *tag)
|
||||
{
|
||||
/* TODO really handle this tag. */
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
handle_tag (char *tag)
|
||||
{
|
||||
if (tag[0] == '/')
|
||||
{
|
||||
tag++;
|
||||
handle_tag_end (tag);
|
||||
}
|
||||
else
|
||||
handle_tag_start (tag);
|
||||
}
|
||||
|
||||
/* Display WIN on the_display. Unlike display_update_display (), this
|
||||
function only does one window. */
|
||||
void
|
||||
display_update_one_window (win)
|
||||
WINDOW *win;
|
||||
display_update_one_window (WINDOW *win)
|
||||
{
|
||||
register char *nodetext; /* Current character to display. */
|
||||
register char *last_node_char; /* Position of the last character in node. */
|
||||
@ -153,12 +178,40 @@ display_update_one_window (win)
|
||||
replen = win->width - pl_index + pl_ignore;
|
||||
}
|
||||
else if (*nodetext == '\0'
|
||||
&& (nodetext + 1) < last_node_char
|
||||
&& *(nodetext + 1) == '\b')
|
||||
&& (nodetext + 2) < last_node_char
|
||||
&& *(nodetext + 1) == '\b'
|
||||
&& *(nodetext + 2) == '[')
|
||||
{
|
||||
/* Found new style image tag/cookie \0\b[ or \0\b]
|
||||
Just skip for now. */
|
||||
nodetext++;
|
||||
/* Found new style tag/cookie \0\b[
|
||||
Read until the closing tag \0\b] */
|
||||
int element_len = 0;
|
||||
char *element;
|
||||
|
||||
/* Skip the escapes. */
|
||||
nodetext += 3;
|
||||
|
||||
while (!(*nodetext == '\0'
|
||||
&& *(nodetext + 1) == '\b'
|
||||
&& *(nodetext + 2) == ']'))
|
||||
{
|
||||
nodetext++;
|
||||
element_len++;
|
||||
}
|
||||
|
||||
element = (char *) malloc (element_len + 1);
|
||||
strncpy (element, nodetext - element_len, element_len);
|
||||
|
||||
/* Skip the escapes. */
|
||||
nodetext += 2;
|
||||
pl_ignore += element_len + 5;
|
||||
/* Append string terminator. */
|
||||
element[element_len] = '\0';
|
||||
|
||||
handle_tag (element);
|
||||
|
||||
/* Over and out */
|
||||
free (element);
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
@ -283,7 +336,7 @@ display_update_one_window (win)
|
||||
fflush (stdout);
|
||||
|
||||
/* Update the display text buffer. */
|
||||
if (strlen (printed_line) > screenwidth)
|
||||
if (strlen (printed_line) > (unsigned int) screenwidth)
|
||||
/* printed_line[] can include more than screenwidth
|
||||
characters if we are under -R and there are escape
|
||||
sequences in it. However, entry->text was
|
||||
@ -395,8 +448,7 @@ display_update_one_window (win)
|
||||
for no scrolling to take place in the case that the terminal doesn't
|
||||
support it. This doesn't matter to us. */
|
||||
void
|
||||
display_scroll_display (start, end, amount)
|
||||
int start, end, amount;
|
||||
display_scroll_display (int start, int end, int amount)
|
||||
{
|
||||
register int i, last;
|
||||
DISPLAY_LINE *temp;
|
||||
@ -466,10 +518,8 @@ display_scroll_display (start, end, amount)
|
||||
starts that used to appear in this window. OLD_COUNT is the number of lines
|
||||
that appear in the OLD_STARTS array. */
|
||||
void
|
||||
display_scroll_line_starts (window, old_pagetop, old_starts, old_count)
|
||||
WINDOW *window;
|
||||
int old_pagetop, old_count;
|
||||
char **old_starts;
|
||||
display_scroll_line_starts (WINDOW *window, int old_pagetop,
|
||||
char **old_starts, int old_count)
|
||||
{
|
||||
register int i, old, new; /* Indices into the line starts arrays. */
|
||||
int last_new, last_old; /* Index of the last visible line. */
|
||||
@ -541,8 +591,7 @@ display_scroll_line_starts (window, old_pagetop, old_starts, old_count)
|
||||
|
||||
/* Move the screen cursor to directly over the current character in WINDOW. */
|
||||
void
|
||||
display_cursor_at_point (window)
|
||||
WINDOW *window;
|
||||
display_cursor_at_point (WINDOW *window)
|
||||
{
|
||||
int vpos, hpos;
|
||||
|
||||
@ -560,8 +609,7 @@ display_cursor_at_point (window)
|
||||
|
||||
/* Make a DISPLAY_LINE ** with width and height. */
|
||||
static DISPLAY_LINE **
|
||||
make_display (width, height)
|
||||
int width, height;
|
||||
make_display (int width, int height)
|
||||
{
|
||||
register int i;
|
||||
DISPLAY_LINE **display;
|
||||
@ -581,8 +629,7 @@ make_display (width, height)
|
||||
|
||||
/* Free the storage allocated to DISPLAY. */
|
||||
static void
|
||||
free_display (display)
|
||||
DISPLAY_LINE **display;
|
||||
free_display (DISPLAY_LINE **display)
|
||||
{
|
||||
register int i;
|
||||
register DISPLAY_LINE *display_line;
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* display.h -- How the display in Info is done.
|
||||
$Id: display.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: display.h,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993, 97 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 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
|
||||
@ -45,33 +45,34 @@ extern int display_inhibited;
|
||||
extern int display_was_interrupted_p;
|
||||
|
||||
/* Initialize THE_DISPLAY to WIDTH and HEIGHT, with nothing in it. */
|
||||
extern void display_initialize_display ();
|
||||
extern void display_initialize_display (int width, int height);
|
||||
|
||||
/* Clear all of the lines in DISPLAY making the screen blank. */
|
||||
extern void display_clear_display ();
|
||||
extern void display_clear_display (DISPLAY_LINE **display);
|
||||
|
||||
/* Update the windows pointed to by WINDOWS in THE_DISPLAY. This actually
|
||||
writes the text on the screen. */
|
||||
extern void display_update_display ();
|
||||
extern void display_update_display (WINDOW *window);
|
||||
|
||||
/* Display WIN on THE_DISPLAY. Unlike display_update_display (), this
|
||||
function only does one window. */
|
||||
extern void display_update_one_window ();
|
||||
extern void display_update_one_window (WINDOW *win);
|
||||
|
||||
/* Move the screen cursor to directly over the current character in WINDOW. */
|
||||
extern void display_cursor_at_point ();
|
||||
extern void display_cursor_at_point (WINDOW *window);
|
||||
|
||||
/* Scroll the region of the_display starting at START, ending at END, and
|
||||
moving the lines AMOUNT lines. If AMOUNT is less than zero, the lines
|
||||
are moved up in the screen, otherwise down. Actually, it is possible
|
||||
for no scrolling to take place in the case that the terminal doesn't
|
||||
support it. This doesn't matter to us. */
|
||||
extern void display_scroll_display ();
|
||||
extern void display_scroll_display (int start, int end, int amount);
|
||||
|
||||
/* Try to scroll lines in WINDOW. OLD_PAGETOP is the pagetop of WINDOW before
|
||||
having had its line starts recalculated. OLD_STARTS is the list of line
|
||||
starts that used to appear in this window. OLD_COUNT is the number of lines
|
||||
that appear in the OLD_STARTS array. */
|
||||
extern void display_scroll_line_starts ();
|
||||
extern void display_scroll_line_starts (WINDOW *window, int old_pagetop,
|
||||
char **old_starts, int old_count);
|
||||
|
||||
#endif /* not INFO_DISPLAY_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* doc.h -- Structures associating function pointers with documentation.
|
||||
$Id: doc.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: doc.h,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 2001, 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
|
||||
@ -66,15 +66,6 @@ typedef struct
|
||||
|
||||
extern FUNCTION_DOC function_doc_array[];
|
||||
|
||||
extern char *function_documentation ();
|
||||
extern char *key_documentation ();
|
||||
extern char *pretty_keyname ();
|
||||
extern char *pretty_keyseq ();
|
||||
extern char *where_is ();
|
||||
extern char *replace_in_documentation ();
|
||||
extern void info_document_key ();
|
||||
extern void dump_map_to_message_buffer ();
|
||||
|
||||
/* Under the old key-binding system, an info command is specified by
|
||||
the pointer to its function. Under the new INFOKEY binding system,
|
||||
it is specified by a pointer to the command's FUNCTION_DOC structure,
|
||||
@ -82,7 +73,9 @@ extern void dump_map_to_message_buffer ();
|
||||
easily divined using the InfoFunction() extractor. */
|
||||
#if defined(INFOKEY)
|
||||
typedef FUNCTION_DOC InfoCommand;
|
||||
#define InfoFunction(ic) ((ic) ? (ic)->func : NULL)
|
||||
/* The cast to VFunction * prevents pgcc from complaining about
|
||||
dereferencing a void *. */
|
||||
#define InfoFunction(ic) ((ic) ? (ic)->func : (VFunction *) NULL)
|
||||
#define InfoCmd(fn) (&function_doc_array[A_##fn])
|
||||
#define DocInfoCmd(fd) ((fd) && (fd)->func ? (fd) : NULL)
|
||||
#else /* !INFOKEY */
|
||||
@ -92,8 +85,19 @@ typedef VFunction InfoCommand;
|
||||
#define DocInfoCmd(fd) ((fd)->func)
|
||||
#endif /* !INFOKEY */
|
||||
|
||||
#include "infomap.h" /* for Keymap. */
|
||||
|
||||
#if defined (NAMED_FUNCTIONS)
|
||||
extern char *function_name ();
|
||||
extern InfoCommand *named_function ();
|
||||
extern char *function_name (InfoCommand *cmd);
|
||||
extern InfoCommand *named_function (char *name);
|
||||
#endif /* NAMED_FUNCTIONS */
|
||||
|
||||
extern char *function_documentation (InfoCommand *cmd);
|
||||
extern char *key_documentation (char key, Keymap map);
|
||||
extern char *pretty_keyname (unsigned char key);
|
||||
extern char *pretty_keyseq (char *keyseq);
|
||||
extern char *where_is (Keymap map, InfoCommand *cmd);
|
||||
extern char *replace_in_documentation (char *string, int help_is_only_window_p);
|
||||
extern void dump_map_to_message_buffer (char *prefix, Keymap map);
|
||||
|
||||
#endif /* !DOC_H */
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* dribble.c -- dribble files for Info.
|
||||
$Id: dribble.c,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 98 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1998, 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
|
||||
@ -28,8 +29,7 @@ FILE *info_dribble_file = (FILE *)NULL;
|
||||
/* Open a dribble file named NAME, perhaps closing an already open one.
|
||||
This sets the global variable INFO_DRIBBLE_FILE to the open stream. */
|
||||
void
|
||||
open_dribble_file (name)
|
||||
char *name;
|
||||
open_dribble_file (char *name)
|
||||
{
|
||||
/* Perhaps close existing dribble file. */
|
||||
close_dribble_file ();
|
||||
@ -49,7 +49,7 @@ open_dribble_file (name)
|
||||
|
||||
/* If there is a dribble file already open, close it. */
|
||||
void
|
||||
close_dribble_file ()
|
||||
close_dribble_file (void)
|
||||
{
|
||||
if (info_dribble_file)
|
||||
{
|
||||
@ -61,8 +61,7 @@ close_dribble_file ()
|
||||
|
||||
/* Write some output to our existing dribble file. */
|
||||
void
|
||||
dribble (byte)
|
||||
unsigned char byte;
|
||||
dribble (unsigned char byte)
|
||||
{
|
||||
if (info_dribble_file)
|
||||
fwrite (&byte, sizeof (unsigned char), 1, info_dribble_file);
|
||||
|
@ -3,7 +3,7 @@
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 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
|
||||
@ -30,12 +30,12 @@ extern FILE *info_dribble_file;
|
||||
|
||||
/* Open a dribble file named NAME, perhaps closing an already open one.
|
||||
This sets the global variable INFO_DRIBBLE_FILE to the open stream. */
|
||||
extern void open_dribble_file ();
|
||||
extern void open_dribble_file (char *name);
|
||||
|
||||
/* If there is a dribble file already open, close it. */
|
||||
extern void close_dribble_file ();
|
||||
extern void close_dribble_file (void);
|
||||
|
||||
/* Write some output to our existing dribble file. */
|
||||
extern void dribble ();
|
||||
extern void dribble (unsigned char byte);
|
||||
|
||||
#endif /* !_DRIBBLE_H_ */
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* echo-area.c -- how to read a line in the echo area.
|
||||
$Id: echo-area.c,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: echo-area.c,v 1.7 2004/12/14 00:15:36 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 1998, 1999, 2001, 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
|
||||
@ -49,18 +50,19 @@ static int input_line_point;
|
||||
static int input_line_beg;
|
||||
static int input_line_end;
|
||||
static NODE input_line_node = {
|
||||
(char *)NULL, (char *)NULL, (char *)NULL, input_line, EA_MAX_INPUT, 0
|
||||
(char *)NULL, (char *)NULL, (char *)NULL, input_line,
|
||||
EA_MAX_INPUT, 0, N_IsInternal
|
||||
};
|
||||
|
||||
static void echo_area_initialize_node ();
|
||||
static void push_echo_area (), pop_echo_area ();
|
||||
static int echo_area_stack_contains_completions_p ();
|
||||
static void echo_area_initialize_node (void);
|
||||
static void push_echo_area (void), pop_echo_area (void);
|
||||
static int echo_area_stack_contains_completions_p (void);
|
||||
|
||||
static void ea_kill_text ();
|
||||
static void ea_kill_text (int from, int to);
|
||||
|
||||
/* Non-zero means we force the user to complete. */
|
||||
static int echo_area_must_complete_p = 0;
|
||||
static int completions_window_p ();
|
||||
static int completions_window_p (WINDOW *window);
|
||||
|
||||
/* If non-null, this is a window which was specifically created to display
|
||||
possible completions output. We remember it so we can delete it when
|
||||
@ -76,8 +78,7 @@ static long calling_window_pagetop = 0;
|
||||
|
||||
/* Remember the node and pertinent variables of the calling window. */
|
||||
static void
|
||||
remember_calling_window (window)
|
||||
WINDOW *window;
|
||||
remember_calling_window (WINDOW *window)
|
||||
{
|
||||
/* Only do this if the calling window is not the completions window, or,
|
||||
if it is the completions window and there is no other window. */
|
||||
@ -94,7 +95,7 @@ remember_calling_window (window)
|
||||
/* Restore the caller's window so that it shows the node that it was showing
|
||||
on entry to info_read_xxx_echo_area (). */
|
||||
static void
|
||||
restore_calling_window ()
|
||||
restore_calling_window (void)
|
||||
{
|
||||
register WINDOW *win, *compwin = (WINDOW *)NULL;
|
||||
|
||||
@ -124,7 +125,10 @@ restore_calling_window ()
|
||||
!echo_area_stack_contains_completions_p ())
|
||||
{
|
||||
WINDOW *next;
|
||||
int pagetop, start, end, amount;
|
||||
int pagetop = 0;
|
||||
int start = 0;
|
||||
int end = 0;
|
||||
int amount = 0;
|
||||
|
||||
next = compwin->next;
|
||||
if (next)
|
||||
@ -156,8 +160,7 @@ restore_calling_window ()
|
||||
|
||||
/* Set up a new input line with PROMPT. */
|
||||
static void
|
||||
initialize_input_line (prompt)
|
||||
char *prompt;
|
||||
initialize_input_line (char *prompt)
|
||||
{
|
||||
input_line_prompt = prompt;
|
||||
if (prompt)
|
||||
@ -169,7 +172,7 @@ initialize_input_line (prompt)
|
||||
}
|
||||
|
||||
static char *
|
||||
echo_area_after_read ()
|
||||
echo_area_after_read (void)
|
||||
{
|
||||
char *return_value;
|
||||
|
||||
@ -198,9 +201,7 @@ echo_area_after_read ()
|
||||
active window, so that we can restore it when we need to. PROMPT, if
|
||||
non-null, is a prompt to print before reading the line. */
|
||||
char *
|
||||
info_read_in_echo_area (window, prompt)
|
||||
WINDOW *window;
|
||||
char *prompt;
|
||||
info_read_in_echo_area (WINDOW *window, char *prompt)
|
||||
{
|
||||
char *line;
|
||||
|
||||
@ -246,11 +247,11 @@ info_read_in_echo_area (window, prompt)
|
||||
|
||||
/* (re) Initialize the echo area node. */
|
||||
static void
|
||||
echo_area_initialize_node ()
|
||||
echo_area_initialize_node (void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = input_line_end; i < sizeof (input_line); i++)
|
||||
for (i = input_line_end; (unsigned int) i < sizeof (input_line); i++)
|
||||
input_line[i] = ' ';
|
||||
|
||||
input_line[i - 1] = '\n';
|
||||
@ -262,7 +263,7 @@ echo_area_initialize_node ()
|
||||
echo area node, but its primary purpose is to side effect the input
|
||||
line buffer contents. */
|
||||
void
|
||||
echo_area_prep_read ()
|
||||
echo_area_prep_read (void)
|
||||
{
|
||||
if (the_echo_area->node != &input_line_node)
|
||||
echo_area_initialize_node ();
|
||||
@ -559,7 +560,7 @@ DECLARE_INFO_COMMAND (ea_yank, _("Yank back the contents of the last kill"))
|
||||
|
||||
if (!kill_ring_index)
|
||||
{
|
||||
inform_in_echo_area (_("Kill ring is empty"));
|
||||
inform_in_echo_area ((char *) _("Kill ring is empty"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -576,8 +577,8 @@ DECLARE_INFO_COMMAND (ea_yank_pop, _("Yank back a previous kill"))
|
||||
{
|
||||
register int len;
|
||||
|
||||
if (((ea_last_executed_command != ea_yank) &&
|
||||
(ea_last_executed_command != ea_yank_pop)) ||
|
||||
if (((ea_last_executed_command != (VFunction *) ea_yank) &&
|
||||
(ea_last_executed_command != (VFunction *) ea_yank_pop)) ||
|
||||
(kill_ring_index == 0))
|
||||
return;
|
||||
|
||||
@ -670,8 +671,7 @@ DECLARE_INFO_COMMAND (ea_backward_kill_word,
|
||||
otherwise it is prepended. If the last command was not a kill command,
|
||||
then a new slot is made for this kill. */
|
||||
static void
|
||||
ea_kill_text (from, to)
|
||||
int from, to;
|
||||
ea_kill_text (int from, int to)
|
||||
{
|
||||
register int i, counter, distance;
|
||||
int killing_backwards, slot;
|
||||
@ -776,7 +776,7 @@ static int completions_found_slots = 0;
|
||||
static REFERENCE *LCD_completion;
|
||||
|
||||
/* Internal functions used by the user calls. */
|
||||
static void build_completions (), completions_must_be_rebuilt ();
|
||||
static void build_completions (void), completions_must_be_rebuilt (void);
|
||||
|
||||
/* Variable which holds the output of completions. */
|
||||
static NODE *possible_completions_output_node = (NODE *)NULL;
|
||||
@ -785,8 +785,7 @@ static char *compwin_name = "*Completions*";
|
||||
|
||||
/* Return non-zero if WINDOW is a window used for completions output. */
|
||||
static int
|
||||
completions_window_p (window)
|
||||
WINDOW *window;
|
||||
completions_window_p (WINDOW *window)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
@ -800,11 +799,8 @@ completions_window_p (window)
|
||||
/* Workhorse for completion readers. If FORCE is non-zero, the user cannot
|
||||
exit unless the line read completes, or is empty. */
|
||||
char *
|
||||
info_read_completing_internal (window, prompt, completions, force)
|
||||
WINDOW *window;
|
||||
char *prompt;
|
||||
REFERENCE **completions;
|
||||
int force;
|
||||
info_read_completing_internal (WINDOW *window, char *prompt,
|
||||
REFERENCE **completions, int force)
|
||||
{
|
||||
char *line;
|
||||
|
||||
@ -869,9 +865,9 @@ info_read_completing_internal (window, prompt, completions, force)
|
||||
if (i == completions_found_index)
|
||||
{
|
||||
if (!completions_found_index)
|
||||
inform_in_echo_area (_("No completions"));
|
||||
inform_in_echo_area ((char *) _("No completions"));
|
||||
else
|
||||
inform_in_echo_area (_("Not complete"));
|
||||
inform_in_echo_area ((char *) _("Not complete"));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -897,10 +893,8 @@ info_read_completing_internal (window, prompt, completions, force)
|
||||
|
||||
/* Read a line in the echo area with completion over COMPLETIONS. */
|
||||
char *
|
||||
info_read_completing_in_echo_area (window, prompt, completions)
|
||||
WINDOW *window;
|
||||
char *prompt;
|
||||
REFERENCE **completions;
|
||||
info_read_completing_in_echo_area (WINDOW *window,
|
||||
char *prompt, REFERENCE **completions)
|
||||
{
|
||||
return (info_read_completing_internal (window, prompt, completions, 1));
|
||||
}
|
||||
@ -908,10 +902,8 @@ info_read_completing_in_echo_area (window, prompt, completions)
|
||||
/* Read a line in the echo area allowing completion over COMPLETIONS, but
|
||||
not requiring it. */
|
||||
char *
|
||||
info_read_maybe_completing (window, prompt, completions)
|
||||
WINDOW *window;
|
||||
char *prompt;
|
||||
REFERENCE **completions;
|
||||
info_read_maybe_completing (WINDOW *window,
|
||||
char *prompt, REFERENCE **completions)
|
||||
{
|
||||
return (info_read_completing_internal (window, prompt, completions, 0));
|
||||
}
|
||||
@ -929,22 +921,23 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions"))
|
||||
if (!completions_found_index)
|
||||
{
|
||||
terminal_ring_bell ();
|
||||
inform_in_echo_area (_("No completions"));
|
||||
inform_in_echo_area ((char *) _("No completions"));
|
||||
}
|
||||
else if ((completions_found_index == 1) && (key != '?'))
|
||||
{
|
||||
inform_in_echo_area (_("Sole completion"));
|
||||
inform_in_echo_area ((char *) _("Sole completion"));
|
||||
}
|
||||
else
|
||||
{
|
||||
register int i, l;
|
||||
int limit, count, max_label = 0;
|
||||
int limit, iterations, max_label = 0;
|
||||
|
||||
initialize_message_buffer ();
|
||||
printf_to_message_buffer (completions_found_index == 1
|
||||
? _("One completion:\n")
|
||||
: _("%d completions:\n"),
|
||||
completions_found_index);
|
||||
? (char *) _("One completion:\n")
|
||||
: (char *) _("%d completions:\n"),
|
||||
(void *) (long) completions_found_index,
|
||||
NULL, NULL);
|
||||
|
||||
/* Find the maximum length of a label. */
|
||||
for (i = 0; i < completions_found_index; i++)
|
||||
@ -967,15 +960,15 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions"))
|
||||
limit = 1;
|
||||
|
||||
/* How many iterations of the printing loop? */
|
||||
count = (completions_found_index + (limit - 1)) / limit;
|
||||
iterations = (completions_found_index + (limit - 1)) / limit;
|
||||
|
||||
/* Watch out for special case. If the number of completions is less
|
||||
than LIMIT, then just do the inner printing loop. */
|
||||
if (completions_found_index < limit)
|
||||
count = 1;
|
||||
iterations = 1;
|
||||
|
||||
/* Print the sorted items, up-and-down alphabetically. */
|
||||
for (i = 0; i < count; i++)
|
||||
for (i = 0; i < iterations; i++)
|
||||
{
|
||||
register int j;
|
||||
|
||||
@ -990,17 +983,17 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions"))
|
||||
|
||||
label = completions_found[l]->label;
|
||||
printed_length = strlen (label);
|
||||
printf_to_message_buffer ("%s", label);
|
||||
printf_to_message_buffer ("%s", label, NULL, NULL);
|
||||
|
||||
if (j + 1 < limit)
|
||||
{
|
||||
for (k = 0; k < max_label - printed_length; k++)
|
||||
printf_to_message_buffer (" ");
|
||||
printf_to_message_buffer (" ", NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
l += count;
|
||||
l += iterations;
|
||||
}
|
||||
printf_to_message_buffer ("\n");
|
||||
printf_to_message_buffer ("\n", NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/* Make a new node to hold onto possible completions. Don't destroy
|
||||
@ -1028,7 +1021,7 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions"))
|
||||
{
|
||||
/* If we can split the window to display most of the completion
|
||||
items, then do so. */
|
||||
if (calling_window->height > (count * 2)
|
||||
if (calling_window->height > (iterations * 2)
|
||||
&& calling_window->height / 2 >= WINDOW_MIN_SIZE)
|
||||
{
|
||||
int start, pagetop;
|
||||
@ -1046,7 +1039,7 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions"))
|
||||
window_make_window (possible_completions_output_node);
|
||||
active_window = the_echo_area;
|
||||
window_change_window_height
|
||||
(compwin, -(compwin->height - (count + 2)));
|
||||
(compwin, -(compwin->height - (iterations + 2)));
|
||||
|
||||
window_adjust_pagetop (calling_window);
|
||||
remember_calling_window (calling_window);
|
||||
@ -1105,7 +1098,7 @@ DECLARE_INFO_COMMAND (ea_complete, _("Insert completion"))
|
||||
return;
|
||||
}
|
||||
|
||||
if (ea_last_executed_command == ea_complete)
|
||||
if (ea_last_executed_command == (VFunction *) ea_complete)
|
||||
{
|
||||
/* If the keypress is a SPC character, and we have already tried
|
||||
completing once, and there are several completions, then check
|
||||
@ -1153,9 +1146,11 @@ DECLARE_INFO_COMMAND (ea_complete, _("Insert completion"))
|
||||
}
|
||||
|
||||
/* Utility REFERENCE used to store possible LCD. */
|
||||
static REFERENCE LCD_reference = { (char *)NULL, (char *)NULL, (char *)NULL };
|
||||
static REFERENCE LCD_reference = {
|
||||
(char *)NULL, (char *)NULL, (char *)NULL, 0, 0, 0
|
||||
};
|
||||
|
||||
static void remove_completion_duplicates ();
|
||||
static void remove_completion_duplicates (void);
|
||||
|
||||
/* Variables which remember the state of the most recent call
|
||||
to build_completions (). */
|
||||
@ -1164,7 +1159,7 @@ static REFERENCE **last_completion_items = (REFERENCE **)NULL;
|
||||
|
||||
/* How to tell the completion builder to reset internal state. */
|
||||
static void
|
||||
completions_must_be_rebuilt ()
|
||||
completions_must_be_rebuilt (void)
|
||||
{
|
||||
maybe_free (last_completion_request);
|
||||
last_completion_request = (char *)NULL;
|
||||
@ -1174,7 +1169,7 @@ completions_must_be_rebuilt ()
|
||||
/* Build a list of possible completions from echo_area_completion_items,
|
||||
and the contents of input_line. */
|
||||
static void
|
||||
build_completions ()
|
||||
build_completions (void)
|
||||
{
|
||||
register int i, len;
|
||||
register REFERENCE *entry;
|
||||
@ -1222,7 +1217,8 @@ build_completions ()
|
||||
if (!informed_of_lengthy_job && completions_found_index > 100)
|
||||
{
|
||||
informed_of_lengthy_job = 1;
|
||||
window_message_in_echo_area (_("Building completions..."));
|
||||
window_message_in_echo_area ((char *) _("Building completions..."),
|
||||
NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1291,15 +1287,17 @@ build_completions ()
|
||||
|
||||
/* Function called by qsort. */
|
||||
static int
|
||||
compare_references (entry1, entry2)
|
||||
REFERENCE **entry1, **entry2;
|
||||
compare_references (const void *entry1, const void *entry2)
|
||||
{
|
||||
return (strcasecmp ((*entry1)->label, (*entry2)->label));
|
||||
REFERENCE **e1 = (REFERENCE **) entry1;
|
||||
REFERENCE **e2 = (REFERENCE **) entry2;
|
||||
|
||||
return (strcasecmp ((*e1)->label, (*e2)->label));
|
||||
}
|
||||
|
||||
/* Prune duplicate entries from COMPLETIONS_FOUND. */
|
||||
static void
|
||||
remove_completion_duplicates ()
|
||||
remove_completion_duplicates (void)
|
||||
{
|
||||
register int i, j;
|
||||
REFERENCE **temp;
|
||||
@ -1359,8 +1357,7 @@ DECLARE_INFO_COMMAND (ea_scroll_completions_window, _("Scroll the completions wi
|
||||
/* Function which gets called when an Info window is deleted while the
|
||||
echo area is active. WINDOW is the window which has just been deleted. */
|
||||
void
|
||||
echo_area_inform_of_deleted_window (window)
|
||||
WINDOW *window;
|
||||
echo_area_inform_of_deleted_window (WINDOW *window)
|
||||
{
|
||||
/* If this is the calling_window, forget what we remembered about it. */
|
||||
if (window == calling_window)
|
||||
@ -1400,7 +1397,7 @@ static int pushed_echo_areas_slots = 0;
|
||||
|
||||
/* Pushing the echo_area has a side effect of zeroing the completion_items. */
|
||||
static void
|
||||
push_echo_area ()
|
||||
push_echo_area (void)
|
||||
{
|
||||
PUSHED_EA *pushed;
|
||||
|
||||
@ -1422,7 +1419,7 @@ push_echo_area ()
|
||||
}
|
||||
|
||||
static void
|
||||
pop_echo_area ()
|
||||
pop_echo_area (void)
|
||||
{
|
||||
PUSHED_EA *popped;
|
||||
|
||||
@ -1460,7 +1457,7 @@ pop_echo_area ()
|
||||
/* Returns non-zero if any of the prior stacked calls to read in the echo
|
||||
area produced a completions window. */
|
||||
static int
|
||||
echo_area_stack_contains_completions_p ()
|
||||
echo_area_stack_contains_completions_p (void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@ -1483,7 +1480,7 @@ echo_area_stack_contains_completions_p ()
|
||||
#endif /* HAVE_SYS_TIME_H */
|
||||
|
||||
static void
|
||||
pause_or_input ()
|
||||
pause_or_input (void)
|
||||
{
|
||||
#ifdef FD_SET
|
||||
struct timeval timer;
|
||||
@ -1503,14 +1500,14 @@ pause_or_input ()
|
||||
for input or a couple of seconds, whichever comes first. Then flush the
|
||||
informational message that was printed. */
|
||||
void
|
||||
inform_in_echo_area (message)
|
||||
char *message;
|
||||
inform_in_echo_area (const char *message)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
char *text;
|
||||
int avail = EA_MAX_INPUT + 1 - input_line_end;
|
||||
|
||||
text = xstrdup (message);
|
||||
for (i = 0; text[i] && text[i] != '\n'; i++)
|
||||
for (i = 0; text[i] && text[i] != '\n' && i < avail; i++)
|
||||
;
|
||||
text[i] = 0;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* echo-area.h -- Functions used in reading information from the echo area.
|
||||
$Id: echo-area.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: echo-area.h,v 1.4 2004/08/07 22:03:08 karl Exp $
|
||||
|
||||
This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993, 97 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 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
|
||||
@ -33,32 +33,53 @@ extern int echo_area_is_active, info_aborted_echo_area;
|
||||
killed some text. */
|
||||
extern int echo_area_last_command_was_kill;
|
||||
|
||||
extern void inform_in_echo_area (), echo_area_inform_of_deleted_window ();
|
||||
extern void echo_area_prep_read ();
|
||||
extern void inform_in_echo_area (const char *message);
|
||||
extern void echo_area_inform_of_deleted_window (WINDOW *window);
|
||||
extern void echo_area_prep_read (void);
|
||||
extern VFunction *ea_last_executed_command;
|
||||
extern char * info_read_completing_internal (WINDOW *window, char *prompt,
|
||||
REFERENCE **completions, int force);
|
||||
|
||||
/* Read a line of text in the echo area. Return a malloc ()'ed string,
|
||||
or NULL if the user aborted out of this read. WINDOW is the currently
|
||||
active window, so that we can restore it when we need to. PROMPT, if
|
||||
non-null, is a prompt to print before reading the line. */
|
||||
extern char *info_read_in_echo_area ();
|
||||
extern char *info_read_in_echo_area (WINDOW *window, char *prompt);
|
||||
|
||||
/* Read a line in the echo area with completion over COMPLETIONS.
|
||||
Takes arguments of WINDOW, PROMPT, and COMPLETIONS, a REFERENCE **. */
|
||||
char *info_read_completing_in_echo_area ();
|
||||
char *info_read_completing_in_echo_area (WINDOW *window,
|
||||
char *prompt, REFERENCE **completions);
|
||||
|
||||
/* Read a line in the echo area allowing completion over COMPLETIONS, but
|
||||
not requiring it. Takes arguments of WINDOW, PROMPT, and COMPLETIONS,
|
||||
a REFERENCE **. */
|
||||
extern char *info_read_maybe_completing ();
|
||||
extern char *info_read_maybe_completing (WINDOW *window,
|
||||
char *prompt, REFERENCE **completions);
|
||||
|
||||
extern void ea_insert (), ea_quoted_insert ();
|
||||
extern void ea_beg_of_line (), ea_backward (), ea_delete (), ea_end_of_line ();
|
||||
extern void ea_forward (), ea_abort (), ea_rubout (), ea_complete ();
|
||||
extern void ea_newline (), ea_kill_line (), ea_transpose_chars ();
|
||||
extern void ea_yank (), ea_tab_insert (), ea_possible_completions ();
|
||||
extern void ea_backward_word (), ea_kill_word (), ea_forward_word ();
|
||||
extern void ea_yank_pop (), ea_backward_kill_word ();
|
||||
extern void ea_scroll_completions_window ();
|
||||
extern void ea_insert (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_quoted_insert (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_beg_of_line (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_backward (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_delete (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_end_of_line (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_forward (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_abort (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_rubout (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_complete (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_newline (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_kill_line (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_backward_kill_line (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_transpose_chars (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_yank (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_tab_insert (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_possible_completions (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_backward_word (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_kill_word (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_forward_word (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_yank_pop (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_backward_kill_word (WINDOW *window, int count, unsigned char key);
|
||||
extern void ea_scroll_completions_window (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
|
||||
#endif /* not INFO_ECHO_AREA_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* filesys.c -- filesystem specific functions.
|
||||
$Id: filesys.c,v 1.3 2003/01/31 19:18:11 karl Exp $
|
||||
$Id: filesys.c,v 1.6 2004/07/30 17:17:40 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 2000, 2002, 2003 Free Software
|
||||
Copyright (C) 1993, 1997, 1998, 2000, 2002, 2003, 2004 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -26,9 +26,12 @@
|
||||
#include "filesys.h"
|
||||
|
||||
/* Local to this file. */
|
||||
static char *info_file_in_path (), *lookup_info_filename ();
|
||||
static char *info_absolute_file ();
|
||||
static void remember_info_filename (), maybe_initialize_infopath ();
|
||||
static char *info_file_in_path (char *filename, char *path);
|
||||
static char *lookup_info_filename (char *filename);
|
||||
static char *info_absolute_file (char *fname);
|
||||
|
||||
static void remember_info_filename (char *filename, char *expansion);
|
||||
static void maybe_initialize_infopath (void);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -77,8 +80,7 @@ static char *local_temp_filename = (char *)NULL;
|
||||
static int local_temp_filename_size = 0;
|
||||
|
||||
char *
|
||||
info_find_fullpath (partial)
|
||||
char *partial;
|
||||
info_find_fullpath (char *partial)
|
||||
{
|
||||
int initial_character;
|
||||
char *temp;
|
||||
@ -141,7 +143,7 @@ info_find_fullpath (partial)
|
||||
if (temp)
|
||||
{
|
||||
remember_info_filename (partial, temp);
|
||||
if (strlen (temp) > local_temp_filename_size)
|
||||
if (strlen (temp) > (unsigned int) local_temp_filename_size)
|
||||
local_temp_filename = (char *) xrealloc
|
||||
(local_temp_filename,
|
||||
(local_temp_filename_size = (50 + strlen (temp))));
|
||||
@ -157,8 +159,7 @@ info_find_fullpath (partial)
|
||||
one that is a regular file, return it as a new string. Otherwise, return
|
||||
a NULL pointer. */
|
||||
static char *
|
||||
info_file_in_path (filename, path)
|
||||
char *filename, *path;
|
||||
info_file_in_path (char *filename, char *path)
|
||||
{
|
||||
struct stat finfo;
|
||||
char *temp_dirname;
|
||||
@ -255,8 +256,7 @@ info_file_in_path (filename, path)
|
||||
return a NULL pointer. We do it by taking the file name apart
|
||||
into its directory and basename parts, and calling info_file_in_path.*/
|
||||
static char *
|
||||
info_absolute_file (fname)
|
||||
char *fname;
|
||||
info_absolute_file (char *fname)
|
||||
{
|
||||
char *containing_dir = xstrdup (fname);
|
||||
char *base = filename_non_directory (containing_dir);
|
||||
@ -273,23 +273,21 @@ info_absolute_file (fname)
|
||||
are no more. Advance IDX to the character after the colon. */
|
||||
|
||||
char *
|
||||
extract_colon_unit (string, idx)
|
||||
char *string;
|
||||
int *idx;
|
||||
extract_colon_unit (char *string, int *idx)
|
||||
{
|
||||
int i = *idx;
|
||||
int start = *idx;
|
||||
unsigned int i = (unsigned int) *idx;
|
||||
unsigned int start = i;
|
||||
|
||||
if (!string || i >= strlen (string))
|
||||
return NULL;
|
||||
|
||||
if (!string[i]) /* end of string */
|
||||
return NULL;
|
||||
|
||||
/* Advance to next PATH_SEP. */
|
||||
while (string[i] && string[i] != PATH_SEP[0])
|
||||
i++;
|
||||
|
||||
if (!string[i] && i == start) /* end of string, and didn't advance */
|
||||
return NULL;
|
||||
|
||||
{
|
||||
char *value = xmalloc ((i - start) + 1);
|
||||
strncpy (value, &string[start], (i - start));
|
||||
@ -316,8 +314,7 @@ static int names_and_files_slots = 0;
|
||||
/* Find the result for having already called info_find_fullpath () with
|
||||
FILENAME. */
|
||||
static char *
|
||||
lookup_info_filename (filename)
|
||||
char *filename;
|
||||
lookup_info_filename (char *filename)
|
||||
{
|
||||
if (filename && names_and_files)
|
||||
{
|
||||
@ -333,8 +330,7 @@ lookup_info_filename (filename)
|
||||
|
||||
/* Add a filename and its expansion to our list. */
|
||||
static void
|
||||
remember_info_filename (filename, expansion)
|
||||
char *filename, *expansion;
|
||||
remember_info_filename (char *filename, char *expansion)
|
||||
{
|
||||
FILENAME_LIST *new;
|
||||
|
||||
@ -358,7 +354,7 @@ remember_info_filename (filename, expansion)
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_initialize_infopath ()
|
||||
maybe_initialize_infopath (void)
|
||||
{
|
||||
if (!infopath_size)
|
||||
{
|
||||
@ -372,9 +368,7 @@ maybe_initialize_infopath ()
|
||||
/* Add PATH to the list of paths found in INFOPATH. 2nd argument says
|
||||
whether to put PATH at the front or end of INFOPATH. */
|
||||
void
|
||||
info_add_path (path, where)
|
||||
char *path;
|
||||
int where;
|
||||
info_add_path (char *path, int where)
|
||||
{
|
||||
int len;
|
||||
|
||||
@ -408,7 +402,7 @@ info_add_path (path, where)
|
||||
|
||||
/* Make INFOPATH have absolutely nothing in it. */
|
||||
void
|
||||
zap_infopath ()
|
||||
zap_infopath (void)
|
||||
{
|
||||
if (infopath)
|
||||
free (infopath);
|
||||
@ -433,9 +427,7 @@ zap_infopath ()
|
||||
|
||||
FIXME: is it a good idea to show the EOL type on the modeline? */
|
||||
long
|
||||
convert_eols (text, textlen)
|
||||
char *text;
|
||||
long textlen;
|
||||
convert_eols (char *text, long int textlen)
|
||||
{
|
||||
register char *s = text;
|
||||
register char *d = text;
|
||||
@ -459,11 +451,8 @@ convert_eols (text, textlen)
|
||||
If the file turns out to be compressed, set IS_COMPRESSED to non-zero.
|
||||
If the file cannot be read, return a NULL pointer. */
|
||||
char *
|
||||
filesys_read_info_file (pathname, filesize, finfo, is_compressed)
|
||||
char *pathname;
|
||||
long *filesize;
|
||||
struct stat *finfo;
|
||||
int *is_compressed;
|
||||
filesys_read_info_file (char *pathname, long int *filesize,
|
||||
struct stat *finfo, int *is_compressed)
|
||||
{
|
||||
long st_size;
|
||||
|
||||
@ -472,7 +461,7 @@ filesys_read_info_file (pathname, filesize, finfo, is_compressed)
|
||||
if (compressed_filename_p (pathname))
|
||||
{
|
||||
*is_compressed = 1;
|
||||
return (filesys_read_compressed (pathname, filesize, finfo));
|
||||
return (filesys_read_compressed (pathname, filesize));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -524,10 +513,7 @@ filesys_read_info_file (pathname, filesize, finfo, is_compressed)
|
||||
#define FILESYS_PIPE_BUFFER_SIZE (16 * BASIC_PIPE_BUFFER)
|
||||
|
||||
char *
|
||||
filesys_read_compressed (pathname, filesize, finfo)
|
||||
char *pathname;
|
||||
long *filesize;
|
||||
struct stat *finfo;
|
||||
filesys_read_compressed (char *pathname, long int *filesize)
|
||||
{
|
||||
FILE *stream;
|
||||
char *command, *decompressor;
|
||||
@ -553,7 +539,7 @@ filesys_read_compressed (pathname, filesize, finfo)
|
||||
|
||||
temp = (char *)xmalloc (5 + strlen (command));
|
||||
sprintf (temp, "%s...", command);
|
||||
message_in_echo_area ("%s", temp);
|
||||
message_in_echo_area ("%s", temp, NULL);
|
||||
free (temp);
|
||||
}
|
||||
#endif /* !BUILDING_LIBRARY */
|
||||
@ -615,8 +601,7 @@ filesys_read_compressed (pathname, filesize, finfo)
|
||||
|
||||
/* Return non-zero if FILENAME belongs to a compressed file. */
|
||||
int
|
||||
compressed_filename_p (filename)
|
||||
char *filename;
|
||||
compressed_filename_p (char *filename)
|
||||
{
|
||||
char *decompressor;
|
||||
|
||||
@ -632,8 +617,7 @@ compressed_filename_p (filename)
|
||||
|
||||
/* Return the command string that would be used to decompress FILENAME. */
|
||||
char *
|
||||
filesys_decompressor_for_file (filename)
|
||||
char *filename;
|
||||
filesys_decompressor_for_file (char *filename)
|
||||
{
|
||||
register int i;
|
||||
char *extension = (char *)NULL;
|
||||
@ -676,9 +660,7 @@ static char *errmsg_buf = (char *)NULL;
|
||||
static int errmsg_buf_size = 0;
|
||||
|
||||
char *
|
||||
filesys_error_string (filename, error_num)
|
||||
char *filename;
|
||||
int error_num;
|
||||
filesys_error_string (char *filename, int error_num)
|
||||
{
|
||||
int len;
|
||||
char *result;
|
||||
@ -701,8 +683,7 @@ filesys_error_string (filename, error_num)
|
||||
in combination. */
|
||||
|
||||
int
|
||||
is_dir_name (filename)
|
||||
char *filename;
|
||||
is_dir_name (char *filename)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* filesys.h -- external declarations for filesys.c.
|
||||
$Id: filesys.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: filesys.h,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 1998, 2002, 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
|
||||
@ -28,11 +28,11 @@
|
||||
extern char *infopath;
|
||||
|
||||
/* Make INFOPATH have absolutely nothing in it. */
|
||||
extern void zap_infopath ();
|
||||
extern void zap_infopath (void);
|
||||
|
||||
/* Add PATH to the list of paths found in INFOPATH. 2nd argument says
|
||||
whether to put PATH at the front or end of INFOPATH. */
|
||||
extern void info_add_path ();
|
||||
extern void info_add_path (char *path, int where);
|
||||
|
||||
/* Defines that are passed along with the pathname to info_add_path (). */
|
||||
#define INFOPATH_PREPEND 0
|
||||
@ -41,27 +41,29 @@ extern void info_add_path ();
|
||||
/* Expand the filename in PARTIAL to make a real name for this operating
|
||||
system. This looks in INFO_PATHS in order to find the correct file.
|
||||
If it can't find the file, it returns NULL. */
|
||||
extern char *info_find_fullpath ();
|
||||
extern char *info_find_fullpath (char *partial);
|
||||
|
||||
/* Given a chunk of text and its length, convert all CRLF pairs at the
|
||||
EOLs into a single Newline character. Return the length of produced
|
||||
text. */
|
||||
long convert_eols ();
|
||||
long convert_eols (char *text, long textlen);
|
||||
|
||||
/* Read the contents of PATHNAME, returning a buffer with the contents of
|
||||
that file in it, and returning the size of that buffer in FILESIZE.
|
||||
FINFO is a stat struct which has already been filled in by the caller.
|
||||
If the file cannot be read, return a NULL pointer. */
|
||||
extern char *filesys_read_info_file ();
|
||||
extern char *filesys_read_compressed ();
|
||||
extern char *filesys_read_info_file (char *pathname, long int *filesize,
|
||||
struct stat *finfo, int *is_compressed);
|
||||
|
||||
extern char *filesys_read_compressed (char *pathname, long int *filesize);
|
||||
|
||||
/* Return the command string that would be used to decompress FILENAME. */
|
||||
extern char *filesys_decompressor_for_file ();
|
||||
extern int compressed_filename_p ();
|
||||
extern char *filesys_decompressor_for_file (char *filename);
|
||||
extern int compressed_filename_p (char *filename);
|
||||
|
||||
/* A function which returns a pointer to a static buffer containing
|
||||
an error message for FILENAME and ERROR_NUM. */
|
||||
extern char *filesys_error_string ();
|
||||
extern char *filesys_error_string (char *filename, int error_num);
|
||||
|
||||
/* The number of the most recent file system error. */
|
||||
extern int filesys_error_number;
|
||||
@ -69,10 +71,10 @@ extern int filesys_error_number;
|
||||
/* Given a string containing units of information separated by colons,
|
||||
return the next one pointed to by IDX, or NULL if there are no more.
|
||||
Advance IDX to the character after the colon. */
|
||||
extern char *extract_colon_unit ();
|
||||
extern char *extract_colon_unit (char *string, int *idx);
|
||||
|
||||
/* Return true if FILENAME is `dir', with a possible compression suffix. */
|
||||
extern int is_dir_name ();
|
||||
extern int is_dir_name (char *filename);
|
||||
|
||||
/* The default value of INFOPATH. */
|
||||
#if !defined (DEFAULT_INFOPATH)
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* footnotes.c -- Some functions for manipulating footnotes.
|
||||
$Id: footnotes.c,v 1.2 2002/11/06 00:41:17 karl Exp $
|
||||
$Id: footnotes.c,v 1.4 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 1998, 1999, 2002, 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
|
||||
@ -17,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.
|
||||
|
||||
Written by Brian Fox (bfox@ai.mit.edu). */
|
||||
Originally written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
|
||||
@ -26,12 +27,14 @@ int auto_footnotes_p = 0;
|
||||
|
||||
static char *footnote_nodename = "*Footnotes*";
|
||||
|
||||
NODE * make_footnotes_node (NODE *node);
|
||||
|
||||
#define FOOTNOTE_HEADER_FORMAT \
|
||||
"*** Footnotes appearing in the node \"%s\" ***\n"
|
||||
"*** Footnotes appearing in the node `%s' ***\n"
|
||||
|
||||
/* Find the window currently showing footnotes. */
|
||||
static WINDOW *
|
||||
find_footnotes_window ()
|
||||
find_footnotes_window (void)
|
||||
{
|
||||
WINDOW *win;
|
||||
|
||||
@ -48,8 +51,7 @@ find_footnotes_window ()
|
||||
return the manufactured node. If NODE has no footnotes, return a
|
||||
NULL pointer. */
|
||||
NODE *
|
||||
make_footnotes_node (node)
|
||||
NODE *node;
|
||||
make_footnotes_node (NODE *node)
|
||||
{
|
||||
NODE *fn_node, *result = (NODE *)NULL;
|
||||
long fn_start;
|
||||
@ -160,8 +162,7 @@ make_footnotes_node (node)
|
||||
in WINDOW's node. Returns FN_UNABLE if there were footnotes, but the
|
||||
window to show them couldn't be made. */
|
||||
int
|
||||
info_get_or_remove_footnotes (window)
|
||||
WINDOW *window;
|
||||
info_get_or_remove_footnotes (WINDOW *window)
|
||||
{
|
||||
WINDOW *fn_win;
|
||||
NODE *new_footnotes;
|
||||
@ -209,7 +210,7 @@ info_get_or_remove_footnotes (window)
|
||||
/* If we are hacking automatic footnotes, and there are footnotes
|
||||
but we couldn't display them, print a message to that effect. */
|
||||
if (auto_footnotes_p)
|
||||
inform_in_echo_area (_("Footnotes could not be displayed"));
|
||||
inform_in_echo_area ((char *) _("Footnotes could not be displayed"));
|
||||
return (FN_UNABLE);
|
||||
}
|
||||
}
|
||||
@ -256,11 +257,11 @@ DECLARE_INFO_COMMAND (info_show_footnotes,
|
||||
switch (result)
|
||||
{
|
||||
case FN_UNFOUND:
|
||||
info_error (msg_no_foot_node);
|
||||
info_error ((char *) msg_no_foot_node, NULL, NULL);
|
||||
break;
|
||||
|
||||
case FN_UNABLE:
|
||||
info_error (msg_win_too_small);
|
||||
info_error ((char *) msg_win_too_small, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* footnotes.h -- Some functions for manipulating footnotes.
|
||||
$Id: footnotes.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: footnotes.h,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 1998, 2002, 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
|
||||
@ -35,7 +35,7 @@
|
||||
and displayed. Returns FN_UNFOUND if there were no footnotes found
|
||||
in WINDOW's node. Returns FN_UNABLE if there were footnotes, but the
|
||||
window to show them couldn't be made. */
|
||||
extern int info_get_or_remove_footnotes ();
|
||||
extern int info_get_or_remove_footnotes (WINDOW *window);
|
||||
|
||||
/* Non-zero means attempt to show footnotes when displaying a new window. */
|
||||
extern int auto_footnotes_p;
|
||||
|
@ -1,9 +1,7 @@
|
||||
/* gc.c -- Functions to remember and garbage collect unused node contents. */
|
||||
/* gc.c -- Functions to remember and garbage collect unused node contents.
|
||||
$Id: gc.c,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 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,8 +32,7 @@ static int gcable_pointers_slots = 0;
|
||||
is not actually garbage collected until no info window contains a node
|
||||
whose contents member is equal to the pointer. */
|
||||
void
|
||||
add_gcable_pointer (pointer)
|
||||
char *pointer;
|
||||
add_gcable_pointer (char *pointer)
|
||||
{
|
||||
gc_pointers ();
|
||||
add_pointer_to_array (pointer, gcable_pointers_index, gcable_pointers,
|
||||
@ -45,7 +42,7 @@ add_gcable_pointer (pointer)
|
||||
/* Grovel the list of info windows and gc-able pointers finding those
|
||||
node->contents which are collectible, and free them. */
|
||||
void
|
||||
gc_pointers ()
|
||||
gc_pointers (void)
|
||||
{
|
||||
register int i, j, k;
|
||||
INFO_WINDOW *iw;
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* gc.h -- Functions for garbage collecting unused node contents.
|
||||
$Id: gc.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: gc.h,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993, 97 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 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
|
||||
@ -28,10 +28,10 @@
|
||||
/* Add POINTER to the list of garbage collectible pointers. A pointer
|
||||
is not actually garbage collected until no info window contains a node
|
||||
whose contents member is equal to the pointer. */
|
||||
extern void add_gcable_pointer ();
|
||||
extern void add_gcable_pointer (char *pointer);
|
||||
|
||||
/* Grovel the list of info windows and gc-able pointers finding those
|
||||
node->contents which are collectible, and free them. */
|
||||
extern void gc_pointers ();
|
||||
extern void gc_pointers (void);
|
||||
|
||||
#endif /* not INFO_GC_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* indices.c -- deal with an Info file index.
|
||||
$Id: indices.c,v 1.2 2003/02/11 16:39:06 karl Exp $
|
||||
$Id: indices.c,v 1.5 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 1999, 2002, 2003 Free Software
|
||||
Copyright (C) 1993, 1997, 1998, 1999, 2002, 2003, 2004 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -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.
|
||||
|
||||
Written by Brian Fox (bfox@ai.mit.edu). */
|
||||
Originally written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "indices.h"
|
||||
@ -55,9 +55,7 @@ static int index_nodenames_slots = 0;
|
||||
/* Add the name of NODE, and the range of the associated index elements
|
||||
(passed in ARRAY) to index_nodenames. */
|
||||
static void
|
||||
add_index_to_index_nodenames (array, node)
|
||||
REFERENCE **array;
|
||||
NODE *node;
|
||||
add_index_to_index_nodenames (REFERENCE **array, NODE *node)
|
||||
{
|
||||
register int i, last;
|
||||
INDEX_NAME_ASSOC *assoc;
|
||||
@ -88,8 +86,7 @@ add_index_to_index_nodenames (array, node)
|
||||
indices are concatenated and the result returned. If WINDOW's info file
|
||||
doesn't have any indices, a NULL pointer is returned. */
|
||||
REFERENCE **
|
||||
info_indices_of_window (window)
|
||||
WINDOW *window;
|
||||
info_indices_of_window (WINDOW *window)
|
||||
{
|
||||
FILE_BUFFER *fb;
|
||||
|
||||
@ -99,8 +96,7 @@ info_indices_of_window (window)
|
||||
}
|
||||
|
||||
REFERENCE **
|
||||
info_indices_of_file_buffer (file_buffer)
|
||||
FILE_BUFFER *file_buffer;
|
||||
info_indices_of_file_buffer (FILE_BUFFER *file_buffer)
|
||||
{
|
||||
register int i;
|
||||
REFERENCE **result = (REFERENCE **)NULL;
|
||||
@ -181,10 +177,7 @@ DECLARE_INFO_COMMAND (info_index_search,
|
||||
/* Look up SEARCH_STRING in the index for this file. If SEARCH_STRING
|
||||
is NULL, prompt user for input. */
|
||||
void
|
||||
do_info_index_search (window, count, search_string)
|
||||
WINDOW *window;
|
||||
int count;
|
||||
char *search_string;
|
||||
do_info_index_search (WINDOW *window, int count, char *search_string)
|
||||
{
|
||||
FILE_BUFFER *fb;
|
||||
char *line;
|
||||
@ -203,14 +196,15 @@ do_info_index_search (window, count, search_string)
|
||||
(FILENAME_CMP (initial_index_filename, fb->filename) != 0))
|
||||
{
|
||||
info_free_references (index_index);
|
||||
window_message_in_echo_area (_("Finding index entries..."));
|
||||
window_message_in_echo_area ((char *) _("Finding index entries..."),
|
||||
NULL, NULL);
|
||||
index_index = info_indices_of_file_buffer (fb);
|
||||
}
|
||||
|
||||
/* If there is no index, quit now. */
|
||||
if (!index_index)
|
||||
{
|
||||
info_error (_("No indices found."));
|
||||
info_error ((char *) _("No indices found."), NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -220,7 +214,7 @@ do_info_index_search (window, count, search_string)
|
||||
line = xstrdup (search_string);
|
||||
else
|
||||
{
|
||||
line = info_read_maybe_completing (window, _("Index entry: "),
|
||||
line = info_read_maybe_completing (window, (char *) _("Index entry: "),
|
||||
index_index);
|
||||
window = active_window;
|
||||
|
||||
@ -283,9 +277,7 @@ do_info_index_search (window, count, search_string)
|
||||
}
|
||||
|
||||
int
|
||||
index_entry_exists (window, string)
|
||||
WINDOW *window;
|
||||
char *string;
|
||||
index_entry_exists (WINDOW *window, char *string)
|
||||
{
|
||||
register int i;
|
||||
FILE_BUFFER *fb;
|
||||
@ -340,14 +332,14 @@ DECLARE_INFO_COMMAND (info_next_index_match,
|
||||
yet. */
|
||||
if (!index_search)
|
||||
{
|
||||
info_error (_("No previous index search string."));
|
||||
info_error ((char *) _("No previous index search string."), NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If there is no index, that is an error. */
|
||||
if (!index_index)
|
||||
{
|
||||
info_error (_("No index entries."));
|
||||
info_error ((char *) _("No index entries."), NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -380,8 +372,8 @@ DECLARE_INFO_COMMAND (info_next_index_match,
|
||||
/* If that failed, print an error. */
|
||||
if ((i < 0) || (!index_index[i]))
|
||||
{
|
||||
info_error (_("No %sindex entries containing \"%s\"."),
|
||||
index_offset > 0 ? _("more ") : "", index_search);
|
||||
info_error ((char *) _("No %sindex entries containing `%s'."),
|
||||
index_offset > 0 ? (char *) _("more ") : "", index_search);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -410,26 +402,27 @@ DECLARE_INFO_COMMAND (info_next_index_match,
|
||||
|
||||
if (partial && show_index_match)
|
||||
{
|
||||
int j, ls, start, upper;
|
||||
int k, ls, start, upper;
|
||||
|
||||
ls = strlen (index_search);
|
||||
start = partial - ls;
|
||||
upper = isupper (match[start]) ? 1 : 0;
|
||||
|
||||
for (j = 0; j < ls; j++)
|
||||
for (k = 0; k < ls; k++)
|
||||
if (upper)
|
||||
match[j + start] = info_tolower (match[j + start]);
|
||||
match[k + start] = info_tolower (match[k + start]);
|
||||
else
|
||||
match[j + start] = info_toupper (match[j + start]);
|
||||
match[k + start] = info_toupper (match[k + start]);
|
||||
}
|
||||
|
||||
{
|
||||
char *format;
|
||||
|
||||
format = replace_in_documentation
|
||||
(_("Found \"%s\" in %s. (`\\[next-index-match]' tries to find next.)"));
|
||||
((char *) _("Found `%s' in %s. (`\\[next-index-match]' tries to find next.)"),
|
||||
0);
|
||||
|
||||
window_message_in_echo_area (format, match, name);
|
||||
window_message_in_echo_area (format, match, (char *) name);
|
||||
}
|
||||
|
||||
free (match);
|
||||
@ -440,7 +433,7 @@ DECLARE_INFO_COMMAND (info_next_index_match,
|
||||
|
||||
if (!node)
|
||||
{
|
||||
info_error (msg_cant_file_node,
|
||||
info_error ((char *) msg_cant_file_node,
|
||||
index_index[i]->filename, index_index[i]->nodename);
|
||||
return;
|
||||
}
|
||||
@ -471,9 +464,7 @@ DECLARE_INFO_COMMAND (info_next_index_match,
|
||||
/* For every menu item in DIR, search the indices of that file for
|
||||
SEARCH_STRING. */
|
||||
REFERENCE **
|
||||
apropos_in_all_indices (search_string, inform)
|
||||
char *search_string;
|
||||
int inform;
|
||||
apropos_in_all_indices (char *search_string, int inform)
|
||||
{
|
||||
register int i, dir_index;
|
||||
REFERENCE **all_indices = (REFERENCE **)NULL;
|
||||
@ -547,7 +538,8 @@ apropos_in_all_indices (search_string, inform)
|
||||
}
|
||||
|
||||
if (this_fb && inform)
|
||||
message_in_echo_area (_("Scanning indices of \"%s\"..."), files_name);
|
||||
message_in_echo_area ((char *) _("Scanning indices of `%s'..."),
|
||||
files_name, NULL);
|
||||
|
||||
this_index = info_indices_of_file_buffer (this_fb);
|
||||
free (this_node);
|
||||
@ -601,20 +593,17 @@ apropos_in_all_indices (search_string, inform)
|
||||
}
|
||||
|
||||
#define APROPOS_NONE \
|
||||
N_("No available info files have \"%s\" in their indices.")
|
||||
N_("No available info files have `%s' in their indices.")
|
||||
|
||||
void
|
||||
info_apropos (string)
|
||||
char *string;
|
||||
info_apropos (char *string)
|
||||
{
|
||||
REFERENCE **apropos_list;
|
||||
|
||||
apropos_list = apropos_in_all_indices (string, 0);
|
||||
|
||||
if (!apropos_list)
|
||||
{
|
||||
info_error (_(APROPOS_NONE), string);
|
||||
}
|
||||
info_error ((char *) _(APROPOS_NONE), string, NULL);
|
||||
else
|
||||
{
|
||||
register int i;
|
||||
@ -634,7 +623,7 @@ DECLARE_INFO_COMMAND (info_index_apropos,
|
||||
{
|
||||
char *line;
|
||||
|
||||
line = info_read_in_echo_area (window, _("Index apropos: "));
|
||||
line = info_read_in_echo_area (window, (char *) _("Index apropos: "));
|
||||
|
||||
window = active_window;
|
||||
|
||||
@ -654,9 +643,7 @@ DECLARE_INFO_COMMAND (info_index_apropos,
|
||||
apropos_list = apropos_in_all_indices (line, 1);
|
||||
|
||||
if (!apropos_list)
|
||||
{
|
||||
info_error (_(APROPOS_NONE), line);
|
||||
}
|
||||
info_error ((char *) _(APROPOS_NONE), line, NULL);
|
||||
else
|
||||
{
|
||||
register int i;
|
||||
@ -664,7 +651,8 @@ DECLARE_INFO_COMMAND (info_index_apropos,
|
||||
|
||||
initialize_message_buffer ();
|
||||
printf_to_message_buffer
|
||||
(_("\n* Menu: Nodes whoses indices contain \"%s\":\n"), line);
|
||||
((char *) _("\n* Menu: Nodes whose indices contain `%s':\n"),
|
||||
line, NULL, NULL);
|
||||
line_buffer = (char *)xmalloc (500);
|
||||
|
||||
for (i = 0; apropos_list[i]; i++)
|
||||
@ -678,7 +666,7 @@ DECLARE_INFO_COMMAND (info_index_apropos,
|
||||
len = pad_to (40, line_buffer);
|
||||
sprintf (line_buffer + len, "(%s)%s.",
|
||||
apropos_list[i]->filename, apropos_list[i]->nodename);
|
||||
printf_to_message_buffer ("%s\n", line_buffer);
|
||||
printf_to_message_buffer ("%s\n", line_buffer, NULL, NULL);
|
||||
}
|
||||
free (line_buffer);
|
||||
}
|
||||
@ -745,4 +733,3 @@ DECLARE_INFO_COMMAND (info_index_apropos,
|
||||
if (!info_error_was_printed)
|
||||
window_clear_echo_area ();
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* indices.h -- Functions defined in indices.c.
|
||||
$Id: indices.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: indices.h,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993, 97 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 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
|
||||
@ -28,15 +28,18 @@
|
||||
/* User-visible variable controls the output of info-index-next. */
|
||||
extern int show_index_match;
|
||||
|
||||
extern REFERENCE **info_indices_of_window (), **info_indices_of_file_buffer ();
|
||||
extern void info_apropos ();
|
||||
extern REFERENCE **info_indices_of_window (WINDOW *window);
|
||||
extern REFERENCE **info_indices_of_file_buffer (FILE_BUFFER *file_buffer);
|
||||
extern void info_apropos (char *string);
|
||||
|
||||
/* For every menu item in DIR, search the indices of that file for STRING. */
|
||||
REFERENCE **apropos_in_all_indices ();
|
||||
REFERENCE **apropos_in_all_indices (char *search_string, int inform);
|
||||
|
||||
/* User visible functions declared in indices.c. */
|
||||
extern void info_index_search (), info_next_index_match ();
|
||||
extern void do_info_index_search ();
|
||||
extern int index_intry_exists ();
|
||||
extern void info_index_search (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_next_index_match (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_index_apropos (WINDOW *window, int count, unsigned char key);
|
||||
extern void do_info_index_search (WINDOW *window, int count, char *search_string);
|
||||
extern int index_entry_exists (WINDOW *window, char *string);
|
||||
|
||||
#endif /* not INFO_INDICES_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* info-utils.c -- miscellanous.
|
||||
$Id: info-utils.c,v 1.2 2003/03/06 23:22:23 karl Exp $
|
||||
$Id: info-utils.c,v 1.4 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1998, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1998, 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
|
||||
@ -17,7 +17,7 @@
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
Originally written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "info-utils.h"
|
||||
@ -37,12 +37,19 @@ char *info_parsed_filename = (char *)NULL;
|
||||
calling info_parse_xxx (). */
|
||||
char *info_parsed_nodename = (char *)NULL;
|
||||
|
||||
/* Variable which holds the most recent line number parsed as a result of
|
||||
calling info_parse_xxx (). */
|
||||
int info_parsed_line_number = 0;
|
||||
|
||||
/* Functions to remember a filename or nodename for later return. */
|
||||
static void save_filename (), saven_filename ();
|
||||
static void save_nodename (), saven_nodename ();
|
||||
static void save_filename (char *filename);
|
||||
static void saven_filename (char *filename, int len);
|
||||
static void save_nodename (char *nodename);
|
||||
static void saven_nodename (char *nodename, int len);
|
||||
|
||||
/* How to get a reference (either menu or cross). */
|
||||
static REFERENCE **info_references_internal ();
|
||||
static REFERENCE **info_references_internal (char *label,
|
||||
SEARCH_BINDING *binding);
|
||||
|
||||
/* Parse the filename and nodename out of STRING. If STRING doesn't
|
||||
contain a filename (i.e., it is NOT (FILENAME)NODENAME) then set
|
||||
@ -50,9 +57,7 @@ static REFERENCE **info_references_internal ();
|
||||
non-zero, it says to allow the nodename specification to cross a
|
||||
newline boundary (i.e., only `,', `.', or `TAB' can end the spec). */
|
||||
void
|
||||
info_parse_node (string, newlines_okay)
|
||||
char *string;
|
||||
int newlines_okay;
|
||||
info_parse_node (char *string, int newlines_okay)
|
||||
{
|
||||
register int i = 0;
|
||||
|
||||
@ -96,6 +101,37 @@ info_parse_node (string, newlines_okay)
|
||||
free (info_parsed_nodename);
|
||||
info_parsed_nodename = (char *)NULL;
|
||||
}
|
||||
|
||||
/* Parse ``(line ...)'' part of menus, if any. */
|
||||
{
|
||||
char *rest = string + i;
|
||||
|
||||
/* Advance only if it's not already at end of string. */
|
||||
if (*rest)
|
||||
rest++;
|
||||
|
||||
/* Skip any whitespace first, and then a newline in case the item
|
||||
was so long to contain the ``(line ...)'' string in the same
|
||||
physical line. */
|
||||
while (whitespace(*rest))
|
||||
rest++;
|
||||
if (*rest == '\n')
|
||||
{
|
||||
rest++;
|
||||
while (whitespace(*rest))
|
||||
rest++;
|
||||
}
|
||||
|
||||
/* Are we looking at an opening parenthesis? That can only mean
|
||||
we have a winner. :) */
|
||||
if (strncmp (rest, "(line ", strlen ("(line ")) == 0)
|
||||
{
|
||||
rest += strlen ("(line ");
|
||||
info_parsed_line_number = strtol (rest, NULL, 0);
|
||||
}
|
||||
else
|
||||
info_parsed_line_number = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the node addressed by LABEL in NODE (usually one of "Prev:",
|
||||
@ -103,9 +139,7 @@ info_parse_node (string, newlines_okay)
|
||||
the global INFO_PARSED_NODENAME and INFO_PARSED_FILENAME contain
|
||||
the information. */
|
||||
void
|
||||
info_parse_label (label, node)
|
||||
char *label;
|
||||
NODE *node;
|
||||
info_parse_label (char *label, NODE *node)
|
||||
{
|
||||
register int i;
|
||||
char *nodeline;
|
||||
@ -135,30 +169,29 @@ info_parse_label (label, node)
|
||||
/* Return a NULL terminated array of REFERENCE * which represents the menu
|
||||
found in NODE. If there is no menu in NODE, just return a NULL pointer. */
|
||||
REFERENCE **
|
||||
info_menu_of_node (node)
|
||||
NODE *node;
|
||||
info_menu_of_node (NODE *node)
|
||||
{
|
||||
long position;
|
||||
SEARCH_BINDING search;
|
||||
SEARCH_BINDING tmp_search;
|
||||
REFERENCE **menu = (REFERENCE **)NULL;
|
||||
|
||||
search.buffer = node->contents;
|
||||
search.start = 0;
|
||||
search.end = node->nodelen;
|
||||
search.flags = S_FoldCase;
|
||||
tmp_search.buffer = node->contents;
|
||||
tmp_search.start = 0;
|
||||
tmp_search.end = node->nodelen;
|
||||
tmp_search.flags = S_FoldCase;
|
||||
|
||||
/* Find the start of the menu. */
|
||||
position = search_forward (INFO_MENU_LABEL, &search);
|
||||
position = search_forward (INFO_MENU_LABEL, &tmp_search);
|
||||
|
||||
if (position == -1)
|
||||
return ((REFERENCE **) NULL);
|
||||
|
||||
/* We have the start of the menu now. Glean menu items from the rest
|
||||
of the node. */
|
||||
search.start = position + strlen (INFO_MENU_LABEL);
|
||||
search.start += skip_line (search.buffer + search.start);
|
||||
search.start--;
|
||||
menu = info_menu_items (&search);
|
||||
tmp_search.start = position + strlen (INFO_MENU_LABEL);
|
||||
tmp_search.start += skip_line (tmp_search.buffer + tmp_search.start);
|
||||
tmp_search.start--;
|
||||
menu = info_menu_items (&tmp_search);
|
||||
return (menu);
|
||||
}
|
||||
|
||||
@ -166,30 +199,28 @@ info_menu_of_node (node)
|
||||
refrences found in NODE. If there are no cross references in NODE, just
|
||||
return a NULL pointer. */
|
||||
REFERENCE **
|
||||
info_xrefs_of_node (node)
|
||||
NODE *node;
|
||||
info_xrefs_of_node (NODE *node)
|
||||
{
|
||||
SEARCH_BINDING search;
|
||||
SEARCH_BINDING tmp_search;
|
||||
|
||||
#if defined (HANDLE_MAN_PAGES)
|
||||
if (node->flags & N_IsManPage)
|
||||
return (xrefs_of_manpage (node));
|
||||
#endif
|
||||
|
||||
search.buffer = node->contents;
|
||||
search.start = 0;
|
||||
search.end = node->nodelen;
|
||||
search.flags = S_FoldCase;
|
||||
tmp_search.buffer = node->contents;
|
||||
tmp_search.start = 0;
|
||||
tmp_search.end = node->nodelen;
|
||||
tmp_search.flags = S_FoldCase;
|
||||
|
||||
return (info_xrefs (&search));
|
||||
return (info_xrefs (&tmp_search));
|
||||
}
|
||||
|
||||
/* Glean menu entries from BINDING->buffer + BINDING->start until we
|
||||
have looked at the entire contents of BINDING. Return an array
|
||||
of REFERENCE * that represents each menu item in this range. */
|
||||
REFERENCE **
|
||||
info_menu_items (binding)
|
||||
SEARCH_BINDING *binding;
|
||||
info_menu_items (SEARCH_BINDING *binding)
|
||||
{
|
||||
return (info_references_internal (INFO_MENU_ENTRY_LABEL, binding));
|
||||
}
|
||||
@ -198,8 +229,7 @@ info_menu_items (binding)
|
||||
BINDING->end. Return an array of REFERENCE * that represents each
|
||||
cross reference in this range. */
|
||||
REFERENCE **
|
||||
info_xrefs (binding)
|
||||
SEARCH_BINDING *binding;
|
||||
info_xrefs (SEARCH_BINDING *binding)
|
||||
{
|
||||
return (info_references_internal (INFO_XREF_LABEL, binding));
|
||||
}
|
||||
@ -207,33 +237,31 @@ info_xrefs (binding)
|
||||
/* Glean cross references or menu items from BINDING. Return an array
|
||||
of REFERENCE * that represents the items found. */
|
||||
static REFERENCE **
|
||||
info_references_internal (label, binding)
|
||||
char *label;
|
||||
SEARCH_BINDING *binding;
|
||||
info_references_internal (char *label, SEARCH_BINDING *binding)
|
||||
{
|
||||
SEARCH_BINDING search;
|
||||
SEARCH_BINDING tmp_search;
|
||||
REFERENCE **refs = (REFERENCE **)NULL;
|
||||
int refs_index = 0, refs_slots = 0;
|
||||
int searching_for_menu_items = 0;
|
||||
long position;
|
||||
|
||||
search.buffer = binding->buffer;
|
||||
search.start = binding->start;
|
||||
search.end = binding->end;
|
||||
search.flags = S_FoldCase | S_SkipDest;
|
||||
tmp_search.buffer = binding->buffer;
|
||||
tmp_search.start = binding->start;
|
||||
tmp_search.end = binding->end;
|
||||
tmp_search.flags = S_FoldCase | S_SkipDest;
|
||||
|
||||
searching_for_menu_items = (strcasecmp (label, INFO_MENU_ENTRY_LABEL) == 0);
|
||||
|
||||
while ((position = search_forward (label, &search)) != -1)
|
||||
while ((position = search_forward (label, &tmp_search)) != -1)
|
||||
{
|
||||
int offset, start;
|
||||
char *refdef;
|
||||
REFERENCE *entry;
|
||||
|
||||
search.start = position;
|
||||
search.start += skip_whitespace (search.buffer + search.start);
|
||||
start = search.start - binding->start;
|
||||
refdef = search.buffer + search.start;
|
||||
tmp_search.start = position;
|
||||
tmp_search.start += skip_whitespace (tmp_search.buffer + tmp_search.start);
|
||||
start = tmp_search.start - binding->start;
|
||||
refdef = tmp_search.buffer + tmp_search.start;
|
||||
offset = string_in_line (":", refdef);
|
||||
|
||||
/* When searching for menu items, if no colon, there is no
|
||||
@ -290,6 +318,8 @@ info_references_internal (label, binding)
|
||||
|
||||
if (info_parsed_nodename)
|
||||
entry->nodename = xstrdup (info_parsed_nodename);
|
||||
|
||||
entry->line_number = info_parsed_line_number;
|
||||
}
|
||||
|
||||
add_pointer_to_array
|
||||
@ -301,9 +331,7 @@ info_references_internal (label, binding)
|
||||
/* Get the entry associated with LABEL in REFERENCES. Return a pointer
|
||||
to the ENTRY if found, or NULL. */
|
||||
REFERENCE *
|
||||
info_get_labeled_reference (label, references)
|
||||
char *label;
|
||||
REFERENCE **references;
|
||||
info_get_labeled_reference (char *label, REFERENCE **references)
|
||||
{
|
||||
register int i;
|
||||
REFERENCE *entry;
|
||||
@ -320,8 +348,7 @@ info_get_labeled_reference (label, references)
|
||||
REFERENCE ** which is the concatenation of REF1 and REF2. The REF1
|
||||
and REF2 arrays are freed, but their contents are not. */
|
||||
REFERENCE **
|
||||
info_concatenate_references (ref1, ref2)
|
||||
REFERENCE **ref1, **ref2;
|
||||
info_concatenate_references (REFERENCE **ref1, REFERENCE **ref2)
|
||||
{
|
||||
register int i, j;
|
||||
REFERENCE **result;
|
||||
@ -361,8 +388,7 @@ info_concatenate_references (ref1, ref2)
|
||||
every opportunity, we don't share any points, but copy everything into
|
||||
new memory. */
|
||||
REFERENCE *
|
||||
info_copy_reference (src)
|
||||
REFERENCE *src;
|
||||
info_copy_reference (REFERENCE *src)
|
||||
{
|
||||
REFERENCE *dest = xmalloc (sizeof (REFERENCE));
|
||||
dest->label = src->label ? xstrdup (src->label) : NULL;
|
||||
@ -378,8 +404,7 @@ info_copy_reference (src)
|
||||
|
||||
/* Free the data associated with REFERENCES. */
|
||||
void
|
||||
info_free_references (references)
|
||||
REFERENCE **references;
|
||||
info_free_references (REFERENCE **references)
|
||||
{
|
||||
register int i;
|
||||
REFERENCE *entry;
|
||||
@ -403,11 +428,10 @@ info_free_references (references)
|
||||
all such sequences with just a single space. Remove whitespace from
|
||||
start and end of string. */
|
||||
void
|
||||
canonicalize_whitespace (string)
|
||||
char *string;
|
||||
canonicalize_whitespace (char *string)
|
||||
{
|
||||
register int i, j;
|
||||
int len, whitespace_found, whitespace_loc;
|
||||
int len, whitespace_found, whitespace_loc = 0;
|
||||
char *temp;
|
||||
|
||||
if (!string)
|
||||
@ -458,9 +482,7 @@ static char the_rep[10];
|
||||
/* Return a pointer to a string which is the printed representation
|
||||
of CHARACTER if it were printed at HPOS. */
|
||||
char *
|
||||
printed_representation (character, hpos)
|
||||
unsigned char character;
|
||||
int hpos;
|
||||
printed_representation (unsigned char character, int hpos)
|
||||
{
|
||||
register int i = 0;
|
||||
int printable_limit = ISO_Latin_p ? 255 : 127;
|
||||
@ -524,22 +546,21 @@ static int parsed_filename_size = 0;
|
||||
/* Amount of space allocated to INFO_PARSED_NODENAME via xmalloc (). */
|
||||
static int parsed_nodename_size = 0;
|
||||
|
||||
static void save_string (), saven_string ();
|
||||
static void save_string (char *string, char **string_p, int *string_size_p);
|
||||
static void saven_string (char *string, int len, char **string_p,
|
||||
int *string_size_p);
|
||||
|
||||
/* Remember FILENAME in PARSED_FILENAME. An empty FILENAME is translated
|
||||
to a NULL pointer in PARSED_FILENAME. */
|
||||
static void
|
||||
save_filename (filename)
|
||||
char *filename;
|
||||
save_filename (char *filename)
|
||||
{
|
||||
save_string (filename, &info_parsed_filename, &parsed_filename_size);
|
||||
}
|
||||
|
||||
/* Just like save_filename (), but you pass the length of the string. */
|
||||
static void
|
||||
saven_filename (filename, len)
|
||||
char *filename;
|
||||
int len;
|
||||
saven_filename (char *filename, int len)
|
||||
{
|
||||
saven_string (filename, len,
|
||||
&info_parsed_filename, &parsed_filename_size);
|
||||
@ -548,17 +569,14 @@ saven_filename (filename, len)
|
||||
/* Remember NODENAME in PARSED_NODENAME. An empty NODENAME is translated
|
||||
to a NULL pointer in PARSED_NODENAME. */
|
||||
static void
|
||||
save_nodename (nodename)
|
||||
char *nodename;
|
||||
save_nodename (char *nodename)
|
||||
{
|
||||
save_string (nodename, &info_parsed_nodename, &parsed_nodename_size);
|
||||
}
|
||||
|
||||
/* Just like save_nodename (), but you pass the length of the string. */
|
||||
static void
|
||||
saven_nodename (nodename, len)
|
||||
char *nodename;
|
||||
int len;
|
||||
saven_nodename (char *nodename, int len)
|
||||
{
|
||||
saven_string (nodename, len,
|
||||
&info_parsed_nodename, &parsed_nodename_size);
|
||||
@ -568,10 +586,7 @@ saven_nodename (nodename, len)
|
||||
bytes allocated to it. An empty STRING is translated to a NULL pointer
|
||||
in STRING_P. */
|
||||
static void
|
||||
save_string (string, string_p, string_size_p)
|
||||
char *string;
|
||||
char **string_p;
|
||||
int *string_size_p;
|
||||
save_string (char *string, char **string_p, int *string_size_p)
|
||||
{
|
||||
if (!string || !*string)
|
||||
{
|
||||
@ -583,7 +598,7 @@ save_string (string, string_p, string_size_p)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen (string) >= *string_size_p)
|
||||
if (strlen (string) >= (unsigned int) *string_size_p)
|
||||
*string_p = (char *)xrealloc
|
||||
(*string_p, (*string_size_p = 1 + strlen (string)));
|
||||
|
||||
@ -593,11 +608,7 @@ save_string (string, string_p, string_size_p)
|
||||
|
||||
/* Just like save_string (), but you also pass the length of STRING. */
|
||||
static void
|
||||
saven_string (string, len, string_p, string_size_p)
|
||||
char *string;
|
||||
int len;
|
||||
char **string_p;
|
||||
int *string_size_p;
|
||||
saven_string (char *string, int len, char **string_p, int *string_size_p)
|
||||
{
|
||||
if (!string)
|
||||
{
|
||||
@ -619,8 +630,7 @@ saven_string (string, len, string_p, string_size_p)
|
||||
|
||||
/* Return a pointer to the part of PATHNAME that simply defines the file. */
|
||||
char *
|
||||
filename_non_directory (pathname)
|
||||
char *pathname;
|
||||
filename_non_directory (char *pathname)
|
||||
{
|
||||
register char *filename = pathname + strlen (pathname);
|
||||
|
||||
@ -635,8 +645,7 @@ filename_non_directory (pathname)
|
||||
|
||||
/* Return non-zero if NODE is one especially created by Info. */
|
||||
int
|
||||
internal_info_node_p (node)
|
||||
NODE *node;
|
||||
internal_info_node_p (NODE *node)
|
||||
{
|
||||
#if defined (NEVER)
|
||||
if (node &&
|
||||
@ -652,9 +661,7 @@ internal_info_node_p (node)
|
||||
|
||||
/* Make NODE appear to be one especially created by Info. */
|
||||
void
|
||||
name_internal_node (node, name)
|
||||
NODE *node;
|
||||
char *name;
|
||||
name_internal_node (NODE *node, char *name)
|
||||
{
|
||||
if (!node)
|
||||
return;
|
||||
@ -668,8 +675,7 @@ name_internal_node (node, name)
|
||||
/* Return the window displaying NAME, the name of an internally created
|
||||
Info window. */
|
||||
WINDOW *
|
||||
get_internal_info_window (name)
|
||||
char *name;
|
||||
get_internal_info_window (char *name)
|
||||
{
|
||||
WINDOW *win;
|
||||
|
||||
@ -683,8 +689,7 @@ get_internal_info_window (name)
|
||||
|
||||
/* Return a window displaying the node NODE. */
|
||||
WINDOW *
|
||||
get_window_of_node (node)
|
||||
NODE *node;
|
||||
get_window_of_node (NODE *node)
|
||||
{
|
||||
WINDOW *win = (WINDOW *)NULL;
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* info-utils.h -- Exported functions and variables from info-utils.c.
|
||||
$Id: info-utils.h,v 1.2 2003/03/06 23:21:48 karl Exp $
|
||||
$Id: info-utils.h,v 1.4 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1996, 1998, 2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1996, 1998, 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 +35,7 @@ typedef struct {
|
||||
char *filename; /* File where this node can be found. */
|
||||
char *nodename; /* Name of the node. */
|
||||
int start, end; /* Offsets within the containing node of LABEL. */
|
||||
int line_number; /* Specific line number a menu item points to. */
|
||||
} REFERENCE;
|
||||
|
||||
/* When non-zero, various display and input functions handle ISO Latin
|
||||
@ -53,72 +55,73 @@ extern char *info_parsed_nodename;
|
||||
INFO_PARSED_FILENAME to NULL. If second argument NEWLINES_OKAY is
|
||||
non-zero, it says to allow the nodename specification to cross a
|
||||
newline boundary (i.e., only `,', `.', or `TAB' can end the spec). */
|
||||
void info_parse_node ();
|
||||
void info_parse_node (char *string, int newlines_okay);
|
||||
|
||||
/* Return a NULL terminated array of REFERENCE * which represents the menu
|
||||
found in NODE. If there is no menu in NODE, just return a NULL pointer. */
|
||||
extern REFERENCE **info_menu_of_node ();
|
||||
extern REFERENCE **info_menu_of_node (NODE *node);
|
||||
|
||||
/* Return a NULL terminated array of REFERENCE * which represents the cross
|
||||
refrences found in NODE. If there are no cross references in NODE, just
|
||||
return a NULL pointer. */
|
||||
extern REFERENCE **info_xrefs_of_node ();
|
||||
extern REFERENCE **info_xrefs_of_node (NODE *node);
|
||||
|
||||
/* Glean cross references from BINDING->buffer + BINDING->start until
|
||||
BINDING->end. Return an array of REFERENCE * that represents each
|
||||
cross reference in this range. */
|
||||
extern REFERENCE **info_xrefs ();
|
||||
extern REFERENCE **info_xrefs (SEARCH_BINDING *binding);
|
||||
|
||||
/* Get the entry associated with LABEL in REFERENCES. Return a pointer to
|
||||
the reference if found, or NULL. */
|
||||
extern REFERENCE *info_get_labeled_reference ();
|
||||
extern REFERENCE *info_get_labeled_reference (char *label,
|
||||
REFERENCE **references);
|
||||
|
||||
/* Glean menu entries from BINDING->buffer + BINDING->start until we
|
||||
have looked at the entire contents of BINDING. Return an array
|
||||
of REFERENCE * that represents each menu item in this range. */
|
||||
extern REFERENCE **info_menu_items ();
|
||||
extern REFERENCE **info_menu_items (SEARCH_BINDING *binding);
|
||||
|
||||
/* A utility function for concatenating REFERENCE **. Returns a new
|
||||
REFERENCE ** which is the concatenation of REF1 and REF2. The REF1
|
||||
and REF2 arrays are freed, but their contents are not. */
|
||||
REFERENCE **info_concatenate_references ();
|
||||
REFERENCE **info_concatenate_references (REFERENCE **ref1, REFERENCE **ref2);
|
||||
|
||||
/* Copy an existing reference into new memory. */
|
||||
extern REFERENCE *info_copy_reference ();
|
||||
extern REFERENCE *info_copy_reference (REFERENCE *src);
|
||||
|
||||
/* Free the data associated with REFERENCES. */
|
||||
extern void info_free_references ();
|
||||
extern void info_free_references (REFERENCE **references);
|
||||
|
||||
/* Search for sequences of whitespace or newlines in STRING, replacing
|
||||
all such sequences with just a single space. Remove whitespace from
|
||||
start and end of string. */
|
||||
void canonicalize_whitespace ();
|
||||
void canonicalize_whitespace (char *string);
|
||||
|
||||
/* Return a pointer to a string which is the printed representation
|
||||
of CHARACTER if it were printed at HPOS. */
|
||||
extern char *printed_representation ();
|
||||
extern char *printed_representation (unsigned char character, int hpos);
|
||||
|
||||
/* Return a pointer to the part of PATHNAME that simply defines the file. */
|
||||
extern char *filename_non_directory ();
|
||||
extern char *filename_non_directory (char *pathname);
|
||||
|
||||
/* Return non-zero if NODE is one especially created by Info. */
|
||||
extern int internal_info_node_p ();
|
||||
extern int internal_info_node_p (NODE *node);
|
||||
|
||||
/* Make NODE appear to be one especially created by Info, and give it NAME. */
|
||||
extern void name_internal_node ();
|
||||
extern void name_internal_node (NODE *node, char *name);
|
||||
|
||||
/* Return the window displaying NAME, the name of an internally created
|
||||
Info window. */
|
||||
extern WINDOW *get_internal_info_window ();
|
||||
extern WINDOW *get_internal_info_window (char *name);
|
||||
|
||||
/* Return a window displaying the node NODE. */
|
||||
extern WINDOW *get_window_of_node ();
|
||||
extern WINDOW *get_window_of_node (NODE *node);
|
||||
|
||||
/* Return the node addressed by LABEL in NODE (usually one of "Prev:",
|
||||
"Next:", "Up:", "File:", or "Node:". After a call to this function,
|
||||
the globals `info_parsed_nodename' and `info_parsed_filename' contain
|
||||
the information. */
|
||||
extern void info_parse_label (/* label, node */);
|
||||
extern void info_parse_label (char *label, NODE *node);
|
||||
|
||||
#define info_file_label_of_node(n) info_parse_label (INFO_FILE_LABEL, n)
|
||||
#define info_next_label_of_node(n) info_parse_label (INFO_NEXT_LABEL, n)
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* info.c -- Display nodes of Info files in multiple windows.
|
||||
$Id: info.c,v 1.7 2003/05/19 13:10:59 karl Exp $
|
||||
$Id: info.c,v 1.11 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -77,8 +77,11 @@ int dump_subnodes = 0;
|
||||
/* Non-zero means make default keybindings be loosely modeled on vi(1). */
|
||||
int vi_keys_p = 0;
|
||||
|
||||
/* Non-zero means don't remove ANSI escape sequences from man pages. */
|
||||
int raw_escapes_p = 0;
|
||||
/* Non-zero means don't remove ANSI escape sequences. */
|
||||
int raw_escapes_p = 1;
|
||||
|
||||
/* Non-zero means print the absolute location of the file to be loaded. */
|
||||
static int print_where_p = 0;
|
||||
|
||||
#ifdef __MSDOS__
|
||||
/* Non-zero indicates that screen output should be made 'speech-friendly'.
|
||||
@ -103,15 +106,18 @@ static struct option long_options[] = {
|
||||
{ "file", 1, 0, 'f' },
|
||||
{ "help", 0, &print_help_p, 1 },
|
||||
{ "index-search", 1, 0, IDXSRCH_OPTION },
|
||||
{ "location", 0, &print_where_p, 1 },
|
||||
{ "node", 1, 0, 'n' },
|
||||
{ "output", 1, 0, 'o' },
|
||||
{ "raw-escapes", 0, &raw_escapes_p, 1 },
|
||||
{ "no-raw-escapes", 0, &raw_escapes_p, 0 },
|
||||
{ "restore", 1, 0, RESTORE_OPTION },
|
||||
{ "show-options", 0, 0, 'O' },
|
||||
{ "subnodes", 0, &dump_subnodes, 1 },
|
||||
{ "usage", 0, 0, 'O' },
|
||||
{ "version", 0, &print_version_p, 1 },
|
||||
{ "vi-keys", 0, &vi_keys_p, 1 },
|
||||
{ "where", 0, &print_where_p, 1 },
|
||||
#ifdef __MSDOS__
|
||||
{ "speech-friendly", 0, &speech_friendly, 1 },
|
||||
#endif
|
||||
@ -120,18 +126,17 @@ static struct option long_options[] = {
|
||||
|
||||
/* String describing the shorthand versions of the long options found above. */
|
||||
#ifdef __MSDOS__
|
||||
static char *short_options = "d:n:f:ho:ORsb";
|
||||
static char *short_options = "d:n:f:ho:ORswb";
|
||||
#else
|
||||
static char *short_options = "d:n:f:ho:ORs";
|
||||
static char *short_options = "d:n:f:ho:ORws";
|
||||
#endif
|
||||
|
||||
/* When non-zero, the Info window system has been initialized. */
|
||||
int info_windows_initialized_p = 0;
|
||||
|
||||
/* Some "forward" declarations. */
|
||||
static void info_short_help ();
|
||||
static void init_messages ();
|
||||
extern void add_file_directory_to_path ();
|
||||
static void info_short_help (void);
|
||||
static void init_messages (void);
|
||||
|
||||
|
||||
/* **************************************************************** */
|
||||
@ -141,9 +146,7 @@ extern void add_file_directory_to_path ();
|
||||
/* **************************************************************** */
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int getopt_long_index; /* Index returned by getopt_long (). */
|
||||
NODE *initial_node; /* First node loaded by Info. */
|
||||
@ -153,9 +156,11 @@ main (argc, argv)
|
||||
setlocale (LC_ALL, "");
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
/* Set the text message domain. */
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
init_messages ();
|
||||
|
||||
@ -229,6 +234,11 @@ main (argc, argv)
|
||||
dump_subnodes = 1;
|
||||
break;
|
||||
|
||||
/* For compatibility with man, -w is --where. */
|
||||
case 'w':
|
||||
print_where_p = 1;
|
||||
break;
|
||||
|
||||
#ifdef __MSDOS__
|
||||
/* User wants speech-friendly output. */
|
||||
case 'b':
|
||||
@ -281,11 +291,10 @@ main (argc, argv)
|
||||
{
|
||||
printf ("%s (GNU %s) %s\n", program_name, PACKAGE, VERSION);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -322,7 +331,13 @@ For more information about these matters, see the files named COPYING.\n"),
|
||||
{
|
||||
info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND);
|
||||
#ifdef INFODIR /* from the Makefile */
|
||||
info_add_path (INFODIR, INFOPATH_PREPEND);
|
||||
info_add_path (INFODIR, INFOPATH_PREPEND);
|
||||
#endif
|
||||
#ifdef INFODIR2 /* from the Makefile, too */
|
||||
# ifdef INFODIR
|
||||
if (!STREQ (INFODIR, INFODIR2))
|
||||
# endif
|
||||
info_add_path (INFODIR2, INFOPATH_PREPEND);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -349,10 +364,10 @@ For more information about these matters, see the files named COPYING.\n"),
|
||||
if (!initial_node)
|
||||
{
|
||||
if (info_recent_file_error)
|
||||
info_error (info_recent_file_error);
|
||||
info_error (info_recent_file_error, NULL, NULL);
|
||||
else
|
||||
info_error (msg_cant_find_node,
|
||||
user_nodenames ? user_nodenames[0] : "Top");
|
||||
info_error ((char *) msg_cant_find_node,
|
||||
user_nodenames ? user_nodenames[0] : "Top", NULL);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
@ -364,7 +379,9 @@ For more information about these matters, see the files named COPYING.\n"),
|
||||
{
|
||||
free (initial_node);
|
||||
|
||||
if (user_output_filename)
|
||||
if (print_where_p)
|
||||
printf ("%s\n", user_filename ? user_filename : "unknown?!");
|
||||
else if (user_output_filename)
|
||||
dump_nodes_to_file
|
||||
(user_filename, user_nodenames, user_output_filename, dump_subnodes);
|
||||
else
|
||||
@ -378,13 +395,27 @@ For more information about these matters, see the files named COPYING.\n"),
|
||||
file name is either "dir", or the contents of user_filename if one
|
||||
was specified. */
|
||||
{
|
||||
char *errstr, *errarg1, *errarg2;
|
||||
const char *errstr;
|
||||
char *errarg1, *errarg2;
|
||||
|
||||
NODE *new_initial_node = info_follow_menus (initial_node, argv + optind,
|
||||
&errstr, &errarg1, &errarg2);
|
||||
&errstr, &errarg1, &errarg2);
|
||||
|
||||
if (new_initial_node && new_initial_node != initial_node)
|
||||
initial_node = new_initial_node;
|
||||
|
||||
if (print_where_p)
|
||||
{
|
||||
if (initial_node->parent)
|
||||
printf ("%s\n", initial_node->parent);
|
||||
else if (initial_node->filename
|
||||
&& !is_dir_name (filename_non_directory (initial_node->filename)))
|
||||
printf ("%s\n", initial_node->filename);
|
||||
else
|
||||
xexit (1);
|
||||
xexit (0);
|
||||
}
|
||||
|
||||
/* If the user specified that this node should be output, then do that
|
||||
now. Otherwise, start the Info session with this node. Or act
|
||||
accordingly if the initial node was not found. */
|
||||
@ -394,14 +425,14 @@ For more information about these matters, see the files named COPYING.\n"),
|
||||
dump_node_to_file (initial_node, user_output_filename,
|
||||
dump_subnodes);
|
||||
else
|
||||
info_error (errstr, errarg1, errarg2);
|
||||
info_error ((char *) errstr, errarg1, errarg2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (errstr)
|
||||
begin_info_session_with_error (initial_node, errstr,
|
||||
errarg1, errarg2);
|
||||
begin_info_session_with_error (initial_node, (char *) errstr,
|
||||
errarg1, errarg2);
|
||||
/* If the user specified `--index-search=STRING' or
|
||||
--show-options, start the info session in the node
|
||||
corresponding to what they want. */
|
||||
@ -483,8 +514,7 @@ For more information about these matters, see the files named COPYING.\n"),
|
||||
}
|
||||
|
||||
void
|
||||
add_file_directory_to_path (filename)
|
||||
char *filename;
|
||||
add_file_directory_to_path (char *filename)
|
||||
{
|
||||
char *directory_name = xstrdup (filename);
|
||||
char *temp = filename_non_directory (directory_name);
|
||||
@ -518,9 +548,7 @@ int info_error_rings_bell_p = 1;
|
||||
then the message is printed in the echo area. Otherwise, a message is
|
||||
output to stderr. */
|
||||
void
|
||||
info_error (format, arg1, arg2)
|
||||
char *format;
|
||||
void *arg1, *arg2;
|
||||
info_error (char *format, void *arg1, void *arg2)
|
||||
{
|
||||
info_error_was_printed = 1;
|
||||
|
||||
@ -556,7 +584,7 @@ info_error (format, arg1, arg2)
|
||||
|
||||
/* Produce a scaled down description of the available options to Info. */
|
||||
static void
|
||||
info_short_help ()
|
||||
info_short_help (void)
|
||||
{
|
||||
#ifdef __MSDOS__
|
||||
static const char speech_friendly_string[] = N_("\
|
||||
@ -580,10 +608,12 @@ Options:\n\
|
||||
--index-search=STRING go to node pointed by index entry STRING.\n\
|
||||
-n, --node=NODENAME specify nodes in first visited Info file.\n\
|
||||
-o, --output=FILENAME output selected nodes to FILENAME.\n\
|
||||
-R, --raw-escapes don't remove ANSI escapes from man pages.\n\
|
||||
-R, --raw-escapes output \"raw\" ANSI escapes (default).\n\
|
||||
--no-raw-escapes output escapes as literal text.\n\
|
||||
--restore=FILENAME read initial keystrokes from FILENAME.\n\
|
||||
-O, --show-options, --usage go to command-line options node.\n%s\
|
||||
--subnodes recursively output menu items.\n\
|
||||
-w, --where, --location print physical location of Info file.\n\
|
||||
--vi-keys use vi-like and less-like key bindings.\n\
|
||||
--version display version information and exit.\n\
|
||||
\n\
|
||||
@ -634,7 +664,7 @@ const char *msg_win_too_small;
|
||||
const char *msg_cant_make_help;
|
||||
|
||||
static void
|
||||
init_messages ()
|
||||
init_messages (void)
|
||||
{
|
||||
msg_cant_find_node = _("Cannot find node `%s'.");
|
||||
msg_cant_file_node = _("Cannot find node `(%s)%s'.");
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* info.h -- Header file which includes all of the other headers.
|
||||
$Id: info.h,v 1.2 2003/02/11 16:39:06 karl Exp $
|
||||
$Id: info.h,v 1.4 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003 Free Software
|
||||
Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -126,7 +126,9 @@ extern int raw_escapes_p;
|
||||
/* Print FORMAT with ARG1 and ARG2. If the window system was initialized,
|
||||
then the message is printed in the echo area. Otherwise, a message is
|
||||
output to stderr. */
|
||||
extern void info_error ();
|
||||
extern void info_error (char *format, void *arg1, void *arg2);
|
||||
|
||||
extern void add_file_directory_to_path (char *filename);
|
||||
|
||||
/* Error message defines. */
|
||||
extern const char *msg_cant_find_node;
|
||||
@ -147,16 +149,12 @@ extern const char *msg_win_too_small;
|
||||
extern const char *msg_cant_make_help;
|
||||
|
||||
|
||||
extern char *filename_non_directory (); /* Found in info-utils.c. */
|
||||
|
||||
#if defined(INFOKEY)
|
||||
extern void set_variable_to_value (); /* Found in variables.c. */
|
||||
/* Found in variables.c. */
|
||||
extern void set_variable_to_value (char *name, char *value);
|
||||
#endif /* INFOKEY */
|
||||
|
||||
#if !defined (BUILDING_LIBRARY)
|
||||
extern int info_windows_initialized_p; /* Found in session.c */
|
||||
/* Found in window.c. */
|
||||
extern void message_in_echo_area (), unmessage_in_echo_area ();
|
||||
#endif /* !BUILDING_LIBRARY */
|
||||
/* Found in m-x.c. */
|
||||
extern char *read_function_name (char *prompt, WINDOW *window);
|
||||
|
||||
#endif /* !INFO_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* infodoc.c -- functions which build documentation nodes.
|
||||
$Id: infodoc.c,v 1.6 2003/05/13 16:22:11 karl Exp $
|
||||
$Id: infodoc.c,v 1.8 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003 Free Software
|
||||
Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -185,12 +185,10 @@ static char *info_help_keys_text[][2] = {
|
||||
|
||||
#endif /* !INFOKEY */
|
||||
|
||||
static char *where_is_internal ();
|
||||
static char *where_is_internal (Keymap map, InfoCommand *cmd);
|
||||
|
||||
void
|
||||
dump_map_to_message_buffer (prefix, map)
|
||||
char *prefix;
|
||||
Keymap map;
|
||||
dump_map_to_message_buffer (char *prefix, Keymap map)
|
||||
{
|
||||
register int i;
|
||||
unsigned prefix_len = strlen (prefix);
|
||||
@ -226,13 +224,16 @@ dump_map_to_message_buffer (prefix, map)
|
||||
|
||||
if (last - 1 != i)
|
||||
{
|
||||
printf_to_message_buffer ("%s .. ", pretty_keyseq (new_prefix));
|
||||
printf_to_message_buffer ("%s .. ", pretty_keyseq (new_prefix),
|
||||
NULL, NULL);
|
||||
new_prefix[prefix_len] = last - 1;
|
||||
printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix));
|
||||
printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix),
|
||||
NULL, NULL);
|
||||
i = last - 1;
|
||||
}
|
||||
else
|
||||
printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix));
|
||||
printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix),
|
||||
NULL, NULL);
|
||||
|
||||
#if defined (NAMED_FUNCTIONS)
|
||||
/* Print the name of the function, and some padding before the
|
||||
@ -241,22 +242,23 @@ dump_map_to_message_buffer (prefix, map)
|
||||
int length_so_far;
|
||||
int desired_doc_start = 40; /* Must be multiple of 8. */
|
||||
|
||||
printf_to_message_buffer ("(%s)", name);
|
||||
printf_to_message_buffer ("(%s)", name, NULL, NULL);
|
||||
length_so_far = message_buffer_length_this_line ();
|
||||
|
||||
if ((desired_doc_start + strlen (doc)) >= the_screen->width)
|
||||
printf_to_message_buffer ("\n ");
|
||||
if ((desired_doc_start + strlen (doc))
|
||||
>= (unsigned int) the_screen->width)
|
||||
printf_to_message_buffer ("\n ", NULL, NULL, NULL);
|
||||
else
|
||||
{
|
||||
while (length_so_far < desired_doc_start)
|
||||
{
|
||||
printf_to_message_buffer ("\t");
|
||||
printf_to_message_buffer ("\t", NULL, NULL, NULL);
|
||||
length_so_far += character_width ('\t', length_so_far);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* NAMED_FUNCTIONS */
|
||||
printf_to_message_buffer ("%s\n", doc);
|
||||
printf_to_message_buffer ("%s\n", doc, NULL, NULL);
|
||||
}
|
||||
}
|
||||
free (new_prefix);
|
||||
@ -269,8 +271,7 @@ dump_map_to_message_buffer (prefix, map)
|
||||
make q do the right thing in both cases. */
|
||||
|
||||
static void
|
||||
create_internal_info_help_node (help_is_only_window_p)
|
||||
int help_is_only_window_p;
|
||||
create_internal_info_help_node (int help_is_only_window_p)
|
||||
{
|
||||
register int i;
|
||||
NODE *node;
|
||||
@ -291,8 +292,9 @@ create_internal_info_help_node (help_is_only_window_p)
|
||||
for (i = 0; info_internal_help_text[i]; i++)
|
||||
{
|
||||
#ifdef INFOKEY
|
||||
printf_to_message_buffer (replace_in_documentation (
|
||||
_(info_internal_help_text[i]), help_is_only_window_p));
|
||||
printf_to_message_buffer (replace_in_documentation
|
||||
((char *) _(info_internal_help_text[i]), help_is_only_window_p),
|
||||
NULL, NULL, NULL);
|
||||
#else
|
||||
/* Don't translate blank lines, gettext outputs the po file
|
||||
header in that case. We want a blank line. */
|
||||
@ -306,18 +308,21 @@ create_internal_info_help_node (help_is_only_window_p)
|
||||
if (STREQ (key, "CTRL-x 0") && help_is_only_window_p)
|
||||
key = "l";
|
||||
|
||||
printf_to_message_buffer (msg, key);
|
||||
printf_to_message_buffer (msg, key, NULL, NULL);
|
||||
#endif /* !INFOKEY */
|
||||
}
|
||||
|
||||
printf_to_message_buffer ("---------------------\n\n");
|
||||
printf_to_message_buffer (_("The current search path is:\n"));
|
||||
printf_to_message_buffer (" %s\n", infopath);
|
||||
printf_to_message_buffer ("---------------------\n\n");
|
||||
printf_to_message_buffer (_("Commands available in Info windows:\n\n"));
|
||||
printf_to_message_buffer ("---------------------\n\n", NULL, NULL, NULL);
|
||||
printf_to_message_buffer ((char *) _("The current search path is:\n"),
|
||||
NULL, NULL, NULL);
|
||||
printf_to_message_buffer (" %s\n", infopath, NULL, NULL);
|
||||
printf_to_message_buffer ("---------------------\n\n", NULL, NULL, NULL);
|
||||
printf_to_message_buffer ((char *) _("Commands available in Info windows:\n\n"),
|
||||
NULL, NULL, NULL);
|
||||
dump_map_to_message_buffer ("", info_keymap);
|
||||
printf_to_message_buffer ("---------------------\n\n");
|
||||
printf_to_message_buffer (_("Commands available in the echo area:\n\n"));
|
||||
printf_to_message_buffer ("---------------------\n\n", NULL, NULL, NULL);
|
||||
printf_to_message_buffer ((char *) _("Commands available in the echo area:\n\n"),
|
||||
NULL, NULL, NULL);
|
||||
dump_map_to_message_buffer ("", echo_area_keymap);
|
||||
|
||||
#if defined (NAMED_FUNCTIONS)
|
||||
@ -329,19 +334,22 @@ create_internal_info_help_node (help_is_only_window_p)
|
||||
{
|
||||
InfoCommand *cmd = DocInfoCmd(&function_doc_array[i]);
|
||||
|
||||
if (InfoFunction(cmd) != info_do_lowercase_version
|
||||
if (InfoFunction(cmd) != (VFunction *) info_do_lowercase_version
|
||||
&& !where_is_internal (info_keymap, cmd)
|
||||
&& !where_is_internal (echo_area_keymap, cmd))
|
||||
{
|
||||
if (!printed_one_mx)
|
||||
{
|
||||
printf_to_message_buffer ("---------------------\n\n");
|
||||
printf_to_message_buffer ("---------------------\n\n",
|
||||
NULL, NULL, NULL);
|
||||
if (exec_keys && exec_keys[0])
|
||||
printf_to_message_buffer
|
||||
(_("The following commands can only be invoked via %s:\n\n"), exec_keys);
|
||||
((char *) _("The following commands can only be invoked via %s:\n\n"),
|
||||
exec_keys, NULL, NULL);
|
||||
else
|
||||
printf_to_message_buffer
|
||||
(_("The following commands cannot be invoked at all:\n\n"));
|
||||
((char *) _("The following commands cannot be invoked at all:\n\n"),
|
||||
NULL, NULL, NULL);
|
||||
printed_one_mx = 1;
|
||||
}
|
||||
|
||||
@ -350,22 +358,22 @@ create_internal_info_help_node (help_is_only_window_p)
|
||||
exec_keys,
|
||||
function_doc_array[i].func_name,
|
||||
replace_in_documentation (strlen (function_doc_array[i].doc)
|
||||
? _(function_doc_array[i].doc)
|
||||
: "")
|
||||
? (char *) _(function_doc_array[i].doc) : "", 0)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (printed_one_mx)
|
||||
printf_to_message_buffer ("\n");
|
||||
printf_to_message_buffer ("\n", NULL, NULL, NULL);
|
||||
|
||||
maybe_free (exec_keys);
|
||||
#endif /* NAMED_FUNCTIONS */
|
||||
|
||||
printf_to_message_buffer
|
||||
("%s", replace_in_documentation
|
||||
(_("--- Use `\\[history-node]' or `\\[kill-node]' to exit ---\n")));
|
||||
((char *) _("--- Use `\\[history-node]' or `\\[kill-node]' to exit ---\n"), 0),
|
||||
NULL, NULL);
|
||||
node = message_buffer_to_node ();
|
||||
internal_info_help_node_contents = node->contents;
|
||||
}
|
||||
@ -404,7 +412,7 @@ create_internal_info_help_node (help_is_only_window_p)
|
||||
#define HELP_SPLIT_SIZE 24
|
||||
|
||||
static WINDOW *
|
||||
info_find_or_create_help_window ()
|
||||
info_find_or_create_help_window (void)
|
||||
{
|
||||
int help_is_only_window_p;
|
||||
WINDOW *eligible = NULL;
|
||||
@ -438,9 +446,8 @@ info_find_or_create_help_window ()
|
||||
argument is false if help will be the only window (so l must be used
|
||||
to quit help), true if help will be one of several visible windows
|
||||
(so CTRL-x 0 must be used to quit help). */
|
||||
help_is_only_window_p
|
||||
= ((help_window && !windows->next)
|
||||
|| !help_window && eligible->height < HELP_SPLIT_SIZE);
|
||||
help_is_only_window_p = ((help_window && !windows->next)
|
||||
|| (!help_window && eligible->height < HELP_SPLIT_SIZE));
|
||||
create_internal_info_help_node (help_is_only_window_p);
|
||||
|
||||
/* Either use the existing window to display the help node, or create
|
||||
@ -487,7 +494,7 @@ DECLARE_INFO_COMMAND (info_get_help_window, _("Display help message"))
|
||||
}
|
||||
else
|
||||
{
|
||||
info_error (msg_cant_make_help);
|
||||
info_error ((char *) msg_cant_make_help, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -529,9 +536,9 @@ DECLARE_INFO_COMMAND (info_get_info_help_node, _("Visit Info node `(info)Help'")
|
||||
if (!node)
|
||||
{
|
||||
if (info_recent_file_error)
|
||||
info_error (info_recent_file_error);
|
||||
info_error (info_recent_file_error, NULL, NULL);
|
||||
else
|
||||
info_error (msg_cant_file_node, "Info", nodename);
|
||||
info_error ((char *) msg_cant_file_node, "Info", nodename);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -559,8 +566,7 @@ DECLARE_INFO_COMMAND (info_get_info_help_node, _("Visit Info node `(info)Help'")
|
||||
|
||||
/* Return the documentation associated with the Info command FUNCTION. */
|
||||
char *
|
||||
function_documentation (cmd)
|
||||
InfoCommand *cmd;
|
||||
function_documentation (InfoCommand *cmd)
|
||||
{
|
||||
char *doc;
|
||||
|
||||
@ -580,15 +586,14 @@ function_documentation (cmd)
|
||||
|
||||
#endif /* !INFOKEY */
|
||||
|
||||
return replace_in_documentation ((strlen (doc) == 0) ? doc : _(doc));
|
||||
return replace_in_documentation ((strlen (doc) == 0) ? doc : (char *) _(doc), 0);
|
||||
}
|
||||
|
||||
#if defined (NAMED_FUNCTIONS)
|
||||
/* Return the user-visible name of the function associated with the
|
||||
Info command FUNCTION. */
|
||||
char *
|
||||
function_name (cmd)
|
||||
InfoCommand *cmd;
|
||||
function_name (InfoCommand *cmd)
|
||||
{
|
||||
#if defined (INFOKEY)
|
||||
|
||||
@ -609,8 +614,7 @@ function_name (cmd)
|
||||
|
||||
/* Return a pointer to the info command for function NAME. */
|
||||
InfoCommand *
|
||||
named_function (name)
|
||||
char *name;
|
||||
named_function (char *name)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@ -624,9 +628,7 @@ named_function (name)
|
||||
|
||||
/* Return the documentation associated with KEY in MAP. */
|
||||
char *
|
||||
key_documentation (key, map)
|
||||
char key;
|
||||
Keymap map;
|
||||
key_documentation (char key, Keymap map)
|
||||
{
|
||||
InfoCommand *function = map[key].function;
|
||||
|
||||
@ -648,7 +650,8 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
|
||||
|
||||
for (;;)
|
||||
{
|
||||
message_in_echo_area (_("Describe key: %s"), pretty_keyseq (keys));
|
||||
message_in_echo_area ((char *) _("Describe key: %s"),
|
||||
pretty_keyseq (keys), NULL);
|
||||
keystroke = info_get_input_char ();
|
||||
unmessage_in_echo_area ();
|
||||
|
||||
@ -674,7 +677,8 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
|
||||
|
||||
if (map[keystroke].function == (InfoCommand *)NULL)
|
||||
{
|
||||
message_in_echo_area (_("%s is undefined."), pretty_keyseq (keys));
|
||||
message_in_echo_area ((char *) _("%s is undefined."),
|
||||
pretty_keyseq (keys), NULL);
|
||||
return;
|
||||
}
|
||||
else if (map[keystroke].type == ISKMAP)
|
||||
@ -693,7 +697,8 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
|
||||
edit keys that emit an escape sequence: it's terribly
|
||||
confusing to see a message "Home (do-lowercase-version)"
|
||||
or some such when Home is unbound. */
|
||||
if (InfoFunction(map[keystroke].function) == info_do_lowercase_version)
|
||||
if (InfoFunction(map[keystroke].function)
|
||||
== (VFunction *) info_do_lowercase_version)
|
||||
{
|
||||
unsigned char lowerkey = Meta_p(keystroke)
|
||||
? Meta (tolower (UnMeta (keystroke)))
|
||||
@ -701,8 +706,8 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
|
||||
|
||||
if (map[lowerkey].function == (InfoCommand *)NULL)
|
||||
{
|
||||
message_in_echo_area (_("%s is undefined."),
|
||||
pretty_keyseq (keys));
|
||||
message_in_echo_area ((char *) _("%s is undefined."),
|
||||
pretty_keyseq (keys), NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -725,7 +730,7 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
|
||||
sprintf (message, _("%s is defined to %s."), keyname, fundoc);
|
||||
#endif /* !NAMED_FUNCTIONS */
|
||||
|
||||
window_message_in_echo_area ("%s", message);
|
||||
window_message_in_echo_area ("%s", message, NULL);
|
||||
free (message);
|
||||
break;
|
||||
}
|
||||
@ -734,8 +739,7 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
|
||||
|
||||
/* Return the pretty printable name of a single character. */
|
||||
char *
|
||||
pretty_keyname (key)
|
||||
unsigned char key;
|
||||
pretty_keyname (unsigned char key)
|
||||
{
|
||||
static char rep_buffer[30];
|
||||
char *rep;
|
||||
@ -785,11 +789,10 @@ pretty_keyname (key)
|
||||
|
||||
/* Return the pretty printable string which represents KEYSEQ. */
|
||||
|
||||
static void pretty_keyseq_internal ();
|
||||
static void pretty_keyseq_internal (char *keyseq, char *rep);
|
||||
|
||||
char *
|
||||
pretty_keyseq (keyseq)
|
||||
char *keyseq;
|
||||
pretty_keyseq (char *keyseq)
|
||||
{
|
||||
static char keyseq_rep[200];
|
||||
|
||||
@ -800,8 +803,7 @@ pretty_keyseq (keyseq)
|
||||
}
|
||||
|
||||
static void
|
||||
pretty_keyseq_internal (keyseq, rep)
|
||||
char *keyseq, *rep;
|
||||
pretty_keyseq_internal (char *keyseq, char *rep)
|
||||
{
|
||||
if (term_kP && strncmp(keyseq, term_kP, strlen(term_kP)) == 0)
|
||||
{
|
||||
@ -869,8 +871,7 @@ pretty_keyseq_internal (keyseq, rep)
|
||||
|
||||
/* Return a pointer to the last character in s that is found in f. */
|
||||
static char *
|
||||
strrpbrk (s, f)
|
||||
const char *s, *f;
|
||||
strrpbrk (const char *s, const char *f)
|
||||
{
|
||||
register const char *e = s + strlen(s);
|
||||
register const char *t;
|
||||
@ -886,9 +887,7 @@ strrpbrk (s, f)
|
||||
|
||||
/* Replace the names of functions with the key that invokes them. */
|
||||
char *
|
||||
replace_in_documentation (string, help_is_only_window_p)
|
||||
char *string;
|
||||
int help_is_only_window_p;
|
||||
replace_in_documentation (char *string, int help_is_only_window_p)
|
||||
{
|
||||
unsigned reslen = strlen (string);
|
||||
register int i, start, next;
|
||||
@ -1058,9 +1057,7 @@ static int where_is_rep_index = 0;
|
||||
static int where_is_rep_size = 0;
|
||||
|
||||
char *
|
||||
where_is (map, cmd)
|
||||
Keymap map;
|
||||
InfoCommand *cmd;
|
||||
where_is (Keymap map, InfoCommand *cmd)
|
||||
{
|
||||
char *rep;
|
||||
|
||||
@ -1093,9 +1090,7 @@ where_is (map, cmd)
|
||||
/* Return the printed rep of the keystrokes that invoke FUNCTION,
|
||||
as found in MAP, or NULL. */
|
||||
static char *
|
||||
where_is_internal (map, cmd)
|
||||
Keymap map;
|
||||
InfoCommand *cmd;
|
||||
where_is_internal (Keymap map, InfoCommand *cmd)
|
||||
{
|
||||
#if defined(INFOKEY)
|
||||
|
||||
@ -1154,14 +1149,12 @@ where_is_internal (map, cmd)
|
||||
#endif /* INFOKEY */
|
||||
}
|
||||
|
||||
extern char *read_function_name ();
|
||||
|
||||
DECLARE_INFO_COMMAND (info_where_is,
|
||||
_("Show what to type to execute a given command"))
|
||||
{
|
||||
char *command_name;
|
||||
|
||||
command_name = read_function_name (_("Where is command: "), window);
|
||||
command_name = read_function_name ((char *) _("Where is command: "), window);
|
||||
|
||||
if (!command_name)
|
||||
{
|
||||
@ -1183,20 +1176,24 @@ DECLARE_INFO_COMMAND (info_where_is,
|
||||
|
||||
if (!location || !location[0])
|
||||
{
|
||||
info_error (_("`%s' is not on any keys"), command_name);
|
||||
info_error ((char *) _("`%s' is not on any keys"),
|
||||
command_name, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strstr (location, function_name (command)))
|
||||
window_message_in_echo_area
|
||||
(_("%s can only be invoked via %s."), command_name, location);
|
||||
((char *) _("%s can only be invoked via %s."),
|
||||
command_name, location);
|
||||
else
|
||||
window_message_in_echo_area
|
||||
(_("%s can be invoked via %s."), command_name, location);
|
||||
((char *) _("%s can be invoked via %s."),
|
||||
command_name, location);
|
||||
}
|
||||
}
|
||||
else
|
||||
info_error (_("There is no function named `%s'"), command_name);
|
||||
info_error ((char *) _("There is no function named `%s'"),
|
||||
command_name, NULL);
|
||||
}
|
||||
|
||||
free (command_name);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* infokey.c -- compile ~/.infokey to ~/.info.
|
||||
$Id: infokey.c,v 1.4 2003/05/13 16:26:02 karl Exp $
|
||||
$Id: infokey.c,v 1.9 2004/12/14 00:15:36 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
|
||||
@ -69,9 +69,16 @@ struct sect
|
||||
};
|
||||
|
||||
/* Some "forward" declarations. */
|
||||
static char *mkpath ();
|
||||
static int compile (), write_infokey_file ();
|
||||
static void syntax_error (), error_message (), suggest_help (), short_help ();
|
||||
static char *mkpath (const char *dir, const char *file);
|
||||
static int compile (FILE *fp, const char *filename, struct sect *sections);
|
||||
static int write_infokey_file (FILE *fp, struct sect *sections);
|
||||
static void syntax_error (const char *filename,
|
||||
unsigned int linenum, const char *fmt,
|
||||
const void *a1, const void *a2, const void *a3, const void *a4);
|
||||
static void error_message (int error_code, const char *fmt,
|
||||
const void *a1, const void *a2, const void *a3, const void *a4);
|
||||
static void suggest_help (void);
|
||||
static void short_help (void);
|
||||
|
||||
|
||||
/* **************************************************************** */
|
||||
@ -81,9 +88,7 @@ static void syntax_error (), error_message (), suggest_help (), short_help ();
|
||||
/* **************************************************************** */
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int getopt_long_index; /* Index returned by getopt_long (). */
|
||||
|
||||
@ -92,9 +97,11 @@ main (argc, argv)
|
||||
setlocale (LC_ALL, "");
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
/* Set the text message domain. */
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
while (1)
|
||||
{
|
||||
@ -160,7 +167,8 @@ For more information about these matters, see the files named COPYING.\n"),
|
||||
}
|
||||
else if (optind != argc)
|
||||
{
|
||||
error_message (0, _("incorrect number of arguments"));
|
||||
error_message (0, _("incorrect number of arguments"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
suggest_help ();
|
||||
xexit (1);
|
||||
}
|
||||
@ -190,7 +198,8 @@ For more information about these matters, see the files named COPYING.\n"),
|
||||
inf = fopen (input_filename, "r");
|
||||
if (!inf)
|
||||
{
|
||||
error_message (errno, _("cannot open input file `%s'"), input_filename);
|
||||
error_message (errno, _("cannot open input file `%s'"),
|
||||
input_filename, NULL, NULL, NULL);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
@ -203,7 +212,8 @@ For more information about these matters, see the files named COPYING.\n"),
|
||||
outf = fopen (output_filename, FOPEN_WBIN);
|
||||
if (!outf)
|
||||
{
|
||||
error_message (errno, _("cannot create output file `%s'"), output_filename);
|
||||
error_message (errno, _("cannot create output file `%s'"),
|
||||
output_filename, NULL, NULL, NULL);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
@ -213,12 +223,14 @@ For more information about these matters, see the files named COPYING.\n"),
|
||||
write_error = 0;
|
||||
if (!write_infokey_file (outf, sections))
|
||||
{
|
||||
error_message (errno, _("error writing to `%s'"), output_filename);
|
||||
error_message (errno, _("error writing to `%s'"),
|
||||
output_filename, NULL, NULL, NULL);
|
||||
write_error = 1;
|
||||
}
|
||||
if (fclose (outf) == EOF)
|
||||
{
|
||||
error_message (errno, _("error closing output file `%s'"), output_filename);
|
||||
error_message (errno, _("error closing output file `%s'"),
|
||||
output_filename, NULL, NULL, NULL);
|
||||
write_error = 1;
|
||||
}
|
||||
if (write_error)
|
||||
@ -236,9 +248,7 @@ For more information about these matters, see the files named COPYING.\n"),
|
||||
}
|
||||
|
||||
static char *
|
||||
mkpath (dir, file)
|
||||
const char *dir;
|
||||
const char *file;
|
||||
mkpath (const char *dir, const char *file)
|
||||
{
|
||||
char *p;
|
||||
|
||||
@ -365,21 +375,19 @@ mkpath (dir, file)
|
||||
following the '=' is not ignored.
|
||||
*/
|
||||
|
||||
static int add_to_section (), lookup_action ();
|
||||
static int add_to_section (struct sect *s, const char *str, unsigned int len);
|
||||
static int lookup_action (const char *actname);
|
||||
|
||||
/* Compile the input file into its various sections. Return true if no
|
||||
error was encountered.
|
||||
*/
|
||||
static int
|
||||
compile (fp, filename, sections)
|
||||
FILE *fp;
|
||||
const char *filename;
|
||||
struct sect sections[];
|
||||
compile (FILE *fp, const char *filename, struct sect *sections)
|
||||
{
|
||||
int error = 0;
|
||||
char rescan = 0;
|
||||
unsigned int lnum = 0;
|
||||
int c;
|
||||
int c = 0;
|
||||
|
||||
/* This parser is a true state machine, with no sneaky fetching
|
||||
of input characters inside the main loop. In other words, all
|
||||
@ -411,9 +419,9 @@ compile (fp, filename, sections)
|
||||
octal,
|
||||
special_key
|
||||
}
|
||||
seqstate; /* used if state == get_keyseq */
|
||||
seqstate; /* used if state == get_keyseq */
|
||||
char meta = 0;
|
||||
char ocnt; /* used if state == get_keyseq && seqstate == octal */
|
||||
char ocnt = 0; /* used if state == get_keyseq && seqstate == octal */
|
||||
|
||||
/* Data is accumulated in the following variables. The code
|
||||
avoids overflowing these strings, and throws an error
|
||||
@ -421,17 +429,17 @@ compile (fp, filename, sections)
|
||||
lengths are arbitrary (and should be large enough) and their
|
||||
lengths are not hard-coded anywhere else, so increasing them
|
||||
here will not break anything. */
|
||||
char oval;
|
||||
char oval = 0;
|
||||
char comment[10];
|
||||
unsigned int clen;
|
||||
unsigned int clen = 0;
|
||||
char seq[20];
|
||||
unsigned int slen;
|
||||
unsigned int slen = 0;
|
||||
char act[80];
|
||||
unsigned int alen;
|
||||
unsigned int alen = 0;
|
||||
char varn[80];
|
||||
unsigned int varlen;
|
||||
unsigned int varlen = 0;
|
||||
char val[80];
|
||||
unsigned int vallen;
|
||||
unsigned int vallen = 0;
|
||||
|
||||
#define To_seq(c) \
|
||||
do { \
|
||||
@ -439,7 +447,8 @@ compile (fp, filename, sections)
|
||||
seq[slen++] = meta ? Meta(c) : (c); \
|
||||
else \
|
||||
{ \
|
||||
syntax_error(filename, lnum, _("key sequence too long")); \
|
||||
syntax_error(filename, lnum, _("key sequence too long"), \
|
||||
NULL, NULL, NULL, NULL); \
|
||||
error = 1; \
|
||||
} \
|
||||
meta = 0; \
|
||||
@ -517,7 +526,8 @@ compile (fp, filename, sections)
|
||||
rescan = 1;
|
||||
if (slen == 0)
|
||||
{
|
||||
syntax_error (filename, lnum, _("missing key sequence"));
|
||||
syntax_error (filename, lnum, _("missing key sequence"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
@ -596,7 +606,9 @@ compile (fp, filename, sections)
|
||||
To_seq (oval);
|
||||
else
|
||||
{
|
||||
syntax_error (filename, lnum, _("NUL character (\\000) not permitted"));
|
||||
syntax_error (filename, lnum,
|
||||
_("NUL character (\\000) not permitted"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
@ -625,7 +637,9 @@ compile (fp, filename, sections)
|
||||
To_seq (CONTROL (c));
|
||||
else
|
||||
{
|
||||
syntax_error (filename, lnum, _("NUL character (^%c) not permitted"), c);
|
||||
syntax_error (filename, lnum,
|
||||
(char *) _("NUL character (^%c) not permitted"),
|
||||
(void *) (long) c, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
seqstate = normal;
|
||||
@ -648,7 +662,8 @@ compile (fp, filename, sections)
|
||||
rescan = 1;
|
||||
if (alen == 0)
|
||||
{
|
||||
syntax_error (filename, lnum, _("missing action name"), c);
|
||||
syntax_error (filename, lnum, (char *) _("missing action name"),
|
||||
(void *) (long) c, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
else
|
||||
@ -663,13 +678,15 @@ compile (fp, filename, sections)
|
||||
&& add_to_section (§ions[section], "", 1)
|
||||
&& add_to_section (§ions[section], &av, 1)))
|
||||
{
|
||||
syntax_error (filename, lnum, _("section too long"));
|
||||
syntax_error (filename, lnum, _("section too long"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
syntax_error (filename, lnum, _("unknown action `%s'"), act);
|
||||
syntax_error (filename, lnum, _("unknown action `%s'"),
|
||||
act, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
@ -678,7 +695,8 @@ compile (fp, filename, sections)
|
||||
act[alen++] = c;
|
||||
else
|
||||
{
|
||||
syntax_error (filename, lnum, _("action name too long"));
|
||||
syntax_error (filename, lnum, _("action name too long"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
break;
|
||||
@ -690,7 +708,9 @@ compile (fp, filename, sections)
|
||||
state = start_of_line;
|
||||
else if (!isspace (c))
|
||||
{
|
||||
syntax_error (filename, lnum, _("extra characters following action `%s'"), act);
|
||||
syntax_error (filename, lnum,
|
||||
_("extra characters following action `%s'"),
|
||||
act, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
break;
|
||||
@ -700,7 +720,8 @@ compile (fp, filename, sections)
|
||||
{
|
||||
if (varlen == 0)
|
||||
{
|
||||
syntax_error (filename, lnum, _("missing variable name"));
|
||||
syntax_error (filename, lnum, _("missing variable name"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
state = get_value;
|
||||
@ -708,14 +729,17 @@ compile (fp, filename, sections)
|
||||
}
|
||||
else if (c == '\n' || isspace (c))
|
||||
{
|
||||
syntax_error (filename, lnum, _("missing `=' immediately after variable name"));
|
||||
syntax_error (filename, lnum,
|
||||
_("missing `=' immediately after variable name"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
else if (varlen < sizeof varn)
|
||||
varn[varlen++] = c;
|
||||
else
|
||||
{
|
||||
syntax_error (filename, lnum, _("variable name too long"));
|
||||
syntax_error (filename, lnum, _("variable name too long"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
break;
|
||||
@ -729,7 +753,8 @@ compile (fp, filename, sections)
|
||||
&& add_to_section (§ions[section], val, vallen)
|
||||
&& add_to_section (§ions[section], "", 1)))
|
||||
{
|
||||
syntax_error (filename, lnum, _("section too long"));
|
||||
syntax_error (filename, lnum, _("section too long"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
@ -737,10 +762,16 @@ compile (fp, filename, sections)
|
||||
val[vallen++] = c;
|
||||
else
|
||||
{
|
||||
syntax_error (filename, lnum, _("value too long"));
|
||||
syntax_error (filename, lnum, _("value too long"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case get_equals:
|
||||
case got_equals:
|
||||
case got_varname:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -753,14 +784,11 @@ compile (fp, filename, sections)
|
||||
characters fit, or false if the section's size limit was exceeded.
|
||||
*/
|
||||
static int
|
||||
add_to_section (s, str, len)
|
||||
struct sect *s;
|
||||
const char *str;
|
||||
unsigned int len;
|
||||
add_to_section (struct sect *s, const char *str, unsigned int len)
|
||||
{
|
||||
if (s->cur + len > sizeof s->data)
|
||||
return 0;
|
||||
strncpy (s->data + s->cur, str, len);
|
||||
strncpy ((char *) s->data + s->cur, str, len);
|
||||
s->cur += len;
|
||||
return 1;
|
||||
}
|
||||
@ -769,8 +797,7 @@ add_to_section (s, str, len)
|
||||
auto-generated array in key.c.
|
||||
*/
|
||||
static int
|
||||
lookup_action (actname)
|
||||
const char *actname;
|
||||
lookup_action (const char *actname)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -787,9 +814,7 @@ lookup_action (actname)
|
||||
in radix INFOKEY_RADIX.
|
||||
*/
|
||||
static int
|
||||
putint (i, fp)
|
||||
int i;
|
||||
FILE *fp;
|
||||
putint (int i, FILE *fp)
|
||||
{
|
||||
return fputc (i % INFOKEY_RADIX, fp) != EOF
|
||||
&& fputc ((i / INFOKEY_RADIX) % INFOKEY_RADIX, fp) != EOF;
|
||||
@ -799,10 +824,7 @@ putint (i, fp)
|
||||
empty, simply omit it.
|
||||
*/
|
||||
static int
|
||||
putsect (s, code, fp)
|
||||
struct sect *s;
|
||||
int code;
|
||||
FILE *fp;
|
||||
putsect (struct sect *s, int code, FILE *fp)
|
||||
{
|
||||
if (s->cur == 0)
|
||||
return 1;
|
||||
@ -814,9 +836,7 @@ putsect (s, code, fp)
|
||||
/* Write an entire infokey file, given an array containing its sections.
|
||||
*/
|
||||
static int
|
||||
write_infokey_file (fp, sections)
|
||||
FILE *fp;
|
||||
struct sect sections[];
|
||||
write_infokey_file (FILE *fp, struct sect *sections)
|
||||
{
|
||||
/* Get rid of sections with no effect. */
|
||||
if (sections[info].cur == 1 && sections[info].data[0] == 0)
|
||||
@ -848,10 +868,8 @@ write_infokey_file (fp, sections)
|
||||
progname: "filename", line N: message
|
||||
*/
|
||||
static void
|
||||
error_message (error_code, fmt, a1, a2, a3, a4)
|
||||
int error_code;
|
||||
const char *fmt;
|
||||
const void *a1, *a2, *a3, *a4;
|
||||
error_message (int error_code, const char *fmt,
|
||||
const void *a1, const void *a2, const void *a3, const void *a4)
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
fprintf (stderr, fmt, a1, a2, a3, a4);
|
||||
@ -864,11 +882,9 @@ error_message (error_code, fmt, a1, a2, a3, a4)
|
||||
progname: message
|
||||
*/
|
||||
static void
|
||||
syntax_error (filename, linenum, fmt, a1, a2, a3, a4)
|
||||
const char *filename;
|
||||
unsigned int linenum;
|
||||
const char *fmt;
|
||||
const void *a1, *a2, *a3, *a4;
|
||||
syntax_error (const char *filename,
|
||||
unsigned int linenum, const char *fmt,
|
||||
const void *a1, const void *a2, const void *a3, const void *a4)
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
fprintf (stderr, _("\"%s\", line %u: "), filename, linenum);
|
||||
@ -878,14 +894,14 @@ syntax_error (filename, linenum, fmt, a1, a2, a3, a4)
|
||||
|
||||
/* Produce a gentle rtfm. */
|
||||
static void
|
||||
suggest_help ()
|
||||
suggest_help (void)
|
||||
{
|
||||
fprintf (stderr, _("Try --help for more information.\n"));
|
||||
}
|
||||
|
||||
/* Produce a scaled down description of the available options to Info. */
|
||||
static void
|
||||
short_help ()
|
||||
short_help (void)
|
||||
{
|
||||
printf (_("\
|
||||
Usage: %s [OPTION]... [INPUT-FILE]\n\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* infokey.h -- Custom keystroke definition support.
|
||||
$Id: infokey.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: infokey.h,v 1.2 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* infomap.h -- description of a keymap in Info and related functions.
|
||||
$Id: infomap.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: infomap.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 2001, 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
|
||||
@ -67,15 +67,16 @@ extern Keymap echo_area_keymap;
|
||||
|
||||
/* Return a new keymap which has all the uppercase letters mapped to run
|
||||
the function info_do_lowercase_version (). */
|
||||
extern Keymap keymap_make_keymap ();
|
||||
extern Keymap keymap_make_keymap (void);
|
||||
|
||||
/* Return a new keymap which is a copy of MAP. */
|
||||
extern Keymap keymap_copy_keymap ();
|
||||
extern Keymap keymap_copy_keymap (Keymap map, Keymap rootmap,
|
||||
Keymap newroot);
|
||||
|
||||
/* Free MAP and it's descendents. */
|
||||
extern void keymap_discard_keymap ();
|
||||
extern void keymap_discard_keymap (Keymap map, Keymap rootmap);
|
||||
|
||||
/* Initialize the info keymaps. */
|
||||
extern void initialize_info_keymaps ();
|
||||
extern void initialize_info_keymaps (void);
|
||||
|
||||
#endif /* not INFOMAP_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* key.c -- Generated array containing function names.
|
||||
|
||||
This file was automatically made from various source files with the
|
||||
command "./makedoc". DO NOT EDIT THIS FILE, only "./makedoc.c".
|
||||
command "..//info/makedoc". DO NOT EDIT THIS FILE, only "..//info/makedoc.c".
|
||||
|
||||
Source files groveled to make this file include:
|
||||
|
||||
@ -142,5 +142,5 @@ FUNCTION_KEY function_key_array[] = {
|
||||
/* Commands found in "./variables.c". */
|
||||
{ "describe-variable", A_describe_variable },
|
||||
{ "set-variable", A_set_variable },
|
||||
(char *)0
|
||||
{ (char *)NULL, 0 }
|
||||
};
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* m-x.c -- Meta-x minibuffer reader.
|
||||
$Id: m-x.c,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: m-x.c,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 1998, 2001, 2002, 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
|
||||
@ -17,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.
|
||||
|
||||
Written by Brian Fox (bfox@ai.mit.edu). */
|
||||
Originally written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "funs.h"
|
||||
@ -32,9 +33,7 @@
|
||||
name. A return value of NULL indicates that no function name could
|
||||
be read. */
|
||||
char *
|
||||
read_function_name (prompt, window)
|
||||
char *prompt;
|
||||
WINDOW *window;
|
||||
read_function_name (char *prompt, WINDOW *window)
|
||||
{
|
||||
register int i;
|
||||
char *line;
|
||||
@ -71,7 +70,7 @@ DECLARE_INFO_COMMAND (describe_command,
|
||||
{
|
||||
char *line;
|
||||
|
||||
line = read_function_name (_("Describe command: "), window);
|
||||
line = read_function_name ((char *) _("Describe command: "), window);
|
||||
|
||||
if (!line)
|
||||
{
|
||||
@ -138,7 +137,8 @@ DECLARE_INFO_COMMAND (info_execute_command,
|
||||
(strncmp (line, "echo-area-", 10) == 0))
|
||||
{
|
||||
free (line);
|
||||
info_error (_("Cannot execute an `echo-area' command here."));
|
||||
info_error ((char *) _("Cannot execute an `echo-area' command here."),
|
||||
NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -148,7 +148,10 @@ DECLARE_INFO_COMMAND (info_execute_command,
|
||||
if (!command)
|
||||
return;
|
||||
|
||||
(*InfoFunction(command)) (active_window, count, 0);
|
||||
if (InfoFunction(command))
|
||||
(*InfoFunction(command)) (active_window, count, 0);
|
||||
else
|
||||
info_error ((char *) _("Undefined command: %s"), line, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* man.c: How to read and format man files.
|
||||
$Id: man.c,v 1.2 2003/05/13 16:37:54 karl Exp $
|
||||
$Id: man.c,v 1.4 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1995, 1997, 1998, 1999, 2000, 2002, 2003 Free Software
|
||||
Copyright (C) 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -53,22 +53,20 @@ static char const * const exec_extensions[] = {
|
||||
static char const * const exec_extensions[] = { "", NULL };
|
||||
#endif
|
||||
|
||||
static char *read_from_fd ();
|
||||
static void clean_manpage ();
|
||||
static NODE *manpage_node_of_file_buffer ();
|
||||
static char *get_manpage_contents ();
|
||||
static char *read_from_fd (int fd);
|
||||
static void clean_manpage (char *manpage);
|
||||
static NODE *manpage_node_of_file_buffer (FILE_BUFFER *file_buffer,
|
||||
char *pagename);
|
||||
static char *get_manpage_contents (char *pagename);
|
||||
|
||||
NODE *
|
||||
make_manpage_node (pagename)
|
||||
char *pagename;
|
||||
make_manpage_node (char *pagename)
|
||||
{
|
||||
return (info_get_node (MANPAGE_FILE_BUFFER_NAME, pagename));
|
||||
}
|
||||
|
||||
NODE *
|
||||
get_manpage_node (file_buffer, pagename)
|
||||
FILE_BUFFER *file_buffer;
|
||||
char *pagename;
|
||||
get_manpage_node (FILE_BUFFER *file_buffer, char *pagename)
|
||||
{
|
||||
NODE *node;
|
||||
|
||||
@ -121,23 +119,25 @@ get_manpage_node (file_buffer, pagename)
|
||||
|
||||
for (in = 0; in < info_win->nodes_index; in++)
|
||||
{
|
||||
NODE *node = info_win->nodes[in];
|
||||
NODE *tmp_node = info_win->nodes[in];
|
||||
|
||||
/* It really only suffices to see that node->filename
|
||||
is "*manpages*". But after several hours of
|
||||
debugging this, would you blame me for being a bit
|
||||
paranoid? */
|
||||
if (node && node->filename && node->contents &&
|
||||
strcmp (node->filename,
|
||||
MANPAGE_FILE_BUFFER_NAME) == 0 &&
|
||||
node->contents >= old_contents &&
|
||||
node->contents + node->nodelen <= old_contents_end)
|
||||
if (tmp_node && tmp_node->filename
|
||||
&& tmp_node->contents
|
||||
&& strcmp (tmp_node->filename,
|
||||
MANPAGE_FILE_BUFFER_NAME) == 0
|
||||
&& tmp_node->contents >= old_contents
|
||||
&& tmp_node->contents + tmp_node->nodelen
|
||||
<= old_contents_end)
|
||||
{
|
||||
info_win->nodes[in] =
|
||||
manpage_node_of_file_buffer (file_buffer,
|
||||
node->nodename);
|
||||
free (node->nodename);
|
||||
free (node);
|
||||
tmp_node->nodename);
|
||||
free (tmp_node->nodename);
|
||||
free (tmp_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -151,7 +151,7 @@ get_manpage_node (file_buffer, pagename)
|
||||
}
|
||||
|
||||
FILE_BUFFER *
|
||||
create_manpage_file_buffer ()
|
||||
create_manpage_file_buffer (void)
|
||||
{
|
||||
FILE_BUFFER *file_buffer = make_file_buffer ();
|
||||
file_buffer->filename = xstrdup (MANPAGE_FILE_BUFFER_NAME);
|
||||
@ -168,8 +168,7 @@ create_manpage_file_buffer ()
|
||||
one that is an executable file, return it as a new string. Otherwise,
|
||||
return a NULL pointer. */
|
||||
static char *
|
||||
executable_file_in_path (filename, path)
|
||||
char *filename, *path;
|
||||
executable_file_in_path (char *filename, char *path)
|
||||
{
|
||||
struct stat finfo;
|
||||
char *temp_dirname;
|
||||
@ -223,7 +222,7 @@ executable_file_in_path (filename, path)
|
||||
|
||||
/* Return the full pathname of the system man page formatter. */
|
||||
static char *
|
||||
find_man_formatter ()
|
||||
find_man_formatter (void)
|
||||
{
|
||||
return (executable_file_in_path ("man", (char *)getenv ("PATH")));
|
||||
}
|
||||
@ -232,8 +231,7 @@ static char *manpage_pagename = (char *)NULL;
|
||||
static char *manpage_section = (char *)NULL;
|
||||
|
||||
static void
|
||||
get_page_and_section (pagename)
|
||||
char *pagename;
|
||||
get_page_and_section (char *pagename)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@ -268,21 +266,19 @@ get_page_and_section (pagename)
|
||||
|
||||
#if PIPE_USE_FORK
|
||||
static void
|
||||
reap_children (sig)
|
||||
int sig;
|
||||
reap_children (int sig)
|
||||
{
|
||||
wait (NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static char *
|
||||
get_manpage_contents (pagename)
|
||||
char *pagename;
|
||||
get_manpage_contents (char *pagename)
|
||||
{
|
||||
static char *formatter_args[4] = { (char *)NULL };
|
||||
int pipes[2];
|
||||
pid_t child;
|
||||
RETSIGTYPE (*sigsave) ();
|
||||
RETSIGTYPE (*sigsave) (int signum);
|
||||
char *formatted_page = NULL;
|
||||
int arg_index = 1;
|
||||
|
||||
@ -376,8 +372,7 @@ get_manpage_contents (pagename)
|
||||
}
|
||||
|
||||
static void
|
||||
clean_manpage (manpage)
|
||||
char *manpage;
|
||||
clean_manpage (char *manpage)
|
||||
{
|
||||
register int i, j;
|
||||
int newline_count = 0;
|
||||
@ -434,9 +429,7 @@ clean_manpage (manpage)
|
||||
}
|
||||
|
||||
static NODE *
|
||||
manpage_node_of_file_buffer (file_buffer, pagename)
|
||||
FILE_BUFFER *file_buffer;
|
||||
char *pagename;
|
||||
manpage_node_of_file_buffer (FILE_BUFFER *file_buffer, char *pagename)
|
||||
{
|
||||
NODE *node = (NODE *)NULL;
|
||||
TAG *tag = (TAG *)NULL;
|
||||
@ -470,8 +463,7 @@ manpage_node_of_file_buffer (file_buffer, pagename)
|
||||
}
|
||||
|
||||
static char *
|
||||
read_from_fd (fd)
|
||||
int fd;
|
||||
read_from_fd (int fd)
|
||||
{
|
||||
struct timeval timeout;
|
||||
char *buffer = (char *)NULL;
|
||||
@ -551,8 +543,7 @@ static char *reference_section_starters[] =
|
||||
static SEARCH_BINDING frs_binding;
|
||||
|
||||
static SEARCH_BINDING *
|
||||
find_reference_section (node)
|
||||
NODE *node;
|
||||
find_reference_section (NODE *node)
|
||||
{
|
||||
register int i;
|
||||
long position = -1;
|
||||
@ -591,8 +582,7 @@ find_reference_section (node)
|
||||
}
|
||||
|
||||
REFERENCE **
|
||||
xrefs_of_manpage (node)
|
||||
NODE *node;
|
||||
xrefs_of_manpage (NODE *node)
|
||||
{
|
||||
SEARCH_BINDING *reference_section;
|
||||
REFERENCE **refs = (REFERENCE **)NULL;
|
||||
@ -660,10 +650,7 @@ xrefs_of_manpage (node)
|
||||
}
|
||||
|
||||
long
|
||||
locate_manpage_xref (node, start, dir)
|
||||
NODE *node;
|
||||
long start;
|
||||
int dir;
|
||||
locate_manpage_xref (NODE *node, long int start, int dir)
|
||||
{
|
||||
REFERENCE **refs;
|
||||
long position = -1;
|
||||
@ -710,9 +697,7 @@ locate_manpage_xref (node, start, dir)
|
||||
a START and END value of 0 -- strlen (window-line-containing-point).
|
||||
The BUFFER is a pointer to the start of that line. */
|
||||
REFERENCE **
|
||||
manpage_xrefs_in_binding (node, binding)
|
||||
NODE *node;
|
||||
SEARCH_BINDING *binding;
|
||||
manpage_xrefs_in_binding (NODE *node, SEARCH_BINDING *binding)
|
||||
{
|
||||
register int i;
|
||||
REFERENCE **all_refs = xrefs_of_manpage (node);
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* man.h: Defines and external function declarations for man.c.
|
||||
$Id: man.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: man.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993, 97 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 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
|
||||
@ -27,11 +27,13 @@
|
||||
|
||||
#define MANPAGE_FILE_BUFFER_NAME "*manpages*"
|
||||
|
||||
extern NODE *make_manpage_node (/* char *pagename */);
|
||||
extern NODE *get_manpage_node (/* FILE_BUFFER *file_buffer, char *pagename */);
|
||||
extern FILE_BUFFER *create_manpage_file_buffer (/* void */);
|
||||
extern long locate_manpage_xref (/* NODE *node, long start, int dir */);
|
||||
extern REFERENCE **xrefs_of_manpage (/* NODE *node */);
|
||||
extern REFERENCE **manpage_xrefs_in_binding (/* NODE *node, SEARCH_BINDING *binding */);
|
||||
extern NODE *make_manpage_node (char *pagename);
|
||||
extern NODE *get_manpage_node (FILE_BUFFER *file_buffer,
|
||||
char *pagename);
|
||||
extern FILE_BUFFER *create_manpage_file_buffer (void);
|
||||
extern long locate_manpage_xref (NODE *node, long int start, int dir);
|
||||
extern REFERENCE **xrefs_of_manpage (NODE *node);
|
||||
extern REFERENCE **manpage_xrefs_in_binding (NODE *node,
|
||||
SEARCH_BINDING *binding);
|
||||
|
||||
#endif /* INFO_MAN_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* nodes.c -- how to get an Info file and node.
|
||||
$Id: nodes.c,v 1.2 2003/05/13 16:37:54 karl Exp $
|
||||
$Id: nodes.c,v 1.4 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1998, 1999, 2000, 2002, 2003 Free Software
|
||||
Copyright (C) 1993, 1998, 1999, 2000, 2002, 2003, 2004 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -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.
|
||||
|
||||
Written by Brian Fox (bfox@ai.mit.edu). */
|
||||
Originally written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
|
||||
@ -31,16 +31,23 @@
|
||||
# include "man.h"
|
||||
#endif /* HANDLE_MAN_PAGES */
|
||||
|
||||
static void forget_info_file (), remember_info_file ();
|
||||
static void free_file_buffer_tags (), free_info_tag ();
|
||||
static void get_nodes_of_tags_table (), get_nodes_of_info_file ();
|
||||
static void get_tags_of_indirect_tags_table ();
|
||||
static void info_reload_file_buffer_contents ();
|
||||
static char *adjust_nodestart ();
|
||||
static FILE_BUFFER *info_load_file_internal (), *info_find_file_internal ();
|
||||
static NODE *info_node_of_file_buffer_tags ();
|
||||
static void forget_info_file (char *filename);
|
||||
static void remember_info_file (FILE_BUFFER *file_buffer);
|
||||
static void free_file_buffer_tags (FILE_BUFFER *file_buffer);
|
||||
static void free_info_tag (TAG *tag);
|
||||
static void get_nodes_of_tags_table (FILE_BUFFER *file_buffer,
|
||||
SEARCH_BINDING *buffer_binding);
|
||||
static void get_nodes_of_info_file (FILE_BUFFER *file_buffer);
|
||||
static void get_tags_of_indirect_tags_table (FILE_BUFFER *file_buffer,
|
||||
SEARCH_BINDING *indirect_binding, SEARCH_BINDING *tags_binding);
|
||||
static void info_reload_file_buffer_contents (FILE_BUFFER *fb);
|
||||
static char *adjust_nodestart (NODE *node, int min, int max);
|
||||
static FILE_BUFFER *info_load_file_internal (char *filename, int get_tags);
|
||||
static FILE_BUFFER *info_find_file_internal (char *filename, int get_tags);
|
||||
static NODE *info_node_of_file_buffer_tags (FILE_BUFFER *file_buffer,
|
||||
char *nodename);
|
||||
|
||||
static long get_node_length ();
|
||||
static long get_node_length (SEARCH_BINDING *binding);
|
||||
|
||||
/* Magic number that RMS used to decide how much a tags table pointer could
|
||||
be off by. I feel that it should be much smaller, like 4. */
|
||||
@ -65,15 +72,14 @@ int info_loaded_files_slots = 0;
|
||||
/* Public functions for node manipulation. */
|
||||
|
||||
/* Used to build `dir' menu from `localdir' files found in INFOPATH. */
|
||||
extern void maybe_build_dir_node ();
|
||||
extern void maybe_build_dir_node (char *dirname);
|
||||
|
||||
/* Return a pointer to a NODE structure for the Info node (FILENAME)NODENAME.
|
||||
If FILENAME is NULL, `dir' is used.
|
||||
IF NODENAME is NULL, `Top' is used.
|
||||
If the node cannot be found, return NULL. */
|
||||
NODE *
|
||||
info_get_node (filename, nodename)
|
||||
char *filename, *nodename;
|
||||
info_get_node (char *filename, char *nodename)
|
||||
{
|
||||
NODE *node;
|
||||
FILE_BUFFER *file_buffer = NULL;
|
||||
@ -128,9 +134,7 @@ info_get_node (filename, nodename)
|
||||
nodename of "Top" is used. If the node cannot be found, return a
|
||||
NULL pointer. */
|
||||
NODE *
|
||||
info_get_node_of_file_buffer (nodename, file_buffer)
|
||||
char *nodename;
|
||||
FILE_BUFFER *file_buffer;
|
||||
info_get_node_of_file_buffer (char *nodename, FILE_BUFFER *file_buffer)
|
||||
{
|
||||
NODE *node = NULL;
|
||||
|
||||
@ -188,8 +192,7 @@ info_get_node_of_file_buffer (nodename, file_buffer)
|
||||
and add it to the list of loaded files. If the file cannot be found,
|
||||
return a NULL FILE_BUFFER *. */
|
||||
FILE_BUFFER *
|
||||
info_find_file (filename)
|
||||
char *filename;
|
||||
info_find_file (char *filename)
|
||||
{
|
||||
return info_find_file_internal (filename, INFO_GET_TAGS);
|
||||
}
|
||||
@ -197,8 +200,7 @@ info_find_file (filename)
|
||||
/* Load the info file FILENAME, remembering information about it in a
|
||||
file buffer. */
|
||||
FILE_BUFFER *
|
||||
info_load_file (filename)
|
||||
char *filename;
|
||||
info_load_file (char *filename)
|
||||
{
|
||||
return info_load_file_internal (filename, INFO_GET_TAGS);
|
||||
}
|
||||
@ -212,9 +214,7 @@ info_load_file (filename)
|
||||
function is called by info_get_node () when we already have a valid
|
||||
tags table describing the nodes, it is unnecessary. */
|
||||
static FILE_BUFFER *
|
||||
info_find_file_internal (filename, get_tags)
|
||||
char *filename;
|
||||
int get_tags;
|
||||
info_find_file_internal (char *filename, int get_tags)
|
||||
{
|
||||
int i;
|
||||
FILE_BUFFER *file_buffer;
|
||||
@ -306,9 +306,7 @@ info_find_file_internal (filename, get_tags)
|
||||
default behaviour when info_load_file () is called, but it is not
|
||||
necessary when loading a subfile for which we already have tags. */
|
||||
static FILE_BUFFER *
|
||||
info_load_file_internal (filename, get_tags)
|
||||
char *filename;
|
||||
int get_tags;
|
||||
info_load_file_internal (char *filename, int get_tags)
|
||||
{
|
||||
char *fullpath, *contents;
|
||||
long filesize;
|
||||
@ -332,23 +330,23 @@ info_load_file_internal (filename, get_tags)
|
||||
if (retcode < 0)
|
||||
{
|
||||
char *lowered_name;
|
||||
char *basename;
|
||||
char *tmp_basename;
|
||||
|
||||
lowered_name = xstrdup (filename);
|
||||
basename = filename_non_directory (lowered_name);
|
||||
tmp_basename = filename_non_directory (lowered_name);
|
||||
|
||||
while (*basename)
|
||||
while (*tmp_basename)
|
||||
{
|
||||
if (isupper (*basename))
|
||||
*basename = tolower (*basename);
|
||||
if (isupper (*tmp_basename))
|
||||
*tmp_basename = tolower (*tmp_basename);
|
||||
|
||||
basename++;
|
||||
tmp_basename++;
|
||||
}
|
||||
|
||||
fullpath = info_find_fullpath (lowered_name);
|
||||
free (lowered_name);
|
||||
|
||||
retcode = stat (fullpath, &finfo);
|
||||
free (lowered_name);
|
||||
}
|
||||
|
||||
/* If the file wasn't found, give up, returning a NULL pointer. */
|
||||
@ -385,8 +383,7 @@ info_load_file_internal (filename, get_tags)
|
||||
/* Grovel FILE_BUFFER->contents finding tags and nodes, and filling in the
|
||||
various slots. This can also be used to rebuild a tag or node table. */
|
||||
void
|
||||
build_tags_and_nodes (file_buffer)
|
||||
FILE_BUFFER *file_buffer;
|
||||
build_tags_and_nodes (FILE_BUFFER *file_buffer)
|
||||
{
|
||||
SEARCH_BINDING binding;
|
||||
long position;
|
||||
@ -496,8 +493,7 @@ build_tags_and_nodes (file_buffer)
|
||||
FILE_BUFFER->tags, and the number of allocated slots in
|
||||
FILE_BUFFER->tags_slots. */
|
||||
static void
|
||||
get_nodes_of_info_file (file_buffer)
|
||||
FILE_BUFFER *file_buffer;
|
||||
get_nodes_of_info_file (FILE_BUFFER *file_buffer)
|
||||
{
|
||||
long nodestart;
|
||||
int tags_index = 0;
|
||||
@ -573,8 +569,7 @@ get_nodes_of_info_file (file_buffer)
|
||||
|
||||
/* Return the length of the node which starts at BINDING. */
|
||||
static long
|
||||
get_node_length (binding)
|
||||
SEARCH_BINDING *binding;
|
||||
get_node_length (SEARCH_BINDING *binding)
|
||||
{
|
||||
int i;
|
||||
char *body;
|
||||
@ -591,33 +586,33 @@ get_node_length (binding)
|
||||
/* Build and save the array of nodes in FILE_BUFFER by searching through the
|
||||
contents of BUFFER_BINDING for a tags table, and groveling the contents. */
|
||||
static void
|
||||
get_nodes_of_tags_table (file_buffer, buffer_binding)
|
||||
FILE_BUFFER *file_buffer;
|
||||
SEARCH_BINDING *buffer_binding;
|
||||
get_nodes_of_tags_table (FILE_BUFFER *file_buffer,
|
||||
SEARCH_BINDING *buffer_binding)
|
||||
{
|
||||
int name_offset;
|
||||
SEARCH_BINDING *search;
|
||||
SEARCH_BINDING *tmp_search;
|
||||
long position;
|
||||
int tags_index = 0;
|
||||
|
||||
search = copy_binding (buffer_binding);
|
||||
tmp_search = copy_binding (buffer_binding);
|
||||
|
||||
/* Find the start of the tags table. */
|
||||
position = find_tags_table (search);
|
||||
position = find_tags_table (tmp_search);
|
||||
|
||||
/* If none, we're all done. */
|
||||
if (position == -1)
|
||||
return;
|
||||
|
||||
/* Move to one character before the start of the actual table. */
|
||||
search->start = position;
|
||||
search->start += skip_node_separator (search->buffer + search->start);
|
||||
search->start += strlen (TAGS_TABLE_BEG_LABEL);
|
||||
search->start--;
|
||||
tmp_search->start = position;
|
||||
tmp_search->start += skip_node_separator
|
||||
(tmp_search->buffer + tmp_search->start);
|
||||
tmp_search->start += strlen (TAGS_TABLE_BEG_LABEL);
|
||||
tmp_search->start--;
|
||||
|
||||
/* The tag table consists of lines containing node names and positions.
|
||||
Do each line until we find one that doesn't contain a node name. */
|
||||
while ((position = search_forward ("\n", search)) != -1)
|
||||
while ((position = search_forward ("\n", tmp_search)) != -1)
|
||||
{
|
||||
TAG *entry;
|
||||
char *nodedef;
|
||||
@ -625,22 +620,22 @@ get_nodes_of_tags_table (file_buffer, buffer_binding)
|
||||
int anchor = 0;
|
||||
|
||||
/* Prepare to skip this line. */
|
||||
search->start = position;
|
||||
search->start++;
|
||||
tmp_search->start = position;
|
||||
tmp_search->start++;
|
||||
|
||||
/* Skip past informative "(Indirect)" tags table line. */
|
||||
if (!tags_index && looking_at (TAGS_TABLE_IS_INDIRECT_LABEL, search))
|
||||
if (!tags_index && looking_at (TAGS_TABLE_IS_INDIRECT_LABEL, tmp_search))
|
||||
continue;
|
||||
|
||||
/* Find the label preceding the node name. */
|
||||
name_offset =
|
||||
string_in_line (INFO_NODE_LABEL, search->buffer + search->start);
|
||||
string_in_line (INFO_NODE_LABEL, tmp_search->buffer + tmp_search->start);
|
||||
|
||||
/* If no node label, maybe it's an anchor. */
|
||||
if (name_offset == -1)
|
||||
{
|
||||
name_offset = string_in_line (INFO_REF_LABEL,
|
||||
search->buffer + search->start);
|
||||
tmp_search->buffer + tmp_search->start);
|
||||
if (name_offset != -1)
|
||||
anchor = 1;
|
||||
}
|
||||
@ -653,8 +648,8 @@ get_nodes_of_tags_table (file_buffer, buffer_binding)
|
||||
entry = xmalloc (sizeof (TAG));
|
||||
|
||||
/* Find the beginning of the node definition. */
|
||||
search->start += name_offset;
|
||||
nodedef = search->buffer + search->start;
|
||||
tmp_search->start += name_offset;
|
||||
nodedef = tmp_search->buffer + tmp_search->start;
|
||||
nodedef += skip_whitespace (nodedef);
|
||||
|
||||
/* Move past the node's name in this tag to the TAGSEP character. */
|
||||
@ -682,7 +677,7 @@ get_nodes_of_tags_table (file_buffer, buffer_binding)
|
||||
add_pointer_to_array (entry, tags_index, file_buffer->tags,
|
||||
file_buffer->tags_slots, 100, TAG *);
|
||||
}
|
||||
free (search);
|
||||
free (tmp_search);
|
||||
}
|
||||
|
||||
/* A structure used only in `get_tags_of_indirect_tags_table' to hold onto
|
||||
@ -696,9 +691,8 @@ typedef struct {
|
||||
subfiles of every node which appears in TAGS_BINDING. The 2nd argument is
|
||||
a binding surrounding the indirect files list. */
|
||||
static void
|
||||
get_tags_of_indirect_tags_table (file_buffer, indirect_binding, tags_binding)
|
||||
FILE_BUFFER *file_buffer;
|
||||
SEARCH_BINDING *indirect_binding, *tags_binding;
|
||||
get_tags_of_indirect_tags_table (FILE_BUFFER *file_buffer,
|
||||
SEARCH_BINDING *indirect_binding, SEARCH_BINDING *tags_binding)
|
||||
{
|
||||
int i;
|
||||
SUBFILE **subfiles = NULL;
|
||||
@ -863,9 +857,7 @@ get_tags_of_indirect_tags_table (file_buffer, indirect_binding, tags_binding)
|
||||
/* Return the node that contains TAG in FILE_BUFFER, else
|
||||
(pathologically) NULL. Called from info_node_of_file_buffer_tags. */
|
||||
static NODE *
|
||||
find_node_of_anchor (file_buffer, tag)
|
||||
FILE_BUFFER *file_buffer;
|
||||
TAG *tag;
|
||||
find_node_of_anchor (FILE_BUFFER *file_buffer, TAG *tag)
|
||||
{
|
||||
int anchor_pos, node_pos;
|
||||
TAG *node_tag;
|
||||
@ -920,7 +912,7 @@ find_node_of_anchor (file_buffer, tag)
|
||||
/* Otherwise an anchor at the end of a node ends up displaying at
|
||||
the end of the last line of the node (way over on the right of
|
||||
the screen), which looks wrong. */
|
||||
if (node->display_pos >= node->nodelen)
|
||||
if (node->display_pos >= (unsigned long) node->nodelen)
|
||||
node->display_pos = node->nodelen - 1;
|
||||
|
||||
/* Don't search in the node for the xref text, it's not there. */
|
||||
@ -934,9 +926,7 @@ find_node_of_anchor (file_buffer, tag)
|
||||
/* Return the node from FILE_BUFFER which matches NODENAME by searching
|
||||
the tags table in FILE_BUFFER, or NULL. */
|
||||
static NODE *
|
||||
info_node_of_file_buffer_tags (file_buffer, nodename)
|
||||
FILE_BUFFER *file_buffer;
|
||||
char *nodename;
|
||||
info_node_of_file_buffer_tags (FILE_BUFFER *file_buffer, char *nodename)
|
||||
{
|
||||
TAG *tag;
|
||||
int i;
|
||||
@ -1060,7 +1050,7 @@ info_node_of_file_buffer_tags (file_buffer, nodename)
|
||||
|
||||
/* Create a new, empty file buffer. */
|
||||
FILE_BUFFER *
|
||||
make_file_buffer ()
|
||||
make_file_buffer (void)
|
||||
{
|
||||
FILE_BUFFER *file_buffer = xmalloc (sizeof (FILE_BUFFER));
|
||||
|
||||
@ -1076,8 +1066,7 @@ make_file_buffer ()
|
||||
|
||||
/* Add FILE_BUFFER to our list of already loaded info files. */
|
||||
static void
|
||||
remember_info_file (file_buffer)
|
||||
FILE_BUFFER *file_buffer;
|
||||
remember_info_file (FILE_BUFFER *file_buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1090,8 +1079,7 @@ remember_info_file (file_buffer)
|
||||
|
||||
/* Forget the contents, tags table, nodes list, and names of FILENAME. */
|
||||
static void
|
||||
forget_info_file (filename)
|
||||
char *filename;
|
||||
forget_info_file (char *filename)
|
||||
{
|
||||
int i;
|
||||
FILE_BUFFER *file_buffer;
|
||||
@ -1127,8 +1115,7 @@ forget_info_file (filename)
|
||||
|
||||
/* Free the tags (if any) associated with FILE_BUFFER. */
|
||||
static void
|
||||
free_file_buffer_tags (file_buffer)
|
||||
FILE_BUFFER *file_buffer;
|
||||
free_file_buffer_tags (FILE_BUFFER *file_buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1156,8 +1143,7 @@ free_file_buffer_tags (file_buffer)
|
||||
|
||||
/* Free the data associated with TAG, as well as TAG itself. */
|
||||
static void
|
||||
free_info_tag (tag)
|
||||
TAG *tag;
|
||||
free_info_tag (TAG *tag)
|
||||
{
|
||||
free (tag->nodename);
|
||||
|
||||
@ -1174,8 +1160,7 @@ free_info_tag (tag)
|
||||
the file was already loaded at least once successfully, so the tags and/or
|
||||
nodes members are still correctly filled. */
|
||||
static void
|
||||
info_reload_file_buffer_contents (fb)
|
||||
FILE_BUFFER *fb;
|
||||
info_reload_file_buffer_contents (FILE_BUFFER *fb)
|
||||
{
|
||||
int is_compressed;
|
||||
|
||||
@ -1205,9 +1190,7 @@ info_reload_file_buffer_contents (fb)
|
||||
position directly on the separator that precedes this node. If the node
|
||||
could not be found, return a NULL pointer. */
|
||||
static char *
|
||||
adjust_nodestart (node, min, max)
|
||||
NODE *node;
|
||||
int min, max;
|
||||
adjust_nodestart (NODE *node, int min, int max)
|
||||
{
|
||||
long position;
|
||||
SEARCH_BINDING node_body;
|
||||
@ -1248,7 +1231,7 @@ adjust_nodestart (node, min, max)
|
||||
nodedef += offset;
|
||||
nodedef += skip_whitespace (nodedef);
|
||||
offset = skip_node_characters (nodedef, DONT_SKIP_NEWLINES);
|
||||
if ((offset == strlen (node->nodename)) &&
|
||||
if (((unsigned int) offset == strlen (node->nodename)) &&
|
||||
(strncmp (node->nodename, nodedef, offset) == 0))
|
||||
{
|
||||
node->contents = nodestart;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* nodes.h -- How we represent nodes internally.
|
||||
$Id: nodes.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: nodes.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 1998, 2002, 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
|
||||
@ -123,33 +123,34 @@ extern int info_loaded_files_slots;
|
||||
already, or it may not. If it does not already appear, find the file,
|
||||
and add it to the list of loaded files. If the file cannot be found,
|
||||
return a NULL FILE_BUFFER *. */
|
||||
extern FILE_BUFFER *info_find_file ();
|
||||
extern FILE_BUFFER *info_find_file (char *filename);
|
||||
|
||||
/* Force load the file named FILENAME, and return the information structure
|
||||
describing this file. Even if the file was already loaded, this loads
|
||||
a new buffer, rebuilds tags and nodes, and returns a new FILE_BUFFER *. */
|
||||
extern FILE_BUFFER *info_load_file ();
|
||||
extern FILE_BUFFER *info_load_file (char *filename);
|
||||
|
||||
/* Return a pointer to a NODE structure for the Info node (FILENAME)NODENAME.
|
||||
FILENAME can be passed as NULL, in which case the filename of "dir" is used.
|
||||
NODENAME can be passed as NULL, in which case the nodename of "Top" is used.
|
||||
If the node cannot be found, return a NULL pointer. */
|
||||
extern NODE *info_get_node ();
|
||||
extern NODE *info_get_node (char *filename, char *nodename);
|
||||
|
||||
/* Return a pointer to a NODE structure for the Info node NODENAME in
|
||||
FILE_BUFFER. NODENAME can be passed as NULL, in which case the
|
||||
nodename of "Top" is used. If the node cannot be found, return a
|
||||
NULL pointer. */
|
||||
extern NODE *info_get_node_of_file_buffer ();
|
||||
extern NODE *info_get_node_of_file_buffer (char *nodename,
|
||||
FILE_BUFFER *file_buffer);
|
||||
|
||||
/* Grovel FILE_BUFFER->contents finding tags and nodes, and filling in the
|
||||
various slots. This can also be used to rebuild a tag or node table. */
|
||||
extern void build_tags_and_nodes ();
|
||||
extern void build_tags_and_nodes (FILE_BUFFER *file_buffer);
|
||||
|
||||
/* When non-zero, this is a string describing the most recent file error. */
|
||||
extern char *info_recent_file_error;
|
||||
|
||||
/* Create a new, empty file buffer. */
|
||||
extern FILE_BUFFER *make_file_buffer ();
|
||||
extern FILE_BUFFER *make_file_buffer (void);
|
||||
|
||||
#endif /* not NODES_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* search.c -- searching large bodies of text.
|
||||
$Id: search.c,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: search.c,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 1998, 2002, 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
|
||||
@ -36,9 +36,7 @@
|
||||
|
||||
/* A function which makes a binding with buffer and bounds. */
|
||||
SEARCH_BINDING *
|
||||
make_binding (buffer, start, end)
|
||||
char *buffer;
|
||||
long start, end;
|
||||
make_binding (char *buffer, long int start, long int end)
|
||||
{
|
||||
SEARCH_BINDING *binding;
|
||||
|
||||
@ -53,8 +51,7 @@ make_binding (buffer, start, end)
|
||||
|
||||
/* Make a copy of BINDING without duplicating the data. */
|
||||
SEARCH_BINDING *
|
||||
copy_binding (binding)
|
||||
SEARCH_BINDING *binding;
|
||||
copy_binding (SEARCH_BINDING *binding)
|
||||
{
|
||||
SEARCH_BINDING *copy;
|
||||
|
||||
@ -73,9 +70,7 @@ copy_binding (binding)
|
||||
/* Search forwards or backwards for the text delimited by BINDING.
|
||||
The search is forwards if BINDING->start is greater than BINDING->end. */
|
||||
long
|
||||
search (string, binding)
|
||||
char *string;
|
||||
SEARCH_BINDING *binding;
|
||||
search (char *string, SEARCH_BINDING *binding)
|
||||
{
|
||||
long result;
|
||||
|
||||
@ -90,9 +85,7 @@ search (string, binding)
|
||||
|
||||
/* Search forwards for STRING through the text delimited in BINDING. */
|
||||
long
|
||||
search_forward (string, binding)
|
||||
char *string;
|
||||
SEARCH_BINDING *binding;
|
||||
search_forward (char *string, SEARCH_BINDING *binding)
|
||||
{
|
||||
register int c, i, len;
|
||||
register char *buff, *end;
|
||||
@ -151,9 +144,7 @@ search_forward (string, binding)
|
||||
|
||||
/* Search for STRING backwards through the text delimited in BINDING. */
|
||||
long
|
||||
search_backward (input_string, binding)
|
||||
char *input_string;
|
||||
SEARCH_BINDING *binding;
|
||||
search_backward (char *input_string, SEARCH_BINDING *binding)
|
||||
{
|
||||
register int c, i, len;
|
||||
register char *buff, *end;
|
||||
@ -225,8 +216,7 @@ search_backward (input_string, binding)
|
||||
Return an offset of -1 if STRING does not appear in LINE. The search
|
||||
is bound by the end of the line (i.e., either NEWLINE or 0). */
|
||||
int
|
||||
string_in_line (string, line)
|
||||
char *string, *line;
|
||||
string_in_line (char *string, char *line)
|
||||
{
|
||||
register int end;
|
||||
SEARCH_BINDING binding;
|
||||
@ -245,9 +235,7 @@ string_in_line (string, line)
|
||||
|
||||
/* Return non-zero if STRING is the first text to appear at BINDING. */
|
||||
int
|
||||
looking_at (string, binding)
|
||||
char *string;
|
||||
SEARCH_BINDING *binding;
|
||||
looking_at (char *string, SEARCH_BINDING *binding)
|
||||
{
|
||||
long search_end;
|
||||
|
||||
@ -273,8 +261,7 @@ looking_at (string, binding)
|
||||
|
||||
/* Return the index of the first non-whitespace character in STRING. */
|
||||
int
|
||||
skip_whitespace (string)
|
||||
char *string;
|
||||
skip_whitespace (char *string)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@ -285,8 +272,7 @@ skip_whitespace (string)
|
||||
/* Return the index of the first non-whitespace or newline character in
|
||||
STRING. */
|
||||
int
|
||||
skip_whitespace_and_newlines (string)
|
||||
char *string;
|
||||
skip_whitespace_and_newlines (char *string)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@ -296,8 +282,7 @@ skip_whitespace_and_newlines (string)
|
||||
|
||||
/* Return the index of the first whitespace character in STRING. */
|
||||
int
|
||||
skip_non_whitespace (string)
|
||||
char *string;
|
||||
skip_non_whitespace (char *string)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@ -313,9 +298,7 @@ skip_non_whitespace (string)
|
||||
the period. If second argument NEWLINES_OKAY is non-zero, newlines should
|
||||
be skipped while parsing out the nodename specification. */
|
||||
int
|
||||
skip_node_characters (string, newlines_okay)
|
||||
char *string;
|
||||
int newlines_okay;
|
||||
skip_node_characters (char *string, int newlines_okay)
|
||||
{
|
||||
register int c, i = 0;
|
||||
int paren_seen = 0;
|
||||
@ -381,8 +364,7 @@ skip_node_characters (string, newlines_okay)
|
||||
BINDING-buffer. The search starts at BINDING->start. Return -1 if no node
|
||||
separator was found. */
|
||||
long
|
||||
find_node_separator (binding)
|
||||
SEARCH_BINDING *binding;
|
||||
find_node_separator (SEARCH_BINDING *binding)
|
||||
{
|
||||
register long i;
|
||||
char *body;
|
||||
@ -407,8 +389,7 @@ find_node_separator (binding)
|
||||
/* Return the length of the node separator characters that BODY is
|
||||
currently pointing at. */
|
||||
int
|
||||
skip_node_separator (body)
|
||||
char *body;
|
||||
skip_node_separator (char *body)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@ -432,8 +413,7 @@ skip_node_separator (body)
|
||||
/* Return the number of characters from STRING to the start of
|
||||
the next line. */
|
||||
int
|
||||
skip_line (string)
|
||||
char *string;
|
||||
skip_line (char *string)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@ -448,23 +428,23 @@ skip_line (string)
|
||||
/* Return the absolute position of the beginning of a tags table in this
|
||||
binding starting the search at binding->start. */
|
||||
long
|
||||
find_tags_table (binding)
|
||||
SEARCH_BINDING *binding;
|
||||
find_tags_table (SEARCH_BINDING *binding)
|
||||
{
|
||||
SEARCH_BINDING search;
|
||||
SEARCH_BINDING tmp_search;
|
||||
long position;
|
||||
|
||||
search.buffer = binding->buffer;
|
||||
search.start = binding->start;
|
||||
search.end = binding->end;
|
||||
search.flags = S_FoldCase;
|
||||
tmp_search.buffer = binding->buffer;
|
||||
tmp_search.start = binding->start;
|
||||
tmp_search.end = binding->end;
|
||||
tmp_search.flags = S_FoldCase;
|
||||
|
||||
while ((position = find_node_separator (&search)) != -1 )
|
||||
while ((position = find_node_separator (&tmp_search)) != -1 )
|
||||
{
|
||||
search.start = position;
|
||||
search.start += skip_node_separator (search.buffer + search.start);
|
||||
tmp_search.start = position;
|
||||
tmp_search.start += skip_node_separator (tmp_search.buffer
|
||||
+ tmp_search.start);
|
||||
|
||||
if (looking_at (TAGS_TABLE_BEG_LABEL, &search))
|
||||
if (looking_at (TAGS_TABLE_BEG_LABEL, &tmp_search))
|
||||
return (position);
|
||||
}
|
||||
return (-1);
|
||||
@ -476,41 +456,41 @@ find_tags_table (binding)
|
||||
really point to the right node. It returns the absolute position of
|
||||
the separator preceding the node. */
|
||||
long
|
||||
find_node_in_binding (nodename, binding)
|
||||
char *nodename;
|
||||
SEARCH_BINDING *binding;
|
||||
find_node_in_binding (char *nodename, SEARCH_BINDING *binding)
|
||||
{
|
||||
long position;
|
||||
int offset, namelen;
|
||||
SEARCH_BINDING search;
|
||||
SEARCH_BINDING tmp_search;
|
||||
|
||||
namelen = strlen (nodename);
|
||||
|
||||
search.buffer = binding->buffer;
|
||||
search.start = binding->start;
|
||||
search.end = binding->end;
|
||||
search.flags = 0;
|
||||
tmp_search.buffer = binding->buffer;
|
||||
tmp_search.start = binding->start;
|
||||
tmp_search.end = binding->end;
|
||||
tmp_search.flags = 0;
|
||||
|
||||
while ((position = find_node_separator (&search)) != -1)
|
||||
while ((position = find_node_separator (&tmp_search)) != -1)
|
||||
{
|
||||
search.start = position;
|
||||
search.start += skip_node_separator (search.buffer + search.start);
|
||||
tmp_search.start = position;
|
||||
tmp_search.start += skip_node_separator
|
||||
(tmp_search.buffer + tmp_search.start);
|
||||
|
||||
offset = string_in_line (INFO_NODE_LABEL, search.buffer + search.start);
|
||||
offset = string_in_line
|
||||
(INFO_NODE_LABEL, tmp_search.buffer + tmp_search.start);
|
||||
|
||||
if (offset == -1)
|
||||
continue;
|
||||
|
||||
search.start += offset;
|
||||
search.start += skip_whitespace (search.buffer + search.start);
|
||||
tmp_search.start += offset;
|
||||
tmp_search.start += skip_whitespace (tmp_search.buffer + tmp_search.start);
|
||||
offset = skip_node_characters
|
||||
(search.buffer + search.start, DONT_SKIP_NEWLINES);
|
||||
(tmp_search.buffer + tmp_search.start, DONT_SKIP_NEWLINES);
|
||||
|
||||
/* Notice that this is an exact match. You cannot grovel through
|
||||
the buffer with this function looking for random nodes. */
|
||||
if ((offset == namelen) &&
|
||||
(search.buffer[search.start] == nodename[0]) &&
|
||||
(strncmp (search.buffer + search.start, nodename, offset) == 0))
|
||||
(tmp_search.buffer[tmp_search.start] == nodename[0]) &&
|
||||
(strncmp (tmp_search.buffer + tmp_search.start, nodename, offset) == 0))
|
||||
return (position);
|
||||
}
|
||||
return (-1);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* search.h -- Structure used to search large bodies of text, with bounds.
|
||||
$Id: search.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: search.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 1998, 2002, 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
|
||||
@ -42,26 +42,34 @@ typedef struct {
|
||||
#define S_FoldCase 0x01 /* Set means fold case in searches. */
|
||||
#define S_SkipDest 0x02 /* Set means return pointing after the dest. */
|
||||
|
||||
SEARCH_BINDING *make_binding (), *copy_binding ();
|
||||
extern long search_forward (), search_backward (), search ();
|
||||
extern int looking_at ();
|
||||
SEARCH_BINDING *make_binding (char *buffer, long int start, long int end);
|
||||
SEARCH_BINDING *copy_binding (SEARCH_BINDING *binding);
|
||||
extern long search_forward (char *string, SEARCH_BINDING *binding);
|
||||
extern long search_backward (char *input_string, SEARCH_BINDING *binding);
|
||||
extern long search (char *string, SEARCH_BINDING *binding);
|
||||
extern int looking_at (char *string, SEARCH_BINDING *binding);
|
||||
|
||||
/* Note that STRING_IN_LINE () always returns the offset of the 1st character
|
||||
after the string. */
|
||||
extern int string_in_line ();
|
||||
extern int string_in_line (char *string, char *line);
|
||||
|
||||
/* Function names that start with "skip" are passed a string, and return
|
||||
an offset from the start of that string. Function names that start
|
||||
with "find" are passed a SEARCH_BINDING, and return an absolute position
|
||||
marker of the item being searched for. "Find" functions return a value
|
||||
of -1 if the item being looked for couldn't be found. */
|
||||
extern int skip_whitespace (), skip_non_whitespace ();
|
||||
extern int skip_whitespace_and_newlines (), skip_line ();
|
||||
extern int skip_node_characters (), skip_node_separator ();
|
||||
extern int skip_whitespace (char *string);
|
||||
extern int skip_non_whitespace (char *string);
|
||||
extern int skip_whitespace_and_newlines (char *string);
|
||||
extern int skip_line (char *string);
|
||||
extern int skip_node_characters (char *string, int newlines_okay);
|
||||
extern int skip_node_separator (char *body);
|
||||
|
||||
#define DONT_SKIP_NEWLINES 0
|
||||
#define SKIP_NEWLINES 1
|
||||
|
||||
extern long find_node_separator (), find_tags_table ();
|
||||
extern long find_node_in_binding ();
|
||||
extern long find_node_separator (SEARCH_BINDING *binding);
|
||||
extern long find_tags_table (SEARCH_BINDING *binding);
|
||||
extern long find_node_in_binding (char *nodename, SEARCH_BINDING *binding);
|
||||
|
||||
#endif /* not INFO_SEARCH_H */
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* session.h -- Functions found in session.c.
|
||||
$Id: session.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: session.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1998, 1999, 2001, 2002, 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
|
||||
@ -32,7 +33,7 @@
|
||||
utility program `makedoc', which is also responsible for making
|
||||
the documentation/function-pointer maps. */
|
||||
#define DECLARE_INFO_COMMAND(name, doc) \
|
||||
void name (window, count, key) WINDOW *window; int count; unsigned char key;
|
||||
void name (WINDOW *window, int count, unsigned char key)
|
||||
|
||||
/* Variables found in session.h. */
|
||||
extern VFunction *info_last_executed_command;
|
||||
@ -60,27 +61,38 @@ extern char *info_scroll_choices[];
|
||||
#define IS_PageOnly 2 /* Simply give up at the bottom of a node. */
|
||||
|
||||
/* Utility functions found in session.c */
|
||||
extern void info_dispatch_on_key ();
|
||||
extern unsigned char info_get_input_char (), info_get_another_input_char ();
|
||||
extern unsigned char info_input_pending_p ();
|
||||
extern void remember_window_and_node (), set_remembered_pagetop_and_point ();
|
||||
extern void set_window_pagetop (), info_set_node_of_window ();
|
||||
extern void initialize_keyseq (), add_char_to_keyseq ();
|
||||
extern void info_gather_typeahead ();
|
||||
extern FILE_BUFFER *file_buffer_of_window ();
|
||||
extern long info_search_in_node (), info_target_search_node ();
|
||||
extern void info_select_reference ();
|
||||
extern int info_any_buffered_input_p ();
|
||||
extern void print_node ();
|
||||
extern void dump_node_to_file (), dump_nodes_to_file ();
|
||||
extern char *program_name_from_file_name ();
|
||||
extern void info_dispatch_on_key (unsigned char key, Keymap map);
|
||||
extern unsigned char info_get_input_char (void);
|
||||
extern unsigned char info_get_another_input_char (void);
|
||||
extern unsigned char info_input_pending_p (void);
|
||||
extern void remember_window_and_node (WINDOW *window, NODE *node);
|
||||
extern void set_remembered_pagetop_and_point (WINDOW *window);
|
||||
extern void set_window_pagetop (WINDOW *window, int desired_top);
|
||||
extern void info_set_node_of_window (int remember, WINDOW *window,
|
||||
NODE *node);
|
||||
extern void initialize_keyseq (void);
|
||||
extern void add_char_to_keyseq (char character);
|
||||
extern void info_gather_typeahead (void);
|
||||
extern FILE_BUFFER *file_buffer_of_window (WINDOW *window);
|
||||
extern long info_search_in_node (char *string, NODE *node,
|
||||
long int start, WINDOW *window, int dir, int case_sensitive);
|
||||
extern long info_target_search_node (NODE *node, char *string,
|
||||
long int start);
|
||||
extern void info_select_reference (WINDOW *window, REFERENCE *entry);
|
||||
extern int info_any_buffered_input_p (void);
|
||||
extern void print_node (NODE *node);
|
||||
extern void dump_node_to_file (NODE *node, char *filename,
|
||||
int dump_subnodes);
|
||||
extern void dump_nodes_to_file (char *filename, char **nodenames,
|
||||
char *output_filename, int dump_subnodes);
|
||||
extern char *program_name_from_file_name (char *file_name);
|
||||
|
||||
/* Do the physical deletion of WINDOW, and forget this window and
|
||||
associated nodes. */
|
||||
extern void info_delete_window_internal ();
|
||||
extern void info_delete_window_internal (WINDOW *window);
|
||||
|
||||
/* Tell Info that input is coming from the file FILENAME. */
|
||||
extern void info_set_input_from_file ();
|
||||
extern void info_set_input_from_file (char *filename);
|
||||
|
||||
#define return_if_control_g(val) \
|
||||
do { \
|
||||
@ -92,59 +104,134 @@ extern void info_set_input_from_file ();
|
||||
/* The names of the functions that run an info session. */
|
||||
|
||||
/* Starting an info session. */
|
||||
extern void begin_multiple_window_info_session (), begin_info_session ();
|
||||
extern void begin_info_session_with_error (), info_session ();
|
||||
extern void info_read_and_dispatch ();
|
||||
extern void begin_multiple_window_info_session (char *filename,
|
||||
char **nodenames);
|
||||
extern void begin_info_session (NODE *initial_node);
|
||||
extern void begin_info_session_with_error (NODE *initial_node,
|
||||
char *format, void *arg1, void *arg2);
|
||||
extern void info_session (void);
|
||||
extern void initialize_info_session (NODE *node, int clear_screen);
|
||||
extern void info_read_and_dispatch (void);
|
||||
extern void info_intuit_options_node (WINDOW *window,
|
||||
NODE *initial_node, char *program);
|
||||
|
||||
/* Moving the point within a node. */
|
||||
extern void info_next_line (), info_prev_line ();
|
||||
extern void info_end_of_line (), info_beginning_of_line ();
|
||||
extern void info_forward_char (), info_backward_char ();
|
||||
extern void info_forward_word (), info_backward_word ();
|
||||
extern void info_beginning_of_node (), info_end_of_node ();
|
||||
extern void info_move_to_prev_xref (), info_move_to_next_xref ();
|
||||
extern void info_next_line (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_prev_line (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_end_of_line (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_beginning_of_line (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_forward_char (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_backward_char (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_forward_word (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_backward_word (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_beginning_of_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_end_of_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_move_to_prev_xref (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_move_to_next_xref (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Scrolling text within a window. */
|
||||
extern void info_scroll_forward (), info_scroll_backward ();
|
||||
extern void info_redraw_display (), info_toggle_wrap ();
|
||||
extern void info_move_to_window_line ();
|
||||
extern void info_up_line (), info_down_line ();
|
||||
extern void info_scroll_half_screen_down (), info_scroll_half_screen_up ();
|
||||
extern void info_scroll_forward (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_scroll_backward (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_redraw_display (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_toggle_wrap (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_move_to_window_line (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_up_line (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_down_line (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_scroll_half_screen_down (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_scroll_half_screen_up (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_scroll_forward_set_window (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_scroll_forward_page_only (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_scroll_forward_page_only_set_window (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_scroll_backward_set_window (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_scroll_backward_page_only (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_scroll_backward_page_only_set_window (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_scroll_other_window_backward (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
|
||||
/* Manipulating multiple windows. */
|
||||
extern void info_split_window (), info_delete_window ();
|
||||
extern void info_keep_one_window (), info_grow_window ();
|
||||
extern void info_scroll_other_window (), info_tile_windows ();
|
||||
extern void info_next_window (), info_prev_window ();
|
||||
extern void info_split_window (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_delete_window (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_keep_one_window (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_grow_window (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_scroll_other_window (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_tile_windows (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_next_window (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_prev_window (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Selecting nodes. */
|
||||
extern void info_next_node (), info_prev_node (), info_up_node ();
|
||||
extern void info_last_node (), info_first_node (), info_history_node ();
|
||||
extern void info_goto_node (), info_top_node (), info_dir_node ();
|
||||
extern void info_global_next_node (), info_global_prev_node ();
|
||||
extern void info_kill_node (), info_view_file ();
|
||||
extern void info_menu_sequence ();
|
||||
extern NODE *info_follow_menus (/* initial_node, menus, errstr, errarg */);
|
||||
extern void info_next_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_prev_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_up_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_last_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_first_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_history_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_goto_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_goto_invocation_node (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_top_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_dir_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_global_next_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_global_prev_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_kill_node (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_view_file (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_menu_sequence (WINDOW *window, int count, unsigned char key);
|
||||
extern NODE *info_follow_menus (NODE *initial_node, char **menus,
|
||||
const char **errstr, char **errarg1, char **errarg2);
|
||||
extern void info_man (WINDOW *window, int count, unsigned char key);
|
||||
extern void list_visited_nodes (WINDOW *window, int count, unsigned char key);
|
||||
extern void select_visited_node (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Selecting cross references. */
|
||||
extern void info_menu_digit (), info_menu_item (), info_xref_item ();
|
||||
extern void info_find_menu (), info_select_reference_this_line ();
|
||||
extern void info_menu_digit (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_menu_item (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_xref_item (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_find_menu (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_select_reference_this_line (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_last_menu_item (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_visit_menu (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Hacking numeric arguments. */
|
||||
extern int info_explicit_arg, info_numeric_arg, info_numeric_arg_sign;
|
||||
|
||||
extern void info_add_digit_to_numeric_arg (), info_universal_argument ();
|
||||
extern void info_initialize_numeric_arg (), info_numeric_arg_digit_loop ();
|
||||
extern void info_add_digit_to_numeric_arg (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_universal_argument (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_initialize_numeric_arg (void);
|
||||
extern void info_numeric_arg_digit_loop (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
|
||||
/* Searching commands. */
|
||||
extern void info_search (), isearch_forward (), isearch_backward ();
|
||||
extern void info_search_case_sensitively (), info_search_backward ();
|
||||
extern void info_search_next (), info_search_previous ();
|
||||
extern void info_search (WINDOW *window, int count, unsigned char key);
|
||||
extern void isearch_forward (WINDOW *window, int count, unsigned char key);
|
||||
extern void isearch_backward (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_search_case_sensitively (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
extern void info_search_backward (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_search_next (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_search_previous (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Dumping and printing nodes. */
|
||||
extern void info_print_node ();
|
||||
extern void info_print_node (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Footnotes. */
|
||||
extern void info_show_footnotes (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Miscellaneous commands. */
|
||||
extern void info_abort_key (), info_quit (), info_do_lowercase_version ();
|
||||
extern void info_abort_key (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_quit (WINDOW *window, int count, unsigned char key);
|
||||
extern void info_do_lowercase_version (WINDOW *window, int count,
|
||||
unsigned char key);
|
||||
|
||||
#endif /* not SESSION_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* signals.h -- header to include system dependent signal definitions.
|
||||
$Id: signals.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: signals.h,v 1.2 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1994, 1995, 1997, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1994, 1995, 1997, 2002, 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
|
||||
@ -17,7 +17,7 @@
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
Originally written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_SIGNALS_H
|
||||
#define INFO_SIGNALS_H
|
||||
@ -34,7 +34,10 @@
|
||||
# define sigmask(x) (1 << ((x)-1))
|
||||
#endif /* !HAVE_SIGPROCMASK && !sigmask */
|
||||
|
||||
#if !defined (HAVE_SIGPROCMASK)
|
||||
/* Without SA_NOCLDSTOP, sigset_t might end up being undefined even
|
||||
though we have sigprocmask, on older systems, according to Nelson
|
||||
Beebe. The test is from coreutils/sort.c, via Paul Eggert. */
|
||||
#if !defined (HAVE_SIGPROCMASK) || !defined (SA_NOCLDSTOP)
|
||||
# if !defined (SIG_BLOCK)
|
||||
# define SIG_UNBLOCK 1
|
||||
# define SIG_BLOCK 2
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* termdep.h -- system things that terminal.c depends on.
|
||||
$Id: termdep.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: termdep.h,v 1.2 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1996, 1997, 1998, 2001, 2002 Free Software
|
||||
Foundation, Inc.
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* terminal.h -- The external interface to terminal I/O.
|
||||
$Id: terminal.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: terminal.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1996, 1997, 2001, 2002, 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
|
||||
@ -52,68 +53,71 @@ extern int terminal_can_scroll;
|
||||
The variables SCREENHEIGHT and SCREENWIDTH are set to the dimensions that
|
||||
this terminal actually has. The variable TERMINAL_HAS_META_P becomes non-
|
||||
zero if this terminal supports a Meta key. */
|
||||
extern void terminal_initialize_terminal ();
|
||||
extern void terminal_initialize_terminal (char *terminal_name);
|
||||
extern VFunction *terminal_initialize_terminal_hook;
|
||||
|
||||
/* Return the current screen width and height in the variables
|
||||
SCREENWIDTH and SCREENHEIGHT. */
|
||||
extern void terminal_get_screen_size ();
|
||||
extern void terminal_get_screen_size (void);
|
||||
extern VFunction *terminal_get_screen_size_hook;
|
||||
|
||||
/* Save and restore tty settings. */
|
||||
extern void terminal_prep_terminal (), terminal_unprep_terminal ();
|
||||
extern VFunction *terminal_prep_terminal_hook, *terminal_unprep_terminal_hook;
|
||||
extern void terminal_prep_terminal (void);
|
||||
extern void terminal_unprep_terminal (void);
|
||||
|
||||
extern VFunction *terminal_prep_terminal_hook;
|
||||
extern VFunction *terminal_unprep_terminal_hook;
|
||||
|
||||
/* Re-initialize the terminal to TERMINAL_NAME. */
|
||||
extern void terminal_new_terminal ();
|
||||
extern void terminal_new_terminal (char *terminal_name);
|
||||
extern VFunction *terminal_new_terminal_hook;
|
||||
|
||||
/* Move the cursor to the terminal location of X and Y. */
|
||||
extern void terminal_goto_xy ();
|
||||
extern void terminal_goto_xy (int x, int y);
|
||||
extern VFunction *terminal_goto_xy_hook;
|
||||
|
||||
/* Print STRING to the terminal at the current position. */
|
||||
extern void terminal_put_text ();
|
||||
extern void terminal_put_text (char *string);
|
||||
extern VFunction *terminal_put_text_hook;
|
||||
|
||||
/* Print NCHARS from STRING to the terminal at the current position. */
|
||||
extern void terminal_write_chars ();
|
||||
extern void terminal_write_chars (char *string, int nchars);
|
||||
extern VFunction *terminal_write_chars_hook;
|
||||
|
||||
/* Clear from the current position of the cursor to the end of the line. */
|
||||
extern void terminal_clear_to_eol ();
|
||||
extern void terminal_clear_to_eol (void);
|
||||
extern VFunction *terminal_clear_to_eol_hook;
|
||||
|
||||
/* Clear the entire terminal screen. */
|
||||
extern void terminal_clear_screen ();
|
||||
extern void terminal_clear_screen (void);
|
||||
extern VFunction *terminal_clear_screen_hook;
|
||||
|
||||
/* Move the cursor up one line. */
|
||||
extern void terminal_up_line ();
|
||||
extern void terminal_up_line (void);
|
||||
extern VFunction *terminal_up_line_hook;
|
||||
|
||||
/* Move the cursor down one line. */
|
||||
extern void terminal_down_line ();
|
||||
extern void terminal_down_line (void);
|
||||
extern VFunction *terminal_down_line_hook;
|
||||
|
||||
/* Turn on reverse video if possible. */
|
||||
extern void terminal_begin_inverse ();
|
||||
extern void terminal_begin_inverse (void);
|
||||
extern VFunction *terminal_begin_inverse_hook;
|
||||
|
||||
/* Turn off reverse video if possible. */
|
||||
extern void terminal_end_inverse ();
|
||||
extern void terminal_end_inverse (void);
|
||||
extern VFunction *terminal_end_inverse_hook;
|
||||
|
||||
/* Scroll an area of the terminal, starting with the region from START
|
||||
to END, AMOUNT lines. If AMOUNT is negative, the lines are scrolled
|
||||
towards the top of the screen, else they are scrolled towards the
|
||||
bottom of the screen. */
|
||||
extern void terminal_scroll_terminal ();
|
||||
extern void terminal_scroll_terminal (int start, int end, int amount);
|
||||
extern VFunction *terminal_scroll_terminal_hook;
|
||||
|
||||
/* Ring the terminal bell. The bell is run visibly if it both has one and
|
||||
terminal_use_visible_bell_p is non-zero. */
|
||||
extern void terminal_ring_bell ();
|
||||
extern void terminal_ring_bell (void);
|
||||
extern VFunction *terminal_ring_bell_hook;
|
||||
|
||||
/* The key sequences output by special keys, if this terminal has any. */
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* tilde.c -- tilde expansion code (~/foo := $HOME/foo).
|
||||
$Id: tilde.c,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: tilde.c,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1998, 1999, 2002
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1998, 1999,
|
||||
2002, 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
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
/* Include config.h before doing alloca. */
|
||||
#include "info.h"
|
||||
#include "tilde.h"
|
||||
|
||||
#if defined (TEST) || defined (STATIC_MALLOC)
|
||||
static void *xmalloc (), *xrealloc ();
|
||||
@ -59,9 +60,7 @@ char **tilde_additional_suffixes = default_suffixes;
|
||||
the tilde which starts the expansion. Place the length of the text
|
||||
which identified this tilde starter in LEN, excluding the tilde itself. */
|
||||
static int
|
||||
tilde_find_prefix (string, len)
|
||||
char *string;
|
||||
int *len;
|
||||
tilde_find_prefix (char *string, int *len)
|
||||
{
|
||||
register int i, j, string_len;
|
||||
register char **prefixes = tilde_additional_prefixes;
|
||||
@ -92,8 +91,7 @@ tilde_find_prefix (string, len)
|
||||
/* Find the end of a tilde expansion in STRING, and return the index of
|
||||
the character which ends the tilde definition. */
|
||||
static int
|
||||
tilde_find_suffix (string)
|
||||
char *string;
|
||||
tilde_find_suffix (char *string)
|
||||
{
|
||||
register int i, j, string_len;
|
||||
register char **suffixes = tilde_additional_suffixes;
|
||||
@ -116,10 +114,9 @@ tilde_find_suffix (string)
|
||||
|
||||
/* Return a new string which is the result of tilde expanding STRING. */
|
||||
char *
|
||||
tilde_expand (string)
|
||||
char *string;
|
||||
tilde_expand (char *string)
|
||||
{
|
||||
char *result, *tilde_expand_word ();
|
||||
char *result;
|
||||
int result_size, result_index;
|
||||
|
||||
result_size = result_index = 0;
|
||||
@ -179,8 +176,7 @@ tilde_expand (string)
|
||||
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
|
||||
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
|
||||
char *
|
||||
tilde_expand_word (filename)
|
||||
char *filename;
|
||||
tilde_expand_word (char *filename)
|
||||
{
|
||||
char *dirname = filename ? xstrdup (filename) : NULL;
|
||||
|
||||
@ -236,9 +232,7 @@ tilde_expand_word (filename)
|
||||
expansion, then let them try. */
|
||||
if (tilde_expansion_failure_hook)
|
||||
{
|
||||
char *expansion;
|
||||
|
||||
expansion = (*tilde_expansion_failure_hook) (username);
|
||||
char *expansion = (*tilde_expansion_failure_hook) (username);
|
||||
|
||||
if (expansion)
|
||||
{
|
||||
|
@ -1,12 +1,10 @@
|
||||
/* tilde.h: Externally available variables and function in libtilde.a. */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
/* tilde.h: Externally available variables and function in libtilde.a.
|
||||
$Id: tilde.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
This file has appeared in prior works by the Free Software Foundation;
|
||||
thus it carries copyright dates from 1988 through 1993.
|
||||
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 2004 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -47,10 +45,10 @@ extern char **tilde_additional_prefixes;
|
||||
extern char **tilde_additional_suffixes;
|
||||
|
||||
/* Return a new string which is the result of tilde expanding STRING. */
|
||||
extern char *tilde_expand ();
|
||||
extern char *tilde_expand (char *string);
|
||||
|
||||
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
|
||||
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
|
||||
extern char *tilde_expand_word ();
|
||||
extern char *tilde_expand_word (char *filename);
|
||||
|
||||
#endif /* not TILDE_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* variables.c -- how to manipulate user visible variables in Info.
|
||||
$Id: variables.c,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: variables.c,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 2001, 2002, 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
|
||||
@ -77,7 +77,7 @@ DECLARE_INFO_COMMAND (describe_variable, _("Explain the use of a variable"))
|
||||
char *description;
|
||||
|
||||
/* Get the variable's name. */
|
||||
var = read_variable_name (_("Describe variable: "), window);
|
||||
var = read_variable_name ((char *) _("Describe variable: "), window);
|
||||
|
||||
if (!var)
|
||||
return;
|
||||
@ -92,7 +92,7 @@ DECLARE_INFO_COMMAND (describe_variable, _("Explain the use of a variable"))
|
||||
sprintf (description, "%s (%d): %s.",
|
||||
var->name, *(var->value), _(var->doc));
|
||||
|
||||
window_message_in_echo_area ("%s", description);
|
||||
window_message_in_echo_area ("%s", description, NULL);
|
||||
free (description);
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ DECLARE_INFO_COMMAND (set_variable, _("Set the value of an Info variable"))
|
||||
char *line;
|
||||
|
||||
/* Get the variable's name and value. */
|
||||
var = read_variable_name (_("Set variable: "), window);
|
||||
var = read_variable_name ((char *) _("Set variable: "), window);
|
||||
|
||||
if (!var)
|
||||
return;
|
||||
@ -201,9 +201,7 @@ DECLARE_INFO_COMMAND (set_variable, _("Set the value of an Info variable"))
|
||||
address of a VARIABLE_ALIST member. A return value of NULL indicates
|
||||
that no variable could be read. */
|
||||
VARIABLE_ALIST *
|
||||
read_variable_name (prompt, window)
|
||||
char *prompt;
|
||||
WINDOW *window;
|
||||
read_variable_name (char *prompt, WINDOW *window)
|
||||
{
|
||||
register int i;
|
||||
char *line;
|
||||
@ -249,7 +247,7 @@ read_variable_name (prompt, window)
|
||||
/* Make an array of REFERENCE which actually contains the names of the
|
||||
variables available in Info. */
|
||||
REFERENCE **
|
||||
make_variable_completions_array ()
|
||||
make_variable_completions_array (void)
|
||||
{
|
||||
register int i;
|
||||
REFERENCE **array = (REFERENCE **)NULL;
|
||||
@ -274,9 +272,7 @@ make_variable_completions_array ()
|
||||
#if defined(INFOKEY)
|
||||
|
||||
void
|
||||
set_variable_to_value(name, value)
|
||||
char *name;
|
||||
char *value;
|
||||
set_variable_to_value(char *name, char *value)
|
||||
{
|
||||
register int i;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* variables.h -- Description of user visible variables in Info.
|
||||
$Id: variables.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: variables.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993, 97 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 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
|
||||
@ -42,14 +42,15 @@ typedef struct {
|
||||
/* Read the name of an Info variable in the echo area and return the
|
||||
address of a VARIABLE_ALIST member. A return value of NULL indicates
|
||||
that no variable could be read. */
|
||||
extern VARIABLE_ALIST *read_variable_name ();
|
||||
extern VARIABLE_ALIST *read_variable_name (char *prompt, WINDOW *window);
|
||||
|
||||
/* Make an array of REFERENCE which actually contains the names of the
|
||||
variables available in Info. */
|
||||
extern REFERENCE **make_variable_completions_array ();
|
||||
extern REFERENCE **make_variable_completions_array (void);
|
||||
|
||||
/* Set the value of an info variable. */
|
||||
extern void set_variable ();
|
||||
extern void set_variable (WINDOW *window, int count, unsigned char key);
|
||||
extern void describe_variable (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* The list of user-visible variables. */
|
||||
extern int auto_footnotes_p;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* window.c -- windows in Info.
|
||||
$Id: window.c,v 1.2 2003/02/11 16:39:06 karl Exp $
|
||||
$Id: window.c,v 1.4 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 1998, 2001, 2002, 2003 Free Software
|
||||
Copyright (C) 1993, 1997, 1998, 2001, 2002, 2003, 2004 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -51,8 +51,7 @@ WINDOW *active_window = NULL;
|
||||
Create the first window ever.
|
||||
You pass the dimensions of the total screen size. */
|
||||
void
|
||||
window_initialize_windows (width, height)
|
||||
int width, height;
|
||||
window_initialize_windows (int width, int height)
|
||||
{
|
||||
the_screen = xmalloc (sizeof (WINDOW));
|
||||
the_echo_area = xmalloc (sizeof (WINDOW));
|
||||
@ -83,7 +82,7 @@ window_initialize_windows (width, height)
|
||||
area. */
|
||||
the_echo_area->height = ECHO_AREA_HEIGHT;
|
||||
active_window->height = the_screen->height - 1 - the_echo_area->height;
|
||||
window_new_screen_size (width, height, NULL);
|
||||
window_new_screen_size (width, height);
|
||||
|
||||
/* The echo area uses a different keymap than normal info windows. */
|
||||
the_echo_area->keymap = echo_area_keymap;
|
||||
@ -103,8 +102,7 @@ window_initialize_windows (width, height)
|
||||
VFunction *window_deletion_notifier = NULL;
|
||||
|
||||
void
|
||||
window_new_screen_size (width, height)
|
||||
int width, height;
|
||||
window_new_screen_size (int width, int height)
|
||||
{
|
||||
register WINDOW *win;
|
||||
int delta_height, delta_each, delta_leftover;
|
||||
@ -232,7 +230,7 @@ window_new_screen_size (width, height)
|
||||
if ((win->height < WINDOW_MIN_HEIGHT) ||
|
||||
(win->height > avail))
|
||||
{
|
||||
WINDOW *lastwin;
|
||||
WINDOW *lastwin = NULL;
|
||||
|
||||
/* Split the space among the available windows. */
|
||||
delta_each = avail / numwins;
|
||||
@ -262,8 +260,7 @@ window_new_screen_size (width, height)
|
||||
window. If the window could not be made return a NULL pointer. The
|
||||
active window is not changed.*/
|
||||
WINDOW *
|
||||
window_make_window (node)
|
||||
NODE *node;
|
||||
window_make_window (NODE *node)
|
||||
{
|
||||
WINDOW *window;
|
||||
|
||||
@ -377,9 +374,7 @@ window_make_window (node)
|
||||
the previous and next windows in the chain. If there is only one user
|
||||
window, then no change takes place. */
|
||||
void
|
||||
window_change_window_height (window, amount)
|
||||
WINDOW *window;
|
||||
int amount;
|
||||
window_change_window_height (WINDOW *window, int amount)
|
||||
{
|
||||
register WINDOW *win, *prev, *next;
|
||||
|
||||
@ -510,8 +505,7 @@ window_change_window_height (window, amount)
|
||||
internal nodes as well, otherwise do not change the height of such
|
||||
windows. */
|
||||
void
|
||||
window_tile_windows (style)
|
||||
int style;
|
||||
window_tile_windows (int style)
|
||||
{
|
||||
WINDOW *win, *last_adjusted;
|
||||
int numwins, avail, per_win_height, leftover;
|
||||
@ -564,8 +558,7 @@ window_tile_windows (style)
|
||||
/* Toggle the state of line wrapping in WINDOW. This can do a bit of fancy
|
||||
redisplay. */
|
||||
void
|
||||
window_toggle_wrap (window)
|
||||
WINDOW *window;
|
||||
window_toggle_wrap (WINDOW *window)
|
||||
{
|
||||
if (window->flags & W_NoWrap)
|
||||
window->flags &= ~W_NoWrap;
|
||||
@ -599,9 +592,7 @@ window_toggle_wrap (window)
|
||||
|
||||
/* Set WINDOW to display NODE. */
|
||||
void
|
||||
window_set_node_of_window (window, node)
|
||||
WINDOW *window;
|
||||
NODE *node;
|
||||
window_set_node_of_window (WINDOW *window, NODE *node)
|
||||
{
|
||||
window->node = node;
|
||||
window->pagetop = 0;
|
||||
@ -619,8 +610,7 @@ window_set_node_of_window (window, node)
|
||||
If the active window is the next or previous window, choose that window
|
||||
as the recipient of the extra space. Otherwise, prefer the next window. */
|
||||
void
|
||||
window_delete_window (window)
|
||||
WINDOW *window;
|
||||
window_delete_window (WINDOW *window)
|
||||
{
|
||||
WINDOW *next, *prev, *window_to_fix;
|
||||
|
||||
@ -691,9 +681,7 @@ window_delete_window (window)
|
||||
|
||||
/* For every window in CHAIN, set the flags member to have FLAG set. */
|
||||
void
|
||||
window_mark_chain (chain, flag)
|
||||
WINDOW *chain;
|
||||
int flag;
|
||||
window_mark_chain (WINDOW *chain, int flag)
|
||||
{
|
||||
register WINDOW *win;
|
||||
|
||||
@ -703,9 +691,7 @@ window_mark_chain (chain, flag)
|
||||
|
||||
/* For every window in CHAIN, clear the flags member of FLAG. */
|
||||
void
|
||||
window_unmark_chain (chain, flag)
|
||||
WINDOW *chain;
|
||||
int flag;
|
||||
window_unmark_chain (WINDOW *chain, int flag)
|
||||
{
|
||||
register WINDOW *win;
|
||||
|
||||
@ -716,8 +702,7 @@ window_unmark_chain (chain, flag)
|
||||
/* Return the number of characters it takes to display CHARACTER on the
|
||||
screen at HPOS. */
|
||||
int
|
||||
character_width (character, hpos)
|
||||
int character, hpos;
|
||||
character_width (int character, int hpos)
|
||||
{
|
||||
int printable_limit = 127;
|
||||
int width = 1;
|
||||
@ -751,9 +736,7 @@ character_width (character, hpos)
|
||||
/* Return the number of characters it takes to display STRING on the screen
|
||||
at HPOS. */
|
||||
int
|
||||
string_width (string, hpos)
|
||||
char *string;
|
||||
int hpos;
|
||||
string_width (char *string, int hpos)
|
||||
{
|
||||
register int i, width, this_char_width;
|
||||
|
||||
@ -782,8 +765,7 @@ string_width (string, hpos)
|
||||
/* Quickly guess the approximate number of lines that NODE would
|
||||
take to display. This really only counts carriage returns. */
|
||||
int
|
||||
window_physical_lines (node)
|
||||
NODE *node;
|
||||
window_physical_lines (NODE *node)
|
||||
{
|
||||
register int i, lines;
|
||||
char *contents;
|
||||
@ -802,8 +784,7 @@ window_physical_lines (node)
|
||||
/* Calculate a list of line starts for the node belonging to WINDOW. The line
|
||||
starts are pointers to the actual text within WINDOW->NODE. */
|
||||
void
|
||||
calculate_line_starts (window)
|
||||
WINDOW *window;
|
||||
calculate_line_starts (WINDOW *window)
|
||||
{
|
||||
register int i, hpos;
|
||||
char **line_starts = NULL;
|
||||
@ -869,7 +850,7 @@ calculate_line_starts (window)
|
||||
cwidth = character_width (c, hpos);
|
||||
|
||||
/* If this character fits within this line, just do the next one. */
|
||||
if ((hpos + cwidth) < window->width)
|
||||
if ((hpos + cwidth) < (unsigned int) window->width)
|
||||
{
|
||||
i++;
|
||||
hpos += cwidth;
|
||||
@ -918,8 +899,7 @@ calculate_line_starts (window)
|
||||
|
||||
/* Given WINDOW, recalculate the line starts for the node it displays. */
|
||||
void
|
||||
recalculate_line_starts (window)
|
||||
WINDOW *window;
|
||||
recalculate_line_starts (WINDOW *window)
|
||||
{
|
||||
maybe_free (window->line_starts);
|
||||
calculate_line_starts (window);
|
||||
@ -933,8 +913,7 @@ int window_scroll_step = 0;
|
||||
|
||||
/* Adjust the pagetop of WINDOW such that the cursor point will be visible. */
|
||||
void
|
||||
window_adjust_pagetop (window)
|
||||
WINDOW *window;
|
||||
window_adjust_pagetop (WINDOW *window)
|
||||
{
|
||||
register int line = 0;
|
||||
char *contents;
|
||||
@ -991,8 +970,7 @@ window_adjust_pagetop (window)
|
||||
|
||||
/* Return the index of the line containing point. */
|
||||
int
|
||||
window_line_of_point (window)
|
||||
WINDOW *window;
|
||||
window_line_of_point (WINDOW *window)
|
||||
{
|
||||
register int i, start = 0;
|
||||
|
||||
@ -1014,8 +992,7 @@ window_line_of_point (window)
|
||||
|
||||
/* Get and return the goal column for this window. */
|
||||
int
|
||||
window_get_goal_column (window)
|
||||
WINDOW *window;
|
||||
window_get_goal_column (WINDOW *window)
|
||||
{
|
||||
if (!window->node)
|
||||
return (-1);
|
||||
@ -1030,8 +1007,7 @@ window_get_goal_column (window)
|
||||
|
||||
/* Get and return the printed column offset of the cursor in this window. */
|
||||
int
|
||||
window_get_cursor_column (window)
|
||||
WINDOW *window;
|
||||
window_get_cursor_column (WINDOW *window)
|
||||
{
|
||||
int i, hpos, end;
|
||||
char *line;
|
||||
@ -1069,11 +1045,9 @@ window_get_cursor_column (window)
|
||||
/* Count the number of characters in LINE that precede the printed column
|
||||
offset of GOAL. */
|
||||
int
|
||||
window_chars_to_goal (line, goal)
|
||||
char *line;
|
||||
int goal;
|
||||
window_chars_to_goal (char *line, int goal)
|
||||
{
|
||||
register int i, check, hpos;
|
||||
register int i, check = 0, hpos;
|
||||
|
||||
for (hpos = 0, i = 0; line[i] != '\n'; i++)
|
||||
{
|
||||
@ -1099,8 +1073,7 @@ window_chars_to_goal (line, goal)
|
||||
|
||||
/* Create a modeline for WINDOW, and store it in window->modeline. */
|
||||
void
|
||||
window_make_modeline (window)
|
||||
WINDOW *window;
|
||||
window_make_modeline (WINDOW *window)
|
||||
{
|
||||
register int i;
|
||||
char *modeline;
|
||||
@ -1214,9 +1187,7 @@ window_make_modeline (window)
|
||||
|
||||
/* Make WINDOW start displaying at PERCENT percentage of its node. */
|
||||
void
|
||||
window_goto_percentage (window, percent)
|
||||
WINDOW *window;
|
||||
int percent;
|
||||
window_goto_percentage (WINDOW *window, int percent)
|
||||
{
|
||||
int desired_line;
|
||||
|
||||
@ -1235,9 +1206,7 @@ window_goto_percentage (window, percent)
|
||||
|
||||
/* Get the state of WINDOW, and save it in STATE. */
|
||||
void
|
||||
window_get_state (window, state)
|
||||
WINDOW *window;
|
||||
WINDOW_STATE *state;
|
||||
window_get_state (WINDOW *window, SEARCH_STATE *state)
|
||||
{
|
||||
state->node = window->node;
|
||||
state->pagetop = window->pagetop;
|
||||
@ -1246,9 +1215,7 @@ window_get_state (window, state)
|
||||
|
||||
/* Set the node, pagetop, and point of WINDOW. */
|
||||
void
|
||||
window_set_state (window, state)
|
||||
WINDOW *window;
|
||||
WINDOW_STATE *state;
|
||||
window_set_state (WINDOW *window, SEARCH_STATE *state)
|
||||
{
|
||||
if (window->node != state->node)
|
||||
window_set_node_of_window (window, state->node);
|
||||
@ -1264,7 +1231,7 @@ static NODE *echo_area_node = NULL;
|
||||
|
||||
/* Make the node of the_echo_area be an empty one. */
|
||||
static void
|
||||
free_echo_area ()
|
||||
free_echo_area (void)
|
||||
{
|
||||
if (echo_area_node)
|
||||
{
|
||||
@ -1279,7 +1246,7 @@ free_echo_area ()
|
||||
/* Clear the echo area, removing any message that is already present.
|
||||
The echo area is cleared immediately. */
|
||||
void
|
||||
window_clear_echo_area ()
|
||||
window_clear_echo_area (void)
|
||||
{
|
||||
free_echo_area ();
|
||||
display_update_one_window (the_echo_area);
|
||||
@ -1290,9 +1257,7 @@ window_clear_echo_area ()
|
||||
printf () hair is present. The message appears immediately. If there was
|
||||
already a message appearing in the echo area, it is removed. */
|
||||
void
|
||||
window_message_in_echo_area (format, arg1, arg2)
|
||||
char *format;
|
||||
void *arg1, *arg2;
|
||||
window_message_in_echo_area (char *format, void *arg1, void *arg2)
|
||||
{
|
||||
free_echo_area ();
|
||||
echo_area_node = build_message_node (format, arg1, arg2);
|
||||
@ -1309,9 +1274,7 @@ static int old_echo_area_nodes_index = 0;
|
||||
static int old_echo_area_nodes_slots = 0;
|
||||
|
||||
void
|
||||
message_in_echo_area (format, arg1, arg2)
|
||||
char *format;
|
||||
void *arg1, *arg2;
|
||||
message_in_echo_area (char *format, void *arg1, void *arg2)
|
||||
{
|
||||
if (echo_area_node)
|
||||
{
|
||||
@ -1324,7 +1287,7 @@ message_in_echo_area (format, arg1, arg2)
|
||||
}
|
||||
|
||||
void
|
||||
unmessage_in_echo_area ()
|
||||
unmessage_in_echo_area (void)
|
||||
{
|
||||
free_echo_area ();
|
||||
|
||||
@ -1343,8 +1306,7 @@ static int message_buffer_size = 0;
|
||||
/* Ensure that there is enough space to stuff LENGTH characters into
|
||||
MESSAGE_BUFFER. */
|
||||
static void
|
||||
message_buffer_resize (length)
|
||||
int length;
|
||||
message_buffer_resize (int length)
|
||||
{
|
||||
if (!message_buffer)
|
||||
{
|
||||
@ -1362,9 +1324,7 @@ message_buffer_resize (length)
|
||||
/* Format MESSAGE_BUFFER with the results of printing FORMAT with ARG1 and
|
||||
ARG2. */
|
||||
static void
|
||||
build_message_buffer (format, arg1, arg2, arg3)
|
||||
char *format;
|
||||
void *arg1, *arg2, *arg3;
|
||||
build_message_buffer (char *format, void *arg1, void *arg2, void *arg3)
|
||||
{
|
||||
register int i, len;
|
||||
void *args[3];
|
||||
@ -1511,9 +1471,7 @@ build_message_buffer (format, arg1, arg2, arg3)
|
||||
/* Build a new node which has FORMAT printed with ARG1 and ARG2 as the
|
||||
contents. */
|
||||
NODE *
|
||||
build_message_node (format, arg1, arg2)
|
||||
char *format;
|
||||
void *arg1, *arg2;
|
||||
build_message_node (char *format, void *arg1, void *arg2)
|
||||
{
|
||||
NODE *node;
|
||||
|
||||
@ -1526,7 +1484,7 @@ build_message_node (format, arg1, arg2)
|
||||
|
||||
/* Convert the contents of the message buffer to a node. */
|
||||
NODE *
|
||||
message_buffer_to_node ()
|
||||
message_buffer_to_node (void)
|
||||
{
|
||||
NODE *node;
|
||||
|
||||
@ -1548,16 +1506,14 @@ message_buffer_to_node ()
|
||||
|
||||
/* Useful functions can be called from outside of window.c. */
|
||||
void
|
||||
initialize_message_buffer ()
|
||||
initialize_message_buffer (void)
|
||||
{
|
||||
message_buffer_index = 0;
|
||||
}
|
||||
|
||||
/* Print FORMAT with ARG1,2 to the end of the current message buffer. */
|
||||
void
|
||||
printf_to_message_buffer (format, arg1, arg2, arg3)
|
||||
char *format;
|
||||
void *arg1, *arg2, *arg3;
|
||||
printf_to_message_buffer (char *format, void *arg1, void *arg2, void *arg3)
|
||||
{
|
||||
build_message_buffer (format, arg1, arg2, arg3);
|
||||
}
|
||||
@ -1565,7 +1521,7 @@ printf_to_message_buffer (format, arg1, arg2, arg3)
|
||||
/* Return the current horizontal position of the "cursor" on the most
|
||||
recently output message buffer line. */
|
||||
int
|
||||
message_buffer_length_this_line ()
|
||||
message_buffer_length_this_line (void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@ -1579,9 +1535,7 @@ message_buffer_length_this_line ()
|
||||
|
||||
/* Pad STRING to COUNT characters by inserting blanks. */
|
||||
int
|
||||
pad_to (count, string)
|
||||
int count;
|
||||
char *string;
|
||||
pad_to (int count, char *string)
|
||||
{
|
||||
register int i;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* window.h -- Structure and flags used in manipulating Info windows.
|
||||
$Id: window.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: window.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993, 97 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1997, 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
|
||||
@ -25,8 +25,8 @@
|
||||
#ifndef INFO_WINDOW_H
|
||||
#define INFO_WINDOW_H
|
||||
|
||||
#include "nodes.h"
|
||||
#include "infomap.h"
|
||||
#include "nodes.h"
|
||||
|
||||
/* Smallest number of visible lines in a window. The actual height is
|
||||
always one more than this number because each window has a modeline. */
|
||||
@ -75,6 +75,14 @@ typedef struct {
|
||||
WINDOW_STATE_DECL; /* What gets saved. */
|
||||
} WINDOW_STATE;
|
||||
|
||||
/* Structure defining the current state of an incremental search. */
|
||||
typedef struct {
|
||||
WINDOW_STATE_DECL; /* The node, pagetop and point. */
|
||||
int search_index; /* Offset of the last char in the search string. */
|
||||
int direction; /* The direction that this search is heading in. */
|
||||
int failing; /* Whether or not this search failed. */
|
||||
} SEARCH_STATE;
|
||||
|
||||
#define W_UpdateWindow 0x01 /* WINDOW needs updating. */
|
||||
#define W_WindowIsPerm 0x02 /* This WINDOW is a permanent object. */
|
||||
#define W_WindowVisible 0x04 /* This WINDOW is currently visible. */
|
||||
@ -95,24 +103,24 @@ extern WINDOW *the_echo_area; /* THE_ECHO_AREA is a window in THE_SCREEN. */
|
||||
extern int window_scroll_step;
|
||||
|
||||
/* Make the modeline member for WINDOW. */
|
||||
extern void window_make_modeline ();
|
||||
extern void window_make_modeline (WINDOW *window);
|
||||
|
||||
/* Initalize the window system by creating THE_SCREEN and THE_ECHO_AREA.
|
||||
Create the first window ever, and make it permanent.
|
||||
You pass WIDTH and HEIGHT; the dimensions of the total screen size. */
|
||||
extern void window_initialize_windows ();
|
||||
extern void window_initialize_windows (int width, int height);
|
||||
|
||||
/* Make a new window showing NODE, and return that window structure.
|
||||
The new window is made to be the active window. If NODE is passed
|
||||
as NULL, then show the node showing in the active window. If the
|
||||
window could not be made return a NULL pointer. The active window
|
||||
is not changed.*/
|
||||
extern WINDOW *window_make_window ();
|
||||
extern WINDOW *window_make_window (NODE *node);
|
||||
|
||||
/* Delete WINDOW from the list of known windows. If this window was the
|
||||
active window, make the next window in the chain be the active window,
|
||||
or the previous window in the chain if there is no next window. */
|
||||
extern void window_delete_window ();
|
||||
extern void window_delete_window (WINDOW *window);
|
||||
|
||||
/* A function to call when the screen changes size, and some windows have
|
||||
to get deleted. The function is called with the window to be deleted
|
||||
@ -121,111 +129,113 @@ extern void window_delete_window ();
|
||||
extern VFunction *window_deletion_notifier;
|
||||
|
||||
/* Set WINDOW to display NODE. */
|
||||
extern void window_set_node_of_window ();
|
||||
extern void window_set_node_of_window (WINDOW *window, NODE *node);
|
||||
|
||||
/* Tell the window system that the size of the screen has changed. This
|
||||
causes lots of interesting things to happen. The permanent windows
|
||||
are resized, as well as every visible window. You pass WIDTH and HEIGHT;
|
||||
the dimensions of the total screen size. */
|
||||
extern void window_new_screen_size ();
|
||||
extern void window_new_screen_size (int width, int height);
|
||||
|
||||
/* Change the height of WINDOW by AMOUNT. This also automagically adjusts
|
||||
the previous and next windows in the chain. If there is only one user
|
||||
window, then no change takes place. */
|
||||
extern void window_change_window_height ();
|
||||
extern void window_change_window_height (WINDOW *window, int amount);
|
||||
|
||||
/* Adjust the pagetop of WINDOW such that the cursor point will be visible. */
|
||||
extern void window_adjust_pagetop ();
|
||||
extern void window_adjust_pagetop (WINDOW *window);
|
||||
|
||||
/* Tile all of the windows currently displayed in the global variable
|
||||
WINDOWS. If argument DO_INTERNALS is non-zero, tile windows displaying
|
||||
internal nodes as well. */
|
||||
#define DONT_TILE_INTERNALS 0
|
||||
#define TILE_INTERNALS 1
|
||||
extern void window_tile_windows ();
|
||||
extern void window_tile_windows (int style);
|
||||
|
||||
/* Toggle the state of line wrapping in WINDOW. This can do a bit of fancy
|
||||
redisplay. */
|
||||
extern void window_toggle_wrap ();
|
||||
extern void window_toggle_wrap (WINDOW *window);
|
||||
|
||||
/* For every window in CHAIN, set the flags member to have FLAG set. */
|
||||
extern void window_mark_chain ();
|
||||
extern void window_mark_chain (WINDOW *chain, int flag);
|
||||
|
||||
/* For every window in CHAIN, clear the flags member of FLAG. */
|
||||
extern void window_unmark_chain ();
|
||||
extern void window_unmark_chain (WINDOW *chain, int flag);
|
||||
|
||||
/* Make WINDOW start displaying at PERCENT percentage of its node. */
|
||||
extern void window_goto_percentage ();
|
||||
extern void window_goto_percentage (WINDOW *window, int percent);
|
||||
|
||||
/* Build a new node which has FORMAT printed with ARG1 and ARG2 as the
|
||||
contents. */
|
||||
extern NODE *build_message_node ();
|
||||
extern NODE *build_message_node (char *format, void *arg1, void *arg2);
|
||||
|
||||
/* Useful functions can be called from outside of window.c. */
|
||||
extern void initialize_message_buffer ();
|
||||
extern void initialize_message_buffer (void);
|
||||
|
||||
/* Print FORMAT with ARG1,2 to the end of the current message buffer. */
|
||||
extern void printf_to_message_buffer ();
|
||||
extern void printf_to_message_buffer (char *format, void *arg1, void *arg2,
|
||||
void *arg3);
|
||||
|
||||
/* Convert the contents of the message buffer to a node. */
|
||||
extern NODE *message_buffer_to_node ();
|
||||
extern NODE *message_buffer_to_node (void);
|
||||
|
||||
/* Return the length of the most recently printed line in message buffer. */
|
||||
extern int message_buffer_length_this_line ();
|
||||
extern int message_buffer_length_this_line (void);
|
||||
|
||||
/* Pad STRING to COUNT characters by inserting blanks. */
|
||||
extern int pad_to ();
|
||||
extern int pad_to (int count, char *string);
|
||||
|
||||
/* Make a message appear in the echo area, built from FORMAT, ARG1 and ARG2.
|
||||
The arguments are treated similar to printf () arguments, but not all of
|
||||
printf () hair is present. The message appears immediately. If there was
|
||||
already a message appearing in the echo area, it is removed. */
|
||||
extern void window_message_in_echo_area ();
|
||||
extern void window_message_in_echo_area (char *format, void *arg1, void *arg2);
|
||||
|
||||
/* Place a temporary message in the echo area built from FORMAT, ARG1
|
||||
and ARG2. The message appears immediately, but does not destroy
|
||||
any existing message. A future call to unmessage_in_echo_area ()
|
||||
restores the old contents. */
|
||||
extern void message_in_echo_area ();
|
||||
extern void unmessage_in_echo_area ();
|
||||
extern void message_in_echo_area (char *format, void *arg1, void *arg2);
|
||||
extern void unmessage_in_echo_area (void);
|
||||
|
||||
/* Clear the echo area, removing any message that is already present.
|
||||
The echo area is cleared immediately. */
|
||||
extern void window_clear_echo_area ();
|
||||
extern void window_clear_echo_area (void);
|
||||
|
||||
/* Quickly guess the approximate number of lines to that NODE would
|
||||
take to display. This really only counts carriage returns. */
|
||||
extern int window_physical_lines ();
|
||||
extern int window_physical_lines (NODE *node);
|
||||
|
||||
/* Calculate a list of line starts for the node belonging to WINDOW. The line
|
||||
starts are pointers to the actual text within WINDOW->NODE. */
|
||||
extern void calculate_line_starts ();
|
||||
extern void calculate_line_starts (WINDOW *window);
|
||||
|
||||
/* Given WINDOW, recalculate the line starts for the node it displays. */
|
||||
extern void recalculate_line_starts ();
|
||||
extern void recalculate_line_starts (WINDOW *window);
|
||||
|
||||
/* Return the number of characters it takes to display CHARACTER on the
|
||||
screen at HPOS. */
|
||||
extern int character_width ();
|
||||
extern int character_width (int character, int hpos);
|
||||
|
||||
/* Return the number of characters it takes to display STRING on the
|
||||
screen at HPOS. */
|
||||
extern int string_width ();
|
||||
extern int string_width (char *string, int hpos);
|
||||
|
||||
/* Return the index of the line containing point. */
|
||||
extern int window_line_of_point ();
|
||||
extern int window_line_of_point (WINDOW *window);
|
||||
|
||||
/* Get and return the goal column for this window. */
|
||||
extern int window_get_goal_column ();
|
||||
extern int window_get_goal_column (WINDOW *window);
|
||||
|
||||
/* Get and return the printed column offset of the cursor in this window. */
|
||||
extern int window_get_cursor_column ();
|
||||
extern int window_get_cursor_column (WINDOW *window);
|
||||
|
||||
/* Get and Set the node, pagetop, and point of WINDOW. */
|
||||
extern void window_get_state (), window_set_state ();
|
||||
extern void window_get_state (WINDOW *window, SEARCH_STATE *state);
|
||||
extern void window_set_state (WINDOW *window, SEARCH_STATE *state);
|
||||
|
||||
/* Count the number of characters in LINE that precede the printed column
|
||||
offset of GOAL. */
|
||||
extern int window_chars_to_goal ();
|
||||
extern int window_chars_to_goal (char *line, int goal);
|
||||
|
||||
#endif /* not INFO_WINDOW_H */
|
||||
|
@ -1,4 +1,4 @@
|
||||
$Id: README,v 1.2 2002/09/11 16:32:09 karl Exp $
|
||||
$Id: README,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
texinfo/lib/README
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
@ -1,20 +1,19 @@
|
||||
/* Convenience header for conditional use of GNU <libintl.h>.
|
||||
Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published
|
||||
by the Free Software Foundation; either version 2, or (at your option)
|
||||
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
|
||||
Library General Public License for more details.
|
||||
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 Library 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. */
|
||||
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 _LIBGETTEXT_H
|
||||
#define _LIBGETTEXT_H 1
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* substring.c -- extract substring.
|
||||
$Id: substring.c,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: substring.c,v 1.2 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 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
|
||||
@ -20,13 +20,11 @@
|
||||
#include "system.h"
|
||||
|
||||
char *
|
||||
substring (start, end)
|
||||
char *start;
|
||||
char *end;
|
||||
substring (const char *start, const char *end)
|
||||
{
|
||||
char *result = xmalloc (end - start + 1);
|
||||
char *scan_result = result;
|
||||
char *scan = start;
|
||||
const char *scan = start;
|
||||
|
||||
while (scan < end)
|
||||
*scan_result++ = *scan++;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* system.h: system-dependent declarations; include this first.
|
||||
$Id: system.h,v 1.5 2003/03/22 17:40:39 karl Exp $
|
||||
$Id: system.h,v 1.12 2004/04/26 13:56:57 karl Exp $
|
||||
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -32,15 +32,11 @@
|
||||
/* MiKTeX defines substring() in a separate DLL, where it has its
|
||||
own __declspec declaration. We don't want to try to duplicate
|
||||
this Microsoft-ism here. */
|
||||
extern char *substring ();
|
||||
extern char *substring (const char *, const char *);
|
||||
#endif
|
||||
|
||||
/* <unistd.h> should be included before any preprocessor test
|
||||
of _POSIX_VERSION. */
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
/* We follow the order of header inclusion from Autoconf's
|
||||
ac_includes_default, more or less. */
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
@ -61,10 +57,6 @@ extern char *substring ();
|
||||
#define _(String) gettext (String)
|
||||
#define N_(String) (String)
|
||||
|
||||
#ifndef HAVE_LC_MESSAGES
|
||||
#define LC_MESSAGES (-1)
|
||||
#endif
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#define getopt system_getopt
|
||||
#include <stdlib.h>
|
||||
@ -75,16 +67,34 @@ extern char *getenv ();
|
||||
|
||||
/* Don't use bcopy! Use memmove if source and destination may overlap,
|
||||
memcpy otherwise. */
|
||||
#ifdef HAVE_STRING_H
|
||||
#if HAVE_STRING_H
|
||||
# if !STDC_HEADERS && HAVE_MEMORY_H
|
||||
# include <memory.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
#else
|
||||
#endif
|
||||
|
||||
#if HAVE_STRINGS_H
|
||||
/* Always include <strings.h> if we have it. This is because that's
|
||||
what Autoconf's AC_CHECK_DECL does. On IBM AIX 4.2, strncasecmp is
|
||||
only declared in strings.h. */
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#if !HAVE_STRNCASECMP || !HAVE_STRCASECMP
|
||||
# include "strcase.h"
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_MEMCHR
|
||||
char *memchr ();
|
||||
#endif
|
||||
|
||||
/* <unistd.h> defines _POSIX_VERSION, but Paul Eggert points out that is
|
||||
only supposed to be used in user code, not other system headers. */
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
@ -191,30 +201,41 @@ extern int strcoll ();
|
||||
# define HAVE_LONG_FILENAMES(dir) (pathconf (dir, _PC_NAME_MAX) > 12)
|
||||
# define NULL_DEVICE "/dev/null"
|
||||
# define DEFAULT_INFOPATH "c:/djgpp/info;/usr/local/info;/usr/info;."
|
||||
# else /* !__DJGPP__ */
|
||||
/* DJGPP supports /dev/null, which is okay for Unix aficionados,
|
||||
shell scripts and Makefiles, but interactive DOS die-hards
|
||||
would probably want to have NUL as well. */
|
||||
# define ALSO_NULL_DEVICE "NUL"
|
||||
# else /* O_BINARY && !__DJGPP__ */
|
||||
# define HAVE_LONG_FILENAMES(dir) (0)
|
||||
# define NULL_DEVICE "NUL"
|
||||
# endif /* !__DJGPP__ */
|
||||
# endif /* O_BINARY && !__DJGPP__ */
|
||||
# define SET_SCREEN_SIZE_HELPER terminal_prep_terminal()
|
||||
# define DEFAULT_INFO_PRINT_COMMAND ">PRN"
|
||||
# else /* !__MSDOS__ */
|
||||
# else /* O_BINARY && !__MSDOS__ */
|
||||
# define setmode(f,m) _setmode(f,m)
|
||||
# define HAVE_LONG_FILENAMES(dir) (1)
|
||||
# define NULL_DEVICE "NUL"
|
||||
# endif /* !__MSDOS__ */
|
||||
# define SET_BINARY(f) do {if (!isatty(f)) setmode(f,O_BINARY);} while(0)
|
||||
# define FOPEN_RBIN "rb"
|
||||
# define FOPEN_WBIN "wb"
|
||||
# define IS_SLASH(c) ((c) == '/' || (c) == '\\')
|
||||
# define HAVE_DRIVE(n) ((n)[0] && (n)[1] == ':')
|
||||
# define IS_ABSOLUTE(n) (IS_SLASH((n)[0]) || ((n)[0] && (n)[1] == ':'))
|
||||
# endif /* O_BINARY && !__MSDOS__ */
|
||||
# ifdef __CYGWIN__
|
||||
# define DEFAULT_TMPDIR "/tmp/"
|
||||
# define PATH_SEP ":"
|
||||
# else /* O_BINARY && !__CYGWIN__ */
|
||||
# define DEFAULT_TMPDIR "c:/"
|
||||
# define PATH_SEP ";"
|
||||
# endif /* O_BINARY && !__CYGWIN__ */
|
||||
/* Back to any O_BINARY system. */
|
||||
# define FILENAME_CMP strcasecmp
|
||||
# define FILENAME_CMPN strncasecmp
|
||||
# define PATH_SEP ";"
|
||||
# define STRIP_DOT_EXE 1
|
||||
# define DEFAULT_TMPDIR "c:/"
|
||||
# define FOPEN_RBIN "rb"
|
||||
# define FOPEN_WBIN "wb"
|
||||
# define HAVE_DRIVE(n) ((n)[0] && (n)[1] == ':')
|
||||
# define IS_SLASH(c) ((c) == '/' || (c) == '\\')
|
||||
# define IS_ABSOLUTE(n) (IS_SLASH((n)[0]) || ((n)[0] && (n)[1] == ':'))
|
||||
# define PIPE_USE_FORK 0
|
||||
#else /* not O_BINARY */
|
||||
# define SET_BINARY(f) do {if (!isatty(f)) setmode(f,O_BINARY);} while(0)
|
||||
# define STRIP_DOT_EXE 1
|
||||
|
||||
#else /* not O_BINARY, i.e., Unix */
|
||||
# define SET_BINARY(f) (void)0
|
||||
# define FOPEN_RBIN "r"
|
||||
# define FOPEN_WBIN "w"
|
||||
@ -235,12 +256,8 @@ extern int strcoll ();
|
||||
# define PIPE_USE_FORK 1
|
||||
#endif /* not O_BINARY */
|
||||
|
||||
/* DJGPP supports /dev/null, which is okay for Unix aficionados,
|
||||
shell scripts and Makefiles, but interactive DOS die-hards
|
||||
would probably want to have NUL as well. */
|
||||
#ifdef __DJGPP__
|
||||
# define ALSO_NULL_DEVICE "NUL"
|
||||
#else
|
||||
/* Everything but DJGPP. */
|
||||
#ifndef ALSO_NULL_DEVICE
|
||||
# define ALSO_NULL_DEVICE ""
|
||||
#endif
|
||||
|
||||
@ -248,15 +265,17 @@ extern int strcoll ();
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
/* Some systems don't declare this function in pwd.h. */
|
||||
struct passwd *getpwnam ();
|
||||
struct passwd *getpwnam (const char *name);
|
||||
|
||||
/* Our library routines not included in any system library. */
|
||||
extern void *xmalloc (), *xrealloc ();
|
||||
extern char *xstrdup ();
|
||||
extern void xexit ();
|
||||
extern void *xmalloc (size_t), *xrealloc (void *, size_t);
|
||||
extern char *xstrdup (const char *);
|
||||
extern void xexit (int);
|
||||
|
||||
/* For convenience. */
|
||||
#define STREQ(s1,s2) (strcmp (s1, s2) == 0)
|
||||
#define STRCASEEQ(s1,s2) (strcasecmp (s1, s2) == 0)
|
||||
#define STRNCASEEQ(s1,s2,n) (strncasecmp (s1, s2, n) == 0)
|
||||
|
||||
/* We don't need anything fancy. If we did need something fancy, gnulib
|
||||
has it. */
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* xalloc.h -- malloc with out-of-memory checking
|
||||
Copyright (C) 1990-1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||
1999, 2000, 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
|
||||
@ -20,14 +22,12 @@
|
||||
|
||||
# include <stddef.h>
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
|
||||
# ifndef __attribute__
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
|
||||
# define __attribute__(x)
|
||||
@ -38,52 +38,53 @@
|
||||
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
|
||||
# endif
|
||||
|
||||
/* Exit value when the requested amount of memory is not available.
|
||||
It is initialized to EXIT_FAILURE, but the caller may set it to
|
||||
some other value. */
|
||||
extern int xalloc_exit_failure;
|
||||
|
||||
/* If this pointer is non-zero, run the specified function upon each
|
||||
allocation failure. It is initialized to zero. */
|
||||
extern void (*xalloc_fail_func) PARAMS ((void));
|
||||
|
||||
/* If XALLOC_FAIL_FUNC is undefined or a function that returns, this
|
||||
message is output. It is translated via gettext.
|
||||
Its value is "memory exhausted". */
|
||||
extern char const xalloc_msg_memory_exhausted[];
|
||||
|
||||
/* This function is always triggered when memory is exhausted. It is
|
||||
in charge of honoring the three previous items. This is the
|
||||
/* This function is always triggered when memory is exhausted.
|
||||
It must be defined by the application, either explicitly
|
||||
or by using gnulib's xalloc-die module. This is the
|
||||
function to call when one wants the program to die because of a
|
||||
memory allocation failure. */
|
||||
extern void xalloc_die PARAMS ((void)) ATTRIBUTE_NORETURN;
|
||||
extern void xalloc_die (void) ATTRIBUTE_NORETURN;
|
||||
|
||||
void *xmalloc PARAMS ((size_t n));
|
||||
void *xcalloc PARAMS ((size_t n, size_t s));
|
||||
void *xrealloc PARAMS ((void *p, size_t n));
|
||||
char *xstrdup PARAMS ((const char *str));
|
||||
void *xmalloc (size_t s);
|
||||
void *xnmalloc (size_t n, size_t s);
|
||||
void *xzalloc (size_t s);
|
||||
void *xcalloc (size_t n, size_t s);
|
||||
void *xrealloc (void *p, size_t s);
|
||||
void *xnrealloc (void *p, size_t n, size_t s);
|
||||
void *x2realloc (void *p, size_t *pn);
|
||||
void *x2nrealloc (void *p, size_t *pn, size_t s);
|
||||
void *xclone (void const *p, size_t s);
|
||||
char *xstrdup (const char *str);
|
||||
|
||||
# define XMALLOC(Type, N_items) ((Type *) xmalloc (sizeof (Type) * (N_items)))
|
||||
# define XCALLOC(Type, N_items) ((Type *) xcalloc (sizeof (Type), (N_items)))
|
||||
# define XREALLOC(Ptr, Type, N_items) \
|
||||
((Type *) xrealloc ((void *) (Ptr), sizeof (Type) * (N_items)))
|
||||
/* Return 1 if an array of N objects, each of size S, cannot exist due
|
||||
to size arithmetic overflow. S must be positive and N must be
|
||||
nonnegative. This is a macro, not an inline function, so that it
|
||||
works correctly even when SIZE_MAX < N.
|
||||
|
||||
/* Declare and alloc memory for VAR of type TYPE. */
|
||||
# define NEW(Type, Var) Type *(Var) = XMALLOC (Type, 1)
|
||||
By gnulib convention, SIZE_MAX represents overflow in size
|
||||
calculations, so the conservative dividend to use here is
|
||||
SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value.
|
||||
However, malloc (SIZE_MAX) fails on all known hosts where
|
||||
sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for
|
||||
exactly-SIZE_MAX allocations on such hosts; this avoids a test and
|
||||
branch when S is known to be 1. */
|
||||
# define xalloc_oversized(n, s) \
|
||||
((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
|
||||
|
||||
/* Free VAR only if non NULL. */
|
||||
# define XFREE(Var) \
|
||||
do { \
|
||||
if (Var) \
|
||||
free (Var); \
|
||||
} while (0)
|
||||
/* These macros are deprecated; they will go away soon, and are retained
|
||||
temporarily only to ease conversion to the functions described above. */
|
||||
# define CCLONE(p, n) xclone (p, (n) * sizeof *(p))
|
||||
# define CLONE(p) xclone (p, sizeof *(p))
|
||||
# define NEW(type, var) type *var = xmalloc (sizeof (type))
|
||||
# define XCALLOC(type, n) xcalloc (n, sizeof (type))
|
||||
# define XMALLOC(type, n) xnmalloc (n, sizeof (type))
|
||||
# define XREALLOC(p, type, n) xnrealloc (p, n, sizeof (type))
|
||||
# define XFREE(p) free (p)
|
||||
|
||||
/* Return a pointer to a malloc'ed copy of the array SRC of NUM elements. */
|
||||
# define CCLONE(Src, Num) \
|
||||
(memcpy (xmalloc (sizeof (*Src) * (Num)), (Src), sizeof (*Src) * (Num)))
|
||||
|
||||
/* Return a malloc'ed copy of SRC. */
|
||||
# define CLONE(Src) CCLONE (Src, 1)
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
|
||||
#endif /* !XALLOC_H_ */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* xexit.c -- exit with attention to return values and closing stdout.
|
||||
$Id: xexit.c,v 1.4 2003/05/19 13:10:59 karl Exp $
|
||||
$Id: xexit.c,v 1.5 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1999, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 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
|
||||
@ -47,8 +47,7 @@
|
||||
unsuccessfully. */
|
||||
|
||||
void
|
||||
xexit (exit_status)
|
||||
int exit_status;
|
||||
xexit (int exit_status)
|
||||
{
|
||||
if (ferror (stdout))
|
||||
{
|
||||
|
@ -1,12 +1,6 @@
|
||||
/* xmalloc.c -- safe versions of malloc and realloc */
|
||||
/* xmalloc.c -- safe versions of malloc and realloc.
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
This file has appeared in prior works by the Free Software Foundation;
|
||||
thus it carries copyright dates from 1988 through 1993.
|
||||
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 2004 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -26,24 +20,20 @@
|
||||
Written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#if !defined (ALREADY_HAVE_XMALLOC)
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
|
||||
extern void *malloc (), *realloc ();
|
||||
static void memory_error_and_abort ();
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Memory Allocation and Deallocation. */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
static void
|
||||
memory_error_and_abort (const char *fname)
|
||||
{
|
||||
fprintf (stderr, "%s: Out of virtual memory!\n", fname);
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* Return a pointer to free()able block of memory large enough
|
||||
to hold BYTES number of bytes. If the memory cannot be allocated,
|
||||
print an error message and abort. */
|
||||
void *
|
||||
xmalloc (bytes)
|
||||
int bytes;
|
||||
xmalloc (size_t bytes)
|
||||
{
|
||||
void *temp = malloc (bytes);
|
||||
|
||||
@ -53,9 +43,7 @@ xmalloc (bytes)
|
||||
}
|
||||
|
||||
void *
|
||||
xrealloc (pointer, bytes)
|
||||
void *pointer;
|
||||
int bytes;
|
||||
xrealloc (void *pointer, size_t bytes)
|
||||
{
|
||||
void *temp;
|
||||
|
||||
@ -70,11 +58,4 @@ xrealloc (pointer, bytes)
|
||||
return (temp);
|
||||
}
|
||||
|
||||
static void
|
||||
memory_error_and_abort (fname)
|
||||
char *fname;
|
||||
{
|
||||
fprintf (stderr, "%s: Out of virtual memory!\n", fname);
|
||||
abort ();
|
||||
}
|
||||
#endif /* !ALREADY_HAVE_XMALLOC */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* xstrdup.c -- copy a string with out of memory checking
|
||||
Copyright (C) 1990, 1996, 1998, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1996, 1998, 2001, 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
|
||||
@ -19,16 +19,11 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if STDC_HEADERS || HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "xalloc.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* Return a newly allocated copy of STRING. */
|
||||
|
||||
char *
|
||||
|
@ -1,4 +1,4 @@
|
||||
$Id: README,v 1.2 2002/09/11 16:32:09 karl Exp $
|
||||
$Id: README,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
texinfo/makeinfo/README
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,8 @@
|
||||
/* cmds.h -- declarations for cmds.c.
|
||||
$Id: cmds.h,v 1.3 2002/11/04 22:15:19 karl Exp $
|
||||
$Id: cmds.h,v 1.9 2004/11/26 00:48:35 karl Exp $
|
||||
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999, 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
|
||||
@ -47,7 +48,166 @@ typedef struct
|
||||
|
||||
extern COMMAND command_table[];
|
||||
|
||||
/* Nonzero if we have seen an @titlepage command. */
|
||||
extern int titlepage_cmd_present;
|
||||
typedef struct acronym_desc
|
||||
{
|
||||
struct acronym_desc *next;
|
||||
char *acronym;
|
||||
char *description;
|
||||
} ACRONYM_DESC;
|
||||
|
||||
/* Texinfo commands. */
|
||||
extern void insert_self (int arg),
|
||||
insert_space (int arg),
|
||||
cm_ignore_line (void),
|
||||
cm_ignore_arg (int arg, int start_pos, int end_pos),
|
||||
cm_comment (void),
|
||||
cm_no_op (void);
|
||||
|
||||
/* Document structure and meta information. */
|
||||
extern void cm_setfilename (void),
|
||||
cm_settitle (void),
|
||||
cm_documentdescription (void),
|
||||
cm_node (void),
|
||||
cm_menu (void),
|
||||
cm_detailmenu (void),
|
||||
cm_dircategory (void),
|
||||
cm_direntry (void),
|
||||
cm_bye (void);
|
||||
|
||||
/* File inclusion. */
|
||||
extern void cm_include (void),
|
||||
cm_verbatiminclude (void);
|
||||
|
||||
/* Cross referencing commands. */
|
||||
extern void cm_anchor (int arg),
|
||||
cm_xref (int arg),
|
||||
cm_pxref (int arg),
|
||||
cm_ref (int arg),
|
||||
cm_inforef (int arg),
|
||||
cm_uref (int arg);
|
||||
|
||||
/* Special insertions. */
|
||||
extern void cm_LaTeX (int arg),
|
||||
cm_TeX (int arg),
|
||||
cm_bullet (int arg),
|
||||
cm_colon (void),
|
||||
cm_comma (int arg),
|
||||
cm_copyright (int arg),
|
||||
cm_dots (int arg),
|
||||
cm_enddots (int arg),
|
||||
cm_equiv (int arg),
|
||||
cm_error (int arg),
|
||||
cm_expansion (int arg),
|
||||
cm_image (int arg),
|
||||
cm_insert_copying (void),
|
||||
cm_minus (int arg),
|
||||
cm_point (int arg),
|
||||
cm_print (int arg),
|
||||
cm_punct (int arg),
|
||||
cm_registeredsymbol (int arg),
|
||||
cm_result (int arg);
|
||||
|
||||
/* Emphasis and markup. */
|
||||
extern void cm_acronym (int arg),
|
||||
cm_abbr (int arg),
|
||||
cm_b (int arg),
|
||||
cm_cite (int arg, int position),
|
||||
cm_code (int arg),
|
||||
cm_dfn (int arg, int position),
|
||||
cm_dmn (int arg),
|
||||
cm_email (int arg),
|
||||
cm_emph (int arg),
|
||||
cm_i (int arg),
|
||||
cm_kbd (int arg),
|
||||
cm_key (int arg),
|
||||
cm_math (int arg),
|
||||
cm_not_fixed_width (int arg, int start, int end),
|
||||
cm_r (int arg),
|
||||
cm_sansserif (int arg),
|
||||
cm_sc (int arg, int start_pos, int end_pos),
|
||||
cm_slanted (int arg),
|
||||
cm_strong (int arg, int start_pos, int end_pos),
|
||||
cm_tt (int arg),
|
||||
cm_indicate_url (int arg, int start, int end),
|
||||
cm_var (int arg, int start_pos, int end_pos),
|
||||
cm_verb (int arg);
|
||||
|
||||
/* Block environments. */
|
||||
extern void cm_cartouche (void),
|
||||
cm_group (void),
|
||||
cm_display (void),
|
||||
cm_smalldisplay (void),
|
||||
cm_example (void),
|
||||
cm_smallexample (void),
|
||||
cm_smalllisp (void),
|
||||
cm_lisp (void),
|
||||
cm_format (void),
|
||||
cm_smallformat (void),
|
||||
cm_quotation (void),
|
||||
cm_copying (void),
|
||||
cm_flushleft (void),
|
||||
cm_flushright (void),
|
||||
cm_verbatim (void),
|
||||
cm_end (void);
|
||||
|
||||
/* Tables, lists, enumerations. */
|
||||
extern void cm_table (void),
|
||||
cm_ftable (void),
|
||||
cm_vtable (void),
|
||||
cm_itemize (void),
|
||||
cm_enumerate (void),
|
||||
cm_multitable (void),
|
||||
cm_headitem (void),
|
||||
cm_item (void),
|
||||
cm_itemx (void),
|
||||
cm_tab (void);
|
||||
|
||||
extern void cm_center (void),
|
||||
cm_exdent (void),
|
||||
cm_indent (void),
|
||||
cm_noindent (void),
|
||||
cm_noindent_cmd (void);
|
||||
|
||||
/* Line and page breaks. */
|
||||
extern void cm_asterisk (void),
|
||||
cm_sp (void),
|
||||
cm_page (void);
|
||||
|
||||
/* Non breaking words. */
|
||||
extern void cm_tie (int arg),
|
||||
cm_w (int arg);
|
||||
|
||||
/* Title page creation. */
|
||||
extern void cm_titlepage (void),
|
||||
cm_author (void),
|
||||
cm_titlepage_cmds (void),
|
||||
cm_titlefont (int arg),
|
||||
cm_today (int arg);
|
||||
|
||||
/* Floats. */
|
||||
extern void cm_float (void),
|
||||
cm_caption (int arg),
|
||||
cm_shortcaption (void),
|
||||
cm_listoffloats (void);
|
||||
|
||||
/* Indices. */
|
||||
extern void cm_kindex (void),
|
||||
cm_cindex (void),
|
||||
cm_findex (void),
|
||||
cm_pindex (void),
|
||||
cm_vindex (void),
|
||||
cm_tindex (void),
|
||||
cm_defindex (void),
|
||||
cm_defcodeindex (void),
|
||||
cm_synindex (void),
|
||||
cm_printindex (void);
|
||||
|
||||
/* Conditionals. */
|
||||
extern void cm_set (void),
|
||||
cm_clear (void),
|
||||
cm_ifset (void),
|
||||
cm_ifclear (void),
|
||||
cm_ifeq (void),
|
||||
cm_value (int arg, int start_pos, int end_pos);
|
||||
|
||||
#endif /* !CMDS_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* defun.c -- @defun and friends.
|
||||
$Id: defun.c,v 1.6 2003/05/09 23:51:10 karl Exp $
|
||||
$Id: defun.c,v 1.11 2004/04/11 17:56:46 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
|
||||
@ -38,8 +38,7 @@ struct token_accumulator
|
||||
};
|
||||
|
||||
static void
|
||||
initialize_token_accumulator (accumulator)
|
||||
struct token_accumulator *accumulator;
|
||||
initialize_token_accumulator (struct token_accumulator *accumulator)
|
||||
{
|
||||
accumulator->length = 0;
|
||||
accumulator->index = 0;
|
||||
@ -47,9 +46,7 @@ initialize_token_accumulator (accumulator)
|
||||
}
|
||||
|
||||
static void
|
||||
accumulate_token (accumulator, token)
|
||||
struct token_accumulator *accumulator;
|
||||
char *token;
|
||||
accumulate_token (struct token_accumulator *accumulator, char *token)
|
||||
{
|
||||
if (accumulator->index >= accumulator->length)
|
||||
{
|
||||
@ -64,8 +61,7 @@ accumulate_token (accumulator, token)
|
||||
/* Given STRING_POINTER pointing at an open brace, skip forward and return a
|
||||
pointer to just past the matching close brace. */
|
||||
static int
|
||||
scan_group_in_string (string_pointer)
|
||||
char **string_pointer;
|
||||
scan_group_in_string (char **string_pointer)
|
||||
{
|
||||
char *scan_string = (*string_pointer) + 1;
|
||||
unsigned int level = 1;
|
||||
@ -106,8 +102,7 @@ scan_group_in_string (string_pointer)
|
||||
Contiguous whitespace characters are converted to a token
|
||||
consisting of a single space. */
|
||||
static char **
|
||||
args_from_string (string)
|
||||
char *string;
|
||||
args_from_string (char *string)
|
||||
{
|
||||
struct token_accumulator accumulator;
|
||||
char *token_start, *token_end;
|
||||
@ -176,6 +171,15 @@ args_from_string (string)
|
||||
token_end = balanced ? (scan_string - 1) : scan_string;
|
||||
}
|
||||
|
||||
/* Make commas separate tokens so to differentiate them from
|
||||
parameter types in XML output. */
|
||||
else if (*scan_string == ',')
|
||||
{
|
||||
token_start = scan_string;
|
||||
scan_string += 1;
|
||||
token_end = scan_string;
|
||||
}
|
||||
|
||||
/* Otherwise a token is delimited by whitespace, parentheses,
|
||||
brackets, or braces. A token is also ended by a command. */
|
||||
else
|
||||
@ -198,6 +202,14 @@ args_from_string (string)
|
||||
break;
|
||||
}
|
||||
|
||||
/* End token if we are looking at a comma, as commas are
|
||||
delimiters too. */
|
||||
if (c == ',')
|
||||
{
|
||||
scan_string--;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we encounter a command embedded within a token,
|
||||
then end the token. */
|
||||
if (c == COMMAND_PREFIX)
|
||||
@ -216,12 +228,16 @@ args_from_string (string)
|
||||
}
|
||||
|
||||
static void
|
||||
process_defun_args (defun_args, auto_var_p)
|
||||
char **defun_args;
|
||||
int auto_var_p;
|
||||
process_defun_args (char **defun_args, int auto_var_p)
|
||||
{
|
||||
int pending_space = 0;
|
||||
|
||||
if (xml)
|
||||
{
|
||||
xml_process_defun_args (defun_args, auto_var_p);
|
||||
return;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
char *defun_arg = *defun_args++;
|
||||
@ -245,38 +261,25 @@ process_defun_args (defun_args, auto_var_p)
|
||||
{
|
||||
/* Within @deffn and friends, texinfo.tex makes parentheses
|
||||
sans serif and brackets bold. We use roman instead. */
|
||||
insert_html_tag (START, "");
|
||||
if (html)
|
||||
insert_html_tag (START, "");
|
||||
|
||||
add_char (defun_arg[0]);
|
||||
insert_html_tag (END, "");
|
||||
|
||||
if (html)
|
||||
insert_html_tag (END, "");
|
||||
}
|
||||
else if (defun_arg[0] == '&')
|
||||
if (html)
|
||||
{
|
||||
defun_arg = escape_string (xstrdup (defun_arg));
|
||||
add_word (defun_arg);
|
||||
free (defun_arg);
|
||||
}
|
||||
else
|
||||
add_word (defun_arg);
|
||||
else if (defun_arg[0] == COMMAND_PREFIX)
|
||||
execute_string ("%s", defun_arg);
|
||||
else if (auto_var_p)
|
||||
if (html)
|
||||
{
|
||||
defun_arg = escape_string (xstrdup (defun_arg));
|
||||
add_word (defun_arg);
|
||||
free (defun_arg);
|
||||
}
|
||||
else
|
||||
add_word (defun_arg);
|
||||
/* else if (defun_arg[0] == '&' || defun_arg[0] == COMMAND_PREFIX) */
|
||||
/* execute_string ("%s", defun_arg); */
|
||||
/* else if (auto_var_p) */
|
||||
/* execute_string ("%s", defun_arg); */
|
||||
else
|
||||
add_word (defun_arg);
|
||||
execute_string ("%s", defun_arg);
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
next_nonwhite_defun_arg (arg_pointer)
|
||||
char ***arg_pointer;
|
||||
next_nonwhite_defun_arg (char ***arg_pointer)
|
||||
{
|
||||
char **scan = (*arg_pointer);
|
||||
char *arg = (*scan++);
|
||||
@ -296,10 +299,9 @@ next_nonwhite_defun_arg (arg_pointer)
|
||||
/* This is needed also in insertion.c. */
|
||||
|
||||
enum insertion_type
|
||||
get_base_type (type)
|
||||
enum insertion_type type;
|
||||
get_base_type (int type)
|
||||
{
|
||||
enum insertion_type base_type;
|
||||
int base_type;
|
||||
switch (type)
|
||||
{
|
||||
case defivar: base_type = defcv; break;
|
||||
@ -307,6 +309,7 @@ get_base_type (type)
|
||||
case defmethod: base_type = defop; break;
|
||||
case defopt: base_type = defvr; break;
|
||||
case defspec: base_type = deffn; break;
|
||||
case deftypecv: base_type = deftypecv; break;
|
||||
case deftypefun: base_type = deftypefn; break;
|
||||
case deftypeivar: base_type = deftypeivar; break;
|
||||
case deftypemethod: base_type = deftypemethod; break;
|
||||
@ -326,14 +329,14 @@ get_base_type (type)
|
||||
TYPE says which insertion this is.
|
||||
X_P, if nonzero, says not to start a new insertion. */
|
||||
static void
|
||||
defun_internal (type, x_p)
|
||||
enum insertion_type type;
|
||||
int x_p;
|
||||
defun_internal (int type, int x_p)
|
||||
{
|
||||
enum insertion_type base_type;
|
||||
int base_type;
|
||||
char **defun_args, **scan_args;
|
||||
const char *category;
|
||||
char *defined_name, *type_name, *type_name2;
|
||||
char *defined_name;
|
||||
char *type_name = NULL;
|
||||
char *type_name2 = NULL;
|
||||
|
||||
{
|
||||
char *line;
|
||||
@ -355,6 +358,33 @@ defun_internal (type, x_p)
|
||||
Unfortunately, this means that you can't call macros, use @value, etc.
|
||||
inside @def.. commands, sigh. */
|
||||
get_rest_of_line (0, &line);
|
||||
|
||||
/* Basic line continuation. If a line ends with \s*@\s* concatanate
|
||||
the next line. */
|
||||
{
|
||||
char *next_line, *new_line;
|
||||
int i;
|
||||
|
||||
line_continuation:
|
||||
i = strlen (line) - 1;
|
||||
|
||||
if (line[i] == '@' && line[i-1] != '@')
|
||||
{
|
||||
get_rest_of_line (0, &next_line);
|
||||
new_line = (char *) xmalloc (i + strlen (next_line) + 2);
|
||||
strncpy (new_line, line, i);
|
||||
new_line[i] = '\0';
|
||||
free (line);
|
||||
strcat (new_line, " ");
|
||||
strcat (new_line, next_line);
|
||||
line = xstrdup (new_line);
|
||||
free (next_line);
|
||||
free (new_line);
|
||||
|
||||
goto line_continuation;
|
||||
}
|
||||
}
|
||||
|
||||
defun_args = (args_from_string (line));
|
||||
free (line);
|
||||
}
|
||||
@ -399,7 +429,8 @@ defun_internal (type, x_p)
|
||||
}
|
||||
|
||||
/* The class name. */
|
||||
if ((base_type == deftypefn)
|
||||
if ((base_type == deftypecv)
|
||||
|| (base_type == deftypefn)
|
||||
|| (base_type == deftypevr)
|
||||
|| (base_type == defcv)
|
||||
|| (base_type == defop)
|
||||
@ -410,8 +441,9 @@ defun_internal (type, x_p)
|
||||
type_name = next_nonwhite_defun_arg (&scan_args);
|
||||
|
||||
/* The type name for typed languages. */
|
||||
if ((base_type == deftypemethod)
|
||||
if ((base_type == deftypecv)
|
||||
|| (base_type == deftypeivar)
|
||||
|| (base_type == deftypemethod)
|
||||
|| (base_type == deftypeop)
|
||||
)
|
||||
type_name2 = next_nonwhite_defun_arg (&scan_args);
|
||||
@ -452,72 +484,84 @@ defun_internal (type, x_p)
|
||||
current_indent -= default_indentation_increment;
|
||||
start_paragraph ();
|
||||
|
||||
if (!x_p) {
|
||||
/* Start the definition on new paragraph. */
|
||||
if (html)
|
||||
add_word ("<p>\n");
|
||||
}
|
||||
|
||||
if (!html && !docbook)
|
||||
if (!html && !xml)
|
||||
switch (base_type)
|
||||
{
|
||||
case deffn:
|
||||
case defvr:
|
||||
case deftp:
|
||||
execute_string (" -- %s: %s", category, defined_name);
|
||||
execute_string (" --- %s: %s", category, defined_name);
|
||||
break;
|
||||
case deftypefn:
|
||||
case deftypevr:
|
||||
execute_string (" -- %s: %s %s", category, type_name, defined_name);
|
||||
execute_string (" --- %s: %s %s", category, type_name, defined_name);
|
||||
break;
|
||||
case defcv:
|
||||
execute_string (" -- %s %s %s: %s", category, _("of"), type_name,
|
||||
execute_string (" --- %s %s %s: %s", category, _("of"), type_name,
|
||||
defined_name);
|
||||
break;
|
||||
case deftypecv:
|
||||
case deftypeivar:
|
||||
execute_string (" -- %s %s %s: %s %s", category, _("of"), type_name,
|
||||
execute_string (" --- %s %s %s: %s %s", category, _("of"), type_name,
|
||||
type_name2, defined_name);
|
||||
break;
|
||||
case defop:
|
||||
execute_string (" -- %s %s %s: %s", category, _("on"), type_name,
|
||||
execute_string (" --- %s %s %s: %s", category, _("on"), type_name,
|
||||
defined_name);
|
||||
break;
|
||||
case deftypeop:
|
||||
execute_string (" -- %s %s %s: %s %s", category, _("on"), type_name,
|
||||
execute_string (" --- %s %s %s: %s %s", category, _("on"), type_name,
|
||||
type_name2, defined_name);
|
||||
break;
|
||||
case deftypemethod:
|
||||
execute_string (" -- %s %s %s: %s %s", category, _("on"), type_name,
|
||||
execute_string (" --- %s %s %s: %s %s", category, _("on"), type_name,
|
||||
type_name2, defined_name);
|
||||
break;
|
||||
}
|
||||
|
||||
if (html)
|
||||
else if (html)
|
||||
{
|
||||
/* If this is not a @def...x version, it could only
|
||||
be a normal version @def.... So start the table here. */
|
||||
if (!x_p)
|
||||
{
|
||||
add_html_elt ("<table width=");
|
||||
add_word ("\"100%\">\n");
|
||||
}
|
||||
insert_string ("<div class=\"defun\">\n");
|
||||
else
|
||||
rollback_empty_tag ("blockquote");
|
||||
|
||||
/* If this is an @def...x there has to be an other @def... before
|
||||
it, so this is only a new row within an existing table. With
|
||||
two complete standalone tables the gap between them is too big. */
|
||||
add_word ("<tr>\n");
|
||||
add_html_elt ("<td align=\"left\">");
|
||||
/* xx The single words (on, off) used here, should depend on
|
||||
documentlanguage and NOT on gettext --kama. */
|
||||
switch (base_type)
|
||||
{
|
||||
case deffn:
|
||||
case defvr:
|
||||
case deftp:
|
||||
case deftypefn:
|
||||
case deftypevr:
|
||||
execute_string ("--- %s: ", category);
|
||||
break;
|
||||
|
||||
case defcv:
|
||||
case deftypecv:
|
||||
case deftypeivar:
|
||||
execute_string ("--- %s %s %s: ", category, _("of"), type_name);
|
||||
break;
|
||||
|
||||
case defop:
|
||||
case deftypemethod:
|
||||
case deftypeop:
|
||||
execute_string ("--- %s %s %s: ", category, _("on"), type_name);
|
||||
break;
|
||||
} /* switch (base_type)... */
|
||||
|
||||
switch (base_type)
|
||||
{
|
||||
case deffn:
|
||||
case defvr:
|
||||
case deftp:
|
||||
/* <i> is for the following function arguments. */
|
||||
/* <var> is for the following function arguments. */
|
||||
insert_html_tag (START, "b");
|
||||
execute_string ("%s", defined_name);
|
||||
insert_html_tag (END, "b");
|
||||
insert_html_tag (START, "i");
|
||||
insert_html_tag (START, "var");
|
||||
break;
|
||||
case deftypefn:
|
||||
case deftypevr:
|
||||
@ -525,58 +569,30 @@ defun_internal (type, x_p)
|
||||
insert_html_tag (START, "b");
|
||||
execute_string ("%s", defined_name);
|
||||
insert_html_tag (END, "b");
|
||||
insert_html_tag (START, "i");
|
||||
insert_html_tag (START, "var");
|
||||
break;
|
||||
case defcv:
|
||||
case defop:
|
||||
insert_html_tag (START, "b");
|
||||
execute_string ("%s", defined_name);
|
||||
insert_html_tag (END, "b");
|
||||
insert_html_tag (START, "i");
|
||||
insert_html_tag (START, "var");
|
||||
break;
|
||||
case deftypecv:
|
||||
case deftypeivar:
|
||||
case deftypemethod:
|
||||
case deftypeop:
|
||||
case deftypeivar:
|
||||
execute_string ("%s ", type_name2);
|
||||
insert_html_tag (START, "b");
|
||||
execute_string ("%s", defined_name);
|
||||
insert_html_tag (END, "b");
|
||||
insert_html_tag (START, "i");
|
||||
insert_html_tag (START, "var");
|
||||
break;
|
||||
}
|
||||
} /* if (html)... */
|
||||
|
||||
if (docbook)
|
||||
{
|
||||
switch (base_type)
|
||||
{
|
||||
case deffn:
|
||||
case defvr:
|
||||
case deftp:
|
||||
case defcv:
|
||||
case defop:
|
||||
xml_insert_element (FUNCTION, START);
|
||||
execute_string ("%s", defined_name);
|
||||
xml_insert_element (FUNCTION, END);
|
||||
break;
|
||||
case deftypefn:
|
||||
case deftypevr:
|
||||
execute_string ("%s ", type_name);
|
||||
xml_insert_element (FUNCTION, START);
|
||||
execute_string ("%s", defined_name);
|
||||
xml_insert_element (FUNCTION, END);
|
||||
break;
|
||||
case deftypemethod:
|
||||
case deftypeop:
|
||||
case deftypeivar:
|
||||
execute_string ("%s ", type_name2);
|
||||
xml_insert_element (FUNCTION, START);
|
||||
execute_string ("%s", defined_name);
|
||||
xml_insert_element (FUNCTION, END);
|
||||
break;
|
||||
}
|
||||
|
||||
} /* if (docbook)... */
|
||||
}
|
||||
else if (xml)
|
||||
xml_begin_def_term (base_type, category, defined_name, type_name,
|
||||
type_name2);
|
||||
|
||||
current_indent += default_indentation_increment;
|
||||
|
||||
@ -606,95 +622,52 @@ defun_internal (type, x_p)
|
||||
}
|
||||
|
||||
current_indent -= default_indentation_increment;
|
||||
close_single_paragraph ();
|
||||
if (!html)
|
||||
close_single_paragraph ();
|
||||
|
||||
if (html)
|
||||
/* Make an entry in the appropriate index. (XML and
|
||||
Docbook already got their entries, so skip them.) */
|
||||
if (!xml)
|
||||
switch (base_type)
|
||||
{
|
||||
case deffn:
|
||||
case deftypefn:
|
||||
execute_string ("@findex %s\n", defined_name);
|
||||
break;
|
||||
case defcv:
|
||||
case deftypecv:
|
||||
case deftypevr:
|
||||
case defvr:
|
||||
execute_string ("@vindex %s\n", defined_name);
|
||||
break;
|
||||
case deftypeivar:
|
||||
execute_string ("@vindex %s %s %s\n", defined_name, _("of"),
|
||||
type_name);
|
||||
break;
|
||||
case defop:
|
||||
case deftypeop:
|
||||
case deftypemethod:
|
||||
execute_string ("@findex %s %s %s\n", defined_name, _("on"),
|
||||
type_name);
|
||||
break;
|
||||
case deftp:
|
||||
execute_string ("@tindex %s\n", defined_name);
|
||||
break;
|
||||
}
|
||||
|
||||
if (xml)
|
||||
xml_end_def_term ();
|
||||
else if (html)
|
||||
{
|
||||
/* xx The single words (on, off) used here, should depend on
|
||||
documentlanguage and NOT on gettext --kama. */
|
||||
switch (base_type)
|
||||
{
|
||||
case deffn:
|
||||
case defvr:
|
||||
case deftp:
|
||||
case deftypefn:
|
||||
case deftypevr:
|
||||
insert_html_tag (END, "i"); /* close italic area for arguments */
|
||||
/* put the rest into the second column */
|
||||
add_word ("</td>\n");
|
||||
add_html_elt ("<td align=\"right\">");
|
||||
execute_string ("%s", category);
|
||||
break;
|
||||
|
||||
case defcv:
|
||||
add_word ("</td>\n");
|
||||
add_html_elt ("<td align=\"right\">");
|
||||
execute_string ("%s %s %s", category, _("of"), type_name);
|
||||
break;
|
||||
|
||||
case defop:
|
||||
case deftypemethod:
|
||||
case deftypeop:
|
||||
insert_html_tag (END, "i");
|
||||
add_word ("</td>\n");
|
||||
add_html_elt ("<td align=\"right\">");
|
||||
execute_string ("%s %s %s", category, _("on"), type_name);
|
||||
break;
|
||||
|
||||
case deftypeivar:
|
||||
insert_html_tag (END, "i");
|
||||
add_word ("</td>\n");
|
||||
add_html_elt ("<td align=\"right\">");
|
||||
execute_string ("%s %s %s", category, _("of"), type_name);
|
||||
break;
|
||||
} /* switch (base_type)... */
|
||||
|
||||
add_word ("</td>\n"); /* close second column */
|
||||
add_word ("</tr>\n"); /* close row */
|
||||
|
||||
/* This is needed because I have to know if the next line is
|
||||
normal text or another @def..x. If text follows, create a new
|
||||
table to get the indentation for the following text.
|
||||
|
||||
This construction would fail if someone uses:
|
||||
@deffn
|
||||
@sp 2
|
||||
@deffnx
|
||||
.
|
||||
@end deffn
|
||||
But we don't care. */
|
||||
if (!looking_at ("@def"))
|
||||
{
|
||||
add_word ("</table>\n");
|
||||
add_html_elt ("<table width=\"95%\" align=\"center\">");
|
||||
add_word ("\n<tr><td>\n");
|
||||
}
|
||||
|
||||
} /* if (html)... */
|
||||
|
||||
/* Make an entry in the appropriate index. */
|
||||
switch (base_type)
|
||||
{
|
||||
case deffn:
|
||||
case deftypefn:
|
||||
execute_string ("@findex %s\n", defined_name);
|
||||
break;
|
||||
case defvr:
|
||||
case deftypevr:
|
||||
case defcv:
|
||||
execute_string ("@vindex %s\n", defined_name);
|
||||
break;
|
||||
case deftypeivar:
|
||||
execute_string ("@vindex %s %s %s\n", defined_name, _("of"), type_name);
|
||||
break;
|
||||
case defop:
|
||||
case deftypeop:
|
||||
case deftypemethod:
|
||||
execute_string ("@findex %s %s %s\n", defined_name, _("on"), type_name);
|
||||
break;
|
||||
case deftp:
|
||||
execute_string ("@tindex %s\n", defined_name);
|
||||
break;
|
||||
inhibit_paragraph_indentation = 1;
|
||||
no_indent = 1;
|
||||
insert_html_tag (END, "var");
|
||||
insert_string ("<br>\n");
|
||||
/* Indent the definition a bit. */
|
||||
add_html_block_elt ("<blockquote>");
|
||||
no_indent = 0;
|
||||
inhibit_paragraph_indentation = 0;
|
||||
paragraph_is_open = 0;
|
||||
}
|
||||
|
||||
/* Deallocate the token list. */
|
||||
@ -713,9 +686,9 @@ defun_internal (type, x_p)
|
||||
If the name of the calling command ends in `x', then this is an extra
|
||||
entry included in the body of an insertion of the same type. */
|
||||
void
|
||||
cm_defun ()
|
||||
cm_defun (void)
|
||||
{
|
||||
enum insertion_type type;
|
||||
int type;
|
||||
char *base_command = xstrdup (command); /* command with any `x' removed */
|
||||
int x_p = (command[strlen (command) - 1] == 'x');
|
||||
|
||||
@ -726,15 +699,22 @@ cm_defun ()
|
||||
|
||||
/* If we are adding to an already existing insertion, then make sure
|
||||
that we are already in an insertion of type TYPE. */
|
||||
if (x_p && (!insertion_level || insertion_stack->insertion != type))
|
||||
if (x_p)
|
||||
{
|
||||
line_error (_("Must be in `@%s' environment to use `@%s'"),
|
||||
base_command, command);
|
||||
discard_until ("\n");
|
||||
return;
|
||||
INSERTION_ELT *i = insertion_stack;
|
||||
/* Skip over ifclear and ifset conditionals. */
|
||||
while (i && (i->insertion == ifset || i->insertion == ifclear))
|
||||
i = i->next;
|
||||
|
||||
if (!i || i->insertion != type)
|
||||
{
|
||||
line_error (_("Must be in `@%s' environment to use `@%s'"),
|
||||
base_command, command);
|
||||
discard_until ("\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
defun_internal (type, x_p);
|
||||
|
||||
defun_internal (type, x_p);
|
||||
free (base_command);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* defun.h -- declaration for defuns.
|
||||
$Id: defun.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: defun.h,v 1.2 2004/04/11 17:56:47 karl Exp $
|
||||
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
@ -24,8 +24,8 @@
|
||||
|
||||
#include "insertion.h"
|
||||
|
||||
extern enum insertion_type get_base_type ();
|
||||
extern void cm_defun ();
|
||||
extern enum insertion_type get_base_type (int type);
|
||||
extern void cm_defun (void);
|
||||
|
||||
#endif /* !DEFUN_H */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* files.c -- file-related functions for makeinfo.
|
||||
$Id: files.c,v 1.3 2003/03/06 14:05:30 karl Exp $
|
||||
$Id: files.c,v 1.5 2004/07/27 00:06:31 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
|
||||
@ -20,15 +20,17 @@
|
||||
|
||||
#include "system.h"
|
||||
#include "files.h"
|
||||
#include "html.h"
|
||||
#include "index.h"
|
||||
#include "macro.h"
|
||||
#include "makeinfo.h"
|
||||
#include "node.h"
|
||||
|
||||
FSTACK *filestack = NULL;
|
||||
|
||||
static int node_filename_stack_index = 0;
|
||||
static int node_filename_stack_size = 0;
|
||||
static char **node_filename_stack = NULL;
|
||||
|
||||
|
||||
/* Looking for include files. */
|
||||
|
||||
@ -36,9 +38,7 @@ static char **node_filename_stack = NULL;
|
||||
return the next one pointed to by INDEX, or NULL if there are no more.
|
||||
Advance INDEX to the character after the colon. */
|
||||
static char *
|
||||
extract_colon_unit (string, index)
|
||||
char *string;
|
||||
int *index;
|
||||
extract_colon_unit (char *string, int *index)
|
||||
{
|
||||
int start;
|
||||
int path_sep_char = PATH_SEP[0];
|
||||
@ -84,9 +84,7 @@ extract_colon_unit (string, index)
|
||||
If PATH is NULL, only the current directory is searched.
|
||||
If the file could not be found, return a NULL pointer. */
|
||||
char *
|
||||
get_file_info_in_path (filename, path, finfo)
|
||||
char *filename, *path;
|
||||
struct stat *finfo;
|
||||
get_file_info_in_path (char *filename, char *path, struct stat *finfo)
|
||||
{
|
||||
char *dir;
|
||||
int result, index = 0;
|
||||
@ -129,12 +127,68 @@ get_file_info_in_path (filename, path, finfo)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Prepend and append new paths to include_files_path. */
|
||||
void
|
||||
prepend_to_include_path (char *path)
|
||||
{
|
||||
if (!include_files_path)
|
||||
{
|
||||
include_files_path = xstrdup (path);
|
||||
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 (path) + 2); /* 2 for ":\0" */
|
||||
strcpy (include_files_path, path);
|
||||
strcat (include_files_path, PATH_SEP);
|
||||
strcat (include_files_path, tmp);
|
||||
free (tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
append_to_include_path (char *path)
|
||||
{
|
||||
if (!include_files_path)
|
||||
include_files_path = xstrdup (".");
|
||||
|
||||
include_files_path = (char *) xrealloc (include_files_path,
|
||||
2 + strlen (include_files_path) + strlen (path));
|
||||
strcat (include_files_path, PATH_SEP);
|
||||
strcat (include_files_path, path);
|
||||
}
|
||||
|
||||
/* Remove the first path from the include_files_path. */
|
||||
void
|
||||
pop_path_from_include_path (void)
|
||||
{
|
||||
int i = 0;
|
||||
char *tmp;
|
||||
|
||||
if (include_files_path)
|
||||
for (i = 0; i < strlen (include_files_path)
|
||||
&& include_files_path[i] != ':'; i++);
|
||||
|
||||
/* Advance include_files_path to the next char from ':' */
|
||||
tmp = (char *) xmalloc (strlen (include_files_path) - i);
|
||||
strcpy (tmp, (char *) include_files_path + i + 1);
|
||||
|
||||
free (include_files_path);
|
||||
include_files_path = tmp;
|
||||
}
|
||||
|
||||
/* Find and load the file named FILENAME. Return a pointer to
|
||||
the loaded file, or NULL if it can't be loaded. */
|
||||
the loaded file, or NULL if it can't be loaded. If USE_PATH is zero,
|
||||
just look for the given file (this is used in handle_delayed_writes),
|
||||
else search along include_files_path. */
|
||||
|
||||
char *
|
||||
find_and_load (filename)
|
||||
char *filename;
|
||||
find_and_load (char *filename, int use_path)
|
||||
{
|
||||
struct stat fileinfo;
|
||||
long file_size;
|
||||
@ -144,7 +198,9 @@ find_and_load (filename)
|
||||
|
||||
result = fullpath = NULL;
|
||||
|
||||
fullpath = get_file_info_in_path (filename, include_files_path, &fileinfo);
|
||||
fullpath
|
||||
= get_file_info_in_path (filename, use_path ? include_files_path : NULL,
|
||||
&fileinfo);
|
||||
|
||||
if (!fullpath)
|
||||
goto error_exit;
|
||||
@ -205,8 +261,8 @@ error_exit:
|
||||
}
|
||||
|
||||
/* Pushing and popping files. */
|
||||
void
|
||||
push_node_filename ()
|
||||
static void
|
||||
push_node_filename (void)
|
||||
{
|
||||
if (node_filename_stack_index + 1 > node_filename_stack_size)
|
||||
node_filename_stack = xrealloc
|
||||
@ -216,15 +272,15 @@ push_node_filename ()
|
||||
node_filename_stack_index++;
|
||||
}
|
||||
|
||||
void
|
||||
pop_node_filename ()
|
||||
static void
|
||||
pop_node_filename (void)
|
||||
{
|
||||
node_filename = node_filename_stack[--node_filename_stack_index];
|
||||
}
|
||||
|
||||
/* Save the state of the current input file. */
|
||||
void
|
||||
pushfile ()
|
||||
pushfile (void)
|
||||
{
|
||||
FSTACK *newstack = xmalloc (sizeof (FSTACK));
|
||||
newstack->filename = input_filename;
|
||||
@ -240,7 +296,7 @@ pushfile ()
|
||||
|
||||
/* Make the current file globals be what is on top of the file stack. */
|
||||
void
|
||||
popfile ()
|
||||
popfile (void)
|
||||
{
|
||||
FSTACK *tos = filestack;
|
||||
|
||||
@ -274,7 +330,7 @@ popfile ()
|
||||
|
||||
/* Flush all open files on the file stack. */
|
||||
void
|
||||
flush_file_stack ()
|
||||
flush_file_stack (void)
|
||||
{
|
||||
while (filestack)
|
||||
{
|
||||
@ -289,8 +345,7 @@ flush_file_stack ()
|
||||
/* Return the index of the first character in the filename
|
||||
which is past all the leading directory characters. */
|
||||
static int
|
||||
skip_directory_part (filename)
|
||||
char *filename;
|
||||
skip_directory_part (char *filename)
|
||||
{
|
||||
int i = strlen (filename) - 1;
|
||||
|
||||
@ -304,9 +359,8 @@ skip_directory_part (filename)
|
||||
return i;
|
||||
}
|
||||
|
||||
char *
|
||||
filename_non_directory (name)
|
||||
char *name;
|
||||
static char *
|
||||
filename_non_directory (char *name)
|
||||
{
|
||||
return xstrdup (name + skip_directory_part (name));
|
||||
}
|
||||
@ -315,8 +369,7 @@ filename_non_directory (name)
|
||||
filename without the path information, or extensions.
|
||||
This conses up a new string. */
|
||||
char *
|
||||
filename_part (filename)
|
||||
char *filename;
|
||||
filename_part (char *filename)
|
||||
{
|
||||
char *basename = filename_non_directory (filename);
|
||||
|
||||
@ -333,10 +386,8 @@ filename_part (filename)
|
||||
|
||||
/* Return the pathname part of filename. This can be NULL. */
|
||||
char *
|
||||
pathname_part (filename)
|
||||
char *filename;
|
||||
pathname_part (char *filename)
|
||||
{
|
||||
char *expand_filename ();
|
||||
char *result = NULL;
|
||||
int i;
|
||||
|
||||
@ -353,72 +404,9 @@ pathname_part (filename)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Return the expansion of FILENAME. */
|
||||
char *
|
||||
expand_filename (filename, input_name)
|
||||
char *filename, *input_name;
|
||||
{
|
||||
int i;
|
||||
char *full_pathname ();
|
||||
|
||||
if (filename)
|
||||
{
|
||||
filename = full_pathname (filename);
|
||||
if (IS_ABSOLUTE (filename)
|
||||
|| (*filename == '.' &&
|
||||
(IS_SLASH (filename[1]) ||
|
||||
(filename[1] == '.' && IS_SLASH (filename[2])))))
|
||||
return filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = filename_non_directory (input_name);
|
||||
|
||||
if (!*filename)
|
||||
{
|
||||
free (filename);
|
||||
filename = xstrdup ("noname.texi");
|
||||
}
|
||||
|
||||
for (i = strlen (filename) - 1; i; i--)
|
||||
if (filename[i] == '.')
|
||||
break;
|
||||
|
||||
if (!i)
|
||||
i = strlen (filename);
|
||||
|
||||
if (i + 6 > (strlen (filename)))
|
||||
filename = xrealloc (filename, i + 6);
|
||||
strcpy (filename + i, html ? ".html" : ".info");
|
||||
return filename;
|
||||
}
|
||||
|
||||
if (IS_ABSOLUTE (input_name))
|
||||
{
|
||||
/* Make it so that relative names work. */
|
||||
char *result;
|
||||
|
||||
i = strlen (input_name) - 1;
|
||||
|
||||
result = xmalloc (1 + strlen (input_name) + strlen (filename));
|
||||
strcpy (result, input_name);
|
||||
|
||||
while (!IS_SLASH (result[i]) && i)
|
||||
i--;
|
||||
if (IS_SLASH (result[i]))
|
||||
i++;
|
||||
|
||||
strcpy (&result[i], filename);
|
||||
free (filename);
|
||||
return result;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
/* Return the full path to FILENAME. */
|
||||
char *
|
||||
full_pathname (filename)
|
||||
char *filename;
|
||||
static char *
|
||||
full_pathname (char *filename)
|
||||
{
|
||||
int initial_character;
|
||||
char *result;
|
||||
@ -508,9 +496,68 @@ full_pathname (filename)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Return the expansion of FILENAME. */
|
||||
char *
|
||||
output_name_from_input_name (name)
|
||||
char *name;
|
||||
expand_filename (char *filename, char *input_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (filename)
|
||||
{
|
||||
filename = full_pathname (filename);
|
||||
if (IS_ABSOLUTE (filename)
|
||||
|| (*filename == '.' &&
|
||||
(IS_SLASH (filename[1]) ||
|
||||
(filename[1] == '.' && IS_SLASH (filename[2])))))
|
||||
return filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = filename_non_directory (input_name);
|
||||
|
||||
if (!*filename)
|
||||
{
|
||||
free (filename);
|
||||
filename = xstrdup ("noname.texi");
|
||||
}
|
||||
|
||||
for (i = strlen (filename) - 1; i; i--)
|
||||
if (filename[i] == '.')
|
||||
break;
|
||||
|
||||
if (!i)
|
||||
i = strlen (filename);
|
||||
|
||||
if (i + 6 > (strlen (filename)))
|
||||
filename = xrealloc (filename, i + 6);
|
||||
strcpy (filename + i, html ? ".html" : ".info");
|
||||
return filename;
|
||||
}
|
||||
|
||||
if (IS_ABSOLUTE (input_name))
|
||||
{
|
||||
/* Make it so that relative names work. */
|
||||
char *result;
|
||||
|
||||
i = strlen (input_name) - 1;
|
||||
|
||||
result = xmalloc (1 + strlen (input_name) + strlen (filename));
|
||||
strcpy (result, input_name);
|
||||
|
||||
while (!IS_SLASH (result[i]) && i)
|
||||
i--;
|
||||
if (IS_SLASH (result[i]))
|
||||
i++;
|
||||
|
||||
strcpy (&result[i], filename);
|
||||
free (filename);
|
||||
return result;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
char *
|
||||
output_name_from_input_name (char *name)
|
||||
{
|
||||
return expand_filename (NULL, name);
|
||||
}
|
||||
@ -522,8 +569,7 @@ output_name_from_input_name (name)
|
||||
never be longer than the original, otherwise we couldn't be sure we
|
||||
have enough space in the original string to modify it in place. */
|
||||
char *
|
||||
normalize_filename (fname)
|
||||
char *fname;
|
||||
normalize_filename (char *fname)
|
||||
{
|
||||
int maxlen;
|
||||
char orig[PATH_MAX + 1];
|
||||
@ -573,3 +619,166 @@ normalize_filename (fname)
|
||||
|
||||
return fname;
|
||||
}
|
||||
|
||||
/* Delayed writing functions. A few of the commands
|
||||
needs to be handled at the end, namely @contents,
|
||||
@shortcontents, @printindex and @listoffloats.
|
||||
These functions take care of that. */
|
||||
static DELAYED_WRITE *delayed_writes = NULL;
|
||||
int handling_delayed_writes = 0;
|
||||
|
||||
void
|
||||
register_delayed_write (char *delayed_command)
|
||||
{
|
||||
DELAYED_WRITE *new;
|
||||
|
||||
if (!current_output_filename || !*current_output_filename)
|
||||
{
|
||||
/* Cannot register if we don't know what the output file is. */
|
||||
warning (_("`%s' omitted before output filename"), delayed_command);
|
||||
return;
|
||||
}
|
||||
|
||||
if (STREQ (current_output_filename, "-"))
|
||||
{
|
||||
/* Do not register a new write if the output file is not seekable.
|
||||
Let the user know about it first, though. */
|
||||
warning (_("`%s' omitted since writing to stdout"), delayed_command);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Don't complain if the user is writing /dev/null, since surely they
|
||||
don't care, but don't register the delayed write, either. */
|
||||
if (FILENAME_CMP (current_output_filename, NULL_DEVICE) == 0
|
||||
|| FILENAME_CMP (current_output_filename, ALSO_NULL_DEVICE) == 0)
|
||||
return;
|
||||
|
||||
/* We need the HTML header in the output,
|
||||
to get a proper output_position. */
|
||||
if (!executing_string && html)
|
||||
html_output_head ();
|
||||
/* Get output_position updated. */
|
||||
flush_output ();
|
||||
|
||||
new = xmalloc (sizeof (DELAYED_WRITE));
|
||||
new->command = xstrdup (delayed_command);
|
||||
new->filename = xstrdup (current_output_filename);
|
||||
new->input_filename = xstrdup (input_filename);
|
||||
new->position = output_position;
|
||||
new->calling_line = line_number;
|
||||
new->node = current_node ? xstrdup (current_node): "";
|
||||
|
||||
new->node_order = node_order;
|
||||
new->index_order = index_counter;
|
||||
|
||||
new->next = delayed_writes;
|
||||
delayed_writes = new;
|
||||
}
|
||||
|
||||
void
|
||||
handle_delayed_writes (void)
|
||||
{
|
||||
DELAYED_WRITE *temp = (DELAYED_WRITE *) reverse_list
|
||||
((GENERIC_LIST *) delayed_writes);
|
||||
int position_shift_amount, line_number_shift_amount;
|
||||
char *delayed_buf;
|
||||
|
||||
handling_delayed_writes = 1;
|
||||
|
||||
while (temp)
|
||||
{
|
||||
delayed_buf = find_and_load (temp->filename, 0);
|
||||
|
||||
if (output_paragraph_offset > 0)
|
||||
{
|
||||
error (_("Output buffer not empty."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!delayed_buf)
|
||||
{
|
||||
fs_error (temp->filename);
|
||||
return;
|
||||
}
|
||||
|
||||
output_stream = fopen (temp->filename, "w");
|
||||
if (!output_stream)
|
||||
{
|
||||
fs_error (temp->filename);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fwrite (delayed_buf, 1, temp->position, output_stream) != temp->position)
|
||||
{
|
||||
fs_error (temp->filename);
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
int output_position_at_start = output_position;
|
||||
int line_number_at_start = output_line_number;
|
||||
|
||||
/* In order to make warnings and errors
|
||||
refer to the correct line number. */
|
||||
input_filename = temp->input_filename;
|
||||
line_number = temp->calling_line;
|
||||
|
||||
execute_string ("%s", temp->command);
|
||||
flush_output ();
|
||||
|
||||
/* Since the output file is modified, following delayed writes
|
||||
need to be updated by this amount. */
|
||||
position_shift_amount = output_position - output_position_at_start;
|
||||
line_number_shift_amount = output_line_number - line_number_at_start;
|
||||
}
|
||||
|
||||
if (fwrite (delayed_buf + temp->position, 1,
|
||||
input_text_length - temp->position, output_stream)
|
||||
!= input_text_length - temp->position
|
||||
|| fclose (output_stream) != 0)
|
||||
fs_error (temp->filename);
|
||||
|
||||
/* Done with the buffer. */
|
||||
free (delayed_buf);
|
||||
|
||||
/* Update positions in tag table for nodes that are defined after
|
||||
the line this delayed write is registered. */
|
||||
if (!html && !xml)
|
||||
{
|
||||
TAG_ENTRY *node;
|
||||
for (node = tag_table; node; node = node->next_ent)
|
||||
if (node->order > temp->node_order)
|
||||
node->position += position_shift_amount;
|
||||
}
|
||||
|
||||
/* Something similar for the line numbers in all of the defined
|
||||
indices. */
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < defined_indices; i++)
|
||||
if (name_index_alist[i])
|
||||
{
|
||||
char *name = ((INDEX_ALIST *) name_index_alist[i])->name;
|
||||
INDEX_ELT *index;
|
||||
for (index = index_list (name); index; index = index->next)
|
||||
if ((no_headers || STREQ (index->node, temp->node))
|
||||
&& index->entry_number > temp->index_order)
|
||||
index->output_line += line_number_shift_amount;
|
||||
}
|
||||
}
|
||||
|
||||
/* Shift remaining delayed positions
|
||||
by the length of this write. */
|
||||
{
|
||||
DELAYED_WRITE *future_write = temp->next;
|
||||
while (future_write)
|
||||
{
|
||||
if (STREQ (temp->filename, future_write->filename))
|
||||
future_write->position += position_shift_amount;
|
||||
future_write = future_write->next;
|
||||
}
|
||||
}
|
||||
|
||||
temp = temp->next;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* files.h -- declarations for files.c.
|
||||
$Id: files.h,v 1.2 2003/03/06 14:05:30 karl Exp $
|
||||
$Id: files.h,v 1.4 2004/07/27 00:06:31 karl Exp $
|
||||
|
||||
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 2002, 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,14 +34,37 @@ typedef struct fstack
|
||||
} FSTACK;
|
||||
extern FSTACK *filestack;
|
||||
|
||||
extern void pushfile (), popfile ();
|
||||
extern void flush_file_stack ();
|
||||
extern char *get_file_info_in_path ();
|
||||
extern char *find_and_load ();
|
||||
extern char *output_name_from_input_name ();
|
||||
extern char *expand_filename ();
|
||||
extern char *filename_part ();
|
||||
extern char *pathname_part ();
|
||||
extern char *normalize_filename ();
|
||||
extern void pushfile (void);
|
||||
extern void popfile (void);
|
||||
extern void flush_file_stack (void);
|
||||
extern char *get_file_info_in_path (char *filename, char *path,
|
||||
struct stat *finfo);
|
||||
extern char *find_and_load (char *filename, int use_path);
|
||||
extern char *output_name_from_input_name (char *name);
|
||||
extern char *expand_filename (char *filename, char *input_name);
|
||||
extern char *filename_part (char *filename);
|
||||
extern char *pathname_part (char *filename);
|
||||
extern char *normalize_filename (char *fname);
|
||||
extern void append_to_include_path (char *path);
|
||||
extern void prepend_to_include_path (char *path);
|
||||
extern void pop_path_from_include_path (void);
|
||||
extern void register_delayed_write (char *delayed_command);
|
||||
extern void handle_delayed_writes (void);
|
||||
|
||||
typedef struct delayed_write
|
||||
{
|
||||
struct delayed_write *next;
|
||||
char *command;
|
||||
char *filename;
|
||||
char *input_filename;
|
||||
char *node;
|
||||
int position;
|
||||
int calling_line;
|
||||
|
||||
int node_order;
|
||||
int index_order;
|
||||
} DELAYED_WRITE;
|
||||
|
||||
extern int handling_delayed_writes;
|
||||
|
||||
#endif /* !FILES_H */
|
||||
|
430
contrib/texinfo/makeinfo/float.c
Normal file
430
contrib/texinfo/makeinfo/float.c
Normal file
@ -0,0 +1,430 @@
|
||||
/* float.c -- float environment functions.
|
||||
$Id: float.c,v 1.8 2004/07/05 22:23:22 karl Exp $
|
||||
|
||||
Copyright (C) 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
|
||||
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.
|
||||
|
||||
Originally written by Alper Ersoy <dirt@gtk.org>. */
|
||||
|
||||
#include "system.h"
|
||||
#include "makeinfo.h"
|
||||
#include "cmds.h"
|
||||
#include "files.h"
|
||||
#include "float.h"
|
||||
#include "html.h"
|
||||
#include "sectioning.h"
|
||||
#include "xml.h"
|
||||
|
||||
static FLOAT_ELT *float_stack = NULL;
|
||||
|
||||
void
|
||||
add_new_float (char *id, char *title, char *shorttitle,
|
||||
char *type, char *position)
|
||||
{
|
||||
FLOAT_ELT *new = xmalloc (sizeof (FLOAT_ELT));
|
||||
unsigned long num_len;
|
||||
|
||||
new->id = id;
|
||||
new->type = type;
|
||||
new->title = title;
|
||||
new->shorttitle = shorttitle;
|
||||
new->position = position;
|
||||
new->title_used = 0;
|
||||
new->defining_line = line_number - 1;
|
||||
|
||||
new->number = current_chapter_number ();
|
||||
/* Append dot if not @unnumbered. */
|
||||
num_len = strlen (new->number);
|
||||
if (num_len > 0)
|
||||
{
|
||||
new->number = xrealloc (new->number, num_len + 1 + 1);
|
||||
new->number[num_len] = '.';
|
||||
new->number[num_len+1] = '\0';
|
||||
}
|
||||
|
||||
{ /* Append the current float number. */
|
||||
unsigned len = strlen (new->number) + 21; /* that's 64 bits */
|
||||
char *s = xmalloc (len + 1);
|
||||
|
||||
sprintf (s, "%s%d", new->number,
|
||||
count_floats_of_type_in_chapter (text_expansion (type),
|
||||
new->number) + 1);
|
||||
free (new->number);
|
||||
new->number = xstrdup (s);
|
||||
}
|
||||
|
||||
/* Plain text output needs sectioning number and its title,
|
||||
when listing floats. */
|
||||
if (!html && !xml && no_headers)
|
||||
{
|
||||
new->section = current_sectioning_number ();
|
||||
if (strlen (new->section) == 0)
|
||||
new->section_name = current_sectioning_name ();
|
||||
else
|
||||
new->section_name = "";
|
||||
}
|
||||
|
||||
new->next = float_stack;
|
||||
float_stack = new;
|
||||
}
|
||||
|
||||
int
|
||||
count_floats_of_type_in_chapter (char *type, char *chapter)
|
||||
{
|
||||
int i = 0;
|
||||
int l = strlen (chapter);
|
||||
FLOAT_ELT *temp = float_stack;
|
||||
|
||||
while (temp && strncmp (temp->number, chapter, l) == 0)
|
||||
{
|
||||
if (strlen (temp->id) > 0 && STREQ (text_expansion (temp->type), type))
|
||||
i++;
|
||||
temp = temp->next;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
char *
|
||||
current_float_title (void)
|
||||
{
|
||||
return float_stack->title;
|
||||
}
|
||||
|
||||
char *
|
||||
current_float_shorttitle (void)
|
||||
{
|
||||
return float_stack->shorttitle;
|
||||
}
|
||||
|
||||
char *
|
||||
current_float_type (void)
|
||||
{
|
||||
return float_stack->type;
|
||||
}
|
||||
|
||||
char *
|
||||
current_float_position (void)
|
||||
{
|
||||
return float_stack->position;
|
||||
}
|
||||
|
||||
char *
|
||||
current_float_number (void)
|
||||
{
|
||||
return float_stack->number;
|
||||
}
|
||||
|
||||
char *
|
||||
current_float_id (void)
|
||||
{
|
||||
return float_stack->id;
|
||||
}
|
||||
|
||||
char *
|
||||
get_float_ref (char *id)
|
||||
{
|
||||
FLOAT_ELT *temp = float_stack;
|
||||
|
||||
while (temp)
|
||||
{
|
||||
if (STREQ (id, temp->id))
|
||||
{
|
||||
char *s = xmalloc (strlen (temp->type) + strlen (temp->number) + 2);
|
||||
sprintf (s, "%s %s", temp->type, temp->number);
|
||||
return s;
|
||||
}
|
||||
temp = temp->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
float_type_exists (char *check_type)
|
||||
{
|
||||
/* Check if the requested float_type exists in the floats stack. */
|
||||
FLOAT_ELT *temp;
|
||||
|
||||
for (temp = float_stack; temp; temp = temp->next)
|
||||
if (STREQ (temp->type, check_type) && temp->id && *temp->id)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
cm_listoffloats (void)
|
||||
{
|
||||
char *float_type;
|
||||
get_rest_of_line (1, &float_type);
|
||||
|
||||
/* 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 (handling_delayed_writes && !float_type_exists (float_type))
|
||||
warning (_("Requested float type `%s' not previously used"), float_type);
|
||||
|
||||
if (xml)
|
||||
{
|
||||
xml_insert_element_with_attribute (LISTOFFLOATS, START,
|
||||
"type=\"%s\"", text_expansion (float_type));
|
||||
xml_insert_element (LISTOFFLOATS, END);
|
||||
}
|
||||
else if (!handling_delayed_writes)
|
||||
{
|
||||
int command_len = sizeof ("@ ") + strlen (command) + strlen (float_type);
|
||||
char *list_command = xmalloc (command_len + 1);
|
||||
|
||||
/* These are for the text following @listoffloats command.
|
||||
Handling them with delayed writes is too late. */
|
||||
close_paragraph ();
|
||||
cm_noindent ();
|
||||
|
||||
sprintf (list_command, "@%s %s", command, float_type);
|
||||
register_delayed_write (list_command);
|
||||
free (list_command);
|
||||
}
|
||||
else if (float_type_exists (float_type))
|
||||
{
|
||||
FLOAT_ELT *temp = (FLOAT_ELT *) reverse_list
|
||||
((GENERIC_LIST *) float_stack);
|
||||
FLOAT_ELT *new_start = temp;
|
||||
|
||||
if (html)
|
||||
insert_string ("<ul class=\"listoffloats\">\n");
|
||||
else
|
||||
{
|
||||
if (!no_headers)
|
||||
insert_string ("* Menu:\n\n");
|
||||
}
|
||||
|
||||
while (temp)
|
||||
{
|
||||
if (strlen (temp->id) > 0 && STREQ (float_type, temp->type))
|
||||
{
|
||||
if (html)
|
||||
{
|
||||
/* A bit of space for HTML reabality. */
|
||||
insert_string (" ");
|
||||
add_html_block_elt ("<li>");
|
||||
|
||||
/* Simply relying on @ref command doesn't work here, because
|
||||
commas in the caption may confuse the argument parsing. */
|
||||
add_word ("<a href=\"");
|
||||
add_anchor_name (temp->id, 1);
|
||||
add_word ("\">");
|
||||
|
||||
if (strlen (float_type) > 0)
|
||||
execute_string ("%s", float_type);
|
||||
|
||||
if (strlen (temp->id) > 0)
|
||||
{
|
||||
if (strlen (float_type) > 0)
|
||||
add_char (' ');
|
||||
|
||||
add_word (temp->number);
|
||||
}
|
||||
|
||||
if (strlen (temp->title) > 0)
|
||||
{
|
||||
if (strlen (float_type) > 0
|
||||
|| strlen (temp->id) > 0)
|
||||
insert_string (": ");
|
||||
|
||||
execute_string ("%s", temp->title);
|
||||
}
|
||||
|
||||
add_word ("</a>");
|
||||
|
||||
add_html_block_elt ("</li>\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
char *entry;
|
||||
char *raw_entry;
|
||||
char *title = expansion (temp->title, 0);
|
||||
|
||||
int len;
|
||||
int aux_chars_len; /* these are asterisk, colon, etc. */
|
||||
int column_width; /* width of the first column in menus. */
|
||||
int number_len; /* length of Figure X.Y: etc. */
|
||||
int i = 0;
|
||||
|
||||
/* Chosen widths are to match what @printindex produces. */
|
||||
if (no_headers)
|
||||
{
|
||||
column_width = 43;
|
||||
/* We have only one auxiliary character, NULL. */
|
||||
aux_chars_len = sizeof ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
column_width = 37;
|
||||
/* We'll be adding an asterisk, followed by a space
|
||||
and then a colon after the title, to construct a
|
||||
proper menu item. */
|
||||
aux_chars_len = sizeof ("* :");
|
||||
}
|
||||
|
||||
/* Allocate enough space for possible expansion later. */
|
||||
raw_entry = (char *) xmalloc (strlen (float_type)
|
||||
+ strlen (temp->number) + strlen (title)
|
||||
+ sizeof (": "));
|
||||
|
||||
sprintf (raw_entry, "%s %s", float_type, temp->number);
|
||||
|
||||
if (strlen (title) > 0)
|
||||
strcat (raw_entry, ": ");
|
||||
|
||||
number_len = strlen (raw_entry);
|
||||
|
||||
len = strlen (title) + strlen (raw_entry);
|
||||
|
||||
/* If we have a @shortcaption, try it if @caption is
|
||||
too long to fit on a line. */
|
||||
if (len + aux_chars_len > column_width
|
||||
&& strlen (temp->shorttitle) > 0)
|
||||
title = expansion (temp->shorttitle, 0);
|
||||
|
||||
strcat (raw_entry, title);
|
||||
len = strlen (raw_entry);
|
||||
|
||||
if (len + aux_chars_len > column_width)
|
||||
{ /* Shorten long titles by looking for a space before
|
||||
column_width - strlen (" ..."). */
|
||||
/* -1 is for NULL, which is already in aux_chars_len. */
|
||||
aux_chars_len += sizeof ("...") - 1;
|
||||
len = column_width - aux_chars_len;
|
||||
while (raw_entry[len] != ' ' && len >= 0)
|
||||
len--;
|
||||
|
||||
/* Advance to the whitespace. */
|
||||
len++;
|
||||
|
||||
/* If we are at the end of, say, Figure X.Y:, but
|
||||
we have a title, then this means title does not
|
||||
contain any whitespaces. Or it may be that we
|
||||
went as far as the beginning. Just print as much
|
||||
as possible of the title. */
|
||||
if (len == 0
|
||||
|| (len == number_len && strlen (title) > 0))
|
||||
len = column_width - sizeof ("...");
|
||||
|
||||
/* Break here. */
|
||||
raw_entry[len] = 0;
|
||||
|
||||
entry = xmalloc (len + aux_chars_len);
|
||||
|
||||
if (!no_headers)
|
||||
strcpy (entry, "* ");
|
||||
else
|
||||
entry[0] = 0;
|
||||
|
||||
strcat (entry, raw_entry);
|
||||
strcat (entry, "...");
|
||||
|
||||
if (!no_headers)
|
||||
strcat (entry, ":");
|
||||
}
|
||||
else
|
||||
{
|
||||
entry = xmalloc (len + aux_chars_len);
|
||||
|
||||
if (!no_headers)
|
||||
strcpy (entry, "* ");
|
||||
else
|
||||
entry[0] = 0;
|
||||
|
||||
strcat (entry, raw_entry);
|
||||
|
||||
if (!no_headers)
|
||||
strcat (entry, ":");
|
||||
}
|
||||
|
||||
insert_string (entry);
|
||||
|
||||
i = strlen (entry);
|
||||
/* We insert space chars until ``column_width + four spaces''
|
||||
is reached, to make the layout the same with what we produce
|
||||
for @printindex. This is of course not obligatory, though
|
||||
easier on the eye. -1 is for NULL. */
|
||||
while (i < column_width + sizeof (" ") - 1)
|
||||
{
|
||||
insert (' ');
|
||||
i++;
|
||||
}
|
||||
|
||||
if (no_headers)
|
||||
{
|
||||
if (strlen (temp->section) > 0)
|
||||
{ /* We got your number. */
|
||||
insert_string ((char *) _("See "));
|
||||
insert_string (temp->section);
|
||||
}
|
||||
else
|
||||
{ /* Sigh, @float in an @unnumbered. :-\ */
|
||||
insert_string ("\n ");
|
||||
insert_string ((char *) _("See "));
|
||||
insert_string ("``");
|
||||
insert_string (expansion (temp->section_name, 0));
|
||||
insert_string ("''");
|
||||
}
|
||||
}
|
||||
else
|
||||
insert_string (temp->id);
|
||||
|
||||
insert_string (".\n");
|
||||
|
||||
free (entry);
|
||||
free (title);
|
||||
}
|
||||
}
|
||||
temp = temp->next;
|
||||
}
|
||||
|
||||
if (html)
|
||||
{
|
||||
inhibit_paragraph_indentation = 1;
|
||||
insert_string ("</ul>\n\n");
|
||||
}
|
||||
else
|
||||
insert ('\n');
|
||||
|
||||
/* Retain the original order of float stack. */
|
||||
temp = new_start;
|
||||
float_stack = (FLOAT_ELT *) reverse_list ((GENERIC_LIST *) temp);
|
||||
}
|
||||
|
||||
free (float_type);
|
||||
/* Re-increment the line number, because get_rest_of_line
|
||||
left us looking at the next line after the command. */
|
||||
line_number++;
|
||||
}
|
||||
|
||||
int
|
||||
current_float_used_title (void)
|
||||
{
|
||||
return float_stack->title_used;
|
||||
}
|
||||
|
||||
void current_float_set_title_used (void)
|
||||
{
|
||||
float_stack->title_used = 1;
|
||||
}
|
56
contrib/texinfo/makeinfo/float.h
Normal file
56
contrib/texinfo/makeinfo/float.h
Normal file
@ -0,0 +1,56 @@
|
||||
/* float.h -- declarations for the float environment.
|
||||
$Id: float.h,v 1.5 2004/04/11 17:56:47 karl Exp $
|
||||
|
||||
Copyright (C) 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
|
||||
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.
|
||||
|
||||
Written by Alper Ersoy <dirt@gtk.org>. */
|
||||
|
||||
#ifndef FLOAT_H
|
||||
#define FLOAT_H
|
||||
|
||||
typedef struct float_elt
|
||||
{
|
||||
struct float_elt *next;
|
||||
char *id;
|
||||
char *type;
|
||||
char *title;
|
||||
char *shorttitle;
|
||||
char *position;
|
||||
char *number;
|
||||
char *section;
|
||||
char *section_name;
|
||||
short title_used;
|
||||
int defining_line;
|
||||
} FLOAT_ELT;
|
||||
|
||||
extern void add_new_float (char *id, char *title, char *shorttitle,
|
||||
char *type, char *position);
|
||||
extern void current_float_set_title_used (void);
|
||||
|
||||
/* Information retrieval about the current float env. */
|
||||
extern char *current_float_id (void);
|
||||
extern char *current_float_title (void);
|
||||
extern char *current_float_shorttitle (void);
|
||||
extern char *current_float_type (void);
|
||||
extern char *current_float_position (void);
|
||||
extern char *current_float_number (void);
|
||||
extern char *get_float_ref (char *id);
|
||||
|
||||
extern int count_floats_of_type_in_chapter (char *type, char *chapter);
|
||||
extern int current_float_used_title (void);
|
||||
|
||||
#endif /* not FLOAT_H */
|
@ -1,5 +1,5 @@
|
||||
/* footnote.c -- footnotes for Texinfo.
|
||||
$Id: footnote.c,v 1.4 2002/11/05 03:04:26 karl Exp $
|
||||
$Id: footnote.c,v 1.7 2004/04/11 17:56:47 karl Exp $
|
||||
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
@ -21,7 +21,9 @@
|
||||
#include "footnote.h"
|
||||
#include "macro.h"
|
||||
#include "makeinfo.h"
|
||||
#include "node.h"
|
||||
#include "xml.h"
|
||||
#include "xref.h"
|
||||
|
||||
/* Nonzero means that the footnote style for this document was set on
|
||||
the command line, which overrides any other settings. */
|
||||
@ -53,11 +55,10 @@ int already_outputting_pending_notes = 0;
|
||||
int footnote_style = end_node;
|
||||
int first_footnote_this_node = 1;
|
||||
int footnote_count = 0;
|
||||
|
||||
|
||||
/* Set the footnote style based on the style identifier in STRING. */
|
||||
int
|
||||
set_footnote_style (string)
|
||||
char *string;
|
||||
set_footnote_style (char *string)
|
||||
{
|
||||
if (strcasecmp (string, "separate") == 0)
|
||||
footnote_style = separate_node;
|
||||
@ -70,7 +71,7 @@ set_footnote_style (string)
|
||||
}
|
||||
|
||||
void
|
||||
cm_footnotestyle ()
|
||||
cm_footnotestyle (void)
|
||||
{
|
||||
char *arg;
|
||||
|
||||
@ -95,9 +96,8 @@ FN *pending_notes = NULL;
|
||||
|
||||
/* A method for remembering footnotes. Note that this list gets output
|
||||
at the end of the current node. */
|
||||
void
|
||||
remember_note (marker, note)
|
||||
char *marker, *note;
|
||||
static void
|
||||
remember_note (char *marker, char *note)
|
||||
{
|
||||
FN *temp = xmalloc (sizeof (FN));
|
||||
|
||||
@ -111,7 +111,7 @@ remember_note (marker, note)
|
||||
|
||||
/* How to get rid of existing footnotes. */
|
||||
static void
|
||||
free_pending_notes ()
|
||||
free_pending_notes (void)
|
||||
{
|
||||
FN *temp;
|
||||
|
||||
@ -133,7 +133,7 @@ free_pending_notes ()
|
||||
footnote *{this is a footnote}
|
||||
where "*" is the (optional) marker character for this note. */
|
||||
void
|
||||
cm_footnote ()
|
||||
cm_footnote (void)
|
||||
{
|
||||
char *marker;
|
||||
char *note;
|
||||
@ -237,9 +237,12 @@ cm_footnote ()
|
||||
`fn-<n>', though that's unlikely. */
|
||||
if (html)
|
||||
{
|
||||
/* Hyperlink also serves as an anchor (mnemonic: fnd is footnote
|
||||
definition.) */
|
||||
add_html_elt ("<a rel=\"footnote\" href=");
|
||||
add_word_args ("\"#fn-%d\"><sup>%s</sup></a>",
|
||||
current_footnote_number, marker);
|
||||
add_word_args ("\"#fn-%d\" name=\"fnd-%d\"><sup>%s</sup></a>",
|
||||
current_footnote_number, current_footnote_number,
|
||||
marker);
|
||||
}
|
||||
else
|
||||
/* Your method should at least insert MARKER. */
|
||||
@ -282,7 +285,7 @@ cm_footnote ()
|
||||
|
||||
/* Output the footnotes. We are at the end of the current node. */
|
||||
void
|
||||
output_pending_notes ()
|
||||
output_pending_notes (void)
|
||||
{
|
||||
FN *footnote = pending_notes;
|
||||
|
||||
@ -290,13 +293,13 @@ output_pending_notes ()
|
||||
return;
|
||||
|
||||
if (html)
|
||||
{ /* The type= attribute is used just in case some weirdo browser
|
||||
out there doesn't use numbers by default. Since we rely on the
|
||||
browser to produce the footnote numbers, we need to make sure
|
||||
they ARE indeed numbers. Pre-HTML4 browsers seem to not care. */
|
||||
add_word ("<div class=\"footnote\">\n<hr>\n<h4>");
|
||||
add_word (_("Footnotes"));
|
||||
add_word ("</h4>\n<ol type=\"1\">\n");
|
||||
{
|
||||
add_html_block_elt ("<div class=\"footnote\">\n<hr>\n");
|
||||
/* We add an anchor here so @printindex can refer to this point
|
||||
(as the node name) for entries defined in footnotes. */
|
||||
if (!splitting)
|
||||
add_word ("<a name=\"texinfo-footnotes-in-document\"></a>");
|
||||
add_word_args ("<h4>%s</h4>", (char *) _("Footnotes"));
|
||||
}
|
||||
else
|
||||
switch (footnote_style)
|
||||
@ -329,6 +332,7 @@ output_pending_notes ()
|
||||
|
||||
/* Handle the footnotes in reverse order. */
|
||||
{
|
||||
int save_in_fixed_width_font = in_fixed_width_font;
|
||||
FN **array = xmalloc ((footnote_count + 1) * sizeof (FN *));
|
||||
array[footnote_count] = NULL;
|
||||
|
||||
@ -340,14 +344,18 @@ output_pending_notes ()
|
||||
|
||||
filling_enabled = 1;
|
||||
indented_fill = 1;
|
||||
in_fixed_width_font = 0;
|
||||
|
||||
while ((footnote = array[++footnote_count]))
|
||||
{
|
||||
if (html)
|
||||
{
|
||||
/* Make the text of every footnote begin a separate paragraph. */
|
||||
add_word_args ("<li><a name=\"fn-%d\"></a>\n<p>",
|
||||
footnote->number);
|
||||
add_html_block_elt ("<p class=\"footnote\"><small>");
|
||||
/* Make footnote number a link to its definition. */
|
||||
add_word_args ("[<a name=\"fn-%d\" href=\"#fnd-%d\">%d</a>]",
|
||||
footnote->number, footnote->number, footnote->number);
|
||||
add_word ("</small> ");
|
||||
already_outputting_pending_notes++;
|
||||
execute_string ("%s", footnote->note);
|
||||
already_outputting_pending_notes--;
|
||||
@ -372,10 +380,12 @@ output_pending_notes ()
|
||||
}
|
||||
|
||||
if (html)
|
||||
add_word ("</ol><hr></div>");
|
||||
add_word ("<hr></div>");
|
||||
close_paragraph ();
|
||||
free (array);
|
||||
|
||||
in_fixed_width_font = save_in_fixed_width_font;
|
||||
}
|
||||
|
||||
|
||||
free_pending_notes ();
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* footnote.h -- declarations for footnote.c.
|
||||
$Id: footnote.h,v 1.1 2002/08/25 23:38:38 karl Exp $
|
||||
$Id: footnote.h,v 1.2 2004/04/11 17:56:47 karl Exp $
|
||||
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -27,11 +28,11 @@ extern int number_footnotes;
|
||||
extern int already_outputting_pending_notes;
|
||||
|
||||
/* The Texinfo @commands. */
|
||||
extern void cm_footnote ();
|
||||
extern void cm_footnotestyle ();
|
||||
extern void cm_footnote (void);
|
||||
extern void cm_footnotestyle (void);
|
||||
|
||||
extern int set_footnote_style (); /* called for -s option */
|
||||
extern int set_footnote_style (char *string); /* called for -s option */
|
||||
|
||||
extern void output_pending_notes (); /* called for output */
|
||||
extern void output_pending_notes (void); /* called for output */
|
||||
|
||||
#endif /* !FOOTNOTE_H */
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* html.c -- html-related utilities.
|
||||
$Id: html.c,v 1.18 2003/06/02 12:32:29 karl Exp $
|
||||
$Id: html.c,v 1.28 2004/12/06 01:13:06 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
|
||||
@ -19,115 +20,13 @@
|
||||
|
||||
#include "system.h"
|
||||
#include "cmds.h"
|
||||
#include "files.h"
|
||||
#include "html.h"
|
||||
#include "lang.h"
|
||||
#include "makeinfo.h"
|
||||
#include "node.h"
|
||||
#include "sectioning.h"
|
||||
|
||||
HSTACK *htmlstack = NULL;
|
||||
|
||||
static char *process_css_file (/* char * */);
|
||||
|
||||
/* See html.h. */
|
||||
int html_output_head_p = 0;
|
||||
int html_title_written = 0;
|
||||
|
||||
|
||||
void
|
||||
html_output_head ()
|
||||
{
|
||||
static const char *html_title = NULL;
|
||||
|
||||
if (html_output_head_p)
|
||||
return;
|
||||
html_output_head_p = 1;
|
||||
|
||||
/* The <title> should not have markup, so use text_expansion. */
|
||||
if (!html_title)
|
||||
html_title = title ? text_expansion (title) : _("Untitled");
|
||||
|
||||
add_word_args ("<html lang=\"%s\">\n<head>\n<title>%s</title>\n",
|
||||
language_table[language_code].abbrev, html_title);
|
||||
|
||||
add_word ("<meta http-equiv=\"Content-Type\" content=\"text/html");
|
||||
if (document_encoding_code != no_encoding)
|
||||
add_word_args ("; charset=%s",
|
||||
encoding_table[document_encoding_code].encname);
|
||||
add_word ("\">\n");
|
||||
|
||||
if (!document_description)
|
||||
document_description = html_title;
|
||||
|
||||
add_word_args ("<meta name=\"description\" content=\"%s\">\n",
|
||||
document_description);
|
||||
add_word_args ("<meta name=\"generator\" content=\"makeinfo %s\">\n",
|
||||
VERSION);
|
||||
#if 0
|
||||
/* let's not do this now, since it causes mozilla to put up a
|
||||
navigation bar. */
|
||||
add_word ("<link href=\"http://www.gnu.org/software/texinfo/\" \
|
||||
rel=\"generator-home\">\n");
|
||||
#endif
|
||||
|
||||
if (copying_text)
|
||||
{ /* copying_text has already been fully expanded in
|
||||
begin_insertion (by full_expansion), so use insert_ rather than
|
||||
add_. It is not ideal that we include the html markup here within
|
||||
<head>, but the alternative is to have yet more and different
|
||||
expansions of the copying text. Yuck. */
|
||||
insert_string ("<!--\n");
|
||||
insert_string (copying_text);
|
||||
insert_string ("-->\n");
|
||||
}
|
||||
|
||||
/* Put the style definitions in a comment for the sake of browsers
|
||||
that don't support <style>. */
|
||||
add_word ("<meta http-equiv=\"Content-Style-Type\" content=\"text/css\">\n");
|
||||
add_word ("<style type=\"text/css\"><!--\n");
|
||||
|
||||
{
|
||||
char *css_inline = NULL;
|
||||
|
||||
if (css_include)
|
||||
/* This writes out any @import commands from the --css-file,
|
||||
and returns any actual css code following the imports. */
|
||||
css_inline = process_css_file (css_include);
|
||||
|
||||
/* This seems cleaner than adding <br>'s at the end of each line for
|
||||
these "roman" displays. It's hardly the end of the world if the
|
||||
browser doesn't do <style>s, in any case; they'll just come out in
|
||||
typewriter. */
|
||||
#define CSS_FONT_INHERIT "font-family:inherit"
|
||||
add_word_args (" pre.display { %s }\n", CSS_FONT_INHERIT);
|
||||
add_word_args (" pre.format { %s }\n", CSS_FONT_INHERIT);
|
||||
|
||||
/* Alternatively, we could do <font size=-1> in insertion.c, but this
|
||||
way makes it easier to override. */
|
||||
#define CSS_FONT_SMALLER "font-size:smaller"
|
||||
add_word_args (" pre.smalldisplay { %s; %s }\n", CSS_FONT_INHERIT,
|
||||
CSS_FONT_SMALLER);
|
||||
add_word_args (" pre.smallformat { %s; %s }\n", CSS_FONT_INHERIT,
|
||||
CSS_FONT_SMALLER);
|
||||
add_word_args (" pre.smallexample { %s }\n", CSS_FONT_SMALLER);
|
||||
add_word_args (" pre.smalllisp { %s }\n", CSS_FONT_SMALLER);
|
||||
|
||||
/* Write out any css code from the user's --css-file. */
|
||||
if (css_inline)
|
||||
add_word (css_inline);
|
||||
|
||||
add_word ("--></style>\n");
|
||||
}
|
||||
|
||||
add_word ("</head>\n<body>\n");
|
||||
|
||||
if (title && !html_title_written && titlepage_cmd_present)
|
||||
{
|
||||
add_word_args ("<h1 class=\"settitle\">%s</h1>\n", html_title);
|
||||
html_title_written = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Append CHAR to BUFFER, (re)allocating as necessary. We don't handle
|
||||
null characters. */
|
||||
@ -139,9 +38,8 @@ typedef struct
|
||||
char *buffer;
|
||||
} buffer_type;
|
||||
|
||||
|
||||
static buffer_type *
|
||||
init_buffer ()
|
||||
init_buffer (void)
|
||||
{
|
||||
buffer_type *buf = xmalloc (sizeof (buffer_type));
|
||||
buf->length = 0;
|
||||
@ -151,11 +49,8 @@ init_buffer ()
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
append_char (buf, c)
|
||||
buffer_type *buf;
|
||||
int c;
|
||||
append_char (buffer_type *buf, int c)
|
||||
{
|
||||
buf->length++;
|
||||
if (buf->length >= buf->size)
|
||||
@ -167,17 +62,15 @@ append_char (buf, c)
|
||||
buf->buffer[buf->length] = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Read the cascading style-sheet file FILENAME. Write out any @import
|
||||
commands, which must come first, by the definition of css. If the
|
||||
file contains any actual css code following the @imports, return it;
|
||||
else return NULL. */
|
||||
|
||||
static char *
|
||||
process_css_file (filename)
|
||||
char *filename;
|
||||
process_css_file (char *filename)
|
||||
{
|
||||
int c, lastchar;
|
||||
int c;
|
||||
int lastchar = 0;
|
||||
FILE *f;
|
||||
buffer_type *import_text = init_buffer ();
|
||||
buffer_type *inline_text = init_buffer ();
|
||||
@ -185,6 +78,8 @@ process_css_file (filename)
|
||||
enum { null_state, comment_state, import_state, inline_state } state
|
||||
= null_state, prev_state;
|
||||
|
||||
prev_state = null_state;
|
||||
|
||||
/* read from stdin if `-' is the filename. */
|
||||
f = STREQ (filename, "-") ? stdin : fopen (filename, "r");
|
||||
if (!f)
|
||||
@ -204,12 +99,22 @@ process_css_file (filename)
|
||||
{
|
||||
case null_state: /* between things */
|
||||
if (c == '@')
|
||||
{
|
||||
/* If there's some other @command, just call it an
|
||||
import, it's all the same to us. So don't bother
|
||||
looking for the `import'. */
|
||||
append_char (import_text, c);
|
||||
state = import_state;
|
||||
{ /* Only @import and @charset should switch into
|
||||
import_state, other @-commands, such as @media, should
|
||||
put us into inline_state. I don't think any other css
|
||||
@-commands start with `i' or `c', although of course
|
||||
this will break when such a command is defined. */
|
||||
int nextchar = getc (f);
|
||||
if (nextchar == 'i' || nextchar == 'c')
|
||||
{
|
||||
append_char (import_text, c);
|
||||
state = import_state;
|
||||
}
|
||||
else
|
||||
{
|
||||
ungetc (nextchar, f); /* wasn't an @import */
|
||||
state = inline_state;
|
||||
}
|
||||
}
|
||||
else if (c == '/')
|
||||
{ /* possible start of a comment */
|
||||
@ -277,23 +182,176 @@ process_css_file (filename)
|
||||
/* We're wasting the buffer struct memory, but so what. */
|
||||
return inline_text->buffer;
|
||||
}
|
||||
|
||||
HSTACK *htmlstack = NULL;
|
||||
|
||||
/* See html.h. */
|
||||
int html_output_head_p = 0;
|
||||
int html_title_written = 0;
|
||||
|
||||
void
|
||||
html_output_head (void)
|
||||
{
|
||||
static const char *html_title = NULL;
|
||||
char *encoding;
|
||||
|
||||
if (html_output_head_p)
|
||||
return;
|
||||
html_output_head_p = 1;
|
||||
|
||||
encoding = current_document_encoding ();
|
||||
|
||||
/* The <title> should not have markup, so use text_expansion. */
|
||||
if (!html_title)
|
||||
html_title = escape_string (title ?
|
||||
text_expansion (title) : (char *) _("Untitled"));
|
||||
|
||||
/* Make sure this is the very first string of the output document. */
|
||||
output_paragraph_offset = 0;
|
||||
|
||||
add_html_block_elt_args ("<html lang=\"%s\">\n<head>\n",
|
||||
language_table[language_code].abbrev);
|
||||
|
||||
/* When splitting, add current node's name to title if it's available and not
|
||||
Top. */
|
||||
if (splitting && current_node && !STREQ (current_node, "Top"))
|
||||
add_word_args ("<title>%s - %s</title>\n",
|
||||
escape_string (xstrdup (current_node)), html_title);
|
||||
else
|
||||
add_word_args ("<title>%s</title>\n", html_title);
|
||||
|
||||
add_word ("<meta http-equiv=\"Content-Type\" content=\"text/html");
|
||||
if (encoding && *encoding)
|
||||
add_word_args ("; charset=%s", encoding);
|
||||
|
||||
add_word ("\">\n");
|
||||
|
||||
if (!document_description)
|
||||
document_description = html_title;
|
||||
|
||||
add_word_args ("<meta name=\"description\" content=\"%s\">\n",
|
||||
document_description);
|
||||
add_word_args ("<meta name=\"generator\" content=\"makeinfo %s\">\n",
|
||||
VERSION);
|
||||
|
||||
/* Navigation bar links. */
|
||||
if (!splitting)
|
||||
add_word ("<link title=\"Top\" rel=\"top\" href=\"#Top\">\n");
|
||||
else if (tag_table)
|
||||
{
|
||||
/* Always put a top link. */
|
||||
add_word ("<link title=\"Top\" rel=\"start\" href=\"index.html#Top\">\n");
|
||||
|
||||
/* We already have a top link, avoid duplication. */
|
||||
if (tag_table->up && !STREQ (tag_table->up, "Top"))
|
||||
add_link (tag_table->up, "rel=\"up\"");
|
||||
|
||||
if (tag_table->prev)
|
||||
add_link (tag_table->prev, "rel=\"prev\"");
|
||||
|
||||
if (tag_table->next)
|
||||
add_link (tag_table->next, "rel=\"next\"");
|
||||
|
||||
/* fixxme: Look for a way to put links to various indices in the
|
||||
document. Also possible candidates to be added here are First and
|
||||
Last links. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We are splitting, but we neither have a tag_table. So this must be
|
||||
index.html. So put a link to Top. */
|
||||
add_word ("<link title=\"Top\" rel=\"start\" href=\"#Top\">\n");
|
||||
}
|
||||
|
||||
add_word ("<link href=\"http://www.gnu.org/software/texinfo/\" \
|
||||
rel=\"generator-home\" title=\"Texinfo Homepage\">\n");
|
||||
|
||||
if (copying_text)
|
||||
{ /* It is not ideal that we include the html markup here within
|
||||
<head>, so we use text_expansion. */
|
||||
insert_string ("<!--\n");
|
||||
insert_string (text_expansion (copying_text));
|
||||
insert_string ("-->\n");
|
||||
}
|
||||
|
||||
/* Put the style definitions in a comment for the sake of browsers
|
||||
that don't support <style>. */
|
||||
add_word ("<meta http-equiv=\"Content-Style-Type\" content=\"text/css\">\n");
|
||||
add_word ("<style type=\"text/css\"><!--\n");
|
||||
|
||||
{
|
||||
char *css_inline = NULL;
|
||||
|
||||
if (css_include)
|
||||
/* This writes out any @import commands from the --css-file,
|
||||
and returns any actual css code following the imports. */
|
||||
css_inline = process_css_file (css_include);
|
||||
|
||||
/* This seems cleaner than adding <br>'s at the end of each line for
|
||||
these "roman" displays. It's hardly the end of the world if the
|
||||
browser doesn't do <style>s, in any case; they'll just come out in
|
||||
typewriter. */
|
||||
#define CSS_FONT_INHERIT "font-family:inherit"
|
||||
add_word_args (" pre.display { %s }\n", CSS_FONT_INHERIT);
|
||||
add_word_args (" pre.format { %s }\n", CSS_FONT_INHERIT);
|
||||
|
||||
/* Alternatively, we could do <font size=-1> in insertion.c, but this
|
||||
way makes it easier to override. */
|
||||
#define CSS_FONT_SMALLER "font-size:smaller"
|
||||
add_word_args (" pre.smalldisplay { %s; %s }\n", CSS_FONT_INHERIT,
|
||||
CSS_FONT_SMALLER);
|
||||
add_word_args (" pre.smallformat { %s; %s }\n", CSS_FONT_INHERIT,
|
||||
CSS_FONT_SMALLER);
|
||||
add_word_args (" pre.smallexample { %s }\n", CSS_FONT_SMALLER);
|
||||
add_word_args (" pre.smalllisp { %s }\n", CSS_FONT_SMALLER);
|
||||
|
||||
/* Since HTML doesn't have a sc element, we use span with a bit of
|
||||
CSS spice instead. */
|
||||
#define CSS_FONT_SMALL_CAPS "font-variant:small-caps"
|
||||
add_word_args (" span.sc { %s }\n", CSS_FONT_SMALL_CAPS);
|
||||
|
||||
/* Roman (default) font class, closest we can come. */
|
||||
#define CSS_FONT_ROMAN "font-family:serif; font-weight:normal;"
|
||||
add_word_args (" span.roman { %s } \n", CSS_FONT_ROMAN);
|
||||
|
||||
/* Sans serif font class. */
|
||||
#define CSS_FONT_SANSSERIF "font-family:sans-serif; font-weight:normal;"
|
||||
add_word_args (" span.sansserif { %s } \n", CSS_FONT_SANSSERIF);
|
||||
|
||||
/* Write out any css code from the user's --css-file. */
|
||||
if (css_inline)
|
||||
insert_string (css_inline);
|
||||
|
||||
add_word ("--></style>\n");
|
||||
}
|
||||
|
||||
add_word ("</head>\n<body>\n");
|
||||
|
||||
if (title && !html_title_written && titlepage_cmd_present)
|
||||
{
|
||||
add_word_args ("<h1 class=\"settitle\">%s</h1>\n", html_title);
|
||||
html_title_written = 1;
|
||||
}
|
||||
|
||||
free (encoding);
|
||||
}
|
||||
|
||||
/* Escape HTML special characters in the string if necessary,
|
||||
returning a pointer to a possibly newly-allocated one. */
|
||||
char *
|
||||
escape_string (string)
|
||||
char * string;
|
||||
escape_string (char *string)
|
||||
{
|
||||
int i=0, newlen=0;
|
||||
char * newstring;
|
||||
char *newstring;
|
||||
int i = 0, newlen = 0;
|
||||
|
||||
do
|
||||
{
|
||||
/* Find how much to allocate. */
|
||||
switch (string[i])
|
||||
{
|
||||
case '"':
|
||||
newlen += 6; /* `"' */
|
||||
break;
|
||||
case '&':
|
||||
newlen += 5; /* `&' */
|
||||
break;
|
||||
@ -315,6 +373,10 @@ escape_string (string)
|
||||
{
|
||||
switch (string[i])
|
||||
{
|
||||
case '"':
|
||||
strcpy (newstring, """);
|
||||
newstring += 6;
|
||||
break;
|
||||
case '&':
|
||||
strcpy (newstring, "&");
|
||||
newstring += 5;
|
||||
@ -336,24 +398,22 @@ escape_string (string)
|
||||
free (string);
|
||||
return newstring - newlen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Save current tag. */
|
||||
void
|
||||
push_tag (tag)
|
||||
char *tag;
|
||||
static void
|
||||
push_tag (char *tag, char *attribs)
|
||||
{
|
||||
HSTACK *newstack = xmalloc (sizeof (HSTACK));
|
||||
|
||||
newstack->tag = tag;
|
||||
newstack->attribs = xstrdup (attribs);
|
||||
newstack->next = htmlstack;
|
||||
htmlstack = newstack;
|
||||
}
|
||||
|
||||
/* Get last tag. */
|
||||
void
|
||||
pop_tag ()
|
||||
static void
|
||||
pop_tag (void)
|
||||
{
|
||||
HSTACK *tos = htmlstack;
|
||||
|
||||
@ -363,77 +423,162 @@ pop_tag ()
|
||||
return;
|
||||
}
|
||||
|
||||
free (htmlstack->attribs);
|
||||
|
||||
htmlstack = htmlstack->next;
|
||||
free (tos);
|
||||
}
|
||||
|
||||
/* Check if tag is an empty or a whitespace only element.
|
||||
If so, remove it, keeping whitespace intact. */
|
||||
int
|
||||
rollback_empty_tag (char *tag)
|
||||
{
|
||||
int check_position = output_paragraph_offset;
|
||||
int taglen = strlen (tag);
|
||||
int rollback_happened = 0;
|
||||
char *contents = "";
|
||||
char *contents_canon_white = "";
|
||||
|
||||
/* If output_paragraph is empty, we cannot rollback :-\ */
|
||||
if (output_paragraph_offset <= 0)
|
||||
return 0;
|
||||
|
||||
/* Find the end of the previous tag. */
|
||||
while (output_paragraph[check_position-1] != '>' && check_position > 0)
|
||||
check_position--;
|
||||
|
||||
/* Save stuff between tag's end to output_paragraph's end. */
|
||||
if (check_position != output_paragraph_offset)
|
||||
{
|
||||
contents = xmalloc (output_paragraph_offset - check_position + 1);
|
||||
memcpy (contents, output_paragraph + check_position,
|
||||
output_paragraph_offset - check_position);
|
||||
|
||||
contents[output_paragraph_offset - check_position] = '\0';
|
||||
|
||||
contents_canon_white = xstrdup (contents);
|
||||
canon_white (contents_canon_white);
|
||||
}
|
||||
|
||||
/* Find the start of the previous tag. */
|
||||
while (output_paragraph[check_position-1] != '<' && check_position > 0)
|
||||
check_position--;
|
||||
|
||||
/* Check to see if this is the tag. */
|
||||
if (strncmp ((char *) output_paragraph + check_position, tag, taglen) == 0
|
||||
&& (whitespace (output_paragraph[check_position + taglen])
|
||||
|| output_paragraph[check_position + taglen] == '>'))
|
||||
{
|
||||
if (!contents_canon_white || !*contents_canon_white)
|
||||
{
|
||||
/* Empty content after whitespace removal, so roll it back. */
|
||||
output_paragraph_offset = check_position - 1;
|
||||
rollback_happened = 1;
|
||||
|
||||
/* Original contents may not be empty (whitespace.) */
|
||||
if (contents && *contents)
|
||||
{
|
||||
insert_string (contents);
|
||||
free (contents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rollback_happened;
|
||||
}
|
||||
|
||||
/* Open or close TAG according to START_OR_END. */
|
||||
void
|
||||
insert_html_tag (start_or_end, tag)
|
||||
#if defined (VA_FPRINTF) && __STDC__
|
||||
insert_html_tag_with_attribute (int start_or_end, char *tag, char *format, ...)
|
||||
#else
|
||||
insert_html_tag_with_attribute (start_or_end, tag, format, va_alist)
|
||||
int start_or_end;
|
||||
char *tag;
|
||||
char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
char *old_tag = NULL;
|
||||
char *old_attribs = NULL;
|
||||
char formatted_attribs[2000]; /* xx no fixed limits */
|
||||
int do_return = 0;
|
||||
|
||||
if (!paragraph_is_open && (start_or_end == START))
|
||||
{
|
||||
/* Need to compensate for the <p> we are about to insert, or
|
||||
else cm_xxx functions that call us will get wrong text
|
||||
between START and END. */
|
||||
adjust_braces_following (output_paragraph_offset, 3);
|
||||
add_word ("<p>");
|
||||
}
|
||||
extern int in_html_elt;
|
||||
|
||||
if (start_or_end != START)
|
||||
pop_tag ();
|
||||
|
||||
if (htmlstack)
|
||||
old_tag = htmlstack->tag;
|
||||
{
|
||||
old_tag = htmlstack->tag;
|
||||
old_attribs = htmlstack->attribs;
|
||||
}
|
||||
|
||||
if (format)
|
||||
{
|
||||
#ifdef VA_SPRINTF
|
||||
va_list ap;
|
||||
#endif
|
||||
|
||||
VA_START (ap, format);
|
||||
#ifdef VA_SPRINTF
|
||||
VA_SPRINTF (formatted_attribs, format, ap);
|
||||
#else
|
||||
sprintf (formatted_attribs, format, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
#endif
|
||||
va_end (ap);
|
||||
}
|
||||
else
|
||||
formatted_attribs[0] = '\0';
|
||||
|
||||
/* Exception: can nest multiple spans. */
|
||||
if (htmlstack
|
||||
&& (strcmp (htmlstack->tag, tag) == 0))
|
||||
&& STREQ (htmlstack->tag, tag)
|
||||
&& !(STREQ (tag, "span") && STREQ (old_attribs, formatted_attribs)))
|
||||
do_return = 1;
|
||||
|
||||
if (start_or_end == START)
|
||||
push_tag (tag);
|
||||
push_tag (tag, formatted_attribs);
|
||||
|
||||
if (do_return)
|
||||
return;
|
||||
|
||||
in_html_elt++;
|
||||
|
||||
/* texinfo.tex doesn't support more than one font attribute
|
||||
at the same time. */
|
||||
if ((start_or_end == START) && old_tag && *old_tag)
|
||||
{
|
||||
add_word ("</");
|
||||
add_word (old_tag);
|
||||
add_char ('>');
|
||||
}
|
||||
if ((start_or_end == START) && old_tag && *old_tag
|
||||
&& !rollback_empty_tag (old_tag))
|
||||
add_word_args ("</%s>", old_tag);
|
||||
|
||||
if (*tag)
|
||||
{
|
||||
add_char ('<');
|
||||
if (start_or_end != START)
|
||||
add_char ('/');
|
||||
add_word (tag);
|
||||
add_char ('>');
|
||||
if (start_or_end == START)
|
||||
add_word_args (format ? "<%s %s>" : "<%s>", tag, formatted_attribs);
|
||||
else if (!rollback_empty_tag (tag))
|
||||
/* Insert close tag only if we didn't rollback,
|
||||
in which case the opening tag is removed. */
|
||||
add_word_args ("</%s>", tag);
|
||||
}
|
||||
|
||||
if ((start_or_end != START) && old_tag && *old_tag)
|
||||
{
|
||||
add_char ('<');
|
||||
add_word (old_tag);
|
||||
add_char ('>');
|
||||
}
|
||||
add_word_args (strlen (old_attribs) > 0 ? "<%s %s>" : "<%s>",
|
||||
old_tag, old_attribs);
|
||||
|
||||
in_html_elt--;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
insert_html_tag (int start_or_end, char *tag)
|
||||
{
|
||||
insert_html_tag_with_attribute (start_or_end, tag, NULL);
|
||||
}
|
||||
|
||||
/* Output an HTML <link> to the filename for NODE, including the
|
||||
other string as extra attributes. */
|
||||
void
|
||||
add_link (nodename, attributes)
|
||||
char *nodename, *attributes;
|
||||
add_link (char *nodename, char *attributes)
|
||||
{
|
||||
if (nodename)
|
||||
{
|
||||
@ -441,39 +586,64 @@ add_link (nodename, attributes)
|
||||
add_word_args ("%s", attributes);
|
||||
add_word_args (" href=\"");
|
||||
add_anchor_name (nodename, 1);
|
||||
add_word ("\">\n");
|
||||
add_word_args ("\" title=\"%s\">\n", nodename);
|
||||
}
|
||||
}
|
||||
|
||||
/* Output NAME with characters escaped as appropriate for an anchor
|
||||
name, i.e., escape URL special characters as %<n>. */
|
||||
name, i.e., escape URL special characters with our _00hh convention
|
||||
if OLD is zero. (See the manual for details on the new scheme.)
|
||||
|
||||
If OLD is nonzero, generate the node name with the 4.6-and-earlier
|
||||
convention of %hh (and more special characters output as-is, notably
|
||||
- and *). This is only so that external references to old names can
|
||||
still work with HTML generated by the new makeinfo; the gcc folks
|
||||
needed this. Our own HTML does not refer to these names. */
|
||||
|
||||
void
|
||||
add_escaped_anchor_name (name)
|
||||
char *name;
|
||||
add_escaped_anchor_name (char *name, int old)
|
||||
{
|
||||
canon_white (name);
|
||||
|
||||
if (!old && !strchr ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
*name))
|
||||
{ /* XHTML does not allow anything but an ASCII letter to start an
|
||||
identifier. Therefore kludge in this constant string if we
|
||||
have a nonletter. */
|
||||
add_word ("g_t");
|
||||
}
|
||||
|
||||
for (; *name; name++)
|
||||
{
|
||||
if (*name == '&')
|
||||
add_word ("&");
|
||||
else if (! URL_SAFE_CHAR (*name))
|
||||
if (cr_or_whitespace (*name))
|
||||
add_char ('-');
|
||||
|
||||
else if (!old && !URL_SAFE_CHAR (*name))
|
||||
/* Cast so characters with the high bit set are treated as >128,
|
||||
for example o-umlaut should be 246, not -10. */
|
||||
add_word_args ("_00%x", (unsigned char) *name);
|
||||
|
||||
else if (old && !URL_SAFE_CHAR (*name) && !OLD_URL_SAFE_CHAR (*name))
|
||||
/* Different output convention, but still cast as above. */
|
||||
add_word_args ("%%%x", (unsigned char) *name);
|
||||
|
||||
else
|
||||
add_char (*name);
|
||||
}
|
||||
}
|
||||
|
||||
/* Insert the text for the name of a reference in an HTML anchor
|
||||
appropriate for NODENAME. If HREF is nonzero, it will be
|
||||
appropriate for a href= attribute, rather than name= i.e., including
|
||||
the `#' if it's an internal reference. */
|
||||
appropriate for NODENAME.
|
||||
|
||||
If HREF is zero, generate text for name= in the new node name
|
||||
conversion convention.
|
||||
If HREF is negative, generate text for name= in the old convention.
|
||||
If HREF is positive, generate the name for an href= attribute, i.e.,
|
||||
including the `#' if it's an internal reference. */
|
||||
void
|
||||
add_anchor_name (nodename, href)
|
||||
char *nodename;
|
||||
int href;
|
||||
add_anchor_name (char *nodename, int href)
|
||||
{
|
||||
if (href)
|
||||
if (href > 0)
|
||||
{
|
||||
if (splitting)
|
||||
add_url_name (nodename, href);
|
||||
@ -486,38 +656,52 @@ add_anchor_name (nodename, href)
|
||||
if (strcasecmp (nodename, "(dir)") == 0)
|
||||
/* Strip the parens, but keep the original letter-case. */
|
||||
add_word_args ("%.3s", nodename + 1);
|
||||
else if (strcasecmp (nodename, "top") == 0)
|
||||
add_word ("Top");
|
||||
else
|
||||
add_escaped_anchor_name (nodename);
|
||||
add_escaped_anchor_name (nodename, href < 0);
|
||||
}
|
||||
|
||||
/* Insert the text for the name of a reference in an HTML url, aprropriate
|
||||
for NODENAME */
|
||||
void
|
||||
add_url_name (nodename, href)
|
||||
char *nodename;
|
||||
int href;
|
||||
add_url_name (char *nodename, int href)
|
||||
{
|
||||
add_nodename_to_filename (nodename, href);
|
||||
}
|
||||
|
||||
/* Only allow [-0-9a-zA-Z_.] when nodifying filenames. This may
|
||||
result in filename clashes; e.g.,
|
||||
|
||||
@node Foo ],,,
|
||||
@node Foo [,,,
|
||||
|
||||
both map to Foo--.html. If that happens, cm_node will put all
|
||||
the nodes whose file names clash on the same file. */
|
||||
void
|
||||
fix_filename (filename)
|
||||
char *filename;
|
||||
/* Convert non [A-Za-z0-9] to _00xx, where xx means the hexadecimal
|
||||
representation of the ASCII character. Also convert spaces and
|
||||
newlines to dashes. */
|
||||
static void
|
||||
fix_filename (char *filename)
|
||||
{
|
||||
char *p;
|
||||
for (p = filename; *p; p++)
|
||||
int i;
|
||||
int len = strlen (filename);
|
||||
char *oldname = xstrdup (filename);
|
||||
|
||||
*filename = '\0';
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (!(isalnum (*p) || strchr ("-._", *p)))
|
||||
*p = '-';
|
||||
if (cr_or_whitespace (oldname[i]))
|
||||
strcat (filename, "-");
|
||||
else if (URL_SAFE_CHAR (oldname[i]))
|
||||
strncat (filename, (char *) oldname + i, 1);
|
||||
else
|
||||
{
|
||||
char *hexchar = xmalloc (6 * sizeof (char));
|
||||
sprintf (hexchar, "_00%x", (unsigned char) oldname[i]);
|
||||
strcat (filename, hexchar);
|
||||
free (hexchar);
|
||||
}
|
||||
|
||||
/* Check if we are nearing boundaries. */
|
||||
if (strlen (filename) >= PATH_MAX - 20)
|
||||
break;
|
||||
}
|
||||
|
||||
free (oldname);
|
||||
}
|
||||
|
||||
/* As we can't look-up a (forward-referenced) nodes' html filename
|
||||
@ -525,9 +709,7 @@ fix_filename (filename)
|
||||
nodenames are unique, and generate the html filename from the
|
||||
nodename, that's always known. */
|
||||
static char *
|
||||
nodename_to_filename_1 (nodename, href)
|
||||
char *nodename;
|
||||
int href;
|
||||
nodename_to_filename_1 (char *nodename, int href)
|
||||
{
|
||||
char *p;
|
||||
char *filename;
|
||||
@ -623,9 +805,7 @@ nodename_to_filename_1 (nodename, href)
|
||||
/* If necessary, ie, if current filename != filename of node, output
|
||||
the node name. */
|
||||
void
|
||||
add_nodename_to_filename (nodename, href)
|
||||
char *nodename;
|
||||
int href;
|
||||
add_nodename_to_filename (char *nodename, int href)
|
||||
{
|
||||
/* for now, don't check: always output filename */
|
||||
char *filename = nodename_to_filename_1 (nodename, href);
|
||||
@ -634,8 +814,7 @@ add_nodename_to_filename (nodename, href)
|
||||
}
|
||||
|
||||
char *
|
||||
nodename_to_filename (nodename)
|
||||
char *nodename;
|
||||
nodename_to_filename (char *nodename)
|
||||
{
|
||||
/* The callers of nodename_to_filename use the result to produce
|
||||
<a href=, so call nodename_to_filename_1 with last arg non-zero. */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* html.h -- declarations for html-related utilities.
|
||||
$Id: html.h,v 1.4 2002/10/31 22:08:23 karl Exp $
|
||||
$Id: html.h,v 1.6 2004/11/30 02:03:23 karl Exp $
|
||||
|
||||
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2002, 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
|
||||
@ -25,6 +25,7 @@ typedef struct hstack
|
||||
{
|
||||
struct hstack *next;
|
||||
char *tag;
|
||||
char *attribs;
|
||||
} HSTACK;
|
||||
|
||||
/* Nonzero if we have output the <head>. */
|
||||
@ -34,24 +35,31 @@ extern int html_output_head_p;
|
||||
extern int html_title_written;
|
||||
|
||||
/* Perform the <head> output. */
|
||||
extern void html_output_head ();
|
||||
extern void html_output_head (void);
|
||||
|
||||
/* Escape &<>. */
|
||||
extern char *escape_string (/* char * */);
|
||||
extern char *escape_string (char *);
|
||||
|
||||
/* Open or close TAG according to START_OR_END. */
|
||||
extern void insert_html_tag (/* int start_or_end, char *tag */);
|
||||
extern void insert_html_tag (int start_or_end, char *tag);
|
||||
|
||||
/* Output HTML <link> to NODE, plus extra ATTRIBUTES. */
|
||||
extern void add_link (/* char *node, char *attributes */);
|
||||
extern void add_link (char *nodename, char *attributes);
|
||||
|
||||
/* Escape URL-special characters as %xy. */
|
||||
extern void add_escaped_anchor_name (/* char *name */);
|
||||
/* Escape URL-special characters. */
|
||||
extern void add_escaped_anchor_name (char *name, int old);
|
||||
|
||||
/* See html.c. */
|
||||
extern void add_anchor_name (/* nodename, href */);
|
||||
extern void add_url_name ( /* nodename, href */ );
|
||||
extern char* nodename_to_filename ( /* nodename */ );
|
||||
extern void add_nodename_to_filename ( /*nodename, href */ );
|
||||
extern void add_anchor_name (char *nodename, int href);
|
||||
extern void add_url_name (char *nodename, int href);
|
||||
extern void add_nodename_to_filename (char *nodename, int href);
|
||||
extern char *nodename_to_filename (char *nodename);
|
||||
extern int rollback_empty_tag (char *tag);
|
||||
|
||||
#if defined (VA_FPRINTF) && __STDC__
|
||||
extern void insert_html_tag_with_attribute (int start_or_end, char *tag, char *format, ...);
|
||||
#else
|
||||
extern void insert_html_tag_with_attribute ();
|
||||
#endif
|
||||
|
||||
#endif /* !HTML_H */
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* index.c -- indexing for Texinfo.
|
||||
$Id: index.c,v 1.8 2003/05/16 23:52:40 karl Exp $
|
||||
$Id: index.c,v 1.17 2004/11/30 02:03:23 karl Exp $
|
||||
|
||||
Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999, 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,59 +19,16 @@
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "system.h"
|
||||
#include "files.h"
|
||||
#include "footnote.h"
|
||||
#include "html.h"
|
||||
#include "index.h"
|
||||
#include "lang.h"
|
||||
#include "macro.h"
|
||||
#include "sectioning.h"
|
||||
#include "toc.h"
|
||||
#include "xml.h"
|
||||
|
||||
/* An index element... */
|
||||
typedef struct index_elt
|
||||
{
|
||||
struct index_elt *next;
|
||||
char *entry; /* The index entry itself, after expansion. */
|
||||
char *entry_text; /* The original, non-expanded entry text. */
|
||||
char *node; /* The node from whence it came. */
|
||||
int code; /* Nonzero means add `@code{...}' when
|
||||
printing this element. */
|
||||
int defining_line; /* Line number where this entry was written. */
|
||||
char *defining_file; /* Source file for defining_line. */
|
||||
} INDEX_ELT;
|
||||
|
||||
|
||||
/* A list of short-names for each index.
|
||||
There are two indices into the the_indices array.
|
||||
* read_index is the index that points to the list of index
|
||||
entries that we will find if we ask for the list of entries for
|
||||
this name.
|
||||
* write_index is the index that points to the list of index entries
|
||||
that we will add new entries to.
|
||||
|
||||
Initially, read_index and write_index are the same, but the
|
||||
@syncodeindex and @synindex commands can change the list we add
|
||||
entries to.
|
||||
|
||||
For example, after the commands
|
||||
@cindex foo
|
||||
@defindex ii
|
||||
@synindex cp ii
|
||||
@cindex bar
|
||||
|
||||
the cp index will contain the entry `foo', and the new ii
|
||||
index will contain the entry `bar'. This is consistent with the
|
||||
way texinfo.tex handles the same situation.
|
||||
|
||||
In addition, for each index, it is remembered whether that index is
|
||||
a code index or not. Code indices have @code{} inserted around the
|
||||
first word when they are printed with printindex. */
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
int read_index; /* index entries for `name' */
|
||||
int write_index; /* store index entries here, @synindex can change it */
|
||||
int code;
|
||||
} INDEX_ALIST;
|
||||
|
||||
INDEX_ALIST **name_index_alist = NULL;
|
||||
|
||||
/* An array of pointers. Each one is for a different index. The
|
||||
@ -81,18 +39,24 @@ INDEX_ELT **the_indices = NULL;
|
||||
/* The number of defined indices. */
|
||||
int defined_indices = 0;
|
||||
|
||||
/* This is the order of the index. */
|
||||
int index_counter = 0;
|
||||
|
||||
/* Stuff for defining commands on the fly. */
|
||||
COMMAND **user_command_array = NULL;
|
||||
int user_command_array_len = 0;
|
||||
|
||||
/* How to compare index entries for sorting. May be set to strcoll. */
|
||||
int (*index_compare_fn) () = strcasecmp;
|
||||
int (*index_compare_fn) (const char *a, const char *b) = strcasecmp;
|
||||
|
||||
/* Function to compare index entries for sorting. (Calls
|
||||
`index_compare_fn' above.) */
|
||||
int index_element_compare (const void *element1, const void *element2);
|
||||
|
||||
/* Find which element in the known list of indices has this name.
|
||||
Returns -1 if NAME isn't found. */
|
||||
static int
|
||||
find_index_offset (name)
|
||||
char *name;
|
||||
find_index_offset (char *name)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < defined_indices; i++)
|
||||
@ -103,9 +67,8 @@ find_index_offset (name)
|
||||
|
||||
/* Return a pointer to the entry of (name . index) for this name.
|
||||
Return NULL if the index doesn't exist. */
|
||||
INDEX_ALIST *
|
||||
find_index (name)
|
||||
char *name;
|
||||
static INDEX_ALIST *
|
||||
find_index (char *name)
|
||||
{
|
||||
int offset = find_index_offset (name);
|
||||
if (offset > -1)
|
||||
@ -116,11 +79,8 @@ find_index (name)
|
||||
|
||||
/* User-defined commands, which happens only from user-defined indexes.
|
||||
Used to initialize the builtin indices, too. */
|
||||
void
|
||||
define_user_command (name, proc, needs_braces_p)
|
||||
char *name;
|
||||
COMMAND_FUNCTION *proc;
|
||||
int needs_braces_p;
|
||||
static void
|
||||
define_user_command (char *name, COMMAND_FUNCTION (*proc), int needs_braces_p)
|
||||
{
|
||||
int slot = user_command_array_len;
|
||||
user_command_array_len++;
|
||||
@ -139,8 +99,7 @@ define_user_command (name, proc, needs_braces_p)
|
||||
|
||||
/* Please release me, let me go... */
|
||||
static void
|
||||
free_index (index)
|
||||
INDEX_ELT *index;
|
||||
free_index (INDEX_ELT *index)
|
||||
{
|
||||
INDEX_ELT *temp;
|
||||
|
||||
@ -159,8 +118,7 @@ free_index (index)
|
||||
/* Flush an index by name. This will delete the list of entries that
|
||||
would be written by a @printindex command for this index. */
|
||||
static void
|
||||
undefindex (name)
|
||||
char *name;
|
||||
undefindex (char *name)
|
||||
{
|
||||
int i;
|
||||
int which = find_index_offset (name);
|
||||
@ -180,11 +138,9 @@ undefindex (name)
|
||||
name_index_alist[which] = NULL;
|
||||
}
|
||||
|
||||
/* Add the arguments to the current index command to the index NAME.
|
||||
html fixxme generate specific html anchor */
|
||||
/* Add the arguments to the current index command to the index NAME. */
|
||||
static void
|
||||
index_add_arg (name)
|
||||
char *name;
|
||||
index_add_arg (char *name)
|
||||
{
|
||||
int which;
|
||||
char *index_entry;
|
||||
@ -216,17 +172,57 @@ index_add_arg (name)
|
||||
else
|
||||
{
|
||||
INDEX_ELT *new = xmalloc (sizeof (INDEX_ELT));
|
||||
|
||||
index_counter++;
|
||||
|
||||
/* Get output line number updated before doing anything. */
|
||||
if (!html && !xml)
|
||||
flush_output ();
|
||||
|
||||
new->next = the_indices[which];
|
||||
new->entry_text = index_entry;
|
||||
new->entry = NULL;
|
||||
new->node = current_node ? current_node : xstrdup ("");
|
||||
new->entry_text = index_entry;
|
||||
/* Since footnotes are handled at the very end of the document,
|
||||
node name in the non-split HTML outputs always show the last
|
||||
node. We artificially make it ``Footnotes''. */
|
||||
if (html && !splitting && already_outputting_pending_notes)
|
||||
new->node = xstrdup (_("Footnotes"));
|
||||
else
|
||||
new->node = current_node ? current_node : xstrdup ("");
|
||||
if (!html && !xml && no_headers)
|
||||
{
|
||||
new->section = current_sectioning_number ();
|
||||
if (strlen (new->section) == 0)
|
||||
new->section_name = current_sectioning_name ();
|
||||
else
|
||||
new->section_name = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
new->section = NULL;
|
||||
new->section_name = NULL;
|
||||
}
|
||||
new->code = tem->code;
|
||||
new->defining_line = line_number - 1;
|
||||
new->output_line = no_headers ? output_line_number : node_line_number;
|
||||
/* We need to make a copy since input_filename may point to
|
||||
something that goes away, for example, inside a macro.
|
||||
(see the findexerr test). */
|
||||
new->defining_file = xstrdup (input_filename);
|
||||
|
||||
if (html && splitting)
|
||||
{
|
||||
if (current_output_filename && *current_output_filename)
|
||||
new->output_file = filename_part (current_output_filename);
|
||||
else
|
||||
new->output_file = xstrdup ("");
|
||||
}
|
||||
else
|
||||
new->output_file = NULL;
|
||||
|
||||
new->entry_number = index_counter;
|
||||
the_indices[which] = new;
|
||||
|
||||
#if 0
|
||||
/* The index breaks if there are colons in the entry.
|
||||
-- This is true, but it's too painful to force changing index
|
||||
@ -238,14 +234,36 @@ index_add_arg (name)
|
||||
warning (_("Info cannot handle `:' in index entry `%s'"),
|
||||
new->entry_text);
|
||||
#endif
|
||||
|
||||
if (html)
|
||||
{
|
||||
/* Anchor. */
|
||||
int removed_empty_elt = 0;
|
||||
|
||||
/* We must put the anchor outside the <dl> and <ul> blocks. */
|
||||
if (rollback_empty_tag ("dl"))
|
||||
removed_empty_elt = 1;
|
||||
else if (rollback_empty_tag ("ul"))
|
||||
removed_empty_elt = 2;
|
||||
|
||||
add_word ("<a name=\"index-");
|
||||
add_escaped_anchor_name (index_entry, 0);
|
||||
add_word_args ("-%d\"></a>", index_counter);
|
||||
|
||||
if (removed_empty_elt == 1)
|
||||
add_html_block_elt_args ("\n<dl>");
|
||||
else if (removed_empty_elt == 2)
|
||||
add_html_block_elt_args ("\n<ul>");
|
||||
}
|
||||
}
|
||||
|
||||
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 ("<ul class=\"index-%s\" compact>", index_name);
|
||||
add_html_block_elt_args ("<ul class=\"index-%s\" compact>",
|
||||
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;
|
||||
/* 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&uuml;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<li><a href=\"%s#index-",
|
||||
(splitting && index->output_file) ? index->output_file : "");
|
||||
add_escaped_anchor_name (index->entry_text, 0);
|
||||
add_word_args ("-%d\">%s</a>: ", index->entry_number,
|
||||
html_entry);
|
||||
free (html_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<li>%s: ", expanded_entry);
|
||||
free (escaped_entry);
|
||||
free (expanded_entry);
|
||||
}
|
||||
add_word ("<a href=\"");
|
||||
if (index->node && *index->node)
|
||||
{
|
||||
/* Make sure any non-macros in the node name are expanded. */
|
||||
/* Ensure any non-macros in the node name are expanded. */
|
||||
char *expanded_index;
|
||||
|
||||
in_fixed_width_font++;
|
||||
expanded_index = expansion (index_node, 0);
|
||||
in_fixed_width_font--;
|
||||
add_anchor_name (expanded_index, 1);
|
||||
expanded_index = escape_string (expanded_index);
|
||||
add_word_args ("\">%s</a>", expanded_index);
|
||||
free (expanded_index);
|
||||
}
|
||||
@ -773,6 +864,8 @@ cm_printindex ()
|
||||
/* If we use the section instead of the (missing) node, then
|
||||
index_node already includes all we need except the #. */
|
||||
add_word_args ("#%s</a>", index_node);
|
||||
|
||||
add_html_block_elt ("</li>");
|
||||
}
|
||||
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 ("</ul>");
|
||||
add_html_block_elt ("</ul>");
|
||||
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++;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
/* Initialize all indices. */
|
||||
extern void init_indices ();
|
||||
/* 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;
|
||||
|
||||
/* Function to compare index entries for sorting. */
|
||||
extern int (*index_compare_fn) ();
|
||||
|
||||
/* 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 (void);
|
||||
|
||||
extern int defined_indices;
|
||||
extern int printing_index;
|
||||
extern int index_counter;
|
||||
|
||||
INDEX_ELT *index_list (char *name);
|
||||
|
||||
#endif /* !INDEX_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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 */
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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 (), cm_accent_acute (), cm_accent_cedilla (),
|
||||
cm_accent_hat (), cm_accent_grave (), cm_accent_tilde ();
|
||||
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 char *current_document_encoding (void);
|
||||
|
||||
#endif /* not LANG_H */
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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 <stdarg.h>. */
|
||||
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 */
|
||||
|
@ -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 ("<hr>");
|
||||
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 <br>s inserted
|
||||
to help non-tables browsers. `@item' inserts a <tr> and `@tab'
|
||||
inserts <td>; we also try to close <tr>. 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;
|
||||
|
||||
/* <p> for non-tables browsers. @multitable implicitly ends the
|
||||
current paragraph, so this is ok. */
|
||||
if (html)
|
||||
add_word ("<p><table>");
|
||||
/* else if (docbook)*/ /* 05-08 */
|
||||
else if (xml)
|
||||
{
|
||||
int *widths = xmalloc (ncolumns * sizeof (int));
|
||||
int i;
|
||||
for (i=0; i<ncolumns; i++)
|
||||
widths[i] = envs[i+1].fill_column;
|
||||
xml_begin_multitable (ncolumns, widths);
|
||||
free (widths);
|
||||
}
|
||||
|
||||
if (hsep)
|
||||
draw_horizontal_separator ();
|
||||
|
||||
/* The next @item command will direct stdout into the first column
|
||||
and start processing. @tab will then switch to the next column,
|
||||
and @item will flush out the saved output and return to the first
|
||||
column. Environment #1 is the first column. (Environment #0 is
|
||||
the normal output) */
|
||||
|
||||
++multitable_active;
|
||||
}
|
||||
|
||||
/* Called to handle a {...} template on the @multitable line.
|
||||
We're at the { and our first job is to find the matching }; as a side
|
||||
effect, we change *PARAMS to point to after it. Our other job is to
|
||||
expand the template text and return the width of that string. */
|
||||
static unsigned
|
||||
find_template_width (params)
|
||||
char **params;
|
||||
find_template_width (char **params)
|
||||
{
|
||||
char *template, *xtemplate;
|
||||
unsigned len;
|
||||
@ -241,107 +130,11 @@ find_template_width (params)
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
/* 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 ()
|
||||
{
|
||||
char *params = insertion_stack->item_function;
|
||||
int nchars;
|
||||
float columnfrac;
|
||||
char command[200]; /* xx no fixed limits */
|
||||
int i = 1;
|
||||
|
||||
/* We implement @hsep and @vsep even though TeX doesn't.
|
||||
We don't get mixing of @columnfractions and templates right,
|
||||
but TeX doesn't either. */
|
||||
hsep = vsep = 0;
|
||||
|
||||
while (*params) {
|
||||
while (whitespace (*params))
|
||||
params++;
|
||||
|
||||
if (*params == '@') {
|
||||
sscanf (params, "%200s", command);
|
||||
nchars = strlen (command);
|
||||
params += nchars;
|
||||
if (strcmp (command, "@hsep") == 0)
|
||||
hsep++;
|
||||
else if (strcmp (command, "@vsep") == 0)
|
||||
vsep++;
|
||||
else if (strcmp (command, "@columnfractions") == 0) {
|
||||
/* 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++) {
|
||||
if (sscanf (params, "%f", &columnfrac) < 1)
|
||||
goto done;
|
||||
/* Unfortunately, can't use %n since m68k-hp-bsd libc (at least)
|
||||
doesn't support it. So skip whitespace (preceding the
|
||||
number) and then non-whitespace (the number). */
|
||||
while (*params && (*params == ' ' || *params == '\t'))
|
||||
params++;
|
||||
/* Hmm, but what about @columnfractions 3foo. Well, I suppose
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
} 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);
|
||||
|
||||
} else {
|
||||
warning (_("ignoring stray text `%s' after @multitable"), params);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
flush_output ();
|
||||
inhibit_output_flushing ();
|
||||
|
||||
last_column = i - 1;
|
||||
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;
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
static int
|
||||
select_output_environment (int n)
|
||||
{
|
||||
struct env *e = &envs[current_env_no];
|
||||
int old_env_no = current_env_no;
|
||||
@ -368,9 +161,233 @@ select_output_environment (n)
|
||||
return old_env_no;
|
||||
}
|
||||
|
||||
/* advance to the next environment number */
|
||||
/* 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. */
|
||||
static int
|
||||
setup_multitable_parameters (void)
|
||||
{
|
||||
char *params = insertion_stack->item_function;
|
||||
int nchars;
|
||||
float columnfrac;
|
||||
char command[200]; /* xx no fixed limits */
|
||||
int i = 1;
|
||||
|
||||
/* We implement @hsep and @vsep even though TeX doesn't.
|
||||
We don't get mixing of @columnfractions and templates right,
|
||||
but TeX doesn't either. */
|
||||
hsep = vsep = 0;
|
||||
|
||||
/* Assume no @columnfractions per default. */
|
||||
seen_column_fractions = 0;
|
||||
|
||||
while (*params) {
|
||||
while (whitespace (*params))
|
||||
params++;
|
||||
|
||||
if (*params == '@') {
|
||||
sscanf (params, "%200s", command);
|
||||
nchars = strlen (command);
|
||||
params += nchars;
|
||||
if (strcmp (command, "@hsep") == 0)
|
||||
hsep++;
|
||||
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++) {
|
||||
if (sscanf (params, "%f", &columnfrac) < 1)
|
||||
goto done;
|
||||
/* Unfortunately, can't use %n since m68k-hp-bsd libc (at least)
|
||||
doesn't support it. So skip whitespace (preceding the
|
||||
number) and then non-whitespace (the number). */
|
||||
while (*params && (*params == ' ' || *params == '\t'))
|
||||
params++;
|
||||
/* Hmm, but what about @columnfractions 3foo. Oh well,
|
||||
it's invalid input anyway. */
|
||||
while (*params && *params != ' ' && *params != '\t'
|
||||
&& *params != '\n' && *params != '@')
|
||||
params++;
|
||||
|
||||
{
|
||||
/* 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);
|
||||
|
||||
} else {
|
||||
warning (_("ignoring stray text `%s' after @multitable"), params);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
flush_output ();
|
||||
inhibit_output_flushing ();
|
||||
|
||||
last_column = i - 1;
|
||||
return last_column;
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw_horizontal_separator (void)
|
||||
{
|
||||
int i, j, s;
|
||||
|
||||
if (html)
|
||||
{
|
||||
add_word ("<hr>");
|
||||
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 (' ');
|
||||
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 <br>s inserted
|
||||
to help non-tables browsers. `@item' inserts a <tr> and `@tab'
|
||||
inserts <td>; we also try to close <tr>. The only real
|
||||
alternative is to rely on the info formatting engine and present
|
||||
preformatted text. */
|
||||
|
||||
void
|
||||
nselect_next_environment ()
|
||||
do_multitable (void)
|
||||
{
|
||||
int ncolumns;
|
||||
|
||||
if (multitable_active)
|
||||
{
|
||||
line_error ("Multitables cannot be nested");
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/* <p> for non-tables browsers. @multitable implicitly ends the
|
||||
current paragraph, so this is ok. */
|
||||
if (html)
|
||||
add_html_block_elt ("<p><table summary=\"\">");
|
||||
/* else if (docbook)*/ /* 05-08 */
|
||||
else if (xml)
|
||||
{
|
||||
int *widths = xmalloc (ncolumns * sizeof (int));
|
||||
int i;
|
||||
for (i=0; i<ncolumns; i++)
|
||||
widths[i] = envs[i+1].fill_column;
|
||||
xml_begin_multitable (ncolumns, widths);
|
||||
free (widths);
|
||||
}
|
||||
|
||||
if (hsep)
|
||||
draw_horizontal_separator ();
|
||||
|
||||
/* The next @item command will direct stdout into the first column
|
||||
and start processing. @tab will then switch to the next column,
|
||||
and @item will flush out the saved output and return to the first
|
||||
column. Environment #1 is the first column. (Environment #0 is
|
||||
the normal output) */
|
||||
|
||||
++multitable_active;
|
||||
}
|
||||
|
||||
/* advance to the next environment number */
|
||||
static void
|
||||
nselect_next_environment (void)
|
||||
{
|
||||
if (current_env_no >= 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 ("<br></td></tr>"); /* <br> for non-tables browsers. */
|
||||
add_word ("<tr align=\"left\"><td valign=\"top\">");
|
||||
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)
|
||||
/* <br> for non-tables browsers. */
|
||||
add_word_args ("<br></%s></tr>", after_headitem ? "th" : "td");
|
||||
|
||||
if (seen_column_fractions)
|
||||
add_word_args ("<tr align=\"left\"><%s valign=\"top\" width=\"%d%%\">",
|
||||
headitem_flag ? "th" : "td",
|
||||
envs[current_column_no].fill_column);
|
||||
else
|
||||
add_word_args ("<tr align=\"left\"><%s valign=\"top\">",
|
||||
headitem_flag ? "th" : "td");
|
||||
|
||||
if (headitem_flag)
|
||||
after_headitem = 1;
|
||||
else
|
||||
after_headitem = 0;
|
||||
first_row = 0;
|
||||
headitem_row = headitem_flag;
|
||||
headitem_flag = 0;
|
||||
return 0;
|
||||
}
|
||||
/* else if (docbook)*/ /* 05-08 */
|
||||
else if (xml)
|
||||
{
|
||||
xml_end_multitable_row (first_row);
|
||||
if (headitem_flag)
|
||||
after_headitem = 1;
|
||||
else
|
||||
after_headitem = 0;
|
||||
first_row = 0;
|
||||
headitem_flag = 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 ();
|
||||
|
||||
if (headitem_flag)
|
||||
hsep = 1;
|
||||
else
|
||||
hsep = 0;
|
||||
|
||||
if (headitem_flag)
|
||||
after_headitem = 1;
|
||||
else
|
||||
after_headitem = 0;
|
||||
headitem_flag = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef CHAR_AT
|
||||
#undef CHAR_ADDR
|
||||
|
||||
/* select a new column in current row of multitable */
|
||||
void
|
||||
cm_tab ()
|
||||
cm_tab (void)
|
||||
{
|
||||
if (!multitable_active)
|
||||
error (_("ignoring @tab outside of multitable"));
|
||||
|
||||
current_column_no++;
|
||||
|
||||
if (html)
|
||||
add_word ("</td><td valign=\"top\">");
|
||||
{
|
||||
if (seen_column_fractions)
|
||||
add_word_args ("</%s><%s valign=\"top\" width=\"%d%%\">",
|
||||
headitem_row ? "th" : "td",
|
||||
headitem_row ? "th" : "td",
|
||||
envs[current_column_no].fill_column);
|
||||
else
|
||||
add_word_args ("</%s><%s valign=\"top\">",
|
||||
headitem_row ? "th" : "td",
|
||||
headitem_row ? "th" : "td");
|
||||
}
|
||||
/* else if (docbook)*/ /* 05-08 */
|
||||
else if (xml)
|
||||
xml_end_multitable_column ();
|
||||
@ -544,7 +609,7 @@ cm_tab ()
|
||||
/* close a multitable, flushing its output and resetting
|
||||
whatever needs resetting */
|
||||
void
|
||||
end_multitable ()
|
||||
end_multitable (void)
|
||||
{
|
||||
if (!html && !docbook)
|
||||
output_multitable_row ();
|
||||
@ -558,7 +623,7 @@ end_multitable ()
|
||||
close_insertion_paragraph ();
|
||||
|
||||
if (html)
|
||||
add_word ("<br></td></tr></table>\n");
|
||||
add_word_args ("<br></%s></tr></table>\n", headitem_row ? "th" : "td");
|
||||
/* else if (docbook)*/ /* 05-08 */
|
||||
else if (xml)
|
||||
xml_end_multitable ();
|
||||
|
28
contrib/texinfo/makeinfo/multi.h
Normal file
28
contrib/texinfo/makeinfo/multi.h
Normal file
@ -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 */
|
@ -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 <a name="..."></a> 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 ("<a name=\"");
|
||||
add_anchor_name (otem, -1); /* old anchor name conversion */
|
||||
add_word ("\"></a>\n");
|
||||
}
|
||||
free (otem);
|
||||
}
|
||||
|
||||
/* Always output the new scheme. */
|
||||
canon_white (tem);
|
||||
add_word ("<a name=\"");
|
||||
add_anchor_name (tem, 0);
|
||||
add_word ("\"></a>\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 ("<a name=\"");
|
||||
tem = expand_node_name (node);
|
||||
add_anchor_name (tem, 0);
|
||||
add_word ("\"></a>");
|
||||
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 ("<div class=\"node\">\n");
|
||||
add_html_block_elt ("<div class=\"node\">\n");
|
||||
/* The <p> avoids the links area running on with old Lynxen. */
|
||||
add_word_args ("<p>%s\n", splitting ? "" : "<hr>");
|
||||
add_word_args ("%s%s<a name=\"", _("Node:"), " ");
|
||||
tem = expand_node_name (node);
|
||||
add_anchor_name (tem, 0);
|
||||
add_word_args ("\">%s</a>", 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 ("<a rel=\"next\" accesskey=\"n\" href=\"");
|
||||
add_anchor_name (tem, 1);
|
||||
tem = escape_string (tem);
|
||||
add_word_args ("\">%s</a>", 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 ("<a rel=\"previous\" accesskey=\"p\" href=\"");
|
||||
add_anchor_name (tem, 1);
|
||||
tem = escape_string (tem);
|
||||
add_word_args ("\">%s</a>", 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 ("<a rel=\"up\" accesskey=\"u\" href=\"");
|
||||
add_anchor_name (tem, 1);
|
||||
tem = escape_string (tem);
|
||||
add_word_args ("\">%s</a>", tem);
|
||||
free (tem);
|
||||
}
|
||||
/* html fixxme: we want a `top' or `contents' link here. */
|
||||
|
||||
add_word_args ("\n%s<br>\n", splitting ? "<hr>" : "");
|
||||
add_word_args ("\n%s\n", splitting ? "<hr>" : "");
|
||||
add_word ("</div>\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);
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user