Commit 8491377b by Jeff Law

This commit was generated by cvs2svn to compensate for changes in r18765,

which included commits to RCS files with non-trunk default branches.

From-SVN: r18766
parent 7e98cc16
Texinfo, Version 3 This is the README file for the GNU Texinfo distribution.
==================
Please email bugs or suggestions to bug-texinfo@prep.ai.mit.edu.
This is the README file for version 3 of the Texinfo distribution.
Files within this distribution have their own version and edition Files within this distribution have their own version and edition
numbers. When you refer to a file, please mention its own number, as numbers. When you refer to a file, please mention its own version, as
well as the version number of the Texinfo distribution. well as the version number of the Texinfo distribution.
PLEASE REPORT BUGS TO: bug-texinfo@prep.ai.mit.edu For instructions on compiling and installing info, makeinfo, texi2dvi,
and texindex, please read the file `INSTALL'. Also:
* The Emacs Lisp files are not compiled or installed by default; to
install them, use `make install' in the `emacs' subdirectory. See
./emacs/README for some considerations.
* The Info tree uses a file `dir' as its root node; the `dir-example'
file in this distribution is included for informative purposes.
Use it or not as you like.
* You can create a file texinfo.cnf to be read by TeX when
processing Texinfo manuals. For example, it might contain the
command @afourpaper. See the `Preparing for TeX' node in
texinfo.texi for more details.
Texinfo is a documentation system that uses a single source file to Texinfo is a documentation system that uses a single source file to
produce both on-line information and printed output. This means that produce both online information and printed output. This means that
instead of writing two different documents, one for the on-line help instead of writing two different documents, one for the online help or
or other on-line information and the other for a typeset manual or other online information and the other for a typeset manual or other
other printed work, you need write only one document. When the work printed work, you need write only one document. When the work is
is revised, you need revise only one document. You can read the revised, you need revise only one document. You can read the online
on-line information, known as an "Info file", with an Info information, known as an "Info file", with an Info documentation-reading
documentation-reading program. By convention, Texinfo source file program. By convention, Texinfo source file names end with a `.texi' or
names end with a `.texi' or `.texinfo' extension. Texinfo is `.texinfo' extension. Texinfo is described in the Texinfo manual (the
described in the Texinfo manual (the file ./texinfo.texi). file ./doc/texinfo.texi).
You can write and format Texinfo files into Info files within GNU Emacs, 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, and read them using the Emacs Info reader. If you do not have Emacs,
...@@ -26,22 +41,15 @@ them using `info'. Use TeX, which is not included in this package (see ...@@ -26,22 +41,15 @@ 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 `How to Obtain TeX' in the Texinfo manual for information), to typeset
Texinfo files for printing. 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: This distribution includes (but is not limited to) the following files:
README This file. README This file.
INTRODUCTION This file tells you how to create INTRODUCTION This file tells you how to create
readable files from the Texinfo source readable files from the Texinfo source
files in this distribution. files in this distribution.
Texinfo source files: Texinfo source files (in ./doc):
texinfo.texi This manual describes Texinfo. It texinfo.texi This manual describes Texinfo. It
tells how to use Texinfo to write tells how to use Texinfo to write
...@@ -61,15 +69,8 @@ Texinfo source files: ...@@ -61,15 +69,8 @@ Texinfo source files:
info-stnd.texi This manual tells you how to use info-stnd.texi This manual tells you how to use
the standalone GNU Info reader that is the standalone GNU Info reader that is
included in this distribution as a C included in this distribution as C
source file, `info.c'. source (./info).
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: Printing related files:
...@@ -78,18 +79,18 @@ Printing related files: ...@@ -78,18 +79,18 @@ Printing related files:
Texinfo file into a DVI file ready for Texinfo file into a DVI file ready for
printing. printing.
texindex.c This file contains the source for util/texindex.c This file contains the source for
the `texindex' program that generates the `texindex' program that generates
sorted indices used by TeX when sorted indices used by TeX when
typesetting a file for printing. typesetting a file for printing.
texi2dvi This is a shell script for util/texi2dvi This is a shell script for
producing an indexed DVI file using producing an indexed DVI file using
TeX and texindex. Must be used if the TeX and texindex. Must be used if the
source document uses Texinfo @macros. source document uses Texinfo @macros.
GNU Emacs related files: GNU Emacs related files (in ./emacs):
texinfmt.el This Emacs Lisp file provides the texinfmt.el This Emacs Lisp file provides the
functions that GNU Emacs uses to functions that GNU Emacs uses to
...@@ -100,19 +101,15 @@ GNU Emacs related files: ...@@ -100,19 +101,15 @@ GNU Emacs related files:
for GNU Emacs. for GNU Emacs.
texnfo-upd.el These files provides commands to texnfo-upd.el These files provides commands to
texnfo-tex.el help you write Texinfo files makeinfo.el help you write Texinfo files
makeinfo.el using GNU Emacs Texinfo mode. 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 info.el These are the standard GNU Emacs
informat.el Info reading and support files, informat.el Info reading and support files,
included here for your convenience. included here for your convenience.
Source files for standalone C programs: Source files for standalone C programs (./lib, ./makeinfo, ./info):
makeinfo.c This file contains the source for makeinfo.c This file contains the source for
the `makeinfo' program that you can the `makeinfo' program that you can
...@@ -128,7 +125,7 @@ Source files for standalone C programs: ...@@ -128,7 +125,7 @@ Source files for standalone C programs:
getopt.h getopt.h
C Installation files: Installation files:
configure This file creates creates a Makefile configure This file creates creates a Makefile
which in turn creates an `info' or which in turn creates an `info' or
...@@ -136,10 +133,14 @@ C Installation files: ...@@ -136,10 +133,14 @@ C Installation files:
distribution. distribution.
configure.in This is a template for creating configure.in This is a template for creating
`configure' using m4 macros. `configure' using Autoconf.
Makefile.in This is a template for `configure' Makefile.in This is a template for `configure'
to use to make a Makefile. to use to make a Makefile. Created by
Automake.
Makefile.am This is a template for Automake
to use to make a Makefile.in.
Other files: Other files:
...@@ -148,10 +149,6 @@ Other files: ...@@ -148,10 +149,6 @@ Other files:
features since the first edition features since the first edition
of Texinfo. 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 fixfonts This is a shell script to install the
`lcircle10' TeX fonts as an alias for `lcircle10' TeX fonts as an alias for
the `circle10' fonts. In some older the `circle10' fonts. In some older
......
If you are interested in working on any of these, If you are interested in working on any of these,
email bug-texinfo@prep.ai.mit.edu. email bug-texinfo@prep.ai.mit.edu.
* Use Automake. * Makeinfo:
- HTML output.
- A detexinfo program, like detex or delatex. This command would
strip all the texinfo commands out, and would be used as a filter on
the way to a speller. An option would be to NOT strip comments out.
makeinfo --no-headers comes close.
- If node name contains an @ command, complain explicitly.
- Better ASCII output: convert menus to single table of contents,
enumerate chapters and sections, convert cross-refs and indices to
chapter/section references. See:
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/faq201s.zip
* Use a config header file instead of @DEFS@. n* TeX:
- Use @ as the escape character, and Texinfo syntax generally, in the
table of contents, aux, and index files. Eliminate all the crazy
multiple redefinitions of every Texinfo command in different contexts.
- Handle @hsep and @vsep in @multitables.
* A detexinfo program, like detex or delatex. This command would * General:
strip all the texinfo commands out, and would be used as a filter on - Better i18n support, including support for 8-bit input characters,
the way to a speller. An option would be to NOT strip comments out. and 8-bit output in info. Perhaps have to use the ec fonts.
makeinfo --no-headers come close. - Support compressed image files, automatic generation of .txt
or .jpg from .eps by Ghostscript.
- Repeat TeX run until cross-references stabilize, not just twice.
(Document this in manual and fix texi2dvi.)
- Handle reference card creation, perhaps by only paying attention to
sectioning and @def... commands.
- Allow : in node names for info files, for names like `class::method'.
- Get Info declared as a MIME Content-Type.
* Change bars. This is difficult or impossible in TeX, * Language:
unfortunately. To do it right requires device driver support. - @figure:
@figure [xref-label]
@figureinclude <filename>, [<height>], [<width>]
@figurehsize <dimen>
@figurevsize <dimen>
@caption ... @end caption
<arbitrary Texinfo commands>
@end figure
- @flushboth to combine @flushleft and @flushright, for RFC's.
- @part sectioning command.
- Anchors a la HTML?
- Allow subitems and `see' and `see also' in indices.
- @exercise/@answer command for, e.g., gawk.
- Allow @hsep/@vsep at @item, instead of just in template.
- The dark corner symbol for the gawk manual.
- 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. * Doc:
- Include a complete functional summary, as in a reference card, in
the manual.
- Improve the manuals for makeinfo, standalone info, etc.
- Page 39, need a new section on doing dedication pages. See gawk.texi
for an example of doing it in both the tex and info versions.
* Better i18n support, including support for 8-bit input * Info:
characters. Requires fonts, and the DC fonts are not (as of this - Search all nodes of dir file at startup, then can have
writing) free. INFO-DIR-SEPARATE-GROUPS and other such.
- Better dir file merging.
- Steal interface ideas from Lynx: TAB for navigating to next link
within a page, number links, etc.
- q within help should quit help like C-x 0.
- Full-text search on all available info files.
- Incorporate an X-based viewer, perhaps tkinfo:
http://www.math.ucsb.edu/~boldt/tkinfo/.
- Perhaps process Texinfo files directly instead of converting to Info:
ftp://ftp.cs.berkeley.edu/ucb/people/phelps/tcltk/tkman.tar.Z
+ ftp://ftp.cs.berkeley.edu/ucb/people/phelps/tcltk/rman.tar.Z
+ Tcl/Tk 8.0 from ftp.smli.com in the /pub/tcl directory.
From: phelps@ecstasy.CS.Berkeley.EDU (Tom Phelps)
* @exercise/@answer command for, e.g., gawk. * Install-info:
- be able to copy the info file to compile-time $(infodir), to
* @figure. simplify by-hand installation.
* 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.
# Makefile for Texinfo/emacs. # Makefile.in generated automatically by automake 1.2 from Makefile.am
# Copyright (C) 1995, 96 Free Software Foundation, Inc.
# $Id: Makefile.in,v 1.1 1997/08/21 22:57:56 jason 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 (bfox@ai.mit.edu)
#
srcdir = @srcdir@ # Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
VPATH = @srcdir@ # This Makefile.in is free software; the Free Software Foundation
SHELL = /bin/sh # gives unlimited permission to copy, distribute and modify it.
RM = rm -f
# Do not byte compile our Elisp files by default.
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 SHELL = /bin/sh
.el.elc: srcdir = @srcdir@
$(srcdir)/elisp-comp $< top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = true
PRE_INSTALL = true
POST_INSTALL = true
NORMAL_UNINSTALL = true
PRE_UNINSTALL = true
POST_UNINSTALL = true
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
DATADIRNAME = @DATADIRNAME@
EXEEXT = @EXEEXT@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
PACKAGE = @PACKAGE@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
TERMLIBS = @TERMLIBS@
TEXCONFIG = @TEXCONFIG@
TEXMF = @TEXMF@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
l = @l@
ELCFILES =
# Do not install our Elisp files by default, either.
noinst_LISP = info.el informat.el makeinfo.el \
texinfmt.el texinfo.el texnfo-upd.el
EXTRA_DIST = README elisp-comp new-useful-setqs $(noinst_LISP)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
LISP = $(noinst_LISP)
lispdir = @lispdir@
EMACS = @EMACS@
DIST_COMMON = README Makefile.am Makefile.in elisp-comp
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP = --best
default: all
.SUFFIXES:
.SUFFIXES: .el .elc
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --cygnus emacs/Makefile
all: Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
sub-all: all cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
.el.elc:
@echo 'WARNING: Warnings can be ignored. :-)'
if test $(EMACS) != no; then \
EMACS=$(EMACS) $(SHELL) $(srcdir)/elisp-comp $<; \
fi
tags: TAGS
TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = emacs
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file; \
done
info:
dvi: dvi:
check: all
$(MAKE)
installcheck:
install-info: install-info:
install-exec:
@$(NORMAL_INSTALL)
install-data: install-data-local
@$(NORMAL_INSTALL)
install: install-exec install-data all
@:
uninstall:
all: Makefile $(LISP) $(ELCFILES)
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
mostlyclean-generic:
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
rm -f Makefile $(DISTCLEANFILES)
rm -f config.cache config.log stamp-h stamp-h[0-9]*
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-lisp mostlyclean-generic
clean: clean-lisp clean-generic mostlyclean
distclean: distclean-lisp distclean-generic clean
rm -f config.status
maintainer-clean: maintainer-clean-lisp maintainer-clean-generic \
distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
.PHONY: default mostlyclean-lisp distclean-lisp clean-lisp \
maintainer-clean-lisp tags distdir info dvi installcheck install-info \
install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
install-data-local:
@echo "WARNING: You must (compile and) install the Emacs Lisp files"
@echo "WARNING: manually. See ./emacs/README for some considerations."
elisp: $(ELISP_OBJS) # For some reason these do not get defined.
.PHONY: elisp distclean-lisp:
clean-lisp:
# Nobody likes any of these install targets. Fine. Install it mostlyclean-lisp:
# 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:
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
...@@ -71,7 +71,8 @@ ...@@ -71,7 +71,8 @@
(delete-region (point) end))) (delete-region (point) end)))
(goto-char (point-max)) (goto-char (point-max))
(insert "\^_\f\nTag table:\n") (insert "\^_\f\nTag table:\n")
(move-marker Info-tag-table-marker (point)) (if (eq major-mode 'info-mode)
(move-marker Info-tag-table-marker (point)))
(setq list (nreverse list)) (setq list (nreverse list))
(while list (while list
(insert "Node: " (car (car list)) ?\177) (insert "Node: " (car (car list)) ?\177)
...@@ -152,6 +153,10 @@ contains just the tag table and a directory of subfiles." ...@@ -152,6 +153,10 @@ contains just the tag table and a directory of subfiles."
(search-forward "\nTag Table:\n") (search-forward "\nTag Table:\n")
(insert "(Indirect)\n"))) (insert "(Indirect)\n")))
(defvar Info-validate-allnodes)
(defvar Info-validate-thisnode)
(defvar Info-validate-lossages)
;;;###autoload ;;;###autoload
(defun Info-validate () (defun Info-validate ()
"Check current buffer for validity as an Info file. "Check current buffer for validity as an Info file.
...@@ -165,76 +170,77 @@ Check that every node pointer points to an existing node." ...@@ -165,76 +170,77 @@ Check that every node pointer points to an existing node."
(error "Don't yet know how to validate indirect info files: \"%s\"" (error "Don't yet know how to validate indirect info files: \"%s\""
(buffer-name (current-buffer)))) (buffer-name (current-buffer))))
(goto-char (point-min)) (goto-char (point-min))
(let ((allnodes '(("*"))) (let ((Info-validate-allnodes '(("*")))
(regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]") (regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]")
(case-fold-search t) (case-fold-search t)
(tags-losing nil) (tags-losing nil)
(lossages ())) (Info-validate-lossages ()))
(while (search-forward "\n\^_" nil t) (while (search-forward "\n\^_" nil t)
(forward-line 1) (forward-line 1)
(let ((beg (point))) (let ((beg (point)))
(forward-line 1) (forward-line 1)
(if (re-search-backward regexp beg t) (if (re-search-backward regexp beg t)
(let ((name (downcase (let ((name (downcase
(buffer-substring-no-properties (buffer-substring-no-properties
(match-beginning 1) (match-beginning 1)
(progn (progn
(goto-char (match-end 1)) (goto-char (match-end 1))
(skip-chars-backward " \t") (skip-chars-backward " \t")
(point)))))) (point))))))
(if (assoc name allnodes) (if (assoc name Info-validate-allnodes)
(setq lossages (setq Info-validate-lossages
(cons (list name "Duplicate node-name" nil) (cons (list name "Duplicate node-name" nil)
lossages)) Info-validate-lossages))
(setq allnodes (setq Info-validate-allnodes
(cons (list name (cons (list name
(progn (progn
(end-of-line) (end-of-line)
(and (re-search-backward (and (re-search-backward
"prev[ious]*:" beg t) "prev[ious]*:" beg t)
(progn (progn
(goto-char (match-end 0)) (goto-char (match-end 0))
(downcase (downcase
(Info-following-node-name))))) (Info-following-node-name)))))
beg) beg)
allnodes))))))) Info-validate-allnodes)))))))
(goto-char (point-min)) (goto-char (point-min))
(while (search-forward "\n\^_" nil t) (while (search-forward "\n\^_" nil t)
(forward-line 1) (forward-line 1)
(let ((beg (point)) (let ((beg (point))
thisnode next) Info-validate-thisnode next)
(forward-line 1) (forward-line 1)
(if (re-search-backward regexp beg t) (if (re-search-backward regexp beg t)
(save-restriction (save-restriction
(search-forward "\n\^_" nil 'move) (search-forward "\n\^_" nil 'move)
(narrow-to-region beg (point)) (narrow-to-region beg (point))
(setq thisnode (downcase (setq Info-validate-thisnode (downcase
(buffer-substring-no-properties (buffer-substring-no-properties
(match-beginning 1) (match-beginning 1)
(progn (progn
(goto-char (match-end 1)) (goto-char (match-end 1))
(skip-chars-backward " \t") (skip-chars-backward " \t")
(point))))) (point)))))
(end-of-line) (end-of-line)
(and (search-backward "next:" nil t) (and (search-backward "next:" nil t)
(setq next (Info-validate-node-name "invalid Next")) (setq next (Info-validate-node-name "invalid Next"))
(assoc next allnodes) (assoc next Info-validate-allnodes)
(if (equal (car (cdr (assoc next allnodes))) (if (equal (car (cdr (assoc next Info-validate-allnodes)))
thisnode) Info-validate-thisnode)
;; allow multiple `next' pointers to one node ;; allow multiple `next' pointers to one node
(let ((tem lossages)) (let ((tem Info-validate-lossages))
(while tem (while tem
(if (and (equal (car (cdr (car tem))) (if (and (equal (car (cdr (car tem)))
"should have Previous") "should have Previous")
(equal (car (car tem)) (equal (car (car tem))
next)) next))
(setq lossages (delq (car tem) lossages))) (setq Info-validate-lossages
(delq (car tem) Info-validate-lossages)))
(setq tem (cdr tem)))) (setq tem (cdr tem))))
(setq lossages (setq Info-validate-lossages
(cons (list next (cons (list next
"should have Previous" "should have Previous"
thisnode) Info-validate-thisnode)
lossages)))) Info-validate-lossages))))
(end-of-line) (end-of-line)
(if (re-search-backward "prev[ious]*:" nil t) (if (re-search-backward "prev[ious]*:" nil t)
(Info-validate-node-name "invalid Previous")) (Info-validate-node-name "invalid Previous"))
...@@ -244,12 +250,12 @@ Check that every node pointer points to an existing node." ...@@ -244,12 +250,12 @@ Check that every node pointer points to an existing node."
(if (re-search-forward "\n* Menu:" nil t) (if (re-search-forward "\n* Menu:" nil t)
(while (re-search-forward "\n\\* " nil t) (while (re-search-forward "\n\\* " nil t)
(Info-validate-node-name (Info-validate-node-name
(concat "invalid menu item " (concat "invalid menu item "
(buffer-substring (point) (buffer-substring (point)
(save-excursion (save-excursion
(skip-chars-forward "^:") (skip-chars-forward "^:")
(point)))) (point))))
(Info-extract-menu-node-name)))) (Info-extract-menu-node-name))))
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "\\*note[ \n]*[^:\t]*:" nil t) (while (re-search-forward "\\*note[ \n]*[^:\t]*:" nil t)
(goto-char (+ (match-beginning 0) 5)) (goto-char (+ (match-beginning 0) 5))
...@@ -262,29 +268,29 @@ Check that every node pointer points to an existing node." ...@@ -262,29 +268,29 @@ Check that every node pointer points to an existing node."
(point)))) (point))))
(Info-extract-menu-node-name "Bad format cross-reference"))))))) (Info-extract-menu-node-name "Bad format cross-reference")))))))
(setq tags-losing (not (Info-validate-tags-table))) (setq tags-losing (not (Info-validate-tags-table)))
(if (or lossages tags-losing) (if (or Info-validate-lossages tags-losing)
(with-output-to-temp-buffer " *problems in info file*" (with-output-to-temp-buffer " *problems in info file*"
(while lossages (while Info-validate-lossages
(princ "In node \"") (princ "In node \"")
(princ (car (car lossages))) (princ (car (car Info-validate-lossages)))
(princ "\", ") (princ "\", ")
(let ((tem (nth 1 (car lossages)))) (let ((tem (nth 1 (car Info-validate-lossages))))
(cond ((string-match "\n" tem) (cond ((string-match "\n" tem)
(princ (substring tem 0 (match-beginning 0))) (princ (substring tem 0 (match-beginning 0)))
(princ "...")) (princ "..."))
(t (t
(princ tem)))) (princ tem))))
(if (nth 2 (car lossages)) (if (nth 2 (car Info-validate-lossages))
(progn (progn
(princ ": ") (princ ": ")
(let ((tem (nth 2 (car lossages)))) (let ((tem (nth 2 (car Info-validate-lossages))))
(cond ((string-match "\n" tem) (cond ((string-match "\n" tem)
(princ (substring tem 0 (match-beginning 0))) (princ (substring tem 0 (match-beginning 0)))
(princ "...")) (princ "..."))
(t (t
(princ tem)))))) (princ tem))))))
(terpri) (terpri)
(setq lossages (cdr lossages))) (setq Info-validate-lossages (cdr Info-validate-lossages)))
(if tags-losing (princ "\nTags table must be recomputed\n"))) (if tags-losing (princ "\nTags table must be recomputed\n")))
;; Here if info file is valid. ;; Here if info file is valid.
;; If we already made a list of problems, clear it out. ;; If we already made a list of problems, clear it out.
...@@ -306,16 +312,17 @@ Check that every node pointer points to an existing node." ...@@ -306,16 +312,17 @@ Check that every node pointer points to an existing node."
(buffer-substring-no-properties (buffer-substring-no-properties
(point) (point)
(progn (progn
(skip-chars-forward "^,\t\n") (skip-chars-forward "^,\t\n")
(skip-chars-backward " ") (skip-chars-backward " ")
(point)))))) (point))))))
(if (null name) (if (null name)
nil nil
(setq name (downcase name)) (setq name (downcase name))
(or (and (> (length name) 0) (= (aref name 0) ?\()) (or (and (> (length name) 0) (= (aref name 0) ?\())
(assoc name allnodes) (assoc name Info-validate-allnodes)
(setq lossages (setq Info-validate-lossages
(cons (list thisnode kind name) lossages)))) (cons (list Info-validate-thisnode kind name)
Info-validate-lossages))))
name) name)
(defun Info-validate-tags-table () (defun Info-validate-tags-table ()
...@@ -327,7 +334,7 @@ Check that every node pointer points to an existing node." ...@@ -327,7 +334,7 @@ Check that every node pointer points to an existing node."
(start (progn (search-backward "\nTag table:\n") (start (progn (search-backward "\nTag table:\n")
(1- (match-end 0)))) (1- (match-end 0))))
tem) tem)
(setq tem allnodes) (setq tem Info-validate-allnodes)
(while tem (while tem
(goto-char start) (goto-char start)
(or (equal (car (car tem)) "*") (or (equal (car (car tem)) "*")
...@@ -342,7 +349,7 @@ Check that every node pointer points to an existing node." ...@@ -342,7 +349,7 @@ Check that every node pointer points to an existing node."
(setq tem (downcase (buffer-substring-no-properties (setq tem (downcase (buffer-substring-no-properties
(match-beginning 1) (match-beginning 1)
(match-end 1)))) (match-end 1))))
(setq tem (assoc tem allnodes)) (setq tem (assoc tem Info-validate-allnodes))
(if (or (not tem) (if (or (not tem)
(< 1000 (progn (< 1000 (progn
(goto-char (match-beginning 2)) (goto-char (match-beginning 2))
...@@ -426,4 +433,6 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\"" ...@@ -426,4 +433,6 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
(error (message ">> Error: %s" (prin1-to-string err)))))) (error (message ">> Error: %s" (prin1-to-string err))))))
(kill-emacs error)))) (kill-emacs error))))
(provide 'informat)
;;; informat.el ends here ;;; informat.el ends here
...@@ -47,15 +47,24 @@ ...@@ -47,15 +47,24 @@
(require 'compile) (require 'compile)
(defvar makeinfo-run-command "makeinfo" (defgroup makeinfo nil
"Run makeinfo conveniently"
:group 'docs)
(defcustom makeinfo-run-command "makeinfo"
"*Command used to run `makeinfo' subjob. "*Command used to run `makeinfo' subjob.
The name of the file is appended to this string, separated by a space.") The name of the file is appended to this string, separated by a space."
:type 'string
:group 'makeinfo)
(defvar makeinfo-options "--fill-column=70" (defcustom makeinfo-options "--fill-column=70"
"*String containing options for running `makeinfo'. "*String containing options for running `makeinfo'.
Do not include `--footnote-style' or `--paragraph-indent'; Do not include `--footnote-style' or `--paragraph-indent';
the proper way to specify those is with the Texinfo commands the proper way to specify those is with the Texinfo commands
`@footnotestyle` and `@paragraphindent'.") `@footnotestyle` and `@paragraphindent'."
:type 'string
:group 'makeinfo)
(require 'texinfo) (require 'texinfo)
......
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 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 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 my second Unix program ever, and my die-hard machine language coding habits
......
/* dir.c -- How to build a special "dir" node from "localdir" files. */ /* dir.c -- How to build a special "dir" node from "localdir" files.
$Id: dir.c,v 1.6 1997/07/27 21:09:20 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation Copyright (C) 1993, 97 Free Software Foundation, Inc.
stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,13 +19,7 @@ ...@@ -21,13 +19,7 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#include <stdio.h> #include "info.h"
#include <sys/types.h>
#include <sys/stat.h>
#if defined (HAVE_SYS_FILE_H)
#include <sys/file.h>
#endif /* HAVE_SYS_FILE_H */
#include <sys/errno.h>
#include "info-utils.h" #include "info-utils.h"
#include "filesys.h" #include "filesys.h"
#include "tilde.h" #include "tilde.h"
...@@ -37,23 +29,53 @@ ...@@ -37,23 +29,53 @@
dirs_to_add which are found in INFOPATH. */ dirs_to_add which are found in INFOPATH. */
static void add_menu_to_file_buffer (), insert_text_into_fb_at_binding (); static void add_menu_to_file_buffer (), insert_text_into_fb_at_binding ();
static void build_dir_node_internal ();
static char *dirs_to_add[] = { static char *dirs_to_add[] = {
"dir", "localdir", (char *)NULL "dir", "localdir", (char *)NULL
}; };
/* Return zero if the file represented in the stat structure TEST has
already been seen, nonzero else. */
typedef struct
{
unsigned long device;
unsigned long inode;
} dir_file_list_entry_type;
static int
new_dir_file_p (test)
struct stat *test;
{
static unsigned dir_file_list_len = 0;
static dir_file_list_entry_type *dir_file_list = NULL;
unsigned i;
for (i = 0; i < dir_file_list_len; i++)
{
dir_file_list_entry_type entry;
entry = dir_file_list[i];
if (entry.device == test->st_dev && entry.inode == test->st_ino)
return 0;
}
dir_file_list_len++;
dir_file_list = xrealloc (dir_file_list,
dir_file_list_len * sizeof (dir_file_list_entry_type));
dir_file_list[dir_file_list_len - 1].device = test->st_dev;
dir_file_list[dir_file_list_len - 1].inode = test->st_ino;
return 1;
}
void void
maybe_build_dir_node (dirname) maybe_build_dir_node (dirname)
char *dirname; char *dirname;
{ {
FILE_BUFFER *dir_buffer;
int path_index, update_tags; int path_index, update_tags;
char *this_dir; char *this_dir;
FILE_BUFFER *dir_buffer = info_find_file (dirname);
/* Check to see if the file has already been built. If so, then
do not build it again. */
dir_buffer = info_find_file (dirname);
/* If there is no "dir" in the current info path, we cannot build one /* If there is no "dir" in the current info path, we cannot build one
from nothing. */ from nothing. */
...@@ -64,6 +86,10 @@ maybe_build_dir_node (dirname) ...@@ -64,6 +86,10 @@ maybe_build_dir_node (dirname)
if (dir_buffer->flags & N_CannotGC) if (dir_buffer->flags & N_CannotGC)
return; return;
/* Initialize the list we use to avoid reading the same dir file twice
with the dir file just found. */
new_dir_file_p (&dir_buffer->finfo);
path_index = update_tags = 0; path_index = update_tags = 0;
/* Using each element of the path, check for one of the files in /* Using each element of the path, check for one of the files in
...@@ -71,62 +97,56 @@ maybe_build_dir_node (dirname) ...@@ -71,62 +97,56 @@ maybe_build_dir_node (dirname)
Only files explictly named are eligible. This is a design decision. Only files explictly named are eligible. This is a design decision.
There can be an info file name "localdir.info" which contains There can be an info file name "localdir.info" which contains
information on the setting up of "localdir" files. */ information on the setting up of "localdir" files. */
while (this_dir = extract_colon_unit (infopath, &path_index)) while ((this_dir = extract_colon_unit (infopath, &path_index)))
{ {
register int da_index; register int da_index;
char *from_file; char *from_file;
/* Expand a leading tilde if one is present. */ /* Expand a leading tilde if one is present. */
if (*this_dir == '~') if (*this_dir == '~')
{ {
char *tilde_expanded_dirname; char *tilde_expanded_dirname;
tilde_expanded_dirname = tilde_expand_word (this_dir); tilde_expanded_dirname = tilde_expand_word (this_dir);
if (tilde_expanded_dirname != this_dir) if (tilde_expanded_dirname != this_dir)
{ {
free (this_dir); free (this_dir);
this_dir = tilde_expanded_dirname; this_dir = tilde_expanded_dirname;
} }
} }
/* For every file named in DIRS_TO_ADD found in the search path, /* For every different file named in DIRS_TO_ADD found in the
add the contents of that file's menu to our "dir" node. */ search path, add that file's menu to our "dir" node. */
for (da_index = 0; from_file = dirs_to_add[da_index]; da_index++) for (da_index = 0; (from_file = dirs_to_add[da_index]); da_index++)
{ {
struct stat finfo; struct stat finfo;
char *fullpath; int statable;
int namelen, statable; int namelen = strlen (from_file);
char *fullpath = xmalloc (3 + strlen (this_dir) + namelen);
namelen = strlen (from_file);
strcpy (fullpath, this_dir);
fullpath = (char *)xmalloc (3 + strlen (this_dir) + namelen); if (fullpath[strlen (fullpath) - 1] != '/')
strcpy (fullpath, this_dir); strcat (fullpath, "/");
if (fullpath[strlen (fullpath) - 1] != '/') strcat (fullpath, from_file);
strcat (fullpath, "/");
strcat (fullpath, from_file); statable = (stat (fullpath, &finfo) == 0);
statable = (stat (fullpath, &finfo) == 0); /* Only add this file if we have not seen it before. */
if (statable && S_ISREG (finfo.st_mode) && new_dir_file_p (&finfo))
/* Only add the contents of this file if it is not identical to the {
file of the DIR buffer. */ long filesize;
if ((statable && S_ISREG (finfo.st_mode)) && char *contents = filesys_read_info_file (fullpath, &filesize,
(strcmp (dir_buffer->fullpath, fullpath) != 0)) &finfo);
{ if (contents)
long filesize; {
char *contents; update_tags++;
add_menu_to_file_buffer (contents, filesize, dir_buffer);
contents = filesys_read_info_file (fullpath, &filesize, &finfo); free (contents);
}
if (contents) }
{
update_tags++; free (fullpath);
add_menu_to_file_buffer (contents, filesize, dir_buffer); }
free (contents);
}
}
free (fullpath);
}
free (this_dir); free (this_dir);
} }
...@@ -176,37 +196,37 @@ add_menu_to_file_buffer (contents, size, fb) ...@@ -176,37 +196,37 @@ add_menu_to_file_buffer (contents, size, fb)
if (fb_offset == -1) if (fb_offset == -1)
{ {
/* Find the start of the second node in this file buffer. If there /* Find the start of the second node in this file buffer. If there
is only one node, we will be adding the contents to the end of is only one node, we will be adding the contents to the end of
this node. */ this node. */
fb_offset = find_node_separator (&fb_binding); fb_offset = find_node_separator (&fb_binding);
/* If not even a single node separator, give up. */ /* If not even a single node separator, give up. */
if (fb_offset == -1) if (fb_offset == -1)
return; return;
fb_binding.start = fb_offset; fb_binding.start = fb_offset;
fb_binding.start += fb_binding.start +=
skip_node_separator (fb_binding.buffer + fb_binding.start); skip_node_separator (fb_binding.buffer + fb_binding.start);
/* Try to find the next node separator. */ /* Try to find the next node separator. */
fb_offset = find_node_separator (&fb_binding); fb_offset = find_node_separator (&fb_binding);
/* If found one, consider that the start of the menu. Otherwise, the /* If found one, consider that the start of the menu. Otherwise, the
start of this menu is the end of the file buffer (i.e., fb->size). */ start of this menu is the end of the file buffer (i.e., fb->size). */
if (fb_offset != -1) if (fb_offset != -1)
fb_binding.start = fb_offset; fb_binding.start = fb_offset;
else else
fb_binding.start = fb_binding.end; fb_binding.start = fb_binding.end;
insert_text_into_fb_at_binding insert_text_into_fb_at_binding
(fb, &fb_binding, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL)); (fb, &fb_binding, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL));
fb_binding.buffer = fb->contents; fb_binding.buffer = fb->contents;
fb_binding.start = 0; fb_binding.start = 0;
fb_binding.end = fb->filesize; fb_binding.end = fb->filesize;
fb_offset = search_forward (INFO_MENU_LABEL, &fb_binding); fb_offset = search_forward (INFO_MENU_LABEL, &fb_binding);
if (fb_offset == -1) if (fb_offset == -1)
abort (); abort ();
} }
/* CONTENTS_OFFSET and FB_OFFSET point to the starts of the menus that /* CONTENTS_OFFSET and FB_OFFSET point to the starts of the menus that
...@@ -224,23 +244,23 @@ add_menu_to_file_buffer (contents, size, fb) ...@@ -224,23 +244,23 @@ add_menu_to_file_buffer (contents, size, fb)
int num_found = 0; int num_found = 0;
while ((fb_binding.start > 0) && while ((fb_binding.start > 0) &&
(whitespace_or_newline (fb_binding.buffer[fb_binding.start - 1]))) (whitespace_or_newline (fb_binding.buffer[fb_binding.start - 1])))
{ {
num_found++; num_found++;
fb_binding.start--; fb_binding.start--;
} }
/* Optimize if possible. */ /* Optimize if possible. */
if (num_found >= 2) if (num_found >= 2)
{ {
fb_binding.buffer[fb_binding.start++] = '\n'; fb_binding.buffer[fb_binding.start++] = '\n';
fb_binding.buffer[fb_binding.start++] = '\n'; fb_binding.buffer[fb_binding.start++] = '\n';
} }
else else
{ {
/* Do it the hard way. */ /* Do it the hard way. */
insert_text_into_fb_at_binding (fb, &fb_binding, "\n\n", 2); insert_text_into_fb_at_binding (fb, &fb_binding, "\n\n", 2);
fb_binding.start += 2; fb_binding.start += 2;
} }
} }
......
/* display.h -- How the display in Info is done. */ /* display.h -- How the display in Info is done.
$Id: display.h,v 1.2 1997/07/15 18:37:29 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,8 +22,8 @@ ...@@ -21,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_DISPLAY_H_) #ifndef INFO_DISPLAY_H
#define _DISPLAY_H_ #define INFO_DISPLAY_H
#include "info-utils.h" #include "info-utils.h"
#include "terminal.h" #include "terminal.h"
...@@ -73,4 +74,4 @@ extern void display_scroll_display (); ...@@ -73,4 +74,4 @@ extern void display_scroll_display ();
that appear in the OLD_STARTS array. */ that appear in the OLD_STARTS array. */
extern void display_scroll_line_starts (); extern void display_scroll_line_starts ();
#endif /* !_DISPLAY_H_ */ #endif /* not INFO_DISPLAY_H */
...@@ -21,18 +21,10 @@ ...@@ -21,18 +21,10 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_DOC_H_) #if !defined (DOC_H)
#define _DOC_H_ #define DOC_H
#if !defined (NULL) #include "info.h" /* for NAMED_FUNCTIONS, VFunction, etc. */
# define NULL 0x0
#endif /* !NULL */
#if !defined (__FUNCTION_DEF)
# define __FUNCTION_DEF
typedef int Function ();
typedef void VFunction ();
#endif /* _FUNCTION_DEF */
typedef struct { typedef struct {
VFunction *func; VFunction *func;
...@@ -55,4 +47,4 @@ extern void dump_map_to_message_buffer (); ...@@ -55,4 +47,4 @@ extern void dump_map_to_message_buffer ();
extern char *function_name (); extern char *function_name ();
extern VFunction *named_function (); extern VFunction *named_function ();
#endif /* NAMED_FUNCTIONS */ #endif /* NAMED_FUNCTIONS */
#endif /* !_DOC_H_ */ #endif /* !DOC_H */
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#include <stdio.h> #include "info.h"
#include "dribble.h" #include "dribble.h"
/* When non-zero, it is a stream to write all input characters to for the /* When non-zero, it is a stream to write all input characters to for the
......
/* filesys.h -- External declarations of functions and vars in filesys.c. */ /* filesys.h -- External declarations of functions and vars in filesys.c.
$Id: filesys.h,v 1.3 1997/07/15 18:39:08 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,8 +22,8 @@ ...@@ -21,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_FILESYS_H_) #ifndef INFO_FILESYS_H
#define _FILESYS_H_ #define INFO_FILESYS_H
/* The path on which we look for info files. You can initialize this /* The path on which we look for info files. You can initialize this
from the environment variable INFOPATH if there is one, or you can from the environment variable INFOPATH if there is one, or you can
...@@ -70,7 +71,7 @@ extern char *extract_colon_unit (); ...@@ -70,7 +71,7 @@ extern char *extract_colon_unit ();
/* The default value of INFOPATH. */ /* The default value of INFOPATH. */
#if !defined (DEFAULT_INFOPATH) #if !defined (DEFAULT_INFOPATH)
! # define DEFAULT_INFOPATH "/usr/local/info:/usr/info:/usr/local/lib/info:/usr/lib/info:/usr/local/gnu/info:/usr/local/gnu/lib/info:/usr/gnu/info:/usr/gnu/lib/info:/opt/gnu/info:/usr/share/info:/usr/share/lib/info:/usr/local/share/info:/usr/local/share/lib/info:/usr/gnu/lib/emacs/info:/usr/local/gnu/lib/emacs/info:/usr/local/lib/emacs/info:/usr/local/emacs/info:." # define DEFAULT_INFOPATH "/usr/local/info:/usr/info:/usr/local/lib/info:/usr/lib/info:/usr/local/gnu/info:/usr/local/gnu/lib/info:/usr/gnu/info:/usr/gnu/lib/info:/opt/gnu/info:/usr/share/info:/usr/share/lib/info:/usr/local/share/info:/usr/local/share/lib/info:/usr/gnu/lib/emacs/info:/usr/local/gnu/lib/emacs/info:/usr/local/lib/emacs/info:/usr/local/emacs/info:."
#endif /* !DEFAULT_INFOPATH */ #endif /* !DEFAULT_INFOPATH */
#if !defined (S_ISREG) && defined (S_IFREG) #if !defined (S_ISREG) && defined (S_IFREG)
...@@ -81,4 +82,4 @@ extern char *extract_colon_unit (); ...@@ -81,4 +82,4 @@ extern char *extract_colon_unit ();
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif /* !S_ISDIR && S_IFDIR */ #endif /* !S_ISDIR && S_IFDIR */
#endif /* !_FILESYS_H_ */ #endif /* not INFO_FILESYS_H */
/* footnotes.c -- Some functions for manipulating footnotes. */ /* footnotes.c -- Some functions for manipulating footnotes.
$Id: footnotes.c,v 1.4 1997/07/24 21:23:33 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation Copyright (C) 1993, 97 Free Software Foundation, Inc.
stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -40,7 +38,7 @@ find_footnotes_window () ...@@ -40,7 +38,7 @@ find_footnotes_window ()
/* Try to find an existing window first. */ /* Try to find an existing window first. */
for (win = windows; win; win = win->next) for (win = windows; win; win = win->next)
if (internal_info_node_p (win->node) && if (internal_info_node_p (win->node) &&
(strcmp (win->node->nodename, footnote_nodename) == 0)) (strcmp (win->node->nodename, footnote_nodename) == 0))
break; break;
return (win); return (win);
...@@ -72,37 +70,37 @@ make_footnotes_node (node) ...@@ -72,37 +70,37 @@ make_footnotes_node (node)
refs = info_xrefs_of_node (node); refs = info_xrefs_of_node (node);
if (refs) if (refs)
{ {
register int i; register int i;
char *refname; char *refname;
refname = (char *)xmalloc refname = (char *)xmalloc
(1 + strlen ("-Footnotes") + strlen (node->nodename)); (1 + strlen ("-Footnotes") + strlen (node->nodename));
strcpy (refname, node->nodename); strcpy (refname, node->nodename);
strcat (refname, "-Footnotes"); strcat (refname, "-Footnotes");
for (i = 0; refs[i]; i++) for (i = 0; refs[i]; i++)
if ((refs[i]->nodename != (char *)NULL) && if ((refs[i]->nodename != (char *)NULL) &&
(strcmp (refs[i]->nodename, refname) == 0)) (strcmp (refs[i]->nodename, refname) == 0))
{ {
char *filename; char *filename;
filename = node->parent; filename = node->parent;
if (!filename) if (!filename)
filename = node->filename; filename = node->filename;
fn_node = info_get_node (filename, refname); fn_node = info_get_node (filename, refname);
if (fn_node) if (fn_node)
fn_start = 0; fn_start = 0;
break; break;
} }
free (refname); free (refname);
info_free_references (refs); info_free_references (refs);
} }
} }
/* If we never found the start of a footnotes area, quit now. */ /* If we never found the start of a footnotes area, quit now. */
...@@ -126,7 +124,7 @@ make_footnotes_node (node) ...@@ -126,7 +124,7 @@ make_footnotes_node (node)
This effectively skips either "---- footno...", or "File: foo...". */ This effectively skips either "---- footno...", or "File: foo...". */
while (text_start < fn_node->nodelen) while (text_start < fn_node->nodelen)
if (fn_node->contents[text_start++] == '\n') if (fn_node->contents[text_start++] == '\n')
break; break;
result->nodelen = strlen (header) + fn_node->nodelen - text_start; result->nodelen = strlen (header) + fn_node->nodelen - text_start;
...@@ -134,7 +132,7 @@ make_footnotes_node (node) ...@@ -134,7 +132,7 @@ make_footnotes_node (node)
result->contents = (char *)xmalloc (1 + result->nodelen); result->contents = (char *)xmalloc (1 + result->nodelen);
sprintf (result->contents, "%s", header); sprintf (result->contents, "%s", header);
memcpy (result->contents + strlen (header), memcpy (result->contents + strlen (header),
fn_node->contents + text_start, fn_node->nodelen - text_start); fn_node->contents + text_start, fn_node->nodelen - text_start);
name_internal_node (result, footnote_nodename); name_internal_node (result, footnote_nodename);
free (header); free (header);
...@@ -176,7 +174,7 @@ info_get_or_remove_footnotes (window) ...@@ -176,7 +174,7 @@ info_get_or_remove_footnotes (window)
if (fn_win && !new_footnotes) if (fn_win && !new_footnotes)
{ {
if (windows->next) if (windows->next)
info_delete_window_internal (fn_win); info_delete_window_internal (fn_win);
} }
/* If there are footnotes for this window's node, but no window around /* If there are footnotes for this window's node, but no window around
...@@ -187,27 +185,27 @@ info_get_or_remove_footnotes (window) ...@@ -187,27 +185,27 @@ info_get_or_remove_footnotes (window)
WINDOW *last, *win; WINDOW *last, *win;
/* Always make this window be the last one appearing in the list. Find /* Always make this window be the last one appearing in the list. Find
the last window in the chain. */ the last window in the chain. */
for (win = windows, last = windows; win; last = win, win = win->next); for (win = windows, last = windows; win; last = win, win = win->next);
/* Try to split this window, and make the split window the one to /* Try to split this window, and make the split window the one to
contain the footnotes. */ contain the footnotes. */
old_active = active_window; old_active = active_window;
active_window = last; active_window = last;
fn_win = window_make_window (new_footnotes); fn_win = window_make_window (new_footnotes);
active_window = old_active; active_window = old_active;
if (!fn_win) if (!fn_win)
{ {
free (new_footnotes->contents); free (new_footnotes->contents);
free (new_footnotes); free (new_footnotes);
/* If we are hacking automatic footnotes, and there are footnotes /* If we are hacking automatic footnotes, and there are footnotes
but we couldn't display them, print a message to that effect. */ but we couldn't display them, print a message to that effect. */
if (auto_footnotes_p) if (auto_footnotes_p)
inform_in_echo_area ("Footnotes could not be displayed"); inform_in_echo_area (_("Footnotes could not be displayed"));
return (FN_UNABLE); return (FN_UNABLE);
} }
} }
/* If there are footnotes, and there is a window to display them, /* If there are footnotes, and there is a window to display them,
...@@ -217,7 +215,7 @@ info_get_or_remove_footnotes (window) ...@@ -217,7 +215,7 @@ info_get_or_remove_footnotes (window)
window_set_node_of_window (fn_win, new_footnotes); window_set_node_of_window (fn_win, new_footnotes);
window_change_window_height window_change_window_height
(fn_win, fn_win->line_count - fn_win->height); (fn_win, fn_win->line_count - fn_win->height);
remember_window_and_node (fn_win, new_footnotes); remember_window_and_node (fn_win, new_footnotes);
add_gcable_pointer (new_footnotes->contents); add_gcable_pointer (new_footnotes->contents);
...@@ -231,19 +229,17 @@ info_get_or_remove_footnotes (window) ...@@ -231,19 +229,17 @@ info_get_or_remove_footnotes (window)
/* Show the footnotes associated with this node in another window. */ /* Show the footnotes associated with this node in another window. */
DECLARE_INFO_COMMAND (info_show_footnotes, DECLARE_INFO_COMMAND (info_show_footnotes,
"Show the footnotes associated with this node in another window") _("Show the footnotes associated with this node in another window"))
{ {
int result;
/* A negative argument means just make the window go away. */ /* A negative argument means just make the window go away. */
if (count < 0) if (count < 0)
{ {
WINDOW *fn_win = find_footnotes_window (); WINDOW *fn_win = find_footnotes_window ();
/* If there is an old footnotes window, and it isn't the only window /* If there is an old footnotes window, and it isn't the only window
on the screen, delete it. */ on the screen, delete it. */
if (fn_win && windows->next) if (fn_win && windows->next)
info_delete_window_internal (fn_win); info_delete_window_internal (fn_win);
} }
else else
{ {
...@@ -252,14 +248,14 @@ DECLARE_INFO_COMMAND (info_show_footnotes, ...@@ -252,14 +248,14 @@ DECLARE_INFO_COMMAND (info_show_footnotes,
result = info_get_or_remove_footnotes (window); result = info_get_or_remove_footnotes (window);
switch (result) switch (result)
{ {
case FN_UNFOUND: case FN_UNFOUND:
info_error (NO_FOOT_NODE); info_error (NO_FOOT_NODE);
break; break;
case FN_UNABLE: case FN_UNABLE:
info_error (WIN_TOO_SMALL); info_error (WIN_TOO_SMALL);
break; break;
} }
} }
} }
/* footnotes.h -- Some functions for manipulating footnotes. */ /* footnotes.h -- Some functions for manipulating footnotes.
$Id: footnotes.h,v 1.3 1997/07/15 18:40:27 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,11 +22,11 @@ ...@@ -21,11 +22,11 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_FOOTNOTES_H_) #ifndef INFO_FOOTNOTES_H
#define _FOOTNOTES_H_ #define INFO_FOOTNOTES_H
/* Magic string which indicates following text is footnotes. */ /* Magic string which indicates following text is footnotes. */
#define FOOTNOTE_LABEL "---------- Footnotes ----------" #define FOOTNOTE_LABEL _("---------- Footnotes ----------")
#define FN_FOUND 0 #define FN_FOUND 0
#define FN_UNFOUND 1 #define FN_UNFOUND 1
...@@ -42,5 +43,4 @@ extern int info_get_or_remove_footnotes (); ...@@ -42,5 +43,4 @@ extern int info_get_or_remove_footnotes ();
/* Non-zero means attempt to show footnotes when displaying a new window. */ /* Non-zero means attempt to show footnotes when displaying a new window. */
extern int auto_footnotes_p; extern int auto_footnotes_p;
#endif /* !_FOOTNOTES_H_ */ #endif /* not INFO_FOOTNOTES_H */
...@@ -56,7 +56,7 @@ gc_pointers () ...@@ -56,7 +56,7 @@ gc_pointers ()
if (!info_windows || !gcable_pointers_index) if (!info_windows || !gcable_pointers_index)
return; return;
for (i = 0; iw = info_windows[i]; i++) for (i = 0; (iw = info_windows[i]); i++)
{ {
for (j = 0; j < iw->nodes_index; j++) for (j = 0; j < iw->nodes_index; j++)
{ {
......
/* gc.h -- Functions for garbage collecting unused node contents. */ /* gc.h -- Functions for garbage collecting unused node contents.
$Id: gc.h,v 1.2 1997/07/15 18:41:53 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,8 +22,8 @@ ...@@ -21,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_GC_H_) #ifndef INFO_GC_H
#define _GC_H_ #define INFO_GC_H
/* Add POINTER to the list of garbage collectible pointers. A pointer /* Add POINTER to the list of garbage collectible pointers. A pointer
is not actually garbage collected until no info window contains a node is not actually garbage collected until no info window contains a node
...@@ -33,4 +34,4 @@ extern void add_gcable_pointer (); ...@@ -33,4 +34,4 @@ extern void add_gcable_pointer ();
node->contents which are collectible, and free them. */ node->contents which are collectible, and free them. */
extern void gc_pointers (); extern void gc_pointers ();
#endif /* !_GC_H_ */ #endif /* not INFO_GC_H */
/* indices.h -- Functions defined in indices.c. */ /* indices.h -- Functions defined in indices.c.
$Id: indices.h,v 1.2 1997/07/06 20:50:29 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,8 +22,8 @@ ...@@ -21,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_INDICES_H_) #ifndef INFO_INDICES_H
#define _INDICES_H_ #define INFO_INDICES_H
/* User-visible variable controls the output of info-index-next. */ /* User-visible variable controls the output of info-index-next. */
extern int show_index_match; extern int show_index_match;
...@@ -35,5 +36,7 @@ REFERENCE **apropos_in_all_indices (); ...@@ -35,5 +36,7 @@ REFERENCE **apropos_in_all_indices ();
/* User visible functions declared in indices.c. */ /* User visible functions declared in indices.c. */
extern void info_index_search (), info_next_index_match (); extern void info_index_search (), info_next_index_match ();
extern void do_info_index_search ();
extern int index_intry_exists ();
#endif /* !_INDICES_H_ */ #endif /* not INFO_INDICES_H */
...@@ -21,15 +21,8 @@ ...@@ -21,15 +21,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#include <stdio.h> /* For "NULL". Yechhh! */ #include "info.h"
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#if defined (HAVE_STRING_H)
# include <string.h>
#endif /* HAVE_STRING_H */
#include "info-utils.h" #include "info-utils.h"
#if defined (HANDLE_MAN_PAGES) #if defined (HANDLE_MAN_PAGES)
# include "man.h" # include "man.h"
#endif /* HANDLE_MAN_PAGES */ #endif /* HANDLE_MAN_PAGES */
...@@ -84,7 +77,7 @@ info_parse_node (string, newlines_okay) ...@@ -84,7 +77,7 @@ info_parse_node (string, newlines_okay)
/* Find the closing paren. */ /* Find the closing paren. */
while (string[i] && string[i] != ')') while (string[i] && string[i] != ')')
i++; i++;
/* Remember parsed filename. */ /* Remember parsed filename. */
saven_filename (string, i); saven_filename (string, i);
...@@ -93,7 +86,7 @@ info_parse_node (string, newlines_okay) ...@@ -93,7 +86,7 @@ info_parse_node (string, newlines_okay)
string += i; string += i;
if (*string) if (*string)
string++; string++;
} }
/* Parse out nodename. */ /* Parse out nodename. */
...@@ -136,9 +129,9 @@ info_parse_label (label, node) ...@@ -136,9 +129,9 @@ info_parse_label (label, node)
} }
/* **************************************************************** */ /* **************************************************************** */
/* */ /* */
/* Finding and Building Menus */ /* Finding and Building Menus */
/* */ /* */
/* **************************************************************** */ /* **************************************************************** */
/* Return a NULL terminated array of REFERENCE * which represents the menu /* Return a NULL terminated array of REFERENCE * which represents the menu
...@@ -246,23 +239,23 @@ info_references_internal (label, binding) ...@@ -246,23 +239,23 @@ info_references_internal (label, binding)
offset = string_in_line (":", refdef); offset = string_in_line (":", refdef);
/* When searching for menu items, if no colon, there is no /* When searching for menu items, if no colon, there is no
menu item on this line. */ menu item on this line. */
if (offset == -1) if (offset == -1)
{ {
if (searching_for_menu_items) if (searching_for_menu_items)
continue; continue;
else else
{ {
int temp; int temp;
temp = skip_line (refdef); temp = skip_line (refdef);
offset = string_in_line (":", refdef + temp); offset = string_in_line (":", refdef + temp);
if (offset == -1) if (offset == -1)
continue; /* Give up? */ continue; /* Give up? */
else else
offset += temp; offset += temp;
} }
} }
entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
entry->filename = (char *)NULL; entry->filename = (char *)NULL;
...@@ -277,32 +270,32 @@ info_references_internal (label, binding) ...@@ -277,32 +270,32 @@ info_references_internal (label, binding)
entry->end = refdef - binding->buffer; entry->end = refdef - binding->buffer;
/* If this reference entry continues with another ':' then the /* If this reference entry continues with another ':' then the
nodename is the same as the label. */ nodename is the same as the label. */
if (*refdef == ':') if (*refdef == ':')
{ {
entry->nodename = strdup (entry->label); entry->nodename = xstrdup (entry->label);
} }
else else
{ {
/* This entry continues with a specific nodename. Parse the /* This entry continues with a specific nodename. Parse the
nodename from the specification. */ nodename from the specification. */
refdef += skip_whitespace_and_newlines (refdef); refdef += skip_whitespace_and_newlines (refdef);
if (searching_for_menu_items) if (searching_for_menu_items)
info_parse_node (refdef, DONT_SKIP_NEWLINES); info_parse_node (refdef, DONT_SKIP_NEWLINES);
else else
info_parse_node (refdef, SKIP_NEWLINES); info_parse_node (refdef, SKIP_NEWLINES);
if (info_parsed_filename) if (info_parsed_filename)
entry->filename = strdup (info_parsed_filename); entry->filename = xstrdup (info_parsed_filename);
if (info_parsed_nodename) if (info_parsed_nodename)
entry->nodename = strdup (info_parsed_nodename); entry->nodename = xstrdup (info_parsed_nodename);
} }
add_pointer_to_array add_pointer_to_array
(entry, refs_index, refs, refs_slots, 50, REFERENCE *); (entry, refs_index, refs, refs_slots, 50, REFERENCE *);
} }
return (refs); return (refs);
} }
...@@ -320,7 +313,7 @@ info_get_labeled_reference (label, references) ...@@ -320,7 +313,7 @@ info_get_labeled_reference (label, references)
for (i = 0; references && (entry = references[i]); i++) for (i = 0; references && (entry = references[i]); i++)
{ {
if (strcmp (label, entry->label) == 0) if (strcmp (label, entry->label) == 0)
return (entry); return (entry);
} }
return ((REFERENCE *)NULL); return ((REFERENCE *)NULL);
} }
...@@ -375,13 +368,13 @@ info_free_references (references) ...@@ -375,13 +368,13 @@ info_free_references (references)
if (references) if (references)
{ {
for (i = 0; references && (entry = references[i]); i++) for (i = 0; references && (entry = references[i]); i++)
{ {
maybe_free (entry->label); maybe_free (entry->label);
maybe_free (entry->filename); maybe_free (entry->filename);
maybe_free (entry->nodename); maybe_free (entry->nodename);
free (entry); free (entry);
} }
free (references); free (references);
} }
...@@ -411,24 +404,24 @@ canonicalize_whitespace (string) ...@@ -411,24 +404,24 @@ canonicalize_whitespace (string)
for (i = 0, j = 0; string[i]; i++) for (i = 0, j = 0; string[i]; i++)
{ {
if (whitespace_or_newline (string[i])) if (whitespace_or_newline (string[i]))
{ {
whitespace_found++; whitespace_found++;
whitespace_loc = i; whitespace_loc = i;
continue; continue;
} }
else else
{ {
if (whitespace_found && whitespace_loc) if (whitespace_found && whitespace_loc)
{ {
whitespace_found = 0; whitespace_found = 0;
/* Suppress whitespace at start of string. */ /* Suppress whitespace at start of string. */
if (j) if (j)
temp[j++] = ' '; temp[j++] = ' ';
} }
temp[j++] = string[i]; temp[j++] = string[i];
} }
} }
/* Kill trailing whitespace. */ /* Kill trailing whitespace. */
...@@ -466,26 +459,26 @@ printed_representation (character, hpos) ...@@ -466,26 +459,26 @@ printed_representation (character, hpos)
else if (iscntrl (character)) else if (iscntrl (character))
{ {
switch (character) switch (character)
{ {
case '\r': case '\r':
case '\n': case '\n':
the_rep[i++] = character; the_rep[i++] = character;
break; break;
case '\t': case '\t':
{ {
int tw; int tw;
tw = ((hpos + 8) & 0xf8) - hpos; tw = ((hpos + 8) & 0xf8) - hpos;
while (i < tw) while (i < tw)
the_rep[i++] = ' '; the_rep[i++] = ' ';
} }
break; break;
default: default:
the_rep[i++] = '^'; the_rep[i++] = '^';
the_rep[i++] = (character | 0x40); the_rep[i++] = (character | 0x40);
} }
} }
else if (character > printable_limit) else if (character > printable_limit)
{ {
...@@ -502,9 +495,9 @@ printed_representation (character, hpos) ...@@ -502,9 +495,9 @@ printed_representation (character, hpos)
/* **************************************************************** */ /* **************************************************************** */
/* */ /* */
/* Functions Static To This File */ /* Functions Static To This File */
/* */ /* */
/* **************************************************************** */ /* **************************************************************** */
/* Amount of space allocated to INFO_PARSED_FILENAME via xmalloc (). */ /* Amount of space allocated to INFO_PARSED_FILENAME via xmalloc (). */
...@@ -531,7 +524,7 @@ saven_filename (filename, len) ...@@ -531,7 +524,7 @@ saven_filename (filename, len)
int len; int len;
{ {
saven_string (filename, len, saven_string (filename, len,
&info_parsed_filename, &parsed_filename_size); &info_parsed_filename, &parsed_filename_size);
} }
/* Remember NODENAME in PARSED_NODENAME. An empty NODENAME is translated /* Remember NODENAME in PARSED_NODENAME. An empty NODENAME is translated
...@@ -550,7 +543,7 @@ saven_nodename (nodename, len) ...@@ -550,7 +543,7 @@ saven_nodename (nodename, len)
int len; int len;
{ {
saven_string (nodename, len, saven_string (nodename, len,
&info_parsed_nodename, &parsed_nodename_size); &info_parsed_nodename, &parsed_nodename_size);
} }
/* Remember STRING in STRING_P. STRING_P should currently have STRING_SIZE_P /* Remember STRING in STRING_P. STRING_P should currently have STRING_SIZE_P
...@@ -565,7 +558,7 @@ save_string (string, string_p, string_size_p) ...@@ -565,7 +558,7 @@ save_string (string, string_p, string_size_p)
if (!string || !*string) if (!string || !*string)
{ {
if (*string_p) if (*string_p)
free (*string_p); free (*string_p);
*string_p = (char *)NULL; *string_p = (char *)NULL;
*string_size_p = 0; *string_size_p = 0;
...@@ -573,8 +566,8 @@ save_string (string, string_p, string_size_p) ...@@ -573,8 +566,8 @@ save_string (string, string_p, string_size_p)
else else
{ {
if (strlen (string) >= *string_size_p) if (strlen (string) >= *string_size_p)
*string_p = (char *)xrealloc *string_p = (char *)xrealloc
(*string_p, (*string_size_p = 1 + strlen (string))); (*string_p, (*string_size_p = 1 + strlen (string)));
strcpy (*string_p, string); strcpy (*string_p, string);
} }
...@@ -591,7 +584,7 @@ saven_string (string, len, string_p, string_size_p) ...@@ -591,7 +584,7 @@ saven_string (string, len, string_p, string_size_p)
if (!string) if (!string)
{ {
if (*string_p) if (*string_p)
free (*string_p); free (*string_p);
*string_p = (char *)NULL; *string_p = (char *)NULL;
*string_size_p = 0; *string_size_p = 0;
...@@ -599,7 +592,7 @@ saven_string (string, len, string_p, string_size_p) ...@@ -599,7 +592,7 @@ saven_string (string, len, string_p, string_size_p)
else else
{ {
if (len >= *string_size_p) if (len >= *string_size_p)
*string_p = (char *)xrealloc (*string_p, (*string_size_p = 1 + len)); *string_p = (char *)xrealloc (*string_p, (*string_size_p = 1 + len));
strncpy (*string_p, string, len); strncpy (*string_p, string, len);
(*string_p)[len] = '\0'; (*string_p)[len] = '\0';
...@@ -665,7 +658,7 @@ get_internal_info_window (name) ...@@ -665,7 +658,7 @@ get_internal_info_window (name)
for (win = windows; win; win = win->next) for (win = windows; win; win = win->next)
if (internal_info_node_p (win->node) && if (internal_info_node_p (win->node) &&
(strcmp (win->node->nodename, name) == 0)) (strcmp (win->node->nodename, name) == 0))
break; break;
return (win); return (win);
......
/* info-utils.h -- Exported functions and variables from info-util.c. /* info-utils.h -- Exported functions and variables from info-util.c.
$Id: info-utils.h,v 1.1 1997/08/21 22:58:02 jason Exp $ $Id: info-utils.h,v 1.3 1997/07/15 18:42:20 karl Exp $
This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_INFO_UTILS_H_) #ifndef INFO_UTILS_H
#define _INFO_UTILS_H_ #define INFO_UTILS_H
#if !defined (HAVE_STRCHR) #if !defined (HAVE_STRCHR)
# undef strchr # undef strchr
...@@ -40,10 +40,10 @@ ...@@ -40,10 +40,10 @@
cross reference. Arrays of such references can be built by calling cross reference. Arrays of such references can be built by calling
info_menus_of_node () or info_xrefs_of_node (). */ info_menus_of_node () or info_xrefs_of_node (). */
typedef struct { typedef struct {
char *label; /* User Label. */ char *label; /* User Label. */
char *filename; /* File where this node can be found. */ char *filename; /* File where this node can be found. */
char *nodename; /* Name of the node. */ char *nodename; /* Name of the node. */
int start, end; /* Offsets within the containing node of LABEL. */ int start, end; /* Offsets within the containing node of LABEL. */
} REFERENCE; } REFERENCE;
/* When non-zero, various display and input functions handle ISO Latin /* When non-zero, various display and input functions handle ISO Latin
...@@ -137,4 +137,4 @@ extern void info_parse_label (/* label, node */); ...@@ -137,4 +137,4 @@ extern void info_parse_label (/* label, node */);
info_parse_label (INFO_ALTPREV_LABEL, n); \ info_parse_label (INFO_ALTPREV_LABEL, n); \
} while (0) } while (0)
#endif /* !_INFO_UTILS_H_ */ #endif /* not INFO_UTILS_H */
/* info.h -- Header file which includes all of the other headers. */ /* info.h -- Header file which includes all of the other headers.
$Id: info.h,v 1.6 1997/07/15 18:34:15 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,33 +22,86 @@ ...@@ -21,33 +22,86 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_INFO_H_) #if !defined (INFO_H)
#define _INFO_H_ #define INFO_H
/* We always want these, so why clutter up the compile command? */
#define HANDLE_MAN_PAGES
#define NAMED_FUNCTIONS
/* System dependencies. */
#include "system.h"
/* Some of our other include files use these. */
typedef int Function ();
typedef void VFunction ();
typedef char *CFunction ();
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#if defined (HAVE_STRING_H)
#include <string.h>
#endif /* HAVE_STRING_H */
#include "filesys.h" #include "filesys.h"
#include "display.h" #include "display.h"
#include "session.h" #include "session.h"
#include "echo_area.h" #include "echo-area.h"
#include "doc.h" #include "doc.h"
#include "footnotes.h" #include "footnotes.h"
#include "gc.h" #include "gc.h"
#define info_toupper(x) (islower (x) ? toupper (x) : x)
#define info_tolower(x) (isupper (x) ? tolower (x) : x)
#if !defined (whitespace)
# define whitespace(c) ((c == ' ') || (c == '\t'))
#endif /* !whitespace */
#if !defined (whitespace_or_newline)
# define whitespace_or_newline(c) (whitespace (c) || (c == '\n'))
#endif /* !whitespace_or_newline */
/* Add POINTER to the list of pointers found in ARRAY. SLOTS is the number
of slots that have already been allocated. INDEX is the index into the
array where POINTER should be added. GROW is the number of slots to grow
ARRAY by, in the case that it needs growing. TYPE is a cast of the type
of object stored in ARRAY (e.g., NODE_ENTRY *. */
#define add_pointer_to_array(pointer, idx, array, slots, grow, type) \
do { \
if (idx + 2 >= slots) \
array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \
array[idx++] = (type)pointer; \
array[idx] = (type)NULL; \
} while (0)
#define maybe_free(x) do { if (x) free (x); } while (0)
#if !defined (zero_mem) && defined (HAVE_MEMSET)
# define zero_mem(mem, length) memset (mem, 0, length)
#endif /* !zero_mem && HAVE_MEMSET */
#if !defined (zero_mem) && defined (HAVE_BZERO)
# define zero_mem(mem, length) bzero (mem, length)
#endif /* !zero_mem && HAVE_BZERO */
#if !defined (zero_mem)
# define zero_mem(mem, length) \
do { \
register int zi; \
register unsigned char *place; \
\
place = (unsigned char *)mem; \
for (zi = 0; zi < length; zi++) \
place[zi] = 0; \
} while (0)
#endif /* !zero_mem */
/* A structure associating the nodes visited in a particular window. */ /* A structure associating the nodes visited in a particular window. */
typedef struct { typedef struct {
WINDOW *window; /* The window that this list is attached to. */ WINDOW *window; /* The window that this list is attached to. */
NODE **nodes; /* Array of nodes visited in this window. */ NODE **nodes; /* Array of nodes visited in this window. */
int *pagetops; /* For each node in NODES, the pagetop. */ int *pagetops; /* For each node in NODES, the pagetop. */
long *points; /* For each node in NODES, the point. */ long *points; /* For each node in NODES, the point. */
int current; /* Index in NODES of the current node. */ int current; /* Index in NODES of the current node. */
int nodes_index; /* Index where to add the next node. */ int nodes_index; /* Index where to add the next node. */
int nodes_slots; /* Number of slots allocated to NODES. */ int nodes_slots; /* Number of slots allocated to NODES. */
} INFO_WINDOW; } INFO_WINDOW;
/* Array of structures describing for each window which nodes have been /* Array of structures describing for each window which nodes have been
...@@ -78,23 +132,34 @@ extern int info_major_version, info_minor_version, info_patch_level; ...@@ -78,23 +132,34 @@ extern int info_major_version, info_minor_version, info_patch_level;
extern char *version_string (); extern char *version_string ();
/* Error message defines. */ /* Error message defines. */
#define CANT_FIND_NODE "Cannot find the node \"%s\"." #define CANT_FIND_NODE _("Cannot find the node \"%s\".")
#define CANT_FILE_NODE "Cannot find the node \"(%s)%s\"." #define CANT_FILE_NODE _("Cannot find the node \"(%s)%s\".")
#define CANT_FIND_WIND "Cannot find a window!" #define CANT_FIND_WIND _("Cannot find a window!")
#define CANT_FIND_POINT "Point doesn't appear within this window's node!" #define CANT_FIND_POINT _("Point doesn't appear within this window's node!")
#define CANT_KILL_LAST "Cannot delete the last window." #define CANT_KILL_LAST _("Cannot delete the last window.")
#define NO_MENU_NODE "No menu in this node." #define NO_MENU_NODE _("No menu in this node.")
#define NO_FOOT_NODE "No footnotes in this node." #define NO_FOOT_NODE _("No footnotes in this node.")
#define NO_XREF_NODE "No cross references in this node." #define NO_XREF_NODE _("No cross references in this node.")
#define NO_POINTER "No \"%s\" pointer for this node." #define NO_POINTER _("No \"%s\" pointer for this node.")
#define UNKNOWN_COMMAND "Unknown Info command `%c'. `?' for help." #define UNKNOWN_COMMAND _("Unknown Info command `%c'. `?' for help.")
#define TERM_TOO_DUMB "Terminal type \"%s\" is not smart enough to run Info." #define TERM_TOO_DUMB _("Terminal type \"%s\" is not smart enough to run Info.")
#define AT_NODE_BOTTOM "You are already at the last page of this node." #define AT_NODE_BOTTOM _("You are already at the last page of this node.")
#define AT_NODE_TOP "You are already at the first page of this node." #define AT_NODE_TOP _("You are already at the first page of this node.")
#define ONE_WINDOW "Only one window." #define ONE_WINDOW _("Only one window.")
#define WIN_TOO_SMALL "Resulting window would be too small." #define WIN_TOO_SMALL _("Resulting window would be too small.")
#define CANT_MAKE_HELP \ #define CANT_MAKE_HELP \
"There isn't enough room to make a help window. Please delete a window." _("There isn't enough room to make a help window. Please delete a window.")
#endif /* !_INFO_H_ */
/* Found in info-utils.c. */
extern char *filename_non_directory ();
#if !defined (BUILDING_LIBRARY)
/* Found in session.c */
extern int info_windows_initialized_p;
/* Found in window.c. */
extern void message_in_echo_area (), unmessage_in_echo_area ();
#endif /* !BUILDING_LIBRARY */
#endif /* !INFO_H */
/* infomap.c -- Keymaps for Info. */ /* infomap.c -- Keymaps for Info.
$Id: infomap.c,v 1.7 1997/07/31 20:37:32 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation Copyright (C) 1993, 97 Free Software Foundation, Inc.
stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,10 +19,10 @@ ...@@ -21,10 +19,10 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#include "stdio.h" #include "info.h"
#include "ctype.h"
#include "infomap.h" #include "infomap.h"
#include "funs.h" #include "funs.h"
#include "terminal.h"
/* Return a new keymap which has all the uppercase letters mapped to run /* Return a new keymap which has all the uppercase letters mapped to run
the function info_do_lowercase_version (). */ the function info_do_lowercase_version (). */
...@@ -82,16 +80,63 @@ keymap_discard_keymap (map) ...@@ -82,16 +80,63 @@ keymap_discard_keymap (map)
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
switch (map[i].type) switch (map[i].type)
{ {
case ISFUNC: case ISFUNC:
break; break;
case ISKMAP: case ISKMAP:
keymap_discard_keymap ((Keymap)map[i].function); keymap_discard_keymap ((Keymap)map[i].function);
break; break;
} }
}
}
/* Conditionally bind key sequence. */
int
keymap_bind_keyseq (map, keyseq, keyentry)
Keymap map;
const unsigned char *keyseq;
KEYMAP_ENTRY *keyentry;
{
register Keymap m = map;
register const unsigned char *s = keyseq;
register int c;
if (s == NULL || *s == '\0') return 0;
while ((c = *s++) != '\0')
{
switch (m[c].type)
{
case ISFUNC:
if (!(m[c].function == NULL ||
(m != map && m[c].function == info_do_lowercase_version)))
return 0;
if (*s != '\0')
{
m[c].type = ISKMAP;
m[c].function = (VFunction *)keymap_make_keymap ();
}
break;
case ISKMAP:
if (*s == '\0')
return 0;
break;
}
if (*s != '\0')
{
m = (Keymap)m[c].function;
}
else
{
m[c] = *keyentry;
}
} }
return 1;
} }
/* Initialize the standard info keymaps. */ /* Initialize the standard info keymaps. */
...@@ -117,15 +162,15 @@ initialize_info_keymaps () ...@@ -117,15 +162,15 @@ initialize_info_keymaps ()
echo_area_keymap[ESC].function = (VFunction *)keymap_make_keymap (); echo_area_keymap[ESC].function = (VFunction *)keymap_make_keymap ();
echo_area_keymap[Control ('x')].type = ISKMAP; echo_area_keymap[Control ('x')].type = ISKMAP;
echo_area_keymap[Control ('x')].function = echo_area_keymap[Control ('x')].function =
(VFunction *)keymap_make_keymap (); (VFunction *)keymap_make_keymap ();
} }
/* Bind numeric arg functions for both echo area and info window maps. */ /* Bind numeric arg functions for both echo area and info window maps. */
for (i = '0'; i < '9' + 1; i++) for (i = '0'; i < '9' + 1; i++)
{ {
((Keymap) info_keymap[ESC].function)[i].function = ((Keymap) info_keymap[ESC].function)[i].function =
((Keymap) echo_area_keymap[ESC].function)[i].function = ((Keymap) echo_area_keymap[ESC].function)[i].function =
info_add_digit_to_numeric_arg; info_add_digit_to_numeric_arg;
} }
((Keymap) info_keymap[ESC].function)['-'].function = ((Keymap) info_keymap[ESC].function)['-'].function =
((Keymap) echo_area_keymap[ESC].function)['-'].function = ((Keymap) echo_area_keymap[ESC].function)['-'].function =
...@@ -182,6 +227,31 @@ initialize_info_keymaps () ...@@ -182,6 +227,31 @@ initialize_info_keymaps ()
map['o'].function = info_next_window; map['o'].function = info_next_window;
map[DEL].function = ea_backward_kill_line; map[DEL].function = ea_backward_kill_line;
/* Arrow key bindings for echo area keymaps. It seems that some
terminals do not match their termcap entries, so it's best to just
define everything with both of the usual prefixes. */
map = echo_area_keymap;
keymap_bind_keyseq (map, term_ku, &map[Control ('p')]); /* up */
keymap_bind_keyseq (map, "\033OA", &map[Control ('p')]);
keymap_bind_keyseq (map, "\033[A", &map[Control ('p')]);
keymap_bind_keyseq (map, term_kd, &map[Control ('n')]); /* down */
keymap_bind_keyseq (map, "\033OB", &map[Control ('n')]);
keymap_bind_keyseq (map, "\033[B", &map[Control ('n')]);
keymap_bind_keyseq (map, term_kr, &map[Control ('f')]); /* right */
keymap_bind_keyseq (map, "\033OC", &map[Control ('f')]);
keymap_bind_keyseq (map, "\033[C", &map[Control ('f')]);
keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */
keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]);
keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]);
map = (Keymap)echo_area_keymap[ESC].function;
keymap_bind_keyseq (map, term_kl, &map['b']); /* left */
keymap_bind_keyseq (map, "\033OA", &map['b']);
keymap_bind_keyseq (map, "\033[A", &map['b']);
keymap_bind_keyseq (map, term_kr, &map['f']); /* right */
keymap_bind_keyseq (map, "\033OB", &map['f']);
keymap_bind_keyseq (map, "\033[B", &map['f']);
/* Bind commands for Info window keymaps. */ /* Bind commands for Info window keymaps. */
map = info_keymap; map = info_keymap;
map[TAB].function = info_move_to_next_xref; map[TAB].function = info_move_to_next_xref;
...@@ -264,11 +334,35 @@ initialize_info_keymaps () ...@@ -264,11 +334,35 @@ initialize_info_keymaps ()
map['o'].function = info_next_window; map['o'].function = info_next_window;
map['t'].function = info_tile_windows; map['t'].function = info_tile_windows;
map['w'].function = info_toggle_wrap; map['w'].function = info_toggle_wrap;
}
/* Strings which represent the sequence of characters that the arrow keys /* Arrow key bindings for Info windows keymap. */
produce. If these keys begin with ESC, and the second character of the map = info_keymap;
sequence does not conflict with an existing binding in the Meta keymap, keymap_bind_keyseq (map, term_kN, &map[Control ('v')]); /* pagedown */
then bind the keys to do what C-p, C-n, C-f, and C-b do. */ keymap_bind_keyseq (map, term_ku, &map[Control ('p')]); /* up */
extern char *term_ku, *term_kd, *term_kr, *term_kl; keymap_bind_keyseq (map, "\033OA", &map[Control ('p')]);
keymap_bind_keyseq (map, "\033[A", &map[Control ('p')]);
keymap_bind_keyseq (map, term_kd, &map[Control ('n')]); /* down */
keymap_bind_keyseq (map, "\033OB", &map[Control ('n')]);
keymap_bind_keyseq (map, "\033[B", &map[Control ('n')]);
keymap_bind_keyseq (map, term_kr, &map[Control ('f')]); /* right */
keymap_bind_keyseq (map, "\033OC", &map[Control ('f')]);
keymap_bind_keyseq (map, "\033[C", &map[Control ('f')]);
keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */
keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]);
keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]);
map = (Keymap)info_keymap[ESC].function;
keymap_bind_keyseq (map, term_kl, &map['b']); /* left */
keymap_bind_keyseq (map, "\033OA", &map['b']);
keymap_bind_keyseq (map, "\033[A", &map['b']);
keymap_bind_keyseq (map, term_kr, &map['f']); /* right */
keymap_bind_keyseq (map, "\033OB", &map['f']);
keymap_bind_keyseq (map, "\033[B", &map['f']);
keymap_bind_keyseq (map, term_kN, &map[Control ('v')]); /* pagedown */
/* The alternative to this definition of a `main map' key in the
`ESC map' section, is something like:
keymap_bind_keyseq (map, term_kP, &((KeyMap)map[ESC].function).map['v']);
*/
keymap_bind_keyseq (info_keymap/*sic*/, term_kP, &map['v']); /* pageup */
}
...@@ -21,14 +21,14 @@ ...@@ -21,14 +21,14 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_INFOMAP_H_) #ifndef INFOMAP_H
#define _INFOMAP_H_ #define INFOMAP_H
#include "general.h" #include "info.h"
#define ESC '\033' #define ESC '\033'
#define DEL '\177' #define DEL '\177'
#define TAB '\011' #define TAB '\011'
#define RET '\r' #define RET '\r'
#define LFD '\n' #define LFD '\n'
#define SPC ' ' #define SPC ' '
...@@ -79,4 +79,4 @@ extern void keymap_discard_keymap (); ...@@ -79,4 +79,4 @@ extern void keymap_discard_keymap ();
/* Initialize the info keymaps. */ /* Initialize the info keymaps. */
extern void initialize_info_keymaps (); extern void initialize_info_keymaps ();
#endif /* !_INFOMAP_H_ */ #endif /* not INFOMAP_H */
/* m-x.c -- Meta-X minibuffer reader. */ /* m-x.c -- Meta-X minibuffer reader.
$Id: m-x.c,v 1.5 1997/07/24 21:28:00 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation Copyright (C) 1993, 97 Free Software Foundation, Inc.
stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -24,9 +22,9 @@ ...@@ -24,9 +22,9 @@
#include "info.h" #include "info.h"
/* **************************************************************** */ /* **************************************************************** */
/* */ /* */
/* Reading Named Commands */ /* Reading Named Commands */
/* */ /* */
/* **************************************************************** */ /* **************************************************************** */
/* Read the name of an Info function in the echo area and return the /* Read the name of an Info function in the echo area and return the
...@@ -49,12 +47,12 @@ read_function_name (prompt, window) ...@@ -49,12 +47,12 @@ read_function_name (prompt, window)
REFERENCE *entry; REFERENCE *entry;
entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
entry->label = strdup (function_doc_array[i].func_name); entry->label = xstrdup (function_doc_array[i].func_name);
entry->nodename = (char *)NULL; entry->nodename = (char *)NULL;
entry->filename = (char *)NULL; entry->filename = (char *)NULL;
add_pointer_to_array add_pointer_to_array
(entry, array_index, array, array_slots, 200, REFERENCE *); (entry, array_index, array, array_slots, 200, REFERENCE *);
} }
line = info_read_completing_in_echo_area (window, prompt, array); line = info_read_completing_in_echo_area (window, prompt, array);
...@@ -68,11 +66,11 @@ read_function_name (prompt, window) ...@@ -68,11 +66,11 @@ read_function_name (prompt, window)
} }
DECLARE_INFO_COMMAND (describe_command, DECLARE_INFO_COMMAND (describe_command,
"Read the name of an Info command and describe it") _("Read the name of an Info command and describe it"))
{ {
char *line; char *line;
line = read_function_name ("Describe command: ", window); line = read_function_name (_("Describe command: "), window);
if (!line) if (!line)
{ {
...@@ -83,22 +81,19 @@ DECLARE_INFO_COMMAND (describe_command, ...@@ -83,22 +81,19 @@ DECLARE_INFO_COMMAND (describe_command,
/* Describe the function named in "LINE". */ /* Describe the function named in "LINE". */
if (*line) if (*line)
{ {
char *fundoc; VFunction *fun = named_function (line);
VFunction *fun;
fun = named_function (line);
if (!fun) if (!fun)
return; return;
window_message_in_echo_area ("%s: %s.", window_message_in_echo_area ("%s: %s.",
line, function_documentation (fun)); line, function_documentation (fun));
} }
free (line); free (line);
} }
DECLARE_INFO_COMMAND (info_execute_command, DECLARE_INFO_COMMAND (info_execute_command,
"Read a command name in the echo area and execute it") _("Read a command name in the echo area and execute it"))
{ {
char *line; char *line;
...@@ -133,11 +128,11 @@ DECLARE_INFO_COMMAND (info_execute_command, ...@@ -133,11 +128,11 @@ DECLARE_INFO_COMMAND (info_execute_command,
VFunction *function; VFunction *function;
if ((active_window != the_echo_area) && if ((active_window != the_echo_area) &&
(strncmp (line, "echo-area-", 10) == 0)) (strncmp (line, "echo-area-", 10) == 0))
{ {
free (line); free (line);
info_error ("Cannot execute an `echo-area' command here."); info_error (_("Cannot execute an `echo-area' command here."));
return; return;
} }
function = named_function (line); function = named_function (line);
...@@ -152,7 +147,7 @@ DECLARE_INFO_COMMAND (info_execute_command, ...@@ -152,7 +147,7 @@ DECLARE_INFO_COMMAND (info_execute_command,
/* Okay, now that we have M-x, let the user set the screen height. */ /* Okay, now that we have M-x, let the user set the screen height. */
DECLARE_INFO_COMMAND (set_screen_height, DECLARE_INFO_COMMAND (set_screen_height,
"Set the height of the displayed window") _("Set the height of the displayed window"))
{ {
int new_height; int new_height;
...@@ -165,24 +160,24 @@ DECLARE_INFO_COMMAND (set_screen_height, ...@@ -165,24 +160,24 @@ DECLARE_INFO_COMMAND (set_screen_height,
new_height = screenheight; new_height = screenheight;
sprintf (prompt, "Set screen height to (%d): ", new_height); sprintf (prompt, _("Set screen height to (%d): "), new_height);
line = info_read_in_echo_area (window, prompt); line = info_read_in_echo_area (window, prompt);
/* If the user aborted, do that now. */ /* If the user aborted, do that now. */
if (!line) if (!line)
{ {
info_abort_key (active_window, count, 0); info_abort_key (active_window, count, 0);
return; return;
} }
/* Find out what the new height is supposed to be. */ /* Find out what the new height is supposed to be. */
if (*line) if (*line)
new_height = atoi (line); new_height = atoi (line);
/* Clear the echo area if it isn't active. */ /* Clear the echo area if it isn't active. */
if (!echo_area_is_active) if (!echo_area_is_active)
window_clear_echo_area (); window_clear_echo_area ();
free (line); free (line);
} }
......
/* man.h: Defines and external function declarations for man.c */ /* man.h: Defines and external function declarations for man.c.
$Id: man.h,v 1.2 1997/07/15 18:42:56 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,8 +22,8 @@ ...@@ -21,8 +22,8 @@
Author: Brian J. Fox (bfox@ai.mit.edu) Sat May 6 16:19:13 1995. */ Author: Brian J. Fox (bfox@ai.mit.edu) Sat May 6 16:19:13 1995. */
#if !defined (_MAN_H_) #ifndef INFO_MAN_H
#define _MAN_H_ #define INFO_MAN_H
#define MANPAGE_FILE_BUFFER_NAME "*manpages*" #define MANPAGE_FILE_BUFFER_NAME "*manpages*"
...@@ -33,4 +34,4 @@ extern long locate_manpage_xref (/* NODE *node, long start, int dir */); ...@@ -33,4 +34,4 @@ extern long locate_manpage_xref (/* NODE *node, long start, int dir */);
extern REFERENCE **xrefs_of_manpage (/* NODE *node */); extern REFERENCE **xrefs_of_manpage (/* NODE *node */);
extern REFERENCE **manpage_xrefs_in_binding (/* NODE *node, SEARCH_BINDING *binding */); extern REFERENCE **manpage_xrefs_in_binding (/* NODE *node, SEARCH_BINDING *binding */);
#endif /* !_MAN_H_ */ #endif /* INFO_MAN_H */
/* nodemenu.c -- Produce a menu of all visited nodes. */ /* nodemenu.c -- Produce a menu of all visited nodes.
$Id: nodemenu.c,v 1.7 1997/07/24 21:30:30 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation Copyright (C) 1993, 97 Free Software Foundation, Inc.
stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -27,10 +25,10 @@ ...@@ -27,10 +25,10 @@
static char * static char *
nodemenu_format_info () nodemenu_format_info ()
{ {
return ("\n\ return (_("\n\
* Menu:\n\ * Menu:\n\
(File)Node Lines Size Containing File\n\ (File)Node Lines Size Containing File\n\
---------- ----- ---- ---------------"); ---------- ----- ---- ---------------"));
} }
/* Produce a formatted line of information about NODE. Here is what we want /* Produce a formatted line of information about NODE. Here is what we want
...@@ -41,7 +39,7 @@ nodemenu_format_info () ...@@ -41,7 +39,7 @@ nodemenu_format_info ()
---------- ----- ---- --------------- ---------- ----- ---- ---------------
* (emacs)Buffers:: 48 2230 /usr/gnu/info/emacs/emacs-1 * (emacs)Buffers:: 48 2230 /usr/gnu/info/emacs/emacs-1
* (autoconf)Writing configure.in:: 123 58789 /usr/gnu/info/autoconf/autoconf-1 * (autoconf)Writing configure.in:: 123 58789 /usr/gnu/info/autoconf/autoconf-1
* (dir)Top:: 40 589 /usr/gnu/info/dir * (dir)Top:: 40 589 /usr/gnu/info/dir
*/ */
static char * static char *
format_node_info (node) format_node_info (node)
...@@ -58,7 +56,7 @@ format_node_info (node) ...@@ -58,7 +56,7 @@ format_node_info (node)
{ {
parent = filename_non_directory (node->parent); parent = filename_non_directory (node->parent);
if (!parent) if (!parent)
parent = node->parent; parent = node->parent;
} }
else else
parent = (char *)NULL; parent = (char *)NULL;
...@@ -72,15 +70,15 @@ format_node_info (node) ...@@ -72,15 +70,15 @@ format_node_info (node)
char *file = (char *)NULL; char *file = (char *)NULL;
if (parent) if (parent)
file = parent; file = parent;
else else
file = filename_non_directory (containing_file); file = filename_non_directory (containing_file);
if (!file) if (!file)
file = containing_file; file = containing_file;
if (!*file) if (!*file)
file = "dir"; file = "dir";
sprintf (line_buffer, "* (%s)%s::", file, node->nodename); sprintf (line_buffer, "* (%s)%s::", file, node->nodename);
} }
...@@ -92,13 +90,13 @@ format_node_info (node) ...@@ -92,13 +90,13 @@ format_node_info (node)
for (i = 0; i < node->nodelen; i++) for (i = 0; i < node->nodelen; i++)
if (node->contents[i] == '\n') if (node->contents[i] == '\n')
lines++; lines++;
sprintf (line_buffer + len, "%d", lines); sprintf (line_buffer + len, "%d", lines);
} }
len = pad_to (44, line_buffer); len = pad_to (44, line_buffer);
sprintf (line_buffer + len, "%d", node->nodelen); sprintf (line_buffer + len, "%ld", node->nodelen);
if (node->filename && *(node->filename)) if (node->filename && *(node->filename))
{ {
...@@ -106,7 +104,7 @@ format_node_info (node) ...@@ -106,7 +104,7 @@ format_node_info (node)
sprintf (line_buffer + len, node->filename); sprintf (line_buffer + len, node->filename);
} }
return (strdup (line_buffer)); return xstrdup (line_buffer);
} }
/* Little string comparison routine for qsort (). */ /* Little string comparison routine for qsort (). */
...@@ -137,26 +135,26 @@ get_visited_nodes (filter_func) ...@@ -137,26 +135,26 @@ get_visited_nodes (filter_func)
if (!info_windows) if (!info_windows)
return ((NODE *)NULL); return ((NODE *)NULL);
for (iw_index = 0; info_win = info_windows[iw_index]; iw_index++) for (iw_index = 0; (info_win = info_windows[iw_index]); iw_index++)
{ {
for (i = 0; i < info_win->nodes_index; i++) for (i = 0; i < info_win->nodes_index; i++)
{ {
node = info_win->nodes[i]; node = info_win->nodes[i];
/* We skip mentioning "*Node Menu*" nodes. */ /* We skip mentioning "*Node Menu*" nodes. */
if (internal_info_node_p (node) && if (internal_info_node_p (node) &&
(strcmp (node->nodename, nodemenu_nodename) == 0)) (strcmp (node->nodename, nodemenu_nodename) == 0))
continue; continue;
if (node && (!filter_func || (*filter_func) (node))) if (node && (!filter_func || (*filter_func) (node)))
{ {
char *line; char *line;
line = format_node_info (node); line = format_node_info (node);
add_pointer_to_array add_pointer_to_array
(line, lines_index, lines, lines_slots, 20, char *); (line, lines_index, lines, lines_slots, 20, char *);
} }
} }
} }
/* Sort the array of information lines, if there are any. */ /* Sort the array of information lines, if there are any. */
...@@ -169,22 +167,22 @@ get_visited_nodes (filter_func) ...@@ -169,22 +167,22 @@ get_visited_nodes (filter_func)
/* Delete duplicates. */ /* Delete duplicates. */
for (i = 0, newlen = 1; i < lines_index - 1; i++) for (i = 0, newlen = 1; i < lines_index - 1; i++)
{ {
if (strcmp (lines[i], lines[i + 1]) == 0) if (strcmp (lines[i], lines[i + 1]) == 0)
{ {
free (lines[i]); free (lines[i]);
lines[i] = (char *)NULL; lines[i] = (char *)NULL;
} }
else else
newlen++; newlen++;
} }
/* We have free ()'d and marked all of the duplicate slots. /* We have free ()'d and marked all of the duplicate slots.
Copy the live slots rather than pruning the dead slots. */ Copy the live slots rather than pruning the dead slots. */
temp = (char **)xmalloc ((1 + newlen) * sizeof (char *)); temp = (char **)xmalloc ((1 + newlen) * sizeof (char *));
for (i = 0, j = 0; i < lines_index; i++) for (i = 0, j = 0; i < lines_index; i++)
if (lines[i]) if (lines[i])
temp[j++] = lines[i]; temp[j++] = lines[i];
temp[j] = (char *)NULL; temp[j] = (char *)NULL;
free (lines); free (lines);
...@@ -196,8 +194,8 @@ get_visited_nodes (filter_func) ...@@ -196,8 +194,8 @@ get_visited_nodes (filter_func)
printf_to_message_buffer printf_to_message_buffer
("%s", replace_in_documentation ("%s", replace_in_documentation
("Here is the menu of nodes you have recently visited.\n\ (_("Here is the menu of nodes you have recently visited.\n\
Select one from this menu, or use `\\[history-node]' in another window.\n")); Select one from this menu, or use `\\[history-node]' in another window.\n")));
printf_to_message_buffer ("%s\n", nodemenu_format_info ()); printf_to_message_buffer ("%s\n", nodemenu_format_info ());
...@@ -216,7 +214,7 @@ Select one from this menu, or use `\\[history-node]' in another window.\n")); ...@@ -216,7 +214,7 @@ Select one from this menu, or use `\\[history-node]' in another window.\n"));
} }
DECLARE_INFO_COMMAND (list_visited_nodes, DECLARE_INFO_COMMAND (list_visited_nodes,
"Make a window containing a menu of all of the currently visited nodes") _("Make a window containing a menu of all of the currently visited nodes"))
{ {
WINDOW *new; WINDOW *new;
NODE *node; NODE *node;
...@@ -229,14 +227,20 @@ DECLARE_INFO_COMMAND (list_visited_nodes, ...@@ -229,14 +227,20 @@ DECLARE_INFO_COMMAND (list_visited_nodes,
node = new->node; node = new->node;
if (internal_info_node_p (node) && if (internal_info_node_p (node) &&
(strcmp (node->nodename, nodemenu_nodename) == 0)) (strcmp (node->nodename, nodemenu_nodename) == 0))
break; break;
} }
/* If we couldn't find an existing window, try to use the next window /* If we couldn't find an existing window, try to use the next window
in the chain. */ in the chain. */
if (!new && window->next) if (!new)
new = window->next; {
if (window->next)
new = window->next;
/* If there is more than one window, wrap around. */
else if (window != windows)
new = windows;
}
/* If we still don't have a window, make a new one to contain the list. */ /* If we still don't have a window, make a new one to contain the list. */
if (!new) if (!new)
...@@ -258,10 +262,16 @@ DECLARE_INFO_COMMAND (list_visited_nodes, ...@@ -258,10 +262,16 @@ DECLARE_INFO_COMMAND (list_visited_nodes,
node = get_visited_nodes ((Function *)NULL); node = get_visited_nodes ((Function *)NULL);
name_internal_node (node, nodemenu_nodename); name_internal_node (node, nodemenu_nodename);
#if 0
/* Even if this is an internal node, we don't want the window /* Even if this is an internal node, we don't want the window
system to treat it specially. So we turn off the internalness system to treat it specially. So we turn off the internalness
of it here. */ of it here. */
/* Why? We depend on internal_info_node_p returning true, so we must
not remove the flag. Otherwise, the *Node Menu* nodes themselves
appear in the node menu. --Andreas Schwab
<schwab@issan.informatik.uni-dortmund.de>. */
node->flags &= ~N_IsInternal; node->flags &= ~N_IsInternal;
#endif
/* If this window is already showing a node menu, reuse the existing node /* If this window is already showing a node menu, reuse the existing node
slot. */ slot. */
...@@ -270,7 +280,7 @@ DECLARE_INFO_COMMAND (list_visited_nodes, ...@@ -270,7 +280,7 @@ DECLARE_INFO_COMMAND (list_visited_nodes,
#if defined (NOTDEF) #if defined (NOTDEF)
if (internal_info_node_p (new->node) && if (internal_info_node_p (new->node) &&
(strcmp (new->node->nodename, nodemenu_nodename) == 0)) (strcmp (new->node->nodename, nodemenu_nodename) == 0))
remember_me = 0; remember_me = 0;
#endif /* NOTDEF */ #endif /* NOTDEF */
...@@ -284,7 +294,7 @@ DECLARE_INFO_COMMAND (list_visited_nodes, ...@@ -284,7 +294,7 @@ DECLARE_INFO_COMMAND (list_visited_nodes,
} }
DECLARE_INFO_COMMAND (select_visited_node, DECLARE_INFO_COMMAND (select_visited_node,
"Select a node which has been previously visited in a visible window") _("Select a node which has been previously visited in a visible window"))
{ {
char *line; char *line;
NODE *node; NODE *node;
...@@ -296,7 +306,7 @@ DECLARE_INFO_COMMAND (select_visited_node, ...@@ -296,7 +306,7 @@ DECLARE_INFO_COMMAND (select_visited_node,
free (node); free (node);
line = line =
info_read_completing_in_echo_area (window, "Select visited node: ", menu); info_read_completing_in_echo_area (window, _("Select visited node: "), menu);
window = active_window; window = active_window;
...@@ -316,9 +326,9 @@ DECLARE_INFO_COMMAND (select_visited_node, ...@@ -316,9 +326,9 @@ DECLARE_INFO_COMMAND (select_visited_node,
entry = info_get_labeled_reference (line, menu); entry = info_get_labeled_reference (line, menu);
if (!entry) if (!entry)
info_error ("The reference disappeared! (%s).", line); info_error (_("The reference disappeared! (%s)."), line);
else else
info_select_reference (window, entry); info_select_reference (window, entry);
} }
free (line); free (line);
......
/* nodes.h -- How we represent nodes internally. */ /* nodes.h -- How we represent nodes internally.
$Id: nodes.h,v 1.5 1997/07/18 14:33:44 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,15 +22,15 @@ ...@@ -21,15 +22,15 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_NODES_H_) #if !defined (NODES_H)
#define _NODES_H_ #define NODES_H
#include "general.h" #include "info.h"
/* **************************************************************** */ /* **************************************************************** */
/* */ /* */
/* User Code Interface */ /* User Code Interface */
/* */ /* */
/* **************************************************************** */ /* **************************************************************** */
/* Callers generally only want the node itself. This structure is used /* Callers generally only want the node itself. This structure is used
...@@ -41,45 +42,45 @@ ...@@ -41,45 +42,45 @@
paths, so you might have: node->filename = "/usr/gnu/info/emacs-1", paths, so you might have: node->filename = "/usr/gnu/info/emacs-1",
with node->parent = "/usr/gnu/info/emacs". */ with node->parent = "/usr/gnu/info/emacs". */
typedef struct { typedef struct {
char *filename; /* The physical file containing this node. */ char *filename; /* The physical file containing this node. */
char *parent; /* Non-null is the logical file name. */ char *parent; /* Non-null is the logical file name. */
char *nodename; /* The name of this node. */ char *nodename; /* The name of this node. */
char *contents; /* Characters appearing in this node. */ char *contents; /* Characters appearing in this node. */
long nodelen; /* The length of the CONTENTS member. */ long nodelen; /* The length of the CONTENTS member. */
int flags; /* See immediately below. */ int flags; /* See immediately below. */
} NODE; } NODE;
/* Defines that can appear in NODE->flags. All informative. */ /* Defines that can appear in NODE->flags. All informative. */
#define N_HasTagsTable 0x01 /* This node was found through a tags table. */ #define N_HasTagsTable 0x01 /* This node was found through a tags table. */
#define N_TagsIndirect 0x02 /* The tags table was an indirect one. */ #define N_TagsIndirect 0x02 /* The tags table was an indirect one. */
#define N_UpdateTags 0x04 /* The tags table is out of date. */ #define N_UpdateTags 0x04 /* The tags table is out of date. */
#define N_IsCompressed 0x08 /* The file is compressed on disk. */ #define N_IsCompressed 0x08 /* The file is compressed on disk. */
#define N_IsInternal 0x10 /* This node was made by Info. */ #define N_IsInternal 0x10 /* This node was made by Info. */
#define N_CannotGC 0x20 /* File buffer cannot be gc'ed. */ #define N_CannotGC 0x20 /* File buffer cannot be gc'ed. */
#define N_IsManPage 0x40 /* This node is a Un*x manpage. */ #define N_IsManPage 0x40 /* This node is a Un*x manpage. */
/* **************************************************************** */ /* **************************************************************** */
/* */ /* */
/* Internal Data Structures */ /* Internal Data Structures */
/* */ /* */
/* **************************************************************** */ /* **************************************************************** */
/* Some defines describing details about Info file contents. */ /* Some defines describing details about Info file contents. */
/* String Constants. */ /* String Constants. */
#define INFO_FILE_LABEL "File:" #define INFO_FILE_LABEL "File:"
#define INFO_NODE_LABEL "Node:" #define INFO_NODE_LABEL "Node:"
#define INFO_PREV_LABEL "Prev:" #define INFO_PREV_LABEL "Prev:"
#define INFO_ALTPREV_LABEL "Previous:" #define INFO_ALTPREV_LABEL "Previous:"
#define INFO_NEXT_LABEL "Next:" #define INFO_NEXT_LABEL "Next:"
#define INFO_UP_LABEL "Up:" #define INFO_UP_LABEL "Up:"
#define INFO_MENU_LABEL "\n* Menu:" #define INFO_MENU_LABEL "\n* Menu:"
#define INFO_MENU_ENTRY_LABEL "\n* " #define INFO_MENU_ENTRY_LABEL "\n* "
#define INFO_XREF_LABEL "*Note" #define INFO_XREF_LABEL "*Note"
#define TAGS_TABLE_END_LABEL "\nEnd Tag Table" #define TAGS_TABLE_END_LABEL "\nEnd Tag Table"
#define TAGS_TABLE_BEG_LABEL "Tag Table:\n" #define TAGS_TABLE_BEG_LABEL "Tag Table:\n"
#define INDIRECT_TAGS_TABLE_LABEL "Indirect:\n" #define INDIRECT_TAGS_TABLE_LABEL "Indirect:\n"
#define TAGS_TABLE_IS_INDIRECT_LABEL "(Indirect)" #define TAGS_TABLE_IS_INDIRECT_LABEL "(Indirect)"
/* Character Constants. */ /* Character Constants. */
#define INFO_COOKIE '\037' #define INFO_COOKIE '\037'
...@@ -94,10 +95,10 @@ typedef struct { ...@@ -94,10 +95,10 @@ typedef struct {
member in the structure below simply contains the name of the current member in the structure below simply contains the name of the current
file. The following structure describes a single node within a file. */ file. The following structure describes a single node within a file. */
typedef struct { typedef struct {
char *filename; /* The file where this node can be found. */ char *filename; /* The file where this node can be found. */
char *nodename; /* The node pointed to by this tag. */ char *nodename; /* The node pointed to by this tag. */
long nodestart; /* The offset of the start of this node. */ long nodestart; /* The offset of the start of this node. */
long nodelen; /* The length of this node. */ long nodelen; /* The length of this node. */
} TAG; } TAG;
/* The following structure is used to remember information about the contents /* The following structure is used to remember information about the contents
...@@ -108,21 +109,21 @@ typedef struct { ...@@ -108,21 +109,21 @@ typedef struct {
corresponding SLOTS member which says how many slots have been allocated corresponding SLOTS member which says how many slots have been allocated
(with malloc ()) for this array. */ (with malloc ()) for this array. */
typedef struct { typedef struct {
char *filename; /* The filename used to find this file. */ char *filename; /* The filename used to find this file. */
char *fullpath; /* The full pathname of this info file. */ char *fullpath; /* The full pathname of this info file. */
struct stat finfo; /* Information about this file. */ struct stat finfo; /* Information about this file. */
char *contents; /* The contents of this particular file. */ char *contents; /* The contents of this particular file. */
long filesize; /* The number of bytes this file expands to. */ long filesize; /* The number of bytes this file expands to. */
char **subfiles; /* If non-null, the list of subfiles. */ char **subfiles; /* If non-null, the list of subfiles. */
TAG **tags; /* If non-null, the indirect tags table. */ TAG **tags; /* If non-null, the indirect tags table. */
int tags_slots; /* Number of slots allocated for TAGS. */ int tags_slots; /* Number of slots allocated for TAGS. */
int flags; /* Various flags. Mimics of N_* flags. */ int flags; /* Various flags. Mimics of N_* flags. */
} FILE_BUFFER; } FILE_BUFFER;
/* **************************************************************** */ /* **************************************************************** */
/* */ /* */
/* Externally Visible Functions */ /* Externally Visible Functions */
/* */ /* */
/* **************************************************************** */ /* **************************************************************** */
/* Array of FILE_BUFFER * which represents the currently loaded info files. */ /* Array of FILE_BUFFER * which represents the currently loaded info files. */
...@@ -165,4 +166,4 @@ extern char *info_recent_file_error; ...@@ -165,4 +166,4 @@ extern char *info_recent_file_error;
/* Create a new, empty file buffer. */ /* Create a new, empty file buffer. */
extern FILE_BUFFER *make_file_buffer (); extern FILE_BUFFER *make_file_buffer ();
#endif /* !_NODES_H_ */ #endif /* !NODES_H */
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/* This file is part of GNU Info, a program for reading online documentation /* This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,17 +21,11 @@ ...@@ -21,17 +21,11 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#include <ctype.h> #include "info.h"
#include <sys/types.h>
#include <sys/stat.h>
#include "general.h"
#include "search.h" #include "search.h"
#include "nodes.h" #include "nodes.h"
#if !defined (NULL)
# define NULL 0x0
#endif /* !NULL */
/* The search functions take two arguments: /* The search functions take two arguments:
1) a string to search for, and 1) a string to search for, and
...@@ -73,9 +67,9 @@ copy_binding (binding) ...@@ -73,9 +67,9 @@ copy_binding (binding)
/* **************************************************************** */ /* **************************************************************** */
/* */ /* */
/* The Actual Searching Functions */ /* The Actual Searching Functions */
/* */ /* */
/* **************************************************************** */ /* **************************************************************** */
/* Search forwards or backwards for the text delimited by BINDING. /* Search forwards or backwards for the text delimited by BINDING.
...@@ -115,15 +109,15 @@ search_forward (string, binding) ...@@ -115,15 +109,15 @@ search_forward (string, binding)
if (binding->flags & S_FoldCase) if (binding->flags & S_FoldCase)
{ {
alternate = strdup (string); alternate = xstrdup (string);
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
if (islower (alternate[i])) if (islower (alternate[i]))
alternate[i] = toupper (alternate[i]); alternate[i] = toupper (alternate[i]);
else if (isupper (alternate[i])) else if (isupper (alternate[i]))
alternate[i] = tolower (alternate[i]); alternate[i] = tolower (alternate[i]);
} }
} }
buff = binding->buffer + binding->start; buff = binding->buffer + binding->start;
...@@ -132,21 +126,21 @@ search_forward (string, binding) ...@@ -132,21 +126,21 @@ search_forward (string, binding)
while (buff < (end - len)) while (buff < (end - len))
{ {
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
c = buff[i]; c = buff[i];
if ((c != string[i]) && (!alternate || c != alternate[i])) if ((c != string[i]) && (!alternate || c != alternate[i]))
break; break;
} }
if (!string[i]) if (!string[i])
{ {
if (alternate) if (alternate)
free (alternate); free (alternate);
if (binding->flags & S_SkipDest) if (binding->flags & S_SkipDest)
buff += len; buff += len;
return ((long) (buff - binding->buffer)); return ((long) (buff - binding->buffer));
} }
buff++; buff++;
} }
...@@ -184,15 +178,15 @@ search_backward (input_string, binding) ...@@ -184,15 +178,15 @@ search_backward (input_string, binding)
if (binding->flags & S_FoldCase) if (binding->flags & S_FoldCase)
{ {
alternate = strdup (string); alternate = xstrdup (string);
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
if (islower (alternate[i])) if (islower (alternate[i]))
alternate[i] = toupper (alternate[i]); alternate[i] = toupper (alternate[i]);
else if (isupper (alternate[i])) else if (isupper (alternate[i]))
alternate[i] = tolower (alternate[i]); alternate[i] = tolower (alternate[i]);
} }
} }
buff = binding->buffer + binding->start - 1; buff = binding->buffer + binding->start - 1;
...@@ -201,23 +195,23 @@ search_backward (input_string, binding) ...@@ -201,23 +195,23 @@ search_backward (input_string, binding)
while (buff > (end + len)) while (buff > (end + len))
{ {
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
c = *(buff - i); c = *(buff - i);
if (c != string[i] && (alternate && c != alternate[i])) if (c != string[i] && (alternate && c != alternate[i]))
break; break;
} }
if (!string[i]) if (!string[i])
{ {
free (string); free (string);
if (alternate) if (alternate)
free (alternate); free (alternate);
if (binding->flags & S_SkipDest) if (binding->flags & S_SkipDest)
buff -= len; buff -= len;
return ((long) (1 + (buff - binding->buffer))); return ((long) (1 + (buff - binding->buffer)));
} }
buff--; buff--;
} }
...@@ -268,9 +262,9 @@ looking_at (string, binding) ...@@ -268,9 +262,9 @@ looking_at (string, binding)
} }
/* **************************************************************** */ /* **************************************************************** */
/* */ /* */
/* Small String Searches */ /* Small String Searches */
/* */ /* */
/* **************************************************************** */ /* **************************************************************** */
/* Function names that start with "skip" are passed a string, and return /* Function names that start with "skip" are passed a string, and return
...@@ -346,37 +340,43 @@ skip_node_characters (string, newlines_okay) ...@@ -346,37 +340,43 @@ skip_node_characters (string, newlines_okay)
for (; string && (c = string[i]); i++) for (; string && (c = string[i]); i++)
{ {
if (paren) if (paren)
{ {
if (c == '(') if (c == '(')
paren++; paren++;
else if (c == ')') else if (c == ')')
paren--; paren--;
continue; continue;
} }
/* If the character following the close paren is a space or period, /* If the character following the close paren is a space or period,
then this node name has no more characters associated with it. */ then this node name has no more characters associated with it. */
if (c == '\t' || if (c == '\t' ||
c == ',' || c == ',' ||
c == INFO_TAGSEP || c == INFO_TAGSEP ||
((!newlines_okay) && (c == '\n')) || ((!newlines_okay) && (c == '\n')) ||
((paren_seen && string[i - 1] == ')') && ((paren_seen && string[i - 1] == ')') &&
(c == ' ' || c == '.')) || (c == ' ' || c == '.')) ||
(c == '.' && (c == '.' &&
((!string[i + 1]) || (
(whitespace_or_newline (string[i + 1])) || #if 0
(string[i + 1] == ')')))) /* This test causes a node name ending in a period, like `This.', not to
break; be found. The trailing . is stripped. This occurs in the jargon
file (`I see no X here.' is a node name). */
(!string[i + 1]) ||
#endif
(whitespace_or_newline (string[i + 1])) ||
(string[i + 1] == ')'))))
break;
} }
return (i); return (i);
} }
/* **************************************************************** */ /* **************************************************************** */
/* */ /* */
/* Searching FILE_BUFFER's */ /* Searching FILE_BUFFER's */
/* */ /* */
/* **************************************************************** */ /* **************************************************************** */
/* Return the absolute position of the first occurence of a node separator in /* Return the absolute position of the first occurence of a node separator in
...@@ -397,11 +397,11 @@ find_node_separator (binding) ...@@ -397,11 +397,11 @@ find_node_separator (binding)
table (if present) and the indirect tags table (if present). */ table (if present) and the indirect tags table (if present). */
for (i = binding->start; i < binding->end - 1; i++) for (i = binding->start; i < binding->end - 1; i++)
if (((body[i] == INFO_FF && body[i + 1] == INFO_COOKIE) && if (((body[i] == INFO_FF && body[i + 1] == INFO_COOKIE) &&
(body[i + 2] == '\n' || (body[i + 2] == '\n' ||
(body[i + 2] == INFO_FF && body[i + 3] == '\n'))) || (body[i + 2] == INFO_FF && body[i + 3] == '\n'))) ||
((body[i] == INFO_COOKIE) && ((body[i] == INFO_COOKIE) &&
(body[i + 1] == '\n' || (body[i + 1] == '\n' ||
(body[i + 1] == INFO_FF && body[i + 2] == '\n')))) (body[i + 1] == INFO_FF && body[i + 2] == '\n'))))
return (i); return (i);
return (-1); return (-1);
} }
...@@ -467,7 +467,7 @@ find_tags_table (binding) ...@@ -467,7 +467,7 @@ find_tags_table (binding)
search.start += skip_node_separator (search.buffer + search.start); search.start += skip_node_separator (search.buffer + search.start);
if (looking_at (TAGS_TABLE_BEG_LABEL, &search)) if (looking_at (TAGS_TABLE_BEG_LABEL, &search))
return (position); return (position);
} }
return (-1); return (-1);
} }
...@@ -482,8 +482,8 @@ find_node_in_binding (nodename, binding) ...@@ -482,8 +482,8 @@ find_node_in_binding (nodename, binding)
char *nodename; char *nodename;
SEARCH_BINDING *binding; SEARCH_BINDING *binding;
{ {
register long position; long position;
register int offset, namelen; int offset, namelen;
SEARCH_BINDING search; SEARCH_BINDING search;
namelen = strlen (nodename); namelen = strlen (nodename);
...@@ -501,19 +501,19 @@ find_node_in_binding (nodename, binding) ...@@ -501,19 +501,19 @@ find_node_in_binding (nodename, binding)
offset = string_in_line (INFO_NODE_LABEL, search.buffer + search.start); offset = string_in_line (INFO_NODE_LABEL, search.buffer + search.start);
if (offset == -1) if (offset == -1)
continue; continue;
search.start += offset; search.start += offset;
search.start += skip_whitespace (search.buffer + search.start); search.start += skip_whitespace (search.buffer + search.start);
offset = skip_node_characters offset = skip_node_characters
(search.buffer + search.start, DONT_SKIP_NEWLINES); (search.buffer + search.start, DONT_SKIP_NEWLINES);
/* Notice that this is an exact match. You cannot grovel through /* Notice that this is an exact match. You cannot grovel through
the buffer with this function looking for random nodes. */ the buffer with this function looking for random nodes. */
if ((offset == namelen) && if ((offset == namelen) &&
(search.buffer[search.start] == nodename[0]) && (search.buffer[search.start] == nodename[0]) &&
(strncmp (search.buffer + search.start, nodename, offset) == 0)) (strncmp (search.buffer + search.start, nodename, offset) == 0))
return (position); return (position);
} }
return (-1); return (-1);
} }
/* search.h -- Structure used to search large bodies of text, with bounds. */ /* search.h -- Structure used to search large bodies of text, with bounds.
$Id: search.h,v 1.3 1997/07/15 18:43:49 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -31,18 +32,18 @@ ...@@ -31,18 +32,18 @@
They return a long, which is the offset from the start of the buffer They return a long, which is the offset from the start of the buffer
at which the match was found. An offset of -1 indicates failure. */ at which the match was found. An offset of -1 indicates failure. */
#if !defined (_SEARCH_H_) #ifndef INFO_SEARCH_H
#define _SEARCH_H_ #define INFO_SEARCH_H
typedef struct { typedef struct {
char *buffer; /* The buffer of text to search. */ char *buffer; /* The buffer of text to search. */
long start; /* Offset of the start of the search. */ long start; /* Offset of the start of the search. */
long end; /* Offset of the end of the searh. */ long end; /* Offset of the end of the searh. */
int flags; /* Flags controlling the type of search. */ int flags; /* Flags controlling the type of search. */
} SEARCH_BINDING; } SEARCH_BINDING;
#define S_FoldCase 0x01 /* Set means fold case in searches. */ #define S_FoldCase 0x01 /* Set means fold case in searches. */
#define S_SkipDest 0x02 /* Set means return pointing after the dest. */ #define S_SkipDest 0x02 /* Set means return pointing after the dest. */
SEARCH_BINDING *make_binding (), *copy_binding (); SEARCH_BINDING *make_binding (), *copy_binding ();
extern long search_forward (), search_backward (), search (); extern long search_forward (), search_backward (), search ();
...@@ -71,5 +72,4 @@ extern int skip_node_characters (), skip_node_separator (); ...@@ -71,5 +72,4 @@ extern int skip_node_characters (), skip_node_separator ();
extern long find_node_separator (), find_tags_table (); extern long find_node_separator (), find_tags_table ();
extern long find_node_in_binding (); extern long find_node_in_binding ();
#endif /* !_SEARCH_H_ */ #endif /* not INFO_SEARCH_H */
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_SESSION_H_) #if !defined (SESSION_H)
#define _SESSION_H_ #define SESSION_H
#include "general.h" #include "info.h"
#include "dribble.h" #include "dribble.h"
/* All commands that can be invoked from within info_session () receive /* All commands that can be invoked from within info_session () receive
...@@ -55,11 +55,11 @@ extern int info_scroll_behaviour; ...@@ -55,11 +55,11 @@ extern int info_scroll_behaviour;
extern char *info_scroll_choices[]; extern char *info_scroll_choices[];
/* Values for info_scroll_behaviour. */ /* Values for info_scroll_behaviour. */
#define IS_Continuous 0 /* Try to get first menu item, or failing that, the #define IS_Continuous 0 /* Try to get first menu item, or failing that, the
"Next:" pointer, or failing that, the "Up:" and "Next:" pointer, or failing that, the "Up:" and
"Next:" of the up. */ "Next:" of the up. */
#define IS_NextOnly 1 /* Try to get "Next:" menu item. */ #define IS_NextOnly 1 /* Try to get "Next:" menu item. */
#define IS_PageOnly 2 /* Simply give up at the bottom of a node. */ #define IS_PageOnly 2 /* Simply give up at the bottom of a node. */
/* Utility functions found in session.c */ /* Utility functions found in session.c */
extern void info_dispatch_on_key (); extern void info_dispatch_on_key ();
...@@ -143,4 +143,4 @@ extern void info_print_node (); ...@@ -143,4 +143,4 @@ extern void info_print_node ();
/* Miscellaneous commands. */ /* Miscellaneous commands. */
extern void info_abort_key (), info_quit (), info_do_lowercase_version (); extern void info_abort_key (), info_quit (), info_do_lowercase_version ();
#endif /* _SESSION_H_ */ #endif /* SESSION_H */
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
#include "signals.h" #include "signals.h"
/* **************************************************************** */ /* **************************************************************** */
/* */ /* */
/* Pretending That We Have POSIX Signals */ /* Pretending That We Have POSIX Signals */
/* */ /* */
/* **************************************************************** */ /* **************************************************************** */
#if !defined (HAVE_SIGPROCMASK) && defined (HAVE_SIGSETMASK) #if !defined (HAVE_SIGPROCMASK) && defined (HAVE_SIGSETMASK)
...@@ -57,33 +57,32 @@ sigprocmask (operation, newset, oldset) ...@@ -57,33 +57,32 @@ sigprocmask (operation, newset, oldset)
#endif /* !HAVE_SIGPROCMASK && HAVE_SIGSETMASK */ #endif /* !HAVE_SIGPROCMASK && HAVE_SIGSETMASK */
/* **************************************************************** */ /* **************************************************************** */
/* */ /* */
/* Signal Handling for Info */ /* Signal Handling for Info */
/* */ /* */
/* **************************************************************** */ /* **************************************************************** */
typedef void SigHandlerType; typedef RETSIGTYPE signal_handler ();
typedef SigHandlerType SigHandler ();
static SigHandlerType info_signal_handler (); static RETSIGTYPE info_signal_handler ();
static SigHandler *old_TSTP, *old_TTOU, *old_TTIN; static signal_handler *old_TSTP, *old_TTOU, *old_TTIN;
static SigHandler *old_WINCH, *old_INT; static signal_handler *old_WINCH, *old_INT;
void void
initialize_info_signal_handler () initialize_info_signal_handler ()
{ {
#if defined (SIGTSTP) #if defined (SIGTSTP)
old_TSTP = (SigHandler *) signal (SIGTSTP, info_signal_handler); old_TSTP = (signal_handler *) signal (SIGTSTP, info_signal_handler);
old_TTOU = (SigHandler *) signal (SIGTTOU, info_signal_handler); old_TTOU = (signal_handler *) signal (SIGTTOU, info_signal_handler);
old_TTIN = (SigHandler *) signal (SIGTTIN, info_signal_handler); old_TTIN = (signal_handler *) signal (SIGTTIN, info_signal_handler);
#endif /* SIGTSTP */ #endif /* SIGTSTP */
#if defined (SIGWINCH) #if defined (SIGWINCH)
old_WINCH = (SigHandler *) signal (SIGWINCH, info_signal_handler); old_WINCH = (signal_handler *) signal (SIGWINCH, info_signal_handler);
#endif #endif
#if defined (SIGINT) #if defined (SIGINT)
old_INT = (SigHandler *) signal (SIGINT, info_signal_handler); old_INT = (signal_handler *) signal (SIGINT, info_signal_handler);
#endif #endif
} }
...@@ -98,11 +97,11 @@ redisplay_after_signal () ...@@ -98,11 +97,11 @@ redisplay_after_signal ()
fflush (stdout); fflush (stdout);
} }
static SigHandlerType static RETSIGTYPE
info_signal_handler (sig) info_signal_handler (sig)
int sig; int sig;
{ {
SigHandler **old_signal_handler; signal_handler **old_signal_handler;
switch (sig) switch (sig)
{ {
...@@ -116,56 +115,56 @@ info_signal_handler (sig) ...@@ -116,56 +115,56 @@ info_signal_handler (sig)
#endif #endif
{ {
#if defined (SIGTSTP) #if defined (SIGTSTP)
if (sig == SIGTSTP) if (sig == SIGTSTP)
old_signal_handler = &old_TSTP; old_signal_handler = &old_TSTP;
if (sig == SIGTTOU) if (sig == SIGTTOU)
old_signal_handler = &old_TTOU; old_signal_handler = &old_TTOU;
if (sig == SIGTTIN) if (sig == SIGTTIN)
old_signal_handler = &old_TTIN; old_signal_handler = &old_TTIN;
#endif /* SIGTSTP */ #endif /* SIGTSTP */
if (sig == SIGINT) if (sig == SIGINT)
old_signal_handler = &old_INT; old_signal_handler = &old_INT;
/* For stop signals, restore the terminal IO, leave the cursor /* For stop signals, restore the terminal IO, leave the cursor
at the bottom of the window, and stop us. */ at the bottom of the window, and stop us. */
terminal_goto_xy (0, screenheight - 1); terminal_goto_xy (0, screenheight - 1);
terminal_clear_to_eol (); terminal_clear_to_eol ();
fflush (stdout); fflush (stdout);
terminal_unprep_terminal (); terminal_unprep_terminal ();
signal (sig, *old_signal_handler); signal (sig, *old_signal_handler);
UNBLOCK_SIGNAL (sig); UNBLOCK_SIGNAL (sig);
kill (getpid (), sig); kill (getpid (), sig);
/* The program is returning now. Restore our signal handler, /* The program is returning now. Restore our signal handler,
turn on terminal handling, redraw the screen, and place the turn on terminal handling, redraw the screen, and place the
cursor where it belongs. */ cursor where it belongs. */
terminal_prep_terminal (); terminal_prep_terminal ();
*old_signal_handler = (SigHandler *) signal (sig, info_signal_handler); *old_signal_handler = (signal_handler *) signal (sig, info_signal_handler);
redisplay_after_signal (); redisplay_after_signal ();
fflush (stdout); fflush (stdout);
} }
break; break;
#if defined (SIGWINCH) #if defined (SIGWINCH)
case SIGWINCH: case SIGWINCH:
{ {
/* Turn off terminal IO, tell our parent that the window has changed, /* Turn off terminal IO, tell our parent that the window has changed,
then reinitialize the terminal and rebuild our windows. */ then reinitialize the terminal and rebuild our windows. */
old_signal_handler = &old_WINCH; old_signal_handler = &old_WINCH;
terminal_goto_xy (0, 0); terminal_goto_xy (0, 0);
fflush (stdout); fflush (stdout);
terminal_unprep_terminal (); terminal_unprep_terminal ();
signal (sig, *old_signal_handler); signal (sig, *old_signal_handler);
UNBLOCK_SIGNAL (sig); UNBLOCK_SIGNAL (sig);
kill (getpid (), sig); kill (getpid (), sig);
/* After our old signal handler returns... */ /* After our old signal handler returns... */
terminal_get_screen_size (); terminal_get_screen_size ();
terminal_prep_terminal (); terminal_prep_terminal ();
display_initialize_display (screenwidth, screenheight); display_initialize_display (screenwidth, screenheight);
window_new_screen_size (screenwidth, screenheight, (VFunction *)NULL); window_new_screen_size (screenwidth, screenheight, (VFunction *)NULL);
*old_signal_handler = (SigHandler *) signal (sig, info_signal_handler); *old_signal_handler = (signal_handler *) signal (sig, info_signal_handler);
redisplay_after_signal (); redisplay_after_signal ();
} }
break; break;
#endif /* SIGWINCH */ #endif /* SIGWINCH */
......
/* signals.h -- Header to include system dependent signal definitions. */ /* signals.h -- Header to include system dependent signal definitions.
$Id: signals.h,v 1.3 1997/07/15 18:35:59 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. Copyright (C) 1993, 94, 95, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,11 +22,17 @@ ...@@ -21,11 +22,17 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_SIGNALS_H_) #ifndef INFO_SIGNALS_H
#define _SIGNALS_H_ #define INFO_SIGNALS_H
#include <sys/types.h>
#include <signal.h> #include <signal.h>
/* For sysV68 --phdm@info.ucl.ac.be. */
#if !defined (SIGCHLD) && defined (SIGCLD)
#define SIGCHLD SIGCLD
#endif
#if !defined (HAVE_SIGPROCMASK) && !defined (sigmask) #if !defined (HAVE_SIGPROCMASK) && !defined (sigmask)
# define sigmask(x) (1 << ((x)-1)) # define sigmask(x) (1 << ((x)-1))
#endif /* !HAVE_SIGPROCMASK && !sigmask */ #endif /* !HAVE_SIGPROCMASK && !sigmask */
...@@ -86,4 +93,4 @@ ...@@ -86,4 +93,4 @@
# define UNBLOCK_SIGNAL(sig) # define UNBLOCK_SIGNAL(sig)
#endif /* !HAVE_SIGPROCMASK && !HAVE_SIGSETMASK */ #endif /* !HAVE_SIGPROCMASK && !HAVE_SIGSETMASK */
#endif /* !_SIGNALS_H_ */ #endif /* not INFO_SIGNALS_H */
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/* This file is part of GNU Info, a program for reading online documentation /* This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993, 96 Free Software Foundation, Inc. Copyright (C) 1993, 96, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,15 +21,10 @@ ...@@ -21,15 +21,10 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_TERMINAL_H_) #if !defined (TERMINAL_H)
#define _TERMINAL_H_ #define TERMINAL_H
/* We use the following data type to talk about pointers to functions. */ #include "info.h"
#if !defined (__FUNCTION_DEF)
# define __FUNCTION_DEF
typedef int Function ();
typedef void VFunction ();
#endif /* _FUNCTION_DEF */
/* For almost every function externally visible from terminal.c, there is /* For almost every function externally visible from terminal.c, there is
a corresponding "hook" function which can be bound in order to replace a corresponding "hook" function which can be bound in order to replace
...@@ -125,5 +120,6 @@ extern VFunction *terminal_ring_bell_hook; ...@@ -125,5 +120,6 @@ extern VFunction *terminal_ring_bell_hook;
/* The key sequences output by the arrow keys, if this terminal has any. */ /* The key sequences output by the arrow keys, if this terminal has any. */
extern char *term_ku, *term_kd, *term_kr, *term_kl; extern char *term_ku, *term_kd, *term_kr, *term_kl;
extern char *term_kP, *term_kN;
#endif /* !_TERMINAL_H_ */ #endif /* !TERMINAL_H */
/* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). /* tilde.c -- Tilde expansion code (~/foo := $HOME/foo).
$Id: tilde.c,v 1.1 1997/08/21 22:58:05 jason Exp $ $Id: tilde.c,v 1.8 1997/07/24 21:49:03 karl Exp $
This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
...@@ -22,6 +22,10 @@ ...@@ -22,6 +22,10 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
/* Include config.h before doing alloca. */
#include "info.h"
#ifndef alloca
#if defined (__GNUC__) #if defined (__GNUC__)
# define alloca __builtin_alloca # define alloca __builtin_alloca
#else /* !__GNUC__ */ #else /* !__GNUC__ */
...@@ -33,28 +37,10 @@ ...@@ -33,28 +37,10 @@
# endif /* HAVE_ALLOCA_H */ # endif /* HAVE_ALLOCA_H */
# endif /* !AIX */ # endif /* !AIX */
#endif /* !__GNUC__ */ #endif /* !__GNUC__ */
#endif /* ! defined alloca */
#if defined (HAVE_STDLIB_H)
#include <stdlib.h>
#endif
#include "tilde.h"
#include <pwd.h>
#if defined (HAVE_STRING_H)
#include <string.h>
#endif
#include "clib.h"
#if !defined (NULL)
# define NULL 0x0
#endif
#if defined (TEST) || defined (STATIC_MALLOC) #if defined (TEST) || defined (STATIC_MALLOC)
static void *xmalloc (), *xrealloc (); static void *xmalloc (), *xrealloc ();
#else
extern void *xmalloc (), *xrealloc ();
#endif /* TEST || STATIC_MALLOC */ #endif /* TEST || STATIC_MALLOC */
/* The default value of tilde_additional_prefixes. This is set to /* The default value of tilde_additional_prefixes. This is set to
...@@ -105,16 +91,16 @@ tilde_find_prefix (string, len) ...@@ -105,16 +91,16 @@ tilde_find_prefix (string, len)
if (prefixes) if (prefixes)
{ {
for (i = 0; i < string_len; i++) for (i = 0; i < string_len; i++)
{ {
for (j = 0; prefixes[j]; j++) for (j = 0; prefixes[j]; j++)
{ {
if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0) if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0)
{ {
*len = strlen (prefixes[j]) - 1; *len = strlen (prefixes[j]) - 1;
return (i + *len); return (i + *len);
} }
} }
} }
} }
return (string_len); return (string_len);
} }
...@@ -133,13 +119,13 @@ tilde_find_suffix (string) ...@@ -133,13 +119,13 @@ tilde_find_suffix (string)
for (i = 0; i < string_len; i++) for (i = 0; i < string_len; i++)
{ {
if (string[i] == '/' || !string[i]) if (string[i] == '/' || !string[i])
break; break;
for (j = 0; suffixes && suffixes[j]; j++) for (j = 0; suffixes && suffixes[j]; j++)
{ {
if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0) if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0)
return (i); return (i);
} }
} }
return (i); return (i);
} }
...@@ -167,7 +153,7 @@ tilde_expand (string) ...@@ -167,7 +153,7 @@ tilde_expand (string)
/* Copy the skipped text into the result. */ /* Copy the skipped text into the result. */
if ((result_index + start + 1) > result_size) if ((result_index + start + 1) > result_size)
result = (char *)xrealloc (result, 1 + (result_size += (start + 20))); result = (char *)xrealloc (result, 1 + (result_size += (start + 20)));
strncpy (result + result_index, string, start); strncpy (result + result_index, string, start);
result_index += start; result_index += start;
...@@ -176,12 +162,12 @@ tilde_expand (string) ...@@ -176,12 +162,12 @@ tilde_expand (string)
string += start; string += start;
/* Make END be the index of one after the last character of the /* Make END be the index of one after the last character of the
username. */ username. */
end = tilde_find_suffix (string); end = tilde_find_suffix (string);
/* If both START and END are zero, we are all done. */ /* If both START and END are zero, we are all done. */
if (!start && !end) if (!start && !end)
break; break;
/* Expand the entire tilde word, and copy it into RESULT. */ /* Expand the entire tilde word, and copy it into RESULT. */
tilde_word = (char *)xmalloc (1 + end); tilde_word = (char *)xmalloc (1 + end);
...@@ -194,7 +180,7 @@ tilde_expand (string) ...@@ -194,7 +180,7 @@ tilde_expand (string)
len = strlen (expansion); len = strlen (expansion);
if ((result_index + len + 1) > result_size) if ((result_index + len + 1) > result_size)
result = (char *)xrealloc (result, 1 + (result_size += (len + 20))); result = (char *)xrealloc (result, 1 + (result_size += (len + 20)));
strcpy (result + result_index, expansion); strcpy (result + result_index, expansion);
result_index += len; result_index += len;
...@@ -214,88 +200,87 @@ tilde_expand_word (filename) ...@@ -214,88 +200,87 @@ tilde_expand_word (filename)
{ {
char *dirname; char *dirname;
dirname = filename ? strdup (filename) : (char *)NULL; dirname = filename ? xstrdup (filename) : (char *)NULL;
if (dirname && *dirname == '~') if (dirname && *dirname == '~')
{ {
char *temp_name; char *temp_name;
if (!dirname[1] || dirname[1] == '/') if (!dirname[1] || dirname[1] == '/')
{ {
/* Prepend $HOME to the rest of the string. */ /* Prepend $HOME to the rest of the string. */
extern char *getenv (); char *temp_home = getenv ("HOME");
char *temp_home = getenv ("HOME");
/* If there is no HOME variable, look up the directory in
/* If there is no HOME variable, look up the directory in the password database. */
the password database. */ if (!temp_home)
if (!temp_home) {
{ struct passwd *entry;
struct passwd *entry;
entry = (struct passwd *) getpwuid (getuid ());
entry = (struct passwd *) getpwuid (getuid ()); if (entry)
if (entry) temp_home = entry->pw_dir;
temp_home = entry->pw_dir; }
}
temp_name = (char *)
temp_name = (char *) alloca (1 + strlen (&dirname[1])
alloca (1 + strlen (&dirname[1]) + (temp_home ? strlen (temp_home) : 0));
+ (temp_home ? strlen (temp_home) : 0)); temp_name[0] = '\0';
temp_name[0] = '\0'; if (temp_home)
if (temp_home) strcpy (temp_name, temp_home);
strcpy (temp_name, temp_home); strcat (temp_name, &dirname[1]);
strcat (temp_name, &dirname[1]); free (dirname);
free (dirname); dirname = xstrdup (temp_name);
dirname = strdup (temp_name); }
}
else else
{ {
struct passwd *user_entry; struct passwd *user_entry;
char *username = (char *)alloca (257); char *username = (char *)alloca (257);
int i, c; int i, c;
for (i = 1; c = dirname[i]; i++) for (i = 1; (c = dirname[i]); i++)
{ {
if (c == '/') if (c == '/')
break; break;
else else
username[i - 1] = c; username[i - 1] = c;
} }
username[i - 1] = '\0'; username[i - 1] = '\0';
if (!(user_entry = (struct passwd *) getpwnam (username))) if (!(user_entry = (struct passwd *) getpwnam (username)))
{ {
/* If the calling program has a special syntax for /* If the calling program has a special syntax for
expanding tildes, and we couldn't find a standard expanding tildes, and we couldn't find a standard
expansion, then let them try. */ expansion, then let them try. */
if (tilde_expansion_failure_hook) if (tilde_expansion_failure_hook)
{ {
char *expansion; char *expansion;
expansion = (*tilde_expansion_failure_hook) (username); expansion = (*tilde_expansion_failure_hook) (username);
if (expansion) if (expansion)
{ {
temp_name = (char *)alloca temp_name = (char *)alloca
(1 + strlen (expansion) + strlen (&dirname[i])); (1 + strlen (expansion) + strlen (&dirname[i]));
strcpy (temp_name, expansion); strcpy (temp_name, expansion);
strcat (temp_name, &dirname[i]); strcat (temp_name, &dirname[i]);
free (expansion); free (expansion);
goto return_name; goto return_name;
} }
} }
/* We shouldn't report errors. */ /* We shouldn't report errors. */
} }
else else
{ {
temp_name = (char *)alloca temp_name = (char *)alloca
(1 + strlen (user_entry->pw_dir) + strlen (&dirname[i])); (1 + strlen (user_entry->pw_dir) + strlen (&dirname[i]));
strcpy (temp_name, user_entry->pw_dir); strcpy (temp_name, user_entry->pw_dir);
strcat (temp_name, &dirname[i]); strcat (temp_name, &dirname[i]);
return_name: return_name:
free (dirname); free (dirname);
dirname = strdup (temp_name); dirname = xstrdup (temp_name);
} }
endpwent (); endpwent ();
} }
} }
return (dirname); return (dirname);
} }
...@@ -318,15 +303,15 @@ main (argc, argv) ...@@ -318,15 +303,15 @@ main (argc, argv)
fflush (stdout); fflush (stdout);
if (!gets (line)) if (!gets (line))
strcpy (line, "done"); strcpy (line, "done");
if ((strcmp (line, "done") == 0) || if ((strcmp (line, "done") == 0) ||
(strcmp (line, "quit") == 0) || (strcmp (line, "quit") == 0) ||
(strcmp (line, "exit") == 0)) (strcmp (line, "exit") == 0))
{ {
done = 1; done = 1;
break; break;
} }
result = tilde_expand (line); result = tilde_expand (line);
printf (" --> %s\n", result); printf (" --> %s\n", result);
...@@ -369,7 +354,7 @@ xrealloc (pointer, bytes) ...@@ -369,7 +354,7 @@ xrealloc (pointer, bytes)
static void static void
memory_error_and_abort () memory_error_and_abort ()
{ {
fprintf (stderr, "readline: Out of virtual memory!\n"); fprintf (stderr, _("readline: Out of virtual memory!\n"));
abort (); abort ();
} }
#endif /* TEST */ #endif /* TEST */
......
...@@ -25,13 +25,10 @@ ...@@ -25,13 +25,10 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
/* Function pointers can be declared as (Function *)foo. */ #ifndef TILDE_H
#if !defined (__FUNCTION_DEF) #define TILDE_H
# define __FUNCTION_DEF
typedef int Function (); #include "info.h"
typedef void VFunction ();
typedef char *CFunction ();
#endif /* _FUNCTION_DEF */
/* If non-null, this contains the address of a function to call if the /* If non-null, this contains the address of a function to call if the
standard meaning for expanding a tilde fails. The function is called standard meaning for expanding a tilde fails. The function is called
...@@ -56,3 +53,4 @@ extern char *tilde_expand (); ...@@ -56,3 +53,4 @@ extern char *tilde_expand ();
tilde. If there is no expansion, call tilde_expansion_failure_hook. */ tilde. If there is no expansion, call tilde_expansion_failure_hook. */
extern char *tilde_expand_word (); extern char *tilde_expand_word ();
#endif /* not TILDE_H */
/* variables.c -- How to manipulate user visible variables in Info. */ /* variables.c -- How to manipulate user visible variables in Info.
$Id: variables.c,v 1.5 1997/07/18 14:34:23 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -25,9 +26,9 @@ ...@@ -25,9 +26,9 @@
#include "variables.h" #include "variables.h"
/* **************************************************************** */ /* **************************************************************** */
/* */ /* */
/* User Visible Variables in Info */ /* User Visible Variables in Info */
/* */ /* */
/* **************************************************************** */ /* **************************************************************** */
/* Choices used by the completer when reading a zero/non-zero value for /* Choices used by the completer when reading a zero/non-zero value for
...@@ -36,73 +37,75 @@ static char *on_off_choices[] = { "Off", "On", (char *)NULL }; ...@@ -36,73 +37,75 @@ static char *on_off_choices[] = { "Off", "On", (char *)NULL };
VARIABLE_ALIST info_variables[] = { VARIABLE_ALIST info_variables[] = {
{ "automatic-footnotes", { "automatic-footnotes",
"When \"On\", footnotes appear and disappear automatically", N_("When \"On\", footnotes appear and disappear automatically"),
&auto_footnotes_p, (char **)on_off_choices }, &auto_footnotes_p, (char **)on_off_choices },
{ "automatic-tiling", { "automatic-tiling",
"When \"On\", creating or deleting a window resizes other windows", N_("When \"On\", creating or deleting a window resizes other windows"),
&auto_tiling_p, (char **)on_off_choices }, &auto_tiling_p, (char **)on_off_choices },
{ "visible-bell", { "visible-bell",
"When \"On\", flash the screen instead of ringing the bell", N_("When \"On\", flash the screen instead of ringing the bell"),
&terminal_use_visible_bell_p, (char **)on_off_choices }, &terminal_use_visible_bell_p, (char **)on_off_choices },
{ "errors-ring-bell", { "errors-ring-bell",
"When \"On\", errors cause the bell to ring", N_("When \"On\", errors cause the bell to ring"),
&info_error_rings_bell_p, (char **)on_off_choices }, &info_error_rings_bell_p, (char **)on_off_choices },
{ "gc-compressed-files", { "gc-compressed-files",
"When \"On\", Info garbage collects files which had to be uncompressed", N_("When \"On\", Info garbage collects files which had to be uncompressed"),
&gc_compressed_files, (char **)on_off_choices }, &gc_compressed_files, (char **)on_off_choices },
{ "show-index-match", { "show-index-match",
"When \"On\", the portion of the matched search string is highlighted", N_("When \"On\", the portion of the matched search string is highlighted"),
&show_index_match, (char **)on_off_choices }, &show_index_match, (char **)on_off_choices },
{ "scroll-behaviour", { "scroll-behaviour",
"Controls what happens when scrolling is requested at the end of a node", N_("Controls what happens when scrolling is requested at the end of a node"),
&info_scroll_behaviour, (char **)info_scroll_choices }, &info_scroll_behaviour, (char **)info_scroll_choices },
{ "scroll-step", { "scroll-step",
"The number lines to scroll when the cursor moves out of the window", N_("The number lines to scroll when the cursor moves out of the window"),
&window_scroll_step, (char **)NULL }, &window_scroll_step, (char **)NULL },
{ "ISO-Latin", { "ISO-Latin",
"When \"On\", Info accepts and displays ISO Latin characters", N_("When \"On\", Info accepts and displays ISO Latin characters"),
&ISO_Latin_p, (char **)on_off_choices }, &ISO_Latin_p, (char **)on_off_choices },
{ (char *)NULL, (char *)NULL, (int *)NULL, (char **)NULL } { (char *)NULL, (char *)NULL, (int *)NULL, (char **)NULL }
}; };
DECLARE_INFO_COMMAND (describe_variable, "Explain the use of a variable") DECLARE_INFO_COMMAND (describe_variable, _("Explain the use of a variable"))
{ {
VARIABLE_ALIST *var; VARIABLE_ALIST *var;
char *description; char *description;
/* Get the variable's name. */ /* Get the variable's name. */
var = read_variable_name ("Describe variable: ", window); var = read_variable_name (_("Describe variable: "), window);
if (!var) if (!var)
return; return;
description = (char *)xmalloc (20 + strlen (var->name) + strlen (var->doc)); description = (char *)xmalloc (20 + strlen (var->name)
+ strlen (_(var->doc)));
if (var->choices) if (var->choices)
sprintf (description, "%s (%s): %s.", sprintf (description, "%s (%s): %s.",
var->name, var->choices[*(var->value)], var->doc); var->name, var->choices[*(var->value)], _(var->doc));
else else
sprintf (description, "%s (%d): %s.", var->name, *(var->value), var->doc); sprintf (description, "%s (%d): %s.",
var->name, *(var->value), _(var->doc));
window_message_in_echo_area ("%s", description); window_message_in_echo_area ("%s", description);
free (description); free (description);
} }
DECLARE_INFO_COMMAND (set_variable, "Set the value of an Info variable") DECLARE_INFO_COMMAND (set_variable, _("Set the value of an Info variable"))
{ {
VARIABLE_ALIST *var; VARIABLE_ALIST *var;
char *line; char *line;
/* Get the variable's name and value. */ /* Get the variable's name and value. */
var = read_variable_name ("Set variable: ", window); var = read_variable_name (_("Set variable: "), window);
if (!var) if (!var)
return; return;
...@@ -113,86 +116,86 @@ DECLARE_INFO_COMMAND (set_variable, "Set the value of an Info variable") ...@@ -113,86 +116,86 @@ DECLARE_INFO_COMMAND (set_variable, "Set the value of an Info variable")
if (!var->choices) if (!var->choices)
{ {
int potential_value; int potential_value;
if (info_explicit_arg || count != 1) if (info_explicit_arg || count != 1)
potential_value = count; potential_value = count;
else else
potential_value = *(var->value); potential_value = *(var->value);
sprintf (prompt, "Set %s to value (%d): ", sprintf (prompt, _("Set %s to value (%d): "),
var->name, potential_value); var->name, potential_value);
line = info_read_in_echo_area (active_window, prompt); line = info_read_in_echo_area (active_window, prompt);
/* If no error was printed, clear the echo area. */ /* If no error was printed, clear the echo area. */
if (!info_error_was_printed) if (!info_error_was_printed)
window_clear_echo_area (); window_clear_echo_area ();
/* User aborted? */ /* User aborted? */
if (!line) if (!line)
return; return;
/* If the user specified a value, get that, otherwise, we are done. */ /* If the user specified a value, get that, otherwise, we are done. */
canonicalize_whitespace (line); canonicalize_whitespace (line);
if (*line) if (*line)
*(var->value) = atoi (line); *(var->value) = atoi (line);
else else
*(var->value) = potential_value; *(var->value) = potential_value;
free (line); free (line);
} }
else else
{ {
register int i; register int i;
REFERENCE **array = (REFERENCE **)NULL; REFERENCE **array = (REFERENCE **)NULL;
int array_index = 0; int array_index = 0;
int array_slots = 0; int array_slots = 0;
for (i = 0; var->choices[i]; i++) for (i = 0; var->choices[i]; i++)
{ {
REFERENCE *entry; REFERENCE *entry;
entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
entry->label = strdup (var->choices[i]); entry->label = xstrdup (var->choices[i]);
entry->nodename = (char *)NULL; entry->nodename = (char *)NULL;
entry->filename = (char *)NULL; entry->filename = (char *)NULL;
add_pointer_to_array add_pointer_to_array
(entry, array_index, array, array_slots, 10, REFERENCE *); (entry, array_index, array, array_slots, 10, REFERENCE *);
} }
sprintf (prompt, "Set %s to value (%s): ", sprintf (prompt, _("Set %s to value (%s): "),
var->name, var->choices[*(var->value)]); var->name, var->choices[*(var->value)]);
/* Ask the completer to read a variable value for us. */ /* Ask the completer to read a variable value for us. */
line = info_read_completing_in_echo_area (window, prompt, array); line = info_read_completing_in_echo_area (window, prompt, array);
info_free_references (array); info_free_references (array);
if (!echo_area_is_active) if (!echo_area_is_active)
window_clear_echo_area (); window_clear_echo_area ();
/* User aborted? */ /* User aborted? */
if (!line) if (!line)
{ {
info_abort_key (active_window, 0, 0); info_abort_key (active_window, 0, 0);
return; return;
} }
/* User accepted default choice? If so, no change. */ /* User accepted default choice? If so, no change. */
if (!*line) if (!*line)
{ {
free (line); free (line);
return; return;
} }
/* Find the choice in our list of choices. */ /* Find the choice in our list of choices. */
for (i = 0; var->choices[i]; i++) for (i = 0; var->choices[i]; i++)
if (strcmp (var->choices[i], line) == 0) if (strcmp (var->choices[i], line) == 0)
break; break;
if (var->choices[i]) if (var->choices[i])
*(var->value) = i; *(var->value) = i;
} }
} }
} }
...@@ -259,13 +262,13 @@ make_variable_completions_array () ...@@ -259,13 +262,13 @@ make_variable_completions_array ()
{ {
REFERENCE *entry; REFERENCE *entry;
entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); entry = (REFERENCE *) xmalloc (sizeof (REFERENCE));
entry->label = strdup (info_variables[i].name); entry->label = xstrdup (info_variables[i].name);
entry->nodename = (char *)NULL; entry->nodename = (char *)NULL;
entry->filename = (char *)NULL; entry->filename = (char *)NULL;
add_pointer_to_array add_pointer_to_array
(entry, array_index, array, array_slots, 200, REFERENCE *); (entry, array_index, array, array_slots, 200, REFERENCE *);
} }
return (array); return (array);
......
/* variables.h -- Description of user visible variables in Info. */ /* variables.h -- Description of user visible variables in Info.
$Id: variables.h,v 1.3 1997/07/15 18:44:23 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,8 +22,8 @@ ...@@ -21,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_VARIABLES_H_) #ifndef INFO_VARIABLES_H
#define _VARIABLES_H_ #define INFO_VARIABLES_H
/* A variable (in the Info sense) is an integer value with a user-visible /* A variable (in the Info sense) is an integer value with a user-visible
name. You may supply an array of strings to complete over when the name. You may supply an array of strings to complete over when the
...@@ -32,10 +33,10 @@ ...@@ -32,10 +33,10 @@
/* Structure describing a user visible variable. */ /* Structure describing a user visible variable. */
typedef struct { typedef struct {
char *name; /* Polite name. */ char *name; /* Polite name. */
char *doc; /* Documentation string. */ char *doc; /* Documentation string. */
int *value; /* Address of value. */ int *value; /* Address of value. */
char **choices; /* Array of strings or NULL if numeric only. */ char **choices; /* Array of strings or NULL if numeric only. */
} VARIABLE_ALIST; } VARIABLE_ALIST;
/* Read the name of an Info variable in the echo area and return the /* Read the name of an Info variable in the echo area and return the
...@@ -61,4 +62,4 @@ extern int info_scroll_behaviour; ...@@ -61,4 +62,4 @@ extern int info_scroll_behaviour;
extern int window_scroll_step; extern int window_scroll_step;
extern int ISO_Latin_p; extern int ISO_Latin_p;
#endif /* _VARIABLES_H_ */ #endif /* not INFO_VARIABLES_H */
/* window.h -- Structure and flags used in manipulating Info windows. */ /* window.h -- Structure and flags used in manipulating Info windows.
$Id: window.h,v 1.4 1997/07/15 18:45:47 karl Exp $
/* This file is part of GNU Info, a program for reading online documentation This file is part of GNU Info, a program for reading online documentation
stored in Info format. stored in Info format.
Copyright (C) 1993 Free Software Foundation, Inc. Copyright (C) 1993, 97 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -21,8 +22,8 @@ ...@@ -21,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */ Written by Brian Fox (bfox@ai.mit.edu). */
#if !defined (_WINDOW_H_) #ifndef INFO_WINDOW_H
#define _WINDOW_H_ #define INFO_WINDOW_H
#include "nodes.h" #include "nodes.h"
#include "infomap.h" #include "infomap.h"
...@@ -44,9 +45,9 @@ ...@@ -44,9 +45,9 @@
if you need to change window state information, here is where you would if you need to change window state information, here is where you would
do it. NB> The last element does NOT end with a semi-colon. */ do it. NB> The last element does NOT end with a semi-colon. */
#define WINDOW_STATE_DECL \ #define WINDOW_STATE_DECL \
NODE *node; /* The node displayed in this window. */ \ NODE *node; /* The node displayed in this window. */ \
int pagetop; /* LINE_STARTS[PAGETOP] is first line in WINDOW. */ \ int pagetop; /* LINE_STARTS[PAGETOP] is first line in WINDOW. */ \
long point /* Offset within NODE of the cursor position. */ long point /* Offset within NODE of the cursor position. */
/* Structure which defines a window. Windows are doubly linked, next /* Structure which defines a window. Windows are doubly linked, next
and prev. The list of windows is kept on WINDOWS. The structure member and prev. The list of windows is kept on WINDOWS. The structure member
...@@ -54,37 +55,38 @@ ...@@ -54,37 +55,38 @@
(0, window->height + window->first_row) is the first character of this (0, window->height + window->first_row) is the first character of this
windows modeline. The number of lines that can be displayed in a window windows modeline. The number of lines that can be displayed in a window
is equal to window->height - 1. */ is equal to window->height - 1. */
typedef struct __window__ { typedef struct window_struct
struct __window__ *next; /* Next window in this chain. */ {
struct __window__ *prev; /* Previous window in this chain. */ struct window_struct *next; /* Next window in this chain. */
int width; /* Width of this window. */ struct window_struct *prev; /* Previous window in this chain. */
int height; /* Height of this window. */ int width; /* Width of this window. */
int first_row; /* Offset of the first line in the_screen. */ int height; /* Height of this window. */
int goal_column; /* The column we would like the cursor to appear in. */ int first_row; /* Offset of the first line in the_screen. */
Keymap keymap; /* Keymap used to read commands in this window. */ int goal_column; /* The column we would like the cursor to appear in. */
WINDOW_STATE_DECL; /* Node, pagetop and point. */ Keymap keymap; /* Keymap used to read commands in this window. */
char *modeline; /* Calculated text of the modeline for this window. */ WINDOW_STATE_DECL; /* Node, pagetop and point. */
char **line_starts; /* Array of printed line starts for this node. */ char *modeline; /* Calculated text of the modeline for this window. */
int line_count; /* Number of lines appearing in LINE_STARTS. */ char **line_starts; /* Array of printed line starts for this node. */
int flags; /* See below for details. */ int line_count; /* Number of lines appearing in LINE_STARTS. */
int flags; /* See below for details. */
} WINDOW; } WINDOW;
typedef struct { typedef struct {
WINDOW_STATE_DECL; /* What gets saved. */ WINDOW_STATE_DECL; /* What gets saved. */
} WINDOW_STATE; } WINDOW_STATE;
#define W_UpdateWindow 0x01 /* WINDOW needs updating. */ #define W_UpdateWindow 0x01 /* WINDOW needs updating. */
#define W_WindowIsPerm 0x02 /* This WINDOW is a permanent object. */ #define W_WindowIsPerm 0x02 /* This WINDOW is a permanent object. */
#define W_WindowVisible 0x04 /* This WINDOW is currently visible. */ #define W_WindowVisible 0x04 /* This WINDOW is currently visible. */
#define W_InhibitMode 0x08 /* This WINDOW has no modeline. */ #define W_InhibitMode 0x08 /* This WINDOW has no modeline. */
#define W_NoWrap 0x10 /* Lines do not wrap in this window. */ #define W_NoWrap 0x10 /* Lines do not wrap in this window. */
#define W_InputWindow 0x20 /* Window accepts input. */ #define W_InputWindow 0x20 /* Window accepts input. */
#define W_TempWindow 0x40 /* Window is less important. */ #define W_TempWindow 0x40 /* Window is less important. */
extern WINDOW *windows; /* List of visible Info windows. */ extern WINDOW *windows; /* List of visible Info windows. */
extern WINDOW *active_window; /* The currently active window. */ extern WINDOW *active_window; /* The currently active window. */
extern WINDOW *the_screen; /* The Info screen is just another window. */ extern WINDOW *the_screen; /* The Info screen is just another window. */
extern WINDOW *the_echo_area; /* THE_ECHO_AREA is a window in THE_SCREEN. */ extern WINDOW *the_echo_area; /* THE_ECHO_AREA is a window in THE_SCREEN. */
/* Global variable control redisplay of scrolled windows. If non-zero, it /* Global variable control redisplay of scrolled windows. If non-zero, it
is the desired number of lines to scroll the window in order to make is the desired number of lines to scroll the window in order to make
...@@ -226,4 +228,4 @@ extern void window_get_state (), window_set_state (); ...@@ -226,4 +228,4 @@ extern void window_get_state (), window_set_state ();
offset of GOAL. */ offset of GOAL. */
extern int window_chars_to_goal (); extern int window_chars_to_goal ();
#endif /* !_WINDOW_H_ */ #endif /* not INFO_WINDOW_H */
# Makefile for GNU makeinfo. # Makefile.in generated automatically by automake 1.2 from Makefile.am
# $Id: Makefile.in,v 1.1 1997/08/21 22:58:07 jason Exp $
#
# Copyright (C) 1993, 96 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
# it under the terms of the GNU General Public License as published by # This Makefile.in is free software; the Free Software Foundation
# the Free Software Foundation; either version 2, or (at your option) # gives unlimited permission to copy, distribute and modify it.
# 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 SHELL = /bin/sh
# 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@ srcdir = @srcdir@
VPATH = $(srcdir):$(common) top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
common = $(srcdir)/../libtxi pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
EXEEXT = @EXEEXT@
CC = @CC@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = true
PRE_INSTALL = true
POST_INSTALL = true
NORMAL_UNINSTALL = true
PRE_UNINSTALL = true
POST_UNINSTALL = true
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
DATADIRNAME = @DATADIRNAME@
EXEEXT = @EXEEXT@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
PACKAGE = @PACKAGE@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
TERMLIBS = @TERMLIBS@
TEXCONFIG = @TEXCONFIG@
TEXMF = @TEXMF@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
l = @l@
bin_PROGRAMS = makeinfo
localedir = $(datadir)/locale
INCLUDES = -I$(top_srcdir)/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
LDADD = ../lib/libtxi.a @INTLLIBS@
makeinfo_SOURCES = makeinfo.c makeinfo.h multi.c
EXTRA_DIST = README
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
bin_PROGRAMS = makeinfo$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I..
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
makeinfo_OBJECTS = makeinfo.o multi.o
makeinfo_LDADD = $(LDADD)
makeinfo_DEPENDENCIES = ../lib/libtxi.a
makeinfo_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = README Makefile.am Makefile.in
LN = ln
RM = rm -f
MKDIR = mkdir
DEFS = @DEFS@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
LIBS = -L../libtxi -ltxi @LIBS@
LOADLIBES = $(LIBS)
SHELL = /bin/sh TAR = tar
GZIP = --best
SOURCES = $(makeinfo_SOURCES)
OBJECTS = $(makeinfo_OBJECTS)
CFLAGS = @CFLAGS@ default: all
LDFLAGS = @LDFLAGS@
prefix = @prefix@ .SUFFIXES:
exec_prefix = @exec_prefix@ .SUFFIXES: .c .o
bindir = @bindir@ $(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
# Prefix for each installed program, normally empty or `g'. cd $(top_srcdir) && $(AUTOMAKE) --cygnus makeinfo/Makefile
binprefix =
infodir = @infodir@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-binPROGRAMS:
#### End of system configuration section. #### clean-binPROGRAMS:
test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
SRCS = makeinfo.c multi.c distclean-binPROGRAMS:
OBJS = makeinfo.o multi.o
PROGS = makeinfo$(EXEEXT) maintainer-clean-binPROGRAMS:
all: $(PROGS) makeinfo.info install-binPROGRAMS: $(bin_PROGRAMS)
sub-all: all @$(NORMAL_INSTALL)
$(mkinstalldirs) $(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`"; \
$(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \
done
.c.o: .c.o:
$(CC) -c $(CPPFLAGS) -I. -I$(srcdir) -I$(common) $(DEFS) $(CFLAGS) $< $(COMPILE) -c $<
mostlyclean-compile:
rm -f *.o core
clean-compile:
distclean-compile:
rm -f *.tab.c
maintainer-clean-compile:
makeinfo$(EXEEXT): $(makeinfo_OBJECTS) $(makeinfo_DEPENDENCIES)
@rm -f makeinfo$(EXEEXT)
$(LINK) $(makeinfo_LDFLAGS) $(makeinfo_OBJECTS) $(makeinfo_LDADD) $(LIBS)
tags: TAGS
ID: $(HEADERS) $(SOURCES)
here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES)
tags=; \
here=`pwd`; \
test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = makeinfo
makeinfo$(EXEEXT): $(OBJS) ../libtxi/libtxi.a distdir: $(DISTFILES)
$(CC) $(LDFLAGS) -o makeinfo $(OBJS) $(LOADLIBES) @for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file; \
done
info:
dvi:
check: all
$(MAKE)
installcheck:
install-info:
install-exec: install-binPROGRAMS
@$(NORMAL_INSTALL)
../libtxi/libtxi.a: install-data:
(cd ../libtxi && $(MAKE) $(MFLAGS) libtxi.a) @$(NORMAL_INSTALL)
makeinfo.o: makeinfo.c $(common)/getopt.h install: install-exec install-data all
@:
$(OBJS): makeinfo.h uninstall: uninstall-binPROGRAMS
info makeinfo.info: ./makeinfo makeinfo.texi #macro.texi all: Makefile $(PROGRAMS)
./makeinfo --no-split -I$(srcdir) makeinfo.texi
# makeinfo.texi: ./makeinfo makeinfo.mki install-strip:
# ./makeinfo -E makeinfo.texi -I$(srcdir) makeinfo.mki $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
$(mkinstalldirs) $(bindir)
dvi makeinfo.dvi: ./makeinfo makeinfo.texi #macro.texi
$(srcdir)/../util/texi2dvi makeinfo.txi
install: all mostlyclean-generic:
$(INSTALL_PROGRAM) makeinfo$(EXEEXT) $(bindir)/$(binprefix)makeinfo$(EXEEXT) test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-d=$(srcdir); test -f ./makeinfo.info && d=.; $(INSTALL_DATA) $$d/makeinfo.info $(infodir)/makeinfo.info
$(POST_INSTALL)
install-info: clean-generic:
-d=$(srcdir); test -f ./makeinfo.info && d=.; $(INSTALL_DATA) $$d/makeinfo.info $(infodir)/makeinfo.info test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
../util/install-info --info-dir=$(infodir) $(infodir)/makeinfo.info
uninstall: distclean-generic:
for f in $(PROGS); do rm -f $(bindir)/$(binprefix)$$f; done rm -f Makefile $(DISTCLEANFILES)
rm -f $(infodir)/makeinfo.info rm -f config.cache config.log stamp-h stamp-h[0-9]*
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
TAGS: $(SRCS) maintainer-clean-generic:
etags $(SRCS) test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-binPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
clean: clean: clean-binPROGRAMS clean-compile clean-tags clean-generic \
rm -f *.o a.out core core.* $(PROGS) mostlyclean
mostlyclean: clean distclean: distclean-binPROGRAMS distclean-compile distclean-tags \
distclean-generic clean
rm -f config.status
distclean: clean maintainer-clean: maintainer-clean-binPROGRAMS maintainer-clean-compile \
rm -f TAGS Makefile config.status *.info */*.info maintainer-clean-tags maintainer-clean-generic \
distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
realclean: distclean .PHONY: default mostlyclean-binPROGRAMS distclean-binPROGRAMS \
maintainer-clean: distclean clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \
install-binPROGRAMS mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info dvi installcheck \
install-info install-exec install-data install uninstall all \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
Makefile: Makefile.in ../config.status
cd .. && sh config.status
# Prevent GNU make v3 from overflowing arg limit on SysV. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: .NOEXPORT:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment