This file was not part of the GDB 5.2.1 import and should have been

deleted from the vendor branch.
This commit is contained in:
marcel 2004-06-20 02:30:48 +00:00
parent c4172ccbdd
commit c6cc8e4a1e
20 changed files with 0 additions and 9238 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,305 +0,0 @@
# Makefile template for Configure for the opcodes library.
# Copyright (C) 1990, 1991, 1992, 1995 Free Software Foundation, Inc.
# Written by Cygnus Support.
#
# 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.
VPATH = @srcdir@
srcdir = @srcdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
exec_prefix = @exec_prefix@
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
datadir = $(prefix)/lib
mandir = $(prefix)/man
man1dir = $(mandir)/man1
man2dir = $(mandir)/man2
man3dir = $(mandir)/man3
man4dir = $(mandir)/man4
man5dir = $(mandir)/man5
man6dir = $(mandir)/man6
man7dir = $(mandir)/man7
man8dir = $(mandir)/man8
man9dir = $(mandir)/man9
infodir = $(prefix)/info
includedir = $(prefix)/include
oldincludedir =
docdir = $(srcdir)/doc
SHELL = /bin/sh
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
AR = @AR@
AR_FLAGS = rc
CC = @CC@
CFLAGS = @CFLAGS@
MAKEINFO = makeinfo
RANLIB = @RANLIB@
ALLLIBS = @ALLLIBS@
PICFLAG = @PICFLAG@
SHLIB = @SHLIB@
SHLIB_CC = @SHLIB_CC@
SHLIB_CFLAGS = @SHLIB_CFLAGS@
COMMON_SHLIB = @COMMON_SHLIB@
SHLIB_DEP = @SHLIB_DEP@
SHLINK = @SHLINK@
SONAME = lib`echo $(SHLIB) | sed -e 's,^\.\./bfd/,,' -e 's/^lib//' | sed '$(program_transform_name)'`
INCDIR = $(srcdir)/../include
BFDDIR = $(srcdir)/../bfd
CSEARCH = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR)
DEP = mkdep
TARGETLIB = libopcodes.a
# To circumvent a Sun make VPATH bug, each file listed here
# should also have a foo.o: foo.c line further along in this file.
ALL_MACHINES = a29k-dis.o alpha-dis.o h8300-dis.o h8500-dis.o \
hppa-dis.o i386-dis.o i960-dis.o m68k-dis.o m68k-opc.o \
m88k-dis.o mips-dis.o mips-opc.o sh-dis.o sparc-dis.o \
sparc-opc.o z8k-dis.o ns32k-dis.o ppc-dis.o ppc-opc.o \
arm-dis.o w65-dis.o
OFILES = @BFD_MACHINES@ dis-buf.o disassemble.o
FLAGS_TO_PASS = \
"against=$(against)" \
"AR=$(AR)" \
"AR_FLAGS=$(AR_FLAGS)" \
"CC=$(CC)" \
"CFLAGS=$(CFLAGS)" \
"RANLIB=$(RANLIB)" \
"MAKEINFO=$(MAKEINFO)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)"
ALL_CFLAGS = $(CSEARCH) @HDEFINES@ $(CFLAGS)
.c.o:
if [ -n "$(PICFLAG)" ]; then \
$(CC) -c $(PICFLAG) $(ALL_CFLAGS) $< -o pic/$@; \
else true; fi
$(CC) -c $(ALL_CFLAGS) $<
# C source files that correspond to .o's.
CFILES = i386-dis.c z8k-dis.c m68k-dis.c mips-dis.c ns32k-dis.c ppc-dis.c
all: $(ALLLIBS)
.NOEXPORT:
installcheck check:
info:
clean-info:
install-info:
dvi:
# HDEPFILES comes from the host config; TDEPFILES from the target config.
$(TARGETLIB): $(OFILES)
rm -f $(TARGETLIB)
$(AR) $(AR_FLAGS) $(TARGETLIB) $(OFILES)
$(RANLIB) $(TARGETLIB)
LIBIBERTY_LISTS = ../libiberty/required-list ../libiberty/needed-list
BFD_LIST = ../bfd/piclist
stamp-piclist: Makefile $(LIBIBERTY_LISTS) $(BFD_LIST)
rm -f tpiclist
if [ -n "$(PICFLAG)" ]; then \
echo $(OFILES) | sed -e 's,\([^ ][^ ]*\),pic/\1,g' > tpiclist; \
else \
echo $(OFILES) > tpiclist; \
fi
if [ "$(COMMON_SHLIB)" = "yes" ]; then \
lobjs=`cat $(LIBIBERTY_LISTS)`; \
if [ -n "$(PICFLAG)" ]; then \
lobjs=`echo $$lobjs | sed -e 's,\([^ ][^ ]*\),pic/\1,g'`; \
fi; \
lobjs=`echo $$lobjs | sed -e 's,\([^ ][^ ]*\),../libiberty/\1,g'`; \
echo $$lobjs >> tpiclist; \
sed -e 's,\([^ ][^ ]*\),../bfd/\1,g' $(BFD_LIST) >> tpiclist; \
else true; fi
$(srcdir)/../move-if-change tpiclist piclist
touch stamp-piclist
piclist: stamp-piclist ; @true
$(SHLIB): stamp-picdir $(OFILES) piclist $(SHLIB_DEP)
rm -f $(SHLIB)
$(SHLIB_CC) $(SHLIB_CFLAGS) -o $(SHLIB) `cat piclist`
$(SHLINK): $(SHLIB)
ts=lib`echo $(SHLIB) | sed -e 's,^\.\./bfd/,,' -e 's/^lib//' | sed -e '$(program_transform_name)'`; \
if [ "$(COMMON_SHLIB)" = "yes" ]; then \
ts=../bfd/$$ts; \
fi; \
if [ "$$ts" != "$(SHLIB)" ]; then \
rm -f $$ts; \
ln -sf `echo $(SHLIB) | sed -e 's,^\.\./bfd/,,'` $$ts; \
else true; fi
rm -f $(SHLINK)
ln -sf `echo $(SHLIB) | sed -e 's,^\.\./bfd/,,'` $(SHLINK)
# This target creates libTARGET-opcodes.so.VERSION as a symlink to
# libopcodes.so.VERSION. It is used on SunOS, which does not have SONAME.
stamp-tshlink: $(SHLIB)
tf=lib`echo $(SHLIB) | sed -e 's,\.\./bfd/,,' -e 's/^lib//' | sed '$(program_transform_name)'`; \
if [ "$(COMMON_SHLIB)" = "yes" ]; then \
tf=../bfd/$$tf; \
fi; \
if [ "$$tf" != "$(SHLIB)" ]; then \
rm -f $$tf; \
ln -sf $(SHLIB) $$tf; \
else true; fi
if [ "$(COMMON_SHLIB)" = "yes" ]; then \
tf=lib`echo $(TARGETLIB) | sed -e 's/^lib//' | sed '$(program_transform_name)'`; \
if [ "$$tf" != "$(TARGETLIB)" ]; then \
rm -f $$tf; \
ln -sf $(TARGETLIB) $$tf; \
else true; fi; \
else true; fi
touch stamp-tshlink
$(OFILES): stamp-picdir
disassemble.o: disassemble.c $(INCDIR)/dis-asm.h
if [ -n "$(PICFLAG)" ]; then \
$(CC) -c @archdefs@ $(PICFLAG) $(ALL_CFLAGS) $(srcdir)/disassemble.c -o pic/disassemble.o; \
else true; fi
$(CC) -c @archdefs@ $(ALL_CFLAGS) $(srcdir)/disassemble.c
a29k-dis.o: a29k-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/a29k.h
dis-buf.o: dis-buf.c $(INCDIR)/dis-asm.h
h8500-dis.o: h8500-dis.c h8500-opc.h $(INCDIR)/dis-asm.h
h8300-dis.o: h8300-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/h8300.h
i386-dis.o: i386-dis.c $(INCDIR)/dis-asm.h
i960-dis.o: i960-dis.c $(INCDIR)/dis-asm.h
w65-dis.o: w65-dis.c
m68k-dis.o: m68k-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/floatformat.h \
$(INCDIR)/opcode/m68k.h
m68k-opc.o: m68k-opc.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/m68k.h
mips-dis.o: mips-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/mips.h
mips-opc.o: mips-opc.c $(INCDIR)/opcode/mips.h
ppc-dis.o: ppc-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/ppc.h
ppc-opc.o: ppc-opc.c $(INCDIR)/opcode/ppc.h
sparc-dis.o: sparc-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/sparc.h
sparc-opc.o: sparc-opc.c $(INCDIR)/opcode/sparc.h
z8k-dis.o: z8k-dis.c z8k-opc.h $(INCDIR)/dis-asm.h
ns32k-dis.o: ns32k-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/ns32k.h
sh-dis.o: sh-dis.c sh-opc.h $(INCDIR)/dis-asm.h
alpha-dis.o: alpha-dis.c alpha-opc.h $(INCDIR)/dis-asm.h
hppa-dis.o: hppa-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/hppa.h
m88k-dis.o: m88k-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/m88k.h
arm-dis.o: arm-dis.c arm-opc.h $(INCDIR)/dis-asm.h
tags etags: TAGS
TAGS: force
etags $(INCDIR)/*.h $(srcdir)/*.h $(srcdir)/*.c
MOSTLYCLEAN = *.o core *.E *.p *.ip config.log pic/*.o
mostlyclean:
rm -rf $(MOSTLYCLEAN)
clean:
rm -f *.a $(MOSTLYCLEAN) $(SHLIB) $(SHLINK) piclist stamp-piclist
distclean: clean
rm -rf Makefile config.status TAGS config.cache config.h stamp-h \
pic stamp-picdir
clobber realclean maintainer-clean: distclean
# Mark everything as depending on config.status, since the timestamp on
# sysdep.h might actually move backwards if we reconfig and relink it
# to a different hosts/h-xxx.h file. This will force a recompile anyway.
RECONFIG = config.status
# This target should be invoked before building a new release.
# 'VERSION' file must be present and contain a string of the form "x.y"
#
roll:
@V=`cat VERSION` ; \
MAJ=`sed 's/\..*//' VERSION` ; \
MIN=`sed 's/.*\.//' VERSION` ; \
V=$$MAJ.`expr $$MIN + 1` ; \
rm -f VERSION ; \
echo $$V >VERSION ; \
echo Version $$V
# Dummy target to force execution of dependent targets.
#
force:
install: $(ALLLIBS)
for f in $(ALLLIBS); do \
if [ "$$f" = "stamp-tshlink" ]; then \
continue; \
fi; \
tf=lib`echo $$f | sed -e 's,^\.\./bfd/,,' -e 's/^lib//' | sed '$(program_transform_name)'`; \
rm -f $(libdir)/$$tf; \
if [ "$$f" = "$(SHLINK)" ]; then \
ts=lib`echo $(SHLIB) | sed -e 's,^\.\./bfd/,,' -e 's/^lib//' | sed '$(program_transform_name)'`; \
ln -sf $$ts $(libdir)/$$tf; \
elif [ "$$f" = "$(SHLIB)" ]; then \
$(INSTALL_PROGRAM) $$f $(libdir)/$$tf; \
else \
$(INSTALL_DATA) $$f $(libdir)/$$tf; \
$(RANLIB) $(libdir)/$$tf; \
chmod a-x $(libdir)/$$tf; \
fi; \
done
Makefile: Makefile.in config.status
CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
config.h: stamp-h ; @true
stamp-h: config.in config.status
CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
config.status : configure $(srcdir)/../bfd/configure.host $(srcdir)/../bfd/config.bfd
$(SHELL) config.status --recheck
dep: $(CFILES)
mkdep $(CFLAGS) $?
stamp-picdir:
if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \
mkdir pic; \
else true; fi
touch stamp-picdir
# What appears below is generated by a hacked mkdep using gcc -MM.
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY

