Compare commits

..
Author SHA1 Message Date
cvs2svn fe49c12662 This commit was manufactured by cvs2svn to create tag
'RELENG_2_2_1_RELEASE'.
1997-03-27 03:07:27 +00:00
730 changed files with 23384 additions and 82011 deletions

No files matched your search

+6 -9
View File
@@ -1,5 +1,5 @@
#
# $Id: Makefile,v 1.109.2.3 1997/04/11 16:57:40 asami Exp $
# $Id: Makefile,v 1.109.2.1 1996/11/28 21:43:35 phk Exp $
#
# Make command line options:
# -DCLOBBER will remove /usr/include
@@ -18,7 +18,6 @@
# -DNOSECURE do not go into secure subdir
# -DNOGAMES do not go into games subdir
# -DNOSHARE do not go into share subdir
# -DNOINFO do not make or install info files
#
# The intended user-driven targets are:
@@ -120,7 +119,7 @@ SUPFLAGS?= -v
# While building tools for bootstrapping, we dont need to waste time on
# profiled libraries or man pages. This speeds things up somewhat.
#
MK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE
MK_FLAGS= -DNOMAN -DNOPROFILE
#
# world
@@ -455,10 +454,6 @@ lib-tools:
# libraries - build and install the libraries
#
libraries:
.if exists(lib/csu/i386)
cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
.if exists(lib/libcompat)
cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
@@ -471,6 +466,10 @@ libraries:
cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
.if exists(lib)
cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
.if exists(gnu)
cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
@@ -502,8 +501,6 @@ libraries:
#
build-tools:
.for d in \
share/info \
gnu/usr.bin/texinfo \
usr.bin/symorder \
usr.bin/sgmls \
usr.bin/sgmlfmt \
+4 -8
View File
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: buf.c,v 1.7 1995/05/30 00:06:43 rgrimes Exp $
* $Id: buf.c,v 1.6 1994/09/24 02:55:22 davidg Exp $
*/
#ifndef lint
static char *rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp";
@@ -198,18 +198,14 @@ char sfn[15] = ""; /* scratch file name */
int
open_sbuf()
{
int fd = -1;
int u;
isbinary = newline_added = 0;
u = umask(077);
strcpy(sfn, "/tmp/ed.XXXXXX");
if ((fd = mkstemp(sfn)) == -1 ||
(sfp = fdopen(fd, "w+")) == NULL) {
if (fd != -1)
close(fd);
perror(sfn);
strcpy(errmsg, "cannot open temp file");
if (mktemp(sfn) == NULL || (sfp = fopen(sfn, "w+")) == NULL) {
fprintf(stderr, "%s: %s\n", sfn, strerror(errno));
sprintf(errmsg, "cannot open temp file");
umask(u);
return ERR;
}
+2 -2
View File
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)ls.1 8.6 (Berkeley) 4/18/94
.\" $Id: ls.1,v 1.5.2.2 1997/03/07 02:00:30 mpp Exp $
.\" $Id: ls.1,v 1.5.2.1 1997/02/25 00:38:13 mpp Exp $
.\"
.Dd April 18, 1994
.Dt LS 1
@@ -43,7 +43,7 @@
.Nd list directory contents
.Sh SYNOPSIS
.Nm ls
.Op Fl ACFLRTacdfgikloqrstu1
.Op Fl ACFLRTacdfgiloqrstu1
.Op Ar file ...
.Sh DESCRIPTION
For each operand that names a
+2 -2
View File
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: util.c,v 1.5 1996/03/31 16:14:11 ache Exp $
* $Id: util.c,v 1.4 1994/10/09 15:25:23 ache Exp $
*/
#ifndef lint
@@ -68,6 +68,6 @@ prcopy(src, dest, len)
void
usage()
{
(void)fprintf(stderr, "usage: ls [-1ACFLRTacdfikloqrstu] [file ...]\n");
(void)fprintf(stderr, "usage: ls [-1ACFLRTacdfiklqrstu] [file ...]\n");
exit(1);
}
+2 -5
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: print.c,v 1.16 1996/10/21 07:30:24 peter Exp $
* $Id: print.c,v 1.15 1996/06/29 10:25:31 peter Exp $
*/
#ifndef lint
@@ -103,10 +103,7 @@ command(k, ve)
v = ve->var;
if (cflag) {
if (ve->next == NULL) /* last field, don't pad */
(void)printf("%s", KI_PROC(k)->p_comm);
else
(void)printf("%-*s", v->width, KI_PROC(k)->p_comm);
(void)printf("%-*s", v->width, KI_PROC(k)->p_comm);
return;
}
+2 -3
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: rcp.c,v 1.7 1996/02/11 09:01:32 markm Exp $
*/
#ifndef lint
@@ -131,8 +131,7 @@ main(argc, argv)
#ifdef KERBEROS
case 'k':
dest_realm = dst_realm_buf;
(void)strncpy(dst_realm_buf, optarg, REALM_SZ - 1);
dst_realm_buf[REALM_SZ - 1] = '\0';
(void)strncpy(dst_realm_buf, optarg, REALM_SZ);
break;
#ifdef CRYPT
case 'x':
+13 -19
View File
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)rm.1 8.2 (Berkeley) 4/18/94
.\" $Id: rm.1,v 1.4.2.1 1997/04/08 20:43:37 mpp Exp $
.\" $Id: rm.1,v 1.3 1996/03/07 23:26:58 wosch Exp $
.\"
.Dd April 18, 1994
.Dt RM 1
@@ -119,26 +119,20 @@ If an error occurs,
.Nm rm
exits with a value >0.
.Sh NOTE
The
.Nm
command uses
.Nm rm
use
.Xr getopt 3
to parse its arguments, which allows it to accept
the
parsing routine. Getopt accept a
.Sq Li --
option which will cause it to stop processing flag options at that
point. This will allow the removal of file names that begin
with a dash
.Pq Sq - .
For example:
.Dl rm -- -filename
The same behavior can be obtained by using an absolute or relative
path reference. For example:
.Dl rm /home/user/-filename
.Dl rm ./-filename
This is useful for commands that do not use
.Xr getopt 3
to parse the command line arguments.
argument, which stop reading options, anything after this
is not an option.
So
.Nm rm
handle files whose names begins with a
.Sq Li - .
Example:
``$ rm -- -filename''.
.Sh SEE ALSO
.Xr rmdir 1 ,
.Xr unlink 2 ,
+2 -2
View File
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: eval.c,v 1.7.2.1 1996/11/12 19:23:44 jkh Exp $
* $Id: eval.c,v 1.8 1996/11/12 18:35:06 peter Exp $
*/
#ifndef lint
@@ -957,7 +957,7 @@ returncmd(argc, argv)
{
int ret;
ret = oexitstatus;
ret = exitstatus;
if (argc > 1)
ret = number(argv[1]);
if (funcnest) {
+5 -9
View File
@@ -86,21 +86,17 @@ Boston, MA 02111-1307, USA. */
#define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
/* Like the default, except no -lg, and no -p. */
#define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}"
/* Like the default, except no -lg. */
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
#define LINK_SPEC \
"%{p:%e`-p' not supported; use `-pg' and gprof(1)} \
%{shared:-Bshareable} \
%{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
%{pg:-Bstatic} %{Z}} \
%{assert*} %{R*}"
"%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*} \
%{p:-Bstatic} %{pg:-Bstatic} %{Z} %{R*}"
#define LINK_LIBGCC_SPECIAL_1 1
#define STARTFILE_SPEC \
"%{shared:c++rt0.o%s} \
%{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
"%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
/* This goes away when the math emulator is fixed. */
#undef TARGET_DEFAULT
+5 -9
View File
@@ -86,21 +86,17 @@ Boston, MA 02111-1307, USA. */
#define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
/* Like the default, except no -lg, and no -p. */
#define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}"
/* Like the default, except no -lg. */
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
#define LINK_SPEC \
"%{p:%e`-p' not supported; use `-pg' and gprof(1)} \
%{shared:-Bshareable} \
%{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
%{pg:-Bstatic} %{Z}} \
%{assert*} %{R*}"
"%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*} \
%{p:-Bstatic} %{pg:-Bstatic} %{Z} %{R*}"
#define LINK_LIBGCC_SPECIAL_1 1
#define STARTFILE_SPEC \
"%{shared:c++rt0.o%s} \
%{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
"%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
/* This goes away when the math emulator is fixed. */
#undef TARGET_DEFAULT
+1 -1
View File
@@ -4,7 +4,7 @@
@ifinfo
@format
START-INFO-DIR-ENTRY
* Reno 1: (reno). The GNU C++ Renovation Project, Phase 1.
* Reno 1: (reno-1). The GNU C++ Renovation Project, Phase 1.
END-INFO-DIR-ENTRY
@end format
@end ifinfo
+3 -9
View File
@@ -1189,17 +1189,13 @@ Like `\|\c
.B \-M\c
\&\|' but the output mentions only the user header files
included with `\|\c
.B
#include "\c
.B #include "\c
.I file\c
.B
\&"\c
\&\|'. System header files
included with `\|\c
.B
#include <\c
.B #include <\c
.I file\c
.B
\&>\c
\&\|' are omitted.
.TP
@@ -1476,10 +1472,8 @@ option are searched only for the case of `\|\c
\&"\c
\&\|';
they are not searched for `\|\c
.B
#include <\c
.B #include <\c
.I file\c
.B
\&>\c
\&\|'.
.Sp
+6 -3
View File
@@ -19,6 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <sgtty.h>
#include <sys/file.h>
#include <netinet/in.h>
#include <sys/socket.h>
@@ -26,8 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <netinet/tcp.h>
#include <signal.h>
#include <ctype.h>
#include <errno.h>
#include <string.h>
/* Sort of a hack... */
#define EOL (EOF - 1)
@@ -42,10 +41,13 @@ void
perror_with_name (string)
char *string;
{
extern int sys_nerr;
extern char *sys_errlist[];
extern int errno;
char *err;
char *combined;
err = strerror(errno);
err = (errno < sys_nerr) ? sys_errlist[errno] : "unknown error";
combined = (char *) alloca (strlen (err) + strlen (string) + 3);
strcpy (combined, string);
strcat (combined, ": ");
@@ -82,6 +84,7 @@ void
remote_open (name)
char *name;
{
struct sgttyb sg;
extern char *strchr ();
if (!strchr (name, ':'))
+4 -1
View File
@@ -30,7 +30,10 @@ void
perror_with_name (string)
char *string;
{
const char *err;
extern int sys_nerr;
extern char *sys_errlist[];
extern int errno;
char *err;
char *combined;
if (errno < sys_nerr)
-6
View File
@@ -83,12 +83,6 @@ add_to_objfile_sections (abfd, asect, objfile_p_char)
section.objfile = objfile;
section.the_bfd_section = asect;
section.addr = bfd_section_vma (abfd, asect);
#ifdef __FreeBSD__
/* XXX perhaps this should be in bfd_section_vma (), but it wouldn't
even compile there, since a bfd pointer isn't actually passed in
all invocations of bfd_section_vma (). */
section.addr += bfd_get_start_address (abfd);
#endif
section.endaddr = section.addr + bfd_section_size (abfd, asect);
obstack_grow (&objfile->psymbol_obstack, (char *) &section, sizeof(section));
objfile->sections_end = (struct obj_section *) (((unsigned long) objfile->sections_end) + 1);
-8
View File
@@ -151,10 +151,6 @@
.nr cZ \\n(.s
.ds aa \&\f\\n(cF\s\\n(cZ
.if \\n(.$==2 \{\
. if "\\$1"1.0" \&\\*(tNFreeBSD\\*(aa 1.0\\*(aa\\$2
. if "\\$1"1.1" \&\\*(tNFreeBSD\\*(aa 1.1\\*(aa\\$2
. if "\\$1"1.1.5" \&\\*(tNFreeBSD\\*(aa 1.1.5\\*(aa\\$2
. if "\\$1"1.1.5.1" \&\\*(tNFreeBSD\\*(aa 1.1.5.1\\*(aa\\$2
. if "\\$1"2.0" \&\\*(tNFreeBSD\\*(aa 2.0\\*(aa\\$2
. if "\\$1"2.0.5" \&\\*(tNFreeBSD\\*(aa 2.0.5\\*(aa\\$2
. if "\\$1"2.1" \&\\*(tNFreeBSD\\*(aa 2.1\\*(aa\\$2
@@ -166,10 +162,6 @@
. if "\\$1"3.0" \&\\*(tNFreeBSD\\*(aa 3.0\\*(aa\\$2
.\}
.if \\n(.$==1 \{\
. if "\\$1"1.0" \&\\*(tNFreeBSD\\*(aa 1.0\\*(aa
. if "\\$1"1.1" \&\\*(tNFreeBSD\\*(aa 1.1\\*(aa
. if "\\$1"1.1.5" \&\\*(tNFreeBSD\\*(aa 1.1.5\\*(aa
. if "\\$1"1.1.5.1" \&\\*(tNFreeBSD\\*(aa 1.1.5.1\\*(aa
. if "\\$1"2.0" \&\\*(tNFreeBSD\\*(aa 2.0\\*(aa
. if "\\$1"2.0.5" \&\\*(tNFreeBSD\\*(aa 2.0.5\\*(aa
. if "\\$1"2.1" \&\\*(tNFreeBSD\\*(aa 2.1\\*(aa
+1 -1
View File
@@ -1536,7 +1536,7 @@
. if "\\$1"-literal" \&\\*(lI\c
. if "\\$1"-symbolic" \&\\*(sY\c
.\}
.el .tm Usage .Bf [Em | -emphasis | Li | -literal | Sy | -symbolic] (#\\n(.c)
.el .tm Usage .Bf [Em | emphasis | Li | literal | Sy | symbolic] (#\\n(.c)
..
.de Ef
.ds mN Ef
+1 -1
View File
@@ -11,7 +11,7 @@
@ifinfo
@format
START-INFO-DIR-ENTRY
* gmp: (gmp). GNU Multiple Precision Arithmetic Library.
* gmp: (gmp.info). GNU Multiple Precision Arithmetic Library.
END-INFO-DIR-ENTRY
@end format
@end ifinfo
-339
View File
@@ -1,339 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, 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
Appendix: 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) 19yy <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., 675 Mass Ave, Cambridge, MA 02139, 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) 19yy 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.
-192
View File
@@ -1,192 +0,0 @@
## -*- text -*- ####################################################
# #
# Makefile for the GNU Readline and History Libraries. #
# #
####################################################################
srcdir = @srcdir@
VPATH = .:@srcdir@
topdir = @top_srcdir@
BUILD_DIR = @BUILD_DIR@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
CC = @CC@
RANLIB = @RANLIB@
AR = @AR@
RM = rm -f
CP = cp
MV = mv
# See the file STANDALONE for the -D defines that readline understands
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
DEFS = @DEFS@
INCLUDES = -I. -I$(BUILD_DIR) -I$(topdir) -I$(topdir)/lib
CCFLAGS = $(DEFS) $(APP_CFLAGS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
# Here is a rule for making .o files from .c files that doesn't force
# the type of the machine (like -sun3) into the flags.
.c.o:
$(CC) -c $(CCFLAGS) $<
# The name of the main library target.
LIBRARY_NAME = libreadline.a
# The C code source files for this library.
CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
$(srcdir)/vi_mode.c $(srcdir)/parens.c $(srcdir)/rltty.c \
$(srcdir)/complete.c $(srcdir)/bind.c $(srcdir)/isearch.c \
$(srcdir)/display.c $(srcdir)/signals.c $(srcdir)/emacs_keymap.c \
$(srcdir)/vi_keymap.c $(srcdir)/util.c $(srcdir)/kill.c \
$(srcdir)/undo.c $(srcdir)/macro.c $(srcdir)/input.c \
$(srcdir)/callback.c $(srcdir)/terminal.c $(srcdir)/xmalloc.c \
$(srcdir)/history.c $(srcdir)/histsearch.c $(srcdir)/histexpand.c \
$(srcdir)/histfile.c $(srcdir)/nls.c \
$(srcdir)/tilde.c \
# The header files for this library.
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
posixstat.h tilde.h rlconf.h tcap.h
HISTOBJ = history.o histexpand.o histfile.o histsearch.o
TILDEOBJ= tilde.o
OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
rltty.o complete.o bind.o isearch.o display.o signals.o \
util.o kill.o undo.o macro.o input.o callback.o terminal.o \
nls.o xmalloc.o \
$(HISTOBJ) $(TILDEOBJ)
# The texinfo files which document this library.
DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
DOCOBJECT = doc/readline.dvi
DOCSUPPORT = doc/Makefile
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
SUPPORT = Makefile ChangeLog $(DOCSUPPORT) examples/[-a-z.]*
SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h
##########################################################################
all: libreadline.a libhistory.a
libreadline.a: $(OBJECTS)
$(RM) -f $@
$(AR) cr $@ $(OBJECTS)
-test -n "$(RANLIB)" && $(RANLIB) $@
libhistory.a: $(HISTOBJ) xmalloc.o
$(RM) -f $@
$(AR) cr $@ $(HISTOBJ) xmalloc.o
-test -n "$(RANLIB)" && $(RANLIB) $@
documentation: force
test -d doc || mkdir doc
-( cd doc && $(MAKE) $(MFLAGS) )
force:
# The rule for 'includes' is written funny so that the if statement
# always returns TRUE unless there really was an error installing the
# include files.
install: installdirs libreadline.a
for file in $(INSTALLED_HEADERS) ; do \
$(INSTALL_DATA) $(srcdir)/$$file $(includedir)/readline ; \
done
-${MV} $(libdir)/libreadline.a $(libdir)/libreadline.old
${INSTALL_DATA} libreadline.a $(libdir)/libreadline.a
-test -n "$(RANLIB)" && $(RANLIB) -t $(bindir)/libreadline.a
installdirs: $(topdir)/support/mkdirs
$(SHELL) $(topdir)/support/mkdirs $(includedir) \
$(includedir)/readline $(libdir) $(infodir) $(man3dir)
uninstall:
cd $(includedir)/readline && ${RM} -f ${INSTALLED_HEADERS}
cd $(libdir) && ${RM} -f libreadline.a libreadline.old
tags: force
etags $(CSOURCES) $(HSOURCES)
TAGS: force
ctags -x $(CSOURCES) $(HSOURCES) > $@
readline: readline.h rldefs.h chardefs.h
readline: $(OBJECTS)
$(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
$(LOCAL_INCLUDES) -DTEST -o readline readline.c vi_mode.o funmap.o \
keymaps.o -ltermcap
clean: force
$(RM) $(OBJECTS) *.a
-( cd doc && $(MAKE) $(MFLAGS) $@ )
distclean realclean maintainer-clean: clean
-( cd doc && $(MAKE) $(MFLAGS) $@ )
$(RM) Makefile
mostlyclean: clean
-( cd doc && $(MAKE) $(MFLAGS) $@ )
# Dependencies
readline.o: readline.c readline.h rldefs.h rlconf.h chardefs.h tcap.h
readline.o: keymaps.h history.h
vi_mode.o: rldefs.h rlconf.h readline.h history.h
funmap.o: funmap.c readline.h rlconf.h
keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c keymaps.h chardefs.h rlconf.h
history.o: history.h histlib.h
histexpand.o: history.h histlib.h
histsearch.o: history.h histlib.h
histfile.o: history.h histlib.h
isearch.o: readline.h history.h
search.o: readline.h history.h
display.o: readline.h history.h rldefs.h rlconf.h tcap.h
complete.o: readline.h rldefs.h rlconf.h posixdir.h posixstat.h
rltty.o: rldefs.h rlconf.h readline.h rltty.h
bind.o: rldefs.h rlconf.h readline.h history.h
signals.o: rldefs.h rlconf.h readline.h history.h
parens.o: readline.h
kill.o: rldefs.h rlconf.h readline.h history.h
macro.o: rldefs.h rlconf.h readline.h history.h
undo.o: rldefs.h rlconf.h readline.h history.h
input.o: rldefs.h rlconf.h readline.h history.h
callback.o: rlconf.h rldefs.h readline.h
terminal.o: rlconf.h rldefs.h readline.h tcap.h history.h
bind.o: $(BUILD_DIR)/config.h
callback.o: $(BUILD_DIR)/config.h
complete.o: $(BUILD_DIR)/config.h
display.o: $(BUILD_DIR)/config.h
funmap.o: $(BUILD_DIR)/config.h
histexpand.o: $(BUILD_DIR)/config.h
histfile.o: $(BUILD_DIR)/config.h
history.o: $(BUILD_DIR)/config.h
histsearch.o: $(BUILD_DIR)/config.h
input.o: $(BUILD_DIR)/config.h
isearch.o: $(BUILD_DIR)/config.h
keymaps.o: $(BUILD_DIR)/config.h
kill.o: $(BUILD_DIR)/config.h
macro.o: $(BUILD_DIR)/config.h
parens.o: $(BUILD_DIR)/config.h
readline.o: $(BUILD_DIR)/config.h
rltty.o: $(BUILD_DIR)/config.h
search.o: $(BUILD_DIR)/config.h
signals.o: $(BUILD_DIR)/config.h
tilde.o: $(BUILD_DIR)/config.h
undo.o: $(BUILD_DIR)/config.h
util.o: $(BUILD_DIR)/config.h
vi_mode.o: $(BUILD_DIR)/config.h
xmalloc.o: $(BUILD_DIR)/config.h
-144
View File
@@ -1,144 +0,0 @@
/* callback.c -- functions to use readline as an X `callback' mechanism. */
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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 1, or
(at your option) any later version.
The GNU Readline Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include "rlconf.h"
#if defined (READLINE_CALLBACKS)
#include <sys/types.h>
#include <stdio.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#include "readline.h"
extern void readline_internal_startup ();
extern char *readline_internal_teardown ();
extern int readline_internal_char ();
extern int _rl_meta_flag;
extern char *rl_prompt;
extern int rl_visible_prompt_length;
/* **************************************************************** */
/* */
/* Callback Readline Functions */
/* */
/* **************************************************************** */
/* Allow using readline in situations where a program may have multiple
things to handle at once, and dispatches them via select(). Call
rl_callback_handler_install() with the prompt and a function to call
whenever a complete line of input is ready. The user must then
call readline_char() every time some input is available, and
readline_char() will call the user's function with the complete text
read in at each end of line. The terminal is kept prepped and signals
handled all the time, except during calls to the user's function. */
VFunction *rl_linefunc; /* user callback function */
static int in_handler; /* terminal_prepped and signals set? */
/* Make sure the terminal is set up, initialize readline, and prompt. */
static void
_rl_callback_newline ()
{
rl_initialize ();
if (in_handler == 0)
{
in_handler = 1;
(*rl_prep_term_function) (_rl_meta_flag);
#if defined (HANDLE_SIGNALS)
rl_set_signals ();
#endif
}
readline_internal_setup ();
}
/* Install a readline handler, set up the terminal, and issue the prompt. */
void
rl_callback_handler_install (prompt, linefunc)
char *prompt;
VFunction *linefunc;
{
rl_prompt = prompt;
rl_visible_prompt_length = rl_prompt ? rl_expand_prompt (rl_prompt) : 0;
rl_linefunc = linefunc;
_rl_callback_newline ();
}
/* Read one character, and dispatch to the handler if it ends the line. */
void
rl_callback_read_char ()
{
char *line;
int eof;
if (rl_linefunc == NULL)
{
fprintf (stderr, "readline: readline_callback_read_char() called with no handler!\r\n");
abort ();
}
eof = readline_internal_char ();
if (rl_done)
{
line = readline_internal_teardown (eof);
(*rl_deprep_term_function) ();
#if defined (HANDLE_SIGNALS)
rl_clear_signals ();
#endif
in_handler = 0;
(*rl_linefunc) (line);
/* Redisplay the prompt if readline_handler_{install,remove} not called. */
if (in_handler == 0 && rl_linefunc)
_rl_callback_newline ();
}
}
/* Remove the handler, and make sure the terminal is in its normal state. */
void
rl_callback_handler_remove ()
{
rl_linefunc = NULL;
if (in_handler)
{
in_handler = 0;
(*rl_deprep_term_function) ();
#if defined (HANDLE_SIGNALS)
rl_clear_signals ();
#endif
}
}
#endif
File diff suppressed because it is too large. Load diff
-69
View File
@@ -1,69 +0,0 @@
# This makefile for Readline library documentation is in -*- text -*- mode.
# Emacs likes it that way.
TEXI2DVI = texi2dvi
RM = rm -f
INSTALL_DATA = cp
infodir = /usr/local/info
RLSRC = rlman.texinfo rluser.texinfo rltech.texinfo
HISTSRC = hist.texinfo hsuser.texinfo hstech.texinfo
DVIOBJ = readline.dvi history.dvi
INFOOBJ = readline.info history.info
PSOBJ = readline.ps history.ps
HTMLOBJ = readline.html history.html
all: info dvi html
readline.dvi: $(RLSRC)
$(TEXI2DVI) rlman.texinfo
mv rlman.dvi readline.dvi
readline.info: $(RLSRC)
makeinfo --no-split -o $@ rlman.texinfo
history.dvi: ${HISTSRC}
$(TEXI2DVI) hist.texinfo
mv hist.dvi history.dvi
history.info: ${HISTSRC}
makeinfo --no-split -o $@ hist.texinfo
readline.ps: readline.dvi
dvips -D 300 -o $@ readline.dvi
history.ps: history.dvi
dvips -D 300 -o $@ history.dvi
readline.html: ${RLSRC}
texi2html rlman.texinfo
sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman.html > readline.html
sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman_toc.html > readline_toc.html
rm -f rlman.html rlman_toc.html
history.html: ${HISTSRC}
texi2html hist.texinfo
sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist.html > history.html
sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist_toc.html > history_toc.html
rm -f hist.html hist_toc.html
info: $(INFOOBJ)
dvi: $(DVIOBJ)
ps: $(PSOBJ)
html: $(HTMLOBJ)
clean:
$(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
*.fns *.kys *.tps *.vrs *.o core
distclean: clean
mostlyclean: clean
maintainer-clean: clean
$(RM) *.dvi *.info *.info-* *.ps *.html
install: info
${INSTALL_DATA} readline.info $(infodir)/readline.info
${INSTALL_DATA} history.info $(infodir)/history.info
-304
View File
@@ -1,304 +0,0 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988, 1991, 1996 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
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 process this file through Tex and print the
results, provided the printed document carries copying permission notice
identical to this one except for the removal of this paragraph (this
paragraph not being relevant to the printed manual).
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that the
GNU Copyright statement is available to the distributee, and 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.
@end ignore
@node Using History Interactively
@chapter Using History Interactively
@ifset BashFeatures
This chapter describes how to use the GNU History Library interactively,
from a user's standpoint. It should be considered a user's guide. For
information on using the GNU History Library in your own programs,
see the GNU Readline Library Manual.
@end ifset
@ifclear BashFeatures
This chapter describes how to use the GNU History Library interactively,
from a user's standpoint. It should be considered a user's guide. For
information on using the GNU History Library in your own programs,
@pxref{Programming with GNU History}.
@end ifclear
@ifset BashFeatures
@menu
* Bash History Facilities:: How Bash lets you manipulate your command
history.
* History Interaction:: What it feels like using History as a user.
@end menu
@end ifset
@ifclear BashFeatures
@menu
* History Interaction:: What it feels like using History as a user.
@end menu
@end ifclear
@ifset BashFeatures
@node Bash History Facilities
@section Bash History Facilities
@cindex command history
@cindex history list
When the @samp{-o history} option to the @code{set} builtin
is enabled (@pxref{The Set Builtin}),
the shell provides access to the @var{command history},
the list of commands previously typed. The text of the last
@code{HISTSIZE}
commands (default 500) is saved in a history list. The shell
stores each command in the history list prior to parameter and
variable expansion
but after history expansion is performed, subject to the
values of the shell variables
@code{HISTIGNORE} and @code{HISTCONTROL}.
When the shell starts up, the history is initialized from the
file named by the @code{HISTFILE} variable (default @file{~/.bash_history}).
@code{HISTFILE} is truncated, if necessary, to contain no more than
the number of lines specified by the value of the @code{HISTFILESIZE}
variable. When an interactive shell exits, the last
@code{HISTSIZE} lines are copied from the history list to @code{HISTFILE}.
If the @code{histappend} shell option is set (@pxref{Bash Builtins}),
the lines are appended to the history file,
otherwise the history file is overwritten.
If @code{HISTFILE}
is unset, or if the history file is unwritable, the history is
not saved. After saving the history, the history file is truncated
to contain no more than @code{$HISTFILESIZE}
lines. If @code{HISTFILESIZE} is not set, no truncation is performed.
The builtin command @code{fc} (@pxref{Korn Shell Builtins})
may be used to list or edit and re-execute a portion of
the history list. The @code{history} builtin (@pxref{C Shell Builtins})
can be used to display or modify the history list and
manipulate the history file.
When using the command-line editing, search commands
are available in each editing mode that provide access to the
history list.
The shell allows control over which commands are saved on the history
list. The @code{HISTCONTROL} and @code{HISTIGNORE}
variables may be set to cause the shell to save only a subset of the
commands entered.
The @code{cmdhist}
shell option, if enabled, causes the shell to attempt to save each
line of a multi-line command in the same history entry, adding
semicolons where necessary to preserve syntactic correctness.
The @code{lithist}
shell option causes the shell to save the command with embedded newlines
instead of semicolons.
@xref{Bash Builtins} for a description of @code{shopt}.
@end ifset
@node History Interaction
@section Interactive History Expansion
@cindex history expansion
The History library provides a history expansion feature that is similar
to the history expansion provided by @code{csh}. This section
describes the syntax used to manipulate the history information.
History expansions introduce words from the history list into
the input stream, making it easy to repeat commands, insert the
arguments to a previous command into the current input line, or
fix errors in previous commands quickly.
History expansion takes place in two parts. The first is to determine
which line from the previous history should be used during substitution.
The second is to select portions of that line for inclusion into the
current one. The line selected from the previous history is called the
@dfn{event}, and the portions of that line that are acted upon are
called @dfn{words}. Various @dfn{modifiers} are available to manipulate
the selected words. The line is broken into words in the same fashion
that Bash does, so that several English (or Unix) words
surrounded by quotes are considered as one word.
History expansions are introduced by the appearance of the
history expansion character, which is @samp{!} by default.
@ifset BashFeatures
Only @samp{\} and @samp{'} may be used to escape the history expansion
character.
@end ifset
@ifset BashFeatures
Several shell options settable with the @code{shopt}
builtin (@pxref{Bash Builtins}) may be used to tailor
the behavior of history expansion. If the
@code{histverify} shell option is enabled, and Readline
is being used, history substitutions are not immediately passed to
the shell parser.
Instead, the expanded line is reloaded into the Readline
editing buffer for further modification.
If Readline is being used, and the @code{histreedit}
shell option is enabled, a failed history expansion will be
reloaded into the Readline editing buffer for correction.
The @samp{-p} option to the @code{history} builtin command
may be used to see what a history expansion will do before using it.
The @samp{-s} option to the @code{history} builtin may be used to
add commands to the end of the history list without actually executing
them, so that they are available for subsequent recall.
The shell allows control of the various characters used by the
history expansion mechanism with the @code{histchars} variable.
@end ifset
@menu
* Event Designators:: How to specify which history line to use.
* Word Designators:: Specifying which words are of interest.
* Modifiers:: Modifying the results of substitution.
@end menu
@node Event Designators
@subsection Event Designators
@cindex event designators
An event designator is a reference to a command line entry in the
history list.
@cindex history events
@table @asis
@item @code{!}
Start a history substitution, except when followed by a space, tab,
the end of the line, @key{=} or @key{(}.
@item @code{!@var{n}}
Refer to command line @var{n}.
@item @code{!-@var{n}}
Refer to the command @var{n} lines back.
@item @code{!!}
Refer to the previous command. This is a synonym for @samp{!-1}.
@item @code{!@var{string}}
Refer to the most recent command starting with @var{string}.
@item @code{!?@var{string}[?]}
Refer to the most recent command containing @var{string}. The trailing
@samp{?} may be omitted if the @var{string} is followed immediately by
a newline.
@item @code{^@var{string1}^@var{string2}^}
Quick Substitution. Repeat the last command, replacing @var{string1}
with @var{string2}. Equivalent to
@code{!!:s/@var{string1}/@var{string2}/}.
@item @code{!#}
The entire command line typed so far.
@end table
@node Word Designators
@subsection Word Designators
Word designators are used to select desired words from the event.
A @samp{:} separates the event specification from the word designator. It
can be omitted if the word designator begins with a @samp{^}, @samp{$},
@samp{*}, @samp{-}, or @samp{%}. Words are numbered from the beginning
of the line, with the first word being denoted by 0 (zero). Words are
inserted into the current line separated by single spaces.
@table @code
@item 0 (zero)
The @code{0}th word. For many applications, this is the command word.
@item @var{n}
The @var{n}th word.
@item ^
The first argument; that is, word 1.
@item $
The last argument.
@item %
The word matched by the most recent @samp{?@var{string}?} search.
@item @var{x}-@var{y}
A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}.
@item *
All of the words, except the @code{0}th. This is a synonym for @samp{1-$}.
It is not an error to use @samp{*} if there is just one word in the event;
the empty string is returned in that case.
@item @var{x}*
Abbreviates @samp{@var{x}-$}
@item @var{x}-
Abbreviates @samp{@var{x}-$} like @samp{@var{x}*}, but omits the last word.
@end table
If a word designator is supplied without an event specification, the
previous command is used as the event.
@node Modifiers
@subsection Modifiers
After the optional word designator, you can add a sequence of one or more
of the following modifiers, each preceded by a @samp{:}.
@table @code
@item h
Remove a trailing pathname component, leaving only the head.
@item t
Remove all leading pathname components, leaving the tail.
@item r
Remove a trailing suffix of the form @samp{.@var{suffix}}, leaving
the basename.
@item e
Remove all but the trailing suffix.
@item p
Print the new command but do not execute it.
@ifset BashFeatures
@item q
Quote the substituted words, escaping further substitutions.
@item x
Quote the substituted words as with @samp{q},
but break into words at spaces, tabs, and newlines.
@end ifset
@item s/@var{old}/@var{new}/
Substitute @var{new} for the first occurrence of @var{old} in the
event line. Any delimiter may be used in place of @samp{/}.
The delimiter may be quoted in @var{old} and @var{new}
with a single backslash. If @samp{&} appears in @var{new},
it is replaced by @var{old}. A single backslash will quote
the @samp{&}. The final delimiter is optional if it is the last
character on the input line.
@item &
Repeat the previous substitution.
@item g
Cause changes to be applied over the entire event line. Used in
conjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/},
or with @samp{&}.
@end table
-19
View File
@@ -1,19 +0,0 @@
# This is the Makefile for the examples subdirectory of readline. -*- text -*-
#
EXECUTABLES = fileman rltest
CFLAGS = -g -I../.. -I..
LDFLAGS = -g -L..
.c.o:
$(CC) $(CFLAGS) -c $<
all: $(EXECUTABLES)
fileman: fileman.o
$(CC) $(LDFLAGS) -o $@ fileman.o -lreadline -ltermcap
rltest: rltest.o
$(CC) $(LDFLAGS) -o $@ rltest.o -lreadline -ltermcap
fileman.o: fileman.c
rltest.o: rltest.c
-54
View File
@@ -1,54 +0,0 @@
/* **************************************************************** */
/* */
/* Testing Readline */
/* */
/* **************************************************************** */
#include <stdio.h>
#include <sys/types.h>
#include "../readline.h"
#include "../history.h"
main ()
{
HIST_ENTRY **history_list ();
char *temp = (char *)NULL;
char *prompt = "readline$ ";
int done = 0;
while (!done)
{
temp = readline (prompt);
/* Test for EOF. */
if (!temp)
exit (1);
/* If there is anything on the line, print it and remember it. */
if (*temp)
{
fprintf (stderr, "%s\r\n", temp);
add_history (temp);
}
/* Check for `command' that we handle. */
if (strcmp (temp, "quit") == 0)
done = 1;
if (strcmp (temp, "list") == 0)
{
HIST_ENTRY **list = history_list ();
register int i;
if (list)
{
for (i = 0; list[i]; i++)
{
fprintf (stderr, "%d: %s\r\n", i, list[i]->line);
free (list[i]->line);
}
free (list);
}
}
free (temp);
}
}
-324
View File
@@ -1,324 +0,0 @@
/* histfile.c - functions to manipulate the history file. */
/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
routines for managing the text of previously typed lines.
The Library 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 1, or (at your option)
any later version.
The Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
you can call. I think I have done that. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h>
#include <sys/types.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <fcntl.h>
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#if defined (HAVE_STRING_H)
# include <string.h>
#else
# include <strings.h>
#endif /* !HAVE_STRING_H */
#include <errno.h>
#if !defined (errno)
extern int errno;
#endif /* !errno */
#include "history.h"
#include "histlib.h"
extern char *xmalloc (), *xrealloc ();
/* Return the string that should be used in the place of this
filename. This only matters when you don't specify the
filename to read_history (), or write_history (). */
static char *
history_filename (filename)
char *filename;
{
char *return_val, *home;
int home_len;
return_val = filename ? savestring (filename) : (char *)NULL;
if (return_val)
return (return_val);
home = getenv ("HOME");
if (home == 0)
{
home = ".";
home_len = 1;
}
else
home_len = strlen (home);
return_val = xmalloc (2 + home_len + 8); /* strlen(".history") == 8 */
strcpy (return_val, home);
return_val[home_len] = '/';
strcpy (return_val + home_len + 1, ".history");
return (return_val);
}
/* Add the contents of FILENAME to the history list, a line at a time.
If FILENAME is NULL, then read from ~/.history. Returns 0 if
successful, or errno if not. */
int
read_history (filename)
char *filename;
{
return (read_history_range (filename, 0, -1));
}
/* Read a range of lines from FILENAME, adding them to the history list.
Start reading at the FROM'th line and end at the TO'th. If FROM
is zero, start at the beginning. If TO is less than FROM, read
until the end of the file. If FILENAME is NULL, then read from
~/.history. Returns 0 if successful, or errno if not. */
int
read_history_range (filename, from, to)
char *filename;
int from, to;
{
register int line_start, line_end;
char *input, *buffer = (char *)NULL;
int file, current_line;
struct stat finfo;
input = history_filename (filename);
file = open (input, O_RDONLY, 0666);
if ((file < 0) || (fstat (file, &finfo) == -1))
goto error_and_exit;
buffer = xmalloc ((int)finfo.st_size + 1);
if (read (file, buffer, finfo.st_size) != finfo.st_size)
{
error_and_exit:
if (file >= 0)
close (file);
FREE (input);
FREE (buffer);
return (errno);
}
close (file);
/* Set TO to larger than end of file if negative. */
if (to < 0)
to = finfo.st_size;
/* Start at beginning of file, work to end. */
line_start = line_end = current_line = 0;
/* Skip lines until we are at FROM. */
while (line_start < finfo.st_size && current_line < from)
{
for (line_end = line_start; line_end < finfo.st_size; line_end++)
if (buffer[line_end] == '\n')
{
current_line++;
line_start = line_end + 1;
if (current_line == from)
break;
}
}
/* If there are lines left to gobble, then gobble them now. */
for (line_end = line_start; line_end < finfo.st_size; line_end++)
if (buffer[line_end] == '\n')
{
buffer[line_end] = '\0';
if (buffer[line_start])
add_history (buffer + line_start);
current_line++;
if (current_line >= to)
break;
line_start = line_end + 1;
}
FREE (input);
FREE (buffer);
return (0);
}
/* Truncate the history file FNAME, leaving only LINES trailing lines.
If FNAME is NULL, then use ~/.history. */
int
history_truncate_file (fname, lines)
char *fname;
register int lines;
{
register int i;
int file, chars_read;
char *buffer = (char *)NULL, *filename;
struct stat finfo;
filename = history_filename (fname);
file = open (filename, O_RDONLY, 0666);
if (file == -1 || fstat (file, &finfo) == -1)
goto truncate_exit;
buffer = xmalloc ((int)finfo.st_size + 1);
chars_read = read (file, buffer, finfo.st_size);
close (file);
if (chars_read <= 0)
goto truncate_exit;
/* Count backwards from the end of buffer until we have passed
LINES lines. */
for (i = chars_read - 1; lines && i; i--)
{
if (buffer[i] == '\n')
lines--;
}
/* If this is the first line, then the file contains exactly the
number of lines we want to truncate to, so we don't need to do
anything. It's the first line if we don't find a newline between
the current value of i and 0. Otherwise, write from the start of
this line until the end of the buffer. */
for ( ; i; i--)
if (buffer[i] == '\n')
{
i++;
break;
}
/* Write only if there are more lines in the file than we want to
truncate to. */
if (i && ((file = open (filename, O_WRONLY|O_TRUNC, 0666)) != -1))
{
write (file, buffer + i, finfo.st_size - i);
close (file);
}
truncate_exit:
FREE (buffer);
free (filename);
return 0;
}
/* Workhorse function for writing history. Writes NELEMENT entries
from the history list to FILENAME. OVERWRITE is non-zero if you
wish to replace FILENAME with the entries. */
static int
history_do_write (filename, nelements, overwrite)
char *filename;
int nelements, overwrite;
{
register int i;
char *output = history_filename (filename);
int file, mode;
mode = overwrite ? O_WRONLY | O_CREAT | O_TRUNC : O_WRONLY | O_APPEND;
if ((file = open (output, mode, 0666)) == -1)
{
FREE (output);
return (errno);
}
if (nelements > history_length)
nelements = history_length;
/* Build a buffer of all the lines to write, and write them in one syscall.
Suggested by Peter Ho ([email protected]). */
{
HIST_ENTRY **the_history; /* local */
register int j;
int buffer_size;
char *buffer;
the_history = history_list ();
/* Calculate the total number of bytes to write. */
for (buffer_size = 0, i = history_length - nelements; i < history_length; i++)
buffer_size += 1 + strlen (the_history[i]->line);
/* Allocate the buffer, and fill it. */
buffer = xmalloc (buffer_size);
for (j = 0, i = history_length - nelements; i < history_length; i++)
{
strcpy (buffer + j, the_history[i]->line);
j += strlen (the_history[i]->line);
buffer[j++] = '\n';
}
write (file, buffer, buffer_size);
free (buffer);
}
close (file);
FREE (output);
return (0);
}
/* Append NELEMENT entries to FILENAME. The entries appended are from
the end of the list minus NELEMENTs up to the end of the list. */
int
append_history (nelements, filename)
int nelements;
char *filename;
{
return (history_do_write (filename, nelements, HISTORY_APPEND));
}
/* Overwrite FILENAME with the current history. If FILENAME is NULL,
then write the history list to ~/.history. Values returned
are as in read_history ().*/
int
write_history (filename)
char *filename;
{
return (history_do_write (filename, history_length, HISTORY_OVERWRITE));
}
-81
View File
@@ -1,81 +0,0 @@
/* histlib.h -- internal definitions for the history library. */
/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
routines for managing the text of previously typed lines.
The Library 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 1, or (at your option)
any later version.
The Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (_HISTLIB_H_)
#define _HISTLIB_H_
/* Function pointers can be declared as (Function *)foo. */
#if !defined (_FUNCTION_DEF)
# define _FUNCTION_DEF
typedef int Function ();
typedef void VFunction ();
typedef char *CPFunction ();
typedef char **CPPFunction ();
#endif /* _FUNCTION_DEF */
#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
#define STREQN(a, b, n) (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
#ifndef savestring
# ifndef strcpy
extern char *strcpy ();
# endif
#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
#endif
#ifndef whitespace
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
#endif
#ifndef _rl_digit_p
#define _rl_digit_p(c) ((c) >= '0' && (c) <= '9')
#endif
#ifndef _rl_digit_value
#define _rl_digit_value(c) ((c) - '0')
#endif
#ifndef member
# ifndef strchr
extern char *strchr ();
# endif
#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
#endif
#ifndef FREE
# define FREE(x) if (x) free (x)
#endif
/* Possible history errors passed to hist_error. */
#define EVENT_NOT_FOUND 0
#define BAD_WORD_SPEC 1
#define SUBST_FAILED 2
#define BAD_MODIFIER 3
/* Possible definitions for history starting point specification. */
#define ANCHORED_SEARCH 1
#define NON_ANCHORED_SEARCH 0
/* Possible definitions for what style of writing the history file we want. */
#define HISTORY_APPEND 0
#define HISTORY_OVERWRITE 1
#endif /* !_HISTLIB_H_ */
-385
View File
@@ -1,385 +0,0 @@
/* History.c -- standalone history library */
/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
routines for managing the text of previously typed lines.
The Library 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 1, or (at your option)
any later version.
The Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
you can call. I think I have done that. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h>
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#if defined (HAVE_STRING_H)
# include <string.h>
#else
# include <strings.h>
#endif /* !HAVE_STRING_H */
#include "history.h"
#include "histlib.h"
extern char *xmalloc (), *xrealloc ();
/* The number of slots to increase the_history by. */
#define DEFAULT_HISTORY_GROW_SIZE 50
/* **************************************************************** */
/* */
/* History Functions */
/* */
/* **************************************************************** */
/* An array of HIST_ENTRY. This is where we store the history. */
static HIST_ENTRY **the_history = (HIST_ENTRY **)NULL;
/* Non-zero means that we have enforced a limit on the amount of
history that we save. */
static int history_stifled;
/* If HISTORY_STIFLED is non-zero, then this is the maximum number of
entries to remember. */
int max_input_history;
/* The current location of the interactive history pointer. Just makes
life easier for outside callers. */
int history_offset;
/* The number of strings currently stored in the history list. */
int history_length;
/* The current number of slots allocated to the input_history. */
static int history_size;
/* The logical `base' of the history array. It defaults to 1. */
int history_base = 1;
/* Return the current HISTORY_STATE of the history. */
HISTORY_STATE *
history_get_history_state ()
{
HISTORY_STATE *state;
state = (HISTORY_STATE *)xmalloc (sizeof (HISTORY_STATE));
state->entries = the_history;
state->offset = history_offset;
state->length = history_length;
state->size = history_size;
state->flags = 0;
if (history_stifled)
state->flags |= HS_STIFLED;
return (state);
}
/* Set the state of the current history array to STATE. */
void
history_set_history_state (state)
HISTORY_STATE *state;
{
the_history = state->entries;
history_offset = state->offset;
history_length = state->length;
history_size = state->size;
if (state->flags & HS_STIFLED)
history_stifled = 1;
}
/* Begin a session in which the history functions might be used. This
initializes interactive variables. */
void
using_history ()
{
history_offset = history_length;
}
/* Return the number of bytes that the primary history entries are using.
This just adds up the lengths of the_history->lines. */
int
history_total_bytes ()
{
register int i, result;
result = 0;
for (i = 0; the_history && the_history[i]; i++)
result += strlen (the_history[i]->line);
return (result);
}
/* Returns the magic number which says what history element we are
looking at now. In this implementation, it returns history_offset. */
int
where_history ()
{
return (history_offset);
}
/* Make the current history item be the one at POS, an absolute index.
Returns zero if POS is out of range, else non-zero. */
int
history_set_pos (pos)
int pos;
{
if (pos > history_length || pos < 0 || !the_history)
return (0);
history_offset = pos;
return (1);
}
/* Return the current history array. The caller has to be carefull, since this
is the actual array of data, and could be bashed or made corrupt easily.
The array is terminated with a NULL pointer. */
HIST_ENTRY **
history_list ()
{
return (the_history);
}
/* Return the history entry at the current position, as determined by
history_offset. If there is no entry there, return a NULL pointer. */
HIST_ENTRY *
current_history ()
{
return ((history_offset == history_length) || the_history == 0)
? (HIST_ENTRY *)NULL
: the_history[history_offset];
}
/* Back up history_offset to the previous history entry, and return
a pointer to that entry. If there is no previous entry then return
a NULL pointer. */
HIST_ENTRY *
previous_history ()
{
return history_offset ? the_history[--history_offset] : (HIST_ENTRY *)NULL;
}
/* Move history_offset forward to the next history entry, and return
a pointer to that entry. If there is no next entry then return a
NULL pointer. */
HIST_ENTRY *
next_history ()
{
return (history_offset == history_length) ? (HIST_ENTRY *)NULL : the_history[++history_offset];
}
/* Return the history entry which is logically at OFFSET in the history array.
OFFSET is relative to history_base. */
HIST_ENTRY *
history_get (offset)
int offset;
{
int local_index;
local_index = offset - history_base;
return (local_index >= history_length || local_index < 0 || !the_history)
? (HIST_ENTRY *)NULL
: the_history[local_index];
}
/* Place STRING at the end of the history list. The data field
is set to NULL. */
void
add_history (string)
char *string;
{
HIST_ENTRY *temp;
if (history_stifled && (history_length == max_input_history))
{
register int i;
/* If the history is stifled, and history_length is zero,
and it equals max_input_history, we don't save items. */
if (history_length == 0)
return;
/* If there is something in the slot, then remove it. */
if (the_history[0])
{
free (the_history[0]->line);
free (the_history[0]);
}
/* Copy the rest of the entries, moving down one slot. */
for (i = 0; i < history_length; i++)
the_history[i] = the_history[i + 1];
history_base++;
}
else
{
if (history_size == 0)
{
history_size = DEFAULT_HISTORY_GROW_SIZE;
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
history_length = 1;
}
else
{
if (history_length == (history_size - 1))
{
history_size += DEFAULT_HISTORY_GROW_SIZE;
the_history = (HIST_ENTRY **)
xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
}
history_length++;
}
}
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
temp->line = savestring (string);
temp->data = (char *)NULL;
the_history[history_length] = (HIST_ENTRY *)NULL;
the_history[history_length - 1] = temp;
}
/* Make the history entry at WHICH have LINE and DATA. This returns
the old entry so you can dispose of the data. In the case of an
invalid WHICH, a NULL pointer is returned. */
HIST_ENTRY *
replace_history_entry (which, line, data)
int which;
char *line;
char *data;
{
HIST_ENTRY *temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
HIST_ENTRY *old_value;
if (which >= history_length)
return ((HIST_ENTRY *)NULL);
old_value = the_history[which];
temp->line = savestring (line);
temp->data = data;
the_history[which] = temp;
return (old_value);
}
/* Remove history element WHICH from the history. The removed
element is returned to you so you can free the line, data,
and containing structure. */
HIST_ENTRY *
remove_history (which)
int which;
{
HIST_ENTRY *return_value;
if (which >= history_length || !history_length)
return_value = (HIST_ENTRY *)NULL;
else
{
register int i;
return_value = the_history[which];
for (i = which; i < history_length; i++)
the_history[i] = the_history[i + 1];
history_length--;
}
return (return_value);
}
/* Stifle the history list, remembering only MAX number of lines. */
void
stifle_history (max)
int max;
{
if (max < 0)
max = 0;
if (history_length > max)
{
register int i, j;
/* This loses because we cannot free the data. */
for (i = 0, j = history_length - max; i < j; i++)
{
free (the_history[i]->line);
free (the_history[i]);
}
history_base = i;
for (j = 0, i = history_length - max; j < max; i++, j++)
the_history[j] = the_history[i];
the_history[j] = (HIST_ENTRY *)NULL;
history_length = j;
}
history_stifled = 1;
max_input_history = max;
}
/* Stop stifling the history. This returns the previous amount the
history was stifled by. The value is positive if the history was
stifled, negative if it wasn't. */
int
unstifle_history ()
{
if (history_stifled)
{
history_stifled = 0;
return (-max_input_history);
}
return (max_input_history);
}
int
history_is_stifled ()
{
return (history_stifled);
}
void
clear_history ()
{
register int i;
/* This loses because we cannot free the data. */
for (i = 0; i < history_length; i++)
{
free (the_history[i]->line);
free (the_history[i]);
the_history[i] = (HIST_ENTRY *)NULL;
}
history_offset = history_length = 0;
}
-197
View File
@@ -1,197 +0,0 @@
/* histsearch.c -- searching the history list. */
/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
routines for managing the text of previously typed lines.
The Library 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 1, or (at your option)
any later version.
The Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h>
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#if defined (HAVE_STRING_H)
# include <string.h>
#else
# include <strings.h>
#endif /* !HAVE_STRING_H */
#include "history.h"
#include "histlib.h"
/* Variables imported from other history library files. */
extern int history_offset;
/* The list of alternate characters that can delimit a history search
string. */
char *history_search_delimiter_chars = (char *)NULL;
/* Search the history for STRING, starting at history_offset.
If DIRECTION < 0, then the search is through previous entries, else
through subsequent. If ANCHORED is non-zero, the string must
appear at the beginning of a history line, otherwise, the string
may appear anywhere in the line. If the string is found, then
current_history () is the history entry, and the value of this
function is the offset in the line of that history entry that the
string was found in. Otherwise, nothing is changed, and a -1 is
returned. */
static int
history_search_internal (string, direction, anchored)
char *string;
int direction, anchored;
{
register int i, reverse;
register char *line;
register int line_index;
int string_len;
HIST_ENTRY **the_history; /* local */
i = history_offset;
reverse = (direction < 0);
/* Take care of trivial cases first. */
if (string == 0 || *string == '\0')
return (-1);
if (!history_length || ((i == history_length) && !reverse))
return (-1);
if (reverse && (i == history_length))
i--;
#define NEXT_LINE() do { if (reverse) i--; else i++; } while (0)
the_history = history_list ();
string_len = strlen (string);
while (1)
{
/* Search each line in the history list for STRING. */
/* At limit for direction? */
if ((reverse && i < 0) || (!reverse && i == history_length))
return (-1);
line = the_history[i]->line;
line_index = strlen (line);
/* If STRING is longer than line, no match. */
if (string_len > line_index)
{
NEXT_LINE ();
continue;
}
/* Handle anchored searches first. */
if (anchored == ANCHORED_SEARCH)
{
if (STREQN (string, line, string_len))
{
history_offset = i;
return (0);
}
NEXT_LINE ();
continue;
}
/* Do substring search. */
if (reverse)
{
line_index -= string_len;
while (line_index >= 0)
{
if (STREQN (string, line + line_index, string_len))
{
history_offset = i;
return (line_index);
}
line_index--;
}
}
else
{
register int limit;
limit = line_index - string_len + 1;
line_index = 0;
while (line_index < limit)
{
if (STREQN (string, line + line_index, string_len))
{
history_offset = i;
return (line_index);
}
line_index++;
}
}
NEXT_LINE ();
}
}
/* Do a non-anchored search for STRING through the history in DIRECTION. */
int
history_search (string, direction)
char *string;
int direction;
{
return (history_search_internal (string, direction, NON_ANCHORED_SEARCH));
}
/* Do an anchored search for string through the history in DIRECTION. */
int
history_search_prefix (string, direction)
char *string;
int direction;
{
return (history_search_internal (string, direction, ANCHORED_SEARCH));
}
/* Search for STRING in the history list. DIR is < 0 for searching
backwards. POS is an absolute index into the history list at
which point to begin searching. */
int
history_search_pos (string, dir, pos)
char *string;
int dir, pos;
{
int ret, old;
old = where_history ();
history_set_pos (pos);
if (history_search (string, dir) == -1)
{
history_set_pos (old);
return (-1);
}
ret = where_history ();
history_set_pos (old);
return ret;
}
-449
View File
@@ -1,449 +0,0 @@
/* input.c -- character input functions for readline. */
/* Copyright (C) 1994 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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.
The GNU Readline Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#include <fcntl.h>
#if defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif /* HAVE_SYS_FILE_H */
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_SELECT)
# if !defined (HAVE_SYS_SELECT_H) || !defined (M_UNIX)
# include <sys/time.h>
# endif
#endif /* HAVE_SELECT */
#if defined (HAVE_SYS_SELECT_H)
# include <sys/select.h>
#endif
#if defined (FIONREAD_IN_SYS_IOCTL)
# include <sys/ioctl.h>
#endif
#include <stdio.h>
#include <errno.h>
#if !defined (errno)
extern int errno;
#endif /* !errno */
/* System-specific feature definitions and include files. */
#include "rldefs.h"
/* Some standard library routines. */
#include "readline.h"
/* What kind of non-blocking I/O do we have? */
#if !defined (O_NDELAY) && defined (O_NONBLOCK)
# define O_NDELAY O_NONBLOCK /* Posix style */
#endif
/* Functions imported from other files in the library. */
extern char *xmalloc (), *xrealloc ();
/* Variables and functions from macro.c. */
extern void _rl_add_macro_char ();
extern void _rl_with_macro_input ();
extern int _rl_next_macro_key ();
extern int _rl_defining_kbd_macro;
#if defined (VI_MODE)
extern void _rl_vi_set_last ();
extern int _rl_vi_textmod_command ();
#endif /* VI_MODE */
extern FILE *rl_instream, *rl_outstream;
extern Function *rl_last_func;
extern int rl_key_sequence_length;
extern int rl_pending_input;
extern int rl_editing_mode;
extern Keymap _rl_keymap;
extern int _rl_convert_meta_chars_to_ascii;
#if defined (__GO32__)
# include <pc.h>
#endif /* __GO32__ */
/* Non-null means it is a pointer to a function to run while waiting for
character input. */
Function *rl_event_hook = (Function *)NULL;
Function *rl_getc_function = rl_getc;
/* **************************************************************** */
/* */
/* Character Input Buffering */
/* */
/* **************************************************************** */
static int pop_index, push_index;
static unsigned char ibuffer[512];
static int ibuffer_len = sizeof (ibuffer) - 1;
#define any_typein (push_index != pop_index)
int
_rl_any_typein ()
{
return any_typein;
}
/* Add KEY to the buffer of characters to be read. */
int
rl_stuff_char (key)
int key;
{
if (key == EOF)
{
key = NEWLINE;
rl_pending_input = EOF;
}
ibuffer[push_index++] = key;
if (push_index >= ibuffer_len)
push_index = 0;
return push_index;
}
/* Make C be the next command to be executed. */
int
rl_execute_next (c)
int c;
{
rl_pending_input = c;
return 0;
}
/* Return the amount of space available in the
buffer for stuffing characters. */
static int
ibuffer_space ()
{
if (pop_index > push_index)
return (pop_index - push_index);
else
return (ibuffer_len - (push_index - pop_index));
}
/* Get a key from the buffer of characters to be read.
Return the key in KEY.
Result is KEY if there was a key, or 0 if there wasn't. */
static int
rl_get_char (key)
int *key;
{
if (push_index == pop_index)
return (0);
*key = ibuffer[pop_index++];
if (pop_index >= ibuffer_len)
pop_index = 0;
return (1);
}
/* Stuff KEY into the *front* of the input buffer.
Returns non-zero if successful, zero if there is
no space left in the buffer. */
static int
rl_unget_char (key)
int key;
{
if (ibuffer_space ())
{
pop_index--;
if (pop_index < 0)
pop_index = ibuffer_len - 1;
ibuffer[pop_index] = key;
return (1);
}
return (0);
}
/* If a character is available to be read, then read it
and stuff it into IBUFFER. Otherwise, just return. */
static void
rl_gather_tyi ()
{
#if defined (__GO32__)
char input;
if (isatty (0) && kbhit () && ibuffer_space ())
{
int i;
i = (*rl_getc_function) (rl_instream);
rl_stuff_char (i);
}
#else /* !__GO32__ */
int tty;
register int tem, result;
int chars_avail;
char input;
#if defined(HAVE_SELECT)
fd_set readfds, exceptfds;
struct timeval timeout;
#endif
tty = fileno (rl_instream);
#if defined (HAVE_SELECT)
FD_ZERO (&readfds);
FD_ZERO (&exceptfds);
FD_SET (tty, &readfds);
FD_SET (tty, &exceptfds);
timeout.tv_sec = 0;
timeout.tv_usec = 100000; /* 0.1 seconds */
if (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) <= 0)
return; /* Nothing to read. */
#endif
result = -1;
#if defined (FIONREAD)
result = ioctl (tty, FIONREAD, &chars_avail);
#endif
#if defined (O_NDELAY)
if (result == -1)
{
tem = fcntl (tty, F_GETFL, 0);
fcntl (tty, F_SETFL, (tem | O_NDELAY));
chars_avail = read (tty, &input, 1);
fcntl (tty, F_SETFL, tem);
if (chars_avail == -1 && errno == EAGAIN)
return;
}
#endif /* O_NDELAY */
/* If there's nothing available, don't waste time trying to read
something. */
if (chars_avail <= 0)
return;
tem = ibuffer_space ();
if (chars_avail > tem)
chars_avail = tem;
/* One cannot read all of the available input. I can only read a single
character at a time, or else programs which require input can be
thwarted. If the buffer is larger than one character, I lose.
Damn! */
if (tem < ibuffer_len)
chars_avail = 0;
if (result != -1)
{
while (chars_avail--)
rl_stuff_char ((*rl_getc_function) (rl_instream));
}
else
{
if (chars_avail)
rl_stuff_char (input);
}
#endif /* !__GO32__ */
}
/* Is there input available to be read on the readline input file
descriptor? Only works if the system has select(2) or FIONREAD. */
int
_rl_input_available ()
{
#if defined(HAVE_SELECT)
fd_set readfds, exceptfds;
struct timeval timeout;
#endif
#if defined(FIONREAD)
int chars_avail;
#endif
int tty;
tty = fileno (rl_instream);
#if defined (HAVE_SELECT)
FD_ZERO (&readfds);
FD_ZERO (&exceptfds);
FD_SET (tty, &readfds);
FD_SET (tty, &exceptfds);
timeout.tv_sec = 0;
timeout.tv_usec = 100000; /* 0.1 seconds */
return (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) > 0);
#endif
#if defined (FIONREAD)
if (ioctl (tty, FIONREAD, &chars_avail) == 0)
return (chars_avail);
#endif
return 0;
}
void
_rl_insert_typein (c)
int c;
{
int key, t, i;
char *string;
i = key = 0;
string = xmalloc (ibuffer_len + 1);
string[i++] = (char) c;
while ((t = rl_get_char (&key)) &&
_rl_keymap[key].type == ISFUNC &&
_rl_keymap[key].function == rl_insert)
string[i++] = key;
if (t)
rl_unget_char (key);
string[i] = '\0';
rl_insert_text (string);
free (string);
}
/* **************************************************************** */
/* */
/* Character Input */
/* */
/* **************************************************************** */
/* Read a key, including pending input. */
int
rl_read_key ()
{
int c;
rl_key_sequence_length++;
if (rl_pending_input)
{
c = rl_pending_input;
rl_pending_input = 0;
}
else
{
/* If input is coming from a macro, then use that. */
if (c = _rl_next_macro_key ())
return (c);
/* If the user has an event function, then call it periodically. */
if (rl_event_hook)
{
while (rl_event_hook && rl_get_char (&c) == 0)
{
(*rl_event_hook) ();
rl_gather_tyi ();
}
}
else
{
if (rl_get_char (&c) == 0)
c = (*rl_getc_function) (rl_instream);
}
}
return (c);
}
int
rl_getc (stream)
FILE *stream;
{
int result, flags;
unsigned char c;
#if defined (__GO32__)
if (isatty (0))
return (getkey () & 0x7F);
#endif /* __GO32__ */
while (1)
{
result = read (fileno (stream), &c, sizeof (unsigned char));
if (result == sizeof (unsigned char))
return (c);
/* If zero characters are returned, then the file that we are
reading from is empty! Return EOF in that case. */
if (result == 0)
return (EOF);
#if defined (EWOULDBLOCK)
if (errno == EWOULDBLOCK)
{
if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
return (EOF);
if (flags & O_NDELAY)
{
flags &= ~O_NDELAY;
fcntl (fileno (stream), F_SETFL, flags);
continue;
}
continue;
}
#endif /* EWOULDBLOCK */
#if defined (_POSIX_VERSION) && defined (EAGAIN) && defined (O_NONBLOCK)
if (errno == EAGAIN)
{
if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
return (EOF);
if (flags & O_NONBLOCK)
{
flags &= ~O_NONBLOCK;
fcntl (fileno (stream), F_SETFL, flags);
continue;
}
}
#endif /* _POSIX_VERSION && EAGAIN && O_NONBLOCK */
#if !defined (__GO32__)
/* If the error that we received was SIGINT, then try again,
this is simply an interrupted system call to read ().
Otherwise, some error ocurred, also signifying EOF. */
if (errno != EINTR)
return (EOF);
#endif /* !__GO32__ */
}
}
-547
View File
@@ -1,547 +0,0 @@
/* kill.c -- kill ring management. */
/* Copyright (C) 1994 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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 1, or
(at your option) any later version.
The GNU Readline Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h> /* for _POSIX_VERSION */
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include <stdio.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
extern int _rl_last_command_was_kill;
extern int rl_editing_mode;
extern int rl_explicit_arg;
extern Function *rl_last_func;
extern void _rl_init_argument ();
extern int _rl_set_mark_at_pos ();
extern void _rl_abort_internal ();
extern char *xmalloc (), *xrealloc ();
/* **************************************************************** */
/* */
/* Killing Mechanism */
/* */
/* **************************************************************** */
/* What we assume for a max number of kills. */
#define DEFAULT_MAX_KILLS 10
/* The real variable to look at to find out when to flush kills. */
static int rl_max_kills = DEFAULT_MAX_KILLS;
/* Where to store killed text. */
static char **rl_kill_ring = (char **)NULL;
/* Where we are in the kill ring. */
static int rl_kill_index;
/* How many slots we have in the kill ring. */
static int rl_kill_ring_length;
/* How to say that you only want to save a certain amount
of kill material. */
int
rl_set_retained_kills (num)
int num;
{
return 0;
}
/* Add TEXT to the kill ring, allocating a new kill ring slot as necessary.
This uses TEXT directly, so the caller must not free it. If APPEND is
non-zero, and the last command was a kill, the text is appended to the
current kill ring slot, otherwise prepended. */
static int
_rl_copy_to_kill_ring (text, append)
char *text;
int append;
{
char *old, *new;
int slot;
/* First, find the slot to work with. */
if (_rl_last_command_was_kill == 0)
{
/* Get a new slot. */
if (rl_kill_ring == 0)
{
/* If we don't have any defined, then make one. */
rl_kill_ring = (char **)
xmalloc (((rl_kill_ring_length = 1) + 1) * sizeof (char *));
rl_kill_ring[slot = 0] = (char *)NULL;
}
else
{
/* We have to add a new slot on the end, unless we have
exceeded the max limit for remembering kills. */
slot = rl_kill_ring_length;
if (slot == rl_max_kills)
{
register int i;
free (rl_kill_ring[0]);
for (i = 0; i < slot; i++)
rl_kill_ring[i] = rl_kill_ring[i + 1];
}
else
{
slot = rl_kill_ring_length += 1;
rl_kill_ring = (char **)xrealloc (rl_kill_ring, slot * sizeof (char *));
}
rl_kill_ring[--slot] = (char *)NULL;
}
}
else
slot = rl_kill_ring_length - 1;
/* If the last command was a kill, prepend or append. */
if (_rl_last_command_was_kill && rl_editing_mode != vi_mode)
{
old = rl_kill_ring[slot];
new = xmalloc (1 + strlen (old) + strlen (text));
if (append)
{
strcpy (new, old);
strcat (new, text);
}
else
{
strcpy (new, text);
strcat (new, old);
}
free (old);
free (text);
rl_kill_ring[slot] = new;
}
else
rl_kill_ring[slot] = text;
rl_kill_index = slot;
return 0;
}
/* The way to kill something. This appends or prepends to the last
kill, if the last command was a kill command. if FROM is less
than TO, then the text is appended, otherwise prepended. If the
last command was not a kill command, then a new slot is made for
this kill. */
int
rl_kill_text (from, to)
int from, to;
{
char *text;
/* Is there anything to kill? */
if (from == to)
{
_rl_last_command_was_kill++;
return 0;
}
text = rl_copy_text (from, to);
/* Delete the copied text from the line. */
rl_delete_text (from, to);
_rl_copy_to_kill_ring (text, from < to);
_rl_last_command_was_kill++;
return 0;
}
/* Now REMEMBER! In order to do prepending or appending correctly, kill
commands always make rl_point's original position be the FROM argument,
and rl_point's extent be the TO argument. */
/* **************************************************************** */
/* */
/* Killing Commands */
/* */
/* **************************************************************** */
/* Delete the word at point, saving the text in the kill ring. */
int
rl_kill_word (count, key)
int count, key;
{
int orig_point = rl_point;
if (count < 0)
return (rl_backward_kill_word (-count, key));
else
{
rl_forward_word (count, key);
if (rl_point != orig_point)
rl_kill_text (orig_point, rl_point);
rl_point = orig_point;
}
return 0;
}
/* Rubout the word before point, placing it on the kill ring. */
int
rl_backward_kill_word (count, ignore)
int count, ignore;
{
int orig_point = rl_point;
if (count < 0)
return (rl_kill_word (-count, ignore));
else
{
rl_backward_word (count, ignore);
if (rl_point != orig_point)
rl_kill_text (orig_point, rl_point);
}
return 0;
}
/* Kill from here to the end of the line. If DIRECTION is negative, kill
back to the line start instead. */
int
rl_kill_line (direction, ignore)
int direction, ignore;
{
int orig_point = rl_point;
if (direction < 0)
return (rl_backward_kill_line (1, ignore));
else
{
rl_end_of_line (1, ignore);
if (orig_point != rl_point)
rl_kill_text (orig_point, rl_point);
rl_point = orig_point;
}
return 0;
}
/* Kill backwards to the start of the line. If DIRECTION is negative, kill
forwards to the line end instead. */
int
rl_backward_kill_line (direction, ignore)
int direction, ignore;
{
int orig_point = rl_point;
if (direction < 0)
return (rl_kill_line (1, ignore));
else
{
if (!rl_point)
ding ();
else
{
rl_beg_of_line (1, ignore);
rl_kill_text (orig_point, rl_point);
}
}
return 0;
}
/* Kill the whole line, no matter where point is. */
int
rl_kill_full_line (count, ignore)
int count, ignore;
{
rl_begin_undo_group ();
rl_point = 0;
rl_kill_text (rl_point, rl_end);
rl_end_undo_group ();
return 0;
}
/* The next two functions mimic unix line editing behaviour, except they
save the deleted text on the kill ring. This is safer than not saving
it, and since we have a ring, nobody should get screwed. */
/* This does what C-w does in Unix. We can't prevent people from
using behaviour that they expect. */
int
rl_unix_word_rubout (count, key)
int count, key;
{
int orig_point;
if (rl_point == 0)
ding ();
else
{
orig_point = rl_point;
if (count <= 0)
count = 1;
while (count--)
{
while (rl_point && whitespace (rl_line_buffer[rl_point - 1]))
rl_point--;
while (rl_point && (whitespace (rl_line_buffer[rl_point - 1]) == 0))
rl_point--;
}
rl_kill_text (orig_point, rl_point);
}
return 0;
}
/* Here is C-u doing what Unix does. You don't *have* to use these
key-bindings. We have a choice of killing the entire line, or
killing from where we are to the start of the line. We choose the
latter, because if you are a Unix weenie, then you haven't backspaced
into the line at all, and if you aren't, then you know what you are
doing. */
int
rl_unix_line_discard (count, key)
int count, key;
{
if (rl_point == 0)
ding ();
else
{
rl_kill_text (rl_point, 0);
rl_point = 0;
}
return 0;
}
/* Copy the text in the `region' to the kill ring. If DELETE is non-zero,
delete the text from the line as well. */
static int
region_kill_internal (delete)
int delete;
{
char *text;
if (rl_mark == rl_point)
{
_rl_last_command_was_kill++;
return 0;
}
text = rl_copy_text (rl_point, rl_mark);
if (delete)
rl_delete_text (rl_point, rl_mark);
_rl_copy_to_kill_ring (text, rl_point < rl_mark);
_rl_last_command_was_kill++;
return 0;
}
/* Copy the text in the region to the kill ring. */
int
rl_copy_region_to_kill (count, ignore)
int count, ignore;
{
return (region_kill_internal (0));
}
/* Kill the text between the point and mark. */
int
rl_kill_region (count, ignore)
int count, ignore;
{
return (region_kill_internal (1));
}
/* Copy COUNT words to the kill ring. DIR says which direction we look
to find the words. */
static int
_rl_copy_word_as_kill (count, dir)
int count, dir;
{
int om, op, r;
om = rl_mark;
op = rl_point;
if (dir > 0)
rl_forward_word (count, 0);
else
rl_backward_word (count, 0);
rl_mark = rl_point;
if (dir > 0)
rl_backward_word (count, 0);
else
rl_forward_word (count, 0);
r = region_kill_internal (0);
rl_mark = om;
rl_point = op;
return r;
}
int
rl_copy_forward_word (count, key)
int count, key;
{
if (count < 0)
return (rl_copy_backward_word (-count, key));
return (_rl_copy_word_as_kill (count, 1));
}
int
rl_copy_backward_word (count, key)
int count, key;
{
if (count < 0)
return (rl_copy_forward_word (-count, key));
return (_rl_copy_word_as_kill (count, -1));
}
/* Yank back the last killed text. This ignores arguments. */
int
rl_yank (count, ignore)
int count, ignore;
{
if (rl_kill_ring == 0)
{
_rl_abort_internal ();
return -1;
}
_rl_set_mark_at_pos (rl_point);
rl_insert_text (rl_kill_ring[rl_kill_index]);
return 0;
}
/* If the last command was yank, or yank_pop, and the text just
before point is identical to the current kill item, then
delete that text from the line, rotate the index down, and
yank back some other text. */
int
rl_yank_pop (count, key)
int count, key;
{
int l, n;
if (((rl_last_func != rl_yank_pop) && (rl_last_func != rl_yank)) ||
!rl_kill_ring)
{
_rl_abort_internal ();
return -1;
}
l = strlen (rl_kill_ring[rl_kill_index]);
n = rl_point - l;
if (n >= 0 && STREQN (rl_line_buffer + n, rl_kill_ring[rl_kill_index], l))
{
rl_delete_text (n, rl_point);
rl_point = n;
rl_kill_index--;
if (rl_kill_index < 0)
rl_kill_index = rl_kill_ring_length - 1;
rl_yank (1, 0);
return 0;
}
else
{
_rl_abort_internal ();
return -1;
}
}
/* Yank the COUNTth argument from the previous history line. */
int
rl_yank_nth_arg (count, ignore)
int count, ignore;
{
register HIST_ENTRY *entry;
char *arg;
entry = previous_history ();
if (entry)
next_history ();
else
{
ding ();
return -1;
}
arg = history_arg_extract (count, count, entry->line);
if (!arg || !*arg)
{
ding ();
return -1;
}
rl_begin_undo_group ();
#if defined (VI_MODE)
/* Vi mode always inserts a space before yanking the argument, and it
inserts it right *after* rl_point. */
if (rl_editing_mode == vi_mode)
{
rl_vi_append_mode ();
rl_insert_text (" ");
}
#endif /* VI_MODE */
rl_insert_text (arg);
free (arg);
rl_end_undo_group ();
return 0;
}
/* Yank the last argument from the previous history line. This `knows'
how rl_yank_nth_arg treats a count of `$'. With an argument, this
behaves the same as rl_yank_nth_arg. */
int
rl_yank_last_arg (count, key)
int count, key;
{
if (rl_explicit_arg)
return (rl_yank_nth_arg (count, key));
else
return (rl_yank_nth_arg ('$', key));
}
-277
View File
@@ -1,277 +0,0 @@
/* macro.c -- keyboard macros for readline. */
/* Copyright (C) 1994 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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 1, or
(at your option) any later version.
The GNU Readline Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h> /* for _POSIX_VERSION */
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include <stdio.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
/* Forward definitions. */
void _rl_push_executing_macro (), _rl_pop_executing_macro ();
void _rl_add_macro_char ();
/* Extern declarations. */
extern int rl_explicit_arg;
extern int rl_key_sequence_length;
extern void _rl_abort_internal ();
extern char *xmalloc (), *xrealloc ();
/* **************************************************************** */
/* */
/* Hacking Keyboard Macros */
/* */
/* **************************************************************** */
/* Non-zero means to save keys that we dispatch on in a kbd macro. */
int _rl_defining_kbd_macro = 0;
/* The currently executing macro string. If this is non-zero,
then it is a malloc ()'ed string where input is coming from. */
char *_rl_executing_macro = (char *)NULL;
/* The offset in the above string to the next character to be read. */
static int executing_macro_index;
/* The current macro string being built. Characters get stuffed
in here by add_macro_char (). */
static char *current_macro = (char *)NULL;
/* The size of the buffer allocated to current_macro. */
static int current_macro_size;
/* The index at which characters are being added to current_macro. */
static int current_macro_index;
/* A structure used to save nested macro strings.
It is a linked list of string/index for each saved macro. */
struct saved_macro {
struct saved_macro *next;
char *string;
int sindex;
};
/* The list of saved macros. */
static struct saved_macro *macro_list = (struct saved_macro *)NULL;
/* Set up to read subsequent input from STRING.
STRING is free ()'ed when we are done with it. */
void
_rl_with_macro_input (string)
char *string;
{
_rl_push_executing_macro ();
_rl_executing_macro = string;
executing_macro_index = 0;
}
/* Return the next character available from a macro, or 0 if
there are no macro characters. */
int
_rl_next_macro_key ()
{
if (_rl_executing_macro == 0)
return (0);
if (_rl_executing_macro[executing_macro_index] == 0)
{
_rl_pop_executing_macro ();
return (_rl_next_macro_key ());
}
return (_rl_executing_macro[executing_macro_index++]);
}
/* Save the currently executing macro on a stack of saved macros. */
void
_rl_push_executing_macro ()
{
struct saved_macro *saver;
saver = (struct saved_macro *)xmalloc (sizeof (struct saved_macro));
saver->next = macro_list;
saver->sindex = executing_macro_index;
saver->string = _rl_executing_macro;
macro_list = saver;
}
/* Discard the current macro, replacing it with the one
on the top of the stack of saved macros. */
void
_rl_pop_executing_macro ()
{
struct saved_macro *macro;
if (_rl_executing_macro)
free (_rl_executing_macro);
_rl_executing_macro = (char *)NULL;
executing_macro_index = 0;
if (macro_list)
{
macro = macro_list;
_rl_executing_macro = macro_list->string;
executing_macro_index = macro_list->sindex;
macro_list = macro_list->next;
free (macro);
}
}
/* Add a character to the macro being built. */
void
_rl_add_macro_char (c)
int c;
{
if (current_macro_index + 1 >= current_macro_size)
{
if (current_macro == 0)
current_macro = xmalloc (current_macro_size = 25);
else
current_macro = xrealloc (current_macro, current_macro_size += 25);
}
current_macro[current_macro_index++] = c;
current_macro[current_macro_index] = '\0';
}
void
_rl_kill_kbd_macro ()
{
if (current_macro)
{
free (current_macro);
current_macro = (char *) NULL;
}
current_macro_size = current_macro_index = 0;
if (_rl_executing_macro)
{
free (_rl_executing_macro);
_rl_executing_macro = (char *) NULL;
}
executing_macro_index = 0;
_rl_defining_kbd_macro = 0;
}
/* Begin defining a keyboard macro.
Keystrokes are recorded as they are executed.
End the definition with rl_end_kbd_macro ().
If a numeric argument was explicitly typed, then append this
definition to the end of the existing macro, and start by
re-executing the existing macro. */
int
rl_start_kbd_macro (ignore1, ignore2)
int ignore1, ignore2;
{
if (_rl_defining_kbd_macro)
{
_rl_abort_internal ();
return -1;
}
if (rl_explicit_arg)
{
if (current_macro)
_rl_with_macro_input (savestring (current_macro));
}
else
current_macro_index = 0;
_rl_defining_kbd_macro = 1;
return 0;
}
/* Stop defining a keyboard macro.
A numeric argument says to execute the macro right now,
that many times, counting the definition as the first time. */
int
rl_end_kbd_macro (count, ignore)
int count, ignore;
{
if (_rl_defining_kbd_macro == 0)
{
_rl_abort_internal ();
return -1;
}
current_macro_index -= rl_key_sequence_length - 1;
current_macro[current_macro_index] = '\0';
_rl_defining_kbd_macro = 0;
return (rl_call_last_kbd_macro (--count, 0));
}
/* Execute the most recently defined keyboard macro.
COUNT says how many times to execute it. */
int
rl_call_last_kbd_macro (count, ignore)
int count, ignore;
{
if (current_macro == 0)
_rl_abort_internal ();
if (_rl_defining_kbd_macro)
{
ding (); /* no recursive macros */
current_macro[--current_macro_index] = '\0'; /* erase this char */
return 0;
}
while (count--)
_rl_with_macro_input (savestring (current_macro));
return 0;
}
void
rl_push_macro_input (macro)
char *macro;
{
_rl_with_macro_input (macro);
}
-198
View File
@@ -1,198 +0,0 @@
/* nls.c -- skeletal internationalization code. */
/* Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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 1, or
(at your option) any later version.
The GNU Readline Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_LOCALE_H)
# include <locale.h>
#endif
#include <ctype.h>
#include "rldefs.h"
extern int _rl_convert_meta_chars_to_ascii;
extern int _rl_output_meta_chars;
extern int _rl_meta_flag;
/* A list of legal values for the LANG or LC_CTYPE environment variables.
If a locale name in this list is the value for the LC_ALL, LC_CTYPE,
or LANG environment variable (using the first of those with a value),
readline eight-bit mode is enabled. */
static char *legal_lang_values[] =
{
"iso88591",
"iso88592",
"iso88593",
"iso88594",
"iso88595",
"iso88596",
"iso88597",
"iso88598",
"iso88599",
"iso885910",
"koi8r",
0
};
static char *normalize_codeset ();
static char *find_codeset ();
/* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value
to decide the defaults for 8-bit character input and output. Returns
1 if we set eight-bit mode. */
int
_rl_init_eightbit ()
{
char *lspec, *t;
int i;
lspec = getenv ("LC_ALL");
if (lspec == 0) lspec = getenv ("LC_CTYPE");
if (lspec == 0) lspec = getenv ("LANG");
if (lspec == 0 || (t = normalize_codeset (lspec)) == 0)
return (0);
for (i = 0; t && legal_lang_values[i]; i++)
if (STREQ (t, legal_lang_values[i]))
{
_rl_meta_flag = 1;
_rl_convert_meta_chars_to_ascii = 0;
_rl_output_meta_chars = 1;
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, lspec);
#endif
break;
}
free (t);
return (legal_lang_values[i] ? 1 : 0);
}
static char *
normalize_codeset (codeset)
char *codeset;
{
size_t namelen, i;
int len, all_digits;
char *wp, *retval;
codeset = find_codeset (codeset, &namelen);
if (codeset == 0)
return (codeset);
all_digits = 1;
for (len = 0, i = 0; i < namelen; i++)
{
if (isalnum (codeset[i]))
{
len++;
all_digits &= isdigit (codeset[i]);
}
}
retval = (char *)malloc ((all_digits ? 3 : 0) + len + 1);
if (retval == 0)
return ((char *)0);
wp = retval;
/* Add `iso' to beginning of an all-digit codeset */
if (all_digits)
{
*wp++ = 'i';
*wp++ = 's';
*wp++ = 'o';
}
for (i = 0; i < namelen; i++)
if (isalpha (codeset[i]))
*wp++ = (isupper (codeset[i])) ? tolower (codeset[i]) : codeset[i];
else if (isdigit (codeset[i]))
*wp++ = codeset[i];
*wp = '\0';
return retval;
}
/* Isolate codeset portion of locale specification. */
static char *
find_codeset (name, lenp)
char *name;
size_t *lenp;
{
char *cp, *language, *result;
cp = language = name;
result = (char *)0;
while (*cp && *cp != '_' && *cp != '@' && *cp != '+' && *cp != ',')
cp++;
/* This does not make sense: language has to be specified. As
an exception we allow the variable to contain only the codeset
name. Perhaps there are funny codeset names. */
if (language == cp)
{
*lenp = strlen (language);
result = language;
}
else
{
/* Next is the territory. */
if (*cp == '_')
do
++cp;
while (*cp && *cp != '.' && *cp != '@' && *cp != '+' && *cp != ',' && *cp != '_');
/* Now, finally, is the codeset. */
result = cp;
if (*cp == '.')
do
++cp;
while (*cp && *cp != '@');
if (cp - result > 2)
{
result++;
*lenp = cp - result;
}
else
{
*lenp = strlen (language);
result = language;
}
}
return result;
}
-49
View File
@@ -1,49 +0,0 @@
/* posixdir.h -- Posix directory reading includes and defines. */
/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash 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 1, or (at your option)
any later version.
Bash 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 Bash; see the file COPYING. If not, write to the Free
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* This file should be included instead of <dirent.h> or <sys/dir.h>. */
#if !defined (_POSIXDIR_H_)
#define _POSIXDIR_H_
#if defined (HAVE_DIRENT_H)
# include <dirent.h>
# define D_NAMLEN(d) (strlen ((d)->d_name))
#else
# if defined (HAVE_SYS_NDIR_H)
# include <sys/ndir.h>
# endif
# if defined (HAVE_SYS_DIR_H)
# include <sys/dir.h>
# endif
# if defined (HAVE_NDIR_H)
# include <ndir.h>
# endif
# if !defined (dirent)
# define dirent direct
# endif /* !dirent */
# define D_NAMLEN(d) ((d)->d_namlen)
#endif /* !HAVE_DIRENT_H */
#if defined (STRUCT_DIRENT_HAS_D_INO)
# define d_fileno d_ino
#endif
#endif /* !_POSIXDIR_H_ */
File diff suppressed because it is too large. Load diff
-146
View File
@@ -1,146 +0,0 @@
/* rldefs.h -- an attempt to isolate some of the system-specific defines
for readline. This should be included after any files that define
system-specific constants like _POSIX_VERSION or USG. */
/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
This file contains the Readline Library (the Library), a set of
routines for providing Emacs style line input to programs that ask
for it.
The Library 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 1, or (at your option)
any later version.
The Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (_RLDEFS_H_)
#define _RLDEFS_H_
#if defined (HAVE_CONFIG_H)
# include "config.h"
#endif
#if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
# define TERMIOS_TTY_DRIVER
#else
# if defined (HAVE_TERMIO_H)
# define TERMIO_TTY_DRIVER
# else
# define NEW_TTY_DRIVER
# endif
#endif
#if defined (HAVE_SYS_STREAM_H)
# include <sys/stream.h>
#endif /* HAVE_SYS_STREAM_H */
#if defined (HAVE_SYS_PTEM_H)
# include <sys/ptem.h>
# define _IO_PTEM_H /* work around SVR4.2 1.1.4 bug */
#endif /* HAVE_SYS_PTEM_H */
#if defined (HAVE_SYS_PTE_H)
# include <sys/pte.h>
#endif /* HAVE_SYS_PTE_H */
/* Posix macro to check file in statbuf for directory-ness.
This requires that <sys/stat.h> be included before this test. */
#if defined (S_IFDIR) && !defined (S_ISDIR)
# define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
#endif
/* Decide which flavor of the header file describing the C library
string functions to include and include it. */
#if defined (HAVE_STRING_H)
# include <string.h>
#else /* !HAVE_STRING_H */
# include <strings.h>
#endif /* !HAVE_STRING_H */
#if !defined (strchr) && !defined (__STDC__)
extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
#if defined (PREFER_STDARG)
# include <stdarg.h>
#else
# if defined (PREFER_VARARGS)
# include <varargs.h>
# endif
#endif
#if defined (HAVE_STRCASECMP)
#define _rl_stricmp strcasecmp
#define _rl_strnicmp strncasecmp
#else
extern int _rl_stricmp (), _rl_strnicmp ();
#endif
#if !defined (emacs_mode)
# define no_mode -1
# define vi_mode 0
# define emacs_mode 1
#endif
/* If you cast map[key].function to type (Keymap) on a Cray,
the compiler takes the value of map[key].function and
divides it by 4 to convert between pointer types (pointers
to functions and pointers to structs are different sizes).
This is not what is wanted. */
#if defined (CRAY)
# define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function)
# define KEYMAP_TO_FUNCTION(data) (Function *)((int)(data))
#else
# define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function)
# define KEYMAP_TO_FUNCTION(data) (Function *)(data)
#endif
#ifndef savestring
extern char *xmalloc ();
#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
#endif
/* Possible values for _rl_bell_preference. */
#define NO_BELL 0
#define AUDIBLE_BELL 1
#define VISIBLE_BELL 2
/* Definitions used when searching the line for characters. */
/* NOTE: it is necessary that opposite directions are inverses */
#define FTO 1 /* forward to */
#define BTO -1 /* backward to */
#define FFIND 2 /* forward find */
#define BFIND -2 /* backward find */
/* Possible values for the found_quote flags word used by the completion
functions. It says what kind of (shell-like) quoting we found anywhere
in the line. */
#define RL_QF_SINGLE_QUOTE 0x1
#define RL_QF_DOUBLE_QUOTE 0x2
#define RL_QF_BACKSLASH 0x4
/* Default readline line buffer length. */
#define DEFAULT_BUFFER_SIZE 256
#if !defined (STREQ)
#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
#define STREQN(a, b, n) (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
#endif
#if !defined (FREE)
# define FREE(x) if (x) free (x)
#endif
/* CONFIGURATION SECTION */
#include "rlconf.h"
#endif /* !_RLDEFS_H_ */
-61
View File
@@ -1,61 +0,0 @@
/* rltty.h - tty driver-related definitions used by some library files. */
/* Copyright (C) 1995 Free Software Foundation, Inc.
This file contains the Readline Library (the Library), a set of
routines for providing Emacs style line input to programs that ask
for it.
The Library 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 1, or (at your option)
any later version.
The Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (_RLTTY_H_)
#define _RLTTY_H
/* Posix systems use termios and the Posix signal functions. */
#if defined (TERMIOS_TTY_DRIVER)
# include <termios.h>
#endif /* TERMIOS_TTY_DRIVER */
/* System V machines use termio. */
#if defined (TERMIO_TTY_DRIVER)
# include <termio.h>
# if !defined (TCOON)
# define TCOON 1
# endif
#endif /* TERMIO_TTY_DRIVER */
/* Other (BSD) machines use sgtty. */
#if defined (NEW_TTY_DRIVER)
# include <sgtty.h>
#endif
/* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
it is not already defined. It is used both to determine if a
special character is disabled and to disable certain special
characters. Posix systems should set to 0, USG systems to -1. */
#if !defined (NEW_TTY_DRIVER) && !defined (_POSIX_VDISABLE)
# if defined (_SVR4_VDISABLE)
# define _POSIX_VDISABLE _SVR4_VDISABLE
# else
# if defined (_POSIX_VERSION)
# define _POSIX_VDISABLE 0
# else /* !_POSIX_VERSION */
# define _POSIX_VDISABLE -1
# endif /* !_POSIX_VERSION */
# endif /* !_SVR4_DISABLE */
#endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
#endif /* _RLTTY_H_ */
-334
View File
@@ -1,334 +0,0 @@
/* signals.c -- signal handling support for readline. */
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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 1, or
(at your option) any later version.
The GNU Readline Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h> /* Just for NULL. Yuck. */
#include <sys/types.h>
#include <signal.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#if defined (GWINSZ_IN_SYS_IOCTL)
# include <sys/ioctl.h>
#endif /* GWINSZ_IN_SYS_IOCTL */
#if defined (__GO32__)
# undef HANDLE_SIGNALS
#endif /* __GO32__ */
#if defined (HANDLE_SIGNALS)
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
extern int readline_echoing_p;
extern int rl_pending_input;
extern int _rl_meta_flag;
extern void free_undo_list ();
extern void _rl_get_screen_size ();
extern void _rl_redisplay_after_sigwinch ();
extern void _rl_clean_up_for_exit ();
extern void _rl_kill_kbd_macro ();
extern void _rl_init_argument ();
extern void rl_deprep_terminal (), rl_prep_terminal ();
#if !defined (RETSIGTYPE)
# if defined (VOID_SIGHANDLER)
# define RETSIGTYPE void
# else
# define RETSIGTYPE int
# endif /* !VOID_SIGHANDLER */
#endif /* !RETSIGTYPE */
#if defined (VOID_SIGHANDLER)
# define SIGHANDLER_RETURN return
#else
# define SIGHANDLER_RETURN return (0)
#endif
/* This typedef is equivalant to the one for Function; it allows us
to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
typedef RETSIGTYPE SigHandler ();
static SigHandler *rl_set_sighandler ();
/* **************************************************************** */
/* */
/* Signal Handling */
/* */
/* **************************************************************** */
#if defined (HAVE_POSIX_SIGNALS)
typedef struct sigaction sighandler_cxt;
# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
#else
typedef struct { SigHandler *sa_handler; } sighandler_cxt;
# define sigemptyset(m)
#endif /* !HAVE_POSIX_SIGNALS */
static sighandler_cxt old_int, old_alrm;
#if !defined (SHELL)
static sighandler_cxt old_tstp, old_ttou, old_ttin, old_term;
#endif /* !SHELL */
#if defined (SIGWINCH)
static sighandler_cxt old_winch;
#endif
/* Readline signal handler functions. */
static RETSIGTYPE
rl_signal_handler (sig)
int sig;
{
#if defined (HAVE_POSIX_SIGNALS)
sigset_t set;
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
long omask;
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
/* Since the signal will not be blocked while we are in the signal
handler, ignore it until rl_clear_signals resets the catcher. */
if (sig == SIGINT || sig == SIGALRM)
rl_set_sighandler (sig, SIG_IGN, (sighandler_cxt *)NULL);
#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
switch (sig)
{
case SIGINT:
{
register HIST_ENTRY *entry;
free_undo_list ();
entry = current_history ();
if (entry)
entry->data = (char *)NULL;
}
_rl_kill_kbd_macro ();
rl_clear_message ();
_rl_init_argument ();
#if defined (SIGTSTP)
case SIGTSTP:
case SIGTTOU:
case SIGTTIN:
#endif /* SIGTSTP */
case SIGALRM:
case SIGTERM:
_rl_clean_up_for_exit ();
(*rl_deprep_term_function) ();
rl_clear_signals ();
rl_pending_input = 0;
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
sigdelset (&set, sig);
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
omask = sigblock (0);
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
kill (getpid (), sig);
/* Let the signal that we just sent through. */
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL);
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
sigsetmask (omask & ~(sigmask (sig)));
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
(*rl_prep_term_function) (_rl_meta_flag);
rl_set_signals ();
}
SIGHANDLER_RETURN;
}
#if defined (SIGWINCH)
static RETSIGTYPE
rl_handle_sigwinch (sig)
int sig;
{
SigHandler *oh;
if (readline_echoing_p)
{
_rl_get_screen_size (fileno (rl_instream), 1);
_rl_redisplay_after_sigwinch ();
}
/* If another sigwinch handler has been installed, call it. */
oh = (SigHandler *)old_winch.sa_handler;
if (oh && oh != (SigHandler *)SIG_IGN && oh != (SigHandler *)SIG_DFL)
(*oh) (sig);
SIGHANDLER_RETURN;
}
#endif /* SIGWINCH */
/* Functions to manage signal handling. */
#if !defined (HAVE_POSIX_SIGNALS)
static int
rl_sigaction (sig, nh, oh)
int sig;
sighandler_cxt *nh, *oh;
{
oh->sa_handler = signal (sig, nh->sa_handler);
return 0;
}
#endif /* !HAVE_POSIX_SIGNALS */
/* Set up a readline-specific signal handler, saving the old signal
information in OHANDLER. Return the old signal handler, like
signal(). */
static SigHandler *
rl_set_sighandler (sig, handler, ohandler)
int sig;
SigHandler *handler;
sighandler_cxt *ohandler;
{
#if defined (HAVE_POSIX_SIGNALS)
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset (&act.sa_mask);
sigemptyset (&ohandler->sa_mask);
sigaction (sig, &act, ohandler);
#else
ohandler->sa_handler = (SigHandler *)signal (sig, handler);
#endif /* !HAVE_POSIX_SIGNALS */
return (ohandler->sa_handler);
}
int
rl_set_signals ()
{
sighandler_cxt dummy;
SigHandler *oh;
#if defined (HAVE_POSIX_SIGNALS)
sigemptyset (&dummy.sa_mask);
#endif
oh = rl_set_sighandler (SIGINT, rl_signal_handler, &old_int);
if (oh == (SigHandler *)SIG_IGN)
rl_sigaction (SIGINT, &old_int, &dummy);
oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm);
if (oh == (SigHandler *)SIG_IGN)
rl_sigaction (SIGALRM, &old_alrm, &dummy);
#if defined (HAVE_POSIX_SIGNALS) && defined (SA_RESTART)
/* If the application using readline has already installed a signal
handler with SA_RESTART, SIGALRM will cause reads to be restarted
automatically, so readline should just get out of the way. Since
we tested for SIG_IGN above, we can just test for SIG_DFL here. */
if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART))
rl_sigaction (SIGALRM, &old_alrm, &dummy);
#endif /* HAVE_POSIX_SIGNALS */
#if !defined (SHELL)
#if defined (SIGTSTP)
oh = rl_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
if (oh == (SigHandler *)SIG_IGN)
rl_sigaction (SIGTSTP, &old_tstp, &dummy);
#else
oh = (SigHandler *)NULL;
#endif /* SIGTSTP */
#if defined (SIGTTOU)
rl_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou);
rl_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin);
if (oh == (SigHandler *)SIG_IGN)
{
rl_set_sighandler (SIGTTOU, SIG_IGN, &dummy);
rl_set_sighandler (SIGTTIN, SIG_IGN, &dummy);
}
#endif /* SIGTTOU */
/* Handle SIGTERM if we're not being compiled as part of bash. */
rl_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
#endif /* !SHELL */
#if defined (SIGWINCH)
rl_set_sighandler (SIGWINCH, rl_handle_sigwinch, &old_winch);
#endif /* SIGWINCH */
return 0;
}
int
rl_clear_signals ()
{
sighandler_cxt dummy;
#if defined (HAVE_POSIX_SIGNALS)
sigemptyset (&dummy.sa_mask);
#endif
rl_sigaction (SIGINT, &old_int, &dummy);
rl_sigaction (SIGALRM, &old_alrm, &dummy);
#if !defined (SHELL)
#if defined (SIGTSTP)
rl_sigaction (SIGTSTP, &old_tstp, &dummy);
#endif
#if defined (SIGTTOU)
rl_sigaction (SIGTTOU, &old_ttou, &dummy);
rl_sigaction (SIGTTIN, &old_ttin, &dummy);
#endif /* SIGTTOU */
rl_sigaction (SIGTERM, &old_term, &dummy);
#endif /* !SHELL */
#if defined (SIGWINCH)
sigemptyset (&dummy.sa_mask);
rl_sigaction (SIGWINCH, &old_winch, &dummy);
#endif
return 0;
}
#endif /* HANDLE_SIGNALS */
-57
View File
@@ -1,57 +0,0 @@
/* tcap.h -- termcap library functions and variables. */
/* Copyright (C) 1996 Free Software Foundation, Inc.
This file contains the Readline Library (the Library), a set of
routines for providing Emacs style line input to programs that ask
for it.
The Library 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 1, or (at your option)
any later version.
The Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (_RLTCAP_H_)
#define _RLTCAP_H_
#if defined (HAVE_CONFIG_H)
# include "config.h"
#endif
#if defined (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. */
#ifdef PC
# undef PC
#endif
extern char PC;
extern char *UP, *BC;
extern short ospeed;
extern int tgetent ();
extern int tgetflag ();
extern int tgetnum ();
extern char *tgetstr ();
extern int tputs ();
extern char *tgoto ();
#endif /* HAVE_TERMCAP_H */
#endif /* !_RLTCAP_H_ */
-554
View File
@@ -1,554 +0,0 @@
/* terminal.c -- controlling the terminal with termcap. */
/* Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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 1, or
(at your option) any later version.
The GNU Readline Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#include "posixstat.h"
#include <fcntl.h>
#if defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif /* HAVE_SYS_FILE_H */
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_LOCALE_H)
# include <locale.h>
#endif
#include <signal.h>
#include <stdio.h>
#include <setjmp.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#include "tcap.h"
#if defined (GWINSZ_IN_SYS_IOCTL)
# include <sys/ioctl.h>
#endif /* GWINSZ_IN_SYS_IOCTL */
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
/* Variables and functions imported from readline.c */
extern FILE *_rl_in_stream, *_rl_out_stream;
extern int readline_echoing_p;
extern int _rl_bell_preference;
extern Keymap _rl_keymap;
/* **************************************************************** */
/* */
/* Terminal and Termcap */
/* */
/* **************************************************************** */
static char *term_buffer = (char *)NULL;
static char *term_string_buffer = (char *)NULL;
static int tcap_initialized;
/* Non-zero means this terminal can't really do anything. */
static int dumb_term;
#if !defined (__linux__)
/* If this causes problems, add back the `extern'. */
/*extern*/ char PC, *BC, *UP;
#endif /* __linux__ */
/* Some strings to control terminal actions. These are output by tputs (). */
char *term_goto, *term_clreol, *term_cr, *term_clrpag, *term_backspace;
char *term_pc;
/* Non-zero if we determine that the terminal can do character insertion. */
int terminal_can_insert = 0;
/* How to insert characters. */
char *term_im, *term_ei, *term_ic, *term_ip, *term_IC;
/* How to delete characters. */
char *term_dc, *term_DC;
#if defined (HACK_TERMCAP_MOTION)
char *term_forward_char;
#endif /* HACK_TERMCAP_MOTION */
/* How to go up a line. */
char *term_up;
/* A visible bell, if the terminal can be made to flash the screen. */
static char *visible_bell;
/* Non-zero means the terminal can auto-wrap lines. */
int _rl_term_autowrap;
/* Non-zero means that this terminal has a meta key. */
static int term_has_meta;
/* The sequences to write to turn on and off the meta key, if this
terminal has one. */
static char *term_mm, *term_mo;
/* The key sequences output by the arrow keys, if this terminal has any. */
static char *term_ku, *term_kd, *term_kr, *term_kl;
/* How to initialize and reset the arrow keys, if this terminal has any. */
static char *term_ks, *term_ke;
/* The key sequences sent by the Home and End keys, if any. */
static char *term_kh, *term_kH;
/* Variables that hold the screen dimensions, used by the display code. */
int screenwidth, screenheight, screenchars;
/* Non-zero means the user wants to enable the keypad. */
int _rl_enable_keypad;
/* Non-zero means the user wants to enable a meta key. */
int _rl_enable_meta = 1;
/* Re-initialize the terminal considering that the TERM/TERMCAP variable
has changed. */
int
rl_reset_terminal (terminal_name)
char *terminal_name;
{
_rl_init_terminal_io (terminal_name);
return 0;
}
#if !defined (SHELL)
static void
set_lines_and_columns (lines, cols)
int lines, cols;
{
char *b;
#if defined (HAVE_PUTENV)
b = xmalloc (24);
sprintf (b, "LINES=%d", lines);
putenv (b);
b = xmalloc (24);
sprintf (b, "COLUMNS=%d", cols);
putenv (b);
#else /* !HAVE_PUTENV */
# if defined (HAVE_SETENV)
b = xmalloc (8);
sprintf (b, "%d", lines);
setenv ("LINES", b, 1);
b = xmalloc (8);
sprintf (b, "%d", cols);
setenv ("COLUMNS", b, 1);
# endif /* HAVE_SETENV */
#endif /* !HAVE_PUTENV */
}
#else /* SHELL */
extern void set_lines_and_columns ();
#endif /* SHELL */
/* Get readline's idea of the screen size. TTY is a file descriptor open
to the terminal. If IGNORE_ENV is true, we do not pay attention to the
values of $LINES and $COLUMNS. The tests for TERM_STRING_BUFFER being
non-null serve to check whether or not we have initialized termcap. */
void
_rl_get_screen_size (tty, ignore_env)
int tty, ignore_env;
{
char *ss;
#if defined (TIOCGWINSZ)
struct winsize window_size;
#endif /* TIOCGWINSZ */
#if defined (TIOCGWINSZ)
if (ioctl (tty, 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 IGNORE_ENV
is unset. */
if (screenwidth <= 0)
{
if (ignore_env == 0 && (ss = getenv ("COLUMNS")))
screenwidth = atoi (ss);
if (screenwidth <= 0 && term_string_buffer)
screenwidth = tgetnum ("co");
}
/* Environment variable LINES overrides setting of "li" if IGNORE_ENV
is unset. */
if (screenheight <= 0)
{
if (ignore_env == 0 && (ss = getenv ("LINES")))
screenheight = atoi (ss);
if (screenheight <= 0 && term_string_buffer)
screenheight = tgetnum ("li");
}
/* If all else fails, default to 80x24 terminal. */
if (screenwidth <= 1)
screenwidth = 80;
if (screenheight <= 0)
screenheight = 24;
/* If we're being compiled as part of bash, set the environment
variables $LINES and $COLUMNS to new values. Otherwise, just
do a pair of putenv () or setenv () calls. */
set_lines_and_columns (screenheight, screenwidth);
if (!_rl_term_autowrap)
screenwidth--;
screenchars = screenwidth * screenheight;
}
void
_rl_set_screen_size (rows, cols)
int rows, cols;
{
screenheight = rows;
screenwidth = cols;
if (_rl_term_autowrap == 0)
screenwidth--;
screenchars = screenwidth * screenheight;
}
struct _tc_string {
char *tc_var;
char **tc_value;
};
/* This should be kept sorted, just in case we decide to change the
search algorithm to something smarter. */
static struct _tc_string tc_strings[] =
{
"DC", &term_DC,
"IC", &term_IC,
"ce", &term_clreol,
"cl", &term_clrpag,
"cr", &term_cr,
"dc", &term_dc,
"ei", &term_ei,
"ic", &term_ic,
"im", &term_im,
"kd", &term_kd,
"kh", &term_kh, /* home */
"kH", &term_kH, /* end */
"kl", &term_kl,
"kr", &term_kr,
"ku", &term_ku,
"ks", &term_ks,
"ke", &term_ke,
"le", &term_backspace,
"mm", &term_mm,
"mo", &term_mo,
#if defined (HACK_TERMCAP_MOTION)
"nd", &term_forward_char,
#endif
"pc", &term_pc,
"up", &term_up,
"vb", &visible_bell,
};
#define NUM_TC_STRINGS (sizeof (tc_strings) / sizeof (struct _tc_string))
/* Read the desired terminal capability strings into BP. The capabilities
are described in the TC_STRINGS table. */
static void
get_term_capabilities (bp)
char **bp;
{
register int i;
for (i = 0; i < NUM_TC_STRINGS; i++)
*(tc_strings[i].tc_value) = tgetstr (tc_strings[i].tc_var, bp);
tcap_initialized = 1;
}
int
_rl_init_terminal_io (terminal_name)
char *terminal_name;
{
#if defined (__GO32__)
screenwidth = ScreenCols ();
screenheight = ScreenRows ();
screenchars = screenwidth * screenheight;
term_cr = "\r";
term_im = term_ei = term_ic = term_IC = (char *)NULL;
term_up = term_dc = term_DC = visible_bell = (char *)NULL;
/* Does the __GO32__ have a meta key? I don't know. */
term_has_meta = 0;
term_mm = term_mo = (char *)NULL;
/* It probably has arrow keys, but I don't know what they are. */
term_ku = term_kd = term_kr = term_kl = (char *)NULL;
#if defined (HACK_TERMCAP_MOTION)
term_forward_char = (char *)NULL;
#endif /* HACK_TERMCAP_MOTION */
terminal_can_insert = _rl_term_autowrap = 0;
return;
#else /* !__GO32__ */
char *term, *buffer;
int tty;
Keymap xkeymap;
term = terminal_name ? terminal_name : getenv ("TERM");
if (term_string_buffer == 0)
term_string_buffer = xmalloc (2032);
if (term_buffer == 0)
term_buffer = xmalloc (4080);
buffer = term_string_buffer;
term_clrpag = term_cr = term_clreol = (char *)NULL;
if (term == 0)
term = "dumb";
if (tgetent (term_buffer, term) <= 0)
{
dumb_term = 1;
screenwidth = 79;
screenheight = 24;
screenchars = 79 * 24;
term_cr = "\r";
term_im = term_ei = term_ic = term_IC = (char *)NULL;
term_up = term_dc = term_DC = visible_bell = (char *)NULL;
term_ku = term_kd = term_kl = term_kr = (char *)NULL;
#if defined (HACK_TERMCAP_MOTION)
term_forward_char = (char *)NULL;
#endif
terminal_can_insert = 0;
return 0;
}
get_term_capabilities (&buffer);
/* Set up the variables that the termcap library expects the application
to provide. */
PC = term_pc ? *term_pc : 0;
BC = term_backspace;
UP = term_up;
if (!term_cr)
term_cr = "\r";
tty = rl_instream ? fileno (rl_instream) : 0;
screenwidth = screenheight = 0;
_rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
_rl_get_screen_size (tty, 0);
/* "An application program can assume that the terminal can do
character insertion if *any one of* the capabilities `IC',
`im', `ic' or `ip' is provided." But we can't do anything if
only `ip' is provided, so... */
terminal_can_insert = (term_IC || term_im || term_ic);
/* Check to see if this terminal has a meta key and clear the capability
variables if there is none. */
term_has_meta = (tgetflag ("km") || tgetflag ("MT"));
if (!term_has_meta)
term_mm = term_mo = (char *)NULL;
/* Attempt to find and bind the arrow keys. Do not override already
bound keys in an overzealous attempt, however. */
xkeymap = _rl_keymap;
_rl_keymap = emacs_standard_keymap;
_rl_bind_if_unbound (term_ku, rl_get_previous_history);
_rl_bind_if_unbound (term_kd, rl_get_next_history);
_rl_bind_if_unbound (term_kr, rl_forward);
_rl_bind_if_unbound (term_kl, rl_backward);
_rl_bind_if_unbound (term_kh, rl_beg_of_line); /* Home */
_rl_bind_if_unbound (term_kH, rl_end_of_line); /* End */
#if defined (VI_MODE)
_rl_keymap = vi_movement_keymap;
_rl_bind_if_unbound (term_ku, rl_get_previous_history);
_rl_bind_if_unbound (term_kd, rl_get_next_history);
_rl_bind_if_unbound (term_kr, rl_forward);
_rl_bind_if_unbound (term_kl, rl_backward);
_rl_bind_if_unbound (term_kh, rl_beg_of_line); /* Home */
_rl_bind_if_unbound (term_kH, rl_end_of_line); /* End */
#endif /* VI_MODE */
_rl_keymap = xkeymap;
#endif /* !__GO32__ */
return 0;
}
char *
rl_get_termcap (cap)
char *cap;
{
register int i;
if (tcap_initialized == 0)
return ((char *)NULL);
for (i = 0; i < NUM_TC_STRINGS; i++)
{
if (tc_strings[i].tc_var[0] == cap[0] && strcmp (tc_strings[i].tc_var, cap) == 0)
return *(tc_strings[i].tc_value);
}
return ((char *)NULL);
}
/* A function for the use of tputs () */
int
_rl_output_character_function (c)
int c;
{
return putc (c, _rl_out_stream);
}
/* Write COUNT characters from STRING to the output stream. */
void
_rl_output_some_chars (string, count)
char *string;
int count;
{
fwrite (string, 1, count, _rl_out_stream);
}
/* Move the cursor back. */
int
_rl_backspace (count)
int count;
{
register int i;
#if !defined (__GO32__)
if (term_backspace)
for (i = 0; i < count; i++)
tputs (term_backspace, 1, _rl_output_character_function);
else
#endif /* !__GO32__ */
for (i = 0; i < count; i++)
putc ('\b', _rl_out_stream);
return 0;
}
/* Move to the start of the next line. */
int
crlf ()
{
#if defined (NEW_TTY_DRIVER)
if (term_cr)
tputs (term_cr, 1, _rl_output_character_function);
#endif /* NEW_TTY_DRIVER */
putc ('\n', _rl_out_stream);
return 0;
}
/* Ring the terminal bell. */
int
ding ()
{
if (readline_echoing_p)
{
#if !defined (__GO32__)
switch (_rl_bell_preference)
{
case NO_BELL:
default:
break;
case VISIBLE_BELL:
if (visible_bell)
{
tputs (visible_bell, 1, _rl_output_character_function);
break;
}
/* FALLTHROUGH */
case AUDIBLE_BELL:
fprintf (stderr, "\007");
fflush (stderr);
break;
}
#else /* __GO32__ */
fprintf (stderr, "\007");
fflush (stderr);
#endif /* __GO32__ */
return (0);
}
return (-1);
}
/* **************************************************************** */
/* */
/* Controlling the Meta Key and Keypad */
/* */
/* **************************************************************** */
static int
outchar (c)
int c;
{
return putc (c, rl_outstream);
}
int
_rl_enable_meta_key ()
{
if (term_has_meta && term_mm)
tputs (term_mm, 1, outchar);
}
void
_rl_control_keypad (on)
int on;
{
if (on && term_ks)
tputs (term_ks, 1, outchar);
else if (!on && term_ke)
tputs (term_ke, 1, outchar);
}
-261
View File
@@ -1,261 +0,0 @@
/* readline.c -- a general facility for reading lines of input
with emacs style editing and completion. */
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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 1, or
(at your option) any later version.
The GNU Readline Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h> /* for _POSIX_VERSION */
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include <setjmp.h>
#include <stdio.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
the undo list. */
int _rl_doing_an_undo = 0;
/* How many unclosed undo groups we currently have. */
int _rl_undo_group_level = 0;
/* The current undo list for THE_LINE. */
UNDO_LIST *rl_undo_list = (UNDO_LIST *)NULL;
/* **************************************************************** */
/* */
/* Undo, and Undoing */
/* */
/* **************************************************************** */
/* Remember how to undo something. Concatenate some undos if that
seems right. */
void
rl_add_undo (what, start, end, text)
enum undo_code what;
int start, end;
char *text;
{
UNDO_LIST *temp = (UNDO_LIST *)xmalloc (sizeof (UNDO_LIST));
temp->what = what;
temp->start = start;
temp->end = end;
temp->text = text;
temp->next = rl_undo_list;
rl_undo_list = temp;
}
/* Free the existing undo list. */
void
free_undo_list ()
{
while (rl_undo_list)
{
UNDO_LIST *release = rl_undo_list;
rl_undo_list = rl_undo_list->next;
if (release->what == UNDO_DELETE)
free (release->text);
free (release);
}
rl_undo_list = (UNDO_LIST *)NULL;
}
/* Undo the next thing in the list. Return 0 if there
is nothing to undo, or non-zero if there was. */
int
rl_do_undo ()
{
UNDO_LIST *release;
int waiting_for_begin = 0;
int start, end;
#define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i)))
do
{
if (!rl_undo_list)
return (0);
_rl_doing_an_undo = 1;
/* To better support vi-mode, a start or end value of -1 means
rl_point, and a value of -2 means rl_end. */
if (rl_undo_list->what == UNDO_DELETE || rl_undo_list->what == UNDO_INSERT)
{
start = TRANS (rl_undo_list->start);
end = TRANS (rl_undo_list->end);
}
switch (rl_undo_list->what)
{
/* Undoing deletes means inserting some text. */
case UNDO_DELETE:
rl_point = start;
rl_insert_text (rl_undo_list->text);
free (rl_undo_list->text);
break;
/* Undoing inserts means deleting some text. */
case UNDO_INSERT:
rl_delete_text (start, end);
rl_point = start;
break;
/* Undoing an END means undoing everything 'til we get to a BEGIN. */
case UNDO_END:
waiting_for_begin++;
break;
/* Undoing a BEGIN means that we are done with this group. */
case UNDO_BEGIN:
if (waiting_for_begin)
waiting_for_begin--;
else
ding ();
break;
}
_rl_doing_an_undo = 0;
release = rl_undo_list;
rl_undo_list = rl_undo_list->next;
free (release);
}
while (waiting_for_begin);
return (1);
}
#undef TRANS
int
_rl_fix_last_undo_of_type (type, start, end)
int type, start, end;
{
UNDO_LIST *rl;
for (rl = rl_undo_list; rl; rl = rl->next)
{
if (rl->what == type)
{
rl->start = start;
rl->end = end;
return 0;
}
}
return 1;
}
/* Begin a group. Subsequent undos are undone as an atomic operation. */
int
rl_begin_undo_group ()
{
rl_add_undo (UNDO_BEGIN, 0, 0, 0);
_rl_undo_group_level++;
return 0;
}
/* End an undo group started with rl_begin_undo_group (). */
int
rl_end_undo_group ()
{
rl_add_undo (UNDO_END, 0, 0, 0);
_rl_undo_group_level--;
return 0;
}
/* Save an undo entry for the text from START to END. */
int
rl_modifying (start, end)
int start, end;
{
if (start > end)
{
SWAP (start, end);
}
if (start != end)
{
char *temp = rl_copy_text (start, end);
rl_begin_undo_group ();
rl_add_undo (UNDO_DELETE, start, end, temp);
rl_add_undo (UNDO_INSERT, start, end, (char *)NULL);
rl_end_undo_group ();
}
return 0;
}
/* Revert the current line to its previous state. */
int
rl_revert_line (count, key)
int count, key;
{
if (!rl_undo_list)
ding ();
else
{
while (rl_undo_list)
rl_do_undo ();
}
return 0;
}
/* Do some undoing of things that were done. */
int
rl_undo_command (count, key)
int count, key;
{
if (count < 0)
return 0; /* Nothing to do. */
while (count)
{
if (rl_do_undo ())
count--;
else
{
ding ();
break;
}
}
return 0;
}
-312
View File
@@ -1,312 +0,0 @@
/* util.c -- readline utility functions */
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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 1, or
(at your option) any later version.
The GNU Readline Library 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <setjmp.h>
#include <ctype.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h> /* for _POSIX_VERSION */
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#if defined (TIOCSTAT_IN_SYS_IOCTL)
# include <sys/ioctl.h>
#endif /* TIOCSTAT_IN_SYS_IOCTL */
/* Some standard library routines. */
#include "readline.h"
#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
/* Pseudo-globals imported from readline.c */
extern int readline_echoing_p;
extern jmp_buf readline_top_level;
extern int rl_line_buffer_len;
extern Function *rl_last_func;
extern int _rl_defining_kbd_macro;
extern char *_rl_executing_macro;
/* Pseudo-global functions imported from other library files. */
extern void _rl_pop_executing_macro ();
extern void _rl_set_the_line ();
extern void _rl_init_argument ();
extern char *xmalloc (), *xrealloc ();
/* **************************************************************** */
/* */
/* Utility Functions */
/* */
/* **************************************************************** */
/* Return 0 if C is not a member of the class of characters that belong
in words, or 1 if it is. */
int _rl_allow_pathname_alphabetic_chars = 0;
static char *pathname_alphabetic_chars = "/-_=~.#$";
int
alphabetic (c)
int c;
{
if (ALPHABETIC (c))
return (1);
return (_rl_allow_pathname_alphabetic_chars &&
strchr (pathname_alphabetic_chars, c) != NULL);
}
/* How to abort things. */
int
_rl_abort_internal ()
{
ding ();
rl_clear_message ();
_rl_init_argument ();
rl_pending_input = 0;
_rl_defining_kbd_macro = 0;
while (_rl_executing_macro)
_rl_pop_executing_macro ();
rl_last_func = (Function *)NULL;
longjmp (readline_top_level, 1);
return (0);
}
int
rl_abort (count, key)
int count, key;
{
return (_rl_abort_internal ());
}
int
rl_tty_status (count, key)
int count, key;
{
#if defined (TIOCSTAT)
ioctl (1, TIOCSTAT, (char *)0);
rl_refresh_line ();
#else
ding ();
#endif
return 0;
}
/* Return a copy of the string between FROM and TO.
FROM is inclusive, TO is not. */
char *
rl_copy_text (from, to)
int from, to;
{
register int length;
char *copy;
/* Fix it if the caller is confused. */
if (from > to)
SWAP (from, to);
length = to - from;
copy = xmalloc (1 + length);
strncpy (copy, rl_line_buffer + from, length);
copy[length] = '\0';
return (copy);
}
/* Increase the size of RL_LINE_BUFFER until it has enough space to hold
LEN characters. */
void
rl_extend_line_buffer (len)
int len;
{
while (len >= rl_line_buffer_len)
{
rl_line_buffer_len += DEFAULT_BUFFER_SIZE;
rl_line_buffer = xrealloc (rl_line_buffer, rl_line_buffer_len);
}
_rl_set_the_line ();
}
/* **************************************************************** */
/* */
/* String Utility Functions */
/* */
/* **************************************************************** */
/* Determine if s2 occurs in s1. If so, return a pointer to the
match in s1. The compare is case insensitive. */
char *
_rl_strindex (s1, s2)
register char *s1, *s2;
{
register int i, l, len;
for (i = 0, l = strlen (s2), len = strlen (s1); (len - i) >= l; i++)
if (_rl_strnicmp (s1 + i, s2, l) == 0)
return (s1 + i);
return ((char *)NULL);
}
#if !defined (HAVE_STRCASECMP)
/* Compare at most COUNT characters from string1 to string2. Case
doesn't matter. */
int
_rl_strnicmp (string1, string2, count)
char *string1, *string2;
int count;
{
register char ch1, ch2;
while (count)
{
ch1 = *string1++;
ch2 = *string2++;
if (_rl_to_upper(ch1) == _rl_to_upper(ch2))
count--;
else
break;
}
return (count);
}
/* strcmp (), but caseless. */
int
_rl_stricmp (string1, string2)
char *string1, *string2;
{
register char ch1, ch2;
while (*string1 && *string2)
{
ch1 = *string1++;
ch2 = *string2++;
if (_rl_to_upper(ch1) != _rl_to_upper(ch2))
return (1);
}
return (*string1 - *string2);
}
#endif /* !HAVE_STRCASECMP */
/* Stupid comparison routine for qsort () ing strings. */
int
_rl_qsort_string_compare (s1, s2)
char **s1, **s2;
{
#if defined (HAVE_STRCOLL)
return (strcoll (*s1, *s2));
#else
int result;
result = **s1 - **s2;
if (result == 0)
result = strcmp (*s1, *s2);
return result;
#endif
}
#if !defined (SHELL)
/* Backwards compatibility, now that savestring has been removed from
all `public' readline header files. */
char *
rl_savestring (s)
char *s;
{
return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
}
#endif /* !SHELL */
/* Function equivalents for the macros defined in chartypes.h. */
#undef _rl_uppercase_p
int
_rl_uppercase_p (c)
int c;
{
return (isupper (c));
}
#undef _rl_lowercase_p
int
_rl_lowercase_p (c)
int c;
{
return (islower (c));
}
#undef _rl_pure_alphabetic
int
_rl_pure_alphabetic (c)
int c;
{
return (isupper (c) || islower (c));
}
#undef _rl_digit_p
int
_rl_digit_p (c)
int c;
{
return (isdigit (c));
}
#undef _rl_to_lower
int
_rl_to_lower (c)
int c;
{
return (isupper (c) ? tolower (c) : c);
}
#undef _rl_to_upper
int
_rl_to_upper (c)
int c;
{
return (islower (c) ? toupper (c) : c);
}
#undef _rl_digit_value
int
_rl_digit_value (c)
int c;
{
return (isdigit (c) ? c - '0' : c);
}
+1 -1
View File
@@ -3,7 +3,7 @@
srcdir= @srcdir@/..
CC= @CC@
OPTFLAG=@OPTFLAG@
CFLAGS= -c $(OPTFLAG) @CFLAGS@ -I. -I$(srcdir)/include @CPPFLAGS@ -DGTAGS
CFLAGS= -c $(OPTFLAG) @CFLAGS@ -I. -I$(srcdir)/include @CPPFLAGS@
LDFLAGS=@LDFLAGS@
PERL= @vi_cv_path_perl@
PERLLIB=@vi_cv_perllib@
-20
View File
@@ -64,9 +64,6 @@ editor(gp, argc, argv)
size_t len;
u_int flags;
int ch, flagchk, lflag, secure, startup, readonly, rval, silent;
#ifdef GTAGS
int gtags = 0;
#endif
char *tag_f, *wsizearg, path[256];
/* Initialize the busy routine, if not defined by the screen. */
@@ -116,18 +113,10 @@ editor(gp, argc, argv)
/* Set the file snapshot flag. */
F_SET(gp, G_SNAPSHOT);
#ifdef GTAGS
#ifdef DEBUG
while ((ch = getopt(argc, argv, "c:D:eFGlRrSsT:t:vw:")) != EOF)
#else
while ((ch = getopt(argc, argv, "c:eFGlRrSst:vw:")) != EOF)
#endif
#else
#ifdef DEBUG
while ((ch = getopt(argc, argv, "c:D:eFlRrSsT:t:vw:")) != EOF)
#else
while ((ch = getopt(argc, argv, "c:eFlRrSst:vw:")) != EOF)
#endif
#endif
switch (ch) {
case 'c': /* Run the command. */
@@ -165,11 +154,6 @@ editor(gp, argc, argv)
case 'F': /* No snapshot. */
F_CLR(gp, G_SNAPSHOT);
break;
#ifdef GTAGS
case 'G': /* gtags mode. */
gtags = 1;
break;
#endif
case 'l': /* Set lisp, showmatch options. */
lflag = 1;
break;
@@ -268,10 +252,6 @@ editor(gp, argc, argv)
}
if (readonly)
*oargp++ = O_READONLY;
#ifdef GTAGS
if (gtags)
*oargp++ = O_GTAGSMODE;
#endif
if (secure)
*oargp++ = O_SECURE;
*oargp = -1; /* Options initialization. */
-7
View File
@@ -80,10 +80,6 @@ OPTLIST const optlist[] = {
{"filec", NULL, OPT_STR, 0},
/* O_FLASH HPUX */
{"flash", NULL, OPT_1BOOL, 0},
#ifdef GTAGS
/* O_GTAGSMODE FreeBSD2.2 */
{"gtagsmode", NULL, OPT_0BOOL, 0},
#endif
/* O_HARDTABS 4BSD */
{"hardtabs", NULL, OPT_NUM, 0},
/* O_ICLOWER 4.4BSD */
@@ -248,9 +244,6 @@ static OABBREV const abbrev[] = {
{"eb", O_ERRORBELLS}, /* 4BSD */
{"ed", O_EDCOMPATIBLE}, /* 4BSD */
{"ex", O_EXRC}, /* System V (undocumented) */
#ifdef GTAGS
{"gt", O_GTAGSMODE}, /* FreeBSD2.2 */
#endif
{"ht", O_HARDTABS}, /* 4BSD */
{"ic", O_IGNORECASE}, /* 4BSD */
{"li", O_LINES}, /* 4.4BSD */
+3 -14
View File
@@ -17,7 +17,7 @@ ex, vi, view \- text editors
.SH SYNOPSIS
.B ex
[\c
.B -eFGRrSsv\c
.B -eFRrSsv\c
] [\c
.BI -c " cmd"\c
] [\c
@@ -28,7 +28,7 @@ ex, vi, view \- text editors
.br
.B vi
[\c
.B -eFGlRrSv\c
.B -eFlRrSv\c
] [\c
.BI -c " cmd"\c
] [\c
@@ -39,7 +39,7 @@ ex, vi, view \- text editors
.br
.B view
[\c
.B -eFGRrSv\c
.B -eFRrSv\c
] [\c
.BI -c " cmd"\c
] [\c
@@ -121,9 +121,6 @@ the file during your edit session.)
.B \-l
Start editing with the lisp and showmatch options set.
.TP
.B \-G
Start editing in gtags mode, as if the gtagsmode option was set.
.TP
.B \-R
Start editing in read-only mode, as if the command name was
.IR view ,
@@ -432,8 +429,6 @@ commands or cancel partial commands.
.TP
.B "<control-]>"
Push a tag reference onto the tag stack.
In gtagsmode, if at the first column of line,
locate function references otherwise function definitions.
.TP
.B "<control-^>"
Switch to the most recently edited file.
@@ -945,9 +940,6 @@ Grow or shrink the current screen.
.B "rew[ind][!]"
Rewind the argument list.
.TP
.B "rta[g][!] tagstring"
Edit the file refering the specified tag. (Only in gtagsmode)
.TP
.B "se[t] [option[=[value]] ...] [nooption ...] [option? ...] [all]"
Display or set editor options.
.TP
@@ -1118,9 +1110,6 @@ command line.
.B "flash [on]"
Flash the screen instead of beeping the keyboard on error.
.TP
.B "gtagsmode, gt [off]"
Use GTAGS and GRTAGS instead of tags.
.TP
.B "hardtabs, ht [8]"
Set the spacing between hardware tab settings.
.TP
-3
View File
@@ -152,9 +152,6 @@ struct _excmd {
#define E_SEARCH_WMSG 0x01000000 /* Display search-wrapped message. */
#define E_USELASTCMD 0x02000000 /* Use the last command. */
#define E_VISEARCH 0x04000000 /* It's really a vi search command. */
#ifdef GTAGS
#define E_REFERENCE 0x08000000 /* locate function references */
#endif
u_int32_t flags; /* Current flags. */
};
-7
View File
@@ -302,13 +302,6 @@ EXCMDLIST const cmds[] = {
"!",
"rew[ind][!]",
"re-edit all the files in the file argument list"},
#ifdef GTAGS
/* C_RTAG */
{"rtag", ex_rtag_push, E_NEWSCREEN,
"!w1o",
"[Rr]ta[g][!] [string]",
"edit the file containing the tag"},
#endif
/*
* !!!
* Adding new commands starting with 's' may break the substitute command code
-142
View File
@@ -46,10 +46,6 @@ static char *binary_search __P((char *, char *, char *));
static int compare __P((char *, char *, char *));
static void ctag_file __P((SCR *, TAGF *, char *, char **, size_t *));
static int ctag_search __P((SCR *, char *, size_t, char *));
#ifdef GTAGS
static int getentry __P((char *, char *, char *, char *));
static TAGQ *gtag_slist __P((SCR *, char *, int));
#endif
static int ctag_sfile __P((SCR *, TAGF *, TAGQ *, char *));
static TAGQ *ctag_slist __P((SCR *, char *));
static char *linear_search __P((char *, char *, char *));
@@ -93,25 +89,6 @@ ex_tag_first(sp, tagarg)
return (0);
}
#ifdef GTAGS
/*
* ex_rtag_push -- ^]
* :rtag[!] [string]
*
* Enter a new TAGQ context based on a ctag string.
*
* PUBLIC: int ex_rtag_push __P((SCR *, EXCMD *));
*/
int
ex_rtag_push(sp, cmdp)
SCR *sp;
EXCMD *cmdp;
{
F_SET(cmdp, E_REFERENCE);
return ex_tag_push(sp, cmdp);
}
#endif
/*
* ex_tag_push -- ^]
* :tag[!] [string]
@@ -161,12 +138,6 @@ ex_tag_push(sp, cmdp)
}
/* Get the tag information. */
#ifdef GTAGS
if (O_ISSET(sp, O_GTAGSMODE)) {
if ((tqp = gtag_slist(sp, exp->tag_last, F_ISSET(cmdp, E_REFERENCE))) == NULL)
return (1);
} else
#endif
if ((tqp = ctag_slist(sp, exp->tag_last)) == NULL)
return (1);
@@ -998,119 +969,6 @@ notfound: tag_msg(sp, TAG_SEARCH, tag);
return (0);
}
#ifdef GTAGS
/*
* getentry --
* get tag information from current line.
*
* gtags temporary file format.
* <tag> <lineno> <file> <image>
*
* sample.
* +------------------------------------------------
* |main 30 main.c main(argc, argv)
* |func 21 subr.c func(arg)
*/
static int
getentry(buf, tag, file, line)
char *buf, *tag, *file, *line;
{
char *p;
p = tag;
while (*buf && !isspace(*buf)) /* tag name */
*p++ = *buf++;
*p = 0;
while (*buf && isspace(*buf)) /* skip blanks */
buf++;
p = line;
while (*buf && !isspace(*buf)) /* line no */
*p++ = *buf++;
*p = 0;
while (*buf && isspace(*buf)) /* skip blanks */
buf++;
p = file;
while (*buf && !isspace(*buf)) /* file name */
*p++ = *buf++;
*p = 0;
/* value check */
if (strlen(tag) && strlen(line) && strlen(file) && atoi(line) > 0)
return 1; /* OK */
return 0; /* ERROR */
}
/*
* gtag_slist --
* Search the list of tags files for a tag, and return tag queue.
*/
static TAGQ *
gtag_slist(sp, tag, ref)
SCR *sp;
char *tag;
int ref;
{
EX_PRIVATE *exp;
TAGF *tfp;
TAGQ *tqp;
size_t len;
int echk;
TAG *tp;
static char name[80], file[200], line[10];
char command[200];
char buf[BUFSIZ+1];
FILE *fp;
/* Allocate and initialize the tag queue structure. */
len = strlen(tag);
CALLOC_GOTO(sp, tqp, TAGQ *, 1, sizeof(TAGQ) + len + 1);
CIRCLEQ_INIT(&tqp->tagq);
tqp->tag = tqp->buf;
memcpy(tqp->tag, tag, (tqp->tlen = len) + 1);
/*
* Find the tag, only display missing file messages once, and
* then only if we didn't find the tag.
*/
sprintf(command, "global -%s '%s'", ref ? "rx" : "x", tag);
if (fp = popen(command, "r")) {
while (fgets(buf, sizeof(buf), fp)) {
if (buf[strlen(buf)-1] == '\n') /* chop(buf) */
buf[strlen(buf)-1] = 0;
else
while (fgetc(fp) != '\n')
;
if (getentry(buf, name, file, line) == 0) {
echk = 1;
F_SET(tfp, TAGF_ERR);
break;
}
CALLOC_GOTO(sp, tp,
TAG *, 1, sizeof(TAG) + strlen(file) + 1 + strlen(line) + 1);
tp->fname = tp->buf;
strcpy(tp->fname, file);
tp->fnlen = strlen(file);
tp->search = tp->fname + tp->fnlen + 1;
strcpy(tp->search, line);
CIRCLEQ_INSERT_TAIL(&tqp->tagq, tp, q);
}
pclose(fp);
}
/* Check to see if we found anything. */
if (tqp->tagq.cqh_first == (void *)&tqp->tagq) {
msgq_str(sp, M_ERR, tag, "162|%s: tag not found");
free(tqp);
return (NULL);
}
tqp->current = tqp->tagq.cqh_first;
return (tqp);
alloc_err:
return (NULL);
}
#endif
/*
* ctag_slist --
* Search the list of tags files for a tag, and return tag queue.
+29 -30
View File
@@ -47,33 +47,32 @@
#define C_RECOVER 46
#define C_RESIZE 47
#define C_REWIND 48
#define C_RTAG 49
#define C_SUBSTITUTE 50
#define C_SCRIPT 51
#define C_SET 52
#define C_SHELL 53
#define C_SOURCE 54
#define C_STOP 55
#define C_SUSPEND 56
#define C_T 57
#define C_TAG 58
#define C_TAGNEXT 59
#define C_TAGPOP 60
#define C_TAGPREV 61
#define C_TAGTOP 62
#define C_TCLCMD 63
#define C_UNDO 64
#define C_UNABBREVIATE 65
#define C_UNMAP 66
#define C_V 67
#define C_VERSION 68
#define C_VISUAL_EX 69
#define C_VISUAL_VI 70
#define C_VIUSAGE 71
#define C_WRITE 72
#define C_WN 73
#define C_WQ 74
#define C_XIT 75
#define C_YANK 76
#define C_Z 77
#define C_SUBTILDE 78
#define C_SUBSTITUTE 49
#define C_SCRIPT 50
#define C_SET 51
#define C_SHELL 52
#define C_SOURCE 53
#define C_STOP 54
#define C_SUSPEND 55
#define C_T 56
#define C_TAG 57
#define C_TAGNEXT 58
#define C_TAGPOP 59
#define C_TAGPREV 60
#define C_TAGTOP 61
#define C_TCLCMD 62
#define C_UNDO 63
#define C_UNABBREVIATE 64
#define C_UNMAP 65
#define C_V 66
#define C_VERSION 67
#define C_VISUAL_EX 68
#define C_VISUAL_VI 69
#define C_VIUSAGE 70
#define C_WRITE 71
#define C_WN 72
#define C_WQ 73
#define C_XIT 74
#define C_YANK 75
#define C_Z 76
#define C_SUBTILDE 77
-1
View File
@@ -89,7 +89,6 @@ int re_compile __P((SCR *,
char *, size_t, char **, size_t *, regex_t *, u_int));
void re_error __P((SCR *, int, regex_t *));
int ex_tag_first __P((SCR *, char *));
int ex_rtag_push __P((SCR *, EXCMD *));
int ex_tag_push __P((SCR *, EXCMD *));
int ex_tag_next __P((SCR *, EXCMD *));
int ex_tag_prev __P((SCR *, EXCMD *));
+61 -62
View File
@@ -16,65 +16,64 @@
#define O_EXTENDED 15
#define O_FILEC 16
#define O_FLASH 17
#define O_GTAGSMODE 18
#define O_HARDTABS 19
#define O_ICLOWER 20
#define O_IGNORECASE 21
#define O_KEYTIME 22
#define O_LEFTRIGHT 23
#define O_LINES 24
#define O_LISP 25
#define O_LIST 26
#define O_LOCKFILES 27
#define O_MAGIC 28
#define O_MATCHTIME 29
#define O_MESG 30
#define O_MODELINE 31
#define O_MSGCAT 32
#define O_NOPRINT 33
#define O_NUMBER 34
#define O_OCTAL 35
#define O_OPEN 36
#define O_OPTIMIZE 37
#define O_PARAGRAPHS 38
#define O_PATH 39
#define O_PRINT 40
#define O_PROMPT 41
#define O_READONLY 42
#define O_RECDIR 43
#define O_REDRAW 44
#define O_REMAP 45
#define O_REPORT 46
#define O_RULER 47
#define O_SCROLL 48
#define O_SEARCHINCR 49
#define O_SECTIONS 50
#define O_SECURE 51
#define O_SHELL 52
#define O_SHELLMETA 53
#define O_SHIFTWIDTH 54
#define O_SHOWMATCH 55
#define O_SHOWMODE 56
#define O_SIDESCROLL 57
#define O_SLOWOPEN 58
#define O_SOURCEANY 59
#define O_TABSTOP 60
#define O_TAGLENGTH 61
#define O_TAGS 62
#define O_TERM 63
#define O_TERSE 64
#define O_TILDEOP 65
#define O_TIMEOUT 66
#define O_TTYWERASE 67
#define O_VERBOSE 68
#define O_W1200 69
#define O_W300 70
#define O_W9600 71
#define O_WARN 72
#define O_WINDOW 73
#define O_WINDOWNAME 74
#define O_WRAPLEN 75
#define O_WRAPMARGIN 76
#define O_WRAPSCAN 77
#define O_WRITEANY 78
#define O_OPTIONCOUNT 79
#define O_HARDTABS 18
#define O_ICLOWER 19
#define O_IGNORECASE 20
#define O_KEYTIME 21
#define O_LEFTRIGHT 22
#define O_LINES 23
#define O_LISP 24
#define O_LIST 25
#define O_LOCKFILES 26
#define O_MAGIC 27
#define O_MATCHTIME 28
#define O_MESG 29
#define O_MODELINE 30
#define O_MSGCAT 31
#define O_NOPRINT 32
#define O_NUMBER 33
#define O_OCTAL 34
#define O_OPEN 35
#define O_OPTIMIZE 36
#define O_PARAGRAPHS 37
#define O_PATH 38
#define O_PRINT 39
#define O_PROMPT 40
#define O_READONLY 41
#define O_RECDIR 42
#define O_REDRAW 43
#define O_REMAP 44
#define O_REPORT 45
#define O_RULER 46
#define O_SCROLL 47
#define O_SEARCHINCR 48
#define O_SECTIONS 49
#define O_SECURE 50
#define O_SHELL 51
#define O_SHELLMETA 52
#define O_SHIFTWIDTH 53
#define O_SHOWMATCH 54
#define O_SHOWMODE 55
#define O_SIDESCROLL 56
#define O_SLOWOPEN 57
#define O_SOURCEANY 58
#define O_TABSTOP 59
#define O_TAGLENGTH 60
#define O_TAGS 61
#define O_TERM 62
#define O_TERSE 63
#define O_TILDEOP 64
#define O_TIMEOUT 65
#define O_TTYWERASE 66
#define O_VERBOSE 67
#define O_W1200 68
#define O_W300 69
#define O_W9600 70
#define O_WARN 71
#define O_WINDOW 72
#define O_WINDOWNAME 73
#define O_WRAPLEN 74
#define O_WRAPMARGIN 75
#define O_WRAPSCAN 76
#define O_WRITEANY 77
#define O_OPTIONCOUNT 78
-5
View File
@@ -226,11 +226,6 @@ v_tagpush(sp, vp)
ARGS *ap[2], a;
EXCMD cmd;
#ifdef GTAGS
if (O_ISSET(sp, O_GTAGSMODE) && vp->m_start.cno == 0)
ex_cinit(&cmd, C_RTAG, 0, OOBLNO, 0, 0, ap);
else
#endif
ex_cinit(&cmd, C_TAG, 0, OOBLNO, 0, 0, ap);
ex_cadd(&cmd, &a, VIP(sp)->keyw, strlen(VIP(sp)->keyw));
return (v_exec_ex(sp, vp, &cmd));
-339
View File
@@ -1,339 +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
Appendix: 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) 19yy <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) 19yy 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
-181
View File
@@ -1,181 +0,0 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
-119
View File
@@ -1,119 +0,0 @@
Getting Started with Texinfo
============================
25 March 1993
Most of the installation instructions are described in the file `INSTALL'.
One additional note to make is that if your info files are in a nonstandard
place (i.e. not in the `info' directory immediately under $prefix) you may
wish to change the default info path as specified via DEFAULT_INFOPATH in
info/Makefile.in.
"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.texi'.
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.texi' 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, type
$ 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
If you are using GNU Emacs, you may want to install the Emacs Lisp files
permanently. Move them them to a directory in the load-path for Emacs;
otherwise Emacs will not be able to load the autoloaded support files, such
as `texinfmt.el'.
The `texinfo.el' file contains the autoload commands; it is the only
file that needs to be loaded initially. If your Emacs does not
automatically load `texinfo.el', you can tell it to do so by placing
the following in `default.el' or in your `.emacs' file:
(load "texinfo")
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:
$ make texinfo.dvi
$ (cd info; make info.dvi info-stnd.dvi)
$ (cd makeinfo; make makeinfo.dvi)
You can then print the resulting .dvi files with the `lpr' command (on BSD
systems. On SysV systems the command is `lp'. Consult your man pages for
more information).
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 [email protected].
Happy formatting.
-211
View File
@@ -1,211 +0,0 @@
# Makefile for Texinfo distribution.
# $Id: Makefile.in,v 1.11 1996/10/04 18:40:33 karl Exp $
#
# Copyright (C) 1993, 96 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.
#### Start of system configuration section. ####
srcdir = @srcdir@
VPATH = $(srcdir):$(common)
common = $(srcdir)/libtxi
CC = @CC@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
LN = ln
RM = rm -f
TAR = tar
MKDIR = mkdir
DEFS = @DEFS@
LIBS = @LIBS@
LOADLIBES = $(LIBS)
ALLOCA = @ALLOCA@
SHELL = /bin/sh
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(exec_prefix)/bin
# Prefix for each installed program, normally empty or `g'.
binprefix =
# Prefix for each installed man page, normally empty or `g'.
manprefix =
manext = 1
mandir = $(prefix)/man/man$(manext)
infodir = $(prefix)/info
# For info program.
DEFAULT_INFOPATH = $(infodir):.
#### End of system configuration section. ####
VERSION = 3.9
DISTNAME = texinfo-$(VERSION)
# Subdirectories that have makefiles
SUBDIRS = libtxi makeinfo info util emacs
# All subdirectories that go into a distribution
ALL_SUBDIRS = $(SUBDIRS) makeinfo/macros
MDEFINES = bindir='$(bindir)' mandir='$(mandir)' manext='$(manext)' \
prefix='$(prefix)' binprefix='$(binprefix)' \
manprefix='$(manprefix)' infodir='$(infodir)' CFLAGS='$(CFLAGS)' \
CC='$(CC)' ALLOCA='$(ALLOCA)' LDFLAGS='$(LDFLAGS)' \
DEFAULT_INFOPATH='$(DEFAULT_INFOPATH)'
all: sub-all texinfo
install: all installdirs
test -f $(infodir)/dir || $(INSTALL_DATA) $(srcdir)/dir $(infodir)
for dir in $(SUBDIRS); do \
echo making $@ in $$dir; \
(cd $$dir && $(MAKE) $(MDEFINES) $@ || exit 1); \
done
d=$(srcdir); test -f ./texinfo && d=.; \
(cd $$d && for f in texinfo texinfo-* ; do \
$(INSTALL_DATA) $$f $(infodir)/$$f; done)
$(POST_INSTALL)
./util/install-info --info-dir=$(infodir) $(infodir)/texinfo
@echo Please install $(srcdir)/texinfo.tex manually.
installdirs:
-$(SHELL) $(srcdir)/util/mkinstalldirs $(bindir) $(datadir) $(infodir) $(mandir)
uninstall:
for dir in $(SUBDIRS); do \
echo making $@ in $$dir; \
(cd $$dir && $(MAKE) $(MDEFINES) $@ || exit 1); \
done
$(RM) $(infodir)/texinfo $(infodir)/texinfo-*
Makefile: Makefile.in config.status
$(SHELL) ./config.status
config.status: configure
$(SHELL) ./config.status --recheck
configure: configure.in
cd $(srcdir) && autoconf
sub-all TAGS:
for dir in $(SUBDIRS); do \
echo making $@ in $$dir; \
(cd $$dir && $(MAKE) $(MDEFINES) $@ || exit 1); \
done
.PHONY: sub-all
clean mostlyclean:
for dir in $(SUBDIRS); do \
echo making $@ in $$dir; \
(cd $$dir && $(MAKE) $(MDEFINES) $@ || exit 1); \
done
distclean: clean texclean
for dir in $(SUBDIRS); do \
echo making $@ in $$dir; \
(cd $$dir && $(MAKE) $(MDEFINES) $@ || exit 1); \
done
$(RM) Makefile *.status *.cache *.log texinfo texinfo-? texinfo-??
texclean:
$(RM) *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.pg *.pgs
$(RM) *.toc *.tp *.tps *.vr *.vrs
realclean: distclean
# Let's hope we weren't cross-compiling.
# If we depend on sub-all, this always gets remade. Annoying.
info texinfo: texinfo.texi
./makeinfo/makeinfo -I$(srcdir) texinfo.texi
.PHONY: info
dvi texinfo.dvi:
PATH="$(srcdir)/util:$${PATH}" TEXINPUTS="$(srcdir):$(common):$${TEXINPUTS}" texi2dvi $(srcdir)/texinfo.texi
.PHONY: dvi
dist: DISTFILES
$(RM) -r $(DISTNAME)
$(MKDIR) $(DISTNAME)
for d in `find . -type d ! -name RCS -print`; do \
d=`echo $$d | grep -v '[@=]'`; \
test -z "$$d" || test "$$d" = . || test "$$d" = "./$(DISTNAME)" \
|| mkdir $(DISTNAME)/$$d; done
for f in `cat DISTFILES`; do \
$(LN) $(srcdir)/$$f $(DISTNAME)/$$f || \
{ echo copying $$f; cp -p $(srcdir)/$$f $(DISTNAME)/$$f ; } \
done
(cd $(DISTNAME); $(MAKE) $(MFLAGS) distclean)
$(TAR) chvf - $(DISTNAME) | gzip >$(DISTNAME).tar.gz
$(RM) -r $(DISTNAME)
# Gets rid of most of the unwanted files. Verify manually (if necessary)
# that this produces a list of all the files desired in the distribution.
DISTFILES: force
(cd $(srcdir); find . ! -type d -print) \
| sed '/\/RCS\//d; \
/\/EMACS-BACKUPS\//d; \
/\.tar.*/d; \
/~$$/d; /\.o$$/d; \
/\.gdbinit$$/d; \
/\.orig$$/d; \
/\#$$/d; \
/\/info\/info$$/d; \
/\.info$$/d; \
/\.elc/d; \
/\/makeinfo\/makeinfo$$/d; \
/\/$(DISTNAME)\/.*$$/d; \
/\/util\/texindex$$/d; \
/texinfo$$/d; \
/texinfo-[0-9]+$$/d; \
/\/.*\.BAK$$/d; \
/\/.*\.a$$/d; \
/\/core$$/d; \
/\/*\.core$$/d; \
/\/core\..*$$/d; \
/\/a.out$$/d; \
/\/[=@]/d; \
/\/conftest\.c$$/d; \
/\/DISTFILES$$/d; \
/\/foo$$/d; \
/\/bar$$/d; \
/\.toc$$/d; \
/\.bak$$/d; \
/\.aux$$/d; /\.log$$/d; \
/\.cps$$/d; /\.cp$$/d; \
/\.fns$$/d; /\.fn$$/d; \
/\.tps$$/d; /\.tp$$/d; \
/\.vrs$$/d; /\.vr$$/d; \
/\.pgs$$/d; /\.pg$$/d; \
/\.kys$$/d; /\.ky$$/d; \
/\.ops$$/d; /\.op$$/d; \
s/^.\///; /^\.$$/d;' \
| sort | uniq > DISTFILES
force:
# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
-93
View File
@@ -1,93 +0,0 @@
This file records noteworthy changes.
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.
texinfo-3.0: first release of Texinfo version 2, with many new commands.
-163
View File
@@ -1,163 +0,0 @@
Texinfo, Version 3
==================
This is the README file for version 3 of the Texinfo distribution.
Files within this distribution have their own version and edition
numbers. When you refer to a file, please mention its own number, as
well as the version number of the Texinfo distribution.
PLEASE REPORT BUGS TO: [email protected]
Texinfo is a documentation system that uses a single source file to
produce both on-line information and printed output. This means that
instead of writing two different documents, one for the on-line help
or other on-line information and the other for a typeset manual or
other printed work, you need write only one document. When the work
is revised, you need revise only one document. You can read the
on-line information, known as an "Info file", with an Info
documentation-reading program. By convention, Texinfo source file
names end with a `.texi' or `.texinfo' extension. Texinfo is
described in the Texinfo manual (the file ./texinfo.texi).
You can write and format Texinfo files into Info files within GNU Emacs,
and read them using the Emacs Info reader. If you do not have Emacs,
you can format Texinfo files into Info files using `makeinfo' and read
them using `info'. Use TeX, which is not included in this package (see
`How to Obtain TeX' in the Texinfo manual for information), to typeset
Texinfo files for printing.
For instructions on compiling and installing info, makeinfo, texi2dvi,
and texindex, please read the file `INSTALL'. The Emacs Lisp files are
not installed by default; to install them, use `make install' in the
`emacs' subdirectory. The Info tree uses a file `dir' as its root node;
a sample `dir' file is included in the distribution, but not installed
anywhere. Use it or not as you like.
This distribution includes (but is not limited to) the following files:
README This file.
INTRODUCTION This file tells you how to create
readable files from the Texinfo source
files in this distribution.
Texinfo source files:
texinfo.texi This manual describes Texinfo. It
tells how to use Texinfo to write
documentation, how to use Texinfo mode
in GNU Emacs, how to use TeX,
makeinfo, and the Emacs Lisp Texinfo
formatting commands.
info.texi This manual tells you how to use
Info. This document 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 a C
source file, `info.c'.
makeinfo.texi This manual tells you how to use
makeinfo. The same information is
contained in a chapter of the Texinfo
manual; it has been extracted here for
your convenience.
Printing related files:
texinfo.tex This TeX definitions file tells
the TeX program how to typeset a
Texinfo file into a DVI file ready for
printing.
texindex.c This file contains the source for
the `texindex' program that generates
sorted indices used by TeX when
typesetting a file for printing.
texi2dvi This is a shell script for
producing an indexed DVI file using
TeX and texindex. Must be used if the
source document uses Texinfo @macros.
GNU Emacs related files:
texinfmt.el This Emacs Lisp file provides the
functions that GNU Emacs uses to
format a Texinfo file into an Info
file.
texinfo.el This file provides Texinfo mode
for GNU Emacs.
texnfo-upd.el These files provides commands to
texnfo-tex.el help you write Texinfo files
makeinfo.el using GNU Emacs Texinfo mode.
detexinfo.el This extra utility file contains functions
to remove Texinfo commands from a
Texinfo source file.
info.el These are the standard GNU Emacs
informat.el Info reading and support files,
included here for your convenience.
Source files for standalone C programs:
makeinfo.c This file contains the source for
the `makeinfo' program that you can
use to create an Info file from a
Texinfo file.
info.c This file contains the source for
the `info' program that you can use to
view Info files on an ASCII terminal.
getopt.c Various support files
getopt1.c
getopt.h
C Installation files:
configure This file creates creates a Makefile
which in turn creates an `info' or
`makeinfo' executable, or a C sources
distribution.
configure.in This is a template for creating
`configure' using m4 macros.
Makefile.in This is a template for `configure'
to use to make a Makefile.
Other files:
NEWS This contains a summary of new
features since the first edition
of Texinfo.
info.1 This is a `man' page that briefly
describes the standalone `info'
program.
fixfonts This is a shell script to install the
`lcircle10' TeX fonts as an alias for
the `circle10' fonts. In some older
TeX distributions the names are
different.
tex3patch This handles a bug for version
3.0 of TeX that does not occur in
more recent versions.
-35
View File
@@ -1,35 +0,0 @@
If you are interested in working on any of these,
email [email protected].
* Use Automake.
* Use a config header file instead of @DEFS@.
* 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 come close.
* Change bars. This is difficult or impossible in TeX,
unfortunately. To do it right requires device driver support.
* The dark corner symbol for the gawk manual.
* Better i18n support, including support for 8-bit input
characters. Requires fonts, and the DC fonts are not (as of this
writing) free.
* @exercise/@answer command for, e.g., gawk.
* @figure.
* HTML output in makeinfo.
* Include a complete functional summary, a la a reference card, in the manual.
* Use @ as the escape character, and Texinfo syntax generally, in the
table of contents, aux, and index files. Eliminate all the crazy
redefinitions of every Texinfo command (which lists always seem to be
incomplete).
* Improve the manuals for makeinfo, standalone info, etc.
-1876
View File
File diff suppressed because it is too large. Load diff
-42
View File
@@ -1,42 +0,0 @@
dnl Process this file with autoconf to produce a configure script.
dnl $Id: configure.in,v 1.3 1996/10/03 18:33:52 karl Exp $
AC_INIT(texinfo.texi)
dnl Checks for programs.
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_ISC_POSIX
AC_MINIX
dnl Checks for libraries.
# Needed on sysV68 for sigblock, sigsetmask.
AC_CHECK_LIB(bsd, sigblock)
TERMLIBS=
for termlib in curses termcap terminfo termlib ; do
AC_CHECK_LIB(${termlib}, tputs,
[TERMLIBS="${TERMLIBS} -l${termlib}"; break])
done
AC_SUBST(TERMLIBS)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h termios.h termio.h strings.h string.h varargs.h \
sys/time.h sys/fcntl.h sys/ttold.h sys/ptem.h sys/file.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
AC_C_CONST
AC_STRUCT_TM
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_SETVBUF_REVERSED
AC_CHECK_FUNCS(setvbuf getcwd memset bzero strchr strcasecmp \
vfprintf vsprintf strerror sigprocmask sigsetmask)
dnl strcasecmp, strerror, xmalloc, xrealloc, probably others should be added.
AC_REPLACE_FUNCS(memcpy memmove strdup)
AC_OUTPUT(Makefile libtxi/Makefile makeinfo/Makefile info/Makefile util/Makefile emacs/Makefile)
-16
View File
@@ -1,16 +0,0 @@
$Id: dir,v 1.2 1996/09/24 18:43:01 karl Exp $
This is the file .../info/dir, which contains the topmost node of the
Info hierarchy. The first time you invoke Info you start off
looking at that node, which is (dir)Top.

File: dir Node: Top This is the top of the INFO tree
This (the Directory node) gives a menu of major topics.
Typing "q" exits, "?" lists all Info commands, "d" returns here,
"h" gives a primer for first-timers,
"mEmacs<Return>" visits the Emacs topic, etc.
In Emacs, you can click mouse button 2 on a menu item or cross reference
to select it.
* Menu:
-309
View File
@@ -1,309 +0,0 @@
This is the directory file `dir' a.k.a. `DIR', which contains the
topmost node of the Info hierarchy. This file is merely made available
for your hacking pleasure, not official or standard in any way.
If it doesn't make sense to you, or you don't like it, ignore it.
$Id: dir,v 1.20 1996/10/04 18:39:29 karl Exp $

File: dir Node: Top This is the top of the INFO tree.
This node gives a menu of the major topics accessible through Info.
`q' quits;
`?' lists all Info commands;
`h' starts the Info tutorial;
`mTexinfo RET' visits the Texinfo manual, etc.
* Menu:
GNU packages
* Bash: (bash). Bourne again shell.
* Cpio: (cpio). Cpio archiver.
* DC: (dc). Postfix arbitrary expression calculator.
* Diff: (diff). Comparing and merging programs.
* Ed: (ed). Line editor.
* Emacs: (emacs). Extensible self-documenting text editor.
* File utilities: (fileutils). GNU file utilities.
* Finding files: (find). Operating on files matching certain criteria.
* Font utilities: (fontu). Programs for font manipulation.
* Gawk: (gawk). A text processing and scanning language.
* Gzip: (gzip). General (de)compression.
* Identifier DB: (id-utils). Identifier database utilities.
* Ispell: (ispell). Interactive spelling corrector.
* M4: (m4). Macro processor.
* Make: (make). Remake files automatically.
* Ptx: (ptx). Permuted index generator.
* Shar: (sharutils). Shell archiver, uudecode/uuencode.
* Shell utilities: (sh-utils). GNU shell utilities.
* Tar: (tar). ``Tape'' archiver.
* Text utilities: (textutils). GNU text utilities.
* Time: (time). Measuring program resource usage.
* UUCP: (uucp). Copying between machines, offline.
* Wdiff: (wdiff). Word-by-word comparison.
GNU programming tools
* As: (as). Assembler.
* Binutils: (binutils). ar/copy/objdump/nm/size/strip/ranlib.
* Bison: (bison). LALR(1) parser generator.
* CPP: (cpp). C preprocessor.
* CVS: (cvs). Concurrent versions system for source control.
* DejaGnu: (dejagnu). Testing framework.
* Flex: (flex). A fast scanner generator.
* Gasp: (gasp). GNU Assembler preprocessor.
* Libtool: (libtool). Generic library support script.
* GCC: (gcc). C compiler.
* GDB: (gdb). Source-level debugger for C and C++.
* Gperf: (gperf). Perfect hash function generator.
* Gprof: (gprof). Profiler.
* Indent: (indent). Prettyprinter for programs.
* Ld: (ld). Linker.
Texinfo documentation system
* Info: (info). Documentation browsing system.
* Texinfo: (texinfo). The GNU documentation format.
* install-info: (texinfo)Invoking install-info. Updating info/dir entries.
* texi2dvi: (texinfo)Format with texi2dvi. Printing Texinfo documentation.
* texindex: (texinfo)Format with tex/texindex. Sorting Texinfo index files.
* info program: (info-stnd). Standalone Info-reading program.
* makeinfo: (makeinfo). Convert Texinfo source to Info or plain ASCII.
GNU Emacs Lisp
* Elisp: (elisp). GNU Emacs Lisp reference manual.
* Intro Elisp: (emacs-lisp-intro). Introduction to Elisp programming.
* Calc: (calc). Calculator and more.
* CC-mode: (ccmode). Editing C, C++, and Objective C.
* Common Lisp: (cl). Partial Common Lisp support for Emacs Lisp.
* Dired-x: (dired-x). Extra directory editor features.
* Edebug: (edebug). Source-level debugger for Emacs Lisp.
* Ediff: (ediff). Comprehensive visual interface to diff & patch.
* EDB: (edb). Database for Emacs.
* Forms: (forms). Fill-in-the-form data entry.
* Gmhist: (gmhist). Generic minibuffer history.
* GNUS: (gnus). Netnews reading and posting.
* Mailcrypt: (mailcrypt). Use PGP in Emacs.
* MH-E: (mh-e). Emacs interface to the MH mail system.
* PCL-CVS: (pcl-cvs). Emacs front end to CVS.
* Supercite: (sc). Supercite for including other people's words.
* VIP: (vip). vi emulation.
* VIPER: (viper). The new VI-emulation mode in Emacs-19.29.
* VM: (vm). Mail reader.
* W3: (w3). WWW browser.
GNU admin
* Autoconf: (autoconf). Automatic generation of package configuration.
* Automake: (automake). Making Makefile.in's.
* Configure: (configure). Cygnus configure.
* Gettext: (gettext). Internationalization.
* Gnats: (gnats). Cygnus bug tracking system.
* Maintaining: (maintain). Maintaining GNU software.
* Remsync: (remsync). Remote synchronization of directory trees.
* Send PR: (send-pr). Cygnus bug reporting for Gnats.
* Source config: (cfg-paper). Some theory on configuring source packages.
* Standards: (standards). GNU coding standards.
GNU libraries
* Annotate: (annotate). High-level GDB to GUI's.
* BFD: (bfd). Binary file descriptors for object file IO.
* GDB library: (libgdb). Application programming interface to GDB.
* GDBM: (gdbm). Hashed databases.
* History: (history). Recall previous lines of input.
* Iostream: (iostream). C++ input/output.
* Libc: (libc). C library.
* Libg++: (libg++). C++ classes.
* Mmalloc: (mmalloc). Memory-mapped malloc.
* Readline: (readline). General command-line interface.
* Regex: (regex). Regular expressions.
* Termcap: (termcap). All about /etc/termcap.
GNU programming documentation
* GDB internals: (gdbint). Debugger internals.
* Ld internals: (ldint). GNU linker internals.
* Stabs: (stabs). Symbol table debugging information format.
DOS
* Demacs: (demacs). GNU Emacs for DOS.
* GNUish: (gnuish). GNU utilities for DOS.
TeX things
* Afm2tfm: (dvips)Invoking afm2tfm. Making Type 1 fonts available to TeX.
* Dvips: (dvips). DVI-to-PostScript translator.
* Eplain: (eplain). Expanding on plain TeX.
* Kpathsearch: (kpathsea). File lookup along search paths.
* LaTeX: (latex). LaTeX.
* MakeIndex: (makeindex). Index creation for TeX.
* Naming fonts: (fontname). Filenames for TeX fonts.
* TeXDraw: (texdraw). Drawing PostScript diagrams within TeX.
* Web2c: (web2c). TeX, Metafont, and their companion programs.
Other things
* Amd: (amdref). Filesystem automounter.
* CMUCL: (cmu-user). CMU Common Lisp.
* File headers: (filehdr). Bibliographic information for computer files.
* HTML: (snafu). Hypertext Markup Language 2.0 specification.
* Jargon: (jargon). The jargon file.
* Perl: (perl). Practical extraction and report language.
* PRCS: (prcs). Project revision control system.
* Screen: (screen). Virtual screen manager.
* UMB C.S. Dept.: (csinfo). UMass/Boston Computer Science Dept. info.
Individual utilities
* aid: (id-utils)aid invocation. Matching strings.
* ar: (binutils)ar. Create/modify/extract archives.
* at-pr: (gnats)at-pr. Bug report timely reminders.
* autoreconf: (autoconf)Invoking autoreconf. Remake multiple configure's.
* autoscan: (autoconf)Invoking autoscan. Automate initial configure.in.
* awk: (Gawk)Invoking gawk. Text processing and scanning.
* basename: (sh-utils)basename invocation. Strip directory and suffix.
* bibtex: (web2c)BibTeX invocation. Maintaining bibliographies.
* c++filt: (binutils)c++filt. Demangle C++ symbols.
* cat: (textutils)cat invocation. Concatenate and write files.
* chgrp: (fileutils)chgrp invocation. Change file groups.
* chmod: (fileutils)chmod invocation. Change file permissions.
* chown: (fileutils)chown invocation. Change file owners/groups.
* chroot: (sh-utils)chroot invocation. Specify the root directory.
* cksum: (textutils)cksum invocation. Print POSIX CRC checksum.
* cmp: (diff)Invoking cmp. Character-by-character diff.
* comm: (textutils)comm invocation. Compare sorted files by line.
* cp: (fileutils)cp invocation. Copy files.
* csplit: (textutils)csplit invocation. Split by context.
* cut: (textutils)cut invocation. Print selected parts of lines.
* date: (sh-utils)date invocation. Print/set system date and time.
* dd: (fileutils)dd invocation. Copy and convert a file.
* df: (fileutils)df invocation. Report filesystems' disk usage.
* diff3: (diff)Invoking diff3. Three-way diff.
* dir: (fileutils)dir invocation. List directories briefly.
* dirname: (sh-utils)dirname invocation. Strip non-directory suffix.
* dmp: (web2c)Dmp invocation. Troff->MPX (MetaPost pictures).
* du: (fileutils)du invocation. Report on disk usage.
* dvicopy: (web2c)DVIcopy invocation. Virtual font expansion
* dvitomp: (web2c)DVItoMP invocation. DVI to MPX (MetaPost pictures).
* dvitype: (web2c)DVItype invocation. DVI to human-readable text.
* echo: (sh-utils)echo invocation. Print a line of text.
* edit-pr: (gnats)Invoking edit-pr. Changing bugs.
* eid: (id-utils)eid invocation. Invoking an editor on matches.
* emacsclient: (emacs)Emacs Server. Connecting to a running Emacs.
* emacsserver: (emacs)Emacs Server. Connecting to a running Emacs.
* env: (sh-utils)env invocation. Modify the environment.
* etags: (emacs)Create Tags Table. Creating a TAGS table.
* expand: (textutils)expand invocation. Convert tabs to spaces.
* expr: (sh-utils)expr invocation. Evaluate expressions.
* false: (sh-utils)false invocation. Do nothing, unsuccessfully.
* fid: (id-utils)fid invocation. Listing a file's identifiers.
* file-pr: (gnats)file-pr. Processing incoming traffic.
* find: (find)Invoking find. Finding and acting on files.
* fmt: (textutils)fmt invocation. Reformat paragraph text.
* fold: (textutils)fold invocation. Wrap long input lines.
* g++: (gcc)Invoking G++. The GNU C++ compiler.
* gftodvi: (web2c)GFtoDVI invocation. Generic font proofsheets.
* gftopk: (web2c)GFtoPK invocation. Generic to packed fonts.
* gftype: (web2c)GFtype invocation. GF to human-readable text.
* gid: (id-utils)gid invocation. Listing all matching lines.
* groups: (sh-utils)groups invocation. Print group names a user is in.
* gunzip: (gzip)Overview. Decompression.
* head: (textutils)head invocation. Output the first part of files.
* hostname: (sh-utils)hostname invocation. Print or set system name.
* id: (sh-utils)id invocation. Print real/effective uid/gid.
* idx: (id-utils)idx invocation. Testing mkid scanners.
* ifnames: (autoconf)Invoking ifnames. List conditionals in source.
* iid: (id-utils)iid invocation. Interactive complex queries.
* inimf: (web2c)inimf invocation. Initial Metafont.
* inimp: (web2c)inimp invocation. Initial MetaPost.
* initex: (web2c)initex invocation. Initial TeX.
* install: (fileutils)install invocation. Copy and change attributes.
* join: (textutils)join invocation. Join lines on a common field.
* kpsewhich: (kpathsea)Invoking kpsewhich. TeX file searching.
* lid: (id-utils)lid invocation. Matching identifier patterns.
* ln: (fileutils)ln invocation. Make links between files.
* locate: (find)Invoking locate. Finding files in a database.
* logname: (sh-utils)logname invocation. Print current login name.
* ls: (fileutils)ls invocation. List directory contents.
* makempx: (web2c)MakeMPX invocation. MetaPost label typesetting.
* maketexmf: (kpathsea)MakeTeX scripts. MF source generation.
* maketexpk: (kpathsea)MakeTeX scripts. PK bitmap generation.
* maketextex: (kpathsea)MakeTeX scripts. TeX source generation.
* maketextfm: (kpathsea)MakeTeX scripts. TeX font metric generation.
* mf: (web2c)mf invocation. Creating typeface families.
* mft: (web2c)MFT invocation. Prettyprinting Metafont source.
* mkdir: (fileutils)mkdir invocation. Create directories.
* mkfifo: (fileutils)mkfifo invocation. Create FIFOs: (named pipes).
* mkid: (id-utils)mkid invocation. Creating an ID database.
* mknod: (fileutils)mknod invocation. Create special files.
* mp: (web2c)mp invocation. Creating technical diagrams.
* mpto: (web2c)MPto invocation. MetaPost label extraction.
* mv: (fileutils)mv invocation. Rename files.
* newer: (web2c)Newer invocation. Compare modification times.
* nice: (sh-utils)nice invocation. Modify scheduling priority.
* nl: (textutils)nl invocation. Number lines and write files.
* nlmconv: (binutils)nlmconv. Convert object to NetWare LM.
* nm: (binutils)nm. List symbols in object files.
* nohup: (sh-utils)nohup invocation. Immunize to hangups.
* objcopy: (binutils)objcopy. Copy/translate object files.
* objdump: (binutils)objdump. Display info from object files.
* od: (textutils)od invocation. Dump files in octal, etc.
* paste: (textutils)paste invocation. Merge lines of files.
* patch: (diff)Invoking patch. Automatically applying diffs.
* patgen: (web2c)Patgen invocation. Creating hyphenation patterns.
* pathchk: (sh-utils)pathchk invocation. Check file name portability.
* pid: (id-utils)pid invocation. Looking up filenames.
* pktogf: (web2c)PKtoGF invocation. Packed to generic fonts.
* pktype: (web2c)PKtype invocation. PK to human-readable text.
* pltotf: (web2c)PLtoTF invocation. Property list to TFM.
* pooltype: (web2c)Pooltype invocation. Display WEB pool files.
* pr-addr: (gnats)pr-addr. Bug report address retrieval.
* pr-edit: (gnats)pr-edit. The edit-pr driver.
* pr: (textutils)pr invocation. Paginate or columnate files.
* printenv: (sh-utils)printenv invocation. Print environment variables.
* printf: (sh-utils)printf invocation. Format and print data.
* pwd: (sh-utils)pwd invocation. Print working directory.
* query-pr: (gnats)Invoking query-pr. Bug searching/reporting.
* queue-pr: (gnats)queue-pr. Handling incoming traffic.
* ranlib: (binutils)ranlib. Index archive file contents.
* rm: (fileutils)rm invocation. Remove files.
* rmdir: (fileutils)rmdir invocation. Remove empty directories.
* sdiff: (diff)Invoking sdiff. Interactively merge files.
* send-pr: (gnats)Invoking send-pr. Submitting bugs.
* shar: (sharutils)shar invocation. Create shell archive.
* size: (binutils)size. List object file section sizes.
* sleep: (sh-utils)sleep invocation. Delay for a specified time.
* sort: (textutils)sort invocation. Sort text files.
* split: (textutils)split invocation. Split into fixed-size pieces.
* strings: (binutils)strings. List printable strings.
* strip: (binutils)strip. Discard symbols.
* stty: (sh-utils)stty invocation. Print/change terminal settings.
* su: (sh-utils)su invocation. Modify user and group id.
* sum: (textutils)sum invocation. Print traditional checksum.
* sync: (fileutils)sync invocation. Synchronize memory and disk.
* tabs: (tput)Invoking tabs. Tab settings.
* tac: (textutils)tac invocation. Reverse files.
* tail: (textutils)tail invocation. Output the last part of files.
* tangle: (web2c)Tangle invocation. WEB to Pascal.
* tee: (sh-utils)tee invocation. Redirect to multiple files.
* test: (sh-utils)test invocation. File/string tests.
* tex: (web2c)tex invocation. Typesetting.
* tftopl: (web2c)TFtoPL invocation. TFM -> property list.
* touch: (fileutils)touch invocation. Change file timestamps.
* tput: (tput)Invoking tput. Termcap in shell scripts.
* tr: (textutils)tr invocation. Translate characters.
* true: (sh-utils)true invocation. Do nothing, successfully.
* tty: (sh-utils)tty invocation. Print terminal name.
* uname: (sh-utils)uname invocation. Print system information.
* unexpand: (textutils)unexpand invocation. Convert spaces to tabs.
* uniq: (textutils)uniq invocation. Uniqify files.
* unshar: (sharutils)unshar invocation. Extract from shell archive.
* updatedb: (find)Invoking updatedb. Building the locate database.
* users: (sh-utils)users invocation. Print current user names.
* vdir: (fileutils)vdir invocation. List directories verbosely.
* vftovp: (web2c)VFtoVP invocation. Virtual font -> virtual pl.
* view-pr: (gnats)Invoking view-pr. Showing bug reports.
* virmf: (web2c)virmf invocation. Virgin Metafont.
* virmp: (web2c)virmp invocation. Virgin MetaPost.
* virtex: (web2c)virtex invocation. Virgin TeX.
* vptovf: (web2c)VPtoVF invocation. Virtual pl -> virtual font.
* wc: (textutils)wc invocation. Byte, word, and line counts.
* weave: (web2c)Weave invocation. WEB to TeX.
* who: (sh-utils)who invocation. Print who is logged in.
* whoami: (sh-utils)whoami invocation. Print effective user id.
* xargs: (find)Invoking xargs. Operating on many files.
* yes: (sh-utils)yes invocation. Print a string indefinitely.
* zcat: (gzip)Overview. Decompression to stdout.
-88
View File
@@ -1,88 +0,0 @@
# Makefile for Texinfo/emacs.
# Copyright (C) 1995, 96 Free Software Foundation, Inc.
# $Id: Makefile.in,v 1.4 1996/09/28 21:34:34 karl Exp $
# 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 ([email protected])
#
srcdir = @srcdir@
VPATH = $(srcdir)
SHELL = /bin/sh
RM = rm -f
ELISP_SRCS = info.el makeinfo.el texinfo.el texnfo-upd.el \
texnfo-tex.el texinfmt.el informat.el detexinfo.el
ELISP_OBJS = info.elc makeinfo.elc texinfo.elc texnfo-upd.elc \
texnfo-tex.elc texinfmt.elc informat.elc detexinfo.elc
.SUFFIXES: .el .elc
.el.elc:
$(srcdir)/elisp-comp $<
all:
sub-all: all
elisp: $(ELISP_OBJS)
.PHONY: elisp
# Nobody likes any of these install targets. Fine. Install it
# manually, then.
install:
@echo Please install the Emacs Lisp files manually.
uninstall:
@echo Please uninstall the Emacs Lisp files manually.
# install: $(ELISP_OBJS)
# @(echo "(print (car load-path))" >/tmp/elc.$$$$; \
# lispdir=`emacs -batch -q -l /tmp/elc.$$$$ -nw | grep site-lisp`; \
# rm /tmp/elc.$$$$; \
# if [ "$$lispdir" != "" ]; then \
# lispdir=`echo $$lispdir | sed -e 's/"//g'`; \
# echo "Installing .elc files in $$lispdir."; \
# $(CP) $(ELISP_OBJS) $$lispdir; \
# else \
# echo "To install the elisp files, please copy *.elc to the"; \
# echo "emacs site-lisp directory."; \
# fi)
#
# install: $(ELISP_OBJS)
# for file in $(ELISP_OBJS); do \
# $(INSTALL_DATA) $$file $(lispdir); \
# done
#
# uninstall: $(ELISP_OBJS)
# cd $(lispdir) && rm -f $(ELISP_OBJS)
#
informat.elc: info.elc
makeinfo.elc: texinfo.elc
texinfmt.elc: texinfo.elc
texinfmt.elc: texnfo-upd.elc
Makefile: $(srcdir)/Makefile.in ../config.status
cd .. && sh config.status
realclean distclean: clean
$(RM) Makefile *.log
clean: FORCE
$(RM) *.elc
FORCE:
-250
View File
@@ -1,250 +0,0 @@
;;; Here is a handy keybinding:
(global-set-key "\C-x\\" 'detexinfo)
;;;;;;;;;;;;;;;; detexinfo.el ;;;;;;;;;;;;;;;;
;;;
;;; Remove Texinfo commands from a Texinfo source file.
;;;
;;; Copyright (C) 1991, 1992 Free Software Foundation
;;; Robert J. Chassell
;;; bugs to [email protected]
;;;
;;; ==> test version <==
;;; Fails if Texinfo source file contains formatting errors.
;;;
;;; Version 0.05 - 3 Jun 1992
;;; Add to list of removed commands. Improve messages.
;;;
;;; Version 0.04 - 27 Jan 1992
;;; Rewrite to insert detexinfo'd text into a temporary buffer.
;;;
;;; Version 0.03 - 27 Dec 1991
;;; Improved messages.
;;;
;;; Version 0.02 - 13 Nov 1991
;;; detexinfo-remove-inline-cmd, detexinfo-syntax-table: Handle
;;; nested commands.
;;; detexinfo: Handle nested @'s, eg @samp{@}} and @samp{@@};
;;; replace @TeX{} with TeX.
;;;
;;; Version 0.01 - 13 Nov 1991
;;;
;;; Based on detex.el, by Bengt Martensson, 4 Oct 1987
;;;
;;;;;;;;;;;;;;;;
(defvar detexinfo-buffer-name "*detexinfo*"
"*Name of the temporary buffer used by \\[detexinfo].")
(defvar detexinfo-syntax-table nil)
(if detexinfo-syntax-table
nil
(setq detexinfo-syntax-table (make-syntax-table))
(modify-syntax-entry ?\[ "." detexinfo-syntax-table)
(modify-syntax-entry ?\] "." detexinfo-syntax-table)
(modify-syntax-entry ?\" "." detexinfo-syntax-table)
(modify-syntax-entry ?\\ "." detexinfo-syntax-table)
(modify-syntax-entry ?\( "." detexinfo-syntax-table)
(modify-syntax-entry ?\) "." detexinfo-syntax-table)
(modify-syntax-entry ?{ "(}" detexinfo-syntax-table)
(modify-syntax-entry ?} "){" detexinfo-syntax-table))
(defun detexinfo ()
"Remove Texinfo commands from current buffer, copying result to new buffer.
BUG: Fails if Texinfo source file contains formatting errors."
(interactive)
(let ((input-buffer (current-buffer)))
;; Find a buffer to use.
(switch-to-buffer (get-buffer-create detexinfo-buffer-name))
(setq major-mode 'detexinfo-mode)
(set-syntax-table detexinfo-syntax-table)
(erase-buffer)
(insert-buffer-substring input-buffer)
;; Replace @{ and @} with %#* and *#% temporarily, so @samp{@{} works.
;; What is a better way of doing this??
(goto-char (point-min))
(while (search-forward "@{" nil t) ; e.g., @samp{@{}
(replace-match "%#*"))
(goto-char (point-min))
(while (search-forward "@}" nil t)
(forward-char -3) ; e.g., @samp{@@}
(if (looking-at "@") ; Two @@ in a row
(progn
(delete-char 2)
(insert "%&%#"))
(forward-char 1)
(delete-char 2)
(insert "*#%")))
(goto-char (point-min))
;; Remove @refill, the only inline command without braces.
(while (search-forward "@refill" nil t)
(replace-match ""))
;; Replace @TeX{} with TeX
(goto-char (point-min))
(while (search-forward "@TeX{}" nil t) (replace-match "TeX" t t))
(detexinfo-remove-line-cmds-without-arg)
(detexinfo-remove-inline-cmds-without-arg)
(detexinfo-remove-inline-cmds-keep-arg)
(detexinfo-remove-line-cmds-deletable-arg)
(detexinfo-remove-line-cmds-maybe-delete-arg)
(detexinfo-remove-line-cmds-keep-arg)
;; Now replace %#*, *#%, and %&%# with {, }, and @@.
(goto-char (point-min))
(while (search-forward "%#*" nil t)
(replace-match "{"))
(goto-char (point-min))
(while (search-forward "*#%" nil t)
(replace-match "}"))
(goto-char (point-min))
(while (search-forward "%&%#" nil t)
(replace-match "@@"))
;; Scan for remaining two character @-commands
(goto-char (point-min))
(while (search-forward "@" nil t)
(cond ((looking-at "[*:]")
(delete-region (1- (point)) (1+ (point))))
((looking-at "[{}^@.'`]\"?!")
(delete-region (1- (point)) (point)))))
(goto-char (point-min))
(message "Done...removed Texinfo commands from buffer. You may save it.")))
(defun detexinfo-remove-whole-line (cmd)
"Delete Texinfo line command CMD at beginning of line and rest of line."
(goto-char (point-min))
(while
(re-search-forward
(concat "^@" cmd "[ \n]+") (point-max) t)
(goto-char (match-beginning 0))
(delete-region
(point) (save-excursion (end-of-line) (1+ (point))))))
(defun detexinfo-remove-inline-cmd (cmd)
"Delete Texinfo inline command CMD, eg. @point, @code."
(goto-char (point-min))
(while
(re-search-forward (concat "@" cmd "{") (point-max) t)
(save-excursion
(forward-char -1)
(forward-sexp 1)
(delete-char -1)) ; delete right brace
(delete-region (point) (match-beginning 0))))
;;;;;;;;;;;;;;;;
;;; 1. @setfilename and other line commands with args to delete
(defvar detexinfo-line-cmds-deletable-arg
'("enumerate" "ftable" "vtable" "itemize" "table"
"setfilename" "settitle" "setchapternewpage"
"footnotestyle" "paragraphindent"
"include" "need" "sp"
"clear" "ifclear" "ifset" "set"
"defcodeindex" "defindex" "syncodeindex" "synindex")
"List of Texinfo commands whose arguments should be deleted.")
(defun detexinfo-remove-line-cmds-deletable-arg ()
"Delete Texinfo line commands together with their args, eg @setfilename."
(message "Removing commands such as @enumerate...with their arguments...")
(mapcar 'detexinfo-remove-whole-line
detexinfo-line-cmds-deletable-arg))
;;; 2. @cindex and other cmds with args that may be deleted
;;; This list is here just to make it easier to revise the
;;; categories. In particular, you might want to keep the index entries.
(defvar detexinfo-line-cmds-maybe-delete-arg
'("cindex" "findex" "kindex" "pindex" "tindex" "vindex" "node"
"c" "comment" "end" "headings" "printindex" "vskip"
"evenfooting" "evenheading" "everyfooting" "everyheading"
"oddfooting" "oddheading")
"List of Texinfo commands whose arguments may possibly be deleted.")
(defun detexinfo-remove-line-cmds-maybe-delete-arg ()
"Delete Texinfo line commands together with their arguments, eg, @cindex."
(message "Removing commands such as @cindex...with their arguments...")
(mapcar 'detexinfo-remove-whole-line
detexinfo-line-cmds-maybe-delete-arg))
;;; 3. @chapter and other line cmds with args to keep.
(defvar detexinfo-line-cmds-keep-arg
'("top" "chapter" "section" "subsection" "subsubsection"
"unnumbered" "unnumberedsec" "unnumberedsubsec" "unnumberedsubsubsec"
"majorheading" "chapheading" "heading" "subheading" "subsubheading"
"appendix" "appendixsec" "appendixsubsec" "appendixsubsubsec"
"item" "itemx"
"title" "subtitle" "center" "author" "exdent"
"defcv" "deffn" "defivar" "defmac" "defmethod" "defop" "defopt"
"defspec" "deftp" "deftypefn" "deftypefun" "deftypvr"
"deftypevar" "defun" "defvar" "defvr")
"List of Texinfo line commands whose arguments should be kept.")
(defun detexinfo-remove-line-cmds-keep-arg ()
"Delete Texinfo line commands but keep their arguments, eg @chapter."
(message "Removing commands such as @chapter...but not their arguments...")
(mapcar 'detexinfo-remove-line-cmd-keep-arg
detexinfo-line-cmds-keep-arg))
(defun detexinfo-remove-line-cmd-keep-arg (cmd)
"Delete Texinfo line command CMD but keep its argument, eg @chapter."
(goto-char (point-min))
(while
(re-search-forward
(concat "^@" cmd "[ \n]+") (point-max) t)
(delete-region (match-beginning 0) (match-end 0))))
;;; 4. @bye and other line commands without args.
(defvar detexinfo-line-cmds-without-arg
'("bye" "contents" "display" "example" "finalout"
"flushleft" "flushright" "format" "group" "ifhtml" "ifinfo" "iftex"
"ignore" "lisp" "menu" "noindent" "page" "quotation"
"shortcontents" "smallbook" "smallexample" "smalllisp"
"summarycontents" "tex" "thischapter" "thischaptername"
"thisfile" "thispage" "thissection" "thistitle" "titlepage")
"List of Texinfo commands without arguments that should be deleted.")
(defun detexinfo-remove-line-cmds-without-arg ()
"Delete line Texinfo commands that lack args, eg. @example."
(message "Removing commands such as @example...that lack arguments...")
(mapcar 'detexinfo-remove-whole-line
detexinfo-line-cmds-without-arg))
;;; 5. @equiv and other inline cmds without args.
(defvar detexinfo-inline-cmds-without-arg
'("equiv" "error" "expansion" "point" "print" "result"
"asis" "br" "bullet" "dots" "minus" "today")
"List of Texinfo inline commands without arguments that should be deleted.")
(defun detexinfo-remove-inline-cmds-without-arg ()
"Delete Texinfo inline commands in that lack arguments."
(message "Removing within line commands such as @result...")
(mapcar 'detexinfo-remove-inline-cmd
detexinfo-inline-cmds-without-arg))
;;; 6. @code and other inline cmds with args to keep
(defvar detexinfo-inline-cmds-keep-arg
'("b" "cartouche" "cite" "code" "copyright" "ctrl" "dfn" "dmn"
"emph" "file" "footnote" "i" "inforef"
"kbd" "key" "pxref" "r" "ref" "samp" "sc" "titlefont"
"strong" "t" "var" "w" "xref")
"List of Texinfo inline commands with arguments that should be kept.")
(defun detexinfo-remove-inline-cmds-keep-arg ()
"Delete Texinfo inline commands but keep its arg, eg. @code."
(message
"Removing within line commands such as @code...but not their arguments...")
(mapcar 'detexinfo-remove-inline-cmd
detexinfo-inline-cmds-keep-arg))
;;;;;;;;;;;;;;;; end detexinfo.el ;;;;;;;;;;;;;;;;
-7
View File
@@ -1,7 +0,0 @@
#!/bin/sh
# $Id: elisp-comp,v 1.2 1996/09/26 23:41:08 karl Exp $
# Trivial script to compile the Elisp files.
setpath=${TMPDIR-/tmp}/elc.$$
echo "(setq load-path (cons nil load-path))" > $setpath
emacs -batch -l $setpath -f batch-byte-compile "$@"
rm -f $setpath
File diff suppressed because it is too large. Load diff
-429
View File
@@ -1,429 +0,0 @@
;;; informat.el --- info support functions package for Emacs
;; Copyright (C) 1986 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: help
;; This file is part of GNU Emacs.
;; GNU Emacs 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.
;; GNU Emacs 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 GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Code:
(require 'info)
;;;###autoload
(defun Info-tagify ()
"Create or update Info-file tag table in current buffer."
(interactive)
;; Save and restore point and restrictions.
;; save-restrictions would not work
;; because it records the old max relative to the end.
;; We record it relative to the beginning.
(message "Tagifying %s ..." (file-name-nondirectory (buffer-file-name)))
(let ((omin (point-min))
(omax (point-max))
(nomax (= (point-max) (1+ (buffer-size))))
(opoint (point)))
(unwind-protect
(progn
(widen)
(goto-char (point-min))
(if (search-forward "\^_\nIndirect:\n" nil t)
(message "Cannot tagify split info file")
(let ((regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]")
(case-fold-search t)
list)
(while (search-forward "\n\^_" nil t)
;; We want the 0-origin character position of the ^_.
;; That is the same as the Emacs (1-origin) position
;; of the newline before it.
(let ((beg (match-beginning 0)))
(forward-line 2)
(if (re-search-backward regexp beg t)
(setq list
(cons (list (buffer-substring-no-properties
(match-beginning 1)
(match-end 1))
beg)
list)))))
(goto-char (point-max))
(forward-line -8)
(let ((buffer-read-only nil))
(if (search-forward "\^_\nEnd tag table\n" nil t)
(let ((end (point)))
(search-backward "\nTag table:\n")
(beginning-of-line)
(delete-region (point) end)))
(goto-char (point-max))
(insert "\^_\f\nTag table:\n")
(move-marker Info-tag-table-marker (point))
(setq list (nreverse list))
(while list
(insert "Node: " (car (car list)) ?\177)
(princ (car (cdr (car list))) (current-buffer))
(insert ?\n)
(setq list (cdr list)))
(insert "\^_\nEnd tag table\n")))))
(goto-char opoint)
(narrow-to-region omin (if nomax (1+ (buffer-size))
(min omax (point-max))))))
(message "Tagifying %s ... done" (file-name-nondirectory (buffer-file-name))))
;;;###autoload
(defun Info-split ()
"Split an info file into an indirect file plus bounded-size subfiles.
Each subfile will be up to 50,000 characters plus one node.
To use this command, first visit a large Info file that has a tag
table. The buffer is modified into a (small) indirect info file which
should be saved in place of the original visited file.
The subfiles are written in the same directory the original file is
in, with names generated by appending `-' and a number to the original
file name. The indirect file still functions as an Info file, but it
contains just the tag table and a directory of subfiles."
(interactive)
(if (< (buffer-size) 70000)
(error "This is too small to be worth splitting"))
(goto-char (point-min))
(search-forward "\^_")
(forward-char -1)
(let ((start (point))
(chars-deleted 0)
subfiles
(subfile-number 1)
(case-fold-search t)
(filename (file-name-sans-versions buffer-file-name)))
(goto-char (point-max))
(forward-line -8)
(setq buffer-read-only nil)
(or (search-forward "\^_\nEnd tag table\n" nil t)
(error "Tag table required; use M-x Info-tagify"))
(search-backward "\nTag table:\n")
(if (looking-at "\nTag table:\n\^_")
(error "Tag table is just a skeleton; use M-x Info-tagify"))
(beginning-of-line)
(forward-char 1)
(save-restriction
(narrow-to-region (point-min) (point))
(goto-char (point-min))
(while (< (1+ (point)) (point-max))
(goto-char (min (+ (point) 50000) (point-max)))
(search-forward "\^_" nil 'move)
(setq subfiles
(cons (list (+ start chars-deleted)
(concat (file-name-nondirectory filename)
(format "-%d" subfile-number)))
subfiles))
;; Put a newline at end of split file, to make Unix happier.
(insert "\n")
(write-region (point-min) (point)
(concat filename (format "-%d" subfile-number)))
(delete-region (1- (point)) (point))
;; Back up over the final ^_.
(forward-char -1)
(setq chars-deleted (+ chars-deleted (- (point) start)))
(delete-region start (point))
(setq subfile-number (1+ subfile-number))))
(while subfiles
(goto-char start)
(insert (nth 1 (car subfiles))
(format ": %d" (1- (car (car subfiles))))
"\n")
(setq subfiles (cdr subfiles)))
(goto-char start)
(insert "\^_\nIndirect:\n")
(search-forward "\nTag Table:\n")
(insert "(Indirect)\n")))
;;;###autoload
(defun Info-validate ()
"Check current buffer for validity as an Info file.
Check that every node pointer points to an existing node."
(interactive)
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(if (search-forward "\nTag table:\n(Indirect)\n" nil t)
(error "Don't yet know how to validate indirect info files: \"%s\""
(buffer-name (current-buffer))))
(goto-char (point-min))
(let ((allnodes '(("*")))
(regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]")
(case-fold-search t)
(tags-losing nil)
(lossages ()))
(while (search-forward "\n\^_" nil t)
(forward-line 1)
(let ((beg (point)))
(forward-line 1)
(if (re-search-backward regexp beg t)
(let ((name (downcase
(buffer-substring-no-properties
(match-beginning 1)
(progn
(goto-char (match-end 1))
(skip-chars-backward " \t")
(point))))))
(if (assoc name allnodes)
(setq lossages
(cons (list name "Duplicate node-name" nil)
lossages))
(setq allnodes
(cons (list name
(progn
(end-of-line)
(and (re-search-backward
"prev[ious]*:" beg t)
(progn
(goto-char (match-end 0))
(downcase
(Info-following-node-name)))))
beg)
allnodes)))))))
(goto-char (point-min))
(while (search-forward "\n\^_" nil t)
(forward-line 1)
(let ((beg (point))
thisnode next)
(forward-line 1)
(if (re-search-backward regexp beg t)
(save-restriction
(search-forward "\n\^_" nil 'move)
(narrow-to-region beg (point))
(setq thisnode (downcase
(buffer-substring-no-properties
(match-beginning 1)
(progn
(goto-char (match-end 1))
(skip-chars-backward " \t")
(point)))))
(end-of-line)
(and (search-backward "next:" nil t)
(setq next (Info-validate-node-name "invalid Next"))
(assoc next allnodes)
(if (equal (car (cdr (assoc next allnodes)))
thisnode)
;; allow multiple `next' pointers to one node
(let ((tem lossages))
(while tem
(if (and (equal (car (cdr (car tem)))
"should have Previous")
(equal (car (car tem))
next))
(setq lossages (delq (car tem) lossages)))
(setq tem (cdr tem))))
(setq lossages
(cons (list next
"should have Previous"
thisnode)
lossages))))
(end-of-line)
(if (re-search-backward "prev[ious]*:" nil t)
(Info-validate-node-name "invalid Previous"))
(end-of-line)
(if (search-backward "up:" nil t)
(Info-validate-node-name "invalid Up"))
(if (re-search-forward "\n* Menu:" nil t)
(while (re-search-forward "\n\\* " nil t)
(Info-validate-node-name
(concat "invalid menu item "
(buffer-substring (point)
(save-excursion
(skip-chars-forward "^:")
(point))))
(Info-extract-menu-node-name))))
(goto-char (point-min))
(while (re-search-forward "\\*note[ \n]*[^:\t]*:" nil t)
(goto-char (+ (match-beginning 0) 5))
(skip-chars-forward " \n")
(Info-validate-node-name
(concat "invalid reference "
(buffer-substring (point)
(save-excursion
(skip-chars-forward "^:")
(point))))
(Info-extract-menu-node-name "Bad format cross-reference")))))))
(setq tags-losing (not (Info-validate-tags-table)))
(if (or lossages tags-losing)
(with-output-to-temp-buffer " *problems in info file*"
(while lossages
(princ "In node \"")
(princ (car (car lossages)))
(princ "\", ")
(let ((tem (nth 1 (car lossages))))
(cond ((string-match "\n" tem)
(princ (substring tem 0 (match-beginning 0)))
(princ "..."))
(t
(princ tem))))
(if (nth 2 (car lossages))
(progn
(princ ": ")
(let ((tem (nth 2 (car lossages))))
(cond ((string-match "\n" tem)
(princ (substring tem 0 (match-beginning 0)))
(princ "..."))
(t
(princ tem))))))
(terpri)
(setq lossages (cdr lossages)))
(if tags-losing (princ "\nTags table must be recomputed\n")))
;; Here if info file is valid.
;; If we already made a list of problems, clear it out.
(save-excursion
(if (get-buffer " *problems in info file*")
(progn
(set-buffer " *problems in info file*")
(kill-buffer (current-buffer)))))
(message "File appears valid"))))))
(defun Info-validate-node-name (kind &optional name)
(if name
nil
(goto-char (match-end 0))
(skip-chars-forward " \t")
(if (= (following-char) ?\()
nil
(setq name
(buffer-substring-no-properties
(point)
(progn
(skip-chars-forward "^,\t\n")
(skip-chars-backward " ")
(point))))))
(if (null name)
nil
(setq name (downcase name))
(or (and (> (length name) 0) (= (aref name 0) ?\())
(assoc name allnodes)
(setq lossages
(cons (list thisnode kind name) lossages))))
name)
(defun Info-validate-tags-table ()
(goto-char (point-min))
(if (not (search-forward "\^_\nEnd tag table\n" nil t))
t
(not (catch 'losing
(let* ((end (match-beginning 0))
(start (progn (search-backward "\nTag table:\n")
(1- (match-end 0))))
tem)
(setq tem allnodes)
(while tem
(goto-char start)
(or (equal (car (car tem)) "*")
(search-forward (concat "Node: "
(car (car tem))
"\177")
end t)
(throw 'losing 'x))
(setq tem (cdr tem)))
(goto-char (1+ start))
(while (looking-at ".*Node: \\(.*\\)\177\\([0-9]+\\)$")
(setq tem (downcase (buffer-substring-no-properties
(match-beginning 1)
(match-end 1))))
(setq tem (assoc tem allnodes))
(if (or (not tem)
(< 1000 (progn
(goto-char (match-beginning 2))
(setq tem (- (car (cdr (cdr tem)))
(read (current-buffer))))
(if (> tem 0) tem (- tem)))))
(throw 'losing 'y))
(forward-line 1)))
(if (looking-at "\^_\n")
(forward-line 1))
(or (looking-at "End tag table\n")
(throw 'losing 'z))
nil))))
;;;###autoload
(defun batch-info-validate ()
"Runs `Info-validate' on the files remaining on the command line.
Must be used only with -batch, and kills Emacs on completion.
Each file will be processed even if an error occurred previously.
For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
(if (not noninteractive)
(error "batch-info-validate may only be used -batch."))
(let ((version-control t)
(auto-save-default nil)
(find-file-run-dired nil)
(kept-old-versions 259259)
(kept-new-versions 259259))
(let ((error 0)
file
(files ()))
(while command-line-args-left
(setq file (expand-file-name (car command-line-args-left)))
(cond ((not (file-exists-p file))
(message ">> %s does not exist!" file)
(setq error 1
command-line-args-left (cdr command-line-args-left)))
((file-directory-p file)
(setq command-line-args-left (nconc (directory-files file)
(cdr command-line-args-left))))
(t
(setq files (cons file files)
command-line-args-left (cdr command-line-args-left)))))
(while files
(setq file (car files)
files (cdr files))
(let ((lose nil))
(condition-case err
(progn
(if buffer-file-name (kill-buffer (current-buffer)))
(find-file file)
(buffer-disable-undo (current-buffer))
(set-buffer-modified-p nil)
(fundamental-mode)
(let ((case-fold-search nil))
(goto-char (point-max))
(cond ((search-backward "\n\^_\^L\nTag table:\n" nil t)
(message "%s already tagified" file))
((< (point-max) 30000)
(message "%s too small to bother tagifying" file))
(t
(Info-tagify))))
(let ((loss-name " *problems in info file*"))
(message "Checking validity of info file %s..." file)
(if (get-buffer loss-name)
(kill-buffer loss-name))
(Info-validate)
(if (not (get-buffer loss-name))
nil ;(message "Checking validity of info file %s... OK" file)
(message "----------------------------------------------------------------------")
(message ">> PROBLEMS IN INFO FILE %s" file)
(save-excursion
(set-buffer loss-name)
(princ (buffer-substring-no-properties
(point-min) (point-max))))
(message "----------------------------------------------------------------------")
(setq error 1 lose t)))
(if (and (buffer-modified-p)
(not lose))
(progn (message "Saving modified %s" file)
(save-buffer))))
(error (message ">> Error: %s" (prin1-to-string err))))))
(kill-emacs error))))
;;; informat.el ends here
-247
View File
@@ -1,247 +0,0 @@
;;; makeinfo.el --- run makeinfo conveniently
;; Copyright (C) 1991, 1993 Free Software Foundation, Inc.
;; Author: Robert J. Chassell
;; Maintainer: FSF
;; This file is part of GNU Emacs.
;; GNU Emacs 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.
;; GNU Emacs 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 GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;; The Texinfo mode `makeinfo' related commands are:
;; makeinfo-region to run makeinfo on the current region.
;; makeinfo-buffer to run makeinfo on the current buffer, or
;; with optional prefix arg, on current region
;; kill-compilation to kill currently running makeinfo job
;; makeinfo-recenter-makeinfo-buffer to redisplay *compilation* buffer
;;; Keybindings (defined in `texinfo.el')
;; makeinfo bindings
; (define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region)
; (define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer)
; (define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation)
; (define-key texinfo-mode-map "\C-c\C-m\C-l"
; 'makeinfo-recenter-compilation-buffer)
;;; Code:
;;; Variables used by `makeinfo'
(require 'compile)
(defvar makeinfo-run-command "makeinfo"
"*Command used to run `makeinfo' subjob.
The name of the file is appended to this string, separated by a space.")
(defvar makeinfo-options "--fill-column=70"
"*String containing options for running `makeinfo'.
Do not include `--footnote-style' or `--paragraph-indent';
the proper way to specify those is with the Texinfo commands
`@footnotestyle` and `@paragraphindent'.")
(require 'texinfo)
(defvar makeinfo-compilation-process nil
"Process that runs `makeinfo'. Should start out nil.")
(defvar makeinfo-temp-file nil
"Temporary file name used for text being sent as input to `makeinfo'.")
(defvar makeinfo-output-file-name nil
"Info file name used for text output by `makeinfo'.")
;;; The `makeinfo' function definitions
(defun makeinfo-region (region-beginning region-end)
"Make Info file from region of current Texinfo file, and switch to it.
This command does not offer the `next-error' feature since it would
apply to a temporary file, not the original; use the `makeinfo-buffer'
command to gain use of `next-error'."
(interactive "r")
(let (filename-or-header
filename-or-header-beginning
filename-or-header-end)
;; Cannot use `let' for makeinfo-temp-file or
;; makeinfo-output-file-name since `makeinfo-compilation-sentinel'
;; needs them.
(setq makeinfo-temp-file
(concat
(make-temp-name
(substring (buffer-file-name)
0
(or (string-match "\\.tex" (buffer-file-name))
(length (buffer-file-name)))))
".texinfo"))
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(let ((search-end (save-excursion (forward-line 100) (point))))
;; Find and record the Info filename,
;; or else explain that a filename is needed.
(if (re-search-forward
"^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*"
search-end t)
(setq makeinfo-output-file-name
(buffer-substring (match-beginning 1) (match-end 1)))
(error
"The texinfo file needs a line saying: @setfilename <name>"))
;; Find header and specify its beginning and end.
(goto-char (point-min))
(if (and
(prog1
(search-forward tex-start-of-header search-end t)
(beginning-of-line)
;; Mark beginning of header.
(setq filename-or-header-beginning (point)))
(prog1
(search-forward tex-end-of-header nil t)
(beginning-of-line)
;; Mark end of header
(setq filename-or-header-end (point))))
;; Insert the header into the temporary file.
(write-region
(min filename-or-header-beginning region-beginning)
filename-or-header-end
makeinfo-temp-file nil nil)
;; Else no header; insert @filename line into temporary file.
(goto-char (point-min))
(search-forward "@setfilename" search-end t)
(beginning-of-line)
(setq filename-or-header-beginning (point))
(forward-line 1)
(setq filename-or-header-end (point))
(write-region
(min filename-or-header-beginning region-beginning)
filename-or-header-end
makeinfo-temp-file nil nil))
;; Insert the region into the file.
(write-region
(max region-beginning filename-or-header-end)
region-end
makeinfo-temp-file t nil)
;; Run the `makeinfo-compile' command in the *compilation* buffer
(save-excursion
(makeinfo-compile
(concat makeinfo-run-command
" "
makeinfo-options
" "
makeinfo-temp-file)
"Use `makeinfo-buffer' to gain use of the `next-error' command"
nil)))))))
;;; Actually run makeinfo. COMMAND is the command to run.
;;; ERROR-MESSAGE is what to say when next-error can't find another error.
;;; If PARSE-ERRORS is non-nil, do try to parse error messages.
(defun makeinfo-compile (command error-message parse-errors)
(let ((buffer
(compile-internal command error-message nil
(and (not parse-errors)
;; If we do want to parse errors, pass nil.
;; Otherwise, use this function, which won't
;; ever find any errors.
'(lambda (&rest ignore)
(setq compilation-error-list nil))))))
(set-process-sentinel (get-buffer-process buffer)
'makeinfo-compilation-sentinel)))
;; Delete makeinfo-temp-file after processing is finished,
;; and visit Info file.
;; This function is called when the compilation process changes state.
;; Based on `compilation-sentinel' in compile.el
(defun makeinfo-compilation-sentinel (proc msg)
(compilation-sentinel proc msg)
(if (and makeinfo-temp-file (file-exists-p makeinfo-temp-file))
(delete-file makeinfo-temp-file))
;; Always use the version on disk.
(if (get-file-buffer makeinfo-output-file-name)
(progn (set-buffer makeinfo-output-file-name)
(revert-buffer t t))
(find-file makeinfo-output-file-name))
(goto-char (point-min)))
(defun makeinfo-buffer ()
"Make Info file from current buffer.
Use the \\[next-error] command to move to the next error
\(if there are errors\)."
(interactive)
(cond ((null buffer-file-name)
(error "Buffer not visiting any file"))
((buffer-modified-p)
(if (y-or-n-p "Buffer modified; do you want to save it? ")
(save-buffer))))
;; Find and record the Info filename,
;; or else explain that a filename is needed.
(save-excursion
(goto-char (point-min))
(let ((search-end (save-excursion (forward-line 100) (point))))
(if (re-search-forward
"^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*"
search-end t)
(setq makeinfo-output-file-name
(buffer-substring (match-beginning 1) (match-end 1)))
(error
"The texinfo file needs a line saying: @setfilename <name>"))))
(save-excursion
(makeinfo-compile
(concat makeinfo-run-command " " makeinfo-options
" " buffer-file-name)
"No more errors."
t)))
(defun makeinfo-recenter-compilation-buffer (linenum)
"Redisplay `*compilation*' buffer so most recent output can be seen.
The last line of the buffer is displayed on
line LINE of the window, or centered if LINE is nil."
(interactive "P")
(let ((makeinfo-buffer (get-buffer "*compilation*"))
(old-buffer (current-buffer)))
(if (null makeinfo-buffer)
(message "No *compilation* buffer")
(pop-to-buffer makeinfo-buffer)
(bury-buffer makeinfo-buffer)
(goto-char (point-max))
(recenter (if linenum
(prefix-numeric-value linenum)
(/ (window-height) 2)))
(pop-to-buffer old-buffer)
)))
;;; Place `provide' at end of file.
(provide 'makeinfo)
;;; makeinfo.el ends here
-180
View File
@@ -1,180 +0,0 @@
;; -*- Mode: Emacs-Lisp -*-
;; This is the `new-useful-setqs' file
;; This overrides old defvars since they were revised.
(setq texinfmt-version "2.35 of 10 September 1996")
(setq texinfo-master-menu-header
"\n@detailmenu\n --- The Detailed Node Listing ---\n")
(setq texinfo-environment-regexp
(concat
"^@"
"\\("
"cartouche\\|"
"display\\|"
"end\\|"
"enumerate\\|"
"example\\|"
"f?table\\|"
"flushleft\\|"
"flushright\\|"
"format\\|"
"group\\|"
"ifhtml\\|"
"ifinfo\\|"
"iftex\\|"
"ignore\\|"
"itemize\\|"
"lisp\\|"
"macro\\|"
"multitable\\|"
"quotation\\|"
"smallexample\\|"
"smalllisp\\|"
"tex"
"\\)")
)
(setq texinfo-no-refill-regexp
(concat
"^@"
"\\("
"example\\|"
"smallexample\\|"
"lisp\\|"
"smalllisp\\|"
"display\\|"
"format\\|"
"flushleft\\|"
"flushright\\|"
"menu\\|"
"multitable\\|"
"titlepage\\|"
"iftex\\|"
"ifhtml\\|"
"tex\\|"
"html"
"\\)"))
(setq texinfo-accent-commands
(concat
"@OE\\|"
"@oe\\|"
"@AA\\|"
"@aa\\|"
"@AE\\|"
"@ae\\|"
"@ss\\|"
"@^\\|"
"@`\\|"
"@'\\|"
"@\"\\|"
"@,\\|"
"@=\\|"
"@~\\|"
"@questiondown{\\|"
"@exclamdown{\\|"
"@L{\\|"
"@l{\\|"
"@O{\\|"
"@o{\\|"
"@dotaccent{\\|"
"@ubaraccent{\\|"
"@d{\\|"
"@H{\\|"
"@ringaccent{\\|"
"@tieaccent{\\|"
"@u{\\|"
"@v{\\|"
"@dotless{"
))
(setq texinfo-part-of-para-regexp
(concat
"^@"
"\\("
"b{\\|"
"bullet{\\|"
"cite{\\|"
"code{\\|"
"emph{\\|"
"equiv{\\|"
"error{\\|"
"expansion{\\|"
"file{\\|"
"i{\\|"
"inforef{\\|"
"kbd{\\|"
"key{\\|"
"lisp{\\|"
"email{\\|"
"minus{\\|"
"point{\\|"
"print{\\|"
"pxref{\\|"
"r{\\|"
"ref{\\|"
"result{\\|"
"samp{\\|"
"sc{\\|"
"t{\\|"
"TeX{\\|"
"today{\\|"
"url{\\|"
"var{\\|"
"w{\\|"
"xref{\\|"
"@-\\|" ; @- is a descretionary hyphen (not an accent) (a noop).
texinfo-accent-commands
"\\)"
))
(setq texinfo-raisesections-alist
'((@chapter . @chapter) ; Cannot go higher
(@unnumbered . @unnumbered)
(@centerchap . @unnumbered)
(@majorheading . @majorheading)
(@chapheading . @chapheading)
(@appendix . @appendix)
(@section . @chapter)
(@unnumberedsec . @unnumbered)
(@heading . @chapheading)
(@appendixsec . @appendix)
(@subsection . @section)
(@unnumberedsubsec . @unnumberedsec)
(@subheading . @heading)
(@appendixsubsec . @appendixsec)
(@subsubsection . @subsection)
(@unnumberedsubsubsec . @unnumberedsubsec)
(@subsubheading . @subheading)
(@appendixsubsubsec . @appendixsubsec)))
(setq texinfo-lowersections-alist
'((@chapter . @section)
(@unnumbered . @unnumberedsec)
(@centerchap . @unnumberedsec)
(@majorheading . @heading)
(@chapheading . @heading)
(@appendix . @appendixsec)
(@section . @subsection)
(@unnumberedsec . @unnumberedsubsec)
(@heading . @subheading)
(@appendixsec . @appendixsubsec)
(@subsection . @subsubsection)
(@unnumberedsubsec . @unnumberedsubsubsec)
(@subheading . @subsubheading)
(@appendixsubsec . @appendixsubsubsec)
(@subsubsection . @subsubsection) ; Cannot go lower.
(@unnumberedsubsubsec . @unnumberedsubsubsec)
(@subsubheading . @subsubheading)
(@appendixsubsubsec . @appendixsubsubsec)))
File diff suppressed because it is too large. Load diff
-932
View File
@@ -1,932 +0,0 @@
;;; texinfo.el--major mode for editing Texinfo files.
;; Copyright (C) 1985, '88, '89, '90, '91,
;; '92, '93, '96 Free Software Foundation, Inc.
;; Author: Robert J. Chassell
;; Date: 6 Sep 1996
;; Maintainer: [email protected]
;; Keywords: maint, tex, docs
;; This file is part of GNU Emacs.
;; GNU Emacs 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.
;; GNU Emacs 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 GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Autoloads:
(autoload 'makeinfo-region
"makeinfo"
"Make Info file from region of current Texinfo file, and switch to it.
This command does not offer the `next-error' feature since it would
apply to a temporary file, not the original; use the `makeinfo-buffer'
command to gain use of `next-error'."
t nil)
(autoload 'makeinfo-buffer
"makeinfo"
"Make Info file from current buffer.
Use the \\[next-error] command to move to the next error
\(if there are errors\)."
t nil)
(autoload 'kill-compilation
"compile"
"Kill the process made by the \\[compile] command."
t nil)
(autoload 'makeinfo-recenter-compilation-buffer
"makeinfo"
"Redisplay `*compilation*' buffer so most recent output can be seen.
The last line of the buffer is displayed on
line LINE of the window, or centered if LINE is nil."
t nil)
(autoload 'texinfo-update-node
"texnfo-upd"
"Without any prefix argument, update the node in which point is located.
Non-nil argument (prefix, if interactive) means update the nodes in the
marked region.
The functions for creating or updating nodes and menus, and their
keybindings, are:
texinfo-update-node (&optional region-p) \\[texinfo-update-node]
texinfo-every-node-update () \\[texinfo-every-node-update]
texinfo-sequential-node-update (&optional region-p)
texinfo-make-menu (&optional region-p) \\[texinfo-make-menu]
texinfo-all-menus-update () \\[texinfo-all-menus-update]
texinfo-master-menu ()
texinfo-indent-menu-description (column &optional region-p)
The `texinfo-column-for-description' variable specifies the column to
which menu descriptions are indented. Its default value is 32."
t nil)
(autoload 'texinfo-every-node-update
"texnfo-upd"
"Update every node in a Texinfo file."
t nil)
(autoload 'texinfo-sequential-node-update
"texnfo-upd"
"Update one node (or many) in a Texinfo file with sequential pointers.
This function causes the `Next' or `Previous' pointer to point to the
immediately preceding or following node, even if it is at a higher or
lower hierarchical level in the document. Continually pressing `n' or
`p' takes you straight through the file.
Without any prefix argument, update the node in which point is located.
Non-nil argument (prefix, if interactive) means update the nodes in the
marked region.
This command makes it awkward to navigate among sections and
subsections; it should be used only for those documents that are meant
to be read like a novel rather than a reference, and for which the
Info `g*' command is inadequate."
t nil)
(autoload 'texinfo-make-menu
"texnfo-upd"
"Without any prefix argument, make or update a menu.
Make the menu for the section enclosing the node found following point.
Non-nil argument (prefix, if interactive) means make or update menus
for nodes within or part of the marked region.
Whenever a menu exists, and is being updated, the descriptions that
are associated with node names in the pre-existing menu are
incorporated into the new menu. Otherwise, the nodes' section titles
are inserted as descriptions."
t nil)
(autoload 'texinfo-all-menus-update
"texnfo-upd"
"Update every regular menu in a Texinfo file.
Remove pre-existing master menu, if there is one.
If called with a non-nil argument, this function first updates all the
nodes in the buffer before updating the menus."
t nil)
(autoload 'texinfo-master-menu
"texnfo-upd"
"Make a master menu for a whole Texinfo file.
Non-nil argument (prefix, if interactive) means first update all
existing nodes and menus. Remove pre-existing master menu, if there is one.
This function creates a master menu that follows the top node. The
master menu includes every entry from all the other menus. It
replaces any existing ordinary menu that follows the top node.
If called with a non-nil argument, this function first updates all the
menus in the buffer (incorporating descriptions from pre-existing
menus) before it constructs the master menu.
The function removes the detailed part of an already existing master
menu. This action depends on the pre-existing master menu using the
standard `texinfo-master-menu-header'.
The master menu has the following format, which is adapted from the
recommendation in the Texinfo Manual:
* The first part contains the major nodes in the Texinfo file: the
nodes for the chapters, chapter-like sections, and the major
appendices. This includes the indices, so long as they are in
chapter-like sections, such as unnumbered sections.
* The second and subsequent parts contain a listing of the other,
lower level menus, in order. This way, an inquirer can go
directly to a particular node if he or she is searching for
specific information.
Each of the menus in the detailed node listing is introduced by the
title of the section containing the menu."
t nil)
(autoload 'texinfo-indent-menu-description
"texnfo-upd"
"Indent every description in menu following point to COLUMN.
Non-nil argument (prefix, if interactive) means indent every
description in every menu in the region. Does not indent second and
subsequent lines of a multi-line description."
t nil)
(autoload 'texinfo-insert-node-lines
"texnfo-upd"
"Insert missing `@node' lines in region of Texinfo file.
Non-nil argument (prefix, if interactive) means also to insert the
section titles as node names; and also to insert the section titles as
node names in pre-existing @node lines that lack names."
t nil)
(autoload 'texinfo-start-menu-description
"texnfo-upd"
"In this menu entry, insert the node's section title as a description.
Position point at beginning of description ready for editing.
Do not insert a title if the line contains an existing description.
You will need to edit the inserted text since a useful description
complements the node name rather than repeats it as a title does."
t nil)
(autoload 'texinfo-multiple-files-update
"texnfo-upd"
"Update first node pointers in each file included in OUTER-FILE;
create or update main menu in the outer file that refers to such nodes.
This does not create or update menus or pointers within the included files.
With optional MAKE-MASTER-MENU argument (prefix arg, if interactive),
insert a master menu in OUTER-FILE. This does not create or update
menus or pointers within the included files.
With optional UPDATE-EVERYTHING argument (numeric prefix arg, if
interactive), update all the menus and all the `Next', `Previous', and
`Up' pointers of all the files included in OUTER-FILE before inserting
a master menu in OUTER-FILE.
The command also updates the `Top' level node pointers of OUTER-FILE.
Notes:
* this command does NOT save any files--you must save the
outer file and any modified, included files.
* except for the `Top' node, this command does NOT handle any
pre-existing nodes in the outer file; hence, indices must be
enclosed in an included file.
Requirements:
* each of the included files must contain exactly one highest
hierarchical level node,
* this highest node must be the first node in the included file,
* each highest hierarchical level node must be of the same type.
Thus, normally, each included file contains one, and only one,
chapter."
t nil)
;;; Code:
;;; Don't you dare insert any `require' calls at top level in this file--rms.
;;; Syntax table
(defvar texinfo-mode-syntax-table nil)
(if texinfo-mode-syntax-table
nil
(setq texinfo-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?\" " " texinfo-mode-syntax-table)
(modify-syntax-entry ?\\ " " texinfo-mode-syntax-table)
(modify-syntax-entry ?@ "\\" texinfo-mode-syntax-table)
(modify-syntax-entry ?\^q "\\" texinfo-mode-syntax-table)
(modify-syntax-entry ?\[ "(]" texinfo-mode-syntax-table)
(modify-syntax-entry ?\] ")[" texinfo-mode-syntax-table)
(modify-syntax-entry ?{ "(}" texinfo-mode-syntax-table)
(modify-syntax-entry ?} "){" texinfo-mode-syntax-table)
(modify-syntax-entry ?\' "w" texinfo-mode-syntax-table))
;; Written by Wolfgang Bangerth <[email protected]>
;; To override this example, set either `imenu-generic-expression'
;; or `imenu-create-index-function'.
(defvar texinfo-imenu-generic-expression
'((nil "^@node[ \t]+\\([^,\n]*\\)" 1)
("Chapters" "^@chapter[ \t]+\\(.*\\)$" 1))
"Imenu generic expression for TexInfo mode. See `imenu-generic-expression'.")
(defvar texinfo-font-lock-keywords
'(;; All but the first 2 had an OVERRIDE of t.
;; It didn't seem to be any better, and it's slower--simon.
("^\\(@c\\|@comment\\)\\>.*" . font-lock-comment-face) ;comments
;; Robert J. Chassell <[email protected]> says remove this line.
;("\\$\\([^$]*\\)\\$" 1 font-lock-string-face t)
("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face) ;commands
("^\\*\\(.*\\)[\t ]*$" 1 font-lock-function-name-face t) ;menu items
("@\\(emph\\|strong\\|b\\|i\\){\\([^}]+\\)" 2 font-lock-comment-face)
("@\\(file\\|kbd\\|key\\){\\([^}]+\\)" 2 font-lock-string-face)
("@\\(samp\\|code\\|var\\|math\\){\\([^}]+\\)"
2 font-lock-variable-name-face)
("@\\(cite\\|xref\\|pxref\\){\\([^}]+\\)" 2 font-lock-reference-face)
("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-function-name-face keep)
)
"Additional expressions to highlight in TeXinfo mode.")
(defvar texinfo-section-list
'(("top" 1)
("majorheading" 1)
("chapter" 2)
("unnumbered" 2)
("appendix" 2)
("chapheading" 2)
("section" 3)
("unnumberedsec" 3)
("appendixsec" 3)
("heading" 3)
("subsection" 4)
("unnumberedsubsec" 4)
("appendixsubsec" 4)
("subheading" 4)
("subsubsection" 5)
("unnumberedsubsubsec" 5)
("appendixsubsubsec" 5)
("subsubheading" 5))
"Alist of sectioning commands and their relative level.")
(defun texinfo-outline-level ()
;; Calculate level of current texinfo outline heading.
(save-excursion
(if (bobp)
0
(forward-char 1)
(let* ((word (buffer-substring-no-properties
(point) (progn (forward-word 1) (point))))
(entry (assoc word texinfo-section-list)))
(if entry
(nth 1 entry)
5)))))
;;; Keybindings
(defvar texinfo-mode-map nil)
;;; Keys common both to Texinfo mode and to TeX shell.
(defun texinfo-define-common-keys (keymap)
"Define the keys both in Texinfo mode and in the texinfo-tex-shell."
(define-key keymap "\C-c\C-t\C-k" 'tex-kill-job)
(define-key keymap "\C-c\C-t\C-x" 'texinfo-quit-job)
(define-key keymap "\C-c\C-t\C-l" 'tex-recenter-output-buffer)
(define-key keymap "\C-c\C-t\C-d" 'texinfo-delete-from-print-queue)
(define-key keymap "\C-c\C-t\C-q" 'tex-show-print-queue)
(define-key keymap "\C-c\C-t\C-p" 'texinfo-tex-print)
(define-key keymap "\C-c\C-t\C-i" 'texinfo-texindex)
(define-key keymap "\C-c\C-t\C-r" 'texinfo-tex-region)
(define-key keymap "\C-c\C-t\C-b" 'texinfo-tex-buffer))
;; Mode documentation displays commands in reverse order
;; from how they are listed in the texinfo-mode-map.
(if texinfo-mode-map
nil
(setq texinfo-mode-map (make-sparse-keymap))
;; bindings for `texnfo-tex.el'
(texinfo-define-common-keys texinfo-mode-map)
;; bindings for `makeinfo.el'
(define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation)
(define-key texinfo-mode-map "\C-c\C-m\C-l"
'makeinfo-recenter-compilation-buffer)
(define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region)
(define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer)
;; bindings for `texinfmt.el'
(define-key texinfo-mode-map "\C-c\C-e\C-r" 'texinfo-format-region)
(define-key texinfo-mode-map "\C-c\C-e\C-b" 'texinfo-format-buffer)
;; bindings for updating nodes and menus
(define-key texinfo-mode-map "\C-c\C-um" 'texinfo-master-menu)
(define-key texinfo-mode-map "\C-c\C-u\C-m" 'texinfo-make-menu)
(define-key texinfo-mode-map "\C-c\C-u\C-n" 'texinfo-update-node)
(define-key texinfo-mode-map "\C-c\C-u\C-e" 'texinfo-every-node-update)
(define-key texinfo-mode-map "\C-c\C-u\C-a" 'texinfo-all-menus-update)
(define-key texinfo-mode-map "\C-c\C-s" 'texinfo-show-structure)
(define-key texinfo-mode-map "\C-c}" 'up-list)
(define-key texinfo-mode-map "\C-c]" 'up-list)
(define-key texinfo-mode-map "\C-c{" 'texinfo-insert-braces)
;; bindings for inserting strings
(define-key texinfo-mode-map "\C-c\C-c\C-d" 'texinfo-start-menu-description)
(define-key texinfo-mode-map "\C-c\C-cv" 'texinfo-insert-@var)
(define-key texinfo-mode-map "\C-c\C-ct" 'texinfo-insert-@table)
(define-key texinfo-mode-map "\C-c\C-cs" 'texinfo-insert-@samp)
(define-key texinfo-mode-map "\C-c\C-co" 'texinfo-insert-@noindent)
(define-key texinfo-mode-map "\C-c\C-cn" 'texinfo-insert-@node)
(define-key texinfo-mode-map "\C-c\C-ck" 'texinfo-insert-@kbd)
(define-key texinfo-mode-map "\C-c\C-ci" 'texinfo-insert-@item)
(define-key texinfo-mode-map "\C-c\C-cf" 'texinfo-insert-@file)
(define-key texinfo-mode-map "\C-c\C-cx" 'texinfo-insert-@example)
(define-key texinfo-mode-map "\C-c\C-ce" 'texinfo-insert-@end)
(define-key texinfo-mode-map "\C-c\C-cd" 'texinfo-insert-@dfn)
(define-key texinfo-mode-map "\C-c\C-cc" 'texinfo-insert-@code))
;;; Texinfo mode
(defvar texinfo-chapter-level-regexp
"chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading"
"Regular expression matching Texinfo chapter-level headings.
This does not match `@node' and does not match the `@top' command.")
;;;###autoload
(defun texinfo-mode ()
"Major mode for editing Texinfo files.
It has these extra commands:
\\{texinfo-mode-map}
These are files that are used as input for TeX to make printed manuals
and also to be turned into Info files with \\[makeinfo-buffer] or
the `makeinfo' program. These files must be written in a very restricted and
modified version of TeX input format.
Editing commands are like text-mode except that the syntax table is
set up so expression commands skip Texinfo bracket groups. To see
what the Info version of a region of the Texinfo file will look like,
use \\[makeinfo-region], which runs `makeinfo' on the current region.
You can show the structure of a Texinfo file with \\[texinfo-show-structure].
This command shows the structure of a Texinfo file by listing the
lines with the @-sign commands for @chapter, @section, and the like.
These lines are displayed in another window called the *Occur* window.
In that window, you can position the cursor over one of the lines and
use \\[occur-mode-goto-occurrence], to jump to the corresponding spot
in the Texinfo file.
In addition, Texinfo mode provides commands that insert various
frequently used @-sign commands into the buffer. You can use these
commands to save keystrokes. And you can insert balanced braces with
\\[texinfo-insert-braces] and later use the command \\[up-list] to
move forward past the closing brace.
Also, Texinfo mode provides functions for automatically creating or
updating menus and node pointers. These functions
* insert the `Next', `Previous' and `Up' pointers of a node,
* insert or update the menu for a section, and
* create a master menu for a Texinfo source file.
Here are the functions:
texinfo-update-node \\[texinfo-update-node]
texinfo-every-node-update \\[texinfo-every-node-update]
texinfo-sequential-node-update
texinfo-make-menu \\[texinfo-make-menu]
texinfo-all-menus-update \\[texinfo-all-menus-update]
texinfo-master-menu
texinfo-indent-menu-description (column &optional region-p)
The `texinfo-column-for-description' variable specifies the column to
which menu descriptions are indented.
Passed an argument (a prefix argument, if interactive), the
`texinfo-update-node' and `texinfo-make-menu' functions do their jobs
in the region.
To use the updating commands, you must structure your Texinfo file
hierarchically, such that each `@node' line, with the exception of the
Top node, is accompanied by some kind of section line, such as an
`@chapter' or `@section' line.
If the file has a `top' node, it must be called `top' or `Top' and
be the first node in the file.
Entering Texinfo mode calls the value of text-mode-hook, and then the
value of texinfo-mode-hook."
(interactive)
(text-mode)
(setq mode-name "Texinfo")
(setq major-mode 'texinfo-mode)
(use-local-map texinfo-mode-map)
(set-syntax-table texinfo-mode-syntax-table)
(make-local-variable 'page-delimiter)
(setq page-delimiter
(concat
"^@node [ \t]*[Tt]op\\|^@\\("
texinfo-chapter-level-regexp
"\\)"))
(make-local-variable 'require-final-newline)
(setq require-final-newline t)
(make-local-variable 'indent-tabs-mode)
(setq indent-tabs-mode nil)
(make-local-variable 'paragraph-separate)
(setq paragraph-separate (concat "^\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-separate))
(make-local-variable 'paragraph-start)
(setq paragraph-start (concat "^\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-start))
(make-local-variable 'fill-column)
(setq fill-column 72)
(make-local-variable 'comment-start)
(setq comment-start "@c ")
(make-local-variable 'comment-start-skip)
(setq comment-start-skip "@c +")
(make-local-variable 'words-include-escapes)
(setq words-include-escapes t)
(make-local-variable 'imenu-generic-expression)
(setq imenu-generic-expression texinfo-imenu-generic-expression)
(make-local-variable 'font-lock-defaults)
(setq font-lock-defaults '(texinfo-font-lock-keywords t))
(make-local-variable 'outline-regexp)
(setq outline-regexp
(concat "@\\("
(mapconcat 'car texinfo-section-list "\\>\\|")
"\\>\\)"))
(make-local-variable 'outline-level)
(setq outline-level 'texinfo-outline-level)
(make-local-variable 'tex-start-of-header)
(setq tex-start-of-header "%**start")
(make-local-variable 'tex-end-of-header)
(setq tex-end-of-header "%**end")
(run-hooks 'text-mode-hook 'texinfo-mode-hook))
;;; Insert string commands
;; Keep as concatinated lists for ease of maintenance
(defconst texinfo-environment-regexp
(concat
"^@"
"\\("
"cartouche\\|"
"display\\|"
"end\\|"
"enumerate\\|"
"example\\|"
"f?table\\|"
"flushleft\\|"
"flushright\\|"
"format\\|"
"group\\|"
"ifhtml\\|"
"ifinfo\\|"
"iftex\\|"
"ignore\\|"
"itemize\\|"
"lisp\\|"
"macro\\|"
"multitable\\|"
"quotation\\|"
"smallexample\\|"
"smalllisp\\|"
"tex"
"\\)")
"Regexp for environment-like TexInfo list commands.
Subexpression 1 is what goes into the corresponding `@end' statement.")
;; The following texinfo-insert-@end command not only inserts a SPC
;; after the @end, but tries to find out what belongs there. It is
;; not very smart: it does not understand nested lists.
(defun texinfo-insert-@end ()
"Insert the matching `@end' for the last Texinfo command that needs one."
(interactive)
(let ((depth 1) string)
(save-excursion
(while (and (> depth 0)
(re-search-backward texinfo-environment-regexp nil t)
(if (looking-at "@end")
(setq depth (1+ depth))
(setq depth (1- depth)))))
(looking-at texinfo-environment-regexp)
(if (zerop depth)
(setq string
(buffer-substring (match-beginning 1)
(match-end 1)))))
(insert "@end ")
(if string (insert string "\n"))))
;; The following insert commands accept a prefix arg N, which is the
;; number of words (actually s-exprs) that should be surrounded by
;; braces. Thus you can first paste a variable name into a .texinfo
;; buffer, then say C-u 1 C-c C-c v at the beginning of the just
;; pasted variable name to put @var{...} *around* the variable name.
;; Operate on previous word or words with negative arg.
;; These commands use texinfo-insert-@-with-arg
(defun texinfo-insert-@-with-arg (string &optional arg)
(if arg
(progn
(setq arg (prefix-numeric-value arg))
(if (< arg 0)
(progn
(skip-chars-backward " \t\n\r\f")
(save-excursion
(forward-sexp arg)
(insert "@" string "{"))
(insert "}"))
(skip-chars-forward " \t\n\r\f")
(insert "@" string "{")
(forward-sexp arg)
(insert "}")))
(insert "@" string "{}")
(backward-char)))
(defun texinfo-insert-braces ()
"Make a pair of braces and be poised to type inside of them.
Use \\[up-list] to move forward out of the braces."
(interactive)
(insert "{}")
(backward-char))
(defun texinfo-insert-@code (&optional arg)
"Insert a `@code{...}' command in a Texinfo buffer.
A numeric argument says how many words the braces should surround.
The default is not to surround any existing words with the braces."
(interactive "P")
(texinfo-insert-@-with-arg "code" arg))
(defun texinfo-insert-@dfn (&optional arg)
"Insert a `@dfn{...}' command in a Texinfo buffer.
A numeric argument says how many words the braces should surround.
The default is not to surround any existing words with the braces."
(interactive "P")
(texinfo-insert-@-with-arg "dfn" arg))
(defun texinfo-insert-@example ()
"Insert the string `@example' in a Texinfo buffer."
(interactive)
(insert "@example\n"))
(defun texinfo-insert-@file (&optional arg)
"Insert a `@file{...}' command in a Texinfo buffer.
A numeric argument says how many words the braces should surround.
The default is not to surround any existing words with the braces."
(interactive "P")
(texinfo-insert-@-with-arg "file" arg))
(defun texinfo-insert-@item ()
"Insert the string `@item' in a Texinfo buffer."
(interactive)
(insert "@item")
(newline))
(defun texinfo-insert-@kbd (&optional arg)
"Insert a `@kbd{...}' command in a Texinfo buffer.
A numeric argument says how many words the braces should surround.
The default is not to surround any existing words with the braces."
(interactive "P")
(texinfo-insert-@-with-arg "kbd" arg))
(defun texinfo-insert-@node ()
"Insert the string `@node' in a Texinfo buffer.
This also inserts on the following line a comment indicating
the order of arguments to @node."
(interactive)
(insert "@node \n@comment node-name, next, previous, up")
(forward-line -1)
(forward-char 6))
(defun texinfo-insert-@noindent ()
"Insert the string `@noindent' in a Texinfo buffer."
(interactive)
(insert "@noindent\n"))
(defun texinfo-insert-@samp (&optional arg)
"Insert a `@samp{...}' command in a Texinfo buffer.
A numeric argument says how many words the braces should surround.
The default is not to surround any existing words with the braces."
(interactive "P")
(texinfo-insert-@-with-arg "samp" arg))
(defun texinfo-insert-@table (&optional arg)
"Insert the string `@table' in a Texinfo buffer."
(interactive "P")
(insert "@table "))
(defun texinfo-insert-@var (&optional arg)
"Insert a `@var{}' command in a Texinfo buffer.
A numeric argument says how many words the braces should surround.
The default is not to surround any existing words with the braces."
(interactive "P")
(texinfo-insert-@-with-arg "var" arg))
;;; Texinfo file structure
;; These are defined in texnfo-upd.el.
;; texinfo-section-types-regexp
;; texinfo-section-level-regexp
;; texinfo-subsection-level-regexp
;; texinfo-subsubsection-level-regexp
;; `texinfo-show-structure' requires texnfo-upd.el
(defun texinfo-show-structure (&optional nodes-too)
"Show the structure of a Texinfo file.
List the lines in the file that begin with the @-sign commands for
@chapter, @section, and the like.
With optional argument (prefix if interactive), list both the lines
with @-sign commands for @chapter, @section, and the like, and list
@node lines.
Lines with structuring commands beginning in them are displayed in
another buffer named `*Occur*'. In that buffer, you can move point to
one of those lines and then use \\<occur-mode-map>\\[occur-mode-goto-occurrence],
to jump to the corresponding spot in the Texinfo source file."
(interactive "P")
(require 'texnfo-upd)
(save-excursion
(goto-char (point-min))
(if nodes-too
(occur (concat "\\(^@node\\)\\|" texinfo-section-types-regexp))
(occur texinfo-section-types-regexp)))
(pop-to-buffer "*Occur*")
(goto-char (point-min))
(flush-lines "-----")
;; Now format the "*Occur*" buffer to show the structure.
;; Thanks to [email protected] (Per Cederqvist)
(goto-char (point-max))
(let ((margin 5))
(while (re-search-backward "^ *[0-9]*:" nil 0)
(re-search-forward ":")
(setq margin
(cond
((looking-at
(concat "@\\(" texinfo-chapter-level-regexp "\\)")) 5)
;; ((looking-at "@chapter ") 5)
;; ((looking-at "@unnumbered ") 5)
;; ((looking-at "@appendix ") 5)
;; ((looking-at "@majorheading ") 5)
;; ((looking-at "@chapheading ") 5)
((looking-at
(concat "@\\(" texinfo-section-level-regexp "\\)")) 9)
;; ((looking-at "@section ") 9)
;; ((looking-at "@unnumberedsec ") 9)
;; ((looking-at "@appendixsec ") 9)
;; ((looking-at "@heading ") 9)
((looking-at
(concat "@\\(" texinfo-subsection-level-regexp "\\)")) 13)
;; ((looking-at "@subsection ") 13)
;; ((looking-at "@unnumberedsubsec ") 13)
;; ((looking-at "@appendixsubsec ") 13)
;; ((looking-at "@subheading ") 13)
((looking-at
(concat "@\\(" texinfo-subsubsection-level-regexp "\\)")) 17)
;; ((looking-at "@subsubsection ") 17)
;; ((looking-at "@unnumberedsubsubsec ") 17)
;; ((looking-at "@appendixsubsubsec ") 17)
;; ((looking-at "@subsubheading ") 17)
(t margin)))
(indent-to-column margin)
(beginning-of-line))))
;;; The tex and print function definitions:
(defvar texinfo-texi2dvi-command "texi2dvi"
"*Command used by `texinfo-tex-buffer' to run TeX and texindex on a buffer.")
(defvar texinfo-tex-command "tex"
"*Command used by `texinfo-tex-region' to run TeX on a region.")
(defvar texinfo-texindex-command "texindex"
"*Command used by `texinfo-texindex' to sort unsorted index files.")
(defvar texinfo-delete-from-print-queue-command "lprm"
"*Command string used to delete a job from the line printer queue.
Command is used by \\[texinfo-delete-from-print-queue] based on
number provided by a previous \\[tex-show-print-queue]
command.")
(defvar texinfo-tex-trailer "@bye"
"String appended after a region sent to TeX by `texinfo-tex-region'.")
(defun texinfo-tex-region (beg end)
"Run TeX on the current region.
This works by writing a temporary file (`tex-zap-file') in the directory
that is the value of `tex-directory', then running TeX on that file.
The first line of the buffer is copied to the
temporary file; and if the buffer has a header, it is written to the
temporary file before the region itself. The buffer's header is all lines
between the strings defined by `tex-start-of-header' and `tex-end-of-header'
inclusive. The header must start in the first 100 lines.
The value of `texinfo-tex-trailer' is appended to the temporary file after the region."
(interactive "r")
(require 'tex-mode)
(if (get-buffer "*tex-shell*")
(tex-kill-job)
(tex-start-shell))
(or tex-zap-file (setq tex-zap-file (make-temp-name "#tz")))
(let ((tex-out-file (concat tex-zap-file ".tex"))
(temp-buffer (get-buffer-create " tex-Output-Buffer"))
(zap-directory
(file-name-as-directory (expand-file-name tex-directory))))
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(forward-line 100)
(let ((search-end (point))
(hbeg (point-min)) (hend (point-min))
(default-directory zap-directory))
(goto-char (point-min))
;; Copy first line, the `\input texinfo' line, to temp file
(write-region (point)
(save-excursion (end-of-line) (point))
tex-out-file nil nil)
;; Don't copy first line twice if region includes it.
(forward-line 1)
(if (< beg (point)) (setq beg (point)))
;; Initialize the temp file with either the header or nothing
(if (search-forward tex-start-of-header search-end t)
(progn
(beginning-of-line)
(setq hbeg (point)) ; Mark beginning of header.
(if (search-forward tex-end-of-header nil t)
(progn (beginning-of-line)
(setq hend (point))) ; Mark end of header.
(setq hbeg (point-min))))) ; Else no header.
;; Copy header to temp file.
(write-region (min hbeg beg) hend tex-out-file t nil)
;; Copy region to temp file.
(write-region (max beg hend) end tex-out-file t nil))
;; This is a kludge to insert the tex-trailer into the tex-out-file.
;; We have to create a special buffer in which to insert
;; the tex-trailer first because there is no function with
;; which to append a literal string directly to a file.
(let ((local-tex-trailer texinfo-tex-trailer))
(set-buffer temp-buffer)
(erase-buffer)
;; make sure trailer isn't hidden by a comment
(insert-string "\n")
(if local-tex-trailer (insert-string local-tex-trailer))
(tex-set-buffer-directory temp-buffer zap-directory)
(write-region (point-min) (point-max) tex-out-file t nil))
;;; The following is sufficient in Emacs 19.
;;; (write-region (concat "\n" texinfo-tex-trailer) nil
;;; tex-out-file t nil)
))
(tex-set-buffer-directory "*tex-shell*" zap-directory)
(tex-send-command tex-shell-cd-command zap-directory)
(tex-send-command texinfo-tex-command tex-out-file)
;; alternatively:
;; (send-string "tex-shell" (concat tex-shell-cd-command " "
;; zap-directory "\n"))
;; (send-string "tex-shell" (concat texinfo-tex-command " "
;; tex-out-file "\n"))
(tex-recenter-output-buffer 0)))
(defun texinfo-tex-buffer ()
"Run TeX on visited file, once or twice, to make a correct `.dvi' file."
(interactive)
;; Make sure TeX shell is running.
(require 'tex-mode)
(if (get-buffer "*tex-shell*")
(quit-process (get-process "tex-shell") t)
(tex-start-shell))
(cond ((null buffer-file-name)
(error "Buffer not visiting any file!"))
((buffer-modified-p)
(error "Buffer has been modified since last saved!")))
(setq tex-zap-file buffer-file-name)
(tex-send-command tex-shell-cd-command (file-name-directory tex-zap-file))
(tex-send-command texinfo-texi2dvi-command tex-zap-file)
;; alternatively:
;; (send-string "tex-shell"
;; (concat tex-shell-cd-command
;; " " (file-name-directory tex-zap-file) "\n"))
;; )
;;
;; (send-string "tex-shell"
;; (concat texinfo-texi2dvi-command " " tex-zap-file "\n"))
(tex-recenter-output-buffer 0))
(defun texinfo-texindex ()
"Run `texindex' on unsorted index files.
The index files are made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
This runs the shell command defined by `texinfo-texindex-command'."
(interactive)
(require 'tex-mode)
(tex-send-command texinfo-texindex-command (concat tex-zap-file ".??"))
;; alternatively
;; (send-string "tex-shell"
;; (concat texinfo-texindex-command
;; " " tex-zap-file ".??" "\n"))
(tex-recenter-output-buffer nil))
(defun texinfo-tex-print ()
"Print `.dvi' file made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
This runs the shell command defined by `tex-dvi-print-command'."
(interactive)
(require 'tex-mode)
(tex-send-command tex-dvi-print-command (concat tex-zap-file ".dvi"))
;; alternatively:
;; (send-string "tex-shell"
;; (concat tex-dvi-print-command
;; " " tex-zap-file ".dvi" "\n"))
(tex-recenter-output-buffer nil))
(defun texinfo-quit-job ()
"Quit currently running TeX job, by sending an `x' to it."
(interactive)
(if (not (get-process "tex-shell"))
(error "No TeX shell running"))
(tex-send-command "x"))
;; alternatively:
;; save-excursion
;; (set-buffer (get-buffer "*tex-shell*"))
;; (goto-char (point-max))
;; (insert "x")
;; (comint-send-input)
(defun texinfo-delete-from-print-queue (job-number)
"Delete job from the line printer spooling queue.
You are prompted for the job number (use a number shown by a previous
\\[tex-show-print-queue] command)."
(interactive "nPrinter job number for deletion: ")
(require 'tex-mode)
(if (tex-shell-running)
(tex-kill-job)
(tex-start-shell))
(tex-send-command texinfo-delete-from-print-queue-command job-number)
;; alternatively
;; (send-string "tex-shell"
;; (concat
;; texinfo-delete-from-print-queue-command
;; " "
;; job-number"\n"))
(tex-recenter-output-buffer nil))
(provide 'texinfo)
;;; texinfo.el ends here
-346
View File
@@ -1,346 +0,0 @@
;;;; texnfo-tex.el
;;; Texinfo mode TeX and hardcopy printing commands.
;; These commands are for running TeX on a region of a Texinfo file in
;; GNU Emacs, or on the whole buffer, and for printing the resulting
;; DVI file.
;;; Version 2.07 22 October 1991
;;; Robert J. Chassell
;;; Please send bug reports to: [email protected]
;;; Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
;;; This file is part of GNU Emacs.
;; GNU Emacs 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.
;; GNU Emacs 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 GNU Emacs; see the file COPYING. If not, write to
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;;; The Texinfo mode TeX related commands are:
; texinfo-tex-region to run tex on the current region.
; texinfo-tex-buffer to run tex on the current buffer.
; texinfo-texindex to sort unsorted index files.
; texinfo-tex-print to print the .dvi file made by tex.
; texinfo-kill-tex-job to kill the currently running tex job.
; texinfo-recenter-tex-output-buffer to redisplay tex output buffer.
; texinfo-show-tex-print-queue to show the print queue.
;;; Keys common both to Texinfo mode and to TeX shell.
;; Defined in `texinfo.el'
; (defun texinfo-define-common-keys (keymap)
; "Define the keys both in Texinfo mode and in the texinfo-tex-shell."
; (define-key keymap "\C-c\C-t\C-k" 'texinfo-kill-tex-job)
; (define-key keymap "\C-c\C-t\C-x" 'texinfo-quit-tex-job)
; (define-key keymap "\C-c\C-t\C-l" 'texinfo-recenter-tex-output-buffer)
; (define-key keymap "\C-c\C-t\C-d" 'texinfo-delete-from-tex-print-queue)
; (define-key keymap "\C-c\C-t\C-q" 'texinfo-show-tex-print-queue)
; (define-key keymap "\C-c\C-t\C-p" 'texinfo-tex-print)
; (define-key keymap "\C-c\C-t\C-i" 'texinfo-texindex)
; (define-key keymap "\C-c\C-t\C-r" 'texinfo-tex-region)
; (define-key keymap "\C-c\C-t\C-b" 'texinfo-tex-buffer))
;; See also texinfo-tex-start-shell.
;; The following is executed in the `texinfo.el' file
;(texinfo-define-common-keys texinfo-mode-map)
;;; Variable definitions:
(require 'shell)
(defvar texinfo-tex-shell-cd-command "cd"
"Command to give to shell running TeX to change directory.")
(defvar texinfo-tex-command "tex"
"*Command used by texinfo-tex-region to run tex on a region.")
(defvar texinfo-texindex-command "texindex"
"*Command used by texinfo-texindex to sort unsorted index files.")
(defvar texinfo-tex-dvi-print-command "lpr -d"
"*Command string used by \\[tex-print] to print a .dvi file.")
(defvar texinfo-show-tex-queue-command "lpq"
"*Command string used to show the Texinfo TeX print queue.
Command is used by \\[texinfo-show-tex-print-queue] and it
should show the queue that \\[texinfo-tex-print] puts jobs on.")
(defvar texinfo-delete-from-print-queue-command "lprm"
"*Command string used to delete a job from the line printer queue.
Command is used by \\[texinfo-delete-from-tex-print-queue] based on
number provided by a previous \\[texinfo-show-tex-print-queue]
command.")
(defvar texinfo-tex-trailer "@bye"
"String appended after a region sent to TeX by texinfo-tex-region.")
(defvar texinfo-tex-original-file ""
"Original name of file on which to run TeX.")
(defvar texinfo-tex-temp-file nil
"Temporary file name used for text being sent as input to TeX.")
(defvar texinfo-tex-root-temp-file nil
"Temporary file name used for text being sent as input to TeX.")
;;; Texinfo TeX main functions
(defun texinfo-tex-region (beginning end)
"Run tex on the current region.
A temporary file is written in the default directory, and tex is run
in that directory. The first line of the file is copied to the
temporary file; and if the buffer has a header, it is written to the
temporary file before the region itself. The buffer's header is all
lines between the strings defined by texinfo-start-of-header and
texinfo-end-of-header inclusive. The header must start in the first 100
lines. The value of texinfo-tex-trailer is appended to the temporary file
after the region."
(interactive "r")
(if (get-buffer "*texinfo-tex-shell*")
(quit-process (get-process "texinfo-tex-shell") t)
(texinfo-tex-start-shell))
(setq texinfo-tex-root-temp-file
(expand-file-name
(make-temp-name
(prin1-to-string (read (buffer-name))))))
(let ((texinfo-tex-temp-file (concat texinfo-tex-root-temp-file ".tex")))
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(forward-line 100)
(let ((search-end (point))
(header-beginning (point-min)) (header-end (point-min)))
(goto-char (point-min))
;; Copy first line, the `\input texinfo' line, to temp file
(write-region (point)
(save-excursion (forward-line 1) (point))
texinfo-tex-temp-file nil nil)
;; Don't copy first line twice if region includes it.
(forward-line 1)
(if (< beginning (point)) (setq beginning (point)))
;; Initialize the temp file with either the header or nothing
(if (search-forward texinfo-start-of-header search-end t)
(progn
(beginning-of-line)
(setq header-beginning (point)) ; Mark beginning of header.
(if (search-forward texinfo-end-of-header nil t)
(progn (beginning-of-line)
(setq header-end (point))) ; Mark end of header.
(setq header-beginning (point-min))))) ; Else no header.
;; Copy header to temp file.
(write-region
(min header-beginning beginning )
header-end
texinfo-tex-temp-file t nil)
;; Copy region to temp file.
(write-region
(max beginning header-end)
end
texinfo-tex-temp-file t nil)
;; This is a kludge to insert the texinfo-tex-trailer into the
;; texinfo-tex-temp-file. We have to create a special buffer
;; in which to insert the texinfo-tex-trailer first because there is
;; no function with which to append a literal string directly
;; to a file.
(let ((local-tex-trailer texinfo-tex-trailer)
(temp-buffer (get-buffer-create " texinfo-trailer-buffer")))
(set-buffer temp-buffer)
(erase-buffer)
;; make sure trailer isn't hidden by a comment
(insert-string "\n")
(if local-tex-trailer (insert local-tex-trailer))
(write-region (point-min) (point-max)
texinfo-tex-temp-file t nil)))
(set-process-sentinel (get-process "texinfo-tex-shell")
'texinfo-tex-shell-sentinel)
(send-string "texinfo-tex-shell"
(concat texinfo-tex-shell-cd-command " "
default-directory "\n"))
(send-string "texinfo-tex-shell"
(concat texinfo-tex-command " "
texinfo-tex-temp-file "\n "))
(texinfo-recenter-tex-output-buffer 0)))))
(defun texinfo-tex-buffer (buffer)
"Run TeX on current buffer.
After running TeX the first time, you may have to run \\[texinfo-texindex]
and then \\[texinfo-tex-buffer] again."
(interactive
(list
;; Sometimes you put point into *texinfo-tex-shell*; this prompts
;; you for the correct file regardless.
(if (and
(string= (buffer-name (current-buffer)) "*texinfo-tex-shell*")
texinfo-tex-root-temp-file)
(read-string (format "Run TeX on: ")
texinfo-tex-original-file)
(read-string (format "Run TeX on: ") (buffer-name (current-buffer))))))
;; Set to original buffer if in *texinfo-tex-shell*; otherwise,
;; record name of current buffer.
(if (string= (buffer-name (current-buffer)) "*texinfo-tex-shell*")
(set-buffer buffer)
(setq texinfo-tex-original-file
(buffer-name (current-buffer))))
(if (get-buffer "*texinfo-tex-shell*")
(quit-process (get-process "texinfo-tex-shell") t)
(texinfo-tex-start-shell))
(cond ((null buffer-file-name)
(error "Buffer not visiting any file!"))
((buffer-modified-p)
(error "Buffer has been modified since last saved!"))
(t (set-process-sentinel (get-process "texinfo-tex-shell")
'texinfo-tex-shell-sentinel)
(send-string "texinfo-tex-shell"
(concat texinfo-tex-shell-cd-command
" "
(file-name-directory
(buffer-file-name
(get-buffer buffer)))
"\n"))
(send-string "texinfo-tex-shell"
(concat texinfo-tex-command " " buffer "\n "))
;; so the texinfo-tex-print command works
(setq texinfo-tex-root-temp-file
(substring buffer 0
(or (string-match "\\.tex" buffer)
(length buffer))))
(texinfo-recenter-tex-output-buffer 0))))
(defun texinfo-texindex ()
"Run texindex on unsorted index files.
The index files are made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
Runs the shell command defined by texinfo-texindex-command."
(interactive)
(send-string "texinfo-tex-shell"
(concat texinfo-texindex-command
" " texinfo-tex-root-temp-file ".??" "\n"))
(texinfo-recenter-tex-output-buffer nil))
(defun texinfo-tex-print ()
"Print .dvi file made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
Runs the shell command defined by texinfo-tex-dvi-print-command."
(interactive)
(send-string "texinfo-tex-shell"
(concat texinfo-tex-dvi-print-command
" " texinfo-tex-root-temp-file ".dvi" "\n"))
(texinfo-recenter-tex-output-buffer nil))
;;; Texinfo TeX utility functions
(defun texinfo-tex-start-shell ()
(save-excursion
(require 'texinfo)
(set-buffer (make-shell "texinfo-tex-shell" "/bin/sh" nil "-v"))
(setq texinfo-tex-shell-map (copy-keymap shell-mode-map))
(texinfo-define-common-keys texinfo-tex-shell-map)
(use-local-map texinfo-tex-shell-map)
(run-hooks 'texinfo-tex-shell-hook)
(if (zerop (buffer-size))
(sleep-for 1))))
(defun texinfo-quit-tex-job ()
"Quit currently running TeX job, by sending an `x' to it."
(interactive)
(if (not (get-process "texinfo-tex-shell"))
(error "No TeX shell running."))
(save-excursion
(set-buffer (get-buffer "*texinfo-tex-shell*"))
(goto-char (point-max))
(insert "x")
(shell-send-input)))
(defun texinfo-kill-tex-job ()
"Kill the currently running TeX job."
(interactive)
(if (get-process "texinfo-tex-shell")
;; Use `texinfo-tex-shell-sentinel' to restart
;; texinfo-tex-shell after it is killed.
(kill-process (get-process "texinfo-tex-shell"))))
(defun texinfo-tex-shell-sentinel (process event)
"Restart texinfo-tex-shell after it is killed."
(if (equal event "killed\n")
(save-excursion
(set-buffer "*texinfo-tex-shell*")
(insert "\n")
(texinfo-tex-start-shell))))
(defun texinfo-recenter-tex-output-buffer (linenum)
"Redisplay buffer of TeX job output so that most recent output can be seen.
The last line of the buffer is displayed on
line LINE of the window, or centered if LINE is nil."
(interactive "P")
(let ((texinfo-tex-shell (get-buffer "*texinfo-tex-shell*"))
(old-buffer (current-buffer)))
(if (null texinfo-tex-shell)
(message "No TeX output buffer")
(pop-to-buffer texinfo-tex-shell)
(bury-buffer texinfo-tex-shell)
(goto-char (point-max))
(recenter (if linenum
(prefix-numeric-value linenum)
(/ (window-height) 2)))
(pop-to-buffer old-buffer)
)))
(defun texinfo-show-tex-print-queue ()
"Show the print queue that \\[texinfo-tex-print] put your job on.
Runs the shell command defined by texinfo-show-tex-queue-command."
(interactive)
(if (not (texinfo-tex-shell-running-p))
(texinfo-tex-start-shell))
(send-string "texinfo-tex-shell"
(concat texinfo-show-tex-queue-command "\n"))
(texinfo-recenter-tex-output-buffer nil))
(defun texinfo-delete-from-tex-print-queue (job-number)
"Delete job from the line printer spooling queue.
You are prompted for the job number (shown by a previous
\\[texinfo-show-tex-print-queue] command."
(interactive "nPrinter job number for deletion: ")
(if (texinfo-tex-shell-running-p)
(texinfo-kill-tex-job)
(texinfo-tex-start-shell))
(send-string "texinfo-tex-shell"
(concat
texinfo-delete-from-print-queue-command
" "
job-number"\n"))
(texinfo-recenter-tex-output-buffer nil))
(defun texinfo-tex-shell-running-p ()
(and (get-process "texinfo-tex-shell")
(eq (process-status (get-process "texinfo-tex-shell")) 'run)))
;;; Place `provide' at end of file.
(provide 'texnfo-tex)
;;;;;;;;;;;;;;;; end texnfo-tex.el ;;;;;;;;;;;;;;;;
File diff suppressed because it is too large. Load diff
-227
View File
@@ -1,227 +0,0 @@
# Makefile for texinfo/info. -*- Indented-Text -*-
# $Id: Makefile.in,v 1.9 1996/10/01 21:44:44 karl Exp $
#
# Copyright (C) 1993,96 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.
#### Start of system configuration section. ####
srcdir = @srcdir@
VPATH = $(srcdir):$(common)
common = $(srcdir)/../libtxi
util = $(srcdir)/../util
CC = @CC@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
LN = ln
RM = rm -f
MKDIR = mkdir
MAKEINFO= ../makeinfo/makeinfo
DEFS = @DEFS@
LDEFS = -DHANDLE_MAN_PAGES -DNAMED_FUNCTIONS=1 -DDEFAULT_INFOPATH='"$(DEFAULT_INFOPATH)"'
TERMLIBS = @TERMLIBS@
LIBS = $(TERMLIBS) -L../libtxi -ltxi @LIBS@
LOADLIBES = $(LIBS)
SHELL = /bin/sh
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(exec_prefix)/bin
# Prefix for each installed program, normally empty or `g'.
binprefix =
# Prefix for each installed man page, normally empty or `g'.
manprefix =
mandir = $(prefix)/man/man1
manext = 1
infodir = $(prefix)/info
DEFAULT_INFOPATH= $(infodir):.
#### End of system configuration section. ####
SRCS = dir.c display.c echo_area.c filesys.c \
info-utils.c info.c infodoc.c infomap.c \
m-x.c nodes.c search.c session.c \
signals.c terminal.c tilde.c window.c \
xmalloc.c indices.c makedoc.c nodemenu.c \
footnotes.c dribble.c variables.c gc.c man.c \
clib.c
HDRS = display.h doc.h echo_area.h filesys.h \
general.h getopt.h info-utils.h info.h \
infomap.h nodes.h search.h session.h \
signals.h termdep.h terminal.h tilde.h \
indices.h window.h footnotes.h dribble.h \
variables.h gc.h clib.h
OBJS = dir.o display.o doc.o echo_area.o filesys.o info-utils.o info.o \
infodoc.o infomap.o m-x.o nodes.o search.o session.o signals.o \
terminal.o tilde.o window.o indices.o xmalloc.o nodemenu.o \
footnotes.o dribble.o variables.o gc.o man.o clib.o
# The names of files which declare info commands.
CMDFILES = $(srcdir)/session.c $(srcdir)/echo_area.c $(srcdir)/infodoc.c \
$(srcdir)/m-x.c $(srcdir)/indices.c $(srcdir)/nodemenu.c \
$(srcdir)/footnotes.c $(srcdir)/variables.c
# The name of the program which builds documentation structure from CMDFILES.
MAKEDOC_OBJECTS = makedoc.o clib.o xmalloc.o
MAKEDOC_SOURCE = makedoc.c clib.c xmalloc.c
infofiles = info.info info-stnd.info
.c.o:
$(CC) -c $(CPPFLAGS) $(LDEFS) $(DEFS) -I. -I$(srcdir) -I$(common) $(CFLAGS) $<
all: info $(infofiles)
sub-all: all
install: all
$(INSTALL_PROGRAM) info $(bindir)/$(binprefix)info
-d=$(srcdir); test -f ./info.info && d=.; $(INSTALL_DATA) $$d/info.info $(infodir)/info.info
-d=$(srcdir); test -f ./info-stnd.info && d=.; $(INSTALL_DATA) $$d/info-stnd.info $(infodir)/info-stnd.info
-$(INSTALL_DATA) $(srcdir)/info.1 $(mandir)/$(manprefix)info.$(manext)
$(POST_INSTALL)
../util/install-info --info-dir=$(infodir) $(infodir)/info.info
../util/install-info --info-dir=$(infodir) $(infodir)/info-stnd.info
uninstall:
$(RM) $(bindir)/info
$(RM) $(infodir)/info.info
$(RM) $(infodir)/info-stnd.info
$(RM) $(mandir)/$(manprefix)info.$(manext)
info: $(OBJS) ../libtxi/libtxi.a
$(CC) $(LDFLAGS) -o info $(OBJS) $(LOADLIBES)
all-info: info.info info-stnd.info
info.info: info.texi
$(MAKEINFO) --no-split -I$(srcdir) info.texi
info-stnd.info: info-stnd.texi
$(MAKEINFO) --no-split -I$(srcdir) info-stnd.texi
dvi all-dvi: info.dvi info-stnd.dvi
info.dvi: info.texi
PATH="$(util):$${PATH}" TEXINPUTS="$(srcdir):$(common):$${TEXINPUTS}" texi2dvi $(srcdir)/info.texi
info-stnd.dvi: info-stnd.texi
PATH="$(util):$${PATH}" TEXINPUTS="$(srcdir):$(common):$${TEXINPUTS}" texi2dvi $(srcdir)/info-stnd.texi
makedoc: $(MAKEDOC_OBJECTS) ../libtxi/libtxi.a
$(CC) $(LDFLAGS) -o makedoc $(MAKEDOC_OBJECTS) $(LOADLIBES)
Makefile: $(srcdir)/Makefile.in ../config.status
cd ..; sh config.status
clean:
$(RM) info funs.h doc.c makedoc $(OBJS) $(MAKEDOC_OBJECTS)
distclean: clean texclean
$(RM) Makefile config.status config.cache *~ core core.* *.core
$(RM) *.BAK makedoc-TAGS TAGS \#* *.info*
mostlyclean: clean
realclean: distclean
$(RM) info.info info-stnd.info
TAGS: $(SRCS) makedoc-TAGS
etags $(SRCS)
cat makedoc-TAGS >>TAGS && $(RM) makedoc-TAGS
makedoc-TAGS: $(CMDFILES)
./makedoc -tags $(CMDFILES) >makedoc-TAGS
texclean:
$(RM) *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky *.cps
$(RM) *.tps *.fns *.kys *.pgs *.vrs
check: info
# The files `doc.c' and `funs.h' are created by ./makedoc run over the source
# files which contain DECLARE_INFO_COMMAND. `funs.h' is a header file
# listing the functions found. `doc.c' is a structure containing pointers
# to those functions along with completable names and documentation strings.
funs.h: makedoc $(CMDFILES)
-@if test -f funs.h; then mv -f funs.h old-funs.h; fi; :
-@if test -f doc.c; then mv -f doc.c old-doc.c; fi; :
./makedoc $(CMDFILES)
-@if cmp -s old-funs.h funs.h; then mv old-funs.h funs.h; \
else $(RM) old-funs.h; fi; :
-@if cmp -s old-doc.c doc.c; then mv old-doc.c doc.c; \
else $(RM) old-doc.c; fi; :
doc.c: funs.h
dribble.o: dribble.c dribble.h
display.o: display.c
echo_area.o: echo_area.c
filesys.o: filesys.c
info-utils.o: info-utils.c
info.o: info.c filesys.h
infodoc.o: infodoc.c
infomap.o: infomap.c
m-x.o: m-x.c
nodes.o: nodes.c
search.o: search.c
session.o: session.c
signals.o: signals.c
terminal.o: terminal.c
tilde.o: tilde.c
window.o: window.c
xmalloc.o: xmalloc.c
indices.o: indices.c
makedoc.o: makedoc.c
dir.o: dir.c
display.o: nodes.h info-utils.h search.h
display.o: terminal.h window.h display.h
echo_area.o: info.h
filesys.o: general.h tilde.h filesys.h
footnotes.o: footnotes.h
info-utils.o: info-utils.h nodes.h search.h
info.o: info.h $(common)/getopt.h
infodoc.o: info.h doc.h
infomap.o: infomap.h funs.h
gc.o: info.h
m-x.o: info.h
nodes.o: search.h filesys.h
nodes.o: nodes.h info-utils.h
search.o: general.h search.h nodes.h
session.o: info.h
signals.o: info.h signals.h
terminal.o: terminal.h termdep.h
tilde.o: tilde.h
variables.c: variables.h
window.o: nodes.h window.h display.h
window.o: info-utils.h search.h infomap.h
# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
# eof
-37
View File
@@ -1,37 +0,0 @@
The file NEWS contains information about what has changed since the last
release.
The file ../INSTALL contains instructions on how to install Info.
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, and the only reason it is in Beta test is because of its
short life span.
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).
I eagerly await responses to this newer version of Info; comments on its
portability, ease of use and user interface, code quality, and general
usefulness are all of interest to me, and I will appreciate any comments
that you would care to make.
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.
Please send your comments, bug reports, and suggestions to
[email protected]
--Brian Fox <[email protected]>
-112
View File
@@ -1,112 +0,0 @@
/* clib.c: Functions which we normally expect to find in the C library.
$Id: clib.c,v 1.2 1996/10/03 16:58:31 karl Exp $
This file is part of GNU Info, a program for reading online documentation
stored in Info format.
Copyright (C) 1995 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 <stdio.h>
#if defined (HAVE_UNISTD_H)
#include <unistd.h>
#endif
#if defined (HAVE_STDLIB_H)
#include <stdlib.h>
#endif
#if defined (HAVE_STRING_H)
#include <string.h>
#endif
#include <sys/errno.h>
extern void *xmalloc (), *xrealloc ();
#include "general.h"
#if !defined (errno)
extern int errno;
#endif
#if !defined (HAVE_STRERROR)
extern char *sys_errlist[];
extern int sys_nerr;
char *
strerror (num)
int num;
{
if (num >= sys_nerr)
return ("");
else
return (sys_errlist[num]);
}
#endif /* !HAVE_STRERROR */
#if !defined (HAVE_STRCASECMP)
/* This Unix doesn't have the strcasecmp () function. */
int
strcasecmp (string1, string2)
char *string1, *string2;
{
char ch1, ch2;
for (;;)
{
ch1 = *string1++;
ch2 = *string2++;
if (!(ch1 | ch2))
return (0);
ch1 = info_toupper (ch1);
ch2 = info_toupper (ch2);
if (ch1 != ch2)
return (ch1 - ch2);
}
}
/* Compare at most COUNT characters from string1 to string2. Case
doesn't matter. */
int
strncasecmp (string1, string2, count)
char *string1, *string2;
int count;
{
register char ch1, ch2;
while (count)
{
ch1 = *string1++;
ch2 = *string2++;
ch1 = info_toupper (ch1);
ch2 = info_toupper (ch2);
if (ch1 == ch2)
count--;
else
break;
}
return (count);
}
#endif /* !STRCASECMP */
-42
View File
@@ -1,42 +0,0 @@
/* clib.h: Declarations of functions which appear in clib.c (or libc.a). */
/* This file is part of GNU Info, a program for reading online documentation
stored in Info format.
Copyright (C) 1995 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 (_CLIB_H_)
#define _CLIB_H_
#if !defined (HAVE_STRDUP)
extern char *strdup ();
#endif
#if !defined (HAVE_STRERROR)
extern char *strerror ();
#endif
#if !defined (HAVE_STRCASECMP)
extern int strcasecmp ();
extern int strncasecmp ();
#endif
#endif /* !_CLIB_H_ */
-5
View File
@@ -1,5 +0,0 @@
mfoo
em
buffers
ââ
-643
View File
@@ -1,643 +0,0 @@
/* man.c: How to read and format man files. */
/* This file is part of GNU Info, a program for reading online documentation
stored in Info format.
Copyright (C) 1995 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 <sys/file.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 */
static char *read_from_fd ();
static void clean_manpage ();
static NODE *manpage_node_of_file_buffer ();
static char *get_manpage_contents ();
NODE *
make_manpage_node (pagename)
char *pagename;
{
return (info_get_node (MANPAGE_FILE_BUFFER_NAME, pagename));
}
NODE *
get_manpage_node (file_buffer, pagename)
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;
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);
oldsize += hlen;
memcpy (file_buffer->contents + oldsize, 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);
}
node = manpage_node_of_file_buffer (file_buffer, pagename);
}
return (node);
}
FILE_BUFFER *
create_manpage_file_buffer ()
{
FILE_BUFFER *file_buffer;
struct stat *finfo;
file_buffer = make_file_buffer ();
file_buffer->filename = strdup (MANPAGE_FILE_BUFFER_NAME);
file_buffer->fullpath = strdup (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 (filename, path)
char *filename, *path;
{
struct stat finfo;
char *temp_dirname;
int statable, dirname_index;
dirname_index = 0;
while (temp_dirname = extract_colon_unit (path, &dirname_index))
{
register int i;
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 (temp[(strlen (temp)) - 1] != '/')
strcat (temp, "/");
strcat (temp, filename);
free (temp_dirname);
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);
else
free (temp);
}
return ((char *)NULL);
}
/* Return the full pathname of the system man page formatter. */
static char *
find_man_formatter ()
{
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 (pagename)
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';
}
}
static void
reap_children (sig)
int sig;
{
unsigned int status;
wait (&status);
}
static char *
get_manpage_contents (pagename)
char *pagename;
{
static char *formatter_args[4] = { (char *)NULL };
int pipes[2];
pid_t child;
char *formatted_page = (char *)NULL;
char *section = (char *)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]. */
pipe (pipes);
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]);
}
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]);
close (fileno (stderr));
close (fileno (stdin)); /* Don't print errors. */
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]);
exit (0);
}
/* If we have the page, then clean it up. */
if (formatted_page)
clean_manpage (formatted_page);
return (formatted_page);
}
static void
clean_manpage (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--;
}
if (manpage[i] == '\b' || manpage[i] == '\f')
j -= 2;
}
newpage[j++] = '\0';
strcpy (manpage, newpage);
free (newpage);
}
static NODE *
manpage_node_of_file_buffer (file_buffer, pagename)
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 = tag->nodename;
node->contents = file_buffer->contents + tag->nodestart;
node->nodelen = tag->nodelen;
node->flags = 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 (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 *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 *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 = strdup (node->filename);
entry->nodename = strdup (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, start, dir)
NODE *node;
long start;
int dir;
{
register int i, count;
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, 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);
}
-36
View File
@@ -1,36 +0,0 @@
/* man.h: Defines and external function declarations for man.c */
/* 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.
Author: Brian J. Fox (bfox@ai.mit.edu) Sat May 6 16:19:13 1995. */
#if !defined (_MAN_H_)
#define _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 start, int dir */);
extern REFERENCE **xrefs_of_manpage (/* NODE *node */);
extern REFERENCE **manpage_xrefs_in_binding (/* NODE *node, SEARCH_BINDING *binding */);
#endif /* !_MAN_H_ */
-76
View File
@@ -1,76 +0,0 @@
/* termdep.h -- System things that terminal.c depends on.
$Id: termdep.h,v 1.3 1996/10/02 22:23:52 karl Exp $
This file is part of GNU Info, a program for reading online documentation
stored in Info format.
Copyright (C) 1993, 96 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 (_TERMDEP_H_)
# define _TERMDEP_H_
#if defined (HAVE_SYS_FCNTL_H)
# include <sys/fcntl.h>
#else
# include <fcntl.h>
#endif /* !HAVE_SYS_FCNTL_H */
#if defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif /* HAVE_SYS_FILE_H */
#if defined (HAVE_STRINGS_H)
# include <strings.h>
#else
# if defined (HAVE_STRING_H)
# include <string.h>
# endif
#endif
#if defined (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 */
#if defined (HAVE_SYS_TTOLD_H)
# include <sys/ttold.h>
#endif /* HAVE_SYS_TTOLD_H */
#if !defined (HAVE_STRCHR)
# undef strchr
# undef strrchr
# define strchr index
# define strrchr rindex
#endif /* !HAVE_STRCHR */
#endif /* _TERMDEP_H_ */
File diff suppressed because it is too large. Load diff
-250
View File
@@ -1,250 +0,0 @@
#! /bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0
-82
View File
@@ -1,82 +0,0 @@
# Makefile for GNU texinfo/libtxi. -*- Indented-Text -*-
# $Id: Makefile.in,v 1.3 1996/10/03 18:32:28 karl Exp $
# Copyright (C) 1993, 96 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.
SHELL = /bin/sh
srcdir = @srcdir@
VPATH = $(srcdir)
CC = @CC@
AR = ar
RANLIB = @RANLIB@
DEFS = @DEFS@
LIBS = @LIBS@
LOADLIBES = $(LIBS)
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
# This is normally inherited from parent make, but if someone wants to
# build libtxi.a alone, this variable will still be properly defined.
ALLOCA = @ALLOCA@
# Standard functions that may be missing.
LIBOBJS = @LIBOBJS@
SRCS = getopt.c getopt1.c bzero.c getopt.h
OBJS = getopt.o getopt1.o bzero.o $(ALLOCA) $(LIBOBJS)
PROGS = libtxi.a
all: $(PROGS)
sub-all: all
.c.o:
$(CC) -c $(CPPFLAGS) -I. -I$(srcdir) $(DEFS) $(CFLAGS) $<
libtxi.a: $(OBJS)
rm -f $@
$(AR) cq $@ $(OBJS)
$(RANLIB) $@
getopt.o: getopt.c getopt.h
getopt1.o: getopt1.c getopt.h
alloca.o: alloca.c
install:
uninstall:
TAGS: $(SRCS)
etags $(SRCS)
clean:
rm -f *.o a.out core core.* $(PROGS)
mostlyclean: clean
distclean: clean
rm -f Makefile config.status TAGS ID
realclean: distclean
Makefile: Makefile.in ../config.status
cd .. && sh config.status
# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
-504
View File
@@ -1,504 +0,0 @@
/* alloca.c -- allocate automatically reclaimed memory
(Mostly) portable public-domain implementation -- D A Gwyn
This implementation of the PWB library alloca function,
which is used to allocate space off the run-time stack so
that it is automatically reclaimed upon procedure exit,
was inspired by discussions with J. Q. Johnson of Cornell.
J.Otto Tennant <jot@cray.com> contributed the Cray support.
There are some preprocessor constants that can
be defined when compiling for your specific system, for
improved efficiency; however, the defaults should be okay.
The general concept of this implementation is to keep
track of all alloca-allocated blocks, and reclaim any
that are found to be deeper in the stack than the current
invocation. This heuristic does not reclaim storage as
soon as it becomes invalid, but it will do so eventually.
As a special case, alloca(0) reclaims storage without
allocating any. It is a good idea to use alloca(0) in
your main control loop, etc. to force garbage collection. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef emacs
#include "blockinput.h"
#endif
/* If compiling with GCC 2, this file's not needed. */
#if !defined (__GNUC__) || __GNUC__ < 2
/* If someone has defined alloca as a macro,
there must be some other way alloca is supposed to work. */
#ifndef alloca
#ifdef emacs
#ifdef static
/* actually, only want this if static is defined as ""
-- this is for usg, in which emacs must undefine static
in order to make unexec workable
*/
#ifndef STACK_DIRECTION
you
lose
-- must know STACK_DIRECTION at compile-time
#endif /* STACK_DIRECTION undefined */
#endif /* static */
#endif /* emacs */
/* If your stack is a linked list of frames, you have to
provide an "address metric" ADDRESS_FUNCTION macro. */
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
long i00afunc ();
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
#else
#define ADDRESS_FUNCTION(arg) &(arg)
#endif
#if __STDC__
typedef void *pointer;
#else
typedef char *pointer;
#endif
#ifndef NULL
#define NULL 0
#endif
/* Different portions of Emacs need to call different versions of
malloc. The Emacs executable needs alloca to call xmalloc, because
ordinary malloc isn't protected from input signals. On the other
hand, the utilities in lib-src need alloca to call malloc; some of
them are very simple, and don't have an xmalloc routine.
Non-Emacs programs expect this to call use xmalloc.
Callers below should use malloc. */
#ifndef emacs
#define malloc xmalloc
#endif
extern pointer malloc ();
/* Define STACK_DIRECTION 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 */
#ifndef STACK_DIRECTION
#define STACK_DIRECTION 0 /* Direction unknown. */
#endif
#if STACK_DIRECTION != 0
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
#else /* STACK_DIRECTION == 0; need run-time code. */
static int stack_dir; /* 1 or -1 once known. */
#define STACK_DIR stack_dir
static void
find_stack_direction ()
{
static char *addr = NULL; /* Address of first `dummy', once known. */
auto char dummy; /* To get stack address. */
if (addr == NULL)
{ /* Initial entry. */
addr = ADDRESS_FUNCTION (dummy);
find_stack_direction (); /* Recurse once. */
}
else
{
/* Second entry. */
if (ADDRESS_FUNCTION (dummy) > addr)
stack_dir = 1; /* Stack grew upward. */
else
stack_dir = -1; /* Stack grew downward. */
}
}
#endif /* STACK_DIRECTION == 0 */
/* An "alloca header" is used to:
(a) chain together all alloca'ed blocks;
(b) keep track of stack depth.
It is very important that sizeof(header) agree with malloc
alignment chunk size. The following default should work okay. */
#ifndef ALIGN_SIZE
#define ALIGN_SIZE sizeof(double)
#endif
typedef union hdr
{
char align[ALIGN_SIZE]; /* To force sizeof(header). */
struct
{
union hdr *next; /* For chaining headers. */
char *deep; /* For stack depth measure. */
} h;
} header;
static header *last_alloca_header = NULL; /* -> last alloca header. */
/* Return a pointer to at least SIZE bytes of storage,
which will be automatically reclaimed upon exit from
the procedure that called alloca. Originally, this space
was supposed to be taken from the current stack frame of the
caller, but that method cannot be made to work for some
implementations of C, for example under Gould's UTX/32. */
pointer
alloca (size)
unsigned size;
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
#if STACK_DIRECTION == 0
if (STACK_DIR == 0) /* Unknown growth direction. */
find_stack_direction ();
#endif
/* Reclaim garbage, defined as all alloca'd storage that
was allocated from deeper in the stack than currently. */
{
register header *hp; /* Traverses linked list. */
#ifdef emacs
BLOCK_INPUT;
#endif
for (hp = last_alloca_header; hp != NULL;)
if ((STACK_DIR > 0 && hp->h.deep > depth)
|| (STACK_DIR < 0 && hp->h.deep < depth))
{
register header *np = hp->h.next;
free ((pointer) hp); /* Collect garbage. */
hp = np; /* -> next header. */
}
else
break; /* Rest are not deeper. */
last_alloca_header = hp; /* -> last valid storage. */
#ifdef emacs
UNBLOCK_INPUT;
#endif
}
if (size == 0)
return NULL; /* No allocation required. */
/* Allocate combined header + user data storage. */
{
register pointer new = malloc (sizeof (header) + size);
/* Address of header. */
if (new == 0)
abort();
((header *) new)->h.next = last_alloca_header;
((header *) new)->h.deep = depth;
last_alloca_header = (header *) new;
/* User storage begins just after header. */
return (pointer) ((char *) new + sizeof (header));
}
}
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
#ifdef DEBUG_I00AFUNC
#include <stdio.h>
#endif
#ifndef CRAY_STACK
#define CRAY_STACK
#ifndef CRAY2
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
struct stack_control_header
{
long shgrow:32; /* Number of times stack has grown. */
long shaseg:32; /* Size of increments to stack. */
long shhwm:32; /* High water mark of stack. */
long shsize:32; /* Current size of stack (all segments). */
};
/* The stack segment linkage control information occurs at
the high-address end of a stack segment. (The stack
grows from low addresses to high addresses.) The initial
part of the stack segment linkage control information is
0200 (octal) words. This provides for register storage
for the routine which overflows the stack. */
struct stack_segment_linkage
{
long ss[0200]; /* 0200 overflow words. */
long sssize:32; /* Number of words in this segment. */
long ssbase:32; /* Offset to stack base. */
long:32;
long sspseg:32; /* Offset to linkage control of previous
segment of stack. */
long:32;
long sstcpt:32; /* Pointer to task common address block. */
long sscsnm; /* Private control structure number for
microtasking. */
long ssusr1; /* Reserved for user. */
long ssusr2; /* Reserved for user. */
long sstpid; /* Process ID for pid based multi-tasking. */
long ssgvup; /* Pointer to multitasking thread giveup. */
long sscray[7]; /* Reserved for Cray Research. */
long ssa0;
long ssa1;
long ssa2;
long ssa3;
long ssa4;
long ssa5;
long ssa6;
long ssa7;
long sss0;
long sss1;
long sss2;
long sss3;
long sss4;
long sss5;
long sss6;
long sss7;
};
#else /* CRAY2 */
/* The following structure defines the vector of words
returned by the STKSTAT library routine. */
struct stk_stat
{
long now; /* Current total stack size. */
long maxc; /* Amount of contiguous space which would
be required to satisfy the maximum
stack demand to date. */
long high_water; /* Stack high-water mark. */
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
long hits; /* Number of internal buffer hits. */
long extends; /* Number of block extensions. */
long stko_mallocs; /* Block allocations by $STKOFEN. */
long underflows; /* Number of stack underflow calls ($STKRETN). */
long stko_free; /* Number of deallocations by $STKRETN. */
long stkm_free; /* Number of deallocations by $STKMRET. */
long segments; /* Current number of stack segments. */
long maxs; /* Maximum number of stack segments so far. */
long pad_size; /* Stack pad size. */
long current_address; /* Current stack segment address. */
long current_size; /* Current stack segment size. This
number is actually corrupted by STKSTAT to
include the fifteen word trailer area. */
long initial_address; /* Address of initial segment. */
long initial_size; /* Size of initial segment. */
};
/* The following structure describes the data structure which trails
any stack segment. I think that the description in 'asdef' is
out of date. I only describe the parts that I am sure about. */
struct stk_trailer
{
long this_address; /* Address of this block. */
long this_size; /* Size of this block (does not include
this trailer). */
long unknown2;
long unknown3;
long link; /* Address of trailer block of previous
segment. */
long unknown5;
long unknown6;
long unknown7;
long unknown8;
long unknown9;
long unknown10;
long unknown11;
long unknown12;
long unknown13;
long unknown14;
};
#endif /* CRAY2 */
#endif /* not CRAY_STACK */
#ifdef CRAY2
/* Determine a "stack measure" for an arbitrary ADDRESS.
I doubt that "lint" will like this much. */
static long
i00afunc (long *address)
{
struct stk_stat status;
struct stk_trailer *trailer;
long *block, size;
long result = 0;
/* We want to iterate through all of the segments. The first
step is to get the stack status structure. We could do this
more quickly and more directly, perhaps, by referencing the
$LM00 common block, but I know that this works. */
STKSTAT (&status);
/* Set up the iteration. */
trailer = (struct stk_trailer *) (status.current_address
+ status.current_size
- 15);
/* There must be at least one stack segment. Therefore it is
a fatal error if "trailer" is null. */
if (trailer == 0)
abort ();
/* Discard segments that do not contain our argument address. */
while (trailer != 0)
{
block = (long *) trailer->this_address;
size = trailer->this_size;
if (block == 0 || size == 0)
abort ();
trailer = (struct stk_trailer *) trailer->link;
if ((block <= address) && (address < (block + size)))
break;
}
/* Set the result to the offset in this segment and add the sizes
of all predecessor segments. */
result = address - block;
if (trailer == 0)
{
return result;
}
do
{
if (trailer->this_size <= 0)
abort ();
result += trailer->this_size;
trailer = (struct stk_trailer *) trailer->link;
}
while (trailer != 0);
/* We are done. Note that if you present a bogus address (one
not in any segment), you will get a different number back, formed
from subtracting the address of the first block. This is probably
not what you want. */
return (result);
}
#else /* not CRAY2 */
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
Determine the number of the cell within the stack,
given the address of the cell. The purpose of this
routine is to linearize, in some sense, stack addresses
for alloca. */
static long
i00afunc (long address)
{
long stkl = 0;
long size, pseg, this_segment, stack;
long result = 0;
struct stack_segment_linkage *ssptr;
/* Register B67 contains the address of the end of the
current stack segment. If you (as a subprogram) store
your registers on the stack and find that you are past
the contents of B67, you have overflowed the segment.
B67 also points to the stack segment linkage control
area, which is what we are really interested in. */
stkl = CRAY_STACKSEG_END ();
ssptr = (struct stack_segment_linkage *) stkl;
/* If one subtracts 'size' from the end of the segment,
one has the address of the first word of the segment.
If this is not the first segment, 'pseg' will be
nonzero. */
pseg = ssptr->sspseg;
size = ssptr->sssize;
this_segment = stkl - size;
/* It is possible that calling this routine itself caused
a stack overflow. Discard stack segments which do not
contain the target address. */
while (!(this_segment <= address && address <= stkl))
{
#ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
#endif
if (pseg == 0)
break;
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
this_segment = stkl - size;
}
result = address - this_segment;
/* If you subtract pseg from the current end of the stack,
you get the address of the previous stack segment's end.
This seems a little convoluted to me, but I'll bet you save
a cycle somewhere. */
while (pseg != 0)
{
#ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o\n", pseg, size);
#endif
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
result += size;
}
return (result);
}
#endif /* not CRAY2 */
#endif /* CRAY */
#endif /* no alloca */
#endif /* not GCC version 2 */
-44
View File
@@ -1,44 +0,0 @@
/*
* 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, you can either send email to this
* program's author (see below) or write to: The Free Software Foundation,
* Inc.; 59 Temple Place - Suite 330. Boston, MA 02111-1307, USA.
*/
#if !defined (HAVE_MEMSET) && !defined (HAVE_BZERO)
void
bzero (b, length)
register char *b;
register int length;
{
#ifdef VMS /* but this is definitely VMS-specific */
short zero = 0;
long max_str = 65535;
while (length > max_str)
{
(void) LIB$MOVC5 (&zero, &zero, &zero, &max_str, b);
length -= max_str;
b += max_str;
}
(void) LIB$MOVC5 (&zero, &zero, &zero, &length, b);
#else
while (length-- > 0)
*b++ = 0;
#endif /* not VMS */
}
#endif /* not HAVE_MEMSET && not HAVE_BZERO */
-20
View File
@@ -1,20 +0,0 @@
/* Copy LEN bytes starting at SRCADDR to DESTADDR. Result undefined
if the source overlaps with the destination.
Return DESTADDR. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
char *
memcpy (destaddr, srcaddr, len)
char *destaddr;
const char *srcaddr;
int len;
{
char *dest = destaddr;
while (len-- > 0)
*destaddr++ = *srcaddr++;
return dest;
}
-24
View File
@@ -1,24 +0,0 @@
/* memmove.c -- copy memory.
Copy LENGTH bytes from SOURCE to DEST. Does not null-terminate.
In the public domain.
By David MacKenzie <djm@gnu.ai.mit.edu>. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
void
memmove (dest, source, length)
char *dest;
const char *source;
unsigned length;
{
if (source < dest)
/* Moving from low mem to hi mem; start at end. */
for (source += length, dest += length; length; --length)
*--dest = *--source;
else if (source != dest)
/* Moving from hi mem to low mem; start at beginning. */
for (; length; --length)
*dest++ = *source++;
}
-43
View File
@@ -1,43 +0,0 @@
/* strdup.c -- return a newly allocated copy of a string
Copyright (C) 1990 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef STDC_HEADERS
#include <string.h>
#include <stdlib.h>
#else
char *malloc ();
char *strcpy ();
#endif
/* Return a newly allocated copy of STR,
or 0 if out of memory. */
char *
strdup (str)
const char *str;
{
char *newstr;
newstr = (char *) malloc (strlen (str) + 1);
if (newstr)
strcpy (newstr, str);
return newstr;
}
-112
View File
@@ -1,112 +0,0 @@
# Makefile for GNU makeinfo.
# $Id: Makefile.in,v 1.9 1996/10/01 21:45:00 karl Exp $
#
# Copyright (C) 1993, 96 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.
#### Start of system configuration section. ####
srcdir = @srcdir@
VPATH = $(srcdir):$(common)
common = $(srcdir)/../libtxi
CC = @CC@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
LN = ln
RM = rm -f
MKDIR = mkdir
DEFS = @DEFS@
LIBS = -L../libtxi -ltxi @LIBS@
LOADLIBES = $(LIBS)
SHELL = /bin/sh
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(exec_prefix)/bin
# Prefix for each installed program, normally empty or `g'.
binprefix =
infodir = $(prefix)/info
#### End of system configuration section. ####
SRCS = makeinfo.c multi.c
OBJS = makeinfo.o multi.o
PROGS = makeinfo
all: $(PROGS) makeinfo.info
sub-all: all
.c.o:
$(CC) -c $(CPPFLAGS) -I. -I$(srcdir) -I$(common) $(DEFS) $(CFLAGS) $<
makeinfo: $(OBJS) ../libtxi/libtxi.a
$(CC) $(LDFLAGS) -o makeinfo $(OBJS) $(LOADLIBES)
../libtxi/libtxi.a:
(cd ../libtxi && $(MAKE) $(MFLAGS) libtxi.a)
makeinfo.o: makeinfo.c $(common)/getopt.h
$(OBJS): makeinfo.h
info makeinfo.info: ./makeinfo makeinfo.texi #macro.texi
./makeinfo --no-split -I$(srcdir) makeinfo.texi
# makeinfo.texi: ./makeinfo makeinfo.mki
# ./makeinfo -E makeinfo.texi -I$(srcdir) makeinfo.mki
dvi makeinfo.dvi: ./makeinfo makeinfo.texi #macro.texi
$(srcdir)/../util/texi2dvi makeinfo.txi
install: all
$(INSTALL_PROGRAM) makeinfo $(bindir)/$(binprefix)makeinfo
-d=$(srcdir); test -f ./makeinfo.info && d=.; $(INSTALL_DATA) $$d/makeinfo.info $(infodir)/makeinfo.info
$(POST_INSTALL)
../util/install-info --info-dir=$(infodir) $(infodir)/makeinfo.info
uninstall:
for f in $(PROGS); do rm -f $(bindir)/$(binprefix)$$f; done
rm -f $(infodir)/makeinfo.info
TAGS: $(SRCS)
etags $(SRCS)
clean:
rm -f *.o a.out core core.* $(PROGS)
mostlyclean: clean
distclean: clean
rm -f TAGS Makefile config.status *.info */*.info
realclean: distclean
maintainer-clean: distclean
Makefile: Makefile.in ../config.status
cd .. && sh config.status
# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
-177
View File
@@ -1,177 +0,0 @@
@c This file is included in makeinfo.texi.
@c
@ifinfo
@comment Here are some useful examples of the macro facility.
@c Simply insert the right version of the texinfo name.
@macro texinfo{}
TeXinfo
@end macro
@macro dfn{text}
@dfn{\text\}
@cpindex \text\
@end macro
@c Define a macro which expands to a pretty version of the name of the
@c Makeinfo program.
@macro makeinfo{}
@code{Makeinfo}
@end macro
@c Define a macro which is used to define other macros. This one makes
@c a macro which creates a node and gives it a sectioning command. Note
@c that the created macro uses the original definition within the
@c expansion text. This takes advantage of the non-recursion feature of
@c macro execution.
@macro node_define{orig-name}
@macro \orig-name\{title}
@node \title\
@\orig-name\ \title\
@end macro
@end macro
@c Now actually define a new set of sectioning commands.
@node_define {chapter}
@node_define {section}
@node_define {subsection}
@end ifinfo
@chapter The Macro Facility
This chapter describes the new macro facility.
A @dfn{macro} is a command that you define in terms of other commands.
It doesn't exist as a @texinfo{} command until you define it as part of
the input file to @makeinfo{}. Once the command exists, it behaves much
as any other @texinfo{} command. Macros are a useful way to ease the
details and tedium of writing a `correct' info file. The following
sections explain how to write and invoke macros.
@menu
* How to Use Macros in @texinfo{}::
How to use the macro facility.
* Using Macros Recursively::
How to write a macro which does (or doesn't) recurse.
* Using @texinfo{} Macros As Arguments::
Passing a macro as an argument.
@end menu
@section How to Use Macros in @texinfo{}
Using macros in @texinfo{} is easy. First you define the macro. After
that, the macro command is available as a normal @texinfo{} command.
Here is what a definition looks like:
@example
@@macro @var{name}@{@var{arg1}, @var{@dots{}} @var{argn}@}
@var{@texinfo{} commands@dots{}}
@@end macro
@end example
The arguments that you specify that the macro takes are expanded with
the actual parameters used when calling the macro if they are seen
surrounded by backslashes. For example, here is a definition of
@code{@@codeitem}, a macro which can be used wherever @code{@@item} can
be used, but which surrounds its argument with @code{@@code@{@dots{}@}}.
@example
@@macro codeitem@{item@}
@@item @@code@{\item\@}
@@end macro
@end example
When the macro is expanded, all of the text between the @code{@@macro}
and @code{@@end macro} is inserted into the document at the expansion
point, with the actual parameters substituted for the named parameters.
So, a call to the above macro might look like:
@example
@@codeitem@{Foo@}
@end example
and @makeinfo{} would execute the following code:
@example
@@item @@code@{Foo@}
@end example
A special case is made for macros which only take a single argument, and
which are invoked without any brace characters (i.e.,
@samp{@{}@dots{}@samp{@}}) surrounding an argument; the rest of the line
is supplied as is as the sole argument to the macro. This special case
allows one to redefine some standard @texinfo{} commands without
modifying the input file. Along with the non-recursive action of macro
invocation, one can easily redefine the sectioning commands to also
provide index entries:
@example
@@macro chapter@{name@}
@@chapter \name\
@@findex \name\
@@end macro
@end example
Thus, the text:
@example
@@chapter strlen
@end example
will expand to:
@example
@@chapter strlen
@@findex strlen
@end example
@section Using Macros Recursively
Normally, while a particular macro is executing, any call to that macro
will be seen as a call to a builtin @texinfo{} command. This allows one
to redefine a builtin @texinfo{} command as a macro, and then use that
command within the definition of the macro itself. For example, one
might wish to make sure that whereever a term was defined with
@code{@@dfn@{@dots{}@}}, the location of the definition would appear
in the concept index for the manual. Here is a macro which redefines
@code{@@dfn} to do just that:
@example
@@macro dfn@{text@}
@@dfn@{\text\@}
@@cpindex \text\
@@end macro
@end example
Note that we used the builtin @texinfo{} command @code{@@dfn} within our
overriding macro definition.
This behaviour itself can be overridden for macro execution by writing a
special @dfn{macro control command} in the definition of the macro. The
command is considered special because it doesn't affect the output text
directly, rather, it affects the way in which the macro is defined. One
such special command is @code{@@allow-recursion}.
@example
@@macro silly@{arg@}
@@allow-recursion
\arg\
@@end macro
@end example
Now @code{@@silly} is a macro that can be used within a call to itself:
@example
This text @@silly@{@@silly@{some text@}@} is ``some text''.
@end example
@section Using @texinfo{} Macros As Arguments
@printindex cp
How to use @texinfo{} macros as arguments to other @texinfo{} macros.
@bye
-193
View File
@@ -1,193 +0,0 @@
/* makeinfo.h -- Declarations for Makeinfo.
$Id: makeinfo.h,v 1.2 1996/07/21 11:21:45 karl Exp $
Copyright (C) 1996 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). */
/* Why, oh why, did I ever listen to rms when he said:
"Don't make lots of small files, just make one big one!" I've
regretted it ever since with this program, and with readline.
bfox@ai.mit.edu Thu Jul 11 07:54:32 1996 */
#if !defined (MAKEINFO_H)
#define MAKEINFO_H
#if defined (COMPILING_MAKEINFO)
# define DECLARE(type, var, init) type var = init
#else
# define DECLARE(type, var, init) extern type var
#endif
enum insertion_type
{
menu, detailmenu, quotation, lisp, smalllisp, example, smallexample,
display, itemize, format, enumerate, cartouche, multitable, table,
ftable, vtable, group, ifinfo, flushleft, flushright, ifset,
ifclear, deffn, defun, defmac, defspec, defvr, defvar, defopt,
deftypefn, deftypefun, deftypevr, deftypevar, defcv, defivar, defop,
defmethod, deftypemethod, deftp, direntry, bad_type
};
DECLARE (int, insertion_level, 0);
#if defined (COMPILING_MAKEINFO)
char *insertion_type_names[] =
{
"menu", "detailmenu", "quotation", "lisp", "smalllisp", "example",
"smallexample", "display", "itemize", "format", "enumerate",
"cartouche", "multitable", "table", "ftable", "vtable", "group",
"ifinfo", "flushleft", "flushright", "ifset", "ifclear", "deffn",
"defun", "defmac", "defspec", "defvr", "defvar", "defopt",
"deftypefn", "deftypefun", "deftypevr", "deftypevar", "defcv",
"defivar", "defop", "defmethod", "deftypemethod", "deftp", "direntry",
"bad_type"
};
#endif
typedef struct istack_elt
{
struct istack_elt *next;
char *item_function;
char *filename;
int line_number;
int filling_enabled;
int indented_fill;
enum insertion_type insertion;
int inhibited;
int in_fixed_width_font;
} INSERTION_ELT;
DECLARE (INSERTION_ELT *, insertion_stack, (INSERTION_ELT *)NULL);
/* Current output stream. */
DECLARE (FILE *, output_stream, (FILE *)NULL);
/* Output paragraph buffer. */
DECLARE (unsigned char *, output_paragraph, (unsigned char *)NULL);
/* Offset into OUTPUT_PARAGRAPH. */
DECLARE (int, output_paragraph_offset, 0);
/* The output paragraph "cursor" horizontal position. */
DECLARE (int, output_column, 0);
/* Non-zero means output_paragraph contains text. */
DECLARE (int, paragraph_is_open, 0);
/* The amount of indentation to apply at the start of each line. */
DECLARE (int, current_indent, 0);
/* nonzero if we are currently processing a multitable command */
DECLARE (int, multitable_active, 0);
/* The column at which long lines are broken. */
DECLARE (int, fill_column, 72);
/* The current input file state. */
DECLARE (char *, input_filename, (char *)NULL);
DECLARE (char *, input_text, (char *)NULL);
DECLARE (int, size_of_input_text, 0);
DECLARE (int, input_text_offset, 0);
DECLARE (int, line_number, 0);
#define curchar() input_text[input_text_offset]
/* **************************************************************** */
/* */
/* Global Defines */
/* */
/* **************************************************************** */
/* Error levels */
#define NO_ERROR 0
#define SYNTAX 2
#define FATAL 4
/* C's standard macros don't check to make sure that the characters being
changed are within range. So I have to check explicitly. */
/* GNU Library doesn't have toupper(). Until GNU gets this fixed, I will
have to do it. */
#ifndef toupper
#define toupper(c) ((c) - 32)
#endif
#define coerce_to_upper(c) ((islower(c) ? toupper(c) : (c)))
#define coerce_to_lower(c) ((isupper(c) ? tolower(c) : (c)))
#define control_character_bit 0x40 /* %01000000, must be off. */
#define meta_character_bit 0x080/* %10000000, must be on. */
#define CTL(c) ((c) & (~control_character_bit))
#define UNCTL(c) coerce_to_upper(((c)|control_character_bit))
#define META(c) ((c) | (meta_character_bit))
#define UNMETA(c) ((c) & (~meta_character_bit))
#define whitespace(c) (((c) == '\t') || ((c) == ' '))
#define sentence_ender(c) ((c) == '.' || (c) == '?' || (c) == '!')
#define cr_or_whitespace(c) (((c) == '\t') || ((c) == ' ') || ((c) == '\n'))
#ifndef isletter
#define isletter(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
#endif
#ifndef isupper
#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
#endif
#ifndef isdigit
#define isdigit(c) ((c) >= '0' && (c) <= '9')
#endif
#ifndef digit_value
#define digit_value(c) ((c) - '0')
#endif
#define member(c, s) (strchr (s, c) != NULL)
#define COMMAND_PREFIX '@'
/* Stuff for splitting large files. */
#define SPLIT_SIZE_THRESHOLD 70000 /* What's good enough for Stallman... */
#define DEFAULT_SPLIT_SIZE 50000 /* Is probably good enough for me. */
DECLARE (int, splitting, 1); /* Defaults to true for now. */
typedef void COMMAND_FUNCTION (); /* So I can say COMMAND_FUNCTION *foo; */
#define command_char(c) ((!whitespace(c)) && \
((c) != '\n') && \
((c) != '{') && \
((c) != '}') && \
((c) != '='))
#define skip_whitespace() \
while ((input_text_offset != size_of_input_text) && \
whitespace (curchar())) \
input_text_offset++
#define skip_whitespace_and_newlines() \
do { \
while ((input_text_offset != size_of_input_text) && \
(whitespace (curchar ()) || (curchar () == '\n'))) \
{ \
if (curchar () == '\n') \
line_number++; \
input_text_offset++; \
} \
} while (0)
#endif /* !MAKEINFO_H */
-418
View File
@@ -1,418 +0,0 @@
/* multi.c -- Multitable stuff for makeinfo.
$Id: multi.c,v 1.7 1996/10/01 21:42:20 karl Exp $
Copyright (C) 1996 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 <stdio.h>
#include "makeinfo.h"
#define MAXCOLS 100 /* remove this limit later @@ */
/*
* Output environments. This is a hack grafted onto existing
* structure. The "output environment" used to consist of the
* global variables `output_paragraph', `fill_column', etc.
* Routines like add_char would manipulate these variables.
*
* Now, when formatting a multitable, we maintain separate environments
* for each column. That way we can build up the columns separately
* and write them all out at once. The "current" output environment"
* is still kept in those global variables, so that the old output
* routines don't have to change. But we provide routines to save
* and restore these variables in an "environment table". The
* `select_output_environment' function switches from one output
* environment to another.
*
* Environment #0 (i.e. element #0 of the table) is the regular
* environment that is used when we're not formatting a multitable.
*
* Environment #N (where N = 1,2,3,...) is the env. for column #N of
* the table, when a multitable is active.
*/
/* contents of an output environment */
/* some more vars may end up being needed here later @@ */
struct env
{
unsigned char *output_paragraph;
int output_paragraph_offset;
int output_column;
int paragraph_is_open;
int current_indent;
int fill_column;
} envs[MAXCOLS]; /* the environment table */
/* index in environment table of currently selected environment */
static int current_env_no;
/* column number of last column in current multitable */
static int last_column;
/* flags indicating whether horizontal and vertical separators need
to be drawn, separating rows and columns in the current multitable. */
static int hsep, vsep;
void
do_multitable ()
{
int ncolumns;
/*
* multitable strategy:
* for each item {
* for each column in an item {
* initialize a new paragraph
* do ordinary formatting into the new paragraph
* save the paragraph away
* repeat if there are more paragraphs in the column
* }
* dump out the saved paragraphs and free the storage
* }
*/
if (multitable_active)
{
line_error ("Multitables cannot be nested");
return;
}
/* scan the current item function to get the field widths
and number of columns, and set up the output environment list
accordingly. */
ncolumns = setup_multitable_parameters ();
if (hsep)
draw_horizontal_separator ();
/* The next @item command will direct stdout into the first column
and start processing. @tab will then switch to the next column,
and @item will flush out the saved output and return to the first
column. Environment #1 is the first column. (Environment #0 is
the normal output) */
++multitable_active;
}
/* Read the parameters for a multitable from the current command
line, save the parameters away, and return the
number of columns. */
int
setup_multitable_parameters ()
{
char *params = insertion_stack->item_function;
int nchars;
float columnfrac;
char command[200];
int i = 1;
/* We implement @hsep and @vsep even though TeX doesn't.
We don't get mixing of @columnfractions and templates right,
but TeX doesn't either. */
hsep = vsep = 0;
while (*params) {
while (whitespace (*params))
params++;
if (*params == '@') {
sscanf (params, "%s%n", command, &nchars);
params += nchars;
if (strcmp (command, "@hsep") == 0)
hsep++;
else if (strcmp (command, "@vsep") == 0)
vsep++;
else if (strcmp (command, "@columnfractions") == 0) {
/* Clobber old environments and create new ones,
starting at #1. Environment #0 is the normal standard output,
so we don't mess with it. */
for ( ; i <= MAXCOLS; i++) {
if (sscanf (params, "%f%n", &columnfrac, &nchars) < 1)
goto done;
params += nchars;
setup_output_environment (i, (int) (columnfrac * fill_column + .5));
}
}
} else if (*params == '{') {
char *start = params;
while ((*params != '}' || params[-1] == '@') && *params) {
params++;
}
/* This gives us two spaces between columns. Seems reasonable.
Really should expand the text, though, so a template of
`@code{foo}' has a width of three, not ten. Also have to match
braces, then. */
setup_output_environment (i++, params++ - start);
} else {
warning ("ignoring stray text `%s' after @multitable", params);
break;
}
}
done:
flush_output ();
inhibit_output_flushing ();
last_column = i - 1;
return last_column;
}
/* Initialize environment number ENV_NO, of width WIDTH.
The idea is that we're going to use one environment for each column of
a multitable, so we can build them up separately and print them
all out at the end. */
int
setup_output_environment (env_no, width)
int env_no;
int width;
{
int old_env = select_output_environment (env_no);
/* clobber old environment and set width of new one */
init_paragraph ();
/* make our change */
fill_column = width;
/* Save new environment and restore previous one. */
select_output_environment (old_env);
return env_no;
}
/* Direct current output to environment number N. Used when
switching work from one column of a multitable to the next.
Returns previous environment number. */
int
select_output_environment (n)
int n;
{
struct env *e = &envs[current_env_no];
int old_env_no = current_env_no;
/* stash current env info from global vars into the old environment */
e->output_paragraph = output_paragraph;
e->output_paragraph_offset = output_paragraph_offset;
e->output_column = output_column;
e->paragraph_is_open = paragraph_is_open;
e->current_indent = current_indent;
e->fill_column = fill_column;
/* now copy new environment into global vars */
current_env_no = n;
e = &envs[current_env_no];
output_paragraph = e->output_paragraph;
output_paragraph_offset = e->output_paragraph_offset;
output_column = e->output_column;
paragraph_is_open = e->paragraph_is_open;
current_indent = e->current_indent;
fill_column = e->fill_column;
return old_env_no;
}
/* advance to the next environment number */
int
nselect_next_environment ()
{
if (current_env_no >= last_column) {
line_error ("Too many columns in multitable item (max %d)", last_column);
return 1;
}
select_output_environment (current_env_no + 1);
}
static void output_multitable_row ();
/* start a new item (row) of a multitable */
multitable_item ()
{
if (!multitable_active) {
/* impossible, I think. */
error ("multitable item not in active multitable");
exit (1);
}
if (current_env_no > 0) {
output_multitable_row ();
}
/* start at column 1 */
select_output_environment (1);
if (!output_paragraph) {
line_error ("Cannot select column #%d in multitable", current_env_no);
exit (FATAL);
}
init_column ();
return 0;
}
/* do anything needed at the beginning of processing a
multitable column. */
init_column ()
{
/* don't indent 1st paragraph in the item */
cm_noindent ();
/* throw away possible whitespace after @item or @tab command */
skip_whitespace ();
}
/* Output a row. Have to keep `output_position' up-to-date for each
character we output, or the tags table will be off, leading to
chopped-off output files and undefined nodes (because they're in the
wrong file, etc.). Perhaps it would be better to accumulate this
value somewhere and add it once at the end of the table, or return it
as the value, but this seems simplest. */
static void
out_char (ch)
int ch;
{
extern int output_position;
putc (ch, output_stream);
output_position++;
}
static void
output_multitable_row ()
{
int i, j, remaining;
/* offset in the output paragraph of the next char needing
to be output for that column. */
int offset[MAXCOLS];
for (i = 0; i <= last_column; i++)
offset[i] = 0;
/* select the current environment, to make sure the env variables
get updated */
select_output_environment (current_env_no);
#define CHAR_ADDR(n) (offset[i] + (n))
#define CHAR_AT(n) (envs[i].output_paragraph[CHAR_ADDR(n)])
/* remove trailing whitespace from each column */
for (i = 1; i <= last_column; i++) {
while (cr_or_whitespace (CHAR_AT (envs[i].output_paragraph_offset - 1))) {
envs[i].output_paragraph_offset--;
}
}
/* read the current line from each column, outputting them all
pasted together. Do this til all lines are output from all
columns. */
for (;;) {
remaining = 0;
/* first, see if there is any work to do */
for (i = 1; i <= last_column; i++) {
if (CHAR_ADDR (0) < envs[i].output_paragraph_offset) {
remaining = 1;
break;
}
}
if (!remaining)
break;
if (vsep)
out_char ('|');
for (i = 1; i <= last_column; i++) {
for (j = 0; CHAR_ADDR (j) < envs[i].output_paragraph_offset; j++) {
if (CHAR_AT (j) == '\n')
break;
out_char (CHAR_AT (j));
}
offset[i] += j + 1; /* skip last text plus skip the newline */
for (; j <= envs[i].fill_column; j++)
out_char (' ');
if (vsep)
out_char ('|'); /* draw column separator */
}
out_char ('\n'); /* end of line */
}
if (hsep)
draw_horizontal_separator ();
/* Now dispose of the buffered output. */
for (i = 1; i <= last_column; i++) {
select_output_environment (i);
init_paragraph ();
}
}
#undef CHAR_AT
#undef CHAR_ADDR
int
draw_horizontal_separator ()
{
int i, j;
if (vsep)
out_char ('+');
for (i = 1; i <= last_column; i++) {
for (j = 0; j <= envs[i].fill_column; j++)
out_char ('-');
if (vsep)
out_char ('+');
}
out_char ('\n');
}
/* select a new column in current row of multitable */
void
cm_tab ()
{
if (!multitable_active)
error ("ignoring @tab outside of multitable");
nselect_next_environment ();
init_column ();
}
/* close a multitable, flushing its output and resetting
whatever needs resetting */
void
end_multitable ()
{
int i;
output_multitable_row ();
/* Multitables cannot be nested. Otherwise, we'd have to save the
previous output environment number on a stack somewhere, and then
restore to that environment. */
select_output_environment (0);
close_paragraph ();
insert ('\n'); /* we swallow newlines, so insert one of our own */
multitable_active = 0;
uninhibit_output_flushing ();
#if 0
printf ("** Multicolumn output from last row:\n");
for (i = 1; i <= last_column; i++) {
select_output_environment (i);
printf ("* column #%d: output = %s\n", i, output_paragraph);
}
#endif
}
File diff suppressed because it is too large. Load diff
-176
View File
@@ -1,176 +0,0 @@
#!/bin/sh
# $Id: gen-dir-node,v 1.2 1996/10/03 18:49:48 karl Exp $
# Generate the top-level Info node, given a directory of Info files
# and (optionally) a skeleton file. The output will be suitable for a
# top-level dir file. The skeleton file contains info topic names in the
# order they should appear in the output. There are three special
# lines that alter the behavior: a line consisting of just "--" causes
# the next line to be echoed verbatim to the output. A line
# containing just "%%" causes all the remaining filenames (wildcards
# allowed) in the rest of the file to be ignored. A line containing
# just "!!" exits the script when reached (unless preceded by a line
# containing just "--"). Once the script reaches the end of the
# skeleton file, it goes through the remaining files in the directory
# in order, putting their entries at the end. The script will use the
# ENTRY information in each info file if it exists. Otherwise it will
# make a minimal entry.
# sent by Jeffrey Osier <[email protected]>, who thinks it came from
# [email protected] (david d `zoo' zuhn)
# modified 7 April 1995 by Joe Harrington <[email protected]> to
# take special flags
INFODIR=$1
if [ $# = 2 ] ; then
SKELETON=$2
else
SKELETON=/dev/null
fi
skip=
if [ $# -gt 2 ] ; then
echo usage: $0 info-directory [ skeleton-file ] 1>&2
exit 1
else
true
fi
if [ ! -d ${INFODIR} ] ; then
echo "$0: first argument must specify a directory"
exit 1
fi
### output the dir header
echo "-*- Text -*-"
echo "This file was generated automatically by $0."
echo "This version was generated on `date`"
echo "by `whoami`@`hostname` for `(cd ${INFODIR}; pwd)`"
cat << moobler
This is the file .../info/dir, which contains the topmost node of the
Info hierarchy. The first time you invoke Info you start off
looking at that node, which is (dir)Top.

File: dir Node: Top This is the top of the INFO tree
This (the Directory node) gives a menu of major topics.
Typing "d" returns here, "q" exits, "?" lists all INFO commands, "h"
gives a primer for first-timers, "mTexinfo<Return>" visits Texinfo topic,
etc.
Or click mouse button 2 on a menu item or cross reference to select it.
--- PLEASE ADD DOCUMENTATION TO THIS TREE. (See INFO topic first.) ---
* Menu: The list of major topics begins on the next line.
moobler
### go through the list of files in the skeleton. If an info file
### exists, grab the ENTRY information from it. If an entry exists
### use it, otherwise create a minimal dir entry.
###
### Then remove that file from the list of existing files. If any
### additional files remain (ones that don't have a skeleton entry),
### then generate entries for those in the same way, putting the info for
### those at the end....
infofiles=`(cd ${INFODIR}; ls | egrep -v '\-|^dir$|^dir\.info$|^dir\.orig$')`
# echoing gets clobbered by backquotes; we do it the hard way...
lines=`wc $SKELETON | awk '{print $1}'`
line=1
while [ $lines -ge $line ] ; do
# Read one line from the file. This is so that we can echo lines with
# whitespace and quoted characters in them.
fileline=`awk NR==$line $SKELETON`
# flag fancy features
if [ ! -z "$echoline" ] ; then # echo line
echo "$fileline"
fileline=
echoline=
elif [ "${fileline}" = "--" ] ; then # should we echo the next line?
echoline=1
elif [ "${fileline}" = "%%" ] ; then # eliminate remaining files from dir?
skip=1
elif [ "${fileline}" = "!!" ] ; then # quit now
exit 0
fi
# handle files if they exist
for file in $fileline"" ; do # expand wildcards ("" handles blank lines)
fname=
if [ -z "$echoline" -a ! -z "$file" ] ; then
# Find the file to operate upon. Check both possible names.
infoname=`echo $file | sed 's/\.info$//'`
noext=
ext=
if [ -f ${INFODIR}/$infoname ] ; then
noext=$infoname
fi
if [ -f ${INFODIR}/${infoname}.info ] ; then
ext=${infoname}.info
fi
# If it exists with both names take what was said in the file.
if [ ! -z "$ext" -a ! -z "$noext" ]; then
fname=$file
warn="### Warning: $ext and $noext both exist! Using ${file}. ###"
elif [ ! \( -z "$ext" -a -z "$noext" \) ]; then
# just take the name if it exists only once
fname=${noext}${ext}
fi
# if we found something and aren't skipping, do the entry
if [ ! -z "$fname" ] ; then
if [ -z "$skip" ] ; then
if [ ! -z "$warn" ] ; then # issue any warning
echo $warn
warn=
fi
entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
-e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$fname`
if [ ! -z "${entry}" ] ; then
echo "${entry}"
else
echo "* ${infoname}: (${fname})."
fi
fi
# remove the name from the directory listing
infofiles=`echo ${infofiles} | sed -e "s/ ${fname} / /" \
-e "s/^${fname} //" \
-e "s/ ${fname}$//"`
fi
fi
done
line=`expr $line + 1`
done
if [ -z "${infofiles}" ] ; then
exit 0
else
echo
fi
for file in ${infofiles}; do
infoname=`echo $file | sed 's/\.info$//'`
entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
-e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/${file}`
if [ ! -z "${entry}" ] ; then
echo "${entry}"
else
echo "* ${infoname}: (${file})."
fi
done
File diff suppressed because it is too large. Load diff
Loaded 100 of 730 files, more files were not shown because too many files have changed in this diff. Show more