Remove GNU texinfo from base along with all info pages.
To be able to info pages consider installing texinfo from ports print/texinfo or via pkg: pkg install texinfo Differential Revision: https://reviews.freebsd.org/D1409 Reviewed by: emaste, imp (previous version) Relnotes: yes
This commit is contained in:
parent
de90b09a79
commit
2d2813618c
@ -260,7 +260,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
|
||||
DESTDIR= \
|
||||
BOOTSTRAPPING=${OSRELDATE} \
|
||||
SSP_CFLAGS= \
|
||||
MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
|
||||
MK_HTML=no NO_LINT=yes MK_MAN=no \
|
||||
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
|
||||
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
|
||||
MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
|
||||
@ -293,7 +293,7 @@ KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
|
||||
DESTDIR= \
|
||||
BOOTSTRAPPING=${OSRELDATE} \
|
||||
SSP_CFLAGS= \
|
||||
MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
|
||||
MK_HTML=no -DNO_LINT MK_MAN=no \
|
||||
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
|
||||
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
|
||||
|
||||
@ -438,7 +438,7 @@ LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
|
||||
MK_TESTS=no
|
||||
|
||||
LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
|
||||
MK_MAN=no MK_INFO=no MK_HTML=no
|
||||
MK_MAN=no MK_HTML=no
|
||||
LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} \
|
||||
MK_TOOLCHAIN=no ${IMAKE_INSTALL}
|
||||
.endif
|
||||
@ -590,7 +590,7 @@ _libraries:
|
||||
@echo ">>> stage 4.2: building libraries"
|
||||
@echo "--------------------------------------------------------------"
|
||||
${_+_}cd ${.CURDIR}; \
|
||||
${WMAKE} -DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
|
||||
${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \
|
||||
MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries
|
||||
_depend:
|
||||
@echo
|
||||
@ -784,9 +784,6 @@ __installcheck_UGID:
|
||||
#
|
||||
# Required install tools to be saved in a scratch dir for safety.
|
||||
#
|
||||
.if ${MK_INFO} != "no"
|
||||
_install-info= install-info
|
||||
.endif
|
||||
.if ${MK_ZONEINFO} != "no"
|
||||
_zoneinfo= zic tzsetup
|
||||
.endif
|
||||
@ -1367,11 +1364,6 @@ _share= share/syscons/scrnmaps
|
||||
_gcc_tools= gnu/usr.bin/cc/cc_tools
|
||||
.endif
|
||||
|
||||
.if ${MK_INFO} != "no"
|
||||
_texinfo= gnu/usr.bin/texinfo/libtxi \
|
||||
gnu/usr.bin/texinfo/makeinfo
|
||||
.endif
|
||||
|
||||
.if ${MK_RESCUE} != "no"
|
||||
_rescue= rescue/rescue
|
||||
.endif
|
||||
@ -1403,16 +1395,6 @@ build-tools: .MAKE
|
||||
${MAKE} DIRPRFX=${_tool}/ depend && \
|
||||
${MAKE} DIRPRFX=${_tool}/ all
|
||||
.endfor
|
||||
.for _tool in \
|
||||
${_texinfo}
|
||||
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
|
||||
cd ${.CURDIR}/${_tool} && \
|
||||
${MAKE} DIRPRFX=${_tool}/ obj && \
|
||||
${MAKE} DIRPRFX=${_tool}/ depend && \
|
||||
${MAKE} DIRPRFX=${_tool}/ all && \
|
||||
${MAKE} DIRPRFX=${_tool}/ install DESTDIR=${WORLDTMP}
|
||||
.endfor
|
||||
|
||||
|
||||
#
|
||||
# kernel-tools: Build kernel-building tools
|
||||
@ -1495,7 +1477,7 @@ NXBMAKE= ${NXBENV} ${MAKE} \
|
||||
MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
|
||||
MK_GDB=no MK_TESTS=no \
|
||||
SSP_CFLAGS= \
|
||||
MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
|
||||
MK_HTML=no NO_LINT=yes MK_MAN=no \
|
||||
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
|
||||
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
|
||||
MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
|
||||
@ -2024,7 +2006,7 @@ XDEV_CPUTYPE?=${CPUTYPE}
|
||||
XDEV_CPUTYPE?=${TARGET_CPUTYPE}
|
||||
.endif
|
||||
|
||||
NOFUN=-DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT \
|
||||
NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \
|
||||
MK_MAN=no MK_NLS=no MK_PROFILE=no \
|
||||
MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \
|
||||
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
||||
|
@ -38,6 +38,38 @@
|
||||
# xargs -n1 | sort | uniq -d;
|
||||
# done
|
||||
|
||||
# 20150103: removal of texinfo
|
||||
OLD_FILES+=usr/bin/info
|
||||
OLD_FILES+=usr/bin/infokey
|
||||
OLD_FILES+=usr/bin/install-info
|
||||
OLD_FILES+=usr/bin/makeinfo
|
||||
OLD_FILES+=usr/bin/texindex
|
||||
OLD_FILES+=usr/share/info/am-utils.info.gz
|
||||
OLD_FILES+=usr/share/info/as-utils.info.gz
|
||||
OLD_FILES+=usr/share/info/binutils.info.gz
|
||||
OLD_FILES+=usr/share/info/com_err.info.gz
|
||||
OLD_FILES+=usr/share/info/diff.info.gz
|
||||
OLD_FILES+=usr/share/info/gdb.info.gz
|
||||
OLD_FILES+=usr/share/info/gdbint.info.gz
|
||||
OLD_FILES+=usr/share/info/gperf.info.gz
|
||||
OLD_FILES+=usr/share/info/grep.info.gz
|
||||
OLD_FILES+=usr/share/info/groff.info.gz
|
||||
OLD_FILES+=usr/share/info/heimdal.info.gz
|
||||
OLD_FILES+=usr/share/info/history.info.gz
|
||||
OLD_FILES+=usr/share/info/info-stnd.info.gz
|
||||
OLD_FILES+=usr/share/info/info.info.gz
|
||||
OLD_FILES+=usr/share/info/ld.info.gz
|
||||
OLD_FILES+=usr/share/info/regex.info.gz
|
||||
OLD_FILES+=usr/share/info/rluserman.info.gz
|
||||
OLD_FILES+=usr/share/info/stabs.info.gz
|
||||
OLD_FILES+=usr/share/info/texinfo.info.gz
|
||||
OLD_FILES+=usr/share/man/man1/info.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/infokey.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/install-info.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/makeinfo.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/texindex.1.gz
|
||||
OLD_FILES+=usr/share/man/man5/info.5.gz
|
||||
OLD_FILES+=usr/share/man/man5/texinfo.5.gz
|
||||
# 20141231: new clang import which bumps version from 3.4.1 to 3.5.0.
|
||||
OLD_FILES+=usr/include/clang/3.4.1/__wmmintrin_aes.h
|
||||
OLD_FILES+=usr/include/clang/3.4.1/__wmmintrin_pclmul.h
|
||||
|
5
UPDATING
5
UPDATING
@ -31,6 +31,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
|
||||
disable the most expensive debugging functionality run
|
||||
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
||||
|
||||
20150102:
|
||||
The GNU texinfo and GNU info pages have been removed.
|
||||
To be able to view GNU info pages please install texinfo from ports.
|
||||
|
||||
20141231:
|
||||
Clang, llvm and lldb have been upgraded to 3.5.0 release.
|
||||
|
||||
@ -176,6 +180,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
|
||||
The GNU texinfo and GNU info pages are not built and installed
|
||||
anymore, WITH_INFO knob has been added to allow to built and install
|
||||
them again.
|
||||
UPDATE: see 20150102 entry on texinfo's removal
|
||||
|
||||
20140708:
|
||||
The GNU readline library is now an INTERNALLIB - that is, it is
|
||||
|
@ -1,31 +0,0 @@
|
||||
$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.
|
||||
|
||||
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 the Texinfo distribution are copied from other
|
||||
locations, no author information is given for those. See util/srclist*.
|
@ -1,340 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 of the License, 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
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,57 +0,0 @@
|
||||
$FreeBSD$
|
||||
*/ABOUT-NLS
|
||||
*/INSTALL.generic
|
||||
*/Makefile.am
|
||||
*/Makefile.in
|
||||
*/acinclude.m4
|
||||
*/aclocal.m4
|
||||
*/config.guess
|
||||
*/config.rpath
|
||||
*/config.sub
|
||||
*/configure
|
||||
*/configure.ac
|
||||
*/depcomp
|
||||
*/dir-example
|
||||
*/djgpp/*
|
||||
*/doc/*.tex
|
||||
*/doc/macro.texi
|
||||
*/doc/mdate-sh
|
||||
*/doc/stamp-*
|
||||
*/doc/texi2dvi.1
|
||||
*/doc/userdoc.texi
|
||||
*/info/makedoc.c
|
||||
*/info/pcterm.c
|
||||
*/install-sh
|
||||
*/intl/*
|
||||
*/lib/alloca.c
|
||||
*/lib/getopt*
|
||||
*/lib/memcpy.c
|
||||
*/lib/memmove.c
|
||||
*/lib/mkstemp.c
|
||||
*/lib/strcase.h
|
||||
*/lib/strcasecmp.c
|
||||
*/lib/strdup.*
|
||||
*/lib/strerror.c
|
||||
*/lib/strncasecmp.c
|
||||
*/lib/tempname.c
|
||||
*/m4/*
|
||||
*/makeinfo/tests
|
||||
*/missing
|
||||
*/mkinstalldirs
|
||||
*/po/*
|
||||
*/util/*awk
|
||||
*/util/deref.c
|
||||
*/util/fix*
|
||||
*/util/gdoc
|
||||
*/util/gen-dir-node
|
||||
*/util/gendocs*
|
||||
*/util/infosrch
|
||||
*/util/install-info-html
|
||||
*/util/tex3patch
|
||||
*/util/texi-docstring-magic.el
|
||||
*/util/texi2dvi
|
||||
*/util/texi2pdf
|
||||
*/util/texinfo-cat.in
|
||||
*/util/texinfo.dtd
|
||||
*/util/texinfo.xsl
|
||||
*/util/txitextest
|
@ -1,42 +0,0 @@
|
||||
# ex:ts=8
|
||||
$FreeBSD$
|
||||
|
||||
GNU Texinfo 4.8
|
||||
originals can be found at: ftp://ftp.gnu.org/gnu/texinfo/
|
||||
|
||||
|
||||
For the import of Texinfo many files and directories were pruned by:
|
||||
|
||||
tar -X FREEBSD-Xlist -xyf texinfo-4.8.tar.bz2
|
||||
|
||||
|
||||
To reduce the size of import, and to make it so the changes from 3.12
|
||||
to 4.8 are easy to determine, the 4.8 directory structure was munged
|
||||
before import:
|
||||
|
||||
cd texinfo-4.8
|
||||
mv config.in config.h.in
|
||||
|
||||
|
||||
Then imported by:
|
||||
|
||||
cvs import -m 'Import of stripped down GNU texinfo 4.8' \
|
||||
src/contrib/texinfo FSF v4_8
|
||||
|
||||
After the import, a separate extraction of texinfo was GNU configured
|
||||
in the "normal" way. The resulting config.h file should be compared
|
||||
with src/contrib/texinfo/config.h, and src/contrib/texinfo/config.h
|
||||
updated as needed.
|
||||
|
||||
To make local changes to texinfo, simply patch and commit to the main
|
||||
branch (aka HEAD). Never make local changes on the vendor (FSF) branch.
|
||||
|
||||
All local changes should be submitted to the FSF for inclusion in the
|
||||
next vendor release.
|
||||
|
||||
ru@FreeBSD.org
|
||||
23-May-2005
|
||||
|
||||
NOTE: The upstream fix to util/texindex.c which fixes CVE-2005-3011
|
||||
(FreeBSD-SA-06:01.texindex) causes temporary files to not be removed
|
||||
when handling very large inputs. FreeBSD's fix works.
|
@ -1,45 +0,0 @@
|
||||
$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
|
||||
notice and this notice are preserved.
|
||||
|
||||
For generic installation instructions on compiling and installing this
|
||||
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.
|
||||
|
||||
* You can create a file texinfo.cnf to be read by TeX when
|
||||
processing Texinfo manuals. For example, you might like to use
|
||||
@afourpaper by default. See the `Preparing for TeX' node in
|
||||
texinfo.txi for more details. You don't have to create the file if
|
||||
you have nothing to put in it.
|
||||
|
||||
* 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.
|
@ -1,108 +0,0 @@
|
||||
$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
|
||||
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.
|
||||
|
||||
|
||||
|
||||
Getting Started with Texinfo
|
||||
============================
|
||||
|
||||
"Texinfo" is a documentation system that uses a single source file to
|
||||
produce both on-line information and printed output. Using Texinfo,
|
||||
you can create a printed document with the normal features of a book,
|
||||
including chapters, sections, cross references, and indices. From the
|
||||
same Texinfo source file, you can create a menu-driven, on-line Info
|
||||
file with nodes, menus, cross references, and indices.
|
||||
|
||||
The name of the Texinfo source documentation file is `texinfo.txi'.
|
||||
You can produce both on-line information and printed output from this
|
||||
source file. The documentation describes Texinfo in detail, including
|
||||
how to write Texinfo files, how to format them for both hard copy and
|
||||
Info, and how to install Info files.
|
||||
|
||||
To get started, you need to create either a printed manual or an
|
||||
on-line Info file from the `texinfo.txi' file. You do not need to
|
||||
create both, although you will probably want both eventually.
|
||||
|
||||
To learn how to use Info, read the info documentation. You can do this in
|
||||
one of two ways: using the standalone `info' program, or using Info mode in
|
||||
GNU Emacs.
|
||||
|
||||
* If you want to use the `info' program, run
|
||||
|
||||
info -f info-stnd
|
||||
|
||||
* If you want to use Emacs, start up emacs and type `C-h i' [M-x info].
|
||||
Follow the instructions to learn how to use Info.
|
||||
|
||||
After learning how to use Info, you can read the Texinfo documentation.
|
||||
Using the standalone `info', type the following at the shell prompt:
|
||||
|
||||
info -f texinfo
|
||||
|
||||
To use read this manual in Emacs, you first need to edit the Info-directory
|
||||
menu (the file `dir' in the system info directory) to contain the
|
||||
appropriate node. To learn how to do this, see node: Add in the Info
|
||||
documentation.
|
||||
|
||||
The Texinfo documentation describes Texinfo in detail; among other things,
|
||||
it tells how to install Info files in the usual manner. (See node: Install
|
||||
an Info File.)
|
||||
|
||||
The `info-stnd.info' file describes the standalone Info reader in detail. To
|
||||
read this file, type
|
||||
|
||||
$ info -f info-stnd
|
||||
|
||||
|
||||
To create a printed manual
|
||||
==========================
|
||||
|
||||
You need:
|
||||
|
||||
* The `tex' program, which typesets the manual using TeX.
|
||||
* The `texinfo.tex' definition file that tells TeX how to typeset
|
||||
a Texinfo file.
|
||||
* The `texindex' program, which sorts the unsorted index files
|
||||
created by TeX.
|
||||
* A printing program such as `lp' or `lpr',
|
||||
* A printer.
|
||||
|
||||
This Texinfo distribution package contains `texinfo.tex', the C source
|
||||
for `texindex', and the handy shell script `texi2dvi'. The `tex'
|
||||
program is not part of this distribution, but is available separately.
|
||||
(See `How to Obtain TeX' in the Texinfo documentation.)
|
||||
|
||||
* Install `tex'. (`texindex' is installed automagically by
|
||||
`make install' in this distribution.)
|
||||
|
||||
* Move the `texinfo.tex' file to an appropriate directory; the current
|
||||
directory will do. (`/usr/local/lib/tex/inputs' might be a good place.
|
||||
See ``Preparing to Use TeX'' in the Texinfo manual, for more
|
||||
information.)
|
||||
|
||||
After following those instructions, type the following to make the .dvi
|
||||
files:
|
||||
|
||||
$ (cd doc; make dvi)
|
||||
|
||||
You can then print the resulting .dvi files with the `lpr' or `lp'
|
||||
commands, or maybe `dvips'.
|
||||
|
||||
For example, the command to print the texinfo.dvi file might be:
|
||||
|
||||
$ lpr -d texinfo.dvi
|
||||
|
||||
The name of the printing command depends on the system; `lpr -d' is
|
||||
common, and is illustrated here. You may use a different name for the
|
||||
printing command.
|
||||
|
||||
Please report bugs to bug-texinfo@gnu.org.
|
||||
|
||||
Happy formatting.
|
@ -1,728 +0,0 @@
|
||||
$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,
|
||||
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
|
||||
notice and this notice are preserved.
|
||||
|
||||
|
||||
*** IMPORTANT NEWS FOR ALL AUTHORS OF TEXINFO MANUALS ***
|
||||
|
||||
As of version 4.2, Texinfo has a new command @copying to define the
|
||||
copyright and copying permissions for a manual. It's important to
|
||||
switch to using it as soon as possible (as in your next release),
|
||||
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://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.
|
||||
. new command @dofirstparagraphindent to control whether the first
|
||||
paragraph following a section heading is indented. Default is to
|
||||
omit this indentation, unlike the output up to now.
|
||||
. new command @indent for explicitly indenting a paragraph.
|
||||
. makeinfo writes a new construct for @image in Info output, so that
|
||||
graphical Info browsers (such as Emacs Info under X) can display an
|
||||
actual image. (Standalone Info ignores this, since it runs in a tty.)
|
||||
* makeinfo:
|
||||
. Common:
|
||||
- search for image files in the include file search path.
|
||||
- warns if @value is used on an undefined variable.
|
||||
. Info output:
|
||||
- default --split-size now 300,000 bytes, up from 50,000.
|
||||
- with --enable-encoding and a given @documentencoding,
|
||||
output a Local Variables section specifying that encoding, for use
|
||||
with Emacs.
|
||||
. HTML output:
|
||||
- uses <h3> at the smallest.
|
||||
- a few css <style> definitions are included to better
|
||||
implement @format, @display, @small..., etc.
|
||||
- new option --css-include=FILE includes FILE in the <style>.
|
||||
- @cartouche now outputs a <table> with a border.
|
||||
* texinfo.tex:
|
||||
. new Polish translation txi-pl.tex.
|
||||
* texi2dvi:
|
||||
. --command=CMD replaces --texinfo=CMD; it inserts CMD at the first
|
||||
line of LaTeX files now, or after the @setfilename for Texinfo files.
|
||||
* info:
|
||||
. RET now goes to the nearest xref (rather like Emacs Info),
|
||||
instead of the next xref starting on the current line.
|
||||
* Distribution:
|
||||
. new Romanian (ro) translation.
|
||||
. variables now declared const where appropriate.
|
||||
. gettext 0.12.1, automake 1.7.5.
|
||||
|
||||
|
||||
4.5 (4 February 2003)
|
||||
* info:
|
||||
. a bug in 4.4 prevented compressed info files from being found.
|
||||
* Distribution:
|
||||
. detect sys/ptem.h on Solaris.
|
||||
|
||||
|
||||
4.4 (31 January 2003)
|
||||
* Language:
|
||||
. The ' (ASCII apostrophe/right quote) character is finally allowed in
|
||||
node and anchor names. Thus, after installing this texinfo.tex,
|
||||
existing .aux files will cause errors! Remove them and rerun TeX to
|
||||
generate good ones.
|
||||
. @value constructs are now expanded in the filename arguments to
|
||||
@include and @verbatiminclude.
|
||||
* makeinfo:
|
||||
. @macro names may no longer include ^ or _, for the sake of math mode.
|
||||
. bug fix: @copying text is now reflected in tag table positions;
|
||||
before, nodes may not have been found with a long-enough @copying.
|
||||
. bug fix: html @verb arg is quoted properly, and does not imply
|
||||
a paragraph break.
|
||||
* texinfo.tex:
|
||||
. @smallexample and the like now output in a smaller font (9pt) in all
|
||||
paper formats, not just @smallbook and @afourpaper.
|
||||
. new translation txi-tr.tex.
|
||||
. bug fix: <>| and other characters do not disappear when they are
|
||||
first on a line in @verbatim.
|
||||
* install-info:
|
||||
. bug fix: don't translate the `* Menu' info keyword.
|
||||
* info:
|
||||
. CTRL-H is treated like DEL in incremental search.
|
||||
. arrow keys once again work in isearch contexts under Solaris.
|
||||
* infokey:
|
||||
. use .info key bindings before defaults.
|
||||
. allow prefix keys to be disabled.
|
||||
* Distribution:
|
||||
. update to GNU FDL 1.2 (http://www.gnu.org/licenses/fdl.html).
|
||||
. getopt and other common library files updated from gnulib
|
||||
(http://savannah.gnu.org/projects/gnulib/).
|
||||
. autoconf 2.57, automake 1.7.2.
|
||||
|
||||
|
||||
4.3 (14 November 2002)
|
||||
* Language:
|
||||
. new command @tie{} to do a real tie (unbreakable interword space).
|
||||
* makeinfo:
|
||||
. html output for @defun and friends now has font changes.
|
||||
. html output has some class attributes.
|
||||
. xml and docbook output improved in many details.
|
||||
* texinfo.tex:
|
||||
. new Italian translations, txi-it.tex.
|
||||
. pdf bookmarks for unnumbered sections work.
|
||||
. type name for @defun and friends no longer extends into margin.
|
||||
* info:
|
||||
. automatic-footnotes now off by default, for emacs compatibility.
|
||||
. crash when MALLOC_CHECK_=2 fixed.
|
||||
* install-info:
|
||||
. new option --infodir synonym for --info-dir, for compatibility with
|
||||
the Debian install-info.
|
||||
. support for bzip2-compressed files.
|
||||
* texindex:
|
||||
. omit initial if the entire index is under one character.
|
||||
* Distribution:
|
||||
. development sources now available under CVS, see
|
||||
http://savannah.gnu.org/projects/texinfo/
|
||||
. Turkish message translation.
|
||||
. gettext 0.11.5, autoconf 2.54, automake 1.7.1.
|
||||
|
||||
|
||||
4.2 (1 April 2002)
|
||||
* Language:
|
||||
. new command @copying to define copying permissions. See above.
|
||||
. new conditionals @ifplaintext, @ifnotplaintext for the plain text
|
||||
(--no-headers) output format.
|
||||
. new command @\ to produce literal \ inside @math, since \ by itself
|
||||
no longer works.
|
||||
* makeinfo:
|
||||
. emit accesskey attributes for keyboard shortcuts to menu items.
|
||||
. @{even,every,odd}{footing,header} are ignored by makeinfo now, so
|
||||
they no longer need to be enclosed in @iftex.
|
||||
* texinfo.tex:
|
||||
. bug fix for pdf-format table of contents.
|
||||
* info:
|
||||
. bug fixes for -R (--raw-escapes).
|
||||
. --help shows short option names.
|
||||
* Distribution:
|
||||
. the doc.c, funs.h, and key.c files in info/ are no longer generated
|
||||
at make time, to appease Automake's make distcheck.
|
||||
. gettext 0.11.1, autoconf 2.53, automake 1.6 (with install-info kludge).
|
||||
|
||||
|
||||
4.1 (4 March 2002)
|
||||
* Language:
|
||||
. new commands @verbatim and @verb for printing verbatim inserts.
|
||||
. new command @verbatiminclude for verbatim include of files.
|
||||
. new environment @documentdescription for defining the HTML description.
|
||||
. new command @afivepaper for the A5 paper size.
|
||||
* makeinfo:
|
||||
. supports xml and docbook output.
|
||||
. supports HTML splitting by node, which is now the default.
|
||||
. new option --split-size to control maximum size of split info files.
|
||||
. new option --enable-encoding to enable
|
||||
* info:
|
||||
. user-specified key bindings supported.
|
||||
. ANSI escape sequences (as produced by groff) removed from man output
|
||||
by default; use --raw-escapes to let them through if your terminal
|
||||
supports them.
|
||||
. RET terminates incremental search normally.
|
||||
* texinfo.tex:
|
||||
. @math implies @tex, so all the usual plain TeX math is supported.
|
||||
. smaller fonts for @smallexample, in all page sizes.
|
||||
. improvements in the PDF support.
|
||||
* texi2dvi:
|
||||
. new option -o to explicitly specify output filename.
|
||||
* Distribution:
|
||||
. switch to GNU Free Documentation License (http://www.gnu.org/copyleft/).
|
||||
. update to GNU gettext 0.11, autoconf 2.52, and automake 1.5.
|
||||
. Danish, Swedish, and Hebrew message translations.
|
||||
|
||||
|
||||
4.0 (28 September 1999)
|
||||
* Language:
|
||||
. New command @anchor for cross references to arbitrary points.
|
||||
. New commands @documentlanguage sets the main document language,
|
||||
and @documentencoding sets the document input encoding (although not
|
||||
much is done yet with either).
|
||||
. New command @pagesizes allows limited control of text area for typesetting.
|
||||
. New command @acronym for abbreviations in all caps, such as `NASA'.
|
||||
. New command @alias for simple command aliases.
|
||||
. New command @definfoenclose for better control of info output.
|
||||
. New commands @deftypeivar for typed instance variables of a class
|
||||
and @deftypeop for typed operations of a class.
|
||||
. New command @novalidate suppresses cross-reference checking and (in
|
||||
TeX) auxiliary file creation.
|
||||
. New commands @setcontentsaftertitlepage and
|
||||
@setshortcontentsaftertitlepage to force printing the table of
|
||||
contents after @end titlepage. Also, @contents and @shortcontents
|
||||
themselves can now appear at the beginning of the document as
|
||||
well as the end.
|
||||
. New markup commands: @env (for environment variables), @command (for
|
||||
command names), @option (for command-line options).
|
||||
. New commands @smallformat and @smalldisplay, a la @smallexample.
|
||||
. New command @exampleindent to set indentation of example-like
|
||||
environments a la @paragraphindent.
|
||||
. @uref takes an optional third argument of text to show instead of
|
||||
(rather than in addition to) the url for info and dvi output.
|
||||
. @footnote works in an @item for a @table.
|
||||
* texinfo.tex:
|
||||
. latest version always at ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex
|
||||
(and mirrors).
|
||||
. implements @macro.
|
||||
. implements @paragraphindent (except asis).
|
||||
. @emph and @i use true italic type (cmti) instead of slanted (cmsl).
|
||||
. implements pdf output when run with pdftex.
|
||||
. better support for internationalization via txi-??.tex files.
|
||||
. footnotes now set in a smaller point size.
|
||||
* makeinfo:
|
||||
. supports HTML output with the --html option.
|
||||
. implication of --html: @top nodes should be wrapped in @ifnottex
|
||||
rather than @ifinfo. @ifinfo conditionals are not expanded with --html.
|
||||
. new option --number-sections to output chapter/section numbers.
|
||||
. dashes and quotes are not treated specially in node names.
|
||||
. new option --commands-in-node-names to allow @-commands in node names.
|
||||
(Not implemented in TeX, and most likely never will be.)
|
||||
. @emph output uses _underscores_.
|
||||
. @image looks for .png files before .jpg.
|
||||
. only output `Making ... file' line when verbose.
|
||||
. allow -v as synonym for --verbose.
|
||||
. new command line options to specify which conditionals to process
|
||||
(but --iftex is not fully implemented).
|
||||
. warns if @var contains any of ,[]().
|
||||
. @quote-arg implicitly done for all one-argument macros, so commas in
|
||||
the argument text are allowed.
|
||||
. \\ required in macro body to get single \, no other `escapes' defined.
|
||||
* info:
|
||||
. ISO Latin 1 characters are displayed and input as-is by default.
|
||||
. new option --vi-keys to enable vi-like and less-like key bindings.
|
||||
. new command S does case-sensitive searching.
|
||||
. new commands C-x n and C-x N repeat last search, respectively, in the
|
||||
same and in reverse direction, without prompting for the string. These
|
||||
commands are bound to n and N under --vi-keys, like in Less.
|
||||
. new command G menu1 menu2 ... searches for menu items from (dir),
|
||||
as allowed on the command line.
|
||||
. new command O (capital o, not zero) goes directly to the node that
|
||||
describes command-line options.
|
||||
. new command-line option --show-options causes the node which
|
||||
describes command-line options to be the first node displayed.
|
||||
. M-prior and M-DEL do new command info-scroll-other-window-backward.
|
||||
. / searches like s does.
|
||||
. If the search string includes upper-case letters, in both incremental
|
||||
and non-incremental search, the search is case-sensitive.
|
||||
. S searches case-sensitively even if the search string is all
|
||||
lower-case.
|
||||
. - makes the argument negative (so e.g. `- /' searches backward).
|
||||
. l restores point in the window returned to.
|
||||
. SPC/DEL do not move outside the current document.
|
||||
. foo.info is found before foo.
|
||||
. `info foo --index-search=bar' now searches for bar in foo's index.
|
||||
. support for files compressed with bzip2.
|
||||
* install-info:
|
||||
. handles gzipped dir files.
|
||||
. sort entries into alphabetical order.
|
||||
. install direntries only in preceding dircategory, not in all.
|
||||
. --delete does not require the info file to exist.
|
||||
. --delete can handle XEmacs-style dir entries.
|
||||
* texi2dvi:
|
||||
. bug fixed: now uses only the @iftex and @tex parts of the source.
|
||||
. process LaTeX source as well as Texinfo source.
|
||||
. output PDF (using pdftex) with new option --pdf.
|
||||
. handles --OPTION=ARG style of command line arguments.
|
||||
. new option --batch for progress reports but no interaction.
|
||||
. new option --clean to remove all auxiliary files.
|
||||
. new option --quiet for silence (unless there are errors).
|
||||
. new option -I for specifying directories for @include to search.
|
||||
. handles LaTeX files (running BibTeX etc.).
|
||||
* Fixes to util/gen-dir-node and util/fix-info-dir (formerly util/update-info).
|
||||
* Distribution:
|
||||
. Man pages included.
|
||||
. Czech and Norwegian message translations.
|
||||
. Various translations for texinfo.tex fixed words included.
|
||||
. DJGPP support.
|
||||
|
||||
|
||||
3.12 (3 March 1998)
|
||||
* Elisp files removed, since they are only usefully distributed with Emacs.
|
||||
* Restore inclusion of compile-time $(infodir) to INFOPATH.
|
||||
* install-info creates a proper dir file.
|
||||
* Various portability fixes.
|
||||
|
||||
|
||||
3.11 (31 July 1997)
|
||||
* New commands:
|
||||
- @uref to make a reference to a url; @url now only indicates such.
|
||||
- @image to include graphics (epsf for TeX).
|
||||
- @deftypemethod and @deftypemethodx to document methods in strongly
|
||||
typed object-oriented languages, such as C++.
|
||||
- @html for raw HTML.
|
||||
- @ifnothtml @ifnotinfo @ifnottex for more precise conditionals.
|
||||
- @kbdinputstyle to control when @kbd uses the slanted typewriter font.
|
||||
- @email takes second optional argument.
|
||||
* texinfo.tex reads texinfo.cnf (if present) for site-wide TeX
|
||||
configuration; for example, A4 paper sizes.
|
||||
* info:
|
||||
- arrow keys supported.
|
||||
- trailing : in INFOPATH appends default path.
|
||||
- new option --index-search for online help support.
|
||||
* makeinfo:
|
||||
- output files removed if errors unless (new option) --force.
|
||||
- new option -P to prepend to search path.
|
||||
- macro expansion file can be standard output.
|
||||
* install-info creates a new dir file if necessary.
|
||||
* update-info script to create a dir file from all info files.
|
||||
* Elisp: texnfo-tex.el and detexinfo.el removed from the distribution;
|
||||
- texnfo-tex features are now part of standard TeX & Texinfo packages;
|
||||
- makeinfo --no-headers does a better job than detexinfo.el.
|
||||
* Documentation:
|
||||
- Updates, revisions, corrections in the manual.
|
||||
- makeinfo.texi removed, as it was a copy of what was in texinfo.texi.
|
||||
* gettext support in sources, French and German translations included.
|
||||
* info man page removed; use the Texinfo manual.
|
||||
* Automake used, other portability fixes.
|
||||
|
||||
3.10 (nonexistent)
|
||||
|
||||
|
||||
3.9 (4 October 1996)
|
||||
* makeinfo:
|
||||
- Give a suppressible (with --no-validate) error for references
|
||||
outside of any node.
|
||||
- Keep track of multitable output correctly for split files; this
|
||||
caused nodes after the first multitable to be ``undefined''.
|
||||
* install-info:
|
||||
- Rename --infodir option to --info-dir.
|
||||
- More robust error checking to avoid various crashes.
|
||||
* configure: Include replacements for memcpy and memmove functions in
|
||||
the distribution, in case they are missing.
|
||||
|
||||
|
||||
3.8 (30 September 1996)
|
||||
* Define and/or document new and/or previously existing commands:
|
||||
Accents: @" @' @, @" @= @^ @` @~ @H @d @dotaccent @dotless @ringaccent
|
||||
@tieaccent @u @ubaraccent @v
|
||||
Special characters: @AA @AE @L @O @OE @aa @ae @exclamdown @l @o @oe
|
||||
@pounds @questiondown @ss
|
||||
Special punctuation: @! @? @enddots
|
||||
dir file maintenance: @dircategory @direntry; also new program, install-info
|
||||
HTML support: @email @url @ifhtml...@end ifhtml
|
||||
Macros: @macro @unmacro
|
||||
Tables: @multitable @tab
|
||||
Hyphenation: @- @hyphenation
|
||||
Spacing: @ @<TAB> @<NEWLINE>
|
||||
Sectioning:
|
||||
@headings singleafter/doubleafter (change heading style after current page)
|
||||
@centerchap
|
||||
@setchapterstyle
|
||||
Other:
|
||||
@shorttitlepage (simple title pages)
|
||||
@detailmenu...@end detailmenu (help makeinfo parse master menus)
|
||||
* Makeinfo prefers an input file named `foo.texinfo' or `foo.texi' or
|
||||
`foo.txinfo' to just `foo' (the latter most likely being an executable).
|
||||
* Makeinfo implements @. @! @? correctly, as end-of-sentence punctuation.
|
||||
* @key marks its argument with a lozenge in TeX and <...> in Info.
|
||||
* TeX output has substantially decreased interline spacing and other
|
||||
formatting changes.
|
||||
* Remove these obsolete and never-documented commands:
|
||||
@infotop
|
||||
@infoappendix @infoappendixsec @infoappendixsubsec @infoappendixsubsubsec
|
||||
@infochapter @infosection @infosubsection @infosubsubsection
|
||||
@infounnumbered @infounnumberedsec @infounnumberedsubsec
|
||||
@infounnumberedsubsubsec
|
||||
@input
|
||||
@smallbreak @medbreak
|
||||
@overfullrule
|
||||
@br
|
||||
* Deprecate these obsolete commands, to be removed in the next release:
|
||||
@ctrl
|
||||
@infoinclude
|
||||
@iappendix @iappendixsection @iappendixsec @iappendixsubsec
|
||||
@iappendixsubsubsec
|
||||
@ichapter @isection @isubsection @isubsubsection
|
||||
@iunnumbered @iunnumberedsec @iunnumberedsubsec @iunnumberedsubsubsec
|
||||
@setchapterstyle
|
||||
@titlespec
|
||||
|
||||
|
||||
3.7 (24 December 1995)
|
||||
* Have --version print texinfo release number as well as the individual
|
||||
program version.
|
||||
* Better man page cleaning.
|
||||
* Update Elisp files from current Emacs release.
|
||||
|
||||
|
||||
3.6 (21 June 1995)
|
||||
* Unmatched brace error reporting improved.
|
||||
* Missing comment terminator prevented compilation.
|
||||
|
||||
|
||||
3.5 (20 June 1995)
|
||||
* Autoconf update.
|
||||
* Support for parallel makes.
|
||||
* make install does not install Elisp files.
|
||||
|
||||
|
||||
3.4 (19 June 1995)
|
||||
* Handle @ifhtml in Elisp.
|
||||
* Update FSF address.
|
||||
|
||||
|
||||
3.3 (15 June 1995)
|
||||
* Portability changes.
|
||||
* Compile Elisp files.
|
||||
* Don't distribute .info* files.
|
||||
|
||||
|
||||
3.2 (9 June 1995)
|
||||
* Standalone Info can read Unix man pages.
|
||||
* New commands: @! @? @^ @" @enddots.
|
||||
* makeinfo -E does macro expansion (and nothing else).
|
||||
|
||||
|
||||
3.1 (23 May 1993)
|
||||
Just bug fixes, see ChangeLog for full details.
|
||||
|
||||
|
||||
3.0: first release of Texinfo version 2, with many new commands.
|
||||
|
||||
|
||||
|
||||
Here is the separate NEWS for old releases of Info:
|
||||
|
||||
Version 2.11, Sat Apr 1 09:15:21 1995
|
||||
|
||||
Changes since 2.7 beta:
|
||||
|
||||
Although the basic code remains the same, there are numerous nits
|
||||
fixed, including some display bugs, and a memory leak. Some changes
|
||||
that have taken place with larger impact include the way in which the
|
||||
(dir) node is built; I have added in support for "localdir"
|
||||
directories among other things. Info files may be stored in
|
||||
compressed formats, and in their own subdirectories; menu items which
|
||||
do not explicitly name the node to which they are attached have the
|
||||
menu item name looked up as an Info file if it is not found within the
|
||||
current document. This means that the menu item:
|
||||
|
||||
* Info:: The Info documentation reader.
|
||||
|
||||
in (dir) refers to the info node "(info)Top".
|
||||
|
||||
Please see the ChangeLog and documentation for details on other
|
||||
changes.
|
||||
|
||||
Version 2.7 beta, Wed Dec 30 02:02:38 1992
|
||||
Version 2.6 beta, Tue Dec 22 03:58:07 1992
|
||||
Version 2.5 beta, Tue Dec 8 14:50:35 1992
|
||||
Version 2.4 beta, Sat Nov 28 14:34:02 1992
|
||||
Version 2.3 beta, Fri Nov 27 01:04:13 1992
|
||||
Version 2.2 beta, Tue Nov 24 09:36:08 1992
|
||||
Version 2.1 beta, Tue Nov 17 23:29:36 1992
|
||||
|
||||
Changes since 2.5 beta:
|
||||
|
||||
Note that versions 2.6 and 2.7 Beta were only released to a select group.
|
||||
|
||||
* "info-" removed from the front of M-x commands.
|
||||
|
||||
* Automatic footnote display. When you enter a node which contains
|
||||
footnotes, and the variable "automatic-footnotes" is "On", Info pops
|
||||
up a window containing the footnotes. Likewise, when you leave that
|
||||
node, the window containing the footnotes goes away.
|
||||
|
||||
* Cleaner built in documentation, and documentation functions.
|
||||
|
||||
Use:
|
||||
o `M-x describe-variable' to read a variable's documenation
|
||||
o `M-x describe-key' to find out what a particular keystroke does.
|
||||
o `M-x describe-function' to read a function's documentation.
|
||||
o `M-x where-is' to find out what keys invoke a particular function.
|
||||
|
||||
* Info can "tile" the displayed windows (via "M-x tile-windows"). If
|
||||
the variable "automatic-tiling" is "On", then splitting a window or
|
||||
deleting a window causes the remaining windows to be retiled.
|
||||
|
||||
* You can save every keystroke you type in a "dribble file" by using the
|
||||
`--dribble FILENAME' option. You can initially read keystrokes from an
|
||||
alternate input stream with `--restore FILENAME', or by redirecting
|
||||
input on the command line `info < old-dribble'.
|
||||
|
||||
* New behaviour of menu items. If the label is the same as the
|
||||
target node name, and the node couldn't be found in the current file,
|
||||
treat the label as a file name. For example, a menu entry in "DIR"
|
||||
might contain:
|
||||
|
||||
* Emacs:: Cool text-editor.
|
||||
|
||||
Info would not find the node "(dir)Emacs", so just plain "(emacs)"
|
||||
would be tried.
|
||||
|
||||
* New variable "ISO-Latin" allows you to use European machines with
|
||||
8-bit character sets.
|
||||
|
||||
* Cleanups in echo area reading, and redisplay. Cleanups in handling the
|
||||
window which shows possible completions.
|
||||
|
||||
* Info can now read files that have been compressed. An array in filesys.c
|
||||
maps extensions to programs that can decompress stdin, and write the results
|
||||
to stdout. Currently, ".Z"/uncompress, ".z"/gunzip, and ".Y"/unyabba are
|
||||
supported. The modeline for a compressed file shows "zz" in it.
|
||||
|
||||
* There is a new variable "gc-compressed-files" which, if non-zero, says
|
||||
it is okay to reclaim the file buffer space allocated to a file which
|
||||
was compressed, if, and only if, that file's contents do not appear in
|
||||
any history node.
|
||||
|
||||
* New file `nodemenu.c' implements a few functions for manipulating
|
||||
previously visited nodes. `C-x C-b' (list-visited-nodes) produces a
|
||||
menu of the nodes that could be reached by info-history-node in some
|
||||
window. `C-x b' (select-visited-node) is similar, but reads one of
|
||||
the node names with completion.
|
||||
|
||||
* Keystroke `M-r' (move_to_screen_line) allows the user to place the cursor at
|
||||
the start of a specific screen line. Without a numeric argument, place the
|
||||
cursor on the center line; with an arg, place the cursor on that line.
|
||||
|
||||
* Interruptible display implemented. Basic display speedups and hacks.
|
||||
* The message "*** Tags Out of Date ***" now means what it says.
|
||||
* Index searching with `,' (info-index-next) has been improved.
|
||||
* When scrolling with C-v, C-M-v, or M-v, only "Page Only" scrolling
|
||||
will happen.
|
||||
|
||||
* Continous scrolling (along with `]' (info-global-next) and `['
|
||||
(info-global-prev) works better. `]' and `[' accept numeric
|
||||
arguments, moving that many nodes in that case.
|
||||
|
||||
* `C-x w' (info-toggle-wrap) controls how lines wider than the width
|
||||
of the screen are displayed. If a line is too long, a `$' is
|
||||
displayed in the rightmost column of the window.
|
||||
|
||||
* There are some new variables for controlling the behaviour of Info
|
||||
interactively. The current list of variables is as follows:
|
||||
|
||||
Variable Name Default Value Description
|
||||
------------- ------------- -----------
|
||||
`automatic-footnotes' On When "On", footnotes appear and
|
||||
disappear automatically.
|
||||
|
||||
`automatic-tiling' Off When "On", creating of deleting a
|
||||
window resizes other windows.
|
||||
|
||||
`visible-bell' Off If non-zero, try to use a visible bell.
|
||||
|
||||
`errors-ring-bell' On If non-zero, errors cause a ring.
|
||||
|
||||
`show-index-match' On If non-zero, the portion of the string
|
||||
matched is highlighted by changing its
|
||||
case.
|
||||
|
||||
`scroll-behaviour' Continuous One of "Continuous", "Next Only", or
|
||||
"Page Only". "Page Only" prevents you from
|
||||
scrolling past the bottom or top of a node.
|
||||
"Next Only" causes the Next or Prev node to
|
||||
be selected when you scroll past the bottom
|
||||
or top of a node. "Continous" moves
|
||||
linearly through the files hierchichal
|
||||
structure.
|
||||
|
||||
`scroll-step' 0 Controls how scrolling is done for you when
|
||||
the cursor moves out of the current window.
|
||||
Non-zero means it is the number of lines
|
||||
you would like the screen to shift. A
|
||||
value of 0 means to center the line
|
||||
containing the cursor in the window.
|
||||
|
||||
`gc-compressed-files' Off If non-zero means it is okay to reclaim the
|
||||
file buffer space allocated to a file which
|
||||
was compressed, if, and only if, that
|
||||
file's contents do not appear in the node
|
||||
list of any window.
|
||||
|
||||
`ISO-Latin' Off Non-zero means that you are using an ISO
|
||||
Latin character set. By default, standard
|
||||
ASCII characters are assumed.
|
||||
________________________________________
|
||||
This release of Info is version 2.5 beta.
|
||||
|
||||
Changes since 2.4 beta:
|
||||
|
||||
* Index (i) and (,) commands fully implemented.
|
||||
* "configure" script now shipped with Info.
|
||||
* New function "set-variable" allows users to set various variables.
|
||||
* User-settable behaviour on end or beginning of node scrolling. This
|
||||
supercedes the SPC and DEL changes in 2.3 beta.
|
||||
|
||||
________________________________________
|
||||
This release of Info is version 2.4 beta.
|
||||
|
||||
Changes since 2.3 beta:
|
||||
|
||||
* info-last-node now means move to the last node of this info file.
|
||||
* info-history-node means move backwards through this window's node history.
|
||||
* info-first-node moves to the first node in the Info file. This node is
|
||||
not necessarily "Top"!
|
||||
* SPC and DEL can select the Next or Prev node after printing an informative
|
||||
message when pressed at the end/beg of a node.
|
||||
|
||||
----------------------------------------
|
||||
This release of Info is version 2.3 beta.
|
||||
|
||||
Changes since 2.2 beta:
|
||||
|
||||
* M-x command lines if NAMED_COMMANDS is #defined. Variable in Makefile.
|
||||
* Screen height changes made quite robust.
|
||||
* Interactive function "set-screen-height" implements user height changes.
|
||||
* Scrolling on some terminals is faster now.
|
||||
* C-l with numeric arguement is fixed.
|
||||
|
||||
----------------------------------------
|
||||
This release of Info is version 2.2 beta.
|
||||
|
||||
Changes since 2.0:
|
||||
|
||||
* C-g can now interrupt multi-file searches.
|
||||
* Incremental search is fully implemented.
|
||||
* Loading large tag tables is much faster now.
|
||||
* makedoc.c replaces shell script, speeding incremental builds.
|
||||
* Scrolling in redisplay is implemented.
|
||||
* Recursive uses of the echo area made more robust.
|
||||
* Garbage collection of unreferenced nodes.
|
@ -1,112 +0,0 @@
|
||||
$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, 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
|
||||
notice and this notice are preserved.
|
||||
|
||||
See ./INSTALL* for installation instructions.
|
||||
|
||||
Primary distribution point: ftp://ftp.gnu.org/gnu/texinfo/
|
||||
(list of mirrors at: http://www.gnu.org/prep/ftp.html)
|
||||
|
||||
Home page: http://www.gnu.org/software/texinfo/
|
||||
(list of mirrors at: http://www.gnu.org/server/list-mirrors.html)
|
||||
This page includes links to other Texinfo-related programs.
|
||||
|
||||
Mailing lists and archives:
|
||||
- bug-texinfo@gnu.org for bug reports or enhancement suggestions,
|
||||
archive: http://mail.gnu.org/pipermail/bug-texinfo
|
||||
- help-texinfo@gnu.org for authoring questions and general discussion,
|
||||
archive: http://mail.gnu.org/pipermail/help-texinfo
|
||||
- texinfo-pretest@texinfo.org for pretests of new releases,
|
||||
archive: http://texinfo.org/ftp/texinfo-pretest-archive
|
||||
There are no corresponding newsgroups.
|
||||
|
||||
Bug reports:
|
||||
please include enough information for the maintainers to reproduce the
|
||||
problem. Generally speaking, that means:
|
||||
- the contents of any input files necessary to reproduce the bug (crucial!).
|
||||
- a description of the problem and any samples of the erroneous output.
|
||||
- the version number of Texinfo and the program(s) involved (use --version).
|
||||
- hardware, operating system, and compiler versions (uname -a).
|
||||
- unusual options you gave to configure, if any (see config.status).
|
||||
- anything else that you think would be helpful.
|
||||
|
||||
Patches are most welcome; if possible, please make them with diff -c and
|
||||
include ChangeLog entries.
|
||||
|
||||
When sending email, please do not encode or split the messages in any
|
||||
way if at all possible; it's easier to deal with one large message than
|
||||
many small ones. GNU shar (http://www.gnu.org/software/sharutils/) is a
|
||||
convenient way of packaging multiple and/or binary files for email.
|
||||
|
||||
See README.dev for information on the Texinfo development environment --
|
||||
any interested parties are welcome. If you're a programmer and wish to
|
||||
contribute, this should get you started. And if you're not a
|
||||
programmer, you can still make significant contributions by writing test
|
||||
cases, checking the documentation against the implementation, etc.
|
||||
|
||||
This distribution includes the following files, among others:
|
||||
README This file.
|
||||
README.dev Texinfo developer information.
|
||||
|
||||
INSTALL Texinfo-specific installation notes.
|
||||
NEWS Summary of new features by release.
|
||||
INTRODUCTION Brief introduction to the system, and
|
||||
how to create readable files from the
|
||||
Texinfo source files in this distribution.
|
||||
|
||||
Texinfo documentation files (in ./doc):
|
||||
texinfo.txi Describes the Texinfo language and many
|
||||
of the associated tools. It tells how
|
||||
to use Texinfo to write documentation,
|
||||
how to use Texinfo mode in GNU Emacs,
|
||||
TeX, makeinfo, and the Emacs Lisp
|
||||
Texinfo formatting commands.
|
||||
|
||||
info.texi This manual tells you how to use
|
||||
Info. This document also comes as part of
|
||||
GNU Emacs. If you do not have Emacs,
|
||||
you can format this Texinfo source
|
||||
file with makeinfo or TeX and then
|
||||
read the resulting Info file with the
|
||||
standalone Info reader that is part of
|
||||
this distribution.
|
||||
|
||||
info-stnd.texi This manual tells you how to use
|
||||
the standalone GNU Info reader that is
|
||||
included in this distribution as C
|
||||
source (./info).
|
||||
|
||||
Printing related files:
|
||||
doc/texinfo.tex This TeX definitions file tells
|
||||
the TeX program how to typeset a
|
||||
Texinfo file into a DVI file ready for
|
||||
printing.
|
||||
|
||||
util/texindex.c This file contains the source for
|
||||
the `texindex' program that generates
|
||||
sorted indices used by TeX when
|
||||
typesetting a file for printing.
|
||||
|
||||
util/texi2dvi This is a shell script for
|
||||
producing an indexed DVI file using
|
||||
TeX and texindex.
|
||||
|
||||
Source files for standalone C programs:
|
||||
./lib
|
||||
./makeinfo
|
||||
./info
|
||||
|
||||
Installation files:
|
||||
Makefile.am What Automake uses to make a Makefile.in.
|
||||
Makefile.in What `configure' uses to make a Makefile,
|
||||
created by Automake.
|
||||
configure.ac What Autoconf uses to create `configure'.
|
||||
configure Configuration script for local conditions,
|
||||
created by Autoconf.
|
@ -1,44 +0,0 @@
|
||||
$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,181 +0,0 @@
|
||||
$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, 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:
|
||||
- @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.
|
||||
- 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:
|
||||
- @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.
|
||||
- @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.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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 and index files. Eliminate all the crazy
|
||||
multiple redefinitions of every Texinfo command in different contexts.
|
||||
- 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?
|
||||
- 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
|
||||
the manual.
|
||||
- Improve the manuals, especially for makeinfo, standalone info, etc.
|
||||
- new section on doing dedication pages. See gawk.texi
|
||||
for an example of doing it in both the tex and info versions.
|
||||
|
||||
* Info:
|
||||
- Regular expression search.
|
||||
- Full-text search across all info files installed on the system.
|
||||
- Support character sets other than ISO Latin 1.
|
||||
- Perhaps comply with LANGUAGE setting on a per-node basis, to allow
|
||||
incremental translation of Texinfo files.
|
||||
- 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 saxinfo or tkinfo
|
||||
http://www.math.ucsb.edu/~boldt/tkinfo/
|
||||
- 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.
|
||||
|
||||
* install-info:
|
||||
- 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, 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:
|
||||
ftp://ftp.cs.berkeley.edu/ucb/people/phelps/tcltk/tkman.tar.Z, which
|
||||
uses Tcl/Tk 8.0 from ftp.smli.com in the /pub/tcl directory.
|
||||
From: phelps@ecstasy.CS.Berkeley.EDU (Tom Phelps)
|
||||
[This has the disadvantage of needing to be updated when the
|
||||
Texinfo language changes, so don't.]
|
||||
|
||||
- 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.
|
@ -1,422 +0,0 @@
|
||||
/* $FreeBSD$ */
|
||||
/* config.h. Generated by configure. */
|
||||
/* config.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
/* #undef CRAY_STACKSEG_END */
|
||||
|
||||
/* Define to 1 if using `alloca.c'. */
|
||||
/* #undef C_ALLOCA */
|
||||
|
||||
/* Define to 1 if translation of program messages to the user's native
|
||||
language is requested. */
|
||||
/* #undef ENABLE_NLS */
|
||||
|
||||
/* Define to 1 if `TIOCGWINSZ' requires <sys/ioctl.h>. */
|
||||
/* #undef GWINSZ_IN_SYS_IOCTL */
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||
*/
|
||||
/* #undef HAVE_ALLOCA_H */
|
||||
|
||||
/* Define to 1 if you have the <argz.h> header file. */
|
||||
/* #undef HAVE_ARGZ_H */
|
||||
|
||||
/* Define to 1 if you have the `asprintf' function. */
|
||||
#define HAVE_ASPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `bzero' function. */
|
||||
#define HAVE_BZERO 1
|
||||
|
||||
/* Define if the GNU dcgettext() function is already present or preinstalled.
|
||||
*/
|
||||
/* #undef HAVE_DCGETTEXT */
|
||||
|
||||
/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL_FEOF_UNLOCKED 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#define HAVE_DECL_FGETS_UNLOCKED 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL_GETC_UNLOCKED 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
|
||||
*/
|
||||
#define HAVE_DECL_GETENV 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `memchr', and to 0 if you don't.
|
||||
*/
|
||||
#define HAVE_DECL_MEMCHR 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `strcoll', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL_STRCOLL 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `strerror', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL_STRERROR 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL__SNPRINTF 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL__SNWPRINTF 0
|
||||
|
||||
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
|
||||
/* #undef HAVE_DOPRNT */
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the `fwprintf' function. */
|
||||
#define HAVE_FWPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `getcwd' function. */
|
||||
#define HAVE_GETCWD 1
|
||||
|
||||
/* Define to 1 if you have the `getegid' function. */
|
||||
#define HAVE_GETEGID 1
|
||||
|
||||
/* Define to 1 if you have the `geteuid' function. */
|
||||
#define HAVE_GETEUID 1
|
||||
|
||||
/* Define to 1 if you have the `getgid' function. */
|
||||
#define HAVE_GETGID 1
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
|
||||
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||
/* #undef HAVE_GETTEXT */
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
/* #undef HAVE_GETTIMEOFDAY */
|
||||
|
||||
/* Define to 1 if you have the `getuid' function. */
|
||||
#define HAVE_GETUID 1
|
||||
|
||||
/* Define if you have the iconv() function. */
|
||||
#define HAVE_ICONV 1
|
||||
|
||||
/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */
|
||||
#define HAVE_INTMAX_T 1
|
||||
|
||||
/* Define if <inttypes.h> exists and doesn't clash with <sys/types.h>. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
|
||||
declares uintmax_t. */
|
||||
#define HAVE_INTTYPES_H_WITH_UINTMAX 1
|
||||
|
||||
/* Define to 1 if you have the <io.h> header file. */
|
||||
/* #undef HAVE_IO_H */
|
||||
|
||||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
||||
#define HAVE_LANGINFO_CODESET 1
|
||||
|
||||
/* Define if your <locale.h> file defines LC_MESSAGES. */
|
||||
#define HAVE_LC_MESSAGES 1
|
||||
|
||||
/* Define to 1 if you have the `bsd' library (-lbsd). */
|
||||
/* #undef HAVE_LIBBSD */
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#define HAVE_LOCALE_H 1
|
||||
|
||||
/* Define if you have the 'long double' type. */
|
||||
#define HAVE_LONG_DOUBLE 1
|
||||
|
||||
/* Define if you have the 'long long' type. */
|
||||
#define HAVE_LONG_LONG 1
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
/* #undef HAVE_MALLOC_H */
|
||||
|
||||
/* Define to 1 if you have the `memcpy' function. */
|
||||
#define HAVE_MEMCPY 1
|
||||
|
||||
/* Define to 1 if you have the `memmove' function. */
|
||||
#define HAVE_MEMMOVE 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `mempcpy' function. */
|
||||
/* #undef HAVE_MEMPCPY */
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#define HAVE_MEMSET 1
|
||||
|
||||
/* Define to 1 if you have the `mkstemp' function. */
|
||||
#define HAVE_MKSTEMP 1
|
||||
|
||||
/* Define to 1 if you have a working `mmap' system call. */
|
||||
#define HAVE_MMAP 1
|
||||
|
||||
/* Define to 1 if you have the `munmap' function. */
|
||||
#define HAVE_MUNMAP 1
|
||||
|
||||
/* Define to 1 if you have the <ncurses/termcap.h> header file. */
|
||||
/* #undef HAVE_NCURSES_TERMCAP_H */
|
||||
|
||||
/* Define to 1 if you have the <nl_types.h> header file. */
|
||||
#define HAVE_NL_TYPES_H 1
|
||||
|
||||
/* Define if your printf() function supports format strings with positions. */
|
||||
#define HAVE_POSIX_PRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `putenv' function. */
|
||||
#define HAVE_PUTENV 1
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
#define HAVE_PWD_H 1
|
||||
|
||||
/* Define to 1 if you have the `setenv' function. */
|
||||
#define HAVE_SETENV 1
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#define HAVE_SETLOCALE 1
|
||||
|
||||
/* Define to 1 if you have the `setvbuf' function. */
|
||||
#define HAVE_SETVBUF 1
|
||||
|
||||
/* Define to 1 if you have the `sigaction' function. */
|
||||
#define HAVE_SIGACTION 1
|
||||
|
||||
/* Define to 1 if you have the `sigprocmask' function. */
|
||||
#define HAVE_SIGPROCMASK 1
|
||||
|
||||
/* Define to 1 if you have the `sigsetmask' function. */
|
||||
#define HAVE_SIGSETMASK 1
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#define HAVE_STDDEF_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
|
||||
uintmax_t. */
|
||||
#define HAVE_STDINT_H_WITH_UINTMAX 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the `stpcpy' function. */
|
||||
#define HAVE_STPCPY 1
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the `strchr' function. */
|
||||
#define HAVE_STRCHR 1
|
||||
|
||||
/* Define to 1 if you have the `strcoll' function and it is properly defined.
|
||||
*/
|
||||
#define HAVE_STRCOLL 1
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strncasecmp' function. */
|
||||
#define HAVE_STRNCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the `strtoul' function. */
|
||||
#define HAVE_STRTOUL 1
|
||||
|
||||
/* Define to 1 if you have the <sys/fcntl.h> header file. */
|
||||
#define HAVE_SYS_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/file.h> header file. */
|
||||
#define HAVE_SYS_FILE_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/ptem.h> header file. */
|
||||
/* #undef HAVE_SYS_PTEM_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stream.h> header file. */
|
||||
/* #undef HAVE_SYS_STREAM_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/ttold.h> header file. */
|
||||
/* #undef HAVE_SYS_TTOLD_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/wait.h> header file. */
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define to 1 if you have the <termcap.h> header file. */
|
||||
#define HAVE_TERMCAP_H 1
|
||||
|
||||
/* Define to 1 if you have the <termios.h> header file. */
|
||||
#define HAVE_TERMIOS_H 1
|
||||
|
||||
/* Define to 1 if you have the <termio.h> header file. */
|
||||
/* #undef HAVE_TERMIO_H */
|
||||
|
||||
/* Define to 1 if you have the `tsearch' function. */
|
||||
#define HAVE_TSEARCH 1
|
||||
|
||||
/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */
|
||||
#define HAVE_UINTMAX_T 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define if you have the 'unsigned long long' type. */
|
||||
#define HAVE_UNSIGNED_LONG_LONG 1
|
||||
|
||||
/* Define to 1 if you have the `vprintf' function. */
|
||||
#define HAVE_VPRINTF 1
|
||||
|
||||
/* Define if you have the 'wchar_t' type. */
|
||||
#define HAVE_WCHAR_T 1
|
||||
|
||||
/* Define to 1 if you have the `wcslen' function. */
|
||||
#define HAVE_WCSLEN 1
|
||||
|
||||
/* Define if you have the 'wint_t' type. */
|
||||
#define HAVE_WINT_T 1
|
||||
|
||||
/* Define to 1 if you have the `__argz_count' function. */
|
||||
/* #undef HAVE___ARGZ_COUNT */
|
||||
|
||||
/* Define to 1 if you have the `__argz_next' function. */
|
||||
/* #undef HAVE___ARGZ_NEXT */
|
||||
|
||||
/* Define to 1 if you have the `__argz_stringify' function. */
|
||||
/* #undef HAVE___ARGZ_STRINGIFY */
|
||||
|
||||
/* Define to 1 if you have the `__fsetlocking' function. */
|
||||
/* #undef HAVE___FSETLOCKING */
|
||||
|
||||
/* Define to 1 if you have the `__secure_getenv' function. */
|
||||
/* #undef HAVE___SECURE_GETENV */
|
||||
|
||||
/* Define as const if the declaration of iconv() needs const. */
|
||||
#define ICONV_CONST const
|
||||
|
||||
/* Define if integer division by zero raises signal SIGFPE. */
|
||||
#define INTDIV0_RAISES_SIGFPE 1
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "texinfo"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "GNU Texinfo"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "GNU Texinfo 4.8"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "texinfo"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "4.8"
|
||||
|
||||
/* Define if <inttypes.h> exists and defines unusable PRI* macros. */
|
||||
/* #undef PRI_MACROS_BROKEN */
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* 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 */
|
||||
/* #undef STACK_DIRECTION */
|
||||
|
||||
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||
/* #undef STAT_MACROS_BROKEN */
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
/* #undef TM_IN_SYS_TIME */
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "4.8"
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
/* #undef _MINIX */
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
/* #undef _POSIX_1_SOURCE */
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* 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 */
|
||||
|
||||
/* 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 */
|
||||
|
||||
/* Define to unsigned long or unsigned long long if <stdint.h> and
|
||||
<inttypes.h> don't define. */
|
||||
/* #undef uintmax_t */
|
@ -1,420 +0,0 @@
|
||||
/* config.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define to 1 if using `alloca.c'. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to 1 if translation of program messages to the user's native
|
||||
language is requested. */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Define to 1 if `TIOCGWINSZ' requires <sys/ioctl.h>. */
|
||||
#undef GWINSZ_IN_SYS_IOCTL
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||
*/
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* 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
|
||||
|
||||
/* Define if the GNU dcgettext() function is already present or preinstalled.
|
||||
*/
|
||||
#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 to 1 if you have the declaration of `memchr', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_MEMCHR
|
||||
|
||||
/* Define to 1 if you have the declaration of `strcoll', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRCOLL
|
||||
|
||||
/* Define to 1 if you have the declaration of `strerror', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRERROR
|
||||
|
||||
/* 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
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* 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 `getegid' function. */
|
||||
#undef HAVE_GETEGID
|
||||
|
||||
/* Define to 1 if you have the `geteuid' function. */
|
||||
#undef HAVE_GETEUID
|
||||
|
||||
/* Define to 1 if you have the `getgid' function. */
|
||||
#undef HAVE_GETGID
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the `getuid' function. */
|
||||
#undef HAVE_GETUID
|
||||
|
||||
/* 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
|
||||
|
||||
/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
|
||||
declares uintmax_t. */
|
||||
#undef HAVE_INTTYPES_H_WITH_UINTMAX
|
||||
|
||||
/* Define to 1 if you have the <io.h> header file. */
|
||||
#undef HAVE_IO_H
|
||||
|
||||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
||||
#undef HAVE_LANGINFO_CODESET
|
||||
|
||||
/* Define if your <locale.h> file defines LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define to 1 if you have the `bsd' library (-lbsd). */
|
||||
#undef HAVE_LIBBSD
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* 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
|
||||
|
||||
/* Define to 1 if you have the `memcpy' function. */
|
||||
#undef HAVE_MEMCPY
|
||||
|
||||
/* Define to 1 if you have the `memmove' function. */
|
||||
#undef HAVE_MEMMOVE
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `mempcpy' function. */
|
||||
#undef HAVE_MEMPCPY
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the `mkstemp' function. */
|
||||
#undef HAVE_MKSTEMP
|
||||
|
||||
/* Define to 1 if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define to 1 if you have the `munmap' function. */
|
||||
#undef HAVE_MUNMAP
|
||||
|
||||
/* Define to 1 if you have the <ncurses/termcap.h> header file. */
|
||||
#undef HAVE_NCURSES_TERMCAP_H
|
||||
|
||||
/* 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
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
#undef HAVE_PWD_H
|
||||
|
||||
/* Define to 1 if you have the `setenv' function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define to 1 if you have the `setvbuf' function. */
|
||||
#undef HAVE_SETVBUF
|
||||
|
||||
/* Define to 1 if you have the `sigaction' function. */
|
||||
#undef HAVE_SIGACTION
|
||||
|
||||
/* Define to 1 if you have the `sigprocmask' function. */
|
||||
#undef HAVE_SIGPROCMASK
|
||||
|
||||
/* 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
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
|
||||
uintmax_t. */
|
||||
#undef HAVE_STDINT_H_WITH_UINTMAX
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `stpcpy' function. */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define to 1 if you have the `strchr' function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
/* Define to 1 if you have the `strcoll' function and it is properly defined.
|
||||
*/
|
||||
#undef HAVE_STRCOLL
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strncasecmp' function. */
|
||||
#undef HAVE_STRNCASECMP
|
||||
|
||||
/* Define to 1 if you have the `strtoul' function. */
|
||||
#undef HAVE_STRTOUL
|
||||
|
||||
/* Define to 1 if you have the <sys/fcntl.h> header file. */
|
||||
#undef HAVE_SYS_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ptem.h> header file. */
|
||||
#undef HAVE_SYS_PTEM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stream.h> header file. */
|
||||
#undef HAVE_SYS_STREAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ttold.h> header file. */
|
||||
#undef HAVE_SYS_TTOLD_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/wait.h> header file. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define to 1 if you have the <termcap.h> header file. */
|
||||
#undef HAVE_TERMCAP_H
|
||||
|
||||
/* Define to 1 if you have the <termios.h> header file. */
|
||||
#undef HAVE_TERMIOS_H
|
||||
|
||||
/* Define to 1 if you have the <termio.h> header file. */
|
||||
#undef HAVE_TERMIO_H
|
||||
|
||||
/* Define to 1 if you have the `tsearch' function. */
|
||||
#undef HAVE_TSEARCH
|
||||
|
||||
/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */
|
||||
#undef HAVE_UINTMAX_T
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the 'unsigned long long' type. */
|
||||
#undef HAVE_UNSIGNED_LONG_LONG
|
||||
|
||||
/* 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
|
||||
|
||||
/* Define to 1 if you have the `__argz_next' function. */
|
||||
#undef HAVE___ARGZ_NEXT
|
||||
|
||||
/* Define to 1 if you have the `__argz_stringify' function. */
|
||||
#undef HAVE___ARGZ_STRINGIFY
|
||||
|
||||
/* Define to 1 if you have the `__fsetlocking' function. */
|
||||
#undef HAVE___FSETLOCKING
|
||||
|
||||
/* Define to 1 if you have the `__secure_getenv' function. */
|
||||
#undef HAVE___SECURE_GETENV
|
||||
|
||||
/* Define as const if the declaration of iconv() needs const. */
|
||||
#undef ICONV_CONST
|
||||
|
||||
/* Define if integer division by zero raises signal SIGFPE. */
|
||||
#undef INTDIV0_RAISES_SIGFPE
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define if <inttypes.h> exists and defines unusable PRI* macros. */
|
||||
#undef PRI_MACROS_BROKEN
|
||||
|
||||
/* 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 */
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||
#undef STAT_MACROS_BROKEN
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
#undef _POSIX_1_SOURCE
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* 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
|
||||
|
||||
/* 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
|
||||
|
||||
/* Define to unsigned long or unsigned long long if <stdint.h> and
|
||||
<inttypes.h> don't define. */
|
||||
#undef uintmax_t
|
@ -1,44 +0,0 @@
|
||||
$Id: README,v 1.4 2004/04/11 17:56:45 karl Exp $
|
||||
texinfo/doc/README
|
||||
|
||||
Copyright (C) 2002 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.
|
||||
|
||||
This directory contains documentation on the Texinfo system and the TeX
|
||||
sources needed to process Texinfo sources. We recommend using the
|
||||
texi2dvi included in this distribution to run a Texinfo manual through
|
||||
TeX to produce a DVI file.
|
||||
|
||||
The .tex files are not installed automatically because TeX installations
|
||||
vary so widely. Installing them in the wrong place would give a false
|
||||
sense of security. So, you should simply cp *.tex to the appropriate
|
||||
place. If your installation follows the TeX Directory Structure
|
||||
standard (http://tug.org/tds/), this will be the directory
|
||||
TEXMF/tex/texinfo/ for texinfo.tex, TEXMF/tex/generic/dvips/ for epsf.tex,
|
||||
and TEXMF/pdftex/plain/misc for pdfcolor.tex. If you use the default
|
||||
installation paths, TEXMF will be /usr/local/share/texmf. On systems
|
||||
with TeX preinstalled, as most GNU/Linux distributions offer, TEXMF
|
||||
will often be something like /usr/share/texmf.
|
||||
|
||||
It is also possible to put these .tex files in a `local' place instead
|
||||
of overwriting existing ones, but this is more complicated. See your TeX
|
||||
documentation in general and the texmf.cnf file in particular for information.
|
||||
|
||||
If you add files to your TeX installations, not just replace existing
|
||||
ones, you very likely have to update your ls-R file; do this with the
|
||||
mktexlsr command. In older versions, this was named MakeTeXls-R.
|
||||
|
||||
You can get the latest texinfo.tex from
|
||||
ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex (and all GNU mirrors)
|
||||
ftp://tug.org/tex/texinfo.tex (and all CTAN mirrors)
|
||||
or on the FSF machines in /home/gd/gnu/doc/texinfo.tex.
|
||||
If you have problems with the version in this distribution, please check
|
||||
for a newer version.
|
||||
|
||||
epsf.tex comes with dvips distributions, and you may already have it
|
||||
installed. The version here is functionally identical but slightly
|
||||
nicer than the one in dvips574. The changes have been sent to the
|
||||
epsf.tex maintainer.
|
@ -1,452 +0,0 @@
|
||||
|
||||
@node GNU Free Documentation License
|
||||
@appendixsec GNU Free Documentation License
|
||||
|
||||
@cindex FDL, GNU Free Documentation License
|
||||
@center Version 1.2, November 2002
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
@end display
|
||||
|
||||
@enumerate 0
|
||||
@item
|
||||
PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document @dfn{free} in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or noncommercially.
|
||||
Secondarily, this License preserves for the author and publisher a way
|
||||
to get credit for their work, while not being considered responsible
|
||||
for modifications made by others.
|
||||
|
||||
This License is a kind of ``copyleft'', which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
@item
|
||||
APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work, in any medium, that
|
||||
contains a notice placed by the copyright holder saying it can be
|
||||
distributed under the terms of this License. Such a notice grants a
|
||||
world-wide, royalty-free license, unlimited in duration, to use that
|
||||
work under the conditions stated herein. The ``Document'', below,
|
||||
refers to any such manual or work. Any member of the public is a
|
||||
licensee, and is addressed as ``you''. You accept the license if you
|
||||
copy, modify or distribute the work in a way requiring permission
|
||||
under copyright law.
|
||||
|
||||
A ``Modified Version'' of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A ``Secondary Section'' is a named appendix or a front-matter section
|
||||
of the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall
|
||||
subject (or to related matters) and contains nothing that could fall
|
||||
directly within that overall subject. (Thus, if the Document is in
|
||||
part a textbook of mathematics, a Secondary Section may not explain
|
||||
any mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
The ``Invariant Sections'' are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License. If a
|
||||
section does not fit the above definition of Secondary then it is not
|
||||
allowed to be designated as Invariant. The Document may contain zero
|
||||
Invariant Sections. If the Document does not identify any Invariant
|
||||
Sections then there are none.
|
||||
|
||||
The ``Cover Texts'' are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License. A Front-Cover Text may
|
||||
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
|
||||
A ``Transparent'' copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup, or absence of markup, has been arranged to thwart
|
||||
or discourage subsequent modification by readers is not Transparent.
|
||||
An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not ``Transparent'' is called ``Opaque''.
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
@sc{ascii} without markup, Texinfo input format, La@TeX{} input
|
||||
format, @acronym{SGML} or @acronym{XML} using a publicly available
|
||||
@acronym{DTD}, and standard-conforming simple @acronym{HTML},
|
||||
PostScript or @acronym{PDF} designed for human modification. Examples
|
||||
of transparent image formats include @acronym{PNG}, @acronym{XCF} and
|
||||
@acronym{JPG}. Opaque formats include proprietary formats that can be
|
||||
read and edited only by proprietary word processors, @acronym{SGML} or
|
||||
@acronym{XML} for which the @acronym{DTD} and/or processing tools are
|
||||
not generally available, and the machine-generated @acronym{HTML},
|
||||
PostScript or @acronym{PDF} produced by some word processors for
|
||||
output purposes only.
|
||||
|
||||
The ``Title Page'' means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, ``Title Page'' means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
|
||||
A section ``Entitled XYZ'' means a named subunit of the Document whose
|
||||
title either is precisely XYZ or contains XYZ in parentheses following
|
||||
text that translates XYZ in another language. (Here XYZ stands for a
|
||||
specific section name mentioned below, such as ``Acknowledgements'',
|
||||
``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
|
||||
of such a section when you modify the Document means that it remains a
|
||||
section ``Entitled XYZ'' according to this definition.
|
||||
|
||||
The Document may include Warranty Disclaimers next to the notice which
|
||||
states that this License applies to the Document. These Warranty
|
||||
Disclaimers are considered to be included by reference in this
|
||||
License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and has
|
||||
no effect on the meaning of this License.
|
||||
|
||||
@item
|
||||
VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no other
|
||||
conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
|
||||
@item
|
||||
COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies (or copies in media that commonly have
|
||||
printed covers) of the Document, numbering more than 100, and the
|
||||
Document's license notice requires Cover Texts, you must enclose the
|
||||
copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a computer-network location from which the general network-using
|
||||
public has access to download using public-standard network protocols
|
||||
a complete Transparent copy of the Document, free of added material.
|
||||
If you use the latter option, you must take reasonably prudent steps,
|
||||
when you begin distribution of Opaque copies in quantity, to ensure
|
||||
that this Transparent copy will remain thus accessible at the stated
|
||||
location until at least one year after the last time you distribute an
|
||||
Opaque copy (directly or through your agents or retailers) of that
|
||||
edition to the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to give
|
||||
them a chance to provide you with an updated version of the Document.
|
||||
|
||||
@item
|
||||
MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
@enumerate A
|
||||
@item
|
||||
Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.
|
||||
|
||||
@item
|
||||
List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has fewer than five),
|
||||
unless they release you from this requirement.
|
||||
|
||||
@item
|
||||
State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
|
||||
@item
|
||||
Preserve all the copyright notices of the Document.
|
||||
|
||||
@item
|
||||
Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
|
||||
@item
|
||||
Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.
|
||||
|
||||
@item
|
||||
Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.
|
||||
|
||||
@item
|
||||
Include an unaltered copy of this License.
|
||||
|
||||
@item
|
||||
Preserve the section Entitled ``History'', Preserve its Title, and add
|
||||
to it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section Entitled ``History'' in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.
|
||||
|
||||
@item
|
||||
Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the ``History'' section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.
|
||||
|
||||
@item
|
||||
For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
|
||||
the Title of the section, and preserve in the section all the
|
||||
substance and tone of each of the contributor acknowledgements and/or
|
||||
dedications given therein.
|
||||
|
||||
@item
|
||||
Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.
|
||||
|
||||
@item
|
||||
Delete any section Entitled ``Endorsements''. Such a section
|
||||
may not be included in the Modified Version.
|
||||
|
||||
@item
|
||||
Do not retitle any existing section to be Entitled ``Endorsements'' or
|
||||
to conflict in title with any Invariant Section.
|
||||
|
||||
@item
|
||||
Preserve any Warranty Disclaimers.
|
||||
@end enumerate
|
||||
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
You may add a section Entitled ``Endorsements'', provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties---for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
|
||||
@item
|
||||
COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice, and that you preserve all their Warranty Disclaimers.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
In the combination, you must combine any sections Entitled ``History''
|
||||
in the various original documents, forming one section Entitled
|
||||
``History''; likewise combine any sections Entitled ``Acknowledgements'',
|
||||
and any sections Entitled ``Dedications''. You must delete all
|
||||
sections Entitled ``Endorsements.''
|
||||
|
||||
@item
|
||||
COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other documents
|
||||
released under this License, and replace the individual copies of this
|
||||
License in the various documents with a single copy that is included in
|
||||
the collection, provided that you follow the rules of this License for
|
||||
verbatim copying of each of the documents in all other respects.
|
||||
|
||||
You may extract a single document from such a collection, and distribute
|
||||
it individually under this License, provided you insert a copy of this
|
||||
License into the extracted document, and follow this License in all
|
||||
other respects regarding verbatim copying of that document.
|
||||
|
||||
@item
|
||||
AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, is called an ``aggregate'' if the copyright
|
||||
resulting from the compilation is not used to limit the legal rights
|
||||
of the compilation's users beyond what the individual works permit.
|
||||
When the Document is included in an aggregate, this License does not
|
||||
apply to the other works in the aggregate which are not themselves
|
||||
derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half of
|
||||
the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic form.
|
||||
Otherwise they must appear on printed covers that bracket the whole
|
||||
aggregate.
|
||||
|
||||
@item
|
||||
TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also include
|
||||
the original English version of this License and the original versions
|
||||
of those notices and disclaimers. In case of a disagreement between
|
||||
the translation and the original version of this License or a notice
|
||||
or disclaimer, the original version will prevail.
|
||||
|
||||
If a section in the Document is Entitled ``Acknowledgements'',
|
||||
``Dedications'', or ``History'', the requirement (section 4) to Preserve
|
||||
its Title (section 1) will typically require changing the actual
|
||||
title.
|
||||
|
||||
@item
|
||||
TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document except
|
||||
as expressly provided for under this License. Any other attempt to
|
||||
copy, modify, sublicense or distribute the Document is void, and will
|
||||
automatically terminate your rights under this License. However,
|
||||
parties who have received copies, or rights, from you under this
|
||||
License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
@item
|
||||
FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions
|
||||
of the GNU Free Documentation License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns. See
|
||||
@uref{http://www.gnu.org/copyleft/}.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License ``or any later version'' applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation.
|
||||
@end enumerate
|
||||
|
||||
@page
|
||||
@appendixsubsec ADDENDUM: How to use this License for your documents
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
Copyright (C) @var{year} @var{your name}.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
||||
Texts. A copy of the license is included in the section entitled ``GNU
|
||||
Free Documentation License''.
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the ``with...Texts.'' line with this:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
with the Invariant Sections being @var{list their titles}, with
|
||||
the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
|
||||
being @var{list}.
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
||||
|
||||
@c Local Variables:
|
||||
@c ispell-local-pdict: "ispell-dict"
|
||||
@c End:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,89 +0,0 @@
|
||||
.\" 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
|
||||
.B info
|
||||
[\fIOPTION\fR]... [\fIMENU-ITEM\fR...]
|
||||
.SH DESCRIPTION
|
||||
Read documentation in Info format.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-\-apropos\fR=\fISTRING\fR
|
||||
look up STRING in all indices of all manuals.
|
||||
.TP
|
||||
\fB\-d\fR, \fB\-\-directory\fR=\fIDIR\fR
|
||||
add DIR to INFOPATH.
|
||||
.TP
|
||||
\fB\-\-dribble\fR=\fIFILENAME\fR
|
||||
remember user keystrokes in FILENAME.
|
||||
.TP
|
||||
\fB\-f\fR, \fB\-\-file\fR=\fIFILENAME\fR
|
||||
specify Info file to visit.
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
display this help and exit.
|
||||
.TP
|
||||
\fB\-\-index\-search\fR=\fISTRING\fR
|
||||
go to node pointed by index entry STRING.
|
||||
.TP
|
||||
\fB\-n\fR, \fB\-\-node\fR=\fINODENAME\fR
|
||||
specify nodes in first visited Info file.
|
||||
.TP
|
||||
\fB\-o\fR, \fB\-\-output\fR=\fIFILENAME\fR
|
||||
output selected nodes to FILENAME.
|
||||
.TP
|
||||
\fB\-R\fR, \fB\-\-raw\-escapes\fR
|
||||
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.
|
||||
.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.
|
||||
.TP
|
||||
\fB\-\-version\fR
|
||||
display version information and exit.
|
||||
.PP
|
||||
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
|
||||
items relative to the initial node visited.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
info
|
||||
show top\-level dir menu
|
||||
.TP
|
||||
info emacs
|
||||
start at emacs node from top\-level dir
|
||||
.TP
|
||||
info emacs buffers
|
||||
start at buffers node within emacs manual
|
||||
.TP
|
||||
info \fB\-\-show\-options\fR emacs
|
||||
start at node with emacs' command line options
|
||||
.TP
|
||||
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.
|
||||
Texinfo home page: http://www.gnu.org/software/texinfo/
|
||||
.SH COPYRIGHT
|
||||
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,62 +0,0 @@
|
||||
.\" info(5)
|
||||
.\" $Id: info.5,v 1.2 2004/04/11 17:56:45 karl Exp $
|
||||
.\"
|
||||
.\" Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" Permission is granted to make and distribute verbatim copies of this
|
||||
.\" manual provided the copyright notice and this permission notice are
|
||||
.\" preserved on all copies.
|
||||
.\"
|
||||
.\" Permission is granted to copy and distribute modified versions of
|
||||
.\" this manual under the conditions for verbatim copying, provided that
|
||||
.\" the entire resulting derived work is distributed under the terms of a
|
||||
.\" permission notice identical to this one.
|
||||
.\"
|
||||
.\" Permission is granted to copy and distribute translations of this
|
||||
.\" manual into another language, under the above conditions for modified
|
||||
.\" versions, except that this permission notice may be stated in a
|
||||
.\" translation approved by the Foundation.
|
||||
.\"
|
||||
.TH INFO 5 "GNU Info" "FSF"
|
||||
.SH NAME
|
||||
info \- readable online documentation
|
||||
.SH DESCRIPTION
|
||||
The Info file format is an easily-parsable representation for online
|
||||
documents. It can be read by
|
||||
.I emacs(1)
|
||||
and
|
||||
.I info(1)
|
||||
among other programs.
|
||||
.PP
|
||||
Info files are usually created from
|
||||
.I texinfo(5)
|
||||
sources by
|
||||
.IR makeinfo(1) ,
|
||||
but can be created from scratch if so desired.
|
||||
.PP
|
||||
For a full description of the Texinfo language and associated tools,
|
||||
please see the Texinfo manual (written in Texinfo itself). Most likely,
|
||||
running this command from your shell:
|
||||
.RS
|
||||
.I info texinfo
|
||||
.RE
|
||||
or this key sequence from inside Emacs:
|
||||
.RS
|
||||
.I M-x info RET m texinfo RET
|
||||
.RE
|
||||
will get you there.
|
||||
.SH AVAILABILITY
|
||||
ftp://ftp.gnu.org/pub/gnu/texinfo-<version>.tar.gz
|
||||
.br
|
||||
or any GNU mirror site.
|
||||
.SH "REPORTING BUGS"
|
||||
Please send bug reports to bug-texinfo@gnu.org,
|
||||
general questions and discussion to help-texinfo@gnu.org.
|
||||
.SH "SEE ALSO"
|
||||
info(1), install-info(1), makeinfo(1), texi2dvi(1),
|
||||
.br
|
||||
texindex(1).
|
||||
.br
|
||||
emacs(1), tex(1).
|
||||
.br
|
||||
texinfo(5).
|
File diff suppressed because it is too large
Load Diff
@ -1,41 +0,0 @@
|
||||
.\" 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,78 +0,0 @@
|
||||
.\" 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.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-\-delete\fR
|
||||
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.
|
||||
.TP
|
||||
\fB\-\-entry\fR=\fITEXT\fR
|
||||
insert TEXT as an Info directory entry.
|
||||
TEXT should have the form of an Info menu item line
|
||||
plus zero or more extra lines starting with whitespace.
|
||||
If you specify more than one entry, they are all added.
|
||||
If you don't specify any entries, they are determined
|
||||
from information in the Info file itself.
|
||||
.TP
|
||||
\fB\-\-help\fR
|
||||
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.
|
||||
.TP
|
||||
\fB\-\-info\-dir\fR=\fIDIR\fR
|
||||
same as \fB\-\-dir\-file\fR=\fIDIR\fR/dir.
|
||||
.TP
|
||||
\fB\-\-item\fR=\fITEXT\fR
|
||||
same as \fB\-\-entry\fR TEXT.
|
||||
An Info directory entry is actually a menu item.
|
||||
.TP
|
||||
\fB\-\-quiet\fR
|
||||
suppress warnings.
|
||||
.TP
|
||||
\fB\-\-remove\fR
|
||||
same as \fB\-\-delete\fR.
|
||||
.TP
|
||||
\fB\-\-section\fR=\fISEC\fR
|
||||
put this file's entries in section SEC of the directory.
|
||||
If you specify more than one section, all the entries
|
||||
are added in each of the sections.
|
||||
If you don't specify any sections, they are determined
|
||||
from information in the Info file itself.
|
||||
.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 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.
|
||||
.SH "SEE ALSO"
|
||||
The full documentation for
|
||||
.B install-info
|
||||
is maintained as a Texinfo manual. If the
|
||||
.B info
|
||||
and
|
||||
.B install-info
|
||||
programs are properly installed at your site, the command
|
||||
.IP
|
||||
.B info install-info
|
||||
.PP
|
||||
should give you access to the complete manual.
|
@ -1,205 +0,0 @@
|
||||
.\" 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
|
||||
.B makeinfo
|
||||
[\fIOPTION\fR]... \fITEXINFO-FILE\fR...
|
||||
.SH DESCRIPTION
|
||||
Translate Texinfo source documentation to various other formats, by default
|
||||
Info files suitable for reading online with Emacs or standalone GNU Info.
|
||||
.SS "General options:"
|
||||
.TP
|
||||
\fB\-\-error\-limit\fR=\fINUM\fR
|
||||
quit after NUM errors (default 100).
|
||||
.TP
|
||||
\fB\-\-force\fR
|
||||
preserve output even if errors.
|
||||
.TP
|
||||
\fB\-\-help\fR
|
||||
display this help and exit.
|
||||
.TP
|
||||
\fB\-\-no\-validate\fR
|
||||
suppress node cross\-reference validation.
|
||||
.TP
|
||||
\fB\-\-no\-warn\fR
|
||||
suppress warnings (but not errors).
|
||||
.TP
|
||||
\fB\-\-reference\-limit\fR=\fINUM\fR
|
||||
warn about at most NUM references (default 1000).
|
||||
.TP
|
||||
\fB\-v\fR, \fB\-\-verbose\fR
|
||||
explain what is being done.
|
||||
.TP
|
||||
\fB\-\-version\fR
|
||||
display version information and exit.
|
||||
.SS "Output format selection (default is to produce Info):"
|
||||
.TP
|
||||
\fB\-\-docbook\fR
|
||||
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.
|
||||
ignoring any @setfilename.
|
||||
.TP
|
||||
\fB\-\-no\-headers\fR
|
||||
suppress node separators, Node: lines, and menus
|
||||
from Info output (thus producing plain text)
|
||||
or from HTML (thus producing shorter output);
|
||||
also, write to standard output by default.
|
||||
.TP
|
||||
\fB\-\-no\-split\fR
|
||||
suppress splitting of Info or HTML output,
|
||||
generate only one output file.
|
||||
.TP
|
||||
\fB\-\-number\-sections\fR
|
||||
output chapter and sectioning numbers.
|
||||
.TP
|
||||
\fB\-o\fR, \fB\-\-output\fR=\fIFILE\fR
|
||||
output to FILE (directory if split HTML),
|
||||
.SS "Options for Info and plain text:"
|
||||
.TP
|
||||
\fB\-\-enable\-encoding\fR
|
||||
output accented and special characters in
|
||||
Info output based on @documentencoding.
|
||||
.TP
|
||||
\fB\-\-fill\-column\fR=\fINUM\fR
|
||||
break Info lines at NUM characters (default 72).
|
||||
.TP
|
||||
\fB\-\-footnote\-style\fR=\fISTYLE\fR
|
||||
output footnotes in Info according to STYLE:
|
||||
`separate' to put them in their own node;
|
||||
`end' to put them at the end of the node
|
||||
.IP
|
||||
in which they are defined (default).
|
||||
.TP
|
||||
\fB\-\-paragraph\-indent\fR=\fIVAL\fR
|
||||
indent Info paragraphs by VAL spaces (default 3).
|
||||
If VAL is `none', do not indent; if VAL is
|
||||
`asis', preserve existing indentation.
|
||||
.TP
|
||||
\fB\-\-split\-size\fR=\fINUM\fR
|
||||
split Info files at size NUM (default 300000).
|
||||
.SS "Options for HTML:"
|
||||
.TP
|
||||
\fB\-\-css\-include\fR=\fIFILE\fR
|
||||
include FILE in HTML <style> output;
|
||||
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
|
||||
allow @ commands in node names.
|
||||
.TP
|
||||
\fB\-D\fR VAR
|
||||
define the variable VAR, as with @set.
|
||||
.TP
|
||||
\fB\-I\fR DIR
|
||||
append DIR to the @include search path.
|
||||
.TP
|
||||
\fB\-P\fR DIR
|
||||
prepend DIR to the @include search path.
|
||||
.TP
|
||||
\fB\-U\fR VAR
|
||||
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
|
||||
\fB\-\-ifinfo\fR
|
||||
process @ifinfo even if not generating Info.
|
||||
.TP
|
||||
\fB\-\-ifplaintext\fR
|
||||
process @ifplaintext even if not generating plain text.
|
||||
.TP
|
||||
\fB\-\-iftex\fR
|
||||
process @iftex and @tex; implies \fB\-\-no\-split\fR.
|
||||
.TP
|
||||
\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
|
||||
\fB\-\-no\-ifinfo\fR
|
||||
do not process @ifinfo text.
|
||||
.TP
|
||||
\fB\-\-no\-ifplaintext\fR
|
||||
do not process @ifplaintext text.
|
||||
.TP
|
||||
\fB\-\-no\-iftex\fR
|
||||
do not process @iftex and @tex text.
|
||||
.TP
|
||||
\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;
|
||||
if generating plain text, \fB\-\-ifplaintext\fR is on and the others are off;
|
||||
if generating XML, \fB\-\-ifxml\fR is on and the others are off.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
makeinfo foo.texi
|
||||
write Info to foo's @setfilename
|
||||
.TP
|
||||
makeinfo \fB\-\-html\fR foo.texi
|
||||
write HTML to @setfilename
|
||||
.TP
|
||||
makeinfo \fB\-\-xml\fR foo.texi
|
||||
write Texinfo XML to @setfilename
|
||||
.TP
|
||||
makeinfo \fB\-\-docbook\fR foo.texi
|
||||
write DocBook XML to @setfilename
|
||||
.TP
|
||||
makeinfo \fB\-\-no\-headers\fR foo.texi
|
||||
write plain text to standard output
|
||||
.IP
|
||||
makeinfo \fB\-\-html\fR \fB\-\-no\-headers\fR foo.texi write html without node lines, menus
|
||||
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.
|
||||
Texinfo home page: http://www.gnu.org/software/texinfo/
|
||||
.SH COPYRIGHT
|
||||
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.
|
||||
.SH "SEE ALSO"
|
||||
The full documentation for
|
||||
.B makeinfo
|
||||
is maintained as a Texinfo manual. If the
|
||||
.B info
|
||||
and
|
||||
.B makeinfo
|
||||
programs are properly installed at your site, the command
|
||||
.IP
|
||||
.B info makeinfo
|
||||
.PP
|
||||
should give you access to the complete manual.
|
@ -1,47 +0,0 @@
|
||||
.\" 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
|
||||
.B texindex
|
||||
[\fIOPTION\fR]... \fIFILE\fR...
|
||||
.SH DESCRIPTION
|
||||
Generate a sorted index for each TeX output FILE.
|
||||
Usually FILE... is specified as `foo.??' for a document `foo.texi'.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
display this help and exit
|
||||
.TP
|
||||
\fB\-k\fR, \fB\-\-keep\fR
|
||||
keep temporary files around after processing
|
||||
.TP
|
||||
\fB\-\-no\-keep\fR
|
||||
do not keep temporary files around after processing (default)
|
||||
.TP
|
||||
\fB\-o\fR, \fB\-\-output\fR FILE
|
||||
send output to FILE
|
||||
.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 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.
|
||||
.SH "SEE ALSO"
|
||||
The full documentation for
|
||||
.B texindex
|
||||
is maintained as a Texinfo manual. If the
|
||||
.B info
|
||||
and
|
||||
.B texindex
|
||||
programs are properly installed at your site, the command
|
||||
.IP
|
||||
.B info texindex
|
||||
.PP
|
||||
should give you access to the complete manual.
|
@ -1,51 +0,0 @@
|
||||
.\" texinfo(5)
|
||||
.\" $Id: texinfo.5,v 1.2 2004/04/11 17:56:45 karl Exp $
|
||||
.\"
|
||||
.\" Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" Permission is granted to make and distribute verbatim copies of this
|
||||
.\" manual provided the copyright notice and this permission notice are
|
||||
.\" preserved on all copies.
|
||||
.\"
|
||||
.\" Permission is granted to copy and distribute modified versions of
|
||||
.\" this manual under the conditions for verbatim copying, provided that
|
||||
.\" the entire resulting derived work is distributed under the terms of a
|
||||
.\" permission notice identical to this one.
|
||||
.\"
|
||||
.\" Permission is granted to copy and distribute translations of this
|
||||
.\" manual into another language, under the above conditions for modified
|
||||
.\" versions, except that this permission notice may be stated in a
|
||||
.\" translation approved by the Foundation.
|
||||
.\"
|
||||
.TH TEXINFO 5 "GNU Texinfo" "FSF"
|
||||
.SH NAME
|
||||
texinfo \- software documentation system
|
||||
.SH DESCRIPTION
|
||||
Texinfo is a documentation system that uses a single source file to
|
||||
produce both online information and printed output. It is primarily
|
||||
designed for writing software manuals.
|
||||
.PP
|
||||
For a full description of the Texinfo language and associated tools,
|
||||
please see the Texinfo manual (written in Texinfo itself). Most likely,
|
||||
running this command from your shell:
|
||||
.RS
|
||||
.I info texinfo
|
||||
.RE
|
||||
or this key sequence from inside Emacs:
|
||||
.RS
|
||||
.I M-x info RET m texinfo RET
|
||||
.RE
|
||||
will get you there.
|
||||
.SH AVAILABILITY
|
||||
ftp://ftp.gnu.org/gnu/texinfo/
|
||||
.br
|
||||
or any GNU mirror site.
|
||||
.SH "REPORTING BUGS"
|
||||
Please send bug reports to bug-texinfo@gnu.org,
|
||||
general questions and discussion to help-texinfo@gnu.org.
|
||||
.SH "SEE ALSO"
|
||||
info(1), install-info(1), makeinfo(1), texi2dvi(1), texindex(1).
|
||||
.br
|
||||
emacs(1), tex(1).
|
||||
.br
|
||||
info(5).
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +0,0 @@
|
||||
@set UPDATED 14 December 2004
|
||||
@set UPDATED-MONTH December 2004
|
||||
@set EDITION 4.8
|
||||
@set VERSION 4.8
|
@ -1,4 +0,0 @@
|
||||
@set UPDATED 29 December 2004
|
||||
@set UPDATED-MONTH December 2004
|
||||
@set EDITION 4.8
|
||||
@set VERSION 4.8
|
@ -1,30 +0,0 @@
|
||||
$Id: README,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
texinfo/info/README
|
||||
|
||||
Copyright (C) 2002 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.
|
||||
|
||||
Info 2.0 is a complete rewrite of the original standalone Info I wrote in
|
||||
1987, the first program I wrote for rms. That program was something like
|
||||
my second Unix program ever, and my die-hard machine language coding habits
|
||||
tended to show through. I found the original Info hard to read and
|
||||
maintain, and thus decided to write this one.
|
||||
|
||||
The rewrite consists of about 12,000 lines of code written in about 12
|
||||
days. I believe this version of Info to be in much better shape than the
|
||||
original Info.
|
||||
|
||||
Info 2.0 is substantially different from its original standalone
|
||||
predecessor. It appears almost identical to the GNU Emacs version, but has
|
||||
the advantages of smaller size, ease of portability, and a built in library
|
||||
which can be used in other programs (to get or display documentation from
|
||||
Info files, for example).
|
||||
|
||||
A full listing of the commands available in Info can be gotten by typing
|
||||
`?' while within an Info window. This produces a node in a window which
|
||||
can be viewed just like any Info node.
|
||||
|
||||
--Brian Fox <bfox@gnu.org>
|
@ -1,290 +0,0 @@
|
||||
/* dir.c -- how to build a special "dir" node from "localdir" files.
|
||||
$Id: dir.c,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "info-utils.h"
|
||||
#include "filesys.h"
|
||||
#include "tilde.h"
|
||||
|
||||
/* The "dir" node can be built from the contents of a file called "dir",
|
||||
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 (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
|
||||
};
|
||||
|
||||
|
||||
/* Return zero if the file represented in the stat structure TEST has
|
||||
already been seen, nonzero else. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long device;
|
||||
unsigned long inode;
|
||||
} dir_file_list_entry_type;
|
||||
|
||||
static int
|
||||
new_dir_file_p (struct stat *test)
|
||||
{
|
||||
static unsigned dir_file_list_len = 0;
|
||||
static dir_file_list_entry_type *dir_file_list = NULL;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < dir_file_list_len; i++)
|
||||
{
|
||||
dir_file_list_entry_type entry;
|
||||
entry = dir_file_list[i];
|
||||
if (entry.device == test->st_dev && entry.inode == test->st_ino)
|
||||
return 0;
|
||||
}
|
||||
|
||||
dir_file_list_len++;
|
||||
dir_file_list = xrealloc (dir_file_list,
|
||||
dir_file_list_len * sizeof (dir_file_list_entry_type));
|
||||
dir_file_list[dir_file_list_len - 1].device = test->st_dev;
|
||||
dir_file_list[dir_file_list_len - 1].inode = test->st_ino;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
maybe_build_dir_node (char *dirname)
|
||||
{
|
||||
int path_index, update_tags;
|
||||
char *this_dir;
|
||||
FILE_BUFFER *dir_buffer = info_find_file (dirname);
|
||||
|
||||
/* If there is no "dir" in the current info path, we cannot build one
|
||||
from nothing. */
|
||||
if (!dir_buffer)
|
||||
return;
|
||||
|
||||
/* If this directory has already been built, return now. */
|
||||
if (dir_buffer->flags & N_CannotGC)
|
||||
return;
|
||||
|
||||
/* Initialize the list we use to avoid reading the same dir file twice
|
||||
with the dir file just found. */
|
||||
new_dir_file_p (&dir_buffer->finfo);
|
||||
|
||||
path_index = update_tags = 0;
|
||||
|
||||
/* Using each element of the path, check for one of the files in
|
||||
DIRS_TO_ADD. Do not check for "localdir.info.Z" or anything else.
|
||||
Only files explictly named are eligible. This is a design decision.
|
||||
There can be an info file name "localdir.info" which contains
|
||||
information on the setting up of "localdir" files. */
|
||||
while ((this_dir = extract_colon_unit (infopath, &path_index)))
|
||||
{
|
||||
register int da_index;
|
||||
char *from_file;
|
||||
|
||||
/* Expand a leading tilde if one is present. */
|
||||
if (*this_dir == '~')
|
||||
{
|
||||
char *tilde_expanded_dirname;
|
||||
|
||||
tilde_expanded_dirname = tilde_expand_word (this_dir);
|
||||
if (tilde_expanded_dirname != this_dir)
|
||||
{
|
||||
free (this_dir);
|
||||
this_dir = tilde_expanded_dirname;
|
||||
}
|
||||
}
|
||||
|
||||
/* For every different file named in DIRS_TO_ADD found in the
|
||||
search path, add that file's menu to our "dir" node. */
|
||||
for (da_index = 0; (from_file = dirs_to_add[da_index]); da_index++)
|
||||
{
|
||||
struct stat finfo;
|
||||
int statable;
|
||||
int namelen = strlen (from_file);
|
||||
char *fullpath = xmalloc (3 + strlen (this_dir) + namelen);
|
||||
|
||||
strcpy (fullpath, this_dir);
|
||||
if (!IS_SLASH (fullpath[strlen (fullpath) - 1]))
|
||||
strcat (fullpath, "/");
|
||||
strcat (fullpath, from_file);
|
||||
|
||||
statable = (stat (fullpath, &finfo) == 0);
|
||||
|
||||
/* Only add this file if we have not seen it before. */
|
||||
if (statable && S_ISREG (finfo.st_mode) && new_dir_file_p (&finfo))
|
||||
{
|
||||
long filesize;
|
||||
int compressed;
|
||||
char *contents = filesys_read_info_file (fullpath, &filesize,
|
||||
&finfo, &compressed);
|
||||
if (contents)
|
||||
{
|
||||
update_tags++;
|
||||
add_menu_to_file_buffer (contents, filesize, dir_buffer);
|
||||
free (contents);
|
||||
}
|
||||
}
|
||||
|
||||
free (fullpath);
|
||||
}
|
||||
free (this_dir);
|
||||
}
|
||||
|
||||
if (update_tags)
|
||||
build_tags_and_nodes (dir_buffer);
|
||||
|
||||
/* Flag that the dir buffer has been built. */
|
||||
dir_buffer->flags |= N_CannotGC;
|
||||
}
|
||||
|
||||
/* Given CONTENTS and FB (a file buffer), add the menu found in CONTENTS
|
||||
to the menu found in FB->contents. Second argument SIZE is the total
|
||||
size of CONTENTS. */
|
||||
static void
|
||||
add_menu_to_file_buffer (char *contents, long int size, FILE_BUFFER *fb)
|
||||
{
|
||||
SEARCH_BINDING contents_binding, fb_binding;
|
||||
long contents_offset, fb_offset;
|
||||
|
||||
contents_binding.buffer = contents;
|
||||
contents_binding.start = 0;
|
||||
contents_binding.end = size;
|
||||
contents_binding.flags = S_FoldCase | S_SkipDest;
|
||||
|
||||
fb_binding.buffer = fb->contents;
|
||||
fb_binding.start = 0;
|
||||
fb_binding.end = fb->filesize;
|
||||
fb_binding.flags = S_FoldCase | S_SkipDest;
|
||||
|
||||
/* Move to the start of the menus in CONTENTS and FB. */
|
||||
contents_offset = search_forward (INFO_MENU_LABEL, &contents_binding);
|
||||
fb_offset = search_forward (INFO_MENU_LABEL, &fb_binding);
|
||||
|
||||
/* If there is no menu in CONTENTS, quit now. */
|
||||
if (contents_offset == -1)
|
||||
return;
|
||||
|
||||
/* There is a menu in CONTENTS, and contents_offset points to the first
|
||||
character following the menu starter string. Skip all whitespace
|
||||
and newline characters. */
|
||||
contents_offset += skip_whitespace_and_newlines (contents + contents_offset);
|
||||
|
||||
/* If there is no menu in FB, make one. */
|
||||
if (fb_offset == -1)
|
||||
{
|
||||
/* Find the start of the second node in this file buffer. If there
|
||||
is only one node, we will be adding the contents to the end of
|
||||
this node. */
|
||||
fb_offset = find_node_separator (&fb_binding);
|
||||
|
||||
/* If not even a single node separator, give up. */
|
||||
if (fb_offset == -1)
|
||||
return;
|
||||
|
||||
fb_binding.start = fb_offset;
|
||||
fb_binding.start +=
|
||||
skip_node_separator (fb_binding.buffer + fb_binding.start);
|
||||
|
||||
/* Try to find the next node separator. */
|
||||
fb_offset = find_node_separator (&fb_binding);
|
||||
|
||||
/* If found one, consider that the start of the menu. Otherwise, the
|
||||
start of this menu is the end of the file buffer (i.e., fb->size). */
|
||||
if (fb_offset != -1)
|
||||
fb_binding.start = fb_offset;
|
||||
else
|
||||
fb_binding.start = fb_binding.end;
|
||||
|
||||
insert_text_into_fb_at_binding
|
||||
(fb, &fb_binding, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL));
|
||||
|
||||
fb_binding.buffer = fb->contents;
|
||||
fb_binding.start = 0;
|
||||
fb_binding.end = fb->filesize;
|
||||
fb_offset = search_forward (INFO_MENU_LABEL, &fb_binding);
|
||||
if (fb_offset == -1)
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* CONTENTS_OFFSET and FB_OFFSET point to the starts of the menus that
|
||||
appear in their respective buffers. Add the remainder of CONTENTS
|
||||
to the end of FB's menu. */
|
||||
fb_binding.start = fb_offset;
|
||||
fb_offset = find_node_separator (&fb_binding);
|
||||
if (fb_offset != -1)
|
||||
fb_binding.start = fb_offset;
|
||||
else
|
||||
fb_binding.start = fb_binding.end;
|
||||
|
||||
/* Leave exactly one blank line between directory entries. */
|
||||
{
|
||||
int num_found = 0;
|
||||
|
||||
while ((fb_binding.start > 0) &&
|
||||
(whitespace_or_newline (fb_binding.buffer[fb_binding.start - 1])))
|
||||
{
|
||||
num_found++;
|
||||
fb_binding.start--;
|
||||
}
|
||||
|
||||
/* Optimize if possible. */
|
||||
if (num_found >= 2)
|
||||
{
|
||||
fb_binding.buffer[fb_binding.start++] = '\n';
|
||||
fb_binding.buffer[fb_binding.start++] = '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Do it the hard way. */
|
||||
insert_text_into_fb_at_binding (fb, &fb_binding, "\n\n", 2);
|
||||
fb_binding.start += 2;
|
||||
}
|
||||
}
|
||||
|
||||
/* Insert the new menu. */
|
||||
insert_text_into_fb_at_binding
|
||||
(fb, &fb_binding, contents + contents_offset, size - contents_offset);
|
||||
}
|
||||
|
||||
static void
|
||||
insert_text_into_fb_at_binding (FILE_BUFFER *fb,
|
||||
SEARCH_BINDING *binding, char *text, int textlen)
|
||||
{
|
||||
char *contents;
|
||||
long start, end;
|
||||
|
||||
start = binding->start;
|
||||
end = fb->filesize;
|
||||
|
||||
contents = (char *)xmalloc (fb->filesize + textlen + 1);
|
||||
memcpy (contents, fb->contents, start);
|
||||
memcpy (contents + start, text, textlen);
|
||||
memcpy (contents + start + textlen, fb->contents + start, end - start);
|
||||
free (fb->contents);
|
||||
fb->contents = contents;
|
||||
fb->filesize += textlen;
|
||||
fb->finfo.st_size = fb->filesize;
|
||||
}
|
@ -1,646 +0,0 @@
|
||||
/* display.c -- How to display Info windows.
|
||||
$Id: display.c,v 1.7 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "display.h"
|
||||
|
||||
extern int info_any_buffered_input_p (void); /* Found in session.c. */
|
||||
|
||||
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. */
|
||||
DISPLAY_LINE **the_display = (DISPLAY_LINE **)NULL;
|
||||
|
||||
/* Non-zero means do no output. */
|
||||
int display_inhibited = 0;
|
||||
|
||||
/* Initialize THE_DISPLAY to WIDTH and HEIGHT, with nothing in it. */
|
||||
void
|
||||
display_initialize_display (int width, int height)
|
||||
{
|
||||
free_display (the_display);
|
||||
the_display = make_display (width, height);
|
||||
display_clear_display (the_display);
|
||||
}
|
||||
|
||||
/* Clear all of the lines in DISPLAY making the screen blank. */
|
||||
void
|
||||
display_clear_display (DISPLAY_LINE **display)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; display[i]; i++)
|
||||
{
|
||||
display[i]->text[0] = '\0';
|
||||
display[i]->textlen = 0;
|
||||
display[i]->inverse = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Non-zero if we didn't completely redisplay a window. */
|
||||
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)
|
||||
{
|
||||
register WINDOW *win;
|
||||
|
||||
display_was_interrupted_p = 0;
|
||||
|
||||
/* For every window in the list, check contents against the display. */
|
||||
for (win = window; win; win = win->next)
|
||||
{
|
||||
/* Only re-display visible windows which need updating. */
|
||||
if (((win->flags & W_WindowVisible) == 0) ||
|
||||
((win->flags & W_UpdateWindow) == 0) ||
|
||||
(win->height == 0))
|
||||
continue;
|
||||
|
||||
display_update_one_window (win);
|
||||
if (display_was_interrupted_p)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Always update the echo area. */
|
||||
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 (WINDOW *win)
|
||||
{
|
||||
register char *nodetext; /* Current character to display. */
|
||||
register char *last_node_char; /* Position of the last character in node. */
|
||||
register int i; /* General use index. */
|
||||
char *printed_line; /* Buffer for a printed line. */
|
||||
int pl_index = 0; /* Index into PRINTED_LINE. */
|
||||
int line_index = 0; /* Number of lines done so far. */
|
||||
int pl_ignore = 0; /* How many chars use zero width on screen. */
|
||||
int allocated_win_width;
|
||||
DISPLAY_LINE **display = the_display;
|
||||
|
||||
/* If display is inhibited, that counts as an interrupted display. */
|
||||
if (display_inhibited)
|
||||
display_was_interrupted_p = 1;
|
||||
|
||||
/* If the window has no height, or display is inhibited, quit now. */
|
||||
if (!win->height || display_inhibited)
|
||||
return;
|
||||
|
||||
/* If the window's first row doesn't appear in the_screen, then it
|
||||
cannot be displayed. This can happen when the_echo_area is the
|
||||
window to be displayed, and the screen has shrunk to less than one
|
||||
line. */
|
||||
if ((win->first_row < 0) || (win->first_row > the_screen->height))
|
||||
return;
|
||||
|
||||
/* Print each line in the window into our local buffer, and then
|
||||
check the contents of that buffer against the display. If they
|
||||
differ, update the display. */
|
||||
allocated_win_width = win->width + 1;
|
||||
printed_line = (char *)xmalloc (allocated_win_width);
|
||||
|
||||
if (!win->node || !win->line_starts)
|
||||
goto done_with_node_display;
|
||||
|
||||
nodetext = win->line_starts[win->pagetop];
|
||||
last_node_char = win->node->contents + win->node->nodelen;
|
||||
|
||||
for (; nodetext < last_node_char; nodetext++)
|
||||
{
|
||||
char *rep = NULL, *rep_carried_over, rep_temp[2];
|
||||
int replen;
|
||||
|
||||
if (isprint (*nodetext))
|
||||
{
|
||||
rep_temp[0] = *nodetext;
|
||||
replen = 1;
|
||||
rep_temp[1] = '\0';
|
||||
rep = rep_temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*nodetext == '\r' || *nodetext == '\n')
|
||||
{
|
||||
replen = win->width - pl_index + pl_ignore;
|
||||
}
|
||||
else if (*nodetext == '\0'
|
||||
&& (nodetext + 2) < last_node_char
|
||||
&& *(nodetext + 1) == '\b'
|
||||
&& *(nodetext + 2) == '[')
|
||||
{
|
||||
/* 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
|
||||
{
|
||||
rep = printed_representation (*nodetext, pl_index);
|
||||
replen = strlen (rep);
|
||||
}
|
||||
}
|
||||
|
||||
/* Support ANSI escape sequences under -R. */
|
||||
if (raw_escapes_p
|
||||
&& *nodetext == '\033'
|
||||
&& nodetext[1] == '['
|
||||
&& isdigit (nodetext[2]))
|
||||
{
|
||||
if (nodetext[3] == 'm')
|
||||
pl_ignore += 4;
|
||||
else if (isdigit (nodetext[3]) && nodetext[4] == 'm')
|
||||
pl_ignore += 5;
|
||||
}
|
||||
while (pl_index + 2 >= allocated_win_width - 1)
|
||||
{
|
||||
allocated_win_width *= 2;
|
||||
printed_line = (char *)xrealloc (printed_line, allocated_win_width);
|
||||
}
|
||||
|
||||
/* If this character can be printed without passing the width of
|
||||
the line, then stuff it into the line. */
|
||||
if (replen + pl_index < win->width + pl_ignore)
|
||||
{
|
||||
/* Optimize if possible. */
|
||||
if (replen == 1)
|
||||
{
|
||||
printed_line[pl_index++] = *rep;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < replen; i++)
|
||||
printed_line[pl_index++] = rep[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPLAY_LINE *entry;
|
||||
|
||||
/* If this character cannot be printed in this line, we have
|
||||
found the end of this line as it would appear on the screen.
|
||||
Carefully print the end of the line, and then compare. */
|
||||
if (*nodetext == '\n' || *nodetext == '\r' || *nodetext == '\t')
|
||||
{
|
||||
printed_line[pl_index] = '\0';
|
||||
rep_carried_over = (char *)NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The printed representation of this character extends into
|
||||
the next line. Remember the offset of the last character
|
||||
printed out of REP so that we can carry the character over
|
||||
to the next line. */
|
||||
for (i = 0; pl_index < (win->width + pl_ignore - 1);)
|
||||
printed_line[pl_index++] = rep[i++];
|
||||
|
||||
rep_carried_over = rep + i;
|
||||
|
||||
/* If printing the last character in this window couldn't
|
||||
possibly cause the screen to scroll, place a backslash
|
||||
in the rightmost column. */
|
||||
if (1 + line_index + win->first_row < the_screen->height)
|
||||
{
|
||||
if (win->flags & W_NoWrap)
|
||||
printed_line[pl_index++] = '$';
|
||||
else
|
||||
printed_line[pl_index++] = '\\';
|
||||
}
|
||||
printed_line[pl_index] = '\0';
|
||||
}
|
||||
|
||||
/* We have the exact line as it should appear on the screen.
|
||||
Check to see if this line matches the one already appearing
|
||||
on the screen. */
|
||||
entry = display[line_index + win->first_row];
|
||||
|
||||
/* If the screen line is inversed, then we have to clear
|
||||
the line from the screen first. Why, I don't know.
|
||||
(But don't do this if we have no visible entries, as can
|
||||
happen if the window is shrunk very small.) */
|
||||
if ((entry && entry->inverse)
|
||||
/* Need to erase the line if it has escape sequences. */
|
||||
|| (raw_escapes_p && strchr (entry->text, '\033') != 0))
|
||||
{
|
||||
terminal_goto_xy (0, line_index + win->first_row);
|
||||
terminal_clear_to_eol ();
|
||||
entry->inverse = 0;
|
||||
entry->text[0] = '\0';
|
||||
entry->textlen = 0;
|
||||
}
|
||||
|
||||
/* Find the offset where these lines differ. */
|
||||
for (i = 0; i < pl_index; i++)
|
||||
if (printed_line[i] != entry->text[i])
|
||||
break;
|
||||
|
||||
/* If the lines are not the same length, or if they differed
|
||||
at all, we must do some redrawing. */
|
||||
if ((i != pl_index) || (pl_index != entry->textlen))
|
||||
{
|
||||
/* Move to the proper point on the terminal. */
|
||||
terminal_goto_xy (i, line_index + win->first_row);
|
||||
|
||||
/* If there is any text to print, print it. */
|
||||
if (i != pl_index)
|
||||
terminal_put_text (printed_line + i);
|
||||
|
||||
/* If the printed text didn't extend all the way to the edge
|
||||
of the window, and text was appearing between here and the
|
||||
edge of the window, clear from here to the end of the line. */
|
||||
if ((pl_index < win->width + pl_ignore
|
||||
&& pl_index < entry->textlen)
|
||||
|| (entry->inverse))
|
||||
terminal_clear_to_eol ();
|
||||
|
||||
fflush (stdout);
|
||||
|
||||
/* Update the display text buffer. */
|
||||
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
|
||||
allocated (in display_initialize_display) for
|
||||
screenwidth characters only. */
|
||||
entry->text = xrealloc (entry->text, strlen (printed_line)+1);
|
||||
strcpy (entry->text + i, printed_line + i);
|
||||
entry->textlen = pl_index;
|
||||
|
||||
/* Lines showing node text are not in inverse. Only modelines
|
||||
have that distinction. */
|
||||
entry->inverse = 0;
|
||||
}
|
||||
|
||||
/* We have done at least one line. Increment our screen line
|
||||
index, and check against the bottom of the window. */
|
||||
if (++line_index == win->height)
|
||||
break;
|
||||
|
||||
/* A line has been displayed, and the screen reflects that state.
|
||||
If there is typeahead pending, then let that typeahead be read
|
||||
now, instead of continuing with the display. */
|
||||
if (info_any_buffered_input_p ())
|
||||
{
|
||||
free (printed_line);
|
||||
display_was_interrupted_p = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Reset PL_INDEX to the start of the line. */
|
||||
pl_index = 0;
|
||||
pl_ignore = 0; /* this is computed per line */
|
||||
|
||||
/* If there are characters from REP left to print, stuff them
|
||||
into the buffer now. */
|
||||
if (rep_carried_over)
|
||||
for (; rep[pl_index]; pl_index++)
|
||||
printed_line[pl_index] = rep[pl_index];
|
||||
|
||||
/* If this window has chosen not to wrap lines, skip to the end
|
||||
of the physical line in the buffer, and start a new line here. */
|
||||
if (pl_index && (win->flags & W_NoWrap))
|
||||
{
|
||||
char *begin;
|
||||
|
||||
pl_index = 0;
|
||||
printed_line[0] = '\0';
|
||||
|
||||
begin = nodetext;
|
||||
|
||||
while ((nodetext < last_node_char) && (*nodetext != '\n'))
|
||||
nodetext++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done_with_node_display:
|
||||
/* We have reached the end of the node or the end of the window. If it
|
||||
is the end of the node, then clear the lines of the window from here
|
||||
to the end of the window. */
|
||||
for (; line_index < win->height; line_index++)
|
||||
{
|
||||
DISPLAY_LINE *entry = display[line_index + win->first_row];
|
||||
|
||||
/* If this line has text on it then make it go away. */
|
||||
if (entry && entry->textlen)
|
||||
{
|
||||
entry->textlen = 0;
|
||||
entry->text[0] = '\0';
|
||||
|
||||
terminal_goto_xy (0, line_index + win->first_row);
|
||||
terminal_clear_to_eol ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally, if this window has a modeline it might need to be redisplayed.
|
||||
Check the window's modeline against the one in the display, and update
|
||||
if necessary. */
|
||||
if ((win->flags & W_InhibitMode) == 0)
|
||||
{
|
||||
window_make_modeline (win);
|
||||
line_index = win->first_row + win->height;
|
||||
|
||||
/* This display line must both be in inverse, and have the same
|
||||
contents. */
|
||||
if ((!display[line_index]->inverse) ||
|
||||
(strcmp (display[line_index]->text, win->modeline) != 0))
|
||||
{
|
||||
terminal_goto_xy (0, line_index);
|
||||
terminal_begin_inverse ();
|
||||
terminal_put_text (win->modeline);
|
||||
terminal_end_inverse ();
|
||||
strcpy (display[line_index]->text, win->modeline);
|
||||
display[line_index]->inverse = 1;
|
||||
display[line_index]->textlen = strlen (win->modeline);
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
|
||||
/* Okay, this window doesn't need updating anymore. */
|
||||
win->flags &= ~W_UpdateWindow;
|
||||
free (printed_line);
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
void
|
||||
display_scroll_display (int start, int end, int amount)
|
||||
{
|
||||
register int i, last;
|
||||
DISPLAY_LINE *temp;
|
||||
|
||||
/* If this terminal cannot do scrolling, give up now. */
|
||||
if (!terminal_can_scroll)
|
||||
return;
|
||||
|
||||
/* If there isn't anything displayed on the screen because it is too
|
||||
small, quit now. */
|
||||
if (!the_display[0])
|
||||
return;
|
||||
|
||||
/* If there is typeahead pending, then don't actually do any scrolling. */
|
||||
if (info_any_buffered_input_p ())
|
||||
return;
|
||||
|
||||
/* Do it on the screen. */
|
||||
terminal_scroll_terminal (start, end, amount);
|
||||
|
||||
/* Now do it in the display buffer so our contents match the screen. */
|
||||
if (amount > 0)
|
||||
{
|
||||
last = end + amount;
|
||||
|
||||
/* Shift the lines to scroll right into place. */
|
||||
for (i = 0; i < (end - start); i++)
|
||||
{
|
||||
temp = the_display[last - i];
|
||||
the_display[last - i] = the_display[end - i];
|
||||
the_display[end - i] = temp;
|
||||
}
|
||||
|
||||
/* The lines have been shifted down in the buffer. Clear all of the
|
||||
lines that were vacated. */
|
||||
for (i = start; i != (start + amount); i++)
|
||||
{
|
||||
the_display[i]->text[0] = '\0';
|
||||
the_display[i]->textlen = 0;
|
||||
the_display[i]->inverse = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (amount < 0)
|
||||
{
|
||||
last = start + amount;
|
||||
for (i = 0; i < (end - start); i++)
|
||||
{
|
||||
temp = the_display[last + i];
|
||||
the_display[last + i] = the_display[start + i];
|
||||
the_display[start + i] = temp;
|
||||
}
|
||||
|
||||
/* The lines have been shifted up in the buffer. Clear all of the
|
||||
lines that are left over. */
|
||||
for (i = end + amount; i != end; i++)
|
||||
{
|
||||
the_display[i]->text[0] = '\0';
|
||||
the_display[i]->textlen = 0;
|
||||
the_display[i]->inverse = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
void
|
||||
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. */
|
||||
int old_first, new_first; /* Index of the first changed line. */
|
||||
int unchanged_at_top = 0;
|
||||
int already_scrolled = 0;
|
||||
|
||||
/* Locate the first line which was displayed on the old window. */
|
||||
old_first = old_pagetop;
|
||||
new_first = window->pagetop;
|
||||
|
||||
/* Find the last line currently visible in this window. */
|
||||
last_new = window->pagetop + (window->height - 1);
|
||||
if (last_new > window->line_count)
|
||||
last_new = window->line_count - 1;
|
||||
|
||||
/* Find the last line which used to be currently visible in this window. */
|
||||
last_old = old_pagetop + (window->height - 1);
|
||||
if (last_old > old_count)
|
||||
last_old = old_count - 1;
|
||||
|
||||
for (old = old_first, new = new_first;
|
||||
old < last_old && new < last_new;
|
||||
old++, new++)
|
||||
if (old_starts[old] != window->line_starts[new])
|
||||
break;
|
||||
else
|
||||
unchanged_at_top++;
|
||||
|
||||
/* Loop through the old lines looking for a match in the new lines. */
|
||||
for (old = old_first + unchanged_at_top; old < last_old; old++)
|
||||
{
|
||||
for (new = new_first; new < last_new; new++)
|
||||
if (old_starts[old] == window->line_starts[new])
|
||||
{
|
||||
/* Find the extent of the matching lines. */
|
||||
for (i = 0; (old + i) < last_old; i++)
|
||||
if (old_starts[old + i] != window->line_starts[new + i])
|
||||
break;
|
||||
|
||||
/* Scroll these lines if there are enough of them. */
|
||||
{
|
||||
int start, end, amount;
|
||||
|
||||
start = (window->first_row
|
||||
+ ((old + already_scrolled) - old_pagetop));
|
||||
amount = new - (old + already_scrolled);
|
||||
end = window->first_row + window->height;
|
||||
|
||||
/* If we are shifting the block of lines down, then the last
|
||||
AMOUNT lines will become invisible. Thus, don't bother
|
||||
scrolling them. */
|
||||
if (amount > 0)
|
||||
end -= amount;
|
||||
|
||||
if ((end - start) > 0)
|
||||
{
|
||||
display_scroll_display (start, end, amount);
|
||||
|
||||
/* Some lines have been scrolled. Simulate the scrolling
|
||||
by offsetting the value of the old index. */
|
||||
old += i;
|
||||
already_scrolled += amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Move the screen cursor to directly over the current character in WINDOW. */
|
||||
void
|
||||
display_cursor_at_point (WINDOW *window)
|
||||
{
|
||||
int vpos, hpos;
|
||||
|
||||
vpos = window_line_of_point (window) - window->pagetop + window->first_row;
|
||||
hpos = window_get_cursor_column (window);
|
||||
terminal_goto_xy (hpos, vpos);
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Functions Static to this File */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Make a DISPLAY_LINE ** with width and height. */
|
||||
static DISPLAY_LINE **
|
||||
make_display (int width, int height)
|
||||
{
|
||||
register int i;
|
||||
DISPLAY_LINE **display;
|
||||
|
||||
display = (DISPLAY_LINE **)xmalloc ((1 + height) * sizeof (DISPLAY_LINE *));
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
display[i] = (DISPLAY_LINE *)xmalloc (sizeof (DISPLAY_LINE));
|
||||
display[i]->text = (char *)xmalloc (1 + width);
|
||||
display[i]->textlen = 0;
|
||||
display[i]->inverse = 0;
|
||||
}
|
||||
display[i] = (DISPLAY_LINE *)NULL;
|
||||
return (display);
|
||||
}
|
||||
|
||||
/* Free the storage allocated to DISPLAY. */
|
||||
static void
|
||||
free_display (DISPLAY_LINE **display)
|
||||
{
|
||||
register int i;
|
||||
register DISPLAY_LINE *display_line;
|
||||
|
||||
if (!display)
|
||||
return;
|
||||
|
||||
for (i = 0; (display_line = display[i]); i++)
|
||||
{
|
||||
free (display_line->text);
|
||||
free (display_line);
|
||||
}
|
||||
free (display);
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/* display.h -- How the display in Info is done.
|
||||
$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, 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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_DISPLAY_H
|
||||
#define INFO_DISPLAY_H
|
||||
|
||||
#include "info-utils.h"
|
||||
#include "terminal.h"
|
||||
|
||||
typedef struct {
|
||||
char *text; /* Text of the line as it appears. */
|
||||
int textlen; /* Printable Length of TEXT. */
|
||||
int inverse; /* Non-zero means this line is inverse. */
|
||||
} DISPLAY_LINE;
|
||||
|
||||
/* An array of display lines which tell us what is currently visible on
|
||||
the display. */
|
||||
extern DISPLAY_LINE **the_display;
|
||||
|
||||
/* Non-zero means do no output. */
|
||||
extern int display_inhibited;
|
||||
|
||||
/* Non-zero if we didn't completely redisplay a window. */
|
||||
extern int display_was_interrupted_p;
|
||||
|
||||
/* Initialize THE_DISPLAY to WIDTH and HEIGHT, with nothing in it. */
|
||||
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 (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 (WINDOW *window);
|
||||
|
||||
/* Display WIN on THE_DISPLAY. Unlike display_update_display (), this
|
||||
function only does 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 (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 (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 (WINDOW *window, int old_pagetop,
|
||||
char **old_starts, int old_count);
|
||||
|
||||
#endif /* not INFO_DISPLAY_H */
|
@ -1,146 +0,0 @@
|
||||
/* doc.c -- Generated structure containing function names and doc strings.
|
||||
|
||||
This file was automatically made from various source files with the
|
||||
command `..//info/makedoc'. DO NOT EDIT THIS FILE, only `..//info/makedoc.c'.
|
||||
Source files groveled to make this file include:
|
||||
|
||||
./session.c
|
||||
./echo-area.c
|
||||
./infodoc.c
|
||||
./m-x.c
|
||||
./indices.c
|
||||
./nodemenu.c
|
||||
./footnotes.c
|
||||
./variables.c
|
||||
|
||||
An entry in the array FUNCTION_DOC_ARRAY is made for each command
|
||||
found in the above files; each entry consists of a function pointer,
|
||||
a string which is the user-visible name of the function,
|
||||
and a string which documents its purpose. */
|
||||
|
||||
#include "info.h"
|
||||
#include "funs.h"
|
||||
|
||||
FUNCTION_DOC function_doc_array[] = {
|
||||
|
||||
/* Commands found in "./session.c". */
|
||||
{ (VFunction *)info_next_line, "next-line", (FUNCTION_KEYSEQ *)0, "Move down to the next line" },
|
||||
{ (VFunction *)info_prev_line, "prev-line", (FUNCTION_KEYSEQ *)0, "Move up to the previous line" },
|
||||
{ (VFunction *)info_end_of_line, "end-of-line", (FUNCTION_KEYSEQ *)0, "Move to the end of the line" },
|
||||
{ (VFunction *)info_beginning_of_line, "beginning-of-line", (FUNCTION_KEYSEQ *)0, "Move to the start of the line" },
|
||||
{ (VFunction *)info_forward_char, "forward-char", (FUNCTION_KEYSEQ *)0, "Move forward a character" },
|
||||
{ (VFunction *)info_backward_char, "backward-char", (FUNCTION_KEYSEQ *)0, "Move backward a character" },
|
||||
{ (VFunction *)info_forward_word, "forward-word", (FUNCTION_KEYSEQ *)0, "Move forward a word" },
|
||||
{ (VFunction *)info_backward_word, "backward-word", (FUNCTION_KEYSEQ *)0, "Move backward a word" },
|
||||
{ (VFunction *)info_global_next_node, "global-next-node", (FUNCTION_KEYSEQ *)0, "Move forwards or down through node structure" },
|
||||
{ (VFunction *)info_global_prev_node, "global-prev-node", (FUNCTION_KEYSEQ *)0, "Move backwards or up through node structure" },
|
||||
{ (VFunction *)info_scroll_forward, "scroll-forward", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window" },
|
||||
{ (VFunction *)info_scroll_forward_set_window, "scroll-forward-set-window", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window and set default window size" },
|
||||
{ (VFunction *)info_scroll_forward_page_only, "scroll-forward-page-only", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window staying within node" },
|
||||
{ (VFunction *)info_scroll_forward_page_only_set_window, "scroll-forward-page-only-set-window", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window staying within node and set default window size" },
|
||||
{ (VFunction *)info_scroll_backward, "scroll-backward", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window" },
|
||||
{ (VFunction *)info_scroll_backward_set_window, "scroll-backward-set-window", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window and set default window size" },
|
||||
{ (VFunction *)info_scroll_backward_page_only, "scroll-backward-page-only", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window staying within node" },
|
||||
{ (VFunction *)info_scroll_backward_page_only_set_window, "scroll-backward-page-only-set-window", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window staying within node and set default window size" },
|
||||
{ (VFunction *)info_beginning_of_node, "beginning-of-node", (FUNCTION_KEYSEQ *)0, "Move to the start of this node" },
|
||||
{ (VFunction *)info_end_of_node, "end-of-node", (FUNCTION_KEYSEQ *)0, "Move to the end of this node" },
|
||||
{ (VFunction *)info_down_line, "down-line", (FUNCTION_KEYSEQ *)0, "Scroll down by lines" },
|
||||
{ (VFunction *)info_up_line, "up-line", (FUNCTION_KEYSEQ *)0, "Scroll up by lines" },
|
||||
{ (VFunction *)info_scroll_half_screen_down, "scroll-half-screen-down", (FUNCTION_KEYSEQ *)0, "Scroll down by half screen size" },
|
||||
{ (VFunction *)info_scroll_half_screen_up, "scroll-half-screen-up", (FUNCTION_KEYSEQ *)0, "Scroll up by half screen size" },
|
||||
{ (VFunction *)info_next_window, "next-window", (FUNCTION_KEYSEQ *)0, "Select the next window" },
|
||||
{ (VFunction *)info_prev_window, "prev-window", (FUNCTION_KEYSEQ *)0, "Select the previous window" },
|
||||
{ (VFunction *)info_split_window, "split-window", (FUNCTION_KEYSEQ *)0, "Split the current window" },
|
||||
{ (VFunction *)info_delete_window, "delete-window", (FUNCTION_KEYSEQ *)0, "Delete the current window" },
|
||||
{ (VFunction *)info_keep_one_window, "keep-one-window", (FUNCTION_KEYSEQ *)0, "Delete all other windows" },
|
||||
{ (VFunction *)info_scroll_other_window, "scroll-other-window", (FUNCTION_KEYSEQ *)0, "Scroll the other window" },
|
||||
{ (VFunction *)info_scroll_other_window_backward, "scroll-other-window-backward", (FUNCTION_KEYSEQ *)0, "Scroll the other window backward" },
|
||||
{ (VFunction *)info_grow_window, "grow-window", (FUNCTION_KEYSEQ *)0, "Grow (or shrink) this window" },
|
||||
{ (VFunction *)info_tile_windows, "tile-windows", (FUNCTION_KEYSEQ *)0, "Divide the available screen space among the visible windows" },
|
||||
{ (VFunction *)info_toggle_wrap, "toggle-wrap", (FUNCTION_KEYSEQ *)0, "Toggle the state of line wrapping in the current window" },
|
||||
{ (VFunction *)info_next_node, "next-node", (FUNCTION_KEYSEQ *)0, "Select the Next node" },
|
||||
{ (VFunction *)info_prev_node, "prev-node", (FUNCTION_KEYSEQ *)0, "Select the Prev node" },
|
||||
{ (VFunction *)info_up_node, "up-node", (FUNCTION_KEYSEQ *)0, "Select the Up node" },
|
||||
{ (VFunction *)info_last_node, "last-node", (FUNCTION_KEYSEQ *)0, "Select the last node in this file" },
|
||||
{ (VFunction *)info_first_node, "first-node", (FUNCTION_KEYSEQ *)0, "Select the first node in this file" },
|
||||
{ (VFunction *)info_last_menu_item, "last-menu-item", (FUNCTION_KEYSEQ *)0, "Select the last item in this node's menu" },
|
||||
{ (VFunction *)info_menu_digit, "menu-digit", (FUNCTION_KEYSEQ *)0, "Select this menu item" },
|
||||
{ (VFunction *)info_menu_item, "menu-item", (FUNCTION_KEYSEQ *)0, "Read a menu item and select its node" },
|
||||
{ (VFunction *)info_xref_item, "xref-item", (FUNCTION_KEYSEQ *)0, "Read a footnote or cross reference and select its node" },
|
||||
{ (VFunction *)info_find_menu, "find-menu", (FUNCTION_KEYSEQ *)0, "Move to the start of this node's menu" },
|
||||
{ (VFunction *)info_visit_menu, "visit-menu", (FUNCTION_KEYSEQ *)0, "Visit as many menu items at once as possible" },
|
||||
{ (VFunction *)info_goto_node, "goto-node", (FUNCTION_KEYSEQ *)0, "Read a node name and select it" },
|
||||
{ (VFunction *)info_menu_sequence, "menu-sequence", (FUNCTION_KEYSEQ *)0, "Read a list of menus starting from dir and follow them" },
|
||||
{ (VFunction *)info_goto_invocation_node, "goto-invocation-node", (FUNCTION_KEYSEQ *)0, "Find the node describing program invocation" },
|
||||
{ (VFunction *)info_man, "man", (FUNCTION_KEYSEQ *)0, "Read a manpage reference and select it" },
|
||||
{ (VFunction *)info_top_node, "top-node", (FUNCTION_KEYSEQ *)0, "Select the node `Top' in this file" },
|
||||
{ (VFunction *)info_dir_node, "dir-node", (FUNCTION_KEYSEQ *)0, "Select the node `(dir)'" },
|
||||
{ (VFunction *)info_history_node, "history-node", (FUNCTION_KEYSEQ *)0, "Select the most recently selected node" },
|
||||
{ (VFunction *)info_kill_node, "kill-node", (FUNCTION_KEYSEQ *)0, "Kill this node" },
|
||||
{ (VFunction *)info_view_file, "view-file", (FUNCTION_KEYSEQ *)0, "Read the name of a file and select it" },
|
||||
{ (VFunction *)info_print_node, "print-node", (FUNCTION_KEYSEQ *)0, "Pipe the contents of this node through INFO_PRINT_COMMAND" },
|
||||
{ (VFunction *)info_search_case_sensitively, "search-case-sensitively", (FUNCTION_KEYSEQ *)0, "Read a string and search for it case-sensitively" },
|
||||
{ (VFunction *)info_search, "search", (FUNCTION_KEYSEQ *)0, "Read a string and search for it" },
|
||||
{ (VFunction *)info_search_backward, "search-backward", (FUNCTION_KEYSEQ *)0, "Read a string and search backward for it" },
|
||||
{ (VFunction *)info_search_next, "search-next", (FUNCTION_KEYSEQ *)0, "Repeat last search in the same direction" },
|
||||
{ (VFunction *)info_search_previous, "search-previous", (FUNCTION_KEYSEQ *)0, "Repeat last search in the reverse direction" },
|
||||
{ (VFunction *)isearch_forward, "isearch-forward", (FUNCTION_KEYSEQ *)0, "Search interactively for a string as you type it" },
|
||||
{ (VFunction *)isearch_backward, "isearch-backward", (FUNCTION_KEYSEQ *)0, "Search interactively for a string as you type it" },
|
||||
{ (VFunction *)info_move_to_prev_xref, "move-to-prev-xref", (FUNCTION_KEYSEQ *)0, "Move to the previous cross reference" },
|
||||
{ (VFunction *)info_move_to_next_xref, "move-to-next-xref", (FUNCTION_KEYSEQ *)0, "Move to the next cross reference" },
|
||||
{ (VFunction *)info_select_reference_this_line, "select-reference-this-line", (FUNCTION_KEYSEQ *)0, "Select reference or menu item appearing on this line" },
|
||||
{ (VFunction *)info_abort_key, "abort-key", (FUNCTION_KEYSEQ *)0, "Cancel current operation" },
|
||||
{ (VFunction *)info_move_to_window_line, "move-to-window-line", (FUNCTION_KEYSEQ *)0, "Move the cursor to a specific line of the window" },
|
||||
{ (VFunction *)info_redraw_display, "redraw-display", (FUNCTION_KEYSEQ *)0, "Redraw the display" },
|
||||
{ (VFunction *)info_quit, "quit", (FUNCTION_KEYSEQ *)0, "Quit using Info" },
|
||||
{ (VFunction *)info_do_lowercase_version, "do-lowercase-version", (FUNCTION_KEYSEQ *)0, "Run command bound to this key's lowercase variant" },
|
||||
{ (VFunction *)info_add_digit_to_numeric_arg, "add-digit-to-numeric-arg", (FUNCTION_KEYSEQ *)0, "Add this digit to the current numeric argument" },
|
||||
{ (VFunction *)info_universal_argument, "universal-argument", (FUNCTION_KEYSEQ *)0, "Start (or multiply by 4) the current numeric argument" },
|
||||
{ (VFunction *)info_numeric_arg_digit_loop, "numeric-arg-digit-loop", (FUNCTION_KEYSEQ *)0, "Internally used by \\[universal-argument]" },
|
||||
/* Commands found in "./echo-area.c". */
|
||||
{ (VFunction *)ea_forward, "echo-area-forward", (FUNCTION_KEYSEQ *)0, "Move forward a character" },
|
||||
{ (VFunction *)ea_backward, "echo-area-backward", (FUNCTION_KEYSEQ *)0, "Move backward a character" },
|
||||
{ (VFunction *)ea_beg_of_line, "echo-area-beg-of-line", (FUNCTION_KEYSEQ *)0, "Move to the start of this line" },
|
||||
{ (VFunction *)ea_end_of_line, "echo-area-end-of-line", (FUNCTION_KEYSEQ *)0, "Move to the end of this line" },
|
||||
{ (VFunction *)ea_forward_word, "echo-area-forward-word", (FUNCTION_KEYSEQ *)0, "Move forward a word" },
|
||||
{ (VFunction *)ea_backward_word, "echo-area-backward-word", (FUNCTION_KEYSEQ *)0, "Move backward a word" },
|
||||
{ (VFunction *)ea_delete, "echo-area-delete", (FUNCTION_KEYSEQ *)0, "Delete the character under the cursor" },
|
||||
{ (VFunction *)ea_rubout, "echo-area-rubout", (FUNCTION_KEYSEQ *)0, "Delete the character behind the cursor" },
|
||||
{ (VFunction *)ea_abort, "echo-area-abort", (FUNCTION_KEYSEQ *)0, "Cancel or quit operation" },
|
||||
{ (VFunction *)ea_newline, "echo-area-newline", (FUNCTION_KEYSEQ *)0, "Accept (or force completion of) this line" },
|
||||
{ (VFunction *)ea_quoted_insert, "echo-area-quoted-insert", (FUNCTION_KEYSEQ *)0, "Insert next character verbatim" },
|
||||
{ (VFunction *)ea_insert, "echo-area-insert", (FUNCTION_KEYSEQ *)0, "Insert this character" },
|
||||
{ (VFunction *)ea_tab_insert, "echo-area-tab-insert", (FUNCTION_KEYSEQ *)0, "Insert a TAB character" },
|
||||
{ (VFunction *)ea_transpose_chars, "echo-area-transpose-chars", (FUNCTION_KEYSEQ *)0, "Transpose characters at point" },
|
||||
{ (VFunction *)ea_yank, "echo-area-yank", (FUNCTION_KEYSEQ *)0, "Yank back the contents of the last kill" },
|
||||
{ (VFunction *)ea_yank_pop, "echo-area-yank-pop", (FUNCTION_KEYSEQ *)0, "Yank back a previous kill" },
|
||||
{ (VFunction *)ea_kill_line, "echo-area-kill-line", (FUNCTION_KEYSEQ *)0, "Kill to the end of the line" },
|
||||
{ (VFunction *)ea_backward_kill_line, "echo-area-backward-kill-line", (FUNCTION_KEYSEQ *)0, "Kill to the beginning of the line" },
|
||||
{ (VFunction *)ea_kill_word, "echo-area-kill-word", (FUNCTION_KEYSEQ *)0, "Kill the word following the cursor" },
|
||||
{ (VFunction *)ea_backward_kill_word, "echo-area-backward-kill-word", (FUNCTION_KEYSEQ *)0, "Kill the word preceding the cursor" },
|
||||
{ (VFunction *)ea_possible_completions, "echo-area-possible-completions", (FUNCTION_KEYSEQ *)0, "List possible completions" },
|
||||
{ (VFunction *)ea_complete, "echo-area-complete", (FUNCTION_KEYSEQ *)0, "Insert completion" },
|
||||
{ (VFunction *)ea_scroll_completions_window, "echo-area-scroll-completions-window", (FUNCTION_KEYSEQ *)0, "Scroll the completions window" },
|
||||
/* Commands found in "./infodoc.c". */
|
||||
{ (VFunction *)info_get_help_window, "get-help-window", (FUNCTION_KEYSEQ *)0, "Display help message" },
|
||||
{ (VFunction *)info_get_info_help_node, "get-info-help-node", (FUNCTION_KEYSEQ *)0, "Visit Info node `(info)Help'" },
|
||||
{ (VFunction *)describe_key, "describe-key", (FUNCTION_KEYSEQ *)0, "Print documentation for KEY" },
|
||||
{ (VFunction *)info_where_is, "where-is", (FUNCTION_KEYSEQ *)0, "Show what to type to execute a given command" },
|
||||
/* Commands found in "./m-x.c". */
|
||||
{ (VFunction *)describe_command, "describe-command", (FUNCTION_KEYSEQ *)0, "Read the name of an Info command and describe it" },
|
||||
{ (VFunction *)info_execute_command, "execute-command", (FUNCTION_KEYSEQ *)0, "Read a command name in the echo area and execute it" },
|
||||
{ (VFunction *)set_screen_height, "set-screen-height", (FUNCTION_KEYSEQ *)0, "Set the height of the displayed window" },
|
||||
/* Commands found in "./indices.c". */
|
||||
{ (VFunction *)info_index_search, "index-search", (FUNCTION_KEYSEQ *)0, "Look up a string in the index for this file" },
|
||||
{ (VFunction *)info_next_index_match, "next-index-match", (FUNCTION_KEYSEQ *)0, "Go to the next matching index item from the last `\\[index-search]' command" },
|
||||
{ (VFunction *)info_index_apropos, "index-apropos", (FUNCTION_KEYSEQ *)0, "Grovel all known info file's indices for a string and build a menu" },
|
||||
/* Commands found in "./nodemenu.c". */
|
||||
{ (VFunction *)list_visited_nodes, "list-visited-nodes", (FUNCTION_KEYSEQ *)0, "Make a window containing a menu of all of the currently visited nodes" },
|
||||
{ (VFunction *)select_visited_node, "select-visited-node", (FUNCTION_KEYSEQ *)0, "Select a node which has been previously visited in a visible window" },
|
||||
/* Commands found in "./footnotes.c". */
|
||||
{ (VFunction *)info_show_footnotes, "show-footnotes", (FUNCTION_KEYSEQ *)0, "Show the footnotes associated with this node in another window" },
|
||||
/* Commands found in "./variables.c". */
|
||||
{ (VFunction *)describe_variable, "describe-variable", (FUNCTION_KEYSEQ *)0, "Explain the use of a variable" },
|
||||
{ (VFunction *)set_variable, "set-variable", (FUNCTION_KEYSEQ *)0, "Set the value of an Info variable" },
|
||||
{ (VFunction *)NULL, (char *)NULL, (FUNCTION_KEYSEQ *)NULL, (char *)NULL }
|
||||
};
|
@ -1,103 +0,0 @@
|
||||
/* doc.h -- Structures associating function pointers with documentation.
|
||||
$Id: doc.h,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#if !defined (DOC_H)
|
||||
#define DOC_H
|
||||
|
||||
#include "info.h" /* for NAMED_FUNCTIONS, VFunction, etc. */
|
||||
|
||||
#if defined (INFOKEY)
|
||||
/* For each function, we keep track of the first defined key sequence
|
||||
which invokes that function, for each different map. This is so that
|
||||
the dynamic documentation generation in infodoc.c (a) doesn't have to
|
||||
search through copious KEYMAP_ENTRYs, and, more importantly, (b) the
|
||||
user and programmer can choose the preferred key sequence that is
|
||||
printed for any given function -- it's just the first one that
|
||||
appears in the user's infokey file or the default keymaps in
|
||||
infomap.c.
|
||||
|
||||
Each FUNCTION_DOC has a linked list of FUNCTION_KEYSEQ structs
|
||||
hanging off it, which are created on startup when the user and/or
|
||||
default keymaps are being parsed. */
|
||||
typedef struct function_keyseq
|
||||
{
|
||||
struct function_keyseq *next;
|
||||
struct keymap_entry *map;
|
||||
char *keyseq;
|
||||
} FUNCTION_KEYSEQ;
|
||||
|
||||
#endif /* INFOKEY */
|
||||
|
||||
|
||||
/* An array of FUNCTION_DOC structures is defined in doc.c, which is
|
||||
automagically generated by the makedoc utility, whose job is to scan
|
||||
through the source files for command function declarations and
|
||||
compile a list of all the ones it finds. This saves tedious
|
||||
housekeeping and avoids errors of omission. */
|
||||
typedef struct
|
||||
{
|
||||
VFunction *func;
|
||||
#if defined (NAMED_FUNCTIONS)
|
||||
char *func_name;
|
||||
#endif /* NAMED_FUNCTIONS */
|
||||
#if defined (INFOKEY)
|
||||
FUNCTION_KEYSEQ *keys;
|
||||
#endif /* INFOKEY */
|
||||
char *doc;
|
||||
} FUNCTION_DOC;
|
||||
|
||||
extern FUNCTION_DOC function_doc_array[];
|
||||
|
||||
/* 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,
|
||||
defined in doc.c, from which the pointer to the function can be
|
||||
easily divined using the InfoFunction() extractor. */
|
||||
#if defined(INFOKEY)
|
||||
typedef FUNCTION_DOC InfoCommand;
|
||||
/* 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 */
|
||||
typedef VFunction InfoCommand;
|
||||
#define InfoFunction(vf) ((vf))
|
||||
#define InfoCmd(fn) fn
|
||||
#define DocInfoCmd(fd) ((fd)->func)
|
||||
#endif /* !INFOKEY */
|
||||
|
||||
#include "infomap.h" /* for Keymap. */
|
||||
|
||||
#if defined (NAMED_FUNCTIONS)
|
||||
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,68 +0,0 @@
|
||||
/* dribble.c -- dribble files for Info.
|
||||
$Id: dribble.c,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "dribble.h"
|
||||
|
||||
/* When non-zero, it is a stream to write all input characters to for the
|
||||
duration of this info session. */
|
||||
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 (char *name)
|
||||
{
|
||||
/* Perhaps close existing dribble file. */
|
||||
close_dribble_file ();
|
||||
|
||||
/* Keystrokes can be non-printable characters, so we need binary I/O. */
|
||||
info_dribble_file = fopen (name, FOPEN_WBIN);
|
||||
|
||||
#if defined (HAVE_SETVBUF)
|
||||
if (info_dribble_file)
|
||||
# if defined (SETVBUF_REVERSED)
|
||||
setvbuf (info_dribble_file, _IONBF, (char *)NULL, 1);
|
||||
# else
|
||||
setvbuf (info_dribble_file, (char *)NULL, _IONBF, 1);
|
||||
# endif /* !SETVBUF_REVERSED */
|
||||
#endif /* HAVE_SETVBUF */
|
||||
}
|
||||
|
||||
/* If there is a dribble file already open, close it. */
|
||||
void
|
||||
close_dribble_file (void)
|
||||
{
|
||||
if (info_dribble_file)
|
||||
{
|
||||
fflush (info_dribble_file);
|
||||
fclose (info_dribble_file);
|
||||
info_dribble_file = (FILE *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Write some output to our existing dribble file. */
|
||||
void
|
||||
dribble (unsigned char byte)
|
||||
{
|
||||
if (info_dribble_file)
|
||||
fwrite (&byte, sizeof (unsigned char), 1, info_dribble_file);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/* dribble.h -- Functions and vars declared in dribble.c. */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#if !defined (_DRIBBLE_H_)
|
||||
#define _DRIBBLE_H_
|
||||
|
||||
/* When non-zero, it is a stream to write all input characters to for the
|
||||
duration of this info session. */
|
||||
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 (char *name);
|
||||
|
||||
/* If there is a dribble file already open, close it. */
|
||||
extern void close_dribble_file (void);
|
||||
|
||||
/* Write some output to our existing dribble file. */
|
||||
extern void dribble (unsigned char byte);
|
||||
|
||||
#endif /* !_DRIBBLE_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -1,85 +0,0 @@
|
||||
/* echo-area.h -- Functions used in reading information from the echo area.
|
||||
$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, 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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_ECHO_AREA_H
|
||||
#define INFO_ECHO_AREA_H
|
||||
|
||||
#define EA_MAX_INPUT 256
|
||||
|
||||
extern int echo_area_is_active, info_aborted_echo_area;
|
||||
|
||||
/* Non-zero means that the last command executed while reading input
|
||||
killed some text. */
|
||||
extern int echo_area_last_command_was_kill;
|
||||
|
||||
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 (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 (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 (WINDOW *window,
|
||||
char *prompt, REFERENCE **completions);
|
||||
|
||||
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,711 +0,0 @@
|
||||
/* filesys.c -- filesystem specific functions.
|
||||
$Id: filesys.c,v 1.6 2004/07/30 17:17:40 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
|
||||
#include "tilde.h"
|
||||
#include "filesys.h"
|
||||
|
||||
/* Local to this file. */
|
||||
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
|
||||
{
|
||||
char *suffix;
|
||||
char *decompressor;
|
||||
} COMPRESSION_ALIST;
|
||||
|
||||
static char *info_suffixes[] = {
|
||||
".info",
|
||||
"-info",
|
||||
"/index",
|
||||
".inf", /* 8+3 file on filesystem which supports long file names */
|
||||
#ifdef __MSDOS__
|
||||
/* 8+3 file names strike again... */
|
||||
".in", /* for .inz, .igz etc. */
|
||||
".i",
|
||||
#endif
|
||||
"",
|
||||
NULL
|
||||
};
|
||||
|
||||
static COMPRESSION_ALIST compress_suffixes[] = {
|
||||
{ ".gz", "gunzip" },
|
||||
{ ".bz2", "bunzip2" },
|
||||
{ ".z", "gunzip" },
|
||||
{ ".Z", "uncompress" },
|
||||
{ ".Y", "unyabba" },
|
||||
#ifdef __MSDOS__
|
||||
{ "gz", "gunzip" },
|
||||
{ "z", "gunzip" },
|
||||
#endif
|
||||
{ (char *)NULL, (char *)NULL }
|
||||
};
|
||||
|
||||
/* The path on which we look for info files. You can initialize this
|
||||
from the environment variable INFOPATH if there is one, or you can
|
||||
call info_add_path () to add paths to the beginning or end of it.
|
||||
You can call zap_infopath () to make the path go away. */
|
||||
char *infopath = (char *)NULL;
|
||||
static int infopath_size = 0;
|
||||
|
||||
/* 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. */
|
||||
static char *local_temp_filename = (char *)NULL;
|
||||
static int local_temp_filename_size = 0;
|
||||
|
||||
char *
|
||||
info_find_fullpath (char *partial)
|
||||
{
|
||||
int initial_character;
|
||||
char *temp;
|
||||
|
||||
filesys_error_number = 0;
|
||||
|
||||
maybe_initialize_infopath ();
|
||||
|
||||
if (partial && (initial_character = *partial))
|
||||
{
|
||||
char *expansion;
|
||||
|
||||
expansion = lookup_info_filename (partial);
|
||||
|
||||
if (expansion)
|
||||
return (expansion);
|
||||
|
||||
/* If we have the full path to this file, we still may have to add
|
||||
various extensions to it. I guess we have to stat this file
|
||||
after all. */
|
||||
if (IS_ABSOLUTE (partial))
|
||||
temp = info_absolute_file (partial);
|
||||
else if (initial_character == '~')
|
||||
{
|
||||
expansion = tilde_expand_word (partial);
|
||||
if (IS_ABSOLUTE (expansion))
|
||||
{
|
||||
temp = info_absolute_file (expansion);
|
||||
free (expansion);
|
||||
}
|
||||
else
|
||||
temp = expansion;
|
||||
}
|
||||
else if (initial_character == '.' &&
|
||||
(IS_SLASH (partial[1]) ||
|
||||
(partial[1] == '.' && IS_SLASH (partial[2]))))
|
||||
{
|
||||
if (local_temp_filename_size < 1024)
|
||||
local_temp_filename = (char *)xrealloc
|
||||
(local_temp_filename, (local_temp_filename_size = 1024));
|
||||
#if defined (HAVE_GETCWD)
|
||||
if (!getcwd (local_temp_filename, local_temp_filename_size))
|
||||
#else /* !HAVE_GETCWD */
|
||||
if (!getwd (local_temp_filename))
|
||||
#endif /* !HAVE_GETCWD */
|
||||
{
|
||||
filesys_error_number = errno;
|
||||
return (partial);
|
||||
}
|
||||
|
||||
strcat (local_temp_filename, "/");
|
||||
strcat (local_temp_filename, partial);
|
||||
temp = info_absolute_file (local_temp_filename); /* try extensions */
|
||||
if (!temp)
|
||||
partial = local_temp_filename;
|
||||
}
|
||||
else
|
||||
temp = info_file_in_path (partial, infopath);
|
||||
|
||||
if (temp)
|
||||
{
|
||||
remember_info_filename (partial, temp);
|
||||
if (strlen (temp) > (unsigned int) local_temp_filename_size)
|
||||
local_temp_filename = (char *) xrealloc
|
||||
(local_temp_filename,
|
||||
(local_temp_filename_size = (50 + strlen (temp))));
|
||||
strcpy (local_temp_filename, temp);
|
||||
free (temp);
|
||||
return (local_temp_filename);
|
||||
}
|
||||
}
|
||||
return (partial);
|
||||
}
|
||||
|
||||
/* Scan the list of directories in PATH looking for FILENAME. If we find
|
||||
one that is a regular file, return it as a new string. Otherwise, return
|
||||
a NULL pointer. */
|
||||
static char *
|
||||
info_file_in_path (char *filename, char *path)
|
||||
{
|
||||
struct stat finfo;
|
||||
char *temp_dirname;
|
||||
int statable, dirname_index;
|
||||
|
||||
/* Reject ridiculous cases up front, to prevent infinite recursion
|
||||
later on. E.g., someone might say "info '(.)foo'"... */
|
||||
if (!*filename || STREQ (filename, ".") || STREQ (filename, ".."))
|
||||
return NULL;
|
||||
|
||||
dirname_index = 0;
|
||||
|
||||
while ((temp_dirname = extract_colon_unit (path, &dirname_index)))
|
||||
{
|
||||
register int i, pre_suffix_length;
|
||||
char *temp;
|
||||
|
||||
/* Expand a leading tilde if one is present. */
|
||||
if (*temp_dirname == '~')
|
||||
{
|
||||
char *expanded_dirname;
|
||||
|
||||
expanded_dirname = tilde_expand_word (temp_dirname);
|
||||
free (temp_dirname);
|
||||
temp_dirname = expanded_dirname;
|
||||
}
|
||||
|
||||
temp = (char *)xmalloc (30 + strlen (temp_dirname) + strlen (filename));
|
||||
strcpy (temp, temp_dirname);
|
||||
if (!IS_SLASH (temp[(strlen (temp)) - 1]))
|
||||
strcat (temp, "/");
|
||||
strcat (temp, filename);
|
||||
|
||||
pre_suffix_length = strlen (temp);
|
||||
|
||||
free (temp_dirname);
|
||||
|
||||
for (i = 0; info_suffixes[i]; i++)
|
||||
{
|
||||
strcpy (temp + pre_suffix_length, info_suffixes[i]);
|
||||
|
||||
statable = (stat (temp, &finfo) == 0);
|
||||
|
||||
/* If we have found a regular file, then use that. Else, if we
|
||||
have found a directory, look in that directory for this file. */
|
||||
if (statable)
|
||||
{
|
||||
if (S_ISREG (finfo.st_mode))
|
||||
{
|
||||
return (temp);
|
||||
}
|
||||
else if (S_ISDIR (finfo.st_mode))
|
||||
{
|
||||
char *newpath, *filename_only, *newtemp;
|
||||
|
||||
newpath = xstrdup (temp);
|
||||
filename_only = filename_non_directory (filename);
|
||||
newtemp = info_file_in_path (filename_only, newpath);
|
||||
|
||||
free (newpath);
|
||||
if (newtemp)
|
||||
{
|
||||
free (temp);
|
||||
return (newtemp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Add various compression suffixes to the name to see if
|
||||
the file is present in compressed format. */
|
||||
register int j, pre_compress_suffix_length;
|
||||
|
||||
pre_compress_suffix_length = strlen (temp);
|
||||
|
||||
for (j = 0; compress_suffixes[j].suffix; j++)
|
||||
{
|
||||
strcpy (temp + pre_compress_suffix_length,
|
||||
compress_suffixes[j].suffix);
|
||||
|
||||
statable = (stat (temp, &finfo) == 0);
|
||||
if (statable && (S_ISREG (finfo.st_mode)))
|
||||
return (temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
free (temp);
|
||||
}
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
/* Assume FNAME is an absolute file name, and check whether it is
|
||||
a regular file. If it is, return it as a new string; otherwise
|
||||
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 (char *fname)
|
||||
{
|
||||
char *containing_dir = xstrdup (fname);
|
||||
char *base = filename_non_directory (containing_dir);
|
||||
|
||||
if (base > containing_dir)
|
||||
base[-1] = '\0';
|
||||
|
||||
return info_file_in_path (filename_non_directory (fname), containing_dir);
|
||||
}
|
||||
|
||||
|
||||
/* Given a string containing units of information separated by the
|
||||
PATH_SEP character, return the next one after IDX, or NULL if there
|
||||
are no more. Advance IDX to the character after the colon. */
|
||||
|
||||
char *
|
||||
extract_colon_unit (char *string, int *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++;
|
||||
|
||||
{
|
||||
char *value = xmalloc ((i - start) + 1);
|
||||
strncpy (value, &string[start], (i - start));
|
||||
value[i - start] = 0;
|
||||
|
||||
i++; /* move past PATH_SEP */
|
||||
*idx = i;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/* A structure which associates a filename with its expansion. */
|
||||
typedef struct
|
||||
{
|
||||
char *filename;
|
||||
char *expansion;
|
||||
} FILENAME_LIST;
|
||||
|
||||
/* An array of remembered arguments and results. */
|
||||
static FILENAME_LIST **names_and_files = (FILENAME_LIST **)NULL;
|
||||
static int names_and_files_index = 0;
|
||||
static int names_and_files_slots = 0;
|
||||
|
||||
/* Find the result for having already called info_find_fullpath () with
|
||||
FILENAME. */
|
||||
static char *
|
||||
lookup_info_filename (char *filename)
|
||||
{
|
||||
if (filename && names_and_files)
|
||||
{
|
||||
register int i;
|
||||
for (i = 0; names_and_files[i]; i++)
|
||||
{
|
||||
if (FILENAME_CMP (names_and_files[i]->filename, filename) == 0)
|
||||
return (names_and_files[i]->expansion);
|
||||
}
|
||||
}
|
||||
return (char *)NULL;;
|
||||
}
|
||||
|
||||
/* Add a filename and its expansion to our list. */
|
||||
static void
|
||||
remember_info_filename (char *filename, char *expansion)
|
||||
{
|
||||
FILENAME_LIST *new;
|
||||
|
||||
if (names_and_files_index + 2 > names_and_files_slots)
|
||||
{
|
||||
int alloc_size;
|
||||
names_and_files_slots += 10;
|
||||
|
||||
alloc_size = names_and_files_slots * sizeof (FILENAME_LIST *);
|
||||
|
||||
names_and_files =
|
||||
(FILENAME_LIST **) xrealloc (names_and_files, alloc_size);
|
||||
}
|
||||
|
||||
new = (FILENAME_LIST *)xmalloc (sizeof (FILENAME_LIST));
|
||||
new->filename = xstrdup (filename);
|
||||
new->expansion = expansion ? xstrdup (expansion) : (char *)NULL;
|
||||
|
||||
names_and_files[names_and_files_index++] = new;
|
||||
names_and_files[names_and_files_index] = (FILENAME_LIST *)NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_initialize_infopath (void)
|
||||
{
|
||||
if (!infopath_size)
|
||||
{
|
||||
infopath = (char *)
|
||||
xmalloc (infopath_size = (1 + strlen (DEFAULT_INFOPATH)));
|
||||
|
||||
strcpy (infopath, DEFAULT_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 (char *path, int where)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (!infopath)
|
||||
{
|
||||
infopath = (char *)xmalloc (infopath_size = 200 + strlen (path));
|
||||
infopath[0] = '\0';
|
||||
}
|
||||
|
||||
len = strlen (path) + strlen (infopath);
|
||||
|
||||
if (len + 2 >= infopath_size)
|
||||
infopath = (char *)xrealloc (infopath, (infopath_size += (2 * len) + 2));
|
||||
|
||||
if (!*infopath)
|
||||
strcpy (infopath, path);
|
||||
else if (where == INFOPATH_APPEND)
|
||||
{
|
||||
strcat (infopath, PATH_SEP);
|
||||
strcat (infopath, path);
|
||||
}
|
||||
else if (where == INFOPATH_PREPEND)
|
||||
{
|
||||
char *temp = xstrdup (infopath);
|
||||
strcpy (infopath, path);
|
||||
strcat (infopath, PATH_SEP);
|
||||
strcat (infopath, temp);
|
||||
free (temp);
|
||||
}
|
||||
}
|
||||
|
||||
/* Make INFOPATH have absolutely nothing in it. */
|
||||
void
|
||||
zap_infopath (void)
|
||||
{
|
||||
if (infopath)
|
||||
free (infopath);
|
||||
|
||||
infopath = (char *)NULL;
|
||||
infopath_size = 0;
|
||||
}
|
||||
|
||||
/* Given a chunk of text and its length, convert all CRLF pairs at every
|
||||
end-of-line into a single Newline character. Return the length of
|
||||
produced text.
|
||||
|
||||
This is required because the rest of code is too entrenched in having
|
||||
a single newline at each EOL; in particular, searching for various
|
||||
Info headers and cookies can become extremely tricky if that assumption
|
||||
breaks.
|
||||
|
||||
FIXME: this could also support Mac-style text files with a single CR
|
||||
at the EOL, but what about random CR characters in non-Mac files? Can
|
||||
we afford converting them into newlines as well? Maybe implement some
|
||||
heuristics here, like in Emacs 20.
|
||||
|
||||
FIXME: is it a good idea to show the EOL type on the modeline? */
|
||||
long
|
||||
convert_eols (char *text, long int textlen)
|
||||
{
|
||||
register char *s = text;
|
||||
register char *d = text;
|
||||
|
||||
while (textlen--)
|
||||
{
|
||||
if (*s == '\r' && textlen && s[1] == '\n')
|
||||
{
|
||||
s++;
|
||||
textlen--;
|
||||
}
|
||||
*d++ = *s++;
|
||||
}
|
||||
|
||||
return (long)(d - text);
|
||||
}
|
||||
|
||||
/* 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 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 (char *pathname, long int *filesize,
|
||||
struct stat *finfo, int *is_compressed)
|
||||
{
|
||||
long st_size;
|
||||
|
||||
*filesize = filesys_error_number = 0;
|
||||
|
||||
if (compressed_filename_p (pathname))
|
||||
{
|
||||
*is_compressed = 1;
|
||||
return (filesys_read_compressed (pathname, filesize));
|
||||
}
|
||||
else
|
||||
{
|
||||
int descriptor;
|
||||
char *contents;
|
||||
|
||||
*is_compressed = 0;
|
||||
descriptor = open (pathname, O_RDONLY | O_BINARY, 0666);
|
||||
|
||||
/* If the file couldn't be opened, give up. */
|
||||
if (descriptor < 0)
|
||||
{
|
||||
filesys_error_number = errno;
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
/* Try to read the contents of this file. */
|
||||
st_size = (long) finfo->st_size;
|
||||
contents = (char *)xmalloc (1 + st_size);
|
||||
if ((read (descriptor, contents, st_size)) != st_size)
|
||||
{
|
||||
filesys_error_number = errno;
|
||||
close (descriptor);
|
||||
free (contents);
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
close (descriptor);
|
||||
|
||||
/* Convert any DOS-style CRLF EOLs into Unix-style NL.
|
||||
Seems like a good idea to have even on Unix, in case the Info
|
||||
files are coming from some Windows system across a network. */
|
||||
*filesize = convert_eols (contents, st_size);
|
||||
|
||||
/* EOL conversion can shrink the text quite a bit. We don't
|
||||
want to waste storage. */
|
||||
if (*filesize < st_size)
|
||||
contents = (char *)xrealloc (contents, 1 + *filesize);
|
||||
contents[*filesize] = '\0';
|
||||
|
||||
return (contents);
|
||||
}
|
||||
}
|
||||
|
||||
/* Typically, pipe buffers are 4k. */
|
||||
#define BASIC_PIPE_BUFFER (4 * 1024)
|
||||
|
||||
/* We use some large multiple of that. */
|
||||
#define FILESYS_PIPE_BUFFER_SIZE (16 * BASIC_PIPE_BUFFER)
|
||||
|
||||
char *
|
||||
filesys_read_compressed (char *pathname, long int *filesize)
|
||||
{
|
||||
FILE *stream;
|
||||
char *command, *decompressor;
|
||||
char *contents = (char *)NULL;
|
||||
|
||||
*filesize = filesys_error_number = 0;
|
||||
|
||||
decompressor = filesys_decompressor_for_file (pathname);
|
||||
|
||||
if (!decompressor)
|
||||
return ((char *)NULL);
|
||||
|
||||
command = (char *)xmalloc (15 + strlen (pathname) + strlen (decompressor));
|
||||
/* Explicit .exe suffix makes the diagnostics of `popen'
|
||||
better on systems where COMMAND.COM is the stock shell. */
|
||||
sprintf (command, "%s%s < %s",
|
||||
decompressor, STRIP_DOT_EXE ? ".exe" : "", pathname);
|
||||
|
||||
#if !defined (BUILDING_LIBRARY)
|
||||
if (info_windows_initialized_p)
|
||||
{
|
||||
char *temp;
|
||||
|
||||
temp = (char *)xmalloc (5 + strlen (command));
|
||||
sprintf (temp, "%s...", command);
|
||||
message_in_echo_area ("%s", temp, NULL);
|
||||
free (temp);
|
||||
}
|
||||
#endif /* !BUILDING_LIBRARY */
|
||||
|
||||
stream = popen (command, FOPEN_RBIN);
|
||||
free (command);
|
||||
|
||||
/* Read chunks from this file until there are none left to read. */
|
||||
if (stream)
|
||||
{
|
||||
long offset, size;
|
||||
char *chunk;
|
||||
|
||||
offset = size = 0;
|
||||
chunk = (char *)xmalloc (FILESYS_PIPE_BUFFER_SIZE);
|
||||
|
||||
while (1)
|
||||
{
|
||||
int bytes_read;
|
||||
|
||||
bytes_read = fread (chunk, 1, FILESYS_PIPE_BUFFER_SIZE, stream);
|
||||
|
||||
if (bytes_read + offset >= size)
|
||||
contents = (char *)xrealloc
|
||||
(contents, size += (2 * FILESYS_PIPE_BUFFER_SIZE));
|
||||
|
||||
memcpy (contents + offset, chunk, bytes_read);
|
||||
offset += bytes_read;
|
||||
if (bytes_read != FILESYS_PIPE_BUFFER_SIZE)
|
||||
break;
|
||||
}
|
||||
|
||||
free (chunk);
|
||||
if (pclose (stream) == -1)
|
||||
{
|
||||
if (contents)
|
||||
free (contents);
|
||||
contents = (char *)NULL;
|
||||
filesys_error_number = errno;
|
||||
}
|
||||
else
|
||||
{
|
||||
*filesize = convert_eols (contents, offset);
|
||||
contents = (char *)xrealloc (contents, 1 + *filesize);
|
||||
contents[*filesize] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
filesys_error_number = errno;
|
||||
}
|
||||
|
||||
#if !defined (BUILDING_LIBARARY)
|
||||
if (info_windows_initialized_p)
|
||||
unmessage_in_echo_area ();
|
||||
#endif /* !BUILDING_LIBRARY */
|
||||
return (contents);
|
||||
}
|
||||
|
||||
/* Return non-zero if FILENAME belongs to a compressed file. */
|
||||
int
|
||||
compressed_filename_p (char *filename)
|
||||
{
|
||||
char *decompressor;
|
||||
|
||||
/* Find the final extension of this filename, and see if it matches one
|
||||
of our known ones. */
|
||||
decompressor = filesys_decompressor_for_file (filename);
|
||||
|
||||
if (decompressor)
|
||||
return (1);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Return the command string that would be used to decompress FILENAME. */
|
||||
char *
|
||||
filesys_decompressor_for_file (char *filename)
|
||||
{
|
||||
register int i;
|
||||
char *extension = (char *)NULL;
|
||||
|
||||
/* Find the final extension of FILENAME, and see if it appears in our
|
||||
list of known compression extensions. */
|
||||
for (i = strlen (filename) - 1; i > 0; i--)
|
||||
if (filename[i] == '.')
|
||||
{
|
||||
extension = filename + i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!extension)
|
||||
return ((char *)NULL);
|
||||
|
||||
for (i = 0; compress_suffixes[i].suffix; i++)
|
||||
if (FILENAME_CMP (extension, compress_suffixes[i].suffix) == 0)
|
||||
return (compress_suffixes[i].decompressor);
|
||||
|
||||
#if defined (__MSDOS__)
|
||||
/* If no other suffix matched, allow any extension which ends
|
||||
with `z' to be decompressed by gunzip. Due to limited 8+3 DOS
|
||||
file namespace, we can expect many such cases, and supporting
|
||||
every weird suffix thus produced would be a pain. */
|
||||
if (extension[strlen (extension) - 1] == 'z' ||
|
||||
extension[strlen (extension) - 1] == 'Z')
|
||||
return "gunzip";
|
||||
#endif
|
||||
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
/* The number of the most recent file system error. */
|
||||
int filesys_error_number = 0;
|
||||
|
||||
/* A function which returns a pointer to a static buffer containing
|
||||
an error message for FILENAME and ERROR_NUM. */
|
||||
static char *errmsg_buf = (char *)NULL;
|
||||
static int errmsg_buf_size = 0;
|
||||
|
||||
char *
|
||||
filesys_error_string (char *filename, int error_num)
|
||||
{
|
||||
int len;
|
||||
char *result;
|
||||
|
||||
if (error_num == 0)
|
||||
return ((char *)NULL);
|
||||
|
||||
result = strerror (error_num);
|
||||
|
||||
len = 4 + strlen (filename) + strlen (result);
|
||||
if (len >= errmsg_buf_size)
|
||||
errmsg_buf = (char *)xrealloc (errmsg_buf, (errmsg_buf_size = 2 + len));
|
||||
|
||||
sprintf (errmsg_buf, "%s: %s", filename, result);
|
||||
return (errmsg_buf);
|
||||
}
|
||||
|
||||
|
||||
/* Check for "dir" with all the possible info and compression suffixes,
|
||||
in combination. */
|
||||
|
||||
int
|
||||
is_dir_name (char *filename)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; info_suffixes[i]; i++)
|
||||
{
|
||||
unsigned c;
|
||||
char trydir[50];
|
||||
strcpy (trydir, "dir");
|
||||
strcat (trydir, info_suffixes[i]);
|
||||
|
||||
if (strcasecmp (filename, trydir) == 0)
|
||||
return 1;
|
||||
|
||||
for (c = 0; compress_suffixes[c].suffix; c++)
|
||||
{
|
||||
char dir_compressed[50]; /* can be short */
|
||||
strcpy (dir_compressed, trydir);
|
||||
strcat (dir_compressed, compress_suffixes[c].suffix);
|
||||
if (strcasecmp (filename, dir_compressed) == 0)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
/* filesys.h -- external declarations for filesys.c.
|
||||
$Id: filesys.h,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_FILESYS_H
|
||||
#define INFO_FILESYS_H
|
||||
|
||||
/* The path on which we look for info files. You can initialize this
|
||||
from the environment variable INFOPATH if there is one, or you can
|
||||
call info_add_path () to add paths to the beginning or end of it. */
|
||||
extern char *infopath;
|
||||
|
||||
/* Make INFOPATH have absolutely nothing in it. */
|
||||
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 (char *path, int where);
|
||||
|
||||
/* Defines that are passed along with the pathname to info_add_path (). */
|
||||
#define INFOPATH_PREPEND 0
|
||||
#define INFOPATH_APPEND 1
|
||||
|
||||
/* 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 (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 (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 (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 (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 (char *filename, int error_num);
|
||||
|
||||
/* The number of the most recent file system error. */
|
||||
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 (char *string, int *idx);
|
||||
|
||||
/* Return true if FILENAME is `dir', with a possible compression suffix. */
|
||||
extern int is_dir_name (char *filename);
|
||||
|
||||
/* The default value of INFOPATH. */
|
||||
#if !defined (DEFAULT_INFOPATH)
|
||||
# define DEFAULT_INFOPATH "/usr/local/info:/usr/info:/usr/local/lib/info:/usr/lib/info:/usr/local/gnu/info:/usr/local/gnu/lib/info:/usr/gnu/info:/usr/gnu/lib/info:/opt/gnu/info:/usr/share/info:/usr/share/lib/info:/usr/local/share/info:/usr/local/share/lib/info:/usr/gnu/lib/emacs/info:/usr/local/gnu/lib/emacs/info:/usr/local/lib/emacs/info:/usr/local/emacs/info:."
|
||||
#endif /* !DEFAULT_INFOPATH */
|
||||
|
||||
#if !defined (S_ISREG) && defined (S_IFREG)
|
||||
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#endif /* !S_ISREG && S_IFREG */
|
||||
|
||||
#if !defined (S_ISDIR) && defined (S_IFDIR)
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif /* !S_ISDIR && S_IFDIR */
|
||||
|
||||
#endif /* not INFO_FILESYS_H */
|
@ -1,268 +0,0 @@
|
||||
/* footnotes.c -- Some functions for manipulating footnotes.
|
||||
$Id: footnotes.c,v 1.4 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
|
||||
/* Nonzero means attempt to show footnotes when displaying a new window. */
|
||||
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"
|
||||
|
||||
/* Find the window currently showing footnotes. */
|
||||
static WINDOW *
|
||||
find_footnotes_window (void)
|
||||
{
|
||||
WINDOW *win;
|
||||
|
||||
/* Try to find an existing window first. */
|
||||
for (win = windows; win; win = win->next)
|
||||
if (internal_info_node_p (win->node) &&
|
||||
(strcmp (win->node->nodename, footnote_nodename) == 0))
|
||||
break;
|
||||
|
||||
return (win);
|
||||
}
|
||||
|
||||
/* Manufacture a node containing the footnotes of this node, and
|
||||
return the manufactured node. If NODE has no footnotes, return a
|
||||
NULL pointer. */
|
||||
NODE *
|
||||
make_footnotes_node (NODE *node)
|
||||
{
|
||||
NODE *fn_node, *result = (NODE *)NULL;
|
||||
long fn_start;
|
||||
|
||||
/* Make the initial assumption that the footnotes appear as simple
|
||||
text within this windows node. */
|
||||
fn_node = node;
|
||||
|
||||
/* See if this node contains the magic footnote label. */
|
||||
fn_start =
|
||||
info_search_in_node (FOOTNOTE_LABEL, node, 0, (WINDOW *)NULL, 1, 0);
|
||||
|
||||
/* If it doesn't, check to see if it has an associated footnotes node. */
|
||||
if (fn_start == -1)
|
||||
{
|
||||
REFERENCE **refs;
|
||||
|
||||
refs = info_xrefs_of_node (node);
|
||||
|
||||
if (refs)
|
||||
{
|
||||
register int i;
|
||||
char *refname;
|
||||
int reflen = strlen ("-Footnotes") + strlen (node->nodename);
|
||||
|
||||
refname = (char *)xmalloc (reflen + 1);
|
||||
|
||||
strcpy (refname, node->nodename);
|
||||
strcat (refname, "-Footnotes");
|
||||
|
||||
for (i = 0; refs[i]; i++)
|
||||
if ((refs[i]->nodename != (char *)NULL) &&
|
||||
/* Support both the older "foo-Footnotes" and the new
|
||||
style "foo-Footnote-NN" references. */
|
||||
(strcmp (refs[i]->nodename, refname) == 0 ||
|
||||
(strncmp (refs[i]->nodename, refname, reflen - 1) == 0 &&
|
||||
refs[i]->nodename[reflen - 1] == '-' &&
|
||||
isdigit (refs[i]->nodename[reflen]))))
|
||||
{
|
||||
char *filename;
|
||||
|
||||
filename = node->parent;
|
||||
if (!filename)
|
||||
filename = node->filename;
|
||||
|
||||
fn_node = info_get_node (filename, refname);
|
||||
|
||||
if (fn_node)
|
||||
fn_start = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
free (refname);
|
||||
info_free_references (refs);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we never found the start of a footnotes area, quit now. */
|
||||
if (fn_start == -1)
|
||||
return ((NODE *)NULL);
|
||||
|
||||
/* Make the new node. */
|
||||
result = (NODE *)xmalloc (sizeof (NODE));
|
||||
result->flags = 0;
|
||||
result->display_pos = 0;
|
||||
|
||||
/* Get the size of the footnotes appearing within this node. */
|
||||
{
|
||||
char *header;
|
||||
long text_start = fn_start;
|
||||
|
||||
header = (char *)xmalloc
|
||||
(1 + strlen (node->nodename) + strlen (FOOTNOTE_HEADER_FORMAT));
|
||||
sprintf (header, FOOTNOTE_HEADER_FORMAT, node->nodename);
|
||||
|
||||
/* Move the start of the displayed text to right after the first line.
|
||||
This effectively skips either "---- footno...", or "File: foo...". */
|
||||
while (text_start < fn_node->nodelen)
|
||||
if (fn_node->contents[text_start++] == '\n')
|
||||
break;
|
||||
|
||||
result->nodelen = strlen (header) + fn_node->nodelen - text_start;
|
||||
|
||||
/* Set the contents of this node. */
|
||||
result->contents = (char *)xmalloc (1 + result->nodelen);
|
||||
sprintf (result->contents, "%s", header);
|
||||
memcpy (result->contents + strlen (header),
|
||||
fn_node->contents + text_start, fn_node->nodelen - text_start);
|
||||
|
||||
name_internal_node (result, footnote_nodename);
|
||||
free (header);
|
||||
}
|
||||
|
||||
#if defined (NOTDEF)
|
||||
/* If the footnotes were gleaned from the node that we were called with,
|
||||
shorten the calling node's display length. */
|
||||
if (fn_node == node)
|
||||
narrow_node (node, 0, fn_start);
|
||||
#endif /* NOTDEF */
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Create or delete the footnotes window depending on whether footnotes
|
||||
exist in WINDOW's node or not. Returns FN_FOUND if footnotes were found
|
||||
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. */
|
||||
int
|
||||
info_get_or_remove_footnotes (WINDOW *window)
|
||||
{
|
||||
WINDOW *fn_win;
|
||||
NODE *new_footnotes;
|
||||
|
||||
fn_win = find_footnotes_window ();
|
||||
|
||||
/* If we are in the footnotes window, change nothing. */
|
||||
if (fn_win == window)
|
||||
return (FN_FOUND);
|
||||
|
||||
/* Try to find footnotes for this window's node. */
|
||||
new_footnotes = make_footnotes_node (window->node);
|
||||
|
||||
/* If there was a window showing footnotes, and there are no footnotes
|
||||
for the current window, delete the old footnote window. */
|
||||
if (fn_win && !new_footnotes)
|
||||
{
|
||||
if (windows->next)
|
||||
info_delete_window_internal (fn_win);
|
||||
}
|
||||
|
||||
/* If there are footnotes for this window's node, but no window around
|
||||
showing footnotes, try to make a new window. */
|
||||
if (new_footnotes && !fn_win)
|
||||
{
|
||||
WINDOW *old_active;
|
||||
WINDOW *last, *win;
|
||||
|
||||
/* Always make this window be the last one appearing in the list. Find
|
||||
the last window in the chain. */
|
||||
for (win = windows, last = windows; win; last = win, win = win->next);
|
||||
|
||||
/* Try to split this window, and make the split window the one to
|
||||
contain the footnotes. */
|
||||
old_active = active_window;
|
||||
active_window = last;
|
||||
fn_win = window_make_window (new_footnotes);
|
||||
active_window = old_active;
|
||||
|
||||
if (!fn_win)
|
||||
{
|
||||
free (new_footnotes->contents);
|
||||
free (new_footnotes);
|
||||
|
||||
/* 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 ((char *) _("Footnotes could not be displayed"));
|
||||
return (FN_UNABLE);
|
||||
}
|
||||
}
|
||||
|
||||
/* If there are footnotes, and there is a window to display them,
|
||||
make that window be the number of lines appearing in the footnotes. */
|
||||
if (new_footnotes && fn_win)
|
||||
{
|
||||
window_set_node_of_window (fn_win, new_footnotes);
|
||||
|
||||
window_change_window_height
|
||||
(fn_win, fn_win->line_count - fn_win->height);
|
||||
|
||||
remember_window_and_node (fn_win, new_footnotes);
|
||||
add_gcable_pointer (new_footnotes->contents);
|
||||
}
|
||||
|
||||
if (!new_footnotes)
|
||||
return (FN_UNFOUND);
|
||||
else
|
||||
return (FN_FOUND);
|
||||
}
|
||||
|
||||
/* Show the footnotes associated with this node in another window. */
|
||||
DECLARE_INFO_COMMAND (info_show_footnotes,
|
||||
_("Show the footnotes associated with this node in another window"))
|
||||
{
|
||||
/* A negative argument means just make the window go away. */
|
||||
if (count < 0)
|
||||
{
|
||||
WINDOW *fn_win = find_footnotes_window ();
|
||||
|
||||
/* If there is an old footnotes window, and it isn't the only window
|
||||
on the screen, delete it. */
|
||||
if (fn_win && windows->next)
|
||||
info_delete_window_internal (fn_win);
|
||||
}
|
||||
else
|
||||
{
|
||||
int result;
|
||||
|
||||
result = info_get_or_remove_footnotes (window);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case FN_UNFOUND:
|
||||
info_error ((char *) msg_no_foot_node, NULL, NULL);
|
||||
break;
|
||||
|
||||
case FN_UNABLE:
|
||||
info_error ((char *) msg_win_too_small, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/* footnotes.h -- Some functions for manipulating footnotes.
|
||||
$Id: footnotes.h,v 1.3 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_FOOTNOTES_H
|
||||
#define INFO_FOOTNOTES_H
|
||||
|
||||
/* Magic string which indicates following text is footnotes. */
|
||||
#define FOOTNOTE_LABEL N_("---------- Footnotes ----------")
|
||||
|
||||
#define FN_FOUND 0
|
||||
#define FN_UNFOUND 1
|
||||
#define FN_UNABLE 2
|
||||
|
||||
|
||||
/* Create or delete the footnotes window depending on whether footnotes
|
||||
exist in WINDOW's node or not. Returns FN_FOUND if footnotes were found
|
||||
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 (WINDOW *window);
|
||||
|
||||
/* Non-zero means attempt to show footnotes when displaying a new window. */
|
||||
extern int auto_footnotes_p;
|
||||
|
||||
#endif /* not INFO_FOOTNOTES_H */
|
@ -1,243 +0,0 @@
|
||||
/* funs.h -- Generated declarations for Info commands. */
|
||||
|
||||
#include "info.h"
|
||||
|
||||
/* Functions declared in "./session.c". */
|
||||
#define A_info_next_line 0
|
||||
extern void info_next_line (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_prev_line 1
|
||||
extern void info_prev_line (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_end_of_line 2
|
||||
extern void info_end_of_line (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_beginning_of_line 3
|
||||
extern void info_beginning_of_line (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_forward_char 4
|
||||
extern void info_forward_char (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_backward_char 5
|
||||
extern void info_backward_char (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_forward_word 6
|
||||
extern void info_forward_word (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_backward_word 7
|
||||
extern void info_backward_word (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_global_next_node 8
|
||||
extern void info_global_next_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_global_prev_node 9
|
||||
extern void info_global_prev_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_scroll_forward 10
|
||||
extern void info_scroll_forward (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_scroll_forward_set_window 11
|
||||
extern void info_scroll_forward_set_window (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_scroll_forward_page_only 12
|
||||
extern void info_scroll_forward_page_only (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_scroll_forward_page_only_set_window 13
|
||||
extern void info_scroll_forward_page_only_set_window (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_scroll_backward 14
|
||||
extern void info_scroll_backward (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_scroll_backward_set_window 15
|
||||
extern void info_scroll_backward_set_window (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_scroll_backward_page_only 16
|
||||
extern void info_scroll_backward_page_only (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_scroll_backward_page_only_set_window 17
|
||||
extern void info_scroll_backward_page_only_set_window (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_beginning_of_node 18
|
||||
extern void info_beginning_of_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_end_of_node 19
|
||||
extern void info_end_of_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_down_line 20
|
||||
extern void info_down_line (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_up_line 21
|
||||
extern void info_up_line (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_scroll_half_screen_down 22
|
||||
extern void info_scroll_half_screen_down (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_scroll_half_screen_up 23
|
||||
extern void info_scroll_half_screen_up (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_next_window 24
|
||||
extern void info_next_window (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_prev_window 25
|
||||
extern void info_prev_window (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_split_window 26
|
||||
extern void info_split_window (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_delete_window 27
|
||||
extern void info_delete_window (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_keep_one_window 28
|
||||
extern void info_keep_one_window (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_scroll_other_window 29
|
||||
extern void info_scroll_other_window (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_scroll_other_window_backward 30
|
||||
extern void info_scroll_other_window_backward (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_grow_window 31
|
||||
extern void info_grow_window (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_tile_windows 32
|
||||
extern void info_tile_windows (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_toggle_wrap 33
|
||||
extern void info_toggle_wrap (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_next_node 34
|
||||
extern void info_next_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_prev_node 35
|
||||
extern void info_prev_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_up_node 36
|
||||
extern void info_up_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_last_node 37
|
||||
extern void info_last_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_first_node 38
|
||||
extern void info_first_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_last_menu_item 39
|
||||
extern void info_last_menu_item (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_menu_digit 40
|
||||
extern void info_menu_digit (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_menu_item 41
|
||||
extern void info_menu_item (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_xref_item 42
|
||||
extern void info_xref_item (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_find_menu 43
|
||||
extern void info_find_menu (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_visit_menu 44
|
||||
extern void info_visit_menu (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_goto_node 45
|
||||
extern void info_goto_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_menu_sequence 46
|
||||
extern void info_menu_sequence (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_goto_invocation_node 47
|
||||
extern void info_goto_invocation_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_man 48
|
||||
extern void info_man (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_top_node 49
|
||||
extern void info_top_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_dir_node 50
|
||||
extern void info_dir_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_history_node 51
|
||||
extern void info_history_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_kill_node 52
|
||||
extern void info_kill_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_view_file 53
|
||||
extern void info_view_file (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_print_node 54
|
||||
extern void info_print_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_search_case_sensitively 55
|
||||
extern void info_search_case_sensitively (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_search 56
|
||||
extern void info_search (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_search_backward 57
|
||||
extern void info_search_backward (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_search_next 58
|
||||
extern void info_search_next (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_search_previous 59
|
||||
extern void info_search_previous (WINDOW *window, int count, unsigned char key);
|
||||
#define A_isearch_forward 60
|
||||
extern void isearch_forward (WINDOW *window, int count, unsigned char key);
|
||||
#define A_isearch_backward 61
|
||||
extern void isearch_backward (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_move_to_prev_xref 62
|
||||
extern void info_move_to_prev_xref (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_move_to_next_xref 63
|
||||
extern void info_move_to_next_xref (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_select_reference_this_line 64
|
||||
extern void info_select_reference_this_line (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_abort_key 65
|
||||
extern void info_abort_key (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_move_to_window_line 66
|
||||
extern void info_move_to_window_line (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_redraw_display 67
|
||||
extern void info_redraw_display (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_quit 68
|
||||
extern void info_quit (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_do_lowercase_version 69
|
||||
extern void info_do_lowercase_version (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_add_digit_to_numeric_arg 70
|
||||
extern void info_add_digit_to_numeric_arg (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_universal_argument 71
|
||||
extern void info_universal_argument (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_numeric_arg_digit_loop 72
|
||||
extern void info_numeric_arg_digit_loop (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Functions declared in "./echo-area.c". */
|
||||
#define A_ea_forward 73
|
||||
extern void ea_forward (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_backward 74
|
||||
extern void ea_backward (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_beg_of_line 75
|
||||
extern void ea_beg_of_line (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_end_of_line 76
|
||||
extern void ea_end_of_line (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_forward_word 77
|
||||
extern void ea_forward_word (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_backward_word 78
|
||||
extern void ea_backward_word (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_delete 79
|
||||
extern void ea_delete (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_rubout 80
|
||||
extern void ea_rubout (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_abort 81
|
||||
extern void ea_abort (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_newline 82
|
||||
extern void ea_newline (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_quoted_insert 83
|
||||
extern void ea_quoted_insert (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_insert 84
|
||||
extern void ea_insert (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_tab_insert 85
|
||||
extern void ea_tab_insert (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_transpose_chars 86
|
||||
extern void ea_transpose_chars (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_yank 87
|
||||
extern void ea_yank (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_yank_pop 88
|
||||
extern void ea_yank_pop (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_kill_line 89
|
||||
extern void ea_kill_line (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_backward_kill_line 90
|
||||
extern void ea_backward_kill_line (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_kill_word 91
|
||||
extern void ea_kill_word (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_backward_kill_word 92
|
||||
extern void ea_backward_kill_word (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_possible_completions 93
|
||||
extern void ea_possible_completions (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_complete 94
|
||||
extern void ea_complete (WINDOW *window, int count, unsigned char key);
|
||||
#define A_ea_scroll_completions_window 95
|
||||
extern void ea_scroll_completions_window (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Functions declared in "./infodoc.c". */
|
||||
#define A_info_get_help_window 96
|
||||
extern void info_get_help_window (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_get_info_help_node 97
|
||||
extern void info_get_info_help_node (WINDOW *window, int count, unsigned char key);
|
||||
#define A_describe_key 98
|
||||
extern void describe_key (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_where_is 99
|
||||
extern void info_where_is (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Functions declared in "./m-x.c". */
|
||||
#define A_describe_command 100
|
||||
extern void describe_command (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_execute_command 101
|
||||
extern void info_execute_command (WINDOW *window, int count, unsigned char key);
|
||||
#define A_set_screen_height 102
|
||||
extern void set_screen_height (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Functions declared in "./indices.c". */
|
||||
#define A_info_index_search 103
|
||||
extern void info_index_search (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_next_index_match 104
|
||||
extern void info_next_index_match (WINDOW *window, int count, unsigned char key);
|
||||
#define A_info_index_apropos 105
|
||||
extern void info_index_apropos (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Functions declared in "./nodemenu.c". */
|
||||
#define A_list_visited_nodes 106
|
||||
extern void list_visited_nodes (WINDOW *window, int count, unsigned char key);
|
||||
#define A_select_visited_node 107
|
||||
extern void select_visited_node (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Functions declared in "./footnotes.c". */
|
||||
#define A_info_show_footnotes 108
|
||||
extern void info_show_footnotes (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
/* Functions declared in "./variables.c". */
|
||||
#define A_describe_variable 109
|
||||
extern void describe_variable (WINDOW *window, int count, unsigned char key);
|
||||
#define A_set_variable 110
|
||||
extern void set_variable (WINDOW *window, int count, unsigned char key);
|
||||
|
||||
#define A_NCOMMANDS 111
|
@ -1,92 +0,0 @@
|
||||
/* 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 $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
|
||||
/* Array of pointers to the contents of gc-able nodes. A pointer on this
|
||||
list can be garbage collected when no info window contains a node whose
|
||||
contents member match the pointer. */
|
||||
static char **gcable_pointers = (char **)NULL;
|
||||
static int gcable_pointers_index = 0;
|
||||
static int gcable_pointers_slots = 0;
|
||||
|
||||
/* 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. */
|
||||
void
|
||||
add_gcable_pointer (char *pointer)
|
||||
{
|
||||
gc_pointers ();
|
||||
add_pointer_to_array (pointer, gcable_pointers_index, gcable_pointers,
|
||||
gcable_pointers_slots, 10, char *);
|
||||
}
|
||||
|
||||
/* Grovel the list of info windows and gc-able pointers finding those
|
||||
node->contents which are collectible, and free them. */
|
||||
void
|
||||
gc_pointers (void)
|
||||
{
|
||||
register int i, j, k;
|
||||
INFO_WINDOW *iw;
|
||||
char **new = (char **)NULL;
|
||||
int new_index = 0;
|
||||
int new_slots = 0;
|
||||
|
||||
if (!info_windows || !gcable_pointers_index)
|
||||
return;
|
||||
|
||||
for (i = 0; (iw = info_windows[i]); i++)
|
||||
{
|
||||
for (j = 0; j < iw->nodes_index; j++)
|
||||
{
|
||||
NODE *node = iw->nodes[j];
|
||||
|
||||
/* If this node->contents appears in our list of gcable_pointers,
|
||||
it is not gc-able, so save it. */
|
||||
for (k = 0; k < gcable_pointers_index; k++)
|
||||
if (gcable_pointers[k] == node->contents)
|
||||
{
|
||||
add_pointer_to_array
|
||||
(node->contents, new_index, new, new_slots, 10, char *);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* We have gathered all of the pointers which need to be saved. Free any
|
||||
of the original pointers which do not appear in the new list. */
|
||||
for (i = 0; i < gcable_pointers_index; i++)
|
||||
{
|
||||
for (j = 0; j < new_index; j++)
|
||||
if (gcable_pointers[i] == new[j])
|
||||
break;
|
||||
|
||||
/* If we got all the way through the new list, then the old pointer
|
||||
can be garbage collected. */
|
||||
if (new && !new[j])
|
||||
free (gcable_pointers[i]);
|
||||
}
|
||||
|
||||
free (gcable_pointers);
|
||||
gcable_pointers = new;
|
||||
gcable_pointers_slots = new_slots;
|
||||
gcable_pointers_index = new_index;
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/* gc.h -- Functions for garbage collecting unused node contents.
|
||||
$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, 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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_GC_H
|
||||
#define INFO_GC_H
|
||||
|
||||
/* 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 (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 (void);
|
||||
|
||||
#endif /* not INFO_GC_H */
|
@ -1,735 +0,0 @@
|
||||
/* indices.c -- deal with an Info file index.
|
||||
$Id: indices.c,v 1.5 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "indices.h"
|
||||
|
||||
/* User-visible variable controls the output of info-index-next. */
|
||||
int show_index_match = 1;
|
||||
|
||||
/* In the Info sense, an index is a menu. This variable holds the last
|
||||
parsed index. */
|
||||
static REFERENCE **index_index = (REFERENCE **)NULL;
|
||||
|
||||
/* The offset of the most recently selected index element. */
|
||||
static int index_offset = 0;
|
||||
|
||||
/* Variable which holds the last string searched for. */
|
||||
static char *index_search = (char *)NULL;
|
||||
|
||||
/* A couple of "globals" describing where the initial index was found. */
|
||||
static char *initial_index_filename = (char *)NULL;
|
||||
static char *initial_index_nodename = (char *)NULL;
|
||||
|
||||
/* A structure associating index names with index offset ranges. */
|
||||
typedef struct {
|
||||
char *name; /* The nodename of this index. */
|
||||
int first; /* The index in our list of the first entry. */
|
||||
int last; /* The index in our list of the last entry. */
|
||||
} INDEX_NAME_ASSOC;
|
||||
|
||||
/* An array associating index nodenames with index offset ranges. */
|
||||
static INDEX_NAME_ASSOC **index_nodenames = (INDEX_NAME_ASSOC **)NULL;
|
||||
static int index_nodenames_index = 0;
|
||||
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 (REFERENCE **array, NODE *node)
|
||||
{
|
||||
register int i, last;
|
||||
INDEX_NAME_ASSOC *assoc;
|
||||
|
||||
for (last = 0; array[last + 1]; last++);
|
||||
assoc = (INDEX_NAME_ASSOC *)xmalloc (sizeof (INDEX_NAME_ASSOC));
|
||||
assoc->name = xstrdup (node->nodename);
|
||||
|
||||
if (!index_nodenames_index)
|
||||
{
|
||||
assoc->first = 0;
|
||||
assoc->last = last;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; index_nodenames[i + 1]; i++);
|
||||
assoc->first = 1 + index_nodenames[i]->last;
|
||||
assoc->last = assoc->first + last;
|
||||
}
|
||||
add_pointer_to_array
|
||||
(assoc, index_nodenames_index, index_nodenames, index_nodenames_slots,
|
||||
10, INDEX_NAME_ASSOC *);
|
||||
}
|
||||
|
||||
/* Find and return the indices of WINDOW's file. The indices are defined
|
||||
as the first node in the file containing the word "Index" and any
|
||||
immediately following nodes whose names also contain "Index". All such
|
||||
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)
|
||||
{
|
||||
FILE_BUFFER *fb;
|
||||
|
||||
fb = file_buffer_of_window (window);
|
||||
|
||||
return (info_indices_of_file_buffer (fb));
|
||||
}
|
||||
|
||||
REFERENCE **
|
||||
info_indices_of_file_buffer (FILE_BUFFER *file_buffer)
|
||||
{
|
||||
register int i;
|
||||
REFERENCE **result = (REFERENCE **)NULL;
|
||||
|
||||
/* No file buffer, no indices. */
|
||||
if (!file_buffer)
|
||||
return ((REFERENCE **)NULL);
|
||||
|
||||
/* Reset globals describing where the index was found. */
|
||||
maybe_free (initial_index_filename);
|
||||
maybe_free (initial_index_nodename);
|
||||
initial_index_filename = (char *)NULL;
|
||||
initial_index_nodename = (char *)NULL;
|
||||
|
||||
if (index_nodenames)
|
||||
{
|
||||
for (i = 0; index_nodenames[i]; i++)
|
||||
{
|
||||
free (index_nodenames[i]->name);
|
||||
free (index_nodenames[i]);
|
||||
}
|
||||
|
||||
index_nodenames_index = 0;
|
||||
index_nodenames[0] = (INDEX_NAME_ASSOC *)NULL;
|
||||
}
|
||||
|
||||
/* Grovel the names of the nodes found in this file. */
|
||||
if (file_buffer->tags)
|
||||
{
|
||||
TAG *tag;
|
||||
|
||||
for (i = 0; (tag = file_buffer->tags[i]); i++)
|
||||
{
|
||||
if (string_in_line ("Index", tag->nodename) != -1)
|
||||
{
|
||||
NODE *node;
|
||||
REFERENCE **menu;
|
||||
|
||||
/* Found one. Get its menu. */
|
||||
node = info_get_node (tag->filename, tag->nodename);
|
||||
if (!node)
|
||||
continue;
|
||||
|
||||
/* Remember the filename and nodename of this index. */
|
||||
initial_index_filename = xstrdup (file_buffer->filename);
|
||||
initial_index_nodename = xstrdup (tag->nodename);
|
||||
|
||||
menu = info_menu_of_node (node);
|
||||
|
||||
/* If we have a menu, add this index's nodename and range
|
||||
to our list of index_nodenames. */
|
||||
if (menu)
|
||||
{
|
||||
add_index_to_index_nodenames (menu, node);
|
||||
|
||||
/* Concatenate the references found so far. */
|
||||
result = info_concatenate_references (result, menu);
|
||||
}
|
||||
free (node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If there is a result, clean it up so that every entry has a filename. */
|
||||
for (i = 0; result && result[i]; i++)
|
||||
if (!result[i]->filename)
|
||||
result[i]->filename = xstrdup (file_buffer->filename);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
DECLARE_INFO_COMMAND (info_index_search,
|
||||
_("Look up a string in the index for this file"))
|
||||
{
|
||||
do_info_index_search (window, count, 0);
|
||||
}
|
||||
|
||||
/* 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 *window, int count, char *search_string)
|
||||
{
|
||||
FILE_BUFFER *fb;
|
||||
char *line;
|
||||
|
||||
/* Reset the index offset, since this is not the info-index-next command. */
|
||||
index_offset = 0;
|
||||
|
||||
/* The user is selecting a new search string, so flush the old one. */
|
||||
maybe_free (index_search);
|
||||
index_search = (char *)NULL;
|
||||
|
||||
/* If this window's file is not the same as the one that we last built an
|
||||
index for, build and remember an index now. */
|
||||
fb = file_buffer_of_window (window);
|
||||
if (!initial_index_filename ||
|
||||
(FILENAME_CMP (initial_index_filename, fb->filename) != 0))
|
||||
{
|
||||
info_free_references (index_index);
|
||||
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 ((char *) _("No indices found."), NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Okay, there is an index. Look for SEARCH_STRING, or, if it is
|
||||
empty, prompt for one. */
|
||||
if (search_string && *search_string)
|
||||
line = xstrdup (search_string);
|
||||
else
|
||||
{
|
||||
line = info_read_maybe_completing (window, (char *) _("Index entry: "),
|
||||
index_index);
|
||||
window = active_window;
|
||||
|
||||
/* User aborted? */
|
||||
if (!line)
|
||||
{
|
||||
info_abort_key (active_window, 1, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Empty line means move to the Index node. */
|
||||
if (!*line)
|
||||
{
|
||||
free (line);
|
||||
|
||||
if (initial_index_filename && initial_index_nodename)
|
||||
{
|
||||
NODE *node;
|
||||
|
||||
node = info_get_node (initial_index_filename,
|
||||
initial_index_nodename);
|
||||
set_remembered_pagetop_and_point (window);
|
||||
window_set_node_of_window (window, node);
|
||||
remember_window_and_node (window, node);
|
||||
window_clear_echo_area ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* The user typed either a completed index label, or a partial string.
|
||||
Find an exact match, or, failing that, the first index entry containing
|
||||
the partial string. So, we just call info_next_index_match () with minor
|
||||
manipulation of INDEX_OFFSET. */
|
||||
{
|
||||
int old_offset;
|
||||
|
||||
/* Start the search right after/before this index. */
|
||||
if (count < 0)
|
||||
{
|
||||
register int i;
|
||||
for (i = 0; index_index[i]; i++);
|
||||
index_offset = i;
|
||||
}
|
||||
else
|
||||
index_offset = -1;
|
||||
|
||||
old_offset = index_offset;
|
||||
|
||||
/* The "last" string searched for is this one. */
|
||||
index_search = line;
|
||||
|
||||
/* Find it, or error. */
|
||||
info_next_index_match (window, count, 0);
|
||||
|
||||
/* If the search failed, return the index offset to where it belongs. */
|
||||
if (index_offset == old_offset)
|
||||
index_offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
index_entry_exists (WINDOW *window, char *string)
|
||||
{
|
||||
register int i;
|
||||
FILE_BUFFER *fb;
|
||||
|
||||
/* If there is no previous search string, the user hasn't built an index
|
||||
yet. */
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
fb = file_buffer_of_window (window);
|
||||
if (!initial_index_filename
|
||||
|| (FILENAME_CMP (initial_index_filename, fb->filename) != 0))
|
||||
{
|
||||
info_free_references (index_index);
|
||||
index_index = info_indices_of_file_buffer (fb);
|
||||
}
|
||||
|
||||
/* If there is no index, that is an error. */
|
||||
if (!index_index)
|
||||
return 0;
|
||||
|
||||
for (i = 0; (i > -1) && (index_index[i]); i++)
|
||||
if (strcmp (string, index_index[i]->label) == 0)
|
||||
break;
|
||||
|
||||
/* If that failed, look for the next substring match. */
|
||||
if ((i < 0) || (!index_index[i]))
|
||||
{
|
||||
for (i = 0; (i > -1) && (index_index[i]); i++)
|
||||
if (string_in_line (string, index_index[i]->label) != -1)
|
||||
break;
|
||||
|
||||
if ((i > -1) && (index_index[i]))
|
||||
string_in_line (string, index_index[i]->label);
|
||||
}
|
||||
|
||||
/* If that failed, return 0. */
|
||||
if ((i < 0) || (!index_index[i]))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
DECLARE_INFO_COMMAND (info_next_index_match,
|
||||
_("Go to the next matching index item from the last `\\[index-search]' command"))
|
||||
{
|
||||
register int i;
|
||||
int partial, dir;
|
||||
NODE *node;
|
||||
|
||||
/* If there is no previous search string, the user hasn't built an index
|
||||
yet. */
|
||||
if (!index_search)
|
||||
{
|
||||
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 ((char *) _("No index entries."), NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
/* The direction of this search is controlled by the value of the
|
||||
numeric argument. */
|
||||
if (count < 0)
|
||||
dir = -1;
|
||||
else
|
||||
dir = 1;
|
||||
|
||||
/* Search for the next occurence of index_search. First try to find
|
||||
an exact match. */
|
||||
partial = 0;
|
||||
|
||||
for (i = index_offset + dir; (i > -1) && (index_index[i]); i += dir)
|
||||
if (strcmp (index_search, index_index[i]->label) == 0)
|
||||
break;
|
||||
|
||||
/* If that failed, look for the next substring match. */
|
||||
if ((i < 0) || (!index_index[i]))
|
||||
{
|
||||
for (i = index_offset + dir; (i > -1) && (index_index[i]); i += dir)
|
||||
if (string_in_line (index_search, index_index[i]->label) != -1)
|
||||
break;
|
||||
|
||||
if ((i > -1) && (index_index[i]))
|
||||
partial = string_in_line (index_search, index_index[i]->label);
|
||||
}
|
||||
|
||||
/* If that failed, print an error. */
|
||||
if ((i < 0) || (!index_index[i]))
|
||||
{
|
||||
info_error ((char *) _("No %sindex entries containing `%s'."),
|
||||
index_offset > 0 ? (char *) _("more ") : "", index_search);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Okay, we found the next one. Move the offset to the current entry. */
|
||||
index_offset = i;
|
||||
|
||||
/* Report to the user on what we have found. */
|
||||
{
|
||||
register int j;
|
||||
const char *name = _("CAN'T SEE THIS");
|
||||
char *match;
|
||||
|
||||
for (j = 0; index_nodenames[j]; j++)
|
||||
{
|
||||
if ((i >= index_nodenames[j]->first) &&
|
||||
(i <= index_nodenames[j]->last))
|
||||
{
|
||||
name = index_nodenames[j]->name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we had a partial match, indicate to the user which part of the
|
||||
string matched. */
|
||||
match = xstrdup (index_index[i]->label);
|
||||
|
||||
if (partial && show_index_match)
|
||||
{
|
||||
int k, ls, start, upper;
|
||||
|
||||
ls = strlen (index_search);
|
||||
start = partial - ls;
|
||||
upper = isupper (match[start]) ? 1 : 0;
|
||||
|
||||
for (k = 0; k < ls; k++)
|
||||
if (upper)
|
||||
match[k + start] = info_tolower (match[k + start]);
|
||||
else
|
||||
match[k + start] = info_toupper (match[k + start]);
|
||||
}
|
||||
|
||||
{
|
||||
char *format;
|
||||
|
||||
format = replace_in_documentation
|
||||
((char *) _("Found `%s' in %s. (`\\[next-index-match]' tries to find next.)"),
|
||||
0);
|
||||
|
||||
window_message_in_echo_area (format, match, (char *) name);
|
||||
}
|
||||
|
||||
free (match);
|
||||
}
|
||||
|
||||
/* Select the node corresponding to this index entry. */
|
||||
node = info_get_node (index_index[i]->filename, index_index[i]->nodename);
|
||||
|
||||
if (!node)
|
||||
{
|
||||
info_error ((char *) msg_cant_file_node,
|
||||
index_index[i]->filename, index_index[i]->nodename);
|
||||
return;
|
||||
}
|
||||
|
||||
info_set_node_of_window (1, window, node);
|
||||
|
||||
/* Try to find an occurence of LABEL in this node. */
|
||||
{
|
||||
long start, loc;
|
||||
|
||||
start = window->line_starts[1] - window->node->contents;
|
||||
loc = info_target_search_node (node, index_index[i]->label, start);
|
||||
|
||||
if (loc != -1)
|
||||
{
|
||||
window->point = loc;
|
||||
window_adjust_pagetop (window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Info APROPOS: Search every known index. */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* For every menu item in DIR, search the indices of that file for
|
||||
SEARCH_STRING. */
|
||||
REFERENCE **
|
||||
apropos_in_all_indices (char *search_string, int inform)
|
||||
{
|
||||
register int i, dir_index;
|
||||
REFERENCE **all_indices = (REFERENCE **)NULL;
|
||||
REFERENCE **dir_menu = (REFERENCE **)NULL;
|
||||
NODE *dir_node;
|
||||
|
||||
dir_node = info_get_node ("dir", "Top");
|
||||
if (dir_node)
|
||||
dir_menu = info_menu_of_node (dir_node);
|
||||
|
||||
if (!dir_menu)
|
||||
return NULL;
|
||||
|
||||
/* For every menu item in DIR, get the associated node's file buffer and
|
||||
read the indices of that file buffer. Gather all of the indices into
|
||||
one large one. */
|
||||
for (dir_index = 0; dir_menu[dir_index]; dir_index++)
|
||||
{
|
||||
REFERENCE **this_index, *this_item;
|
||||
NODE *this_node;
|
||||
FILE_BUFFER *this_fb;
|
||||
int dir_node_duplicated = 0;
|
||||
|
||||
this_item = dir_menu[dir_index];
|
||||
|
||||
if (!this_item->filename)
|
||||
{
|
||||
dir_node_duplicated = 1;
|
||||
if (dir_node->parent)
|
||||
this_item->filename = xstrdup (dir_node->parent);
|
||||
else
|
||||
this_item->filename = xstrdup (dir_node->filename);
|
||||
}
|
||||
|
||||
/* Find this node. If we cannot find it, try using the label of the
|
||||
entry as a file (i.e., "(LABEL)Top"). */
|
||||
this_node = info_get_node (this_item->filename, this_item->nodename);
|
||||
|
||||
if (!this_node && this_item->nodename &&
|
||||
(strcmp (this_item->label, this_item->nodename) == 0))
|
||||
this_node = info_get_node (this_item->label, "Top");
|
||||
|
||||
if (!this_node)
|
||||
{
|
||||
if (dir_node_duplicated)
|
||||
free (this_item->filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Get the file buffer associated with this node. */
|
||||
{
|
||||
char *files_name;
|
||||
|
||||
files_name = this_node->parent;
|
||||
if (!files_name)
|
||||
files_name = this_node->filename;
|
||||
|
||||
this_fb = info_find_file (files_name);
|
||||
|
||||
/* If we already scanned this file, don't do that again.
|
||||
In addition to being faster, this also avoids having
|
||||
multiple identical entries in the *Apropos* menu. */
|
||||
for (i = 0; i < dir_index; i++)
|
||||
if (FILENAME_CMP (this_fb->filename, dir_menu[i]->filename) == 0)
|
||||
break;
|
||||
if (i < dir_index)
|
||||
{
|
||||
if (dir_node_duplicated)
|
||||
free (this_item->filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this_fb && inform)
|
||||
message_in_echo_area ((char *) _("Scanning indices of `%s'..."),
|
||||
files_name, NULL);
|
||||
|
||||
this_index = info_indices_of_file_buffer (this_fb);
|
||||
free (this_node);
|
||||
|
||||
if (this_fb && inform)
|
||||
unmessage_in_echo_area ();
|
||||
}
|
||||
|
||||
if (this_index)
|
||||
{
|
||||
/* Remember the filename which contains this set of references. */
|
||||
for (i = 0; this_index && this_index[i]; i++)
|
||||
if (!this_index[i]->filename)
|
||||
this_index[i]->filename = xstrdup (this_fb->filename);
|
||||
|
||||
/* Concatenate with the other indices. */
|
||||
all_indices = info_concatenate_references (all_indices, this_index);
|
||||
}
|
||||
}
|
||||
|
||||
info_free_references (dir_menu);
|
||||
|
||||
/* Build a list of the references which contain SEARCH_STRING. */
|
||||
if (all_indices)
|
||||
{
|
||||
REFERENCE *entry, **apropos_list = (REFERENCE **)NULL;
|
||||
int apropos_list_index = 0;
|
||||
int apropos_list_slots = 0;
|
||||
|
||||
for (i = 0; (entry = all_indices[i]); i++)
|
||||
{
|
||||
if (string_in_line (search_string, entry->label) != -1)
|
||||
{
|
||||
add_pointer_to_array
|
||||
(entry, apropos_list_index, apropos_list, apropos_list_slots,
|
||||
100, REFERENCE *);
|
||||
}
|
||||
else
|
||||
{
|
||||
maybe_free (entry->label);
|
||||
maybe_free (entry->filename);
|
||||
maybe_free (entry->nodename);
|
||||
free (entry);
|
||||
}
|
||||
}
|
||||
|
||||
free (all_indices);
|
||||
all_indices = apropos_list;
|
||||
}
|
||||
return (all_indices);
|
||||
}
|
||||
|
||||
#define APROPOS_NONE \
|
||||
N_("No available info files have `%s' in their indices.")
|
||||
|
||||
void
|
||||
info_apropos (char *string)
|
||||
{
|
||||
REFERENCE **apropos_list;
|
||||
|
||||
apropos_list = apropos_in_all_indices (string, 0);
|
||||
|
||||
if (!apropos_list)
|
||||
info_error ((char *) _(APROPOS_NONE), string, NULL);
|
||||
else
|
||||
{
|
||||
register int i;
|
||||
REFERENCE *entry;
|
||||
|
||||
for (i = 0; (entry = apropos_list[i]); i++)
|
||||
fprintf (stdout, "\"(%s)%s\" -- %s\n",
|
||||
entry->filename, entry->nodename, entry->label);
|
||||
}
|
||||
info_free_references (apropos_list);
|
||||
}
|
||||
|
||||
static char *apropos_list_nodename = "*Apropos*";
|
||||
|
||||
DECLARE_INFO_COMMAND (info_index_apropos,
|
||||
_("Grovel all known info file's indices for a string and build a menu"))
|
||||
{
|
||||
char *line;
|
||||
|
||||
line = info_read_in_echo_area (window, (char *) _("Index apropos: "));
|
||||
|
||||
window = active_window;
|
||||
|
||||
/* User aborted? */
|
||||
if (!line)
|
||||
{
|
||||
info_abort_key (window, 1, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* User typed something? */
|
||||
if (*line)
|
||||
{
|
||||
REFERENCE **apropos_list;
|
||||
NODE *apropos_node;
|
||||
|
||||
apropos_list = apropos_in_all_indices (line, 1);
|
||||
|
||||
if (!apropos_list)
|
||||
info_error ((char *) _(APROPOS_NONE), line, NULL);
|
||||
else
|
||||
{
|
||||
register int i;
|
||||
char *line_buffer;
|
||||
|
||||
initialize_message_buffer ();
|
||||
printf_to_message_buffer
|
||||
((char *) _("\n* Menu: Nodes whose indices contain `%s':\n"),
|
||||
line, NULL, NULL);
|
||||
line_buffer = (char *)xmalloc (500);
|
||||
|
||||
for (i = 0; apropos_list[i]; i++)
|
||||
{
|
||||
int len;
|
||||
/* The label might be identical to that of another index
|
||||
entry in another Info file. Therefore, we make the file
|
||||
name part of the menu entry, to make them all distinct. */
|
||||
sprintf (line_buffer, "* %s [%s]: ",
|
||||
apropos_list[i]->label, apropos_list[i]->filename);
|
||||
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, NULL, NULL);
|
||||
}
|
||||
free (line_buffer);
|
||||
}
|
||||
|
||||
apropos_node = message_buffer_to_node ();
|
||||
add_gcable_pointer (apropos_node->contents);
|
||||
name_internal_node (apropos_node, apropos_list_nodename);
|
||||
|
||||
/* Even though this is an internal node, we don't want the window
|
||||
system to treat it specially. So we turn off the internalness
|
||||
of it here. */
|
||||
apropos_node->flags &= ~N_IsInternal;
|
||||
|
||||
/* Find/Create a window to contain this node. */
|
||||
{
|
||||
WINDOW *new;
|
||||
NODE *node;
|
||||
|
||||
set_remembered_pagetop_and_point (window);
|
||||
|
||||
/* If a window is visible and showing an apropos list already,
|
||||
re-use it. */
|
||||
for (new = windows; new; new = new->next)
|
||||
{
|
||||
node = new->node;
|
||||
|
||||
if (internal_info_node_p (node) &&
|
||||
(strcmp (node->nodename, apropos_list_nodename) == 0))
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we couldn't find an existing window, try to use the next window
|
||||
in the chain. */
|
||||
if (!new && window->next)
|
||||
new = window->next;
|
||||
|
||||
/* If we still don't have a window, make a new one to contain
|
||||
the list. */
|
||||
if (!new)
|
||||
{
|
||||
WINDOW *old_active;
|
||||
|
||||
old_active = active_window;
|
||||
active_window = window;
|
||||
new = window_make_window ((NODE *)NULL);
|
||||
active_window = old_active;
|
||||
}
|
||||
|
||||
/* If we couldn't make a new window, use this one. */
|
||||
if (!new)
|
||||
new = window;
|
||||
|
||||
/* Lines do not wrap in this window. */
|
||||
new->flags |= W_NoWrap;
|
||||
|
||||
window_set_node_of_window (new, apropos_node);
|
||||
remember_window_and_node (new, apropos_node);
|
||||
active_window = new;
|
||||
}
|
||||
info_free_references (apropos_list);
|
||||
}
|
||||
free (line);
|
||||
|
||||
if (!info_error_was_printed)
|
||||
window_clear_echo_area ();
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/* indices.h -- Functions defined in indices.c.
|
||||
$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, 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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_INDICES_H
|
||||
#define INFO_INDICES_H
|
||||
|
||||
/* User-visible variable controls the output of info-index-next. */
|
||||
extern int show_index_match;
|
||||
|
||||
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 (char *search_string, int inform);
|
||||
|
||||
/* User visible functions declared in indices.c. */
|
||||
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,701 +0,0 @@
|
||||
/* info-utils.c -- miscellanous.
|
||||
$Id: info-utils.c,v 1.4 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "info-utils.h"
|
||||
#if defined (HANDLE_MAN_PAGES)
|
||||
# include "man.h"
|
||||
#endif /* HANDLE_MAN_PAGES */
|
||||
|
||||
/* When non-zero, various display and input functions handle ISO Latin
|
||||
character sets correctly. */
|
||||
int ISO_Latin_p = 1;
|
||||
|
||||
/* Variable which holds the most recent filename parsed as a result of
|
||||
calling info_parse_xxx (). */
|
||||
char *info_parsed_filename = (char *)NULL;
|
||||
|
||||
/* Variable which holds the most recent nodename parsed as a result of
|
||||
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 (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 (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
|
||||
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 (char *string, int newlines_okay)
|
||||
{
|
||||
register int i = 0;
|
||||
|
||||
/* Default the answer. */
|
||||
save_filename ((char *)NULL);
|
||||
save_nodename ((char *)NULL);
|
||||
|
||||
/* Special case of nothing passed. Return nothing. */
|
||||
if (!string || !*string)
|
||||
return;
|
||||
|
||||
string += skip_whitespace (string);
|
||||
|
||||
/* Check for (FILENAME)NODENAME. */
|
||||
if (*string == '(')
|
||||
{
|
||||
i = 0;
|
||||
/* Advance past the opening paren. */
|
||||
string++;
|
||||
|
||||
/* Find the closing paren. */
|
||||
while (string[i] && string[i] != ')')
|
||||
i++;
|
||||
|
||||
/* Remember parsed filename. */
|
||||
saven_filename (string, i);
|
||||
|
||||
/* Point directly at the nodename. */
|
||||
string += i;
|
||||
|
||||
if (*string)
|
||||
string++;
|
||||
}
|
||||
|
||||
/* Parse out nodename. */
|
||||
i = skip_node_characters (string, newlines_okay);
|
||||
saven_nodename (string, i);
|
||||
canonicalize_whitespace (info_parsed_nodename);
|
||||
if (info_parsed_nodename && !*info_parsed_nodename)
|
||||
{
|
||||
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:",
|
||||
"Next:", "Up:", "File:", or "Node:". After a call to this function,
|
||||
the global INFO_PARSED_NODENAME and INFO_PARSED_FILENAME contain
|
||||
the information. */
|
||||
void
|
||||
info_parse_label (char *label, NODE *node)
|
||||
{
|
||||
register int i;
|
||||
char *nodeline;
|
||||
|
||||
/* Default answer to failure. */
|
||||
save_nodename ((char *)NULL);
|
||||
save_filename ((char *)NULL);
|
||||
|
||||
/* Find the label in the first line of this node. */
|
||||
nodeline = node->contents;
|
||||
i = string_in_line (label, nodeline);
|
||||
|
||||
if (i == -1)
|
||||
return;
|
||||
|
||||
nodeline += i;
|
||||
nodeline += skip_whitespace (nodeline);
|
||||
info_parse_node (nodeline, DONT_SKIP_NEWLINES);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Finding and Building Menus */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* 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)
|
||||
{
|
||||
long position;
|
||||
SEARCH_BINDING tmp_search;
|
||||
REFERENCE **menu = (REFERENCE **)NULL;
|
||||
|
||||
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, &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. */
|
||||
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);
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
REFERENCE **
|
||||
info_xrefs_of_node (NODE *node)
|
||||
{
|
||||
SEARCH_BINDING tmp_search;
|
||||
|
||||
#if defined (HANDLE_MAN_PAGES)
|
||||
if (node->flags & N_IsManPage)
|
||||
return (xrefs_of_manpage (node));
|
||||
#endif
|
||||
|
||||
tmp_search.buffer = node->contents;
|
||||
tmp_search.start = 0;
|
||||
tmp_search.end = node->nodelen;
|
||||
tmp_search.flags = S_FoldCase;
|
||||
|
||||
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 (SEARCH_BINDING *binding)
|
||||
{
|
||||
return (info_references_internal (INFO_MENU_ENTRY_LABEL, binding));
|
||||
}
|
||||
|
||||
/* Glean cross references from BINDING->buffer + BINDING->start until
|
||||
BINDING->end. Return an array of REFERENCE * that represents each
|
||||
cross reference in this range. */
|
||||
REFERENCE **
|
||||
info_xrefs (SEARCH_BINDING *binding)
|
||||
{
|
||||
return (info_references_internal (INFO_XREF_LABEL, binding));
|
||||
}
|
||||
|
||||
/* Glean cross references or menu items from BINDING. Return an array
|
||||
of REFERENCE * that represents the items found. */
|
||||
static REFERENCE **
|
||||
info_references_internal (char *label, SEARCH_BINDING *binding)
|
||||
{
|
||||
SEARCH_BINDING tmp_search;
|
||||
REFERENCE **refs = (REFERENCE **)NULL;
|
||||
int refs_index = 0, refs_slots = 0;
|
||||
int searching_for_menu_items = 0;
|
||||
long position;
|
||||
|
||||
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, &tmp_search)) != -1)
|
||||
{
|
||||
int offset, start;
|
||||
char *refdef;
|
||||
REFERENCE *entry;
|
||||
|
||||
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
|
||||
menu item on this line. */
|
||||
if (offset == -1)
|
||||
{
|
||||
if (searching_for_menu_items)
|
||||
continue;
|
||||
else
|
||||
{
|
||||
int temp;
|
||||
|
||||
temp = skip_line (refdef);
|
||||
offset = string_in_line (":", refdef + temp);
|
||||
if (offset == -1)
|
||||
continue; /* Give up? */
|
||||
else
|
||||
offset += temp;
|
||||
}
|
||||
}
|
||||
|
||||
entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
|
||||
entry->filename = (char *)NULL;
|
||||
entry->nodename = (char *)NULL;
|
||||
entry->label = (char *)xmalloc (offset);
|
||||
strncpy (entry->label, refdef, offset - 1);
|
||||
entry->label[offset - 1] = '\0';
|
||||
canonicalize_whitespace (entry->label);
|
||||
|
||||
refdef += offset;
|
||||
entry->start = start;
|
||||
entry->end = refdef - binding->buffer;
|
||||
|
||||
/* If this reference entry continues with another ':' then the
|
||||
nodename is the same as the label. */
|
||||
if (*refdef == ':')
|
||||
{
|
||||
entry->nodename = xstrdup (entry->label);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This entry continues with a specific nodename. Parse the
|
||||
nodename from the specification. */
|
||||
|
||||
refdef += skip_whitespace_and_newlines (refdef);
|
||||
|
||||
if (searching_for_menu_items)
|
||||
info_parse_node (refdef, DONT_SKIP_NEWLINES);
|
||||
else
|
||||
info_parse_node (refdef, SKIP_NEWLINES);
|
||||
|
||||
if (info_parsed_filename)
|
||||
entry->filename = xstrdup (info_parsed_filename);
|
||||
|
||||
if (info_parsed_nodename)
|
||||
entry->nodename = xstrdup (info_parsed_nodename);
|
||||
|
||||
entry->line_number = info_parsed_line_number;
|
||||
}
|
||||
|
||||
add_pointer_to_array
|
||||
(entry, refs_index, refs, refs_slots, 50, REFERENCE *);
|
||||
}
|
||||
return (refs);
|
||||
}
|
||||
|
||||
/* Get the entry associated with LABEL in REFERENCES. Return a pointer
|
||||
to the ENTRY if found, or NULL. */
|
||||
REFERENCE *
|
||||
info_get_labeled_reference (char *label, REFERENCE **references)
|
||||
{
|
||||
register int i;
|
||||
REFERENCE *entry;
|
||||
|
||||
for (i = 0; references && (entry = references[i]); i++)
|
||||
{
|
||||
if (strcmp (label, entry->label) == 0)
|
||||
return (entry);
|
||||
}
|
||||
return ((REFERENCE *)NULL);
|
||||
}
|
||||
|
||||
/* 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 **ref1, REFERENCE **ref2)
|
||||
{
|
||||
register int i, j;
|
||||
REFERENCE **result;
|
||||
int size;
|
||||
|
||||
/* With one argument passed as NULL, simply return the other arg. */
|
||||
if (!ref1)
|
||||
return (ref2);
|
||||
else if (!ref2)
|
||||
return (ref1);
|
||||
|
||||
/* Get the total size of the slots that we will need. */
|
||||
for (i = 0; ref1[i]; i++);
|
||||
size = i;
|
||||
for (i = 0; ref2[i]; i++);
|
||||
size += i;
|
||||
|
||||
result = (REFERENCE **)xmalloc ((1 + size) * sizeof (REFERENCE *));
|
||||
|
||||
/* Copy the contents over. */
|
||||
for (i = 0; ref1[i]; i++)
|
||||
result[i] = ref1[i];
|
||||
|
||||
j = i;
|
||||
for (i = 0; ref2[i]; i++)
|
||||
result[j++] = ref2[i];
|
||||
|
||||
result[j] = (REFERENCE *)NULL;
|
||||
free (ref1);
|
||||
free (ref2);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Copy a reference structure. Since we tend to free everything at
|
||||
every opportunity, we don't share any points, but copy everything into
|
||||
new memory. */
|
||||
REFERENCE *
|
||||
info_copy_reference (REFERENCE *src)
|
||||
{
|
||||
REFERENCE *dest = xmalloc (sizeof (REFERENCE));
|
||||
dest->label = src->label ? xstrdup (src->label) : NULL;
|
||||
dest->filename = src->filename ? xstrdup (src->filename) : NULL;
|
||||
dest->nodename = src->nodename ? xstrdup (src->nodename) : NULL;
|
||||
dest->start = src->start;
|
||||
dest->end = src->end;
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Free the data associated with REFERENCES. */
|
||||
void
|
||||
info_free_references (REFERENCE **references)
|
||||
{
|
||||
register int i;
|
||||
REFERENCE *entry;
|
||||
|
||||
if (references)
|
||||
{
|
||||
for (i = 0; references && (entry = references[i]); i++)
|
||||
{
|
||||
maybe_free (entry->label);
|
||||
maybe_free (entry->filename);
|
||||
maybe_free (entry->nodename);
|
||||
|
||||
free (entry);
|
||||
}
|
||||
|
||||
free (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 (char *string)
|
||||
{
|
||||
register int i, j;
|
||||
int len, whitespace_found, whitespace_loc = 0;
|
||||
char *temp;
|
||||
|
||||
if (!string)
|
||||
return;
|
||||
|
||||
len = strlen (string);
|
||||
temp = (char *)xmalloc (1 + len);
|
||||
|
||||
/* Search for sequences of whitespace or newlines. Replace all such
|
||||
sequences in the string with just a single space. */
|
||||
|
||||
whitespace_found = 0;
|
||||
for (i = 0, j = 0; string[i]; i++)
|
||||
{
|
||||
if (whitespace_or_newline (string[i]))
|
||||
{
|
||||
whitespace_found++;
|
||||
whitespace_loc = i;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (whitespace_found && whitespace_loc)
|
||||
{
|
||||
whitespace_found = 0;
|
||||
|
||||
/* Suppress whitespace at start of string. */
|
||||
if (j)
|
||||
temp[j++] = ' ';
|
||||
}
|
||||
|
||||
temp[j++] = string[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* Kill trailing whitespace. */
|
||||
if (j && whitespace (temp[j - 1]))
|
||||
j--;
|
||||
|
||||
temp[j] = '\0';
|
||||
strcpy (string, temp);
|
||||
free (temp);
|
||||
}
|
||||
|
||||
/* String representation of a char returned by printed_representation (). */
|
||||
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 (unsigned char character, int hpos)
|
||||
{
|
||||
register int i = 0;
|
||||
int printable_limit = ISO_Latin_p ? 255 : 127;
|
||||
|
||||
if (raw_escapes_p && character == '\033')
|
||||
the_rep[i++] = character;
|
||||
/* Show CTRL-x as ^X. */
|
||||
else if (iscntrl (character) && character < 127)
|
||||
{
|
||||
switch (character)
|
||||
{
|
||||
case '\r':
|
||||
case '\n':
|
||||
the_rep[i++] = character;
|
||||
break;
|
||||
|
||||
case '\t':
|
||||
{
|
||||
int tw;
|
||||
|
||||
tw = ((hpos + 8) & 0xf8) - hpos;
|
||||
while (i < tw)
|
||||
the_rep[i++] = ' ';
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
the_rep[i++] = '^';
|
||||
the_rep[i++] = (character | 0x40);
|
||||
}
|
||||
}
|
||||
/* Show META-x as 0370. */
|
||||
else if (character > printable_limit)
|
||||
{
|
||||
sprintf (the_rep + i, "\\%0o", character);
|
||||
i = strlen (the_rep);
|
||||
}
|
||||
else if (character == DEL)
|
||||
{
|
||||
the_rep[i++] = '^';
|
||||
the_rep[i++] = '?';
|
||||
}
|
||||
else
|
||||
the_rep[i++] = character;
|
||||
|
||||
the_rep[i] = 0;
|
||||
|
||||
return the_rep;
|
||||
}
|
||||
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Functions Static To This File */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Amount of space allocated to INFO_PARSED_FILENAME via xmalloc (). */
|
||||
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 (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 (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 (char *filename, int len)
|
||||
{
|
||||
saven_string (filename, len,
|
||||
&info_parsed_filename, &parsed_filename_size);
|
||||
}
|
||||
|
||||
/* Remember NODENAME in PARSED_NODENAME. An empty NODENAME is translated
|
||||
to a NULL pointer in PARSED_NODENAME. */
|
||||
static void
|
||||
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 (char *nodename, int len)
|
||||
{
|
||||
saven_string (nodename, len,
|
||||
&info_parsed_nodename, &parsed_nodename_size);
|
||||
}
|
||||
|
||||
/* Remember STRING in STRING_P. STRING_P should currently have STRING_SIZE_P
|
||||
bytes allocated to it. An empty STRING is translated to a NULL pointer
|
||||
in STRING_P. */
|
||||
static void
|
||||
save_string (char *string, char **string_p, int *string_size_p)
|
||||
{
|
||||
if (!string || !*string)
|
||||
{
|
||||
if (*string_p)
|
||||
free (*string_p);
|
||||
|
||||
*string_p = (char *)NULL;
|
||||
*string_size_p = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen (string) >= (unsigned int) *string_size_p)
|
||||
*string_p = (char *)xrealloc
|
||||
(*string_p, (*string_size_p = 1 + strlen (string)));
|
||||
|
||||
strcpy (*string_p, string);
|
||||
}
|
||||
}
|
||||
|
||||
/* Just like save_string (), but you also pass the length of STRING. */
|
||||
static void
|
||||
saven_string (char *string, int len, char **string_p, int *string_size_p)
|
||||
{
|
||||
if (!string)
|
||||
{
|
||||
if (*string_p)
|
||||
free (*string_p);
|
||||
|
||||
*string_p = (char *)NULL;
|
||||
*string_size_p = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (len >= *string_size_p)
|
||||
*string_p = (char *)xrealloc (*string_p, (*string_size_p = 1 + len));
|
||||
|
||||
strncpy (*string_p, string, len);
|
||||
(*string_p)[len] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/* Return a pointer to the part of PATHNAME that simply defines the file. */
|
||||
char *
|
||||
filename_non_directory (char *pathname)
|
||||
{
|
||||
register char *filename = pathname + strlen (pathname);
|
||||
|
||||
if (HAVE_DRIVE (pathname))
|
||||
pathname += 2;
|
||||
|
||||
while (filename > pathname && !IS_SLASH (filename[-1]))
|
||||
filename--;
|
||||
|
||||
return (filename);
|
||||
}
|
||||
|
||||
/* Return non-zero if NODE is one especially created by Info. */
|
||||
int
|
||||
internal_info_node_p (NODE *node)
|
||||
{
|
||||
#if defined (NEVER)
|
||||
if (node &&
|
||||
(node->filename && !*node->filename) &&
|
||||
!node->parent && node->nodename)
|
||||
return (1);
|
||||
else
|
||||
return (0);
|
||||
#else
|
||||
return ((node != (NODE *)NULL) && ((node->flags & N_IsInternal) != 0));
|
||||
#endif /* !NEVER */
|
||||
}
|
||||
|
||||
/* Make NODE appear to be one especially created by Info. */
|
||||
void
|
||||
name_internal_node (NODE *node, char *name)
|
||||
{
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
node->filename = "";
|
||||
node->parent = (char *)NULL;
|
||||
node->nodename = name;
|
||||
node->flags |= N_IsInternal;
|
||||
}
|
||||
|
||||
/* Return the window displaying NAME, the name of an internally created
|
||||
Info window. */
|
||||
WINDOW *
|
||||
get_internal_info_window (char *name)
|
||||
{
|
||||
WINDOW *win;
|
||||
|
||||
for (win = windows; win; win = win->next)
|
||||
if (internal_info_node_p (win->node) &&
|
||||
(strcmp (win->node->nodename, name) == 0))
|
||||
break;
|
||||
|
||||
return (win);
|
||||
}
|
||||
|
||||
/* Return a window displaying the node NODE. */
|
||||
WINDOW *
|
||||
get_window_of_node (NODE *node)
|
||||
{
|
||||
WINDOW *win = (WINDOW *)NULL;
|
||||
|
||||
for (win = windows; win; win = win->next)
|
||||
if (win->node == node)
|
||||
break;
|
||||
|
||||
return (win);
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
/* info-utils.h -- Exported functions and variables from info-utils.c.
|
||||
$Id: info-utils.h,v 1.4 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_UTILS_H
|
||||
#define INFO_UTILS_H
|
||||
|
||||
#include "nodes.h"
|
||||
#include "window.h"
|
||||
#include "search.h"
|
||||
|
||||
/* Structure which describes a node reference, such as a menu entry or
|
||||
cross reference. Arrays of such references can be built by calling
|
||||
info_menus_of_node () or info_xrefs_of_node (). */
|
||||
typedef struct {
|
||||
char *label; /* User Label. */
|
||||
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
|
||||
character sets correctly. */
|
||||
extern int ISO_Latin_p;
|
||||
|
||||
/* Variable which holds the most recent filename parsed as a result of
|
||||
calling info_parse_xxx (). */
|
||||
extern char *info_parsed_filename;
|
||||
|
||||
/* Variable which holds the most recent nodename parsed as a result of
|
||||
calling info_parse_xxx (). */
|
||||
extern char *info_parsed_nodename;
|
||||
|
||||
/* Parse the filename and nodename out of STRING. If STRING doesn't
|
||||
contain a filename (i.e., it is NOT (FILENAME)NODENAME) then set
|
||||
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 (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 (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 (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 (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 (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 (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 **ref1, REFERENCE **ref2);
|
||||
|
||||
/* Copy an existing reference into new memory. */
|
||||
extern REFERENCE *info_copy_reference (REFERENCE *src);
|
||||
|
||||
/* Free the data associated with 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 (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 (unsigned char character, int hpos);
|
||||
|
||||
/* Return a pointer to the part of PATHNAME that simply defines the file. */
|
||||
extern char *filename_non_directory (char *pathname);
|
||||
|
||||
/* Return non-zero if NODE is one especially created by Info. */
|
||||
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 (NODE *node, char *name);
|
||||
|
||||
/* Return the window displaying NAME, the name of an internally created
|
||||
Info window. */
|
||||
extern WINDOW *get_internal_info_window (char *name);
|
||||
|
||||
/* Return a window displaying the node 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 (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)
|
||||
#define info_up_label_of_node(n) info_parse_label (INFO_UP_LABEL, n)
|
||||
#define info_prev_label_of_node(n) \
|
||||
do { \
|
||||
info_parse_label (INFO_PREV_LABEL, n); \
|
||||
if (!info_parsed_nodename && !info_parsed_filename) \
|
||||
info_parse_label (INFO_ALTPREV_LABEL, n); \
|
||||
} while (0)
|
||||
|
||||
#endif /* not INFO_UTILS_H */
|
@ -1,685 +0,0 @@
|
||||
/* info.c -- Display nodes of Info files in multiple windows.
|
||||
$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,
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "indices.h"
|
||||
#include "dribble.h"
|
||||
#include "getopt.h"
|
||||
#if defined (HANDLE_MAN_PAGES)
|
||||
# include "man.h"
|
||||
#endif /* HANDLE_MAN_PAGES */
|
||||
|
||||
static char *program_name = "info";
|
||||
|
||||
/* Non-zero means search all indices for APROPOS_SEARCH_STRING. */
|
||||
static int apropos_p = 0;
|
||||
|
||||
/* Variable containing the string to search for when apropos_p is non-zero. */
|
||||
static char *apropos_search_string = (char *)NULL;
|
||||
|
||||
/* Non-zero means search all indices for INDEX_SEARCH_STRING. Unlike
|
||||
apropos, this puts the user at the node, running info. */
|
||||
static int index_search_p = 0;
|
||||
|
||||
/* Non-zero means look for the node which describes the invocation
|
||||
and command-line options of the program, and start the info
|
||||
session at that node. */
|
||||
static int goto_invocation_p = 0;
|
||||
|
||||
/* Variable containing the string to search for when index_search_p is
|
||||
non-zero. */
|
||||
static char *index_search_string = (char *)NULL;
|
||||
|
||||
/* Non-zero means print version info only. */
|
||||
static int print_version_p = 0;
|
||||
|
||||
/* Non-zero means print a short description of the options. */
|
||||
static int print_help_p = 0;
|
||||
|
||||
/* Array of the names of nodes that the user specified with "--node" on the
|
||||
command line. */
|
||||
static char **user_nodenames = (char **)NULL;
|
||||
static int user_nodenames_index = 0;
|
||||
static int user_nodenames_slots = 0;
|
||||
|
||||
/* String specifying the first file to load. This string can only be set
|
||||
by the user specifying "--file" on the command line. */
|
||||
static char *user_filename = (char *)NULL;
|
||||
|
||||
/* String specifying the name of the file to dump nodes to. This value is
|
||||
filled if the user speficies "--output" on the command line. */
|
||||
static char *user_output_filename = (char *)NULL;
|
||||
|
||||
/* Non-zero indicates that when "--output" is specified, all of the menu
|
||||
items of the specified nodes (and their subnodes as well) should be
|
||||
dumped in the order encountered. This basically can print a book. */
|
||||
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. */
|
||||
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'.
|
||||
Since on MSDOS the usual behavior is to write directly to the video
|
||||
memory, speech synthesizer software cannot grab the output. Therefore,
|
||||
we provide a user option which tells us to avoid direct screen output
|
||||
and use stdout instead (which loses the color output). */
|
||||
int speech_friendly = 0;
|
||||
#endif
|
||||
|
||||
/* Structure describing the options that Info accepts. We pass this structure
|
||||
to getopt_long (). If you add or otherwise change this structure, you must
|
||||
also change the string which follows it. */
|
||||
#define APROPOS_OPTION 1
|
||||
#define DRIBBLE_OPTION 2
|
||||
#define RESTORE_OPTION 3
|
||||
#define IDXSRCH_OPTION 4
|
||||
static struct option long_options[] = {
|
||||
{ "apropos", 1, 0, APROPOS_OPTION },
|
||||
{ "directory", 1, 0, 'd' },
|
||||
{ "dribble", 1, 0, DRIBBLE_OPTION },
|
||||
{ "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
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
/* String describing the shorthand versions of the long options found above. */
|
||||
#ifdef __MSDOS__
|
||||
static char *short_options = "d:n:f:ho:ORswb";
|
||||
#else
|
||||
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 (void);
|
||||
static void init_messages (void);
|
||||
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Main Entry Point to the Info Program */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int getopt_long_index; /* Index returned by getopt_long (). */
|
||||
NODE *initial_node; /* First node loaded by Info. */
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
/* Set locale via LC_ALL. */
|
||||
setlocale (LC_ALL, "");
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
/* Set the text message domain. */
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
init_messages ();
|
||||
|
||||
while (1)
|
||||
{
|
||||
int option_character;
|
||||
|
||||
option_character = getopt_long
|
||||
(argc, argv, short_options, long_options, &getopt_long_index);
|
||||
|
||||
/* getopt_long returns EOF when there are no more long options. */
|
||||
if (option_character == EOF)
|
||||
break;
|
||||
|
||||
/* If this is a long option, then get the short version of it. */
|
||||
if (option_character == 0 && long_options[getopt_long_index].flag == 0)
|
||||
option_character = long_options[getopt_long_index].val;
|
||||
|
||||
/* Case on the option that we have received. */
|
||||
switch (option_character)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
/* User wants to add a directory. */
|
||||
case 'd':
|
||||
info_add_path (optarg, INFOPATH_PREPEND);
|
||||
break;
|
||||
|
||||
/* User is specifying a particular node. */
|
||||
case 'n':
|
||||
add_pointer_to_array (optarg, user_nodenames_index, user_nodenames,
|
||||
user_nodenames_slots, 10, char *);
|
||||
break;
|
||||
|
||||
/* User is specifying a particular Info file. */
|
||||
case 'f':
|
||||
if (user_filename)
|
||||
free (user_filename);
|
||||
|
||||
user_filename = xstrdup (optarg);
|
||||
break;
|
||||
|
||||
/* Treat -h like --help. */
|
||||
case 'h':
|
||||
print_help_p = 1;
|
||||
break;
|
||||
|
||||
/* User is specifying the name of a file to output to. */
|
||||
case 'o':
|
||||
if (user_output_filename)
|
||||
free (user_output_filename);
|
||||
user_output_filename = xstrdup (optarg);
|
||||
break;
|
||||
|
||||
/* User has specified that she wants to find the "Options"
|
||||
or "Invocation" node for the program. */
|
||||
case 'O':
|
||||
goto_invocation_p = 1;
|
||||
break;
|
||||
|
||||
/* User has specified that she wants the escape sequences
|
||||
in man pages to be passed thru unaltered. */
|
||||
case 'R':
|
||||
raw_escapes_p = 1;
|
||||
break;
|
||||
|
||||
/* User is specifying that she wishes to dump the subnodes of
|
||||
the node that she is dumping. */
|
||||
case 's':
|
||||
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':
|
||||
speech_friendly = 1;
|
||||
break;
|
||||
#endif /* __MSDOS__ */
|
||||
|
||||
/* User has specified a string to search all indices for. */
|
||||
case APROPOS_OPTION:
|
||||
apropos_p = 1;
|
||||
maybe_free (apropos_search_string);
|
||||
apropos_search_string = xstrdup (optarg);
|
||||
break;
|
||||
|
||||
/* User has specified a dribble file to receive keystrokes. */
|
||||
case DRIBBLE_OPTION:
|
||||
close_dribble_file ();
|
||||
open_dribble_file (optarg);
|
||||
break;
|
||||
|
||||
/* User has specified an alternate input stream. */
|
||||
case RESTORE_OPTION:
|
||||
info_set_input_from_file (optarg);
|
||||
break;
|
||||
|
||||
/* User has specified a string to search all indices for. */
|
||||
case IDXSRCH_OPTION:
|
||||
index_search_p = 1;
|
||||
maybe_free (index_search_string);
|
||||
index_search_string = xstrdup (optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf (stderr, _("Try --help for more information.\n"));
|
||||
xexit (1);
|
||||
}
|
||||
}
|
||||
|
||||
/* If the output device is not a terminal, and no output filename has been
|
||||
specified, make user_output_filename be "-", so that the info is written
|
||||
to stdout, and turn on the dumping of subnodes. */
|
||||
if ((!isatty (fileno (stdout))) && (user_output_filename == (char *)NULL))
|
||||
{
|
||||
user_output_filename = xstrdup ("-");
|
||||
dump_subnodes = 1;
|
||||
}
|
||||
|
||||
/* If the user specified --version, then show the version and exit. */
|
||||
if (print_version_p)
|
||||
{
|
||||
printf ("%s (GNU %s) %s\n", program_name, PACKAGE, VERSION);
|
||||
puts ("");
|
||||
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"));
|
||||
xexit (0);
|
||||
}
|
||||
|
||||
/* If the `--help' option was present, show the help and exit. */
|
||||
if (print_help_p)
|
||||
{
|
||||
info_short_help ();
|
||||
xexit (0);
|
||||
}
|
||||
|
||||
/* If the user hasn't specified a path for Info files, default it.
|
||||
Lowest priority is our messy hardwired list in filesys.h.
|
||||
Then comes the user's INFODIR from the Makefile.
|
||||
Highest priority is the environment variable, if set. */
|
||||
if (!infopath)
|
||||
{
|
||||
char *path_from_env = getenv ("INFOPATH");
|
||||
|
||||
if (path_from_env)
|
||||
{
|
||||
unsigned len = strlen (path_from_env);
|
||||
/* Trailing : on INFOPATH means insert the default path. */
|
||||
if (len && path_from_env[len - 1] == PATH_SEP[0])
|
||||
{
|
||||
path_from_env[len - 1] = 0;
|
||||
info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND);
|
||||
}
|
||||
#ifdef INFODIR /* from the Makefile */
|
||||
info_add_path (INFODIR, INFOPATH_PREPEND);
|
||||
#endif
|
||||
info_add_path (path_from_env, INFOPATH_PREPEND);
|
||||
}
|
||||
else
|
||||
{
|
||||
info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND);
|
||||
#ifdef INFODIR /* from the Makefile */
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
/* If the user specified a particular filename, add the path of that
|
||||
file to the contents of INFOPATH. */
|
||||
if (user_filename)
|
||||
add_file_directory_to_path (user_filename);
|
||||
|
||||
/* If the user wants to search every known index for a given string,
|
||||
do that now, and report the results. */
|
||||
if (apropos_p)
|
||||
{
|
||||
info_apropos (apropos_search_string);
|
||||
xexit (0);
|
||||
}
|
||||
|
||||
/* Get the initial Info node. It is either "(dir)Top", or what the user
|
||||
specifed with values in user_filename and user_nodenames. */
|
||||
initial_node = info_get_node (user_filename,
|
||||
user_nodenames ? user_nodenames[0] : 0);
|
||||
|
||||
/* If we couldn't get the initial node, this user is in trouble. */
|
||||
if (!initial_node)
|
||||
{
|
||||
if (info_recent_file_error)
|
||||
info_error (info_recent_file_error, NULL, NULL);
|
||||
else
|
||||
info_error ((char *) msg_cant_find_node,
|
||||
user_nodenames ? user_nodenames[0] : "Top", NULL);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
/* Special cases for when the user specifies multiple nodes. If we
|
||||
are dumping to an output file, dump all of the nodes specified.
|
||||
Otherwise, attempt to create enough windows to handle the nodes
|
||||
that this user wants displayed. */
|
||||
if (user_nodenames_index > 1)
|
||||
{
|
||||
free (initial_node);
|
||||
|
||||
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
|
||||
begin_multiple_window_info_session (user_filename, user_nodenames);
|
||||
|
||||
xexit (0);
|
||||
}
|
||||
|
||||
/* If there are arguments remaining, they are the names of menu items
|
||||
in sequential info files starting from the first one loaded. That
|
||||
file name is either "dir", or the contents of user_filename if one
|
||||
was specified. */
|
||||
{
|
||||
const char *errstr;
|
||||
char *errarg1, *errarg2;
|
||||
|
||||
NODE *new_initial_node = info_follow_menus (initial_node, argv + optind,
|
||||
&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. */
|
||||
if (user_output_filename && !goto_invocation_p)
|
||||
{
|
||||
if (!errstr)
|
||||
dump_node_to_file (initial_node, user_output_filename,
|
||||
dump_subnodes);
|
||||
else
|
||||
info_error ((char *) errstr, errarg1, errarg2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (errstr)
|
||||
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. */
|
||||
else if (index_search_p || goto_invocation_p)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
initialize_info_session (initial_node, 0);
|
||||
|
||||
if (goto_invocation_p
|
||||
|| index_entry_exists (windows, index_search_string))
|
||||
{
|
||||
terminal_prep_terminal ();
|
||||
terminal_clear_screen ();
|
||||
info_last_executed_command = (VFunction *)NULL;
|
||||
|
||||
if (index_search_p)
|
||||
do_info_index_search (windows, 0, index_search_string);
|
||||
else
|
||||
{
|
||||
/* If they said "info --show-options foo bar baz",
|
||||
the last of the arguments is the program whose
|
||||
options they want to see. */
|
||||
char **p = argv + optind;
|
||||
char *program;
|
||||
|
||||
if (*p)
|
||||
{
|
||||
while (p[1])
|
||||
p++;
|
||||
program = xstrdup (*p);
|
||||
}
|
||||
else if (user_filename)
|
||||
/* If there's no command-line arguments to
|
||||
supply the program name, use the Info file
|
||||
name (sans extension and leading directories)
|
||||
instead. */
|
||||
program = program_name_from_file_name (user_filename);
|
||||
else
|
||||
program = xstrdup ("");
|
||||
|
||||
info_intuit_options_node (windows, initial_node, program);
|
||||
free (program);
|
||||
}
|
||||
|
||||
if (user_output_filename)
|
||||
{
|
||||
dump_node_to_file (windows->node, user_output_filename,
|
||||
dump_subnodes);
|
||||
}
|
||||
else
|
||||
info_read_and_dispatch ();
|
||||
|
||||
/* On program exit, leave the cursor at the bottom of the
|
||||
window, and restore the terminal IO. */
|
||||
terminal_goto_xy (0, screenheight - 1);
|
||||
terminal_clear_to_eol ();
|
||||
fflush (stdout);
|
||||
terminal_unprep_terminal ();
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, _("no index entries found for `%s'\n"),
|
||||
index_search_string);
|
||||
status = 2;
|
||||
}
|
||||
|
||||
close_dribble_file ();
|
||||
xexit (status);
|
||||
}
|
||||
else
|
||||
begin_info_session (initial_node);
|
||||
}
|
||||
|
||||
xexit (0);
|
||||
}
|
||||
|
||||
return 0; /* Avoid bogus warnings. */
|
||||
}
|
||||
|
||||
void
|
||||
add_file_directory_to_path (char *filename)
|
||||
{
|
||||
char *directory_name = xstrdup (filename);
|
||||
char *temp = filename_non_directory (directory_name);
|
||||
|
||||
if (temp != directory_name)
|
||||
{
|
||||
if (HAVE_DRIVE (directory_name) && temp == directory_name + 2)
|
||||
{
|
||||
/* The directory of "d:foo" is stored as "d:.", to avoid
|
||||
mixing it with "d:/" when a slash is appended. */
|
||||
*temp = '.';
|
||||
temp += 2;
|
||||
}
|
||||
temp[-1] = 0;
|
||||
info_add_path (directory_name, INFOPATH_PREPEND);
|
||||
}
|
||||
|
||||
free (directory_name);
|
||||
}
|
||||
|
||||
|
||||
/* Error handling. */
|
||||
|
||||
/* Non-zero if an error has been signalled. */
|
||||
int info_error_was_printed = 0;
|
||||
|
||||
/* Non-zero means ring terminal bell on errors. */
|
||||
int info_error_rings_bell_p = 1;
|
||||
|
||||
/* 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. */
|
||||
void
|
||||
info_error (char *format, void *arg1, void *arg2)
|
||||
{
|
||||
info_error_was_printed = 1;
|
||||
|
||||
if (!info_windows_initialized_p || display_inhibited)
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
fprintf (stderr, format, arg1, arg2);
|
||||
fprintf (stderr, "\n");
|
||||
fflush (stderr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!echo_area_is_active)
|
||||
{
|
||||
if (info_error_rings_bell_p)
|
||||
terminal_ring_bell ();
|
||||
window_message_in_echo_area (format, arg1, arg2);
|
||||
}
|
||||
else
|
||||
{
|
||||
NODE *temp;
|
||||
|
||||
temp = build_message_node (format, arg1, arg2);
|
||||
if (info_error_rings_bell_p)
|
||||
terminal_ring_bell ();
|
||||
inform_in_echo_area (temp->contents);
|
||||
free (temp->contents);
|
||||
free (temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Produce a scaled down description of the available options to Info. */
|
||||
static void
|
||||
info_short_help (void)
|
||||
{
|
||||
#ifdef __MSDOS__
|
||||
static const char speech_friendly_string[] = N_("\
|
||||
-b, --speech-friendly be friendly to speech synthesizers.\n");
|
||||
#else
|
||||
static const char speech_friendly_string[] = "";
|
||||
#endif
|
||||
|
||||
|
||||
printf (_("\
|
||||
Usage: %s [OPTION]... [MENU-ITEM...]\n\
|
||||
\n\
|
||||
Read documentation in Info format.\n\
|
||||
\n\
|
||||
Options:\n\
|
||||
--apropos=STRING look up STRING in all indices of all manuals.\n\
|
||||
-d, --directory=DIR add DIR to INFOPATH.\n\
|
||||
--dribble=FILENAME remember user keystrokes in FILENAME.\n\
|
||||
-f, --file=FILENAME specify Info file to visit.\n\
|
||||
-h, --help display this help and exit.\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 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\
|
||||
The first non-option argument, if present, is the menu entry to start from;\n\
|
||||
it is searched for in all `dir' files along INFOPATH.\n\
|
||||
If it is not present, info merges all `dir' files and shows the result.\n\
|
||||
Any remaining arguments are treated as the names of menu\n\
|
||||
items relative to the initial node visited.\n\
|
||||
\n\
|
||||
Examples:\n\
|
||||
info show top-level dir menu\n\
|
||||
info emacs start at emacs node from top-level dir\n\
|
||||
info emacs buffers start at buffers node within emacs manual\n\
|
||||
info --show-options emacs start at node with emacs' command line options\n\
|
||||
info -f ./foo.info show file ./foo.info, not searching dir\n\
|
||||
"),
|
||||
program_name, speech_friendly_string);
|
||||
|
||||
puts (_("\n\
|
||||
Email bug reports to bug-texinfo@gnu.org,\n\
|
||||
general questions and discussion to help-texinfo@gnu.org.\n\
|
||||
Texinfo home page: http://www.gnu.org/software/texinfo/"));
|
||||
|
||||
xexit (0);
|
||||
}
|
||||
|
||||
|
||||
/* Initialize strings for gettext. Because gettext doesn't handle N_ or
|
||||
_ within macro definitions, we put shared messages into variables and
|
||||
use them that way. This also has the advantage that there's only one
|
||||
copy of the strings. */
|
||||
|
||||
const char *msg_cant_find_node;
|
||||
const char *msg_cant_file_node;
|
||||
const char *msg_cant_find_window;
|
||||
const char *msg_cant_find_point;
|
||||
const char *msg_cant_kill_last;
|
||||
const char *msg_no_menu_node;
|
||||
const char *msg_no_foot_node;
|
||||
const char *msg_no_xref_node;
|
||||
const char *msg_no_pointer;
|
||||
const char *msg_unknown_command;
|
||||
const char *msg_term_too_dumb;
|
||||
const char *msg_at_node_bottom;
|
||||
const char *msg_at_node_top;
|
||||
const char *msg_one_window;
|
||||
const char *msg_win_too_small;
|
||||
const char *msg_cant_make_help;
|
||||
|
||||
static void
|
||||
init_messages (void)
|
||||
{
|
||||
msg_cant_find_node = _("Cannot find node `%s'.");
|
||||
msg_cant_file_node = _("Cannot find node `(%s)%s'.");
|
||||
msg_cant_find_window = _("Cannot find a window!");
|
||||
msg_cant_find_point = _("Point doesn't appear within this window's node!");
|
||||
msg_cant_kill_last = _("Cannot delete the last window.");
|
||||
msg_no_menu_node = _("No menu in this node.");
|
||||
msg_no_foot_node = _("No footnotes in this node.");
|
||||
msg_no_xref_node = _("No cross references in this node.");
|
||||
msg_no_pointer = _("No `%s' pointer for this node.");
|
||||
msg_unknown_command = _("Unknown Info command `%c'; try `?' for help.");
|
||||
msg_term_too_dumb = _("Terminal type `%s' is not smart enough to run Info.");
|
||||
msg_at_node_bottom = _("You are already at the last page of this node.");
|
||||
msg_at_node_top = _("You are already at the first page of this node.");
|
||||
msg_one_window = _("Only one window.");
|
||||
msg_win_too_small = _("Resulting window would be too small.");
|
||||
msg_cant_make_help = _("Not enough room for a help window, please delete a window.");
|
||||
}
|
@ -1,160 +0,0 @@
|
||||
/* info.h -- Header file which includes all of the other headers.
|
||||
$Id: info.h,v 1.4 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_H
|
||||
#define INFO_H
|
||||
|
||||
/* We always want these, so why clutter up the compile command? */
|
||||
#define HANDLE_MAN_PAGES
|
||||
#define NAMED_FUNCTIONS
|
||||
#define INFOKEY
|
||||
|
||||
/* System dependencies. */
|
||||
#include "system.h"
|
||||
|
||||
/* Some of our other include files use these. */
|
||||
typedef int Function ();
|
||||
typedef void VFunction ();
|
||||
typedef char *CFunction ();
|
||||
|
||||
#include "filesys.h"
|
||||
#include "doc.h"
|
||||
#include "display.h"
|
||||
#include "session.h"
|
||||
#include "echo-area.h"
|
||||
#include "footnotes.h"
|
||||
#include "gc.h"
|
||||
|
||||
#define info_toupper(x) (islower (x) ? toupper (x) : x)
|
||||
#define info_tolower(x) (isupper (x) ? tolower (x) : x)
|
||||
|
||||
#if !defined (whitespace)
|
||||
# define whitespace(c) ((c == ' ') || (c == '\t'))
|
||||
#endif /* !whitespace */
|
||||
|
||||
#if !defined (whitespace_or_newline)
|
||||
# define whitespace_or_newline(c) (whitespace (c) || (c == '\n'))
|
||||
#endif /* !whitespace_or_newline */
|
||||
|
||||
/* Add POINTER to the list of pointers found in ARRAY. SLOTS is the number
|
||||
of slots that have already been allocated. INDEX is the index into the
|
||||
array where POINTER should be added. GROW is the number of slots to grow
|
||||
ARRAY by, in the case that it needs growing. TYPE is a cast of the type
|
||||
of object stored in ARRAY (e.g., NODE_ENTRY *. */
|
||||
#define add_pointer_to_array(pointer, idx, array, slots, grow, type) \
|
||||
do { \
|
||||
if (idx + 2 >= slots) \
|
||||
array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \
|
||||
array[idx++] = (type)pointer; \
|
||||
array[idx] = (type)NULL; \
|
||||
} while (0)
|
||||
|
||||
#define maybe_free(x) do { if (x) free (x); } while (0)
|
||||
|
||||
#if !defined (zero_mem) && defined (HAVE_MEMSET)
|
||||
# define zero_mem(mem, length) memset (mem, 0, length)
|
||||
#endif /* !zero_mem && HAVE_MEMSET */
|
||||
|
||||
#if !defined (zero_mem) && defined (HAVE_BZERO)
|
||||
# define zero_mem(mem, length) bzero (mem, length)
|
||||
#endif /* !zero_mem && HAVE_BZERO */
|
||||
|
||||
#if !defined (zero_mem)
|
||||
# define zero_mem(mem, length) \
|
||||
do { \
|
||||
register int zi; \
|
||||
register unsigned char *place; \
|
||||
\
|
||||
place = (unsigned char *)mem; \
|
||||
for (zi = 0; zi < length; zi++) \
|
||||
place[zi] = 0; \
|
||||
} while (0)
|
||||
#endif /* !zero_mem */
|
||||
|
||||
|
||||
/* A structure associating the nodes visited in a particular window. */
|
||||
typedef struct {
|
||||
WINDOW *window; /* The window that this list is attached to. */
|
||||
NODE **nodes; /* Array of nodes visited in this window. */
|
||||
int *pagetops; /* For each node in NODES, the pagetop. */
|
||||
long *points; /* For each node in NODES, the point. */
|
||||
int current; /* Index in NODES of the current node. */
|
||||
int nodes_index; /* Index where to add the next node. */
|
||||
int nodes_slots; /* Number of slots allocated to NODES. */
|
||||
} INFO_WINDOW;
|
||||
|
||||
/* Array of structures describing for each window which nodes have been
|
||||
visited in that window. */
|
||||
extern INFO_WINDOW **info_windows;
|
||||
|
||||
/* For handling errors. If you initialize the window system, you should
|
||||
also set info_windows_initialized_p to non-zero. It is used by the
|
||||
info_error () function to determine how to format and output errors. */
|
||||
extern int info_windows_initialized_p;
|
||||
|
||||
/* Non-zero if an error message has been printed. */
|
||||
extern int info_error_was_printed;
|
||||
|
||||
/* Non-zero means ring terminal bell on errors. */
|
||||
extern int info_error_rings_bell_p;
|
||||
|
||||
/* Non-zero means default keybindings are loosely modeled on vi(1). */
|
||||
extern int vi_keys_p;
|
||||
|
||||
/* Non-zero means don't remove ANSI escape sequences from man pages. */
|
||||
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 (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;
|
||||
extern const char *msg_cant_file_node;
|
||||
extern const char *msg_cant_find_window;
|
||||
extern const char *msg_cant_find_point;
|
||||
extern const char *msg_cant_kill_last;
|
||||
extern const char *msg_no_menu_node;
|
||||
extern const char *msg_no_foot_node;
|
||||
extern const char *msg_no_xref_node;
|
||||
extern const char *msg_no_pointer;
|
||||
extern const char *msg_unknown_command;
|
||||
extern const char *msg_term_too_dumb;
|
||||
extern const char *msg_at_node_bottom;
|
||||
extern const char *msg_at_node_top;
|
||||
extern const char *msg_one_window;
|
||||
extern const char *msg_win_too_small;
|
||||
extern const char *msg_cant_make_help;
|
||||
|
||||
|
||||
#if defined(INFOKEY)
|
||||
/* Found in variables.c. */
|
||||
extern void set_variable_to_value (char *name, char *value);
|
||||
#endif /* INFOKEY */
|
||||
|
||||
/* Found in m-x.c. */
|
||||
extern char *read_function_name (char *prompt, WINDOW *window);
|
||||
|
||||
#endif /* !INFO_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,924 +0,0 @@
|
||||
/* infokey.c -- compile ~/.infokey to ~/.info.
|
||||
$Id: infokey.c,v 1.9 2004/12/14 00:15:36 karl Exp $
|
||||
|
||||
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
|
||||
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 Andrew Bettison <andrewb@zip.com.au>. */
|
||||
|
||||
#include "info.h"
|
||||
#include "infomap.h"
|
||||
#include "infokey.h"
|
||||
#include "key.h"
|
||||
#include "getopt.h"
|
||||
|
||||
static char *program_name = "infokey";
|
||||
|
||||
/* Non-zero means print version info only. */
|
||||
static int print_version_p = 0;
|
||||
|
||||
/* Non-zero means print a short description of the options. */
|
||||
static int print_help_p = 0;
|
||||
|
||||
/* String specifying the source file. This is set by the user on the
|
||||
command line, or a default is used. */
|
||||
static char *input_filename = (char *) NULL;
|
||||
|
||||
/* String specifying the name of the file to output to. This is
|
||||
set by the user on the command line, or a default is used. */
|
||||
static char *output_filename = (char *) NULL;
|
||||
|
||||
/* Structure describing the options that Infokey accepts. We pass this
|
||||
structure to getopt_long (). If you add or otherwise change this
|
||||
structure, you must also change the string which follows it. */
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"output", 1, 0, 'o'},
|
||||
{"help", 0, &print_help_p, 1},
|
||||
{"version", 0, &print_version_p, 1},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
/* String describing the shorthand versions of the long options found above. */
|
||||
static char *short_options = "o:";
|
||||
|
||||
/* Structure for holding the compiled sections. */
|
||||
enum sect_e
|
||||
{
|
||||
info = 0,
|
||||
ea = 1,
|
||||
var = 2
|
||||
};
|
||||
struct sect
|
||||
{
|
||||
unsigned int cur;
|
||||
unsigned char data[INFOKEY_MAX_SECTIONLEN];
|
||||
};
|
||||
|
||||
/* Some "forward" declarations. */
|
||||
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);
|
||||
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Main Entry Point to the Infokey Program */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int getopt_long_index; /* Index returned by getopt_long (). */
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
/* Set locale via LC_ALL. */
|
||||
setlocale (LC_ALL, "");
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
/* Set the text message domain. */
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
while (1)
|
||||
{
|
||||
int option_character;
|
||||
|
||||
option_character = getopt_long
|
||||
(argc, argv, short_options, long_options, &getopt_long_index);
|
||||
|
||||
/* getopt_long () returns EOF when there are no more long options. */
|
||||
if (option_character == EOF)
|
||||
break;
|
||||
|
||||
/* If this is a long option, then get the short version of it. */
|
||||
if (option_character == 0 && long_options[getopt_long_index].flag == 0)
|
||||
option_character = long_options[getopt_long_index].val;
|
||||
|
||||
/* Case on the option that we have received. */
|
||||
switch (option_character)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
/* User is specifying the name of a file to output to. */
|
||||
case 'o':
|
||||
if (output_filename)
|
||||
free (output_filename);
|
||||
output_filename = xstrdup (optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
suggest_help ();
|
||||
xexit (1);
|
||||
}
|
||||
}
|
||||
|
||||
/* If the user specified --version, then show the version and exit. */
|
||||
if (print_version_p)
|
||||
{
|
||||
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\
|
||||
under the terms of the GNU General Public License.\n\
|
||||
For more information about these matters, see the files named COPYING.\n"),
|
||||
"2003");
|
||||
xexit (0);
|
||||
}
|
||||
|
||||
/* If the `--help' option was present, show the help and exit. */
|
||||
if (print_help_p)
|
||||
{
|
||||
short_help ();
|
||||
xexit (0);
|
||||
}
|
||||
|
||||
/* If there is one argument remaining, it is the name of the input
|
||||
file. */
|
||||
if (optind == argc - 1)
|
||||
{
|
||||
if (input_filename)
|
||||
free (input_filename);
|
||||
input_filename = xstrdup (argv[optind]);
|
||||
}
|
||||
else if (optind != argc)
|
||||
{
|
||||
error_message (0, _("incorrect number of arguments"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
suggest_help ();
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
/* Use default filenames where none given. */
|
||||
{
|
||||
char *homedir;
|
||||
|
||||
homedir = getenv ("HOME");
|
||||
#ifdef __MSDOS__
|
||||
if (!homedir)
|
||||
homedir = ".";
|
||||
#endif
|
||||
if (!input_filename)
|
||||
input_filename = mkpath (homedir, INFOKEY_SRCFILE);
|
||||
if (!output_filename)
|
||||
output_filename = mkpath (homedir, INFOKEY_FILE);
|
||||
}
|
||||
|
||||
{
|
||||
FILE *inf;
|
||||
FILE *outf;
|
||||
int write_error;
|
||||
static struct sect sections[3];
|
||||
|
||||
/* Open the input file. */
|
||||
inf = fopen (input_filename, "r");
|
||||
if (!inf)
|
||||
{
|
||||
error_message (errno, _("cannot open input file `%s'"),
|
||||
input_filename, NULL, NULL, NULL);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
/* Compile the input file to its verious sections, then write the
|
||||
section data to the output file. */
|
||||
|
||||
if (compile (inf, input_filename, sections))
|
||||
{
|
||||
/* Open the output file. */
|
||||
outf = fopen (output_filename, FOPEN_WBIN);
|
||||
if (!outf)
|
||||
{
|
||||
error_message (errno, _("cannot create output file `%s'"),
|
||||
output_filename, NULL, NULL, NULL);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
/* Write the contents of the output file and close it. If there is
|
||||
an error writing to the file, delete it and exit with a failure
|
||||
status. */
|
||||
write_error = 0;
|
||||
if (!write_infokey_file (outf, sections))
|
||||
{
|
||||
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, NULL, NULL, NULL);
|
||||
write_error = 1;
|
||||
}
|
||||
if (write_error)
|
||||
{
|
||||
unlink (output_filename);
|
||||
xexit (1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Close the input file. */
|
||||
fclose (inf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *
|
||||
mkpath (const char *dir, const char *file)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = xmalloc (strlen (dir) + 1 + strlen (file) + 2);
|
||||
strcpy (p, dir);
|
||||
strcat (p, "/");
|
||||
strcat (p, file);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/* Compilation - the real work.
|
||||
|
||||
Source file syntax
|
||||
------------------
|
||||
The source file is a line-based text file with the following
|
||||
structure:
|
||||
|
||||
# comments
|
||||
# more comments
|
||||
|
||||
#info
|
||||
u prev-line
|
||||
d next-line
|
||||
^a invalid # just beep
|
||||
\ku prev-line
|
||||
#stop
|
||||
\kd next-line
|
||||
q quit # of course!
|
||||
|
||||
#echo-area
|
||||
^a echo-area-beg-of-line
|
||||
^e echo-area-end-of-line
|
||||
\kr echo-area-forward
|
||||
\kl echo-area-backward
|
||||
\kh echo-area-beg-of-line
|
||||
\ke echo-area-end-of-line
|
||||
|
||||
#var
|
||||
scroll-step=1
|
||||
ISO-Latin=Off
|
||||
|
||||
Lines starting with '#' are comments, and are ignored. Blank
|
||||
lines are ignored. Each section is introduced by one of the
|
||||
following lines:
|
||||
|
||||
#info
|
||||
#echo-area
|
||||
#var
|
||||
|
||||
The sections may occur in any order. Each section may be
|
||||
omitted completely. If the 'info' section is the first in the
|
||||
file, its '#info' line may be omitted.
|
||||
|
||||
The 'info' and 'echo-area' sections
|
||||
-----------------------------------
|
||||
Each line in the 'info' or 'echo-area' sections has the
|
||||
following syntax:
|
||||
|
||||
key-sequence SPACE action-name [ SPACE [ # comment ] ] \n
|
||||
|
||||
Where SPACE is one or more white space characters excluding
|
||||
newline, "action-name" is the name of a GNU Info command,
|
||||
"comment" is any sequence of characters excluding newline, and
|
||||
"key-sequence" is a concatenation of one or more key definitions
|
||||
using the following syntax:
|
||||
|
||||
1. A carat ^ followed by one character indicates a single
|
||||
control character;
|
||||
|
||||
2. A backslash \ followed by one, two, or three octal
|
||||
digits indicates a single character having that ASCII
|
||||
code;
|
||||
|
||||
3. \n indicates a single NEWLINE;
|
||||
\e indicates a single ESC;
|
||||
\r indicates a single CR;
|
||||
\t indicates a single TAB;
|
||||
\b indicates a single BACKSPACE;
|
||||
|
||||
4. \ku indicates the Up Arrow key;
|
||||
\kd indicates the Down Arrow key;
|
||||
\kl indicates the Left Arrow key;
|
||||
\kr indicates the Right Arrow key;
|
||||
\kP indicates the Page Up (PRIOR) key;
|
||||
\kN indicates the Page Down (NEXT) key;
|
||||
\kh indicates the Home key;
|
||||
\ke indicates the End key;
|
||||
\kx indicates the DEL key;
|
||||
\k followed by any other character indicates a single
|
||||
control-K, and the following character is interpreted
|
||||
as in rules 1, 2, 3, 5 and 6.
|
||||
|
||||
5. \m followed by any sequence defined in rules 1, 2, 3, 4
|
||||
or 6 indicates the "Meta" modification of that key.
|
||||
|
||||
6. A backslash \ followed by any character not described
|
||||
above indicates that character itself. In particular:
|
||||
\\ indicates a single backslash \,
|
||||
\ (backslash-space) indicates a single space,
|
||||
\^ indicates a single caret ^,
|
||||
|
||||
If the following line:
|
||||
|
||||
#stop
|
||||
|
||||
occurs anywhere in an 'info' or 'echo-area' section, that
|
||||
indicates to GNU Info to suppress all of its default key
|
||||
bindings in that context.
|
||||
|
||||
The 'var' section
|
||||
-----------------
|
||||
Each line in the 'var' section has the following syntax:
|
||||
|
||||
variable-name = value \n
|
||||
|
||||
Where "variable-name" is the name of a GNU Info variable and
|
||||
"value" is the value that GNU Info will assign to that variable
|
||||
when commencing execution. There must be no white space in the
|
||||
variable name, nor between the variable name and the '='. All
|
||||
characters immediately following the '=', up to but not
|
||||
including the terminating newline, are considered to be the
|
||||
value that will be assigned. In other words, white space
|
||||
following the '=' is not ignored.
|
||||
*/
|
||||
|
||||
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 (FILE *fp, const char *filename, struct sect *sections)
|
||||
{
|
||||
int error = 0;
|
||||
char rescan = 0;
|
||||
unsigned int lnum = 0;
|
||||
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
|
||||
state is fully represented by the following variables:
|
||||
*/
|
||||
enum
|
||||
{
|
||||
start_of_line,
|
||||
start_of_comment,
|
||||
in_line_comment,
|
||||
in_trailing_comment,
|
||||
get_keyseq,
|
||||
got_keyseq,
|
||||
get_action,
|
||||
got_action,
|
||||
get_varname,
|
||||
got_varname,
|
||||
get_equals,
|
||||
got_equals,
|
||||
get_value
|
||||
}
|
||||
state = start_of_line;
|
||||
enum sect_e section = info;
|
||||
enum
|
||||
{
|
||||
normal,
|
||||
slosh,
|
||||
control,
|
||||
octal,
|
||||
special_key
|
||||
}
|
||||
seqstate; /* used if state == get_keyseq */
|
||||
char meta = 0;
|
||||
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
|
||||
where appropriate if a string limit is exceeded. These string
|
||||
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 = 0;
|
||||
char comment[10];
|
||||
unsigned int clen = 0;
|
||||
char seq[20];
|
||||
unsigned int slen = 0;
|
||||
char act[80];
|
||||
unsigned int alen = 0;
|
||||
char varn[80];
|
||||
unsigned int varlen = 0;
|
||||
char val[80];
|
||||
unsigned int vallen = 0;
|
||||
|
||||
#define To_seq(c) \
|
||||
do { \
|
||||
if (slen < sizeof seq) \
|
||||
seq[slen++] = meta ? Meta(c) : (c); \
|
||||
else \
|
||||
{ \
|
||||
syntax_error(filename, lnum, _("key sequence too long"), \
|
||||
NULL, NULL, NULL, NULL); \
|
||||
error = 1; \
|
||||
} \
|
||||
meta = 0; \
|
||||
} while (0)
|
||||
|
||||
sections[info].cur = 1;
|
||||
sections[info].data[0] = 0;
|
||||
sections[ea].cur = 1;
|
||||
sections[ea].data[0] = 0;
|
||||
sections[var].cur = 0;
|
||||
|
||||
while (!error && (rescan || (c = fgetc (fp)) != EOF))
|
||||
{
|
||||
rescan = 0;
|
||||
switch (state)
|
||||
{
|
||||
case start_of_line:
|
||||
lnum++;
|
||||
if (c == '#')
|
||||
state = start_of_comment;
|
||||
else if (c != '\n')
|
||||
{
|
||||
switch (section)
|
||||
{
|
||||
case info:
|
||||
case ea:
|
||||
state = get_keyseq;
|
||||
seqstate = normal;
|
||||
slen = 0;
|
||||
break;
|
||||
case var:
|
||||
state = get_varname;
|
||||
varlen = 0;
|
||||
break;
|
||||
}
|
||||
rescan = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case start_of_comment:
|
||||
clen = 0;
|
||||
state = in_line_comment;
|
||||
/* fall through */
|
||||
case in_line_comment:
|
||||
if (c == '\n')
|
||||
{
|
||||
state = start_of_line;
|
||||
comment[clen] = '\0';
|
||||
if (strcmp (comment, "info") == 0)
|
||||
section = info;
|
||||
else if (strcmp (comment, "echo-area") == 0)
|
||||
section = ea;
|
||||
else if (strcmp (comment, "var") == 0)
|
||||
section = var;
|
||||
else if (strcmp (comment, "stop") == 0
|
||||
&& (section == info || section == ea))
|
||||
sections[section].data[0] = 1;
|
||||
}
|
||||
else if (clen < sizeof comment - 1)
|
||||
comment[clen++] = c;
|
||||
break;
|
||||
|
||||
case in_trailing_comment:
|
||||
if (c == '\n')
|
||||
state = start_of_line;
|
||||
break;
|
||||
|
||||
case get_keyseq:
|
||||
switch (seqstate)
|
||||
{
|
||||
case normal:
|
||||
if (c == '\n' || isspace (c))
|
||||
{
|
||||
state = got_keyseq;
|
||||
rescan = 1;
|
||||
if (slen == 0)
|
||||
{
|
||||
syntax_error (filename, lnum, _("missing key sequence"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
else if (c == '\\')
|
||||
seqstate = slosh;
|
||||
else if (c == '^')
|
||||
seqstate = control;
|
||||
else
|
||||
To_seq (c);
|
||||
break;
|
||||
|
||||
case slosh:
|
||||
switch (c)
|
||||
{
|
||||
case '0': case '1': case '2': case '3':
|
||||
case '4': case '5': case '6': case '7':
|
||||
seqstate = octal;
|
||||
oval = c - '0';
|
||||
ocnt = 1;
|
||||
break;
|
||||
case 'b':
|
||||
To_seq ('\b');
|
||||
seqstate = normal;
|
||||
break;
|
||||
case 'e':
|
||||
To_seq ('\033');
|
||||
seqstate = normal;
|
||||
break;
|
||||
case 'n':
|
||||
To_seq ('\n');
|
||||
seqstate = normal;
|
||||
break;
|
||||
case 'r':
|
||||
To_seq ('\r');
|
||||
seqstate = normal;
|
||||
break;
|
||||
case 't':
|
||||
To_seq ('\t');
|
||||
seqstate = normal;
|
||||
break;
|
||||
case 'm':
|
||||
meta = 1;
|
||||
seqstate = normal;
|
||||
break;
|
||||
case 'k':
|
||||
seqstate = special_key;
|
||||
break;
|
||||
default:
|
||||
/* Backslash followed by any other char
|
||||
just means that char. */
|
||||
To_seq (c);
|
||||
seqstate = normal;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case octal:
|
||||
switch (c)
|
||||
{
|
||||
case '0': case '1': case '2': case '3':
|
||||
case '4': case '5': case '6': case '7':
|
||||
if (++ocnt <= 3)
|
||||
oval = oval * 8 + c - '0';
|
||||
if (ocnt == 3)
|
||||
seqstate = normal;
|
||||
break;
|
||||
default:
|
||||
ocnt = 4;
|
||||
seqstate = normal;
|
||||
rescan = 1;
|
||||
break;
|
||||
}
|
||||
if (seqstate != octal)
|
||||
{
|
||||
if (oval)
|
||||
To_seq (oval);
|
||||
else
|
||||
{
|
||||
syntax_error (filename, lnum,
|
||||
_("NUL character (\\000) not permitted"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case special_key:
|
||||
To_seq (SK_ESCAPE);
|
||||
switch (c)
|
||||
{
|
||||
case 'u': To_seq (SK_UP_ARROW); break;
|
||||
case 'd': To_seq (SK_DOWN_ARROW); break;
|
||||
case 'r': To_seq (SK_RIGHT_ARROW); break;
|
||||
case 'l': To_seq (SK_LEFT_ARROW); break;
|
||||
case 'U': To_seq (SK_PAGE_UP); break;
|
||||
case 'D': To_seq (SK_PAGE_DOWN); break;
|
||||
case 'h': To_seq (SK_HOME); break;
|
||||
case 'e': To_seq (SK_END); break;
|
||||
case 'x': To_seq (SK_DELETE); break;
|
||||
default: To_seq (SK_LITERAL); rescan = 1; break;
|
||||
}
|
||||
seqstate = normal;
|
||||
break;
|
||||
|
||||
case control:
|
||||
if (CONTROL (c))
|
||||
To_seq (CONTROL (c));
|
||||
else
|
||||
{
|
||||
syntax_error (filename, lnum,
|
||||
(char *) _("NUL character (^%c) not permitted"),
|
||||
(void *) (long) c, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
seqstate = normal;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case got_keyseq:
|
||||
if (isspace (c) && c != '\n')
|
||||
break;
|
||||
state = get_action;
|
||||
alen = 0;
|
||||
/* fall through */
|
||||
case get_action:
|
||||
if (c == '\n' || isspace (c))
|
||||
{
|
||||
int a;
|
||||
|
||||
state = got_action;
|
||||
rescan = 1;
|
||||
if (alen == 0)
|
||||
{
|
||||
syntax_error (filename, lnum, (char *) _("missing action name"),
|
||||
(void *) (long) c, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
act[alen] = '\0';
|
||||
a = lookup_action (act);
|
||||
if (a != -1)
|
||||
{
|
||||
char av = a;
|
||||
|
||||
if (!(add_to_section (§ions[section], seq, slen)
|
||||
&& add_to_section (§ions[section], "", 1)
|
||||
&& add_to_section (§ions[section], &av, 1)))
|
||||
{
|
||||
syntax_error (filename, lnum, _("section too long"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
syntax_error (filename, lnum, _("unknown action `%s'"),
|
||||
act, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (alen < sizeof act - 1)
|
||||
act[alen++] = c;
|
||||
else
|
||||
{
|
||||
syntax_error (filename, lnum, _("action name too long"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case got_action:
|
||||
if (c == '#')
|
||||
state = in_trailing_comment;
|
||||
else if (c == '\n')
|
||||
state = start_of_line;
|
||||
else if (!isspace (c))
|
||||
{
|
||||
syntax_error (filename, lnum,
|
||||
_("extra characters following action `%s'"),
|
||||
act, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case get_varname:
|
||||
if (c == '=')
|
||||
{
|
||||
if (varlen == 0)
|
||||
{
|
||||
syntax_error (filename, lnum, _("missing variable name"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
state = get_value;
|
||||
vallen = 0;
|
||||
}
|
||||
else if (c == '\n' || isspace (c))
|
||||
{
|
||||
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"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case get_value:
|
||||
if (c == '\n')
|
||||
{
|
||||
state = start_of_line;
|
||||
if (!(add_to_section (§ions[section], varn, varlen)
|
||||
&& add_to_section (§ions[section], "", 1)
|
||||
&& add_to_section (§ions[section], val, vallen)
|
||||
&& add_to_section (§ions[section], "", 1)))
|
||||
{
|
||||
syntax_error (filename, lnum, _("section too long"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
else if (vallen < sizeof val)
|
||||
val[vallen++] = c;
|
||||
else
|
||||
{
|
||||
syntax_error (filename, lnum, _("value too long"),
|
||||
NULL, NULL, NULL, NULL);
|
||||
error = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case get_equals:
|
||||
case got_equals:
|
||||
case got_varname:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#undef To_seq
|
||||
|
||||
return !error;
|
||||
}
|
||||
|
||||
/* Add some characters to a section's data. Return true if all the
|
||||
characters fit, or false if the section's size limit was exceeded.
|
||||
*/
|
||||
static int
|
||||
add_to_section (struct sect *s, const char *str, unsigned int len)
|
||||
{
|
||||
if (s->cur + len > sizeof s->data)
|
||||
return 0;
|
||||
strncpy ((char *) s->data + s->cur, str, len);
|
||||
s->cur += len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Translate from an action name to its numeric code. This uses the
|
||||
auto-generated array in key.c.
|
||||
*/
|
||||
static int
|
||||
lookup_action (const char *actname)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (strcmp ("invalid", actname) == 0)
|
||||
return A_INVALID;
|
||||
for (i = 0; function_key_array[i].name != NULL; i++)
|
||||
if (strcmp (function_key_array[i].name, actname) == 0)
|
||||
return function_key_array[i].code;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Put an integer to an infokey file.
|
||||
Integers are stored as two bytes, low order first,
|
||||
in radix INFOKEY_RADIX.
|
||||
*/
|
||||
static int
|
||||
putint (int i, FILE *fp)
|
||||
{
|
||||
return fputc (i % INFOKEY_RADIX, fp) != EOF
|
||||
&& fputc ((i / INFOKEY_RADIX) % INFOKEY_RADIX, fp) != EOF;
|
||||
}
|
||||
|
||||
/* Write an entire section to an infokey file. If the section is
|
||||
empty, simply omit it.
|
||||
*/
|
||||
static int
|
||||
putsect (struct sect *s, int code, FILE *fp)
|
||||
{
|
||||
if (s->cur == 0)
|
||||
return 1;
|
||||
return fputc (code, fp) != EOF
|
||||
&& putint (s->cur, fp)
|
||||
&& fwrite (s->data, s->cur, 1, fp) == 1;
|
||||
}
|
||||
|
||||
/* Write an entire infokey file, given an array containing its sections.
|
||||
*/
|
||||
static int
|
||||
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)
|
||||
sections[info].cur = 0;
|
||||
if (sections[ea].cur == 1 && sections[ea].data[0] == 0)
|
||||
sections[ea].cur = 0;
|
||||
|
||||
/* Write all parts of the file out in order (no lseeks),
|
||||
checking for errors all the way. */
|
||||
return fputc (INFOKEY_MAGIC_S0, fp) != EOF
|
||||
&& fputc (INFOKEY_MAGIC_S1, fp) != EOF
|
||||
&& fputc (INFOKEY_MAGIC_S2, fp) != EOF
|
||||
&& fputc (INFOKEY_MAGIC_S3, fp) != EOF
|
||||
&& fputs (VERSION, fp) != EOF
|
||||
&& fputc ('\0', fp) != EOF
|
||||
&& putsect (§ions[info], INFOKEY_SECTION_INFO, fp)
|
||||
&& putsect (§ions[ea], INFOKEY_SECTION_EA, fp)
|
||||
&& putsect (§ions[var], INFOKEY_SECTION_VAR, fp)
|
||||
&& fputc (INFOKEY_MAGIC_E0, fp) != EOF
|
||||
&& fputc (INFOKEY_MAGIC_E1, fp) != EOF
|
||||
&& fputc (INFOKEY_MAGIC_E2, fp) != EOF
|
||||
&& fputc (INFOKEY_MAGIC_E3, fp) != EOF;
|
||||
}
|
||||
|
||||
|
||||
/* Error handling. */
|
||||
|
||||
/* Give the user a "syntax error" message in the form
|
||||
progname: "filename", line N: message
|
||||
*/
|
||||
static void
|
||||
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);
|
||||
if (error_code)
|
||||
fprintf (stderr, " - %s", strerror (error_code));
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
/* Give the user a generic error message in the form
|
||||
progname: message
|
||||
*/
|
||||
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)
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
fprintf (stderr, _("\"%s\", line %u: "), filename, linenum);
|
||||
fprintf (stderr, fmt, a1, a2, a3, a4);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
/* Produce a gentle rtfm. */
|
||||
static void
|
||||
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 (void)
|
||||
{
|
||||
printf (_("\
|
||||
Usage: %s [OPTION]... [INPUT-FILE]\n\
|
||||
\n\
|
||||
Compile infokey source file to infokey file. Reads INPUT-FILE (default\n\
|
||||
$HOME/.infokey) and writes compiled key file to (by default) $HOME/.info.\n\
|
||||
\n\
|
||||
Options:\n\
|
||||
--output FILE output to FILE instead of $HOME/.info\n\
|
||||
--help display this help and exit.\n\
|
||||
--version display version information and exit.\n\
|
||||
"), program_name);
|
||||
|
||||
puts (_("\n\
|
||||
Email bug reports to bug-texinfo@gnu.org,\n\
|
||||
general questions and discussion to help-texinfo@gnu.org.\n\
|
||||
Texinfo home page: http://www.gnu.org/software/texinfo/"));
|
||||
|
||||
xexit (0);
|
||||
}
|
@ -1,128 +0,0 @@
|
||||
/* infokey.h -- Custom keystroke definition support.
|
||||
$Id: infokey.h,v 1.2 2004/04/11 17:56:45 karl Exp $
|
||||
|
||||
Copyright (C) 1999, 2002 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 Andrew Bettison <andrewb@zip.com.au>.
|
||||
|
||||
This design was derived from the "lesskey" system in less 3.4.0. by
|
||||
Mark Nudelman.
|
||||
|
||||
The following terminology is confusing:
|
||||
source file = $HOME/.infokey
|
||||
infokey file = $HOME/.info
|
||||
Oh, well.
|
||||
*/
|
||||
|
||||
|
||||
/* Default source file, where user writes text definitions to be
|
||||
compiled to the infokey file. MS-DOS doesn't allow leading
|
||||
dots in file names. */
|
||||
#ifdef __MSDOS__
|
||||
#define INFOKEY_SRCFILE "_infokey"
|
||||
#else
|
||||
#define INFOKEY_SRCFILE ".infokey"
|
||||
#endif
|
||||
|
||||
/* Default "infokey file", where compiled user defs are kept and
|
||||
read by Info. MS-DOS doesn't allow leading dots in file names. */
|
||||
#ifdef __MSDOS__
|
||||
#define INFOKEY_FILE "_info"
|
||||
#else
|
||||
#define INFOKEY_FILE ".info"
|
||||
#endif
|
||||
|
||||
/*
|
||||
Format of entire infokey file:
|
||||
|
||||
4 bytes magic number S
|
||||
X bytes version string
|
||||
1 byte '\0' terminator
|
||||
|
||||
any number of sections:
|
||||
1 byte section id
|
||||
2 bytes section length (N)
|
||||
N bytes section definitions: format depends on section
|
||||
|
||||
4 bytes magic number E
|
||||
|
||||
Format of INFO and EA sections:
|
||||
|
||||
1 byte flag: 1 == suppress default key bindings
|
||||
Repeat:
|
||||
X bytes key sequence
|
||||
1 byte '\0' terminator
|
||||
1 byte action code (A_xxx)
|
||||
|
||||
Format of VAR section:
|
||||
|
||||
Repeat:
|
||||
X bytes variable name
|
||||
1 byte '\0' terminator
|
||||
Y bytes value
|
||||
1 byte '\0' terminator
|
||||
|
||||
*/
|
||||
|
||||
#define INFOKEY_NMAGIC 8
|
||||
|
||||
#define INFOKEY_MAGIC_S0 '\001'
|
||||
#define INFOKEY_MAGIC_S1 'I'
|
||||
#define INFOKEY_MAGIC_S2 'n'
|
||||
#define INFOKEY_MAGIC_S3 'f'
|
||||
|
||||
#define INFOKEY_SECTION_INFO 'i'
|
||||
#define INFOKEY_SECTION_EA 'e'
|
||||
#define INFOKEY_SECTION_VAR 'v'
|
||||
|
||||
#define INFOKEY_MAGIC_E0 'A'
|
||||
#define INFOKEY_MAGIC_E1 'l'
|
||||
#define INFOKEY_MAGIC_E2 'f'
|
||||
#define INFOKEY_MAGIC_E3 'n'
|
||||
|
||||
#define INFOKEY_RADIX 64
|
||||
#define INFOKEY_MAX_SECTIONLEN 500
|
||||
#define INFOKEY_MAX_DEFLEN 16
|
||||
|
||||
#define A_MAX_COMMAND 120
|
||||
#define A_INVALID 121
|
||||
|
||||
/* Character transformations (independent of info's own) */
|
||||
|
||||
#define CONTROL(c) ((c) & 0x1f)
|
||||
#define ISCONTROL(c) (((c) & ~0x1f) == 0)
|
||||
#define META(c) ((c) | 0x80)
|
||||
#define UNMETA(c) ((c) & ~0x80)
|
||||
#define ISMETA(c) (((c) & 0x80) != 0)
|
||||
|
||||
/* Special keys (keys which output different strings on different terminals) */
|
||||
|
||||
#define SK_ESCAPE CONTROL('k')
|
||||
#define SK_RIGHT_ARROW 1
|
||||
#define SK_LEFT_ARROW 2
|
||||
#define SK_UP_ARROW 3
|
||||
#define SK_DOWN_ARROW 4
|
||||
#define SK_PAGE_UP 5
|
||||
#define SK_PAGE_DOWN 6
|
||||
#define SK_HOME 7
|
||||
#define SK_END 8
|
||||
#define SK_DELETE 9
|
||||
#define SK_INSERT 10
|
||||
#define SK_CTL_LEFT_ARROW 11
|
||||
#define SK_CTL_RIGHT_ARROW 12
|
||||
#define SK_CTL_DELETE 13
|
||||
#define SK_LITERAL 40
|
File diff suppressed because it is too large
Load Diff
@ -1,82 +0,0 @@
|
||||
/* infomap.h -- description of a keymap in Info and related functions.
|
||||
$Id: infomap.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFOMAP_H
|
||||
#define INFOMAP_H
|
||||
|
||||
#include "info.h"
|
||||
|
||||
#define ESC '\033'
|
||||
#define DEL '\177'
|
||||
#define TAB '\011'
|
||||
#define RET '\r'
|
||||
#define LFD '\n'
|
||||
#define SPC ' '
|
||||
|
||||
#define meta_character_threshold (DEL + 1)
|
||||
#define control_character_threshold (SPC)
|
||||
|
||||
#define meta_character_bit 0x80
|
||||
#define control_character_bit 0x40
|
||||
|
||||
#define Meta_p(c) (((c) > meta_character_threshold))
|
||||
#define Control_p(c) ((c) < control_character_threshold)
|
||||
|
||||
#define Meta(c) ((c) | (meta_character_bit))
|
||||
#define UnMeta(c) ((c) & (~meta_character_bit))
|
||||
#define Control(c) ((toupper (c)) & (~control_character_bit))
|
||||
#define UnControl(c) (tolower ((c) | control_character_bit))
|
||||
|
||||
/* A keymap contains one entry for each key in the ASCII set.
|
||||
Each entry consists of a type and a pointer.
|
||||
FUNCTION is the address of a function to run, or the
|
||||
address of a keymap to indirect through.
|
||||
TYPE says which kind of thing FUNCTION is. */
|
||||
typedef struct keymap_entry
|
||||
{
|
||||
char type;
|
||||
InfoCommand *function;
|
||||
} KEYMAP_ENTRY;
|
||||
|
||||
typedef KEYMAP_ENTRY *Keymap;
|
||||
|
||||
/* The values that TYPE can have in a keymap entry. */
|
||||
#define ISFUNC 0
|
||||
#define ISKMAP 1
|
||||
|
||||
extern Keymap info_keymap;
|
||||
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 (void);
|
||||
|
||||
/* Return a new keymap which is a copy of MAP. */
|
||||
extern Keymap keymap_copy_keymap (Keymap map, Keymap rootmap,
|
||||
Keymap newroot);
|
||||
|
||||
/* Free MAP and it's descendents. */
|
||||
extern void keymap_discard_keymap (Keymap map, Keymap rootmap);
|
||||
|
||||
/* Initialize the info keymaps. */
|
||||
extern void initialize_info_keymaps (void);
|
||||
|
||||
#endif /* not INFOMAP_H */
|
@ -1,146 +0,0 @@
|
||||
/* key.c -- Generated array containing function names.
|
||||
|
||||
This file was automatically made from various source files with the
|
||||
command "..//info/makedoc". DO NOT EDIT THIS FILE, only "..//info/makedoc.c".
|
||||
|
||||
Source files groveled to make this file include:
|
||||
|
||||
./session.c
|
||||
./echo-area.c
|
||||
./infodoc.c
|
||||
./m-x.c
|
||||
./indices.c
|
||||
./nodemenu.c
|
||||
./footnotes.c
|
||||
./variables.c
|
||||
|
||||
An entry in the array FUNCTION_KEY_ARRAY is made for each command
|
||||
found in the above files; each entry consists of
|
||||
a string which is the user-visible name of the function. */
|
||||
|
||||
#include "key.h"
|
||||
#include "funs.h"
|
||||
|
||||
FUNCTION_KEY function_key_array[] = {
|
||||
|
||||
/* Commands found in "./session.c". */
|
||||
{ "next-line", A_info_next_line },
|
||||
{ "prev-line", A_info_prev_line },
|
||||
{ "end-of-line", A_info_end_of_line },
|
||||
{ "beginning-of-line", A_info_beginning_of_line },
|
||||
{ "forward-char", A_info_forward_char },
|
||||
{ "backward-char", A_info_backward_char },
|
||||
{ "forward-word", A_info_forward_word },
|
||||
{ "backward-word", A_info_backward_word },
|
||||
{ "global-next-node", A_info_global_next_node },
|
||||
{ "global-prev-node", A_info_global_prev_node },
|
||||
{ "scroll-forward", A_info_scroll_forward },
|
||||
{ "scroll-forward-set-window", A_info_scroll_forward_set_window },
|
||||
{ "scroll-forward-page-only", A_info_scroll_forward_page_only },
|
||||
{ "scroll-forward-page-only-set-window", A_info_scroll_forward_page_only_set_window },
|
||||
{ "scroll-backward", A_info_scroll_backward },
|
||||
{ "scroll-backward-set-window", A_info_scroll_backward_set_window },
|
||||
{ "scroll-backward-page-only", A_info_scroll_backward_page_only },
|
||||
{ "scroll-backward-page-only-set-window", A_info_scroll_backward_page_only_set_window },
|
||||
{ "beginning-of-node", A_info_beginning_of_node },
|
||||
{ "end-of-node", A_info_end_of_node },
|
||||
{ "down-line", A_info_down_line },
|
||||
{ "up-line", A_info_up_line },
|
||||
{ "scroll-half-screen-down", A_info_scroll_half_screen_down },
|
||||
{ "scroll-half-screen-up", A_info_scroll_half_screen_up },
|
||||
{ "next-window", A_info_next_window },
|
||||
{ "prev-window", A_info_prev_window },
|
||||
{ "split-window", A_info_split_window },
|
||||
{ "delete-window", A_info_delete_window },
|
||||
{ "keep-one-window", A_info_keep_one_window },
|
||||
{ "scroll-other-window", A_info_scroll_other_window },
|
||||
{ "scroll-other-window-backward", A_info_scroll_other_window_backward },
|
||||
{ "grow-window", A_info_grow_window },
|
||||
{ "tile-windows", A_info_tile_windows },
|
||||
{ "toggle-wrap", A_info_toggle_wrap },
|
||||
{ "next-node", A_info_next_node },
|
||||
{ "prev-node", A_info_prev_node },
|
||||
{ "up-node", A_info_up_node },
|
||||
{ "last-node", A_info_last_node },
|
||||
{ "first-node", A_info_first_node },
|
||||
{ "last-menu-item", A_info_last_menu_item },
|
||||
{ "menu-digit", A_info_menu_digit },
|
||||
{ "menu-item", A_info_menu_item },
|
||||
{ "xref-item", A_info_xref_item },
|
||||
{ "find-menu", A_info_find_menu },
|
||||
{ "visit-menu", A_info_visit_menu },
|
||||
{ "goto-node", A_info_goto_node },
|
||||
{ "menu-sequence", A_info_menu_sequence },
|
||||
{ "goto-invocation-node", A_info_goto_invocation_node },
|
||||
{ "man", A_info_man },
|
||||
{ "top-node", A_info_top_node },
|
||||
{ "dir-node", A_info_dir_node },
|
||||
{ "history-node", A_info_history_node },
|
||||
{ "kill-node", A_info_kill_node },
|
||||
{ "view-file", A_info_view_file },
|
||||
{ "print-node", A_info_print_node },
|
||||
{ "search-case-sensitively", A_info_search_case_sensitively },
|
||||
{ "search", A_info_search },
|
||||
{ "search-backward", A_info_search_backward },
|
||||
{ "search-next", A_info_search_next },
|
||||
{ "search-previous", A_info_search_previous },
|
||||
{ "isearch-forward", A_isearch_forward },
|
||||
{ "isearch-backward", A_isearch_backward },
|
||||
{ "move-to-prev-xref", A_info_move_to_prev_xref },
|
||||
{ "move-to-next-xref", A_info_move_to_next_xref },
|
||||
{ "select-reference-this-line", A_info_select_reference_this_line },
|
||||
{ "abort-key", A_info_abort_key },
|
||||
{ "move-to-window-line", A_info_move_to_window_line },
|
||||
{ "redraw-display", A_info_redraw_display },
|
||||
{ "quit", A_info_quit },
|
||||
{ "do-lowercase-version", A_info_do_lowercase_version },
|
||||
{ "add-digit-to-numeric-arg", A_info_add_digit_to_numeric_arg },
|
||||
{ "universal-argument", A_info_universal_argument },
|
||||
{ "numeric-arg-digit-loop", A_info_numeric_arg_digit_loop },
|
||||
/* Commands found in "./echo-area.c". */
|
||||
{ "echo-area-forward", A_ea_forward },
|
||||
{ "echo-area-backward", A_ea_backward },
|
||||
{ "echo-area-beg-of-line", A_ea_beg_of_line },
|
||||
{ "echo-area-end-of-line", A_ea_end_of_line },
|
||||
{ "echo-area-forward-word", A_ea_forward_word },
|
||||
{ "echo-area-backward-word", A_ea_backward_word },
|
||||
{ "echo-area-delete", A_ea_delete },
|
||||
{ "echo-area-rubout", A_ea_rubout },
|
||||
{ "echo-area-abort", A_ea_abort },
|
||||
{ "echo-area-newline", A_ea_newline },
|
||||
{ "echo-area-quoted-insert", A_ea_quoted_insert },
|
||||
{ "echo-area-insert", A_ea_insert },
|
||||
{ "echo-area-tab-insert", A_ea_tab_insert },
|
||||
{ "echo-area-transpose-chars", A_ea_transpose_chars },
|
||||
{ "echo-area-yank", A_ea_yank },
|
||||
{ "echo-area-yank-pop", A_ea_yank_pop },
|
||||
{ "echo-area-kill-line", A_ea_kill_line },
|
||||
{ "echo-area-backward-kill-line", A_ea_backward_kill_line },
|
||||
{ "echo-area-kill-word", A_ea_kill_word },
|
||||
{ "echo-area-backward-kill-word", A_ea_backward_kill_word },
|
||||
{ "echo-area-possible-completions", A_ea_possible_completions },
|
||||
{ "echo-area-complete", A_ea_complete },
|
||||
{ "echo-area-scroll-completions-window", A_ea_scroll_completions_window },
|
||||
/* Commands found in "./infodoc.c". */
|
||||
{ "get-help-window", A_info_get_help_window },
|
||||
{ "get-info-help-node", A_info_get_info_help_node },
|
||||
{ "describe-key", A_describe_key },
|
||||
{ "where-is", A_info_where_is },
|
||||
/* Commands found in "./m-x.c". */
|
||||
{ "describe-command", A_describe_command },
|
||||
{ "execute-command", A_info_execute_command },
|
||||
{ "set-screen-height", A_set_screen_height },
|
||||
/* Commands found in "./indices.c". */
|
||||
{ "index-search", A_info_index_search },
|
||||
{ "next-index-match", A_info_next_index_match },
|
||||
{ "index-apropos", A_info_index_apropos },
|
||||
/* Commands found in "./nodemenu.c". */
|
||||
{ "list-visited-nodes", A_list_visited_nodes },
|
||||
{ "select-visited-node", A_select_visited_node },
|
||||
/* Commands found in "./footnotes.c". */
|
||||
{ "show-footnotes", A_info_show_footnotes },
|
||||
/* Commands found in "./variables.c". */
|
||||
{ "describe-variable", A_describe_variable },
|
||||
{ "set-variable", A_set_variable },
|
||||
{ (char *)NULL, 0 }
|
||||
};
|
@ -1,35 +0,0 @@
|
||||
/* key.h -- Structure associating function names with numeric codes. */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993 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 Andrew Bettison <andrewb@zip.com.au> */
|
||||
|
||||
#if !defined (KEY_H)
|
||||
#define KEY_H
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
unsigned char code;
|
||||
}
|
||||
FUNCTION_KEY;
|
||||
|
||||
extern FUNCTION_KEY function_key_array[];
|
||||
|
||||
#endif /* !KEY_H */
|
@ -1,214 +0,0 @@
|
||||
/* m-x.c -- Meta-x minibuffer reader.
|
||||
$Id: m-x.c,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "funs.h"
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Reading Named Commands */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Read the name of an Info function in the echo area and return the
|
||||
name. A return value of NULL indicates that no function name could
|
||||
be read. */
|
||||
char *
|
||||
read_function_name (char *prompt, WINDOW *window)
|
||||
{
|
||||
register int i;
|
||||
char *line;
|
||||
REFERENCE **array = (REFERENCE **)NULL;
|
||||
int array_index = 0, array_slots = 0;
|
||||
|
||||
/* Make an array of REFERENCE which actually contains the names of
|
||||
the functions available in Info. */
|
||||
for (i = 0; function_doc_array[i].func; i++)
|
||||
{
|
||||
REFERENCE *entry;
|
||||
|
||||
entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
|
||||
entry->label = xstrdup (function_doc_array[i].func_name);
|
||||
entry->nodename = (char *)NULL;
|
||||
entry->filename = (char *)NULL;
|
||||
|
||||
add_pointer_to_array
|
||||
(entry, array_index, array, array_slots, 200, REFERENCE *);
|
||||
}
|
||||
|
||||
line = info_read_completing_in_echo_area (window, prompt, array);
|
||||
|
||||
info_free_references (array);
|
||||
|
||||
if (!echo_area_is_active)
|
||||
window_clear_echo_area ();
|
||||
|
||||
return (line);
|
||||
}
|
||||
|
||||
DECLARE_INFO_COMMAND (describe_command,
|
||||
_("Read the name of an Info command and describe it"))
|
||||
{
|
||||
char *line;
|
||||
|
||||
line = read_function_name ((char *) _("Describe command: "), window);
|
||||
|
||||
if (!line)
|
||||
{
|
||||
info_abort_key (active_window, count, key);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Describe the function named in "LINE". */
|
||||
if (*line)
|
||||
{
|
||||
InfoCommand *cmd = named_function (line);
|
||||
|
||||
if (!cmd)
|
||||
return;
|
||||
|
||||
window_message_in_echo_area ("%s: %s.",
|
||||
line, function_documentation (cmd));
|
||||
}
|
||||
free (line);
|
||||
}
|
||||
|
||||
DECLARE_INFO_COMMAND (info_execute_command,
|
||||
_("Read a command name in the echo area and execute it"))
|
||||
{
|
||||
char *line;
|
||||
char *keys;
|
||||
char *prompt;
|
||||
|
||||
prompt = (char *)xmalloc (20);
|
||||
|
||||
keys = where_is (info_keymap, InfoCmd(info_execute_command));
|
||||
/* If the where_is () function thinks that this command doesn't exist,
|
||||
there's something very wrong! */
|
||||
if (!keys)
|
||||
abort();
|
||||
|
||||
if (info_explicit_arg || count != 1)
|
||||
sprintf (prompt, "%d %s ", count, keys);
|
||||
else
|
||||
sprintf (prompt, "%s ", keys);
|
||||
|
||||
/* Ask the completer to read a reference for us. */
|
||||
line = read_function_name (prompt, window);
|
||||
|
||||
/* User aborted? */
|
||||
if (!line)
|
||||
{
|
||||
info_abort_key (active_window, count, key);
|
||||
return;
|
||||
}
|
||||
|
||||
/* User accepted "default"? (There is none.) */
|
||||
if (!*line)
|
||||
{
|
||||
free (line);
|
||||
return;
|
||||
}
|
||||
|
||||
/* User wants to execute a named command. Do it. */
|
||||
{
|
||||
InfoCommand *command;
|
||||
|
||||
if ((active_window != the_echo_area) &&
|
||||
(strncmp (line, "echo-area-", 10) == 0))
|
||||
{
|
||||
free (line);
|
||||
info_error ((char *) _("Cannot execute an `echo-area' command here."),
|
||||
NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
command = named_function (line);
|
||||
free (line);
|
||||
|
||||
if (!command)
|
||||
return;
|
||||
|
||||
if (InfoFunction(command))
|
||||
(*InfoFunction(command)) (active_window, count, 0);
|
||||
else
|
||||
info_error ((char *) _("Undefined command: %s"), line, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Okay, now that we have M-x, let the user set the screen height. */
|
||||
DECLARE_INFO_COMMAND (set_screen_height,
|
||||
_("Set the height of the displayed window"))
|
||||
{
|
||||
int new_height, old_height = screenheight;
|
||||
|
||||
if (info_explicit_arg || count != 1)
|
||||
new_height = count;
|
||||
else
|
||||
{
|
||||
char prompt[80];
|
||||
char *line;
|
||||
|
||||
new_height = screenheight;
|
||||
|
||||
sprintf (prompt, _("Set screen height to (%d): "), new_height);
|
||||
|
||||
line = info_read_in_echo_area (window, prompt);
|
||||
|
||||
/* If the user aborted, do that now. */
|
||||
if (!line)
|
||||
{
|
||||
info_abort_key (active_window, count, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Find out what the new height is supposed to be. */
|
||||
if (*line)
|
||||
new_height = atoi (line);
|
||||
|
||||
/* Clear the echo area if it isn't active. */
|
||||
if (!echo_area_is_active)
|
||||
window_clear_echo_area ();
|
||||
|
||||
free (line);
|
||||
}
|
||||
|
||||
terminal_clear_screen ();
|
||||
display_clear_display (the_display);
|
||||
screenheight = new_height;
|
||||
#ifdef SET_SCREEN_SIZE_HELPER
|
||||
SET_SCREEN_SIZE_HELPER;
|
||||
#endif
|
||||
if (screenheight == old_height)
|
||||
{
|
||||
/* Display dimensions didn't actually change, so
|
||||
window_new_screen_size won't do anything, but we've
|
||||
already cleared the display above. Undo the damage. */
|
||||
window_mark_chain (windows, W_UpdateWindow);
|
||||
display_update_display (windows);
|
||||
}
|
||||
else
|
||||
{
|
||||
display_initialize_display (screenwidth, screenheight);
|
||||
window_new_screen_size (screenwidth, screenheight);
|
||||
}
|
||||
}
|
@ -1,734 +0,0 @@
|
||||
/* man.c: How to read and format man files.
|
||||
$Id: man.c,v 1.4 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox Thu May 4 09:17:52 1995 (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include "signals.h"
|
||||
#if defined (HAVE_SYS_TIME_H)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#if defined (HAVE_SYS_WAIT_H)
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#include "tilde.h"
|
||||
#include "man.h"
|
||||
|
||||
#if !defined (_POSIX_VERSION)
|
||||
#define pid_t int
|
||||
#endif
|
||||
|
||||
#if defined (FD_SET)
|
||||
# if defined (hpux)
|
||||
# define fd_set_cast(x) (int *)(x)
|
||||
# else
|
||||
# define fd_set_cast(x) (fd_set *)(x)
|
||||
# endif /* !hpux */
|
||||
#endif /* FD_SET */
|
||||
|
||||
#if STRIP_DOT_EXE
|
||||
static char const * const exec_extensions[] = {
|
||||
".exe", ".com", ".bat", ".btm", ".sh", ".ksh", ".pl", ".sed", "", NULL
|
||||
};
|
||||
#else
|
||||
static char const * const exec_extensions[] = { "", NULL };
|
||||
#endif
|
||||
|
||||
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 (char *pagename)
|
||||
{
|
||||
return (info_get_node (MANPAGE_FILE_BUFFER_NAME, pagename));
|
||||
}
|
||||
|
||||
NODE *
|
||||
get_manpage_node (FILE_BUFFER *file_buffer, char *pagename)
|
||||
{
|
||||
NODE *node;
|
||||
|
||||
node = manpage_node_of_file_buffer (file_buffer, pagename);
|
||||
|
||||
if (!node)
|
||||
{
|
||||
char *page;
|
||||
|
||||
page = get_manpage_contents (pagename);
|
||||
|
||||
if (page)
|
||||
{
|
||||
char header[1024];
|
||||
long oldsize, newsize;
|
||||
int hlen, plen;
|
||||
char *old_contents = file_buffer->contents;
|
||||
|
||||
sprintf (header, "\n\n%c\n%s %s, %s %s, %s (dir)\n\n",
|
||||
INFO_COOKIE,
|
||||
INFO_FILE_LABEL, file_buffer->filename,
|
||||
INFO_NODE_LABEL, pagename,
|
||||
INFO_UP_LABEL);
|
||||
oldsize = file_buffer->filesize;
|
||||
hlen = strlen (header);
|
||||
plen = strlen (page);
|
||||
newsize = (oldsize + hlen + plen);
|
||||
file_buffer->contents =
|
||||
(char *)xrealloc (file_buffer->contents, 1 + newsize);
|
||||
memcpy (file_buffer->contents + oldsize, header, hlen);
|
||||
memcpy (file_buffer->contents + oldsize + hlen, page, plen);
|
||||
file_buffer->contents[newsize] = '\0';
|
||||
file_buffer->filesize = newsize;
|
||||
file_buffer->finfo.st_size = newsize;
|
||||
build_tags_and_nodes (file_buffer);
|
||||
free (page);
|
||||
/* We have just relocated file_buffer->contents from under
|
||||
the feet of info_windows[] array. Therefore, all the
|
||||
nodes on that list which are showing man pages have their
|
||||
contents member pointing into the blue. Undo that harm. */
|
||||
if (old_contents && oldsize && old_contents != file_buffer->contents)
|
||||
{
|
||||
int iw;
|
||||
INFO_WINDOW *info_win;
|
||||
char *old_contents_end = old_contents + oldsize;
|
||||
|
||||
for (iw = 0; (info_win = info_windows[iw]); iw++)
|
||||
{
|
||||
int in;
|
||||
|
||||
for (in = 0; in < info_win->nodes_index; 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 (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,
|
||||
tmp_node->nodename);
|
||||
free (tmp_node->nodename);
|
||||
free (tmp_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
node = manpage_node_of_file_buffer (file_buffer, pagename);
|
||||
}
|
||||
|
||||
return (node);
|
||||
}
|
||||
|
||||
FILE_BUFFER *
|
||||
create_manpage_file_buffer (void)
|
||||
{
|
||||
FILE_BUFFER *file_buffer = make_file_buffer ();
|
||||
file_buffer->filename = xstrdup (MANPAGE_FILE_BUFFER_NAME);
|
||||
file_buffer->fullpath = xstrdup (MANPAGE_FILE_BUFFER_NAME);
|
||||
file_buffer->finfo.st_size = 0;
|
||||
file_buffer->filesize = 0;
|
||||
file_buffer->contents = (char *)NULL;
|
||||
file_buffer->flags = (N_IsInternal | N_CannotGC | N_IsManPage);
|
||||
|
||||
return (file_buffer);
|
||||
}
|
||||
|
||||
/* Scan the list of directories in PATH looking for FILENAME. If we find
|
||||
one that is an executable file, return it as a new string. Otherwise,
|
||||
return a NULL pointer. */
|
||||
static char *
|
||||
executable_file_in_path (char *filename, char *path)
|
||||
{
|
||||
struct stat finfo;
|
||||
char *temp_dirname;
|
||||
int statable, dirname_index;
|
||||
|
||||
dirname_index = 0;
|
||||
|
||||
while ((temp_dirname = extract_colon_unit (path, &dirname_index)))
|
||||
{
|
||||
char *temp;
|
||||
char *temp_end;
|
||||
int i;
|
||||
|
||||
/* Expand a leading tilde if one is present. */
|
||||
if (*temp_dirname == '~')
|
||||
{
|
||||
char *expanded_dirname;
|
||||
|
||||
expanded_dirname = tilde_expand_word (temp_dirname);
|
||||
free (temp_dirname);
|
||||
temp_dirname = expanded_dirname;
|
||||
}
|
||||
|
||||
temp = (char *)xmalloc (34 + strlen (temp_dirname) + strlen (filename));
|
||||
strcpy (temp, temp_dirname);
|
||||
if (!IS_SLASH (temp[(strlen (temp)) - 1]))
|
||||
strcat (temp, "/");
|
||||
strcat (temp, filename);
|
||||
temp_end = temp + strlen (temp);
|
||||
|
||||
free (temp_dirname);
|
||||
|
||||
/* Look for FILENAME, possibly with any of the extensions
|
||||
in EXEC_EXTENSIONS[]. */
|
||||
for (i = 0; exec_extensions[i]; i++)
|
||||
{
|
||||
if (exec_extensions[i][0])
|
||||
strcpy (temp_end, exec_extensions[i]);
|
||||
statable = (stat (temp, &finfo) == 0);
|
||||
|
||||
/* If we have found a regular executable file, then use it. */
|
||||
if ((statable) && (S_ISREG (finfo.st_mode)) &&
|
||||
(access (temp, X_OK) == 0))
|
||||
return (temp);
|
||||
}
|
||||
|
||||
free (temp);
|
||||
}
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
/* Return the full pathname of the system man page formatter. */
|
||||
static char *
|
||||
find_man_formatter (void)
|
||||
{
|
||||
return (executable_file_in_path ("man", (char *)getenv ("PATH")));
|
||||
}
|
||||
|
||||
static char *manpage_pagename = (char *)NULL;
|
||||
static char *manpage_section = (char *)NULL;
|
||||
|
||||
static void
|
||||
get_page_and_section (char *pagename)
|
||||
{
|
||||
register int i;
|
||||
|
||||
if (manpage_pagename)
|
||||
free (manpage_pagename);
|
||||
|
||||
if (manpage_section)
|
||||
free (manpage_section);
|
||||
|
||||
manpage_pagename = (char *)NULL;
|
||||
manpage_section = (char *)NULL;
|
||||
|
||||
for (i = 0; pagename[i] != '\0' && pagename[i] != '('; i++);
|
||||
|
||||
manpage_pagename = (char *)xmalloc (1 + i);
|
||||
strncpy (manpage_pagename, pagename, i);
|
||||
manpage_pagename[i] = '\0';
|
||||
|
||||
if (pagename[i] == '(')
|
||||
{
|
||||
int start;
|
||||
|
||||
start = i + 1;
|
||||
|
||||
for (i = start; pagename[i] != '\0' && pagename[i] != ')'; i++);
|
||||
|
||||
manpage_section = (char *)xmalloc (1 + (i - start));
|
||||
strncpy (manpage_section, pagename + start, (i - start));
|
||||
manpage_section[i - start] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
#if PIPE_USE_FORK
|
||||
static void
|
||||
reap_children (int sig)
|
||||
{
|
||||
wait (NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static char *
|
||||
get_manpage_contents (char *pagename)
|
||||
{
|
||||
static char *formatter_args[4] = { (char *)NULL };
|
||||
int pipes[2];
|
||||
pid_t child;
|
||||
RETSIGTYPE (*sigsave) (int signum);
|
||||
char *formatted_page = NULL;
|
||||
int arg_index = 1;
|
||||
|
||||
if (formatter_args[0] == (char *)NULL)
|
||||
formatter_args[0] = find_man_formatter ();
|
||||
|
||||
if (formatter_args[0] == (char *)NULL)
|
||||
return ((char *)NULL);
|
||||
|
||||
get_page_and_section (pagename);
|
||||
|
||||
if (manpage_section != (char *)NULL)
|
||||
formatter_args[arg_index++] = manpage_section;
|
||||
|
||||
formatter_args[arg_index++] = manpage_pagename;
|
||||
formatter_args[arg_index] = (char *)NULL;
|
||||
|
||||
/* Open a pipe to this program, read the output, and save it away
|
||||
in FORMATTED_PAGE. The reader end of the pipe is pipes[0]; the
|
||||
writer end is pipes[1]. */
|
||||
#if PIPE_USE_FORK
|
||||
pipe (pipes);
|
||||
|
||||
sigsave = signal (SIGCHLD, reap_children);
|
||||
|
||||
child = fork ();
|
||||
if (child == -1)
|
||||
return ((char *)NULL);
|
||||
|
||||
if (child != 0)
|
||||
{
|
||||
/* In the parent, close the writing end of the pipe, and read from
|
||||
the exec'd child. */
|
||||
close (pipes[1]);
|
||||
formatted_page = read_from_fd (pipes[0]);
|
||||
close (pipes[0]);
|
||||
signal (SIGCHLD, sigsave);
|
||||
}
|
||||
else
|
||||
{ /* In the child, close the read end of the pipe, make the write end
|
||||
of the pipe be stdout, and execute the man page formatter. */
|
||||
close (pipes[0]);
|
||||
freopen (NULL_DEVICE, "w", stderr);
|
||||
freopen (NULL_DEVICE, "r", stdin);
|
||||
dup2 (pipes[1], fileno (stdout));
|
||||
|
||||
execv (formatter_args[0], formatter_args);
|
||||
|
||||
/* If we get here, we couldn't exec, so close out the pipe and
|
||||
exit. */
|
||||
close (pipes[1]);
|
||||
xexit (0);
|
||||
}
|
||||
#else /* !PIPE_USE_FORK */
|
||||
/* Cannot fork/exec, but can popen/pclose. */
|
||||
{
|
||||
FILE *fpipe;
|
||||
char *cmdline = xmalloc (strlen (formatter_args[0])
|
||||
+ strlen (manpage_pagename)
|
||||
+ (arg_index > 2 ? strlen (manpage_section) : 0)
|
||||
+ 3);
|
||||
int save_stderr = dup (fileno (stderr));
|
||||
int fd_err = open (NULL_DEVICE, O_WRONLY, 0666);
|
||||
|
||||
if (fd_err > 2)
|
||||
dup2 (fd_err, fileno (stderr)); /* Don't print errors. */
|
||||
sprintf (cmdline, "%s %s %s", formatter_args[0], manpage_pagename,
|
||||
arg_index > 2 ? manpage_section : "");
|
||||
fpipe = popen (cmdline, "r");
|
||||
free (cmdline);
|
||||
if (fd_err > 2)
|
||||
close (fd_err);
|
||||
dup2 (save_stderr, fileno (stderr));
|
||||
if (fpipe == 0)
|
||||
return ((char *)NULL);
|
||||
formatted_page = read_from_fd (fileno (fpipe));
|
||||
if (pclose (fpipe) == -1)
|
||||
{
|
||||
if (formatted_page)
|
||||
free (formatted_page);
|
||||
return ((char *)NULL);
|
||||
}
|
||||
}
|
||||
#endif /* !PIPE_USE_FORK */
|
||||
|
||||
/* If we have the page, then clean it up. */
|
||||
if (formatted_page)
|
||||
clean_manpage (formatted_page);
|
||||
|
||||
return (formatted_page);
|
||||
}
|
||||
|
||||
static void
|
||||
clean_manpage (char *manpage)
|
||||
{
|
||||
register int i, j;
|
||||
int newline_count = 0;
|
||||
char *newpage;
|
||||
|
||||
newpage = (char *)xmalloc (1 + strlen (manpage));
|
||||
|
||||
for (i = 0, j = 0; (newpage[j] = manpage[i]); i++, j++)
|
||||
{
|
||||
if (manpage[i] == '\n')
|
||||
newline_count++;
|
||||
else
|
||||
newline_count = 0;
|
||||
|
||||
if (newline_count == 3)
|
||||
{
|
||||
j--;
|
||||
newline_count--;
|
||||
}
|
||||
|
||||
/* A malformed man page could have a \b as its first character,
|
||||
in which case decrementing j by 2 will cause us to write into
|
||||
newpage[-1], smashing the hidden info stored there by malloc. */
|
||||
if (manpage[i] == '\b' || (manpage[i] == '\f' && j > 0))
|
||||
j -= 2;
|
||||
else if (!raw_escapes_p)
|
||||
{
|
||||
/* Remove the ANSI escape sequences for color, boldface,
|
||||
underlining, and italics, generated by some versions of
|
||||
Groff. */
|
||||
if (manpage[i] == '\033' && manpage[i + 1] == '['
|
||||
&& isdigit (manpage[i + 2]))
|
||||
{
|
||||
if (isdigit (manpage[i + 3]) && manpage[i + 4] == 'm')
|
||||
{
|
||||
i += 4;
|
||||
j--;
|
||||
}
|
||||
else if (manpage[i + 3] == 'm')
|
||||
{
|
||||
i += 3;
|
||||
j--;
|
||||
}
|
||||
/* Else do nothing: it's some unknown escape sequence,
|
||||
so let's leave it alone. */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newpage[j++] = 0;
|
||||
|
||||
strcpy (manpage, newpage);
|
||||
free (newpage);
|
||||
}
|
||||
|
||||
static NODE *
|
||||
manpage_node_of_file_buffer (FILE_BUFFER *file_buffer, char *pagename)
|
||||
{
|
||||
NODE *node = (NODE *)NULL;
|
||||
TAG *tag = (TAG *)NULL;
|
||||
|
||||
if (file_buffer->contents)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; (tag = file_buffer->tags[i]); i++)
|
||||
{
|
||||
if (strcasecmp (pagename, tag->nodename) == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tag)
|
||||
{
|
||||
node = (NODE *)xmalloc (sizeof (NODE));
|
||||
node->filename = file_buffer->filename;
|
||||
node->nodename = xstrdup (tag->nodename);
|
||||
node->contents = file_buffer->contents + tag->nodestart;
|
||||
node->nodelen = tag->nodelen;
|
||||
node->flags = 0;
|
||||
node->display_pos = 0;
|
||||
node->parent = (char *)NULL;
|
||||
node->flags = (N_HasTagsTable | N_IsManPage);
|
||||
node->contents += skip_node_separator (node->contents);
|
||||
}
|
||||
|
||||
return (node);
|
||||
}
|
||||
|
||||
static char *
|
||||
read_from_fd (int fd)
|
||||
{
|
||||
struct timeval timeout;
|
||||
char *buffer = (char *)NULL;
|
||||
int bsize = 0;
|
||||
int bindex = 0;
|
||||
int select_result;
|
||||
#if defined (FD_SET)
|
||||
fd_set read_fds;
|
||||
|
||||
timeout.tv_sec = 15;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
FD_ZERO (&read_fds);
|
||||
FD_SET (fd, &read_fds);
|
||||
|
||||
select_result = select (fd + 1, fd_set_cast (&read_fds), 0, 0, &timeout);
|
||||
#else /* !FD_SET */
|
||||
select_result = 1;
|
||||
#endif /* !FD_SET */
|
||||
|
||||
switch (select_result)
|
||||
{
|
||||
case 0:
|
||||
case -1:
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
int amount_read;
|
||||
int done = 0;
|
||||
|
||||
while (!done)
|
||||
{
|
||||
while ((bindex + 1024) > (bsize))
|
||||
buffer = (char *)xrealloc (buffer, (bsize += 1024));
|
||||
buffer[bindex] = '\0';
|
||||
|
||||
amount_read = read (fd, buffer + bindex, 1023);
|
||||
|
||||
if (amount_read < 0)
|
||||
{
|
||||
done = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bindex += amount_read;
|
||||
buffer[bindex] = '\0';
|
||||
if (amount_read == 0)
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((buffer != (char *)NULL) && (*buffer == '\0'))
|
||||
{
|
||||
free (buffer);
|
||||
buffer = (char *)NULL;
|
||||
}
|
||||
|
||||
return (buffer);
|
||||
}
|
||||
|
||||
static char *reference_section_starters[] =
|
||||
{
|
||||
"\nRELATED INFORMATION",
|
||||
"\nRELATED\tINFORMATION",
|
||||
"RELATED INFORMATION\n",
|
||||
"RELATED\tINFORMATION\n",
|
||||
"\nSEE ALSO",
|
||||
"\nSEE\tALSO",
|
||||
"SEE ALSO\n",
|
||||
"SEE\tALSO\n",
|
||||
(char *)NULL
|
||||
};
|
||||
|
||||
static SEARCH_BINDING frs_binding;
|
||||
|
||||
static SEARCH_BINDING *
|
||||
find_reference_section (NODE *node)
|
||||
{
|
||||
register int i;
|
||||
long position = -1;
|
||||
|
||||
frs_binding.buffer = node->contents;
|
||||
frs_binding.start = 0;
|
||||
frs_binding.end = node->nodelen;
|
||||
frs_binding.flags = S_SkipDest;
|
||||
|
||||
for (i = 0; reference_section_starters[i] != (char *)NULL; i++)
|
||||
{
|
||||
position = search_forward (reference_section_starters[i], &frs_binding);
|
||||
if (position != -1)
|
||||
break;
|
||||
}
|
||||
|
||||
if (position == -1)
|
||||
return ((SEARCH_BINDING *)NULL);
|
||||
|
||||
/* We found the start of the reference section, and point is right after
|
||||
the string which starts it. The text from here to the next header
|
||||
(or end of buffer) contains the only references in this manpage. */
|
||||
frs_binding.start = position;
|
||||
|
||||
for (i = frs_binding.start; i < frs_binding.end - 2; i++)
|
||||
{
|
||||
if ((frs_binding.buffer[i] == '\n') &&
|
||||
(!whitespace (frs_binding.buffer[i + 1])))
|
||||
{
|
||||
frs_binding.end = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (&frs_binding);
|
||||
}
|
||||
|
||||
REFERENCE **
|
||||
xrefs_of_manpage (NODE *node)
|
||||
{
|
||||
SEARCH_BINDING *reference_section;
|
||||
REFERENCE **refs = (REFERENCE **)NULL;
|
||||
int refs_index = 0;
|
||||
int refs_slots = 0;
|
||||
long position;
|
||||
|
||||
reference_section = find_reference_section (node);
|
||||
|
||||
if (reference_section == (SEARCH_BINDING *)NULL)
|
||||
return ((REFERENCE **)NULL);
|
||||
|
||||
/* Grovel the reference section building a list of references found there.
|
||||
A reference is alphabetic characters followed by non-whitespace text
|
||||
within parenthesis. */
|
||||
reference_section->flags = 0;
|
||||
|
||||
while ((position = search_forward ("(", reference_section)) != -1)
|
||||
{
|
||||
register int start, end;
|
||||
|
||||
for (start = position; start > reference_section->start; start--)
|
||||
if (whitespace (reference_section->buffer[start]))
|
||||
break;
|
||||
|
||||
start++;
|
||||
|
||||
for (end = position; end < reference_section->end; end++)
|
||||
{
|
||||
if (whitespace (reference_section->buffer[end]))
|
||||
{
|
||||
end = start;
|
||||
break;
|
||||
}
|
||||
|
||||
if (reference_section->buffer[end] == ')')
|
||||
{
|
||||
end++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (end != start)
|
||||
{
|
||||
REFERENCE *entry;
|
||||
int len = end - start;
|
||||
|
||||
entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
|
||||
entry->label = (char *)xmalloc (1 + len);
|
||||
strncpy (entry->label, (reference_section->buffer) + start, len);
|
||||
entry->label[len] = '\0';
|
||||
entry->filename = xstrdup (node->filename);
|
||||
entry->nodename = xstrdup (entry->label);
|
||||
entry->start = start;
|
||||
entry->end = end;
|
||||
|
||||
add_pointer_to_array
|
||||
(entry, refs_index, refs, refs_slots, 10, REFERENCE *);
|
||||
}
|
||||
|
||||
reference_section->start = position + 1;
|
||||
}
|
||||
|
||||
return (refs);
|
||||
}
|
||||
|
||||
long
|
||||
locate_manpage_xref (NODE *node, long int start, int dir)
|
||||
{
|
||||
REFERENCE **refs;
|
||||
long position = -1;
|
||||
|
||||
refs = xrefs_of_manpage (node);
|
||||
|
||||
if (refs)
|
||||
{
|
||||
register int i, count;
|
||||
REFERENCE *entry;
|
||||
|
||||
for (i = 0; refs[i]; i++);
|
||||
count = i;
|
||||
|
||||
if (dir > 0)
|
||||
{
|
||||
for (i = 0; (entry = refs[i]); i++)
|
||||
if (entry->start > start)
|
||||
{
|
||||
position = entry->start;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = count - 1; i > -1; i--)
|
||||
{
|
||||
entry = refs[i];
|
||||
|
||||
if (entry->start < start)
|
||||
{
|
||||
position = entry->start;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
info_free_references (refs);
|
||||
}
|
||||
return (position);
|
||||
}
|
||||
|
||||
/* This one was a little tricky. The binding buffer that is passed in has
|
||||
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 *node, SEARCH_BINDING *binding)
|
||||
{
|
||||
register int i;
|
||||
REFERENCE **all_refs = xrefs_of_manpage (node);
|
||||
REFERENCE **brefs = (REFERENCE **)NULL;
|
||||
REFERENCE *entry;
|
||||
int brefs_index = 0;
|
||||
int brefs_slots = 0;
|
||||
int start, end;
|
||||
|
||||
if (!all_refs)
|
||||
return ((REFERENCE **)NULL);
|
||||
|
||||
start = binding->start + (binding->buffer - node->contents);
|
||||
end = binding->end + (binding->buffer - node->contents);
|
||||
|
||||
for (i = 0; (entry = all_refs[i]); i++)
|
||||
{
|
||||
if ((entry->start > start) && (entry->end < end))
|
||||
{
|
||||
add_pointer_to_array
|
||||
(entry, brefs_index, brefs, brefs_slots, 10, REFERENCE *);
|
||||
}
|
||||
else
|
||||
{
|
||||
maybe_free (entry->label);
|
||||
maybe_free (entry->filename);
|
||||
maybe_free (entry->nodename);
|
||||
free (entry);
|
||||
}
|
||||
}
|
||||
|
||||
free (all_refs);
|
||||
return (brefs);
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/* man.h: Defines and external function declarations for man.c.
|
||||
$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, 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
|
||||
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.
|
||||
|
||||
Author: Brian J. Fox (bfox@ai.mit.edu) Sat May 6 16:19:13 1995. */
|
||||
|
||||
#ifndef INFO_MAN_H
|
||||
#define INFO_MAN_H
|
||||
|
||||
#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 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,347 +0,0 @@
|
||||
/* nodemenu.c -- produce a menu of all visited nodes.
|
||||
$Id: nodemenu.c,v 1.5 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1997, 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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
|
||||
NODE * get_visited_nodes (Function *filter_func);
|
||||
|
||||
/* Return a line describing the format of a node information line. */
|
||||
static const char *
|
||||
nodemenu_format_info (void)
|
||||
{
|
||||
return (_("\n\
|
||||
* Menu:\n\
|
||||
(File)Node Lines Size Containing File\n\
|
||||
---------- ----- ---- ---------------"));
|
||||
}
|
||||
|
||||
/* Produce a formatted line of information about NODE. Here is what we want
|
||||
the output listing to look like:
|
||||
|
||||
* Menu:
|
||||
(File)Node Lines Size Containing File
|
||||
---------- ----- ---- ---------------
|
||||
* (emacs)Buffers:: 48 2230 /usr/gnu/info/emacs/emacs-1
|
||||
* (autoconf)Writing configure.in:: 123 58789 /usr/gnu/info/autoconf/autoconf-1
|
||||
* (dir)Top:: 40 589 /usr/gnu/info/dir
|
||||
*/
|
||||
static char *
|
||||
format_node_info (NODE *node)
|
||||
{
|
||||
register int i, len;
|
||||
char *parent, *containing_file;
|
||||
static char *line_buffer = (char *)NULL;
|
||||
|
||||
if (!line_buffer)
|
||||
line_buffer = (char *)xmalloc (1000);
|
||||
|
||||
if (node->parent)
|
||||
{
|
||||
parent = filename_non_directory (node->parent);
|
||||
if (!parent)
|
||||
parent = node->parent;
|
||||
}
|
||||
else
|
||||
parent = (char *)NULL;
|
||||
|
||||
containing_file = node->filename;
|
||||
|
||||
if (!parent && !*containing_file)
|
||||
sprintf (line_buffer, "* %s::", node->nodename);
|
||||
else
|
||||
{
|
||||
char *file = (char *)NULL;
|
||||
|
||||
if (parent)
|
||||
file = parent;
|
||||
else
|
||||
file = filename_non_directory (containing_file);
|
||||
|
||||
if (!file)
|
||||
file = containing_file;
|
||||
|
||||
if (!*file)
|
||||
file = "dir";
|
||||
|
||||
sprintf (line_buffer, "* (%s)%s::", file, node->nodename);
|
||||
}
|
||||
|
||||
len = pad_to (36, line_buffer);
|
||||
|
||||
{
|
||||
int lines = 1;
|
||||
|
||||
for (i = 0; i < node->nodelen; i++)
|
||||
if (node->contents[i] == '\n')
|
||||
lines++;
|
||||
|
||||
sprintf (line_buffer + len, "%d", lines);
|
||||
}
|
||||
|
||||
len = pad_to (44, line_buffer);
|
||||
sprintf (line_buffer + len, "%ld", node->nodelen);
|
||||
|
||||
if (node->filename && *(node->filename))
|
||||
{
|
||||
len = pad_to (51, line_buffer);
|
||||
strcpy (line_buffer + len, node->filename);
|
||||
}
|
||||
|
||||
return xstrdup (line_buffer);
|
||||
}
|
||||
|
||||
/* Little string comparison routine for qsort (). */
|
||||
static int
|
||||
compare_strings (const void *entry1, const void *entry2)
|
||||
{
|
||||
char **e1 = (char **) entry1;
|
||||
char **e2 = (char **) entry2;
|
||||
|
||||
return (strcasecmp (*e1, *e2));
|
||||
}
|
||||
|
||||
/* The name of the nodemenu node. */
|
||||
static char *nodemenu_nodename = "*Node Menu*";
|
||||
|
||||
/* Produce an informative listing of all the visited nodes, and return it
|
||||
in a node. If FILTER_FUNC is non-null, it is a function which filters
|
||||
which nodes will appear in the listing. FILTER_FUNC takes an argument
|
||||
of NODE, and returns non-zero if the node should appear in the listing. */
|
||||
NODE *
|
||||
get_visited_nodes (Function *filter_func)
|
||||
{
|
||||
register int i, iw_index;
|
||||
INFO_WINDOW *info_win;
|
||||
NODE *node;
|
||||
char **lines = (char **)NULL;
|
||||
int lines_index = 0, lines_slots = 0;
|
||||
|
||||
if (!info_windows)
|
||||
return ((NODE *)NULL);
|
||||
|
||||
for (iw_index = 0; (info_win = info_windows[iw_index]); iw_index++)
|
||||
{
|
||||
for (i = 0; i < info_win->nodes_index; i++)
|
||||
{
|
||||
node = info_win->nodes[i];
|
||||
|
||||
/* We skip mentioning "*Node Menu*" nodes. */
|
||||
if (internal_info_node_p (node) &&
|
||||
(strcmp (node->nodename, nodemenu_nodename) == 0))
|
||||
continue;
|
||||
|
||||
if (node && (!filter_func || (*filter_func) (node)))
|
||||
{
|
||||
char *line;
|
||||
|
||||
line = format_node_info (node);
|
||||
add_pointer_to_array
|
||||
(line, lines_index, lines, lines_slots, 20, char *);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Sort the array of information lines, if there are any. */
|
||||
if (lines)
|
||||
{
|
||||
register int j, newlen;
|
||||
char **temp;
|
||||
|
||||
qsort (lines, lines_index, sizeof (char *), compare_strings);
|
||||
|
||||
/* Delete duplicates. */
|
||||
for (i = 0, newlen = 1; i < lines_index - 1; i++)
|
||||
{
|
||||
/* Use FILENAME_CMP here, since the most important piece
|
||||
of info in each line is the file name of the node. */
|
||||
if (FILENAME_CMP (lines[i], lines[i + 1]) == 0)
|
||||
{
|
||||
free (lines[i]);
|
||||
lines[i] = (char *)NULL;
|
||||
}
|
||||
else
|
||||
newlen++;
|
||||
}
|
||||
|
||||
/* We have free ()'d and marked all of the duplicate slots.
|
||||
Copy the live slots rather than pruning the dead slots. */
|
||||
temp = (char **)xmalloc ((1 + newlen) * sizeof (char *));
|
||||
for (i = 0, j = 0; i < lines_index; i++)
|
||||
if (lines[i])
|
||||
temp[j++] = lines[i];
|
||||
|
||||
temp[j] = (char *)NULL;
|
||||
free (lines);
|
||||
lines = temp;
|
||||
lines_index = newlen;
|
||||
}
|
||||
|
||||
initialize_message_buffer ();
|
||||
|
||||
printf_to_message_buffer
|
||||
("%s", replace_in_documentation
|
||||
((char *) _("Here is the menu of nodes you have recently visited.\n\
|
||||
Select one from this menu, or use `\\[history-node]' in another window.\n"), 0),
|
||||
NULL, NULL);
|
||||
|
||||
printf_to_message_buffer ("%s\n", (char *) nodemenu_format_info (),
|
||||
NULL, NULL);
|
||||
|
||||
for (i = 0; (lines != (char **)NULL) && (i < lines_index); i++)
|
||||
{
|
||||
printf_to_message_buffer ("%s\n", lines[i], NULL, NULL);
|
||||
free (lines[i]);
|
||||
}
|
||||
|
||||
if (lines)
|
||||
free (lines);
|
||||
|
||||
node = message_buffer_to_node ();
|
||||
add_gcable_pointer (node->contents);
|
||||
return (node);
|
||||
}
|
||||
|
||||
DECLARE_INFO_COMMAND (list_visited_nodes,
|
||||
_("Make a window containing a menu of all of the currently visited nodes"))
|
||||
{
|
||||
WINDOW *new;
|
||||
NODE *node;
|
||||
|
||||
set_remembered_pagetop_and_point (window);
|
||||
|
||||
/* If a window is visible and showing the buffer list already, re-use it. */
|
||||
for (new = windows; new; new = new->next)
|
||||
{
|
||||
node = new->node;
|
||||
|
||||
if (internal_info_node_p (node) &&
|
||||
(strcmp (node->nodename, nodemenu_nodename) == 0))
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we couldn't find an existing window, try to use the next window
|
||||
in the chain. */
|
||||
if (!new)
|
||||
{
|
||||
if (window->next)
|
||||
new = window->next;
|
||||
/* If there is more than one window, wrap around. */
|
||||
else if (window != windows)
|
||||
new = windows;
|
||||
}
|
||||
|
||||
/* If we still don't have a window, make a new one to contain the list. */
|
||||
if (!new)
|
||||
{
|
||||
WINDOW *old_active;
|
||||
|
||||
old_active = active_window;
|
||||
active_window = window;
|
||||
new = window_make_window ((NODE *)NULL);
|
||||
active_window = old_active;
|
||||
}
|
||||
|
||||
/* If we couldn't make a new window, use this one. */
|
||||
if (!new)
|
||||
new = window;
|
||||
|
||||
/* Lines do not wrap in this window. */
|
||||
new->flags |= W_NoWrap;
|
||||
node = get_visited_nodes ((Function *)NULL);
|
||||
name_internal_node (node, nodemenu_nodename);
|
||||
|
||||
#if 0
|
||||
/* Even if this is an internal node, we don't want the window
|
||||
system to treat it specially. So we turn off the internalness
|
||||
of it here. */
|
||||
/* Why? We depend on internal_info_node_p returning true, so we must
|
||||
not remove the flag. Otherwise, the *Node Menu* nodes themselves
|
||||
appear in the node menu. --Andreas Schwab
|
||||
<schwab@issan.informatik.uni-dortmund.de>. */
|
||||
node->flags &= ~N_IsInternal;
|
||||
#endif
|
||||
|
||||
/* If this window is already showing a node menu, reuse the existing node
|
||||
slot. */
|
||||
{
|
||||
int remember_me = 1;
|
||||
|
||||
#if defined (NOTDEF)
|
||||
if (internal_info_node_p (new->node) &&
|
||||
(strcmp (new->node->nodename, nodemenu_nodename) == 0))
|
||||
remember_me = 0;
|
||||
#endif /* NOTDEF */
|
||||
|
||||
window_set_node_of_window (new, node);
|
||||
|
||||
if (remember_me)
|
||||
remember_window_and_node (new, node);
|
||||
}
|
||||
|
||||
active_window = new;
|
||||
}
|
||||
|
||||
DECLARE_INFO_COMMAND (select_visited_node,
|
||||
_("Select a node which has been previously visited in a visible window"))
|
||||
{
|
||||
char *line;
|
||||
NODE *node;
|
||||
REFERENCE **menu;
|
||||
|
||||
node = get_visited_nodes ((Function *)NULL);
|
||||
|
||||
menu = info_menu_of_node (node);
|
||||
free (node);
|
||||
|
||||
line =
|
||||
info_read_completing_in_echo_area (window,
|
||||
(char *) _("Select visited node: "), menu);
|
||||
|
||||
window = active_window;
|
||||
|
||||
/* User aborts, just quit. */
|
||||
if (!line)
|
||||
{
|
||||
info_abort_key (window, 0, 0);
|
||||
info_free_references (menu);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*line)
|
||||
{
|
||||
REFERENCE *entry;
|
||||
|
||||
/* Find the selected label in the references. */
|
||||
entry = info_get_labeled_reference (line, menu);
|
||||
|
||||
if (!entry)
|
||||
info_error ((char *) _("The reference disappeared! (%s)."), line, NULL);
|
||||
else
|
||||
info_select_reference (window, entry);
|
||||
}
|
||||
|
||||
free (line);
|
||||
info_free_references (menu);
|
||||
|
||||
if (!info_error_was_printed)
|
||||
window_clear_echo_area ();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,156 +0,0 @@
|
||||
/* nodes.h -- How we represent nodes internally.
|
||||
$Id: nodes.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef NODES_H
|
||||
#define NODES_H
|
||||
|
||||
#include "info.h"
|
||||
|
||||
/* User code interface. */
|
||||
|
||||
/* Callers generally only want the node itself. This structure is used
|
||||
to pass node information around. None of the information in this
|
||||
structure should ever be directly freed. The structure itself can
|
||||
be passed to free (). Note that NODE->parent is non-null if this
|
||||
node's file is a subfile. In that case, NODE->parent is the logical
|
||||
name of the file containing this node. Both names are given as full
|
||||
paths, so you might have: node->filename = "/usr/gnu/info/emacs-1",
|
||||
with node->parent = "/usr/gnu/info/emacs". */
|
||||
typedef struct {
|
||||
char *filename; /* The physical file containing this node. */
|
||||
char *parent; /* Non-null is the logical file name. */
|
||||
char *nodename; /* The name of this node. */
|
||||
char *contents; /* Characters appearing in this node. */
|
||||
long nodelen; /* The length of the CONTENTS member. */
|
||||
unsigned long display_pos; /* Where to display at, if nonzero. */
|
||||
int flags; /* See immediately below. */
|
||||
} NODE;
|
||||
|
||||
/* Defines that can appear in NODE->flags. All informative. */
|
||||
#define N_HasTagsTable 0x01 /* This node was found through a tags table. */
|
||||
#define N_TagsIndirect 0x02 /* The tags table was an indirect one. */
|
||||
#define N_UpdateTags 0x04 /* The tags table is out of date. */
|
||||
#define N_IsCompressed 0x08 /* The file is compressed on disk. */
|
||||
#define N_IsInternal 0x10 /* This node was made by Info. */
|
||||
#define N_CannotGC 0x20 /* File buffer cannot be gc'ed. */
|
||||
#define N_IsManPage 0x40 /* This node is a manpage. */
|
||||
#define N_FromAnchor 0x80 /* Synthesized for an anchor reference. */
|
||||
|
||||
/* Internal data structures. */
|
||||
|
||||
/* String constants. */
|
||||
#define INFO_FILE_LABEL "File:"
|
||||
#define INFO_REF_LABEL "Ref:"
|
||||
#define INFO_NODE_LABEL "Node:"
|
||||
#define INFO_PREV_LABEL "Prev:"
|
||||
#define INFO_ALTPREV_LABEL "Previous:"
|
||||
#define INFO_NEXT_LABEL "Next:"
|
||||
#define INFO_UP_LABEL "Up:"
|
||||
#define INFO_MENU_LABEL "\n* Menu:"
|
||||
#define INFO_MENU_ENTRY_LABEL "\n* "
|
||||
#define INFO_XREF_LABEL "*Note"
|
||||
#define TAGS_TABLE_END_LABEL "\nEnd Tag Table"
|
||||
#define TAGS_TABLE_BEG_LABEL "Tag Table:\n"
|
||||
#define INDIRECT_TAGS_TABLE_LABEL "Indirect:\n"
|
||||
#define TAGS_TABLE_IS_INDIRECT_LABEL "(Indirect)"
|
||||
|
||||
/* Character constants. */
|
||||
#define INFO_COOKIE '\037'
|
||||
#define INFO_FF '\014'
|
||||
#define INFO_TAGSEP '\177'
|
||||
|
||||
/* For each logical file that we have loaded, we keep a list of the names
|
||||
of the nodes that are found in that file. A pointer to a node in an
|
||||
info file is called a "tag". For split files, the tag pointer is
|
||||
"indirect"; that is, the pointer also contains the name of the split
|
||||
file where the node can be found. For non-split files, the filename
|
||||
member in the structure below simply contains the name of the current
|
||||
file. The following structure describes a single node within a file. */
|
||||
typedef struct {
|
||||
char *filename; /* The file where this node can be found. */
|
||||
char *nodename; /* The node pointed to by this tag. */
|
||||
long nodestart; /* The offset of the start of this node. */
|
||||
long nodelen; /* The length of this node. */
|
||||
} TAG;
|
||||
|
||||
/* The following structure is used to remember information about the contents
|
||||
of Info files that we have loaded at least once before. The FINFO member
|
||||
is present so that we can reload the file if it has been modified since
|
||||
last being loaded. All of the arrays appearing within this structure
|
||||
are NULL terminated, and each array which can change size has a
|
||||
corresponding SLOTS member which says how many slots have been allocated
|
||||
(with malloc ()) for this array. */
|
||||
typedef struct {
|
||||
char *filename; /* The filename used to find this file. */
|
||||
char *fullpath; /* The full pathname of this info file. */
|
||||
struct stat finfo; /* Information about this file. */
|
||||
char *contents; /* The contents of this particular file. */
|
||||
long filesize; /* The number of bytes this file expands to. */
|
||||
char **subfiles; /* If non-null, the list of subfiles. */
|
||||
TAG **tags; /* If non-null, the indirect tags table. */
|
||||
int tags_slots; /* Number of slots allocated for TAGS. */
|
||||
int flags; /* Various flags. Mimics of N_* flags. */
|
||||
} FILE_BUFFER;
|
||||
|
||||
/* Externally visible functions. */
|
||||
|
||||
/* Array of FILE_BUFFER * which represents the currently loaded info files. */
|
||||
extern FILE_BUFFER **info_loaded_files;
|
||||
|
||||
/* The number of slots currently allocated to INFO_LOADED_FILES. */
|
||||
extern int info_loaded_files_slots;
|
||||
|
||||
/* Locate the file named by FILENAME, and return the information structure
|
||||
describing this file. The file may appear in our list of loaded files
|
||||
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 (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 (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 (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 (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 (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 (void);
|
||||
|
||||
#endif /* not NODES_H */
|
@ -1,497 +0,0 @@
|
||||
/* search.c -- searching large bodies of text.
|
||||
$Id: search.c,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
|
||||
#include "search.h"
|
||||
#include "nodes.h"
|
||||
|
||||
/* The search functions take two arguments:
|
||||
|
||||
1) a string to search for, and
|
||||
|
||||
2) a pointer to a SEARCH_BINDING which contains the buffer, start,
|
||||
and end of the search.
|
||||
|
||||
They return a long, which is the offset from the start of the buffer
|
||||
at which the match was found. An offset of -1 indicates failure. */
|
||||
|
||||
/* A function which makes a binding with buffer and bounds. */
|
||||
SEARCH_BINDING *
|
||||
make_binding (char *buffer, long int start, long int end)
|
||||
{
|
||||
SEARCH_BINDING *binding;
|
||||
|
||||
binding = (SEARCH_BINDING *)xmalloc (sizeof (SEARCH_BINDING));
|
||||
binding->buffer = buffer;
|
||||
binding->start = start;
|
||||
binding->end = end;
|
||||
binding->flags = 0;
|
||||
|
||||
return (binding);
|
||||
}
|
||||
|
||||
/* Make a copy of BINDING without duplicating the data. */
|
||||
SEARCH_BINDING *
|
||||
copy_binding (SEARCH_BINDING *binding)
|
||||
{
|
||||
SEARCH_BINDING *copy;
|
||||
|
||||
copy = make_binding (binding->buffer, binding->start, binding->end);
|
||||
copy->flags = binding->flags;
|
||||
return (copy);
|
||||
}
|
||||
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* The Actual Searching Functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Search forwards or backwards for the text delimited by BINDING.
|
||||
The search is forwards if BINDING->start is greater than BINDING->end. */
|
||||
long
|
||||
search (char *string, SEARCH_BINDING *binding)
|
||||
{
|
||||
long result;
|
||||
|
||||
/* If the search is backwards, then search backwards, otherwise forwards. */
|
||||
if (binding->start > binding->end)
|
||||
result = search_backward (string, binding);
|
||||
else
|
||||
result = search_forward (string, binding);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Search forwards for STRING through the text delimited in BINDING. */
|
||||
long
|
||||
search_forward (char *string, SEARCH_BINDING *binding)
|
||||
{
|
||||
register int c, i, len;
|
||||
register char *buff, *end;
|
||||
char *alternate = (char *)NULL;
|
||||
|
||||
len = strlen (string);
|
||||
|
||||
/* We match characters in the search buffer against STRING and ALTERNATE.
|
||||
ALTERNATE is a case reversed version of STRING; this is cheaper than
|
||||
case folding each character before comparison. Alternate is only
|
||||
used if the case folding bit is turned on in the passed BINDING. */
|
||||
|
||||
if (binding->flags & S_FoldCase)
|
||||
{
|
||||
alternate = xstrdup (string);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (islower (alternate[i]))
|
||||
alternate[i] = toupper (alternate[i]);
|
||||
else if (isupper (alternate[i]))
|
||||
alternate[i] = tolower (alternate[i]);
|
||||
}
|
||||
}
|
||||
|
||||
buff = binding->buffer + binding->start;
|
||||
end = binding->buffer + binding->end + 1;
|
||||
|
||||
while (buff < (end - len))
|
||||
{
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
c = buff[i];
|
||||
|
||||
if ((c != string[i]) && (!alternate || c != alternate[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (!string[i])
|
||||
{
|
||||
if (alternate)
|
||||
free (alternate);
|
||||
if (binding->flags & S_SkipDest)
|
||||
buff += len;
|
||||
return ((long) (buff - binding->buffer));
|
||||
}
|
||||
|
||||
buff++;
|
||||
}
|
||||
|
||||
if (alternate)
|
||||
free (alternate);
|
||||
|
||||
return ((long) -1);
|
||||
}
|
||||
|
||||
/* Search for STRING backwards through the text delimited in BINDING. */
|
||||
long
|
||||
search_backward (char *input_string, SEARCH_BINDING *binding)
|
||||
{
|
||||
register int c, i, len;
|
||||
register char *buff, *end;
|
||||
char *string;
|
||||
char *alternate = (char *)NULL;
|
||||
|
||||
len = strlen (input_string);
|
||||
|
||||
/* Reverse the characters in the search string. */
|
||||
string = (char *)xmalloc (1 + len);
|
||||
for (c = 0, i = len - 1; input_string[c]; c++, i--)
|
||||
string[i] = input_string[c];
|
||||
|
||||
string[c] = '\0';
|
||||
|
||||
/* We match characters in the search buffer against STRING and ALTERNATE.
|
||||
ALTERNATE is a case reversed version of STRING; this is cheaper than
|
||||
case folding each character before comparison. ALTERNATE is only
|
||||
used if the case folding bit is turned on in the passed BINDING. */
|
||||
|
||||
if (binding->flags & S_FoldCase)
|
||||
{
|
||||
alternate = xstrdup (string);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (islower (alternate[i]))
|
||||
alternate[i] = toupper (alternate[i]);
|
||||
else if (isupper (alternate[i]))
|
||||
alternate[i] = tolower (alternate[i]);
|
||||
}
|
||||
}
|
||||
|
||||
buff = binding->buffer + binding->start - 1;
|
||||
end = binding->buffer + binding->end;
|
||||
|
||||
while (buff > (end + len))
|
||||
{
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
c = *(buff - i);
|
||||
|
||||
if (c != string[i] && (!alternate || c != alternate[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (!string[i])
|
||||
{
|
||||
free (string);
|
||||
if (alternate)
|
||||
free (alternate);
|
||||
|
||||
if (binding->flags & S_SkipDest)
|
||||
buff -= len;
|
||||
return ((long) (1 + (buff - binding->buffer)));
|
||||
}
|
||||
|
||||
buff--;
|
||||
}
|
||||
|
||||
free (string);
|
||||
if (alternate)
|
||||
free (alternate);
|
||||
|
||||
return ((long) -1);
|
||||
}
|
||||
|
||||
/* Find STRING in LINE, returning the offset of the end of the string.
|
||||
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 (char *string, char *line)
|
||||
{
|
||||
register int end;
|
||||
SEARCH_BINDING binding;
|
||||
|
||||
/* Find the end of the line. */
|
||||
for (end = 0; line[end] && line[end] != '\n'; end++);
|
||||
|
||||
/* Search for STRING within these confines. */
|
||||
binding.buffer = line;
|
||||
binding.start = 0;
|
||||
binding.end = end;
|
||||
binding.flags = S_FoldCase | S_SkipDest;
|
||||
|
||||
return (search_forward (string, &binding));
|
||||
}
|
||||
|
||||
/* Return non-zero if STRING is the first text to appear at BINDING. */
|
||||
int
|
||||
looking_at (char *string, SEARCH_BINDING *binding)
|
||||
{
|
||||
long search_end;
|
||||
|
||||
search_end = search (string, binding);
|
||||
|
||||
/* If the string was not found, SEARCH_END is -1. If the string was found,
|
||||
but not right away, SEARCH_END is != binding->start. Otherwise, the
|
||||
string was found at binding->start. */
|
||||
return (search_end == binding->start);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Small String Searches */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* 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. */
|
||||
|
||||
/* Return the index of the first non-whitespace character in STRING. */
|
||||
int
|
||||
skip_whitespace (char *string)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; string && whitespace (string[i]); i++);
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Return the index of the first non-whitespace or newline character in
|
||||
STRING. */
|
||||
int
|
||||
skip_whitespace_and_newlines (char *string)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; string && whitespace_or_newline (string[i]); i++);
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Return the index of the first whitespace character in STRING. */
|
||||
int
|
||||
skip_non_whitespace (char *string)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; string && string[i] && !whitespace (string[i]); i++);
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Return the index of the first non-node character in STRING. Note that
|
||||
this function contains quite a bit of hair to ignore periods in some
|
||||
special cases. This is because we here at GNU ship some info files which
|
||||
contain nodenames that contain periods. No such nodename can start with
|
||||
a period, or continue with whitespace, newline, or ')' immediately following
|
||||
the period. If second argument NEWLINES_OKAY is non-zero, newlines should
|
||||
be skipped while parsing out the nodename specification. */
|
||||
int
|
||||
skip_node_characters (char *string, int newlines_okay)
|
||||
{
|
||||
register int c, i = 0;
|
||||
int paren_seen = 0;
|
||||
int paren = 0;
|
||||
|
||||
/* Handle special case. This is when another function has parsed out the
|
||||
filename component of the node name, and we just want to parse out the
|
||||
nodename proper. In that case, a period at the start of the nodename
|
||||
indicates an empty nodename. */
|
||||
if (string && *string == '.')
|
||||
return (0);
|
||||
|
||||
if (string && *string == '(')
|
||||
{
|
||||
paren++;
|
||||
paren_seen++;
|
||||
i++;
|
||||
}
|
||||
|
||||
for (; string && (c = string[i]); i++)
|
||||
{
|
||||
if (paren)
|
||||
{
|
||||
if (c == '(')
|
||||
paren++;
|
||||
else if (c == ')')
|
||||
paren--;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If the character following the close paren is a space or period,
|
||||
then this node name has no more characters associated with it. */
|
||||
if (c == '\t' ||
|
||||
c == ',' ||
|
||||
c == INFO_TAGSEP ||
|
||||
((!newlines_okay) && (c == '\n')) ||
|
||||
((paren_seen && string[i - 1] == ')') &&
|
||||
(c == ' ' || c == '.')) ||
|
||||
(c == '.' &&
|
||||
(
|
||||
#if 0
|
||||
/* This test causes a node name ending in a period, like `This.', not to
|
||||
be found. The trailing . is stripped. This occurs in the jargon
|
||||
file (`I see no X here.' is a node name). */
|
||||
(!string[i + 1]) ||
|
||||
#endif
|
||||
(whitespace_or_newline (string[i + 1])) ||
|
||||
(string[i + 1] == ')'))))
|
||||
break;
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Searching FILE_BUFFER's */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Return the absolute position of the first occurence of a node separator in
|
||||
BINDING-buffer. The search starts at BINDING->start. Return -1 if no node
|
||||
separator was found. */
|
||||
long
|
||||
find_node_separator (SEARCH_BINDING *binding)
|
||||
{
|
||||
register long i;
|
||||
char *body;
|
||||
|
||||
body = binding->buffer;
|
||||
|
||||
/* A node is started by [^L]^_[^L]\n. That is to say, the C-l's are
|
||||
optional, but the DELETE and NEWLINE are not. This separator holds
|
||||
true for all separated elements in an Info file, including the tags
|
||||
table (if present) and the indirect tags table (if present). */
|
||||
for (i = binding->start; i < binding->end - 1; i++)
|
||||
if (((body[i] == INFO_FF && body[i + 1] == INFO_COOKIE) &&
|
||||
(body[i + 2] == '\n' ||
|
||||
(body[i + 2] == INFO_FF && body[i + 3] == '\n'))) ||
|
||||
((body[i] == INFO_COOKIE) &&
|
||||
(body[i + 1] == '\n' ||
|
||||
(body[i + 1] == INFO_FF && body[i + 2] == '\n'))))
|
||||
return (i);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Return the length of the node separator characters that BODY is
|
||||
currently pointing at. */
|
||||
int
|
||||
skip_node_separator (char *body)
|
||||
{
|
||||
register int i;
|
||||
|
||||
i = 0;
|
||||
|
||||
if (body[i] == INFO_FF)
|
||||
i++;
|
||||
|
||||
if (body[i++] != INFO_COOKIE)
|
||||
return (0);
|
||||
|
||||
if (body[i] == INFO_FF)
|
||||
i++;
|
||||
|
||||
if (body[i++] != '\n')
|
||||
return (0);
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Return the number of characters from STRING to the start of
|
||||
the next line. */
|
||||
int
|
||||
skip_line (char *string)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; string && string[i] && string[i] != '\n'; i++);
|
||||
|
||||
if (string[i] == '\n')
|
||||
i++;
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Return the absolute position of the beginning of a tags table in this
|
||||
binding starting the search at binding->start. */
|
||||
long
|
||||
find_tags_table (SEARCH_BINDING *binding)
|
||||
{
|
||||
SEARCH_BINDING tmp_search;
|
||||
long position;
|
||||
|
||||
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 (&tmp_search)) != -1 )
|
||||
{
|
||||
tmp_search.start = position;
|
||||
tmp_search.start += skip_node_separator (tmp_search.buffer
|
||||
+ tmp_search.start);
|
||||
|
||||
if (looking_at (TAGS_TABLE_BEG_LABEL, &tmp_search))
|
||||
return (position);
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Return the absolute position of the node named NODENAME in BINDING.
|
||||
This is a brute force search, and we wish to avoid it when possible.
|
||||
This function is called when a tag (indirect or otherwise) doesn't
|
||||
really point to the right node. It returns the absolute position of
|
||||
the separator preceding the node. */
|
||||
long
|
||||
find_node_in_binding (char *nodename, SEARCH_BINDING *binding)
|
||||
{
|
||||
long position;
|
||||
int offset, namelen;
|
||||
SEARCH_BINDING tmp_search;
|
||||
|
||||
namelen = strlen (nodename);
|
||||
|
||||
tmp_search.buffer = binding->buffer;
|
||||
tmp_search.start = binding->start;
|
||||
tmp_search.end = binding->end;
|
||||
tmp_search.flags = 0;
|
||||
|
||||
while ((position = find_node_separator (&tmp_search)) != -1)
|
||||
{
|
||||
tmp_search.start = position;
|
||||
tmp_search.start += skip_node_separator
|
||||
(tmp_search.buffer + tmp_search.start);
|
||||
|
||||
offset = string_in_line
|
||||
(INFO_NODE_LABEL, tmp_search.buffer + tmp_search.start);
|
||||
|
||||
if (offset == -1)
|
||||
continue;
|
||||
|
||||
tmp_search.start += offset;
|
||||
tmp_search.start += skip_whitespace (tmp_search.buffer + tmp_search.start);
|
||||
offset = skip_node_characters
|
||||
(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) &&
|
||||
(tmp_search.buffer[tmp_search.start] == nodename[0]) &&
|
||||
(strncmp (tmp_search.buffer + tmp_search.start, nodename, offset) == 0))
|
||||
return (position);
|
||||
}
|
||||
return (-1);
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
/* search.h -- Structure used to search large bodies of text, with bounds.
|
||||
$Id: search.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
/* The search functions take two arguments:
|
||||
|
||||
1) a string to search for, and
|
||||
|
||||
2) a pointer to a SEARCH_BINDING which contains the buffer, start,
|
||||
and end of the search.
|
||||
|
||||
They return a long, which is the offset from the start of the buffer
|
||||
at which the match was found. An offset of -1 indicates failure. */
|
||||
|
||||
#ifndef INFO_SEARCH_H
|
||||
#define INFO_SEARCH_H
|
||||
|
||||
typedef struct {
|
||||
char *buffer; /* The buffer of text to search. */
|
||||
long start; /* Offset of the start of the search. */
|
||||
long end; /* Offset of the end of the searh. */
|
||||
int flags; /* Flags controlling the type of search. */
|
||||
} SEARCH_BINDING;
|
||||
|
||||
#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 (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 (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 (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 (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 */
|
File diff suppressed because it is too large
Load Diff
@ -1,237 +0,0 @@
|
||||
/* session.h -- Functions found in session.c.
|
||||
$Id: session.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef SESSION_H
|
||||
#define SESSION_H
|
||||
|
||||
#include "info.h"
|
||||
#include "dribble.h"
|
||||
|
||||
/* All commands that can be invoked from within info_session () receive
|
||||
arguments in the same way. This simple define declares the header
|
||||
of a function named NAME, with associated documentation DOC. The
|
||||
documentation string is groveled out of the source files by the
|
||||
utility program `makedoc', which is also responsible for making
|
||||
the documentation/function-pointer maps. */
|
||||
#define DECLARE_INFO_COMMAND(name, doc) \
|
||||
void name (WINDOW *window, int count, unsigned char key)
|
||||
|
||||
/* Variables found in session.h. */
|
||||
extern VFunction *info_last_executed_command;
|
||||
|
||||
/* Variable controlling the garbage collection of files briefly visited
|
||||
during searches. Such files are normally gc'ed, unless they were
|
||||
compressed to begin with. If this variable is non-zero, it says
|
||||
to gc even those file buffer contents which had to be uncompressed. */
|
||||
extern int gc_compressed_files;
|
||||
|
||||
/* When non-zero, tiling takes place automatically when info_split_window
|
||||
is called. */
|
||||
extern int auto_tiling_p;
|
||||
|
||||
/* Variable controlling the behaviour of default scrolling when you are
|
||||
already at the bottom of a node. */
|
||||
extern int info_scroll_behaviour;
|
||||
extern char *info_scroll_choices[];
|
||||
|
||||
/* Values for info_scroll_behaviour. */
|
||||
#define IS_Continuous 0 /* Try to get first menu item, or failing that, the
|
||||
"Next:" pointer, or failing that, the "Up:" and
|
||||
"Next:" of the up. */
|
||||
#define IS_NextOnly 1 /* Try to get "Next:" menu item. */
|
||||
#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 (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 (WINDOW *window);
|
||||
|
||||
/* Tell Info that input is coming from the file FILENAME. */
|
||||
extern void info_set_input_from_file (char *filename);
|
||||
|
||||
#define return_if_control_g(val) \
|
||||
do { \
|
||||
info_gather_typeahead (); \
|
||||
if (info_input_pending_p () == Control ('g')) \
|
||||
return (val); \
|
||||
} while (0)
|
||||
|
||||
/* The names of the functions that run an info session. */
|
||||
|
||||
/* Starting an info session. */
|
||||
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 (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 (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 (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 (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 (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 (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 (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 (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 (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,295 +0,0 @@
|
||||
/* signals.c -- install and maintain signal handlers.
|
||||
$Id: signals.c,v 1.7 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1993, 1994, 1995, 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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "signals.h"
|
||||
|
||||
void initialize_info_signal_handler (void);
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Pretending That We Have POSIX Signals */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
#if !defined (HAVE_SIGPROCMASK) && defined (HAVE_SIGSETMASK)
|
||||
/* Perform OPERATION on NEWSET, perhaps leaving information in OLDSET. */
|
||||
static void
|
||||
sigprocmask (int operation, int *newset, int *oldset)
|
||||
{
|
||||
switch (operation)
|
||||
{
|
||||
case SIG_UNBLOCK:
|
||||
sigsetmask (sigblock (0) & ~(*newset));
|
||||
break;
|
||||
|
||||
case SIG_BLOCK:
|
||||
*oldset = sigblock (*newset);
|
||||
break;
|
||||
|
||||
case SIG_SETMASK:
|
||||
sigsetmask (*newset);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
#endif /* !HAVE_SIGPROCMASK && HAVE_SIGSETMASK */
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Signal Handling for Info */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
#if defined (HAVE_SIGACTION) || defined (HAVE_SIGPROCMASK) ||\
|
||||
defined (HAVE_SIGSETMASK)
|
||||
static void
|
||||
mask_termsig (sigset_t *set)
|
||||
{
|
||||
# if defined (SIGTSTP)
|
||||
sigaddset (set, SIGTSTP);
|
||||
sigaddset (set, SIGTTOU);
|
||||
sigaddset (set, SIGTTIN);
|
||||
# endif
|
||||
# if defined (SIGWINCH)
|
||||
sigaddset (set, SIGWINCH);
|
||||
# endif
|
||||
#if defined (SIGQUIT)
|
||||
sigaddset (set, SIGQUIT);
|
||||
#endif
|
||||
#if defined (SIGINT)
|
||||
sigaddset (set, SIGINT);
|
||||
#endif
|
||||
# if defined (SIGUSR1)
|
||||
sigaddset (set, SIGUSR1);
|
||||
# endif
|
||||
}
|
||||
#endif /* HAVE_SIGACTION || HAVE_SIGPROCMASK || HAVE_SIGSETMASK */
|
||||
|
||||
static RETSIGTYPE info_signal_proc (int sig);
|
||||
#if defined (HAVE_SIGACTION)
|
||||
typedef struct sigaction signal_info;
|
||||
signal_info info_signal_handler;
|
||||
|
||||
static void
|
||||
set_termsig (int sig, signal_info *old)
|
||||
{
|
||||
sigaction (sig, &info_signal_handler, old);
|
||||
}
|
||||
|
||||
static void
|
||||
restore_termsig (int sig, const signal_info *saved)
|
||||
{
|
||||
sigaction (sig, saved, NULL);
|
||||
}
|
||||
#else /* !HAVE_SIGACTION */
|
||||
typedef RETSIGTYPE (*signal_info) ();
|
||||
#define set_termsig(sig, old) (void)(*(old) = signal (sig, info_signal_proc))
|
||||
#define restore_termsig(sig, saved) (void)signal (sig, *(saved))
|
||||
#define info_signal_handler info_signal_proc
|
||||
static int term_conf_busy = 0;
|
||||
#endif /* !HAVE_SIGACTION */
|
||||
|
||||
static signal_info old_TSTP, old_TTOU, old_TTIN;
|
||||
static signal_info old_WINCH, old_INT, old_USR1;
|
||||
static signal_info old_QUIT;
|
||||
|
||||
void
|
||||
initialize_info_signal_handler (void)
|
||||
{
|
||||
#ifdef SA_NOCLDSTOP
|
||||
/* (Based on info from Paul Eggert found in coreutils.) Don't use
|
||||
HAVE_SIGACTION to decide whether to use the sa_handler, sa_flags,
|
||||
sa_mask members, as some systems (Solaris 7+) don't define them. Use
|
||||
SA_NOCLDSTOP instead; it's been part of POSIX.1 since day 1 (in 1988). */
|
||||
info_signal_handler.sa_handler = info_signal_proc;
|
||||
info_signal_handler.sa_flags = 0;
|
||||
mask_termsig (&info_signal_handler.sa_mask);
|
||||
#endif /* SA_NOCLDSTOP */
|
||||
|
||||
#if defined (SIGTSTP)
|
||||
set_termsig (SIGTSTP, &old_TSTP);
|
||||
set_termsig (SIGTTOU, &old_TTOU);
|
||||
set_termsig (SIGTTIN, &old_TTIN);
|
||||
#endif /* SIGTSTP */
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
set_termsig (SIGWINCH, &old_WINCH);
|
||||
#endif
|
||||
|
||||
#if defined (SIGQUIT)
|
||||
set_termsig (SIGQUIT, &old_QUIT);
|
||||
#endif
|
||||
|
||||
#if defined (SIGINT)
|
||||
set_termsig (SIGINT, &old_INT);
|
||||
#endif
|
||||
|
||||
#if defined (SIGUSR1)
|
||||
/* Used by DJGPP to simulate SIGTSTP on Ctrl-Z. */
|
||||
set_termsig (SIGUSR1, &old_USR1);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
redisplay_after_signal (void)
|
||||
{
|
||||
terminal_clear_screen ();
|
||||
display_clear_display (the_display);
|
||||
window_mark_chain (windows, W_UpdateWindow);
|
||||
display_update_display (windows);
|
||||
display_cursor_at_point (active_window);
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
reset_info_window_sizes (void)
|
||||
{
|
||||
terminal_goto_xy (0, 0);
|
||||
fflush (stdout);
|
||||
terminal_unprep_terminal ();
|
||||
terminal_get_screen_size ();
|
||||
terminal_prep_terminal ();
|
||||
display_initialize_display (screenwidth, screenheight);
|
||||
window_new_screen_size (screenwidth, screenheight);
|
||||
redisplay_after_signal ();
|
||||
}
|
||||
|
||||
static RETSIGTYPE
|
||||
info_signal_proc (int sig)
|
||||
{
|
||||
signal_info *old_signal_handler = NULL;
|
||||
|
||||
#if !defined (HAVE_SIGACTION)
|
||||
/* best effort: first increment this counter and later block signals */
|
||||
if (term_conf_busy)
|
||||
return;
|
||||
term_conf_busy++;
|
||||
#if defined (HAVE_SIGPROCMASK) || defined (HAVE_SIGSETMASK)
|
||||
{
|
||||
sigset_t nvar, ovar;
|
||||
sigemptyset (&nvar);
|
||||
mask_termsig (&nvar);
|
||||
sigprocmask (SIG_BLOCK, &nvar, &ovar);
|
||||
}
|
||||
#endif /* HAVE_SIGPROCMASK || HAVE_SIGSETMASK */
|
||||
#endif /* !HAVE_SIGACTION */
|
||||
switch (sig)
|
||||
{
|
||||
#if defined (SIGTSTP)
|
||||
case SIGTSTP:
|
||||
case SIGTTOU:
|
||||
case SIGTTIN:
|
||||
#endif
|
||||
#if defined (SIGQUIT)
|
||||
case SIGQUIT:
|
||||
#endif
|
||||
#if defined (SIGINT)
|
||||
case SIGINT:
|
||||
#endif
|
||||
{
|
||||
#if defined (SIGTSTP)
|
||||
if (sig == SIGTSTP)
|
||||
old_signal_handler = &old_TSTP;
|
||||
if (sig == SIGTTOU)
|
||||
old_signal_handler = &old_TTOU;
|
||||
if (sig == SIGTTIN)
|
||||
old_signal_handler = &old_TTIN;
|
||||
#endif /* SIGTSTP */
|
||||
#if defined (SIGQUIT)
|
||||
if (sig == SIGQUIT)
|
||||
old_signal_handler = &old_QUIT;
|
||||
#endif /* SIGQUIT */
|
||||
#if defined (SIGINT)
|
||||
if (sig == SIGINT)
|
||||
old_signal_handler = &old_INT;
|
||||
#endif /* SIGINT */
|
||||
|
||||
/* For stop signals, restore the terminal IO, leave the cursor
|
||||
at the bottom of the window, and stop us. */
|
||||
terminal_goto_xy (0, screenheight - 1);
|
||||
terminal_clear_to_eol ();
|
||||
fflush (stdout);
|
||||
terminal_unprep_terminal ();
|
||||
restore_termsig (sig, old_signal_handler);
|
||||
UNBLOCK_SIGNAL (sig);
|
||||
kill (getpid (), sig);
|
||||
|
||||
/* The program is returning now. Restore our signal handler,
|
||||
turn on terminal handling, redraw the screen, and place the
|
||||
cursor where it belongs. */
|
||||
terminal_prep_terminal ();
|
||||
set_termsig (sig, old_signal_handler);
|
||||
/* window size might be changed while sleeping */
|
||||
reset_info_window_sizes ();
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined (SIGWINCH) || defined (SIGUSR1)
|
||||
#ifdef SIGWINCH
|
||||
case SIGWINCH:
|
||||
#endif
|
||||
#ifdef SIGUSR1
|
||||
case SIGUSR1:
|
||||
#endif
|
||||
{
|
||||
/* Turn off terminal IO, tell our parent that the window has changed,
|
||||
then reinitialize the terminal and rebuild our windows. */
|
||||
#ifdef SIGWINCH
|
||||
if (sig == SIGWINCH)
|
||||
old_signal_handler = &old_WINCH;
|
||||
#endif
|
||||
#ifdef SIGUSR1
|
||||
if (sig == SIGUSR1)
|
||||
old_signal_handler = &old_USR1;
|
||||
#endif
|
||||
terminal_goto_xy (0, 0);
|
||||
fflush (stdout);
|
||||
terminal_unprep_terminal (); /* needless? */
|
||||
restore_termsig (sig, old_signal_handler);
|
||||
UNBLOCK_SIGNAL (sig);
|
||||
kill (getpid (), sig);
|
||||
|
||||
/* After our old signal handler returns... */
|
||||
set_termsig (sig, old_signal_handler); /* needless? */
|
||||
terminal_prep_terminal ();
|
||||
reset_info_window_sizes ();
|
||||
}
|
||||
break;
|
||||
#endif /* SIGWINCH || SIGUSR1 */
|
||||
}
|
||||
#if !defined (HAVE_SIGACTION)
|
||||
/* at this time it is safer to perform unblock after decrement */
|
||||
term_conf_busy--;
|
||||
#if defined (HAVE_SIGPROCMASK) || defined (HAVE_SIGSETMASK)
|
||||
{
|
||||
sigset_t nvar, ovar;
|
||||
sigemptyset (&nvar);
|
||||
mask_termsig (&nvar);
|
||||
sigprocmask (SIG_UNBLOCK, &nvar, &ovar);
|
||||
}
|
||||
#endif /* HAVE_SIGPROCMASK || HAVE_SIGSETMASK */
|
||||
#endif /* !HAVE_SIGACTION */
|
||||
}
|
||||
/* vim: set sw=2 cino={1s>2sn-s^-se-s: */
|
@ -1,96 +0,0 @@
|
||||
/* signals.h -- header to include system dependent signal definitions.
|
||||
$Id: signals.h,v 1.2 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_SIGNALS_H
|
||||
#define INFO_SIGNALS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
/* For sysV68 --phdm@info.ucl.ac.be. */
|
||||
#if !defined (SIGCHLD) && defined (SIGCLD)
|
||||
#define SIGCHLD SIGCLD
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_SIGPROCMASK) && !defined (sigmask)
|
||||
# define sigmask(x) (1 << ((x)-1))
|
||||
#endif /* !HAVE_SIGPROCMASK && !sigmask */
|
||||
|
||||
/* 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
|
||||
# define SIG_SETMASK 3
|
||||
# endif /* SIG_BLOCK */
|
||||
|
||||
/* Type of a signal set. */
|
||||
# define sigset_t int
|
||||
|
||||
/* Make SET have no signals in it. */
|
||||
# define sigemptyset(set) (*(set) = (sigset_t)0x0)
|
||||
|
||||
/* Make SET have the full range of signal specifications possible. */
|
||||
# define sigfillset(set) (*(set) = (sigset_t)0xffffffffff)
|
||||
|
||||
/* Add SIG to the contents of SET. */
|
||||
# define sigaddset(set, sig) *(set) |= sigmask (sig)
|
||||
|
||||
/* Delete SIG from the contents of SET. */
|
||||
# define sigdelset(set, sig) *(set) &= ~(sigmask (sig))
|
||||
|
||||
/* Tell if SET contains SIG. */
|
||||
# define sigismember(set, sig) (*(set) & (sigmask (sig)))
|
||||
|
||||
/* Suspend the process until the reception of one of the signals
|
||||
not present in SET. */
|
||||
# define sigsuspend(set) sigpause (*(set))
|
||||
#endif /* !HAVE_SIGPROCMASK */
|
||||
|
||||
#if defined (HAVE_SIGPROCMASK) || defined (HAVE_SIGSETMASK)
|
||||
/* These definitions are used both in POSIX and non-POSIX implementations. */
|
||||
|
||||
#define BLOCK_SIGNAL(sig) \
|
||||
do { \
|
||||
sigset_t nvar, ovar; \
|
||||
sigemptyset (&nvar); \
|
||||
sigemptyset (&ovar); \
|
||||
sigaddset (&nvar, sig); \
|
||||
sigprocmask (SIG_BLOCK, &nvar, &ovar); \
|
||||
} while (0)
|
||||
|
||||
#define UNBLOCK_SIGNAL(sig) \
|
||||
do { \
|
||||
sigset_t nvar, ovar; \
|
||||
sigemptyset (&ovar); \
|
||||
sigemptyset (&nvar); \
|
||||
sigaddset (&nvar, sig); \
|
||||
sigprocmask (SIG_UNBLOCK, &nvar, &ovar); \
|
||||
} while (0)
|
||||
|
||||
#else /* !HAVE_SIGPROCMASK && !HAVE_SIGSETMASK */
|
||||
# define BLOCK_SIGNAL(sig)
|
||||
# define UNBLOCK_SIGNAL(sig)
|
||||
#endif /* !HAVE_SIGPROCMASK && !HAVE_SIGSETMASK */
|
||||
|
||||
#endif /* not INFO_SIGNALS_H */
|
@ -1,59 +0,0 @@
|
||||
/* termdep.h -- system things that terminal.c depends on.
|
||||
$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.
|
||||
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_TERMDEP_H
|
||||
#define INFO_TERMDEP_H
|
||||
|
||||
/* NeXT supplies <termios.h> but it is broken. Probably Autoconf should
|
||||
have a separate test, but anyway ... */
|
||||
#ifdef NeXT
|
||||
#undef HAVE_TERMIOS_H
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
# include <termios.h>
|
||||
#else
|
||||
# if defined (HAVE_TERMIO_H)
|
||||
# include <termio.h>
|
||||
# if defined (HAVE_SYS_PTEM_H)
|
||||
# if defined (M_UNIX) || !defined (M_XENIX)
|
||||
# include <sys/stream.h>
|
||||
# include <sys/ptem.h>
|
||||
# undef TIOCGETC
|
||||
# else /* M_XENIX */
|
||||
# define tchars tc
|
||||
# endif /* M_XENIX */
|
||||
# endif /* HAVE_SYS_PTEM_H */
|
||||
# else /* !HAVE_TERMIO_H */
|
||||
# include <sgtty.h>
|
||||
# endif /* !HAVE_TERMIO_H */
|
||||
#endif /* !HAVE_TERMIOS_H */
|
||||
|
||||
#ifdef GWINSZ_IN_SYS_IOCTL
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TTOLD_H
|
||||
# include <sys/ttold.h>
|
||||
#endif /* HAVE_SYS_TTOLD_H */
|
||||
|
||||
#endif /* not INFO_TERMDEP_H */
|
@ -1,873 +0,0 @@
|
||||
/* terminal.c -- how to handle the physical terminal for Info.
|
||||
$Id: terminal.c,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, 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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "terminal.h"
|
||||
#include "termdep.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
/* The Unix termcap interface code. */
|
||||
#ifdef HAVE_NCURSES_TERMCAP_H
|
||||
#include <ncurses/termcap.h>
|
||||
#else
|
||||
#ifdef HAVE_TERMCAP_H
|
||||
#include <termcap.h>
|
||||
#else
|
||||
/* On Solaris2, sys/types.h #includes sys/reg.h, which #defines PC.
|
||||
Unfortunately, PC is a global variable used by the termcap library. */
|
||||
#undef PC
|
||||
|
||||
/* Termcap requires these variables, whether we access them or not. */
|
||||
char *BC, *UP;
|
||||
char PC; /* Pad character */
|
||||
short ospeed; /* Terminal output baud rate */
|
||||
extern int tgetnum (), tgetflag (), tgetent ();
|
||||
extern char *tgetstr (), *tgoto ();
|
||||
extern void tputs ();
|
||||
#endif /* not HAVE_TERMCAP_H */
|
||||
#endif /* not HAVE_NCURSES_TERMCAP_H */
|
||||
|
||||
/* Function "hooks". If you make one of these point to a function, that
|
||||
function is called when appropriate instead of its namesake. Your
|
||||
function is called with exactly the same arguments that were passed
|
||||
to the namesake function. */
|
||||
VFunction *terminal_begin_inverse_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_end_inverse_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_prep_terminal_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_unprep_terminal_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_up_line_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_down_line_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_clear_screen_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_clear_to_eol_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_get_screen_size_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_goto_xy_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_initialize_terminal_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_new_terminal_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_put_text_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_ring_bell_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_write_chars_hook = (VFunction *)NULL;
|
||||
VFunction *terminal_scroll_terminal_hook = (VFunction *)NULL;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Terminal and Termcap */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* A buffer which holds onto the current terminal description, and a pointer
|
||||
used to float within it. And the name of the terminal. */
|
||||
static char *term_buffer = NULL;
|
||||
static char *term_string_buffer = NULL;
|
||||
static char *term_name;
|
||||
|
||||
/* Some strings to control terminal actions. These are output by tputs (). */
|
||||
static char *term_goto, *term_clreol, *term_cr, *term_clrpag;
|
||||
static char *term_begin_use, *term_end_use;
|
||||
static char *term_AL, *term_DL, *term_al, *term_dl;
|
||||
|
||||
static char *term_keypad_on, *term_keypad_off;
|
||||
|
||||
/* How to go up a line. */
|
||||
static char *term_up;
|
||||
|
||||
/* How to go down a line. */
|
||||
static char *term_dn;
|
||||
|
||||
/* An audible bell, if the terminal can be made to make noise. */
|
||||
static char *audible_bell;
|
||||
|
||||
/* A visible bell, if the terminal can be made to flash the screen. */
|
||||
static char *visible_bell;
|
||||
|
||||
/* The string to write to turn on the meta key, if this term has one. */
|
||||
static char *term_mm;
|
||||
|
||||
/* The string to turn on inverse mode, if this term has one. */
|
||||
static char *term_invbeg;
|
||||
|
||||
/* The string to turn off inverse mode, if this term has one. */
|
||||
static char *term_invend;
|
||||
|
||||
/* Although I can't find any documentation that says this is supposed to
|
||||
return its argument, all the code I've looked at (termutils, less)
|
||||
does so, so fine. */
|
||||
static int
|
||||
output_character_function (int c)
|
||||
{
|
||||
putc (c, stdout);
|
||||
return c;
|
||||
}
|
||||
|
||||
/* Macro to send STRING to the terminal. */
|
||||
#define send_to_terminal(string) \
|
||||
do { \
|
||||
if (string) \
|
||||
tputs (string, 1, output_character_function); \
|
||||
} while (0)
|
||||
|
||||
/* Tell the terminal that we will be doing cursor addressable motion. */
|
||||
static void
|
||||
terminal_begin_using_terminal (void)
|
||||
{
|
||||
RETSIGTYPE (*sigsave) (int signum);
|
||||
|
||||
if (term_keypad_on)
|
||||
send_to_terminal (term_keypad_on);
|
||||
|
||||
if (!term_begin_use || !*term_begin_use)
|
||||
return;
|
||||
|
||||
#ifdef SIGWINCH
|
||||
sigsave = signal (SIGWINCH, SIG_IGN);
|
||||
#endif
|
||||
|
||||
send_to_terminal (term_begin_use);
|
||||
fflush (stdout);
|
||||
if (STREQ (term_name, "sun-cmd"))
|
||||
/* Without this fflush and sleep, running info in a shelltool or
|
||||
cmdtool (TERM=sun-cmd) with scrollbars loses -- the scrollbars are
|
||||
not restored properly.
|
||||
From: strube@physik3.gwdg.de (Hans Werner Strube). */
|
||||
sleep (1);
|
||||
|
||||
#ifdef SIGWINCH
|
||||
signal (SIGWINCH, sigsave);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Tell the terminal that we will not be doing any more cursor
|
||||
addressable motion. */
|
||||
static void
|
||||
terminal_end_using_terminal (void)
|
||||
{
|
||||
RETSIGTYPE (*sigsave) (int signum);
|
||||
|
||||
if (term_keypad_off)
|
||||
send_to_terminal (term_keypad_off);
|
||||
|
||||
if (!term_end_use || !*term_end_use)
|
||||
return;
|
||||
|
||||
#ifdef SIGWINCH
|
||||
sigsave = signal (SIGWINCH, SIG_IGN);
|
||||
#endif
|
||||
|
||||
send_to_terminal (term_end_use);
|
||||
fflush (stdout);
|
||||
if (STREQ (term_name, "sun-cmd"))
|
||||
/* See comments at other sleep. */
|
||||
sleep (1);
|
||||
|
||||
#ifdef SIGWINCH
|
||||
signal (SIGWINCH, sigsave);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Necessary Terminal Functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* The functions and variables on this page implement the user visible
|
||||
portion of the terminal interface. */
|
||||
|
||||
/* The width and height of the terminal. */
|
||||
int screenwidth, screenheight;
|
||||
|
||||
/* Non-zero means this terminal can't really do anything. */
|
||||
int terminal_is_dumb_p = 0;
|
||||
|
||||
/* Non-zero means that this terminal has a meta key. */
|
||||
int terminal_has_meta_p = 0;
|
||||
|
||||
/* Non-zero means that this terminal can produce a visible bell. */
|
||||
int terminal_has_visible_bell_p = 0;
|
||||
|
||||
/* Non-zero means to use that visible bell if at all possible. */
|
||||
int terminal_use_visible_bell_p = 0;
|
||||
|
||||
/* Non-zero means that the terminal can do scrolling. */
|
||||
int terminal_can_scroll = 0;
|
||||
|
||||
/* The key sequences output by the arrow keys, if this terminal has any. */
|
||||
char *term_ku = NULL;
|
||||
char *term_kd = NULL;
|
||||
char *term_kr = NULL;
|
||||
char *term_kl = NULL;
|
||||
char *term_kP = NULL; /* page-up */
|
||||
char *term_kN = NULL; /* page-down */
|
||||
char *term_kh = NULL; /* home */
|
||||
char *term_ke = NULL; /* end */
|
||||
char *term_kD = NULL; /* delete */
|
||||
char *term_ki = NULL; /* ins */
|
||||
char *term_kx = NULL; /* del */
|
||||
|
||||
/* Move the cursor to the terminal location of X and Y. */
|
||||
void
|
||||
terminal_goto_xy (int x, int y)
|
||||
{
|
||||
if (terminal_goto_xy_hook)
|
||||
(*terminal_goto_xy_hook) (x, y);
|
||||
else
|
||||
{
|
||||
if (term_goto)
|
||||
tputs (tgoto (term_goto, x, y), 1, output_character_function);
|
||||
}
|
||||
}
|
||||
|
||||
/* Print STRING to the terminal at the current position. */
|
||||
void
|
||||
terminal_put_text (char *string)
|
||||
{
|
||||
if (terminal_put_text_hook)
|
||||
(*terminal_put_text_hook) (string);
|
||||
else
|
||||
{
|
||||
printf ("%s", string);
|
||||
}
|
||||
}
|
||||
|
||||
/* Print NCHARS from STRING to the terminal at the current position. */
|
||||
void
|
||||
terminal_write_chars (char *string, int nchars)
|
||||
{
|
||||
if (terminal_write_chars_hook)
|
||||
(*terminal_write_chars_hook) (string, nchars);
|
||||
else
|
||||
{
|
||||
if (nchars)
|
||||
fwrite (string, 1, nchars, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear from the current position of the cursor to the end of the line. */
|
||||
void
|
||||
terminal_clear_to_eol (void)
|
||||
{
|
||||
if (terminal_clear_to_eol_hook)
|
||||
(*terminal_clear_to_eol_hook) ();
|
||||
else
|
||||
{
|
||||
send_to_terminal (term_clreol);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear the entire terminal screen. */
|
||||
void
|
||||
terminal_clear_screen (void)
|
||||
{
|
||||
if (terminal_clear_screen_hook)
|
||||
(*terminal_clear_screen_hook) ();
|
||||
else
|
||||
{
|
||||
send_to_terminal (term_clrpag);
|
||||
}
|
||||
}
|
||||
|
||||
/* Move the cursor up one line. */
|
||||
void
|
||||
terminal_up_line (void)
|
||||
{
|
||||
if (terminal_up_line_hook)
|
||||
(*terminal_up_line_hook) ();
|
||||
else
|
||||
{
|
||||
send_to_terminal (term_up);
|
||||
}
|
||||
}
|
||||
|
||||
/* Move the cursor down one line. */
|
||||
void
|
||||
terminal_down_line (void)
|
||||
{
|
||||
if (terminal_down_line_hook)
|
||||
(*terminal_down_line_hook) ();
|
||||
else
|
||||
{
|
||||
send_to_terminal (term_dn);
|
||||
}
|
||||
}
|
||||
|
||||
/* Turn on reverse video if possible. */
|
||||
void
|
||||
terminal_begin_inverse (void)
|
||||
{
|
||||
if (terminal_begin_inverse_hook)
|
||||
(*terminal_begin_inverse_hook) ();
|
||||
else
|
||||
{
|
||||
send_to_terminal (term_invbeg);
|
||||
}
|
||||
}
|
||||
|
||||
/* Turn off reverse video if possible. */
|
||||
void
|
||||
terminal_end_inverse (void)
|
||||
{
|
||||
if (terminal_end_inverse_hook)
|
||||
(*terminal_end_inverse_hook) ();
|
||||
else
|
||||
{
|
||||
send_to_terminal (term_invend);
|
||||
}
|
||||
}
|
||||
|
||||
/* Ring the terminal bell. The bell is run visibly if it both has one and
|
||||
terminal_use_visible_bell_p is non-zero. */
|
||||
void
|
||||
terminal_ring_bell (void)
|
||||
{
|
||||
if (terminal_ring_bell_hook)
|
||||
(*terminal_ring_bell_hook) ();
|
||||
else
|
||||
{
|
||||
if (terminal_has_visible_bell_p && terminal_use_visible_bell_p)
|
||||
send_to_terminal (visible_bell);
|
||||
else
|
||||
send_to_terminal (audible_bell);
|
||||
}
|
||||
}
|
||||
|
||||
/* At the line START, delete COUNT lines from the terminal display. */
|
||||
static void
|
||||
terminal_delete_lines (int start, int count)
|
||||
{
|
||||
int lines;
|
||||
|
||||
/* Normalize arguments. */
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
|
||||
lines = screenheight - start;
|
||||
terminal_goto_xy (0, start);
|
||||
if (term_DL)
|
||||
tputs (tgoto (term_DL, 0, count), lines, output_character_function);
|
||||
else
|
||||
{
|
||||
while (count--)
|
||||
tputs (term_dl, lines, output_character_function);
|
||||
}
|
||||
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
/* At the line START, insert COUNT lines in the terminal display. */
|
||||
static void
|
||||
terminal_insert_lines (int start, int count)
|
||||
{
|
||||
int lines;
|
||||
|
||||
/* Normalize arguments. */
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
|
||||
lines = screenheight - start;
|
||||
terminal_goto_xy (0, start);
|
||||
|
||||
if (term_AL)
|
||||
tputs (tgoto (term_AL, 0, count), lines, output_character_function);
|
||||
else
|
||||
{
|
||||
while (count--)
|
||||
tputs (term_al, lines, output_character_function);
|
||||
}
|
||||
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
void
|
||||
terminal_scroll_terminal (int start, int end, int amount)
|
||||
{
|
||||
if (!terminal_can_scroll)
|
||||
return;
|
||||
|
||||
/* Any scrolling at all? */
|
||||
if (amount == 0)
|
||||
return;
|
||||
|
||||
if (terminal_scroll_terminal_hook)
|
||||
(*terminal_scroll_terminal_hook) (start, end, amount);
|
||||
else
|
||||
{
|
||||
/* If we are scrolling down, delete AMOUNT lines at END. Then insert
|
||||
AMOUNT lines at START. */
|
||||
if (amount > 0)
|
||||
{
|
||||
terminal_delete_lines (end, amount);
|
||||
terminal_insert_lines (start, amount);
|
||||
}
|
||||
|
||||
/* If we are scrolling up, delete AMOUNT lines before START. This
|
||||
actually does the upwards scroll. Then, insert AMOUNT lines
|
||||
after the already scrolled region (i.e., END - AMOUNT). */
|
||||
if (amount < 0)
|
||||
{
|
||||
int abs_amount = -amount;
|
||||
terminal_delete_lines (start - abs_amount, abs_amount);
|
||||
terminal_insert_lines (end - abs_amount, abs_amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Re-initialize the terminal considering that the TERM/TERMCAP variable
|
||||
has changed. */
|
||||
void
|
||||
terminal_new_terminal (char *terminal_name)
|
||||
{
|
||||
if (terminal_new_terminal_hook)
|
||||
(*terminal_new_terminal_hook) (terminal_name);
|
||||
else
|
||||
{
|
||||
terminal_initialize_terminal (terminal_name);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the global variables SCREENWIDTH and SCREENHEIGHT. */
|
||||
void
|
||||
terminal_get_screen_size (void)
|
||||
{
|
||||
if (terminal_get_screen_size_hook)
|
||||
(*terminal_get_screen_size_hook) ();
|
||||
else
|
||||
{
|
||||
screenwidth = screenheight = 0;
|
||||
|
||||
#if defined (TIOCGWINSZ)
|
||||
{
|
||||
struct winsize window_size;
|
||||
|
||||
if (ioctl (fileno (stdout), TIOCGWINSZ, &window_size) == 0)
|
||||
{
|
||||
screenwidth = (int) window_size.ws_col;
|
||||
screenheight = (int) window_size.ws_row;
|
||||
}
|
||||
}
|
||||
#endif /* TIOCGWINSZ */
|
||||
|
||||
/* Environment variable COLUMNS overrides setting of "co". */
|
||||
if (screenwidth <= 0)
|
||||
{
|
||||
char *sw = getenv ("COLUMNS");
|
||||
|
||||
if (sw)
|
||||
screenwidth = atoi (sw);
|
||||
|
||||
if (screenwidth <= 0)
|
||||
screenwidth = tgetnum ("co");
|
||||
}
|
||||
|
||||
/* Environment variable LINES overrides setting of "li". */
|
||||
if (screenheight <= 0)
|
||||
{
|
||||
char *sh = getenv ("LINES");
|
||||
|
||||
if (sh)
|
||||
screenheight = atoi (sh);
|
||||
|
||||
if (screenheight <= 0)
|
||||
screenheight = tgetnum ("li");
|
||||
}
|
||||
|
||||
/* If all else fails, default to 80x24 terminal. */
|
||||
if (screenwidth <= 0)
|
||||
screenwidth = 80;
|
||||
|
||||
if (screenheight <= 0)
|
||||
screenheight = 24;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the terminal which is known as TERMINAL_NAME. If this
|
||||
terminal doesn't have cursor addressability, `terminal_is_dumb_p'
|
||||
becomes nonzero. The variables SCREENHEIGHT and SCREENWIDTH are set
|
||||
to the dimensions that this terminal actually has. The variable
|
||||
TERMINAL_HAS_META_P becomes nonzero if this terminal supports a Meta
|
||||
key. Finally, the terminal screen is cleared. */
|
||||
void
|
||||
terminal_initialize_terminal (char *terminal_name)
|
||||
{
|
||||
char *buffer;
|
||||
|
||||
terminal_is_dumb_p = 0;
|
||||
|
||||
if (terminal_initialize_terminal_hook)
|
||||
{
|
||||
(*terminal_initialize_terminal_hook) (terminal_name);
|
||||
return;
|
||||
}
|
||||
|
||||
term_name = terminal_name ? terminal_name : getenv ("TERM");
|
||||
if (!term_name)
|
||||
term_name = "dumb";
|
||||
|
||||
if (!term_string_buffer)
|
||||
term_string_buffer = xmalloc (2048);
|
||||
|
||||
if (!term_buffer)
|
||||
term_buffer = xmalloc (2048);
|
||||
|
||||
buffer = term_string_buffer;
|
||||
|
||||
term_clrpag = term_cr = term_clreol = NULL;
|
||||
|
||||
/* HP-UX 11.x returns 0 for OK --jeff.hull@state.co.us. */
|
||||
if (tgetent (term_buffer, term_name) < 0)
|
||||
{
|
||||
terminal_is_dumb_p = 1;
|
||||
screenwidth = 80;
|
||||
screenheight = 24;
|
||||
term_cr = "\r";
|
||||
term_up = term_dn = audible_bell = visible_bell = NULL;
|
||||
term_ku = term_kd = term_kl = term_kr = NULL;
|
||||
term_kP = term_kN = NULL;
|
||||
term_kh = term_ke = NULL;
|
||||
term_kD = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
BC = tgetstr ("pc", &buffer);
|
||||
PC = BC ? *BC : 0;
|
||||
|
||||
#if defined (HAVE_TERMIOS_H)
|
||||
{
|
||||
struct termios ti;
|
||||
if (tcgetattr (fileno(stdout), &ti) != -1)
|
||||
ospeed = cfgetospeed (&ti);
|
||||
else
|
||||
ospeed = B9600;
|
||||
}
|
||||
#else
|
||||
# if defined (TIOCGETP)
|
||||
{
|
||||
struct sgttyb sg;
|
||||
|
||||
if (ioctl (fileno (stdout), TIOCGETP, &sg) != -1)
|
||||
ospeed = sg.sg_ospeed;
|
||||
else
|
||||
ospeed = B9600;
|
||||
}
|
||||
# else
|
||||
ospeed = B9600;
|
||||
# endif /* !TIOCGETP */
|
||||
#endif
|
||||
|
||||
term_cr = tgetstr ("cr", &buffer);
|
||||
term_clreol = tgetstr ("ce", &buffer);
|
||||
term_clrpag = tgetstr ("cl", &buffer);
|
||||
term_goto = tgetstr ("cm", &buffer);
|
||||
|
||||
/* Find out about this terminal's scrolling capability. */
|
||||
term_AL = tgetstr ("AL", &buffer);
|
||||
term_DL = tgetstr ("DL", &buffer);
|
||||
term_al = tgetstr ("al", &buffer);
|
||||
term_dl = tgetstr ("dl", &buffer);
|
||||
|
||||
terminal_can_scroll = ((term_AL || term_al) && (term_DL || term_dl));
|
||||
|
||||
term_invbeg = tgetstr ("mr", &buffer);
|
||||
if (term_invbeg)
|
||||
term_invend = tgetstr ("me", &buffer);
|
||||
else
|
||||
term_invend = NULL;
|
||||
|
||||
if (!term_cr)
|
||||
term_cr = "\r";
|
||||
|
||||
terminal_get_screen_size ();
|
||||
|
||||
term_up = tgetstr ("up", &buffer);
|
||||
term_dn = tgetstr ("dn", &buffer);
|
||||
visible_bell = tgetstr ("vb", &buffer);
|
||||
terminal_has_visible_bell_p = (visible_bell != NULL);
|
||||
audible_bell = tgetstr ("bl", &buffer);
|
||||
if (!audible_bell)
|
||||
audible_bell = "\007";
|
||||
term_begin_use = tgetstr ("ti", &buffer);
|
||||
term_end_use = tgetstr ("te", &buffer);
|
||||
|
||||
term_keypad_on = tgetstr ("ks", &buffer);
|
||||
term_keypad_off = tgetstr ("ke", &buffer);
|
||||
|
||||
/* Check to see if this terminal has a meta key. */
|
||||
terminal_has_meta_p = (tgetflag ("km") || tgetflag ("MT"));
|
||||
if (terminal_has_meta_p)
|
||||
{
|
||||
term_mm = tgetstr ("mm", &buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
term_mm = NULL;
|
||||
}
|
||||
|
||||
/* Attempt to find the arrow keys. */
|
||||
term_ku = tgetstr ("ku", &buffer);
|
||||
term_kd = tgetstr ("kd", &buffer);
|
||||
term_kr = tgetstr ("kr", &buffer);
|
||||
term_kl = tgetstr ("kl", &buffer);
|
||||
|
||||
term_kP = tgetstr ("kP", &buffer);
|
||||
term_kN = tgetstr ("kN", &buffer);
|
||||
|
||||
#if defined(INFOKEY)
|
||||
term_kh = tgetstr ("kh", &buffer);
|
||||
term_ke = tgetstr ("@7", &buffer);
|
||||
term_ki = tgetstr ("kI", &buffer);
|
||||
term_kx = tgetstr ("kD", &buffer);
|
||||
#endif /* defined(INFOKEY) */
|
||||
|
||||
/* Home and end keys. */
|
||||
term_kh = tgetstr ("kh", &buffer);
|
||||
term_ke = tgetstr ("@7", &buffer);
|
||||
|
||||
term_kD = tgetstr ("kD", &buffer);
|
||||
|
||||
/* If this terminal is not cursor addressable, then it is really dumb. */
|
||||
if (!term_goto)
|
||||
terminal_is_dumb_p = 1;
|
||||
}
|
||||
|
||||
/* How to read characters from the terminal. */
|
||||
|
||||
#if defined (HAVE_TERMIOS_H)
|
||||
struct termios original_termios, ttybuff;
|
||||
#else
|
||||
# if defined (HAVE_TERMIO_H)
|
||||
/* A buffer containing the terminal mode flags upon entry to info. */
|
||||
struct termio original_termio, ttybuff;
|
||||
# else /* !HAVE_TERMIO_H */
|
||||
/* Buffers containing the terminal mode flags upon entry to info. */
|
||||
int original_tty_flags = 0;
|
||||
int original_lmode;
|
||||
struct sgttyb ttybuff;
|
||||
|
||||
# if defined(TIOCGETC) && defined(M_XENIX)
|
||||
/* SCO 3.2v5.0.2 defines but does not support TIOCGETC. Gak. Maybe
|
||||
better fix would be to use Posix termios in preference. --gildea,
|
||||
1jul99. */
|
||||
# undef TIOCGETC
|
||||
# endif
|
||||
|
||||
# if defined (TIOCGETC)
|
||||
/* A buffer containing the terminal interrupt characters upon entry
|
||||
to Info. */
|
||||
struct tchars original_tchars;
|
||||
# endif
|
||||
|
||||
# if defined (TIOCGLTC)
|
||||
/* A buffer containing the local terminal mode characters upon entry
|
||||
to Info. */
|
||||
struct ltchars original_ltchars;
|
||||
# endif
|
||||
# endif /* !HAVE_TERMIO_H */
|
||||
#endif /* !HAVE_TERMIOS_H */
|
||||
|
||||
/* Prepare to start using the terminal to read characters singly. */
|
||||
void
|
||||
terminal_prep_terminal (void)
|
||||
{
|
||||
int tty;
|
||||
|
||||
if (terminal_prep_terminal_hook)
|
||||
{
|
||||
(*terminal_prep_terminal_hook) ();
|
||||
return;
|
||||
}
|
||||
|
||||
terminal_begin_using_terminal ();
|
||||
|
||||
tty = fileno (stdin);
|
||||
|
||||
#if defined (HAVE_TERMIOS_H)
|
||||
tcgetattr (tty, &original_termios);
|
||||
tcgetattr (tty, &ttybuff);
|
||||
#else
|
||||
# if defined (HAVE_TERMIO_H)
|
||||
ioctl (tty, TCGETA, &original_termio);
|
||||
ioctl (tty, TCGETA, &ttybuff);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_TERMIOS_H) || defined (HAVE_TERMIO_H)
|
||||
ttybuff.c_iflag &= (~ISTRIP & ~INLCR & ~IGNCR & ~ICRNL & ~IXON);
|
||||
/* These output flags are not part of POSIX, so only use them if they
|
||||
are defined. */
|
||||
#ifdef ONLCR
|
||||
ttybuff.c_oflag &= ~ONLCR ;
|
||||
#endif
|
||||
#ifdef OCRNL
|
||||
ttybuff.c_oflag &= ~OCRNL;
|
||||
#endif
|
||||
ttybuff.c_lflag &= (~ICANON & ~ECHO);
|
||||
|
||||
ttybuff.c_cc[VMIN] = 1;
|
||||
ttybuff.c_cc[VTIME] = 0;
|
||||
|
||||
if (ttybuff.c_cc[VINTR] == '\177')
|
||||
ttybuff.c_cc[VINTR] = -1;
|
||||
|
||||
if (ttybuff.c_cc[VQUIT] == '\177')
|
||||
ttybuff.c_cc[VQUIT] = -1;
|
||||
|
||||
#ifdef VLNEXT
|
||||
if (ttybuff.c_cc[VLNEXT] == '\026')
|
||||
ttybuff.c_cc[VLNEXT] = -1;
|
||||
#endif /* VLNEXT */
|
||||
#endif /* TERMIOS or TERMIO */
|
||||
|
||||
/* cf. emacs/src/sysdep.c for being sure output is on. */
|
||||
#if defined (HAVE_TERMIOS_H)
|
||||
/* linux kernel 2.2.x needs a TCOFF followed by a TCOON to turn output
|
||||
back on if the user presses ^S at the very beginning; just a TCOON
|
||||
doesn't work. --Kevin Ryde <user42@zip.com.au>, 16jun2000. */
|
||||
tcsetattr (tty, TCSANOW, &ttybuff);
|
||||
# ifdef TCOON
|
||||
tcflow (tty, TCOOFF);
|
||||
tcflow (tty, TCOON);
|
||||
# endif
|
||||
#else
|
||||
# if defined (HAVE_TERMIO_H)
|
||||
ioctl (tty, TCSETA, &ttybuff);
|
||||
# ifdef TCXONC
|
||||
ioctl (tty, TCXONC, 1);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_TERMIOS_H) && !defined (HAVE_TERMIO_H)
|
||||
ioctl (tty, TIOCGETP, &ttybuff);
|
||||
|
||||
if (!original_tty_flags)
|
||||
original_tty_flags = ttybuff.sg_flags;
|
||||
|
||||
/* Make this terminal pass 8 bits around while we are using it. */
|
||||
# if defined (PASS8)
|
||||
ttybuff.sg_flags |= PASS8;
|
||||
# endif /* PASS8 */
|
||||
|
||||
# if defined (TIOCLGET) && defined (LPASS8)
|
||||
{
|
||||
int flags;
|
||||
ioctl (tty, TIOCLGET, &flags);
|
||||
original_lmode = flags;
|
||||
flags |= LPASS8;
|
||||
ioctl (tty, TIOCLSET, &flags);
|
||||
}
|
||||
# endif /* TIOCLGET && LPASS8 */
|
||||
|
||||
# if defined (TIOCGETC)
|
||||
{
|
||||
struct tchars temp;
|
||||
|
||||
ioctl (tty, TIOCGETC, &original_tchars);
|
||||
temp = original_tchars;
|
||||
|
||||
/* C-s and C-q. */
|
||||
temp.t_startc = temp.t_stopc = -1;
|
||||
|
||||
/* Often set to C-d. */
|
||||
temp.t_eofc = -1;
|
||||
|
||||
/* If the a quit or interrupt character conflicts with one of our
|
||||
commands, then make it go away. */
|
||||
if (temp.t_intrc == '\177')
|
||||
temp.t_intrc = -1;
|
||||
|
||||
if (temp.t_quitc == '\177')
|
||||
temp.t_quitc = -1;
|
||||
|
||||
ioctl (tty, TIOCSETC, &temp);
|
||||
}
|
||||
# endif /* TIOCGETC */
|
||||
|
||||
# if defined (TIOCGLTC)
|
||||
{
|
||||
struct ltchars temp;
|
||||
|
||||
ioctl (tty, TIOCGLTC, &original_ltchars);
|
||||
temp = original_ltchars;
|
||||
|
||||
/* Make the interrupt keys go away. Just enough to make people happy. */
|
||||
temp.t_lnextc = -1; /* C-v. */
|
||||
temp.t_dsuspc = -1; /* C-y. */
|
||||
temp.t_flushc = -1; /* C-o. */
|
||||
ioctl (tty, TIOCSLTC, &temp);
|
||||
}
|
||||
# endif /* TIOCGLTC */
|
||||
|
||||
ttybuff.sg_flags &= ~ECHO;
|
||||
ttybuff.sg_flags |= CBREAK;
|
||||
ioctl (tty, TIOCSETN, &ttybuff);
|
||||
#endif /* !HAVE_TERMIOS_H && !HAVE_TERMIO_H */
|
||||
}
|
||||
|
||||
/* Restore the tty settings back to what they were before we started using
|
||||
this terminal. */
|
||||
void
|
||||
terminal_unprep_terminal (void)
|
||||
{
|
||||
int tty;
|
||||
|
||||
if (terminal_unprep_terminal_hook)
|
||||
{
|
||||
(*terminal_unprep_terminal_hook) ();
|
||||
return;
|
||||
}
|
||||
|
||||
tty = fileno (stdin);
|
||||
|
||||
#if defined (HAVE_TERMIOS_H)
|
||||
tcsetattr (tty, TCSANOW, &original_termios);
|
||||
#else
|
||||
# if defined (HAVE_TERMIO_H)
|
||||
ioctl (tty, TCSETA, &original_termio);
|
||||
# else /* !HAVE_TERMIO_H */
|
||||
ioctl (tty, TIOCGETP, &ttybuff);
|
||||
ttybuff.sg_flags = original_tty_flags;
|
||||
ioctl (tty, TIOCSETN, &ttybuff);
|
||||
|
||||
# if defined (TIOCGETC)
|
||||
ioctl (tty, TIOCSETC, &original_tchars);
|
||||
# endif /* TIOCGETC */
|
||||
|
||||
# if defined (TIOCGLTC)
|
||||
ioctl (tty, TIOCSLTC, &original_ltchars);
|
||||
# endif /* TIOCGLTC */
|
||||
|
||||
# if defined (TIOCLGET) && defined (LPASS8)
|
||||
ioctl (tty, TIOCLSET, &original_lmode);
|
||||
# endif /* TIOCLGET && LPASS8 */
|
||||
|
||||
# endif /* !HAVE_TERMIO_H */
|
||||
#endif /* !HAVE_TERMIOS_H */
|
||||
terminal_end_using_terminal ();
|
||||
}
|
||||
|
||||
#ifdef __MSDOS__
|
||||
# include "pcterm.c"
|
||||
#endif
|
@ -1,130 +0,0 @@
|
||||
/* terminal.h -- The external interface to terminal I/O.
|
||||
$Id: terminal.h,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#if !defined (TERMINAL_H)
|
||||
#define TERMINAL_H
|
||||
|
||||
#include "info.h"
|
||||
|
||||
/* For almost every function externally visible from terminal.c, there is
|
||||
a corresponding "hook" function which can be bound in order to replace
|
||||
the functionality of the one found in terminal.c. This is how we go
|
||||
about implemented X window display. */
|
||||
|
||||
/* The width and height of the terminal. */
|
||||
extern int screenwidth, screenheight;
|
||||
|
||||
/* Non-zero means this terminal can't really do anything. */
|
||||
extern int terminal_is_dumb_p;
|
||||
|
||||
/* Non-zero means that this terminal has a meta key. */
|
||||
extern int terminal_has_meta_p;
|
||||
|
||||
/* Non-zero means that this terminal can produce a visible bell. */
|
||||
extern int terminal_has_visible_bell_p;
|
||||
|
||||
/* Non-zero means to use that visible bell if at all possible. */
|
||||
extern int terminal_use_visible_bell_p;
|
||||
|
||||
/* Non-zero means that this terminal can scroll lines up and down. */
|
||||
extern int terminal_can_scroll;
|
||||
|
||||
/* Initialize the terminal which is known as TERMINAL_NAME. If this terminal
|
||||
doesn't have cursor addressability, TERMINAL_IS_DUMB_P becomes non-zero.
|
||||
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 (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 (void);
|
||||
extern VFunction *terminal_get_screen_size_hook;
|
||||
|
||||
/* Save and restore tty settings. */
|
||||
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 (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 (int x, int y);
|
||||
extern VFunction *terminal_goto_xy_hook;
|
||||
|
||||
/* Print STRING to the terminal at the current position. */
|
||||
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 (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 (void);
|
||||
extern VFunction *terminal_clear_to_eol_hook;
|
||||
|
||||
/* Clear the entire terminal screen. */
|
||||
extern void terminal_clear_screen (void);
|
||||
extern VFunction *terminal_clear_screen_hook;
|
||||
|
||||
/* Move the cursor up one line. */
|
||||
extern void terminal_up_line (void);
|
||||
extern VFunction *terminal_up_line_hook;
|
||||
|
||||
/* Move the cursor down one line. */
|
||||
extern void terminal_down_line (void);
|
||||
extern VFunction *terminal_down_line_hook;
|
||||
|
||||
/* Turn on reverse video if possible. */
|
||||
extern void terminal_begin_inverse (void);
|
||||
extern VFunction *terminal_begin_inverse_hook;
|
||||
|
||||
/* Turn off reverse video if possible. */
|
||||
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 (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 (void);
|
||||
extern VFunction *terminal_ring_bell_hook;
|
||||
|
||||
/* The key sequences output by special keys, if this terminal has any. */
|
||||
extern char *term_ku, *term_kd, *term_kr, *term_kl;
|
||||
extern char *term_kP, *term_kN;
|
||||
extern char *term_ke, *term_kh;
|
||||
extern char *term_kx, *term_ki;
|
||||
extern char *term_kD;
|
||||
|
||||
#endif /* !TERMINAL_H */
|
@ -1,342 +0,0 @@
|
||||
/* tilde.c -- tilde expansion code (~/foo := $HOME/foo).
|
||||
$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, 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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
/* Include config.h before doing alloca. */
|
||||
#include "info.h"
|
||||
#include "tilde.h"
|
||||
|
||||
#if defined (TEST) || defined (STATIC_MALLOC)
|
||||
static void *xmalloc (), *xrealloc ();
|
||||
#endif /* TEST || STATIC_MALLOC */
|
||||
|
||||
/* The default value of tilde_additional_prefixes. This is set to
|
||||
whitespace preceding a tilde so that simple programs which do not
|
||||
perform any word separation get desired behaviour. */
|
||||
static char *default_prefixes[] =
|
||||
{ " ~", "\t~", (char *)NULL };
|
||||
|
||||
/* The default value of tilde_additional_suffixes. This is set to
|
||||
whitespace or newline so that simple programs which do not
|
||||
perform any word separation get desired behaviour. */
|
||||
static char *default_suffixes[] =
|
||||
{ " ", "\n", (char *)NULL };
|
||||
|
||||
/* If non-null, this contains the address of a function to call if the
|
||||
standard meaning for expanding a tilde fails. The function is called
|
||||
with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
|
||||
which is the expansion, or a NULL pointer if there is no expansion. */
|
||||
CFunction *tilde_expansion_failure_hook = (CFunction *)NULL;
|
||||
|
||||
/* When non-null, this is a NULL terminated array of strings which
|
||||
are duplicates for a tilde prefix. Bash uses this to expand
|
||||
`=~' and `:~'. */
|
||||
char **tilde_additional_prefixes = default_prefixes;
|
||||
|
||||
/* When non-null, this is a NULL terminated array of strings which match
|
||||
the end of a username, instead of just "/". Bash sets this to
|
||||
`:' and `=~'. */
|
||||
char **tilde_additional_suffixes = default_suffixes;
|
||||
|
||||
/* Find the start of a tilde expansion in STRING, and return the index of
|
||||
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 (char *string, int *len)
|
||||
{
|
||||
register int i, j, string_len;
|
||||
register char **prefixes = tilde_additional_prefixes;
|
||||
|
||||
string_len = strlen (string);
|
||||
*len = 0;
|
||||
|
||||
if (!*string || *string == '~')
|
||||
return (0);
|
||||
|
||||
if (prefixes)
|
||||
{
|
||||
for (i = 0; i < string_len; i++)
|
||||
{
|
||||
for (j = 0; prefixes[j]; j++)
|
||||
{
|
||||
if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0)
|
||||
{
|
||||
*len = strlen (prefixes[j]) - 1;
|
||||
return (i + *len);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (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 (char *string)
|
||||
{
|
||||
register int i, j, string_len;
|
||||
register char **suffixes = tilde_additional_suffixes;
|
||||
|
||||
string_len = strlen (string);
|
||||
|
||||
for (i = 0; i < string_len; i++)
|
||||
{
|
||||
if (IS_SLASH (string[i]) || !string[i])
|
||||
break;
|
||||
|
||||
for (j = 0; suffixes && suffixes[j]; j++)
|
||||
{
|
||||
if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0)
|
||||
return (i);
|
||||
}
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Return a new string which is the result of tilde expanding STRING. */
|
||||
char *
|
||||
tilde_expand (char *string)
|
||||
{
|
||||
char *result;
|
||||
int result_size, result_index;
|
||||
|
||||
result_size = result_index = 0;
|
||||
result = (char *)NULL;
|
||||
|
||||
/* Scan through STRING expanding tildes as we come to them. */
|
||||
while (1)
|
||||
{
|
||||
register int start, end;
|
||||
char *tilde_word, *expansion;
|
||||
int len;
|
||||
|
||||
/* Make START point to the tilde which starts the expansion. */
|
||||
start = tilde_find_prefix (string, &len);
|
||||
|
||||
/* Copy the skipped text into the result. */
|
||||
if ((result_index + start + 1) > result_size)
|
||||
result = (char *)xrealloc (result, 1 + (result_size += (start + 20)));
|
||||
|
||||
strncpy (result + result_index, string, start);
|
||||
result_index += start;
|
||||
|
||||
/* Advance STRING to the starting tilde. */
|
||||
string += start;
|
||||
|
||||
/* Make END be the index of one after the last character of the
|
||||
username. */
|
||||
end = tilde_find_suffix (string);
|
||||
|
||||
/* If both START and END are zero, we are all done. */
|
||||
if (!start && !end)
|
||||
break;
|
||||
|
||||
/* Expand the entire tilde word, and copy it into RESULT. */
|
||||
tilde_word = (char *)xmalloc (1 + end);
|
||||
strncpy (tilde_word, string, end);
|
||||
tilde_word[end] = '\0';
|
||||
string += end;
|
||||
|
||||
expansion = tilde_expand_word (tilde_word);
|
||||
free (tilde_word);
|
||||
|
||||
len = strlen (expansion);
|
||||
if ((result_index + len + 1) > result_size)
|
||||
result = (char *)xrealloc (result, 1 + (result_size += (len + 20)));
|
||||
|
||||
strcpy (result + result_index, expansion);
|
||||
result_index += len;
|
||||
free (expansion);
|
||||
}
|
||||
|
||||
result[result_index] = '\0';
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* 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 (char *filename)
|
||||
{
|
||||
char *dirname = filename ? xstrdup (filename) : NULL;
|
||||
|
||||
if (dirname && *dirname == '~')
|
||||
{
|
||||
char *temp_name;
|
||||
if (!dirname[1] || IS_SLASH (dirname[1]))
|
||||
{
|
||||
/* Prepend $HOME to the rest of the string. */
|
||||
char *temp_home = getenv ("HOME");
|
||||
|
||||
/* If there is no HOME variable, look up the directory in
|
||||
the password database. */
|
||||
if (!temp_home)
|
||||
{
|
||||
struct passwd *entry;
|
||||
|
||||
entry = (struct passwd *) getpwuid (getuid ());
|
||||
if (entry)
|
||||
temp_home = entry->pw_dir;
|
||||
}
|
||||
|
||||
temp_name = xmalloc (1 + strlen (&dirname[1])
|
||||
+ (temp_home ? strlen (temp_home) : 0));
|
||||
if (temp_home)
|
||||
strcpy (temp_name, temp_home);
|
||||
else
|
||||
temp_name[0] = 0;
|
||||
strcat (temp_name, &dirname[1]);
|
||||
free (dirname);
|
||||
dirname = xstrdup (temp_name);
|
||||
free (temp_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct passwd *user_entry;
|
||||
char *username = xmalloc (257);
|
||||
int i, c;
|
||||
|
||||
for (i = 1; (c = dirname[i]); i++)
|
||||
{
|
||||
if (IS_SLASH (c))
|
||||
break;
|
||||
else
|
||||
username[i - 1] = c;
|
||||
}
|
||||
username[i - 1] = 0;
|
||||
|
||||
if (!(user_entry = (struct passwd *) getpwnam (username)))
|
||||
{
|
||||
/* If the calling program has a special syntax for
|
||||
expanding tildes, and we couldn't find a standard
|
||||
expansion, then let them try. */
|
||||
if (tilde_expansion_failure_hook)
|
||||
{
|
||||
char *expansion = (*tilde_expansion_failure_hook) (username);
|
||||
|
||||
if (expansion)
|
||||
{
|
||||
temp_name = xmalloc (1 + strlen (expansion)
|
||||
+ strlen (&dirname[i]));
|
||||
strcpy (temp_name, expansion);
|
||||
strcat (temp_name, &dirname[i]);
|
||||
free (expansion);
|
||||
goto return_name;
|
||||
}
|
||||
}
|
||||
/* We shouldn't report errors. */
|
||||
}
|
||||
else
|
||||
{
|
||||
temp_name = xmalloc (1 + strlen (user_entry->pw_dir)
|
||||
+ strlen (&dirname[i]));
|
||||
strcpy (temp_name, user_entry->pw_dir);
|
||||
strcat (temp_name, &dirname[i]);
|
||||
|
||||
return_name:
|
||||
free (dirname);
|
||||
dirname = xstrdup (temp_name);
|
||||
free (temp_name);
|
||||
}
|
||||
|
||||
endpwent ();
|
||||
free (username);
|
||||
}
|
||||
}
|
||||
return dirname;
|
||||
}
|
||||
|
||||
|
||||
#if defined (TEST)
|
||||
#undef NULL
|
||||
#include <stdio.h>
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *result, line[512];
|
||||
int done = 0;
|
||||
|
||||
while (!done)
|
||||
{
|
||||
printf ("~expand: ");
|
||||
fflush (stdout);
|
||||
|
||||
if (!gets (line))
|
||||
strcpy (line, "done");
|
||||
|
||||
if ((strcmp (line, "done") == 0) ||
|
||||
(strcmp (line, "quit") == 0) ||
|
||||
(strcmp (line, "exit") == 0))
|
||||
{
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
result = tilde_expand (line);
|
||||
printf (" --> %s\n", result);
|
||||
free (result);
|
||||
}
|
||||
xexit (0);
|
||||
}
|
||||
|
||||
static void memory_error_and_abort ();
|
||||
|
||||
static void *
|
||||
xmalloc (bytes)
|
||||
int bytes;
|
||||
{
|
||||
void *temp = (void *)malloc (bytes);
|
||||
|
||||
if (!temp)
|
||||
memory_error_and_abort ();
|
||||
return (temp);
|
||||
}
|
||||
|
||||
static void *
|
||||
xrealloc (pointer, bytes)
|
||||
void *pointer;
|
||||
int bytes;
|
||||
{
|
||||
void *temp;
|
||||
|
||||
if (!pointer)
|
||||
temp = (char *)malloc (bytes);
|
||||
else
|
||||
temp = (char *)realloc (pointer, bytes);
|
||||
|
||||
if (!temp)
|
||||
memory_error_and_abort ();
|
||||
|
||||
return (temp);
|
||||
}
|
||||
|
||||
static void
|
||||
memory_error_and_abort ()
|
||||
{
|
||||
fprintf (stderr, _("readline: Out of virtual memory!\n"));
|
||||
abort ();
|
||||
}
|
||||
#endif /* TEST */
|
||||
|
@ -1,54 +0,0 @@
|
||||
/* 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, 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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef TILDE_H
|
||||
#define TILDE_H
|
||||
|
||||
#include "info.h"
|
||||
|
||||
/* If non-null, this contains the address of a function to call if the
|
||||
standard meaning for expanding a tilde fails. The function is called
|
||||
with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
|
||||
which is the expansion, or a NULL pointer if there is no expansion. */
|
||||
extern CFunction *tilde_expansion_failure_hook;
|
||||
|
||||
/* When non-null, this is a NULL terminated array of strings which
|
||||
are duplicates for a tilde prefix. Bash uses this to expand
|
||||
`=~' and `:~'. */
|
||||
extern char **tilde_additional_prefixes;
|
||||
|
||||
/* When non-null, this is a NULL terminated array of strings which match
|
||||
the end of a username, instead of just "/". Bash sets this to
|
||||
`:' and `=~'. */
|
||||
extern char **tilde_additional_suffixes;
|
||||
|
||||
/* Return a new string which is the result of tilde expanding STRING. */
|
||||
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 (char *filename);
|
||||
|
||||
#endif /* not TILDE_H */
|
@ -1,305 +0,0 @@
|
||||
/* variables.c -- how to manipulate user visible variables in Info.
|
||||
$Id: variables.c,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include "info.h"
|
||||
#include "variables.h"
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* User Visible Variables in Info */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Choices used by the completer when reading a zero/non-zero value for
|
||||
a variable. */
|
||||
static char *on_off_choices[] = { "Off", "On", (char *)NULL };
|
||||
|
||||
VARIABLE_ALIST info_variables[] = {
|
||||
{ "automatic-footnotes",
|
||||
N_("When \"On\", footnotes appear and disappear automatically"),
|
||||
&auto_footnotes_p, (char **)on_off_choices },
|
||||
|
||||
{ "automatic-tiling",
|
||||
N_("When \"On\", creating or deleting a window resizes other windows"),
|
||||
&auto_tiling_p, (char **)on_off_choices },
|
||||
|
||||
{ "visible-bell",
|
||||
N_("When \"On\", flash the screen instead of ringing the bell"),
|
||||
&terminal_use_visible_bell_p, (char **)on_off_choices },
|
||||
|
||||
{ "errors-ring-bell",
|
||||
N_("When \"On\", errors cause the bell to ring"),
|
||||
&info_error_rings_bell_p, (char **)on_off_choices },
|
||||
|
||||
{ "gc-compressed-files",
|
||||
N_("When \"On\", Info garbage collects files which had to be uncompressed"),
|
||||
&gc_compressed_files, (char **)on_off_choices },
|
||||
{ "show-index-match",
|
||||
N_("When \"On\", the portion of the matched search string is highlighted"),
|
||||
&show_index_match, (char **)on_off_choices },
|
||||
|
||||
{ "scroll-behaviour",
|
||||
N_("Controls what happens when scrolling is requested at the end of a node"),
|
||||
&info_scroll_behaviour, (char **)info_scroll_choices },
|
||||
|
||||
{ "scroll-step",
|
||||
N_("The number lines to scroll when the cursor moves out of the window"),
|
||||
&window_scroll_step, (char **)NULL },
|
||||
|
||||
{ "ISO-Latin",
|
||||
N_("When \"On\", Info accepts and displays ISO Latin characters"),
|
||||
&ISO_Latin_p, (char **)on_off_choices },
|
||||
|
||||
{ (char *)NULL, (char *)NULL, (int *)NULL, (char **)NULL }
|
||||
};
|
||||
|
||||
DECLARE_INFO_COMMAND (describe_variable, _("Explain the use of a variable"))
|
||||
{
|
||||
VARIABLE_ALIST *var;
|
||||
char *description;
|
||||
|
||||
/* Get the variable's name. */
|
||||
var = read_variable_name ((char *) _("Describe variable: "), window);
|
||||
|
||||
if (!var)
|
||||
return;
|
||||
|
||||
description = (char *)xmalloc (20 + strlen (var->name)
|
||||
+ strlen (_(var->doc)));
|
||||
|
||||
if (var->choices)
|
||||
sprintf (description, "%s (%s): %s.",
|
||||
var->name, var->choices[*(var->value)], _(var->doc));
|
||||
else
|
||||
sprintf (description, "%s (%d): %s.",
|
||||
var->name, *(var->value), _(var->doc));
|
||||
|
||||
window_message_in_echo_area ("%s", description, NULL);
|
||||
free (description);
|
||||
}
|
||||
|
||||
DECLARE_INFO_COMMAND (set_variable, _("Set the value of an Info variable"))
|
||||
{
|
||||
VARIABLE_ALIST *var;
|
||||
char *line;
|
||||
|
||||
/* Get the variable's name and value. */
|
||||
var = read_variable_name ((char *) _("Set variable: "), window);
|
||||
|
||||
if (!var)
|
||||
return;
|
||||
|
||||
/* Read a new value for this variable. */
|
||||
{
|
||||
char prompt[100];
|
||||
|
||||
if (!var->choices)
|
||||
{
|
||||
int potential_value;
|
||||
|
||||
if (info_explicit_arg || count != 1)
|
||||
potential_value = count;
|
||||
else
|
||||
potential_value = *(var->value);
|
||||
|
||||
sprintf (prompt, _("Set %s to value (%d): "),
|
||||
var->name, potential_value);
|
||||
line = info_read_in_echo_area (active_window, prompt);
|
||||
|
||||
/* If no error was printed, clear the echo area. */
|
||||
if (!info_error_was_printed)
|
||||
window_clear_echo_area ();
|
||||
|
||||
/* User aborted? */
|
||||
if (!line)
|
||||
return;
|
||||
|
||||
/* If the user specified a value, get that, otherwise, we are done. */
|
||||
canonicalize_whitespace (line);
|
||||
if (*line)
|
||||
*(var->value) = atoi (line);
|
||||
else
|
||||
*(var->value) = potential_value;
|
||||
|
||||
free (line);
|
||||
}
|
||||
else
|
||||
{
|
||||
register int i;
|
||||
REFERENCE **array = (REFERENCE **)NULL;
|
||||
int array_index = 0;
|
||||
int array_slots = 0;
|
||||
|
||||
for (i = 0; var->choices[i]; i++)
|
||||
{
|
||||
REFERENCE *entry;
|
||||
|
||||
entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
|
||||
entry->label = xstrdup (var->choices[i]);
|
||||
entry->nodename = (char *)NULL;
|
||||
entry->filename = (char *)NULL;
|
||||
|
||||
add_pointer_to_array
|
||||
(entry, array_index, array, array_slots, 10, REFERENCE *);
|
||||
}
|
||||
|
||||
sprintf (prompt, _("Set %s to value (%s): "),
|
||||
var->name, var->choices[*(var->value)]);
|
||||
|
||||
/* Ask the completer to read a variable value for us. */
|
||||
line = info_read_completing_in_echo_area (window, prompt, array);
|
||||
|
||||
info_free_references (array);
|
||||
|
||||
if (!echo_area_is_active)
|
||||
window_clear_echo_area ();
|
||||
|
||||
/* User aborted? */
|
||||
if (!line)
|
||||
{
|
||||
info_abort_key (active_window, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
/* User accepted default choice? If so, no change. */
|
||||
if (!*line)
|
||||
{
|
||||
free (line);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Find the choice in our list of choices. */
|
||||
for (i = 0; var->choices[i]; i++)
|
||||
if (strcmp (var->choices[i], line) == 0)
|
||||
break;
|
||||
|
||||
if (var->choices[i])
|
||||
*(var->value) = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
VARIABLE_ALIST *
|
||||
read_variable_name (char *prompt, WINDOW *window)
|
||||
{
|
||||
register int i;
|
||||
char *line;
|
||||
REFERENCE **variables;
|
||||
|
||||
/* Get the completion array of variable names. */
|
||||
variables = make_variable_completions_array ();
|
||||
|
||||
/* Ask the completer to read a variable for us. */
|
||||
line =
|
||||
info_read_completing_in_echo_area (window, prompt, variables);
|
||||
|
||||
info_free_references (variables);
|
||||
|
||||
if (!echo_area_is_active)
|
||||
window_clear_echo_area ();
|
||||
|
||||
/* User aborted? */
|
||||
if (!line)
|
||||
{
|
||||
info_abort_key (active_window, 0, 0);
|
||||
return ((VARIABLE_ALIST *)NULL);
|
||||
}
|
||||
|
||||
/* User accepted "default"? (There is none.) */
|
||||
if (!*line)
|
||||
{
|
||||
free (line);
|
||||
return ((VARIABLE_ALIST *)NULL);
|
||||
}
|
||||
|
||||
/* Find the variable in our list of variables. */
|
||||
for (i = 0; info_variables[i].name; i++)
|
||||
if (strcmp (info_variables[i].name, line) == 0)
|
||||
break;
|
||||
|
||||
if (!info_variables[i].name)
|
||||
return ((VARIABLE_ALIST *)NULL);
|
||||
else
|
||||
return (&(info_variables[i]));
|
||||
}
|
||||
|
||||
/* Make an array of REFERENCE which actually contains the names of the
|
||||
variables available in Info. */
|
||||
REFERENCE **
|
||||
make_variable_completions_array (void)
|
||||
{
|
||||
register int i;
|
||||
REFERENCE **array = (REFERENCE **)NULL;
|
||||
int array_index = 0, array_slots = 0;
|
||||
|
||||
for (i = 0; info_variables[i].name; i++)
|
||||
{
|
||||
REFERENCE *entry;
|
||||
|
||||
entry = (REFERENCE *) xmalloc (sizeof (REFERENCE));
|
||||
entry->label = xstrdup (info_variables[i].name);
|
||||
entry->nodename = (char *)NULL;
|
||||
entry->filename = (char *)NULL;
|
||||
|
||||
add_pointer_to_array
|
||||
(entry, array_index, array, array_slots, 200, REFERENCE *);
|
||||
}
|
||||
|
||||
return (array);
|
||||
}
|
||||
|
||||
#if defined(INFOKEY)
|
||||
|
||||
void
|
||||
set_variable_to_value(char *name, char *value)
|
||||
{
|
||||
register int i;
|
||||
|
||||
/* Find the variable in our list of variables. */
|
||||
for (i = 0; info_variables[i].name; i++)
|
||||
if (strcmp(info_variables[i].name, name) == 0)
|
||||
break;
|
||||
|
||||
if (!info_variables[i].name)
|
||||
return;
|
||||
|
||||
if (info_variables[i].choices)
|
||||
{
|
||||
register int j;
|
||||
|
||||
/* Find the choice in our list of choices. */
|
||||
for (j = 0; info_variables[i].choices[j]; j++)
|
||||
if (strcmp (info_variables[i].choices[j], value) == 0)
|
||||
break;
|
||||
|
||||
if (info_variables[i].choices[j])
|
||||
*info_variables[i].value = j;
|
||||
}
|
||||
else
|
||||
{
|
||||
*info_variables[i].value = atoi(value);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* INFOKEY */
|
@ -1,66 +0,0 @@
|
||||
/* variables.h -- Description of user visible variables in Info.
|
||||
$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, 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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_VARIABLES_H
|
||||
#define INFO_VARIABLES_H
|
||||
|
||||
/* A variable (in the Info sense) is an integer value with a user-visible
|
||||
name. You may supply an array of strings to complete over when the
|
||||
variable is set; in that case, the variable is set to the index of the
|
||||
string that the user chose. If you supply a null list, the user can
|
||||
set the variable to a numeric value. */
|
||||
|
||||
/* Structure describing a user visible variable. */
|
||||
typedef struct {
|
||||
char *name; /* Polite name. */
|
||||
char *doc; /* Documentation string. */
|
||||
int *value; /* Address of value. */
|
||||
char **choices; /* Array of strings or NULL if numeric only. */
|
||||
} VARIABLE_ALIST;
|
||||
|
||||
/* 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 (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 (void);
|
||||
|
||||
/* Set the value of an info 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;
|
||||
extern int auto_tiling_p;
|
||||
extern int terminal_use_visible_bell_p;
|
||||
extern int info_error_rings_bell_p;
|
||||
extern int gc_compressed_files;
|
||||
extern int show_index_match;
|
||||
extern int info_scroll_behaviour;
|
||||
extern int window_scroll_step;
|
||||
extern int ISO_Latin_p;
|
||||
|
||||
#endif /* not INFO_VARIABLES_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,241 +0,0 @@
|
||||
/* window.h -- Structure and flags used in manipulating Info windows.
|
||||
$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, 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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#ifndef INFO_WINDOW_H
|
||||
#define INFO_WINDOW_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. */
|
||||
#define WINDOW_MIN_HEIGHT 2
|
||||
|
||||
/* Smallest number of screen lines that can be used to fully present a
|
||||
window. This number includes the modeline of the window. */
|
||||
#define WINDOW_MIN_SIZE (WINDOW_MIN_HEIGHT + 1)
|
||||
|
||||
/* The exact same elements are used within the WINDOW_STATE structure and a
|
||||
subsection of the WINDOW structure. We could define a structure which
|
||||
contains this elements, and include that structure in each of WINDOW_STATE
|
||||
and WINDOW. But that would lead references in the code such as
|
||||
window->state->node which we would like to avoid. Instead, we #define the
|
||||
elements here, and simply include the define in both data structures. Thus,
|
||||
if you need to change window state information, here is where you would
|
||||
do it. NB> The last element does NOT end with a semi-colon. */
|
||||
#define WINDOW_STATE_DECL \
|
||||
NODE *node; /* The node displayed in this window. */ \
|
||||
int pagetop; /* LINE_STARTS[PAGETOP] is first line in WINDOW. */ \
|
||||
long point /* Offset within NODE of the cursor position. */
|
||||
|
||||
/* Structure which defines a window. Windows are doubly linked, next
|
||||
and prev. The list of windows is kept on WINDOWS. The structure member
|
||||
window->height is the total height of the window. The position location
|
||||
(0, window->height + window->first_row) is the first character of this
|
||||
windows modeline. The number of lines that can be displayed in a window
|
||||
is equal to window->height - 1. */
|
||||
typedef struct window_struct
|
||||
{
|
||||
struct window_struct *next; /* Next window in this chain. */
|
||||
struct window_struct *prev; /* Previous window in this chain. */
|
||||
int width; /* Width of this window. */
|
||||
int height; /* Height of this window. */
|
||||
int first_row; /* Offset of the first line in the_screen. */
|
||||
int goal_column; /* The column we would like the cursor to appear in. */
|
||||
Keymap keymap; /* Keymap used to read commands in this window. */
|
||||
WINDOW_STATE_DECL; /* Node, pagetop and point. */
|
||||
char *modeline; /* Calculated text of the modeline for this window. */
|
||||
char **line_starts; /* Array of printed line starts for this node. */
|
||||
int line_count; /* Number of lines appearing in LINE_STARTS. */
|
||||
int flags; /* See below for details. */
|
||||
} WINDOW;
|
||||
|
||||
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. */
|
||||
#define W_InhibitMode 0x08 /* This WINDOW has no modeline. */
|
||||
#define W_NoWrap 0x10 /* Lines do not wrap in this window. */
|
||||
#define W_InputWindow 0x20 /* Window accepts input. */
|
||||
#define W_TempWindow 0x40 /* Window is less important. */
|
||||
|
||||
extern WINDOW *windows; /* List of visible Info windows. */
|
||||
extern WINDOW *active_window; /* The currently active window. */
|
||||
extern WINDOW *the_screen; /* The Info screen is just another window. */
|
||||
extern WINDOW *the_echo_area; /* THE_ECHO_AREA is a window in THE_SCREEN. */
|
||||
|
||||
/* Global variable control redisplay of scrolled windows. If non-zero, it
|
||||
is the desired number of lines to scroll the window in order to make
|
||||
point visible. A user might set this to 1 for smooth scrolling. If
|
||||
set to zero, the line containing point is centered within the window. */
|
||||
extern int window_scroll_step;
|
||||
|
||||
/* Make the modeline member for WINDOW. */
|
||||
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 (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 (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 (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
|
||||
as an argument, and it can't do anything about the window getting deleted;
|
||||
it can only clean up dangling references to that window. */
|
||||
extern VFunction *window_deletion_notifier;
|
||||
|
||||
/* Set WINDOW to display NODE. */
|
||||
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 (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 (WINDOW *window, int amount);
|
||||
|
||||
/* Adjust the pagetop of WINDOW such that the cursor point will be visible. */
|
||||
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 (int style);
|
||||
|
||||
/* Toggle the state of line wrapping in WINDOW. This can do a bit of fancy
|
||||
redisplay. */
|
||||
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 (WINDOW *chain, int flag);
|
||||
|
||||
/* For every window in CHAIN, clear the flags member of FLAG. */
|
||||
extern void window_unmark_chain (WINDOW *chain, int flag);
|
||||
|
||||
/* Make WINDOW start displaying at PERCENT percentage of its node. */
|
||||
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 (char *format, void *arg1, void *arg2);
|
||||
|
||||
/* Useful functions can be called from outside of window.c. */
|
||||
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 (char *format, void *arg1, void *arg2,
|
||||
void *arg3);
|
||||
|
||||
/* Convert the contents of the message buffer to a 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 (void);
|
||||
|
||||
/* Pad STRING to COUNT characters by inserting blanks. */
|
||||
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 (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 (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 (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 (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 (WINDOW *window);
|
||||
|
||||
/* Given WINDOW, recalculate the line starts for the node it displays. */
|
||||
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 (int character, int hpos);
|
||||
|
||||
/* Return the number of characters it takes to display STRING on the
|
||||
screen at HPOS. */
|
||||
extern int string_width (char *string, int hpos);
|
||||
|
||||
/* Return the index of the line containing point. */
|
||||
extern int window_line_of_point (WINDOW *window);
|
||||
|
||||
/* Get and return the goal column for this window. */
|
||||
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 (WINDOW *window);
|
||||
|
||||
/* Get and Set the node, pagetop, and point of WINDOW. */
|
||||
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 (char *line, int goal);
|
||||
|
||||
#endif /* not INFO_WINDOW_H */
|
@ -1,13 +0,0 @@
|
||||
$Id: README,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
texinfo/lib/README
|
||||
|
||||
Copyright (C) 2002 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.
|
||||
|
||||
Common routines for the Texinfo programs.
|
||||
|
||||
Many are common to other GNU packages as well.
|
||||
See the gnulib project at savannah: http://savannah.gnu.org/projects/gnulib
|
@ -1,68 +0,0 @@
|
||||
/* 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 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 _LIBGETTEXT_H
|
||||
#define _LIBGETTEXT_H 1
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option. */
|
||||
#if ENABLE_NLS
|
||||
|
||||
/* Get declarations of GNU message catalog functions. */
|
||||
# include <libintl.h>
|
||||
|
||||
#else
|
||||
|
||||
/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
|
||||
chokes if dcgettext is defined as a macro. So include it now, to make
|
||||
later inclusions of <locale.h> a NOP. We don't include <libintl.h>
|
||||
as well because people using "gettext.h" will not include <libintl.h>,
|
||||
and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
|
||||
is OK. */
|
||||
#if defined(__sun)
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
/* Disabled NLS.
|
||||
The casts to 'const char *' serve the purpose of producing warnings
|
||||
for invalid uses of the value returned from these functions.
|
||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
||||
contain "#define const". */
|
||||
# define gettext(Msgid) ((const char *) (Msgid))
|
||||
# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
|
||||
# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
||||
# define textdomain(Domainname) ((const char *) (Domainname))
|
||||
# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
|
||||
# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
|
||||
|
||||
#endif
|
||||
|
||||
/* A pseudo function call that serves as a marker for the automated
|
||||
extraction of messages, but does not call gettext(). The run-time
|
||||
translation is done at a different place in the code.
|
||||
The argument, String, should be a literal string. Concatenated strings
|
||||
and other string expressions won't work.
|
||||
The macro's expansion is not parenthesized, so that it is suitable as
|
||||
initializer for static 'char[]' or 'const char[]' variables. */
|
||||
#define gettext_noop(String) String
|
||||
|
||||
#endif /* _LIBGETTEXT_H */
|
@ -1,35 +0,0 @@
|
||||
/* substring.c -- extract substring.
|
||||
$Id: substring.c,v 1.2 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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. */
|
||||
|
||||
#include "system.h"
|
||||
|
||||
char *
|
||||
substring (const char *start, const char *end)
|
||||
{
|
||||
char *result = xmalloc (end - start + 1);
|
||||
char *scan_result = result;
|
||||
const char *scan = start;
|
||||
|
||||
while (scan < end)
|
||||
*scan_result++ = *scan++;
|
||||
|
||||
*scan_result = 0;
|
||||
return result;
|
||||
}
|
||||
|
@ -1,291 +0,0 @@
|
||||
/* system.h: system-dependent declarations; include this first.
|
||||
$Id: system.h,v 1.12 2004/04/26 13:56:57 karl Exp $
|
||||
|
||||
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
|
||||
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 TEXINFO_SYSTEM_H
|
||||
#define TEXINFO_SYSTEM_H
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef MIKTEX
|
||||
#include <gnu-miktex.h>
|
||||
#define S_ISDIR(x) ((x)&_S_IFDIR)
|
||||
#else
|
||||
/* 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 (const char *, const char *);
|
||||
#endif
|
||||
|
||||
/* 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>
|
||||
|
||||
/* All systems nowadays probably have these functions, but ... */
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#ifndef HAVE_SETLOCALE
|
||||
#define setlocale(category,locale) /* empty */
|
||||
#endif
|
||||
|
||||
/* For gettext (NLS). */
|
||||
#define const
|
||||
#include "gettext.h"
|
||||
#undef const
|
||||
|
||||
#define _(String) gettext (String)
|
||||
#define N_(String) (String)
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#define getopt system_getopt
|
||||
#include <stdlib.h>
|
||||
#undef getopt
|
||||
#else
|
||||
extern char *getenv ();
|
||||
#endif
|
||||
|
||||
/* Don't use bcopy! Use memmove if source and destination may overlap,
|
||||
memcpy otherwise. */
|
||||
#if HAVE_STRING_H
|
||||
# if !STDC_HEADERS && HAVE_MEMORY_H
|
||||
# include <memory.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
#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;
|
||||
#endif
|
||||
#ifdef VMS
|
||||
#include <perror.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL_STRERROR
|
||||
extern char *strerror ();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#ifndef PATH_MAX
|
||||
#ifndef _POSIX_PATH_MAX
|
||||
# define _POSIX_PATH_MAX 255
|
||||
#endif
|
||||
#define PATH_MAX _POSIX_PATH_MAX
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL_STRCASECMP
|
||||
extern int strcasecmp ();
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL_STRNCASECMP
|
||||
extern int strncasecmp ();
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL_STRCOLL
|
||||
extern int strcoll ();
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#if STAT_MACROS_BROKEN
|
||||
# undef S_ISDIR
|
||||
#endif
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif /* HAVE_SYS_FILE_H */
|
||||
|
||||
#ifndef O_RDONLY
|
||||
/* Since <fcntl.h> is POSIX, prefer that to <sys/fcntl.h>.
|
||||
This also avoids some useless warnings on (at least) Linux. */
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#else /* not HAVE_FCNTL_H */
|
||||
#ifdef HAVE_SYS_FCNTL_H
|
||||
#include <sys/fcntl.h>
|
||||
#endif /* not HAVE_SYS_FCNTL_H */
|
||||
#endif /* not HAVE_FCNTL_H */
|
||||
#endif /* not O_RDONLY */
|
||||
|
||||
/* MS-DOS and similar non-Posix systems have some peculiarities:
|
||||
- they distinguish between binary and text files;
|
||||
- they use both `/' and `\\' as directory separator in file names;
|
||||
- they can have a drive letter X: prepended to a file name;
|
||||
- they have a separate root directory on each drive;
|
||||
- their filesystems are case-insensitive;
|
||||
- directories in environment variables (like INFOPATH) are separated
|
||||
by `;' rather than `:';
|
||||
- text files can have their lines ended either with \n or with \r\n pairs;
|
||||
These are all parameterized here except the last, which is
|
||||
handled by the source code as appropriate (mostly, in info/). */
|
||||
#ifndef O_BINARY
|
||||
# ifdef _O_BINARY
|
||||
# define O_BINARY _O_BINARY
|
||||
# else
|
||||
# define O_BINARY 0
|
||||
# endif
|
||||
#endif /* O_BINARY */
|
||||
|
||||
/* We'd like to take advantage of _doprnt if it's around, a la error.c,
|
||||
but then we'd have no VA_SPRINTF. */
|
||||
#if HAVE_VPRINTF
|
||||
# if __STDC__
|
||||
# include <stdarg.h>
|
||||
# define VA_START(args, lastarg) va_start(args, lastarg)
|
||||
# else
|
||||
# include <varargs.h>
|
||||
# define VA_START(args, lastarg) va_start(args)
|
||||
# endif
|
||||
# define VA_FPRINTF(file, fmt, ap) vfprintf (file, fmt, ap)
|
||||
# define VA_SPRINTF(str, fmt, ap) vsprintf (str, fmt, ap)
|
||||
#else /* not HAVE_VPRINTF */
|
||||
# define VA_START(args, lastarg)
|
||||
# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
|
||||
# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
|
||||
# define va_end(args)
|
||||
#endif
|
||||
|
||||
#if O_BINARY
|
||||
# ifdef HAVE_IO_H
|
||||
# include <io.h>
|
||||
# endif
|
||||
# ifdef __MSDOS__
|
||||
# include <limits.h>
|
||||
# ifdef __DJGPP__
|
||||
# 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;."
|
||||
/* 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 /* O_BINARY && !__DJGPP__ */
|
||||
# define SET_SCREEN_SIZE_HELPER terminal_prep_terminal()
|
||||
# define DEFAULT_INFO_PRINT_COMMAND ">PRN"
|
||||
# else /* O_BINARY && !__MSDOS__ */
|
||||
# define setmode(f,m) _setmode(f,m)
|
||||
# define HAVE_LONG_FILENAMES(dir) (1)
|
||||
# define NULL_DEVICE "NUL"
|
||||
# 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 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
|
||||
# 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"
|
||||
# define IS_SLASH(c) ((c) == '/')
|
||||
# define HAVE_DRIVE(n) (0)
|
||||
# define IS_ABSOLUTE(n) ((n)[0] == '/')
|
||||
# define FILENAME_CMP strcmp
|
||||
# define FILENAME_CMPN strncmp
|
||||
# define HAVE_LONG_FILENAMES(dir) (1)
|
||||
# define PATH_SEP ":"
|
||||
# define STRIP_DOT_EXE 0
|
||||
# ifdef VMS
|
||||
# define DEFAULT_TMPDIR "sys$scratch:"
|
||||
# else
|
||||
# define DEFAULT_TMPDIR "/tmp/"
|
||||
# endif
|
||||
# define NULL_DEVICE "/dev/null"
|
||||
# define PIPE_USE_FORK 1
|
||||
#endif /* not O_BINARY */
|
||||
|
||||
/* Everything but DJGPP. */
|
||||
#ifndef ALSO_NULL_DEVICE
|
||||
# define ALSO_NULL_DEVICE ""
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
/* Some systems don't declare this function in pwd.h. */
|
||||
struct passwd *getpwnam (const char *name);
|
||||
|
||||
/* Our library routines not included in any system library. */
|
||||
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. */
|
||||
#ifdef MIN
|
||||
#undef MIN
|
||||
#endif
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#ifdef MAX
|
||||
#undef MAX
|
||||
#endif
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
#endif /* TEXINFO_SYSTEM_H */
|
@ -1,90 +0,0 @@
|
||||
/* xalloc.h -- malloc with out-of-memory checking
|
||||
|
||||
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
|
||||
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 XALLOC_H_
|
||||
# define XALLOC_H_
|
||||
|
||||
# include <stddef.h>
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
|
||||
# ifndef __attribute__
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
|
||||
# define __attribute__(x)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef ATTRIBUTE_NORETURN
|
||||
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
|
||||
# endif
|
||||
|
||||
/* 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 (void) ATTRIBUTE_NORETURN;
|
||||
|
||||
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);
|
||||
|
||||
/* 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.
|
||||
|
||||
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))
|
||||
|
||||
/* 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)
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
|
||||
#endif /* !XALLOC_H_ */
|
@ -1,87 +0,0 @@
|
||||
/* xexit.c -- exit with attention to return values and closing stdout.
|
||||
$Id: xexit.c,v 1.5 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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. */
|
||||
|
||||
#include "system.h"
|
||||
|
||||
/* SunOS 4.1.1 gets STDC_HEADERS defined, but it doesn't provide
|
||||
EXIT_FAILURE. So far no system has defined one of EXIT_FAILURE and
|
||||
EXIT_SUCCESS without the other. */
|
||||
#ifdef EXIT_SUCCESS
|
||||
/* The following test is to work around the gross typo in
|
||||
systems like Sony NEWS-OS Release 4.0C, whereby EXIT_FAILURE
|
||||
is defined to 0, not 1. */
|
||||
# if !EXIT_FAILURE
|
||||
# undef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 1
|
||||
# endif
|
||||
#else /* not EXIT_SUCCESS */
|
||||
# ifdef VMS /* these values suppress some messages; from gnuplot */
|
||||
# define EXIT_SUCCESS 1
|
||||
# define EXIT_FAILURE 0x10000002
|
||||
# else /* not VMS */
|
||||
# define EXIT_SUCCESS 0
|
||||
# define EXIT_FAILURE 1
|
||||
# endif /* not VMS */
|
||||
#endif /* not EXIT_SUCCESS */
|
||||
|
||||
|
||||
/* Flush stdout first, exit if failure (therefore, xexit should be
|
||||
called to exit every program, not just `return' from main).
|
||||
Otherwise, if EXIT_STATUS is zero, exit successfully, else
|
||||
unsuccessfully. */
|
||||
|
||||
void
|
||||
xexit (int exit_status)
|
||||
{
|
||||
if (ferror (stdout))
|
||||
{
|
||||
fputs (_("ferror on stdout\n"), stderr);
|
||||
exit_status = 1;
|
||||
}
|
||||
else if (fflush (stdout) != 0)
|
||||
{
|
||||
fputs (_("fflush error on stdout\n"), stderr);
|
||||
exit_status = 1;
|
||||
}
|
||||
|
||||
exit_status = exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
|
||||
exit (exit_status);
|
||||
}
|
||||
|
||||
|
||||
/* Why do we care about stdout you may ask? Here's why, from Jim
|
||||
Meyering in the lib/closeout.c file. */
|
||||
|
||||
/* If a program writes *anything* to stdout, that program should close
|
||||
stdout and make sure that the close succeeds. Otherwise, suppose that
|
||||
you go to the extreme of checking the return status of every function
|
||||
that does an explicit write to stdout. The last printf can succeed in
|
||||
writing to the internal stream buffer, and yet the fclose(stdout) could
|
||||
still fail (due e.g., to a disk full error) when it tries to write
|
||||
out that buffered data. Thus, you would be left with an incomplete
|
||||
output file and the offending program would exit successfully.
|
||||
|
||||
Besides, it's wasteful to check the return value from every call
|
||||
that writes to stdout -- just let the internal stream state record
|
||||
the failure. That's what the ferror test is checking below.
|
||||
|
||||
It's important to detect such failures and exit nonzero because many
|
||||
tools (most notably `make' and other build-management systems) depend
|
||||
on being able to detect failure in other tools via their exit status. */
|
@ -1,61 +0,0 @@
|
||||
/* xmalloc.c -- safe versions of malloc and realloc.
|
||||
|
||||
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
|
||||
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 Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#if !defined (ALREADY_HAVE_XMALLOC)
|
||||
#include "system.h"
|
||||
|
||||
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 (size_t bytes)
|
||||
{
|
||||
void *temp = malloc (bytes);
|
||||
|
||||
if (!temp)
|
||||
memory_error_and_abort ("xmalloc");
|
||||
return (temp);
|
||||
}
|
||||
|
||||
void *
|
||||
xrealloc (void *pointer, size_t bytes)
|
||||
{
|
||||
void *temp;
|
||||
|
||||
if (!pointer)
|
||||
temp = malloc (bytes);
|
||||
else
|
||||
temp = realloc (pointer, bytes);
|
||||
|
||||
if (!temp)
|
||||
memory_error_and_abort ("xrealloc");
|
||||
|
||||
return (temp);
|
||||
}
|
||||
|
||||
#endif /* !ALREADY_HAVE_XMALLOC */
|
@ -1,33 +0,0 @@
|
||||
/* xstrdup.c -- copy a string with out of memory checking
|
||||
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
|
||||
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. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Specification. */
|
||||
#include "xalloc.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* Return a newly allocated copy of STRING. */
|
||||
|
||||
char *
|
||||
xstrdup (const char *string)
|
||||
{
|
||||
return strcpy (xmalloc (strlen (string) + 1), string);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
$Id: README,v 1.3 2004/04/11 17:56:46 karl Exp $
|
||||
texinfo/makeinfo/README
|
||||
|
||||
Copyright (C) 2002 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.
|
||||
|
||||
makeinfo is a standalone program to convert Texinfo source into Info
|
||||
files readable with standalone info or M-x info in Emacs.
|
||||
|
||||
makeinfo can also output other formats: plain ASCII (with --no-headers)
|
||||
or HTML (with --html) or XML (with --xml).
|
||||
|
||||
The Emacs function M-x texinfo-format-buffer does more or less the same
|
||||
job, but makeinfo is faster and gives better error messages.
|
File diff suppressed because it is too large
Load Diff
@ -1,213 +0,0 @@
|
||||
/* cmds.h -- declarations for cmds.c.
|
||||
$Id: cmds.h,v 1.9 2004/11/26 00:48:35 karl Exp $
|
||||
|
||||
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
|
||||
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 CMDS_H
|
||||
#define CMDS_H
|
||||
|
||||
/* The three arguments a command can get are a flag saying whether it is
|
||||
before argument parsing (START) or after (END), the starting position
|
||||
of the arguments, and the ending position. */
|
||||
typedef void COMMAND_FUNCTION (); /* So we can say COMMAND_FUNCTION *foo; */
|
||||
|
||||
/* Each command has an associated function. When the command is
|
||||
encountered in the text, the associated function is called with START
|
||||
as the argument. If the function expects arguments in braces, it
|
||||
remembers itself on the stack. When the corresponding close brace is
|
||||
encountered, the function is called with END as the argument. */
|
||||
#define START 0
|
||||
#define END 1
|
||||
|
||||
/* Does the command expect braces? */
|
||||
#define NO_BRACE_ARGS 0
|
||||
#define BRACE_ARGS 1
|
||||
#define MAYBE_BRACE_ARGS 2
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
COMMAND_FUNCTION *proc;
|
||||
int argument_in_braces;
|
||||
} COMMAND;
|
||||
|
||||
extern COMMAND command_table[];
|
||||
|
||||
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,720 +0,0 @@
|
||||
/* defun.c -- @defun and friends.
|
||||
$Id: defun.c,v 1.11 2004/04/11 17:56:46 karl Exp $
|
||||
|
||||
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
|
||||
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. */
|
||||
|
||||
#include "system.h"
|
||||
#include "defun.h"
|
||||
#include "xml.h"
|
||||
#include "insertion.h"
|
||||
#include "makeinfo.h"
|
||||
#include "cmds.h"
|
||||
#include "html.h"
|
||||
|
||||
|
||||
#define DEFUN_SELF_DELIMITING(c) \
|
||||
((c) == '(' || (c) == ')' || (c) == '[' || (c) == ']')
|
||||
|
||||
struct token_accumulator
|
||||
{
|
||||
unsigned int length;
|
||||
unsigned int index;
|
||||
char **tokens;
|
||||
};
|
||||
|
||||
static void
|
||||
initialize_token_accumulator (struct token_accumulator *accumulator)
|
||||
{
|
||||
accumulator->length = 0;
|
||||
accumulator->index = 0;
|
||||
accumulator->tokens = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
accumulate_token (struct token_accumulator *accumulator, char *token)
|
||||
{
|
||||
if (accumulator->index >= accumulator->length)
|
||||
{
|
||||
accumulator->length += 10;
|
||||
accumulator->tokens = xrealloc (accumulator->tokens,
|
||||
(accumulator->length * sizeof (char *)));
|
||||
}
|
||||
accumulator->tokens[accumulator->index] = token;
|
||||
accumulator->index += 1;
|
||||
}
|
||||
|
||||
/* 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 (char **string_pointer)
|
||||
{
|
||||
char *scan_string = (*string_pointer) + 1;
|
||||
unsigned int level = 1;
|
||||
int started_command = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int c;
|
||||
if (level == 0)
|
||||
{
|
||||
*string_pointer = scan_string;
|
||||
return 1;
|
||||
}
|
||||
c = *scan_string++;
|
||||
if (c == 0)
|
||||
{
|
||||
/* Tweak line_number to compensate for fact that
|
||||
we gobbled the whole line before coming here. */
|
||||
line_number--;
|
||||
line_error (_("Missing `}' in @def arg"));
|
||||
line_number++;
|
||||
*string_pointer = scan_string - 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (c == '{' && !started_command)
|
||||
level++;
|
||||
if (c == '}' && !started_command)
|
||||
level--;
|
||||
|
||||
/* remember if at @. */
|
||||
started_command = (c == '@' && !started_command);
|
||||
}
|
||||
}
|
||||
|
||||
/* Return a list of tokens from the contents of STRING.
|
||||
Commands and brace-delimited groups count as single tokens.
|
||||
Contiguous whitespace characters are converted to a token
|
||||
consisting of a single space. */
|
||||
static char **
|
||||
args_from_string (char *string)
|
||||
{
|
||||
struct token_accumulator accumulator;
|
||||
char *token_start, *token_end;
|
||||
char *scan_string = string;
|
||||
|
||||
initialize_token_accumulator (&accumulator);
|
||||
|
||||
while (*scan_string)
|
||||
{ /* Replace arbitrary whitespace by a single space. */
|
||||
if (whitespace (*scan_string))
|
||||
{
|
||||
scan_string += 1;
|
||||
while (whitespace (*scan_string))
|
||||
scan_string += 1;
|
||||
accumulate_token ((&accumulator), (xstrdup (" ")));
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Commands count as single tokens. */
|
||||
if (*scan_string == COMMAND_PREFIX)
|
||||
{
|
||||
token_start = scan_string;
|
||||
scan_string += 1;
|
||||
if (self_delimiting (*scan_string))
|
||||
scan_string += 1;
|
||||
else
|
||||
{
|
||||
int c;
|
||||
while (1)
|
||||
{
|
||||
c = *scan_string++;
|
||||
|
||||
if ((c == 0) || (c == '{') || (whitespace (c)))
|
||||
{
|
||||
scan_string -= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (*scan_string == '{')
|
||||
{
|
||||
char *s = scan_string;
|
||||
(void) scan_group_in_string (&s);
|
||||
scan_string = s;
|
||||
}
|
||||
}
|
||||
token_end = scan_string;
|
||||
}
|
||||
|
||||
/* Parentheses and brackets are self-delimiting. */
|
||||
else if (DEFUN_SELF_DELIMITING (*scan_string))
|
||||
{
|
||||
token_start = scan_string;
|
||||
scan_string += 1;
|
||||
token_end = scan_string;
|
||||
}
|
||||
|
||||
/* Open brace introduces a group that is a single token. */
|
||||
else if (*scan_string == '{')
|
||||
{
|
||||
char *s = scan_string;
|
||||
int balanced = scan_group_in_string (&s);
|
||||
|
||||
token_start = scan_string + 1;
|
||||
scan_string = s;
|
||||
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
|
||||
{
|
||||
token_start = scan_string;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = *scan_string++;
|
||||
|
||||
/* Do not back up if we're looking at a }; since the only
|
||||
valid }'s are those matched with {'s, we want to give
|
||||
an error. If we back up, we go into an infinite loop. */
|
||||
if (!c || whitespace (c) || DEFUN_SELF_DELIMITING (c)
|
||||
|| c == '{')
|
||||
{
|
||||
scan_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)
|
||||
{
|
||||
scan_string--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
token_end = scan_string;
|
||||
}
|
||||
|
||||
accumulate_token (&accumulator, substring (token_start, token_end));
|
||||
}
|
||||
accumulate_token (&accumulator, NULL);
|
||||
return accumulator.tokens;
|
||||
}
|
||||
|
||||
static void
|
||||
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++;
|
||||
|
||||
if (defun_arg == NULL)
|
||||
break;
|
||||
|
||||
if (defun_arg[0] == ' ')
|
||||
{
|
||||
pending_space = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pending_space)
|
||||
{
|
||||
add_char (' ');
|
||||
pending_space = 0;
|
||||
}
|
||||
|
||||
if (DEFUN_SELF_DELIMITING (defun_arg[0]))
|
||||
{
|
||||
/* Within @deffn and friends, texinfo.tex makes parentheses
|
||||
sans serif and brackets bold. We use roman instead. */
|
||||
if (html)
|
||||
insert_html_tag (START, "");
|
||||
|
||||
add_char (defun_arg[0]);
|
||||
|
||||
if (html)
|
||||
insert_html_tag (END, "");
|
||||
}
|
||||
/* 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
|
||||
execute_string ("%s", defun_arg);
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
next_nonwhite_defun_arg (char ***arg_pointer)
|
||||
{
|
||||
char **scan = (*arg_pointer);
|
||||
char *arg = (*scan++);
|
||||
|
||||
if ((arg != 0) && (*arg == ' '))
|
||||
arg = *scan++;
|
||||
|
||||
if (arg == 0)
|
||||
scan -= 1;
|
||||
|
||||
*arg_pointer = scan;
|
||||
|
||||
return (arg == 0) ? "" : arg;
|
||||
}
|
||||
|
||||
|
||||
/* This is needed also in insertion.c. */
|
||||
|
||||
enum insertion_type
|
||||
get_base_type (int type)
|
||||
{
|
||||
int base_type;
|
||||
switch (type)
|
||||
{
|
||||
case defivar: base_type = defcv; break;
|
||||
case defmac: base_type = deffn; break;
|
||||
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;
|
||||
case deftypeop: base_type = deftypeop; break;
|
||||
case deftypevar: base_type = deftypevr; break;
|
||||
case defun: base_type = deffn; break;
|
||||
case defvar: base_type = defvr; break;
|
||||
default:
|
||||
base_type = type;
|
||||
break;
|
||||
}
|
||||
|
||||
return base_type;
|
||||
}
|
||||
|
||||
/* Make the defun type insertion.
|
||||
TYPE says which insertion this is.
|
||||
X_P, if nonzero, says not to start a new insertion. */
|
||||
static void
|
||||
defun_internal (int type, int x_p)
|
||||
{
|
||||
int base_type;
|
||||
char **defun_args, **scan_args;
|
||||
const char *category;
|
||||
char *defined_name;
|
||||
char *type_name = NULL;
|
||||
char *type_name2 = NULL;
|
||||
|
||||
{
|
||||
char *line;
|
||||
|
||||
/* The @def.. line is the only place in Texinfo where you are
|
||||
allowed to use unquoted braces that don't delimit arguments of
|
||||
a command or a macro; in any other place it will trigger an
|
||||
error message from the reader loop. The special handling of
|
||||
this case inside `args_from_string' is an extra special hack
|
||||
which allows this. The side effect is that if we try to expand
|
||||
the rest of the line below, the recursive reader loop will
|
||||
signal an error if there are brace-delimited arguments on that line.
|
||||
|
||||
The best solution to this would be to change the syntax of
|
||||
@def.. commands so that it doesn't violate Texinfo's own rules.
|
||||
But it's probably too late for this now, as it will break a lot
|
||||
of existing manuals.
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
scan_args = defun_args;
|
||||
|
||||
/* Get base type and category string. */
|
||||
base_type = get_base_type (type);
|
||||
|
||||
/* xx all these const strings should be determined upon
|
||||
documentlanguage argument and NOT via gettext (kama). */
|
||||
switch (type)
|
||||
{
|
||||
case defun:
|
||||
case deftypefun:
|
||||
category = _("Function");
|
||||
break;
|
||||
case defmac:
|
||||
category = _("Macro");
|
||||
break;
|
||||
case defspec:
|
||||
category = _("Special Form");
|
||||
break;
|
||||
case defvar:
|
||||
case deftypevar:
|
||||
category = _("Variable");
|
||||
break;
|
||||
case defopt:
|
||||
category = _("User Option");
|
||||
break;
|
||||
case defivar:
|
||||
case deftypeivar:
|
||||
category = _("Instance Variable");
|
||||
break;
|
||||
case defmethod:
|
||||
case deftypemethod:
|
||||
category = _("Method");
|
||||
break;
|
||||
default:
|
||||
category = next_nonwhite_defun_arg (&scan_args);
|
||||
break;
|
||||
}
|
||||
|
||||
/* The class name. */
|
||||
if ((base_type == deftypecv)
|
||||
|| (base_type == deftypefn)
|
||||
|| (base_type == deftypevr)
|
||||
|| (base_type == defcv)
|
||||
|| (base_type == defop)
|
||||
|| (base_type == deftypeivar)
|
||||
|| (base_type == deftypemethod)
|
||||
|| (base_type == deftypeop)
|
||||
)
|
||||
type_name = next_nonwhite_defun_arg (&scan_args);
|
||||
|
||||
/* The type name for typed languages. */
|
||||
if ((base_type == deftypecv)
|
||||
|| (base_type == deftypeivar)
|
||||
|| (base_type == deftypemethod)
|
||||
|| (base_type == deftypeop)
|
||||
)
|
||||
type_name2 = next_nonwhite_defun_arg (&scan_args);
|
||||
|
||||
/* The function or whatever that's actually being defined. */
|
||||
defined_name = next_nonwhite_defun_arg (&scan_args);
|
||||
|
||||
/* This hack exists solely for the purposes of formatting the Texinfo
|
||||
manual. I couldn't think of a better way. The token might be a
|
||||
simple @@ followed immediately by more text. If this is the case,
|
||||
then the next defun arg is part of this one, and we should
|
||||
concatenate them. */
|
||||
if (*scan_args && **scan_args && !whitespace (**scan_args)
|
||||
&& STREQ (defined_name, "@@"))
|
||||
{
|
||||
char *tem = xmalloc (3 + strlen (scan_args[0]));
|
||||
|
||||
sprintf (tem, "@@%s", scan_args[0]);
|
||||
|
||||
free (scan_args[0]);
|
||||
scan_args[0] = tem;
|
||||
scan_args++;
|
||||
defined_name = tem;
|
||||
}
|
||||
|
||||
/* It's easy to write @defun foo(arg1 arg2), but a following ( is
|
||||
misparsed by texinfo.tex and this is next to impossible to fix.
|
||||
Warn about it. */
|
||||
if (*scan_args && **scan_args && **scan_args == '(')
|
||||
warning ("`%c' follows defined name `%s' instead of whitespace",
|
||||
**scan_args, defined_name);
|
||||
|
||||
if (!x_p)
|
||||
begin_insertion (type);
|
||||
|
||||
/* Write the definition header line.
|
||||
This should start at the normal indentation. */
|
||||
current_indent -= default_indentation_increment;
|
||||
start_paragraph ();
|
||||
|
||||
if (!html && !xml)
|
||||
switch (base_type)
|
||||
{
|
||||
case deffn:
|
||||
case defvr:
|
||||
case deftp:
|
||||
execute_string (" --- %s: %s", category, defined_name);
|
||||
break;
|
||||
case deftypefn:
|
||||
case deftypevr:
|
||||
execute_string (" --- %s: %s %s", category, type_name, defined_name);
|
||||
break;
|
||||
case defcv:
|
||||
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,
|
||||
type_name2, defined_name);
|
||||
break;
|
||||
case defop:
|
||||
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,
|
||||
type_name2, defined_name);
|
||||
break;
|
||||
case deftypemethod:
|
||||
execute_string (" --- %s %s %s: %s %s", category, _("on"), type_name,
|
||||
type_name2, defined_name);
|
||||
break;
|
||||
}
|
||||
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)
|
||||
insert_string ("<div class=\"defun\">\n");
|
||||
else
|
||||
rollback_empty_tag ("blockquote");
|
||||
|
||||
/* 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:
|
||||
/* <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, "var");
|
||||
break;
|
||||
case deftypefn:
|
||||
case deftypevr:
|
||||
execute_string ("%s ", type_name);
|
||||
insert_html_tag (START, "b");
|
||||
execute_string ("%s", defined_name);
|
||||
insert_html_tag (END, "b");
|
||||
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, "var");
|
||||
break;
|
||||
case deftypecv:
|
||||
case deftypeivar:
|
||||
case deftypemethod:
|
||||
case deftypeop:
|
||||
execute_string ("%s ", type_name2);
|
||||
insert_html_tag (START, "b");
|
||||
execute_string ("%s", defined_name);
|
||||
insert_html_tag (END, "b");
|
||||
insert_html_tag (START, "var");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (xml)
|
||||
xml_begin_def_term (base_type, category, defined_name, type_name,
|
||||
type_name2);
|
||||
|
||||
current_indent += default_indentation_increment;
|
||||
|
||||
/* Now process the function arguments, if any. If these carry onto
|
||||
the next line, they should be indented by two increments to
|
||||
distinguish them from the body of the definition, which is indented
|
||||
by one increment. */
|
||||
current_indent += default_indentation_increment;
|
||||
|
||||
switch (base_type)
|
||||
{
|
||||
case deffn:
|
||||
case defop:
|
||||
process_defun_args (scan_args, 1);
|
||||
break;
|
||||
|
||||
/* Through Makeinfo 1.67 we processed remaining args only for deftp,
|
||||
deftypefn, and deftypemethod. But the libc manual, for example,
|
||||
needs to say:
|
||||
@deftypevar {char *} tzname[2]
|
||||
And simply allowing the extra text seems far simpler than trying
|
||||
to invent yet more defn commands. In any case, we should either
|
||||
output it or give an error, not silently ignore it. */
|
||||
default:
|
||||
process_defun_args (scan_args, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
current_indent -= default_indentation_increment;
|
||||
if (!html)
|
||||
close_single_paragraph ();
|
||||
|
||||
/* 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)
|
||||
{
|
||||
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. */
|
||||
scan_args = defun_args;
|
||||
while (1)
|
||||
{
|
||||
char * arg = (*scan_args++);
|
||||
if (arg == NULL)
|
||||
break;
|
||||
free (arg);
|
||||
}
|
||||
free (defun_args);
|
||||
}
|
||||
|
||||
/* Add an entry for a function, macro, special form, variable, or option.
|
||||
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 (void)
|
||||
{
|
||||
int type;
|
||||
char *base_command = xstrdup (command); /* command with any `x' removed */
|
||||
int x_p = (command[strlen (command) - 1] == 'x');
|
||||
|
||||
if (x_p)
|
||||
base_command[strlen (base_command) - 1] = 0;
|
||||
|
||||
type = find_type_from_name (base_command);
|
||||
|
||||
/* 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_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;
|
||||
}
|
||||
}
|
||||
|
||||
defun_internal (type, x_p);
|
||||
free (base_command);
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
/* defun.h -- declaration for defuns.
|
||||
$Id: defun.h,v 1.2 2004/04/11 17:56:47 karl Exp $
|
||||
|
||||
Copyright (C) 1999 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 Karl Heinz Marbaise <kama@hippo.fido.de>. */
|
||||
|
||||
#ifndef DEFUN_H
|
||||
#define DEFUN_H
|
||||
|
||||
#include "insertion.h"
|
||||
|
||||
extern enum insertion_type get_base_type (int type);
|
||||
extern void cm_defun (void);
|
||||
|
||||
#endif /* !DEFUN_H */
|
||||
|
@ -1,784 +0,0 @@
|
||||
/* files.c -- file-related functions for makeinfo.
|
||||
$Id: files.c,v 1.5 2004/07/27 00:06:31 karl Exp $
|
||||
|
||||
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
|
||||
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. */
|
||||
|
||||
#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. */
|
||||
|
||||
/* Given a string containing units of information separated by colons,
|
||||
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 (char *string, int *index)
|
||||
{
|
||||
int start;
|
||||
int path_sep_char = PATH_SEP[0];
|
||||
int i = *index;
|
||||
|
||||
if (!string || (i >= strlen (string)))
|
||||
return NULL;
|
||||
|
||||
/* Each call to this routine leaves the index pointing at a colon if
|
||||
there is more to the path. If i > 0, then increment past the
|
||||
`:'. If i == 0, then the path has a leading colon. Trailing colons
|
||||
are handled OK by the `else' part of the if statement; an empty
|
||||
string is returned in that case. */
|
||||
if (i && string[i] == path_sep_char)
|
||||
i++;
|
||||
|
||||
start = i;
|
||||
while (string[i] && string[i] != path_sep_char) i++;
|
||||
*index = i;
|
||||
|
||||
if (i == start)
|
||||
{
|
||||
if (string[i])
|
||||
(*index)++;
|
||||
|
||||
/* Return "" in the case of a trailing `:'. */
|
||||
return xstrdup ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
char *value;
|
||||
|
||||
value = xmalloc (1 + (i - start));
|
||||
memcpy (value, &string[start], (i - start));
|
||||
value [i - start] = 0;
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the full pathname for FILENAME by searching along PATH.
|
||||
When found, return the stat () info for FILENAME in FINFO.
|
||||
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 (char *filename, char *path, struct stat *finfo)
|
||||
{
|
||||
char *dir;
|
||||
int result, index = 0;
|
||||
|
||||
if (path == NULL)
|
||||
path = ".";
|
||||
|
||||
/* Handle absolute pathnames. */
|
||||
if (IS_ABSOLUTE (filename)
|
||||
|| (*filename == '.'
|
||||
&& (IS_SLASH (filename[1])
|
||||
|| (filename[1] == '.' && IS_SLASH (filename[2])))))
|
||||
{
|
||||
if (stat (filename, finfo) == 0)
|
||||
return xstrdup (filename);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while ((dir = extract_colon_unit (path, &index)))
|
||||
{
|
||||
char *fullpath;
|
||||
|
||||
if (!*dir)
|
||||
{
|
||||
free (dir);
|
||||
dir = xstrdup (".");
|
||||
}
|
||||
|
||||
fullpath = xmalloc (2 + strlen (dir) + strlen (filename));
|
||||
sprintf (fullpath, "%s/%s", dir, filename);
|
||||
free (dir);
|
||||
|
||||
result = stat (fullpath, finfo);
|
||||
|
||||
if (result == 0)
|
||||
return fullpath;
|
||||
else
|
||||
free (fullpath);
|
||||
}
|
||||
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. 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 (char *filename, int use_path)
|
||||
{
|
||||
struct stat fileinfo;
|
||||
long file_size;
|
||||
int file = -1, count = 0;
|
||||
char *fullpath, *result;
|
||||
int n, bytes_to_read;
|
||||
|
||||
result = fullpath = NULL;
|
||||
|
||||
fullpath
|
||||
= get_file_info_in_path (filename, use_path ? include_files_path : NULL,
|
||||
&fileinfo);
|
||||
|
||||
if (!fullpath)
|
||||
goto error_exit;
|
||||
|
||||
filename = fullpath;
|
||||
file_size = (long) fileinfo.st_size;
|
||||
|
||||
file = open (filename, O_RDONLY);
|
||||
if (file < 0)
|
||||
goto error_exit;
|
||||
|
||||
/* Load the file, with enough room for a newline and a null. */
|
||||
result = xmalloc (file_size + 2);
|
||||
|
||||
/* VMS stat lies about the st_size value. The actual number of
|
||||
readable bytes is always less than this value. The arcane
|
||||
mysteries of VMS/RMS are too much to probe, so this hack
|
||||
suffices to make things work. It's also needed on Cygwin. And so
|
||||
we might as well use it everywhere. */
|
||||
bytes_to_read = file_size;
|
||||
while ((n = read (file, result + count, bytes_to_read)) > 0)
|
||||
{
|
||||
count += n;
|
||||
bytes_to_read -= n;
|
||||
}
|
||||
if (0 < count && count < file_size)
|
||||
result = xrealloc (result, count + 2); /* why waste the slack? */
|
||||
else if (n == -1)
|
||||
error_exit:
|
||||
{
|
||||
if (result)
|
||||
free (result);
|
||||
|
||||
if (fullpath)
|
||||
free (fullpath);
|
||||
|
||||
if (file != -1)
|
||||
close (file);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
close (file);
|
||||
|
||||
/* Set the globals to the new file. */
|
||||
input_text = result;
|
||||
input_text_length = count;
|
||||
input_filename = fullpath;
|
||||
node_filename = xstrdup (fullpath);
|
||||
input_text_offset = 0;
|
||||
line_number = 1;
|
||||
/* Not strictly necessary. This magic prevents read_token () from doing
|
||||
extra unnecessary work each time it is called (that is a lot of times).
|
||||
INPUT_TEXT_LENGTH is one past the actual end of the text. */
|
||||
input_text[input_text_length] = '\n';
|
||||
/* This, on the other hand, is always necessary. */
|
||||
input_text[input_text_length+1] = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Pushing and popping files. */
|
||||
static void
|
||||
push_node_filename (void)
|
||||
{
|
||||
if (node_filename_stack_index + 1 > node_filename_stack_size)
|
||||
node_filename_stack = xrealloc
|
||||
(node_filename_stack, (node_filename_stack_size += 10) * sizeof (char *));
|
||||
|
||||
node_filename_stack[node_filename_stack_index] = node_filename;
|
||||
node_filename_stack_index++;
|
||||
}
|
||||
|
||||
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 (void)
|
||||
{
|
||||
FSTACK *newstack = xmalloc (sizeof (FSTACK));
|
||||
newstack->filename = input_filename;
|
||||
newstack->text = input_text;
|
||||
newstack->size = input_text_length;
|
||||
newstack->offset = input_text_offset;
|
||||
newstack->line_number = line_number;
|
||||
newstack->next = filestack;
|
||||
|
||||
filestack = newstack;
|
||||
push_node_filename ();
|
||||
}
|
||||
|
||||
/* Make the current file globals be what is on top of the file stack. */
|
||||
void
|
||||
popfile (void)
|
||||
{
|
||||
FSTACK *tos = filestack;
|
||||
|
||||
if (!tos)
|
||||
abort (); /* My fault. I wonder what I did? */
|
||||
|
||||
if (macro_expansion_output_stream)
|
||||
{
|
||||
maybe_write_itext (input_text, input_text_offset);
|
||||
forget_itext (input_text);
|
||||
}
|
||||
|
||||
/* Pop the stack. */
|
||||
filestack = filestack->next;
|
||||
|
||||
/* Make sure that commands with braces have been satisfied. */
|
||||
if (!executing_string && !me_executing_string)
|
||||
discard_braces ();
|
||||
|
||||
/* Get the top of the stack into the globals. */
|
||||
input_filename = tos->filename;
|
||||
input_text = tos->text;
|
||||
input_text_length = tos->size;
|
||||
input_text_offset = tos->offset;
|
||||
line_number = tos->line_number;
|
||||
free (tos);
|
||||
|
||||
/* Go back to the (now) current node. */
|
||||
pop_node_filename ();
|
||||
}
|
||||
|
||||
/* Flush all open files on the file stack. */
|
||||
void
|
||||
flush_file_stack (void)
|
||||
{
|
||||
while (filestack)
|
||||
{
|
||||
char *fname = input_filename;
|
||||
char *text = input_text;
|
||||
popfile ();
|
||||
free (fname);
|
||||
free (text);
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the index of the first character in the filename
|
||||
which is past all the leading directory characters. */
|
||||
static int
|
||||
skip_directory_part (char *filename)
|
||||
{
|
||||
int i = strlen (filename) - 1;
|
||||
|
||||
while (i && !IS_SLASH (filename[i]))
|
||||
i--;
|
||||
if (IS_SLASH (filename[i]))
|
||||
i++;
|
||||
else if (filename[i] && HAVE_DRIVE (filename))
|
||||
i = 2;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static char *
|
||||
filename_non_directory (char *name)
|
||||
{
|
||||
return xstrdup (name + skip_directory_part (name));
|
||||
}
|
||||
|
||||
/* Return just the simple part of the filename; i.e. the
|
||||
filename without the path information, or extensions.
|
||||
This conses up a new string. */
|
||||
char *
|
||||
filename_part (char *filename)
|
||||
{
|
||||
char *basename = filename_non_directory (filename);
|
||||
|
||||
#ifdef REMOVE_OUTPUT_EXTENSIONS
|
||||
/* See if there is an extension to remove. If so, remove it. */
|
||||
{
|
||||
char *temp = strrchr (basename, '.');
|
||||
if (temp)
|
||||
*temp = 0;
|
||||
}
|
||||
#endif /* REMOVE_OUTPUT_EXTENSIONS */
|
||||
return basename;
|
||||
}
|
||||
|
||||
/* Return the pathname part of filename. This can be NULL. */
|
||||
char *
|
||||
pathname_part (char *filename)
|
||||
{
|
||||
char *result = NULL;
|
||||
int i;
|
||||
|
||||
filename = expand_filename (filename, "");
|
||||
|
||||
i = skip_directory_part (filename);
|
||||
if (i)
|
||||
{
|
||||
result = xmalloc (1 + i);
|
||||
strncpy (result, filename, i);
|
||||
result[i] = 0;
|
||||
}
|
||||
free (filename);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Return the full path to FILENAME. */
|
||||
static char *
|
||||
full_pathname (char *filename)
|
||||
{
|
||||
int initial_character;
|
||||
char *result;
|
||||
|
||||
/* No filename given? */
|
||||
if (!filename || !*filename)
|
||||
return xstrdup ("");
|
||||
|
||||
/* Already absolute? */
|
||||
if (IS_ABSOLUTE (filename) ||
|
||||
(*filename == '.' &&
|
||||
(IS_SLASH (filename[1]) ||
|
||||
(filename[1] == '.' && IS_SLASH (filename[2])))))
|
||||
return xstrdup (filename);
|
||||
|
||||
initial_character = *filename;
|
||||
if (initial_character != '~')
|
||||
{
|
||||
char *localdir = xmalloc (1025);
|
||||
#ifdef HAVE_GETCWD
|
||||
if (!getcwd (localdir, 1024))
|
||||
#else
|
||||
if (!getwd (localdir))
|
||||
#endif
|
||||
{
|
||||
fprintf (stderr, _("%s: getwd: %s, %s\n"),
|
||||
progname, filename, localdir);
|
||||
xexit (1);
|
||||
}
|
||||
|
||||
strcat (localdir, "/");
|
||||
strcat (localdir, filename);
|
||||
result = xstrdup (localdir);
|
||||
free (localdir);
|
||||
}
|
||||
else
|
||||
{ /* Does anybody know why WIN32 doesn't want to support $HOME?
|
||||
If the reason is they don't have getpwnam, they should
|
||||
only disable the else clause below. */
|
||||
#ifndef WIN32
|
||||
if (IS_SLASH (filename[1]))
|
||||
{
|
||||
/* Return the concatenation of the environment variable HOME
|
||||
and the rest of the string. */
|
||||
char *temp_home;
|
||||
|
||||
temp_home = (char *) getenv ("HOME");
|
||||
result = xmalloc (strlen (&filename[1])
|
||||
+ 1
|
||||
+ temp_home ? strlen (temp_home)
|
||||
: 0);
|
||||
*result = 0;
|
||||
|
||||
if (temp_home)
|
||||
strcpy (result, temp_home);
|
||||
|
||||
strcat (result, &filename[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct passwd *user_entry;
|
||||
int i, c;
|
||||
char *username = xmalloc (257);
|
||||
|
||||
for (i = 1; (c = filename[i]); i++)
|
||||
{
|
||||
if (IS_SLASH (c))
|
||||
break;
|
||||
else
|
||||
username[i - 1] = c;
|
||||
}
|
||||
if (c)
|
||||
username[i - 1] = 0;
|
||||
|
||||
user_entry = getpwnam (username);
|
||||
|
||||
if (!user_entry)
|
||||
return xstrdup (filename);
|
||||
|
||||
result = xmalloc (1 + strlen (user_entry->pw_dir)
|
||||
+ strlen (&filename[i]));
|
||||
strcpy (result, user_entry->pw_dir);
|
||||
strcat (result, &filename[i]);
|
||||
}
|
||||
#endif /* not WIN32 */
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Return the expansion of FILENAME. */
|
||||
char *
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/* Modify the file name FNAME so that it fits the limitations of the
|
||||
underlying filesystem. In particular, truncate the file name as it
|
||||
would be truncated by the filesystem. We assume the result can
|
||||
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 (char *fname)
|
||||
{
|
||||
int maxlen;
|
||||
char orig[PATH_MAX + 1];
|
||||
int i;
|
||||
char *lastdot, *p;
|
||||
|
||||
#ifdef _PC_NAME_MAX
|
||||
maxlen = pathconf (fname, _PC_NAME_MAX);
|
||||
if (maxlen < 1)
|
||||
#endif
|
||||
maxlen = PATH_MAX;
|
||||
|
||||
i = skip_directory_part (fname);
|
||||
if (fname[i] == '\0')
|
||||
return fname; /* only a directory name -- don't modify */
|
||||
strcpy (orig, fname + i);
|
||||
|
||||
switch (maxlen)
|
||||
{
|
||||
case 12: /* MS-DOS 8+3 filesystem */
|
||||
if (orig[0] == '.') /* leading dots are not allowed */
|
||||
orig[0] = '_';
|
||||
lastdot = strrchr (orig, '.');
|
||||
if (!lastdot)
|
||||
lastdot = orig + strlen (orig);
|
||||
strncpy (fname + i, orig, lastdot - orig);
|
||||
for (p = fname + i;
|
||||
p < fname + i + (lastdot - orig) && p < fname + i + 8;
|
||||
p++)
|
||||
if (*p == '.')
|
||||
*p = '_';
|
||||
*p = '\0';
|
||||
if (*lastdot == '.')
|
||||
strncat (fname + i, lastdot, 4);
|
||||
break;
|
||||
case 14: /* old Unix systems with 14-char limitation */
|
||||
strcpy (fname + i, orig);
|
||||
if (strlen (fname + i) > 14)
|
||||
fname[i + 14] = '\0';
|
||||
break;
|
||||
default:
|
||||
strcpy (fname + i, orig);
|
||||
if (strlen (fname) > maxlen - 1)
|
||||
fname[maxlen - 1] = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
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,70 +0,0 @@
|
||||
/* files.h -- declarations for files.c.
|
||||
$Id: files.h,v 1.4 2004/07/27 00:06:31 karl Exp $
|
||||
|
||||
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
|
||||
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 FILES_H
|
||||
#define FILES_H
|
||||
|
||||
/* A stack of file information records. If a new file is read in with
|
||||
"@input", we remember the old input file state on this stack. */
|
||||
typedef struct fstack
|
||||
{
|
||||
struct fstack *next;
|
||||
char *filename;
|
||||
char *text;
|
||||
int size;
|
||||
int offset;
|
||||
int line_number;
|
||||
} FSTACK;
|
||||
extern FSTACK *filestack;
|
||||
|
||||
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 */
|
@ -1,430 +0,0 @@
|
||||
/* 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;
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/* 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,391 +0,0 @@
|
||||
/* footnote.c -- footnotes for Texinfo.
|
||||
$Id: footnote.c,v 1.7 2004/04/11 17:56:47 karl Exp $
|
||||
|
||||
Copyright (C) 1998, 1999, 2002 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. */
|
||||
|
||||
#include "system.h"
|
||||
#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. */
|
||||
int footnote_style_preset = 0;
|
||||
|
||||
/* The current footnote number in this node. Each time a new node is
|
||||
started this is reset to 1. */
|
||||
int current_footnote_number = 1;
|
||||
|
||||
/* Nonzero means we automatically number footnotes with no specified marker. */
|
||||
int number_footnotes = 1;
|
||||
|
||||
/* Nonzero means we are currently outputting footnotes. */
|
||||
int already_outputting_pending_notes = 0;
|
||||
|
||||
|
||||
/* Footnotes can be handled in one of two ways:
|
||||
|
||||
separate_node:
|
||||
Make them look like followed references, with the reference
|
||||
destinations in a makeinfo manufactured node or,
|
||||
end_node:
|
||||
Make them appear at the bottom of the node that they originally
|
||||
appeared in. */
|
||||
|
||||
#define separate_node 0
|
||||
#define end_node 1
|
||||
|
||||
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 (char *string)
|
||||
{
|
||||
if (strcasecmp (string, "separate") == 0)
|
||||
footnote_style = separate_node;
|
||||
else if (strcasecmp (string, "end") == 0)
|
||||
footnote_style = end_node;
|
||||
else
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
cm_footnotestyle (void)
|
||||
{
|
||||
char *arg;
|
||||
|
||||
get_rest_of_line (1, &arg);
|
||||
|
||||
/* If set on command line, do not change the footnote style. */
|
||||
if (!footnote_style_preset && set_footnote_style (arg) != 0)
|
||||
line_error (_("Bad argument to %c%s"), COMMAND_PREFIX, command);
|
||||
|
||||
free (arg);
|
||||
}
|
||||
|
||||
typedef struct fn
|
||||
{
|
||||
struct fn *next;
|
||||
char *marker;
|
||||
char *note;
|
||||
int number;
|
||||
} FN;
|
||||
|
||||
FN *pending_notes = NULL;
|
||||
|
||||
/* A method for remembering footnotes. Note that this list gets output
|
||||
at the end of the current node. */
|
||||
static void
|
||||
remember_note (char *marker, char *note)
|
||||
{
|
||||
FN *temp = xmalloc (sizeof (FN));
|
||||
|
||||
temp->marker = xstrdup (marker);
|
||||
temp->note = xstrdup (note);
|
||||
temp->next = pending_notes;
|
||||
temp->number = current_footnote_number;
|
||||
pending_notes = temp;
|
||||
footnote_count++;
|
||||
}
|
||||
|
||||
/* How to get rid of existing footnotes. */
|
||||
static void
|
||||
free_pending_notes (void)
|
||||
{
|
||||
FN *temp;
|
||||
|
||||
while ((temp = pending_notes))
|
||||
{
|
||||
free (temp->marker);
|
||||
free (temp->note);
|
||||
pending_notes = pending_notes->next;
|
||||
free (temp);
|
||||
}
|
||||
first_footnote_this_node = 1;
|
||||
footnote_count = 0;
|
||||
current_footnote_number = 1; /* for html */
|
||||
}
|
||||
|
||||
/* What to do when you see a @footnote construct. */
|
||||
|
||||
/* Handle a "footnote".
|
||||
footnote *{this is a footnote}
|
||||
where "*" is the (optional) marker character for this note. */
|
||||
void
|
||||
cm_footnote (void)
|
||||
{
|
||||
char *marker;
|
||||
char *note;
|
||||
|
||||
get_until ("{", &marker);
|
||||
canon_white (marker);
|
||||
|
||||
if (macro_expansion_output_stream && !executing_string)
|
||||
append_to_expansion_output (input_text_offset + 1); /* include the { */
|
||||
|
||||
/* Read the argument in braces. */
|
||||
if (curchar () != '{')
|
||||
{
|
||||
line_error (_("`%c%s' needs an argument `{...}', not just `%s'"),
|
||||
COMMAND_PREFIX, command, marker);
|
||||
free (marker);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
int len;
|
||||
int braces = 1;
|
||||
int loc = ++input_text_offset;
|
||||
|
||||
while (braces)
|
||||
{
|
||||
if (loc == input_text_length)
|
||||
{
|
||||
line_error (_("No closing brace for footnote `%s'"), marker);
|
||||
return;
|
||||
}
|
||||
|
||||
if (input_text[loc] == '{')
|
||||
braces++;
|
||||
else if (input_text[loc] == '}')
|
||||
braces--;
|
||||
else if (input_text[loc] == '\n')
|
||||
line_number++;
|
||||
|
||||
loc++;
|
||||
}
|
||||
|
||||
len = (loc - input_text_offset) - 1;
|
||||
note = xmalloc (len + 1);
|
||||
memcpy (note, &input_text[input_text_offset], len);
|
||||
note[len] = 0;
|
||||
input_text_offset = loc;
|
||||
}
|
||||
|
||||
/* Must write the macro-expanded argument to the macro expansion
|
||||
output stream. This is like the case in index_add_arg. */
|
||||
if (macro_expansion_output_stream && !executing_string)
|
||||
{
|
||||
/* Calling me_execute_string on a lone } provokes an error, since
|
||||
as far as the reader knows there is no matching {. We wrote
|
||||
the { above in the call to append_to_expansion_output. */
|
||||
me_execute_string_keep_state (note, "}");
|
||||
}
|
||||
|
||||
if (!current_node || !*current_node)
|
||||
{
|
||||
line_error (_("Footnote defined without parent node"));
|
||||
free (marker);
|
||||
free (note);
|
||||
return;
|
||||
}
|
||||
|
||||
/* output_pending_notes is non-reentrant (it uses a global data
|
||||
structure pending_notes, which it frees before it returns), and
|
||||
TeX doesn't grok footnotes inside footnotes anyway. Disallow
|
||||
that. */
|
||||
if (already_outputting_pending_notes)
|
||||
{
|
||||
line_error (_("Footnotes inside footnotes are not allowed"));
|
||||
free (marker);
|
||||
free (note);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!*marker)
|
||||
{
|
||||
free (marker);
|
||||
|
||||
if (number_footnotes)
|
||||
{
|
||||
marker = xmalloc (10);
|
||||
sprintf (marker, "%d", current_footnote_number);
|
||||
}
|
||||
else
|
||||
marker = xstrdup ("*");
|
||||
}
|
||||
|
||||
if (xml)
|
||||
xml_insert_footnote (note);
|
||||
else
|
||||
{
|
||||
remember_note (marker, note);
|
||||
|
||||
/* fixme: html: footnote processing needs work; we currently ignore
|
||||
the style requested; we could clash with a node name of the form
|
||||
`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\" name=\"fnd-%d\"><sup>%s</sup></a>",
|
||||
current_footnote_number, current_footnote_number,
|
||||
marker);
|
||||
}
|
||||
else
|
||||
/* Your method should at least insert MARKER. */
|
||||
switch (footnote_style)
|
||||
{
|
||||
case separate_node:
|
||||
add_word_args ("(%s)", marker);
|
||||
execute_string (" (*note %s-Footnote-%d::)",
|
||||
current_node, current_footnote_number);
|
||||
if (first_footnote_this_node)
|
||||
{
|
||||
char *temp_string, *expanded_ref;
|
||||
|
||||
temp_string = xmalloc (strlen (current_node)
|
||||
+ strlen ("-Footnotes") + 1);
|
||||
|
||||
strcpy (temp_string, current_node);
|
||||
strcat (temp_string, "-Footnotes");
|
||||
expanded_ref = expansion (temp_string, 0);
|
||||
remember_node_reference (expanded_ref, line_number,
|
||||
followed_reference);
|
||||
free (temp_string);
|
||||
free (expanded_ref);
|
||||
first_footnote_this_node = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case end_node:
|
||||
add_word_args ("(%s)", marker);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
current_footnote_number++;
|
||||
}
|
||||
free (marker);
|
||||
free (note);
|
||||
}
|
||||
|
||||
/* Output the footnotes. We are at the end of the current node. */
|
||||
void
|
||||
output_pending_notes (void)
|
||||
{
|
||||
FN *footnote = pending_notes;
|
||||
|
||||
if (!pending_notes)
|
||||
return;
|
||||
|
||||
if (html)
|
||||
{
|
||||
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)
|
||||
{
|
||||
case separate_node:
|
||||
{
|
||||
char *old_current_node = current_node;
|
||||
char *old_command = xstrdup (command);
|
||||
|
||||
already_outputting_pending_notes++;
|
||||
execute_string ("%cnode %s-Footnotes,,,%s\n",
|
||||
COMMAND_PREFIX, current_node, current_node);
|
||||
already_outputting_pending_notes--;
|
||||
current_node = old_current_node;
|
||||
free (command);
|
||||
command = old_command;
|
||||
}
|
||||
break;
|
||||
|
||||
case end_node:
|
||||
close_paragraph ();
|
||||
in_fixed_width_font++;
|
||||
/* This string should be translated according to the
|
||||
@documentlanguage, not the current LANG. We can't do that
|
||||
yet, so leave it in English. */
|
||||
execute_string ("---------- Footnotes ----------\n\n");
|
||||
in_fixed_width_font--;
|
||||
break;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
while (--footnote_count > -1)
|
||||
{
|
||||
array[footnote_count] = footnote;
|
||||
footnote = footnote->next;
|
||||
}
|
||||
|
||||
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_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--;
|
||||
add_word ("</p>\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
char *old_current_node = current_node;
|
||||
char *old_command = xstrdup (command);
|
||||
|
||||
already_outputting_pending_notes++;
|
||||
execute_string ("%canchor{%s-Footnote-%d}(%s) %s",
|
||||
COMMAND_PREFIX, current_node, footnote->number,
|
||||
footnote->marker, footnote->note);
|
||||
already_outputting_pending_notes--;
|
||||
current_node = old_current_node;
|
||||
free (command);
|
||||
command = old_command;
|
||||
}
|
||||
|
||||
close_paragraph ();
|
||||
}
|
||||
|
||||
if (html)
|
||||
add_word ("<hr></div>");
|
||||
close_paragraph ();
|
||||
free (array);
|
||||
|
||||
in_fixed_width_font = save_in_fixed_width_font;
|
||||
}
|
||||
|
||||
free_pending_notes ();
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user