View File

@ -1,7 +0,0 @@
/* config.in. Generated automatically from configure.in by autoheader. */
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

File diff suppressed because it is too large Load Diff

View File

@ -1,216 +0,0 @@
AC_PREREQ(2.0)
AC_INIT(z8k-dis.c)
# configure.in script for the opcodes library.
# Copyright (C) 1995, 1996 Free Software Foundation, Inc.
# Written by Cygnus Support.
#
# 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.
AC_ARG_ENABLE(targets,
[ --enable-targets alternative target configurations],
[case "${enableval}" in
yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
;;
no) enable_targets= ;;
*) enable_targets=$enableval ;;
esac])dnl
AC_ARG_ENABLE(shared,
[ --enable-shared build shared opcodes library],
[case "${enableval}" in
yes) shared=true ;;
no) shared=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for opcodes shared option]) ;;
esac])dnl
AC_ARG_ENABLE(commonbfdlib,
[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
[case "${enableval}" in
yes) commonbfdlib=true ;;
no) commonbfdlib=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for opcodes commonbfdlib option]) ;;
esac])dnl
AC_CONFIG_HEADER(config.h:config.in)
AC_CONFIG_AUX_DIR(`cd $srcdir/..;pwd`)
AC_CANONICAL_SYSTEM
if test -z "$target" ; then
AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
fi
AC_ARG_PROGRAM
# host-specific stuff:
ALLLIBS='$(TARGETLIB)'
PICFLAG=
SHLIB=unused-shlib
SHLINK=unused-shlink
if test "${shared}" = "true"; then
ALLLIBS='$(TARGETLIB) $(SHLIB) $(SHLINK)'
PICFLAG=-fpic
if test "${commonbfdlib}" = "true"; then
changequote(,)dnl
SHLIB=../bfd/libbfd.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/../bfd/VERSION`
changequote([,])dnl
SHLINK=../bfd/libbfd.so
else
changequote(,)dnl
SHLIB=libopcodes.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/../bfd/VERSION`
changequote([,])dnl
SHLINK=libopcodes.so
fi
fi
AC_PROG_CC
. ${srcdir}/../bfd/configure.host
AC_SUBST(HDEFINES)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PROG_INSTALL
if test "${shared}" = "true"; then
if test "${GCC}" != "yes" && test "${shared_non_gcc}" != "yes"; then
AC_MSG_WARN([opcodes --enable-shared only supported when using gcc])
shared=false
ALLLIBS='$(TARGETLIB)'
PICFLAG=
SHLIB=unused-shlib
fi
fi
AC_SUBST(ALLLIBS)
AC_SUBST(PICFLAG)
AC_SUBST(SHLIB)
AC_SUBST(SHLIB_CC)
AC_SUBST(SHLIB_CFLAGS)
if test "${commonbfdlib}" = "true"; then
COMMON_SHLIB=yes
# Rebuild the shared library if libiberty or libbfd changes.
SHLIB_DEP="../libiberty/libiberty.a ../bfd/libbfd.a"
else
COMMON_SHLIB=
SHLIB_DEP=
fi
AC_SUBST(COMMON_SHLIB)
AC_SUBST(SHLIB_DEP)
AC_SUBST(SHLINK)
AC_CHECK_HEADERS(string.h strings.h)
# target-specific stuff:
# Canonicalize the secondary target names.
if test -n "$enable_targets" ; then
for targ in `echo $enable_targets | sed 's/,/ /g'`
do
result=`$ac_config_sub $targ 2>/dev/null`
if test -n "$result" ; then
canon_targets="$canon_targets $result"
else
# Allow targets that config.sub doesn't recognize, like "all".
canon_targets="$canon_targets $targ"
fi
done
fi
all_targets=false
selarchs=
for targ in $target $canon_targets
do
if test "x$targ" = "xall" ; then
all_targets=true
else
. $srcdir/../bfd/config.bfd
selarchs="$selarchs $targ_archs"
fi
done
# We don't do any links based on the target system, just makefile config.
if test x${all_targets} = xfalse ; then
# Target architecture .o files.
ta=
for arch in $selarchs
do
ad=`echo $arch | sed -e s/bfd_//g -e s/_arch//g`
archdefs="$archdefs -DARCH_$ad"
case "$arch" in
bfd_a29k_arch) ta="$ta a29k-dis.o" ;;
bfd_alliant_arch) ;;
bfd_alpha_arch) ta="$ta alpha-dis.o" ;;
bfd_arm_arch) ta="$ta arm-dis.o" ;;
bfd_convex_arch) ;;
bfd_h8300_arch) ta="$ta h8300-dis.o" ;;
bfd_h8500_arch) ta="$ta h8500-dis.o" ;;
bfd_hppa_arch) ta="$ta hppa-dis.o" ;;
bfd_i386_arch) ta="$ta i386-dis.o" ;;
bfd_i860_arch) ;;
bfd_i960_arch) ta="$ta i960-dis.o" ;;
bfd_m68k_arch) ta="$ta m68k-dis.o m68k-opc.o" ;;
bfd_m88k_arch) ta="$ta m88k-dis.o" ;;
bfd_mips_arch) ta="$ta mips-dis.o mips-opc.o" ;;
bfd_ns32k_arch) ta="$ta ns32k-dis.o" ;;
bfd_powerpc_arch) ta="$ta ppc-dis.o ppc-opc.o" ;;
bfd_pyramid_arch) ;;
bfd_romp_arch) ;;
bfd_rs6000_arch) ta="$ta ppc-dis.o ppc-opc.o" ;;
bfd_sh_arch) ta="$ta sh-dis.o" ;;
bfd_sparc_arch) ta="$ta sparc-dis.o sparc-opc.o" ;;
bfd_tahoe_arch) ;;
bfd_vax_arch) ;;
bfd_w65_arch) ta="$ta w65-dis.o" ;;
bfd_we32k_arch) ;;
bfd_z8k_arch) ta="$ta z8k-dis.o" ;;
"") ;;
*) AC_MSG_ERROR(*** unknown target architecture $arch) ;;
esac
done
# Weed out duplicate .o files.
f=""
for i in $ta ; do
case " $f " in
*" $i "*) ;;
*) f="$f $i" ;;
esac
done
ta="$f"
# And duplicate -D flags.
f=""
for i in $archdefs ; do
case " $f " in
*" $i "*) ;;
*) f="$f $i" ;;
esac
done
archdefs="$f"
BFD_MACHINES="$ta"
else # all_targets is true
archdefs=-DARCH_all
BFD_MACHINES='$(ALL_MACHINES)'
fi
AC_SUBST(archdefs)
AC_SUBST(BFD_MACHINES)
AC_OUTPUT(Makefile,
[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])

View File

