Add a file that I forgot to "cvs add", and remove a lot of stuff that is
no longer a part of texinfo-3.12. Pointed out by: dg (partially)
This commit is contained in:
parent
d284f489b0
commit
9eb82d4ddc
258
contrib/texinfo/config.h
Normal file
258
contrib/texinfo/config.h
Normal file
@ -0,0 +1,258 @@
|
||||
/* config.h. Generated automatically by configure. */
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
/* acconfig.h
|
||||
This file is in the public domain.
|
||||
|
||||
Descriptive text for the C preprocessor macros that
|
||||
the distributed Autoconf macros can define.
|
||||
No software package will use all of them; autoheader copies the ones
|
||||
your configure.in uses into your configuration header file templates.
|
||||
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). Although this order
|
||||
can split up related entries, it makes it easier to check whether
|
||||
a given entry is in the file.
|
||||
|
||||
Leave the following blank line there!! Autoheader needs it. */
|
||||
|
||||
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
/* #undef C_ALLOCA */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
/* #undef CRAY_STACKSEG_END */
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
/* #undef HAVE_ALLOCA_H */
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
/* #undef HAVE_DOPRNT */
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#define HAVE_MMAP 1
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#define HAVE_VPRINTF 1
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
/* #undef inline */
|
||||
|
||||
/* Define if on MINIX. */
|
||||
/* #undef _MINIX */
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
/* #undef off_t */
|
||||
|
||||
/* Define if the system does not provide POSIX.1 features except
|
||||
with this defined. */
|
||||
/* #undef _POSIX_1_SOURCE */
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define if the setvbuf function takes the buffering type as its second
|
||||
argument and the buffer pointer as the third, as on System V
|
||||
before release 3. */
|
||||
/* #undef SETVBUF_REVERSED */
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||
/* #undef size_t */
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
/* #undef STACK_DIRECTION */
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
/* #undef TM_IN_SYS_TIME */
|
||||
|
||||
/* Define to 1 if NLS is requested. */
|
||||
#define ENABLE_NLS 1
|
||||
|
||||
/* Define as 1 if you have catgets and don't want to use GNU gettext. */
|
||||
/* #undef HAVE_CATGETS */
|
||||
|
||||
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
|
||||
/* #undef HAVE_GETTEXT */
|
||||
|
||||
/* Define if your locale.h file contains LC_MESSAGES. */
|
||||
#define HAVE_LC_MESSAGES 1
|
||||
|
||||
/* Define as 1 if you have the stpcpy function. */
|
||||
/* #undef HAVE_STPCPY */
|
||||
|
||||
/* Define to the name of the distribution. */
|
||||
#define PACKAGE "texinfo"
|
||||
|
||||
/* Define to the version of the distribution. */
|
||||
#define VERSION "3.12"
|
||||
|
||||
/* Define if you have the __argz_count function. */
|
||||
/* #undef HAVE___ARGZ_COUNT */
|
||||
|
||||
/* Define if you have the __argz_next function. */
|
||||
/* #undef HAVE___ARGZ_NEXT */
|
||||
|
||||
/* Define if you have the __argz_stringify function. */
|
||||
/* #undef HAVE___ARGZ_STRINGIFY */
|
||||
|
||||
/* Define if you have the bzero function. */
|
||||
#define HAVE_BZERO 1
|
||||
|
||||
/* Define if you have the dcgettext function. */
|
||||
/* #undef HAVE_DCGETTEXT */
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#define HAVE_GETCWD 1
|
||||
|
||||
/* Define if you have the getpagesize function. */
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
|
||||
/* Define if you have the memcpy function. */
|
||||
#define HAVE_MEMCPY 1
|
||||
|
||||
/* Define if you have the memmove function. */
|
||||
#define HAVE_MEMMOVE 1
|
||||
|
||||
/* Define if you have the memset function. */
|
||||
#define HAVE_MEMSET 1
|
||||
|
||||
/* Define if you have the munmap function. */
|
||||
#define HAVE_MUNMAP 1
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#define HAVE_PUTENV 1
|
||||
|
||||
/* Define if you have the setenv function. */
|
||||
#define HAVE_SETENV 1
|
||||
|
||||
/* Define if you have the setlocale function. */
|
||||
#define HAVE_SETLOCALE 1
|
||||
|
||||
/* Define if you have the setvbuf function. */
|
||||
#define HAVE_SETVBUF 1
|
||||
|
||||
/* Define if you have the sigprocmask function. */
|
||||
#define HAVE_SIGPROCMASK 1
|
||||
|
||||
/* Define if you have the sigsetmask function. */
|
||||
#define HAVE_SIGSETMASK 1
|
||||
|
||||
/* Define if you have the stpcpy function. */
|
||||
/* #undef HAVE_STPCPY */
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define if you have the strchr function. */
|
||||
#define HAVE_STRCHR 1
|
||||
|
||||
/* Define if you have the strdup function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define if you have the <argz.h> header file. */
|
||||
/* #undef HAVE_ARGZ_H */
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define if you have the <locale.h> header file. */
|
||||
#define HAVE_LOCALE_H 1
|
||||
|
||||
/* Define if you have the <malloc.h> header file. */
|
||||
/* #undef HAVE_MALLOC_H */
|
||||
|
||||
/* Define if you have the <ncurses/termcap.h> header file. */
|
||||
/* #undef HAVE_NCURSES_TERMCAP_H */
|
||||
|
||||
/* Define if you have the <nl_types.h> header file. */
|
||||
#define HAVE_NL_TYPES_H 1
|
||||
|
||||
/* Define if you have the <pwd.h> header file. */
|
||||
#define HAVE_PWD_H 1
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define if you have the <sys/fcntl.h> header file. */
|
||||
#define HAVE_SYS_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#define HAVE_SYS_FILE_H 1
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define if you have the <sys/ptem.h> header file. */
|
||||
/* #undef HAVE_SYS_PTEM_H */
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define if you have the <sys/ttold.h> header file. */
|
||||
/* #undef HAVE_SYS_TTOLD_H */
|
||||
|
||||
/* Define if you have the <sys/wait.h> header file. */
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define if you have the <termcap.h> header file. */
|
||||
#define HAVE_TERMCAP_H 1
|
||||
|
||||
/* Define if you have the <termio.h> header file. */
|
||||
/* #undef HAVE_TERMIO_H */
|
||||
|
||||
/* Define if you have the <termios.h> header file. */
|
||||
#define HAVE_TERMIOS_H 1
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define if you have the <values.h> header file. */
|
||||
/* #undef HAVE_VALUES_H */
|
||||
|
||||
/* Define if you have the bsd library (-lbsd). */
|
||||
/* #undef HAVE_LIBBSD */
|
||||
|
||||
/* Define if you have the i library (-li). */
|
||||
/* #undef HAVE_LIBI */
|
||||
|
||||
/* Define if you have the z library (-lz). */
|
||||
#define HAVE_LIBZ 1
|
||||
|
||||
/* For gettext (NLS) */
|
||||
#include <libintl.h>
|
||||
#define _(String) gettext (String)
|
||||
#define N_(String) (String)
|
||||
|
||||
|
||||
/* Leave that blank line there!! Autoheader needs it.
|
||||
If you're adding to this file, keep in mind:
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). */
|
@ -1,16 +0,0 @@
|
||||
$Id: dir,v 1.2 1996/09/24 18:43:01 karl Exp $
|
||||
This is the file .../info/dir, which contains the topmost node of the
|
||||
Info hierarchy. The first time you invoke Info you start off
|
||||
looking at that node, which is (dir)Top.
|
||||
|
||||
File: dir Node: Top This is the top of the INFO tree
|
||||
|
||||
This (the Directory node) gives a menu of major topics.
|
||||
Typing "q" exits, "?" lists all Info commands, "d" returns here,
|
||||
"h" gives a primer for first-timers,
|
||||
"mEmacs<Return>" visits the Emacs topic, etc.
|
||||
|
||||
In Emacs, you can click mouse button 2 on a menu item or cross reference
|
||||
to select it.
|
||||
|
||||
* Menu:
|
@ -1,88 +0,0 @@
|
||||
# Makefile for Texinfo/emacs.
|
||||
# Copyright (C) 1995, 96 Free Software Foundation, Inc.
|
||||
# $Id: Makefile.in,v 1.4 1996/09/28 21:34:34 karl Exp $
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# Author: Brian J. Fox (bfox@ai.mit.edu)
|
||||
#
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = $(srcdir)
|
||||
SHELL = /bin/sh
|
||||
RM = rm -f
|
||||
|
||||
|
||||
ELISP_SRCS = info.el makeinfo.el texinfo.el texnfo-upd.el \
|
||||
texnfo-tex.el texinfmt.el informat.el detexinfo.el
|
||||
ELISP_OBJS = info.elc makeinfo.elc texinfo.elc texnfo-upd.elc \
|
||||
texnfo-tex.elc texinfmt.elc informat.elc detexinfo.elc
|
||||
|
||||
.SUFFIXES: .el .elc
|
||||
|
||||
.el.elc:
|
||||
$(srcdir)/elisp-comp $<
|
||||
|
||||
all:
|
||||
sub-all: all
|
||||
|
||||
elisp: $(ELISP_OBJS)
|
||||
.PHONY: elisp
|
||||
|
||||
# Nobody likes any of these install targets. Fine. Install it
|
||||
# manually, then.
|
||||
install:
|
||||
@echo Please install the Emacs Lisp files manually.
|
||||
|
||||
uninstall:
|
||||
@echo Please uninstall the Emacs Lisp files manually.
|
||||
|
||||
# install: $(ELISP_OBJS)
|
||||
# @(echo "(print (car load-path))" >/tmp/elc.$$$$; \
|
||||
# lispdir=`emacs -batch -q -l /tmp/elc.$$$$ -nw | grep site-lisp`; \
|
||||
# rm /tmp/elc.$$$$; \
|
||||
# if [ "$$lispdir" != "" ]; then \
|
||||
# lispdir=`echo $$lispdir | sed -e 's/"//g'`; \
|
||||
# echo "Installing .elc files in $$lispdir."; \
|
||||
# $(CP) $(ELISP_OBJS) $$lispdir; \
|
||||
# else \
|
||||
# echo "To install the elisp files, please copy *.elc to the"; \
|
||||
# echo "emacs site-lisp directory."; \
|
||||
# fi)
|
||||
#
|
||||
# install: $(ELISP_OBJS)
|
||||
# for file in $(ELISP_OBJS); do \
|
||||
# $(INSTALL_DATA) $$file $(lispdir); \
|
||||
# done
|
||||
#
|
||||
# uninstall: $(ELISP_OBJS)
|
||||
# cd $(lispdir) && rm -f $(ELISP_OBJS)
|
||||
#
|
||||
informat.elc: info.elc
|
||||
makeinfo.elc: texinfo.elc
|
||||
texinfmt.elc: texinfo.elc
|
||||
texinfmt.elc: texnfo-upd.elc
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in ../config.status
|
||||
cd .. && sh config.status
|
||||
|
||||
realclean distclean: clean
|
||||
$(RM) Makefile *.log
|
||||
|
||||
clean: FORCE
|
||||
$(RM) *.elc
|
||||
|
||||
FORCE:
|
||||
|
@ -1,250 +0,0 @@
|
||||
;;; Here is a handy keybinding:
|
||||
|
||||
(global-set-key "\C-x\\" 'detexinfo)
|
||||
|
||||
;;;;;;;;;;;;;;;; detexinfo.el ;;;;;;;;;;;;;;;;
|
||||
;;;
|
||||
;;; Remove Texinfo commands from a Texinfo source file.
|
||||
;;;
|
||||
;;; Copyright (C) 1991, 1992 Free Software Foundation
|
||||
;;; Robert J. Chassell
|
||||
;;; bugs to bug-texinfo@prep.ai.mit.edu
|
||||
;;;
|
||||
;;; ==> test version <==
|
||||
;;; Fails if Texinfo source file contains formatting errors.
|
||||
;;;
|
||||
;;; Version 0.05 - 3 Jun 1992
|
||||
;;; Add to list of removed commands. Improve messages.
|
||||
;;;
|
||||
;;; Version 0.04 - 27 Jan 1992
|
||||
;;; Rewrite to insert detexinfo'd text into a temporary buffer.
|
||||
;;;
|
||||
;;; Version 0.03 - 27 Dec 1991
|
||||
;;; Improved messages.
|
||||
;;;
|
||||
;;; Version 0.02 - 13 Nov 1991
|
||||
;;; detexinfo-remove-inline-cmd, detexinfo-syntax-table: Handle
|
||||
;;; nested commands.
|
||||
;;; detexinfo: Handle nested @'s, eg @samp{@}} and @samp{@@};
|
||||
;;; replace @TeX{} with TeX.
|
||||
;;;
|
||||
;;; Version 0.01 - 13 Nov 1991
|
||||
;;;
|
||||
;;; Based on detex.el, by Bengt Martensson, 4 Oct 1987
|
||||
;;;
|
||||
;;;;;;;;;;;;;;;;
|
||||
|
||||
(defvar detexinfo-buffer-name "*detexinfo*"
|
||||
"*Name of the temporary buffer used by \\[detexinfo].")
|
||||
|
||||
(defvar detexinfo-syntax-table nil)
|
||||
|
||||
(if detexinfo-syntax-table
|
||||
nil
|
||||
(setq detexinfo-syntax-table (make-syntax-table))
|
||||
(modify-syntax-entry ?\[ "." detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?\] "." detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?\" "." detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?\\ "." detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?\( "." detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?\) "." detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?{ "(}" detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?} "){" detexinfo-syntax-table))
|
||||
|
||||
(defun detexinfo ()
|
||||
"Remove Texinfo commands from current buffer, copying result to new buffer.
|
||||
BUG: Fails if Texinfo source file contains formatting errors."
|
||||
(interactive)
|
||||
(let ((input-buffer (current-buffer)))
|
||||
;; Find a buffer to use.
|
||||
(switch-to-buffer (get-buffer-create detexinfo-buffer-name))
|
||||
(setq major-mode 'detexinfo-mode)
|
||||
(set-syntax-table detexinfo-syntax-table)
|
||||
(erase-buffer)
|
||||
(insert-buffer-substring input-buffer)
|
||||
|
||||
;; Replace @{ and @} with %#* and *#% temporarily, so @samp{@{} works.
|
||||
;; What is a better way of doing this??
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "@{" nil t) ; e.g., @samp{@{}
|
||||
(replace-match "%#*"))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "@}" nil t)
|
||||
(forward-char -3) ; e.g., @samp{@@}
|
||||
(if (looking-at "@") ; Two @@ in a row
|
||||
(progn
|
||||
(delete-char 2)
|
||||
(insert "%&%#"))
|
||||
(forward-char 1)
|
||||
(delete-char 2)
|
||||
(insert "*#%")))
|
||||
|
||||
(goto-char (point-min))
|
||||
;; Remove @refill, the only inline command without braces.
|
||||
(while (search-forward "@refill" nil t)
|
||||
(replace-match ""))
|
||||
;; Replace @TeX{} with TeX
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "@TeX{}" nil t) (replace-match "TeX" t t))
|
||||
|
||||
(detexinfo-remove-line-cmds-without-arg)
|
||||
(detexinfo-remove-inline-cmds-without-arg)
|
||||
(detexinfo-remove-inline-cmds-keep-arg)
|
||||
(detexinfo-remove-line-cmds-deletable-arg)
|
||||
(detexinfo-remove-line-cmds-maybe-delete-arg)
|
||||
(detexinfo-remove-line-cmds-keep-arg)
|
||||
|
||||
;; Now replace %#*, *#%, and %&%# with {, }, and @@.
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "%#*" nil t)
|
||||
(replace-match "{"))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "*#%" nil t)
|
||||
(replace-match "}"))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "%&%#" nil t)
|
||||
(replace-match "@@"))
|
||||
|
||||
;; Scan for remaining two character @-commands
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "@" nil t)
|
||||
(cond ((looking-at "[*:]")
|
||||
(delete-region (1- (point)) (1+ (point))))
|
||||
((looking-at "[{}^@.'`]\"?!")
|
||||
(delete-region (1- (point)) (point)))))
|
||||
|
||||
(goto-char (point-min))
|
||||
(message "Done...removed Texinfo commands from buffer. You may save it.")))
|
||||
|
||||
(defun detexinfo-remove-whole-line (cmd)
|
||||
"Delete Texinfo line command CMD at beginning of line and rest of line."
|
||||
(goto-char (point-min))
|
||||
(while
|
||||
(re-search-forward
|
||||
(concat "^@" cmd "[ \n]+") (point-max) t)
|
||||
(goto-char (match-beginning 0))
|
||||
(delete-region
|
||||
(point) (save-excursion (end-of-line) (1+ (point))))))
|
||||
|
||||
(defun detexinfo-remove-inline-cmd (cmd)
|
||||
"Delete Texinfo inline command CMD, eg. @point, @code."
|
||||
(goto-char (point-min))
|
||||
(while
|
||||
(re-search-forward (concat "@" cmd "{") (point-max) t)
|
||||
(save-excursion
|
||||
(forward-char -1)
|
||||
(forward-sexp 1)
|
||||
(delete-char -1)) ; delete right brace
|
||||
(delete-region (point) (match-beginning 0))))
|
||||
|
||||
;;;;;;;;;;;;;;;;
|
||||
|
||||
;;; 1. @setfilename and other line commands with args to delete
|
||||
|
||||
(defvar detexinfo-line-cmds-deletable-arg
|
||||
'("enumerate" "ftable" "vtable" "itemize" "table"
|
||||
"setfilename" "settitle" "setchapternewpage"
|
||||
"footnotestyle" "paragraphindent"
|
||||
"include" "need" "sp"
|
||||
"clear" "ifclear" "ifset" "set"
|
||||
"defcodeindex" "defindex" "syncodeindex" "synindex")
|
||||
"List of Texinfo commands whose arguments should be deleted.")
|
||||
|
||||
(defun detexinfo-remove-line-cmds-deletable-arg ()
|
||||
"Delete Texinfo line commands together with their args, eg @setfilename."
|
||||
(message "Removing commands such as @enumerate...with their arguments...")
|
||||
(mapcar 'detexinfo-remove-whole-line
|
||||
detexinfo-line-cmds-deletable-arg))
|
||||
|
||||
;;; 2. @cindex and other cmds with args that may be deleted
|
||||
;;; This list is here just to make it easier to revise the
|
||||
;;; categories. In particular, you might want to keep the index entries.
|
||||
|
||||
(defvar detexinfo-line-cmds-maybe-delete-arg
|
||||
'("cindex" "findex" "kindex" "pindex" "tindex" "vindex" "node"
|
||||
"c" "comment" "end" "headings" "printindex" "vskip"
|
||||
"evenfooting" "evenheading" "everyfooting" "everyheading"
|
||||
"oddfooting" "oddheading")
|
||||
"List of Texinfo commands whose arguments may possibly be deleted.")
|
||||
|
||||
(defun detexinfo-remove-line-cmds-maybe-delete-arg ()
|
||||
"Delete Texinfo line commands together with their arguments, eg, @cindex."
|
||||
(message "Removing commands such as @cindex...with their arguments...")
|
||||
(mapcar 'detexinfo-remove-whole-line
|
||||
detexinfo-line-cmds-maybe-delete-arg))
|
||||
|
||||
;;; 3. @chapter and other line cmds with args to keep.
|
||||
|
||||
(defvar detexinfo-line-cmds-keep-arg
|
||||
'("top" "chapter" "section" "subsection" "subsubsection"
|
||||
"unnumbered" "unnumberedsec" "unnumberedsubsec" "unnumberedsubsubsec"
|
||||
"majorheading" "chapheading" "heading" "subheading" "subsubheading"
|
||||
"appendix" "appendixsec" "appendixsubsec" "appendixsubsubsec"
|
||||
"item" "itemx"
|
||||
"title" "subtitle" "center" "author" "exdent"
|
||||
"defcv" "deffn" "defivar" "defmac" "defmethod" "defop" "defopt"
|
||||
"defspec" "deftp" "deftypefn" "deftypefun" "deftypvr"
|
||||
"deftypevar" "defun" "defvar" "defvr")
|
||||
"List of Texinfo line commands whose arguments should be kept.")
|
||||
|
||||
(defun detexinfo-remove-line-cmds-keep-arg ()
|
||||
"Delete Texinfo line commands but keep their arguments, eg @chapter."
|
||||
(message "Removing commands such as @chapter...but not their arguments...")
|
||||
(mapcar 'detexinfo-remove-line-cmd-keep-arg
|
||||
detexinfo-line-cmds-keep-arg))
|
||||
|
||||
(defun detexinfo-remove-line-cmd-keep-arg (cmd)
|
||||
"Delete Texinfo line command CMD but keep its argument, eg @chapter."
|
||||
(goto-char (point-min))
|
||||
(while
|
||||
(re-search-forward
|
||||
(concat "^@" cmd "[ \n]+") (point-max) t)
|
||||
(delete-region (match-beginning 0) (match-end 0))))
|
||||
|
||||
;;; 4. @bye and other line commands without args.
|
||||
|
||||
(defvar detexinfo-line-cmds-without-arg
|
||||
'("bye" "contents" "display" "example" "finalout"
|
||||
"flushleft" "flushright" "format" "group" "ifhtml" "ifinfo" "iftex"
|
||||
"ignore" "lisp" "menu" "noindent" "page" "quotation"
|
||||
"shortcontents" "smallbook" "smallexample" "smalllisp"
|
||||
"summarycontents" "tex" "thischapter" "thischaptername"
|
||||
"thisfile" "thispage" "thissection" "thistitle" "titlepage")
|
||||
"List of Texinfo commands without arguments that should be deleted.")
|
||||
|
||||
(defun detexinfo-remove-line-cmds-without-arg ()
|
||||
"Delete line Texinfo commands that lack args, eg. @example."
|
||||
(message "Removing commands such as @example...that lack arguments...")
|
||||
(mapcar 'detexinfo-remove-whole-line
|
||||
detexinfo-line-cmds-without-arg))
|
||||
|
||||
;;; 5. @equiv and other inline cmds without args.
|
||||
|
||||
(defvar detexinfo-inline-cmds-without-arg
|
||||
'("equiv" "error" "expansion" "point" "print" "result"
|
||||
"asis" "br" "bullet" "dots" "minus" "today")
|
||||
"List of Texinfo inline commands without arguments that should be deleted.")
|
||||
|
||||
(defun detexinfo-remove-inline-cmds-without-arg ()
|
||||
"Delete Texinfo inline commands in that lack arguments."
|
||||
(message "Removing within line commands such as @result...")
|
||||
(mapcar 'detexinfo-remove-inline-cmd
|
||||
detexinfo-inline-cmds-without-arg))
|
||||
|
||||
;;; 6. @code and other inline cmds with args to keep
|
||||
|
||||
(defvar detexinfo-inline-cmds-keep-arg
|
||||
'("b" "cartouche" "cite" "code" "copyright" "ctrl" "dfn" "dmn"
|
||||
"emph" "file" "footnote" "i" "inforef"
|
||||
"kbd" "key" "pxref" "r" "ref" "samp" "sc" "titlefont"
|
||||
"strong" "t" "var" "w" "xref")
|
||||
"List of Texinfo inline commands with arguments that should be kept.")
|
||||
|
||||
(defun detexinfo-remove-inline-cmds-keep-arg ()
|
||||
"Delete Texinfo inline commands but keep its arg, eg. @code."
|
||||
(message
|
||||
"Removing within line commands such as @code...but not their arguments...")
|
||||
(mapcar 'detexinfo-remove-inline-cmd
|
||||
detexinfo-inline-cmds-keep-arg))
|
||||
|
||||
;;;;;;;;;;;;;;;; end detexinfo.el ;;;;;;;;;;;;;;;;
|
@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
# $Id: elisp-comp,v 1.2 1996/09/26 23:41:08 karl Exp $
|
||||
# Trivial script to compile the Elisp files.
|
||||
setpath=${TMPDIR-/tmp}/elc.$$
|
||||
echo "(setq load-path (cons nil load-path))" > $setpath
|
||||
emacs -batch -l $setpath -f batch-byte-compile "$@"
|
||||
rm -f $setpath
|
File diff suppressed because it is too large
Load Diff
@ -1,429 +0,0 @@
|
||||
;;; informat.el --- info support functions package for Emacs
|
||||
|
||||
;; Copyright (C) 1986 Free Software Foundation, Inc.
|
||||
|
||||
;; Maintainer: FSF
|
||||
;; Keywords: help
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
||||
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'info)
|
||||
|
||||
;;;###autoload
|
||||
(defun Info-tagify ()
|
||||
"Create or update Info-file tag table in current buffer."
|
||||
(interactive)
|
||||
;; Save and restore point and restrictions.
|
||||
;; save-restrictions would not work
|
||||
;; because it records the old max relative to the end.
|
||||
;; We record it relative to the beginning.
|
||||
(message "Tagifying %s ..." (file-name-nondirectory (buffer-file-name)))
|
||||
(let ((omin (point-min))
|
||||
(omax (point-max))
|
||||
(nomax (= (point-max) (1+ (buffer-size))))
|
||||
(opoint (point)))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(if (search-forward "\^_\nIndirect:\n" nil t)
|
||||
(message "Cannot tagify split info file")
|
||||
(let ((regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]")
|
||||
(case-fold-search t)
|
||||
list)
|
||||
(while (search-forward "\n\^_" nil t)
|
||||
;; We want the 0-origin character position of the ^_.
|
||||
;; That is the same as the Emacs (1-origin) position
|
||||
;; of the newline before it.
|
||||
(let ((beg (match-beginning 0)))
|
||||
(forward-line 2)
|
||||
(if (re-search-backward regexp beg t)
|
||||
(setq list
|
||||
(cons (list (buffer-substring-no-properties
|
||||
(match-beginning 1)
|
||||
(match-end 1))
|
||||
beg)
|
||||
list)))))
|
||||
(goto-char (point-max))
|
||||
(forward-line -8)
|
||||
(let ((buffer-read-only nil))
|
||||
(if (search-forward "\^_\nEnd tag table\n" nil t)
|
||||
(let ((end (point)))
|
||||
(search-backward "\nTag table:\n")
|
||||
(beginning-of-line)
|
||||
(delete-region (point) end)))
|
||||
(goto-char (point-max))
|
||||
(insert "\^_\f\nTag table:\n")
|
||||
(move-marker Info-tag-table-marker (point))
|
||||
(setq list (nreverse list))
|
||||
(while list
|
||||
(insert "Node: " (car (car list)) ?\177)
|
||||
(princ (car (cdr (car list))) (current-buffer))
|
||||
(insert ?\n)
|
||||
(setq list (cdr list)))
|
||||
(insert "\^_\nEnd tag table\n")))))
|
||||
(goto-char opoint)
|
||||
(narrow-to-region omin (if nomax (1+ (buffer-size))
|
||||
(min omax (point-max))))))
|
||||
(message "Tagifying %s ... done" (file-name-nondirectory (buffer-file-name))))
|
||||
|
||||
;;;###autoload
|
||||
(defun Info-split ()
|
||||
"Split an info file into an indirect file plus bounded-size subfiles.
|
||||
Each subfile will be up to 50,000 characters plus one node.
|
||||
|
||||
To use this command, first visit a large Info file that has a tag
|
||||
table. The buffer is modified into a (small) indirect info file which
|
||||
should be saved in place of the original visited file.
|
||||
|
||||
The subfiles are written in the same directory the original file is
|
||||
in, with names generated by appending `-' and a number to the original
|
||||
file name. The indirect file still functions as an Info file, but it
|
||||
contains just the tag table and a directory of subfiles."
|
||||
|
||||
(interactive)
|
||||
(if (< (buffer-size) 70000)
|
||||
(error "This is too small to be worth splitting"))
|
||||
(goto-char (point-min))
|
||||
(search-forward "\^_")
|
||||
(forward-char -1)
|
||||
(let ((start (point))
|
||||
(chars-deleted 0)
|
||||
subfiles
|
||||
(subfile-number 1)
|
||||
(case-fold-search t)
|
||||
(filename (file-name-sans-versions buffer-file-name)))
|
||||
(goto-char (point-max))
|
||||
(forward-line -8)
|
||||
(setq buffer-read-only nil)
|
||||
(or (search-forward "\^_\nEnd tag table\n" nil t)
|
||||
(error "Tag table required; use M-x Info-tagify"))
|
||||
(search-backward "\nTag table:\n")
|
||||
(if (looking-at "\nTag table:\n\^_")
|
||||
(error "Tag table is just a skeleton; use M-x Info-tagify"))
|
||||
(beginning-of-line)
|
||||
(forward-char 1)
|
||||
(save-restriction
|
||||
(narrow-to-region (point-min) (point))
|
||||
(goto-char (point-min))
|
||||
(while (< (1+ (point)) (point-max))
|
||||
(goto-char (min (+ (point) 50000) (point-max)))
|
||||
(search-forward "\^_" nil 'move)
|
||||
(setq subfiles
|
||||
(cons (list (+ start chars-deleted)
|
||||
(concat (file-name-nondirectory filename)
|
||||
(format "-%d" subfile-number)))
|
||||
subfiles))
|
||||
;; Put a newline at end of split file, to make Unix happier.
|
||||
(insert "\n")
|
||||
(write-region (point-min) (point)
|
||||
(concat filename (format "-%d" subfile-number)))
|
||||
(delete-region (1- (point)) (point))
|
||||
;; Back up over the final ^_.
|
||||
(forward-char -1)
|
||||
(setq chars-deleted (+ chars-deleted (- (point) start)))
|
||||
(delete-region start (point))
|
||||
(setq subfile-number (1+ subfile-number))))
|
||||
(while subfiles
|
||||
(goto-char start)
|
||||
(insert (nth 1 (car subfiles))
|
||||
(format ": %d" (1- (car (car subfiles))))
|
||||
"\n")
|
||||
(setq subfiles (cdr subfiles)))
|
||||
(goto-char start)
|
||||
(insert "\^_\nIndirect:\n")
|
||||
(search-forward "\nTag Table:\n")
|
||||
(insert "(Indirect)\n")))
|
||||
|
||||
;;;###autoload
|
||||
(defun Info-validate ()
|
||||
"Check current buffer for validity as an Info file.
|
||||
Check that every node pointer points to an existing node."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(if (search-forward "\nTag table:\n(Indirect)\n" nil t)
|
||||
(error "Don't yet know how to validate indirect info files: \"%s\""
|
||||
(buffer-name (current-buffer))))
|
||||
(goto-char (point-min))
|
||||
(let ((allnodes '(("*")))
|
||||
(regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]")
|
||||
(case-fold-search t)
|
||||
(tags-losing nil)
|
||||
(lossages ()))
|
||||
(while (search-forward "\n\^_" nil t)
|
||||
(forward-line 1)
|
||||
(let ((beg (point)))
|
||||
(forward-line 1)
|
||||
(if (re-search-backward regexp beg t)
|
||||
(let ((name (downcase
|
||||
(buffer-substring-no-properties
|
||||
(match-beginning 1)
|
||||
(progn
|
||||
(goto-char (match-end 1))
|
||||
(skip-chars-backward " \t")
|
||||
(point))))))
|
||||
(if (assoc name allnodes)
|
||||
(setq lossages
|
||||
(cons (list name "Duplicate node-name" nil)
|
||||
lossages))
|
||||
(setq allnodes
|
||||
(cons (list name
|
||||
(progn
|
||||
(end-of-line)
|
||||
(and (re-search-backward
|
||||
"prev[ious]*:" beg t)
|
||||
(progn
|
||||
(goto-char (match-end 0))
|
||||
(downcase
|
||||
(Info-following-node-name)))))
|
||||
beg)
|
||||
allnodes)))))))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "\n\^_" nil t)
|
||||
(forward-line 1)
|
||||
(let ((beg (point))
|
||||
thisnode next)
|
||||
(forward-line 1)
|
||||
(if (re-search-backward regexp beg t)
|
||||
(save-restriction
|
||||
(search-forward "\n\^_" nil 'move)
|
||||
(narrow-to-region beg (point))
|
||||
(setq thisnode (downcase
|
||||
(buffer-substring-no-properties
|
||||
(match-beginning 1)
|
||||
(progn
|
||||
(goto-char (match-end 1))
|
||||
(skip-chars-backward " \t")
|
||||
(point)))))
|
||||
(end-of-line)
|
||||
(and (search-backward "next:" nil t)
|
||||
(setq next (Info-validate-node-name "invalid Next"))
|
||||
(assoc next allnodes)
|
||||
(if (equal (car (cdr (assoc next allnodes)))
|
||||
thisnode)
|
||||
;; allow multiple `next' pointers to one node
|
||||
(let ((tem lossages))
|
||||
(while tem
|
||||
(if (and (equal (car (cdr (car tem)))
|
||||
"should have Previous")
|
||||
(equal (car (car tem))
|
||||
next))
|
||||
(setq lossages (delq (car tem) lossages)))
|
||||
(setq tem (cdr tem))))
|
||||
(setq lossages
|
||||
(cons (list next
|
||||
"should have Previous"
|
||||
thisnode)
|
||||
lossages))))
|
||||
(end-of-line)
|
||||
(if (re-search-backward "prev[ious]*:" nil t)
|
||||
(Info-validate-node-name "invalid Previous"))
|
||||
(end-of-line)
|
||||
(if (search-backward "up:" nil t)
|
||||
(Info-validate-node-name "invalid Up"))
|
||||
(if (re-search-forward "\n* Menu:" nil t)
|
||||
(while (re-search-forward "\n\\* " nil t)
|
||||
(Info-validate-node-name
|
||||
(concat "invalid menu item "
|
||||
(buffer-substring (point)
|
||||
(save-excursion
|
||||
(skip-chars-forward "^:")
|
||||
(point))))
|
||||
(Info-extract-menu-node-name))))
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "\\*note[ \n]*[^:\t]*:" nil t)
|
||||
(goto-char (+ (match-beginning 0) 5))
|
||||
(skip-chars-forward " \n")
|
||||
(Info-validate-node-name
|
||||
(concat "invalid reference "
|
||||
(buffer-substring (point)
|
||||
(save-excursion
|
||||
(skip-chars-forward "^:")
|
||||
(point))))
|
||||
(Info-extract-menu-node-name "Bad format cross-reference")))))))
|
||||
(setq tags-losing (not (Info-validate-tags-table)))
|
||||
(if (or lossages tags-losing)
|
||||
(with-output-to-temp-buffer " *problems in info file*"
|
||||
(while lossages
|
||||
(princ "In node \"")
|
||||
(princ (car (car lossages)))
|
||||
(princ "\", ")
|
||||
(let ((tem (nth 1 (car lossages))))
|
||||
(cond ((string-match "\n" tem)
|
||||
(princ (substring tem 0 (match-beginning 0)))
|
||||
(princ "..."))
|
||||
(t
|
||||
(princ tem))))
|
||||
(if (nth 2 (car lossages))
|
||||
(progn
|
||||
(princ ": ")
|
||||
(let ((tem (nth 2 (car lossages))))
|
||||
(cond ((string-match "\n" tem)
|
||||
(princ (substring tem 0 (match-beginning 0)))
|
||||
(princ "..."))
|
||||
(t
|
||||
(princ tem))))))
|
||||
(terpri)
|
||||
(setq lossages (cdr lossages)))
|
||||
(if tags-losing (princ "\nTags table must be recomputed\n")))
|
||||
;; Here if info file is valid.
|
||||
;; If we already made a list of problems, clear it out.
|
||||
(save-excursion
|
||||
(if (get-buffer " *problems in info file*")
|
||||
(progn
|
||||
(set-buffer " *problems in info file*")
|
||||
(kill-buffer (current-buffer)))))
|
||||
(message "File appears valid"))))))
|
||||
|
||||
(defun Info-validate-node-name (kind &optional name)
|
||||
(if name
|
||||
nil
|
||||
(goto-char (match-end 0))
|
||||
(skip-chars-forward " \t")
|
||||
(if (= (following-char) ?\()
|
||||
nil
|
||||
(setq name
|
||||
(buffer-substring-no-properties
|
||||
(point)
|
||||
(progn
|
||||
(skip-chars-forward "^,\t\n")
|
||||
(skip-chars-backward " ")
|
||||
(point))))))
|
||||
(if (null name)
|
||||
nil
|
||||
(setq name (downcase name))
|
||||
(or (and (> (length name) 0) (= (aref name 0) ?\())
|
||||
(assoc name allnodes)
|
||||
(setq lossages
|
||||
(cons (list thisnode kind name) lossages))))
|
||||
name)
|
||||
|
||||
(defun Info-validate-tags-table ()
|
||||
(goto-char (point-min))
|
||||
(if (not (search-forward "\^_\nEnd tag table\n" nil t))
|
||||
t
|
||||
(not (catch 'losing
|
||||
(let* ((end (match-beginning 0))
|
||||
(start (progn (search-backward "\nTag table:\n")
|
||||
(1- (match-end 0))))
|
||||
tem)
|
||||
(setq tem allnodes)
|
||||
(while tem
|
||||
(goto-char start)
|
||||
(or (equal (car (car tem)) "*")
|
||||
(search-forward (concat "Node: "
|
||||
(car (car tem))
|
||||
"\177")
|
||||
end t)
|
||||
(throw 'losing 'x))
|
||||
(setq tem (cdr tem)))
|
||||
(goto-char (1+ start))
|
||||
(while (looking-at ".*Node: \\(.*\\)\177\\([0-9]+\\)$")
|
||||
(setq tem (downcase (buffer-substring-no-properties
|
||||
(match-beginning 1)
|
||||
(match-end 1))))
|
||||
(setq tem (assoc tem allnodes))
|
||||
(if (or (not tem)
|
||||
(< 1000 (progn
|
||||
(goto-char (match-beginning 2))
|
||||
(setq tem (- (car (cdr (cdr tem)))
|
||||
(read (current-buffer))))
|
||||
(if (> tem 0) tem (- tem)))))
|
||||
(throw 'losing 'y))
|
||||
(forward-line 1)))
|
||||
(if (looking-at "\^_\n")
|
||||
(forward-line 1))
|
||||
(or (looking-at "End tag table\n")
|
||||
(throw 'losing 'z))
|
||||
nil))))
|
||||
|
||||
;;;###autoload
|
||||
(defun batch-info-validate ()
|
||||
"Runs `Info-validate' on the files remaining on the command line.
|
||||
Must be used only with -batch, and kills Emacs on completion.
|
||||
Each file will be processed even if an error occurred previously.
|
||||
For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
|
||||
(if (not noninteractive)
|
||||
(error "batch-info-validate may only be used -batch."))
|
||||
(let ((version-control t)
|
||||
(auto-save-default nil)
|
||||
(find-file-run-dired nil)
|
||||
(kept-old-versions 259259)
|
||||
(kept-new-versions 259259))
|
||||
(let ((error 0)
|
||||
file
|
||||
(files ()))
|
||||
(while command-line-args-left
|
||||
(setq file (expand-file-name (car command-line-args-left)))
|
||||
(cond ((not (file-exists-p file))
|
||||
(message ">> %s does not exist!" file)
|
||||
(setq error 1
|
||||
command-line-args-left (cdr command-line-args-left)))
|
||||
((file-directory-p file)
|
||||
(setq command-line-args-left (nconc (directory-files file)
|
||||
(cdr command-line-args-left))))
|
||||
(t
|
||||
(setq files (cons file files)
|
||||
command-line-args-left (cdr command-line-args-left)))))
|
||||
(while files
|
||||
(setq file (car files)
|
||||
files (cdr files))
|
||||
(let ((lose nil))
|
||||
(condition-case err
|
||||
(progn
|
||||
(if buffer-file-name (kill-buffer (current-buffer)))
|
||||
(find-file file)
|
||||
(buffer-disable-undo (current-buffer))
|
||||
(set-buffer-modified-p nil)
|
||||
(fundamental-mode)
|
||||
(let ((case-fold-search nil))
|
||||
(goto-char (point-max))
|
||||
(cond ((search-backward "\n\^_\^L\nTag table:\n" nil t)
|
||||
(message "%s already tagified" file))
|
||||
((< (point-max) 30000)
|
||||
(message "%s too small to bother tagifying" file))
|
||||
(t
|
||||
(Info-tagify))))
|
||||
(let ((loss-name " *problems in info file*"))
|
||||
(message "Checking validity of info file %s..." file)
|
||||
(if (get-buffer loss-name)
|
||||
(kill-buffer loss-name))
|
||||
(Info-validate)
|
||||
(if (not (get-buffer loss-name))
|
||||
nil ;(message "Checking validity of info file %s... OK" file)
|
||||
(message "----------------------------------------------------------------------")
|
||||
(message ">> PROBLEMS IN INFO FILE %s" file)
|
||||
(save-excursion
|
||||
(set-buffer loss-name)
|
||||
(princ (buffer-substring-no-properties
|
||||
(point-min) (point-max))))
|
||||
(message "----------------------------------------------------------------------")
|
||||
(setq error 1 lose t)))
|
||||
(if (and (buffer-modified-p)
|
||||
(not lose))
|
||||
(progn (message "Saving modified %s" file)
|
||||
(save-buffer))))
|
||||
(error (message ">> Error: %s" (prin1-to-string err))))))
|
||||
(kill-emacs error))))
|
||||
|
||||
;;; informat.el ends here
|
@ -1,247 +0,0 @@
|
||||
;;; makeinfo.el --- run makeinfo conveniently
|
||||
|
||||
;; Copyright (C) 1991, 1993 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Robert J. Chassell
|
||||
;; Maintainer: FSF
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
||||
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; The Texinfo mode `makeinfo' related commands are:
|
||||
|
||||
;; makeinfo-region to run makeinfo on the current region.
|
||||
;; makeinfo-buffer to run makeinfo on the current buffer, or
|
||||
;; with optional prefix arg, on current region
|
||||
;; kill-compilation to kill currently running makeinfo job
|
||||
;; makeinfo-recenter-makeinfo-buffer to redisplay *compilation* buffer
|
||||
|
||||
;;; Keybindings (defined in `texinfo.el')
|
||||
|
||||
;; makeinfo bindings
|
||||
; (define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region)
|
||||
; (define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer)
|
||||
; (define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation)
|
||||
; (define-key texinfo-mode-map "\C-c\C-m\C-l"
|
||||
; 'makeinfo-recenter-compilation-buffer)
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Variables used by `makeinfo'
|
||||
|
||||
(require 'compile)
|
||||
|
||||
(defvar makeinfo-run-command "makeinfo"
|
||||
"*Command used to run `makeinfo' subjob.
|
||||
The name of the file is appended to this string, separated by a space.")
|
||||
|
||||
(defvar makeinfo-options "--fill-column=70"
|
||||
"*String containing options for running `makeinfo'.
|
||||
Do not include `--footnote-style' or `--paragraph-indent';
|
||||
the proper way to specify those is with the Texinfo commands
|
||||
`@footnotestyle` and `@paragraphindent'.")
|
||||
|
||||
(require 'texinfo)
|
||||
|
||||
(defvar makeinfo-compilation-process nil
|
||||
"Process that runs `makeinfo'. Should start out nil.")
|
||||
|
||||
(defvar makeinfo-temp-file nil
|
||||
"Temporary file name used for text being sent as input to `makeinfo'.")
|
||||
|
||||
(defvar makeinfo-output-file-name nil
|
||||
"Info file name used for text output by `makeinfo'.")
|
||||
|
||||
|
||||
;;; The `makeinfo' function definitions
|
||||
|
||||
(defun makeinfo-region (region-beginning region-end)
|
||||
"Make Info file from region of current Texinfo file, and switch to it.
|
||||
|
||||
This command does not offer the `next-error' feature since it would
|
||||
apply to a temporary file, not the original; use the `makeinfo-buffer'
|
||||
command to gain use of `next-error'."
|
||||
|
||||
(interactive "r")
|
||||
(let (filename-or-header
|
||||
filename-or-header-beginning
|
||||
filename-or-header-end)
|
||||
;; Cannot use `let' for makeinfo-temp-file or
|
||||
;; makeinfo-output-file-name since `makeinfo-compilation-sentinel'
|
||||
;; needs them.
|
||||
|
||||
(setq makeinfo-temp-file
|
||||
(concat
|
||||
(make-temp-name
|
||||
(substring (buffer-file-name)
|
||||
0
|
||||
(or (string-match "\\.tex" (buffer-file-name))
|
||||
(length (buffer-file-name)))))
|
||||
".texinfo"))
|
||||
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(let ((search-end (save-excursion (forward-line 100) (point))))
|
||||
;; Find and record the Info filename,
|
||||
;; or else explain that a filename is needed.
|
||||
(if (re-search-forward
|
||||
"^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*"
|
||||
search-end t)
|
||||
(setq makeinfo-output-file-name
|
||||
(buffer-substring (match-beginning 1) (match-end 1)))
|
||||
(error
|
||||
"The texinfo file needs a line saying: @setfilename <name>"))
|
||||
|
||||
;; Find header and specify its beginning and end.
|
||||
(goto-char (point-min))
|
||||
(if (and
|
||||
(prog1
|
||||
(search-forward tex-start-of-header search-end t)
|
||||
(beginning-of-line)
|
||||
;; Mark beginning of header.
|
||||
(setq filename-or-header-beginning (point)))
|
||||
(prog1
|
||||
(search-forward tex-end-of-header nil t)
|
||||
(beginning-of-line)
|
||||
;; Mark end of header
|
||||
(setq filename-or-header-end (point))))
|
||||
|
||||
;; Insert the header into the temporary file.
|
||||
(write-region
|
||||
(min filename-or-header-beginning region-beginning)
|
||||
filename-or-header-end
|
||||
makeinfo-temp-file nil nil)
|
||||
|
||||
;; Else no header; insert @filename line into temporary file.
|
||||
(goto-char (point-min))
|
||||
(search-forward "@setfilename" search-end t)
|
||||
(beginning-of-line)
|
||||
(setq filename-or-header-beginning (point))
|
||||
(forward-line 1)
|
||||
(setq filename-or-header-end (point))
|
||||
(write-region
|
||||
(min filename-or-header-beginning region-beginning)
|
||||
filename-or-header-end
|
||||
makeinfo-temp-file nil nil))
|
||||
|
||||
;; Insert the region into the file.
|
||||
(write-region
|
||||
(max region-beginning filename-or-header-end)
|
||||
region-end
|
||||
makeinfo-temp-file t nil)
|
||||
|
||||
;; Run the `makeinfo-compile' command in the *compilation* buffer
|
||||
(save-excursion
|
||||
(makeinfo-compile
|
||||
(concat makeinfo-run-command
|
||||
" "
|
||||
makeinfo-options
|
||||
" "
|
||||
makeinfo-temp-file)
|
||||
"Use `makeinfo-buffer' to gain use of the `next-error' command"
|
||||
nil)))))))
|
||||
|
||||
;;; Actually run makeinfo. COMMAND is the command to run.
|
||||
;;; ERROR-MESSAGE is what to say when next-error can't find another error.
|
||||
;;; If PARSE-ERRORS is non-nil, do try to parse error messages.
|
||||
(defun makeinfo-compile (command error-message parse-errors)
|
||||
(let ((buffer
|
||||
(compile-internal command error-message nil
|
||||
(and (not parse-errors)
|
||||
;; If we do want to parse errors, pass nil.
|
||||
;; Otherwise, use this function, which won't
|
||||
;; ever find any errors.
|
||||
'(lambda (&rest ignore)
|
||||
(setq compilation-error-list nil))))))
|
||||
(set-process-sentinel (get-buffer-process buffer)
|
||||
'makeinfo-compilation-sentinel)))
|
||||
|
||||
;; Delete makeinfo-temp-file after processing is finished,
|
||||
;; and visit Info file.
|
||||
;; This function is called when the compilation process changes state.
|
||||
;; Based on `compilation-sentinel' in compile.el
|
||||
(defun makeinfo-compilation-sentinel (proc msg)
|
||||
(compilation-sentinel proc msg)
|
||||
(if (and makeinfo-temp-file (file-exists-p makeinfo-temp-file))
|
||||
(delete-file makeinfo-temp-file))
|
||||
;; Always use the version on disk.
|
||||
(if (get-file-buffer makeinfo-output-file-name)
|
||||
(progn (set-buffer makeinfo-output-file-name)
|
||||
(revert-buffer t t))
|
||||
(find-file makeinfo-output-file-name))
|
||||
(goto-char (point-min)))
|
||||
|
||||
(defun makeinfo-buffer ()
|
||||
"Make Info file from current buffer.
|
||||
|
||||
Use the \\[next-error] command to move to the next error
|
||||
\(if there are errors\)."
|
||||
|
||||
(interactive)
|
||||
(cond ((null buffer-file-name)
|
||||
(error "Buffer not visiting any file"))
|
||||
((buffer-modified-p)
|
||||
(if (y-or-n-p "Buffer modified; do you want to save it? ")
|
||||
(save-buffer))))
|
||||
|
||||
;; Find and record the Info filename,
|
||||
;; or else explain that a filename is needed.
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(let ((search-end (save-excursion (forward-line 100) (point))))
|
||||
(if (re-search-forward
|
||||
"^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*"
|
||||
search-end t)
|
||||
(setq makeinfo-output-file-name
|
||||
(buffer-substring (match-beginning 1) (match-end 1)))
|
||||
(error
|
||||
"The texinfo file needs a line saying: @setfilename <name>"))))
|
||||
|
||||
(save-excursion
|
||||
(makeinfo-compile
|
||||
(concat makeinfo-run-command " " makeinfo-options
|
||||
" " buffer-file-name)
|
||||
"No more errors."
|
||||
t)))
|
||||
|
||||
(defun makeinfo-recenter-compilation-buffer (linenum)
|
||||
"Redisplay `*compilation*' buffer so most recent output can be seen.
|
||||
The last line of the buffer is displayed on
|
||||
line LINE of the window, or centered if LINE is nil."
|
||||
(interactive "P")
|
||||
(let ((makeinfo-buffer (get-buffer "*compilation*"))
|
||||
(old-buffer (current-buffer)))
|
||||
(if (null makeinfo-buffer)
|
||||
(message "No *compilation* buffer")
|
||||
(pop-to-buffer makeinfo-buffer)
|
||||
(bury-buffer makeinfo-buffer)
|
||||
(goto-char (point-max))
|
||||
(recenter (if linenum
|
||||
(prefix-numeric-value linenum)
|
||||
(/ (window-height) 2)))
|
||||
(pop-to-buffer old-buffer)
|
||||
)))
|
||||
|
||||
;;; Place `provide' at end of file.
|
||||
(provide 'makeinfo)
|
||||
|
||||
;;; makeinfo.el ends here
|
||||
|
@ -1,180 +0,0 @@
|
||||
;; -*- Mode: Emacs-Lisp -*-
|
||||
|
||||
;; This is the `new-useful-setqs' file
|
||||
;; This overrides old defvars since they were revised.
|
||||
|
||||
(setq texinfmt-version "2.35 of 10 September 1996")
|
||||
|
||||
(setq texinfo-master-menu-header
|
||||
"\n@detailmenu\n --- The Detailed Node Listing ---\n")
|
||||
|
||||
(setq texinfo-environment-regexp
|
||||
(concat
|
||||
"^@"
|
||||
"\\("
|
||||
"cartouche\\|"
|
||||
"display\\|"
|
||||
"end\\|"
|
||||
"enumerate\\|"
|
||||
"example\\|"
|
||||
"f?table\\|"
|
||||
"flushleft\\|"
|
||||
"flushright\\|"
|
||||
"format\\|"
|
||||
"group\\|"
|
||||
"ifhtml\\|"
|
||||
"ifinfo\\|"
|
||||
"iftex\\|"
|
||||
"ignore\\|"
|
||||
"itemize\\|"
|
||||
"lisp\\|"
|
||||
"macro\\|"
|
||||
"multitable\\|"
|
||||
"quotation\\|"
|
||||
"smallexample\\|"
|
||||
"smalllisp\\|"
|
||||
"tex"
|
||||
"\\)")
|
||||
)
|
||||
|
||||
(setq texinfo-no-refill-regexp
|
||||
(concat
|
||||
"^@"
|
||||
"\\("
|
||||
"example\\|"
|
||||
"smallexample\\|"
|
||||
"lisp\\|"
|
||||
"smalllisp\\|"
|
||||
"display\\|"
|
||||
"format\\|"
|
||||
"flushleft\\|"
|
||||
"flushright\\|"
|
||||
"menu\\|"
|
||||
"multitable\\|"
|
||||
"titlepage\\|"
|
||||
"iftex\\|"
|
||||
"ifhtml\\|"
|
||||
"tex\\|"
|
||||
"html"
|
||||
"\\)"))
|
||||
|
||||
|
||||
(setq texinfo-accent-commands
|
||||
(concat
|
||||
"@OE\\|"
|
||||
"@oe\\|"
|
||||
"@AA\\|"
|
||||
"@aa\\|"
|
||||
"@AE\\|"
|
||||
"@ae\\|"
|
||||
"@ss\\|"
|
||||
"@^\\|"
|
||||
"@`\\|"
|
||||
"@'\\|"
|
||||
"@\"\\|"
|
||||
"@,\\|"
|
||||
"@=\\|"
|
||||
"@~\\|"
|
||||
"@questiondown{\\|"
|
||||
"@exclamdown{\\|"
|
||||
"@L{\\|"
|
||||
"@l{\\|"
|
||||
"@O{\\|"
|
||||
"@o{\\|"
|
||||
"@dotaccent{\\|"
|
||||
"@ubaraccent{\\|"
|
||||
"@d{\\|"
|
||||
"@H{\\|"
|
||||
"@ringaccent{\\|"
|
||||
"@tieaccent{\\|"
|
||||
"@u{\\|"
|
||||
"@v{\\|"
|
||||
"@dotless{"
|
||||
))
|
||||
|
||||
(setq texinfo-part-of-para-regexp
|
||||
(concat
|
||||
"^@"
|
||||
"\\("
|
||||
"b{\\|"
|
||||
"bullet{\\|"
|
||||
"cite{\\|"
|
||||
"code{\\|"
|
||||
"emph{\\|"
|
||||
"equiv{\\|"
|
||||
"error{\\|"
|
||||
"expansion{\\|"
|
||||
"file{\\|"
|
||||
"i{\\|"
|
||||
"inforef{\\|"
|
||||
"kbd{\\|"
|
||||
"key{\\|"
|
||||
"lisp{\\|"
|
||||
"email{\\|"
|
||||
"minus{\\|"
|
||||
"point{\\|"
|
||||
"print{\\|"
|
||||
"pxref{\\|"
|
||||
"r{\\|"
|
||||
"ref{\\|"
|
||||
"result{\\|"
|
||||
"samp{\\|"
|
||||
"sc{\\|"
|
||||
"t{\\|"
|
||||
"TeX{\\|"
|
||||
"today{\\|"
|
||||
"url{\\|"
|
||||
"var{\\|"
|
||||
"w{\\|"
|
||||
"xref{\\|"
|
||||
"@-\\|" ; @- is a descretionary hyphen (not an accent) (a noop).
|
||||
texinfo-accent-commands
|
||||
"\\)"
|
||||
))
|
||||
|
||||
(setq texinfo-raisesections-alist
|
||||
'((@chapter . @chapter) ; Cannot go higher
|
||||
(@unnumbered . @unnumbered)
|
||||
(@centerchap . @unnumbered)
|
||||
|
||||
(@majorheading . @majorheading)
|
||||
(@chapheading . @chapheading)
|
||||
(@appendix . @appendix)
|
||||
|
||||
(@section . @chapter)
|
||||
(@unnumberedsec . @unnumbered)
|
||||
(@heading . @chapheading)
|
||||
(@appendixsec . @appendix)
|
||||
|
||||
(@subsection . @section)
|
||||
(@unnumberedsubsec . @unnumberedsec)
|
||||
(@subheading . @heading)
|
||||
(@appendixsubsec . @appendixsec)
|
||||
|
||||
(@subsubsection . @subsection)
|
||||
(@unnumberedsubsubsec . @unnumberedsubsec)
|
||||
(@subsubheading . @subheading)
|
||||
(@appendixsubsubsec . @appendixsubsec)))
|
||||
|
||||
(setq texinfo-lowersections-alist
|
||||
'((@chapter . @section)
|
||||
(@unnumbered . @unnumberedsec)
|
||||
(@centerchap . @unnumberedsec)
|
||||
(@majorheading . @heading)
|
||||
(@chapheading . @heading)
|
||||
(@appendix . @appendixsec)
|
||||
|
||||
(@section . @subsection)
|
||||
(@unnumberedsec . @unnumberedsubsec)
|
||||
(@heading . @subheading)
|
||||
(@appendixsec . @appendixsubsec)
|
||||
|
||||
(@subsection . @subsubsection)
|
||||
(@unnumberedsubsec . @unnumberedsubsubsec)
|
||||
(@subheading . @subsubheading)
|
||||
(@appendixsubsec . @appendixsubsubsec)
|
||||
|
||||
(@subsubsection . @subsubsection) ; Cannot go lower.
|
||||
(@unnumberedsubsubsec . @unnumberedsubsubsec)
|
||||
(@subsubheading . @subsubheading)
|
||||
(@appendixsubsubsec . @appendixsubsubsec)))
|
File diff suppressed because it is too large
Load Diff
@ -1,932 +0,0 @@
|
||||
;;; texinfo.el--major mode for editing Texinfo files.
|
||||
|
||||
;; Copyright (C) 1985, '88, '89, '90, '91,
|
||||
;; '92, '93, '96 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Robert J. Chassell
|
||||
;; Date: 6 Sep 1996
|
||||
;; Maintainer: bug-texinfo@prep.ai.mit.edu
|
||||
;; Keywords: maint, tex, docs
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
||||
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
;;; Autoloads:
|
||||
|
||||
(autoload 'makeinfo-region
|
||||
"makeinfo"
|
||||
"Make Info file from region of current Texinfo file, and switch to it.
|
||||
|
||||
This command does not offer the `next-error' feature since it would
|
||||
apply to a temporary file, not the original; use the `makeinfo-buffer'
|
||||
command to gain use of `next-error'."
|
||||
t nil)
|
||||
|
||||
(autoload 'makeinfo-buffer
|
||||
"makeinfo"
|
||||
"Make Info file from current buffer.
|
||||
|
||||
Use the \\[next-error] command to move to the next error
|
||||
\(if there are errors\)."
|
||||
t nil)
|
||||
|
||||
(autoload 'kill-compilation
|
||||
"compile"
|
||||
"Kill the process made by the \\[compile] command."
|
||||
t nil)
|
||||
|
||||
(autoload 'makeinfo-recenter-compilation-buffer
|
||||
"makeinfo"
|
||||
"Redisplay `*compilation*' buffer so most recent output can be seen.
|
||||
The last line of the buffer is displayed on
|
||||
line LINE of the window, or centered if LINE is nil."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-update-node
|
||||
"texnfo-upd"
|
||||
"Without any prefix argument, update the node in which point is located.
|
||||
Non-nil argument (prefix, if interactive) means update the nodes in the
|
||||
marked region.
|
||||
|
||||
The functions for creating or updating nodes and menus, and their
|
||||
keybindings, are:
|
||||
|
||||
texinfo-update-node (&optional region-p) \\[texinfo-update-node]
|
||||
texinfo-every-node-update () \\[texinfo-every-node-update]
|
||||
texinfo-sequential-node-update (&optional region-p)
|
||||
|
||||
texinfo-make-menu (&optional region-p) \\[texinfo-make-menu]
|
||||
texinfo-all-menus-update () \\[texinfo-all-menus-update]
|
||||
texinfo-master-menu ()
|
||||
|
||||
texinfo-indent-menu-description (column &optional region-p)
|
||||
|
||||
The `texinfo-column-for-description' variable specifies the column to
|
||||
which menu descriptions are indented. Its default value is 32."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-every-node-update
|
||||
"texnfo-upd"
|
||||
"Update every node in a Texinfo file."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-sequential-node-update
|
||||
"texnfo-upd"
|
||||
"Update one node (or many) in a Texinfo file with sequential pointers.
|
||||
|
||||
This function causes the `Next' or `Previous' pointer to point to the
|
||||
immediately preceding or following node, even if it is at a higher or
|
||||
lower hierarchical level in the document. Continually pressing `n' or
|
||||
`p' takes you straight through the file.
|
||||
|
||||
Without any prefix argument, update the node in which point is located.
|
||||
Non-nil argument (prefix, if interactive) means update the nodes in the
|
||||
marked region.
|
||||
|
||||
This command makes it awkward to navigate among sections and
|
||||
subsections; it should be used only for those documents that are meant
|
||||
to be read like a novel rather than a reference, and for which the
|
||||
Info `g*' command is inadequate."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-make-menu
|
||||
"texnfo-upd"
|
||||
"Without any prefix argument, make or update a menu.
|
||||
Make the menu for the section enclosing the node found following point.
|
||||
|
||||
Non-nil argument (prefix, if interactive) means make or update menus
|
||||
for nodes within or part of the marked region.
|
||||
|
||||
Whenever a menu exists, and is being updated, the descriptions that
|
||||
are associated with node names in the pre-existing menu are
|
||||
incorporated into the new menu. Otherwise, the nodes' section titles
|
||||
are inserted as descriptions."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-all-menus-update
|
||||
"texnfo-upd"
|
||||
"Update every regular menu in a Texinfo file.
|
||||
Remove pre-existing master menu, if there is one.
|
||||
|
||||
If called with a non-nil argument, this function first updates all the
|
||||
nodes in the buffer before updating the menus."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-master-menu
|
||||
"texnfo-upd"
|
||||
"Make a master menu for a whole Texinfo file.
|
||||
Non-nil argument (prefix, if interactive) means first update all
|
||||
existing nodes and menus. Remove pre-existing master menu, if there is one.
|
||||
|
||||
This function creates a master menu that follows the top node. The
|
||||
master menu includes every entry from all the other menus. It
|
||||
replaces any existing ordinary menu that follows the top node.
|
||||
|
||||
If called with a non-nil argument, this function first updates all the
|
||||
menus in the buffer (incorporating descriptions from pre-existing
|
||||
menus) before it constructs the master menu.
|
||||
|
||||
The function removes the detailed part of an already existing master
|
||||
menu. This action depends on the pre-existing master menu using the
|
||||
standard `texinfo-master-menu-header'.
|
||||
|
||||
The master menu has the following format, which is adapted from the
|
||||
recommendation in the Texinfo Manual:
|
||||
|
||||
* The first part contains the major nodes in the Texinfo file: the
|
||||
nodes for the chapters, chapter-like sections, and the major
|
||||
appendices. This includes the indices, so long as they are in
|
||||
chapter-like sections, such as unnumbered sections.
|
||||
|
||||
* The second and subsequent parts contain a listing of the other,
|
||||
lower level menus, in order. This way, an inquirer can go
|
||||
directly to a particular node if he or she is searching for
|
||||
specific information.
|
||||
|
||||
Each of the menus in the detailed node listing is introduced by the
|
||||
title of the section containing the menu."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-indent-menu-description
|
||||
"texnfo-upd"
|
||||
"Indent every description in menu following point to COLUMN.
|
||||
Non-nil argument (prefix, if interactive) means indent every
|
||||
description in every menu in the region. Does not indent second and
|
||||
subsequent lines of a multi-line description."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-insert-node-lines
|
||||
"texnfo-upd"
|
||||
"Insert missing `@node' lines in region of Texinfo file.
|
||||
Non-nil argument (prefix, if interactive) means also to insert the
|
||||
section titles as node names; and also to insert the section titles as
|
||||
node names in pre-existing @node lines that lack names."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-start-menu-description
|
||||
"texnfo-upd"
|
||||
"In this menu entry, insert the node's section title as a description.
|
||||
Position point at beginning of description ready for editing.
|
||||
Do not insert a title if the line contains an existing description.
|
||||
|
||||
You will need to edit the inserted text since a useful description
|
||||
complements the node name rather than repeats it as a title does."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-multiple-files-update
|
||||
"texnfo-upd"
|
||||
"Update first node pointers in each file included in OUTER-FILE;
|
||||
create or update main menu in the outer file that refers to such nodes.
|
||||
This does not create or update menus or pointers within the included files.
|
||||
|
||||
With optional MAKE-MASTER-MENU argument (prefix arg, if interactive),
|
||||
insert a master menu in OUTER-FILE. This does not create or update
|
||||
menus or pointers within the included files.
|
||||
|
||||
With optional UPDATE-EVERYTHING argument (numeric prefix arg, if
|
||||
interactive), update all the menus and all the `Next', `Previous', and
|
||||
`Up' pointers of all the files included in OUTER-FILE before inserting
|
||||
a master menu in OUTER-FILE.
|
||||
|
||||
The command also updates the `Top' level node pointers of OUTER-FILE.
|
||||
|
||||
Notes:
|
||||
|
||||
* this command does NOT save any files--you must save the
|
||||
outer file and any modified, included files.
|
||||
|
||||
* except for the `Top' node, this command does NOT handle any
|
||||
pre-existing nodes in the outer file; hence, indices must be
|
||||
enclosed in an included file.
|
||||
|
||||
Requirements:
|
||||
|
||||
* each of the included files must contain exactly one highest
|
||||
hierarchical level node,
|
||||
* this highest node must be the first node in the included file,
|
||||
* each highest hierarchical level node must be of the same type.
|
||||
|
||||
Thus, normally, each included file contains one, and only one,
|
||||
chapter."
|
||||
t nil)
|
||||
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Don't you dare insert any `require' calls at top level in this file--rms.
|
||||
|
||||
;;; Syntax table
|
||||
|
||||
(defvar texinfo-mode-syntax-table nil)
|
||||
|
||||
(if texinfo-mode-syntax-table
|
||||
nil
|
||||
(setq texinfo-mode-syntax-table (make-syntax-table))
|
||||
(modify-syntax-entry ?\" " " texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?\\ " " texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?@ "\\" texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?\^q "\\" texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?\[ "(]" texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?\] ")[" texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?{ "(}" texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?} "){" texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?\' "w" texinfo-mode-syntax-table))
|
||||
|
||||
;; Written by Wolfgang Bangerth <zcg51122@rpool1.rus.uni-stuttgart.de>
|
||||
;; To override this example, set either `imenu-generic-expression'
|
||||
;; or `imenu-create-index-function'.
|
||||
(defvar texinfo-imenu-generic-expression
|
||||
'((nil "^@node[ \t]+\\([^,\n]*\\)" 1)
|
||||
("Chapters" "^@chapter[ \t]+\\(.*\\)$" 1))
|
||||
|
||||
"Imenu generic expression for TexInfo mode. See `imenu-generic-expression'.")
|
||||
|
||||
(defvar texinfo-font-lock-keywords
|
||||
'(;; All but the first 2 had an OVERRIDE of t.
|
||||
;; It didn't seem to be any better, and it's slower--simon.
|
||||
("^\\(@c\\|@comment\\)\\>.*" . font-lock-comment-face) ;comments
|
||||
;; Robert J. Chassell <bob@gnu.ai.mit.edu> says remove this line.
|
||||
;("\\$\\([^$]*\\)\\$" 1 font-lock-string-face t)
|
||||
("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face) ;commands
|
||||
("^\\*\\(.*\\)[\t ]*$" 1 font-lock-function-name-face t) ;menu items
|
||||
("@\\(emph\\|strong\\|b\\|i\\){\\([^}]+\\)" 2 font-lock-comment-face)
|
||||
("@\\(file\\|kbd\\|key\\){\\([^}]+\\)" 2 font-lock-string-face)
|
||||
("@\\(samp\\|code\\|var\\|math\\){\\([^}]+\\)"
|
||||
2 font-lock-variable-name-face)
|
||||
("@\\(cite\\|xref\\|pxref\\){\\([^}]+\\)" 2 font-lock-reference-face)
|
||||
("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-function-name-face keep)
|
||||
)
|
||||
"Additional expressions to highlight in TeXinfo mode.")
|
||||
|
||||
(defvar texinfo-section-list
|
||||
'(("top" 1)
|
||||
("majorheading" 1)
|
||||
("chapter" 2)
|
||||
("unnumbered" 2)
|
||||
("appendix" 2)
|
||||
("chapheading" 2)
|
||||
("section" 3)
|
||||
("unnumberedsec" 3)
|
||||
("appendixsec" 3)
|
||||
("heading" 3)
|
||||
("subsection" 4)
|
||||
("unnumberedsubsec" 4)
|
||||
("appendixsubsec" 4)
|
||||
("subheading" 4)
|
||||
("subsubsection" 5)
|
||||
("unnumberedsubsubsec" 5)
|
||||
("appendixsubsubsec" 5)
|
||||
("subsubheading" 5))
|
||||
"Alist of sectioning commands and their relative level.")
|
||||
|
||||
(defun texinfo-outline-level ()
|
||||
;; Calculate level of current texinfo outline heading.
|
||||
(save-excursion
|
||||
(if (bobp)
|
||||
0
|
||||
(forward-char 1)
|
||||
(let* ((word (buffer-substring-no-properties
|
||||
(point) (progn (forward-word 1) (point))))
|
||||
(entry (assoc word texinfo-section-list)))
|
||||
(if entry
|
||||
(nth 1 entry)
|
||||
5)))))
|
||||
|
||||
|
||||
;;; Keybindings
|
||||
(defvar texinfo-mode-map nil)
|
||||
|
||||
;;; Keys common both to Texinfo mode and to TeX shell.
|
||||
|
||||
(defun texinfo-define-common-keys (keymap)
|
||||
"Define the keys both in Texinfo mode and in the texinfo-tex-shell."
|
||||
(define-key keymap "\C-c\C-t\C-k" 'tex-kill-job)
|
||||
(define-key keymap "\C-c\C-t\C-x" 'texinfo-quit-job)
|
||||
(define-key keymap "\C-c\C-t\C-l" 'tex-recenter-output-buffer)
|
||||
(define-key keymap "\C-c\C-t\C-d" 'texinfo-delete-from-print-queue)
|
||||
(define-key keymap "\C-c\C-t\C-q" 'tex-show-print-queue)
|
||||
(define-key keymap "\C-c\C-t\C-p" 'texinfo-tex-print)
|
||||
(define-key keymap "\C-c\C-t\C-i" 'texinfo-texindex)
|
||||
|
||||
(define-key keymap "\C-c\C-t\C-r" 'texinfo-tex-region)
|
||||
(define-key keymap "\C-c\C-t\C-b" 'texinfo-tex-buffer))
|
||||
|
||||
;; Mode documentation displays commands in reverse order
|
||||
;; from how they are listed in the texinfo-mode-map.
|
||||
|
||||
(if texinfo-mode-map
|
||||
nil
|
||||
(setq texinfo-mode-map (make-sparse-keymap))
|
||||
|
||||
;; bindings for `texnfo-tex.el'
|
||||
(texinfo-define-common-keys texinfo-mode-map)
|
||||
|
||||
;; bindings for `makeinfo.el'
|
||||
(define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation)
|
||||
(define-key texinfo-mode-map "\C-c\C-m\C-l"
|
||||
'makeinfo-recenter-compilation-buffer)
|
||||
(define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region)
|
||||
(define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer)
|
||||
|
||||
;; bindings for `texinfmt.el'
|
||||
(define-key texinfo-mode-map "\C-c\C-e\C-r" 'texinfo-format-region)
|
||||
(define-key texinfo-mode-map "\C-c\C-e\C-b" 'texinfo-format-buffer)
|
||||
|
||||
;; bindings for updating nodes and menus
|
||||
|
||||
(define-key texinfo-mode-map "\C-c\C-um" 'texinfo-master-menu)
|
||||
|
||||
(define-key texinfo-mode-map "\C-c\C-u\C-m" 'texinfo-make-menu)
|
||||
(define-key texinfo-mode-map "\C-c\C-u\C-n" 'texinfo-update-node)
|
||||
(define-key texinfo-mode-map "\C-c\C-u\C-e" 'texinfo-every-node-update)
|
||||
(define-key texinfo-mode-map "\C-c\C-u\C-a" 'texinfo-all-menus-update)
|
||||
|
||||
(define-key texinfo-mode-map "\C-c\C-s" 'texinfo-show-structure)
|
||||
|
||||
(define-key texinfo-mode-map "\C-c}" 'up-list)
|
||||
(define-key texinfo-mode-map "\C-c]" 'up-list)
|
||||
(define-key texinfo-mode-map "\C-c{" 'texinfo-insert-braces)
|
||||
|
||||
;; bindings for inserting strings
|
||||
|
||||
(define-key texinfo-mode-map "\C-c\C-c\C-d" 'texinfo-start-menu-description)
|
||||
|
||||
(define-key texinfo-mode-map "\C-c\C-cv" 'texinfo-insert-@var)
|
||||
(define-key texinfo-mode-map "\C-c\C-ct" 'texinfo-insert-@table)
|
||||
(define-key texinfo-mode-map "\C-c\C-cs" 'texinfo-insert-@samp)
|
||||
(define-key texinfo-mode-map "\C-c\C-co" 'texinfo-insert-@noindent)
|
||||
(define-key texinfo-mode-map "\C-c\C-cn" 'texinfo-insert-@node)
|
||||
(define-key texinfo-mode-map "\C-c\C-ck" 'texinfo-insert-@kbd)
|
||||
(define-key texinfo-mode-map "\C-c\C-ci" 'texinfo-insert-@item)
|
||||
(define-key texinfo-mode-map "\C-c\C-cf" 'texinfo-insert-@file)
|
||||
(define-key texinfo-mode-map "\C-c\C-cx" 'texinfo-insert-@example)
|
||||
(define-key texinfo-mode-map "\C-c\C-ce" 'texinfo-insert-@end)
|
||||
(define-key texinfo-mode-map "\C-c\C-cd" 'texinfo-insert-@dfn)
|
||||
(define-key texinfo-mode-map "\C-c\C-cc" 'texinfo-insert-@code))
|
||||
|
||||
|
||||
;;; Texinfo mode
|
||||
|
||||
(defvar texinfo-chapter-level-regexp
|
||||
"chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading"
|
||||
"Regular expression matching Texinfo chapter-level headings.
|
||||
This does not match `@node' and does not match the `@top' command.")
|
||||
|
||||
;;;###autoload
|
||||
(defun texinfo-mode ()
|
||||
"Major mode for editing Texinfo files.
|
||||
|
||||
It has these extra commands:
|
||||
\\{texinfo-mode-map}
|
||||
|
||||
These are files that are used as input for TeX to make printed manuals
|
||||
and also to be turned into Info files with \\[makeinfo-buffer] or
|
||||
the `makeinfo' program. These files must be written in a very restricted and
|
||||
modified version of TeX input format.
|
||||
|
||||
Editing commands are like text-mode except that the syntax table is
|
||||
set up so expression commands skip Texinfo bracket groups. To see
|
||||
what the Info version of a region of the Texinfo file will look like,
|
||||
use \\[makeinfo-region], which runs `makeinfo' on the current region.
|
||||
|
||||
You can show the structure of a Texinfo file with \\[texinfo-show-structure].
|
||||
This command shows the structure of a Texinfo file by listing the
|
||||
lines with the @-sign commands for @chapter, @section, and the like.
|
||||
These lines are displayed in another window called the *Occur* window.
|
||||
In that window, you can position the cursor over one of the lines and
|
||||
use \\[occur-mode-goto-occurrence], to jump to the corresponding spot
|
||||
in the Texinfo file.
|
||||
|
||||
In addition, Texinfo mode provides commands that insert various
|
||||
frequently used @-sign commands into the buffer. You can use these
|
||||
commands to save keystrokes. And you can insert balanced braces with
|
||||
\\[texinfo-insert-braces] and later use the command \\[up-list] to
|
||||
move forward past the closing brace.
|
||||
|
||||
Also, Texinfo mode provides functions for automatically creating or
|
||||
updating menus and node pointers. These functions
|
||||
|
||||
* insert the `Next', `Previous' and `Up' pointers of a node,
|
||||
* insert or update the menu for a section, and
|
||||
* create a master menu for a Texinfo source file.
|
||||
|
||||
Here are the functions:
|
||||
|
||||
texinfo-update-node \\[texinfo-update-node]
|
||||
texinfo-every-node-update \\[texinfo-every-node-update]
|
||||
texinfo-sequential-node-update
|
||||
|
||||
texinfo-make-menu \\[texinfo-make-menu]
|
||||
texinfo-all-menus-update \\[texinfo-all-menus-update]
|
||||
texinfo-master-menu
|
||||
|
||||
texinfo-indent-menu-description (column &optional region-p)
|
||||
|
||||
The `texinfo-column-for-description' variable specifies the column to
|
||||
which menu descriptions are indented.
|
||||
|
||||
Passed an argument (a prefix argument, if interactive), the
|
||||
`texinfo-update-node' and `texinfo-make-menu' functions do their jobs
|
||||
in the region.
|
||||
|
||||
To use the updating commands, you must structure your Texinfo file
|
||||
hierarchically, such that each `@node' line, with the exception of the
|
||||
Top node, is accompanied by some kind of section line, such as an
|
||||
`@chapter' or `@section' line.
|
||||
|
||||
If the file has a `top' node, it must be called `top' or `Top' and
|
||||
be the first node in the file.
|
||||
|
||||
Entering Texinfo mode calls the value of text-mode-hook, and then the
|
||||
value of texinfo-mode-hook."
|
||||
(interactive)
|
||||
(text-mode)
|
||||
(setq mode-name "Texinfo")
|
||||
(setq major-mode 'texinfo-mode)
|
||||
(use-local-map texinfo-mode-map)
|
||||
(set-syntax-table texinfo-mode-syntax-table)
|
||||
(make-local-variable 'page-delimiter)
|
||||
(setq page-delimiter
|
||||
(concat
|
||||
"^@node [ \t]*[Tt]op\\|^@\\("
|
||||
texinfo-chapter-level-regexp
|
||||
"\\)"))
|
||||
(make-local-variable 'require-final-newline)
|
||||
(setq require-final-newline t)
|
||||
(make-local-variable 'indent-tabs-mode)
|
||||
(setq indent-tabs-mode nil)
|
||||
(make-local-variable 'paragraph-separate)
|
||||
(setq paragraph-separate (concat "^\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-separate))
|
||||
(make-local-variable 'paragraph-start)
|
||||
(setq paragraph-start (concat "^\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-start))
|
||||
(make-local-variable 'fill-column)
|
||||
(setq fill-column 72)
|
||||
(make-local-variable 'comment-start)
|
||||
(setq comment-start "@c ")
|
||||
(make-local-variable 'comment-start-skip)
|
||||
(setq comment-start-skip "@c +")
|
||||
(make-local-variable 'words-include-escapes)
|
||||
(setq words-include-escapes t)
|
||||
(make-local-variable 'imenu-generic-expression)
|
||||
(setq imenu-generic-expression texinfo-imenu-generic-expression)
|
||||
(make-local-variable 'font-lock-defaults)
|
||||
(setq font-lock-defaults '(texinfo-font-lock-keywords t))
|
||||
(make-local-variable 'outline-regexp)
|
||||
(setq outline-regexp
|
||||
(concat "@\\("
|
||||
(mapconcat 'car texinfo-section-list "\\>\\|")
|
||||
"\\>\\)"))
|
||||
(make-local-variable 'outline-level)
|
||||
(setq outline-level 'texinfo-outline-level)
|
||||
(make-local-variable 'tex-start-of-header)
|
||||
(setq tex-start-of-header "%**start")
|
||||
(make-local-variable 'tex-end-of-header)
|
||||
(setq tex-end-of-header "%**end")
|
||||
(run-hooks 'text-mode-hook 'texinfo-mode-hook))
|
||||
|
||||
|
||||
;;; Insert string commands
|
||||
|
||||
;; Keep as concatinated lists for ease of maintenance
|
||||
(defconst texinfo-environment-regexp
|
||||
(concat
|
||||
"^@"
|
||||
"\\("
|
||||
"cartouche\\|"
|
||||
"display\\|"
|
||||
"end\\|"
|
||||
"enumerate\\|"
|
||||
"example\\|"
|
||||
"f?table\\|"
|
||||
"flushleft\\|"
|
||||
"flushright\\|"
|
||||
"format\\|"
|
||||
"group\\|"
|
||||
"ifhtml\\|"
|
||||
"ifinfo\\|"
|
||||
"iftex\\|"
|
||||
"ignore\\|"
|
||||
"itemize\\|"
|
||||
"lisp\\|"
|
||||
"macro\\|"
|
||||
"multitable\\|"
|
||||
"quotation\\|"
|
||||
"smallexample\\|"
|
||||
"smalllisp\\|"
|
||||
"tex"
|
||||
"\\)")
|
||||
"Regexp for environment-like TexInfo list commands.
|
||||
Subexpression 1 is what goes into the corresponding `@end' statement.")
|
||||
|
||||
;; The following texinfo-insert-@end command not only inserts a SPC
|
||||
;; after the @end, but tries to find out what belongs there. It is
|
||||
;; not very smart: it does not understand nested lists.
|
||||
|
||||
(defun texinfo-insert-@end ()
|
||||
"Insert the matching `@end' for the last Texinfo command that needs one."
|
||||
(interactive)
|
||||
(let ((depth 1) string)
|
||||
(save-excursion
|
||||
(while (and (> depth 0)
|
||||
(re-search-backward texinfo-environment-regexp nil t)
|
||||
(if (looking-at "@end")
|
||||
(setq depth (1+ depth))
|
||||
(setq depth (1- depth)))))
|
||||
(looking-at texinfo-environment-regexp)
|
||||
(if (zerop depth)
|
||||
(setq string
|
||||
(buffer-substring (match-beginning 1)
|
||||
(match-end 1)))))
|
||||
(insert "@end ")
|
||||
(if string (insert string "\n"))))
|
||||
|
||||
;; The following insert commands accept a prefix arg N, which is the
|
||||
;; number of words (actually s-exprs) that should be surrounded by
|
||||
;; braces. Thus you can first paste a variable name into a .texinfo
|
||||
;; buffer, then say C-u 1 C-c C-c v at the beginning of the just
|
||||
;; pasted variable name to put @var{...} *around* the variable name.
|
||||
;; Operate on previous word or words with negative arg.
|
||||
|
||||
;; These commands use texinfo-insert-@-with-arg
|
||||
(defun texinfo-insert-@-with-arg (string &optional arg)
|
||||
(if arg
|
||||
(progn
|
||||
(setq arg (prefix-numeric-value arg))
|
||||
(if (< arg 0)
|
||||
(progn
|
||||
(skip-chars-backward " \t\n\r\f")
|
||||
(save-excursion
|
||||
(forward-sexp arg)
|
||||
(insert "@" string "{"))
|
||||
(insert "}"))
|
||||
(skip-chars-forward " \t\n\r\f")
|
||||
(insert "@" string "{")
|
||||
(forward-sexp arg)
|
||||
(insert "}")))
|
||||
(insert "@" string "{}")
|
||||
(backward-char)))
|
||||
|
||||
(defun texinfo-insert-braces ()
|
||||
"Make a pair of braces and be poised to type inside of them.
|
||||
Use \\[up-list] to move forward out of the braces."
|
||||
(interactive)
|
||||
(insert "{}")
|
||||
(backward-char))
|
||||
|
||||
(defun texinfo-insert-@code (&optional arg)
|
||||
"Insert a `@code{...}' command in a Texinfo buffer.
|
||||
A numeric argument says how many words the braces should surround.
|
||||
The default is not to surround any existing words with the braces."
|
||||
(interactive "P")
|
||||
(texinfo-insert-@-with-arg "code" arg))
|
||||
|
||||
(defun texinfo-insert-@dfn (&optional arg)
|
||||
"Insert a `@dfn{...}' command in a Texinfo buffer.
|
||||
A numeric argument says how many words the braces should surround.
|
||||
The default is not to surround any existing words with the braces."
|
||||
(interactive "P")
|
||||
(texinfo-insert-@-with-arg "dfn" arg))
|
||||
|
||||
(defun texinfo-insert-@example ()
|
||||
"Insert the string `@example' in a Texinfo buffer."
|
||||
(interactive)
|
||||
(insert "@example\n"))
|
||||
|
||||
(defun texinfo-insert-@file (&optional arg)
|
||||
"Insert a `@file{...}' command in a Texinfo buffer.
|
||||
A numeric argument says how many words the braces should surround.
|
||||
The default is not to surround any existing words with the braces."
|
||||
(interactive "P")
|
||||
(texinfo-insert-@-with-arg "file" arg))
|
||||
|
||||
(defun texinfo-insert-@item ()
|
||||
"Insert the string `@item' in a Texinfo buffer."
|
||||
(interactive)
|
||||
(insert "@item")
|
||||
(newline))
|
||||
|
||||
(defun texinfo-insert-@kbd (&optional arg)
|
||||
"Insert a `@kbd{...}' command in a Texinfo buffer.
|
||||
A numeric argument says how many words the braces should surround.
|
||||
The default is not to surround any existing words with the braces."
|
||||
(interactive "P")
|
||||
(texinfo-insert-@-with-arg "kbd" arg))
|
||||
|
||||
(defun texinfo-insert-@node ()
|
||||
"Insert the string `@node' in a Texinfo buffer.
|
||||
This also inserts on the following line a comment indicating
|
||||
the order of arguments to @node."
|
||||
(interactive)
|
||||
(insert "@node \n@comment node-name, next, previous, up")
|
||||
(forward-line -1)
|
||||
(forward-char 6))
|
||||
|
||||
(defun texinfo-insert-@noindent ()
|
||||
"Insert the string `@noindent' in a Texinfo buffer."
|
||||
(interactive)
|
||||
(insert "@noindent\n"))
|
||||
|
||||
(defun texinfo-insert-@samp (&optional arg)
|
||||
"Insert a `@samp{...}' command in a Texinfo buffer.
|
||||
A numeric argument says how many words the braces should surround.
|
||||
The default is not to surround any existing words with the braces."
|
||||
(interactive "P")
|
||||
(texinfo-insert-@-with-arg "samp" arg))
|
||||
|
||||
(defun texinfo-insert-@table (&optional arg)
|
||||
"Insert the string `@table' in a Texinfo buffer."
|
||||
(interactive "P")
|
||||
(insert "@table "))
|
||||
|
||||
(defun texinfo-insert-@var (&optional arg)
|
||||
"Insert a `@var{}' command in a Texinfo buffer.
|
||||
A numeric argument says how many words the braces should surround.
|
||||
The default is not to surround any existing words with the braces."
|
||||
(interactive "P")
|
||||
(texinfo-insert-@-with-arg "var" arg))
|
||||
|
||||
;;; Texinfo file structure
|
||||
|
||||
;; These are defined in texnfo-upd.el.
|
||||
;; texinfo-section-types-regexp
|
||||
;; texinfo-section-level-regexp
|
||||
;; texinfo-subsection-level-regexp
|
||||
;; texinfo-subsubsection-level-regexp
|
||||
|
||||
;; `texinfo-show-structure' requires texnfo-upd.el
|
||||
(defun texinfo-show-structure (&optional nodes-too)
|
||||
"Show the structure of a Texinfo file.
|
||||
List the lines in the file that begin with the @-sign commands for
|
||||
@chapter, @section, and the like.
|
||||
|
||||
With optional argument (prefix if interactive), list both the lines
|
||||
with @-sign commands for @chapter, @section, and the like, and list
|
||||
@node lines.
|
||||
|
||||
Lines with structuring commands beginning in them are displayed in
|
||||
another buffer named `*Occur*'. In that buffer, you can move point to
|
||||
one of those lines and then use \\<occur-mode-map>\\[occur-mode-goto-occurrence],
|
||||
to jump to the corresponding spot in the Texinfo source file."
|
||||
|
||||
(interactive "P")
|
||||
(require 'texnfo-upd)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(if nodes-too
|
||||
(occur (concat "\\(^@node\\)\\|" texinfo-section-types-regexp))
|
||||
(occur texinfo-section-types-regexp)))
|
||||
(pop-to-buffer "*Occur*")
|
||||
(goto-char (point-min))
|
||||
(flush-lines "-----")
|
||||
;; Now format the "*Occur*" buffer to show the structure.
|
||||
;; Thanks to ceder@signum.se (Per Cederqvist)
|
||||
(goto-char (point-max))
|
||||
(let ((margin 5))
|
||||
(while (re-search-backward "^ *[0-9]*:" nil 0)
|
||||
(re-search-forward ":")
|
||||
(setq margin
|
||||
(cond
|
||||
((looking-at
|
||||
(concat "@\\(" texinfo-chapter-level-regexp "\\)")) 5)
|
||||
;; ((looking-at "@chapter ") 5)
|
||||
;; ((looking-at "@unnumbered ") 5)
|
||||
;; ((looking-at "@appendix ") 5)
|
||||
;; ((looking-at "@majorheading ") 5)
|
||||
;; ((looking-at "@chapheading ") 5)
|
||||
|
||||
((looking-at
|
||||
(concat "@\\(" texinfo-section-level-regexp "\\)")) 9)
|
||||
;; ((looking-at "@section ") 9)
|
||||
;; ((looking-at "@unnumberedsec ") 9)
|
||||
;; ((looking-at "@appendixsec ") 9)
|
||||
;; ((looking-at "@heading ") 9)
|
||||
|
||||
((looking-at
|
||||
(concat "@\\(" texinfo-subsection-level-regexp "\\)")) 13)
|
||||
;; ((looking-at "@subsection ") 13)
|
||||
;; ((looking-at "@unnumberedsubsec ") 13)
|
||||
;; ((looking-at "@appendixsubsec ") 13)
|
||||
;; ((looking-at "@subheading ") 13)
|
||||
|
||||
((looking-at
|
||||
(concat "@\\(" texinfo-subsubsection-level-regexp "\\)")) 17)
|
||||
;; ((looking-at "@subsubsection ") 17)
|
||||
;; ((looking-at "@unnumberedsubsubsec ") 17)
|
||||
;; ((looking-at "@appendixsubsubsec ") 17)
|
||||
;; ((looking-at "@subsubheading ") 17)
|
||||
(t margin)))
|
||||
(indent-to-column margin)
|
||||
(beginning-of-line))))
|
||||
|
||||
;;; The tex and print function definitions:
|
||||
|
||||
(defvar texinfo-texi2dvi-command "texi2dvi"
|
||||
"*Command used by `texinfo-tex-buffer' to run TeX and texindex on a buffer.")
|
||||
|
||||
(defvar texinfo-tex-command "tex"
|
||||
"*Command used by `texinfo-tex-region' to run TeX on a region.")
|
||||
|
||||
(defvar texinfo-texindex-command "texindex"
|
||||
"*Command used by `texinfo-texindex' to sort unsorted index files.")
|
||||
|
||||
(defvar texinfo-delete-from-print-queue-command "lprm"
|
||||
"*Command string used to delete a job from the line printer queue.
|
||||
Command is used by \\[texinfo-delete-from-print-queue] based on
|
||||
number provided by a previous \\[tex-show-print-queue]
|
||||
command.")
|
||||
|
||||
(defvar texinfo-tex-trailer "@bye"
|
||||
"String appended after a region sent to TeX by `texinfo-tex-region'.")
|
||||
|
||||
(defun texinfo-tex-region (beg end)
|
||||
"Run TeX on the current region.
|
||||
This works by writing a temporary file (`tex-zap-file') in the directory
|
||||
that is the value of `tex-directory', then running TeX on that file.
|
||||
|
||||
The first line of the buffer is copied to the
|
||||
temporary file; and if the buffer has a header, it is written to the
|
||||
temporary file before the region itself. The buffer's header is all lines
|
||||
between the strings defined by `tex-start-of-header' and `tex-end-of-header'
|
||||
inclusive. The header must start in the first 100 lines.
|
||||
|
||||
The value of `texinfo-tex-trailer' is appended to the temporary file after the region."
|
||||
(interactive "r")
|
||||
(require 'tex-mode)
|
||||
(if (get-buffer "*tex-shell*")
|
||||
(tex-kill-job)
|
||||
(tex-start-shell))
|
||||
(or tex-zap-file (setq tex-zap-file (make-temp-name "#tz")))
|
||||
(let ((tex-out-file (concat tex-zap-file ".tex"))
|
||||
(temp-buffer (get-buffer-create " tex-Output-Buffer"))
|
||||
(zap-directory
|
||||
(file-name-as-directory (expand-file-name tex-directory))))
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(forward-line 100)
|
||||
(let ((search-end (point))
|
||||
(hbeg (point-min)) (hend (point-min))
|
||||
(default-directory zap-directory))
|
||||
(goto-char (point-min))
|
||||
|
||||
;; Copy first line, the `\input texinfo' line, to temp file
|
||||
(write-region (point)
|
||||
(save-excursion (end-of-line) (point))
|
||||
tex-out-file nil nil)
|
||||
|
||||
;; Don't copy first line twice if region includes it.
|
||||
(forward-line 1)
|
||||
(if (< beg (point)) (setq beg (point)))
|
||||
|
||||
;; Initialize the temp file with either the header or nothing
|
||||
(if (search-forward tex-start-of-header search-end t)
|
||||
(progn
|
||||
(beginning-of-line)
|
||||
(setq hbeg (point)) ; Mark beginning of header.
|
||||
(if (search-forward tex-end-of-header nil t)
|
||||
(progn (beginning-of-line)
|
||||
(setq hend (point))) ; Mark end of header.
|
||||
(setq hbeg (point-min))))) ; Else no header.
|
||||
|
||||
;; Copy header to temp file.
|
||||
(write-region (min hbeg beg) hend tex-out-file t nil)
|
||||
|
||||
;; Copy region to temp file.
|
||||
(write-region (max beg hend) end tex-out-file t nil))
|
||||
|
||||
;; This is a kludge to insert the tex-trailer into the tex-out-file.
|
||||
;; We have to create a special buffer in which to insert
|
||||
;; the tex-trailer first because there is no function with
|
||||
;; which to append a literal string directly to a file.
|
||||
(let ((local-tex-trailer texinfo-tex-trailer))
|
||||
(set-buffer temp-buffer)
|
||||
(erase-buffer)
|
||||
;; make sure trailer isn't hidden by a comment
|
||||
(insert-string "\n")
|
||||
(if local-tex-trailer (insert-string local-tex-trailer))
|
||||
(tex-set-buffer-directory temp-buffer zap-directory)
|
||||
(write-region (point-min) (point-max) tex-out-file t nil))
|
||||
|
||||
;;; The following is sufficient in Emacs 19.
|
||||
;;; (write-region (concat "\n" texinfo-tex-trailer) nil
|
||||
;;; tex-out-file t nil)
|
||||
))
|
||||
|
||||
(tex-set-buffer-directory "*tex-shell*" zap-directory)
|
||||
(tex-send-command tex-shell-cd-command zap-directory)
|
||||
(tex-send-command texinfo-tex-command tex-out-file)
|
||||
;; alternatively:
|
||||
;; (send-string "tex-shell" (concat tex-shell-cd-command " "
|
||||
;; zap-directory "\n"))
|
||||
;; (send-string "tex-shell" (concat texinfo-tex-command " "
|
||||
;; tex-out-file "\n"))
|
||||
(tex-recenter-output-buffer 0)))
|
||||
|
||||
(defun texinfo-tex-buffer ()
|
||||
"Run TeX on visited file, once or twice, to make a correct `.dvi' file."
|
||||
(interactive)
|
||||
|
||||
;; Make sure TeX shell is running.
|
||||
(require 'tex-mode)
|
||||
(if (get-buffer "*tex-shell*")
|
||||
(quit-process (get-process "tex-shell") t)
|
||||
(tex-start-shell))
|
||||
|
||||
(cond ((null buffer-file-name)
|
||||
(error "Buffer not visiting any file!"))
|
||||
((buffer-modified-p)
|
||||
(error "Buffer has been modified since last saved!")))
|
||||
|
||||
(setq tex-zap-file buffer-file-name)
|
||||
|
||||
(tex-send-command tex-shell-cd-command (file-name-directory tex-zap-file))
|
||||
|
||||
(tex-send-command texinfo-texi2dvi-command tex-zap-file)
|
||||
|
||||
;; alternatively:
|
||||
;; (send-string "tex-shell"
|
||||
;; (concat tex-shell-cd-command
|
||||
;; " " (file-name-directory tex-zap-file) "\n"))
|
||||
;; )
|
||||
;;
|
||||
;; (send-string "tex-shell"
|
||||
;; (concat texinfo-texi2dvi-command " " tex-zap-file "\n"))
|
||||
|
||||
|
||||
(tex-recenter-output-buffer 0))
|
||||
|
||||
(defun texinfo-texindex ()
|
||||
"Run `texindex' on unsorted index files.
|
||||
The index files are made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
|
||||
This runs the shell command defined by `texinfo-texindex-command'."
|
||||
(interactive)
|
||||
(require 'tex-mode)
|
||||
(tex-send-command texinfo-texindex-command (concat tex-zap-file ".??"))
|
||||
;; alternatively
|
||||
;; (send-string "tex-shell"
|
||||
;; (concat texinfo-texindex-command
|
||||
;; " " tex-zap-file ".??" "\n"))
|
||||
(tex-recenter-output-buffer nil))
|
||||
|
||||
(defun texinfo-tex-print ()
|
||||
"Print `.dvi' file made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
|
||||
This runs the shell command defined by `tex-dvi-print-command'."
|
||||
(interactive)
|
||||
(require 'tex-mode)
|
||||
(tex-send-command tex-dvi-print-command (concat tex-zap-file ".dvi"))
|
||||
;; alternatively:
|
||||
;; (send-string "tex-shell"
|
||||
;; (concat tex-dvi-print-command
|
||||
;; " " tex-zap-file ".dvi" "\n"))
|
||||
(tex-recenter-output-buffer nil))
|
||||
|
||||
(defun texinfo-quit-job ()
|
||||
"Quit currently running TeX job, by sending an `x' to it."
|
||||
(interactive)
|
||||
(if (not (get-process "tex-shell"))
|
||||
(error "No TeX shell running"))
|
||||
(tex-send-command "x"))
|
||||
;; alternatively:
|
||||
;; save-excursion
|
||||
;; (set-buffer (get-buffer "*tex-shell*"))
|
||||
;; (goto-char (point-max))
|
||||
;; (insert "x")
|
||||
;; (comint-send-input)
|
||||
|
||||
(defun texinfo-delete-from-print-queue (job-number)
|
||||
"Delete job from the line printer spooling queue.
|
||||
You are prompted for the job number (use a number shown by a previous
|
||||
\\[tex-show-print-queue] command)."
|
||||
(interactive "nPrinter job number for deletion: ")
|
||||
(require 'tex-mode)
|
||||
(if (tex-shell-running)
|
||||
(tex-kill-job)
|
||||
(tex-start-shell))
|
||||
(tex-send-command texinfo-delete-from-print-queue-command job-number)
|
||||
;; alternatively
|
||||
;; (send-string "tex-shell"
|
||||
;; (concat
|
||||
;; texinfo-delete-from-print-queue-command
|
||||
;; " "
|
||||
;; job-number"\n"))
|
||||
(tex-recenter-output-buffer nil))
|
||||
|
||||
(provide 'texinfo)
|
||||
|
||||
;;; texinfo.el ends here
|
@ -1,346 +0,0 @@
|
||||
;;;; texnfo-tex.el
|
||||
|
||||
;;; Texinfo mode TeX and hardcopy printing commands.
|
||||
|
||||
;; These commands are for running TeX on a region of a Texinfo file in
|
||||
;; GNU Emacs, or on the whole buffer, and for printing the resulting
|
||||
;; DVI file.
|
||||
|
||||
;;; Version 2.07 22 October 1991
|
||||
;;; Robert J. Chassell
|
||||
;;; Please send bug reports to: bug-texinfo@prep.ai.mit.edu
|
||||
|
||||
;;; Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
;;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to
|
||||
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
|
||||
|
||||
;;; The Texinfo mode TeX related commands are:
|
||||
|
||||
; texinfo-tex-region to run tex on the current region.
|
||||
; texinfo-tex-buffer to run tex on the current buffer.
|
||||
; texinfo-texindex to sort unsorted index files.
|
||||
; texinfo-tex-print to print the .dvi file made by tex.
|
||||
; texinfo-kill-tex-job to kill the currently running tex job.
|
||||
; texinfo-recenter-tex-output-buffer to redisplay tex output buffer.
|
||||
; texinfo-show-tex-print-queue to show the print queue.
|
||||
|
||||
|
||||
;;; Keys common both to Texinfo mode and to TeX shell.
|
||||
|
||||
;; Defined in `texinfo.el'
|
||||
; (defun texinfo-define-common-keys (keymap)
|
||||
; "Define the keys both in Texinfo mode and in the texinfo-tex-shell."
|
||||
; (define-key keymap "\C-c\C-t\C-k" 'texinfo-kill-tex-job)
|
||||
; (define-key keymap "\C-c\C-t\C-x" 'texinfo-quit-tex-job)
|
||||
; (define-key keymap "\C-c\C-t\C-l" 'texinfo-recenter-tex-output-buffer)
|
||||
; (define-key keymap "\C-c\C-t\C-d" 'texinfo-delete-from-tex-print-queue)
|
||||
; (define-key keymap "\C-c\C-t\C-q" 'texinfo-show-tex-print-queue)
|
||||
; (define-key keymap "\C-c\C-t\C-p" 'texinfo-tex-print)
|
||||
; (define-key keymap "\C-c\C-t\C-i" 'texinfo-texindex)
|
||||
; (define-key keymap "\C-c\C-t\C-r" 'texinfo-tex-region)
|
||||
; (define-key keymap "\C-c\C-t\C-b" 'texinfo-tex-buffer))
|
||||
|
||||
;; See also texinfo-tex-start-shell.
|
||||
;; The following is executed in the `texinfo.el' file
|
||||
;(texinfo-define-common-keys texinfo-mode-map)
|
||||
|
||||
|
||||
;;; Variable definitions:
|
||||
|
||||
(require 'shell)
|
||||
|
||||
(defvar texinfo-tex-shell-cd-command "cd"
|
||||
"Command to give to shell running TeX to change directory.")
|
||||
|
||||
(defvar texinfo-tex-command "tex"
|
||||
"*Command used by texinfo-tex-region to run tex on a region.")
|
||||
|
||||
(defvar texinfo-texindex-command "texindex"
|
||||
"*Command used by texinfo-texindex to sort unsorted index files.")
|
||||
|
||||
(defvar texinfo-tex-dvi-print-command "lpr -d"
|
||||
"*Command string used by \\[tex-print] to print a .dvi file.")
|
||||
|
||||
(defvar texinfo-show-tex-queue-command "lpq"
|
||||
"*Command string used to show the Texinfo TeX print queue.
|
||||
Command is used by \\[texinfo-show-tex-print-queue] and it
|
||||
should show the queue that \\[texinfo-tex-print] puts jobs on.")
|
||||
|
||||
(defvar texinfo-delete-from-print-queue-command "lprm"
|
||||
"*Command string used to delete a job from the line printer queue.
|
||||
Command is used by \\[texinfo-delete-from-tex-print-queue] based on
|
||||
number provided by a previous \\[texinfo-show-tex-print-queue]
|
||||
command.")
|
||||
|
||||
(defvar texinfo-tex-trailer "@bye"
|
||||
"String appended after a region sent to TeX by texinfo-tex-region.")
|
||||
|
||||
(defvar texinfo-tex-original-file ""
|
||||
"Original name of file on which to run TeX.")
|
||||
|
||||
(defvar texinfo-tex-temp-file nil
|
||||
"Temporary file name used for text being sent as input to TeX.")
|
||||
|
||||
(defvar texinfo-tex-root-temp-file nil
|
||||
"Temporary file name used for text being sent as input to TeX.")
|
||||
|
||||
|
||||
;;; Texinfo TeX main functions
|
||||
|
||||
(defun texinfo-tex-region (beginning end)
|
||||
"Run tex on the current region.
|
||||
|
||||
A temporary file is written in the default directory, and tex is run
|
||||
in that directory. The first line of the file is copied to the
|
||||
temporary file; and if the buffer has a header, it is written to the
|
||||
temporary file before the region itself. The buffer's header is all
|
||||
lines between the strings defined by texinfo-start-of-header and
|
||||
texinfo-end-of-header inclusive. The header must start in the first 100
|
||||
lines. The value of texinfo-tex-trailer is appended to the temporary file
|
||||
after the region."
|
||||
|
||||
(interactive "r")
|
||||
(if (get-buffer "*texinfo-tex-shell*")
|
||||
(quit-process (get-process "texinfo-tex-shell") t)
|
||||
(texinfo-tex-start-shell))
|
||||
|
||||
(setq texinfo-tex-root-temp-file
|
||||
(expand-file-name
|
||||
(make-temp-name
|
||||
(prin1-to-string (read (buffer-name))))))
|
||||
|
||||
(let ((texinfo-tex-temp-file (concat texinfo-tex-root-temp-file ".tex")))
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(forward-line 100)
|
||||
(let ((search-end (point))
|
||||
(header-beginning (point-min)) (header-end (point-min)))
|
||||
(goto-char (point-min))
|
||||
;; Copy first line, the `\input texinfo' line, to temp file
|
||||
(write-region (point)
|
||||
(save-excursion (forward-line 1) (point))
|
||||
texinfo-tex-temp-file nil nil)
|
||||
;; Don't copy first line twice if region includes it.
|
||||
(forward-line 1)
|
||||
(if (< beginning (point)) (setq beginning (point)))
|
||||
;; Initialize the temp file with either the header or nothing
|
||||
(if (search-forward texinfo-start-of-header search-end t)
|
||||
(progn
|
||||
(beginning-of-line)
|
||||
(setq header-beginning (point)) ; Mark beginning of header.
|
||||
(if (search-forward texinfo-end-of-header nil t)
|
||||
(progn (beginning-of-line)
|
||||
(setq header-end (point))) ; Mark end of header.
|
||||
(setq header-beginning (point-min))))) ; Else no header.
|
||||
;; Copy header to temp file.
|
||||
(write-region
|
||||
(min header-beginning beginning )
|
||||
header-end
|
||||
texinfo-tex-temp-file t nil)
|
||||
;; Copy region to temp file.
|
||||
(write-region
|
||||
(max beginning header-end)
|
||||
end
|
||||
texinfo-tex-temp-file t nil)
|
||||
;; This is a kludge to insert the texinfo-tex-trailer into the
|
||||
;; texinfo-tex-temp-file. We have to create a special buffer
|
||||
;; in which to insert the texinfo-tex-trailer first because there is
|
||||
;; no function with which to append a literal string directly
|
||||
;; to a file.
|
||||
(let ((local-tex-trailer texinfo-tex-trailer)
|
||||
(temp-buffer (get-buffer-create " texinfo-trailer-buffer")))
|
||||
(set-buffer temp-buffer)
|
||||
(erase-buffer)
|
||||
;; make sure trailer isn't hidden by a comment
|
||||
(insert-string "\n")
|
||||
(if local-tex-trailer (insert local-tex-trailer))
|
||||
(write-region (point-min) (point-max)
|
||||
texinfo-tex-temp-file t nil)))
|
||||
(set-process-sentinel (get-process "texinfo-tex-shell")
|
||||
'texinfo-tex-shell-sentinel)
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-tex-shell-cd-command " "
|
||||
default-directory "\n"))
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-tex-command " "
|
||||
texinfo-tex-temp-file "\n "))
|
||||
(texinfo-recenter-tex-output-buffer 0)))))
|
||||
|
||||
(defun texinfo-tex-buffer (buffer)
|
||||
"Run TeX on current buffer.
|
||||
After running TeX the first time, you may have to run \\[texinfo-texindex]
|
||||
and then \\[texinfo-tex-buffer] again."
|
||||
(interactive
|
||||
(list
|
||||
;; Sometimes you put point into *texinfo-tex-shell*; this prompts
|
||||
;; you for the correct file regardless.
|
||||
(if (and
|
||||
(string= (buffer-name (current-buffer)) "*texinfo-tex-shell*")
|
||||
texinfo-tex-root-temp-file)
|
||||
(read-string (format "Run TeX on: ")
|
||||
texinfo-tex-original-file)
|
||||
(read-string (format "Run TeX on: ") (buffer-name (current-buffer))))))
|
||||
|
||||
;; Set to original buffer if in *texinfo-tex-shell*; otherwise,
|
||||
;; record name of current buffer.
|
||||
(if (string= (buffer-name (current-buffer)) "*texinfo-tex-shell*")
|
||||
(set-buffer buffer)
|
||||
(setq texinfo-tex-original-file
|
||||
(buffer-name (current-buffer))))
|
||||
|
||||
(if (get-buffer "*texinfo-tex-shell*")
|
||||
(quit-process (get-process "texinfo-tex-shell") t)
|
||||
(texinfo-tex-start-shell))
|
||||
(cond ((null buffer-file-name)
|
||||
(error "Buffer not visiting any file!"))
|
||||
((buffer-modified-p)
|
||||
(error "Buffer has been modified since last saved!"))
|
||||
(t (set-process-sentinel (get-process "texinfo-tex-shell")
|
||||
'texinfo-tex-shell-sentinel)
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-tex-shell-cd-command
|
||||
" "
|
||||
(file-name-directory
|
||||
(buffer-file-name
|
||||
(get-buffer buffer)))
|
||||
"\n"))
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-tex-command " " buffer "\n "))
|
||||
|
||||
;; so the texinfo-tex-print command works
|
||||
(setq texinfo-tex-root-temp-file
|
||||
(substring buffer 0
|
||||
(or (string-match "\\.tex" buffer)
|
||||
(length buffer))))
|
||||
|
||||
(texinfo-recenter-tex-output-buffer 0))))
|
||||
|
||||
(defun texinfo-texindex ()
|
||||
"Run texindex on unsorted index files.
|
||||
The index files are made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
|
||||
Runs the shell command defined by texinfo-texindex-command."
|
||||
(interactive)
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-texindex-command
|
||||
" " texinfo-tex-root-temp-file ".??" "\n"))
|
||||
(texinfo-recenter-tex-output-buffer nil))
|
||||
|
||||
(defun texinfo-tex-print ()
|
||||
"Print .dvi file made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
|
||||
Runs the shell command defined by texinfo-tex-dvi-print-command."
|
||||
(interactive)
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-tex-dvi-print-command
|
||||
" " texinfo-tex-root-temp-file ".dvi" "\n"))
|
||||
(texinfo-recenter-tex-output-buffer nil))
|
||||
|
||||
|
||||
;;; Texinfo TeX utility functions
|
||||
|
||||
(defun texinfo-tex-start-shell ()
|
||||
(save-excursion
|
||||
(require 'texinfo)
|
||||
(set-buffer (make-shell "texinfo-tex-shell" "/bin/sh" nil "-v"))
|
||||
(setq texinfo-tex-shell-map (copy-keymap shell-mode-map))
|
||||
(texinfo-define-common-keys texinfo-tex-shell-map)
|
||||
(use-local-map texinfo-tex-shell-map)
|
||||
(run-hooks 'texinfo-tex-shell-hook)
|
||||
(if (zerop (buffer-size))
|
||||
(sleep-for 1))))
|
||||
|
||||
(defun texinfo-quit-tex-job ()
|
||||
"Quit currently running TeX job, by sending an `x' to it."
|
||||
(interactive)
|
||||
(if (not (get-process "texinfo-tex-shell"))
|
||||
(error "No TeX shell running."))
|
||||
(save-excursion
|
||||
(set-buffer (get-buffer "*texinfo-tex-shell*"))
|
||||
(goto-char (point-max))
|
||||
(insert "x")
|
||||
(shell-send-input)))
|
||||
|
||||
(defun texinfo-kill-tex-job ()
|
||||
"Kill the currently running TeX job."
|
||||
(interactive)
|
||||
(if (get-process "texinfo-tex-shell")
|
||||
;; Use `texinfo-tex-shell-sentinel' to restart
|
||||
;; texinfo-tex-shell after it is killed.
|
||||
(kill-process (get-process "texinfo-tex-shell"))))
|
||||
|
||||
(defun texinfo-tex-shell-sentinel (process event)
|
||||
"Restart texinfo-tex-shell after it is killed."
|
||||
(if (equal event "killed\n")
|
||||
(save-excursion
|
||||
(set-buffer "*texinfo-tex-shell*")
|
||||
(insert "\n")
|
||||
(texinfo-tex-start-shell))))
|
||||
|
||||
(defun texinfo-recenter-tex-output-buffer (linenum)
|
||||
"Redisplay buffer of TeX job output so that most recent output can be seen.
|
||||
The last line of the buffer is displayed on
|
||||
line LINE of the window, or centered if LINE is nil."
|
||||
(interactive "P")
|
||||
(let ((texinfo-tex-shell (get-buffer "*texinfo-tex-shell*"))
|
||||
(old-buffer (current-buffer)))
|
||||
(if (null texinfo-tex-shell)
|
||||
(message "No TeX output buffer")
|
||||
(pop-to-buffer texinfo-tex-shell)
|
||||
(bury-buffer texinfo-tex-shell)
|
||||
(goto-char (point-max))
|
||||
(recenter (if linenum
|
||||
(prefix-numeric-value linenum)
|
||||
(/ (window-height) 2)))
|
||||
(pop-to-buffer old-buffer)
|
||||
)))
|
||||
|
||||
(defun texinfo-show-tex-print-queue ()
|
||||
"Show the print queue that \\[texinfo-tex-print] put your job on.
|
||||
Runs the shell command defined by texinfo-show-tex-queue-command."
|
||||
(interactive)
|
||||
(if (not (texinfo-tex-shell-running-p))
|
||||
(texinfo-tex-start-shell))
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-show-tex-queue-command "\n"))
|
||||
(texinfo-recenter-tex-output-buffer nil))
|
||||
|
||||
(defun texinfo-delete-from-tex-print-queue (job-number)
|
||||
"Delete job from the line printer spooling queue.
|
||||
You are prompted for the job number (shown by a previous
|
||||
\\[texinfo-show-tex-print-queue] command."
|
||||
(interactive "nPrinter job number for deletion: ")
|
||||
(if (texinfo-tex-shell-running-p)
|
||||
(texinfo-kill-tex-job)
|
||||
(texinfo-tex-start-shell))
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat
|
||||
texinfo-delete-from-print-queue-command
|
||||
" "
|
||||
job-number"\n"))
|
||||
(texinfo-recenter-tex-output-buffer nil))
|
||||
|
||||
(defun texinfo-tex-shell-running-p ()
|
||||
(and (get-process "texinfo-tex-shell")
|
||||
(eq (process-status (get-process "texinfo-tex-shell")) 'run)))
|
||||
|
||||
|
||||
;;; Place `provide' at end of file.
|
||||
(provide 'texnfo-tex)
|
||||
;;;;;;;;;;;;;;;; end texnfo-tex.el ;;;;;;;;;;;;;;;;
|
File diff suppressed because it is too large
Load Diff
@ -1,200 +0,0 @@
|
||||
This release of Info is version 2.11. Please read the file README.
|
||||
|
||||
Version 2.11, Sat Apr 1 09:15:21 1995
|
||||
|
||||
Changes since 2.7 beta:
|
||||
|
||||
Although the basic code remains the same, there are numerous nits
|
||||
fixed, including some display bugs, and a memory leak. Some changes
|
||||
that have taken place with larger impact include the way in which the
|
||||
(dir) node is built; I have added in support for "localdir"
|
||||
directories among other things. Info files may be stored in
|
||||
compressed formats, and in their own subdirectories; menu items which
|
||||
do not explicitly name the node to which they are attached have the
|
||||
menu item name looked up as an Info file if it is not found within the
|
||||
current document. This means that the menu item:
|
||||
|
||||
* Info:: The Info documentation reader.
|
||||
|
||||
in (dir) refers to the info node "(info)Top".
|
||||
|
||||
Please see the ChangeLog and documentation for details on other
|
||||
changes.
|
||||
|
||||
Version 2.7 beta, Wed Dec 30 02:02:38 1992
|
||||
Version 2.6 beta, Tue Dec 22 03:58:07 1992
|
||||
Version 2.5 beta, Tue Dec 8 14:50:35 1992
|
||||
Version 2.4 beta, Sat Nov 28 14:34:02 1992
|
||||
Version 2.3 beta, Fri Nov 27 01:04:13 1992
|
||||
Version 2.2 beta, Tue Nov 24 09:36:08 1992
|
||||
Version 2.1 beta, Tue Nov 17 23:29:36 1992
|
||||
|
||||
Changes since 2.5 beta:
|
||||
|
||||
Note that versions 2.6 and 2.7 Beta were only released to a select group.
|
||||
|
||||
* "info-" removed from the front of M-x commands.
|
||||
|
||||
* Automatic footnote display. When you enter a node which contains
|
||||
footnotes, and the variable "automatic-footnotes" is "On", Info pops
|
||||
up a window containing the footnotes. Likewise, when you leave that
|
||||
node, the window containing the footnotes goes away.
|
||||
|
||||
* Cleaner built in documentation, and documentation functions.
|
||||
|
||||
Use:
|
||||
o `M-x describe-variable' to read a variable's documenation
|
||||
o `M-x describe-key' to find out what a particular keystroke does.
|
||||
o `M-x describe-function' to read a function's documentation.
|
||||
o `M-x where-is' to find out what keys invoke a particular function.
|
||||
|
||||
* Info can "tile" the displayed windows (via "M-x tile-windows"). If
|
||||
the variable "automatic-tiling" is "On", then splitting a window or
|
||||
deleting a window causes the remaining windows to be retiled.
|
||||
|
||||
* You can save every keystroke you type in a "dribble file" by using the
|
||||
`--dribble FILENAME' option. You can initially read keystrokes from an
|
||||
alternate input stream with `--restore FILENAME', or by redirecting
|
||||
input on the command line `info < old-dribble'.
|
||||
|
||||
* New behaviour of menu items. If the label is the same as the
|
||||
target node name, and the node couldn't be found in the current file,
|
||||
treat the label as a file name. For example, a menu entry in "DIR"
|
||||
might contain:
|
||||
|
||||
* Emacs:: Cool text-editor.
|
||||
|
||||
Info would not find the node "(dir)Emacs", so just plain "(emacs)"
|
||||
would be tried.
|
||||
|
||||
* New variable "ISO-Latin" allows you to use European machines with
|
||||
8-bit character sets.
|
||||
|
||||
* Cleanups in echo area reading, and redisplay. Cleanups in handling the
|
||||
window which shows possible completions.
|
||||
|
||||
* Info can now read files that have been compressed. An array in filesys.c
|
||||
maps extensions to programs that can decompress stdin, and write the results
|
||||
to stdout. Currently, ".Z"/uncompress, ".z"/gunzip, and ".Y"/unyabba are
|
||||
supported. The modeline for a compressed file shows "zz" in it.
|
||||
|
||||
* There is a new variable "gc-compressed-files" which, if non-zero, says
|
||||
it is okay to reclaim the file buffer space allocated to a file which
|
||||
was compressed, if, and only if, that file's contents do not appear in
|
||||
any history node.
|
||||
|
||||
* New file `nodemenu.c' implements a few functions for manipulating
|
||||
previously visited nodes. `C-x C-b' (list-visited-nodes) produces a
|
||||
menu of the nodes that could be reached by info-history-node in some
|
||||
window. `C-x b' (select-visited-node) is similar, but reads one of
|
||||
the node names with completion.
|
||||
|
||||
* Keystroke `M-r' (move_to_screen_line) allows the user to place the cursor at
|
||||
the start of a specific screen line. Without a numeric argument, place the
|
||||
cursor on the center line; with an arg, place the cursor on that line.
|
||||
|
||||
* Interruptible display implemented. Basic display speedups and hacks.
|
||||
* The message "*** Tags Out of Date ***" now means what it says.
|
||||
* Index searching with `,' (info-index-next) has been improved.
|
||||
* When scrolling with C-v, C-M-v, or M-v, only "Page Only" scrolling
|
||||
will happen.
|
||||
|
||||
* Continous scrolling (along with `]' (info-global-next) and `['
|
||||
(info-global-prev) works better. `]' and `[' accept numeric
|
||||
arguments, moving that many nodes in that case.
|
||||
|
||||
* `C-x w' (info-toggle-wrap) controls how lines wider than the width
|
||||
of the screen are displayed. If a line is too long, a `$' is
|
||||
displayed in the rightmost column of the window.
|
||||
|
||||
* There are some new variables for controlling the behaviour of Info
|
||||
interactively. The current list of variables is as follows:
|
||||
|
||||
Variable Name Default Value Description
|
||||
------------- ------------- -----------
|
||||
`automatic-footnotes' On When "On", footnotes appear and
|
||||
disappear automatically.
|
||||
|
||||
`automatic-tiling' Off When "On", creating of deleting a
|
||||
window resizes other windows.
|
||||
|
||||
`visible-bell' Off If non-zero, try to use a visible bell.
|
||||
|
||||
`errors-ring-bell' On If non-zero, errors cause a ring.
|
||||
|
||||
`show-index-match' On If non-zero, the portion of the string
|
||||
matched is highlighted by changing its
|
||||
case.
|
||||
|
||||
`scroll-behaviour' Continuous One of "Continuous", "Next Only", or
|
||||
"Page Only". "Page Only" prevents you from
|
||||
scrolling past the bottom or top of a node.
|
||||
"Next Only" causes the Next or Prev node to
|
||||
be selected when you scroll past the bottom
|
||||
or top of a node. "Continous" moves
|
||||
linearly through the files hierchichal
|
||||
structure.
|
||||
|
||||
`scroll-step' 0 Controls how scrolling is done for you when
|
||||
the cursor moves out of the current window.
|
||||
Non-zero means it is the number of lines
|
||||
you would like the screen to shift. A
|
||||
value of 0 means to center the line
|
||||
containing the cursor in the window.
|
||||
|
||||
`gc-compressed-files' Off If non-zero means it is okay to reclaim the
|
||||
file buffer space allocated to a file which
|
||||
was compressed, if, and only if, that
|
||||
file's contents do not appear in the node
|
||||
list of any window.
|
||||
|
||||
`ISO-Latin' Off Non-zero means that you are using an ISO
|
||||
Latin character set. By default, standard
|
||||
ASCII characters are assumed.
|
||||
________________________________________
|
||||
This release of Info is version 2.5 beta.
|
||||
|
||||
Changes since 2.4 beta:
|
||||
|
||||
* Index (i) and (,) commands fully implemented.
|
||||
* "configure" script now shipped with Info.
|
||||
* New function "set-variable" allows users to set various variables.
|
||||
* User-settable behaviour on end or beginning of node scrolling. This
|
||||
supercedes the SPC and DEL changes in 2.3 beta.
|
||||
|
||||
________________________________________
|
||||
This release of Info is version 2.4 beta.
|
||||
|
||||
Changes since 2.3 beta:
|
||||
|
||||
* info-last-node now means move to the last node of this info file.
|
||||
* info-history-node means move backwards through this window's node history.
|
||||
* info-first-node moves to the first node in the Info file. This node is
|
||||
not necessarily "Top"!
|
||||
* SPC and DEL can select the Next or Prev node after printing an informative
|
||||
message when pressed at the end/beg of a node.
|
||||
|
||||
----------------------------------------
|
||||
This release of Info is version 2.3 beta.
|
||||
|
||||
Changes since 2.2 beta:
|
||||
|
||||
* M-x command lines if NAMED_COMMANDS is #defined. Variable in Makefile.
|
||||
* Screen height changes made quite robust.
|
||||
* Interactive function "set-screen-height" implements user height changes.
|
||||
* Scrolling on some terminals is faster now.
|
||||
* C-l with numeric arguement is fixed.
|
||||
|
||||
----------------------------------------
|
||||
This release of Info is version 2.2 beta.
|
||||
|
||||
Changes since 2.0:
|
||||
|
||||
* C-g can now interrupt multi-file searches.
|
||||
* Incremental search is fully implemented.
|
||||
* Loading large tag tables is much faster now.
|
||||
* makedoc.c replaces shell script, speeding incremental builds.
|
||||
* Scrolling in redisplay is implemented.
|
||||
* Recursive uses of the echo area made more robust.
|
||||
* Garbage collection of unreferenced nodes.
|
||||
|
@ -1,112 +0,0 @@
|
||||
/* clib.c: Functions which we normally expect to find in the C library.
|
||||
$Id: clib.c,v 1.2 1996/10/03 16:58:31 karl Exp $
|
||||
|
||||
This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include <sys/errno.h>
|
||||
|
||||
extern void *xmalloc (), *xrealloc ();
|
||||
#include "general.h"
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_STRERROR)
|
||||
extern char *sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
|
||||
char *
|
||||
strerror (num)
|
||||
int num;
|
||||
{
|
||||
if (num >= sys_nerr)
|
||||
return ("");
|
||||
else
|
||||
return (sys_errlist[num]);
|
||||
}
|
||||
#endif /* !HAVE_STRERROR */
|
||||
|
||||
#if !defined (HAVE_STRCASECMP)
|
||||
/* This Unix doesn't have the strcasecmp () function. */
|
||||
int
|
||||
strcasecmp (string1, string2)
|
||||
char *string1, *string2;
|
||||
{
|
||||
char ch1, ch2;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
ch1 = *string1++;
|
||||
ch2 = *string2++;
|
||||
|
||||
if (!(ch1 | ch2))
|
||||
return (0);
|
||||
|
||||
ch1 = info_toupper (ch1);
|
||||
ch2 = info_toupper (ch2);
|
||||
|
||||
if (ch1 != ch2)
|
||||
return (ch1 - ch2);
|
||||
}
|
||||
}
|
||||
|
||||
/* Compare at most COUNT characters from string1 to string2. Case
|
||||
doesn't matter. */
|
||||
int
|
||||
strncasecmp (string1, string2, count)
|
||||
char *string1, *string2;
|
||||
int count;
|
||||
{
|
||||
register char ch1, ch2;
|
||||
|
||||
while (count)
|
||||
{
|
||||
ch1 = *string1++;
|
||||
ch2 = *string2++;
|
||||
|
||||
ch1 = info_toupper (ch1);
|
||||
ch2 = info_toupper (ch2);
|
||||
|
||||
if (ch1 == ch2)
|
||||
count--;
|
||||
else
|
||||
break;
|
||||
}
|
||||
return (count);
|
||||
}
|
||||
#endif /* !STRCASECMP */
|
||||
|
@ -1,42 +0,0 @@
|
||||
/* clib.h: Declarations of functions which appear in clib.c (or libc.a). */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#if !defined (_CLIB_H_)
|
||||
#define _CLIB_H_
|
||||
|
||||
#if !defined (HAVE_STRDUP)
|
||||
extern char *strdup ();
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_STRERROR)
|
||||
extern char *strerror ();
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_STRCASECMP)
|
||||
extern int strcasecmp ();
|
||||
extern int strncasecmp ();
|
||||
#endif
|
||||
|
||||
#endif /* !_CLIB_H_ */
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
mfoo
|
||||
em
|
||||
buffers
|
||||
|
||||
ââ
|
File diff suppressed because it is too large
Load Diff
@ -1,63 +0,0 @@
|
||||
/* echo_area.h -- Functions used in reading information from the echo area. */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#if !defined (_ECHO_AREA_H_)
|
||||
#define _ECHO_AREA_H_
|
||||
|
||||
#define EA_MAX_INPUT 256
|
||||
|
||||
extern int echo_area_is_active, info_aborted_echo_area;
|
||||
|
||||
/* Non-zero means that the last command executed while reading input
|
||||
killed some text. */
|
||||
extern int echo_area_last_command_was_kill;
|
||||
|
||||
extern void inform_in_echo_area (), echo_area_inform_of_deleted_window ();
|
||||
extern void echo_area_prep_read ();
|
||||
extern VFunction *ea_last_executed_command;
|
||||
|
||||
/* Read a line of text in the echo area. Return a malloc ()'ed string,
|
||||
or NULL if the user aborted out of this read. WINDOW is the currently
|
||||
active window, so that we can restore it when we need to. PROMPT, if
|
||||
non-null, is a prompt to print before reading the line. */
|
||||
extern char *info_read_in_echo_area ();
|
||||
|
||||
/* Read a line in the echo area with completion over COMPLETIONS.
|
||||
Takes arguments of WINDOW, PROMPT, and COMPLETIONS, a REFERENCE **. */
|
||||
char *info_read_completing_in_echo_area ();
|
||||
|
||||
/* Read a line in the echo area allowing completion over COMPLETIONS, but
|
||||
not requiring it. Takes arguments of WINDOW, PROMPT, and COMPLETIONS,
|
||||
a REFERENCE **. */
|
||||
extern char *info_read_maybe_completing ();
|
||||
|
||||
extern void ea_insert (), ea_quoted_insert ();
|
||||
extern void ea_beg_of_line (), ea_backward (), ea_delete (), ea_end_of_line ();
|
||||
extern void ea_forward (), ea_abort (), ea_rubout (), ea_complete ();
|
||||
extern void ea_newline (), ea_kill_line (), ea_transpose_chars ();
|
||||
extern void ea_yank (), ea_tab_insert (), ea_possible_completions ();
|
||||
extern void ea_backward_word (), ea_kill_word (), ea_forward_word ();
|
||||
extern void ea_yank_pop (), ea_backward_kill_word ();
|
||||
extern void ea_scroll_completions_window ();
|
||||
|
||||
#endif /* _ECHO_AREA_H_ */
|
@ -1,94 +0,0 @@
|
||||
/* general.h -- Some generally useful defines. */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#if !defined (_GENERAL_H_)
|
||||
#define _GENERAL_H_
|
||||
|
||||
extern void *xmalloc (), *xrealloc ();
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#include "clib.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 */
|
||||
|
||||
#if !defined (__FUNCTION_DEF)
|
||||
# define __FUNCTION_DEF
|
||||
typedef int Function ();
|
||||
typedef void VFunction ();
|
||||
typedef char *CFunction ();
|
||||
#endif /* _FUNCTION_DEF */
|
||||
|
||||
/* 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 */
|
||||
|
||||
#endif /* !_GENERAL_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -1,232 +0,0 @@
|
||||
.\" $Id$
|
||||
.\"
|
||||
.TH info 1 "7th December 1990"
|
||||
.SH NAME
|
||||
info \- GNU's hypertext system
|
||||
.SH SYNOPSIS
|
||||
.B info
|
||||
[
|
||||
.B \-\-option-name option-value
|
||||
]
|
||||
.B \menu-item...
|
||||
.SH COPYRIGHT
|
||||
.if n Copyright (C) 1989, 1993 Free Software Foundation, Inc.
|
||||
.if t Copyright \(co 1989, 1993 Free Software Foundation, Inc.
|
||||
.SH DESCRIPTION
|
||||
.LP
|
||||
The GNU project has a hypertext system called
|
||||
.I Info
|
||||
which allows the same source file to be either printed as a
|
||||
paper manual, or viewed using
|
||||
.B info.
|
||||
It is possible to use the
|
||||
.B info
|
||||
program from inside Emacs, or to use the stand-alone version described here.
|
||||
This manual page gives a brief summary of its capabilities.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-\-directory directory-path
|
||||
Add
|
||||
.B directory-path
|
||||
to the list of directory paths searched when
|
||||
.B info
|
||||
needs to find a file. You may issue
|
||||
.B \-\-directory
|
||||
multiple times.
|
||||
Alternatively, you may specify a value for the environment variable
|
||||
.B INFOPATH;
|
||||
if
|
||||
.B \-\-directory
|
||||
is not given, the value of
|
||||
.B INFOPATH
|
||||
is used. The value of
|
||||
.B INFOPATH
|
||||
is a colon separated list of directory names. If you do not supply either
|
||||
.B INFOPATH
|
||||
or
|
||||
.B \-\-directory-path,
|
||||
.B info
|
||||
uses a default path.
|
||||
.TP
|
||||
.B \-f filename
|
||||
Specify a particular
|
||||
.B info
|
||||
file to visit. By default,
|
||||
.B info
|
||||
visits
|
||||
the file
|
||||
.B dir;
|
||||
if you use this option,
|
||||
.B info
|
||||
will start with
|
||||
.B (FILENAME)Top
|
||||
as the first file and node.
|
||||
.TP
|
||||
.B \-n nodename
|
||||
Specify a particular node to visit in the initial file that
|
||||
.B info
|
||||
loads. This is especially useful in conjunction with
|
||||
.B \-\-file.
|
||||
You may specify
|
||||
.B \-\-node
|
||||
multiple times.
|
||||
.TP
|
||||
.B -o file
|
||||
Direct output to
|
||||
.B file
|
||||
instead of starting an interactive
|
||||
.B info
|
||||
session.
|
||||
.TP
|
||||
.B \-h
|
||||
Produce a relatively brief description of the available
|
||||
.B info
|
||||
options.
|
||||
.TP
|
||||
.B \-\-version
|
||||
Print the version information of
|
||||
.B info
|
||||
and exit.
|
||||
.TP
|
||||
.B menu-item
|
||||
.B info
|
||||
treats its remaining arguments as the names of menu items.
|
||||
The first argument is a menu item in the initial node visited,
|
||||
while the second argument is a menu item in the first argument's
|
||||
node. You can easily move to the node of your choice by
|
||||
specifying the menu names which describe the path to that node.
|
||||
For example,
|
||||
|
||||
.B info emacs buffers
|
||||
|
||||
first selects the menu item
|
||||
.B emacs
|
||||
in the node
|
||||
.B (dir)Top,
|
||||
and then selects the menu item
|
||||
.B buffers
|
||||
in the node
|
||||
.B (emacs)Top.
|
||||
.SH COMMANDS
|
||||
When in
|
||||
.B info
|
||||
the following commands are available:
|
||||
.TP
|
||||
.B h
|
||||
Invoke the Info tutorial.
|
||||
.TP
|
||||
.B ?
|
||||
Get a short summary of
|
||||
.B info
|
||||
commands.
|
||||
.TP
|
||||
.B h
|
||||
Select the
|
||||
.B info
|
||||
node from the main directory; this is much more complete than just
|
||||
using
|
||||
.B ?.
|
||||
.TP
|
||||
.B Ctrl-g
|
||||
Abort whatever you are doing.
|
||||
.TP
|
||||
.B Ctrl-l
|
||||
Redraw the screen.
|
||||
.PP
|
||||
Selecting other nodes:
|
||||
.TP
|
||||
.B n
|
||||
Move to the "next" node of this node.
|
||||
.TP
|
||||
.B p
|
||||
Move to the "previous" node of this node.
|
||||
.TP
|
||||
.B u
|
||||
Move to this node's "up" node.
|
||||
.TP
|
||||
.B m
|
||||
Pick a menu item specified by name. Picking a menu item causes another
|
||||
node to be selected. You do not need to type a complete nodename; if
|
||||
you type a few letters and then a space or tab
|
||||
.B info
|
||||
will try to fill in the rest of the nodename. If you ask for further
|
||||
completion without typing any more characters you'll be given a list
|
||||
of possibilities; you can also get the list with
|
||||
.B ?.
|
||||
If you type a few characters and then hit return
|
||||
.B info
|
||||
will try to do a completion, and if it is ambiguous use the first possibility.
|
||||
.TP
|
||||
.B f
|
||||
Follow a cross reference. You are asked for the name of the reference,
|
||||
using command completion as for
|
||||
.B m.
|
||||
.TP
|
||||
.B l
|
||||
Move to the last node you were at.
|
||||
.PP
|
||||
Moving within a node:
|
||||
.TP
|
||||
.B Space
|
||||
Scroll forward a page.
|
||||
.TP
|
||||
.B DEL
|
||||
Scroll backward a page.
|
||||
.TP
|
||||
.B b
|
||||
Go to the beginning of this node.
|
||||
.PP
|
||||
Advanced commands:
|
||||
.TP
|
||||
.B q
|
||||
Quit
|
||||
.B info.
|
||||
.TP
|
||||
.B 1
|
||||
Pick first item in node's menu.
|
||||
.TP
|
||||
.B 2 \-\- 5
|
||||
Pick second ... fifth item in node's menu.
|
||||
.TP
|
||||
.B g
|
||||
Move to node specified by name. You may include a filename as well,
|
||||
as
|
||||
.B (FILENAME)NODENAME.
|
||||
.TP
|
||||
.B s
|
||||
Search through this
|
||||
.B info
|
||||
file for a specified string, and select the node in which
|
||||
the next occurrence is found.
|
||||
.TP
|
||||
.B M-x print-node
|
||||
Pipe the contents of the current node through the command in the
|
||||
environment variable
|
||||
.B INFO_PRINT_COMMAND.
|
||||
If the variable does not exist, the node is simply piped to
|
||||
.B lpr.
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.B INFOPATH
|
||||
A colon-separated list of directories to search for
|
||||
.B info
|
||||
files. Used if
|
||||
.B \-\-directory
|
||||
is not given.
|
||||
.TP
|
||||
.B INFO_PRINT_COMMAND
|
||||
The command used for printing.
|
||||
.SH SEE ALSO
|
||||
.BR man (1)
|
||||
.\" .BR emacs (1)
|
||||
.SH AUTHOR
|
||||
.RS
|
||||
Brian Fox, Free Software Foundation
|
||||
.br
|
||||
bfox@ai.mit.edu
|
||||
.SH MANUAL AUTHOR
|
||||
.RS
|
||||
Robert Lupton; updated by Robert J. Chassell.
|
||||
.br
|
||||
rhl@astro.princeton.edu; bob@gnu.ai.mit.edu
|
@ -1,916 +0,0 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@comment %**start of header
|
||||
@setfilename info.info
|
||||
@settitle Info 1.0
|
||||
@comment %**end of header
|
||||
@comment $Id: info.texi,v 1.5 1996/09/29 16:58:42 karl Exp $
|
||||
|
||||
@dircategory Texinfo documentation system
|
||||
@direntry
|
||||
* Info: (info). Documentation browsing system.
|
||||
@end direntry
|
||||
|
||||
@ifinfo
|
||||
This file describes how to use Info,
|
||||
the on-line, menu-driven GNU documentation system.
|
||||
|
||||
Copyright (C) 1989, 92, 96 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file through TeX and print the
|
||||
results, provided the printed document carries copying permission
|
||||
notice identical to this one except for the removal of this paragraph
|
||||
(this paragraph not being relevant to the printed manual).
|
||||
|
||||
@end ignore
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the entire
|
||||
resulting derived work is distributed under the terms of a permission
|
||||
notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation approved
|
||||
by the Free Software Foundation.
|
||||
@end ifinfo
|
||||
|
||||
@titlepage
|
||||
@sp 11
|
||||
@center @titlefont{Info}
|
||||
@sp 2
|
||||
@center The
|
||||
@sp 2
|
||||
@center On-line, Menu-driven
|
||||
@sp 2
|
||||
@center GNU Documentation System
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1989, 1992, 1993 Free Software Foundation, Inc.
|
||||
@sp 2
|
||||
|
||||
Published by the Free Software Foundation @*
|
||||
59 Temple Place - Suite 330 @*
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the entire
|
||||
resulting derived work is distributed under the terms of a permission
|
||||
notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation approved
|
||||
by the Free Software Foundation.
|
||||
@end titlepage
|
||||
|
||||
@ifinfo
|
||||
@node Top, Getting Started, (dir), (dir)
|
||||
@top Info: An Introduction
|
||||
|
||||
Info is a program for reading documentation, which you are using now.
|
||||
|
||||
To learn how to use Info, type the command @kbd{h}. It brings you
|
||||
to a programmed instruction sequence.
|
||||
|
||||
@c Need to make sure that `Info-help' goes to the right node,
|
||||
@c which is the first node of the first chapter. (It should.)
|
||||
@c (Info-find-node "info"
|
||||
@c (if (< (window-height) 23)
|
||||
@c "Help-Small-Screen"
|
||||
@c "Help")))
|
||||
|
||||
To learn advanced Info commands, type @kbd{n} twice. This brings you to
|
||||
@cite{Info for Experts}, skipping over the `Getting Started' chapter.
|
||||
@end ifinfo
|
||||
|
||||
@menu
|
||||
* Getting Started:: Getting started using an Info reader.
|
||||
* Advanced Info:: Advanced commands within Info.
|
||||
* Create an Info File:: How to make your own Info file.
|
||||
* The Standalone Info Program: (info-stnd.info).
|
||||
@end menu
|
||||
|
||||
@node Getting Started, Advanced Info, Top, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Getting Started
|
||||
|
||||
This first part of the Info manual describes how to get around inside
|
||||
of Info. The second part of the manual describes various advanced
|
||||
Info commands, and how to write an Info as distinct from a Texinfo
|
||||
file. The third part is about how to generate Info files from
|
||||
Texinfo files.
|
||||
|
||||
@iftex
|
||||
This manual is primarily designed for use on a computer, so that you can
|
||||
try Info commands while reading about them. Reading it on paper is less
|
||||
effective, since you must take it on faith that the commands described
|
||||
really do what the manual says. By all means go through this manual now
|
||||
that you have it; but please try going through the on-line version as
|
||||
well.
|
||||
|
||||
There are two ways of looking at the online version of this manual:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Type @code{info} at your shell's command line. This approach uses a
|
||||
small stand-alone program designed just to read Info files.
|
||||
|
||||
@item
|
||||
Type @code{emacs} at the command line; then type @kbd{C-h i} (Control
|
||||
@kbd{h}, followed by @kbd{i}). This approach uses the Info mode of the
|
||||
Emacs program, an editor with many other capabilities.
|
||||
@end enumerate
|
||||
|
||||
In either case, then type @kbd{mInfo} (just the letters), followed by
|
||||
@key{RET}---the ``Return'' or ``Enter'' key. At this point, you should
|
||||
be ready to follow the instructions in this manual as you read them on
|
||||
the screen.
|
||||
@c FIXME! (pesch@cygnus.com, 14 dec 1992)
|
||||
@c Is it worth worrying about what-if the beginner goes to somebody
|
||||
@c else's Emacs session, which already has an Info running in the middle
|
||||
@c of something---in which case these simple instructions won't work?
|
||||
@end iftex
|
||||
|
||||
@menu
|
||||
* Help-Small-Screen:: Starting Info on a Small Screen
|
||||
* Help:: How to use Info
|
||||
* Help-P:: Returning to the Previous node
|
||||
* Help-^L:: The Space, Rubout, B and ^L commands.
|
||||
* Help-M:: Menus
|
||||
* Help-Adv:: Some advanced Info commands
|
||||
* Help-Q:: Quitting Info
|
||||
@end menu
|
||||
|
||||
@node Help-Small-Screen, Help, , Getting Started
|
||||
@comment node-name, next, previous, up
|
||||
@section Starting Info on a Small Screen
|
||||
|
||||
@iftex
|
||||
(In Info, you only see this section if your terminal has a small
|
||||
number of lines; most readers pass by it without seeing it.)
|
||||
@end iftex
|
||||
|
||||
Since your terminal has an unusually small number of lines on its
|
||||
screen, it is necessary to give you special advice at the beginning.
|
||||
|
||||
If you see the text @samp{--All----} at near the bottom right corner
|
||||
of the screen, it means the entire text you are looking at fits on the
|
||||
screen. If you see @samp{--Top----} instead, it means that there is
|
||||
more text below that does not fit. To move forward through the text
|
||||
and see another screen full, press the Space bar, @key{SPC}. To move
|
||||
back up, press the key labeled @samp{Backspace} or @key{Delete}.
|
||||
|
||||
@ifinfo
|
||||
Here are 40 lines of junk, so you can try Spaces and Deletes and
|
||||
see what they do. At the end are instructions of what you should do
|
||||
next.
|
||||
|
||||
This is line 17 @*
|
||||
This is line 18 @*
|
||||
This is line 19 @*
|
||||
This is line 20 @*
|
||||
This is line 21 @*
|
||||
This is line 22 @*
|
||||
This is line 23 @*
|
||||
This is line 24 @*
|
||||
This is line 25 @*
|
||||
This is line 26 @*
|
||||
This is line 27 @*
|
||||
This is line 28 @*
|
||||
This is line 29 @*
|
||||
This is line 30 @*
|
||||
This is line 31 @*
|
||||
This is line 32 @*
|
||||
This is line 33 @*
|
||||
This is line 34 @*
|
||||
This is line 35 @*
|
||||
This is line 36 @*
|
||||
This is line 37 @*
|
||||
This is line 38 @*
|
||||
This is line 39 @*
|
||||
This is line 40 @*
|
||||
This is line 41 @*
|
||||
This is line 42 @*
|
||||
This is line 43 @*
|
||||
This is line 44 @*
|
||||
This is line 45 @*
|
||||
This is line 46 @*
|
||||
This is line 47 @*
|
||||
This is line 48 @*
|
||||
This is line 49 @*
|
||||
This is line 50 @*
|
||||
This is line 51 @*
|
||||
This is line 52 @*
|
||||
This is line 53 @*
|
||||
This is line 54 @*
|
||||
This is line 55 @*
|
||||
This is line 56 @*
|
||||
|
||||
If you have managed to get here, go back to the beginning with
|
||||
Delete, and come back here again, then you understand Space and
|
||||
Delete. So now type an @kbd{n} ---just one character; don't type
|
||||
the quotes and don't type the Return key afterward--- to
|
||||
get to the normal start of the course.
|
||||
@end ifinfo
|
||||
|
||||
@node Help, Help-P, Help-Small-Screen, Getting Started
|
||||
@comment node-name, next, previous, up
|
||||
@section How to use Info
|
||||
|
||||
You are talking to the program Info, for reading documentation.
|
||||
|
||||
Right now you are looking at one @dfn{Node} of Information.
|
||||
A node contains text describing a specific topic at a specific
|
||||
level of detail. This node's topic is ``how to use Info''.
|
||||
|
||||
The top line of a node is its @dfn{header}. This node's header (look at
|
||||
it now) says that it is the node named @samp{Help} in the file
|
||||
@file{info}. It says that the @samp{Next} node after this one is the node
|
||||
called @samp{Help-P}. An advanced Info command lets you go to any node
|
||||
whose name you know.
|
||||
|
||||
Besides a @samp{Next}, a node can have a @samp{Previous} or an @samp{Up}.
|
||||
This node has a @samp{Previous} but no @samp{Up}, as you can see.
|
||||
|
||||
Now it is time to move on to the @samp{Next} node, named @samp{Help-P}.
|
||||
|
||||
>> Type @samp{n} to move there. Type just one character;
|
||||
do not type the quotes and do not type a @key{RET} afterward.
|
||||
|
||||
@samp{>>} in the margin means it is really time to try a command.
|
||||
|
||||
@node Help-P, Help-^L, Help, Getting Started
|
||||
@comment node-name, next, previous, up
|
||||
@section Returning to the Previous node
|
||||
|
||||
This node is called @samp{Help-P}. The @samp{Previous} node, as you see,
|
||||
is @samp{Help}, which is the one you just came from using the @kbd{n}
|
||||
command. Another @kbd{n} command now would take you to the next
|
||||
node, @samp{Help-^L}.
|
||||
|
||||
>> But do not do that yet. First, try the @kbd{p} command, which takes
|
||||
you to the @samp{Previous} node. When you get there, you can do an
|
||||
@kbd{n} again to return here.
|
||||
|
||||
This all probably seems insultingly simple so far, but @emph{do not} be
|
||||
led into skimming. Things will get more complicated soon. Also,
|
||||
do not try a new command until you are told it is time to. Otherwise,
|
||||
you may make Info skip past an important warning that was coming up.
|
||||
|
||||
>> Now do an @kbd{n} to get to the node @samp{Help-^L} and learn more.
|
||||
|
||||
@node Help-^L, Help-M, Help-P, Getting Started
|
||||
@comment node-name, next, previous, up
|
||||
@section The Space, Delete, B and ^L commands.
|
||||
|
||||
This node's header tells you that you are now at node @samp{Help-^L}, and
|
||||
that @kbd{p} would get you back to @samp{Help-P}. The node's title is
|
||||
underlined; it says what the node is about (most nodes have titles).
|
||||
|
||||
This is a big node and it does not all fit on your display screen.
|
||||
You can tell that there is more that is not visible because you
|
||||
can see the string @samp{--Top-----} rather than @samp{--All----} near
|
||||
the bottom right corner of the screen.
|
||||
|
||||
The Space, Delete and @kbd{B} commands exist to allow you to ``move
|
||||
around'' in a node that does not all fit on the screen at once.
|
||||
Space moves forward, to show what was below the bottom of the screen.
|
||||
Delete moves backward, to show what was above the top of the screen
|
||||
(there is not anything above the top until you have typed some spaces).
|
||||
|
||||
>> Now try typing a Space (afterward, type a Delete to return here).
|
||||
|
||||
When you type the space, the two lines that were at the bottom of
|
||||
the screen appear at the top, followed by more lines. Delete takes
|
||||
the two lines from the top and moves them to the bottom,
|
||||
@emph{usually}, but if there are not a full screen's worth of lines
|
||||
above them they may not make it all the way to the bottom.
|
||||
|
||||
If you type Space when there is no more to see, it rings the
|
||||
bell and otherwise does nothing. The same goes for Delete when
|
||||
the header of the node is visible.
|
||||
|
||||
If your screen is ever garbaged, you can tell Info to print it out
|
||||
again by typing @kbd{C-l} (@kbd{Control-L}, that is---hold down ``Control'' and
|
||||
type an @key{L} or @kbd{l}).
|
||||
|
||||
>> Type @kbd{C-l} now.
|
||||
|
||||
To move back to the beginning of the node you are on, you can type
|
||||
a lot of Deletes. You can also type simply @kbd{b} for beginning.
|
||||
>> Try that now. (We have put in enough verbiage to push this past
|
||||
the first screenful, but screens are so big nowadays that perhaps it
|
||||
isn't enough. You may need to shrink your Emacs or Info window.)
|
||||
Then come back, with Spaces.
|
||||
|
||||
If your screen is very tall, all of this node might fit at once.
|
||||
In that case, "b" won't do anything. Sorry; what can we do?
|
||||
|
||||
You have just learned a considerable number of commands. If you
|
||||
want to use one but have trouble remembering which, you should type
|
||||
a @key{?} which prints out a brief list of commands. When you are
|
||||
finished looking at the list, make it go away by typing a @key{SPC}.
|
||||
|
||||
>> Type a @key{?} now. After it finishes, type a @key{SPC}.
|
||||
|
||||
(If you are using the standalone Info reader, type `l' to return here.)
|
||||
|
||||
From now on, you will encounter large nodes without warning, and
|
||||
will be expected to know how to use Space and Delete to move
|
||||
around in them without being told. Since not all terminals have
|
||||
the same size screen, it would be impossible to warn you anyway.
|
||||
|
||||
>> Now type @kbd{n} to see the description of the @kbd{m} command.
|
||||
|
||||
@node Help-M, Help-Adv, Help-^L, Getting Started
|
||||
@comment node-name, next, previous, up
|
||||
@section Menus
|
||||
|
||||
Menus and the @kbd{m} command
|
||||
|
||||
With only the @kbd{n} and @kbd{p} commands for moving between nodes, nodes
|
||||
are restricted to a linear sequence. Menus allow a branching
|
||||
structure. A menu is a list of other nodes you can move to. It is
|
||||
actually just part of the text of the node formatted specially so that
|
||||
Info can interpret it. The beginning of a menu is always identified
|
||||
by a line which starts with @samp{* Menu:}. A node contains a menu if and
|
||||
only if it has a line in it which starts that way. The only menu you
|
||||
can use at any moment is the one in the node you are in. To use a
|
||||
menu in any other node, you must move to that node first.
|
||||
|
||||
After the start of the menu, each line that starts with a @samp{*}
|
||||
identifies one subtopic. The line usually contains a brief name
|
||||
for the subtopic (followed by a @samp{:}), the name of the node that talks
|
||||
about that subtopic, and optionally some further description of the
|
||||
subtopic. Lines in the menu that do not start with a @samp{*} have no
|
||||
special meaning---they are only for the human reader's benefit and do
|
||||
not define additional subtopics. Here is an example:
|
||||
|
||||
@example
|
||||
* Foo: FOO's Node This tells about FOO
|
||||
@end example
|
||||
|
||||
The subtopic name is Foo, and the node describing it is @samp{FOO's Node}.
|
||||
The rest of the line is just for the reader's Information.
|
||||
[[ But this line is not a real menu item, simply because there is
|
||||
no line above it which starts with @samp{* Menu:}.]]
|
||||
|
||||
When you use a menu to go to another node (in a way that will be
|
||||
described soon), what you specify is the subtopic name, the first
|
||||
thing in the menu line. Info uses it to find the menu line, extracts
|
||||
the node name from it, and goes to that node. The reason that there
|
||||
is both a subtopic name and a node name is that the node name must be
|
||||
meaningful to the computer and may therefore have to be ugly looking.
|
||||
The subtopic name can be chosen just to be convenient for the user to
|
||||
specify. Often the node name is convenient for the user to specify
|
||||
and so both it and the subtopic name are the same. There is an
|
||||
abbreviation for this:
|
||||
|
||||
@example
|
||||
* Foo:: This tells about FOO
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
This means that the subtopic name and node name are the same; they are
|
||||
both @samp{Foo}.
|
||||
|
||||
>> Now use Spaces to find the menu in this node, then come back to
|
||||
the front with a @kbd{b} and some Spaces. As you see, a menu is
|
||||
actually visible in its node. If you cannot find a menu in a node
|
||||
by looking at it, then the node does not have a menu and the
|
||||
@kbd{m} command is not available.
|
||||
|
||||
The command to go to one of the subnodes is @kbd{m}---but @emph{do
|
||||
not do it yet!} Before you use @kbd{m}, you must understand the
|
||||
difference between commands and arguments. So far, you have learned
|
||||
several commands that do not need arguments. When you type one, Info
|
||||
processes it and is instantly ready for another command. The @kbd{m}
|
||||
command is different: it is incomplete without the @dfn{name of the
|
||||
subtopic}. Once you have typed @kbd{m}, Info tries to read the
|
||||
subtopic name.
|
||||
|
||||
Now look for the line containing many dashes near the bottom of the
|
||||
screen. There is one more line beneath that one, but usually it is
|
||||
blank. If it is empty, Info is ready for a command, such as @kbd{n}
|
||||
or @kbd{b} or Space or @kbd{m}. If that line contains text ending
|
||||
in a colon, it mean Info is trying to read the @dfn{argument} to a
|
||||
command. At such times, commands do not work, because Info tries to
|
||||
use them as the argument. You must either type the argument and
|
||||
finish the command you started, or type @kbd{Control-g} to cancel the
|
||||
command. When you have done one of those things, the line becomes
|
||||
blank again.
|
||||
|
||||
The command to go to a subnode via a menu is @kbd{m}. After you type
|
||||
the @kbd{m}, the line at the bottom of the screen says @samp{Menu item: }.
|
||||
You must then type the name of the subtopic you want, and end it with
|
||||
a @key{RET}.
|
||||
|
||||
You can abbreviate the subtopic name. If the abbreviation is not
|
||||
unique, the first matching subtopic is chosen. Some menus put
|
||||
the shortest possible abbreviation for each subtopic name in capital
|
||||
letters, so you can see how much you need to type. It does not
|
||||
matter whether you use upper case or lower case when you type the
|
||||
subtopic. You should not put any spaces at the end, or inside of the
|
||||
item name, except for one space where a space appears in the item in
|
||||
the menu.
|
||||
|
||||
You can also use the @dfn{completion} feature to help enter the subtopic
|
||||
name. If you type the Tab key after entering part of a name, it will
|
||||
magically fill in more of the name---as much as follows uniquely from
|
||||
what you have entered.
|
||||
|
||||
If you move the cursor to one of the menu subtopic lines, then you do
|
||||
not need to type the argument: you just type a Return, and it stands for
|
||||
the subtopic of the line you are on.
|
||||
|
||||
Here is a menu to give you a chance to practice.
|
||||
|
||||
* Menu: The menu starts here.
|
||||
|
||||
This menu gives you three ways of going to one place, Help-FOO.
|
||||
|
||||
* Foo: Help-FOO. A node you can visit for fun.@*
|
||||
* Bar: Help-FOO. Strange! two ways to get to the same place.@*
|
||||
* Help-FOO:: And yet another!@*
|
||||
|
||||
|
||||
>> Now type just an @kbd{m} and see what happens:
|
||||
|
||||
Now you are ``inside'' an @kbd{m} command. Commands cannot be used
|
||||
now; the next thing you will type must be the name of a subtopic.
|
||||
|
||||
You can change your mind about doing the @kbd{m} by typing Control-g.
|
||||
|
||||
>> Try that now; notice the bottom line clear.
|
||||
|
||||
>> Then type another @kbd{m}.
|
||||
|
||||
>> Now type @samp{BAR} item name. Do not type Return yet.
|
||||
|
||||
While you are typing the item name, you can use the Delete key to
|
||||
cancel one character at a time if you make a mistake.
|
||||
|
||||
>> Type one to cancel the @samp{R}. You could type another @samp{R} to
|
||||
replace it. You do not have to, since @samp{BA} is a valid abbreviation.
|
||||
|
||||
>> Now you are ready to go. Type a @key{RET}.
|
||||
|
||||
After visiting Help-FOO, you should return here.
|
||||
|
||||
>> Type @kbd{n} to see more commands.
|
||||
|
||||
@c If a menu appears at the end of this node, remove it.
|
||||
@c It is an accident of the menu updating command.
|
||||
|
||||
Here is another way to get to Help-FOO, a menu. You can ignore this
|
||||
if you want, or else try it (but then please come back to here).
|
||||
|
||||
@menu
|
||||
* Help-FOO::
|
||||
@end menu
|
||||
|
||||
@node Help-FOO, , , Help-M
|
||||
@comment node-name, next, previous, up
|
||||
@subsection The @kbd{u} command
|
||||
|
||||
Congratulations! This is the node @samp{Help-FOO}. Unlike the other
|
||||
nodes you have seen, this one has an @samp{Up}: @samp{Help-M}, the node you
|
||||
just came from via the @kbd{m} command. This is the usual
|
||||
convention---the nodes you reach from a menu have @samp{Up} nodes that lead
|
||||
back to the menu. Menus move Down in the tree, and @samp{Up} moves Up.
|
||||
@samp{Previous}, on the other hand, is usually used to ``stay on the same
|
||||
level but go backwards''
|
||||
|
||||
You can go back to the node @samp{Help-M} by typing the command
|
||||
@kbd{u} for ``Up''. That puts you at the @emph{front} of the
|
||||
node---to get back to where you were reading you have to type
|
||||
some @key{SPC}s.
|
||||
|
||||
>> Now type @kbd{u} to move back up to @samp{Help-M}.
|
||||
|
||||
@node Help-Adv, Help-Q, Help-M, Getting Started
|
||||
@comment node-name, next, previous, up
|
||||
@section Some advanced Info commands
|
||||
|
||||
The course is almost over, so please stick with it to the end.
|
||||
|
||||
If you have been moving around to different nodes and wish to
|
||||
retrace your steps, the @kbd{l} command (@kbd{l} for @dfn{last}) will
|
||||
do that, one node-step at a time. As you move from node to node, Info
|
||||
records the nodes where you have been in a special history list. The
|
||||
@kbd{l} command revisits nodes in the history list; each successive
|
||||
@kbd{l} command moves one step back through the history.
|
||||
|
||||
If you have been following directions, ad @kbd{l} command now will get
|
||||
you back to @samp{Help-M}. Another @kbd{l} command would undo the
|
||||
@kbd{u} and get you back to @samp{Help-FOO}. Another @kbd{l} would undo
|
||||
the @kbd{m} and get you back to @samp{Help-M}.
|
||||
|
||||
>> Try typing three @kbd{l}'s, pausing in between to see what each
|
||||
@kbd{l} does.
|
||||
|
||||
Then follow directions again and you will end up back here.
|
||||
|
||||
Note the difference between @kbd{l} and @kbd{p}: @kbd{l} moves to
|
||||
where @emph{you} last were, whereas @kbd{p} always moves to the node
|
||||
which the header says is the @samp{Previous} node (from this node, to
|
||||
@samp{Help-M}).
|
||||
|
||||
The @samp{d} command gets you instantly to the Directory node.
|
||||
This node, which is the first one you saw when you entered Info,
|
||||
has a menu which leads (directly, or indirectly through other menus),
|
||||
to all the nodes that exist.
|
||||
|
||||
>> Try doing a @samp{d}, then do an @kbd{l} to return here (yes,
|
||||
@emph{do} return).
|
||||
|
||||
Sometimes, in Info documentation, you will see a cross reference.
|
||||
Cross references look like this: @xref{Help-Cross, Cross}. That is a
|
||||
real, live cross reference which is named @samp{Cross} and points at
|
||||
the node named @samp{Help-Cross}.
|
||||
|
||||
If you wish to follow a cross reference, you must use the @samp{f}
|
||||
command. The @samp{f} must be followed by the cross reference name
|
||||
(in this case, @samp{Cross}). While you enter the name, you can use the
|
||||
Delete key to edit your input. If you change your mind about following
|
||||
any reference, you can use @kbd{Control-g} to cancel the command.
|
||||
|
||||
Completion is available in the @samp{f} command; you can complete among
|
||||
all the cross reference names in the current node by typing a Tab.
|
||||
|
||||
>> Type @samp{f}, followed by @samp{Cross}, and a @key{RET}.
|
||||
|
||||
To get a list of all the cross references in the current node, you can
|
||||
type @kbd{?} after an @samp{f}. The @samp{f} continues to await a
|
||||
cross reference name even after printing the list, so if you don't
|
||||
actually want to follow a reference, you should type a @kbd{Control-g}
|
||||
to cancel the @samp{f}.
|
||||
|
||||
>> Type "f?" to get a list of the cross references in this node. Then
|
||||
type a @kbd{Control-g} and see how the @samp{f} gives up.
|
||||
|
||||
>> Now type @kbd{n} to see the last node of the course.
|
||||
|
||||
@c If a menu appears at the end of this node, remove it.
|
||||
@c It is an accident of the menu updating command.
|
||||
|
||||
@node Help-Cross, , , Help-Adv
|
||||
@comment node-name, next, previous, up
|
||||
@unnumberedsubsec The node reached by the cross reference in Info
|
||||
|
||||
This is the node reached by the cross reference named @samp{Cross}.
|
||||
|
||||
While this node is specifically intended to be reached by a cross
|
||||
reference, most cross references lead to nodes that ``belong''
|
||||
someplace else far away in the structure of Info. So you cannot expect
|
||||
the footnote to have a @samp{Next}, @samp{Previous} or @samp{Up} pointing back to
|
||||
where you came from. In general, the @kbd{l} (el) command is the only
|
||||
way to get back there.
|
||||
|
||||
>> Type @kbd{l} to return to the node where the cross reference was.
|
||||
|
||||
@node Help-Q, , Help-Adv, Getting Started
|
||||
@comment node-name, next, previous, up
|
||||
@section Quitting Info
|
||||
|
||||
To get out of Info, back to what you were doing before, type @kbd{q}
|
||||
for @dfn{Quit}.
|
||||
|
||||
This is the end of the course on using Info. There are some other
|
||||
commands that are meant for experienced users; they are useful, and you
|
||||
can find them by looking in the directory node for documentation on
|
||||
Info. Finding them will be a good exercise in using Info in the usual
|
||||
manner.
|
||||
|
||||
>> Type @samp{d} to go to the Info directory node; then type
|
||||
@samp{mInfo} and Return, to get to the node about Info and
|
||||
see what other help is available.
|
||||
|
||||
@node Advanced Info, Create an Info File, Getting Started, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Info for Experts
|
||||
|
||||
This chapter describes various advanced Info commands, and how to write
|
||||
an Info as distinct from a Texinfo file. (However, in most cases, writing a
|
||||
Texinfo file is better, since you can use it @emph{both} to generate an
|
||||
Info file and to make a printed manual. @xref{Top,, Overview of
|
||||
Texinfo, texinfo, Texinfo: The GNU Documentation Format}.)
|
||||
|
||||
@menu
|
||||
* Expert:: Advanced Info commands: g, s, e, and 1 - 5.
|
||||
* Add:: Describes how to add new nodes to the hierarchy.
|
||||
Also tells what nodes look like.
|
||||
* Menus:: How to add to or create menus in Info nodes.
|
||||
* Cross-refs:: How to add cross-references to Info nodes.
|
||||
* Tags:: How to make tag tables for Info files.
|
||||
* Checking:: Checking an Info File
|
||||
* Emacs Info Variables:: Variables modifying the behavior of Emacs Info.
|
||||
@end menu
|
||||
|
||||
@node Expert, Add, , Advanced Info
|
||||
@comment node-name, next, previous, up
|
||||
@section Advanced Info Commands
|
||||
|
||||
@kbd{g}, @kbd{s}, @kbd{1}, -- @kbd{9}, and @kbd{e}
|
||||
|
||||
If you know a node's name, you can go there by typing @kbd{g}, the
|
||||
name, and @key{RET}. Thus, @kbd{gTop@key{RET}} would go to the node
|
||||
called @samp{Top} in this file (its directory node).
|
||||
@kbd{gExpert@key{RET}} would come back here.
|
||||
|
||||
Unlike @kbd{m}, @kbd{g} does not allow the use of abbreviations.
|
||||
|
||||
To go to a node in another file, you can include the filename in the
|
||||
node name by putting it at the front, in parentheses. Thus,
|
||||
@kbd{g(dir)Top@key{RET}} would go to the Info Directory node, which is
|
||||
node @samp{Top} in the file @file{dir}.
|
||||
|
||||
The node name @samp{*} specifies the whole file. So you can look at
|
||||
all of the current file by typing @kbd{g*@key{RET}} or all of any
|
||||
other file with @kbd{g(FILENAME)@key{RET}}.
|
||||
|
||||
The @kbd{s} command allows you to search a whole file for a string.
|
||||
It switches to the next node if and when that is necessary. You
|
||||
type @kbd{s} followed by the string to search for, terminated by
|
||||
@key{RET}. To search for the same string again, just @kbd{s} followed
|
||||
by @key{RET} will do. The file's nodes are scanned in the order
|
||||
they are in in the file, which has no necessary relationship to the
|
||||
order that they may be in in the tree structure of menus and @samp{next} pointers.
|
||||
But normally the two orders are not very different. In any case,
|
||||
you can always do a @kbd{b} to find out what node you have reached, if
|
||||
the header is not visible (this can happen, because @kbd{s} puts your
|
||||
cursor at the occurrence of the string, not at the beginning of the
|
||||
node).
|
||||
|
||||
If you grudge the system each character of type-in it requires, you
|
||||
might like to use the commands @kbd{1}, @kbd{2}, @kbd{3}, @kbd{4}, ...
|
||||
@kbd{9}. They are short for the @kbd{m} command together with an
|
||||
argument. @kbd{1} goes through the first item in the current node's
|
||||
menu; @kbd{2} goes through the second item, etc.
|
||||
|
||||
If you display supports multiple fonts, and you are using Emacs' Info
|
||||
mode to read Info files, the @samp{*} for the fifth menu item is
|
||||
underlines, and so is the @samp{*} for the ninth item; these underlines
|
||||
make it easy to see at a glance which number to use for an item.
|
||||
|
||||
On ordinary terminals, you won't have underlining. If you need to
|
||||
actually count items, it is better to use @kbd{m} instead, and specify
|
||||
the name.
|
||||
|
||||
The Info command @kbd{e} changes from Info mode to an ordinary
|
||||
Emacs editing mode, so that you can edit the text of the current node.
|
||||
Type @kbd{C-c C-c} to switch back to Info. The @kbd{e} command is allowed
|
||||
only if the variable @code{Info-enable-edit} is non-@code{nil}.
|
||||
|
||||
@node Add, Menus, Expert, Advanced Info
|
||||
@comment node-name, next, previous, up
|
||||
@section Adding a new node to Info
|
||||
|
||||
To add a new topic to the list in the Info directory, you must:
|
||||
@enumerate
|
||||
@item
|
||||
Create some nodes, in some file, to document that topic.
|
||||
@item
|
||||
Put that topic in the menu in the directory. @xref{Menus, Menu}.
|
||||
@end enumerate
|
||||
|
||||
Usually, the way to create the nodes is with Texinfo @pxref{Top,, Overview of
|
||||
Texinfo, texinfo, Texinfo: The GNU Documentation Format}); this has the
|
||||
advantage that you can also make a printed manual from them. However,
|
||||
if hyou want to edit an Info file, here is how.
|
||||
|
||||
The new node can live in an existing documentation file, or in a new
|
||||
one. It must have a @key{^_} character before it (invisible to the
|
||||
user; this node has one but you cannot see it), and it ends with either
|
||||
a @key{^_}, a @key{^L}, or the end of file. Note: If you put in a
|
||||
@key{^L} to end a new node, be sure that there is a @key{^_} after it
|
||||
to start the next one, since @key{^L} cannot @emph{start} a node.
|
||||
Also, a nicer way to make a node boundary be a page boundary as well
|
||||
is to put a @key{^L} @emph{right after} the @key{^_}.
|
||||
|
||||
The @key{^_} starting a node must be followed by a newline or a
|
||||
@key{^L} newline, after which comes the node's header line. The
|
||||
header line must give the node's name (by which Info finds it),
|
||||
and state the names of the @samp{Next}, @samp{Previous}, and @samp{Up} nodes (if
|
||||
there are any). As you can see, this node's @samp{Up} node is the node
|
||||
@samp{Top}, which points at all the documentation for Info. The @samp{Next}
|
||||
node is @samp{Menus}.
|
||||
|
||||
The keywords @dfn{Node}, @dfn{Previous}, @dfn{Up}, and @dfn{Next},
|
||||
may appear in any order, anywhere in the header line, but the
|
||||
recommended order is the one in this sentence. Each keyword must be
|
||||
followed by a colon, spaces and tabs, and then the appropriate name.
|
||||
The name may be terminated with a tab, a comma, or a newline. A space
|
||||
does not end it; node names may contain spaces. The case of letters
|
||||
in the names is insignificant.
|
||||
|
||||
A node name has two forms. A node in the current file is named by
|
||||
what appears after the @samp{Node: } in that node's first line. For
|
||||
example, this node's name is @samp{Add}. A node in another file is
|
||||
named by @samp{(@var{filename})@var{node-within-file}}, as in
|
||||
@samp{(info)Add} for this node. If the file name starts with ``./'',
|
||||
then it is relative to the current directory; otherwise, it is relative
|
||||
starting from the standard Info file directory of your site.
|
||||
The name @samp{(@var{filename})Top} can be abbreviated to just
|
||||
@samp{(@var{filename})}. By convention, the name @samp{Top} is used for
|
||||
the ``highest'' node in any single file---the node whose @samp{Up} points
|
||||
out of the file. The Directory node is @file{(dir)}. The @samp{Top} node
|
||||
of a document file listed in the Directory should have an @samp{Up:
|
||||
(dir)} in it.
|
||||
|
||||
The node name @kbd{*} is special: it refers to the entire file.
|
||||
Thus, @kbd{g*} shows you the whole current file. The use of the
|
||||
node @kbd{*} is to make it possible to make old-fashioned,
|
||||
unstructured files into nodes of the tree.
|
||||
|
||||
The @samp{Node:} name, in which a node states its own name, must not
|
||||
contain a filename, since Info when searching for a node does not
|
||||
expect one to be there. The @samp{Next}, @samp{Previous} and @samp{Up} names may
|
||||
contain them. In this node, since the @samp{Up} node is in the same file,
|
||||
it was not necessary to use one.
|
||||
|
||||
Note that the nodes in this file have a file name in the header
|
||||
line. The file names are ignored by Info, but they serve as comments
|
||||
to help identify the node for the user.
|
||||
|
||||
@node Menus, Cross-refs, Add, Advanced Info
|
||||
@comment node-name, next, previous, up
|
||||
@section How to Create Menus
|
||||
|
||||
Any node in the Info hierarchy may have a @dfn{menu}---a list of subnodes.
|
||||
The @kbd{m} command searches the current node's menu for the topic which it
|
||||
reads from the terminal.
|
||||
|
||||
A menu begins with a line starting with @samp{* Menu:}. The rest of the
|
||||
line is a comment. After the starting line, every line that begins
|
||||
with a @samp{* } lists a single topic. The name of the topic--the
|
||||
argument that the user must give to the @kbd{m} command to select this
|
||||
topic---comes right after the star and space, and is followed by a
|
||||
colon, spaces and tabs, and the name of the node which discusses that
|
||||
topic. The node name, like node names following @samp{Next}, @samp{Previous}
|
||||
and @samp{Up}, may be terminated with a tab, comma, or newline; it may also
|
||||
be terminated with a period.
|
||||
|
||||
If the node name and topic name are the same, then rather than
|
||||
giving the name twice, the abbreviation @samp{* NAME::} may be used
|
||||
(and should be used, whenever possible, as it reduces the visual
|
||||
clutter in the menu).
|
||||
|
||||
It is considerate to choose the topic names so that they differ
|
||||
from each other very near the beginning---this allows the user to type
|
||||
short abbreviations. In a long menu, it is a good idea to capitalize
|
||||
the beginning of each item name which is the minimum acceptable
|
||||
abbreviation for it (a long menu is more than 5 or so entries).
|
||||
|
||||
The nodes listed in a node's menu are called its ``subnodes'', and
|
||||
it is their ``superior''. They should each have an @samp{Up:} pointing at
|
||||
the superior. It is often useful to arrange all or most of the
|
||||
subnodes in a sequence of @samp{Next} and @samp{Previous} pointers so that someone who
|
||||
wants to see them all need not keep revisiting the Menu.
|
||||
|
||||
The Info Directory is simply the menu of the node @samp{(dir)Top}---that
|
||||
is, node @samp{Top} in file @file{.../info/dir}. You can put new entries
|
||||
in that menu just like any other menu. The Info Directory is @emph{not} the
|
||||
same as the file directory called @file{info}. It happens that many of
|
||||
Info's files live on that file directory, but they do not have to; and
|
||||
files on that directory are not automatically listed in the Info
|
||||
Directory node.
|
||||
|
||||
Also, although the Info node graph is claimed to be a ``hierarchy'',
|
||||
in fact it can be @emph{any} directed graph. Shared structures and
|
||||
pointer cycles are perfectly possible, and can be used if they are
|
||||
appropriate to the meaning to be expressed. There is no need for all
|
||||
the nodes in a file to form a connected structure. In fact, this file
|
||||
has two connected components. You are in one of them, which is under
|
||||
the node @samp{Top}; the other contains the node @samp{Help} which the
|
||||
@kbd{h} command goes to. In fact, since there is no garbage
|
||||
collector, nothing terrible happens if a substructure is not pointed
|
||||
to, but such a substructure is rather useless since nobody can
|
||||
ever find out that it exists.
|
||||
|
||||
@node Cross-refs, Tags, Menus, Advanced Info
|
||||
@comment node-name, next, previous, up
|
||||
@section Creating Cross References
|
||||
|
||||
A cross reference can be placed anywhere in the text, unlike a menu
|
||||
item which must go at the front of a line. A cross reference looks
|
||||
like a menu item except that it has @samp{*note} instead of @kbd{*}.
|
||||
It @emph{cannot} be terminated by a @samp{)}, because @samp{)}'s are
|
||||
so often part of node names. If you wish to enclose a cross reference
|
||||
in parentheses, terminate it with a period first. Here are two
|
||||
examples of cross references pointers:
|
||||
|
||||
@example
|
||||
*Note details: commands. (See *note 3: Full Proof.)
|
||||
@end example
|
||||
|
||||
They are just examples. The places they ``lead to'' do not really exist!
|
||||
|
||||
@node Tags, Checking, Cross-refs, Advanced Info
|
||||
@comment node-name, next, previous, up
|
||||
@section Tag Tables for Info Files
|
||||
|
||||
You can speed up the access to nodes of a large Info file by giving
|
||||
it a tag table. Unlike the tag table for a program, the tag table for
|
||||
an Info file lives inside the file itself and is used
|
||||
automatically whenever Info reads in the file.
|
||||
|
||||
To make a tag table, go to a node in the file using Emacs Info mode and type
|
||||
@kbd{M-x Info-tagify}. Then you must use @kbd{C-x C-s} to save the
|
||||
file.
|
||||
|
||||
Once the Info file has a tag table, you must make certain it is up
|
||||
to date. If, as a result of deletion of text, any node moves back
|
||||
more than a thousand characters in the file from the position
|
||||
recorded in the tag table, Info will no longer be able to find that
|
||||
node. To update the tag table, use the @code{Info-tagify} command again.
|
||||
|
||||
An Info file tag table appears at the end of the file and looks like
|
||||
this:
|
||||
|
||||
@example
|
||||
^_
|
||||
Tag Table:
|
||||
File: info, Node: Cross-refs^?21419
|
||||
File: info, Node: Tags^?22145
|
||||
^_
|
||||
End Tag Table
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Note that it contains one line per node, and this line contains
|
||||
the beginning of the node's header (ending just after the node name),
|
||||
a Delete character, and the character position in the file of the
|
||||
beginning of the node.
|
||||
|
||||
@node Checking, Emacs Info Variables, Tags, Advanced Info
|
||||
@comment node-name, next, previous, up
|
||||
@section Checking an Info File
|
||||
|
||||
When creating an Info file, it is easy to forget the name of a node
|
||||
when you are making a pointer to it from another node. If you put in
|
||||
the wrong name for a node, this is not detected until someone
|
||||
tries to go through the pointer using Info. Verification of the Info
|
||||
file is an automatic process which checks all pointers to nodes and
|
||||
reports any pointers which are invalid. Every @samp{Next}, @samp{Previous}, and
|
||||
@samp{Up} is checked, as is every menu item and every cross reference. In
|
||||
addition, any @samp{Next} which does not have a @samp{Previous} pointing back is
|
||||
reported. Only pointers within the file are checked, because checking
|
||||
pointers to other files would be terribly slow. But those are usually
|
||||
few.
|
||||
|
||||
To check an Info file, do @kbd{M-x Info-validate} while looking at
|
||||
any node of the file with Emacs Info mode.
|
||||
|
||||
@node Emacs Info Variables, , Checking, Advanced Info
|
||||
@section Emacs Info-mode Variables
|
||||
|
||||
The following variables may modify the behaviour of Info-mode in Emacs;
|
||||
you may wish to set one or several of these variables interactively, or
|
||||
in your @file{~/.emacs} init file. @xref{Examining, Examining and Setting
|
||||
Variables, Examining and Setting Variables, emacs, The GNU Emacs
|
||||
Manual}.
|
||||
|
||||
@vtable @code
|
||||
@item Info-enable-edit
|
||||
Set to @code{nil}, disables the @samp{e} (@code{Info-edit}) command. A
|
||||
non-@code{nil} value enables it. @xref{Add, Edit}.
|
||||
|
||||
@item Info-enable-active-nodes
|
||||
When set to a non-@code{nil} value, allows Info to execute Lisp code
|
||||
associated with nodes. The Lisp code is executed when the node is
|
||||
selected.
|
||||
|
||||
@item Info-directory-list
|
||||
The list of directories to search for Info files. Each element is a
|
||||
string (directory name) or @code{nil} (try default directory).
|
||||
|
||||
@item Info-directory
|
||||
The standard directory for Info documentation files. Only used when the
|
||||
function @code{Info-directory} is called.
|
||||
@end vtable
|
||||
|
||||
@node Create an Info File, , Advanced Info, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Creating an Info File from a Makeinfo file
|
||||
|
||||
@code{makeinfo} is a utility that converts a Texinfo file into an Info
|
||||
file; @code{texinfo-format-region} and @code{texinfo-format-buffer} are
|
||||
GNU Emacs functions that do the same.
|
||||
|
||||
@xref{Create an Info File, , Creating an Info File, texinfo, the Texinfo
|
||||
Manual}, to learn how to create an Info file from a Texinfo file.
|
||||
|
||||
@xref{Top,, Overview of Texinfo, texinfo, Texinfo: The GNU Documentation
|
||||
Format}, to learn how to write a Texinfo file.
|
||||
|
||||
@bye
|
File diff suppressed because it is too large
Load Diff
@ -1,80 +0,0 @@
|
||||
/* xmalloc.c -- safe versions of malloc and realloc */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
This file has appeared in prior works by the Free Software Foundation;
|
||||
thus it carries copyright dates from 1988 through 1993.
|
||||
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox (bfox@ai.mit.edu). */
|
||||
|
||||
#if !defined (ALREADY_HAVE_XMALLOC)
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
extern void *malloc (), *realloc ();
|
||||
static void memory_error_and_abort ();
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Memory Allocation and Deallocation. */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Return a pointer to free()able block of memory large enough
|
||||
to hold BYTES number of bytes. If the memory cannot be allocated,
|
||||
print an error message and abort. */
|
||||
void *
|
||||
xmalloc (bytes)
|
||||
int bytes;
|
||||
{
|
||||
void *temp = malloc (bytes);
|
||||
|
||||
if (!temp)
|
||||
memory_error_and_abort ("xmalloc");
|
||||
return (temp);
|
||||
}
|
||||
|
||||
void *
|
||||
xrealloc (pointer, bytes)
|
||||
void *pointer;
|
||||
int bytes;
|
||||
{
|
||||
void *temp;
|
||||
|
||||
if (!pointer)
|
||||
temp = malloc (bytes);
|
||||
else
|
||||
temp = realloc (pointer, bytes);
|
||||
|
||||
if (!temp)
|
||||
memory_error_and_abort ("xrealloc");
|
||||
|
||||
return (temp);
|
||||
}
|
||||
|
||||
static void
|
||||
memory_error_and_abort (fname)
|
||||
char *fname;
|
||||
{
|
||||
fprintf (stderr, "%s: Out of virtual memory!\n", fname);
|
||||
abort ();
|
||||
}
|
||||
#endif /* !ALREADY_HAVE_XMALLOC */
|
@ -1,82 +0,0 @@
|
||||
# Makefile for GNU texinfo/libtxi. -*- Indented-Text -*-
|
||||
# $Id: Makefile.in,v 1.3 1996/10/03 18:32:28 karl Exp $
|
||||
|
||||
# Copyright (C) 1993, 96 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
SHELL = /bin/sh
|
||||
srcdir = @srcdir@
|
||||
VPATH = $(srcdir)
|
||||
|
||||
CC = @CC@
|
||||
AR = ar
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
DEFS = @DEFS@
|
||||
LIBS = @LIBS@
|
||||
LOADLIBES = $(LIBS)
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
# This is normally inherited from parent make, but if someone wants to
|
||||
# build libtxi.a alone, this variable will still be properly defined.
|
||||
ALLOCA = @ALLOCA@
|
||||
|
||||
# Standard functions that may be missing.
|
||||
LIBOBJS = @LIBOBJS@
|
||||
|
||||
SRCS = getopt.c getopt1.c bzero.c getopt.h
|
||||
OBJS = getopt.o getopt1.o bzero.o $(ALLOCA) $(LIBOBJS)
|
||||
|
||||
PROGS = libtxi.a
|
||||
|
||||
all: $(PROGS)
|
||||
sub-all: all
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) -I. -I$(srcdir) $(DEFS) $(CFLAGS) $<
|
||||
|
||||
libtxi.a: $(OBJS)
|
||||
rm -f $@
|
||||
$(AR) cq $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
getopt.o: getopt.c getopt.h
|
||||
getopt1.o: getopt1.c getopt.h
|
||||
alloca.o: alloca.c
|
||||
|
||||
install:
|
||||
uninstall:
|
||||
|
||||
TAGS: $(SRCS)
|
||||
etags $(SRCS)
|
||||
|
||||
clean:
|
||||
rm -f *.o a.out core core.* $(PROGS)
|
||||
|
||||
mostlyclean: clean
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile config.status TAGS ID
|
||||
|
||||
realclean: distclean
|
||||
|
||||
Makefile: Makefile.in ../config.status
|
||||
cd .. && sh config.status
|
||||
|
||||
# Prevent GNU make v3 from overflowing arg limit on SysV.
|
||||
.NOEXPORT:
|
@ -1,504 +0,0 @@
|
||||
/* alloca.c -- allocate automatically reclaimed memory
|
||||
(Mostly) portable public-domain implementation -- D A Gwyn
|
||||
|
||||
This implementation of the PWB library alloca function,
|
||||
which is used to allocate space off the run-time stack so
|
||||
that it is automatically reclaimed upon procedure exit,
|
||||
was inspired by discussions with J. Q. Johnson of Cornell.
|
||||
J.Otto Tennant <jot@cray.com> contributed the Cray support.
|
||||
|
||||
There are some preprocessor constants that can
|
||||
be defined when compiling for your specific system, for
|
||||
improved efficiency; however, the defaults should be okay.
|
||||
|
||||
The general concept of this implementation is to keep
|
||||
track of all alloca-allocated blocks, and reclaim any
|
||||
that are found to be deeper in the stack than the current
|
||||
invocation. This heuristic does not reclaim storage as
|
||||
soon as it becomes invalid, but it will do so eventually.
|
||||
|
||||
As a special case, alloca(0) reclaims storage without
|
||||
allocating any. It is a good idea to use alloca(0) in
|
||||
your main control loop, etc. to force garbage collection. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef emacs
|
||||
#include "blockinput.h"
|
||||
#endif
|
||||
|
||||
/* If compiling with GCC 2, this file's not needed. */
|
||||
#if !defined (__GNUC__) || __GNUC__ < 2
|
||||
|
||||
/* If someone has defined alloca as a macro,
|
||||
there must be some other way alloca is supposed to work. */
|
||||
#ifndef alloca
|
||||
|
||||
#ifdef emacs
|
||||
#ifdef static
|
||||
/* actually, only want this if static is defined as ""
|
||||
-- this is for usg, in which emacs must undefine static
|
||||
in order to make unexec workable
|
||||
*/
|
||||
#ifndef STACK_DIRECTION
|
||||
you
|
||||
lose
|
||||
-- must know STACK_DIRECTION at compile-time
|
||||
#endif /* STACK_DIRECTION undefined */
|
||||
#endif /* static */
|
||||
#endif /* emacs */
|
||||
|
||||
/* If your stack is a linked list of frames, you have to
|
||||
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
long i00afunc ();
|
||||
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||
#else
|
||||
#define ADDRESS_FUNCTION(arg) &(arg)
|
||||
#endif
|
||||
|
||||
#if __STDC__
|
||||
typedef void *pointer;
|
||||
#else
|
||||
typedef char *pointer;
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/* Different portions of Emacs need to call different versions of
|
||||
malloc. The Emacs executable needs alloca to call xmalloc, because
|
||||
ordinary malloc isn't protected from input signals. On the other
|
||||
hand, the utilities in lib-src need alloca to call malloc; some of
|
||||
them are very simple, and don't have an xmalloc routine.
|
||||
|
||||
Non-Emacs programs expect this to call use xmalloc.
|
||||
|
||||
Callers below should use malloc. */
|
||||
|
||||
#ifndef emacs
|
||||
#define malloc xmalloc
|
||||
#endif
|
||||
extern pointer malloc ();
|
||||
|
||||
/* Define STACK_DIRECTION if you know the direction of stack
|
||||
growth for your system; otherwise it will be automatically
|
||||
deduced at run-time.
|
||||
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
|
||||
#ifndef STACK_DIRECTION
|
||||
#define STACK_DIRECTION 0 /* Direction unknown. */
|
||||
#endif
|
||||
|
||||
#if STACK_DIRECTION != 0
|
||||
|
||||
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||
|
||||
#else /* STACK_DIRECTION == 0; need run-time code. */
|
||||
|
||||
static int stack_dir; /* 1 or -1 once known. */
|
||||
#define STACK_DIR stack_dir
|
||||
|
||||
static void
|
||||
find_stack_direction ()
|
||||
{
|
||||
static char *addr = NULL; /* Address of first `dummy', once known. */
|
||||
auto char dummy; /* To get stack address. */
|
||||
|
||||
if (addr == NULL)
|
||||
{ /* Initial entry. */
|
||||
addr = ADDRESS_FUNCTION (dummy);
|
||||
|
||||
find_stack_direction (); /* Recurse once. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second entry. */
|
||||
if (ADDRESS_FUNCTION (dummy) > addr)
|
||||
stack_dir = 1; /* Stack grew upward. */
|
||||
else
|
||||
stack_dir = -1; /* Stack grew downward. */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* STACK_DIRECTION == 0 */
|
||||
|
||||
/* An "alloca header" is used to:
|
||||
(a) chain together all alloca'ed blocks;
|
||||
(b) keep track of stack depth.
|
||||
|
||||
It is very important that sizeof(header) agree with malloc
|
||||
alignment chunk size. The following default should work okay. */
|
||||
|
||||
#ifndef ALIGN_SIZE
|
||||
#define ALIGN_SIZE sizeof(double)
|
||||
#endif
|
||||
|
||||
typedef union hdr
|
||||
{
|
||||
char align[ALIGN_SIZE]; /* To force sizeof(header). */
|
||||
struct
|
||||
{
|
||||
union hdr *next; /* For chaining headers. */
|
||||
char *deep; /* For stack depth measure. */
|
||||
} h;
|
||||
} header;
|
||||
|
||||
static header *last_alloca_header = NULL; /* -> last alloca header. */
|
||||
|
||||
/* Return a pointer to at least SIZE bytes of storage,
|
||||
which will be automatically reclaimed upon exit from
|
||||
the procedure that called alloca. Originally, this space
|
||||
was supposed to be taken from the current stack frame of the
|
||||
caller, but that method cannot be made to work for some
|
||||
implementations of C, for example under Gould's UTX/32. */
|
||||
|
||||
pointer
|
||||
alloca (size)
|
||||
unsigned size;
|
||||
{
|
||||
auto char probe; /* Probes stack depth: */
|
||||
register char *depth = ADDRESS_FUNCTION (probe);
|
||||
|
||||
#if STACK_DIRECTION == 0
|
||||
if (STACK_DIR == 0) /* Unknown growth direction. */
|
||||
find_stack_direction ();
|
||||
#endif
|
||||
|
||||
/* Reclaim garbage, defined as all alloca'd storage that
|
||||
was allocated from deeper in the stack than currently. */
|
||||
|
||||
{
|
||||
register header *hp; /* Traverses linked list. */
|
||||
|
||||
#ifdef emacs
|
||||
BLOCK_INPUT;
|
||||
#endif
|
||||
|
||||
for (hp = last_alloca_header; hp != NULL;)
|
||||
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
||||
|| (STACK_DIR < 0 && hp->h.deep < depth))
|
||||
{
|
||||
register header *np = hp->h.next;
|
||||
|
||||
free ((pointer) hp); /* Collect garbage. */
|
||||
|
||||
hp = np; /* -> next header. */
|
||||
}
|
||||
else
|
||||
break; /* Rest are not deeper. */
|
||||
|
||||
last_alloca_header = hp; /* -> last valid storage. */
|
||||
|
||||
#ifdef emacs
|
||||
UNBLOCK_INPUT;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
return NULL; /* No allocation required. */
|
||||
|
||||
/* Allocate combined header + user data storage. */
|
||||
|
||||
{
|
||||
register pointer new = malloc (sizeof (header) + size);
|
||||
/* Address of header. */
|
||||
|
||||
if (new == 0)
|
||||
abort();
|
||||
|
||||
((header *) new)->h.next = last_alloca_header;
|
||||
((header *) new)->h.deep = depth;
|
||||
|
||||
last_alloca_header = (header *) new;
|
||||
|
||||
/* User storage begins just after header. */
|
||||
|
||||
return (pointer) ((char *) new + sizeof (header));
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef CRAY_STACK
|
||||
#define CRAY_STACK
|
||||
#ifndef CRAY2
|
||||
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
||||
struct stack_control_header
|
||||
{
|
||||
long shgrow:32; /* Number of times stack has grown. */
|
||||
long shaseg:32; /* Size of increments to stack. */
|
||||
long shhwm:32; /* High water mark of stack. */
|
||||
long shsize:32; /* Current size of stack (all segments). */
|
||||
};
|
||||
|
||||
/* The stack segment linkage control information occurs at
|
||||
the high-address end of a stack segment. (The stack
|
||||
grows from low addresses to high addresses.) The initial
|
||||
part of the stack segment linkage control information is
|
||||
0200 (octal) words. This provides for register storage
|
||||
for the routine which overflows the stack. */
|
||||
|
||||
struct stack_segment_linkage
|
||||
{
|
||||
long ss[0200]; /* 0200 overflow words. */
|
||||
long sssize:32; /* Number of words in this segment. */
|
||||
long ssbase:32; /* Offset to stack base. */
|
||||
long:32;
|
||||
long sspseg:32; /* Offset to linkage control of previous
|
||||
segment of stack. */
|
||||
long:32;
|
||||
long sstcpt:32; /* Pointer to task common address block. */
|
||||
long sscsnm; /* Private control structure number for
|
||||
microtasking. */
|
||||
long ssusr1; /* Reserved for user. */
|
||||
long ssusr2; /* Reserved for user. */
|
||||
long sstpid; /* Process ID for pid based multi-tasking. */
|
||||
long ssgvup; /* Pointer to multitasking thread giveup. */
|
||||
long sscray[7]; /* Reserved for Cray Research. */
|
||||
long ssa0;
|
||||
long ssa1;
|
||||
long ssa2;
|
||||
long ssa3;
|
||||
long ssa4;
|
||||
long ssa5;
|
||||
long ssa6;
|
||||
long ssa7;
|
||||
long sss0;
|
||||
long sss1;
|
||||
long sss2;
|
||||
long sss3;
|
||||
long sss4;
|
||||
long sss5;
|
||||
long sss6;
|
||||
long sss7;
|
||||
};
|
||||
|
||||
#else /* CRAY2 */
|
||||
/* The following structure defines the vector of words
|
||||
returned by the STKSTAT library routine. */
|
||||
struct stk_stat
|
||||
{
|
||||
long now; /* Current total stack size. */
|
||||
long maxc; /* Amount of contiguous space which would
|
||||
be required to satisfy the maximum
|
||||
stack demand to date. */
|
||||
long high_water; /* Stack high-water mark. */
|
||||
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
|
||||
long hits; /* Number of internal buffer hits. */
|
||||
long extends; /* Number of block extensions. */
|
||||
long stko_mallocs; /* Block allocations by $STKOFEN. */
|
||||
long underflows; /* Number of stack underflow calls ($STKRETN). */
|
||||
long stko_free; /* Number of deallocations by $STKRETN. */
|
||||
long stkm_free; /* Number of deallocations by $STKMRET. */
|
||||
long segments; /* Current number of stack segments. */
|
||||
long maxs; /* Maximum number of stack segments so far. */
|
||||
long pad_size; /* Stack pad size. */
|
||||
long current_address; /* Current stack segment address. */
|
||||
long current_size; /* Current stack segment size. This
|
||||
number is actually corrupted by STKSTAT to
|
||||
include the fifteen word trailer area. */
|
||||
long initial_address; /* Address of initial segment. */
|
||||
long initial_size; /* Size of initial segment. */
|
||||
};
|
||||
|
||||
/* The following structure describes the data structure which trails
|
||||
any stack segment. I think that the description in 'asdef' is
|
||||
out of date. I only describe the parts that I am sure about. */
|
||||
|
||||
struct stk_trailer
|
||||
{
|
||||
long this_address; /* Address of this block. */
|
||||
long this_size; /* Size of this block (does not include
|
||||
this trailer). */
|
||||
long unknown2;
|
||||
long unknown3;
|
||||
long link; /* Address of trailer block of previous
|
||||
segment. */
|
||||
long unknown5;
|
||||
long unknown6;
|
||||
long unknown7;
|
||||
long unknown8;
|
||||
long unknown9;
|
||||
long unknown10;
|
||||
long unknown11;
|
||||
long unknown12;
|
||||
long unknown13;
|
||||
long unknown14;
|
||||
};
|
||||
|
||||
#endif /* CRAY2 */
|
||||
#endif /* not CRAY_STACK */
|
||||
|
||||
#ifdef CRAY2
|
||||
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
||||
I doubt that "lint" will like this much. */
|
||||
|
||||
static long
|
||||
i00afunc (long *address)
|
||||
{
|
||||
struct stk_stat status;
|
||||
struct stk_trailer *trailer;
|
||||
long *block, size;
|
||||
long result = 0;
|
||||
|
||||
/* We want to iterate through all of the segments. The first
|
||||
step is to get the stack status structure. We could do this
|
||||
more quickly and more directly, perhaps, by referencing the
|
||||
$LM00 common block, but I know that this works. */
|
||||
|
||||
STKSTAT (&status);
|
||||
|
||||
/* Set up the iteration. */
|
||||
|
||||
trailer = (struct stk_trailer *) (status.current_address
|
||||
+ status.current_size
|
||||
- 15);
|
||||
|
||||
/* There must be at least one stack segment. Therefore it is
|
||||
a fatal error if "trailer" is null. */
|
||||
|
||||
if (trailer == 0)
|
||||
abort ();
|
||||
|
||||
/* Discard segments that do not contain our argument address. */
|
||||
|
||||
while (trailer != 0)
|
||||
{
|
||||
block = (long *) trailer->this_address;
|
||||
size = trailer->this_size;
|
||||
if (block == 0 || size == 0)
|
||||
abort ();
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
if ((block <= address) && (address < (block + size)))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set the result to the offset in this segment and add the sizes
|
||||
of all predecessor segments. */
|
||||
|
||||
result = address - block;
|
||||
|
||||
if (trailer == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (trailer->this_size <= 0)
|
||||
abort ();
|
||||
result += trailer->this_size;
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
}
|
||||
while (trailer != 0);
|
||||
|
||||
/* We are done. Note that if you present a bogus address (one
|
||||
not in any segment), you will get a different number back, formed
|
||||
from subtracting the address of the first block. This is probably
|
||||
not what you want. */
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
#else /* not CRAY2 */
|
||||
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
|
||||
Determine the number of the cell within the stack,
|
||||
given the address of the cell. The purpose of this
|
||||
routine is to linearize, in some sense, stack addresses
|
||||
for alloca. */
|
||||
|
||||
static long
|
||||
i00afunc (long address)
|
||||
{
|
||||
long stkl = 0;
|
||||
|
||||
long size, pseg, this_segment, stack;
|
||||
long result = 0;
|
||||
|
||||
struct stack_segment_linkage *ssptr;
|
||||
|
||||
/* Register B67 contains the address of the end of the
|
||||
current stack segment. If you (as a subprogram) store
|
||||
your registers on the stack and find that you are past
|
||||
the contents of B67, you have overflowed the segment.
|
||||
|
||||
B67 also points to the stack segment linkage control
|
||||
area, which is what we are really interested in. */
|
||||
|
||||
stkl = CRAY_STACKSEG_END ();
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
|
||||
/* If one subtracts 'size' from the end of the segment,
|
||||
one has the address of the first word of the segment.
|
||||
|
||||
If this is not the first segment, 'pseg' will be
|
||||
nonzero. */
|
||||
|
||||
pseg = ssptr->sspseg;
|
||||
size = ssptr->sssize;
|
||||
|
||||
this_segment = stkl - size;
|
||||
|
||||
/* It is possible that calling this routine itself caused
|
||||
a stack overflow. Discard stack segments which do not
|
||||
contain the target address. */
|
||||
|
||||
while (!(this_segment <= address && address <= stkl))
|
||||
{
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
||||
#endif
|
||||
if (pseg == 0)
|
||||
break;
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
this_segment = stkl - size;
|
||||
}
|
||||
|
||||
result = address - this_segment;
|
||||
|
||||
/* If you subtract pseg from the current end of the stack,
|
||||
you get the address of the previous stack segment's end.
|
||||
This seems a little convoluted to me, but I'll bet you save
|
||||
a cycle somewhere. */
|
||||
|
||||
while (pseg != 0)
|
||||
{
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o\n", pseg, size);
|
||||
#endif
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
result += size;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
#endif /* not CRAY2 */
|
||||
#endif /* CRAY */
|
||||
|
||||
#endif /* no alloca */
|
||||
#endif /* not GCC version 2 */
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you can either send email to this
|
||||
* program's author (see below) or write to: The Free Software Foundation,
|
||||
* Inc.; 59 Temple Place - Suite 330. Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if !defined (HAVE_MEMSET) && !defined (HAVE_BZERO)
|
||||
|
||||
void
|
||||
bzero (b, length)
|
||||
register char *b;
|
||||
register int length;
|
||||
{
|
||||
#ifdef VMS /* but this is definitely VMS-specific */
|
||||
short zero = 0;
|
||||
long max_str = 65535;
|
||||
|
||||
while (length > max_str)
|
||||
{
|
||||
(void) LIB$MOVC5 (&zero, &zero, &zero, &max_str, b);
|
||||
length -= max_str;
|
||||
b += max_str;
|
||||
}
|
||||
(void) LIB$MOVC5 (&zero, &zero, &zero, &length, b);
|
||||
#else
|
||||
while (length-- > 0)
|
||||
*b++ = 0;
|
||||
#endif /* not VMS */
|
||||
}
|
||||
|
||||
#endif /* not HAVE_MEMSET && not HAVE_BZERO */
|
@ -1,762 +0,0 @@
|
||||
/* Getopt for GNU.
|
||||
NOTE: getopt is now part of the C library, so if you don't know what
|
||||
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
|
||||
before changing it!
|
||||
|
||||
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
|
||||
Ditto for AIX 3.2 and <stdlib.h>. */
|
||||
#ifndef _NO_PROTO
|
||||
#define _NO_PROTO
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#if !defined (__STDC__) || !__STDC__
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
|
||||
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* Don't include stdlib.h for non-GNU C libraries because some of them
|
||||
contain conflicting prototypes for getopt. */
|
||||
#include <stdlib.h>
|
||||
#endif /* GNU C library. */
|
||||
|
||||
/* This is for other GNU distributions with internationalized messages.
|
||||
The GNU C Library itself does not yet support such messages. */
|
||||
#if HAVE_LIBINTL_H
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# define gettext(msgid) (msgid)
|
||||
#endif
|
||||
|
||||
/* This version of `getopt' appears to the caller like standard Unix `getopt'
|
||||
but it behaves differently for the user, since it allows the user
|
||||
to intersperse the options with the other arguments.
|
||||
|
||||
As `getopt' works, it permutes the elements of ARGV so that,
|
||||
when it is done, all the options precede everything else. Thus
|
||||
all application programs are extended to handle flexible argument order.
|
||||
|
||||
Setting the environment variable POSIXLY_CORRECT disables permutation.
|
||||
Then the behavior is completely standard.
|
||||
|
||||
GNU application programs can use a third alternative mode in which
|
||||
they can distinguish the relative order of options and other arguments. */
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
When `getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when `ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
char *optarg = NULL;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to `getopt'.
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns EOF, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
/* XXX 1003.2 says this must be 1 before any call. */
|
||||
int optind = 0;
|
||||
|
||||
/* The next char to be scanned in the option-element
|
||||
in which the last option character we returned was found.
|
||||
This allows us to pick up the scan where we left off.
|
||||
|
||||
If this is zero, or a null string, it means resume the scan
|
||||
by advancing to the next ARGV-element. */
|
||||
|
||||
static char *nextchar;
|
||||
|
||||
/* Callers store zero here to inhibit the error message
|
||||
for unrecognized options. */
|
||||
|
||||
int opterr = 1;
|
||||
|
||||
/* Set to an option character which was unrecognized.
|
||||
This must be initialized on some systems to avoid linking in the
|
||||
system's own getopt implementation. */
|
||||
|
||||
int optopt = '?';
|
||||
|
||||
/* Describe how to deal with options that follow non-option ARGV-elements.
|
||||
|
||||
If the caller did not specify anything,
|
||||
the default is REQUIRE_ORDER if the environment variable
|
||||
POSIXLY_CORRECT is defined, PERMUTE otherwise.
|
||||
|
||||
REQUIRE_ORDER means don't recognize them as options;
|
||||
stop option processing when the first non-option is seen.
|
||||
This is what Unix does.
|
||||
This mode of operation is selected by either setting the environment
|
||||
variable POSIXLY_CORRECT, or using `+' as the first character
|
||||
of the list of option characters.
|
||||
|
||||
PERMUTE is the default. We permute the contents of ARGV as we scan,
|
||||
so that eventually all the non-options are at the end. This allows options
|
||||
to be given in any order, even with programs that were not written to
|
||||
expect this.
|
||||
|
||||
RETURN_IN_ORDER is an option available to programs that were written
|
||||
to expect options and other ARGV-elements in any order and that care about
|
||||
the ordering of the two. We describe each non-option ARGV-element
|
||||
as if it were the argument of an option with character code 1.
|
||||
Using `-' as the first character of the list of option characters
|
||||
selects this mode of operation.
|
||||
|
||||
The special argument `--' forces an end of option-scanning regardless
|
||||
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
|
||||
`--' can cause `getopt' to return EOF with `optind' != ARGC. */
|
||||
|
||||
static enum
|
||||
{
|
||||
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
|
||||
} ordering;
|
||||
|
||||
/* Value of POSIXLY_CORRECT environment variable. */
|
||||
static char *posixly_correct;
|
||||
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* We want to avoid inclusion of string.h with non-GNU libraries
|
||||
because there are many ways it can cause trouble.
|
||||
On some systems, it contains special magic macros that don't work
|
||||
in GCC. */
|
||||
#include <string.h>
|
||||
#define my_index strchr
|
||||
#else
|
||||
|
||||
/* Avoid depending on library functions or files
|
||||
whose names are inconsistent. */
|
||||
|
||||
char *getenv ();
|
||||
|
||||
static char *
|
||||
my_index (str, chr)
|
||||
const char *str;
|
||||
int chr;
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
if (*str == chr)
|
||||
return (char *) str;
|
||||
str++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If using GCC, we can safely declare strlen this way.
|
||||
If not using GCC, it is ok not to declare it. */
|
||||
#ifdef __GNUC__
|
||||
/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
|
||||
That was relevant to code that was here before. */
|
||||
#if !defined (__STDC__) || !__STDC__
|
||||
/* gcc with -traditional declares the built-in strlen to return int,
|
||||
and has done so at least since version 2.4.5. -- rms. */
|
||||
extern int strlen (const char *);
|
||||
#endif /* not __STDC__ */
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#endif /* not __GNU_LIBRARY__ */
|
||||
|
||||
/* Handle permutation of arguments. */
|
||||
|
||||
/* Describe the part of ARGV that contains non-options that have
|
||||
been skipped. `first_nonopt' is the index in ARGV of the first of them;
|
||||
`last_nonopt' is the index after the last of them. */
|
||||
|
||||
static int first_nonopt;
|
||||
static int last_nonopt;
|
||||
|
||||
/* Exchange two adjacent subsequences of ARGV.
|
||||
One subsequence is elements [first_nonopt,last_nonopt)
|
||||
which contains all the non-options that have been skipped so far.
|
||||
The other is elements [last_nonopt,optind), which contains all
|
||||
the options processed since those non-options were skipped.
|
||||
|
||||
`first_nonopt' and `last_nonopt' are relocated so that they describe
|
||||
the new indices of the non-options in ARGV after they are moved. */
|
||||
|
||||
static void
|
||||
exchange (argv)
|
||||
char **argv;
|
||||
{
|
||||
int bottom = first_nonopt;
|
||||
int middle = last_nonopt;
|
||||
int top = optind;
|
||||
char *tem;
|
||||
|
||||
/* Exchange the shorter segment with the far end of the longer segment.
|
||||
That puts the shorter segment into the right place.
|
||||
It leaves the longer segment in the right place overall,
|
||||
but it consists of two parts that need to be swapped next. */
|
||||
|
||||
while (top > middle && middle > bottom)
|
||||
{
|
||||
if (top - middle > middle - bottom)
|
||||
{
|
||||
/* Bottom segment is the short one. */
|
||||
int len = middle - bottom;
|
||||
register int i;
|
||||
|
||||
/* Swap it with the top part of the top segment. */
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] = argv[top - (middle - bottom) + i];
|
||||
argv[top - (middle - bottom) + i] = tem;
|
||||
}
|
||||
/* Exclude the moved bottom segment from further swapping. */
|
||||
top -= len;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Top segment is the short one. */
|
||||
int len = top - middle;
|
||||
register int i;
|
||||
|
||||
/* Swap it with the bottom part of the bottom segment. */
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] = argv[middle + i];
|
||||
argv[middle + i] = tem;
|
||||
}
|
||||
/* Exclude the moved top segment from further swapping. */
|
||||
bottom += len;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update records for the slots the non-options now occupy. */
|
||||
|
||||
first_nonopt += (optind - last_nonopt);
|
||||
last_nonopt = optind;
|
||||
}
|
||||
|
||||
/* Initialize the internal data when the first call is made. */
|
||||
|
||||
static const char *
|
||||
_getopt_initialize (optstring)
|
||||
const char *optstring;
|
||||
{
|
||||
/* Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||
is the program name); the sequence of previously skipped
|
||||
non-option ARGV-elements is empty. */
|
||||
|
||||
first_nonopt = last_nonopt = optind = 1;
|
||||
|
||||
nextchar = NULL;
|
||||
|
||||
posixly_correct = getenv ("POSIXLY_CORRECT");
|
||||
|
||||
/* Determine how to handle the ordering of options and nonoptions. */
|
||||
|
||||
if (optstring[0] == '-')
|
||||
{
|
||||
ordering = RETURN_IN_ORDER;
|
||||
++optstring;
|
||||
}
|
||||
else if (optstring[0] == '+')
|
||||
{
|
||||
ordering = REQUIRE_ORDER;
|
||||
++optstring;
|
||||
}
|
||||
else if (posixly_correct != NULL)
|
||||
ordering = REQUIRE_ORDER;
|
||||
else
|
||||
ordering = PERMUTE;
|
||||
|
||||
return optstring;
|
||||
}
|
||||
|
||||
/* Scan elements of ARGV (whose length is ARGC) for option characters
|
||||
given in OPTSTRING.
|
||||
|
||||
If an element of ARGV starts with '-', and is not exactly "-" or "--",
|
||||
then it is an option element. The characters of this element
|
||||
(aside from the initial '-') are option characters. If `getopt'
|
||||
is called repeatedly, it returns successively each of the option characters
|
||||
from each of the option elements.
|
||||
|
||||
If `getopt' finds another option character, it returns that character,
|
||||
updating `optind' and `nextchar' so that the next call to `getopt' can
|
||||
resume the scan with the following option character or ARGV-element.
|
||||
|
||||
If there are no more option characters, `getopt' returns `EOF'.
|
||||
Then `optind' is the index in ARGV of the first ARGV-element
|
||||
that is not an option. (The ARGV-elements have been permuted
|
||||
so that those that are not options now come last.)
|
||||
|
||||
OPTSTRING is a string containing the legitimate option characters.
|
||||
If an option character is seen that is not listed in OPTSTRING,
|
||||
return '?' after printing an error message. If you set `opterr' to
|
||||
zero, the error message is suppressed but we still return '?'.
|
||||
|
||||
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
|
||||
so the following text in the same ARGV-element, or the text of the following
|
||||
ARGV-element, is returned in `optarg'. Two colons mean an option that
|
||||
wants an optional arg; if there is text in the current ARGV-element,
|
||||
it is returned in `optarg', otherwise `optarg' is set to zero.
|
||||
|
||||
If OPTSTRING starts with `-' or `+', it requests different methods of
|
||||
handling the non-option ARGV-elements.
|
||||
See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
|
||||
|
||||
Long-named options begin with `--' instead of `-'.
|
||||
Their names may be abbreviated as long as the abbreviation is unique
|
||||
or is an exact match for some defined option. If they have an
|
||||
argument, it follows the option name in the same ARGV-element, separated
|
||||
from the option name by a `=', or else the in next ARGV-element.
|
||||
When `getopt' finds a long-named option, it returns 0 if that option's
|
||||
`flag' field is nonzero, the value of the option's `val' field
|
||||
if the `flag' field is zero.
|
||||
|
||||
The elements of ARGV aren't really const, because we permute them.
|
||||
But we pretend they're const in the prototype to be compatible
|
||||
with other systems.
|
||||
|
||||
LONGOPTS is a vector of `struct option' terminated by an
|
||||
element containing a name which is zero.
|
||||
|
||||
LONGIND returns the index in LONGOPT of the long-named option found.
|
||||
It is only valid when a long-named option has been found by the most
|
||||
recent call.
|
||||
|
||||
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
|
||||
long-named options. */
|
||||
|
||||
int
|
||||
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *optstring;
|
||||
const struct option *longopts;
|
||||
int *longind;
|
||||
int long_only;
|
||||
{
|
||||
optarg = NULL;
|
||||
|
||||
if (optind == 0)
|
||||
{
|
||||
optstring = _getopt_initialize (optstring);
|
||||
optind = 1; /* Don't scan ARGV[0], the program name. */
|
||||
}
|
||||
|
||||
if (nextchar == NULL || *nextchar == '\0')
|
||||
{
|
||||
/* Advance to the next ARGV-element. */
|
||||
|
||||
if (ordering == PERMUTE)
|
||||
{
|
||||
/* If we have just processed some options following some non-options,
|
||||
exchange them so that the options come first. */
|
||||
|
||||
if (first_nonopt != last_nonopt && last_nonopt != optind)
|
||||
exchange ((char **) argv);
|
||||
else if (last_nonopt != optind)
|
||||
first_nonopt = optind;
|
||||
|
||||
/* Skip any additional non-options
|
||||
and extend the range of non-options previously skipped. */
|
||||
|
||||
while (optind < argc
|
||||
&& (argv[optind][0] != '-' || argv[optind][1] == '\0'))
|
||||
optind++;
|
||||
last_nonopt = optind;
|
||||
}
|
||||
|
||||
/* The special ARGV-element `--' means premature end of options.
|
||||
Skip it like a null option,
|
||||
then exchange with previous non-options as if it were an option,
|
||||
then skip everything else like a non-option. */
|
||||
|
||||
if (optind != argc && !strcmp (argv[optind], "--"))
|
||||
{
|
||||
optind++;
|
||||
|
||||
if (first_nonopt != last_nonopt && last_nonopt != optind)
|
||||
exchange ((char **) argv);
|
||||
else if (first_nonopt == last_nonopt)
|
||||
first_nonopt = optind;
|
||||
last_nonopt = argc;
|
||||
|
||||
optind = argc;
|
||||
}
|
||||
|
||||
/* If we have done all the ARGV-elements, stop the scan
|
||||
and back over any non-options that we skipped and permuted. */
|
||||
|
||||
if (optind == argc)
|
||||
{
|
||||
/* Set the next-arg-index to point at the non-options
|
||||
that we previously skipped, so the caller will digest them. */
|
||||
if (first_nonopt != last_nonopt)
|
||||
optind = first_nonopt;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
/* If we have come to a non-option and did not permute it,
|
||||
either stop the scan or describe it to the caller and pass it by. */
|
||||
|
||||
if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))
|
||||
{
|
||||
if (ordering == REQUIRE_ORDER)
|
||||
return EOF;
|
||||
optarg = argv[optind++];
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* We have found another option-ARGV-element.
|
||||
Skip the initial punctuation. */
|
||||
|
||||
nextchar = (argv[optind] + 1
|
||||
+ (longopts != NULL && argv[optind][1] == '-'));
|
||||
}
|
||||
|
||||
/* Decode the current option-ARGV-element. */
|
||||
|
||||
/* Check whether the ARGV-element is a long option.
|
||||
|
||||
If long_only and the ARGV-element has the form "-f", where f is
|
||||
a valid short option, don't consider it an abbreviated form of
|
||||
a long option that starts with f. Otherwise there would be no
|
||||
way to give the -f short option.
|
||||
|
||||
On the other hand, if there's a long option "fubar" and
|
||||
the ARGV-element is "-fu", do consider that an abbreviation of
|
||||
the long option, just like "--fu", and not "-f" with arg "u".
|
||||
|
||||
This distinction seems to be the most useful approach. */
|
||||
|
||||
if (longopts != NULL
|
||||
&& (argv[optind][1] == '-'
|
||||
|| (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
|
||||
{
|
||||
char *nameend;
|
||||
const struct option *p;
|
||||
const struct option *pfound = NULL;
|
||||
int exact = 0;
|
||||
int ambig = 0;
|
||||
int indfound;
|
||||
int option_index;
|
||||
|
||||
for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
|
||||
/* Do nothing. */ ;
|
||||
|
||||
/* Test all long options for either exact match
|
||||
or abbreviated matches. */
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp (p->name, nextchar, nameend - nextchar))
|
||||
{
|
||||
if (nameend - nextchar == strlen (p->name))
|
||||
{
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
exact = 1;
|
||||
break;
|
||||
}
|
||||
else if (pfound == NULL)
|
||||
{
|
||||
/* First nonexact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
}
|
||||
else
|
||||
/* Second or later nonexact match found. */
|
||||
ambig = 1;
|
||||
}
|
||||
|
||||
if (ambig && !exact)
|
||||
{
|
||||
if (opterr)
|
||||
fprintf (stderr, gettext ("%s: option `%s' is ambiguous\n"),
|
||||
argv[0], argv[optind]);
|
||||
nextchar += strlen (nextchar);
|
||||
optind++;
|
||||
return '?';
|
||||
}
|
||||
|
||||
if (pfound != NULL)
|
||||
{
|
||||
option_index = indfound;
|
||||
optind++;
|
||||
if (*nameend)
|
||||
{
|
||||
/* Don't test has_arg with >, because some C compilers don't
|
||||
allow it to be used on enums. */
|
||||
if (pfound->has_arg)
|
||||
optarg = nameend + 1;
|
||||
else
|
||||
{
|
||||
if (opterr)
|
||||
if (argv[optind - 1][1] == '-')
|
||||
/* --option */
|
||||
fprintf (stderr,
|
||||
gettext ("%s: option `--%s' doesn't allow an argument\n"),
|
||||
argv[0], pfound->name);
|
||||
else
|
||||
/* +option or -option */
|
||||
fprintf (stderr,
|
||||
gettext ("%s: option `%c%s' doesn't allow an argument\n"),
|
||||
argv[0], argv[optind - 1][0], pfound->name);
|
||||
|
||||
nextchar += strlen (nextchar);
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
else if (pfound->has_arg == 1)
|
||||
{
|
||||
if (optind < argc)
|
||||
optarg = argv[optind++];
|
||||
else
|
||||
{
|
||||
if (opterr)
|
||||
fprintf (stderr,
|
||||
gettext ("%s: option `%s' requires an argument\n"),
|
||||
argv[0], argv[optind - 1]);
|
||||
nextchar += strlen (nextchar);
|
||||
return optstring[0] == ':' ? ':' : '?';
|
||||
}
|
||||
}
|
||||
nextchar += strlen (nextchar);
|
||||
if (longind != NULL)
|
||||
*longind = option_index;
|
||||
if (pfound->flag)
|
||||
{
|
||||
*(pfound->flag) = pfound->val;
|
||||
return 0;
|
||||
}
|
||||
return pfound->val;
|
||||
}
|
||||
|
||||
/* Can't find it as a long option. If this is not getopt_long_only,
|
||||
or the option starts with '--' or is not a valid short
|
||||
option, then it's an error.
|
||||
Otherwise interpret it as a short option. */
|
||||
if (!long_only || argv[optind][1] == '-'
|
||||
|| my_index (optstring, *nextchar) == NULL)
|
||||
{
|
||||
if (opterr)
|
||||
{
|
||||
if (argv[optind][1] == '-')
|
||||
/* --option */
|
||||
fprintf (stderr, gettext ("%s: unrecognized option `--%s'\n"),
|
||||
argv[0], nextchar);
|
||||
else
|
||||
/* +option or -option */
|
||||
fprintf (stderr, gettext ("%s: unrecognized option `%c%s'\n"),
|
||||
argv[0], argv[optind][0], nextchar);
|
||||
}
|
||||
nextchar = (char *) "";
|
||||
optind++;
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
|
||||
/* Look at and handle the next short option-character. */
|
||||
|
||||
{
|
||||
char c = *nextchar++;
|
||||
char *temp = my_index (optstring, c);
|
||||
|
||||
/* Increment `optind' when we start to process its last character. */
|
||||
if (*nextchar == '\0')
|
||||
++optind;
|
||||
|
||||
if (temp == NULL || c == ':')
|
||||
{
|
||||
if (opterr)
|
||||
{
|
||||
if (posixly_correct)
|
||||
/* 1003.2 specifies the format of this message. */
|
||||
fprintf (stderr, gettext ("%s: illegal option -- %c\n"),
|
||||
argv[0], c);
|
||||
else
|
||||
fprintf (stderr, gettext ("%s: invalid option -- %c\n"),
|
||||
argv[0], c);
|
||||
}
|
||||
optopt = c;
|
||||
return '?';
|
||||
}
|
||||
if (temp[1] == ':')
|
||||
{
|
||||
if (temp[2] == ':')
|
||||
{
|
||||
/* This is an option that accepts an argument optionally. */
|
||||
if (*nextchar != '\0')
|
||||
{
|
||||
optarg = nextchar;
|
||||
optind++;
|
||||
}
|
||||
else
|
||||
optarg = NULL;
|
||||
nextchar = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is an option that requires an argument. */
|
||||
if (*nextchar != '\0')
|
||||
{
|
||||
optarg = nextchar;
|
||||
/* If we end this ARGV-element by taking the rest as an arg,
|
||||
we must advance to the next element now. */
|
||||
optind++;
|
||||
}
|
||||
else if (optind == argc)
|
||||
{
|
||||
if (opterr)
|
||||
{
|
||||
/* 1003.2 specifies the format of this message. */
|
||||
fprintf (stderr,
|
||||
gettext ("%s: option requires an argument -- %c\n"),
|
||||
argv[0], c);
|
||||
}
|
||||
optopt = c;
|
||||
if (optstring[0] == ':')
|
||||
c = ':';
|
||||
else
|
||||
c = '?';
|
||||
}
|
||||
else
|
||||
/* We already incremented `optind' once;
|
||||
increment it again when taking next ARGV-elt as argument. */
|
||||
optarg = argv[optind++];
|
||||
nextchar = NULL;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
getopt (argc, argv, optstring)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *optstring;
|
||||
{
|
||||
return _getopt_internal (argc, argv, optstring,
|
||||
(const struct option *) 0,
|
||||
(int *) 0,
|
||||
0);
|
||||
}
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
/* Compile with -DTEST to make an executable for use in testing
|
||||
the above definition of `getopt'. */
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
|
||||
c = getopt (argc, argv, "abc:d:0123456789");
|
||||
if (c == EOF)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||
printf ("digits occur in two different argv-elements.\n");
|
||||
digit_optind = this_option_optind;
|
||||
printf ("option %c\n", c);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf ("option a\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf ("option b\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf ("option c with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
printf ("non-option ARGV-elements: ");
|
||||
while (optind < argc)
|
||||
printf ("%s ", argv[optind++]);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
@ -1,129 +0,0 @@
|
||||
/* Declarations for getopt.
|
||||
Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
#define _GETOPT_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
When `getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when `ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to `getopt'.
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns EOF, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
extern int optind;
|
||||
|
||||
/* Callers store zero here to inhibit the error message `getopt' prints
|
||||
for unrecognized options. */
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
extern int optopt;
|
||||
|
||||
/* Describe the long-named options requested by the application.
|
||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||
of `struct option' terminated by an element containing a name which is
|
||||
zero.
|
||||
|
||||
The field `has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field `flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field `val' when the option is found, but
|
||||
left unchanged if the option is not found.
|
||||
|
||||
To have a long-named option do something other than set an `int' to
|
||||
a compiled-in constant, such as set a value from `optarg', set the
|
||||
option's `flag' field to zero and its `val' field to a nonzero
|
||||
value (the equivalent single-letter option character, if there is
|
||||
one). For long options that have a zero `flag' field, `getopt'
|
||||
returns the contents of the `val' field. */
|
||||
|
||||
struct option
|
||||
{
|
||||
#if defined (__STDC__) && __STDC__
|
||||
const char *name;
|
||||
#else
|
||||
char *name;
|
||||
#endif
|
||||
/* has_arg can't be an enum because some compilers complain about
|
||||
type mismatches in all the code that assumes it is an int. */
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* Many other libraries have conflicting prototypes for getopt, with
|
||||
differences in the consts, in stdlib.h. To avoid compilation
|
||||
errors, only prototype getopt for the GNU C library. */
|
||||
extern int getopt (int argc, char *const *argv, const char *shortopts);
|
||||
#else /* not __GNU_LIBRARY__ */
|
||||
extern int getopt ();
|
||||
#endif /* __GNU_LIBRARY__ */
|
||||
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
|
||||
const struct option *longopts, int *longind);
|
||||
extern int getopt_long_only (int argc, char *const *argv,
|
||||
const char *shortopts,
|
||||
const struct option *longopts, int *longind);
|
||||
|
||||
/* Internal only. Users should not call this directly. */
|
||||
extern int _getopt_internal (int argc, char *const *argv,
|
||||
const char *shortopts,
|
||||
const struct option *longopts, int *longind,
|
||||
int long_only);
|
||||
#else /* not __STDC__ */
|
||||
extern int getopt ();
|
||||
extern int getopt_long ();
|
||||
extern int getopt_long_only ();
|
||||
|
||||
extern int _getopt_internal ();
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GETOPT_H */
|
@ -1,180 +0,0 @@
|
||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
#if !defined (__STDC__) || !__STDC__
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
|
||||
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
char *getenv ();
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
int
|
||||
getopt_long (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *options;
|
||||
const struct option *long_options;
|
||||
int *opt_index;
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
|
||||
}
|
||||
|
||||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||||
If an option that starts with '-' (not '--') doesn't match a long option,
|
||||
but does match a short option, it is parsed as a short option
|
||||
instead. */
|
||||
|
||||
int
|
||||
getopt_long_only (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *options;
|
||||
const struct option *long_options;
|
||||
int *opt_index;
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
|
||||
}
|
||||
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
int option_index = 0;
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"add", 1, 0, 0},
|
||||
{"append", 0, 0, 0},
|
||||
{"delete", 1, 0, 0},
|
||||
{"verbose", 0, 0, 0},
|
||||
{"create", 0, 0, 0},
|
||||
{"file", 1, 0, 0},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||||
long_options, &option_index);
|
||||
if (c == EOF)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
printf ("option %s", long_options[option_index].name);
|
||||
if (optarg)
|
||||
printf (" with arg %s", optarg);
|
||||
printf ("\n");
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||
printf ("digits occur in two different argv-elements.\n");
|
||||
digit_optind = this_option_optind;
|
||||
printf ("option %c\n", c);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf ("option a\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf ("option b\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf ("option c with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
printf ("option d with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
printf ("non-option ARGV-elements: ");
|
||||
while (optind < argc)
|
||||
printf ("%s ", argv[optind++]);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
@ -1,20 +0,0 @@
|
||||
/* Copy LEN bytes starting at SRCADDR to DESTADDR. Result undefined
|
||||
if the source overlaps with the destination.
|
||||
Return DESTADDR. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
char *
|
||||
memcpy (destaddr, srcaddr, len)
|
||||
char *destaddr;
|
||||
const char *srcaddr;
|
||||
int len;
|
||||
{
|
||||
char *dest = destaddr;
|
||||
|
||||
while (len-- > 0)
|
||||
*destaddr++ = *srcaddr++;
|
||||
return dest;
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
/* memmove.c -- copy memory.
|
||||
Copy LENGTH bytes from SOURCE to DEST. Does not null-terminate.
|
||||
In the public domain.
|
||||
By David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
void
|
||||
memmove (dest, source, length)
|
||||
char *dest;
|
||||
const char *source;
|
||||
unsigned length;
|
||||
{
|
||||
if (source < dest)
|
||||
/* Moving from low mem to hi mem; start at end. */
|
||||
for (source += length, dest += length; length; --length)
|
||||
*--dest = *--source;
|
||||
else if (source != dest)
|
||||
/* Moving from hi mem to low mem; start at beginning. */
|
||||
for (; length; --length)
|
||||
*dest++ = *source++;
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/* strdup.c -- return a newly allocated copy of a string
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
char *malloc ();
|
||||
char *strcpy ();
|
||||
#endif
|
||||
|
||||
/* Return a newly allocated copy of STR,
|
||||
or 0 if out of memory. */
|
||||
|
||||
char *
|
||||
strdup (str)
|
||||
const char *str;
|
||||
{
|
||||
char *newstr;
|
||||
|
||||
newstr = (char *) malloc (strlen (str) + 1);
|
||||
if (newstr)
|
||||
strcpy (newstr, str);
|
||||
return newstr;
|
||||
}
|
@ -1,177 +0,0 @@
|
||||
@c This file is included in makeinfo.texi.
|
||||
@c
|
||||
@ifinfo
|
||||
@comment Here are some useful examples of the macro facility.
|
||||
|
||||
@c Simply insert the right version of the texinfo name.
|
||||
@macro texinfo{}
|
||||
TeXinfo
|
||||
@end macro
|
||||
|
||||
@macro dfn{text}
|
||||
@dfn{\text\}
|
||||
@cpindex \text\
|
||||
@end macro
|
||||
|
||||
@c Define a macro which expands to a pretty version of the name of the
|
||||
@c Makeinfo program.
|
||||
@macro makeinfo{}
|
||||
@code{Makeinfo}
|
||||
@end macro
|
||||
|
||||
@c Define a macro which is used to define other macros. This one makes
|
||||
@c a macro which creates a node and gives it a sectioning command. Note
|
||||
@c that the created macro uses the original definition within the
|
||||
@c expansion text. This takes advantage of the non-recursion feature of
|
||||
@c macro execution.
|
||||
@macro node_define{orig-name}
|
||||
@macro \orig-name\{title}
|
||||
@node \title\
|
||||
@\orig-name\ \title\
|
||||
@end macro
|
||||
@end macro
|
||||
|
||||
@c Now actually define a new set of sectioning commands.
|
||||
@node_define {chapter}
|
||||
@node_define {section}
|
||||
@node_define {subsection}
|
||||
@end ifinfo
|
||||
|
||||
@chapter The Macro Facility
|
||||
|
||||
This chapter describes the new macro facility.
|
||||
|
||||
A @dfn{macro} is a command that you define in terms of other commands.
|
||||
It doesn't exist as a @texinfo{} command until you define it as part of
|
||||
the input file to @makeinfo{}. Once the command exists, it behaves much
|
||||
as any other @texinfo{} command. Macros are a useful way to ease the
|
||||
details and tedium of writing a `correct' info file. The following
|
||||
sections explain how to write and invoke macros.
|
||||
|
||||
@menu
|
||||
* How to Use Macros in @texinfo{}::
|
||||
How to use the macro facility.
|
||||
|
||||
* Using Macros Recursively::
|
||||
How to write a macro which does (or doesn't) recurse.
|
||||
|
||||
* Using @texinfo{} Macros As Arguments::
|
||||
Passing a macro as an argument.
|
||||
@end menu
|
||||
|
||||
@section How to Use Macros in @texinfo{}
|
||||
|
||||
Using macros in @texinfo{} is easy. First you define the macro. After
|
||||
that, the macro command is available as a normal @texinfo{} command.
|
||||
Here is what a definition looks like:
|
||||
|
||||
@example
|
||||
@@macro @var{name}@{@var{arg1}, @var{@dots{}} @var{argn}@}
|
||||
@var{@texinfo{} commands@dots{}}
|
||||
@@end macro
|
||||
@end example
|
||||
|
||||
The arguments that you specify that the macro takes are expanded with
|
||||
the actual parameters used when calling the macro if they are seen
|
||||
surrounded by backslashes. For example, here is a definition of
|
||||
@code{@@codeitem}, a macro which can be used wherever @code{@@item} can
|
||||
be used, but which surrounds its argument with @code{@@code@{@dots{}@}}.
|
||||
|
||||
@example
|
||||
@@macro codeitem@{item@}
|
||||
@@item @@code@{\item\@}
|
||||
@@end macro
|
||||
@end example
|
||||
|
||||
When the macro is expanded, all of the text between the @code{@@macro}
|
||||
and @code{@@end macro} is inserted into the document at the expansion
|
||||
point, with the actual parameters substituted for the named parameters.
|
||||
So, a call to the above macro might look like:
|
||||
|
||||
@example
|
||||
@@codeitem@{Foo@}
|
||||
@end example
|
||||
|
||||
and @makeinfo{} would execute the following code:
|
||||
|
||||
@example
|
||||
@@item @@code@{Foo@}
|
||||
@end example
|
||||
|
||||
A special case is made for macros which only take a single argument, and
|
||||
which are invoked without any brace characters (i.e.,
|
||||
@samp{@{}@dots{}@samp{@}}) surrounding an argument; the rest of the line
|
||||
is supplied as is as the sole argument to the macro. This special case
|
||||
allows one to redefine some standard @texinfo{} commands without
|
||||
modifying the input file. Along with the non-recursive action of macro
|
||||
invocation, one can easily redefine the sectioning commands to also
|
||||
provide index entries:
|
||||
|
||||
@example
|
||||
@@macro chapter@{name@}
|
||||
@@chapter \name\
|
||||
@@findex \name\
|
||||
@@end macro
|
||||
@end example
|
||||
|
||||
Thus, the text:
|
||||
|
||||
@example
|
||||
@@chapter strlen
|
||||
@end example
|
||||
|
||||
will expand to:
|
||||
|
||||
@example
|
||||
@@chapter strlen
|
||||
@@findex strlen
|
||||
@end example
|
||||
|
||||
@section Using Macros Recursively
|
||||
|
||||
Normally, while a particular macro is executing, any call to that macro
|
||||
will be seen as a call to a builtin @texinfo{} command. This allows one
|
||||
to redefine a builtin @texinfo{} command as a macro, and then use that
|
||||
command within the definition of the macro itself. For example, one
|
||||
might wish to make sure that whereever a term was defined with
|
||||
@code{@@dfn@{@dots{}@}}, the location of the definition would appear
|
||||
in the concept index for the manual. Here is a macro which redefines
|
||||
@code{@@dfn} to do just that:
|
||||
|
||||
@example
|
||||
@@macro dfn@{text@}
|
||||
@@dfn@{\text\@}
|
||||
@@cpindex \text\
|
||||
@@end macro
|
||||
@end example
|
||||
|
||||
Note that we used the builtin @texinfo{} command @code{@@dfn} within our
|
||||
overriding macro definition.
|
||||
|
||||
This behaviour itself can be overridden for macro execution by writing a
|
||||
special @dfn{macro control command} in the definition of the macro. The
|
||||
command is considered special because it doesn't affect the output text
|
||||
directly, rather, it affects the way in which the macro is defined. One
|
||||
such special command is @code{@@allow-recursion}.
|
||||
|
||||
@example
|
||||
@@macro silly@{arg@}
|
||||
@@allow-recursion
|
||||
\arg\
|
||||
@@end macro
|
||||
@end example
|
||||
|
||||
Now @code{@@silly} is a macro that can be used within a call to itself:
|
||||
|
||||
@example
|
||||
This text @@silly@{@@silly@{some text@}@} is ``some text''.
|
||||
@end example
|
||||
|
||||
@section Using @texinfo{} Macros As Arguments
|
||||
|
||||
@printindex cp
|
||||
How to use @texinfo{} macros as arguments to other @texinfo{} macros.
|
||||
|
||||
@bye
|
||||
|
||||
|
@ -1,303 +0,0 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@comment %**start of header
|
||||
@setfilename makeinfo.info
|
||||
@set VERSION 1.61
|
||||
@paragraphindent none
|
||||
@comment %**start of header
|
||||
@comment $Id: makeinfo.texi,v 1.2 1996/09/28 21:49:18 karl Exp $
|
||||
|
||||
@dircategory Texinfo documentation system
|
||||
@direntry
|
||||
* makeinfo: (makeinfo). Convert Texinfo source to Info or plain ASCII.
|
||||
@end direntry
|
||||
|
||||
@ifinfo
|
||||
This file is an extract from the @cite{Texinfo} manual.@*
|
||||
It documents Makeinfo, a program that converts Texinfo
|
||||
files into Info files.
|
||||
|
||||
Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file through TeX and print the
|
||||
results, provided the printed document carries copying permission
|
||||
notice identical to this one except for the removal of this paragraph
|
||||
(this paragraph not being relevant to the printed manual).
|
||||
|
||||
@end ignore
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the entire
|
||||
resulting derived work is distributed under the terms of a permission
|
||||
notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation approved
|
||||
by the Free Software Foundation.
|
||||
@end ifinfo
|
||||
|
||||
@titlepage
|
||||
@title GNU Makeinfo
|
||||
@author Brian J. Fox and Robert J. Chassell
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the entire
|
||||
resulting derived work is distributed under the terms of a permission
|
||||
notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation approved
|
||||
by the Free Software Foundation.
|
||||
@end titlepage
|
||||
|
||||
@node Top
|
||||
@chapter What is @code{makeinfo}?
|
||||
|
||||
@iftex
|
||||
This file documents the use of the @code{makeinfo} program, versions
|
||||
@value{VERSION} and later. It is an extract from the @cite{Texinfo} manual.
|
||||
@end iftex
|
||||
|
||||
@code{makeinfo} is a program for converting @dfn{Texinfo} files into @dfn{Info}
|
||||
files. Texinfo is a documentation system that uses a single source file to
|
||||
produce both on-line information and printed output.
|
||||
|
||||
You can read the on-line information using Info; type @code{info} to
|
||||
learn about Info.
|
||||
@ifinfo
|
||||
@xref{Top, Texinfo, Overview of Texinfo, Texinfo, Texinfo},
|
||||
@end ifinfo
|
||||
@iftex
|
||||
See the @cite{Texinfo} manual,
|
||||
@end iftex
|
||||
to learn about the Texinfo documentation system.
|
||||
|
||||
@menu
|
||||
* Formatting Control:: Controlling the width of lines, paragraph
|
||||
indentation, and other similar formatting.
|
||||
|
||||
* Options:: Command line options which control the
|
||||
behaviour of Makeinfo.
|
||||
|
||||
* Pointer Validation:: How Makeinfo can help you to track node
|
||||
references through complex Texinfo files.
|
||||
|
||||
* Index:: Index of Concepts.
|
||||
@end menu
|
||||
|
||||
@c Removed this for 3.8 until it's time to rewrite it.
|
||||
@c * The Macro Facility:: Makeinfo allows the use of @dfn{macros}.
|
||||
|
||||
@node Formatting Control
|
||||
@section Controlling Paragraph Formats
|
||||
|
||||
Without any special options, @code{makeinfo} @dfn{fills} the paragraphs that
|
||||
it outputs to an Info file. Filling is the process of breaking and connecting
|
||||
lines so that lines are the same length as or shorter than the number
|
||||
specified as the fill column. Lines are broken between words. With
|
||||
@code{makeinfo}, you can control:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
The width of each paragraph (the @dfn{fill-column}).
|
||||
@item
|
||||
The amount of indentation that the first line of
|
||||
each paragraph receives (the @dfn{paragraph-indentation}).
|
||||
@end itemize
|
||||
|
||||
@node Options
|
||||
@section Command Line Options
|
||||
|
||||
The following command line options are available for @code{makeinfo}.
|
||||
|
||||
@need 100
|
||||
@table @code
|
||||
@item -D @var{var}
|
||||
Cause @var{var} to be defined. This is equivalent to
|
||||
@code{@@set @var{var}} in the Texinfo file.
|
||||
|
||||
@need 150
|
||||
@item --error-limit @var{limit}
|
||||
Set the maximum number of errors that @code{makeinfo} will report
|
||||
before exiting (on the assumption that continuing would be useless).
|
||||
The default number of errors that can be reported before
|
||||
@code{makeinfo} gives up is 100.@refill
|
||||
|
||||
@need 150
|
||||
@item --fill-column @var{width}
|
||||
Specify the maximum number of columns in a line; this is the right-hand
|
||||
edge of a line. Paragraphs that are filled will be filled to this
|
||||
width. The default value for @code{fill-column} is 72.
|
||||
@refill
|
||||
|
||||
@item --footnote-style @var{style}
|
||||
Set the footnote style to @var{style}, either @samp{end} for the end
|
||||
node style or @samp{separate} for the separate node style. The value
|
||||
set by this option overrides the value set in a Texinfo file by an
|
||||
@code{@@footnotestyle} command. When the footnote style is
|
||||
@samp{separate}, @code{makeinfo} makes a new node containing the
|
||||
footnotes found in the current node. When the footnote style is
|
||||
@samp{end}, @code{makeinfo} places the footnote references at the end
|
||||
of the current node.@refill
|
||||
|
||||
@need 150
|
||||
@item -I @var{dir}
|
||||
Add @code{dir} to the directory search list for finding files that are
|
||||
included using the @code{@@include} command. By default,
|
||||
@code{makeinfo} searches only the current directory.
|
||||
|
||||
@need 150
|
||||
@item --no-headers
|
||||
Do not include menus or node lines in the output. This results in an
|
||||
@sc{ascii} file that you cannot read in Info since it does not contain
|
||||
the requisite nodes or menus; but you can print such a file in a
|
||||
single, typewriter-like font and produce acceptable output.
|
||||
|
||||
@need 150
|
||||
@item --no-split
|
||||
Suppress the splitting stage of @code{makeinfo}. Normally, large
|
||||
output files (where the size is greater than 70k bytes) are split into
|
||||
smaller subfiles, each one approximately 50k bytes. If you specify
|
||||
@samp{--no-split}, @code{makeinfo} will not split up the output
|
||||
file.@refill
|
||||
|
||||
@need 100
|
||||
@item --no-pointer-validate
|
||||
@item --no-validate
|
||||
Suppress the pointer-validation phase of @code{makeinfo}. Normally,
|
||||
after a Texinfo file is processed, some consistency checks are made to
|
||||
ensure that cross references can be resolved, etc.
|
||||
@xref{Pointer Validation}.@refill
|
||||
|
||||
@need 150
|
||||
@item --no-warn
|
||||
Suppress the output of warning messages. This does @emph{not}
|
||||
suppress the output of error messages, only warnings. You might
|
||||
want this if the file you are creating has examples of Texinfo cross
|
||||
references within it, and the nodes that are referenced do not actually
|
||||
exist.@refill
|
||||
|
||||
@item --no-number-footnotes
|
||||
Supress automatic footnote numbering. By default, @code{makeinfo}
|
||||
numbers each footnote sequentially in a single node, resetting the
|
||||
current footnote number to 1 at the start of each node.
|
||||
|
||||
@need 150
|
||||
@item --output @var{file}
|
||||
@itemx -o @var{file}
|
||||
Specify that the output should be directed to @var{file} and not to the
|
||||
file name specified in the @code{@@setfilename} command found in the Texinfo
|
||||
source. @var{file} can be the special token @samp{-}, which specifies
|
||||
standard output.
|
||||
|
||||
@need 150
|
||||
@item --paragraph-indent @var{indent}
|
||||
Set the paragraph indentation style to @var{indent}. The value set by
|
||||
this option overrides the value set in a Texinfo file by an
|
||||
@code{@@paragraphindent} command. The value of @var{indent} is
|
||||
interpreted as follows:@refill
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
If the value of @var{indent} is @samp{asis}, do not change the
|
||||
existing indentation at the starts of paragraphs.@refill
|
||||
|
||||
@item
|
||||
If the value of @var{indent} is zero, delete any existing
|
||||
indentation.@refill
|
||||
|
||||
@item
|
||||
If the value of @var{indent} is greater than zero, indent each
|
||||
paragraph by that number of spaces.@refill
|
||||
@end itemize
|
||||
|
||||
@need 100
|
||||
@item --reference-limit @var{limit}
|
||||
Set the value of the number of references to a node that
|
||||
@code{makeinfo} will make without reporting a warning. If a node has more
|
||||
than this number of references in it, @code{makeinfo} will make the
|
||||
references but also report a warning.@refill
|
||||
|
||||
@need 150
|
||||
@item -U @var{var}
|
||||
Cause @var{var} to be undefined. This is equivalent to
|
||||
@code{@@clear @var{var}} in the Texinfo file.
|
||||
|
||||
@need 100
|
||||
@item --verbose
|
||||
Cause @code{makeinfo} to display messages saying what it is doing.
|
||||
Normally, @code{makeinfo} only outputs messages if there are errors or
|
||||
warnings.@refill
|
||||
|
||||
@need 100
|
||||
@item --version
|
||||
Report the version number of this copy of @code{makeinfo}.@refill
|
||||
|
||||
@item --help
|
||||
Show a summary of the commend line arguments to @code{makeinfo}.
|
||||
@end table
|
||||
|
||||
@node Pointer Validation
|
||||
@section Pointer Validation
|
||||
@cindex Pointer validation with @code{makeinfo}
|
||||
@cindex Validation of pointers
|
||||
|
||||
If you do not suppress pointer-validation (by using the
|
||||
@samp{--no-pointer-validation} option), @code{makeinfo}
|
||||
will check the validity of the final Info file. Mostly,
|
||||
this means ensuring that nodes you have referenced
|
||||
really exist. Here is a complete list of what is
|
||||
checked:@refill
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
If a `Next', `Previous', or `Up' node reference is a reference to a
|
||||
node in the current file and is not an external reference such as to
|
||||
@file{(dir)}, then the referenced node must exist.@refill
|
||||
|
||||
@item
|
||||
In every node, if the `Previous' node is different from the `Up' node,
|
||||
then the `Previous' node must also be pointed to by a `Next' node.@refill
|
||||
|
||||
@item
|
||||
Every node except the `Top' node must have an `Up' pointer.@refill
|
||||
|
||||
@item
|
||||
The node referenced by an `Up' pointer must contain a reference to the
|
||||
current node in some manner other than through a `Next' reference.
|
||||
This includes menu entries and cross references.@refill
|
||||
|
||||
@item
|
||||
If the `Next' reference of a node is not the same as the `Next' reference
|
||||
of the `Up' reference, then the node referenced by the `Next' pointer
|
||||
must have a `Previous' pointer that points back to the current node.
|
||||
This rule allows the last node in a section to point to the first node
|
||||
of the next chapter.@refill
|
||||
@end enumerate
|
||||
|
||||
@c We don't want to advertise redefining commands.
|
||||
@c lowersections
|
||||
@c include macro.texi
|
||||
@c raisesections
|
||||
|
||||
@lowersections
|
||||
@node Index
|
||||
@appendix Index
|
||||
@printindex cp
|
||||
@raisesections
|
||||
|
||||
@contents
|
||||
@bye
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,40 +0,0 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id: mkinstalldirs,v 1.10 1996/05/03 07:37:52 friedman Exp $
|
||||
|
||||
errstatus=0
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
Loading…
Reference in New Issue
Block a user