@ -1,70 +0,0 @@
/* Disassemble from a buffer, for GNU.
Copyright (C) 1993, 1994 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 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. */
#include "sysdep.h"
#include "dis-asm.h"
#include <errno.h>
/* Get LENGTH bytes from info's buffer, at target address memaddr.
Transfer them to myaddr. */
int
buffer_read_memory (memaddr, myaddr, length, info)
bfd_vma memaddr;
bfd_byte *myaddr;
int length;
struct disassemble_info *info;
{
if (memaddr < info->buffer_vma
|| memaddr + length > info->buffer_vma + info->buffer_length)
/* Out of bounds. Use EIO because GDB uses it. */
return EIO;
memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length);
return 0;
}
/* Print an error message. We can assume that this is in response to
an error return from buffer_read_memory. */
void
perror_memory (status, memaddr, info)
int status;
bfd_vma memaddr;
struct disassemble_info *info;
{
if (status != EIO)
/* Can't happen. */
(*info->fprintf_func) (info->stream, "Unknown error %d\n", status);
else
/* Actually, address between memaddr and memaddr + len was
out of bounds. */
(*info->fprintf_func) (info->stream,
"Address 0x%x is out of bounds.\n", memaddr);
}
/* This could be in a separate file, to save miniscule amounts of space
in statically linked executables. */
/* Just print the address is hex. This is included for completeness even
though both GDB and objdump provide their own (to print symbolic
addresses). */
void
generic_print_address (addr, info)
bfd_vma addr;
struct disassemble_info *info;
{
(*info->fprintf_func) (info->stream, "0x%x", addr);
}

View File

@ -1,166 +0,0 @@
/* Select disassembly routine for specified architecture.
Copyright (C) 1994, 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 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. */
#include "ansidecl.h"
#include "dis-asm.h"
#ifdef ARCH_all
#define ARCH_a29k
#define ARCH_alpha
#define ARCH_arm
#define ARCH_h8300
#define ARCH_h8500
#define ARCH_hppa
#define ARCH_i386
#define ARCH_i960
#define ARCH_m68k
#define ARCH_m88k
#define ARCH_mips
#define ARCH_ns32k
#define ARCH_powerpc
#define ARCH_rs6000
#define ARCH_sh
#define ARCH_sparc
#define ARCH_w65
#define ARCH_z8k
#endif
disassembler_ftype
disassembler (abfd)
bfd *abfd;
{
enum bfd_architecture a = bfd_get_arch (abfd);
disassembler_ftype disassemble;
switch (a)
{
/* If you add a case to this table, also add it to the
ARCH_all definition right above this function. */
#ifdef ARCH_a29k
case bfd_arch_a29k:
/* As far as I know we only handle big-endian 29k objects. */
disassemble = print_insn_big_a29k;
break;
#endif
#ifdef ARCH_alpha
case bfd_arch_alpha:
disassemble = print_insn_alpha;
break;
#endif
#ifdef ARCH_arm
case bfd_arch_arm:
if (bfd_big_endian (abfd))
disassemble = print_insn_big_arm;
else
disassemble = print_insn_little_arm;
break;
#endif
#ifdef ARCH_h8300
case bfd_arch_h8300:
if (bfd_get_mach(abfd) == bfd_mach_h8300h)
disassemble = print_insn_h8300h;
else
disassemble = print_insn_h8300;
break;
#endif
#ifdef ARCH_h8500
case bfd_arch_h8500:
disassemble = print_insn_h8500;
break;
#endif
#ifdef ARCH_hppa
case bfd_arch_hppa:
disassemble = print_insn_hppa;
break;
#endif
#ifdef ARCH_i386
case bfd_arch_i386:
disassemble = print_insn_i386;
break;
#endif
#ifdef ARCH_i960
case bfd_arch_i960:
disassemble = print_insn_i960;
break;
#endif
#ifdef ARCH_m68k
case bfd_arch_m68k:
disassemble = print_insn_m68k;
break;
#endif
#ifdef ARCH_m88k
case bfd_arch_m88k:
disassemble = print_insn_m88k;
break;
#endif
#ifdef ARCH_ns32k
case bfd_arch_ns32k:
disassemble = print_insn_ns32k;
break;
#endif
#ifdef ARCH_mips
case bfd_arch_mips:
if (bfd_big_endian (abfd))
disassemble = print_insn_big_mips;
else
disassemble = print_insn_little_mips;
break;
#endif
#ifdef ARCH_powerpc
case bfd_arch_powerpc:
if (bfd_big_endian (abfd))
disassemble = print_insn_big_powerpc;
else
disassemble = print_insn_little_powerpc;
break;
#endif
#ifdef ARCH_rs6000
case bfd_arch_rs6000:
disassemble = print_insn_rs6000;
break;
#endif
#ifdef ARCH_sh
case bfd_arch_sh:
if (bfd_big_endian (abfd))
disassemble = print_insn_sh;
else
disassemble = print_insn_shl;
break;
#endif
#ifdef ARCH_sparc
case bfd_arch_sparc:
disassemble = print_insn_sparc;
break;
#endif
#ifdef ARCH_w65
case bfd_arch_w65:
disassemble = print_insn_w65;
break;
#endif
#ifdef ARCH_z8k
case bfd_arch_z8k:
if (bfd_get_mach(abfd) == bfd_mach_z8001)
disassemble = print_insn_z8001;
else
disassemble = print_insn_z8002;
break;
#endif
default:
return 0;
}
return disassemble;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,38 +0,0 @@
/* Random host-dependent support code.
Copyright (C) 1995 Free Software Foundation, Inc.
Written by Ken Raeburn.
This file is part of libopcodes, the opcodes library.
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. */
/* Do system-dependent stuff, mainly driven by autoconf-detected info.
Well, some generic common stuff is done here too, like including
ansidecl.h. That's because the .h files in bfd/hosts files I'm
trying to replace often did that. If it can be dropped from this
file (check in a non-ANSI environment!), it should be. */
#include "config.h"
#include <ansidecl.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#endif

View File

@ -1,571 +0,0 @@
/*
This file is part of GNU Binutils.
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. */
#include <ansidecl.h>
#include "sysdep.h"
#include "dis-asm.h"
#define DEFINE_TABLE
#include "z8k-opc.h"
#include <setjmp.h>
typedef struct
{
/* These are all indexed by nibble number (i.e only every other entry
of bytes is used, and every 4th entry of words). */
unsigned char nibbles[24];
unsigned char bytes[24];
unsigned short words[24];
/* Nibble number of first word not yet fetched. */
int max_fetched;
bfd_vma insn_start;
jmp_buf bailout;
long tabl_index;
char instr_asmsrc[80];
unsigned long arg_reg[0x0f];
unsigned long immediate;
unsigned long displacement;
unsigned long address;
unsigned long cond_code;
unsigned long ctrl_code;
unsigned long flags;
unsigned long interrupts;
}
instr_data_s;
/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
to ADDR (exclusive) are valid. Returns 1 for success, longjmps
on error. */
#define FETCH_DATA(info, nibble) \
((nibble) < ((instr_data_s *)(info->private_data))->max_fetched \
? 1 : fetch_data ((info), (nibble)))
static int
fetch_data (info, nibble)
struct disassemble_info *info;
int nibble;
{
unsigned char mybuf[20];
int status;
instr_data_s *priv = (instr_data_s *)info->private_data;
bfd_vma start;
if ((nibble % 4) != 0)
abort ();
status = (*info->read_memory_func) (priv->insn_start,
(bfd_byte *) mybuf,
nibble / 2,
info);
if (status != 0)
{
(*info->memory_error_func) (status, priv->insn_start, info);
longjmp (priv->bailout, 1);
}
{
int i;
unsigned char *p = mybuf ;
for (i = 0; i < nibble;)
{
priv->words[i] = (p[0] << 8) | p[1];
priv->bytes[i] = *p;
priv->nibbles[i++] = *p >> 4;
priv->nibbles[i++] = *p &0xf;
++p;
priv->bytes[i] = *p;
priv->nibbles[i++] = *p >> 4;
priv->nibbles[i++] = *p & 0xf;
++p;
}
}
priv->max_fetched = nibble;
return 1;
}
static char *codes[16] =
{
"f",
"lt",
"le",
"ule",
"ov/pe",
"mi",
"eq",
"c/ult",
"t",
"ge",
"gt",
"ugt",
"nov/po",
"pl",
"ne",
"nc/uge"
};
int z8k_lookup_instr PARAMS ((unsigned char*, disassemble_info *));
static void output_instr
PARAMS ((instr_data_s *, unsigned long, disassemble_info *));
static void unpack_instr PARAMS ((instr_data_s *, int, disassemble_info *));
static void unparse_instr PARAMS ((instr_data_s *));
static int
print_insn_z8k (addr, info, is_segmented)
bfd_vma addr;
disassemble_info *info;
int is_segmented;
{
instr_data_s instr_data;
info->private_data = (PTR) &instr_data;
instr_data.max_fetched = 0;
instr_data.insn_start = addr;
if (setjmp (instr_data.bailout) != 0)
/* Error return. */
return -1;
instr_data.tabl_index = z8k_lookup_instr (instr_data.nibbles, info);
if (instr_data.tabl_index > 0)
{
unpack_instr (&instr_data, is_segmented, info);
unparse_instr (&instr_data);
output_instr (&instr_data, addr, info);
return z8k_table[instr_data.tabl_index].length;
}
else
{
FETCH_DATA (info, 4);
(*info->fprintf_func) (info->stream, ".word %02x%02x",
instr_data.bytes[0], instr_data.bytes[2]);
return 2;
}
}
print_insn_z8001 (addr, info)
bfd_vma addr;
disassemble_info *info;
{
return print_insn_z8k (addr, info, 1);
}
print_insn_z8002 (addr, info)
bfd_vma addr;
disassemble_info *info;
{
return print_insn_z8k (addr, info, 0);
}
int
z8k_lookup_instr (nibbles, info)
unsigned char *nibbles;
disassemble_info *info;
{
int nibl_index, tabl_index;
int nibl_matched;
unsigned short instr_nibl;
unsigned short tabl_datum, datum_class, datum_value;
nibl_matched = 0;
tabl_index = 0;
while (!nibl_matched && z8k_table[tabl_index].name)
{
nibl_matched = 1;
for (nibl_index = 0; nibl_index < z8k_table[tabl_index].length * 2 && nibl_matched; nibl_index++)
{
if ((nibl_index % 4) == 0)
/* Fetch one word at a time. */
FETCH_DATA (info, nibl_index + 4);
instr_nibl = nibbles[nibl_index];
tabl_datum = z8k_table[tabl_index].byte_info[nibl_index];
datum_class = tabl_datum & CLASS_MASK;
datum_value = ~CLASS_MASK & tabl_datum;
switch (datum_class)
{
case CLASS_BIT:
if (datum_value != instr_nibl)
nibl_matched = 0;
break;
case CLASS_00II:
if (!((~instr_nibl) & 0x4))
nibl_matched = 0;
break;
case CLASS_01II:
if (!(instr_nibl & 0x4))
nibl_matched = 0;
break;
case CLASS_0CCC:
if (!((~instr_nibl) & 0x8))
nibl_matched = 0;
break;
case CLASS_1CCC:
if (!(instr_nibl & 0x8))
nibl_matched = 0;
break;
case CLASS_0DISP7:
if (!((~instr_nibl) & 0x8))
nibl_matched = 0;
nibl_index += 1;
break;
case CLASS_1DISP7:
if (!(instr_nibl & 0x8))
nibl_matched = 0;
nibl_index += 1;
break;
case CLASS_REGN0:
if (instr_nibl == 0)
nibl_matched = 0;
break;
case CLASS_BIT_1OR2:
if ((instr_nibl | 0x2) != (datum_value | 0x2))
nibl_matched = 0;
break;
default:
break;
}
}
if (nibl_matched)
{
return tabl_index;
}
tabl_index++;
}
return -1;
}
static void
output_instr (instr_data, addr, info)
instr_data_s *instr_data;
unsigned long addr;
disassemble_info *info;
{
int loop, loop_limit;
char tmp_str[20];
char out_str[100];
strcpy (out_str, "\t");
loop_limit = z8k_table[instr_data->tabl_index].length * 2;
FETCH_DATA (info, loop_limit);
for (loop = 0; loop < loop_limit; loop++)
{
sprintf (tmp_str, "%x", instr_data->nibbles[loop]);
strcat (out_str, tmp_str);
}
while (loop++ < 8)
{
strcat (out_str, " ");
}
strcat (out_str, instr_data->instr_asmsrc);
(*info->fprintf_func) (info->stream, "%s", out_str);
}
static void
unpack_instr (instr_data, is_segmented, info)
instr_data_s *instr_data;
int is_segmented;
disassemble_info *info;
{
int nibl_count, loop;
unsigned short instr_nibl, instr_byte, instr_word;
long instr_long;
unsigned short tabl_datum, datum_class, datum_value;
nibl_count = 0;
loop = 0;
while (z8k_table[instr_data->tabl_index].byte_info[loop] != 0)
{
FETCH_DATA (info, nibl_count + 4 - (nibl_count % 4));
instr_nibl = instr_data->nibbles[nibl_count];
instr_byte = instr_data->bytes[nibl_count];
instr_word = instr_data->words[nibl_count];
tabl_datum = z8k_table[instr_data->tabl_index].byte_info[loop];
datum_class = tabl_datum & CLASS_MASK;
datum_value = tabl_datum & ~CLASS_MASK;
switch (datum_class)
{
case CLASS_X:
instr_data->address = instr_nibl;
break;
case CLASS_BA:
instr_data->displacement = instr_nibl;
break;
case CLASS_BX:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_DISP:
switch (datum_value)
{
case ARG_DISP16:
instr_data->displacement = instr_word;
nibl_count += 3;
break;
case ARG_DISP12:
instr_data->displacement = instr_word & 0x0fff;
nibl_count += 2;
break;
default:
break;
}
break;
case CLASS_IMM:
switch (datum_value)
{
case ARG_IMM4:
instr_data->immediate = instr_nibl;
break;
case ARG_NIM8:
instr_data->immediate = (-instr_byte);
nibl_count += 1;
break;
case ARG_IMM8:
instr_data->immediate = instr_byte;
nibl_count += 1;
break;
case ARG_IMM16:
instr_data->immediate = instr_word;
nibl_count += 3;
break;
case ARG_IMM32:
FETCH_DATA (info, nibl_count + 8);
instr_long = (instr_data->words[nibl_count] << 16)
| (instr_data->words[nibl_count + 4]);
instr_data->immediate = instr_long;
nibl_count += 7;
break;
case ARG_IMMN:
instr_data->immediate = instr_nibl - 1;
break;
case ARG_IMM4M1:
instr_data->immediate = instr_nibl + 1;
break;
case ARG_IMM_1:
instr_data->immediate = 1;
break;
case ARG_IMM_2:
instr_data->immediate = 2;
break;
case ARG_IMM2:
instr_data->immediate = instr_nibl & 0x3;
break;
default:
break;
}
break;
case CLASS_CC:
instr_data->cond_code = instr_nibl;
break;
case CLASS_CTRL:
instr_data->ctrl_code = instr_nibl;
break;
case CLASS_DA:
case CLASS_ADDRESS:
if (is_segmented)
{
if (instr_nibl & 0x8)
{
FETCH_DATA (info, nibl_count + 8);
instr_long = (instr_data->words[nibl_count] << 16)
| (instr_data->words[nibl_count + 4]);
instr_data->address = ((instr_word & 0x7f00) << 8) +
(instr_long & 0xffff);
nibl_count += 7;
}
else
{
instr_data->address = ((instr_word & 0x7f00) << 8) +
(instr_word & 0x00ff);
nibl_count += 3;
}
}
else
{
instr_data->address = instr_word;
nibl_count += 3;
}
break;
case CLASS_0CCC:
instr_data->cond_code = instr_nibl & 0x7;
break;
case CLASS_1CCC:
instr_data->cond_code = instr_nibl & 0x7;
break;
case CLASS_0DISP7:
instr_data->displacement = instr_byte & 0x7f;
nibl_count += 1;
break;
case CLASS_1DISP7:
instr_data->displacement = instr_byte & 0x7f;
nibl_count += 1;
break;
case CLASS_01II:
instr_data->interrupts = instr_nibl & 0x3;
break;
case CLASS_00II:
instr_data->interrupts = instr_nibl & 0x3;
break;
case CLASS_BIT:
/* do nothing */
break;
case CLASS_IR:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_FLAGS:
instr_data->flags = instr_nibl;
break;
case CLASS_REG:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_REG_BYTE:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_REG_WORD:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_REG_QUAD:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_REG_LONG:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_REGN0:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
default:
break;
}
loop += 1;
nibl_count += 1;
}
}
static void
unparse_instr (instr_data)
instr_data_s *instr_data;
{
unsigned short tabl_datum, datum_class, datum_value;
int loop, loop_limit;
char out_str[80], tmp_str[25];
sprintf (out_str, "\t%s\t", z8k_table[instr_data->tabl_index].name);
loop_limit = z8k_table[instr_data->tabl_index].noperands;
for (loop = 0; loop < loop_limit; loop++)
{
if (loop)
strcat (out_str, ",");
tabl_datum = z8k_table[instr_data->tabl_index].arg_info[loop];
datum_class = tabl_datum & CLASS_MASK;
datum_value = tabl_datum & ~CLASS_MASK;
switch (datum_class)
{
case CLASS_X:
sprintf (tmp_str, "0x%0x(R%d)", instr_data->address,
instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_BA:
sprintf (tmp_str, "r%d(#%x)", instr_data->arg_reg[datum_value],
instr_data->immediate);
strcat (out_str, tmp_str);
break;
case CLASS_BX:
sprintf (tmp_str, "r%d(R%d)", instr_data->arg_reg[datum_value],
instr_data->arg_reg[ARG_RX]);
strcat (out_str, tmp_str);
break;
case CLASS_DISP:
sprintf (tmp_str, "#0x%0x", instr_data->displacement);
strcat (out_str, tmp_str);
break;
case CLASS_IMM:
sprintf (tmp_str, "#0x%0x", instr_data->immediate);
strcat (out_str, tmp_str);
break;
case CLASS_CC:
sprintf (tmp_str, "%s", codes[instr_data->cond_code]);
strcat (out_str, tmp_str);
break;
case CLASS_CTRL:
sprintf (tmp_str, "0x%0x", instr_data->ctrl_code);
strcat (out_str, tmp_str);
break;
case CLASS_DA:
case CLASS_ADDRESS:
sprintf (tmp_str, "#0x%0x", instr_data->address);
strcat (out_str, tmp_str);
break;
case CLASS_IR:
sprintf (tmp_str, "@R%d", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_FLAGS:
sprintf (tmp_str, "0x%0x", instr_data->flags);
strcat (out_str, tmp_str);
break;
case CLASS_REG_BYTE:
if (instr_data->arg_reg[datum_value] >= 0x8)
{
sprintf (tmp_str, "rl%d",
instr_data->arg_reg[datum_value] - 0x8);
}
else
{
sprintf (tmp_str, "rh%d", instr_data->arg_reg[datum_value]);
}
strcat (out_str, tmp_str);
break;
case CLASS_REG_WORD:
sprintf (tmp_str, "r%d", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_REG_QUAD:
sprintf (tmp_str, "rq%d", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_REG_LONG:
sprintf (tmp_str, "rr%d", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
default:
break;
}
}
strcpy (instr_data->instr_asmsrc, out_str);
}

View File

@ -1,12 +0,0 @@
Wed Sep 20 12:57:29 1995 Ian Lance Taylor <ian@cygnus.com>
* Makefile.in (maintainer-clean): New synonym for realclean.
Tue Feb 2 11:40:04 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* Makefile.in: configurable (and useable) Makefile template
* Makefile: removed, replaced with configurable Makefile.in
* texindex.c texinfo.tex: remove, replacing w/refs to tools
elsewhere in distribution tree
* configure.in: pro forma configure stub
* ChangeLog: new file

View File

@ -1,94 +0,0 @@
## Copyright (C) 1993 Free Software Foundation, Inc.
# Makefile for Readline documentation.
# 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.
srcdir = .
prefix = /usr/local
infodir = $(prefix)/info
SHELL = /bin/sh
INSTALL = install -c
INSTALL_DATA = $(INSTALL)
# where to find texinfo
TEXIDIR=$(srcdir)/../../texinfo
# where to find makeinfo, preferably one designed for texinfo-2
MAKEINFO=makeinfo
# auxiliary program for sorting Texinfo indices
TEXINDEX=texindex
# Don Knuth's TeX formatter
TEX=tex
#### Host, target, and site specific Makefile fragments come in here.
###
all: info dvi
install: install-info
info: history.info readline.info
dvi: history.dvi readline.dvi
install-info: info
-parent=`echo $(infodir)|sed -e 's@/[^/]*$$@@'`; \
if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
-if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; fi
for i in *.info* ; do \
$(INSTALL_DATA) $$i $(infodir)/$$i ; \
done
history.info: hist.texinfo hsuser.texinfo hstech.texinfo
$(MAKEINFO) -I $(srcdir) -o ./history.info $(srcdir)/hist.texinfo
history.dvi: hist.texinfo hsuser.texinfo hstech.texinfo $(TEXIDIR)/texinfo.tex
TEXINPUTS=${TEXIDIR}:$(srcdir):$$TEXINPUTS $(TEX) hist.texinfo
$(TEXINDEX) hist.??
TEXINPUTS=${TEXIDIR}:$(srcdir):$$TEXINPUTS $(TEX) hist.texinfo
readline.info: rlman.texinfo rluser.texinfo rltech.texinfo
$(MAKEINFO) -I $(srcdir) -o ./readline.info $(srcdir)/rlman.texinfo
readline.dvi: rlman.texinfo rluser.texinfo rltech.texinfo
TEXINPUTS=${TEXIDIR}:$(srcdir):$$TEXINPUTS $(TEX) rlman.texinfo
$(TEXINDEX) rlman.??
TEXINPUTS=${TEXIDIR}:$(srcdir):$$TEXINPUTS $(TEX) rlman.texinfo
distclean: clean
rm -f Makefile config.status
mostlyclean: clean
realclean maintainer-clean: distclean
clean: clean-info clean-dvi
clean-info:
rm -f history.info* readline.info*
clean-dvi:
rm -f hist.?? hist.???
rm -f rlman.?? rlman.???
Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
$(SHELL) ./config.status

View File

@ -1,8 +0,0 @@
srcname="READLINE doc"
srctrigger=rlman.texinfo
# per-host:
# per-target:
files=""
links=""

View File

@ -1,106 +0,0 @@
\input texinfo @c -*-texinfo-*-
@comment %**start of header (This is for running Texinfo on a region.)
@setfilename history.info
@settitle GNU Readline Library
@comment %**end of header (This is for running Texinfo on a region.)
@synindex vr fn
@setchapternewpage odd
@ifinfo
This document describes the GNU History library, a programming tool that
provides a consistent user interface for recalling lines of previously
typed input.
Copyright (C) 1988, 1991 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
pare preserved on all copies.
@ignore
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).
@end ignore
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation approved
by the Foundation.
@end ifinfo
@titlepage
@sp 10
@center @titlefont{GNU History Library}
@center Brian Fox
@center Free Software Foundation
@center Version 1.1
@center April 1991
@c Include the Distribution inside the titlepage environment so
@c that headings are turned off.
@page
This document describes the GNU History library, a programming tool that
provides a consistent user interface for recalling lines of previously
typed input.
Published by the Free Software Foundation @*
675 Massachusetts Avenue, @*
Cambridge, MA 02139 USA
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation approved
by the Foundation.
@vskip 0pt plus 1filll
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
@end titlepage
@ifinfo
@node Top
@top GNU History Library
This document describes the GNU History library, a programming tool that
provides a consistent user interface for recalling lines of previously
typed input.
@menu
* Using History Interactively:: GNU History User's Manual.
* Programming with GNU History:: GNU History Programmer's Manual.
* Concept Index:: Index of concepts described in this manual.
* Function and Variable Index:: Index of externally visible functions
and variables.
@end menu
@end ifinfo
@include hsuser.texinfo
@include hstech.texinfo
@node Concept Index
@appendix Concept Index
@printindex cp
@node Function and Variable Index
@appendix Function and Variable Index
@printindex vr
@contents
@bye

View File

@ -1,311 +0,0 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988, 1991 Free Software Foundation, Inc.
Authored by Brian Fox.
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 Programming with GNU History
@chapter Programming with GNU History
This chapter describes how to interface the GNU History Library with
programs that you write. It should be considered a technical guide.
For information on the interactive use of GNU History, @pxref{Using
History Interactively}.
@menu
* Introduction to History:: What is the GNU History library for?
* History Storage:: How information is stored.
* History Functions:: Functions that you can use.
* History Variables:: Variables that control behaviour.
* History Programming Example:: Example of using the GNU History Library.
@end menu
@node Introduction to History
@section Introduction to History
Many programs read input from the user a line at a time. The GNU history
library is able to keep track of those lines, associate arbitrary data with
each line, and utilize information from previous lines in making up new
ones.
The programmer using the History library has available to him functions
for remembering lines on a history stack, associating arbitrary data
with a line, removing lines from the stack, searching through the stack
for a line containing an arbitrary text string, and referencing any line
on the stack directly. In addition, a history @dfn{expansion} function
is available which provides for a consistent user interface across many
different programs.
The end-user using programs written with the History library has the
benifit of a consistent user interface, with a set of well-known
commands for manipulating the text of previous lines and using that text
in new commands. The basic history manipulation commands are similar to
the history substitution used by @code{Csh}.
If the programmer desires, he can use the Readline library, which
includes some history manipulation by default, and has the added
advantage of Emacs style command line editing.
@node History Storage
@section History Storage
@example
typedef struct _hist_entry @{
char *line;
char *data;
@} HIST_ENTRY;
@end example
@node History Functions
@section History Functions
This section describes the calling sequence for the various functions
present in GNU History.
@defun {void using_history} ()
Begin a session in which the history functions might be used. This
just initializes the interactive variables.
@end defun
@defun {void add_history} (char *string)
Place @var{string} at the end of the history list. The associated data
field (if any) is set to @code{NULL}.
@end defun
@defun {int where_history} ()
Returns the number which says what history element we are now looking
at.
@end defun
@defun {int history_set_pos} (int pos)
Set the position in the history list to @var{pos}.
@end defun
@defun {int history_search_pos} (char *string, int direction, int pos)
Search for @var{string} in the history list, starting at @var{pos}, an
absolute index into the list. @var{direction}, if negative, says to search
backwards from @var{pos}, else forwards. Returns the absolute index of
the history element where @var{string} was found, or -1 otherwise.
@end defun
@defun {HIST_ENTRY *remove_history} ();
Remove history element @var{which} from the history. The removed
element is returned to you so you can free the line, data,
and containing structure.
@end defun
@defun {void stifle_history} (int max)
Stifle the history list, remembering only @var{max} number of entries.
@end defun
@defun {int unstifle_history} ();
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.
@end defun
@defun {int read_history} (char *filename)
Add the contents of @var{filename} to the history list, a line at a
time. If @var{filename} is @code{NULL}, then read from
@file{~/.history}. Returns 0 if successful, or errno if not.
@end defun
@defun {int read_history_range} (char *filename, int from, int to)
Read a range of lines from @var{filename}, adding them to the history list.
Start reading at the @var{from}'th line and end at the @var{to}'th. If
@var{from} is zero, start at the beginning. If @var{to} is less than
@var{from}, then read until the end of the file. If @var{filename} is
@code{NULL}, then read from @file{~/.history}. Returns 0 if successful,
or @code{errno} if not.
@end defun
@defun {int write_history} (char *filename)
Append the current history to @var{filename}. If @var{filename} is
@code{NULL}, then append the history list to @file{~/.history}. Values
returned are as in @code{read_history ()}.
@end defun
@defun {int append_history} (int nelements, char *filename)
Append @var{nelement} entries to @var{filename}. The entries appended
are from the end of the list minus @var{nelements} up to the end of the
list.
@end defun
@defun {HIST_ENTRY *replace_history_entry} ()
Make the history entry at @var{which} have @var{line} and @var{data}.
This returns the old entry so you can dispose of the data. In the case
of an invalid @var{which}, a @code{NULL} pointer is returned.
@end defun
@defun {HIST_ENTRY *current_history} ()
Return the history entry at the current position, as determined by
@code{history_offset}. If there is no entry there, return a @code{NULL}
pointer.
@end defun
@defun {HIST_ENTRY *previous_history} ()
Back up @var{history_offset} to the previous history entry, and return a
pointer to that entry. If there is no previous entry, return a
@code{NULL} pointer.
@end defun
@defun {HIST_ENTRY *next_history} ()
Move @code{history_offset} forward to the next history entry, and return
the a pointer to that entry. If there is no next entry, return a
@code{NULL} pointer.
@end defun
@defun {HIST_ENTRY **history_list} ()
Return a @code{NULL} terminated array of @code{HIST_ENTRY} which is the
current input history. Element 0 of this list is the beginning of time.
If there is no history, return @code{NULL}.
@end defun
@defun {int history_search} (char *string, int direction)
Search the history for @var{string}, starting at @code{history_offset}.
If @var{direction} < 0, then the search is through previous entries,
else through subsequent. If @var{string} is found, then
@code{current_history ()} is the history entry, and the value of this
function is the offset in the line of that history entry that the
@var{string} was found in. Otherwise, nothing is changed, and a -1 is
returned.
@end defun
@defun {int history_expand} (char *string, char **output)
Expand @var{string}, placing the result into @var{output}, a pointer
to a string. Returns:
@table @code
@item 0
If no expansions took place (or, if the only change in
the text was the de-slashifying of the history expansion
character),
@item 1
if expansions did take place, or
@item -1
if there was an error in expansion.
@end table
If an error ocurred in expansion, then @var{output} contains a descriptive
error message.
@end defun
@defun {char *history_arg_extract} (int first, int last, char *string)
Extract a string segment consisting of the @var{first} through @var{last}
arguments present in @var{string}. Arguments are broken up as in
the GNU Bash shell.
@end defun
@defun {int history_total_bytes} ();
Return the number of bytes that the primary history entries are using.
This just adds up the lengths of @code{the_history->lines}.
@end defun
@node History Variables
@section History Variables
This section describes the variables in GNU History that are externally
visible.
@defvar {int history_base}
For convenience only. You set this when interpreting history commands.
It is the logical offset of the first history element.
@end defvar
@node History Programming Example
@section History Programming Example
The following snippet of code demonstrates simple use of the GNU History
Library.
@smallexample
main ()
@{
char line[1024], *t;
int done = 0;
line[0] = 0;
while (!done)
@{
fprintf (stdout, "history%% ");
t = gets (line);
if (!t)
strcpy (line, "quit");
if (line[0])
@{
char *expansion;
int result;
using_history ();
result = history_expand (line, &expansion);
strcpy (line, expansion);
free (expansion);
if (result)
fprintf (stderr, "%s\n", line);
if (result < 0)
continue;
add_history (line);
@}
if (strcmp (line, "quit") == 0) done = 1;
if (strcmp (line, "save") == 0) write_history (0);
if (strcmp (line, "read") == 0) read_history (0);
if (strcmp (line, "list") == 0)
@{
register HIST_ENTRY **the_list = history_list ();
register int i;
if (the_list)
for (i = 0; the_list[i]; i++)
fprintf (stdout, "%d: %s\n",
i + history_base, the_list[i]->line);
@}
if (strncmp (line, "delete", strlen ("delete")) == 0)
@{
int which;
if ((sscanf (line + strlen ("delete"), "%d", &which)) == 1)
@{
HIST_ENTRY *entry = remove_history (which);
if (!entry)
fprintf (stderr, "No such entry %d\n", which);
else
@{
free (entry->line);
free (entry);
@}
@}
else
@{
fprintf (stderr, "non-numeric arg given to `delete'\n");
@}
@}
@}
@}
@end smallexample

View File

@ -1,153 +0,0 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988, 1991 Free Software Foundation, Inc.
Authored by Brian Fox.
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
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}.
@menu
* History Interaction:: What it feels like using History as a user.
@end menu
@node History Interaction
@section History Interaction
@cindex expansion
The History library provides a history expansion feature that is similar
to the history expansion in Csh. The following text describes the sytax
that you use to manipulate the history information.
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}. The line is broken into words in the same fashion
that the Bash shell does, so that several English (or Unix) words
surrounded by quotes are considered as one word.
@menu
* Event Designators:: How to specify which history line to use.
* Word Designators:: Specifying which words are of interest.
* Modifiers:: Modifying the results of susbstitution.
@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.
@table @asis
@item @code{!}
Start a history subsititution, except when followed by a space, tab, or
the end of the line... @key{=} or @key{(}.
@item @code{!!}
Refer to the previous command. This is a synonym for @code{!-1}.
@item @code{!n}
Refer to command line @var{n}.
@item @code{!-n}
Refer to the command line @var{n} lines back.
@item @code{!string}
Refer to the most recent command starting with @var{string}.
@item @code{!?string}[@code{?}]
Refer to the most recent command containing @var{string}.
@end table
@node Word Designators
@subsection Word Designators
A @key{:} separates the event specification from the word designator. It
can be omitted if the word designator begins with a @key{^}, @key{$},
@key{*} or @key{%}. Words are numbered from the beginning of the line,
with the first word being denoted by a 0 (zero).
@table @code
@item 0 (zero)
The zero'th word. For many applications, this is the command word.
@item 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 @code{?string?} search.
@item x-y
A range of words; @code{-@var{y}} Abbreviates @code{0-@var{y}}.
@item *
All of the words, excepting the zero'th. This is a synonym for @code{1-$}.
It is not an error to use @key{*} if there is just one word in the event.
The empty string is returned in that case.
@end table
@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 @key{:}.
@table @code
@item #
The entire command line typed so far. This means the current command,
not the previous command, so it really isn't a word designator, and doesn't
belong in this section.
@item h
Remove a trailing pathname component, leaving only the head.
@item r
Remove a trailing suffix of the form @samp{.}@var{suffix}, leaving the basename.
@item e
Remove all but the suffix.
@item t
Remove all leading pathname components, leaving the tail.
@item p
Print the new command but do not execute it.
@end table

View File

@ -1,159 +0,0 @@
@ignore
This file is completely identical to hsuser.texinfo, except that it has the
reference to the programming manual removed. There are definately better ways
to do this!
This file documents the user interface to the GNU History library.
Copyright (C) 1988, 1991 Free Software Foundation, Inc.
Authored by Brian Fox.
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
@appendix Using History Interactively
This chapter describes how to use the GNU History Library interactively,
from a user's standpoint.
@menu
* History Interaction:: What it feels like using History as a user.
@end menu
@node History Interaction
@section History Interaction
@cindex expansion
The History library provides a history expansion feature similar
to the history expansion in @code{csh}. The following text describes the
syntax you use to manipulate history information.
History expansion takes two parts. In the first part, determine
which line from the previous history will be used for substitution.
This line is called the @dfn{event}.
In the second part, select portions of that line for inclusion into the
current line. These portions are called @dfn{words}.
@value{GDBN} breaks the line into words in the same
way that the Bash shell does, so that several English (or Unix) words
surrounded by quotes are considered one word.
@menu
* Event Designators:: How to specify which history line to use.
* Word Designators:: Specifying which words are of interest.
* Modifiers:: Modifying the results of susbstitution.
@end menu
@node Event Designators
@subsection Event Designators
@cindex event designators
An @dfn{event designator} is a reference to a command line entry in the
history list.
@table @asis
@item @code{!}
Start a history subsititution, except when followed by a space, tab, or
the end of the line... @key{=} or @key{(}.
@item @code{!!}
Refer to the previous command. This is a synonym for @code{!-1}.
@item @code{!n}
Refer to command line @var{n}.
@item @code{!-n}
Refer to the command line @var{n} lines back.
@item @code{!string}
Refer to the most recent command starting with @var{string}.
@item @code{!?string}[@code{?}]
Refer to the most recent command containing @var{string}.
@end table
@node Word Designators
@subsection Word Designators
A @key{:} separates the event designator from the @dfn{word designator}.
It can be omitted if the word designator begins with a @key{^}, @key{$},
@key{*} or @key{%}. Words are numbered from the beginning of the line,
with the first word being denoted by a 0 (zero).
@table @code
@item 0 (zero)
The zero'th word. For many applications, this is the command word.
@item 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 @code{?string?} search.
@item x-y
A range of words; @code{-@var{y}} Abbreviates @code{0-@var{y}}.
@item *
All of the words, excepting the zero'th. This is a synonym for @code{1-$}.
It is not an error to use @key{*} if there is just one word in the event.
The empty string is returned in that case.
@end table
@node Modifiers
@subsection Modifiers
After the optional word designator, you can add a sequence of one or more
of the following @dfn{modifiers}, each preceded by a @key{:}.
@table @code
@item #
The entire command line typed so far. This means the current command,
not the previous command.
@c
@c FIXME: If it doesn't belong here, let's put it where it does.
@c
@c so it technically isn't a word designator and doesn't belong in
@c this section.
@item h
Remove a trailing pathname component, leaving only the head.
@item r
Remove a trailing suffix of the form @samp{.}@var{suffix}, leaving the basename.
@item e
Remove all but the suffix.
@item t
Remove all leading pathname components, leaving the tail.
@item p
Print the new command but do not execute it.
@end table

View File

@ -1,103 +0,0 @@
\input texinfo @c -*-texinfo-*-
@comment %**start of header (This is for running Texinfo on a region.)
@setfilename readline.info
@settitle GNU Readline Library
@comment %**end of header (This is for running Texinfo on a region.)
@synindex vr fn
@setchapternewpage odd
@ifinfo
This document describes the GNU Readline Library, a utility which aids
in the consistency of user interface across discrete programs that need
to provide a command line interface.
Copyright (C) 1988, 1991 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
pare preserved on all copies.
@ignore
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).
@end ignore
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation approved
by the Foundation.
@end ifinfo
@titlepage
@sp 10
@center @titlefont{GNU Readline Library}
@center Brian Fox
@center Free Software Foundation
@center Version 1.1
@center April 1991
@page
This document describes the GNU Readline Library, a utility which aids
in the consistency of user interface across discrete programs that need
to provide a command line interface.
Published by the Free Software Foundation @*
675 Massachusetts Avenue, @*
Cambridge, MA 02139 USA
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation approved
by the Foundation.
@vskip 0pt plus 1filll
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
@end titlepage
@ifinfo
@node Top
@top GNU Readline Library
This document describes the GNU Readline Library, a utility which aids
in the consistency of user interface across discrete programs that need
to provide a command line interface.
@menu
* Command Line Editing:: GNU Readline User's Manual.
* Programming with GNU Readline:: GNU Readline Programmer's Manual.
* Concept Index:: Index of concepts described in this manual.
* Function and Variable Index:: Index of externally visible functions
and variables.
@end menu
@end ifinfo
@include rluser.texinfo
@include rltech.texinfo
@node Concept Index
@unnumbered Concept Index
@printindex cp
@node Function and Variable Index
@unnumbered Function and Variable Index
@printindex fn
@contents
@bye

File diff suppressed because it is too large Load Diff

View File

@ -1,566 +0,0 @@
@ignore
This file documents the end user interface to the GNU command line
editing feautres. It is to be an appendix to manuals for programs which
use these features. There is a document entitled "readline.texinfo"
which contains both end-user and programmer documentation for the GNU
Readline Library.
Copyright (C) 1988 Free Software Foundation, Inc.
Authored by Brian Fox.
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 make and distribute verbatim copies of this manual
provided the copyright notice and this permission notice are preserved on
all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided 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 Command Line Editing
@appendix Command Line Editing
This text describes GNU's command line editing interface.
@menu
* Introduction and Notation:: Notation used in this text.
* Readline Interaction:: The minimum set of commands for editing a line.
* Readline Init File:: Customizing Readline from a user's view.
@end menu
@node Introduction and Notation
@section Introduction to Line Editing
The following paragraphs describe the notation we use to represent
keystrokes.
The text @key{C-k} is read as `Control-K' and describes the character
produced when the Control key is depressed and the @key{k} key is struck.
The text @key{M-k} is read as `Meta-K' and describes the character
produced when the meta key (if you have one) is depressed, and the @key{k}
key is struck. If you do not have a meta key, the identical keystroke
can be generated by typing @key{ESC} @i{first}, and then typing @key{k}.
Either process is known as @dfn{metafying} the @key{k} key.
The text @key{M-C-k} is read as `Meta-Control-k' and describes the
character produced by @dfn{metafying} @key{C-k}.
In addition, several keys have their own names. Specifically,
@key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} all
stand for themselves when seen in this text, or in an init file
(@pxref{Readline Init File}, for more info).
@node Readline Interaction
@section Readline Interaction
@cindex interaction, readline
Often during an interactive session you type in a long line of text,
only to notice that the first word on the line is misspelled. The
Readline library gives you a set of commands for manipulating the text
as you type it in, allowing you to just fix your typo, and not forcing
you to retype the majority of the line. Using these editing commands,
you move the cursor to the place that needs correction, and delete or
insert the text of the corrections. Then, when you are satisfied with
the line, you simply press @key{RET}. You do not have to be at the
end of the line to press @key{RET}; the entire line is accepted
regardless of the location of the cursor within the line.
@menu
* Readline Bare Essentials:: The least you need to know about Readline.
* Readline Movement Commands:: Moving about the input line.
* Readline Killing Commands:: How to delete text, and how to get it back!
* Readline Arguments:: Giving numeric arguments to commands.
@end menu
@node Readline Bare Essentials
@subsection Readline Bare Essentials
In order to enter characters into the line, simply type them. The typed
character appears where the cursor was, and then the cursor moves one
space to the right. If you mistype a character, you can use @key{DEL} to
back up, and delete the mistyped character.
Sometimes you may miss typing a character that you wanted to type, and
not notice your error until you have typed several other characters. In
that case, you can type @key{C-b} to move the cursor to the left, and then
correct your mistake. Aftwerwards, you can move the cursor to the right
with @key{C-f}.
When you add text in the middle of a line, you will notice that characters
to the right of the cursor get `pushed over' to make room for the text
that you have inserted. Likewise, when you delete text behind the cursor,
characters to the right of the cursor get `pulled back' to fill in the
blank space created by the removal of the text. A list of the basic bare
essentials for editing the text of an input line follows.
@table @asis
@item @key{C-b}
Move back one character.
@item @key{C-f}
Move forward one character.
@item @key{DEL}
Delete the character to the left of the cursor.
@item @key{C-d}
Delete the character underneath the cursor.
@item @w{Printing characters}
Insert itself into the line at the cursor.
@item @key{C-_}
Undo the last thing that you did. You can undo all the way back to an
empty line.
@end table
@node Readline Movement Commands
@subsection Readline Movement Commands
The above table describes the most basic possible keystrokes that you need
in order to do editing of the input line. For your convenience, many
other commands have been added in addition to @key{C-b}, @key{C-f},
@key{C-d}, and @key{DEL}. Here are some commands for moving more rapidly
about the line.
@table @key
@item C-a
Move to the start of the line.
@item C-e
Move to the end of the line.
@item M-f
Move forward a word.
@item M-b
Move backward a word.
@item C-l
Clear the screen, reprinting the current line at the top.
@end table
Notice how @key{C-f} moves forward a character, while @key{M-f} moves
forward a word. It is a loose convention that control keystrokes
operate on characters while meta keystrokes operate on words.
@node Readline Killing Commands
@subsection Readline Killing Commands
@dfn{Killing} text means to delete the text from the line, but to save
it away for later use, usually by @dfn{yanking} it back into the line.
If the description for a command says that it `kills' text, then you can
be sure that you can get the text back in a different (or the same)
place later.
Here is the list of commands for killing text.
@table @key
@item C-k
Kill the text from the current cursor position to the end of the line.
@item M-d
Kill from the cursor to the end of the current word, or if between
words, to the end of the next word.
@item M-DEL
Kill from the cursor to the start of the previous word, or if between
words, to the start of the previous word.
@item C-w
Kill from the cursor to the previous whitespace. This is different than
@key{M-DEL} because the word boundaries differ.
@end table
And, here is how to @dfn{yank} the text back into the line.
@table @key
@item C-y
Yank the most recently killed text back into the buffer at the cursor.
@item M-y
Rotate the kill-ring, and yank the new top. You can only do this if
the prior command is @key{C-y} or @key{M-y}.
@end table
When you use a kill command, the text is saved in a @dfn{kill-ring}.
Any number of consecutive kills save all of the killed text together, so
that when you yank it back, you get it in one clean sweep. The kill
ring is not line specific; the text that you killed on a previously
typed line is available to be yanked back later, when you are typing
another line.
@node Readline Arguments
@subsection Readline Arguments
You can pass numeric arguments to Readline commands. Sometimes the
argument acts as a repeat count, other times it is the @i{sign} of the
argument that is significant. If you pass a negative argument to a
command which normally acts in a forward direction, that command will
act in a backward direction. For example, to kill text back to the
start of the line, you might type @key{M--} @key{C-k}.
The general way to pass numeric arguments to a command is to type meta
digits before the command. If the first `digit' you type is a minus
sign (@key{-}), then the sign of the argument will be negative. Once
you have typed one meta digit to get the argument started, you can type
the remainder of the digits, and then the command. For example, to give
the @key{C-d} command an argument of 10, you could type @key{M-1 0 C-d}.
@node Readline Init File
@section Readline Init File
Although the Readline library comes with a set of @sc{gnu} Emacs-like
keybindings, it is possible that you would like to use a different set
of keybindings. You can customize programs that use Readline by putting
commands in an @dfn{init} file in your home directory. The name of this
file is @file{~/.inputrc}.
When a program which uses the Readline library starts up, the
@file{~/.inputrc} file is read, and the keybindings are set.
In addition, the @key{C-x C-r} command re-reads this init file, thus
incorporating any changes that you might have made to it.
@menu
* Readline Init Syntax:: Syntax for the commands in @file{~/.inputrc}.
* Readline vi Mode:: Switching to @code{vi} mode in Readline.
@end menu
@node Readline Init Syntax
@subsection Readline Init Syntax
There are only four constructs allowed in the @file{~/.inputrc}
file:
@table @asis
@item Variable Settings
You can change the state of a few variables in Readline. You do this by
using the @code{set} command within the init file. Here is how you
would specify that you wish to use @code{vi} line editing commands:
@example
set editing-mode vi
@end example
Right now, there are only a few variables which can be set; so few in
fact, that we just iterate them here:
@table @code
@item editing-mode
@vindex editing-mode
The @code{editing-mode} variable controls which editing mode you are
using. By default, @sc{gnu} Readline starts up in Emacs editing mode, where
the keystrokes are most similar to Emacs. This variable can either be
set to @code{emacs} or @code{vi}.
@item horizontal-scroll-mode
@vindex horizontal-scroll-mode
This variable can either be set to @code{On} or @code{Off}. Setting it
to @code{On} means that the text of the lines that you edit will scroll
horizontally on a single screen line when they are larger than the width
of the screen, instead of wrapping onto a new screen line. By default,
this variable is set to @code{Off}.
@item mark-modified-lines
@vindex mark-modified-lines
This variable when set to @code{On}, says to display an asterisk
(@samp{*}) at the starts of history lines which have been modified.
This variable is off by default.
@item prefer-visible-bell
@vindex prefer-visible-bell
If this variable is set to @code{On} it means to use a visible bell if
one is available, rather than simply ringing the terminal bell. By
default, the value is @code{Off}.
@end table
@item Key Bindings
The syntax for controlling keybindings in the @file{~/.inputrc} file is
simple. First you have to know the @i{name} of the command that you
want to change. The following pages contain tables of the command name,
the default keybinding, and a short description of what the command
does.
Once you know the name of the command, simply place the name of the key
you wish to bind the command to, a colon, and then the name of the
command on a line in the @file{~/.inputrc} file. The name of the key
can be expressed in different ways, depending on which is most
comfortable for you.
@table @asis
@item @w{@var{keyname}: @var{function-name} or @var{macro}}
@var{keyname} is the name of a key spelled out in English. For example:
@example
Control-u: universal-argument
Meta-Rubout: backward-kill-word
Control-o: ">&output"
@end example
In the above example, @key{C-u} is bound to the function
@code{universal-argument}, and @key{C-o} is bound to run the macro
expressed on the right hand side (that is, to insert the text
@samp{>&output} into the line).
@item @w{"@var{keyseq}": @var{function-name} or @var{macro}}
@var{keyseq} differs from @var{keyname} above in that strings denoting
an entire key sequence can be specified. Simply place the key sequence
in double quotes. @sc{gnu} Emacs style key escapes can be used, as in the
following example:
@example
"\C-u": universal-argument
"\C-x\C-r": re-read-init-file
"\e[11~": "Function Key 1"
@end example
In the above example, @key{C-u} is bound to the function
@code{universal-argument} (just as it was in the first example),
@key{C-x C-r} is bound to the function @code{re-read-init-file}, and
@key{ESC [ 1 1 ~} is bound to insert the text @samp{Function Key 1}.
@end table
@end table
@menu
* Commands For Moving:: Moving about the line.
* Commands For History:: Getting at previous lines.
* Commands For Text:: Commands for changing text.
* Commands For Killing:: Commands for killing and yanking.
* Numeric Arguments:: Specifying numeric arguments, repeat counts.
* Commands For Completion:: Getting Readline to do the typing for you.
* Miscellaneous Commands:: Other miscillaneous commands.
@end menu
@need 2000
@node Commands For Moving
@subsubsection Commands For Moving
@ftable @code
@item beginning-of-line (@key{C-a})
Move to the start of the current line.
@item end-of-line (@key{C-e})
Move to the end of the line.
@item forward-char (@key{C-f})
Move forward a character.
@item backward-char (@key{C-b})
Move back a character.
@item forward-word (@key{M-f})
Move forward to the end of the next word.
@item backward-word (@key{M-b})
Move back to the start of this, or the previous, word.
@item clear-screen (@key{C-l})
Clear the screen leaving the current line at the top of the screen.
@end ftable
@need 2000
@node Commands For History
@subsubsection Commands For Manipulating The History
@ftable @code
@item accept-line (Newline, Return)
Accept the line regardless of where the cursor is. If this line is
non-empty, add it to the history list. If this line was a history
line, then restore the history line to its original state.
@item previous-history (@key{C-p})
Move `up' through the history list.
@item next-history (@key{C-n})
Move `down' through the history list.
@item beginning-of-history (@key{M-<})
Move to the first line in the history.
@item end-of-history (@key{M->})
Move to the end of the input history, i.e., the line you are entering.
@item reverse-search-history (@key{C-r})
Search backward starting at the current line and moving `up' through
the history as necessary. This is an incremental search.
@item forward-search-history (@key{C-s})
Search forward starting at the current line and moving `down' through
the the history as necessary.
@end ftable
@need 2000
@node Commands For Text
@subsubsection Commands For Changing Text
@ftable @code
@item delete-char (@key{C-d})
Delete the character under the cursor. If the cursor is at the
beginning of the line, and there are no characters in the line, and
the last character typed was not @key{C-d}, then return EOF.
@item backward-delete-char (Rubout)
Delete the character behind the cursor. A numeric argument says to kill
the characters instead of deleting them.
@item quoted-insert (@key{C-q}, @key{C-v})
Add the next character that you type to the line verbatim. This is
how to insert things like @key{C-q} for example.
@item tab-insert (@key{M-TAB})
Insert a tab character.
@item self-insert (a, b, A, 1, !, ...)
Insert yourself.
@item transpose-chars (@key{C-t})
Drag the character before point forward over the character at point.
Point moves forward as well. If point is at the end of the line, then
transpose the two characters before point. Negative arguments don't work.
@item transpose-words (@key{M-t})
Drag the word behind the cursor past the word in front of the cursor
moving the cursor over that word as well.
@item upcase-word (@key{M-u})
Uppercase all letters in the current (or following) word. With a
negative argument, do the previous word, but do not move point.
@item downcase-word (@key{M-l})
Lowercase all letters in the current (or following) word. With a
negative argument, do the previous word, but do not move point.
@item capitalize-word (@key{M-c})
Uppercase the first letter in the current (or following) word. With a
negative argument, do the previous word, but do not move point.
@end ftable
@need 2000
@node Commands For Killing
@subsubsection Killing And Yanking
@ftable @code
@item kill-line (@key{C-k})
Kill the text from the current cursor position to the end of the line.
@item backward-kill-line ()
Kill backward to the beginning of the line. This is normally unbound.
@item kill-word (@key{M-d})
Kill from the cursor to the end of the current word, or if between
words, to the end of the next word.
@item backward-kill-word (@key{M-DEL})
Kill the word behind the cursor.
@item unix-line-discard (@key{C-u})
Kill the whole line the way @key{C-u} used to in Unix line input.
The killed text is saved on the kill-ring.
@item unix-word-rubout (@key{C-w})
Kill the word the way @key{C-w} used to in Unix line input.
The killed text is saved on the kill-ring. This is different than
backward-kill-word because the word boundaries differ.
@item yank (@key{C-y})
Yank the top of the kill ring into the buffer at point.
@item yank-pop (@key{M-y})
Rotate the kill-ring, and yank the new top. You can only do this if
the prior command is yank or yank-pop.
@end ftable
@need 2000
@node Numeric Arguments
@subsubsection Specifying Numeric Arguments
@ftable @code
@item digit-argument (@key{M-0}, @key{M-1}, ... @key{M--})
Add this digit to the argument already accumulating, or start a new
argument. @key{M--} starts a negative argument.
@item universal-argument ()
Do what @key{C-u} does in @sc{gnu} Emacs. By default, this is not bound.
@end ftable
@need 2000
@node Commands For Completion
@subsubsection Letting Readline Type For You
@ftable @code
@item complete (TAB)
Attempt to do completion on the text before point. This is
implementation defined. Generally, if you are typing a filename
argument, you can do filename completion; if you are typing a command,
you can do command completion, if you are typing in a symbol to GDB, you
can do symbol name completion, if you are typing in a variable to Bash,
you can do variable name completion.
@item possible-completions (M-?)
List the possible completions of the text before point.
@end ftable
@need 2000
@node Miscellaneous Commands
@subsubsection Some Miscellaneous Commands
@ftable @code
@item re-read-init-file (@key{C-x} @key{C-r})
Read in the contents of your @file{~/.inputrc} file, and incorporate
any bindings found there.
@item abort (@key{C-g})
Stop running the current editing command.
@ignore
@c I have no idea what this means, and can't figure it out by
@c experiment, and can't find it in the readline source.
@c doc@cygnus.com, 20may1993.
@item do-uppercase-version (@key{M-a}, @key{M-b}, ...)
Run the command that is bound to your uppercase brother.
@end ignore
@item prefix-meta (ESC)
Make the next character that you type be metafied. This is for people
without a meta key. Typing @key{ESC f} is equivalent to typing
@key{M-f}.
@item undo (@key{C-_})
Incremental undo, separately remembered for each line.
@item revert-line (@key{M-r})
Undo all changes made to this line. This is like typing the `undo'
command enough times to get back to the beginning.
@end ftable
@need 2000
@node Readline vi Mode
@subsection Readline @code{vi} Mode
@cindex @code{vi} style command editing
@kindex toggle-editing-mode
While the Readline library does not have a full set of @code{vi} editing
functions, it does contain enough to allow simple editing of the line.
In order to switch interactively between @sc{gnu} Emacs and @code{vi}
editing modes, use the command @key{M-C-j} (toggle-editing-mode).
When you enter a line in @code{vi} mode, you are already placed in `insertion'
mode, as if you had typed an `i'. Pressing @key{ESC} switches you into
`edit' mode, where you can edit the text of the line with the standard
@code{vi} movement keys, move to previous history lines with `k', and following
lines with `j', and so forth.