diff options
60 files changed, 7533 insertions, 6198 deletions
diff --git a/texinfo/NEWS b/texinfo/NEWS index ffc7093..9681841 100644 --- a/texinfo/NEWS +++ b/texinfo/NEWS @@ -1,5 +1,39 @@ This file records noteworthy changes. +3.11 (31 July 1997) +* New commands: + - @uref to make a reference to a url; @url now only indicates such. + - @image to include graphics (epsf for TeX). + - @deftypemethod and @deftypemethodx to document methods in strongly + typed object-oriented languages, such as C++. + - @html for raw HTML. + - @ifnothtml @ifnotinfo @ifnottex for more precise conditionals. + - @kbdinputstyle to control when @kbd uses the slanted typewriter font. + - @email takes second optional argument. +* texinfo.tex reads texinfo.cnf (if present) for site-wide TeX + configuration; for example, A4 paper sizes. +* info: + - arrow keys supported. + - trailing : in INFOPATH appends default path. + - new option --index-search for online help support. +* makeinfo: + - output files removed if errors unless (new option) --force. + - new option -P to prepend to search path. + - macro expansion file can be standard output. +* install-info creates a new dir file if necessary. +* update-info script to create a dir file from all info files. +* Elisp: texnfo-tex.el and detexinfo.el removed from the distribution; + - texnfo-tex features are now part of standard TeX & Texinfo packages; + - makeinfo --no-headers does a better job than detexinfo.el. +* Documentation: + - Updates, revisions, corrections in the manual. + - makeinfo.texi removed, as it was a copy of what was in texinfo.texi. +* gettext support in sources, French and German translations included. +* info man page removed; use the Texinfo manual. +* Automake used, other portability fixes. + +3.10 (nonexistent) + 3.9 (4 October 1996) * makeinfo: - Give a suppressible (with --no-validate) error for references @@ -91,3 +125,205 @@ This file records noteworthy changes. Just bug fixes, see ChangeLog for full details. texinfo-3.0: first release of Texinfo version 2, with many new commands. + + +Here is the separate NEWS for old releases of Info: + +Version 2.11, Sat Apr 1 09:15:21 1995 + +Changes since 2.7 beta: + +Although the basic code remains the same, there are numerous nits +fixed, including some display bugs, and a memory leak. Some changes +that have taken place with larger impact include the way in which the +(dir) node is built; I have added in support for "localdir" +directories among other things. Info files may be stored in +compressed formats, and in their own subdirectories; menu items which +do not explicitly name the node to which they are attached have the +menu item name looked up as an Info file if it is not found within the +current document. This means that the menu item: + +* Info:: The Info documentation reader. + +in (dir) refers to the info node "(info)Top". + +Please see the ChangeLog and documentation for details on other +changes. + +Version 2.7 beta, Wed Dec 30 02:02:38 1992 +Version 2.6 beta, Tue Dec 22 03:58:07 1992 +Version 2.5 beta, Tue Dec 8 14:50:35 1992 +Version 2.4 beta, Sat Nov 28 14:34:02 1992 +Version 2.3 beta, Fri Nov 27 01:04:13 1992 +Version 2.2 beta, Tue Nov 24 09:36:08 1992 +Version 2.1 beta, Tue Nov 17 23:29:36 1992 + +Changes since 2.5 beta: + +Note that versions 2.6 and 2.7 Beta were only released to a select group. + +* "info-" removed from the front of M-x commands. + +* Automatic footnote display. When you enter a node which contains + footnotes, and the variable "automatic-footnotes" is "On", Info pops + up a window containing the footnotes. Likewise, when you leave that + node, the window containing the footnotes goes away. + +* Cleaner built in documentation, and documentation functions. + + Use: + o `M-x describe-variable' to read a variable's documenation + o `M-x describe-key' to find out what a particular keystroke does. + o `M-x describe-function' to read a function's documentation. + o `M-x where-is' to find out what keys invoke a particular function. + +* Info can "tile" the displayed windows (via "M-x tile-windows"). If + the variable "automatic-tiling" is "On", then splitting a window or + deleting a window causes the remaining windows to be retiled. + +* You can save every keystroke you type in a "dribble file" by using the + `--dribble FILENAME' option. You can initially read keystrokes from an + alternate input stream with `--restore FILENAME', or by redirecting + input on the command line `info < old-dribble'. + +* New behaviour of menu items. If the label is the same as the + target node name, and the node couldn't be found in the current file, + treat the label as a file name. For example, a menu entry in "DIR" + might contain: + + * Emacs:: Cool text-editor. + + Info would not find the node "(dir)Emacs", so just plain "(emacs)" + would be tried. + +* New variable "ISO-Latin" allows you to use European machines with + 8-bit character sets. + +* Cleanups in echo area reading, and redisplay. Cleanups in handling the + window which shows possible completions. + +* Info can now read files that have been compressed. An array in filesys.c + maps extensions to programs that can decompress stdin, and write the results + to stdout. Currently, ".Z"/uncompress, ".z"/gunzip, and ".Y"/unyabba are + supported. The modeline for a compressed file shows "zz" in it. + +* There is a new variable "gc-compressed-files" which, if non-zero, says + it is okay to reclaim the file buffer space allocated to a file which + was compressed, if, and only if, that file's contents do not appear in + any history node. + +* New file `nodemenu.c' implements a few functions for manipulating + previously visited nodes. `C-x C-b' (list-visited-nodes) produces a + menu of the nodes that could be reached by info-history-node in some + window. `C-x b' (select-visited-node) is similar, but reads one of + the node names with completion. + +* Keystroke `M-r' (move_to_screen_line) allows the user to place the cursor at + the start of a specific screen line. Without a numeric argument, place the + cursor on the center line; with an arg, place the cursor on that line. + +* Interruptible display implemented. Basic display speedups and hacks. +* The message "*** Tags Out of Date ***" now means what it says. +* Index searching with `,' (info-index-next) has been improved. +* When scrolling with C-v, C-M-v, or M-v, only "Page Only" scrolling + will happen. + +* Continous scrolling (along with `]' (info-global-next) and `[' + (info-global-prev) works better. `]' and `[' accept numeric + arguments, moving that many nodes in that case. + +* `C-x w' (info-toggle-wrap) controls how lines wider than the width + of the screen are displayed. If a line is too long, a `$' is + displayed in the rightmost column of the window. + +* There are some new variables for controlling the behaviour of Info + interactively. The current list of variables is as follows: + + Variable Name Default Value Description + ------------- ------------- ----------- + `automatic-footnotes' On When "On", footnotes appear and + disappear automatically. + + `automatic-tiling' Off When "On", creating of deleting a + window resizes other windows. + + `visible-bell' Off If non-zero, try to use a visible bell. + + `errors-ring-bell' On If non-zero, errors cause a ring. + + `show-index-match' On If non-zero, the portion of the string + matched is highlighted by changing its + case. + + `scroll-behaviour' Continuous One of "Continuous", "Next Only", or + "Page Only". "Page Only" prevents you from + scrolling past the bottom or top of a node. + "Next Only" causes the Next or Prev node to + be selected when you scroll past the bottom + or top of a node. "Continous" moves + linearly through the files hierchichal + structure. + + `scroll-step' 0 Controls how scrolling is done for you when + the cursor moves out of the current window. + Non-zero means it is the number of lines + you would like the screen to shift. A + value of 0 means to center the line + containing the cursor in the window. + + `gc-compressed-files' Off If non-zero means it is okay to reclaim the + file buffer space allocated to a file which + was compressed, if, and only if, that + file's contents do not appear in the node + list of any window. + + `ISO-Latin' Off Non-zero means that you are using an ISO + Latin character set. By default, standard + ASCII characters are assumed. +________________________________________ +This release of Info is version 2.5 beta. + +Changes since 2.4 beta: + +* Index (i) and (,) commands fully implemented. +* "configure" script now shipped with Info. +* New function "set-variable" allows users to set various variables. +* User-settable behaviour on end or beginning of node scrolling. This + supercedes the SPC and DEL changes in 2.3 beta. + +________________________________________ +This release of Info is version 2.4 beta. + +Changes since 2.3 beta: + +* info-last-node now means move to the last node of this info file. +* info-history-node means move backwards through this window's node history. +* info-first-node moves to the first node in the Info file. This node is + not necessarily "Top"! +* SPC and DEL can select the Next or Prev node after printing an informative + message when pressed at the end/beg of a node. + +---------------------------------------- +This release of Info is version 2.3 beta. + +Changes since 2.2 beta: + +* M-x command lines if NAMED_COMMANDS is #defined. Variable in Makefile. +* Screen height changes made quite robust. +* Interactive function "set-screen-height" implements user height changes. +* Scrolling on some terminals is faster now. +* C-l with numeric arguement is fixed. + +---------------------------------------- +This release of Info is version 2.2 beta. + +Changes since 2.0: + +* C-g can now interrupt multi-file searches. +* Incremental search is fully implemented. +* Loading large tag tables is much faster now. +* makedoc.c replaces shell script, speeding incremental builds. +* Scrolling in redisplay is implemented. +* Recursive uses of the echo area made more robust. +* Garbage collection of unreferenced nodes. + diff --git a/texinfo/README b/texinfo/README index 357a98fb..0312f85 100644 --- a/texinfo/README +++ b/texinfo/README @@ -1,23 +1,38 @@ -Texinfo, Version 3 -================== +This is the README file for the GNU Texinfo distribution. + +Please email bugs or suggestions to bug-texinfo@prep.ai.mit.edu. -This is the README file for version 3 of the Texinfo distribution. Files within this distribution have their own version and edition -numbers. When you refer to a file, please mention its own number, as +numbers. When you refer to a file, please mention its own version, as well as the version number of the Texinfo distribution. -PLEASE REPORT BUGS TO: bug-texinfo@prep.ai.mit.edu +For instructions on compiling and installing info, makeinfo, texi2dvi, +and texindex, please read the file `INSTALL'. Also: + + * The Emacs Lisp files are not compiled or installed by default; to + install them, use `make install' in the `emacs' subdirectory. See + ./emacs/README for some considerations. + + * The Info tree uses a file `dir' as its root node; the `dir-example' + file in this distribution is included for informative purposes. + Use it or not as you like. + + * You can create a file texinfo.cnf to be read by TeX when + processing Texinfo manuals. For example, it might contain the + command @afourpaper. See the `Preparing for TeX' node in + texinfo.texi for more details. + Texinfo is a documentation system that uses a single source file to -produce both on-line information and printed output. This means that -instead of writing two different documents, one for the on-line help -or other on-line information and the other for a typeset manual or -other printed work, you need write only one document. When the work -is revised, you need revise only one document. You can read the -on-line information, known as an "Info file", with an Info -documentation-reading program. By convention, Texinfo source file -names end with a `.texi' or `.texinfo' extension. Texinfo is -described in the Texinfo manual (the file ./texinfo.texi). +produce both online information and printed output. This means that +instead of writing two different documents, one for the online help or +other online information and the other for a typeset manual or other +printed work, you need write only one document. When the work is +revised, you need revise only one document. You can read the online +information, known as an "Info file", with an Info documentation-reading +program. By convention, Texinfo source file names end with a `.texi' or +`.texinfo' extension. Texinfo is described in the Texinfo manual (the +file ./doc/texinfo.texi). You can write and format Texinfo files into Info files within GNU Emacs, and read them using the Emacs Info reader. If you do not have Emacs, @@ -26,22 +41,15 @@ them using `info'. Use TeX, which is not included in this package (see `How to Obtain TeX' in the Texinfo manual for information), to typeset Texinfo files for printing. -For instructions on compiling and installing info, makeinfo, texi2dvi, -and texindex, please read the file `INSTALL'. The Emacs Lisp files are -not installed by default; to install them, use `make install' in the -`emacs' subdirectory. The Info tree uses a file `dir' as its root node; -a sample `dir' file is included in the distribution, but not installed -anywhere. Use it or not as you like. This distribution includes (but is not limited to) the following files: README This file. - INTRODUCTION This file tells you how to create readable files from the Texinfo source files in this distribution. -Texinfo source files: +Texinfo source files (in ./doc): texinfo.texi This manual describes Texinfo. It tells how to use Texinfo to write @@ -61,15 +69,8 @@ Texinfo source files: info-stnd.texi This manual tells you how to use the standalone GNU Info reader that is - included in this distribution as a C - source file, `info.c'. - - makeinfo.texi This manual tells you how to use - makeinfo. The same information is - contained in a chapter of the Texinfo - manual; it has been extracted here for - your convenience. - + included in this distribution as C + source (./info). Printing related files: @@ -78,18 +79,18 @@ Printing related files: Texinfo file into a DVI file ready for printing. - texindex.c This file contains the source for + util/texindex.c This file contains the source for the `texindex' program that generates sorted indices used by TeX when typesetting a file for printing. - texi2dvi This is a shell script for + util/texi2dvi This is a shell script for producing an indexed DVI file using TeX and texindex. Must be used if the source document uses Texinfo @macros. -GNU Emacs related files: +GNU Emacs related files (in ./emacs): texinfmt.el This Emacs Lisp file provides the functions that GNU Emacs uses to @@ -100,19 +101,15 @@ GNU Emacs related files: for GNU Emacs. texnfo-upd.el These files provides commands to - texnfo-tex.el help you write Texinfo files - makeinfo.el using GNU Emacs Texinfo mode. - - detexinfo.el This extra utility file contains functions - to remove Texinfo commands from a - Texinfo source file. + makeinfo.el help you write Texinfo files + using GNU Emacs Texinfo mode. info.el These are the standard GNU Emacs informat.el Info reading and support files, included here for your convenience. -Source files for standalone C programs: +Source files for standalone C programs (./lib, ./makeinfo, ./info): makeinfo.c This file contains the source for the `makeinfo' program that you can @@ -128,7 +125,7 @@ Source files for standalone C programs: getopt.h -C Installation files: +Installation files: configure This file creates creates a Makefile which in turn creates an `info' or @@ -136,10 +133,14 @@ C Installation files: distribution. configure.in This is a template for creating - `configure' using m4 macros. + `configure' using Autoconf. Makefile.in This is a template for `configure' - to use to make a Makefile. + to use to make a Makefile. Created by + Automake. + + Makefile.am This is a template for Automake + to use to make a Makefile.in. Other files: @@ -148,10 +149,6 @@ Other files: features since the first edition of Texinfo. - info.1 This is a `man' page that briefly - describes the standalone `info' - program. - fixfonts This is a shell script to install the `lcircle10' TeX fonts as an alias for the `circle10' fonts. In some older diff --git a/texinfo/TODO b/texinfo/TODO index de5b571..7a7eb85 100644 --- a/texinfo/TODO +++ b/texinfo/TODO @@ -1,35 +1,78 @@ If you are interested in working on any of these, email bug-texinfo@prep.ai.mit.edu. -* Use Automake. +* Makeinfo: + - HTML output. + - A detexinfo program, like detex or delatex. This command would + strip all the texinfo commands out, and would be used as a filter on + the way to a speller. An option would be to NOT strip comments out. + makeinfo --no-headers comes close. + - If node name contains an @ command, complain explicitly. + - Better ASCII output: convert menus to single table of contents, + enumerate chapters and sections, convert cross-refs and indices to + chapter/section references. See: + ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/faq201s.zip -* Use a config header file instead of @DEFS@. +n* TeX: + - Use @ as the escape character, and Texinfo syntax generally, in the + table of contents, aux, and index files. Eliminate all the crazy + multiple redefinitions of every Texinfo command in different contexts. + - Handle @hsep and @vsep in @multitables. -* A detexinfo program, like detex or delatex. This command would - strip all the texinfo commands out, and would be used as a filter on - the way to a speller. An option would be to NOT strip comments out. - makeinfo --no-headers come close. +* General: + - Better i18n support, including support for 8-bit input characters, + and 8-bit output in info. Perhaps have to use the ec fonts. + - Support compressed image files, automatic generation of .txt + or .jpg from .eps by Ghostscript. + - Repeat TeX run until cross-references stabilize, not just twice. + (Document this in manual and fix texi2dvi.) + - Handle reference card creation, perhaps by only paying attention to + sectioning and @def... commands. + - Allow : in node names for info files, for names like `class::method'. + - Get Info declared as a MIME Content-Type. -* Change bars. This is difficult or impossible in TeX, - unfortunately. To do it right requires device driver support. +* Language: + - @figure: +@figure [xref-label] +@figureinclude <filename>, [<height>], [<width>] +@figurehsize <dimen> +@figurevsize <dimen> +@caption ... @end caption +<arbitrary Texinfo commands> +@end figure + - @flushboth to combine @flushleft and @flushright, for RFC's. + - @part sectioning command. + - Anchors a la HTML? + - Allow subitems and `see' and `see also' in indices. + - @exercise/@answer command for, e.g., gawk. + - Allow @hsep/@vsep at @item, instead of just in template. + - The dark corner symbol for the gawk manual. + - Change bars. This is difficult or impossible in TeX, + unfortunately. To do it right requires device driver support. -* The dark corner symbol for the gawk manual. +* Doc: + - Include a complete functional summary, as in a reference card, in + the manual. + - Improve the manuals for makeinfo, standalone info, etc. + - Page 39, need a new section on doing dedication pages. See gawk.texi + for an example of doing it in both the tex and info versions. -* Better i18n support, including support for 8-bit input - characters. Requires fonts, and the DC fonts are not (as of this - writing) free. +* Info: + - Search all nodes of dir file at startup, then can have + INFO-DIR-SEPARATE-GROUPS and other such. + - Better dir file merging. + - Steal interface ideas from Lynx: TAB for navigating to next link + within a page, number links, etc. + - q within help should quit help like C-x 0. + - Full-text search on all available info files. + - Incorporate an X-based viewer, perhaps tkinfo: + http://www.math.ucsb.edu/~boldt/tkinfo/. + - Perhaps process Texinfo files directly instead of converting to Info: + ftp://ftp.cs.berkeley.edu/ucb/people/phelps/tcltk/tkman.tar.Z + + ftp://ftp.cs.berkeley.edu/ucb/people/phelps/tcltk/rman.tar.Z + + Tcl/Tk 8.0 from ftp.smli.com in the /pub/tcl directory. + From: phelps@ecstasy.CS.Berkeley.EDU (Tom Phelps) -* @exercise/@answer command for, e.g., gawk. - -* @figure. - -* HTML output in makeinfo. - -* Include a complete functional summary, a la a reference card, in the manual. - -* Use @ as the escape character, and Texinfo syntax generally, in the - table of contents, aux, and index files. Eliminate all the crazy - redefinitions of every Texinfo command (which lists always seem to be - incomplete). - -* Improve the manuals for makeinfo, standalone info, etc. +* Install-info: + - be able to copy the info file to compile-time $(infodir), to + simplify by-hand installation. diff --git a/texinfo/dir-example b/texinfo/dir-example index 3b9bd72..d6f8d50 100644 --- a/texinfo/dir-example +++ b/texinfo/dir-example @@ -3,7 +3,7 @@ topmost node of the Info hierarchy. This file is merely made available for your hacking pleasure, not official or standard in any way. If it doesn't make sense to you, or you don't like it, ignore it. -$Id: dir-example,v 1.1 1997/08/21 22:57:52 jason Exp $ +$Id: dir,v 1.23 1997/07/25 18:05:32 karl Exp $ File: dir Node: Top This is the top of the INFO tree. @@ -17,293 +17,305 @@ This node gives a menu of the major topics accessible through Info. * Menu: GNU packages -* Bash: (bash). Bourne again shell. -* Cpio: (cpio). Cpio archiver. -* DC: (dc). Postfix arbitrary expression calculator. -* Diff: (diff). Comparing and merging programs. -* Ed: (ed). Line editor. -* Emacs: (emacs). Extensible self-documenting text editor. +* Bash: (bash). Bourne again shell. +* Cpio: (cpio). Cpio archiver. +* DC: (dc). Postfix arbitrary expression calculator. +* Diff: (diff). Comparing and merging programs. +* Ed: (ed). Line editor. +* Emacs: (emacs). Extensible self-documenting text editor. * File utilities: (fileutils). GNU file utilities. -* Finding files: (find). Operating on files matching certain criteria. -* Font utilities: (fontu). Programs for font manipulation. -* Gawk: (gawk). A text processing and scanning language. -* Gzip: (gzip). General (de)compression. -* Identifier DB: (id-utils). Identifier database utilities. -* Ispell: (ispell). Interactive spelling corrector. -* M4: (m4). Macro processor. -* Make: (make). Remake files automatically. -* Ptx: (ptx). Permuted index generator. -* Shar: (sharutils). Shell archiver, uudecode/uuencode. +* Finding files: (find). Operating on files matching certain criteria. +* Font utilities: (fontu). Programs for font manipulation. +* Gawk: (gawk.info). A text scanning and processing language. +* Gzip: (gzip). General (de)compression. +* Identifier DB: (id-utils). Identifier database utilities. +* Ispell: (ispell). Interactive spelling corrector. +* M4: (m4). Macro processor. +* Make: (make). Remake files automatically. +* Ptx: (ptx). Permuted index generator. +* Shar: (sharutils). Shell archiver, uudecode/uuencode. * Shell utilities: (sh-utils). GNU shell utilities. -* Tar: (tar). ``Tape'' archiver. +* tar: (tar). Making tape (or disk) archives. * Text utilities: (textutils). GNU text utilities. -* Time: (time). Measuring program resource usage. -* UUCP: (uucp). Copying between machines, offline. -* Wdiff: (wdiff). Word-by-word comparison. +* Time: (time). Measuring program resource usage. +* UUCP: (uucp). Copying between machines, offline. +* Wdiff: (wdiff). Word-by-word comparison. +* Wget: (wget). URL download. GNU programming tools -* As: (as). Assembler. -* Binutils: (binutils). ar/copy/objdump/nm/size/strip/ranlib. -* Bison: (bison). LALR(1) parser generator. -* CPP: (cpp). C preprocessor. -* CVS: (cvs). Concurrent versions system for source control. -* DejaGnu: (dejagnu). Testing framework. -* Flex: (flex). A fast scanner generator. -* Gasp: (gasp). GNU Assembler preprocessor. -* Libtool: (libtool). Generic library support script. -* GCC: (gcc). C compiler. -* GDB: (gdb). Source-level debugger for C and C++. -* Gperf: (gperf). Perfect hash function generator. -* Gprof: (gprof). Profiler. -* Indent: (indent). Prettyprinter for programs. -* Ld: (ld). Linker. +* As: (as). Assembler. +* Binutils: (binutils). ar/copy/objdump/nm/size/strip/ranlib. +* Bison: (bison). LALR(1) parser generator. +* CPP: (cpp). C preprocessor. +* CVS: (cvs). Concurrent versions system for source control. +* DejaGnu: (dejagnu). Testing framework. +* Flex: (flex). A fast scanner generator. +* Gasp: (gasp). GNU Assembler preprocessor. +* Libtool: (libtool). Generic library support script. +* GCC: (gcc). C compiler. +* GDB: (gdb). Source-level debugger for C and C++. +* Gettext Utilities: (gettext). GNU gettext utilities. +* Gperf: (gperf). Perfect hash function generator. +* Gprof: (gprof). Profiler. +* Indent: (indent). Prettyprinter for programs. +* Ld: (ld). Linker. Texinfo documentation system * Info: (info). Documentation browsing system. * Texinfo: (texinfo). The GNU documentation format. +* info program: (info-stnd). Standalone Info-reading program. * install-info: (texinfo)Invoking install-info. Updating info/dir entries. * texi2dvi: (texinfo)Format with texi2dvi. Printing Texinfo documentation. * texindex: (texinfo)Format with tex/texindex. Sorting Texinfo index files. -* info program: (info-stnd). Standalone Info-reading program. -* makeinfo: (makeinfo). Convert Texinfo source to Info or plain ASCII. +* makeinfo: (texinfo)makeinfo preferred. Translate Texinfo source. GNU Emacs Lisp -* Elisp: (elisp). GNU Emacs Lisp reference manual. +* Elisp: (elisp). GNU Emacs Lisp reference manual. * Intro Elisp: (emacs-lisp-intro). Introduction to Elisp programming. -* Calc: (calc). Calculator and more. -* CC-mode: (ccmode). Editing C, C++, and Objective C. -* Common Lisp: (cl). Partial Common Lisp support for Emacs Lisp. -* Dired-x: (dired-x). Extra directory editor features. -* Edebug: (edebug). Source-level debugger for Emacs Lisp. -* Ediff: (ediff). Comprehensive visual interface to diff & patch. -* EDB: (edb). Database for Emacs. -* Forms: (forms). Fill-in-the-form data entry. -* Gmhist: (gmhist). Generic minibuffer history. -* GNUS: (gnus). Netnews reading and posting. -* Mailcrypt: (mailcrypt). Use PGP in Emacs. -* MH-E: (mh-e). Emacs interface to the MH mail system. -* PCL-CVS: (pcl-cvs). Emacs front end to CVS. -* Supercite: (sc). Supercite for including other people's words. -* VIP: (vip). vi emulation. -* VIPER: (viper). The new VI-emulation mode in Emacs-19.29. -* VM: (vm). Mail reader. -* W3: (w3). WWW browser. +* Calc: (calc). Calculator and more. +* CC-mode: (ccmode). Editing C, C++, and Objective C. +* Common Lisp: (cl). Partial Common Lisp support for Emacs Lisp. +* Dired-x: (dired-x). Extra directory editor features. +* Edebug: (edebug). Source-level debugger for Emacs Lisp. +* Ediff: (ediff). Comprehensive visual interface to diff & patch. +* EDB: (edb). Database for Emacs. +* Forms: (forms). Fill-in-the-form data entry. +* Gmhist: (gmhist). Generic minibuffer history. +* GNUS: (gnus). Netnews reading and posting. +* Mailcrypt: (mailcrypt). Use PGP in Emacs. +* MH-E: (mh-e). Emacs interface to the MH mail system. +* PCL-CVS: (pcl-cvs). Emacs front end to CVS. +* Supercite: (sc). Supercite for including other people's words. +* VIP: (vip). vi emulation. +* VIPER: (viper). The new VI-emulation mode in Emacs-19.29. +* VM: (vm). Mail reader. +* W3: (w3). WWW browser. -GNU admin -* Autoconf: (autoconf). Automatic generation of package configuration. -* Automake: (automake). Making Makefile.in's. -* Configure: (configure). Cygnus configure. -* Gettext: (gettext). Internationalization. -* Gnats: (gnats). Cygnus bug tracking system. -* Maintaining: (maintain). Maintaining GNU software. -* Remsync: (remsync). Remote synchronization of directory trees. -* Send PR: (send-pr). Cygnus bug reporting for Gnats. -* Source config: (cfg-paper). Some theory on configuring source packages. -* Standards: (standards). GNU coding standards. +GNU programming support +* Autoconf: (autoconf). Automatic generation of package configuration. +* Configure: (configure). Cygnus configure. +* Gnats: (gnats). Cygnus bug tracking system. +* Remsync: (remsync). Remote synchronization of directory trees. +* Send PR: (send-pr). Cygnus bug reporting for Gnats. GNU libraries -* Annotate: (annotate). High-level GDB to GUI's. -* BFD: (bfd). Binary file descriptors for object file IO. -* GDB library: (libgdb). Application programming interface to GDB. -* GDBM: (gdbm). Hashed databases. -* History: (history). Recall previous lines of input. -* Iostream: (iostream). C++ input/output. -* Libc: (libc). C library. -* Libg++: (libg++). C++ classes. -* Mmalloc: (mmalloc). Memory-mapped malloc. -* Readline: (readline). General command-line interface. -* Regex: (regex). Regular expressions. -* Termcap: (termcap). All about /etc/termcap. +* Annotate: (annotate). High-level GDB to GUI's. +* BFD: (bfd). Binary file descriptors for object file IO. +* GDB library: (libgdb). Application programming interface to GDB. +* GDBM: (gdbm). Hashed databases. +* History: (history). Recall previous lines of input. +* Iostream: (iostream). C++ input/output. +* Libc: (libc). C library. +* Libg++: (libg++). C++ classes. +* Mmalloc: (mmalloc). Memory-mapped malloc. +* Readline: (readline). General command-line interface. +* Regex: (regex). Regular expressions. +* Termcap: (termcap). All about /etc/termcap. GNU programming documentation -* GDB internals: (gdbint). Debugger internals. -* Ld internals: (ldint). GNU linker internals. -* Stabs: (stabs). Symbol table debugging information format. +* GDB internals: (gdbint). Debugger internals. +* Ld internals: (ldint). GNU linker internals. +* Maintaining: (maintain). Maintaining GNU software. +* Source config: (cfg-paper). Some theory on configuring source packages. +* Stabs: (stabs). Symbol table debugging information format. +* Standards: (standards). GNU coding standards. DOS -* Demacs: (demacs). GNU Emacs for DOS. -* GNUish: (gnuish). GNU utilities for DOS. +* Demacs: (demacs). GNU Emacs for DOS. +* GNUish: (gnuish). GNU utilities for DOS. TeX things * Afm2tfm: (dvips)Invoking afm2tfm. Making Type 1 fonts available to TeX. -* Dvips: (dvips). DVI-to-PostScript translator. -* Eplain: (eplain). Expanding on plain TeX. -* Kpathsearch: (kpathsea). File lookup along search paths. -* LaTeX: (latex). LaTeX. -* MakeIndex: (makeindex). Index creation for TeX. -* Naming fonts: (fontname). Filenames for TeX fonts. -* TeXDraw: (texdraw). Drawing PostScript diagrams within TeX. -* Web2c: (web2c). TeX, Metafont, and their companion programs. +* Dvips: (dvips). DVI-to-PostScript translator. +* Eplain: (eplain). Expanding on plain TeX. +* Kpathsearch: (kpathsea). File lookup along search paths. +* LaTeX: (latex). LaTeX. +* MakeIndex: (makeindex). Index creation for TeX. +* Naming fonts: (fontname). Filenames for TeX fonts. +* TDS: (tds). Standard TeX directory structure. +* TeXDraw: (texdraw). Drawing PostScript diagrams within TeX. +* Web2c: (web2c). TeX, Metafont, and their companion programs. Other things -* Amd: (amdref). Filesystem automounter. -* CMUCL: (cmu-user). CMU Common Lisp. -* File headers: (filehdr). Bibliographic information for computer files. -* HTML: (snafu). Hypertext Markup Language 2.0 specification. -* Jargon: (jargon). The jargon file. -* Perl: (perl). Practical extraction and report language. +* Amd: (amdref). Filesystem automounter. +* CMUCL: (cmu-user). CMU Common Lisp. +* File headers: (filehdr). Bibliographic information for computer files. +* GCP: (gcp). Game club protocol. +* HTML: (snafu). Hypertext Markup Language 2.0 specification. +* Jargon: (jargon). The jargon file. +* Perl: (perl). Practical extraction and report language. * PRCS: (prcs). Project revision control system. -* Screen: (screen). Virtual screen manager. -* UMB C.S. Dept.: (csinfo). UMass/Boston Computer Science Dept. info. +* Screen: (screen). Virtual screen manager. +* UMB C.S. Dept.: (csinfo). UMass/Boston Computer Science Dept. info. Individual utilities -* aid: (id-utils)aid invocation. Matching strings. -* ar: (binutils)ar. Create/modify/extract archives. -* at-pr: (gnats)at-pr. Bug report timely reminders. -* autoreconf: (autoconf)Invoking autoreconf. Remake multiple configure's. -* autoscan: (autoconf)Invoking autoscan. Automate initial configure.in. -* awk: (Gawk)Invoking gawk. Text processing and scanning. +* aclocal: (automake)Invoking aclocal. Generating aclocal.m4. +* aid: (id-utils)aid invocation. Matching strings. +* ar: (binutils)ar. Create/modify/extract archives. +* at-pr: (gnats)at-pr. Bug report timely reminders. +* automake: (automake). Making Makefile.in's. +* autoreconf: (autoconf)Invoking autoreconf. Remake multiple configure's. +* autoscan: (autoconf)Invoking autoscan. Automate initial configure.in. +* awk: (gawk)Invoking gawk. Text processing and scanning. * basename: (sh-utils)basename invocation. Strip directory and suffix. -* bibtex: (web2c)BibTeX invocation. Maintaining bibliographies. -* c++filt: (binutils)c++filt. Demangle C++ symbols. +* bibtex: (web2c)BibTeX invocation. Maintaining bibliographies. +* c++filt: (binutils)c++filt. Demangle C++ symbols. * cat: (textutils)cat invocation. Concatenate and write files. * chgrp: (fileutils)chgrp invocation. Change file groups. * chmod: (fileutils)chmod invocation. Change file permissions. * chown: (fileutils)chown invocation. Change file owners/groups. * chroot: (sh-utils)chroot invocation. Specify the root directory. * cksum: (textutils)cksum invocation. Print POSIX CRC checksum. -* cmp: (diff)Invoking cmp. Character-by-character diff. +* cmp: (diff)Invoking cmp. Character-by-character diff. * comm: (textutils)comm invocation. Compare sorted files by line. * cp: (fileutils)cp invocation. Copy files. * csplit: (textutils)csplit invocation. Split by context. * cut: (textutils)cut invocation. Print selected parts of lines. * date: (sh-utils)date invocation. Print/set system date and time. * dd: (fileutils)dd invocation. Copy and convert a file. -* df: (fileutils)df invocation. Report filesystems' disk usage. -* diff3: (diff)Invoking diff3. Three-way diff. +* df: (fileutils)df invocation. Report filesystem disk usage. +* diff3: (diff)Invoking diff3. Three-way diff. * dir: (fileutils)dir invocation. List directories briefly. +* dircolors: (fileutils)dircolors invocation. Color setup for ls. * dirname: (sh-utils)dirname invocation. Strip non-directory suffix. -* dmp: (web2c)Dmp invocation. Troff->MPX (MetaPost pictures). +* dmp: (web2c)Dmp invocation. Troff->MPX (MetaPost pictures). * du: (fileutils)du invocation. Report on disk usage. -* dvicopy: (web2c)DVIcopy invocation. Virtual font expansion -* dvitomp: (web2c)DVItoMP invocation. DVI to MPX (MetaPost pictures). -* dvitype: (web2c)DVItype invocation. DVI to human-readable text. +* dvicopy: (web2c)DVIcopy invocation. Virtual font expansion +* dvitomp: (web2c)DVItoMP invocation. DVI to MPX (MetaPost pictures). +* dvitype: (web2c)DVItype invocation. DVI to human-readable text. * echo: (sh-utils)echo invocation. Print a line of text. -* edit-pr: (gnats)Invoking edit-pr. Changing bugs. -* eid: (id-utils)eid invocation. Invoking an editor on matches. +* edit-pr: (gnats)Invoking edit-pr. Changing bugs. +* eid: (id-utils)eid invocation. Invoking an editor on matches. * emacsclient: (emacs)Emacs Server. Connecting to a running Emacs. * emacsserver: (emacs)Emacs Server. Connecting to a running Emacs. * env: (sh-utils)env invocation. Modify the environment. * etags: (emacs)Create Tags Table. Creating a TAGS table. * expand: (textutils)expand invocation. Convert tabs to spaces. * expr: (sh-utils)expr invocation. Evaluate expressions. +* factor: (sh-utils)factor invocation. Print prime factors * false: (sh-utils)false invocation. Do nothing, unsuccessfully. -* fid: (id-utils)fid invocation. Listing a file's identifiers. -* file-pr: (gnats)file-pr. Processing incoming traffic. -* find: (find)Invoking find. Finding and acting on files. +* fid: (id-utils)fid invocation. Listing a file's identifiers. +* file-pr: (gnats)file-pr. Processing incoming traffic. +* find: (find)Invoking find. Finding and acting on files. * fmt: (textutils)fmt invocation. Reformat paragraph text. * fold: (textutils)fold invocation. Wrap long input lines. -* g++: (gcc)Invoking G++. The GNU C++ compiler. -* gftodvi: (web2c)GFtoDVI invocation. Generic font proofsheets. -* gftopk: (web2c)GFtoPK invocation. Generic to packed fonts. -* gftype: (web2c)GFtype invocation. GF to human-readable text. -* gid: (id-utils)gid invocation. Listing all matching lines. +* g++: (gcc)Invoking G++. The GNU C++ compiler. +* gettextize: (gettext)gettextize Invocation. Prepare a package for gettext. +* gftodvi: (web2c)GFtoDVI invocation. Generic font proofsheets. +* gftopk: (web2c)GFtoPK invocation. Generic to packed fonts. +* gftype: (web2c)GFtype invocation. GF to human-readable text. +* gid: (id-utils)gid invocation. Listing all matching lines. * groups: (sh-utils)groups invocation. Print group names a user is in. -* gunzip: (gzip)Overview. Decompression. +* gunzip: (gzip)Overview. Decompression. * head: (textutils)head invocation. Output the first part of files. * hostname: (sh-utils)hostname invocation. Print or set system name. * id: (sh-utils)id invocation. Print real/effective uid/gid. -* idx: (id-utils)idx invocation. Testing mkid scanners. -* ifnames: (autoconf)Invoking ifnames. List conditionals in source. -* iid: (id-utils)iid invocation. Interactive complex queries. -* inimf: (web2c)inimf invocation. Initial Metafont. -* inimp: (web2c)inimp invocation. Initial MetaPost. -* initex: (web2c)initex invocation. Initial TeX. +* idx: (id-utils)idx invocation. Testing mkid scanners. +* ifnames: (autoconf)Invoking ifnames. List conditionals in source. +* iid: (id-utils)iid invocation. Interactive complex queries. +* inimf: (web2c)inimf invocation. Initial Metafont. +* inimp: (web2c)inimp invocation. Initial MetaPost. +* initex: (web2c)initex invocation. Initial TeX. * install: (fileutils)install invocation. Copy and change attributes. * join: (textutils)join invocation. Join lines on a common field. -* kpsewhich: (kpathsea)Invoking kpsewhich. TeX file searching. -* lid: (id-utils)lid invocation. Matching identifier patterns. +* kpsewhich: (kpathsea)Invoking kpsewhich. TeX file searching. +* lid: (id-utils)lid invocation. Matching identifier patterns. * ln: (fileutils)ln invocation. Make links between files. -* locate: (find)Invoking locate. Finding files in a database. +* locate: (find)Invoking locate. Finding files in a database. * logname: (sh-utils)logname invocation. Print current login name. * ls: (fileutils)ls invocation. List directory contents. -* makempx: (web2c)MakeMPX invocation. MetaPost label typesetting. -* maketexmf: (kpathsea)MakeTeX scripts. MF source generation. -* maketexpk: (kpathsea)MakeTeX scripts. PK bitmap generation. -* maketextex: (kpathsea)MakeTeX scripts. TeX source generation. -* maketextfm: (kpathsea)MakeTeX scripts. TeX font metric generation. -* mf: (web2c)mf invocation. Creating typeface families. -* mft: (web2c)MFT invocation. Prettyprinting Metafont source. +* makempx: (web2c)MakeMPX invocation. MetaPost label typesetting. +* maketexmf: (kpathsea)MakeTeX scripts. MF source generation. +* maketexpk: (kpathsea)MakeTeX scripts. PK bitmap generation. +* maketextex: (kpathsea)MakeTeX scripts. TeX source generation. +* maketextfm: (kpathsea)MakeTeX scripts. TeX font metric generation. +* md5sum: (textutils)md5sum invocation. Print or check message-digests. +* mf: (web2c)mf invocation. Creating typeface families. +* mft: (web2c)MFT invocation. Prettyprinting Metafont source. * mkdir: (fileutils)mkdir invocation. Create directories. * mkfifo: (fileutils)mkfifo invocation. Create FIFOs: (named pipes). -* mkid: (id-utils)mkid invocation. Creating an ID database. +* mkid: (id-utils)mkid invocation. Creating an ID database. * mknod: (fileutils)mknod invocation. Create special files. -* mp: (web2c)mp invocation. Creating technical diagrams. -* mpto: (web2c)MPto invocation. MetaPost label extraction. +* mp: (web2c)mp invocation. Creating technical diagrams. +* mpto: (web2c)MPto invocation. MetaPost label extraction. +* msgfmt: (gettext)msgfmt Invocation. Make MO files out of PO files. +* msgmerge: (gettext)msgmerge Invocation. Update two PO files into one. * mv: (fileutils)mv invocation. Rename files. -* newer: (web2c)Newer invocation. Compare modification times. +* newer: (web2c)Newer invocation. Compare modification times. * nice: (sh-utils)nice invocation. Modify scheduling priority. * nl: (textutils)nl invocation. Number lines and write files. -* nlmconv: (binutils)nlmconv. Convert object to NetWare LM. -* nm: (binutils)nm. List symbols in object files. +* nlmconv: (binutils)nlmconv. Convert object to NetWare LM. +* nm: (binutils)nm. List symbols in object files. * nohup: (sh-utils)nohup invocation. Immunize to hangups. -* objcopy: (binutils)objcopy. Copy/translate object files. -* objdump: (binutils)objdump. Display info from object files. +* objcopy: (binutils)objcopy. Copy/translate object files. +* objdump: (binutils)objdump. Display info from object files. * od: (textutils)od invocation. Dump files in octal, etc. * paste: (textutils)paste invocation. Merge lines of files. -* patch: (diff)Invoking patch. Automatically applying diffs. -* patgen: (web2c)Patgen invocation. Creating hyphenation patterns. +* patch: (diff)Invoking patch. Automatically applying diffs. +* patgen: (web2c)Patgen invocation. Creating hyphenation patterns. * pathchk: (sh-utils)pathchk invocation. Check file name portability. -* pid: (id-utils)pid invocation. Looking up filenames. -* pktogf: (web2c)PKtoGF invocation. Packed to generic fonts. -* pktype: (web2c)PKtype invocation. PK to human-readable text. -* pltotf: (web2c)PLtoTF invocation. Property list to TFM. -* pooltype: (web2c)Pooltype invocation. Display WEB pool files. -* pr-addr: (gnats)pr-addr. Bug report address retrieval. -* pr-edit: (gnats)pr-edit. The edit-pr driver. +* pid: (id-utils)pid invocation. Looking up filenames. +* pktogf: (web2c)PKtoGF invocation. Packed to generic fonts. +* pktype: (web2c)PKtype invocation. PK to human-readable text. +* pltotf: (web2c)PLtoTF invocation. Property list to TFM. +* pooltype: (web2c)Pooltype invocation. Display WEB pool files. +* pr-addr: (gnats)pr-addr. Bug report address retrieval. +* pr-edit: (gnats)pr-edit. The edit-pr driver. * pr: (textutils)pr invocation. Paginate or columnate files. * printenv: (sh-utils)printenv invocation. Print environment variables. * printf: (sh-utils)printf invocation. Format and print data. * pwd: (sh-utils)pwd invocation. Print working directory. -* query-pr: (gnats)Invoking query-pr. Bug searching/reporting. -* queue-pr: (gnats)queue-pr. Handling incoming traffic. -* ranlib: (binutils)ranlib. Index archive file contents. +* query-pr: (gnats)Invoking query-pr. Bug searching/reporting. +* queue-pr: (gnats)queue-pr. Handling incoming traffic. +* ranlib: (binutils)ranlib. Index archive file contents. * rm: (fileutils)rm invocation. Remove files. * rmdir: (fileutils)rmdir invocation. Remove empty directories. -* sdiff: (diff)Invoking sdiff. Interactively merge files. -* send-pr: (gnats)Invoking send-pr. Submitting bugs. -* shar: (sharutils)shar invocation. Create shell archive. -* size: (binutils)size. List object file section sizes. +* sdiff: (diff)Invoking sdiff. Interactively merge files. +* send-pr: (gnats)Invoking send-pr. Submitting bugs. +* seq: (sh-utils)seq invocation. Print numeric sequences +* shar: (sharutils)shar invocation. Create shell archive. +* size: (binutils)size. List object file section sizes. * sleep: (sh-utils)sleep invocation. Delay for a specified time. * sort: (textutils)sort invocation. Sort text files. * split: (textutils)split invocation. Split into fixed-size pieces. -* strings: (binutils)strings. List printable strings. -* strip: (binutils)strip. Discard symbols. +* strings: (binutils)strings. List printable strings. +* strip: (binutils)strip. Discard symbols. * stty: (sh-utils)stty invocation. Print/change terminal settings. * su: (sh-utils)su invocation. Modify user and group id. * sum: (textutils)sum invocation. Print traditional checksum. * sync: (fileutils)sync invocation. Synchronize memory and disk. -* tabs: (tput)Invoking tabs. Tab settings. +* tabs: (tput)Invoking tabs. Tab settings. * tac: (textutils)tac invocation. Reverse files. * tail: (textutils)tail invocation. Output the last part of files. -* tangle: (web2c)Tangle invocation. WEB to Pascal. +* tangle: (web2c)Tangle invocation. WEB to Pascal. * tee: (sh-utils)tee invocation. Redirect to multiple files. * test: (sh-utils)test invocation. File/string tests. -* tex: (web2c)tex invocation. Typesetting. -* tftopl: (web2c)TFtoPL invocation. TFM -> property list. +* tex: (web2c)tex invocation. Typesetting. +* tftopl: (web2c)TFtoPL invocation. TFM -> property list. * touch: (fileutils)touch invocation. Change file timestamps. -* tput: (tput)Invoking tput. Termcap in shell scripts. +* tput: (tput)Invoking tput. Termcap in shell scripts. * tr: (textutils)tr invocation. Translate characters. * true: (sh-utils)true invocation. Do nothing, successfully. * tty: (sh-utils)tty invocation. Print terminal name. * uname: (sh-utils)uname invocation. Print system information. * unexpand: (textutils)unexpand invocation. Convert spaces to tabs. * uniq: (textutils)uniq invocation. Uniqify files. -* unshar: (sharutils)unshar invocation. Extract from shell archive. -* updatedb: (find)Invoking updatedb. Building the locate database. +* unshar: (sharutils)unshar invocation. Extract from shell archive. +* updatedb: (find)Invoking updatedb. Building the locate database. * users: (sh-utils)users invocation. Print current user names. * vdir: (fileutils)vdir invocation. List directories verbosely. -* vftovp: (web2c)VFtoVP invocation. Virtual font -> virtual pl. -* view-pr: (gnats)Invoking view-pr. Showing bug reports. -* virmf: (web2c)virmf invocation. Virgin Metafont. -* virmp: (web2c)virmp invocation. Virgin MetaPost. -* virtex: (web2c)virtex invocation. Virgin TeX. -* vptovf: (web2c)VPtoVF invocation. Virtual pl -> virtual font. +* vftovp: (web2c)VFtoVP invocation. Virtual font -> virtual pl. +* view-pr: (gnats)Invoking view-pr. Showing bug reports. +* virmf: (web2c)virmf invocation. Virgin Metafont. +* virmp: (web2c)virmp invocation. Virgin MetaPost. +* virtex: (web2c)virtex invocation. Virgin TeX. +* vptovf: (web2c)VPtoVF invocation. Virtual pl -> virtual font. * wc: (textutils)wc invocation. Byte, word, and line counts. -* weave: (web2c)Weave invocation. WEB to TeX. +* weave: (web2c)Weave invocation. WEB to TeX. * who: (sh-utils)who invocation. Print who is logged in. * whoami: (sh-utils)whoami invocation. Print effective user id. -* xargs: (find)Invoking xargs. Operating on many files. +* xargs: (find)Invoking xargs. Operating on many files. +* xgettext: (gettext)xgettext Invocation. Extract strings into a PO file. * yes: (sh-utils)yes invocation. Print a string indefinitely. -* zcat: (gzip)Overview. Decompression to stdout. +* zcat: (gzip)Overview. Decompression to stdout. diff --git a/texinfo/emacs/Makefile.in b/texinfo/emacs/Makefile.in index 5f19d1a..f200fa5 100644 --- a/texinfo/emacs/Makefile.in +++ b/texinfo/emacs/Makefile.in @@ -1,91 +1,204 @@ -# Makefile for Texinfo/emacs. -# Copyright (C) 1995, 96 Free Software Foundation, Inc. -# $Id: Makefile.in,v 1.1 1997/08/21 22:57:56 jason Exp $ - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# Author: Brian J. Fox (bfox@ai.mit.edu) -# +# Makefile.in generated automatically by automake 1.2 from Makefile.am -srcdir = @srcdir@ -VPATH = @srcdir@ -SHELL = /bin/sh -RM = rm -f +# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +# Do not byte compile our Elisp files by default. -ELISP_SRCS = info.el makeinfo.el texinfo.el texnfo-upd.el \ - texnfo-tex.el texinfmt.el informat.el detexinfo.el -ELISP_OBJS = info.elc makeinfo.elc texinfo.elc texnfo-upd.elc \ - texnfo-tex.elc texinfmt.elc informat.elc detexinfo.elc -.SUFFIXES: .el .elc +SHELL = /bin/sh -.el.elc: - $(srcdir)/elisp-comp $< +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = true +PRE_INSTALL = true +POST_INSTALL = true +NORMAL_UNINSTALL = true +PRE_UNINSTALL = true +POST_UNINSTALL = true +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +TERMLIBS = @TERMLIBS@ +TEXCONFIG = @TEXCONFIG@ +TEXMF = @TEXMF@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +l = @l@ + +ELCFILES = + +# Do not install our Elisp files by default, either. +noinst_LISP = info.el informat.el makeinfo.el \ + texinfmt.el texinfo.el texnfo-upd.el + +EXTRA_DIST = README elisp-comp new-useful-setqs $(noinst_LISP) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +LISP = $(noinst_LISP) + +lispdir = @lispdir@ +EMACS = @EMACS@ +DIST_COMMON = README Makefile.am Makefile.in elisp-comp + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP = --best +default: all + +.SUFFIXES: +.SUFFIXES: .el .elc +$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus emacs/Makefile -all: -sub-all: all +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +.el.elc: + @echo 'WARNING: Warnings can be ignored. :-)' + if test $(EMACS) != no; then \ + EMACS=$(EMACS) $(SHELL) $(srcdir)/elisp-comp $<; \ + fi +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = emacs + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done +info: dvi: +check: all + $(MAKE) +installcheck: install-info: +install-exec: + @$(NORMAL_INSTALL) + +install-data: install-data-local + @$(NORMAL_INSTALL) + +install: install-exec install-data all + @: + +uninstall: + +all: Makefile $(LISP) $(ELCFILES) + +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install +installdirs: + + +mostlyclean-generic: + test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + rm -f Makefile $(DISTCLEANFILES) + rm -f config.cache config.log stamp-h stamp-h[0-9]* + test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-lisp mostlyclean-generic + +clean: clean-lisp clean-generic mostlyclean + +distclean: distclean-lisp distclean-generic clean + rm -f config.status + +maintainer-clean: maintainer-clean-lisp maintainer-clean-generic \ + distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +.PHONY: default mostlyclean-lisp distclean-lisp clean-lisp \ +maintainer-clean-lisp tags distdir info dvi installcheck install-info \ +install-exec install-data install uninstall all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +install-data-local: + @echo "WARNING: You must (compile and) install the Emacs Lisp files" + @echo "WARNING: manually. See ./emacs/README for some considerations." -elisp: $(ELISP_OBJS) -.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: +# For some reason these do not get defined. +distclean-lisp: +clean-lisp: +mostlyclean-lisp: +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/texinfo/emacs/info.el b/texinfo/emacs/info.el index ead6ab9..ec21f5b 100644 --- a/texinfo/emacs/info.el +++ b/texinfo/emacs/info.el @@ -1,6 +1,7 @@ ;;; info.el --- info package for Emacs. -;; Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc. +;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 97 Free Software +;; Foundation, Inc. ;; Maintainer: FSF ;; Keywords: help @@ -28,27 +29,39 @@ ;;; Code: +(defgroup info nil + "Info subsystem" + :group 'help + :group 'docs) + + (defvar Info-history nil "List of info nodes user has visited. Each element of list is a list (FILENAME NODENAME BUFFERPOS).") -(defvar Info-enable-edit nil +(defcustom Info-enable-edit nil "*Non-nil means the \\<Info-mode-map>\\[Info-edit] command in Info can edit the current node. This is convenient if you want to write info files by hand. However, we recommend that you not do this. It is better to write a Texinfo file and generate the Info file from that, -because that gives you a printed manual as well.") +because that gives you a printed manual as well." + :type 'boolean + :group 'info) (defvar Info-enable-active-nodes nil "Non-nil allows Info to execute Lisp code associated with nodes. The Lisp code is executed when the node is selected.") (put 'Info-enable-active-nodes 'risky-local-variable t) -(defvar Info-fontify t - "*Non-nil enables highlighting and fonts in Info nodes.") +(defcustom Info-fontify t + "*Non-nil enables highlighting and fonts in Info nodes." + :type 'boolean + :group 'info) -(defvar Info-fontify-maximum-menu-size 30000 - "*Maximum size of menu to fontify if `Info-fontify' is non-nil.") +(defcustom Info-fontify-maximum-menu-size 30000 + "*Maximum size of menu to fontify if `Info-fontify' is non-nil." + :type 'integer + :group 'info) (defvar Info-directory-list (let ((path (getenv "INFOPATH")) @@ -98,9 +111,11 @@ source tree, the `info' directory in the source tree is used as the last element, in place of the installation Info directory. This is useful when you run a version of Emacs without installing it.") -(defvar Info-additional-directory-list nil +(defcustom Info-additional-directory-list nil "List of additional directories to search for Info documentation files. -These directories are not searched for merging the `dir' file.") +These directories are not searched for merging the `dir' file." + :type '(repeat directory) + :group 'info) (defvar Info-current-file nil "Info file that Info is now looking at, or nil. @@ -114,10 +129,13 @@ or nil if current info file is not split into subfiles.") (defvar Info-current-node nil "Name of node that Info is now looking at, or nil.") -(defvar Info-tag-table-marker (make-marker) +(defvar Info-tag-table-marker nil "Marker pointing at beginning of current Info file's tag table. Marker points nowhere if file has no tag table.") +(defvar Info-tag-table-buffer nil + "Buffer used for indirect tag tables.") + (defvar Info-current-file-completions nil "Cached completion list for current Info file.") @@ -133,16 +151,26 @@ Marker points nowhere if file has no tag table.") (".z" . "gunzip") (".inf" . nil) ("" . nil)) - '( (".info.Z" . "uncompress") - (".info.Y" . "unyabba") - (".info.gz" . "gunzip") - (".info.z" . "gunzip") - (".info" . nil) - (".Z" . "uncompress") - (".Y" . "unyabba") - (".gz" . "gunzip") - (".z" . "gunzip") - ("" . nil))) + '( (".info.Z". "uncompress") + (".info.Y". "unyabba") + (".info.gz". "gunzip") + (".info.z". "gunzip") + (".info". nil) + ("-info.Z". "uncompress") + ("-info.Y". "unyabba") + ("-info.gz". "gunzip") + ("-info.z". "gunzip") + ("-info". nil) + ("/index.Z". "uncompress") + ("/index.Y". "unyabba") + ("/index.gz". "gunzip") + ("/index.z". "gunzip") + ("/index". nil) + (".Z". "uncompress") + (".Y". "unyabba") + (".gz". "gunzip") + (".z". "gunzip") + ("". nil))) "List of file name suffixes and associated decoding commands. Each entry should be (SUFFIX . STRING); the file is given to the command as standard input. If STRING is nil, no decoding is done. @@ -301,7 +329,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." (cons (list Info-current-file Info-current-node (point)) Info-history))) ;; Go into info buffer. - (switch-to-buffer "*info*") + (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) (buffer-disable-undo (current-buffer)) (or (eq major-mode 'Info-mode) (Info-mode)) @@ -316,7 +344,6 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." (setq Info-current-file nil Info-current-subfile nil Info-current-file-completions nil - Info-index-alternatives nil buffer-file-name nil) (erase-buffer) (if (eq filename t) @@ -325,12 +352,12 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." (setq default-directory (file-name-directory filename))) (set-buffer-modified-p nil) ;; See whether file has a tag table. Record the location if yes. - (set-marker Info-tag-table-marker nil) (goto-char (point-max)) (forward-line -8) ;; Use string-equal, not equal, to ignore text props. - (or (string-equal nodename "*") - (not (search-forward "\^_\nEnd tag table\n" nil t)) + (if (not (or (string-equal nodename "*") + (not + (search-forward "\^_\nEnd tag table\n" nil t)))) (let (pos) ;; We have a tag table. Find its beginning. ;; Is this an indirect file? @@ -341,16 +368,21 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." (looking-at "(Indirect)\n")) ;; It is indirect. Copy it to another buffer ;; and record that the tag table is in that buffer. - (save-excursion - (let ((buf (current-buffer))) - (set-buffer (get-buffer-create " *info tag table*")) + (let ((buf (current-buffer)) + (tagbuf + (or Info-tag-table-buffer + (generate-new-buffer " *info tag table*")))) + (setq Info-tag-table-buffer tagbuf) + (save-excursion + (set-buffer tagbuf) (buffer-disable-undo (current-buffer)) (setq case-fold-search t) (erase-buffer) - (insert-buffer-substring buf) - (set-marker Info-tag-table-marker - (match-end 0)))) - (set-marker Info-tag-table-marker pos)))) + (insert-buffer-substring buf)) + (set-marker Info-tag-table-marker + (match-end 0) tagbuf)) + (set-marker Info-tag-table-marker pos))) + (set-marker Info-tag-table-marker nil)) (setq Info-current-file (if (eq filename t) "dir" filename)))) ;; Use string-equal, not equal, to ignore text props. @@ -365,18 +397,28 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." ;; read the proper subfile into this buffer. (if (marker-position Info-tag-table-marker) (save-excursion - (set-buffer (marker-buffer Info-tag-table-marker)) - (goto-char Info-tag-table-marker) - (if (re-search-forward regexp nil t) - (progn - (setq guesspos (read (current-buffer))) - ;; If this is an indirect file, - ;; determine which file really holds this node - ;; and read it in. - (if (not (eq (current-buffer) (get-buffer "*info*"))) - (setq guesspos - (Info-read-subfile guesspos)))) - (error "No such node: %s" nodename)))) + (let ((m Info-tag-table-marker) + found found-mode) + (save-excursion + (set-buffer (marker-buffer m)) + (goto-char m) + (beginning-of-line) ;so re-search will work. + (setq found (re-search-forward regexp nil t)) + (if found + (setq guesspos (read (current-buffer)))) + (setq found-mode major-mode)) + (if found + (progn + ;; If this is an indirect file, determine + ;; which file really holds this node and + ;; read it in. + (if (not (eq found-mode 'Info-mode)) + ;; Note that the current buffer must be + ;; the *info* buffer on entry to + ;; Info-read-subfile. Thus the hackery + ;; above. + (setq guesspos (Info-read-subfile guesspos)))) + (error "No such node: %s" nodename))))) (goto-char (max (point-min) (- guesspos 1000))) ;; Now search from our advised position (or from beg of buffer) ;; to find the actual node. @@ -464,7 +506,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." Info-dir-file-attributes (cons (cons file attrs) Info-dir-file-attributes)))))) - (or (cdr dirs) (setq Info-dir-contents-directory (car dirs))) + (or (cdr dirs) (setq Info-dir-contents-directory + (file-name-as-directory (car dirs)))) (setq dirs (cdr dirs)))) (or buffers @@ -548,30 +591,39 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." (setq Info-dir-contents (buffer-string))) (setq default-directory Info-dir-contents-directory)) +;; Note that on entry to this function the current-buffer must be the +;; *info* buffer; not the info tags buffer. (defun Info-read-subfile (nodepos) - (set-buffer (marker-buffer Info-tag-table-marker)) - (goto-char (point-min)) - (search-forward "\n\^_") + ;; NODEPOS is either a position (in the Info file as a whole, + ;; not relative to a subfile) or the name of a subfile. (let (lastfilepos lastfilename) - (forward-line 2) - (catch 'foo - (while (not (looking-at "\^_")) - (if (not (eolp)) - (let ((beg (point)) - thisfilepos thisfilename) - (search-forward ": ") - (setq thisfilename (buffer-substring beg (- (point) 2))) - (setq thisfilepos (read (current-buffer))) - ;; read in version 19 stops at the end of number. - ;; Advance to the next line. - (forward-line 1) - (if (> thisfilepos nodepos) - (throw 'foo t)) - (setq lastfilename thisfilename) - (setq lastfilepos thisfilepos)) - (forward-line 1)))) - (set-buffer (get-buffer "*info*")) + (if (numberp nodepos) + (save-excursion + (set-buffer (marker-buffer Info-tag-table-marker)) + (goto-char (point-min)) + (search-forward "\n\^_") + (forward-line 2) + (catch 'foo + (while (not (looking-at "\^_")) + (if (not (eolp)) + (let ((beg (point)) + thisfilepos thisfilename) + (search-forward ": ") + (setq thisfilename (buffer-substring beg (- (point) 2))) + (setq thisfilepos (read (current-buffer))) + ;; read in version 19 stops at the end of number. + ;; Advance to the next line. + (forward-line 1) + (if (> thisfilepos nodepos) + (throw 'foo t)) + (setq lastfilename thisfilename) + (setq lastfilepos thisfilepos)) + (forward-line 1))))) + (setq lastfilename nodepos) + (setq lastfilepos 0)) + ;; Assume previous buffer is in Info-mode. + ;; (set-buffer (get-buffer "*info*")) (or (equal Info-current-subfile lastfilename) (let ((buffer-read-only nil)) (setq buffer-file-name nil) @@ -582,7 +634,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." (setq Info-current-subfile lastfilename))) (goto-char (point-min)) (search-forward "\n\^_") - (+ (- nodepos lastfilepos) (point)))) + (if (numberp nodepos) + (+ (- nodepos lastfilepos) (point))))) ;; Select the info node that point is in. (defun Info-select-node () @@ -618,7 +671,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." (defun Info-set-mode-line () (setq mode-line-buffer-identification (concat - "Info: (" + " Info: (" (if Info-current-file (file-name-nondirectory Info-current-file) "") @@ -667,7 +720,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." (defun Info-read-node-name (prompt &optional default) (let* ((completion-ignore-case t) (completion-table (Info-build-node-completions)) - (nodename (completing-read prompt 'Info-read-node-name-1))) + (nodename (completing-read prompt 'Info-read-node-name-1 nil t))) (if (equal nodename "") (or default (Info-read-node-name prompt)) @@ -679,10 +732,10 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." (save-excursion (save-restriction (if (marker-buffer Info-tag-table-marker) - (progn - (set-buffer (marker-buffer Info-tag-table-marker)) + (let ((marker Info-tag-table-marker)) + (set-buffer (marker-buffer marker)) (widen) - (goto-char Info-tag-table-marker) + (goto-char marker) (while (re-search-forward "\nNode: \\(.*\\)\177" nil t) (setq compl (cons (list (buffer-substring (match-beginning 1) @@ -727,6 +780,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." (onode Info-current-node) (ofile Info-current-file) (opoint (point)) + (ostart (window-start)) (osubfile Info-current-subfile)) (save-excursion (save-restriction @@ -739,27 +793,28 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." (if (not found) ;can only happen in subfile case -- else would have erred (unwind-protect (let ((list ())) - (set-buffer (marker-buffer Info-tag-table-marker)) - (goto-char (point-min)) - (search-forward "\n\^_\nIndirect:") - (save-restriction - (narrow-to-region (point) - (progn (search-forward "\n\^_") - (1- (point)))) + (save-excursion + (set-buffer (marker-buffer Info-tag-table-marker)) (goto-char (point-min)) - (search-forward (concat "\n" osubfile ": ")) - (beginning-of-line) - (while (not (eobp)) - (re-search-forward "\\(^.*\\): [0-9]+$") - (goto-char (+ (match-end 1) 2)) - (setq list (cons (cons (read (current-buffer)) - (buffer-substring (match-beginning 1) - (match-end 1))) - list)) - (goto-char (1+ (match-end 0)))) - (setq list (nreverse list) - current (car (car list)) - list (cdr list))) + (search-forward "\n\^_\nIndirect:") + (save-restriction + (narrow-to-region (point) + (progn (search-forward "\n\^_") + (1- (point)))) + (goto-char (point-min)) + (search-forward (concat "\n" osubfile ": ")) + (beginning-of-line) + (while (not (eobp)) + (re-search-forward "\\(^.*\\): [0-9]+$") + (goto-char (+ (match-end 1) 2)) + (setq list (cons (cons (read (current-buffer)) + (buffer-substring + (match-beginning 1) (match-end 1))) + list)) + (goto-char (1+ (match-end 0)))) + (setq list (nreverse list) + current (car (car list)) + list (cdr list)))) (while list (message "Searching subfile %s..." (cdr (car list))) (Info-read-subfile (car (car list))) @@ -771,9 +826,10 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." (message "") (signal 'search-failed (list regexp)))) (if (not found) - (progn (Info-read-subfile opoint) + (progn (Info-read-subfile osubfile) (goto-char opoint) - (Info-select-node))))) + (Info-select-node) + (set-window-start (selected-window) ostart))))) (widen) (goto-char found) (Info-select-node) @@ -800,7 +856,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." ;; Return the node name in the buffer following point. ;; ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp -;; saying which chas may appear in the node name. +;; saying which chars may appear in the node name. (defun Info-following-node-name (&optional allowedchars) (skip-chars-forward " \t") (buffer-substring-no-properties @@ -884,9 +940,18 @@ NAME may be an abbreviation of the reference name." ;; Record as a completion and perhaps as default. (if (eq default t) (setq default str)) (if (eq alt-default t) (setq alt-default str)) - (setq completions - (cons (cons str nil) - completions)))) + ;; Don't add this string if it's a duplicate. + ;; We use a loop instead of "(assoc str completions)" because + ;; we want to do a case-insensitive compare. + (let ((tail completions) + (tem (downcase str))) + (while (and tail + (not (string-equal tem (downcase (car (car tail)))))) + (setq tail (cdr tail))) + (or tail + (setq completions + (cons (cons str nil) + completions)))))) ;; If no good default was found, try an alternate. (or default (setq default alt-default)) @@ -1148,8 +1213,7 @@ N is the digit argument used to invoke this command." (interactive) (if Info-standalone (save-buffers-kill-emacs) - (switch-to-buffer (prog1 (other-buffer (current-buffer)) - (bury-buffer (current-buffer)))))) + (bury-buffer))) (defun Info-next-menu-item () (interactive) @@ -1222,9 +1286,15 @@ N is the digit argument used to invoke this command." (defun Info-scroll-up () "Scroll one screenful forward in Info, considering all nodes as one sequence. -Once you scroll far enough in a node that its menu appears on the screen, -the next scroll moves into its first subnode. When you scroll past -the end of a node, that goes to the next node or back up to the parent node." +Once you scroll far enough in a node that its menu appears on the screen +but after point, the next scroll moves into its first subnode. + +When you scroll past the end of a node, that goes to the next node; if +this node has no successor, it moves to the parent node's successor, +and so on. If point is inside the menu of a node, it moves to +subnode indicated by the following menu item. (That case won't +normally result from this command, but can happen in other ways.)" + (interactive) (if (or (< (window-start) (point-min)) (> (window-start) (point-max))) @@ -1363,7 +1433,7 @@ Give a blank topic name to go to the Index node itself." "Go to the next matching index item from the last `i' command." (interactive "p") (or Info-index-alternatives - (error "No previous `i' command in this file")) + (error "No previous `i' command")) (while (< num 0) (setq num (+ num (length Info-index-alternatives)))) (while (> num 0) @@ -1446,7 +1516,16 @@ SIG optional fourth argument, controls action on no match a string: signal an error, using that string." (save-excursion (goto-char pos) - (re-search-backward start (max (point-min) (- pos 200)) 'yes) + ;; First look for a match for START that goes across POS. + (while (and (not (bobp)) (> (point) (- pos (length start))) + (not (looking-at start))) + (forward-char -1)) + ;; If we did not find one, search back for START + ;; (this finds only matches that end at or before POS). + (or (looking-at start) + (progn + (goto-char pos) + (re-search-backward start (max (point-min) (- pos 200)) 'yes))) (let (found) (while (and (re-search-forward all (min (point-max) (+ pos 200)) 'yes) (not (setq found (and (<= (match-beginning 0) pos) @@ -1553,6 +1632,92 @@ If no reference to follow, moves to the next node, or up if none." (define-key Info-mode-map "\177" 'Info-scroll-down) (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node) ) + +(defun Info-check-pointer (item) + ;; Non-nil if ITEM is present in this node. + (condition-case nil + (Info-extract-pointer item) + (error nil))) + +(easy-menu-define Info-mode-menu Info-mode-map + "Menu for info files." + '("Info" + ["Up" Info-up (Info-check-pointer "up")] + ["Next" Info-next (Info-check-pointer "next")] + ["Previous" Info-prev (Info-check-pointer "prev[ious]*")] + ("Menu item" ["You should never see this" report-emacs-bug t]) + ("Reference" ["You should never see this" report-emacs-bug t]) + ["Search..." Info-search t] + ["Goto node..." Info-goto-node t] + ["Last" Info-last Info-history] + ["Exit" Info-exit t])) + +(defvar Info-menu-last-node nil) +;; Last node the menu was created for. + +(defun Info-menu-update () + ;; Update the Info menu for the current node. + (condition-case nil + (if (or (not (eq major-mode 'Info-mode)) + (eq Info-current-node Info-menu-last-node)) + () + ;; Update menu menu. + (let* ((Info-complete-menu-buffer (current-buffer)) + (items (nreverse (condition-case nil + (Info-complete-menu-item + "" (lambda (e) t) t) + (error nil)))) + entries current + (number 0)) + (while (and items (< number 9)) + (setq current (car items) + items (cdr items) + number (1+ number)) + (setq entries (cons `[,current + (Info-menu ,current) + :keys ,(format "%d" number)] + entries))) + (if items + (setq entries (cons ["Other..." Info-menu t] entries))) + (or entries + (setq entries (list ["No menu" nil nil]))) + (easy-menu-change '("Info") "Menu item" (nreverse entries))) + ;; Update reference menu. Code stolen from `Info-follow-reference'. + (let ((items nil) + str i entries current + (number 0)) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "\\*note[ \n\t]*\\([^:]*\\):" nil t) + (setq str (buffer-substring + (match-beginning 1) + (1- (point)))) + (setq i 0) + (while (setq i (string-match "[ \n\t]+" str i)) + (setq str (concat (substring str 0 i) " " + (substring str (match-end 0)))) + (setq i (1+ i))) + (setq items + (cons str items)))) + (while (and items (< number 9)) + (setq current (car items) + items (cdr items) + number (1+ number)) + (setq entries (cons `[,current + (Info-follow-reference ,current) + t] + entries))) + (if items + (setq entries (cons ["Other..." Info-follow-reference t] + entries))) + (or entries + (setq entries (list ["No references" nil nil]))) + (easy-menu-change '("Info") "Reference" (nreverse entries))) + ;; Update last seen node. + (setq Info-menu-last-node (current-buffer))) + ;; Try to avoid entering infinite beep mode in case of errors. + (error (ding)))) + ;; Info mode is suitable only for specially formatted data. (put 'info-mode 'mode-class 'special) @@ -1604,7 +1769,10 @@ Advanced commands: (kill-all-local-variables) (setq major-mode 'Info-mode) (setq mode-name "Info") + (setq tab-width 8) (use-local-map Info-mode-map) + (make-local-hook 'activate-menubar-hook) + (add-hook 'activate-menubar-hook 'Info-menu-update nil t) (set-syntax-table text-mode-syntax-table) (setq local-abbrev-table text-mode-abbrev-table) (setq case-fold-search t) @@ -1613,9 +1781,12 @@ Advanced commands: (make-local-variable 'Info-current-subfile) (make-local-variable 'Info-current-node) (make-local-variable 'Info-tag-table-marker) + (setq Info-tag-table-marker (make-marker)) + (make-local-variable 'Info-tag-table-buffer) + (setq Info-tag-table-buffer nil) (make-local-variable 'Info-history) (make-local-variable 'Info-index-alternatives) - (if (memq (framep (selected-frame)) '(x pc)) + (if (memq (framep (selected-frame)) '(x pc w32)) (progn (make-face 'info-node) (make-face 'info-menu-5) @@ -1752,6 +1923,8 @@ the variable `Info-file-list-for-emacs'." ;; Get Info running, and pop to it in another window. (save-window-excursion (info)) + ;; FIXME It would be cool if this could use a buffer other + ;; than *info*. (pop-to-buffer "*info*") (Info-find-node (car (car where)) (car (cdr (car where)))) @@ -1786,12 +1959,14 @@ the variable `Info-file-list-for-emacs'." (t (Info-goto-emacs-command-node command))))) -(defvar Info-title-face-alist +(defcustom Info-title-face-alist '((?* bold underline) (?= bold-italic underline) (?- italic underline)) "*Alist of face or list of faces to use for pseudo-underlined titles. -The alist key is the character the title is underlined with (?*, ?= or ?-).") +The alist key is the character the title is underlined with (?*, ?= or ?-)." + :type '(repeat (list character face face)) + :group 'info) (defun Info-fontify-node () (save-excursion @@ -1840,6 +2015,17 @@ The alist key is the character the title is underlined with (?*, ?= or ?-).") (put-text-property (match-beginning 1) (match-end 1) 'mouse-face 'highlight)))) (set-buffer-modified-p nil)))) + + +;; When an Info buffer is killed, make sure the associated tags buffer +;; is killed too. +(defun Info-kill-buffer () + (and (eq major-mode 'Info-mode) + Info-tag-table-buffer + (kill-buffer Info-tag-table-buffer))) + +(add-hook 'kill-buffer-hook 'Info-kill-buffer) + (provide 'info) diff --git a/texinfo/emacs/informat.el b/texinfo/emacs/informat.el index 0b195b9..36f0c56 100644 --- a/texinfo/emacs/informat.el +++ b/texinfo/emacs/informat.el @@ -71,7 +71,8 @@ (delete-region (point) end))) (goto-char (point-max)) (insert "\^_\f\nTag table:\n") - (move-marker Info-tag-table-marker (point)) + (if (eq major-mode 'info-mode) + (move-marker Info-tag-table-marker (point))) (setq list (nreverse list)) (while list (insert "Node: " (car (car list)) ?\177) @@ -152,6 +153,10 @@ contains just the tag table and a directory of subfiles." (search-forward "\nTag Table:\n") (insert "(Indirect)\n"))) +(defvar Info-validate-allnodes) +(defvar Info-validate-thisnode) +(defvar Info-validate-lossages) + ;;;###autoload (defun Info-validate () "Check current buffer for validity as an Info file. @@ -165,76 +170,77 @@ Check that every node pointer points to an existing node." (error "Don't yet know how to validate indirect info files: \"%s\"" (buffer-name (current-buffer)))) (goto-char (point-min)) - (let ((allnodes '(("*"))) + (let ((Info-validate-allnodes '(("*"))) (regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]") (case-fold-search t) (tags-losing nil) - (lossages ())) + (Info-validate-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 + (buffer-substring-no-properties + (match-beginning 1) + (progn + (goto-char (match-end 1)) + (skip-chars-backward " \t") + (point)))))) + (if (assoc name Info-validate-allnodes) + (setq Info-validate-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))))))) + Info-validate-lossages)) + (setq Info-validate-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) + Info-validate-allnodes))))))) (goto-char (point-min)) (while (search-forward "\n\^_" nil t) (forward-line 1) (let ((beg (point)) - thisnode next) + Info-validate-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))))) + (setq Info-validate-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) + (assoc next Info-validate-allnodes) + (if (equal (car (cdr (assoc next Info-validate-allnodes))) + Info-validate-thisnode) ;; allow multiple `next' pointers to one node - (let ((tem lossages)) + (let ((tem Info-validate-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 Info-validate-lossages + (delq (car tem) Info-validate-lossages))) (setq tem (cdr tem)))) - (setq lossages + (setq Info-validate-lossages (cons (list next "should have Previous" - thisnode) - lossages)))) + Info-validate-thisnode) + Info-validate-lossages)))) (end-of-line) (if (re-search-backward "prev[ious]*:" nil t) (Info-validate-node-name "invalid Previous")) @@ -244,12 +250,12 @@ Check that every node pointer points to an existing node." (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)))) + (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)) @@ -262,29 +268,29 @@ Check that every node pointer points to an existing node." (point)))) (Info-extract-menu-node-name "Bad format cross-reference"))))))) (setq tags-losing (not (Info-validate-tags-table))) - (if (or lossages tags-losing) + (if (or Info-validate-lossages tags-losing) (with-output-to-temp-buffer " *problems in info file*" - (while lossages + (while Info-validate-lossages (princ "In node \"") - (princ (car (car lossages))) + (princ (car (car Info-validate-lossages))) (princ "\", ") - (let ((tem (nth 1 (car lossages)))) + (let ((tem (nth 1 (car Info-validate-lossages)))) (cond ((string-match "\n" tem) (princ (substring tem 0 (match-beginning 0))) (princ "...")) (t (princ tem)))) - (if (nth 2 (car lossages)) + (if (nth 2 (car Info-validate-lossages)) (progn (princ ": ") - (let ((tem (nth 2 (car lossages)))) + (let ((tem (nth 2 (car Info-validate-lossages)))) (cond ((string-match "\n" tem) (princ (substring tem 0 (match-beginning 0))) (princ "...")) (t (princ tem)))))) (terpri) - (setq lossages (cdr lossages))) + (setq Info-validate-lossages (cdr Info-validate-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. @@ -306,16 +312,17 @@ Check that every node pointer points to an existing node." (buffer-substring-no-properties (point) (progn - (skip-chars-forward "^,\t\n") - (skip-chars-backward " ") - (point)))))) + (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)))) + (assoc name Info-validate-allnodes) + (setq Info-validate-lossages + (cons (list Info-validate-thisnode kind name) + Info-validate-lossages)))) name) (defun Info-validate-tags-table () @@ -327,7 +334,7 @@ Check that every node pointer points to an existing node." (start (progn (search-backward "\nTag table:\n") (1- (match-end 0)))) tem) - (setq tem allnodes) + (setq tem Info-validate-allnodes) (while tem (goto-char start) (or (equal (car (car tem)) "*") @@ -342,7 +349,7 @@ Check that every node pointer points to an existing node." (setq tem (downcase (buffer-substring-no-properties (match-beginning 1) (match-end 1)))) - (setq tem (assoc tem allnodes)) + (setq tem (assoc tem Info-validate-allnodes)) (if (or (not tem) (< 1000 (progn (goto-char (match-beginning 2)) @@ -426,4 +433,6 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\"" (error (message ">> Error: %s" (prin1-to-string err)))))) (kill-emacs error)))) +(provide 'informat) + ;;; informat.el ends here diff --git a/texinfo/emacs/makeinfo.el b/texinfo/emacs/makeinfo.el index a649d52..d6ee7bb 100644 --- a/texinfo/emacs/makeinfo.el +++ b/texinfo/emacs/makeinfo.el @@ -47,15 +47,24 @@ (require 'compile) -(defvar makeinfo-run-command "makeinfo" +(defgroup makeinfo nil + "Run makeinfo conveniently" + :group 'docs) + + +(defcustom makeinfo-run-command "makeinfo" "*Command used to run `makeinfo' subjob. -The name of the file is appended to this string, separated by a space.") +The name of the file is appended to this string, separated by a space." + :type 'string + :group 'makeinfo) -(defvar makeinfo-options "--fill-column=70" +(defcustom makeinfo-options "--fill-column=70" "*String containing options for running `makeinfo'. Do not include `--footnote-style' or `--paragraph-indent'; the proper way to specify those is with the Texinfo commands -`@footnotestyle` and `@paragraphindent'.") +`@footnotestyle` and `@paragraphindent'." + :type 'string + :group 'makeinfo) (require 'texinfo) diff --git a/texinfo/emacs/texinfmt.el b/texinfo/emacs/texinfmt.el index c0d0963..ffc8b1f 100644 --- a/texinfo/emacs/texinfmt.el +++ b/texinfo/emacs/texinfmt.el @@ -1,10 +1,8 @@ ;;; texinfmt.el --- format Texinfo files into Info files. -;; Copyright (C) 1985, 1986, 1988, 1990, 1991, -;; 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, +;; 1994, 1995, 1996, 1997 Free Software Foundation, Inc. -;; Author: Robert J. Chassell -;; Date: 10 Sep 1996 ;; Maintainer: Robert J. Chassell <bug-texinfo@prep.ai.mit.edu> ;; Keywords: maint, tex, docs @@ -29,7 +27,7 @@ ;;; Emacs lisp functions to convert Texinfo files to Info files. -(defvar texinfmt-version "2.35 of 10 September 1996") +(defvar texinfmt-version "2.37 of 24 May 1997") (defun texinfmt-version (&optional here) "Show the version of texinfmt.el in the minibuffer. @@ -101,7 +99,7 @@ If optional argument HERE is non-nil, insert info at point." (defun texinfo-format-buffer (&optional notagify) "Process the current buffer as texinfo code, into an Info file. The Info file output is generated in a buffer visiting the Info file -names specified in the @setfilename command. +name specified in the @setfilename command. Non-nil argument (prefix, if interactive) means don't make tag table and don't split the file if large. You can use Info-tagify and @@ -299,6 +297,33 @@ converted to Info is stored in a temporary buffer." (message "Done."))) +;;;###autoload +(defun texi2info (&optional notagify) + "Convert the current buffer (written in Texinfo code) into an Info file. +The Info file output is generated in a buffer visiting the Info file +names specified in the @setfilename command. + +This function automatically updates all node pointers and menus, and +creates a master menu. This work is done on a temporary buffer that +is automatically removed when the Info file is created. The original +Texinfo source buffer is not changed. + +Non-nil argument (prefix, if interactive) means don't make tag table +and don't split the file if large. You can use Info-tagify and +Info-split to do these manually." + (interactive "P") + (let ((temp-buffer (concat "*--" (buffer-name) "--temporary-buffer*" ))) + (message "First updating nodes and menus, then creating Info file.") + ;; (sit-for 2) + (copy-to-buffer temp-buffer (point-min) (point-max)) + (switch-to-buffer temp-buffer) + (texinfo-master-menu t) + (message "Now creating Info file.") + (sit-for 2) + (texinfo-format-buffer notagify) + (save-buffer) + (kill-buffer temp-buffer))) + ;;; Primary internal formatting function for the whole buffer. @@ -476,6 +501,7 @@ converted to Info is stored in a temporary buffer." "bullet{\\|" "cite{\\|" "code{\\|" + "email{\\|" "emph{\\|" "equiv{\\|" "error{\\|" @@ -486,7 +512,6 @@ converted to Info is stored in a temporary buffer." "kbd{\\|" "key{\\|" "lisp{\\|" - "email{\\|" "minus{\\|" "point{\\|" "print{\\|" @@ -1049,12 +1074,10 @@ Leave point after argument." (file-name-nondirectory (expand-file-name arg))) (insert "Info file: " texinfo-format-filename ", -*-Text-*-\n" - ;; Date string removed so that regression testing is easier. - ;; "produced on " - ;; (substring (current-time-string) 8 10) " " - ;; (substring (current-time-string) 4 7) " " - ;; (substring (current-time-string) -4) " " "produced by `texinfo-format-buffer'\n" + ;; Date string removed so that regression testing is easier. + ;; "on " + ;; (insert (format-time-string "%e %b %Y")) " " "from file" (if (buffer-file-name input-buffer) (concat " `" @@ -1714,7 +1737,7 @@ Used by @refill indenting command to avoid indenting within lists, etc.") ;; ;; Using the Emacs Lisp formatter, texinfmt.el, ;; the whitespace between columns can be increased by setting -;; `extra-inter-column-width' to a value greater than 0. By default, +;; `texinfo-extra-inter-column-width' to a value greater than 0. By default, ;; there is at least one blank space between columns. ;; ;; The Emacs Lisp formatter, texinfmt.el, ignores the following four @@ -1764,12 +1787,11 @@ Used by @refill indenting command to avoid indenting within lists, etc.") ;; Note that @tab, the cell separators, are not treated as independent ;; Texinfo commands. -(defvar extra-inter-column-width 0 -"*Insert NUMBER of additional columns of whitespace between entries of -a multi-column table.") +(defvar texinfo-extra-inter-column-width 0 + "*Number of extra spaces between entries (columns) in @multitable.") -(defvar multitable-temp-buffer-name "*multitable-temporary-buffer*") -(defvar multitable-temp-rectangle-name "texinfo-multitable-temp-") +(defvar texinfo-multitable-buffer-name "*multitable-temporary-buffer*") +(defvar texinfo-multitable-rectangle-name "texinfo-multitable-temp-") ;; These commands are defined in texinfo.tex for printed output. (put 'multitableparskip 'texinfo-format 'texinfo-discard-line-with-args) @@ -1778,6 +1800,7 @@ a multi-column table.") (put 'multitablelinespace 'texinfo-format 'texinfo-discard-line-with-args) (put 'multitable 'texinfo-format 'texinfo-multitable) + (defun texinfo-multitable () "Produce multi-column tables. @@ -1806,7 +1829,7 @@ Long lines of text are filled within columns. Using the Emacs Lisp formatter, texinfmt.el, the whitespace between columns can be increased by setting -`extra-inter-column-width' to a value greater than 0. By default, +`texinfo-extra-inter-column-width' to a value greater than 0. By default, there is at least one blank space between columns. The Emacs Lisp formatter, texinfmt.el, ignores the following four @@ -1895,7 +1918,7 @@ commands that are defined in texinfo.tex for printed output. ;; between column spaces (length texinfo-multitable-width-list) ;; additional between column spaces, if any - extra-inter-column-width + texinfo-extra-inter-column-width ;; sum of spaces for each entry (apply '+ texinfo-multitable-width-list)))) (if (> desired-columns fill-column) @@ -1941,7 +1964,7 @@ This command is executed when texinfmt sees @item inside @multitable." ;; extract-row command deletes the source line in the table. (unformated-row (texinfo-multitable-extract-row))) ;; Use a temporary buffer - (set-buffer (get-buffer-create multitable-temp-buffer-name)) + (set-buffer (get-buffer-create texinfo-multitable-buffer-name)) (delete-region (point-min) (point-max)) (insert unformated-row) (goto-char (point-min)) @@ -1968,7 +1991,7 @@ This command is executed when texinfmt sees @item inside @multitable." (point))) ;; Set fill-column *wider* than needed to produce inter-column space (setq fill-column (+ 1 - extra-inter-column-width + texinfo-extra-inter-column-width (nth table-column table-widths))) (narrow-to-region start end) ;; Remove whitespace before and after entry. @@ -2000,7 +2023,7 @@ This command is executed when texinfmt sees @item inside @multitable." (if (> needed-whitespace 0) needed-whitespace 1) ? ))) ;; now, put formatted cell into a rectangle - (set (intern (concat multitable-temp-rectangle-name + (set (intern (concat texinfo-multitable-rectangle-name (int-to-string table-column))) (extract-rectangle (point-min) (point))) (delete-region (point-min) (point)) @@ -2023,12 +2046,12 @@ This command is executed when texinfmt sees @item inside @multitable." (setq here (point)) (insert-rectangle (eval (intern - (concat multitable-temp-rectangle-name + (concat texinfo-multitable-rectangle-name (int-to-string column-number))))) (goto-char here) (end-of-line) (setq column-number (1+ column-number)))) - (kill-buffer multitable-temp-buffer-name) + (kill-buffer texinfo-multitable-buffer-name) (setq fill-column existing-fill-column))) @@ -2091,10 +2114,21 @@ This command is executed when texinfmt sees @item inside @multitable." ;; The `@today{}' command requires a pair of braces, like `@dots{}'. (defun texinfo-format-today () (texinfo-parse-arg-discard) - (insert (format "%s %s %s" - (substring (current-time-string) 8 10) - (substring (current-time-string) 4 7) - (substring (current-time-string) -4)))) + (insert (format-time-string "%e %b %Y"))) + + +;;; @timestamp{} +;; Produce `Day Month Year Hour:Min' style of output. +;; eg `1 Jan 1900 13:52' + +(put 'timestamp 'texinfo-format 'texinfo-format-timestamp) + +;; The `@timestamp{}' command requires a pair of braces, like `@dots{}'. +(defun texinfo-format-timestamp () + "Insert the current local time and date." + (texinfo-parse-arg-discard) + ;; For seconds and time zone, replace format string with "%e %b %Y %T %Z" + (insert (format-time-string "%e %b %Y %R"))) ;;; @ignore @@ -2217,8 +2251,9 @@ This command is executed when texinfmt sees @item inside @multitable." (put 'email 'texinfo-format 'texinfo-format-key) (put 'key 'texinfo-format 'texinfo-format-key) +;; I've decided not want to have angle brackets around these -- rms. (defun texinfo-format-key () - (insert "<" (texinfo-parse-arg-discard) ">") + (insert (texinfo-parse-arg-discard)) (goto-char texinfo-command-start)) (put 'bullet 'texinfo-format 'texinfo-format-bullet) @@ -3705,13 +3740,12 @@ The command `@value{foo}' expands to the value." ;; In this case flag is neither set nor cleared. ;; Act as if clear, i.e. do nothing. ())))) - ;;; @ifeq (put 'ifeq 'texinfo-format 'texinfo-format-ifeq) (defun texinfo-format-ifeq () - "If ARG1 and ARG2 caselessly string compare to same string, performs COMMAND. + "If ARG1 and ARG2 caselessly string compare to same string, perform COMMAND. Otherwise produces no output. Thus: diff --git a/texinfo/emacs/texinfo.el b/texinfo/emacs/texinfo.el index 0a1ab13..9e1099f 100644 --- a/texinfo/emacs/texinfo.el +++ b/texinfo/emacs/texinfo.el @@ -1,10 +1,10 @@ -;;; texinfo.el--major mode for editing Texinfo files. +;;; texinfo.el --- major mode for editing Texinfo files ;; Copyright (C) 1985, '88, '89, '90, '91, -;; '92, '93, '96 Free Software Foundation, Inc. +;; '92, '93, '96, '97 Free Software Foundation, Inc. -;; Author: Robert J. Chassell -;; Date: 6 Sep 1996 +;; Author: Robert J. Chassell +;; Date: [Set date below for texinfo-version] ;; Maintainer: bug-texinfo@prep.ai.mit.edu ;; Keywords: maint, tex, docs @@ -25,6 +25,26 @@ ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. +;;; Code: + +(defgroup texinfo nil + "Texinfo Mode" + :group 'docs) + +(defvar texinfo-version "2.37 of 24 May 1997") + +(defun texinfo-version (&optional here) + "Show the version of texinfo.el in the minibuffer. +If optional argument HERE is non-nil, insert info at point." + (interactive "P") + (let ((version-string + (format "Version of \`texinfo.el\': %s" texinfo-version))) + (if here + (insert version-string) + (if (interactive-p) + (message "%s" version-string) + version-string)))) + ;;; Autoloads: @@ -41,7 +61,7 @@ command to gain use of `next-error'." "makeinfo" "Make Info file from current buffer. -Use the \\[next-error] command to move to the next error +Use the \\[next-error] command to move to the next error \(if there are errors\)." t nil) @@ -164,7 +184,7 @@ title of the section containing the menu." (autoload 'texinfo-indent-menu-description "texnfo-upd" - "Indent every description in menu following point to COLUMN. + "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." @@ -180,7 +200,7 @@ node names in pre-existing @node lines that lack names." (autoload 'texinfo-start-menu-description "texnfo-upd" - "In this menu entry, insert the node's section title as a description. + "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. @@ -191,7 +211,7 @@ complements the node name rather than repeats it as a title does." (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. +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), @@ -205,7 +225,7 @@ a master menu in OUTER-FILE. The command also updates the `Top' level node pointers of OUTER-FILE. -Notes: +Notes: * this command does NOT save any files--you must save the outer file and any modified, included files. @@ -217,7 +237,7 @@ Notes: Requirements: * each of the included files must contain exactly one highest - hierarchical level node, + 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. @@ -261,11 +281,11 @@ chapter." ;; 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) + ;;("\\$\\([^$]*\\)\\$" 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) + ("@\\(file\\|kbd\\|key\\|url\\|email\\){\\([^}]+\\)" 2 font-lock-string-face) ("@\\(samp\\|code\\|var\\|math\\){\\([^}]+\\)" 2 font-lock-variable-name-face) ("@\\(cite\\|xref\\|pxref\\){\\([^}]+\\)" 2 font-lock-reference-face) @@ -300,7 +320,7 @@ chapter." (if (bobp) 0 (forward-char 1) - (let* ((word (buffer-substring-no-properties + (let* ((word (buffer-substring-no-properties (point) (progn (forward-word 1) (point)))) (entry (assoc word texinfo-section-list))) (if entry @@ -321,12 +341,13 @@ chapter." (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-v" 'texinfo-tex-view) (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 +;; Mode documentation displays commands in reverse order ;; from how they are listed in the texinfo-mode-map. (if texinfo-mode-map @@ -338,7 +359,7 @@ chapter." ;; 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" + (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) @@ -382,7 +403,7 @@ chapter." ;;; Texinfo mode -(defvar texinfo-chapter-level-regexp +(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.") @@ -429,7 +450,7 @@ Here are the functions: texinfo-update-node \\[texinfo-update-node] texinfo-every-node-update \\[texinfo-every-node-update] - texinfo-sequential-node-update + texinfo-sequential-node-update texinfo-make-menu \\[texinfo-make-menu] texinfo-all-menus-update \\[texinfo-all-menus-update] @@ -438,7 +459,7 @@ Here are the functions: texinfo-indent-menu-description (column &optional region-p) The `texinfo-column-for-description' variable specifies the column to -which menu descriptions are indented. +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 @@ -461,19 +482,20 @@ value of texinfo-mode-hook." (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 + (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)) + (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)) + (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) @@ -487,16 +509,20 @@ value of texinfo-mode-hook." (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(texinfo-font-lock-keywords t)) (make-local-variable 'outline-regexp) - (setq 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") + (setq tex-start-of-header "%\\*\\*start") (make-local-variable 'tex-end-of-header) - (setq tex-end-of-header "%**end") + (setq tex-end-of-header "%\\*\\*end") + (make-local-variable 'tex-first-line-header-regexp) + (setq tex-first-line-header-regexp "^\\\\input") + (make-local-variable 'tex-trailer) + (setq tex-trailer "@bye\n") (run-hooks 'text-mode-hook 'texinfo-mode-hook)) @@ -543,10 +569,10 @@ value of texinfo-mode-hook." (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))))) + (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 @@ -564,7 +590,7 @@ value of texinfo-mode-hook." ;; These commands use texinfo-insert-@-with-arg (defun texinfo-insert-@-with-arg (string &optional arg) - (if arg + (if arg (progn (setq arg (prefix-numeric-value arg)) (if (< arg 0) @@ -662,14 +688,13 @@ The default is not to surround any existing words with the braces." ;;; 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 +;; These are defined in texnfo-upd.el. defvars here avoid warnings. +(defvar texinfo-section-types-regexp) +(defvar texinfo-section-level-regexp) +(defvar texinfo-subsection-level-regexp) +(defvar texinfo-subsubsection-level-regexp) -;; `texinfo-show-structure' requires texnfo-upd.el -(defun texinfo-show-structure (&optional nodes-too) +(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. @@ -680,12 +705,12 @@ with @-sign commands for @chapter, @section, and the like, and list 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], +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 + (save-excursion (goto-char (point-min)) (if nodes-too (occur (concat "\\(^@node\\)\\|" texinfo-section-types-regexp)) @@ -716,14 +741,14 @@ to jump to the corresponding spot in the Texinfo source file." ;; ((looking-at "@appendixsec ") 9) ;; ((looking-at "@heading ") 9) - ((looking-at + ((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 + ((looking-at (concat "@\\(" texinfo-subsubsection-level-regexp "\\)")) 17) ;; ((looking-at "@subsubsection ") 17) ;; ((looking-at "@unnumberedsubsubsec ") 17) @@ -735,20 +760,28 @@ to jump to the corresponding spot in the Texinfo source file." ;;; 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.") +(defcustom texinfo-texi2dvi-command "texi2dvi" + "*Command used by `texinfo-tex-buffer' to run TeX and texindex on a buffer." + :type 'string + :group 'texinfo) -(defvar texinfo-tex-command "tex" - "*Command used by `texinfo-tex-region' to run TeX on a region.") +(defcustom texinfo-tex-command "tex" + "*Command used by `texinfo-tex-region' to run TeX on a region." + :type 'string + :group 'texinfo) -(defvar texinfo-texindex-command "texindex" - "*Command used by `texinfo-texindex' to sort unsorted index files.") +(defcustom texinfo-texindex-command "texindex" + "*Command used by `texinfo-texindex' to sort unsorted index files." + :type 'string + :group 'texinfo) -(defvar texinfo-delete-from-print-queue-command "lprm" +(defcustom 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.") +command." + :type 'string + :group 'texinfo) (defvar texinfo-tex-trailer "@bye" "String appended after a region sent to TeX by `texinfo-tex-region'.") @@ -767,109 +800,16 @@ 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))) + (let ((tex-command texinfo-tex-command) + (tex-trailer "@bye\n")) + (tex-region beg end))) (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)) + (let ((tex-command texinfo-texi2dvi-command)) + (tex-buffer))) (defun texinfo-texindex () "Run `texindex' on unsorted index files. @@ -889,12 +829,14 @@ This runs the shell command defined by `texinfo-texindex-command'." 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)) + (tex-print)) + +(defun texinfo-tex-view () + "View `.dvi' file made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer]. +This runs the shell command defined by `tex-dvi-view-command'." + (interactive) + (require 'tex-mode) + (tex-view)) (defun texinfo-quit-job () "Quit currently running TeX job, by sending an `x' to it." @@ -921,7 +863,7 @@ You are prompted for the job number (use a number shown by a previous (tex-send-command texinfo-delete-from-print-queue-command job-number) ;; alternatively ;; (send-string "tex-shell" - ;; (concat + ;; (concat ;; texinfo-delete-from-print-queue-command ;; " " ;; job-number"\n")) diff --git a/texinfo/emacs/texnfo-upd.el b/texinfo/emacs/texnfo-upd.el index 4827fe5..516c1a6 100644 --- a/texinfo/emacs/texnfo-upd.el +++ b/texinfo/emacs/texnfo-upd.el @@ -1,10 +1,9 @@ ;;; texnfo-upd.el --- utilities for updating nodes and menus in Texinfo files -;; Copyright 1989, 1990, 1991, 1992, 1996 Free Software Foundation, Inc. +;; Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. ;; Author: Robert J. Chassell -;; Date: 12 Sep 1996 -;; Maintainer: Robert J. Chassell <bug-texinfo@prep.ai.mit.edu> +;; Maintainer: bug-texinfo@prep.ai.mit.edu ;; Keywords: maint, tex, docs ;; This file is part of GNU Emacs. @@ -37,16 +36,16 @@ ;; * insert or update the menu for a section, ;; * create a master menu for a Texinfo source file. ;; -;; Passed an argument, the `texinfo-update-node' and +;; With a prefix argument, the `texinfo-update-node' and ;; `texinfo-make-menu' functions do their jobs in the region. ;; ;; In brief, the functions for creating or updating nodes and menus, are: ;; -;; texinfo-update-node (&optional region-p) +;; texinfo-update-node (&optional beginning end) ;; texinfo-every-node-update () ;; texinfo-sequential-node-update (&optional region-p) ;; -;; texinfo-make-menu (&optional region-p) +;; texinfo-make-menu (&optional beginning end) ;; texinfo-all-menus-update () ;; texinfo-master-menu () ;; @@ -81,11 +80,11 @@ ;;; The update node functions described in detail -;; The `texinfo-update-node' function without an argument inserts +;; The `texinfo-update-node' command with no prefix argument inserts ;; the correct next, previous and up pointers for the node in which ;; point is located (i.e., for the node preceding point). -;; With an argument, the `texinfo-update-node' function inserts the +;; With prefix argument, the `texinfo-update-node' function inserts the ;; correct next, previous and up pointers for the nodes inside the ;; region. @@ -150,13 +149,16 @@ ;;; Code: -;;; The menu making functions +(defvar texinfo-master-menu-header + " --- The Detailed Node Listing ---\n" + "String inserted before lower level entries in Texinfo master menu. +It comes after the chapter-level menu entries.") -(defun texinfo-make-menu (&optional region-p) +(defun texinfo-make-menu (&optional beginning end) "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 +A prefix argument 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 @@ -164,25 +166,24 @@ 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." - (interactive "P") - (if (not region-p) + (interactive + (if prefix-arg + (list (point) (mark)))) + (if (null beginning) (let ((level (texinfo-hierarchic-level))) (texinfo-make-one-menu level) - (message "Done...updated the menu. You may save the buffer.")) + (message "Menu updated")) ;; else (message "Making or updating menus in %s... " (buffer-name)) - (let ((beginning (region-beginning)) - (region-end (region-end)) - (level (progn ; find section type following point - (goto-char (region-beginning)) - (texinfo-hierarchic-level)))) - (if (= region-end beginning) - (error "Please mark a region!")) - (save-excursion + (save-excursion + (goto-char (min beginning end)) + ;; find section type following point + (let ((level (texinfo-hierarchic-level)) + (region-end (max beginning end))) (save-restriction (widen) - (while (texinfo-find-lower-level-node level region-end) + (while (texinfo-find-lower-level-node level region-end) (setq level (texinfo-hierarchic-level)) ; new, lower level (texinfo-make-one-menu level)) @@ -192,7 +193,7 @@ are inserted as descriptions." (while (texinfo-find-lower-level-node level region-end) (setq level (texinfo-hierarchic-level)) ; new, lower level (texinfo-make-one-menu level)))))) - (message "Done...updated menus. You may save the buffer."))) + (message "Making or updating menus in %s...done" (buffer-name)))) (defun texinfo-make-one-menu (level) "Make a menu of all the appropriate nodes in this section. @@ -201,10 +202,10 @@ at the level specified by LEVEL. Point is left at the end of menu." (let* ((case-fold-search t) (beginning - (save-excursion - (goto-char (texinfo-update-menu-region-beginning level)) - (end-of-line) - (point))) + (save-excursion + (goto-char (texinfo-update-menu-region-beginning level)) + (end-of-line) + (point))) (end (texinfo-update-menu-region-end level)) (first (texinfo-menu-first-node beginning end)) (node-name (progn @@ -233,9 +234,14 @@ nodes in the buffer before updating the menus." (goto-char (point-min)) (message "Checking for a master menu in %s ... "(buffer-name)) (save-excursion - (if (re-search-forward texinfo-master-menu-header nil t) - ;; Remove detailed master menu listing + (if (search-forward texinfo-master-menu-header nil t) (progn + ;; Check if @detailmenu kludge is used; + ;; if so, leave point before @detailmenu. + (search-backward "\n@detailmenu" + (save-excursion (forward-line -3) (point)) + t) + ;; Remove detailed master menu listing (setq master-menu-p t) (goto-char (match-beginning 0)) (let ((end-of-detailed-menu-descriptions @@ -249,21 +255,11 @@ nodes in the buffer before updating the menus." (progn (message "Updating all nodes in %s ... " (buffer-name)) (sleep-for 2) - (push-mark (point-max) t) - (goto-char (point-min)) - ;; Using the mark to pass bounds this way - ;; is kludgy, but it's not worth fixing. -- rms. - (let ((mark-active t)) - (texinfo-update-node t)))) + (texinfo-update-node (point-min) (point-max)))) (message "Updating all menus in %s ... " (buffer-name)) (sleep-for 2) - (push-mark (point-max) t) - (goto-char (point-min)) - ;; Using the mark to pass bounds this way - ;; is kludgy, but it's not worth fixing. -- rms. - (let ((mark-active t)) - (texinfo-make-menu t)) + (texinfo-make-menu (point-max) (point-min)) (if master-menu-p (progn @@ -438,7 +434,7 @@ old description into the new entry. For this function, the new menu is a list made up of lists of dotted pairs in which the first element of the pair is the node name and the second element the description. The new menu is changed destructively. -The old menu is the menu as it appears in the texinfo file." +The old menu is the menu as it appears in the Texinfo file." (let ((new-menu-list-pointer new-menu-list) (end-of-menu (texinfo-menu-end))) @@ -452,9 +448,9 @@ The old menu is the menu as it appears in the texinfo file." ;; ;; Recognize both when looking for the description. (concat "\\* \\(" ; so only menu entries are found - (car (car new-menu-list)) "::" + (regexp-quote (car (car new-menu-list))) "::" "\\|" - ".*: " (car (car new-menu-list)) "[.,\t\n]" + ".*: " (regexp-quote (car (car new-menu-list))) "[.,\t\n]" "\\)" ) ; so only complete entries are found end-of-menu @@ -525,7 +521,7 @@ Single argument, END-OF-MENU, is position limiting search." "")) (defun texinfo-menu-end () - "Return position of end of menu. Does not change location of point. + "Return position of end of menu, but don't move point. Signal an error if not end of menu." (save-excursion (if (re-search-forward "^@end menu" nil t) @@ -784,9 +780,14 @@ title of the section containing the menu." (or (re-search-forward "^@node" nil t) (error "Too few nodes for a master menu!")) (point)))) - (if (re-search-forward texinfo-master-menu-header first-chapter t) - ;; Remove detailed master menu listing + (if (search-forward texinfo-master-menu-header first-chapter t) (progn + ;; Check if @detailmenu kludge is used; + ;; if so, leave point before @detailmenu. + (search-backward "\n@detailmenu" + (save-excursion (forward-line -3) (point)) + t) + ;; Remove detailed master menu listing (goto-char (match-beginning 0)) (let ((end-of-detailed-menu-descriptions (save-excursion ; beginning of end menu line @@ -800,15 +801,11 @@ title of the section containing the menu." (message "Making a master menu in %s ...first updating all nodes... " (buffer-name)) (sleep-for 2) - (push-mark (point-max) t) - (goto-char (point-min)) - (texinfo-update-node t) + (texinfo-update-node (point-min) (point-max)) (message "Updating all menus in %s ... " (buffer-name)) (sleep-for 2) - (push-mark (point-max) t) - (goto-char (point-min)) - (texinfo-make-menu t))) + (texinfo-make-menu (point-min) (point-max)))) (message "Now making the master menu in %s... " (buffer-name)) (sleep-for 2) @@ -822,9 +819,14 @@ title of the section containing the menu." (save-excursion (goto-char (point-min)) - (if (re-search-forward texinfo-master-menu-header nil t) + (if (search-forward texinfo-master-menu-header nil t) (progn (goto-char (match-beginning 0)) + ;; Check if @detailmenu kludge is used; + ;; if so, leave point before @detailmenu. + (search-backward "\n@detailmenu" + (save-excursion (forward-line -3) (point)) + t) (insert "\n") (delete-blank-lines) (goto-char (point-min)))) @@ -880,59 +882,63 @@ However, there does not need to be a title field." (point) (save-excursion (re-search-forward "^@end menu") (point))) - (save-excursion ; leave point at beginning of menu - ;; Handle top of menu - (insert "\n@menu\n") - ;; Insert chapter menu entries - (setq this-very-menu-list (reverse (car (car master-menu-list)))) - ;; Tell user what is going on. - (message "Inserting chapter menu entry: %s ... " this-very-menu-list) - (while this-very-menu-list - (insert "* " (car this-very-menu-list) "\n") - (setq this-very-menu-list (cdr this-very-menu-list))) - - (setq master-menu-list (cdr master-menu-list)) + (save-excursion + ;; `master-menu-inserted-p' is a kludge to tell + ;; whether to insert @end detailmenu (see bleow) + (let (master-menu-inserted-p) + ;; Handle top of menu + (insert "\n@menu\n") + ;; Insert chapter menu entries + (setq this-very-menu-list (reverse (car (car master-menu-list)))) + ;; Tell user what is going on. + (message "Inserting chapter menu entry: %s ... " this-very-menu-list) + (while this-very-menu-list + (insert "* " (car this-very-menu-list) "\n") + (setq this-very-menu-list (cdr this-very-menu-list))) - ;; Only insert detailed master menu if there is one.... - (if (car (car master-menu-list)) -;; @detailmenu added 5 Sept 1996 at Karl Berry's request to avert a -;; bug in `makeinfo'; all agree this is a bad kluge and should -;; eventually be removed. @detailmenu ... @end detailmenu is a noop -;; in `texinfmt.el' See @end detailmenu below -;; also see `texinfo-all-menus-update' above, `texinfo-master-menu', -;; `texinfo-multiple-files-update' - (insert texinfo-master-menu-header)) + (setq master-menu-list (cdr master-menu-list)) - ;; Now, insert all the other menus + ;; Only insert detailed master menu if there is one.... + (if (car (car master-menu-list)) + (progn (setq master-menu-inserted-p t) + (insert (concat "\n@detailmenu" texinfo-master-menu-header)))) + + ;; @detailmenu added 5 Sept 1996 to `texinfo-master-menu-header' + ;; at Karl Berry's request to avert a bug in `makeinfo'; + ;; all agree this is a bad kludge and should eventually be removed. + ;; @detailmenu ... @end detailmenu is a noop in `texinfmt.el'. + ;; See @end detailmenu below; + ;; also see `texinfo-all-menus-update' above, `texinfo-master-menu', + ;; `texinfo-multiple-files-update'. + + ;; Now, insert all the other menus - ;; The menu master-menu-list has a form like this: - ;; ((("beta" "alpha") "title-A") - ;; (("delta" "gamma") "title-B")) + ;; The menu master-menu-list has a form like this: + ;; ((("beta" "alpha") "title-A") + ;; (("delta" "gamma") "title-B")) - (while master-menu-list + (while master-menu-list - (message - "Inserting menu for %s .... " (car (cdr (car master-menu-list)))) - ;; insert title of menu section - (insert "\n" (car (cdr (car master-menu-list))) "\n\n") + (message + "Inserting menu for %s .... " (car (cdr (car master-menu-list)))) + ;; insert title of menu section + (insert "\n" (car (cdr (car master-menu-list))) "\n\n") - ;; insert each menu entry - (setq this-very-menu-list (reverse (car (car master-menu-list)))) - (while this-very-menu-list - (insert "* " (car this-very-menu-list) "\n") - (setq this-very-menu-list (cdr this-very-menu-list))) + ;; insert each menu entry + (setq this-very-menu-list (reverse (car (car master-menu-list)))) + (while this-very-menu-list + (insert "* " (car this-very-menu-list) "\n") + (setq this-very-menu-list (cdr this-very-menu-list))) - (setq master-menu-list (cdr master-menu-list))) + (setq master-menu-list (cdr master-menu-list))) - ;; Finish menu -;; @detailmenu (see note above) - (insert "\n@end detailmenu") - (insert "\n@end menu\n\n"))) + ;; Finish menu -(defvar texinfo-master-menu-header - "\n@detailmenu\n --- The Detailed Node Listing ---\n" - "String inserted before lower level entries in Texinfo master menu. -It comes after the chapter-level menu entries.") + ;; @detailmenu (see note above) + ;; Only insert @end detailmenu if a master menu was inserted. + (if master-menu-inserted-p + (insert "\n@end detailmenu")) + (insert "\n@end menu\n\n")))) (defun texinfo-locate-menu-p () "Find the next menu in the texinfo file. @@ -1005,18 +1011,18 @@ error if the node is not the top node and a section is not found." (cond ((re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" ;;; Following search limit by cph but causes a bug -;;; (save-excursion -;;; (end-of-line) -;;; (point)) +;;; (save-excursion +;;; (end-of-line) +;;; (point)) nil t) "top") ((re-search-forward texinfo-section-types-regexp nil t) (buffer-substring-no-properties - (progn (beginning-of-line) ; copy its name - (1+ (point))) - (progn (forward-word 1) - (point)))) + (progn (beginning-of-line) ; copy its name + (1+ (point))) + (progn (forward-word 1) + (point)))) (t (error "texinfo-specific-section-type: Chapter or section not found.")))))) @@ -1236,15 +1242,14 @@ document; the values are regular expressions.") ;;; Updating a node ;;;###autoload -(defun texinfo-update-node (&optional region-p) +(defun texinfo-update-node (&optional beginning end) "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. +Interactively, a prefix argument means to operate on the region. The functions for creating or updating nodes and menus, and their keybindings, are: - texinfo-update-node (&optional region-p) \\[texinfo-update-node] + texinfo-update-node (&optional beginning end) \\[texinfo-update-node] texinfo-every-node-update () \\[texinfo-every-node-update] texinfo-sequential-node-update (&optional region-p) @@ -1257,41 +1262,35 @@ keybindings, are: The `texinfo-column-for-description' variable specifies the column to which menu descriptions are indented. Its default value is 32." - (interactive "P") - (if (not region-p) - ;; update a single node + (interactive + (if prefix-arg + (list (point) (mark)))) + (if (null beginning) + ;; Update a single node. (let ((auto-fill-function nil) (auto-fill-hook nil)) (if (not (re-search-backward "^@node" (point-min) t)) - (error "Node line not found before this position.")) + (error "Node line not found before this position")) (texinfo-update-the-node) (message "Done...updated the node. You may save the buffer.")) ;; else (let ((auto-fill-function nil) - (auto-fill-hook nil) - (beginning (region-beginning)) - (end (region-end))) - (if (= end beginning) - (error "Please mark a region!")) - (save-restriction - (narrow-to-region beginning end) - (goto-char beginning) - (push-mark (point) t) - (while (re-search-forward "^@node" (point-max) t) - (beginning-of-line) - (texinfo-update-the-node)) - (message "Done...updated nodes in region. You may save the buffer."))))) + (auto-fill-hook nil)) + (save-excursion + (save-restriction + (narrow-to-region beginning end) + (goto-char (point-min)) + (while (re-search-forward "^@node" (point-max) t) + (beginning-of-line) + (texinfo-update-the-node)) + (goto-char (point-max)) + (message "Done...nodes updated in region. You may save the buffer.")))))) ;;;###autoload (defun texinfo-every-node-update () "Update every node in a Texinfo file." (interactive) (save-excursion - (push-mark (point-max) t) - (goto-char (point-min)) - ;; Using the mark to pass bounds this way - ;; is kludgy, but it's not worth fixing. -- rms. - (let ((mark-active t)) - (texinfo-update-node t)) + (texinfo-update-node (point-min) (point-max)) (message "Done...updated every node. You may save the buffer."))) (defun texinfo-update-the-node () @@ -1366,7 +1365,7 @@ line, including the comma. Leaves point at beginning of line." (defun texinfo-find-pointer (beginning end level direction) "Move point to section associated with next, previous, or up pointer. -Return type of pointer (either 'normal or 'no-pointer). +Return type of pointer (either `normal' or `no-pointer'). The first and second arguments bound the search for a pointer to the beginning and end, respectively, of the enclosing higher level @@ -1447,7 +1446,7 @@ will be at some level higher in the Texinfo file. The fourth argument (defun texinfo-pointer-name (kind) "Return the node name preceding the section command. -The argument is the kind of section, either normal or no-pointer." +The argument is the kind of section, either `normal' or `no-pointer'." (let (name) (cond ((eq kind 'normal) (end-of-line) ; this handles prev node top case @@ -1456,8 +1455,10 @@ The argument is the kind of section, either normal or no-pointer." (save-excursion (forward-line -3)) t) (setq name (texinfo-copy-node-name))) - ((eq kind 'no-pointer) - (setq name " "))) ; put a blank in the pointer slot + ((eq kind 'no-pointer) + ;; Don't need to put a blank in the pointer slot, + ;; since insert "' " always has a space + (setq name " "))) ; put a blank in the pointer slot name)) (defun texinfo-insert-pointer (beginning end level direction) @@ -1468,8 +1469,7 @@ The first and second arguments bound the search for a pointer to the beginning and end, respectively, of the enclosing higher level section. The third argument is the hierarchical level of the Texinfo file, a string such as \"section\". The fourth argument is direction -towards which the pointer is directed, one of `next, `previous, or -'up." +towards which the pointer is directed, one of `next', `previous', or `up'." (end-of-line) (insert @@ -1523,7 +1523,7 @@ Info `g*' command is inadequate." "Done...sequentially updated the node . You may save the buffer.")) ;; else (let ((auto-fill-function nil) - (auto-fill-hook nil) + (auto-fill-hook nil) (beginning (region-beginning)) (end (region-end))) (if (= end beginning) @@ -1565,13 +1565,13 @@ regardless of its hierarchical level." Move point to section associated with the pointer. Find point even if it is in a different section. -Return type of pointer (either 'normal or 'no-pointer). +Return type of pointer (either `normal' or `no-pointer'). The first argument is a string specifying the general kind of section such as \"chapter\" or \"section\". The section found will be at the same hierarchical level in the Texinfo file, or, in the case of the up -pointer, some level higher. The second argument (one of 'next, -'previous, or 'up) specifies whether to find the `Next', `Previous', +pointer, some level higher. The second argument (one of `next', +`previous', or `up') specifies whether to find the `Next', `Previous', or `Up' pointer." (let ((case-fold-search t)) (cond ((eq direction 'next) @@ -1605,7 +1605,7 @@ Move point forward. The first argument is the hierarchical level of the Texinfo file, a string such as \"section\". The second argument is direction, one of -`next, `previous, or 'up." +`next', `previous', or `up'." (end-of-line) (insert @@ -1624,7 +1624,7 @@ string such as \"section\". The second argument is direction, one of "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." +node names in pre-existing `@node' lines that lack names." (interactive "r\nP") ;; Use marker; after inserting node lines, leave point at end of @@ -1785,8 +1785,7 @@ Requirements: * this 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." +Thus, normally, each included file contains one, and only one, chapter." ;; The menu-list has the form: ;; @@ -1879,7 +1878,7 @@ chapter." (defun texinfo-multi-files-insert-main-menu (menu-list) "Insert formatted main menu at point. Indents the first line of the description, if any, to the value of -texinfo-column-for-description." +`texinfo-column-for-description'." (insert "@menu\n") (while menu-list @@ -2019,10 +2018,15 @@ chapter." (progn ;; First, removing detailed part of any pre-existing master menu (goto-char (point-min)) - (if (re-search-forward texinfo-master-menu-header nil t) - ;; Remove detailed master menu listing + (if (search-forward texinfo-master-menu-header nil t) (progn (goto-char (match-beginning 0)) + ;; Check if @detailmenu kludge is used; + ;; if so, leave point before @detailmenu. + (search-backward "\n@detailmenu" + (save-excursion (forward-line -3) (point)) + t) + ;; Remove detailed master menu listing (let ((end-of-detailed-menu-descriptions (save-excursion ; beginning of end menu line (goto-char (texinfo-menu-end)) diff --git a/texinfo/info/Makefile.in b/texinfo/info/Makefile.in index 776872e..24c555e3 100644 --- a/texinfo/info/Makefile.in +++ b/texinfo/info/Makefile.in @@ -1,232 +1,327 @@ -# Makefile for texinfo/info. -*- Indented-Text -*- -# $Id: Makefile.in,v 1.1 1997/08/21 22:57:59 jason 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. +# Makefile.in generated automatically by automake 1.2 from Makefile.am -# 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. +# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#### Start of system configuration section. #### +SHELL = /bin/sh srcdir = @srcdir@ -VPATH = $(srcdir):$(common) +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ -common = $(srcdir)/../libtxi -util = $(srcdir)/../util +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include -EXEEXT = @EXEEXT@ -CC = @CC@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ + +NORMAL_INSTALL = true +PRE_INSTALL = true +POST_INSTALL = true +NORMAL_UNINSTALL = true +PRE_UNINSTALL = true +POST_UNINSTALL = true +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +TERMLIBS = @TERMLIBS@ +TEXCONFIG = @TEXCONFIG@ +TEXMF = @TEXMF@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +l = @l@ + +noinst_PROGRAMS = makedoc + +# Use `ginfo' for building to avoid confusion with the standard `info' +# target. The install rule removes the `g' before applying any +# user-specified name transformations. +bin_PROGRAMS = ginfo +transform = s/ginfo/info/; @program_transform_name@ + +localedir = $(datadir)/locale + +# -I. for funs.h. +INCLUDES = -I. -I$(top_srcdir)/lib -I../intl -DLOCALEDIR=\"$(localedir)\" +LDADD = ../lib/libtxi.a @TERMLIBS@ @INTLLIBS@ + +makedoc_SOURCES = makedoc.c +ginfo_SOURCES = dir.c display.c display.h doc.c doc.h dribble.c dribble.h \ + echo-area.c echo-area.h \ + filesys.c filesys.h footnotes.c footnotes.h funs.h gc.c gc.h \ + indices.c indices.h info-utils.c info-utils.h info.c info.h infodoc.c \ + infomap.c infomap.h m-x.c man.c man.h nodemenu.c nodes.c nodes.h \ + search.c search.h session.c session.h signals.c signals.h \ + termdep.h terminal.c terminal.h tilde.c tilde.h \ + variables.c variables.h window.c window.h + +EXTRA_DIST = README +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = ginfo$(EXEEXT) +noinst_PROGRAMS = makedoc$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +ginfo_OBJECTS = dir.o display.o doc.o dribble.o echo-area.o filesys.o \ +footnotes.o gc.o indices.o info-utils.o info.o infodoc.o infomap.o \ +m-x.o man.o nodemenu.o nodes.o search.o session.o signals.o terminal.o \ +tilde.o variables.o window.o +ginfo_LDADD = $(LDADD) +ginfo_DEPENDENCIES = ../lib/libtxi.a +ginfo_LDFLAGS = +makedoc_OBJECTS = makedoc.o +makedoc_LDADD = $(LDADD) +makedoc_DEPENDENCIES = ../lib/libtxi.a +makedoc_LDFLAGS = +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = README Makefile.am Makefile.in -LN = ln -RM = rm -f -MKDIR = mkdir -MAKEINFO= ../makeinfo/makeinfo$(EXEEXT) -DEFS = @DEFS@ +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -LDEFS = -DHANDLE_MAN_PAGES -DNAMED_FUNCTIONS=1 -DDEFAULT_INFOPATH='"$(DEFAULT_INFOPATH)"' +TAR = tar +GZIP = --best +SOURCES = $(ginfo_SOURCES) $(makedoc_SOURCES) +OBJECTS = $(ginfo_OBJECTS) $(makedoc_OBJECTS) -TERMLIBS = @TERMLIBS@ -LIBS = $(TERMLIBS) -L../libtxi -ltxi @LIBS@ -LOADLIBES = $(LIBS) +default: all -SHELL = /bin/sh +.SUFFIXES: +.SUFFIXES: .c .o +$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus info/Makefile -CFLAGS = @CFLAGS@ -LDFLAGS = @LDFLAGS@ +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -# Prefix for each installed program, normally empty or `g'. -binprefix = -# Prefix for each installed man page, normally empty or `g'. -manprefix = -mandir = @mandir@/man1 -manext = 1 -infodir = @infodir@ -DEFAULT_INFOPATH= $(infodir):. -#### End of system configuration section. #### +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -SRCS = dir.c display.c echo_area.c filesys.c \ - info-utils.c info.c infodoc.c infomap.c \ - m-x.c nodes.c search.c session.c \ - signals.c terminal.c tilde.c window.c \ - xmalloc.c indices.c makedoc.c nodemenu.c \ - footnotes.c dribble.c variables.c gc.c man.c \ - clib.c +distclean-binPROGRAMS: -HDRS = display.h doc.h echo_area.h filesys.h \ - general.h getopt.h info-utils.h info.h \ - infomap.h nodes.h search.h session.h \ - signals.h termdep.h terminal.h tilde.h \ - indices.h window.h footnotes.h dribble.h \ - variables.h gc.h clib.h +maintainer-clean-binPROGRAMS: -OBJS = dir.o display.o doc.o echo_area.o filesys.o info-utils.o info.o \ - infodoc.o infomap.o m-x.o nodes.o search.o session.o signals.o \ - terminal.o tilde.o window.o indices.o xmalloc.o nodemenu.o \ - footnotes.o dribble.o variables.o gc.o man.o clib.o +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`"; \ + $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \ + else :; fi; \ + done -# The names of files which declare info commands. -CMDFILES = $(srcdir)/session.c $(srcdir)/echo_area.c $(srcdir)/infodoc.c \ - $(srcdir)/m-x.c $(srcdir)/indices.c $(srcdir)/nodemenu.c \ - $(srcdir)/footnotes.c $(srcdir)/variables.c +uninstall-binPROGRAMS: + $(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \ + done -# The name of the program which builds documentation structure from CMDFILES. -MAKEDOC_OBJECTS = makedoc.o clib.o xmalloc.o -MAKEDOC_SOURCE = makedoc.c clib.c xmalloc.c +mostlyclean-noinstPROGRAMS: -infofiles = info.info info-stnd.info +clean-noinstPROGRAMS: + test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) + +distclean-noinstPROGRAMS: + +maintainer-clean-noinstPROGRAMS: .c.o: - $(CC) -c $(CPPFLAGS) $(LDEFS) $(DEFS) -I. -I$(srcdir) -I$(common) $(CFLAGS) $< + $(COMPILE) -c $< + +mostlyclean-compile: + rm -f *.o core + +clean-compile: + +distclean-compile: + rm -f *.tab.c -all: info$(EXEEXT) $(infofiles) -sub-all: all +maintainer-clean-compile: -dvi: all-dvi +ginfo$(EXEEXT): $(ginfo_OBJECTS) $(ginfo_DEPENDENCIES) + @rm -f ginfo$(EXEEXT) + $(LINK) $(ginfo_LDFLAGS) $(ginfo_OBJECTS) $(ginfo_LDADD) $(LIBS) -install: all - $(INSTALL_PROGRAM) info$(EXEEXT) $(bindir)/$(binprefix)info$(EXEEXT) - -$(INSTALL_DATA) $(srcdir)/info.1 $(mandir)/$(manprefix)info.$(manext) - $(POST_INSTALL) +makedoc$(EXEEXT): $(makedoc_OBJECTS) $(makedoc_DEPENDENCIES) + @rm -f makedoc$(EXEEXT) + $(LINK) $(makedoc_LDFLAGS) $(makedoc_OBJECTS) $(makedoc_LDADD) $(LIBS) -install-info: - -d=$(srcdir); test -f ./info.info && d=.; $(INSTALL_DATA) $$d/info.info $(infodir)/info.info - -d=$(srcdir); test -f ./info-stnd.info && d=.; $(INSTALL_DATA) $$d/info-stnd.info $(infodir)/info-stnd.info - ../util/install-info --info-dir=$(infodir) $(infodir)/info.info - ../util/install-info --info-dir=$(infodir) $(infodir)/info-stnd.info +tags: TAGS -uninstall: - $(RM) $(bindir)/info$(EXEEXT) - $(RM) $(infodir)/info.info - $(RM) $(infodir)/info-stnd.info - $(RM) $(mandir)/$(manprefix)info.$(manext) +ID: $(HEADERS) $(SOURCES) + here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS) -info$(EXEEXT): $(OBJS) ../libtxi/libtxi.a - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LOADLIBES) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) + tags=; \ + here=`pwd`; \ + test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS) -all-info: info.info info-stnd.info +mostlyclean-tags: -info.info: info.texi - $(MAKEINFO) --no-split -I$(srcdir) info.texi +clean-tags: -info-stnd.info: info-stnd.texi - $(MAKEINFO) --no-split -I$(srcdir) info-stnd.texi +distclean-tags: + rm -f TAGS ID -dvi all-dvi: info.dvi info-stnd.dvi -info.dvi: info.texi - PATH="$(util):$${PATH}" TEXINPUTS="$(srcdir):$(common):$${TEXINPUTS}" texi2dvi $(srcdir)/info.texi +maintainer-clean-tags: -info-stnd.dvi: info-stnd.texi - PATH="$(util):$${PATH}" TEXINPUTS="$(srcdir):$(common):$${TEXINPUTS}" texi2dvi $(srcdir)/info-stnd.texi +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) -makedoc$(EXEEXT): $(MAKEDOC_OBJECTS) ../libtxi/libtxi.a - $(CC) $(LDFLAGS) -o $@ $(MAKEDOC_OBJECTS) $(LOADLIBES) +subdir = info -Makefile: $(srcdir)/Makefile.in ../config.status - cd ..; $(SHELL) config.status +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done +info: +dvi: +check: all + $(MAKE) +installcheck: +install-info: +install-exec: install-binPROGRAMS + @$(NORMAL_INSTALL) -clean: - $(RM) info$(EXEEXT) funs.h doc.c makedoc$(EXEEXT) $(OBJS) $(MAKEDOC_OBJECTS) +install-data: + @$(NORMAL_INSTALL) -distclean: clean texclean - $(RM) Makefile config.status config.cache *~ core core.* *.core - $(RM) *.BAK makedoc-TAGS TAGS \#* *.info* +install: install-exec install-data all + @: -mostlyclean: clean +uninstall: uninstall-binPROGRAMS -realclean: distclean - $(RM) info.info info-stnd.info +all: Makefile $(PROGRAMS) -TAGS: $(SRCS) makedoc-TAGS - etags $(SRCS) - cat makedoc-TAGS >>TAGS && $(RM) makedoc-TAGS +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install +installdirs: + $(mkinstalldirs) $(bindir) -makedoc-TAGS: $(CMDFILES) - ./makedoc -tags $(CMDFILES) >makedoc-TAGS -texclean: - $(RM) *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky *.cps - $(RM) *.tps *.fns *.kys *.pgs *.vrs +mostlyclean-generic: + test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + rm -f Makefile $(DISTCLEANFILES) + rm -f config.cache config.log stamp-h stamp-h[0-9]* + test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \ + mostlyclean-compile mostlyclean-tags \ + mostlyclean-generic + +clean: clean-binPROGRAMS clean-noinstPROGRAMS clean-compile clean-tags \ + clean-generic mostlyclean + +distclean: distclean-binPROGRAMS distclean-noinstPROGRAMS \ + distclean-compile distclean-tags distclean-generic \ + clean + rm -f config.status + +maintainer-clean: maintainer-clean-binPROGRAMS \ + maintainer-clean-noinstPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-generic distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +.PHONY: default mostlyclean-binPROGRAMS distclean-binPROGRAMS \ +clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \ +install-binPROGRAMS mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ +clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info dvi installcheck \ +install-info install-exec install-data install uninstall all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean -check: info # The files `doc.c' and `funs.h' are created by ./makedoc run over the source # files which contain DECLARE_INFO_COMMAND. `funs.h' is a header file # listing the functions found. `doc.c' is a structure containing pointers # to those functions along with completable names and documentation strings. -funs.h: makedoc$(EXEEXT) $(CMDFILES) - -@if test -f funs.h; then mv -f funs.h old-funs.h; fi; : - -@if test -f doc.c; then mv -f doc.c old-doc.c; fi; : - ./makedoc$(EXEEXT) $(CMDFILES) - -@if cmp -s old-funs.h funs.h; then mv old-funs.h funs.h; \ - else $(RM) old-funs.h; fi; : - -@if cmp -s old-doc.c doc.c; then mv old-doc.c doc.c; \ - else $(RM) old-doc.c; fi; : - -doc.c: funs.h -dribble.o: dribble.c dribble.h -display.o: display.c -echo_area.o: echo_area.c -filesys.o: filesys.c -info-utils.o: info-utils.c -info.o: info.c filesys.h -infodoc.o: infodoc.c -infomap.o: infomap.c -m-x.o: m-x.c -nodes.o: nodes.c -search.o: search.c -session.o: session.c -signals.o: signals.c -terminal.o: terminal.c -tilde.o: tilde.c -window.o: window.c -xmalloc.o: xmalloc.c -indices.o: indices.c -makedoc.o: makedoc.c - -dir.o: dir.c -display.o: nodes.h info-utils.h search.h -display.o: terminal.h window.h display.h -echo_area.o: info.h -filesys.o: general.h tilde.h filesys.h -footnotes.o: footnotes.h -info-utils.o: info-utils.h nodes.h search.h -info.o: info.h $(common)/getopt.h -infodoc.o: info.h doc.h -infomap.o: infomap.h funs.h -gc.o: info.h -m-x.o: info.h -nodes.o: search.h filesys.h -nodes.o: nodes.h info-utils.h -search.o: general.h search.h nodes.h -session.o: info.h -signals.o: info.h signals.h -terminal.o: terminal.h termdep.h -tilde.o: tilde.h -variables.c: variables.h -window.o: nodes.h window.h display.h -window.o: info-utils.h search.h infomap.h - -# Prevent GNU make v3 from overflowing arg limit on SysV. +# +# I do not know how to get this right. +# BUILT_SOURCES = doc.c funs.h +# +#cmd_sources = $(srcdir)/session.c $(srcdir)/echo-area.c $(srcdir)/infodoc.c \ +# $(srcdir)/m-x.c $(srcdir)/indices.c $(srcdir)/nodemenu.c \ +# $(srcdir)/footnotes.c $(srcdir)/variables.c +# +#$(BUILTSOURCES): makedoc $(cmd_sources) +# ./makedoc $(cmd_sources) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: - -# eof diff --git a/texinfo/info/README b/texinfo/info/README index d8f1ab6..90d3e2c 100644 --- a/texinfo/info/README +++ b/texinfo/info/README @@ -1,9 +1,3 @@ -The file NEWS contains information about what has changed since the last -release. - -The file ../INSTALL contains instructions on how to install Info. - - Info 2.0 is a complete rewrite of the original standalone Info I wrote in 1987, the first program I wrote for rms. That program was something like my second Unix program ever, and my die-hard machine language coding habits diff --git a/texinfo/info/dir.c b/texinfo/info/dir.c index 4ccf856..651e48a 100644 --- a/texinfo/info/dir.c +++ b/texinfo/info/dir.c @@ -1,9 +1,7 @@ -/* dir.c -- How to build a special "dir" node from "localdir" files. */ +/* dir.c -- How to build a special "dir" node from "localdir" files. + $Id: dir.c,v 1.6 1997/07/27 21:09:20 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,13 +19,7 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#if defined (HAVE_SYS_FILE_H) -#include <sys/file.h> -#endif /* HAVE_SYS_FILE_H */ -#include <sys/errno.h> +#include "info.h" #include "info-utils.h" #include "filesys.h" #include "tilde.h" @@ -37,23 +29,53 @@ dirs_to_add which are found in INFOPATH. */ static void add_menu_to_file_buffer (), insert_text_into_fb_at_binding (); -static void build_dir_node_internal (); static char *dirs_to_add[] = { "dir", "localdir", (char *)NULL }; + +/* Return zero if the file represented in the stat structure TEST has + already been seen, nonzero else. */ + +typedef struct +{ + unsigned long device; + unsigned long inode; +} dir_file_list_entry_type; + +static int +new_dir_file_p (test) + struct stat *test; +{ + static unsigned dir_file_list_len = 0; + static dir_file_list_entry_type *dir_file_list = NULL; + unsigned i; + + for (i = 0; i < dir_file_list_len; i++) + { + dir_file_list_entry_type entry; + entry = dir_file_list[i]; + if (entry.device == test->st_dev && entry.inode == test->st_ino) + return 0; + } + + dir_file_list_len++; + dir_file_list = xrealloc (dir_file_list, + dir_file_list_len * sizeof (dir_file_list_entry_type)); + dir_file_list[dir_file_list_len - 1].device = test->st_dev; + dir_file_list[dir_file_list_len - 1].inode = test->st_ino; + return 1; +} + + void maybe_build_dir_node (dirname) char *dirname; { - FILE_BUFFER *dir_buffer; int path_index, update_tags; char *this_dir; - - /* Check to see if the file has already been built. If so, then - do not build it again. */ - dir_buffer = info_find_file (dirname); + FILE_BUFFER *dir_buffer = info_find_file (dirname); /* If there is no "dir" in the current info path, we cannot build one from nothing. */ @@ -64,6 +86,10 @@ maybe_build_dir_node (dirname) if (dir_buffer->flags & N_CannotGC) return; + /* Initialize the list we use to avoid reading the same dir file twice + with the dir file just found. */ + new_dir_file_p (&dir_buffer->finfo); + path_index = update_tags = 0; /* Using each element of the path, check for one of the files in @@ -71,62 +97,56 @@ maybe_build_dir_node (dirname) Only files explictly named are eligible. This is a design decision. There can be an info file name "localdir.info" which contains information on the setting up of "localdir" files. */ - while (this_dir = extract_colon_unit (infopath, &path_index)) + while ((this_dir = extract_colon_unit (infopath, &path_index))) { register int da_index; char *from_file; /* Expand a leading tilde if one is present. */ if (*this_dir == '~') - { - char *tilde_expanded_dirname; - - tilde_expanded_dirname = tilde_expand_word (this_dir); - if (tilde_expanded_dirname != this_dir) - { - free (this_dir); - this_dir = tilde_expanded_dirname; - } - } - - /* For every file named in DIRS_TO_ADD found in the search path, - add the contents of that file's menu to our "dir" node. */ - for (da_index = 0; from_file = dirs_to_add[da_index]; da_index++) - { - struct stat finfo; - char *fullpath; - int namelen, statable; - - namelen = strlen (from_file); - - fullpath = (char *)xmalloc (3 + strlen (this_dir) + namelen); - strcpy (fullpath, this_dir); - if (fullpath[strlen (fullpath) - 1] != '/') - strcat (fullpath, "/"); - strcat (fullpath, from_file); - - statable = (stat (fullpath, &finfo) == 0); - - /* Only add the contents of this file if it is not identical to the - file of the DIR buffer. */ - if ((statable && S_ISREG (finfo.st_mode)) && - (strcmp (dir_buffer->fullpath, fullpath) != 0)) - { - long filesize; - char *contents; - - contents = filesys_read_info_file (fullpath, &filesize, &finfo); - - if (contents) - { - update_tags++; - add_menu_to_file_buffer (contents, filesize, dir_buffer); - free (contents); - } - } - - free (fullpath); - } + { + char *tilde_expanded_dirname; + + tilde_expanded_dirname = tilde_expand_word (this_dir); + if (tilde_expanded_dirname != this_dir) + { + free (this_dir); + this_dir = tilde_expanded_dirname; + } + } + + /* For every different file named in DIRS_TO_ADD found in the + search path, add that file's menu to our "dir" node. */ + for (da_index = 0; (from_file = dirs_to_add[da_index]); da_index++) + { + struct stat finfo; + int statable; + int namelen = strlen (from_file); + char *fullpath = xmalloc (3 + strlen (this_dir) + namelen); + + strcpy (fullpath, this_dir); + if (fullpath[strlen (fullpath) - 1] != '/') + strcat (fullpath, "/"); + strcat (fullpath, from_file); + + statable = (stat (fullpath, &finfo) == 0); + + /* Only add this file if we have not seen it before. */ + if (statable && S_ISREG (finfo.st_mode) && new_dir_file_p (&finfo)) + { + long filesize; + char *contents = filesys_read_info_file (fullpath, &filesize, + &finfo); + if (contents) + { + update_tags++; + add_menu_to_file_buffer (contents, filesize, dir_buffer); + free (contents); + } + } + + free (fullpath); + } free (this_dir); } @@ -176,37 +196,37 @@ add_menu_to_file_buffer (contents, size, fb) if (fb_offset == -1) { /* Find the start of the second node in this file buffer. If there - is only one node, we will be adding the contents to the end of - this node. */ + is only one node, we will be adding the contents to the end of + this node. */ fb_offset = find_node_separator (&fb_binding); /* If not even a single node separator, give up. */ if (fb_offset == -1) - return; + return; fb_binding.start = fb_offset; fb_binding.start += - skip_node_separator (fb_binding.buffer + fb_binding.start); + skip_node_separator (fb_binding.buffer + fb_binding.start); /* Try to find the next node separator. */ fb_offset = find_node_separator (&fb_binding); /* If found one, consider that the start of the menu. Otherwise, the - start of this menu is the end of the file buffer (i.e., fb->size). */ + start of this menu is the end of the file buffer (i.e., fb->size). */ if (fb_offset != -1) - fb_binding.start = fb_offset; + fb_binding.start = fb_offset; else - fb_binding.start = fb_binding.end; + fb_binding.start = fb_binding.end; insert_text_into_fb_at_binding - (fb, &fb_binding, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL)); + (fb, &fb_binding, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL)); fb_binding.buffer = fb->contents; fb_binding.start = 0; fb_binding.end = fb->filesize; fb_offset = search_forward (INFO_MENU_LABEL, &fb_binding); if (fb_offset == -1) - abort (); + abort (); } /* CONTENTS_OFFSET and FB_OFFSET point to the starts of the menus that @@ -224,23 +244,23 @@ add_menu_to_file_buffer (contents, size, fb) int num_found = 0; while ((fb_binding.start > 0) && - (whitespace_or_newline (fb_binding.buffer[fb_binding.start - 1]))) + (whitespace_or_newline (fb_binding.buffer[fb_binding.start - 1]))) { - num_found++; - fb_binding.start--; + num_found++; + fb_binding.start--; } /* Optimize if possible. */ if (num_found >= 2) { - fb_binding.buffer[fb_binding.start++] = '\n'; - fb_binding.buffer[fb_binding.start++] = '\n'; + fb_binding.buffer[fb_binding.start++] = '\n'; + fb_binding.buffer[fb_binding.start++] = '\n'; } else { - /* Do it the hard way. */ - insert_text_into_fb_at_binding (fb, &fb_binding, "\n\n", 2); - fb_binding.start += 2; + /* Do it the hard way. */ + insert_text_into_fb_at_binding (fb, &fb_binding, "\n\n", 2); + fb_binding.start += 2; } } diff --git a/texinfo/info/display.c b/texinfo/info/display.c index 0194afa..3f2abe3 100644 --- a/texinfo/info/display.c +++ b/texinfo/info/display.c @@ -1,9 +1,7 @@ -/* display.c -- How to display Info windows. */ +/* display.c -- How to display Info windows. + $Id: display.c,v 1.6 1997/07/24 21:13:27 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,10 +19,7 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#include <stdio.h> -#include <ctype.h> -#include <sys/types.h> -#include <sys/stat.h> +#include "info.h" #include "display.h" extern int info_any_buffered_input_p (); /* Found in session.c. */ @@ -57,7 +52,7 @@ display_clear_display (display) register int i; register DISPLAY_LINE *display_line; - for (i = 0; display_line = display[i]; i++) + for (i = 0; (display_line = display[i]); i++) { display[i]->text[0] = '\0'; display[i]->textlen = 0; @@ -83,13 +78,13 @@ display_update_display (window) { /* Only re-display visible windows which need updating. */ if (((win->flags & W_WindowVisible) == 0) || - ((win->flags & W_UpdateWindow) == 0) || - (win->height == 0)) - continue; + ((win->flags & W_UpdateWindow) == 0) || + (win->height == 0)) + continue; display_update_one_window (win); if (display_was_interrupted_p) - break; + break; } /* Always update the echo area. */ @@ -102,12 +97,12 @@ void display_update_one_window (win) WINDOW *win; { - register char *nodetext; /* Current character to display. */ + register char *nodetext; /* Current character to display. */ register char *last_node_char; /* Position of the last character in node. */ - register int i; /* General use index. */ - char *printed_line; /* Buffer for a printed line. */ - int pl_index = 0; /* Index into PRINTED_LINE. */ - int line_index = 0; /* Number of lines done so far. */ + register int i; /* General use index. */ + char *printed_line; /* Buffer for a printed line. */ + int pl_index = 0; /* Index into PRINTED_LINE. */ + int line_index = 0; /* Number of lines done so far. */ DISPLAY_LINE **display = the_display; /* If display is inhibited, that counts as an interrupted display. */ @@ -142,165 +137,165 @@ display_update_one_window (win) int replen; if (isprint (*nodetext)) - { - rep_temp[0] = *nodetext; - replen = 1; - rep_temp[1] = '\0'; - rep = rep_temp; - } + { + rep_temp[0] = *nodetext; + replen = 1; + rep_temp[1] = '\0'; + rep = rep_temp; + } else - { - if (*nodetext == '\r' || *nodetext == '\n') - { - replen = win->width - pl_index; - } - else - { - rep = printed_representation (*nodetext, pl_index); - replen = strlen (rep); - } - } + { + if (*nodetext == '\r' || *nodetext == '\n') + { + replen = win->width - pl_index; + } + else + { + rep = printed_representation (*nodetext, pl_index); + replen = strlen (rep); + } + } /* If this character can be printed without passing the width of - the line, then stuff it into the line. */ + the line, then stuff it into the line. */ if (replen + pl_index < win->width) - { - /* Optimize if possible. */ - if (replen == 1) - { - printed_line[pl_index++] = *rep; - } - else - { - for (i = 0; i < replen; i++) - printed_line[pl_index++] = rep[i]; - } - } + { + /* Optimize if possible. */ + if (replen == 1) + { + printed_line[pl_index++] = *rep; + } + else + { + for (i = 0; i < replen; i++) + printed_line[pl_index++] = rep[i]; + } + } else - { - DISPLAY_LINE *entry; - - /* If this character cannot be printed in this line, we have - found the end of this line as it would appear on the screen. - Carefully print the end of the line, and then compare. */ - if (*nodetext == '\n' || *nodetext == '\r' || *nodetext == '\t') - { - printed_line[pl_index] = '\0'; - rep_carried_over = (char *)NULL; - } - else - { - /* The printed representation of this character extends into - the next line. Remember the offset of the last character - printed out of REP so that we can carry the character over - to the next line. */ - for (i = 0; pl_index < (win->width - 1);) - printed_line[pl_index++] = rep[i++]; - - rep_carried_over = rep + i; - - /* If printing the last character in this window couldn't - possibly cause the screen to scroll, place a backslash - in the rightmost column. */ - if (1 + line_index + win->first_row < the_screen->height) - { - if (win->flags & W_NoWrap) - printed_line[pl_index++] = '$'; - else - printed_line[pl_index++] = '\\'; - } - printed_line[pl_index] = '\0'; - } - - /* We have the exact line as it should appear on the screen. - Check to see if this line matches the one already appearing - on the screen. */ - entry = display[line_index + win->first_row]; - - /* If the screen line is inversed, then we have to clear - the line from the screen first. Why, I don't know. */ - if (entry->inverse) - { - terminal_goto_xy (0, line_index + win->first_row); - terminal_clear_to_eol (); - entry->inverse = 0; - entry->text[0] = '\0'; - entry->textlen = 0; - } - - /* Find the offset where these lines differ. */ - for (i = 0; i < pl_index; i++) - if (printed_line[i] != entry->text[i]) - break; - - /* If the lines are not the same length, or if they differed - at all, we must do some redrawing. */ - if ((i != pl_index) || (pl_index != entry->textlen)) - { - /* Move to the proper point on the terminal. */ - terminal_goto_xy (i, line_index + win->first_row); - - /* If there is any text to print, print it. */ - if (i != pl_index) - terminal_put_text (printed_line + i); - - /* If the printed text didn't extend all the way to the edge - of the window, and text was appearing between here and the - edge of the window, clear from here to the end of the line. */ - if ((pl_index < win->width && pl_index < entry->textlen) || - (entry->inverse)) - terminal_clear_to_eol (); - - fflush (stdout); - - /* Update the display text buffer. */ - strcpy (entry->text + i, printed_line + i); - entry->textlen = pl_index; - - /* Lines showing node text are not in inverse. Only modelines - have that distinction. */ - entry->inverse = 0; - } - - /* We have done at least one line. Increment our screen line - index, and check against the bottom of the window. */ - if (++line_index == win->height) - break; - - /* A line has been displayed, and the screen reflects that state. - If there is typeahead pending, then let that typeahead be read - now, instead of continuing with the display. */ - if (info_any_buffered_input_p ()) - { - free (printed_line); - display_was_interrupted_p = 1; - return; - } - - /* Reset PL_INDEX to the start of the line. */ - pl_index = 0; - - /* If there are characters from REP left to print, stuff them - into the buffer now. */ - if (rep_carried_over) - for (; rep[pl_index]; pl_index++) - printed_line[pl_index] = rep[pl_index]; - - /* If this window has chosen not to wrap lines, skip to the end - of the physical line in the buffer, and start a new line here. */ - if (pl_index && (win->flags & W_NoWrap)) - { - char *begin; - - pl_index = 0; - printed_line[0] = '\0'; - - begin = nodetext; - - while ((nodetext < last_node_char) && (*nodetext != '\n')) - nodetext++; - } - } + { + DISPLAY_LINE *entry; + + /* If this character cannot be printed in this line, we have + found the end of this line as it would appear on the screen. + Carefully print the end of the line, and then compare. */ + if (*nodetext == '\n' || *nodetext == '\r' || *nodetext == '\t') + { + printed_line[pl_index] = '\0'; + rep_carried_over = (char *)NULL; + } + else + { + /* The printed representation of this character extends into + the next line. Remember the offset of the last character + printed out of REP so that we can carry the character over + to the next line. */ + for (i = 0; pl_index < (win->width - 1);) + printed_line[pl_index++] = rep[i++]; + + rep_carried_over = rep + i; + + /* If printing the last character in this window couldn't + possibly cause the screen to scroll, place a backslash + in the rightmost column. */ + if (1 + line_index + win->first_row < the_screen->height) + { + if (win->flags & W_NoWrap) + printed_line[pl_index++] = '$'; + else + printed_line[pl_index++] = '\\'; + } + printed_line[pl_index] = '\0'; + } + + /* We have the exact line as it should appear on the screen. + Check to see if this line matches the one already appearing + on the screen. */ + entry = display[line_index + win->first_row]; + + /* If the screen line is inversed, then we have to clear + the line from the screen first. Why, I don't know. */ + if (entry->inverse) + { + terminal_goto_xy (0, line_index + win->first_row); + terminal_clear_to_eol (); + entry->inverse = 0; + entry->text[0] = '\0'; + entry->textlen = 0; + } + + /* Find the offset where these lines differ. */ + for (i = 0; i < pl_index; i++) + if (printed_line[i] != entry->text[i]) + break; + + /* If the lines are not the same length, or if they differed + at all, we must do some redrawing. */ + if ((i != pl_index) || (pl_index != entry->textlen)) + { + /* Move to the proper point on the terminal. */ + terminal_goto_xy (i, line_index + win->first_row); + + /* If there is any text to print, print it. */ + if (i != pl_index) + terminal_put_text (printed_line + i); + + /* If the printed text didn't extend all the way to the edge + of the window, and text was appearing between here and the + edge of the window, clear from here to the end of the line. */ + if ((pl_index < win->width && pl_index < entry->textlen) || + (entry->inverse)) + terminal_clear_to_eol (); + + fflush (stdout); + + /* Update the display text buffer. */ + strcpy (entry->text + i, printed_line + i); + entry->textlen = pl_index; + + /* Lines showing node text are not in inverse. Only modelines + have that distinction. */ + entry->inverse = 0; + } + + /* We have done at least one line. Increment our screen line + index, and check against the bottom of the window. */ + if (++line_index == win->height) + break; + + /* A line has been displayed, and the screen reflects that state. + If there is typeahead pending, then let that typeahead be read + now, instead of continuing with the display. */ + if (info_any_buffered_input_p ()) + { + free (printed_line); + display_was_interrupted_p = 1; + return; + } + + /* Reset PL_INDEX to the start of the line. */ + pl_index = 0; + + /* If there are characters from REP left to print, stuff them + into the buffer now. */ + if (rep_carried_over) + for (; rep[pl_index]; pl_index++) + printed_line[pl_index] = rep[pl_index]; + + /* If this window has chosen not to wrap lines, skip to the end + of the physical line in the buffer, and start a new line here. */ + if (pl_index && (win->flags & W_NoWrap)) + { + char *begin; + + pl_index = 0; + printed_line[0] = '\0'; + + begin = nodetext; + + while ((nodetext < last_node_char) && (*nodetext != '\n')) + nodetext++; + } + } } done_with_node_display: @@ -313,13 +308,13 @@ display_update_one_window (win) /* If this line has text on it then make it go away. */ if (entry && entry->textlen) - { - entry->textlen = 0; - entry->text[0] = '\0'; + { + entry->textlen = 0; + entry->text[0] = '\0'; - terminal_goto_xy (0, line_index + win->first_row); - terminal_clear_to_eol (); - } + terminal_goto_xy (0, line_index + win->first_row); + terminal_clear_to_eol (); + } } /* Finally, if this window has a modeline it might need to be redisplayed. @@ -331,19 +326,19 @@ display_update_one_window (win) line_index = win->first_row + win->height; /* This display line must both be in inverse, and have the same - contents. */ + contents. */ if ((!display[line_index]->inverse) || - (strcmp (display[line_index]->text, win->modeline) != 0)) - { - terminal_goto_xy (0, line_index); - terminal_begin_inverse (); - terminal_put_text (win->modeline); - terminal_end_inverse (); - strcpy (display[line_index]->text, win->modeline); - display[line_index]->inverse = 1; - display[line_index]->textlen = strlen (win->modeline); - fflush (stdout); - } + (strcmp (display[line_index]->text, win->modeline) != 0)) + { + terminal_goto_xy (0, line_index); + terminal_begin_inverse (); + terminal_put_text (win->modeline); + terminal_end_inverse (); + strcpy (display[line_index]->text, win->modeline); + display[line_index]->inverse = 1; + display[line_index]->textlen = strlen (win->modeline); + fflush (stdout); + } } /* Okay, this window doesn't need updating anymore. */ @@ -387,40 +382,40 @@ display_scroll_display (start, end, amount) /* Shift the lines to scroll right into place. */ for (i = 0; i < (end - start); i++) - { - temp = the_display[last - i]; - the_display[last - i] = the_display[end - i]; - the_display[end - i] = temp; - } + { + temp = the_display[last - i]; + the_display[last - i] = the_display[end - i]; + the_display[end - i] = temp; + } /* The lines have been shifted down in the buffer. Clear all of the - lines that were vacated. */ + lines that were vacated. */ for (i = start; i != (start + amount); i++) - { - the_display[i]->text[0] = '\0'; - the_display[i]->textlen = 0; - the_display[i]->inverse = 0; - } + { + the_display[i]->text[0] = '\0'; + the_display[i]->textlen = 0; + the_display[i]->inverse = 0; + } } if (amount < 0) { last = start + amount; for (i = 0; i < (end - start); i++) - { - temp = the_display[last + i]; - the_display[last + i] = the_display[start + i]; - the_display[start + i] = temp; - } + { + temp = the_display[last + i]; + the_display[last + i] = the_display[start + i]; + the_display[start + i] = temp; + } /* The lines have been shifted up in the buffer. Clear all of the - lines that are left over. */ + lines that are left over. */ for (i = end + amount; i != end; i++) - { - the_display[i]->text[0] = '\0'; - the_display[i]->textlen = 0; - the_display[i]->inverse = 0; - } + { + the_display[i]->text[0] = '\0'; + the_display[i]->textlen = 0; + the_display[i]->inverse = 0; + } } } @@ -434,9 +429,9 @@ display_scroll_line_starts (window, old_pagetop, old_starts, old_count) int old_pagetop, old_count; char **old_starts; { - register int i, old, new; /* Indices into the line starts arrays. */ - int last_new, last_old; /* Index of the last visible line. */ - int old_first, new_first; /* Index of the first changed line. */ + register int i, old, new; /* Indices into the line starts arrays. */ + int last_new, last_old; /* Index of the last visible line. */ + int old_first, new_first; /* Index of the first changed line. */ int unchanged_at_top = 0; int already_scrolled = 0; @@ -466,39 +461,39 @@ display_scroll_line_starts (window, old_pagetop, old_starts, old_count) for (old = old_first + unchanged_at_top; old < last_old; old++) { for (new = new_first; new < last_new; new++) - if (old_starts[old] == window->line_starts[new]) - { - /* Find the extent of the matching lines. */ - for (i = 0; (old + i) < last_old; i++) - if (old_starts[old + i] != window->line_starts[new + i]) - break; - - /* Scroll these lines if there are enough of them. */ - { - int start, end, amount; - - start = (window->first_row - + ((old + already_scrolled) - old_pagetop)); - amount = new - (old + already_scrolled); - end = window->first_row + window->height; - - /* If we are shifting the block of lines down, then the last - AMOUNT lines will become invisible. Thus, don't bother - scrolling them. */ - if (amount > 0) - end -= amount; - - if ((end - start) > 0) - { - display_scroll_display (start, end, amount); - - /* Some lines have been scrolled. Simulate the scrolling - by offsetting the value of the old index. */ - old += i; - already_scrolled += amount; - } - } - } + if (old_starts[old] == window->line_starts[new]) + { + /* Find the extent of the matching lines. */ + for (i = 0; (old + i) < last_old; i++) + if (old_starts[old + i] != window->line_starts[new + i]) + break; + + /* Scroll these lines if there are enough of them. */ + { + int start, end, amount; + + start = (window->first_row + + ((old + already_scrolled) - old_pagetop)); + amount = new - (old + already_scrolled); + end = window->first_row + window->height; + + /* If we are shifting the block of lines down, then the last + AMOUNT lines will become invisible. Thus, don't bother + scrolling them. */ + if (amount > 0) + end -= amount; + + if ((end - start) > 0) + { + display_scroll_display (start, end, amount); + + /* Some lines have been scrolled. Simulate the scrolling + by offsetting the value of the old index. */ + old += i; + already_scrolled += amount; + } + } + } } } @@ -512,12 +507,13 @@ display_cursor_at_point (window) vpos = window_line_of_point (window) - window->pagetop + window->first_row; hpos = window_get_cursor_column (window); terminal_goto_xy (hpos, vpos); + fflush (stdout); } /* **************************************************************** */ -/* */ -/* Functions Static to this File */ -/* */ +/* */ +/* Functions Static to this File */ +/* */ /* **************************************************************** */ /* Make a DISPLAY_LINE ** with width and height. */ @@ -552,7 +548,7 @@ free_display (display) if (!display) return; - for (i = 0; display_line = display[i]; i++) + for (i = 0; (display_line = display[i]); i++) { free (display_line->text); free (display_line); diff --git a/texinfo/info/display.h b/texinfo/info/display.h index d8bd5a1..4398135 100644 --- a/texinfo/info/display.h +++ b/texinfo/info/display.h @@ -1,9 +1,10 @@ -/* display.h -- How the display in Info is done. */ +/* display.h -- How the display in Info is done. + $Id: display.h,v 1.2 1997/07/15 18:37:29 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,8 +22,8 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_DISPLAY_H_) -#define _DISPLAY_H_ +#ifndef INFO_DISPLAY_H +#define INFO_DISPLAY_H #include "info-utils.h" #include "terminal.h" @@ -73,4 +74,4 @@ extern void display_scroll_display (); that appear in the OLD_STARTS array. */ extern void display_scroll_line_starts (); -#endif /* !_DISPLAY_H_ */ +#endif /* not INFO_DISPLAY_H */ diff --git a/texinfo/info/doc.h b/texinfo/info/doc.h index 8afc28f..423998e 100644 --- a/texinfo/info/doc.h +++ b/texinfo/info/doc.h @@ -21,18 +21,10 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_DOC_H_) -#define _DOC_H_ +#if !defined (DOC_H) +#define DOC_H -#if !defined (NULL) -# define NULL 0x0 -#endif /* !NULL */ - -#if !defined (__FUNCTION_DEF) -# define __FUNCTION_DEF -typedef int Function (); -typedef void VFunction (); -#endif /* _FUNCTION_DEF */ +#include "info.h" /* for NAMED_FUNCTIONS, VFunction, etc. */ typedef struct { VFunction *func; @@ -55,4 +47,4 @@ extern void dump_map_to_message_buffer (); extern char *function_name (); extern VFunction *named_function (); #endif /* NAMED_FUNCTIONS */ -#endif /* !_DOC_H_ */ +#endif /* !DOC_H */ diff --git a/texinfo/info/dribble.c b/texinfo/info/dribble.c index 8e16cea..d1d5848 100644 --- a/texinfo/info/dribble.c +++ b/texinfo/info/dribble.c @@ -21,7 +21,7 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#include <stdio.h> +#include "info.h" #include "dribble.h" /* When non-zero, it is a stream to write all input characters to for the diff --git a/texinfo/info/filesys.c b/texinfo/info/filesys.c index e684bf8..24d1d75 100644 --- a/texinfo/info/filesys.c +++ b/texinfo/info/filesys.c @@ -1,9 +1,7 @@ -/* filesys.c -- File system specific functions for hacking this system. */ +/* filesys.c -- File system specific functions for hacking this system. + $Id: filesys.c,v 1.4 1997/07/24 21:23:07 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,49 +19,17 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#if defined (HAVE_SYS_FILE_H) -#include <sys/file.h> -#endif /* HAVE_SYS_FILE_H */ -#include <sys/errno.h> -#include "general.h" +#include "info.h" + #include "tilde.h" #include "filesys.h" -#if !defined (O_RDONLY) -#if defined (HAVE_SYS_FCNTL_H) -#include <sys/fcntl.h> -#else /* !HAVE_SYS_FCNTL_H */ -#include <fcntl.h> -#endif /* !HAVE_SYS_FCNTL_H */ -#endif /* !O_RDONLY */ - -#if !defined (errno) -extern int errno; -#endif /* !errno */ - -/* Found in info-utils.c. */ -extern char *filename_non_directory (); - -#if !defined (BUILDING_LIBRARY) -/* Found in session.c */ -extern int info_windows_initialized_p; - -/* Found in window.c. */ -extern void message_in_echo_area (), unmessage_in_echo_area (); -#endif /* !BUILDING_LIBRARY */ - /* Local to this file. */ static char *info_file_in_path (), *lookup_info_filename (); static void remember_info_filename (), maybe_initialize_infopath (); -#if !defined (NULL) -# define NULL 0x0 -#endif /* !NULL */ - -typedef struct { +typedef struct +{ char *suffix; char *decompressor; } COMPRESSION_ALIST; @@ -114,58 +80,58 @@ info_find_fullpath (partial) expansion = lookup_info_filename (partial); if (expansion) - return (expansion); + return (expansion); /* If we have the full path to this file, we still may have to add - various extensions to it. I guess we have to stat this file - after all. */ + various extensions to it. I guess we have to stat this file + after all. */ if (initial_character == '/') - temp = info_file_in_path (partial + 1, "/"); + temp = info_file_in_path (partial + 1, "/"); else if (initial_character == '~') - { - expansion = tilde_expand_word (partial); - if (*expansion == '/') - { - temp = info_file_in_path (expansion + 1, "/"); - free (expansion); - } - else - temp = expansion; - } + { + expansion = tilde_expand_word (partial); + if (*expansion == '/') + { + temp = info_file_in_path (expansion + 1, "/"); + free (expansion); + } + else + temp = expansion; + } else if (initial_character == '.' && - (partial[1] == '/' || (partial[1] == '.' && partial[2] == '/'))) - { - if (local_temp_filename_size < 1024) - local_temp_filename = (char *)xrealloc - (local_temp_filename, (local_temp_filename_size = 1024)); + (partial[1] == '/' || (partial[1] == '.' && partial[2] == '/'))) + { + if (local_temp_filename_size < 1024) + local_temp_filename = (char *)xrealloc + (local_temp_filename, (local_temp_filename_size = 1024)); #if defined (HAVE_GETCWD) - if (!getcwd (local_temp_filename, local_temp_filename_size)) + if (!getcwd (local_temp_filename, local_temp_filename_size)) #else /* !HAVE_GETCWD */ - if (!getwd (local_temp_filename)) + if (!getwd (local_temp_filename)) #endif /* !HAVE_GETCWD */ - { - filesys_error_number = errno; - return (partial); - } - - strcat (local_temp_filename, "/"); - strcat (local_temp_filename, partial); - return (local_temp_filename); - } + { + filesys_error_number = errno; + return (partial); + } + + strcat (local_temp_filename, "/"); + strcat (local_temp_filename, partial); + return (local_temp_filename); + } else - temp = info_file_in_path (partial, infopath); + temp = info_file_in_path (partial, infopath); if (temp) - { - remember_info_filename (partial, temp); - if (strlen (temp) > local_temp_filename_size) - local_temp_filename = (char *) xrealloc - (local_temp_filename, - (local_temp_filename_size = (50 + strlen (temp)))); - strcpy (local_temp_filename, temp); - free (temp); - return (local_temp_filename); - } + { + remember_info_filename (partial, temp); + if (strlen (temp) > local_temp_filename_size) + local_temp_filename = (char *) xrealloc + (local_temp_filename, + (local_temp_filename_size = (50 + strlen (temp)))); + strcpy (local_temp_filename, temp); + free (temp); + return (local_temp_filename); + } } return (partial); } @@ -183,25 +149,25 @@ info_file_in_path (filename, path) dirname_index = 0; - while (temp_dirname = extract_colon_unit (path, &dirname_index)) + while ((temp_dirname = extract_colon_unit (path, &dirname_index))) { register int i, pre_suffix_length; char *temp; /* Expand a leading tilde if one is present. */ if (*temp_dirname == '~') - { - char *expanded_dirname; + { + char *expanded_dirname; - expanded_dirname = tilde_expand_word (temp_dirname); - free (temp_dirname); - temp_dirname = expanded_dirname; - } + expanded_dirname = tilde_expand_word (temp_dirname); + free (temp_dirname); + temp_dirname = expanded_dirname; + } temp = (char *)xmalloc (30 + strlen (temp_dirname) + strlen (filename)); strcpy (temp, temp_dirname); if (temp[(strlen (temp)) - 1] != '/') - strcat (temp, "/"); + strcat (temp, "/"); strcat (temp, filename); pre_suffix_length = strlen (temp); @@ -209,54 +175,54 @@ info_file_in_path (filename, path) free (temp_dirname); for (i = 0; info_suffixes[i]; i++) - { - strcpy (temp + pre_suffix_length, info_suffixes[i]); - - statable = (stat (temp, &finfo) == 0); - - /* If we have found a regular file, then use that. Else, if we - have found a directory, look in that directory for this file. */ - if (statable) - { - if (S_ISREG (finfo.st_mode)) - { - return (temp); - } - else if (S_ISDIR (finfo.st_mode)) - { - char *newpath, *filename_only, *newtemp; - - newpath = strdup (temp); - filename_only = filename_non_directory (filename); - newtemp = info_file_in_path (filename_only, newpath); - - free (newpath); - if (newtemp) - { - free (temp); - return (newtemp); - } - } - } - else - { - /* Add various compression suffixes to the name to see if - the file is present in compressed format. */ - register int j, pre_compress_suffix_length; - - pre_compress_suffix_length = strlen (temp); - - for (j = 0; compress_suffixes[j].suffix; j++) - { - strcpy (temp + pre_compress_suffix_length, - compress_suffixes[j].suffix); - - statable = (stat (temp, &finfo) == 0); - if (statable && (S_ISREG (finfo.st_mode))) - return (temp); - } - } - } + { + strcpy (temp + pre_suffix_length, info_suffixes[i]); + + statable = (stat (temp, &finfo) == 0); + + /* If we have found a regular file, then use that. Else, if we + have found a directory, look in that directory for this file. */ + if (statable) + { + if (S_ISREG (finfo.st_mode)) + { + return (temp); + } + else if (S_ISDIR (finfo.st_mode)) + { + char *newpath, *filename_only, *newtemp; + + newpath = xstrdup (temp); + filename_only = filename_non_directory (filename); + newtemp = info_file_in_path (filename_only, newpath); + + free (newpath); + if (newtemp) + { + free (temp); + return (newtemp); + } + } + } + else + { + /* Add various compression suffixes to the name to see if + the file is present in compressed format. */ + register int j, pre_compress_suffix_length; + + pre_compress_suffix_length = strlen (temp); + + for (j = 0; compress_suffixes[j].suffix; j++) + { + strcpy (temp + pre_compress_suffix_length, + compress_suffixes[j].suffix); + + statable = (stat (temp, &finfo) == 0); + if (statable && (S_ISREG (finfo.st_mode))) + return (temp); + } + } + } free (temp); } return ((char *)NULL); @@ -290,7 +256,7 @@ extract_colon_unit (string, idx) strncpy (value, &string[start], (i - start)); value[i - start] = '\0'; if (string[i]) - ++i; + ++i; *idx = i; return (value); } @@ -317,10 +283,10 @@ lookup_info_filename (filename) { register int i; for (i = 0; names_and_files[i]; i++) - { - if (strcmp (names_and_files[i]->filename, filename) == 0) - return (names_and_files[i]->expansion); - } + { + if (strcmp (names_and_files[i]->filename, filename) == 0) + return (names_and_files[i]->expansion); + } } return (char *)NULL;; } @@ -340,12 +306,12 @@ remember_info_filename (filename, expansion) alloc_size = names_and_files_slots * sizeof (FILENAME_LIST *); names_and_files = - (FILENAME_LIST **) xrealloc (names_and_files, alloc_size); + (FILENAME_LIST **) xrealloc (names_and_files, alloc_size); } new = (FILENAME_LIST *)xmalloc (sizeof (FILENAME_LIST)); - new->filename = strdup (filename); - new->expansion = expansion ? strdup (expansion) : (char *)NULL; + new->filename = xstrdup (filename); + new->expansion = expansion ? xstrdup (expansion) : (char *)NULL; names_and_files[names_and_files_index++] = new; names_and_files[names_and_files_index] = (FILENAME_LIST *)NULL; @@ -357,7 +323,7 @@ maybe_initialize_infopath () if (!infopath_size) { infopath = (char *) - xmalloc (infopath_size = (1 + strlen (DEFAULT_INFOPATH))); + xmalloc (infopath_size = (1 + strlen (DEFAULT_INFOPATH))); strcpy (infopath, DEFAULT_INFOPATH); } @@ -392,7 +358,7 @@ info_add_path (path, where) } else if (where == INFOPATH_PREPEND) { - char *temp = strdup (infopath); + char *temp = xstrdup (infopath); strcpy (infopath, path); strcat (infopath, ":"); strcat (infopath, temp); @@ -436,21 +402,21 @@ filesys_read_info_file (pathname, filesize, finfo) /* If the file couldn't be opened, give up. */ if (descriptor < 0) - { - filesys_error_number = errno; - return ((char *)NULL); - } + { + filesys_error_number = errno; + return ((char *)NULL); + } /* Try to read the contents of this file. */ st_size = (long) finfo->st_size; contents = (char *)xmalloc (1 + st_size); if ((read (descriptor, contents, st_size)) != st_size) - { - filesys_error_number = errno; - close (descriptor); - free (contents); - return ((char *)NULL); - } + { + filesys_error_number = errno; + close (descriptor); + free (contents); + return ((char *)NULL); + } close (descriptor); @@ -510,20 +476,20 @@ filesys_read_compressed (pathname, filesize, finfo) chunk = (char *)xmalloc (FILESYS_PIPE_BUFFER_SIZE); while (1) - { - int bytes_read; + { + int bytes_read; - bytes_read = fread (chunk, 1, FILESYS_PIPE_BUFFER_SIZE, stream); + bytes_read = fread (chunk, 1, FILESYS_PIPE_BUFFER_SIZE, stream); - if (bytes_read + offset >= size) - contents = (char *)xrealloc - (contents, size += (2 * FILESYS_PIPE_BUFFER_SIZE)); + if (bytes_read + offset >= size) + contents = (char *)xrealloc + (contents, size += (2 * FILESYS_PIPE_BUFFER_SIZE)); - memcpy (contents + offset, chunk, bytes_read); - offset += bytes_read; - if (bytes_read != FILESYS_PIPE_BUFFER_SIZE) - break; - } + memcpy (contents + offset, chunk, bytes_read); + offset += bytes_read; + if (bytes_read != FILESYS_PIPE_BUFFER_SIZE) + break; + } free (chunk); pclose (stream); @@ -572,8 +538,8 @@ filesys_decompressor_for_file (filename) for (i = strlen (filename) - 1; i > 0; i--) if (filename[i] == '.') { - extension = filename + i; - break; + extension = filename + i; + break; } if (!extension) diff --git a/texinfo/info/filesys.h b/texinfo/info/filesys.h index 130a52a..440eb9b 100644 --- a/texinfo/info/filesys.h +++ b/texinfo/info/filesys.h @@ -1,9 +1,10 @@ -/* filesys.h -- External declarations of functions and vars in filesys.c. */ +/* filesys.h -- External declarations of functions and vars in filesys.c. + $Id: filesys.h,v 1.3 1997/07/15 18:39:08 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,8 +22,8 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_FILESYS_H_) -#define _FILESYS_H_ +#ifndef INFO_FILESYS_H +#define INFO_FILESYS_H /* The path on which we look for info files. You can initialize this from the environment variable INFOPATH if there is one, or you can @@ -70,7 +71,7 @@ extern char *extract_colon_unit (); /* The default value of INFOPATH. */ #if !defined (DEFAULT_INFOPATH) -! # define DEFAULT_INFOPATH "/usr/local/info:/usr/info:/usr/local/lib/info:/usr/lib/info:/usr/local/gnu/info:/usr/local/gnu/lib/info:/usr/gnu/info:/usr/gnu/lib/info:/opt/gnu/info:/usr/share/info:/usr/share/lib/info:/usr/local/share/info:/usr/local/share/lib/info:/usr/gnu/lib/emacs/info:/usr/local/gnu/lib/emacs/info:/usr/local/lib/emacs/info:/usr/local/emacs/info:." +# define DEFAULT_INFOPATH "/usr/local/info:/usr/info:/usr/local/lib/info:/usr/lib/info:/usr/local/gnu/info:/usr/local/gnu/lib/info:/usr/gnu/info:/usr/gnu/lib/info:/opt/gnu/info:/usr/share/info:/usr/share/lib/info:/usr/local/share/info:/usr/local/share/lib/info:/usr/gnu/lib/emacs/info:/usr/local/gnu/lib/emacs/info:/usr/local/lib/emacs/info:/usr/local/emacs/info:." #endif /* !DEFAULT_INFOPATH */ #if !defined (S_ISREG) && defined (S_IFREG) @@ -81,4 +82,4 @@ extern char *extract_colon_unit (); # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif /* !S_ISDIR && S_IFDIR */ -#endif /* !_FILESYS_H_ */ +#endif /* not INFO_FILESYS_H */ diff --git a/texinfo/info/footnotes.c b/texinfo/info/footnotes.c index 35a0f35..b646743 100644 --- a/texinfo/info/footnotes.c +++ b/texinfo/info/footnotes.c @@ -1,9 +1,7 @@ -/* footnotes.c -- Some functions for manipulating footnotes. */ +/* footnotes.c -- Some functions for manipulating footnotes. + $Id: footnotes.c,v 1.4 1997/07/24 21:23:33 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,7 +38,7 @@ find_footnotes_window () /* Try to find an existing window first. */ for (win = windows; win; win = win->next) if (internal_info_node_p (win->node) && - (strcmp (win->node->nodename, footnote_nodename) == 0)) + (strcmp (win->node->nodename, footnote_nodename) == 0)) break; return (win); @@ -72,37 +70,37 @@ make_footnotes_node (node) refs = info_xrefs_of_node (node); if (refs) - { - register int i; - char *refname; + { + register int i; + char *refname; - refname = (char *)xmalloc - (1 + strlen ("-Footnotes") + strlen (node->nodename)); + refname = (char *)xmalloc + (1 + strlen ("-Footnotes") + strlen (node->nodename)); - strcpy (refname, node->nodename); - strcat (refname, "-Footnotes"); + strcpy (refname, node->nodename); + strcat (refname, "-Footnotes"); - for (i = 0; refs[i]; i++) - if ((refs[i]->nodename != (char *)NULL) && - (strcmp (refs[i]->nodename, refname) == 0)) - { - char *filename; + for (i = 0; refs[i]; i++) + if ((refs[i]->nodename != (char *)NULL) && + (strcmp (refs[i]->nodename, refname) == 0)) + { + char *filename; - filename = node->parent; - if (!filename) - filename = node->filename; + filename = node->parent; + if (!filename) + filename = node->filename; - fn_node = info_get_node (filename, refname); + fn_node = info_get_node (filename, refname); - if (fn_node) - fn_start = 0; + if (fn_node) + fn_start = 0; - break; - } + break; + } - free (refname); - info_free_references (refs); - } + free (refname); + info_free_references (refs); + } } /* If we never found the start of a footnotes area, quit now. */ @@ -126,7 +124,7 @@ make_footnotes_node (node) This effectively skips either "---- footno...", or "File: foo...". */ while (text_start < fn_node->nodelen) if (fn_node->contents[text_start++] == '\n') - break; + break; result->nodelen = strlen (header) + fn_node->nodelen - text_start; @@ -134,7 +132,7 @@ make_footnotes_node (node) result->contents = (char *)xmalloc (1 + result->nodelen); sprintf (result->contents, "%s", header); memcpy (result->contents + strlen (header), - fn_node->contents + text_start, fn_node->nodelen - text_start); + fn_node->contents + text_start, fn_node->nodelen - text_start); name_internal_node (result, footnote_nodename); free (header); @@ -176,7 +174,7 @@ info_get_or_remove_footnotes (window) if (fn_win && !new_footnotes) { if (windows->next) - info_delete_window_internal (fn_win); + info_delete_window_internal (fn_win); } /* If there are footnotes for this window's node, but no window around @@ -187,27 +185,27 @@ info_get_or_remove_footnotes (window) WINDOW *last, *win; /* Always make this window be the last one appearing in the list. Find - the last window in the chain. */ + the last window in the chain. */ for (win = windows, last = windows; win; last = win, win = win->next); /* Try to split this window, and make the split window the one to - contain the footnotes. */ + contain the footnotes. */ old_active = active_window; active_window = last; fn_win = window_make_window (new_footnotes); active_window = old_active; if (!fn_win) - { - free (new_footnotes->contents); - free (new_footnotes); - - /* If we are hacking automatic footnotes, and there are footnotes - but we couldn't display them, print a message to that effect. */ - if (auto_footnotes_p) - inform_in_echo_area ("Footnotes could not be displayed"); - return (FN_UNABLE); - } + { + free (new_footnotes->contents); + free (new_footnotes); + + /* If we are hacking automatic footnotes, and there are footnotes + but we couldn't display them, print a message to that effect. */ + if (auto_footnotes_p) + inform_in_echo_area (_("Footnotes could not be displayed")); + return (FN_UNABLE); + } } /* If there are footnotes, and there is a window to display them, @@ -217,7 +215,7 @@ info_get_or_remove_footnotes (window) window_set_node_of_window (fn_win, new_footnotes); window_change_window_height - (fn_win, fn_win->line_count - fn_win->height); + (fn_win, fn_win->line_count - fn_win->height); remember_window_and_node (fn_win, new_footnotes); add_gcable_pointer (new_footnotes->contents); @@ -231,19 +229,17 @@ info_get_or_remove_footnotes (window) /* Show the footnotes associated with this node in another window. */ DECLARE_INFO_COMMAND (info_show_footnotes, - "Show the footnotes associated with this node in another window") + _("Show the footnotes associated with this node in another window")) { - int result; - /* A negative argument means just make the window go away. */ if (count < 0) { WINDOW *fn_win = find_footnotes_window (); /* If there is an old footnotes window, and it isn't the only window - on the screen, delete it. */ + on the screen, delete it. */ if (fn_win && windows->next) - info_delete_window_internal (fn_win); + info_delete_window_internal (fn_win); } else { @@ -252,14 +248,14 @@ DECLARE_INFO_COMMAND (info_show_footnotes, result = info_get_or_remove_footnotes (window); switch (result) - { - case FN_UNFOUND: - info_error (NO_FOOT_NODE); - break; - - case FN_UNABLE: - info_error (WIN_TOO_SMALL); - break; - } + { + case FN_UNFOUND: + info_error (NO_FOOT_NODE); + break; + + case FN_UNABLE: + info_error (WIN_TOO_SMALL); + break; + } } } diff --git a/texinfo/info/footnotes.h b/texinfo/info/footnotes.h index 89b1b35..3406bcb 100644 --- a/texinfo/info/footnotes.h +++ b/texinfo/info/footnotes.h @@ -1,9 +1,10 @@ -/* footnotes.h -- Some functions for manipulating footnotes. */ +/* footnotes.h -- Some functions for manipulating footnotes. + $Id: footnotes.h,v 1.3 1997/07/15 18:40:27 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,11 +22,11 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_FOOTNOTES_H_) -#define _FOOTNOTES_H_ +#ifndef INFO_FOOTNOTES_H +#define INFO_FOOTNOTES_H /* Magic string which indicates following text is footnotes. */ -#define FOOTNOTE_LABEL "---------- Footnotes ----------" +#define FOOTNOTE_LABEL _("---------- Footnotes ----------") #define FN_FOUND 0 #define FN_UNFOUND 1 @@ -42,5 +43,4 @@ extern int info_get_or_remove_footnotes (); /* Non-zero means attempt to show footnotes when displaying a new window. */ extern int auto_footnotes_p; -#endif /* !_FOOTNOTES_H_ */ - +#endif /* not INFO_FOOTNOTES_H */ diff --git a/texinfo/info/gc.c b/texinfo/info/gc.c index 3b9b090..1c868ba3 100644 --- a/texinfo/info/gc.c +++ b/texinfo/info/gc.c @@ -56,7 +56,7 @@ gc_pointers () if (!info_windows || !gcable_pointers_index) return; - for (i = 0; iw = info_windows[i]; i++) + for (i = 0; (iw = info_windows[i]); i++) { for (j = 0; j < iw->nodes_index; j++) { diff --git a/texinfo/info/gc.h b/texinfo/info/gc.h index 876062a..b4d993a 100644 --- a/texinfo/info/gc.h +++ b/texinfo/info/gc.h @@ -1,9 +1,10 @@ -/* gc.h -- Functions for garbage collecting unused node contents. */ +/* gc.h -- Functions for garbage collecting unused node contents. + $Id: gc.h,v 1.2 1997/07/15 18:41:53 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,8 +22,8 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_GC_H_) -#define _GC_H_ +#ifndef INFO_GC_H +#define INFO_GC_H /* Add POINTER to the list of garbage collectible pointers. A pointer is not actually garbage collected until no info window contains a node @@ -33,4 +34,4 @@ extern void add_gcable_pointer (); node->contents which are collectible, and free them. */ extern void gc_pointers (); -#endif /* !_GC_H_ */ +#endif /* not INFO_GC_H */ diff --git a/texinfo/info/indices.c b/texinfo/info/indices.c index 6848884..37e9b03 100644 --- a/texinfo/info/indices.c +++ b/texinfo/info/indices.c @@ -1,9 +1,7 @@ -/* indices.c -- Commands for dealing with an Info file Index. */ +/* indices.c -- Commands for dealing with an Info file Index. + $Id: indices.c,v 1.6 1997/07/24 21:25:53 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,9 +41,9 @@ static char *initial_index_nodename = (char *)NULL; /* A structure associating index names with index offset ranges. */ typedef struct { - char *name; /* The nodename of this index. */ - int first; /* The index in our list of the first entry. */ - int last; /* The index in our list of the last entry. */ + char *name; /* The nodename of this index. */ + int first; /* The index in our list of the first entry. */ + int last; /* The index in our list of the last entry. */ } INDEX_NAME_ASSOC; /* An array associating index nodenames with index offset ranges. */ @@ -65,7 +63,7 @@ add_index_to_index_nodenames (array, node) for (last = 0; array[last]; last++); assoc = (INDEX_NAME_ASSOC *)xmalloc (sizeof (INDEX_NAME_ASSOC)); - assoc->name = strdup (node->nodename); + assoc->name = xstrdup (node->nodename); if (!index_nodenames_index) { @@ -119,10 +117,10 @@ info_indices_of_file_buffer (file_buffer) if (index_nodenames) { for (i = 0; index_nodenames[i]; i++) - { - free (index_nodenames[i]->name); - free (index_nodenames[i]); - } + { + free (index_nodenames[i]->name); + free (index_nodenames[i]); + } index_nodenames_index = 0; index_nodenames[0] = (INDEX_NAME_ASSOC *)NULL; @@ -133,48 +131,59 @@ info_indices_of_file_buffer (file_buffer) { TAG *tag; - for (i = 0; tag = file_buffer->tags[i]; i++) - { - if (string_in_line ("Index", tag->nodename) != -1) - { - NODE *node; - REFERENCE **menu; - - /* Found one. Get its menu. */ - node = info_get_node (tag->filename, tag->nodename); - if (!node) - continue; - - /* Remember the filename and nodename of this index. */ - initial_index_filename = strdup (file_buffer->filename); - initial_index_nodename = strdup (tag->nodename); - - menu = info_menu_of_node (node); - - /* If we have a menu, add this index's nodename and range - to our list of index_nodenames. */ - if (menu) - { - add_index_to_index_nodenames (menu, node); - - /* Concatenate the references found so far. */ - result = info_concatenate_references (result, menu); - } - free (node); - } - } + for (i = 0; (tag = file_buffer->tags[i]); i++) + { + if (string_in_line ("Index", tag->nodename) != -1) + { + NODE *node; + REFERENCE **menu; + + /* Found one. Get its menu. */ + node = info_get_node (tag->filename, tag->nodename); + if (!node) + continue; + + /* Remember the filename and nodename of this index. */ + initial_index_filename = xstrdup (file_buffer->filename); + initial_index_nodename = xstrdup (tag->nodename); + + menu = info_menu_of_node (node); + + /* If we have a menu, add this index's nodename and range + to our list of index_nodenames. */ + if (menu) + { + add_index_to_index_nodenames (menu, node); + + /* Concatenate the references found so far. */ + result = info_concatenate_references (result, menu); + } + free (node); + } + } } /* If there is a result, clean it up so that every entry has a filename. */ for (i = 0; result && result[i]; i++) if (!result[i]->filename) - result[i]->filename = strdup (file_buffer->filename); + result[i]->filename = xstrdup (file_buffer->filename); return (result); } DECLARE_INFO_COMMAND (info_index_search, - "Look up a string in the index for this file") + _("Look up a string in the index for this file")) +{ + do_info_index_search (window, count, 0); +} + +/* Look up SEARCH_STRING in the index for this file. If SEARCH_STRING + is NULL, prompt user for input. */ +void +do_info_index_search (window, count, search_string) + WINDOW *window; + int count; + char *search_string; { FILE_BUFFER *fb; char *line; @@ -193,47 +202,52 @@ DECLARE_INFO_COMMAND (info_index_search, (strcmp (initial_index_filename, fb->filename) != 0)) { info_free_references (index_index); - window_message_in_echo_area ("Finding index entries..."); + window_message_in_echo_area (_("Finding index entries...")); index_index = info_indices_of_file_buffer (fb); } /* If there is no index, quit now. */ if (!index_index) { - info_error ("No indices found."); - return; - } - - /* Okay, there is an index. Let the user select one of the members of it. */ - line = - info_read_maybe_completing (window, "Index entry: ", index_index); - - window = active_window; - - /* User aborted? */ - if (!line) - { - info_abort_key (active_window, 1, 0); + info_error (_("No indices found.")); return; } - /* Empty line means move to the Index node. */ - if (!*line) + /* Okay, there is an index. Look for SEARCH_STRING, or, if it is + empty, prompt for one. */ + if (search_string && *search_string) + line = xstrdup (search_string); + else { - free (line); - - if (initial_index_filename && initial_index_nodename) - { - NODE *node; - - node = - info_get_node (initial_index_filename, initial_index_nodename); - set_remembered_pagetop_and_point (window); - window_set_node_of_window (window, node); - remember_window_and_node (window, node); - window_clear_echo_area (); - return; - } + line = info_read_maybe_completing (window, _("Index entry: "), + index_index); + window = active_window; + + /* User aborted? */ + if (!line) + { + info_abort_key (active_window, 1, 0); + return; + } + + /* Empty line means move to the Index node. */ + if (!*line) + { + free (line); + + if (initial_index_filename && initial_index_nodename) + { + NODE *node; + + node = info_get_node (initial_index_filename, + initial_index_nodename); + set_remembered_pagetop_and_point (window); + window_set_node_of_window (window, node); + remember_window_and_node (window, node); + window_clear_echo_area (); + return; + } + } } /* The user typed either a completed index label, or a partial string. @@ -246,9 +260,9 @@ DECLARE_INFO_COMMAND (info_index_search, /* Start the search right after/before this index. */ if (count < 0) { - register int i; - for (i = 0; index_index[i]; i++); - index_offset = i; + register int i; + for (i = 0; index_index[i]; i++); + index_offset = i; } else index_offset = -1; @@ -267,8 +281,55 @@ DECLARE_INFO_COMMAND (info_index_search, } } +int +index_entry_exists (window, string) + WINDOW *window; + char *string; +{ + register int i; + FILE_BUFFER *fb; + + /* If there is no previous search string, the user hasn't built an index + yet. */ + if (!string) + return 0; + + fb = file_buffer_of_window (window); + if (!initial_index_filename + || (strcmp (initial_index_filename, fb->filename) != 0)) + { + info_free_references (index_index); + index_index = info_indices_of_file_buffer (fb); + } + + /* If there is no index, that is an error. */ + if (!index_index) + return 0; + + for (i = 0; (i > -1) && (index_index[i]); i++) + if (strcmp (string, index_index[i]->label) == 0) + break; + + /* If that failed, look for the next substring match. */ + if ((i < 0) || (!index_index[i])) + { + for (i = 0; (i > -1) && (index_index[i]); i++) + if (string_in_line (string, index_index[i]->label) != -1) + break; + + if ((i > -1) && (index_index[i])) + string_in_line (string, index_index[i]->label); + } + + /* If that failed, return 0. */ + if ((i < 0) || (!index_index[i])) + return 0; + + return 1; +} + DECLARE_INFO_COMMAND (info_next_index_match, - "Go to the next matching index item from the last `\\[index-search]' command") + _("Go to the next matching index item from the last `\\[index-search]' command")) { register int i; int partial, dir; @@ -278,14 +339,14 @@ DECLARE_INFO_COMMAND (info_next_index_match, yet. */ if (!index_search) { - info_error ("No previous index search string."); + info_error (_("No previous index search string.")); return; } /* If there is no index, that is an error. */ if (!index_index) { - info_error ("No index entries."); + info_error (_("No index entries.")); return; } @@ -308,18 +369,18 @@ DECLARE_INFO_COMMAND (info_next_index_match, if ((i < 0) || (!index_index[i])) { for (i = index_offset + dir; (i > -1) && (index_index[i]); i += dir) - if (string_in_line (index_search, index_index[i]->label) != -1) - break; + if (string_in_line (index_search, index_index[i]->label) != -1) + break; if ((i > -1) && (index_index[i])) - partial = string_in_line (index_search, index_index[i]->label); + partial = string_in_line (index_search, index_index[i]->label); } /* If that failed, print an error. */ if ((i < 0) || (!index_index[i])) { - info_error ("No %sindex entries containing \"%s\".", - index_offset > 0 ? "more " : "", index_search); + info_error (_("No %sindex entries containing \"%s\"."), + index_offset > 0 ? _("more ") : "", index_search); return; } @@ -329,43 +390,43 @@ DECLARE_INFO_COMMAND (info_next_index_match, /* Report to the user on what we have found. */ { register int j; - char *name = "CAN'T SEE THIS"; + char *name = _("CAN'T SEE THIS"); char *match; for (j = 0; index_nodenames[j]; j++) { - if ((i >= index_nodenames[j]->first) && - (i <= index_nodenames[j]->last)) - { - name = index_nodenames[j]->name; - break; - } + if ((i >= index_nodenames[j]->first) && + (i <= index_nodenames[j]->last)) + { + name = index_nodenames[j]->name; + break; + } } /* If we had a partial match, indicate to the user which part of the string matched. */ - match = strdup (index_index[i]->label); + match = xstrdup (index_index[i]->label); if (partial && show_index_match) { - int j, ls, start, upper; + int j, ls, start, upper; - ls = strlen (index_search); - start = partial - ls; - upper = isupper (match[start]) ? 1 : 0; + ls = strlen (index_search); + start = partial - ls; + upper = isupper (match[start]) ? 1 : 0; - for (j = 0; j < ls; j++) - if (upper) - match[j + start] = info_tolower (match[j + start]); - else - match[j + start] = info_toupper (match[j + start]); + for (j = 0; j < ls; j++) + if (upper) + match[j + start] = info_tolower (match[j + start]); + else + match[j + start] = info_toupper (match[j + start]); } { char *format; format = replace_in_documentation - ("Found \"%s\" in %s. (`\\[next-index-match]' tries to find next.)"); + (_("Found \"%s\" in %s. (`\\[next-index-match]' tries to find next.)")); window_message_in_echo_area (format, match, name); } @@ -379,7 +440,7 @@ DECLARE_INFO_COMMAND (info_next_index_match, if (!node) { info_error (CANT_FILE_NODE, - index_index[i]->filename, index_index[i]->nodename); + index_index[i]->filename, index_index[i]->nodename); return; } @@ -397,16 +458,16 @@ DECLARE_INFO_COMMAND (info_next_index_match, if (loc != -1) { - window->point = loc; - window_adjust_pagetop (window); + window->point = loc; + window_adjust_pagetop (window); } } } /* **************************************************************** */ -/* */ -/* Info APROPOS: Search every known index. */ -/* */ +/* */ +/* Info APROPOS: Search every known index. */ +/* */ /* **************************************************************** */ /* For every menu item in DIR, search the indices of that file for @@ -420,14 +481,13 @@ apropos_in_all_indices (search_string, inform) REFERENCE **all_indices = (REFERENCE **)NULL; REFERENCE **dir_menu = (REFERENCE **)NULL; NODE *dir_node; - int printed = 0; dir_node = info_get_node ("dir", "Top"); if (dir_node) dir_menu = info_menu_of_node (dir_node); if (!dir_menu) - return; + return NULL; /* For every menu item in DIR, get the associated node's file buffer and read the indices of that file buffer. Gather all of the indices into @@ -441,54 +501,54 @@ apropos_in_all_indices (search_string, inform) this_item = dir_menu[dir_index]; if (!this_item->filename) - { - if (dir_node->parent) - this_item->filename = strdup (dir_node->parent); - else - this_item->filename = strdup (dir_node->filename); - } + { + if (dir_node->parent) + this_item->filename = xstrdup (dir_node->parent); + else + this_item->filename = xstrdup (dir_node->filename); + } /* Find this node. If we cannot find it, try using the label of the - entry as a file (i.e., "(LABEL)Top"). */ + entry as a file (i.e., "(LABEL)Top"). */ this_node = info_get_node (this_item->filename, this_item->nodename); if (!this_node && this_item->nodename && - (strcmp (this_item->label, this_item->nodename) == 0)) - this_node = info_get_node (this_item->label, "Top"); + (strcmp (this_item->label, this_item->nodename) == 0)) + this_node = info_get_node (this_item->label, "Top"); if (!this_node) - continue; + continue; /* Get the file buffer associated with this node. */ { - char *files_name; + char *files_name; - files_name = this_node->parent; - if (!files_name) - files_name = this_node->filename; + files_name = this_node->parent; + if (!files_name) + files_name = this_node->filename; - this_fb = info_find_file (files_name); + this_fb = info_find_file (files_name); - if (this_fb && inform) - message_in_echo_area ("Scanning indices of \"%s\"...", files_name); + if (this_fb && inform) + message_in_echo_area (_("Scanning indices of \"%s\"..."), files_name); - this_index = info_indices_of_file_buffer (this_fb); - free (this_node); + this_index = info_indices_of_file_buffer (this_fb); + free (this_node); - if (this_fb && inform) - unmessage_in_echo_area (); + if (this_fb && inform) + unmessage_in_echo_area (); } if (this_index) - { - /* Remember the filename which contains this set of references. */ - for (i = 0; this_index && this_index[i]; i++) - if (!this_index[i]->filename) - this_index[i]->filename = strdup (this_fb->filename); - - /* Concatenate with the other indices. */ - all_indices = info_concatenate_references (all_indices, this_index); - } + { + /* Remember the filename which contains this set of references. */ + for (i = 0; this_index && this_index[i]; i++) + if (!this_index[i]->filename) + this_index[i]->filename = xstrdup (this_fb->filename); + + /* Concatenate with the other indices. */ + all_indices = info_concatenate_references (all_indices, this_index); + } } info_free_references (dir_menu); @@ -501,21 +561,21 @@ apropos_in_all_indices (search_string, inform) int apropos_list_slots = 0; for (i = 0; (entry = all_indices[i]); i++) - { - if (string_in_line (search_string, entry->label) != -1) - { - add_pointer_to_array - (entry, apropos_list_index, apropos_list, apropos_list_slots, - 100, REFERENCE *); - } - else - { - maybe_free (entry->label); - maybe_free (entry->filename); - maybe_free (entry->nodename); - free (entry); - } - } + { + if (string_in_line (search_string, entry->label) != -1) + { + add_pointer_to_array + (entry, apropos_list_index, apropos_list, apropos_list_slots, + 100, REFERENCE *); + } + else + { + maybe_free (entry->label); + maybe_free (entry->filename); + maybe_free (entry->nodename); + free (entry); + } + } free (all_indices); all_indices = apropos_list; @@ -524,7 +584,7 @@ apropos_in_all_indices (search_string, inform) } #define APROPOS_NONE \ - "No available info files reference \"%s\" in their indices." + _("No available info files reference \"%s\" in their indices.") void info_apropos (string) @@ -544,8 +604,8 @@ info_apropos (string) REFERENCE *entry; for (i = 0; (entry = apropos_list[i]); i++) - fprintf (stderr, "\"(%s)%s\" -- %s\n", - entry->filename, entry->nodename, entry->label); + fprintf (stderr, "\"(%s)%s\" -- %s\n", + entry->filename, entry->nodename, entry->label); } info_free_references (apropos_list); } @@ -553,11 +613,11 @@ info_apropos (string) static char *apropos_list_nodename = "*Apropos*"; DECLARE_INFO_COMMAND (info_index_apropos, - "Grovel all known info file's indices for a string and build a menu") + _("Grovel all known info file's indices for a string and build a menu")) { char *line; - line = info_read_in_echo_area (window, "Index apropos: "); + line = info_read_in_echo_area (window, _("Index apropos: ")); window = active_window; @@ -577,85 +637,85 @@ DECLARE_INFO_COMMAND (info_index_apropos, apropos_list = apropos_in_all_indices (line, 1); if (!apropos_list) - { - info_error (APROPOS_NONE, line); - } + { + info_error (APROPOS_NONE, line); + } else - { - register int i; - char *line_buffer; - - initialize_message_buffer (); - printf_to_message_buffer - ("\n* Menu: Nodes whoses indices contain \"%s\":\n", line); - line_buffer = (char *)xmalloc (500); - - for (i = 0; apropos_list[i]; i++) - { - int len; - sprintf (line_buffer, "* (%s)%s::", - apropos_list[i]->filename, apropos_list[i]->nodename); - len = pad_to (36, line_buffer); - sprintf (line_buffer + len, "%s", apropos_list[i]->label); - printf_to_message_buffer ("%s\n", line_buffer); - } - free (line_buffer); - } + { + register int i; + char *line_buffer; + + initialize_message_buffer (); + printf_to_message_buffer + (_("\n* Menu: Nodes whoses indices contain \"%s\":\n"), line); + line_buffer = (char *)xmalloc (500); + + for (i = 0; apropos_list[i]; i++) + { + int len; + sprintf (line_buffer, "* (%s)%s::", + apropos_list[i]->filename, apropos_list[i]->nodename); + len = pad_to (36, line_buffer); + sprintf (line_buffer + len, "%s", apropos_list[i]->label); + printf_to_message_buffer ("%s\n", line_buffer); + } + free (line_buffer); + } apropos_node = message_buffer_to_node (); add_gcable_pointer (apropos_node->contents); name_internal_node (apropos_node, apropos_list_nodename); /* Even though this is an internal node, we don't want the window - system to treat it specially. So we turn off the internalness - of it here. */ + system to treat it specially. So we turn off the internalness + of it here. */ apropos_node->flags &= ~N_IsInternal; /* Find/Create a window to contain this node. */ { - WINDOW *new; - NODE *node; - - set_remembered_pagetop_and_point (window); - - /* If a window is visible and showing an apropos list already, - re-use it. */ - for (new = windows; new; new = new->next) - { - node = new->node; - - if (internal_info_node_p (node) && - (strcmp (node->nodename, apropos_list_nodename) == 0)) - break; - } - - /* If we couldn't find an existing window, try to use the next window - in the chain. */ - if (!new && window->next) - new = window->next; - - /* If we still don't have a window, make a new one to contain - the list. */ - if (!new) - { - WINDOW *old_active; - - old_active = active_window; - active_window = window; - new = window_make_window ((NODE *)NULL); - active_window = old_active; - } - - /* If we couldn't make a new window, use this one. */ - if (!new) - new = window; - - /* Lines do not wrap in this window. */ - new->flags |= W_NoWrap; - - window_set_node_of_window (new, apropos_node); - remember_window_and_node (new, apropos_node); - active_window = new; + WINDOW *new; + NODE *node; + + set_remembered_pagetop_and_point (window); + + /* If a window is visible and showing an apropos list already, + re-use it. */ + for (new = windows; new; new = new->next) + { + node = new->node; + + if (internal_info_node_p (node) && + (strcmp (node->nodename, apropos_list_nodename) == 0)) + break; + } + + /* If we couldn't find an existing window, try to use the next window + in the chain. */ + if (!new && window->next) + new = window->next; + + /* If we still don't have a window, make a new one to contain + the list. */ + if (!new) + { + WINDOW *old_active; + + old_active = active_window; + active_window = window; + new = window_make_window ((NODE *)NULL); + active_window = old_active; + } + + /* If we couldn't make a new window, use this one. */ + if (!new) + new = window; + + /* Lines do not wrap in this window. */ + new->flags |= W_NoWrap; + + window_set_node_of_window (new, apropos_node); + remember_window_and_node (new, apropos_node); + active_window = new; } info_free_references (apropos_list); } diff --git a/texinfo/info/indices.h b/texinfo/info/indices.h index 265b147..8b8a707 100644 --- a/texinfo/info/indices.h +++ b/texinfo/info/indices.h @@ -1,9 +1,10 @@ -/* indices.h -- Functions defined in indices.c. */ +/* indices.h -- Functions defined in indices.c. + $Id: indices.h,v 1.2 1997/07/06 20:50:29 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,8 +22,8 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_INDICES_H_) -#define _INDICES_H_ +#ifndef INFO_INDICES_H +#define INFO_INDICES_H /* User-visible variable controls the output of info-index-next. */ extern int show_index_match; @@ -35,5 +36,7 @@ REFERENCE **apropos_in_all_indices (); /* User visible functions declared in indices.c. */ extern void info_index_search (), info_next_index_match (); +extern void do_info_index_search (); +extern int index_intry_exists (); -#endif /* !_INDICES_H_ */ +#endif /* not INFO_INDICES_H */ diff --git a/texinfo/info/info-utils.c b/texinfo/info/info-utils.c index 6af3dd0..d9ab9a0 100644 --- a/texinfo/info/info-utils.c +++ b/texinfo/info/info-utils.c @@ -21,15 +21,8 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#include <stdio.h> /* For "NULL". Yechhh! */ -#include <ctype.h> -#include <sys/types.h> -#include <sys/stat.h> -#if defined (HAVE_STRING_H) -# include <string.h> -#endif /* HAVE_STRING_H */ +#include "info.h" #include "info-utils.h" - #if defined (HANDLE_MAN_PAGES) # include "man.h" #endif /* HANDLE_MAN_PAGES */ @@ -84,7 +77,7 @@ info_parse_node (string, newlines_okay) /* Find the closing paren. */ while (string[i] && string[i] != ')') - i++; + i++; /* Remember parsed filename. */ saven_filename (string, i); @@ -93,7 +86,7 @@ info_parse_node (string, newlines_okay) string += i; if (*string) - string++; + string++; } /* Parse out nodename. */ @@ -136,9 +129,9 @@ info_parse_label (label, node) } /* **************************************************************** */ -/* */ -/* Finding and Building Menus */ -/* */ +/* */ +/* Finding and Building Menus */ +/* */ /* **************************************************************** */ /* Return a NULL terminated array of REFERENCE * which represents the menu @@ -246,23 +239,23 @@ info_references_internal (label, binding) offset = string_in_line (":", refdef); /* When searching for menu items, if no colon, there is no - menu item on this line. */ + menu item on this line. */ if (offset == -1) - { - if (searching_for_menu_items) - continue; - else - { - int temp; - - temp = skip_line (refdef); - offset = string_in_line (":", refdef + temp); - if (offset == -1) - continue; /* Give up? */ - else - offset += temp; - } - } + { + if (searching_for_menu_items) + continue; + else + { + int temp; + + temp = skip_line (refdef); + offset = string_in_line (":", refdef + temp); + if (offset == -1) + continue; /* Give up? */ + else + offset += temp; + } + } entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); entry->filename = (char *)NULL; @@ -277,32 +270,32 @@ info_references_internal (label, binding) entry->end = refdef - binding->buffer; /* If this reference entry continues with another ':' then the - nodename is the same as the label. */ + nodename is the same as the label. */ if (*refdef == ':') - { - entry->nodename = strdup (entry->label); - } + { + entry->nodename = xstrdup (entry->label); + } else - { - /* This entry continues with a specific nodename. Parse the - nodename from the specification. */ + { + /* This entry continues with a specific nodename. Parse the + nodename from the specification. */ - refdef += skip_whitespace_and_newlines (refdef); + refdef += skip_whitespace_and_newlines (refdef); - if (searching_for_menu_items) - info_parse_node (refdef, DONT_SKIP_NEWLINES); - else - info_parse_node (refdef, SKIP_NEWLINES); + if (searching_for_menu_items) + info_parse_node (refdef, DONT_SKIP_NEWLINES); + else + info_parse_node (refdef, SKIP_NEWLINES); - if (info_parsed_filename) - entry->filename = strdup (info_parsed_filename); + if (info_parsed_filename) + entry->filename = xstrdup (info_parsed_filename); - if (info_parsed_nodename) - entry->nodename = strdup (info_parsed_nodename); - } + if (info_parsed_nodename) + entry->nodename = xstrdup (info_parsed_nodename); + } add_pointer_to_array - (entry, refs_index, refs, refs_slots, 50, REFERENCE *); + (entry, refs_index, refs, refs_slots, 50, REFERENCE *); } return (refs); } @@ -320,7 +313,7 @@ info_get_labeled_reference (label, references) for (i = 0; references && (entry = references[i]); i++) { if (strcmp (label, entry->label) == 0) - return (entry); + return (entry); } return ((REFERENCE *)NULL); } @@ -375,13 +368,13 @@ info_free_references (references) if (references) { for (i = 0; references && (entry = references[i]); i++) - { - maybe_free (entry->label); - maybe_free (entry->filename); - maybe_free (entry->nodename); + { + maybe_free (entry->label); + maybe_free (entry->filename); + maybe_free (entry->nodename); - free (entry); - } + free (entry); + } free (references); } @@ -411,24 +404,24 @@ canonicalize_whitespace (string) for (i = 0, j = 0; string[i]; i++) { if (whitespace_or_newline (string[i])) - { - whitespace_found++; - whitespace_loc = i; - continue; - } + { + whitespace_found++; + whitespace_loc = i; + continue; + } else - { - if (whitespace_found && whitespace_loc) - { - whitespace_found = 0; - - /* Suppress whitespace at start of string. */ - if (j) - temp[j++] = ' '; - } - - temp[j++] = string[i]; - } + { + if (whitespace_found && whitespace_loc) + { + whitespace_found = 0; + + /* Suppress whitespace at start of string. */ + if (j) + temp[j++] = ' '; + } + + temp[j++] = string[i]; + } } /* Kill trailing whitespace. */ @@ -466,26 +459,26 @@ printed_representation (character, hpos) else if (iscntrl (character)) { switch (character) - { - case '\r': - case '\n': - the_rep[i++] = character; - break; - - case '\t': - { - int tw; - - tw = ((hpos + 8) & 0xf8) - hpos; - while (i < tw) - the_rep[i++] = ' '; - } - break; - - default: - the_rep[i++] = '^'; - the_rep[i++] = (character | 0x40); - } + { + case '\r': + case '\n': + the_rep[i++] = character; + break; + + case '\t': + { + int tw; + + tw = ((hpos + 8) & 0xf8) - hpos; + while (i < tw) + the_rep[i++] = ' '; + } + break; + + default: + the_rep[i++] = '^'; + the_rep[i++] = (character | 0x40); + } } else if (character > printable_limit) { @@ -502,9 +495,9 @@ printed_representation (character, hpos) /* **************************************************************** */ -/* */ -/* Functions Static To This File */ -/* */ +/* */ +/* Functions Static To This File */ +/* */ /* **************************************************************** */ /* Amount of space allocated to INFO_PARSED_FILENAME via xmalloc (). */ @@ -531,7 +524,7 @@ saven_filename (filename, len) int len; { saven_string (filename, len, - &info_parsed_filename, &parsed_filename_size); + &info_parsed_filename, &parsed_filename_size); } /* Remember NODENAME in PARSED_NODENAME. An empty NODENAME is translated @@ -550,7 +543,7 @@ saven_nodename (nodename, len) int len; { saven_string (nodename, len, - &info_parsed_nodename, &parsed_nodename_size); + &info_parsed_nodename, &parsed_nodename_size); } /* Remember STRING in STRING_P. STRING_P should currently have STRING_SIZE_P @@ -565,7 +558,7 @@ save_string (string, string_p, string_size_p) if (!string || !*string) { if (*string_p) - free (*string_p); + free (*string_p); *string_p = (char *)NULL; *string_size_p = 0; @@ -573,8 +566,8 @@ save_string (string, string_p, string_size_p) else { if (strlen (string) >= *string_size_p) - *string_p = (char *)xrealloc - (*string_p, (*string_size_p = 1 + strlen (string))); + *string_p = (char *)xrealloc + (*string_p, (*string_size_p = 1 + strlen (string))); strcpy (*string_p, string); } @@ -591,7 +584,7 @@ saven_string (string, len, string_p, string_size_p) if (!string) { if (*string_p) - free (*string_p); + free (*string_p); *string_p = (char *)NULL; *string_size_p = 0; @@ -599,7 +592,7 @@ saven_string (string, len, string_p, string_size_p) else { if (len >= *string_size_p) - *string_p = (char *)xrealloc (*string_p, (*string_size_p = 1 + len)); + *string_p = (char *)xrealloc (*string_p, (*string_size_p = 1 + len)); strncpy (*string_p, string, len); (*string_p)[len] = '\0'; @@ -665,7 +658,7 @@ get_internal_info_window (name) for (win = windows; win; win = win->next) if (internal_info_node_p (win->node) && - (strcmp (win->node->nodename, name) == 0)) + (strcmp (win->node->nodename, name) == 0)) break; return (win); diff --git a/texinfo/info/info-utils.h b/texinfo/info/info-utils.h index 9f17a39..879587c 100644 --- a/texinfo/info/info-utils.h +++ b/texinfo/info/info-utils.h @@ -1,5 +1,5 @@ /* info-utils.h -- Exported functions and variables from info-util.c. - $Id: info-utils.h,v 1.1 1997/08/21 22:58:02 jason Exp $ + $Id: info-utils.h,v 1.3 1997/07/15 18:42:20 karl Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. @@ -22,8 +22,8 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_INFO_UTILS_H_) -#define _INFO_UTILS_H_ +#ifndef INFO_UTILS_H +#define INFO_UTILS_H #if !defined (HAVE_STRCHR) # undef strchr @@ -40,10 +40,10 @@ cross reference. Arrays of such references can be built by calling info_menus_of_node () or info_xrefs_of_node (). */ typedef struct { - char *label; /* User Label. */ - char *filename; /* File where this node can be found. */ - char *nodename; /* Name of the node. */ - int start, end; /* Offsets within the containing node of LABEL. */ + char *label; /* User Label. */ + char *filename; /* File where this node can be found. */ + char *nodename; /* Name of the node. */ + int start, end; /* Offsets within the containing node of LABEL. */ } REFERENCE; /* When non-zero, various display and input functions handle ISO Latin @@ -137,4 +137,4 @@ extern void info_parse_label (/* label, node */); info_parse_label (INFO_ALTPREV_LABEL, n); \ } while (0) -#endif /* !_INFO_UTILS_H_ */ +#endif /* not INFO_UTILS_H */ diff --git a/texinfo/info/info.c b/texinfo/info/info.c index 223df55..9b46edf 100644 --- a/texinfo/info/info.c +++ b/texinfo/info/info.c @@ -1,9 +1,7 @@ -/* info.c -- Display nodes of Info files in multiple windows. */ +/* info.c -- Display nodes of Info files in multiple windows. + $Id: info.c,v 1.10 1997/07/30 15:21:44 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993, 96 Free Software Foundation, Inc. + Copyright (C) 1993, 96, 97 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 @@ -22,6 +20,7 @@ Written by Brian Fox (bfox@ai.mit.edu). */ #include "info.h" +#include "indices.h" #include "dribble.h" #include "getopt.h" #if defined (HANDLE_MAN_PAGES) @@ -30,7 +29,7 @@ /* The version numbers of this version of Info. */ int info_major_version = 2; -int info_minor_version = 16; +int info_minor_version = 17; int info_patch_level = 0; /* Non-zero means search all indices for APROPOS_SEARCH_STRING. */ @@ -39,6 +38,14 @@ static int apropos_p = 0; /* Variable containing the string to search for when apropos_p is non-zero. */ static char *apropos_search_string = (char *)NULL; +/* Non-zero means search all indices for INDEX_SEARCH_STRING. Unlike + apropos, this puts the user at the node, running info. */ +static int index_search_p = 0; + +/* Variable containing the string to search for when index_search_p is + non-zero. */ +static char *index_search_string = (char *)NULL; + /* Non-zero means print version info only. */ static int print_version_p = 0; @@ -70,6 +77,7 @@ int dump_subnodes = 0; #define APROPOS_OPTION 1 #define DRIBBLE_OPTION 2 #define RESTORE_OPTION 3 +#define IDXSRCH_OPTION 4 static struct option long_options[] = { { "apropos", 1, 0, APROPOS_OPTION }, { "directory", 1, 0, 'd' }, @@ -81,6 +89,7 @@ static struct option long_options[] = { { "version", 0, &print_version_p, 1 }, { "dribble", 1, 0, DRIBBLE_OPTION }, { "restore", 1, 0, RESTORE_OPTION }, + { "index-search", 1, 0, IDXSRCH_OPTION }, {NULL, 0, NULL, 0} }; @@ -95,9 +104,9 @@ static void usage (), info_short_help (), remember_info_program_name (); /* **************************************************************** */ -/* */ -/* Main Entry Point to the Info Program */ -/* */ +/* */ +/* Main Entry Point to the Info Program */ +/* */ /* **************************************************************** */ int @@ -105,85 +114,101 @@ main (argc, argv) int argc; char **argv; { - int getopt_long_index; /* Index returned by getopt_long (). */ - NODE *initial_node; /* First node loaded by Info. */ + int getopt_long_index; /* Index returned by getopt_long (). */ + NODE *initial_node; /* First node loaded by Info. */ remember_info_program_name (argv[0]); +#ifdef HAVE_SETLOCALE + /* Set locale via LC_ALL. */ + setlocale (LC_ALL, ""); +#endif + + /* Set the text message domain. */ + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + while (1) { int option_character; option_character = getopt_long - (argc, argv, short_options, long_options, &getopt_long_index); + (argc, argv, short_options, long_options, &getopt_long_index); /* getopt_long () returns EOF when there are no more long options. */ if (option_character == EOF) - break; + break; /* If this is a long option, then get the short version of it. */ if (option_character == 0 && long_options[getopt_long_index].flag == 0) - option_character = long_options[getopt_long_index].val; + option_character = long_options[getopt_long_index].val; /* Case on the option that we have received. */ switch (option_character) - { - case 0: - break; - - /* User wants to add a directory. */ - case 'd': - info_add_path (optarg, INFOPATH_PREPEND); - break; - - /* User is specifying a particular node. */ - case 'n': - add_pointer_to_array (optarg, user_nodenames_index, user_nodenames, - user_nodenames_slots, 10, char *); - break; - - /* User is specifying a particular Info file. */ - case 'f': - if (user_filename) - free (user_filename); - - user_filename = strdup (optarg); - break; - - /* User is specifying the name of a file to output to. */ - case 'o': - if (user_output_filename) - free (user_output_filename); - user_output_filename = strdup (optarg); - break; - - /* User is specifying that she wishes to dump the subnodes of - the node that she is dumping. */ - case 's': - dump_subnodes = 1; - break; - - /* User has specified a string to search all indices for. */ - case APROPOS_OPTION: - apropos_p = 1; - maybe_free (apropos_search_string); - apropos_search_string = strdup (optarg); - break; - - /* User has specified a dribble file to receive keystrokes. */ - case DRIBBLE_OPTION: - close_dribble_file (); - open_dribble_file (optarg); - break; - - /* User has specified an alternate input stream. */ - case RESTORE_OPTION: - info_set_input_from_file (optarg); - break; - - default: - usage (); - } + { + case 0: + break; + + /* User wants to add a directory. */ + case 'd': + info_add_path (optarg, INFOPATH_PREPEND); + break; + + /* User is specifying a particular node. */ + case 'n': + add_pointer_to_array (optarg, user_nodenames_index, user_nodenames, + user_nodenames_slots, 10, char *); + break; + + /* User is specifying a particular Info file. */ + case 'f': + if (user_filename) + free (user_filename); + + user_filename = xstrdup (optarg); + break; + + /* User is specifying the name of a file to output to. */ + case 'o': + if (user_output_filename) + free (user_output_filename); + user_output_filename = xstrdup (optarg); + break; + + /* User is specifying that she wishes to dump the subnodes of + the node that she is dumping. */ + case 's': + dump_subnodes = 1; + break; + + /* User has specified a string to search all indices for. */ + case APROPOS_OPTION: + apropos_p = 1; + maybe_free (apropos_search_string); + apropos_search_string = xstrdup (optarg); + break; + + /* User has specified a dribble file to receive keystrokes. */ + case DRIBBLE_OPTION: + close_dribble_file (); + open_dribble_file (optarg); + break; + + /* User has specified an alternate input stream. */ + case RESTORE_OPTION: + info_set_input_from_file (optarg); + break; + + /* User has specified a string to search all indices for. */ + case IDXSRCH_OPTION: + index_search_p = 1; + maybe_free (index_search_string); + index_search_string = xstrdup (optarg); + break; + + default: + usage (); + } } /* If the output device is not a terminal, and no output filename has been @@ -191,15 +216,15 @@ main (argc, argv) to stdout, and turn on the dumping of subnodes. */ if ((!isatty (fileno (stdout))) && (user_output_filename == (char *)NULL)) { - user_output_filename = strdup ("-"); + user_output_filename = xstrdup ("-"); dump_subnodes = 1; } /* If the user specified --version, then show the version and exit. */ if (print_version_p) { - printf ("GNU Info (Texinfo 3.9) %s\n", version_string ()); - puts ("Copyright (C) 1996 Free Software Foundation, Inc.\n\ + printf ("info (GNU %s %s) %s\n", PACKAGE, VERSION, version_string ()); + puts ("Copyright (C) 1997 Free Software Foundation, Inc.\n\ There is NO warranty. You may redistribute this software\n\ under the terms of the GNU General Public License.\n\ For more information about these matters, see the files named COPYING."); @@ -213,34 +238,38 @@ For more information about these matters, see the files named COPYING."); exit (0); } - /* If the user hasn't specified a path for Info files, default that path - now. */ + /* If the user hasn't specified a path for Info files, default it. */ if (!infopath) { - char *path_from_env, *getenv (); - - path_from_env = getenv ("INFOPATH"); + char *path_from_env = getenv ("INFOPATH"); if (path_from_env) - info_add_path (path_from_env, INFOPATH_PREPEND); + { + unsigned len = strlen (path_from_env); + /* Trailing : on INFOPATH means insert the default path. */ + if (len && path_from_env[len - 1] == ':') + { + path_from_env[len - 1] = 0; + info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND); + } + info_add_path (path_from_env, INFOPATH_PREPEND); + } else - info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND); + info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND); } /* If the user specified a particular filename, add the path of that file to the contents of INFOPATH. */ if (user_filename) { - char *directory_name, *temp; - - directory_name = strdup (user_filename); - temp = filename_non_directory (directory_name); + char *directory_name = xstrdup (user_filename); + char *temp = filename_non_directory (directory_name); if (temp != directory_name) - { - *temp = 0; - info_add_path (directory_name, INFOPATH_PREPEND); - } + { + *temp = 0; + info_add_path (directory_name, INFOPATH_PREPEND); + } free (directory_name); } @@ -255,39 +284,74 @@ For more information about these matters, see the files named COPYING."); /* Get the initial Info node. It is either "(dir)Top", or what the user specifed with values in user_filename and user_nodenames. */ - if (user_nodenames) - initial_node = info_get_node (user_filename, user_nodenames[0]); - else - initial_node = info_get_node (user_filename, (char *)NULL); + initial_node = info_get_node (user_filename, + user_nodenames ? user_nodenames[0] : NULL); /* If we couldn't get the initial node, this user is in trouble. */ if (!initial_node) { if (info_recent_file_error) - info_error (info_recent_file_error); + info_error (info_recent_file_error); else - info_error - (CANT_FIND_NODE, user_nodenames ? user_nodenames[0] : "Top"); + info_error + (CANT_FIND_NODE, user_nodenames ? user_nodenames[0] : "Top"); exit (1); } - /* Special cases for when the user specifies multiple nodes. If we are - dumping to an output file, dump all of the nodes specified. Otherwise, - attempt to create enough windows to handle the nodes that this user wants - displayed. */ + /* Special cases for when the user specifies multiple nodes. If we + are dumping to an output file, dump all of the nodes specified. + Otherwise, attempt to create enough windows to handle the nodes + that this user wants displayed. */ if (user_nodenames_index > 1) { free (initial_node); if (user_output_filename) - dump_nodes_to_file - (user_filename, user_nodenames, user_output_filename, dump_subnodes); + dump_nodes_to_file + (user_filename, user_nodenames, user_output_filename, dump_subnodes); else - begin_multiple_window_info_session (user_filename, user_nodenames); + begin_multiple_window_info_session (user_filename, user_nodenames); exit (0); } + /* If the user specified `--index-search=STRING', start the info + session in the node corresponding to the first match. */ + if (index_search_p) + { + int status = 0; + + initialize_info_session (initial_node, 0); + + if (index_entry_exists (windows, index_search_string)) + { + terminal_clear_screen (); + terminal_prep_terminal (); + display_update_display (windows); + info_last_executed_command = (VFunction *)NULL; + + do_info_index_search (windows, 0, index_search_string); + + info_read_and_dispatch (); + + terminal_unprep_terminal (); + + /* On program exit, leave the cursor at the bottom of the + window, and restore the terminal IO. */ + terminal_goto_xy (0, screenheight - 1); + terminal_clear_to_eol (); + fflush (stdout); + } + else + { + fputs (_("no entries found\n"), stderr); + status = 2; + } + + close_dribble_file (); + exit (status); + } + /* If there are arguments remaining, they are the names of menu items in sequential info files starting from the first one loaded. That file name is either "dir", or the contents of user_filename if one @@ -303,134 +367,134 @@ For more information about these matters, see the files named COPYING."); /* Remember the name of the menu entry we want. */ arg = argv[optind++]; - if (first_arg == (char *)NULL) - first_arg = arg; + if (!first_arg) + first_arg = arg; /* Build and return a list of the menu items in this node. */ menu = info_menu_of_node (initial_node); /* If there wasn't a menu item in this node, stop here, but let - the user continue to use Info. Perhaps they wanted this node - and didn't realize it. */ + the user continue to use Info. Perhaps they wanted this node + and didn't realize it. */ if (!menu) - { + { #if defined (HANDLE_MAN_PAGES) - if (first_arg == arg) - { - node = make_manpage_node (first_arg); - if (node) - goto maybe_got_node; - } + if (first_arg == arg) + { + node = make_manpage_node (first_arg); + if (node) + goto maybe_got_node; + } #endif /* HANDLE_MAN_PAGES */ - begin_info_session_with_error - (initial_node, "There is no menu in this node."); - exit (0); - } + begin_info_session_with_error + (initial_node, _("There is no menu in this node.")); + exit (0); + } /* Find the specified menu item. */ entry = info_get_labeled_reference (arg, menu); /* If the item wasn't found, search the list sloppily. Perhaps this - user typed "buffer" when they really meant "Buffers". */ + user typed "buffer" when they really meant "Buffers". */ if (!entry) - { - register int i; - int best_guess = -1; - - for (i = 0; entry = menu[i]; i++) - { - if (strcasecmp (entry->label, arg) == 0) - break; - else - if (strncasecmp (entry->label, arg, strlen (arg)) == 0) - best_guess = i; - } - - if (!entry && best_guess != -1) - entry = menu[best_guess]; - } + { + register int i; + int best_guess = -1; + + for (i = 0; (entry = menu[i]); i++) + { + if (strcasecmp (entry->label, arg) == 0) + break; + else + if (strncasecmp (entry->label, arg, strlen (arg)) == 0) + best_guess = i; + } + + if (!entry && best_guess != -1) + entry = menu[best_guess]; + } /* If we failed to find the reference, start Info with the current - node anyway. It is probably a misspelling. */ + node anyway. It is probably a misspelling. */ if (!entry) - { - char *error_message = "There is no menu item \"%s\" in this node."; + { + char *error_message = _("There is no menu item \"%s\" in this node."); #if defined (HANDLE_MAN_PAGES) - if (first_arg == arg) - { - node = make_manpage_node (first_arg); - if (node) - goto maybe_got_node; - } + if (first_arg == arg) + { + node = make_manpage_node (first_arg); + if (node) + goto maybe_got_node; + } #endif /* HANDLE_MAN_PAGES */ - info_free_references (menu); + info_free_references (menu); - /* If we were supposed to dump this node, complain. */ - if (user_output_filename) - info_error (error_message, arg); - else - begin_info_session_with_error (initial_node, error_message, arg); + /* If we were supposed to dump this node, complain. */ + if (user_output_filename) + info_error (error_message, arg); + else + begin_info_session_with_error (initial_node, error_message, arg); - exit (0); - } + exit (0); + } /* We have found the reference that the user specified. Clean it - up a little bit. */ + up a little bit. */ if (!entry->filename) - { - if (initial_node->parent) - entry->filename = strdup (initial_node->parent); - else - entry->filename = strdup (initial_node->filename); - } + { + if (initial_node->parent) + entry->filename = xstrdup (initial_node->parent); + else + entry->filename = xstrdup (initial_node->filename); + } /* Find this node. If we can find it, then turn the initial_node - into this one. If we cannot find it, try using the label of the - entry as a file (i.e., "(LABEL)Top"). Otherwise the Info file is - malformed in some way, and we will just use the current value of - initial node. */ + into this one. If we cannot find it, try using the label of the + entry as a file (i.e., "(LABEL)Top"). Otherwise the Info file is + malformed in some way, and we will just use the current value of + initial node. */ node = info_get_node (entry->filename, entry->nodename); #if defined (HANDLE_MAN_PAGES) - if ((first_arg == arg) && !node) - { - node = make_manpage_node (first_arg); - if (node) - goto maybe_got_node; - } + if ((first_arg == arg) && !node) + { + node = make_manpage_node (first_arg); + if (node) + goto maybe_got_node; + } #endif /* HANDLE_MAN_PAGES */ if (!node && entry->nodename && - (strcmp (entry->label, entry->nodename) == 0)) - node = info_get_node (entry->label, "Top"); + (strcmp (entry->label, entry->nodename) == 0)) + node = info_get_node (entry->label, "Top"); maybe_got_node: if (node) - { - free (initial_node); - initial_node = node; - info_free_references (menu); - } + { + free (initial_node); + initial_node = node; + info_free_references (menu); + } else - { - char *temp = strdup (entry->label); - char *error_message; + { + char *temp = xstrdup (entry->label); + char *error_message; - error_message = "Unable to find the node referenced by \"%s\"."; + error_message = _("Unable to find the node referenced by \"%s\"."); - info_free_references (menu); + info_free_references (menu); - /* If we were trying to dump the node, then give up. Otherwise, - start the session with an error message. */ - if (user_output_filename) - info_error (error_message, temp); - else - begin_info_session_with_error (initial_node, error_message, temp); + /* If we were trying to dump the node, then give up. Otherwise, + start the session with an error message. */ + if (user_output_filename) + info_error (error_message, temp); + else + begin_info_session_with_error (initial_node, error_message, temp); - exit (0); - } + exit (0); + } } /* If the user specified that this node should be output, then do that @@ -454,15 +518,15 @@ version_string () vstring = (char *)xmalloc (50); sprintf (vstring, "%d.%d", info_major_version, info_minor_version); if (info_patch_level) - sprintf (vstring + strlen (vstring), "-p%d", info_patch_level); + sprintf (vstring + strlen (vstring), "-p%d", info_patch_level); } return (vstring); } /* **************************************************************** */ -/* */ -/* Error Handling for Info */ -/* */ +/* */ +/* Error Handling for Info */ +/* */ /* **************************************************************** */ static char *program_name = (char *)NULL; @@ -474,7 +538,7 @@ remember_info_program_name (fullpath) char *filename; filename = filename_non_directory (fullpath); - program_name = strdup (filename); + program_name = xstrdup (filename); } /* Non-zero if an error has been signalled. */ @@ -503,22 +567,22 @@ info_error (format, arg1, arg2) else { if (!echo_area_is_active) - { - if (info_error_rings_bell_p) - terminal_ring_bell (); - window_message_in_echo_area (format, arg1, arg2); - } + { + if (info_error_rings_bell_p) + terminal_ring_bell (); + window_message_in_echo_area (format, arg1, arg2); + } else - { - NODE *temp; - - temp = build_message_node (format, arg1, arg2); - if (info_error_rings_bell_p) - terminal_ring_bell (); - inform_in_echo_area (temp->contents); - free (temp->contents); - free (temp); - } + { + NODE *temp; + + temp = build_message_node (format, arg1, arg2); + if (info_error_rings_bell_p) + terminal_ring_bell (); + inform_in_echo_area (temp->contents); + free (temp->contents); + free (temp); + } } } @@ -528,11 +592,11 @@ static void usage () { fprintf (stderr,"%s\n%s\n%s\n%s\n%s\n", -"Usage: info [-d dir-path] [-f info-file] [-o output-file] [-n node-name]...", -" [--directory dir-path] [--file info-file] [--node node-name]...", -" [--help] [--output output-file] [--subnodes] [--version]", -" [--dribble dribble-file] [--restore from-file]", -" [menu-selection ...]"); +_("Usage: info [-d dir-path] [-f info-file] [-o output-file] [-n node-name]..."), +_(" [--directory dir-path] [--file info-file] [--node node-name]..."), +_(" [--help] [--output output-file] [--subnodes] [--version]"), +_(" [--dribble dribble-file] [--restore from-file]"), +_(" [menu-selection ...]")); exit (1); } @@ -540,26 +604,26 @@ usage () static void info_short_help () { - puts ("\ + puts (_("\ Here is a quick description of Info's options. For a more complete\n\ description of how to use Info, type `info info options'.\n\ \n\ - --directory DIR Add DIR to INFOPATH.\n\ - --dribble FILENAME Remember user keystrokes in FILENAME.\n\ - --file FILENAME Specify Info file to visit.\n\ - --node NODENAME Specify nodes in first visited Info file.\n\ - --output FILENAME Output selected nodes to FILENAME.\n\ - --restore FILENAME Read initial keystrokes from FILENAME.\n\ - --subnodes Recursively output menu items.\n\ - --help Get this help message.\n\ - --version Display Info's version information.\n\ + --directory DIR Add DIR to INFOPATH.\n\ + --dribble FILENAME Remember user keystrokes in FILENAME.\n\ + --file FILENAME Specify Info file to visit.\n\ + --node NODENAME Specify nodes in first visited Info file.\n\ + --output FILENAME Output selected nodes to FILENAME.\n\ + --restore FILENAME Read initial keystrokes from FILENAME.\n\ + --subnodes Recursively output menu items.\n\ + --help Get this help message.\n\ + --version Display Info's version information.\n\ \n\ Remaining arguments to Info are treated as the names of menu\n\ items in the initial node visited. You can easily move to the\n\ node of your choice by specifying the menu names which describe\n\ the path to that node. For example, `info emacs buffers'.\n\ \n\ -Email bug reports to bug-texinfo@prep.ai.mit.edu."); +Email bug reports to bug-texinfo@prep.ai.mit.edu.")); exit (0); } diff --git a/texinfo/info/info.h b/texinfo/info/info.h index a875922..e8be98e 100644 --- a/texinfo/info/info.h +++ b/texinfo/info/info.h @@ -1,9 +1,10 @@ -/* info.h -- Header file which includes all of the other headers. */ +/* info.h -- Header file which includes all of the other headers. + $Id: info.h,v 1.6 1997/07/15 18:34:15 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,33 +22,86 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_INFO_H_) -#define _INFO_H_ +#if !defined (INFO_H) +#define INFO_H + +/* We always want these, so why clutter up the compile command? */ +#define HANDLE_MAN_PAGES +#define NAMED_FUNCTIONS + +/* System dependencies. */ +#include "system.h" + +/* Some of our other include files use these. */ +typedef int Function (); +typedef void VFunction (); +typedef char *CFunction (); + -#include <stdio.h> -#include <ctype.h> -#include <sys/types.h> -#include <sys/stat.h> -#if defined (HAVE_STRING_H) -#include <string.h> -#endif /* HAVE_STRING_H */ #include "filesys.h" #include "display.h" #include "session.h" -#include "echo_area.h" +#include "echo-area.h" #include "doc.h" #include "footnotes.h" #include "gc.h" +#define info_toupper(x) (islower (x) ? toupper (x) : x) +#define info_tolower(x) (isupper (x) ? tolower (x) : x) + +#if !defined (whitespace) +# define whitespace(c) ((c == ' ') || (c == '\t')) +#endif /* !whitespace */ + +#if !defined (whitespace_or_newline) +# define whitespace_or_newline(c) (whitespace (c) || (c == '\n')) +#endif /* !whitespace_or_newline */ + +/* Add POINTER to the list of pointers found in ARRAY. SLOTS is the number + of slots that have already been allocated. INDEX is the index into the + array where POINTER should be added. GROW is the number of slots to grow + ARRAY by, in the case that it needs growing. TYPE is a cast of the type + of object stored in ARRAY (e.g., NODE_ENTRY *. */ +#define add_pointer_to_array(pointer, idx, array, slots, grow, type) \ + do { \ + if (idx + 2 >= slots) \ + array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \ + array[idx++] = (type)pointer; \ + array[idx] = (type)NULL; \ + } while (0) + +#define maybe_free(x) do { if (x) free (x); } while (0) + +#if !defined (zero_mem) && defined (HAVE_MEMSET) +# define zero_mem(mem, length) memset (mem, 0, length) +#endif /* !zero_mem && HAVE_MEMSET */ + +#if !defined (zero_mem) && defined (HAVE_BZERO) +# define zero_mem(mem, length) bzero (mem, length) +#endif /* !zero_mem && HAVE_BZERO */ + +#if !defined (zero_mem) +# define zero_mem(mem, length) \ + do { \ + register int zi; \ + register unsigned char *place; \ + \ + place = (unsigned char *)mem; \ + for (zi = 0; zi < length; zi++) \ + place[zi] = 0; \ + } while (0) +#endif /* !zero_mem */ + + /* A structure associating the nodes visited in a particular window. */ typedef struct { - WINDOW *window; /* The window that this list is attached to. */ - NODE **nodes; /* Array of nodes visited in this window. */ - int *pagetops; /* For each node in NODES, the pagetop. */ - long *points; /* For each node in NODES, the point. */ - int current; /* Index in NODES of the current node. */ - int nodes_index; /* Index where to add the next node. */ - int nodes_slots; /* Number of slots allocated to NODES. */ + WINDOW *window; /* The window that this list is attached to. */ + NODE **nodes; /* Array of nodes visited in this window. */ + int *pagetops; /* For each node in NODES, the pagetop. */ + long *points; /* For each node in NODES, the point. */ + int current; /* Index in NODES of the current node. */ + int nodes_index; /* Index where to add the next node. */ + int nodes_slots; /* Number of slots allocated to NODES. */ } INFO_WINDOW; /* Array of structures describing for each window which nodes have been @@ -78,23 +132,34 @@ extern int info_major_version, info_minor_version, info_patch_level; extern char *version_string (); /* Error message defines. */ -#define CANT_FIND_NODE "Cannot find the node \"%s\"." -#define CANT_FILE_NODE "Cannot find the node \"(%s)%s\"." -#define CANT_FIND_WIND "Cannot find a window!" -#define CANT_FIND_POINT "Point doesn't appear within this window's node!" -#define CANT_KILL_LAST "Cannot delete the last window." -#define NO_MENU_NODE "No menu in this node." -#define NO_FOOT_NODE "No footnotes in this node." -#define NO_XREF_NODE "No cross references in this node." -#define NO_POINTER "No \"%s\" pointer for this node." -#define UNKNOWN_COMMAND "Unknown Info command `%c'. `?' for help." -#define TERM_TOO_DUMB "Terminal type \"%s\" is not smart enough to run Info." -#define AT_NODE_BOTTOM "You are already at the last page of this node." -#define AT_NODE_TOP "You are already at the first page of this node." -#define ONE_WINDOW "Only one window." -#define WIN_TOO_SMALL "Resulting window would be too small." -#define CANT_MAKE_HELP \ -"There isn't enough room to make a help window. Please delete a window." - -#endif /* !_INFO_H_ */ +#define CANT_FIND_NODE _("Cannot find the node \"%s\".") +#define CANT_FILE_NODE _("Cannot find the node \"(%s)%s\".") +#define CANT_FIND_WIND _("Cannot find a window!") +#define CANT_FIND_POINT _("Point doesn't appear within this window's node!") +#define CANT_KILL_LAST _("Cannot delete the last window.") +#define NO_MENU_NODE _("No menu in this node.") +#define NO_FOOT_NODE _("No footnotes in this node.") +#define NO_XREF_NODE _("No cross references in this node.") +#define NO_POINTER _("No \"%s\" pointer for this node.") +#define UNKNOWN_COMMAND _("Unknown Info command `%c'. `?' for help.") +#define TERM_TOO_DUMB _("Terminal type \"%s\" is not smart enough to run Info.") +#define AT_NODE_BOTTOM _("You are already at the last page of this node.") +#define AT_NODE_TOP _("You are already at the first page of this node.") +#define ONE_WINDOW _("Only one window.") +#define WIN_TOO_SMALL _("Resulting window would be too small.") +#define CANT_MAKE_HELP \ +_("There isn't enough room to make a help window. Please delete a window.") + + +/* Found in info-utils.c. */ +extern char *filename_non_directory (); + +#if !defined (BUILDING_LIBRARY) +/* Found in session.c */ +extern int info_windows_initialized_p; + +/* Found in window.c. */ +extern void message_in_echo_area (), unmessage_in_echo_area (); +#endif /* !BUILDING_LIBRARY */ +#endif /* !INFO_H */ diff --git a/texinfo/info/infodoc.c b/texinfo/info/infodoc.c index 3567509..4fc0419 100644 --- a/texinfo/info/infodoc.c +++ b/texinfo/info/infodoc.c @@ -1,9 +1,7 @@ -/* infodoc.c -- Functions which build documentation nodes. */ +/* infodoc.c -- Functions which build documentation nodes. + $Id: infodoc.c,v 1.4 1997/07/25 21:08:40 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,9 +31,9 @@ /* #define HELP_NODE_GETS_REGENERATED 1 */ /* **************************************************************** */ -/* */ -/* Info Help Windows */ -/* */ +/* */ +/* Info Help Windows */ +/* */ /* **************************************************************** */ /* The name of the node used in the help window. */ @@ -49,10 +47,12 @@ static char *internal_info_help_node_contents = (char *)NULL; /* The static text which appears in the internal info help node. */ static char *info_internal_help_text[] = { - "Basic Commands in Info Windows", + N_ ("Basic Commands in Info Windows"), "******************************", "", - " h Invoke the Info tutorial.", + " h Invoke the Info tutorial.", + " CTRL-x 0 Quit this help.", + " q Quit Info altogether.", "", "Selecting other nodes:", "----------------------", @@ -72,9 +72,8 @@ static char *info_internal_help_text[] = { " b Go to the beginning of this node.", " e Go to the end of this node.", "", - "\"Advanced\" commands:", + "Other commands:", "--------------------", - " q Quit Info.", " 1 Pick first item in node's menu.", " 2-9 Pick second ... ninth item in node's menu.", " 0 Pick last item in node's menu.", @@ -82,7 +81,7 @@ static char *info_internal_help_text[] = { " You may include a filename as well, as in (FILENAME)NODENAME.", " s Search through this Info file for a specified string,", " and select the node in which the next occurrence is found.", - (char *)NULL + NULL }; static char *where_is (), *where_is_internal (); @@ -97,70 +96,70 @@ dump_map_to_message_buffer (prefix, map) for (i = 0; i < 256; i++) { if (map[i].type == ISKMAP) - { - char *new_prefix, *keyname; + { + char *new_prefix, *keyname; - keyname = pretty_keyname (i); - new_prefix = (char *) - xmalloc (3 + strlen (prefix) + strlen (keyname)); - sprintf (new_prefix, "%s%s%s ", prefix, *prefix ? " " : "", keyname); + keyname = pretty_keyname (i); + new_prefix = (char *) + xmalloc (3 + strlen (prefix) + strlen (keyname)); + sprintf (new_prefix, "%s%s%s ", prefix, *prefix ? " " : "", keyname); - dump_map_to_message_buffer (new_prefix, (Keymap)map[i].function); - free (new_prefix); - } + dump_map_to_message_buffer (new_prefix, (Keymap)map[i].function); + free (new_prefix); + } else if (map[i].function) - { - register int last; - char *doc, *name; - - doc = function_documentation (map[i].function); - name = function_name (map[i].function); - - if (!*doc) - continue; - - /* Find out if there is a series of identical functions, as in - ea_insert (). */ - for (last = i + 1; last < 256; last++) - if ((map[last].type != ISFUNC) || - (map[last].function != map[i].function)) - break; - - if (last - 1 != i) - { - printf_to_message_buffer - ("%s%s .. ", prefix, pretty_keyname (i)); - printf_to_message_buffer - ("%s%s\t", prefix, pretty_keyname (last - 1)); - i = last - 1; - } - else - printf_to_message_buffer ("%s%s\t", prefix, pretty_keyname (i)); + { + register int last; + char *doc, *name; + + doc = function_documentation (map[i].function); + name = function_name (map[i].function); + + if (!*doc) + continue; + + /* Find out if there is a series of identical functions, as in + ea_insert (). */ + for (last = i + 1; last < 256; last++) + if ((map[last].type != ISFUNC) || + (map[last].function != map[i].function)) + break; + + if (last - 1 != i) + { + printf_to_message_buffer + ("%s%s .. ", prefix, pretty_keyname (i)); + printf_to_message_buffer + ("%s%s\t", prefix, pretty_keyname (last - 1)); + i = last - 1; + } + else + printf_to_message_buffer ("%s%s\t", prefix, pretty_keyname (i)); #if defined (NAMED_FUNCTIONS) - /* Print the name of the function, and some padding before the - documentation string is printed. */ - { - int length_so_far; - int desired_doc_start = 40; /* Must be multiple of 8. */ - - printf_to_message_buffer ("(%s)", name); - length_so_far = message_buffer_length_this_line (); - - if ((desired_doc_start + strlen (doc)) >= the_screen->width) - printf_to_message_buffer ("\n "); - else - { - while (length_so_far < desired_doc_start) - { - printf_to_message_buffer ("\t"); - length_so_far += character_width ('\t', length_so_far); - } - } - } + /* Print the name of the function, and some padding before the + documentation string is printed. */ + { + int length_so_far; + int desired_doc_start = 40; /* Must be multiple of 8. */ + + printf_to_message_buffer ("(%s)", name); + length_so_far = message_buffer_length_this_line (); + + if ((desired_doc_start + strlen (doc)) >= the_screen->width) + printf_to_message_buffer ("\n "); + else + { + while (length_so_far < desired_doc_start) + { + printf_to_message_buffer ("\t"); + length_so_far += character_width ('\t', length_so_far); + } + } + } #endif /* NAMED_FUNCTIONS */ - printf_to_message_buffer ("%s\n", doc); - } + printf_to_message_buffer ("%s\n", doc); + } } } @@ -184,7 +183,7 @@ create_internal_info_help_node () initialize_message_buffer (); for (i = 0; info_internal_help_text[i]; i++) - printf_to_message_buffer ("%s\n", info_internal_help_text[i]); + printf_to_message_buffer ("%s\n", info_internal_help_text[i]); printf_to_message_buffer ("---------------------\n\n"); printf_to_message_buffer ("The current search path is:\n"); @@ -199,34 +198,34 @@ create_internal_info_help_node () #if defined (NAMED_FUNCTIONS) /* Get a list of the M-x commands which have no keystroke equivs. */ for (i = 0; function_doc_array[i].func; i++) - { - VFunction *func = function_doc_array[i].func; - - if ((!where_is_internal (info_keymap, func)) && - (!where_is_internal (echo_area_keymap, func))) - { - if (!printed_one_mx) - { - printf_to_message_buffer ("---------------------\n\n"); - printf_to_message_buffer - ("The following commands can only be invoked via M-x:\n\n"); - printed_one_mx = 1; - } - - printf_to_message_buffer - ("M-x %s\n %s\n", - function_doc_array[i].func_name, - replace_in_documentation (function_doc_array[i].doc)); - } - } + { + VFunction *func = function_doc_array[i].func; + + if ((!where_is_internal (info_keymap, func)) && + (!where_is_internal (echo_area_keymap, func))) + { + if (!printed_one_mx) + { + printf_to_message_buffer ("---------------------\n\n"); + printf_to_message_buffer + (_("The following commands can only be invoked via M-x:\n\n")); + printed_one_mx = 1; + } + + printf_to_message_buffer + ("M-x %s\n %s\n", + function_doc_array[i].func_name, + replace_in_documentation (function_doc_array[i].doc)); + } + } if (printed_one_mx) - printf_to_message_buffer ("\n"); + printf_to_message_buffer ("\n"); #endif /* NAMED_FUNCTIONS */ printf_to_message_buffer - ("%s", replace_in_documentation - ("--- Use `\\[history-node]' or `\\[kill-node]' to exit ---\n")); + ("%s", replace_in_documentation + (_("--- Use `\\[history-node]' or `\\[kill-node]' to exit ---\n"))); node = message_buffer_to_node (); internal_info_help_node_contents = node->contents; } @@ -273,16 +272,16 @@ info_find_or_create_help_window () int max = 0; for (window = windows; window; window = window->next) - { - if (window->height > max) - { - max = window->height; - eligible = window; - } - } + { + if (window->height > max) + { + max = window->height; + eligible = window; + } + } if (!eligible) - return ((WINDOW *)NULL); + return ((WINDOW *)NULL); } #if !defined (HELP_NODE_GETS_REGENERATED) else @@ -297,28 +296,28 @@ info_find_or_create_help_window () if (!help_window) { /* Split the largest window into 2 windows, and show the help text - in that window. */ + in that window. */ if (eligible->height > 30) - { - active_window = eligible; - help_window = window_make_window (internal_info_help_node); - } + { + active_window = eligible; + help_window = window_make_window (internal_info_help_node); + } else - { - set_remembered_pagetop_and_point (active_window); - window_set_node_of_window (active_window, internal_info_help_node); - help_window = active_window; - } + { + set_remembered_pagetop_and_point (active_window); + window_set_node_of_window (active_window, internal_info_help_node); + help_window = active_window; + } } else { /* Case where help node always gets regenerated, and we have an - existing window in which to place the node. */ + existing window in which to place the node. */ if (active_window != help_window) - { - set_remembered_pagetop_and_point (active_window); - active_window = help_window; - } + { + set_remembered_pagetop_and_point (active_window); + active_window = help_window; + } window_set_node_of_window (active_window, internal_info_help_node); } remember_window_and_node (help_window, help_window->node); @@ -326,7 +325,7 @@ info_find_or_create_help_window () } /* Create or move to the help window. */ -DECLARE_INFO_COMMAND (info_get_help_window, "Display help message") +DECLARE_INFO_COMMAND (info_get_help_window, _("Display help message")) { WINDOW *help_window; @@ -344,7 +343,7 @@ DECLARE_INFO_COMMAND (info_get_help_window, "Display help message") /* Show the Info help node. This means that the "info" file is installed where it can easily be found on your system. */ -DECLARE_INFO_COMMAND (info_get_info_help_node, "Visit Info node `(info)Help'") +DECLARE_INFO_COMMAND (info_get_info_help_node, _("Visit Info node `(info)Help'")) { NODE *node; char *nodename; @@ -356,15 +355,15 @@ DECLARE_INFO_COMMAND (info_get_info_help_node, "Visit Info node `(info)Help'") for (win = windows; win; win = win->next) { - if (win->node && win->node->filename && - (strcasecmp - (filename_non_directory (win->node->filename), "info") == 0) && - ((strcmp (win->node->nodename, "Help") == 0) || - (strcmp (win->node->nodename, "Help-Small-Screen") == 0))) - { - active_window = win; - return; - } + if (win->node && win->node->filename && + (strcasecmp + (filename_non_directory (win->node->filename), "info") == 0) && + ((strcmp (win->node->nodename, "Help") == 0) || + (strcmp (win->node->nodename, "Help-Small-Screen") == 0))) + { + active_window = win; + return; + } } } @@ -380,32 +379,32 @@ DECLARE_INFO_COMMAND (info_get_info_help_node, "Visit Info node `(info)Help'") if (!node) { if (info_recent_file_error) - info_error (info_recent_file_error); + info_error (info_recent_file_error); else - info_error (CANT_FILE_NODE, "Info", nodename); + info_error (CANT_FILE_NODE, "Info", nodename); } else { /* If the current window is very large (greater than 45 lines), - then split it and show the help node in another window. - Otherwise, use the current window. */ + then split it and show the help node in another window. + Otherwise, use the current window. */ if (active_window->height > 45) - active_window = window_make_window (node); + active_window = window_make_window (node); else - { - set_remembered_pagetop_and_point (active_window); - window_set_node_of_window (active_window, node); - } + { + set_remembered_pagetop_and_point (active_window); + window_set_node_of_window (active_window, node); + } remember_window_and_node (active_window, node); } } /* **************************************************************** */ -/* */ -/* Groveling Info Keymaps and Docs */ -/* */ +/* */ +/* Groveling Info Keymaps and Docs */ +/* */ /* **************************************************************** */ /* Return the documentation associated with the Info command FUNCTION. */ @@ -468,7 +467,7 @@ key_documentation (key, map) return ((char *)NULL); } -DECLARE_INFO_COMMAND (describe_key, "Print documentation for KEY") +DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY")) { char keyname[50]; int keyname_index = 0; @@ -481,24 +480,24 @@ DECLARE_INFO_COMMAND (describe_key, "Print documentation for KEY") while (1) { - message_in_echo_area ("Describe key: %s", keyname); + message_in_echo_area (_("Describe key: %s"), keyname); keystroke = info_get_input_char (); unmessage_in_echo_area (); if (Meta_p (keystroke) && (!ISO_Latin_p || key < 160)) - { - if (map[ESC].type != ISKMAP) - { - window_message_in_echo_area - ("ESC %s is undefined.", pretty_keyname (UnMeta (keystroke))); - return; - } - - strcpy (keyname + keyname_index, "ESC "); - keyname_index = strlen (keyname); - keystroke = UnMeta (keystroke); - map = (Keymap)map[ESC].function; - } + { + if (map[ESC].type != ISKMAP) + { + window_message_in_echo_area + (_("ESC %s is undefined."), pretty_keyname (UnMeta (keystroke))); + return; + } + + strcpy (keyname + keyname_index, "ESC "); + keyname_index = strlen (keyname); + keystroke = UnMeta (keystroke); + map = (Keymap)map[ESC].function; + } /* Add the printed representation of KEYSTROKE to our keyname. */ rep = pretty_keyname (keystroke); @@ -506,40 +505,40 @@ DECLARE_INFO_COMMAND (describe_key, "Print documentation for KEY") keyname_index = strlen (keyname); if (map[keystroke].function == (VFunction *)NULL) - { - message_in_echo_area ("%s is undefined.", keyname); - return; - } + { + message_in_echo_area (_("%s is undefined."), keyname); + return; + } else if (map[keystroke].type == ISKMAP) - { - map = (Keymap)map[keystroke].function; - strcat (keyname, " "); - keyname_index = strlen (keyname); - continue; - } + { + map = (Keymap)map[keystroke].function; + strcat (keyname, " "); + keyname_index = strlen (keyname); + continue; + } else - { - char *message, *fundoc, *funname = ""; + { + char *message, *fundoc, *funname = ""; #if defined (NAMED_FUNCTIONS) - funname = function_name (map[keystroke].function); + funname = function_name (map[keystroke].function); #endif /* NAMED_FUNCTIONS */ - fundoc = function_documentation (map[keystroke].function); + fundoc = function_documentation (map[keystroke].function); - message = (char *)xmalloc - (10 + strlen (keyname) + strlen (fundoc) + strlen (funname)); + message = (char *)xmalloc + (10 + strlen (keyname) + strlen (fundoc) + strlen (funname)); #if defined (NAMED_FUNCTIONS) - sprintf (message, "%s (%s): %s.", keyname, funname, fundoc); + sprintf (message, "%s (%s): %s.", keyname, funname, fundoc); #else - sprintf (message, "%s is defined to %s.", keyname, fundoc); + sprintf (message, _("%s is defined to %s."), keyname, fundoc); #endif /* !NAMED_FUNCTIONS */ - window_message_in_echo_area ("%s", message); - free (message); - break; - } + window_message_in_echo_area ("%s", message); + free (message); + break; + } } } @@ -565,28 +564,28 @@ pretty_keyname (key) else if (Control_p (key)) { switch (key) - { - case '\n': rep = "LFD"; break; - case '\t': rep = "TAB"; break; - case '\r': rep = "RET"; break; - case ESC: rep = "ESC"; break; - - default: - sprintf (rep_buffer, "C-%c", UnControl (key)); - rep = rep_buffer; - } + { + case '\n': rep = "LFD"; break; + case '\t': rep = "TAB"; break; + case '\r': rep = "RET"; break; + case ESC: rep = "ESC"; break; + + default: + sprintf (rep_buffer, "C-%c", UnControl (key)); + rep = rep_buffer; + } } else { switch (key) - { - case ' ': rep = "SPC"; break; - case DEL: rep = "DEL"; break; - default: - rep_buffer[0] = key; - rep_buffer[1] = '\0'; - rep = rep_buffer; - } + { + case ' ': rep = "SPC"; break; + case DEL: rep = "DEL"; break; + default: + rep_buffer[0] = key; + rep_buffer[1] = '\0'; + rep = rep_buffer; + } } return (rep); } @@ -609,39 +608,39 @@ replace_in_documentation (string) { /* Is this the start of a replaceable function name? */ if (string[i] == '\\' && string[i + 1] == '[') - { - char *fun_name, *rep; - VFunction *function; - - /* Copy in the old text. */ - strncpy (result + next, string + start, i - start); - next += (i - start); - start = i + 2; - - /* Move to the end of the function name. */ - for (i = start; string[i] && (string[i] != ']'); i++); - - fun_name = (char *)xmalloc (1 + i - start); - strncpy (fun_name, string + start, i - start); - fun_name[i - start] = '\0'; - - /* Find a key which invokes this function in the info_keymap. */ - function = named_function (fun_name); - - /* If the internal documentation string fails, there is a - serious problem with the associated command's documentation. - We croak so that it can be fixed immediately. */ - if (!function) - abort (); - - rep = where_is (info_keymap, function); - strcpy (result + next, rep); - next = strlen (result); - - start = i; - if (string[i]) - start++; - } + { + char *fun_name, *rep; + VFunction *function; + + /* Copy in the old text. */ + strncpy (result + next, string + start, i - start); + next += (i - start); + start = i + 2; + + /* Move to the end of the function name. */ + for (i = start; string[i] && (string[i] != ']'); i++); + + fun_name = (char *)xmalloc (1 + i - start); + strncpy (fun_name, string + start, i - start); + fun_name[i - start] = '\0'; + + /* Find a key which invokes this function in the info_keymap. */ + function = named_function (fun_name); + + /* If the internal documentation string fails, there is a + serious problem with the associated command's documentation. + We croak so that it can be fixed immediately. */ + if (!function) + abort (); + + rep = where_is (info_keymap, function); + strcpy (result + next, rep); + next = strlen (result); + + start = i; + if (string[i]) + start++; + } } strcpy (result + next, string + start); return (result); @@ -674,7 +673,7 @@ where_is (map, function) name = function_name (function); if (name) - sprintf (where_is_rep, "M-x %s", name); + sprintf (where_is_rep, "M-x %s", name); rep = where_is_rep; } @@ -694,29 +693,29 @@ where_is_internal (map, function) for (i = 0; i < 256; i++) if ((map[i].type == ISFUNC) && map[i].function == function) { - sprintf (where_is_rep + where_is_rep_index, "%s", pretty_keyname (i)); - return (where_is_rep); + sprintf (where_is_rep + where_is_rep_index, "%s", pretty_keyname (i)); + return (where_is_rep); } /* Okay, search subsequent maps for this function. */ for (i = 0; i < 256; i++) { if (map[i].type == ISKMAP) - { - int saved_index = where_is_rep_index; - char *rep; + { + int saved_index = where_is_rep_index; + char *rep; - sprintf (where_is_rep + where_is_rep_index, "%s ", - pretty_keyname (i)); + sprintf (where_is_rep + where_is_rep_index, "%s ", + pretty_keyname (i)); - where_is_rep_index = strlen (where_is_rep); - rep = where_is_internal ((Keymap)map[i].function, function); + where_is_rep_index = strlen (where_is_rep); + rep = where_is_internal ((Keymap)map[i].function, function); - if (rep) - return (where_is_rep); + if (rep) + return (where_is_rep); - where_is_rep_index = saved_index; - } + where_is_rep_index = saved_index; + } } return ((char *)NULL); @@ -729,7 +728,7 @@ DECLARE_INFO_COMMAND (info_where_is, { char *command_name; - command_name = read_function_name ("Where is command: ", window); + command_name = read_function_name (_("Where is command: "), window); if (!command_name) { @@ -744,27 +743,27 @@ DECLARE_INFO_COMMAND (info_where_is, function = named_function (command_name); if (function) - { - char *location; - - location = where_is (active_window->keymap, function); - - if (!location) - { - info_error ("`%s' is not on any keys", command_name); - } - else - { - if (strncmp (location, "M-x ", 4) == 0) - window_message_in_echo_area - ("%s can only be invoked via %s.", command_name, location); - else - window_message_in_echo_area - ("%s can be invoked via %s.", command_name, location); - } - } + { + char *location; + + location = where_is (active_window->keymap, function); + + if (!location) + { + info_error (_("`%s' is not on any keys"), command_name); + } + else + { + if (strncmp (location, "M-x ", 4) == 0) + window_message_in_echo_area + (_("%s can only be invoked via %s."), command_name, location); + else + window_message_in_echo_area + (_("%s can be invoked via %s."), command_name, location); + } + } else - info_error ("There is no function named `%s'", command_name); + info_error (_("There is no function named `%s'"), command_name); } free (command_name); diff --git a/texinfo/info/infomap.c b/texinfo/info/infomap.c index 3f24f1f..7591283 100644 --- a/texinfo/info/infomap.c +++ b/texinfo/info/infomap.c @@ -1,9 +1,7 @@ -/* infomap.c -- Keymaps for Info. */ +/* infomap.c -- Keymaps for Info. + $Id: infomap.c,v 1.7 1997/07/31 20:37:32 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,10 +19,10 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#include "stdio.h" -#include "ctype.h" +#include "info.h" #include "infomap.h" #include "funs.h" +#include "terminal.h" /* Return a new keymap which has all the uppercase letters mapped to run the function info_do_lowercase_version (). */ @@ -82,16 +80,63 @@ keymap_discard_keymap (map) for (i = 0; i < 256; i++) { switch (map[i].type) - { - case ISFUNC: - break; + { + case ISFUNC: + break; - case ISKMAP: - keymap_discard_keymap ((Keymap)map[i].function); - break; + case ISKMAP: + keymap_discard_keymap ((Keymap)map[i].function); + break; - } + } + } +} + +/* Conditionally bind key sequence. */ +int +keymap_bind_keyseq (map, keyseq, keyentry) + Keymap map; + const unsigned char *keyseq; + KEYMAP_ENTRY *keyentry; +{ + register Keymap m = map; + register const unsigned char *s = keyseq; + register int c; + + if (s == NULL || *s == '\0') return 0; + + while ((c = *s++) != '\0') + { + switch (m[c].type) + { + case ISFUNC: + if (!(m[c].function == NULL || + (m != map && m[c].function == info_do_lowercase_version))) + return 0; + + if (*s != '\0') + { + m[c].type = ISKMAP; + m[c].function = (VFunction *)keymap_make_keymap (); + } + break; + + case ISKMAP: + if (*s == '\0') + return 0; + break; + } + if (*s != '\0') + { + m = (Keymap)m[c].function; + } + else + { + m[c] = *keyentry; + } } + + return 1; } /* Initialize the standard info keymaps. */ @@ -117,15 +162,15 @@ initialize_info_keymaps () echo_area_keymap[ESC].function = (VFunction *)keymap_make_keymap (); echo_area_keymap[Control ('x')].type = ISKMAP; echo_area_keymap[Control ('x')].function = - (VFunction *)keymap_make_keymap (); + (VFunction *)keymap_make_keymap (); } /* Bind numeric arg functions for both echo area and info window maps. */ for (i = '0'; i < '9' + 1; i++) { ((Keymap) info_keymap[ESC].function)[i].function = - ((Keymap) echo_area_keymap[ESC].function)[i].function = - info_add_digit_to_numeric_arg; + ((Keymap) echo_area_keymap[ESC].function)[i].function = + info_add_digit_to_numeric_arg; } ((Keymap) info_keymap[ESC].function)['-'].function = ((Keymap) echo_area_keymap[ESC].function)['-'].function = @@ -182,6 +227,31 @@ initialize_info_keymaps () map['o'].function = info_next_window; map[DEL].function = ea_backward_kill_line; + /* Arrow key bindings for echo area keymaps. It seems that some + terminals do not match their termcap entries, so it's best to just + define everything with both of the usual prefixes. */ + map = echo_area_keymap; + keymap_bind_keyseq (map, term_ku, &map[Control ('p')]); /* up */ + keymap_bind_keyseq (map, "\033OA", &map[Control ('p')]); + keymap_bind_keyseq (map, "\033[A", &map[Control ('p')]); + keymap_bind_keyseq (map, term_kd, &map[Control ('n')]); /* down */ + keymap_bind_keyseq (map, "\033OB", &map[Control ('n')]); + keymap_bind_keyseq (map, "\033[B", &map[Control ('n')]); + keymap_bind_keyseq (map, term_kr, &map[Control ('f')]); /* right */ + keymap_bind_keyseq (map, "\033OC", &map[Control ('f')]); + keymap_bind_keyseq (map, "\033[C", &map[Control ('f')]); + keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */ + keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]); + keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]); + + map = (Keymap)echo_area_keymap[ESC].function; + keymap_bind_keyseq (map, term_kl, &map['b']); /* left */ + keymap_bind_keyseq (map, "\033OA", &map['b']); + keymap_bind_keyseq (map, "\033[A", &map['b']); + keymap_bind_keyseq (map, term_kr, &map['f']); /* right */ + keymap_bind_keyseq (map, "\033OB", &map['f']); + keymap_bind_keyseq (map, "\033[B", &map['f']); + /* Bind commands for Info window keymaps. */ map = info_keymap; map[TAB].function = info_move_to_next_xref; @@ -264,11 +334,35 @@ initialize_info_keymaps () map['o'].function = info_next_window; map['t'].function = info_tile_windows; map['w'].function = info_toggle_wrap; -} -/* Strings which represent the sequence of characters that the arrow keys - produce. If these keys begin with ESC, and the second character of the - sequence does not conflict with an existing binding in the Meta keymap, - then bind the keys to do what C-p, C-n, C-f, and C-b do. */ -extern char *term_ku, *term_kd, *term_kr, *term_kl; + /* Arrow key bindings for Info windows keymap. */ + map = info_keymap; + keymap_bind_keyseq (map, term_kN, &map[Control ('v')]); /* pagedown */ + keymap_bind_keyseq (map, term_ku, &map[Control ('p')]); /* up */ + keymap_bind_keyseq (map, "\033OA", &map[Control ('p')]); + keymap_bind_keyseq (map, "\033[A", &map[Control ('p')]); + keymap_bind_keyseq (map, term_kd, &map[Control ('n')]); /* down */ + keymap_bind_keyseq (map, "\033OB", &map[Control ('n')]); + keymap_bind_keyseq (map, "\033[B", &map[Control ('n')]); + keymap_bind_keyseq (map, term_kr, &map[Control ('f')]); /* right */ + keymap_bind_keyseq (map, "\033OC", &map[Control ('f')]); + keymap_bind_keyseq (map, "\033[C", &map[Control ('f')]); + keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */ + keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]); + keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]); + map = (Keymap)info_keymap[ESC].function; + keymap_bind_keyseq (map, term_kl, &map['b']); /* left */ + keymap_bind_keyseq (map, "\033OA", &map['b']); + keymap_bind_keyseq (map, "\033[A", &map['b']); + keymap_bind_keyseq (map, term_kr, &map['f']); /* right */ + keymap_bind_keyseq (map, "\033OB", &map['f']); + keymap_bind_keyseq (map, "\033[B", &map['f']); + keymap_bind_keyseq (map, term_kN, &map[Control ('v')]); /* pagedown */ + + /* The alternative to this definition of a `main map' key in the + `ESC map' section, is something like: + keymap_bind_keyseq (map, term_kP, &((KeyMap)map[ESC].function).map['v']); + */ + keymap_bind_keyseq (info_keymap/*sic*/, term_kP, &map['v']); /* pageup */ +} diff --git a/texinfo/info/infomap.h b/texinfo/info/infomap.h index faf9388..65968cb 100644 --- a/texinfo/info/infomap.h +++ b/texinfo/info/infomap.h @@ -21,14 +21,14 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_INFOMAP_H_) -#define _INFOMAP_H_ +#ifndef INFOMAP_H +#define INFOMAP_H -#include "general.h" +#include "info.h" #define ESC '\033' #define DEL '\177' -#define TAB '\011' +#define TAB '\011' #define RET '\r' #define LFD '\n' #define SPC ' ' @@ -79,4 +79,4 @@ extern void keymap_discard_keymap (); /* Initialize the info keymaps. */ extern void initialize_info_keymaps (); -#endif /* !_INFOMAP_H_ */ +#endif /* not INFOMAP_H */ diff --git a/texinfo/info/m-x.c b/texinfo/info/m-x.c index 03ac1a5..28b8e80 100644 --- a/texinfo/info/m-x.c +++ b/texinfo/info/m-x.c @@ -1,9 +1,7 @@ -/* m-x.c -- Meta-X minibuffer reader. */ +/* m-x.c -- Meta-X minibuffer reader. + $Id: m-x.c,v 1.5 1997/07/24 21:28:00 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,9 +22,9 @@ #include "info.h" /* **************************************************************** */ -/* */ -/* Reading Named Commands */ -/* */ +/* */ +/* Reading Named Commands */ +/* */ /* **************************************************************** */ /* Read the name of an Info function in the echo area and return the @@ -49,12 +47,12 @@ read_function_name (prompt, window) REFERENCE *entry; entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); - entry->label = strdup (function_doc_array[i].func_name); + entry->label = xstrdup (function_doc_array[i].func_name); entry->nodename = (char *)NULL; entry->filename = (char *)NULL; add_pointer_to_array - (entry, array_index, array, array_slots, 200, REFERENCE *); + (entry, array_index, array, array_slots, 200, REFERENCE *); } line = info_read_completing_in_echo_area (window, prompt, array); @@ -68,11 +66,11 @@ read_function_name (prompt, window) } DECLARE_INFO_COMMAND (describe_command, - "Read the name of an Info command and describe it") + _("Read the name of an Info command and describe it")) { char *line; - line = read_function_name ("Describe command: ", window); + line = read_function_name (_("Describe command: "), window); if (!line) { @@ -83,22 +81,19 @@ DECLARE_INFO_COMMAND (describe_command, /* Describe the function named in "LINE". */ if (*line) { - char *fundoc; - VFunction *fun; - - fun = named_function (line); + VFunction *fun = named_function (line); if (!fun) - return; + return; window_message_in_echo_area ("%s: %s.", - line, function_documentation (fun)); + line, function_documentation (fun)); } free (line); } DECLARE_INFO_COMMAND (info_execute_command, - "Read a command name in the echo area and execute it") + _("Read a command name in the echo area and execute it")) { char *line; @@ -133,11 +128,11 @@ DECLARE_INFO_COMMAND (info_execute_command, VFunction *function; if ((active_window != the_echo_area) && - (strncmp (line, "echo-area-", 10) == 0)) + (strncmp (line, "echo-area-", 10) == 0)) { - free (line); - info_error ("Cannot execute an `echo-area' command here."); - return; + free (line); + info_error (_("Cannot execute an `echo-area' command here.")); + return; } function = named_function (line); @@ -152,7 +147,7 @@ DECLARE_INFO_COMMAND (info_execute_command, /* Okay, now that we have M-x, let the user set the screen height. */ DECLARE_INFO_COMMAND (set_screen_height, - "Set the height of the displayed window") + _("Set the height of the displayed window")) { int new_height; @@ -165,24 +160,24 @@ DECLARE_INFO_COMMAND (set_screen_height, new_height = screenheight; - sprintf (prompt, "Set screen height to (%d): ", new_height); + sprintf (prompt, _("Set screen height to (%d): "), new_height); line = info_read_in_echo_area (window, prompt); /* If the user aborted, do that now. */ if (!line) - { - info_abort_key (active_window, count, 0); - return; - } + { + info_abort_key (active_window, count, 0); + return; + } /* Find out what the new height is supposed to be. */ if (*line) - new_height = atoi (line); + new_height = atoi (line); /* Clear the echo area if it isn't active. */ if (!echo_area_is_active) - window_clear_echo_area (); + window_clear_echo_area (); free (line); } diff --git a/texinfo/info/makedoc.c b/texinfo/info/makedoc.c index c0c4587..c88663f 100644 --- a/texinfo/info/makedoc.c +++ b/texinfo/info/makedoc.c @@ -1,9 +1,10 @@ -/* makedoc.c -- Make DOC.C and FUNS.H from input files. */ +/* makedoc.c -- Make doc.c and funs.h from input files. + $Id: makedoc.c,v 1.4 1997/07/15 18:35:59 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,24 +27,8 @@ a header file which describes the contents. This only does the functions declared with DECLARE_INFO_COMMAND. */ -#include <stdio.h> -#include <ctype.h> -#include <sys/types.h> -#if defined (HAVE_SYS_FILE_H) -#include <sys/file.h> -#endif /* HAVE_SYS_FILE_H */ -#include <sys/stat.h> -#include "general.h" - -#if !defined (O_RDONLY) -#if defined (HAVE_SYS_FCNTL_H) -#include <sys/fcntl.h> -#else /* !HAVE_SYS_FCNTL_H */ -#include <fcntl.h> -#endif /* !HAVE_SYS_FCNTL_H */ -#endif /* !O_RDONLY */ - -extern void *xmalloc (), *xrealloc (); +#include "info.h" + static void fatal_file_error (); /* Name of the header file which receives the declarations of functions. */ @@ -79,15 +64,15 @@ static char *doc_header_1[] = { /* How to remember the locations of the functions found so that Emacs can use the information in a tag table. */ typedef struct { - char *name; /* Name of the tag. */ - int line; /* Line number at which it appears. */ - long char_offset; /* Character offset at which it appears. */ + char *name; /* Name of the tag. */ + int line; /* Line number at which it appears. */ + long char_offset; /* Character offset at which it appears. */ } EMACS_TAG; typedef struct { - char *filename; /* Name of the file containing entries. */ - long entrylen; /* Total number of characters in tag block. */ - EMACS_TAG **entries; /* Entries found in FILENAME. */ + char *filename; /* Name of the file containing entries. */ + long entrylen; /* Total number of characters in tag block. */ + EMACS_TAG **entries; /* Entries found in FILENAME. */ int entries_index; int entries_slots; } EMACS_TAG_BLOCK; @@ -114,8 +99,8 @@ main (argc, argv) for (i = 1; i < argc; i++) if (strcmp (argv[i], "-tags") == 0) { - tags_only++; - break; + tags_only++; + break; } if (tags_only) @@ -128,8 +113,8 @@ main (argc, argv) doc_stream = must_fopen (doc_filename, "w"); fprintf (funs_stream, - "/* %s -- Generated declarations for Info commands. */\n", - funs_filename); + "/* %s -- Generated declarations for Info commands. */\n", + funs_filename); for (i = 0; doc_header[i]; i++) { @@ -138,7 +123,7 @@ main (argc, argv) } fprintf (doc_stream, - " Source files groveled to make this file include:\n\n"); + _(" Source files groveled to make this file include:\n\n")); for (i = 1; i < argc; i++) fprintf (doc_stream, "\t%s\n", argv[i]); @@ -155,17 +140,17 @@ main (argc, argv) curfile = argv[i]; if (*curfile == '-') - continue; + continue; fprintf (doc_stream, "/* Commands found in \"%s\". */\n", curfile); fprintf (funs_stream, "\n/* Functions declared in \"%s\". */\n", - curfile); + curfile); process_one_file (curfile, doc_stream, funs_stream); } fprintf (doc_stream, - " { (VFunction *)NULL, (char *)NULL, (char *)NULL }\n};\n"); + " { (VFunction *)NULL, (char *)NULL, (char *)NULL }\n};\n"); fclose (funs_stream); fclose (doc_stream); @@ -195,25 +180,25 @@ maybe_dump_tags (stream) /* Calculate the length of the dumped block first. */ for (j = 0; j < block->entries_index; j++) - { - char digits[30]; - etag = block->entries[j]; - block_len += 3 + strlen (etag->name); - sprintf (digits, "%d,%d", etag->line, etag->char_offset); - block_len += strlen (digits); - } + { + char digits[30]; + etag = block->entries[j]; + block_len += 3 + strlen (etag->name); + sprintf (digits, "%d,%ld", etag->line, etag->char_offset); + block_len += strlen (digits); + } /* Print out the defining line. */ - fprintf (stream, "\f\n%s,%d\n", block->filename, block_len); + fprintf (stream, "\f\n%s,%ld\n", block->filename, block_len); /* Print out the individual tags. */ for (j = 0; j < block->entries_index; j++) - { - etag = block->entries[j]; + { + etag = block->entries[j]; - fprintf (stream, "%s,\177%d,%d\n", - etag->name, etag->line, etag->char_offset); - } + fprintf (stream, "%s,\177%d,%ld\n", + etag->name, etag->line, etag->char_offset); + } } } @@ -226,7 +211,7 @@ make_emacs_tag_block (filename) EMACS_TAG_BLOCK *block; block = (EMACS_TAG_BLOCK *)xmalloc (sizeof (EMACS_TAG_BLOCK)); - block->filename = strdup (filename); + block->filename = xstrdup (filename); block->entrylen = 0; block->entries = (EMACS_TAG **)NULL; block->entries_index = 0; @@ -248,7 +233,7 @@ add_tag_to_block (block, name, line, char_offset) tag->line = line; tag->char_offset = char_offset; add_pointer_to_array (tag, block->entries_index, block->entries, - block->entries_slots, 50, EMACS_TAG *); + block->entries_slots, 50, EMACS_TAG *); } /* Read the file represented by FILENAME into core, and search it for Info @@ -297,51 +282,51 @@ process_one_file (filename, doc_stream, funs_stream) #endif /* NAMED_FUNCTIONS */ for (; offset < (file_size - decl_len); offset++) - { - if (buffer[offset] == '\n') - { - line_number++; - line_start = offset + 1; - } - - if (strncmp (buffer + offset, decl_str, decl_len) == 0) - { - offset += decl_len; - point = offset; - break; - } - } + { + if (buffer[offset] == '\n') + { + line_number++; + line_start = offset + 1; + } + + if (strncmp (buffer + offset, decl_str, decl_len) == 0) + { + offset += decl_len; + point = offset; + break; + } + } if (!point) - break; + break; /* Skip forward until we find the open paren. */ while (point < file_size) - { - if (buffer[point] == '\n') - { - line_number++; - line_start = point + 1; - } - else if (buffer[point] == '(') - break; - - point++; - } + { + if (buffer[point] == '\n') + { + line_number++; + line_start = point + 1; + } + else if (buffer[point] == '(') + break; + + point++; + } while (point++ < file_size) - { - if (!whitespace_or_newline (buffer[point])) - break; - else if (buffer[point] == '\n') - { - line_number++; - line_start = point + 1; - } - } + { + if (!whitespace_or_newline (buffer[point])) + break; + else if (buffer[point] == '\n') + { + line_number++; + line_start = point + 1; + } + } if (point >= file_size) - break; + break; /* Now looking at name of function. Get it. */ for (offset = point; buffer[offset] != ','; offset++); @@ -351,42 +336,42 @@ process_one_file (filename, doc_stream, funs_stream) /* Remember this tag in the current block. */ { - char *tag_name; + char *tag_name; - tag_name = (char *)xmalloc (1 + (offset - line_start)); - strncpy (tag_name, buffer + line_start, offset - line_start); - tag_name[offset - line_start] = '\0'; - add_tag_to_block (block, tag_name, line_number, point); + tag_name = (char *)xmalloc (1 + (offset - line_start)); + strncpy (tag_name, buffer + line_start, offset - line_start); + tag_name[offset - line_start] = '\0'; + add_tag_to_block (block, tag_name, line_number, point); } #if defined (NAMED_FUNCTIONS) /* Generate the user-visible function name from the function's name. */ { - register int i; - char *name_start; + register int i; + char *name_start; - name_start = func; + name_start = func; - if (strncmp (name_start, "info_", 5) == 0) - name_start += 5; + if (strncmp (name_start, "info_", 5) == 0) + name_start += 5; - func_name = strdup (name_start); + func_name = xstrdup (name_start); - /* Fix up "ea" commands. */ - if (strncmp (func_name, "ea_", 3) == 0) - { - char *temp_func_name; + /* Fix up "ea" commands. */ + if (strncmp (func_name, "ea_", 3) == 0) + { + char *temp_func_name; - temp_func_name = (char *)xmalloc (10 + strlen (func_name)); - strcpy (temp_func_name, "echo_area_"); - strcat (temp_func_name, func_name + 3); - free (func_name); - func_name = temp_func_name; - } + temp_func_name = (char *)xmalloc (10 + strlen (func_name)); + strcpy (temp_func_name, "echo_area_"); + strcat (temp_func_name, func_name + 3); + free (func_name); + func_name = temp_func_name; + } - for (i = 0; func_name[i]; i++) - if (func_name[i] == '_') - func_name[i] = '-'; + for (i = 0; func_name[i]; i++) + if (func_name[i] == '_') + func_name[i] = '-'; } #endif /* NAMED_FUNCTIONS */ @@ -394,40 +379,40 @@ process_one_file (filename, doc_stream, funs_stream) point = offset + 1; while (point < file_size) - { - if (buffer[point] == '\n') - { - line_number++; - line_start = point + 1; - } - - if (buffer[point] == '"') - break; - else - point++; - } + { + if (buffer[point] == '\n') + { + line_number++; + line_start = point + 1; + } + + if (buffer[point] == '"') + break; + else + point++; + } offset = point + 1; while (offset < file_size) - { - if (buffer[offset] == '\n') - { - line_number++; - line_start = offset + 1; - } - - if (buffer[offset] == '\\') - offset += 2; - else if (buffer[offset] == '"') - break; - else - offset++; - } + { + if (buffer[offset] == '\n') + { + line_number++; + line_start = offset + 1; + } + + if (buffer[offset] == '\\') + offset += 2; + else if (buffer[offset] == '"') + break; + else + offset++; + } offset++; if (offset >= file_size) - break; + break; doc = (char *)xmalloc (1 + (offset - point)); strncpy (doc, buffer + point, offset - point); @@ -450,7 +435,7 @@ process_one_file (filename, doc_stream, funs_stream) free the memory already allocated to it. */ if (block->entries) add_pointer_to_array (block, emacs_tags_index, emacs_tags, - emacs_tags_slots, 10, EMACS_TAG_BLOCK *); + emacs_tags_slots, 10, EMACS_TAG_BLOCK *); else { free (block->filename); @@ -462,7 +447,7 @@ static void fatal_file_error (filename) char *filename; { - fprintf (stderr, "Couldn't manipulate the file %s.\n", filename); + fprintf (stderr, _("Couldn't manipulate the file %s.\n"), filename); exit (2); } diff --git a/texinfo/info/man.h b/texinfo/info/man.h index 1584e26..3cf4b16 100644 --- a/texinfo/info/man.h +++ b/texinfo/info/man.h @@ -1,9 +1,10 @@ -/* man.h: Defines and external function declarations for man.c */ +/* man.h: Defines and external function declarations for man.c. + $Id: man.h,v 1.2 1997/07/15 18:42:56 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,8 +22,8 @@ Author: Brian J. Fox (bfox@ai.mit.edu) Sat May 6 16:19:13 1995. */ -#if !defined (_MAN_H_) -#define _MAN_H_ +#ifndef INFO_MAN_H +#define INFO_MAN_H #define MANPAGE_FILE_BUFFER_NAME "*manpages*" @@ -33,4 +34,4 @@ extern long locate_manpage_xref (/* NODE *node, long start, int dir */); extern REFERENCE **xrefs_of_manpage (/* NODE *node */); extern REFERENCE **manpage_xrefs_in_binding (/* NODE *node, SEARCH_BINDING *binding */); -#endif /* !_MAN_H_ */ +#endif /* INFO_MAN_H */ diff --git a/texinfo/info/nodemenu.c b/texinfo/info/nodemenu.c index 3304415..2632657 100644 --- a/texinfo/info/nodemenu.c +++ b/texinfo/info/nodemenu.c @@ -1,9 +1,7 @@ -/* nodemenu.c -- Produce a menu of all visited nodes. */ +/* nodemenu.c -- Produce a menu of all visited nodes. + $Id: nodemenu.c,v 1.7 1997/07/24 21:30:30 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,10 +25,10 @@ static char * nodemenu_format_info () { - return ("\n\ + return (_("\n\ * Menu:\n\ (File)Node Lines Size Containing File\n\ - ---------- ----- ---- ---------------"); + ---------- ----- ---- ---------------")); } /* Produce a formatted line of information about NODE. Here is what we want @@ -41,7 +39,7 @@ nodemenu_format_info () ---------- ----- ---- --------------- * (emacs)Buffers:: 48 2230 /usr/gnu/info/emacs/emacs-1 * (autoconf)Writing configure.in:: 123 58789 /usr/gnu/info/autoconf/autoconf-1 -* (dir)Top:: 40 589 /usr/gnu/info/dir +* (dir)Top:: 40 589 /usr/gnu/info/dir */ static char * format_node_info (node) @@ -58,7 +56,7 @@ format_node_info (node) { parent = filename_non_directory (node->parent); if (!parent) - parent = node->parent; + parent = node->parent; } else parent = (char *)NULL; @@ -72,15 +70,15 @@ format_node_info (node) char *file = (char *)NULL; if (parent) - file = parent; + file = parent; else - file = filename_non_directory (containing_file); + file = filename_non_directory (containing_file); if (!file) - file = containing_file; + file = containing_file; if (!*file) - file = "dir"; + file = "dir"; sprintf (line_buffer, "* (%s)%s::", file, node->nodename); } @@ -92,13 +90,13 @@ format_node_info (node) for (i = 0; i < node->nodelen; i++) if (node->contents[i] == '\n') - lines++; + lines++; sprintf (line_buffer + len, "%d", lines); } len = pad_to (44, line_buffer); - sprintf (line_buffer + len, "%d", node->nodelen); + sprintf (line_buffer + len, "%ld", node->nodelen); if (node->filename && *(node->filename)) { @@ -106,7 +104,7 @@ format_node_info (node) sprintf (line_buffer + len, node->filename); } - return (strdup (line_buffer)); + return xstrdup (line_buffer); } /* Little string comparison routine for qsort (). */ @@ -137,26 +135,26 @@ get_visited_nodes (filter_func) if (!info_windows) return ((NODE *)NULL); - for (iw_index = 0; info_win = info_windows[iw_index]; iw_index++) + for (iw_index = 0; (info_win = info_windows[iw_index]); iw_index++) { for (i = 0; i < info_win->nodes_index; i++) - { - node = info_win->nodes[i]; - - /* We skip mentioning "*Node Menu*" nodes. */ - if (internal_info_node_p (node) && - (strcmp (node->nodename, nodemenu_nodename) == 0)) - continue; - - if (node && (!filter_func || (*filter_func) (node))) - { - char *line; - - line = format_node_info (node); - add_pointer_to_array - (line, lines_index, lines, lines_slots, 20, char *); - } - } + { + node = info_win->nodes[i]; + + /* We skip mentioning "*Node Menu*" nodes. */ + if (internal_info_node_p (node) && + (strcmp (node->nodename, nodemenu_nodename) == 0)) + continue; + + if (node && (!filter_func || (*filter_func) (node))) + { + char *line; + + line = format_node_info (node); + add_pointer_to_array + (line, lines_index, lines, lines_slots, 20, char *); + } + } } /* Sort the array of information lines, if there are any. */ @@ -169,22 +167,22 @@ get_visited_nodes (filter_func) /* Delete duplicates. */ for (i = 0, newlen = 1; i < lines_index - 1; i++) - { - if (strcmp (lines[i], lines[i + 1]) == 0) - { - free (lines[i]); - lines[i] = (char *)NULL; - } - else - newlen++; - } + { + if (strcmp (lines[i], lines[i + 1]) == 0) + { + free (lines[i]); + lines[i] = (char *)NULL; + } + else + newlen++; + } /* We have free ()'d and marked all of the duplicate slots. - Copy the live slots rather than pruning the dead slots. */ + Copy the live slots rather than pruning the dead slots. */ temp = (char **)xmalloc ((1 + newlen) * sizeof (char *)); for (i = 0, j = 0; i < lines_index; i++) - if (lines[i]) - temp[j++] = lines[i]; + if (lines[i]) + temp[j++] = lines[i]; temp[j] = (char *)NULL; free (lines); @@ -196,8 +194,8 @@ get_visited_nodes (filter_func) printf_to_message_buffer ("%s", replace_in_documentation - ("Here is the menu of nodes you have recently visited.\n\ -Select one from this menu, or use `\\[history-node]' in another window.\n")); + (_("Here is the menu of nodes you have recently visited.\n\ +Select one from this menu, or use `\\[history-node]' in another window.\n"))); printf_to_message_buffer ("%s\n", nodemenu_format_info ()); @@ -216,7 +214,7 @@ Select one from this menu, or use `\\[history-node]' in another window.\n")); } DECLARE_INFO_COMMAND (list_visited_nodes, - "Make a window containing a menu of all of the currently visited nodes") + _("Make a window containing a menu of all of the currently visited nodes")) { WINDOW *new; NODE *node; @@ -229,14 +227,20 @@ DECLARE_INFO_COMMAND (list_visited_nodes, node = new->node; if (internal_info_node_p (node) && - (strcmp (node->nodename, nodemenu_nodename) == 0)) - break; + (strcmp (node->nodename, nodemenu_nodename) == 0)) + break; } /* If we couldn't find an existing window, try to use the next window in the chain. */ - if (!new && window->next) - new = window->next; + if (!new) + { + if (window->next) + new = window->next; + /* If there is more than one window, wrap around. */ + else if (window != windows) + new = windows; + } /* If we still don't have a window, make a new one to contain the list. */ if (!new) @@ -258,10 +262,16 @@ DECLARE_INFO_COMMAND (list_visited_nodes, node = get_visited_nodes ((Function *)NULL); name_internal_node (node, nodemenu_nodename); +#if 0 /* Even if this is an internal node, we don't want the window system to treat it specially. So we turn off the internalness of it here. */ + /* Why? We depend on internal_info_node_p returning true, so we must + not remove the flag. Otherwise, the *Node Menu* nodes themselves + appear in the node menu. --Andreas Schwab + <schwab@issan.informatik.uni-dortmund.de>. */ node->flags &= ~N_IsInternal; +#endif /* If this window is already showing a node menu, reuse the existing node slot. */ @@ -270,7 +280,7 @@ DECLARE_INFO_COMMAND (list_visited_nodes, #if defined (NOTDEF) if (internal_info_node_p (new->node) && - (strcmp (new->node->nodename, nodemenu_nodename) == 0)) + (strcmp (new->node->nodename, nodemenu_nodename) == 0)) remember_me = 0; #endif /* NOTDEF */ @@ -284,7 +294,7 @@ DECLARE_INFO_COMMAND (list_visited_nodes, } DECLARE_INFO_COMMAND (select_visited_node, - "Select a node which has been previously visited in a visible window") + _("Select a node which has been previously visited in a visible window")) { char *line; NODE *node; @@ -296,7 +306,7 @@ DECLARE_INFO_COMMAND (select_visited_node, free (node); line = - info_read_completing_in_echo_area (window, "Select visited node: ", menu); + info_read_completing_in_echo_area (window, _("Select visited node: "), menu); window = active_window; @@ -316,9 +326,9 @@ DECLARE_INFO_COMMAND (select_visited_node, entry = info_get_labeled_reference (line, menu); if (!entry) - info_error ("The reference disappeared! (%s).", line); + info_error (_("The reference disappeared! (%s)."), line); else - info_select_reference (window, entry); + info_select_reference (window, entry); } free (line); diff --git a/texinfo/info/nodes.c b/texinfo/info/nodes.c index 8995c78..f2737e7 100644 --- a/texinfo/info/nodes.c +++ b/texinfo/info/nodes.c @@ -21,17 +21,8 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#include <stdio.h> -#include <ctype.h> -#include <sys/types.h> -#if defined (HAVE_SYS_FILE_H) -#include <sys/file.h> -#endif /* HAVE_SYS_FILE_H */ -#include <sys/errno.h> -#include <sys/stat.h> -#if defined (HAVE_STRING_H) -#include <string.h> -#endif /* HAVE_STRING_H */ +#include "info.h" + #include "nodes.h" #include "search.h" #include "filesys.h" @@ -41,22 +32,10 @@ # include "man.h" #endif /* HANDLE_MAN_PAGES */ -#if !defined (O_RDONLY) -#if defined (HAVE_SYS_FCNTL_H) -#include <sys/fcntl.h> -#else /* !HAVE_SYS_FCNTL_H */ -#include <fcntl.h> -#endif /* !HAVE_SYS_FCNTL_H */ -#endif /* !O_RDONLY */ - -#if !defined (errno) -extern int errno; -#endif /* !errno */ - /* **************************************************************** */ -/* */ -/* Functions Static to this File */ -/* */ +/* */ +/* Functions Static to this File */ +/* */ /* **************************************************************** */ static void forget_info_file (), remember_info_file (); @@ -81,9 +60,9 @@ static long get_node_length (); #define INFO_GET_TAGS 1 /* **************************************************************** */ -/* */ -/* Global Variables */ -/* */ +/* */ +/* Global Variables */ +/* */ /* **************************************************************** */ /* When non-zero, this is a string describing the recent file error. */ @@ -96,9 +75,9 @@ FILE_BUFFER **info_loaded_files = (FILE_BUFFER **)NULL; int info_loaded_files_slots = 0; /* **************************************************************** */ -/* */ -/* Public Functions for Node Manipulation */ -/* */ +/* */ +/* Public Functions for Node Manipulation */ +/* */ /* **************************************************************** */ /* Used to build "dir" menu from "localdir" files found in INFOPATH. */ @@ -142,8 +121,8 @@ info_get_node (filename, nodename) if (!file_buffer) { if (filesys_error_number) - info_recent_file_error = - filesys_error_string (filename, filesys_error_number); + info_recent_file_error = + filesys_error_string (filename, filesys_error_number); return ((NODE *)NULL); } @@ -154,9 +133,9 @@ info_get_node (filename, nodename) { node = info_get_node_of_file_buffer ("Top", file_buffer); if (!node) - node = info_get_node_of_file_buffer ("top", file_buffer); + node = info_get_node_of_file_buffer ("top", file_buffer); if (!node) - node = info_get_node_of_file_buffer ("TOP", file_buffer); + node = info_get_node_of_file_buffer ("TOP", file_buffer); } return (node); } @@ -193,7 +172,7 @@ info_get_node_of_file_buffer (nodename, file_buffer) node = (NODE *)xmalloc (sizeof (NODE)); node->filename = file_buffer->fullpath; node->parent = (char *)NULL; - node->nodename = strdup ("*"); + node->nodename = xstrdup ("*"); node->contents = file_buffer->contents; node->nodelen = file_buffer->filesize; node->flags = 0; @@ -203,7 +182,7 @@ info_get_node_of_file_buffer (nodename, file_buffer) the manpage node finding function instead. */ else if (file_buffer->flags & N_IsManPage) { - node = get_manpage_node (file_buffer, nodename); + node = get_manpage_node (file_buffer, nodename); } #endif /* HANDLE_MAN_PAGES */ /* If this is the "main" info file, it might contain a tags table. Search @@ -242,9 +221,9 @@ info_load_file (filename) /* **************************************************************** */ -/* */ -/* Private Functions Implementation */ -/* */ +/* */ +/* Private Functions Implementation */ +/* */ /* **************************************************************** */ /* The workhorse for info_find_file (). Non-zero 2nd argument says to @@ -263,58 +242,58 @@ info_find_file_internal (filename, get_tags) /* First try to find the file in our list of already loaded files. */ if (info_loaded_files) { - for (i = 0; file_buffer = info_loaded_files[i]; i++) - if ((strcmp (filename, file_buffer->filename) == 0) || - (strcmp (filename, file_buffer->fullpath) == 0) || - ((*filename != '/') && - strcmp (filename, - filename_non_directory (file_buffer->fullpath)) == 0)) - { - struct stat new_info, *old_info; - - /* This file is loaded. If the filename that we want is - specifically "dir", then simply return the file buffer. */ - if (strcasecmp (filename_non_directory (filename), "dir") == 0) - return (file_buffer); + for (i = 0; (file_buffer = info_loaded_files[i]); i++) + if ((strcmp (filename, file_buffer->filename) == 0) || + (strcmp (filename, file_buffer->fullpath) == 0) || + ((*filename != '/') && + strcmp (filename, + filename_non_directory (file_buffer->fullpath)) == 0)) + { + struct stat new_info, *old_info; + + /* This file is loaded. If the filename that we want is + specifically "dir", then simply return the file buffer. */ + if (strcasecmp (filename_non_directory (filename), "dir") == 0) + return (file_buffer); #if defined (HANDLE_MAN_PAGES) - /* Do the same for the magic MANPAGE file. */ - if (file_buffer->flags & N_IsManPage) - return (file_buffer); + /* Do the same for the magic MANPAGE file. */ + if (file_buffer->flags & N_IsManPage) + return (file_buffer); #endif /* HANDLE_MAN_PAGES */ - /* The file appears to be already loaded, and it is not "dir". - Check to see if it has changed since the last time it was - loaded. */ - if (stat (file_buffer->fullpath, &new_info) == -1) - { - filesys_error_number = errno; - return ((FILE_BUFFER *)NULL); - } - - old_info = &file_buffer->finfo; - - if ((new_info.st_size != old_info->st_size) || - (new_info.st_mtime != old_info->st_mtime)) - { - /* The file has changed. Forget that we ever had loaded it - in the first place. */ - forget_info_file (filename); - break; - } - else - { - /* The info file exists, and has not changed since the last - time it was loaded. If the caller requested a nodes list - for this file, and there isn't one here, build the nodes - for this file_buffer. In any case, return the file_buffer - object. */ - if (get_tags && !file_buffer->tags) - build_tags_and_nodes (file_buffer); - - return (file_buffer); - } - } + /* The file appears to be already loaded, and it is not "dir". + Check to see if it has changed since the last time it was + loaded. */ + if (stat (file_buffer->fullpath, &new_info) == -1) + { + filesys_error_number = errno; + return ((FILE_BUFFER *)NULL); + } + + old_info = &file_buffer->finfo; + + if ((new_info.st_size != old_info->st_size) || + (new_info.st_mtime != old_info->st_mtime)) + { + /* The file has changed. Forget that we ever had loaded it + in the first place. */ + forget_info_file (filename); + break; + } + else + { + /* The info file exists, and has not changed since the last + time it was loaded. If the caller requested a nodes list + for this file, and there isn't one here, build the nodes + for this file_buffer. In any case, return the file_buffer + object. */ + if (get_tags && !file_buffer->tags) + build_tags_and_nodes (file_buffer); + + return (file_buffer); + } + } } /* The file wasn't loaded. Try to load it now. */ @@ -364,21 +343,21 @@ info_load_file_internal (filename, get_tags) char *lowered_name; char *basename; - lowered_name = strdup (filename); + lowered_name = xstrdup (filename); basename = (char *) strrchr (lowered_name, '/'); if (basename) - basename++; + basename++; else - basename = lowered_name; + basename = lowered_name; while (*basename) - { - if (isupper (*basename)) - *basename = tolower (*basename); + { + if (isupper (*basename)) + *basename = tolower (*basename); - basename++; - } + basename++; + } fullpath = info_find_fullpath (lowered_name); free (lowered_name); @@ -402,8 +381,8 @@ info_load_file_internal (filename, get_tags) /* The file was found, and can be read. Allocate FILE_BUFFER and fill in the various members. */ file_buffer = make_file_buffer (); - file_buffer->filename = strdup (filename); - file_buffer->fullpath = strdup (fullpath); + file_buffer->filename = xstrdup (filename); + file_buffer->fullpath = xstrdup (fullpath); file_buffer->finfo = finfo; file_buffer->filesize = filesize; file_buffer->contents = contents; @@ -444,81 +423,81 @@ build_tags_and_nodes (file_buffer) if (position != -1) while (1) { - long tags_table_begin, tags_table_end; - - binding.end = position; - binding.start = binding.end - 5 - strlen (TAGS_TABLE_END_LABEL); - if (binding.start < 0) - binding.start = 0; - - position = find_node_separator (&binding); - - /* For this test, (and all others here) failure indicates a bogus - tags table. Grovel the file. */ - if (position == -1) - break; - - /* Remember the end of the tags table. */ - binding.start = position; - tags_table_end = binding.start; - binding.end = 0; - - /* Locate the start of the tags table. */ - position = search_backward (TAGS_TABLE_BEG_LABEL, &binding); - - if (position == -1) - break; - - binding.end = position; - binding.start = binding.end - 5 - strlen (TAGS_TABLE_BEG_LABEL); - position = find_node_separator (&binding); - - if (position == -1) - break; - - /* The file contains a valid tags table. Fill the FILE_BUFFER's - tags member. */ - file_buffer->flags |= N_HasTagsTable; - tags_table_begin = position; - - /* If this isn't an indirect tags table, just remember the nodes - described locally in this tags table. Note that binding.end - is pointing to just after the beginning label. */ - binding.start = binding.end; - binding.end = file_buffer->filesize; - - if (!looking_at (TAGS_TABLE_IS_INDIRECT_LABEL, &binding)) - { - binding.start = tags_table_begin; - binding.end = tags_table_end; - get_nodes_of_tags_table (file_buffer, &binding); - return; - } - else - { - /* This is an indirect tags table. Build TAGS member. */ - SEARCH_BINDING indirect; - - indirect.start = tags_table_begin; - indirect.end = 0; - indirect.buffer = binding.buffer; - indirect.flags = S_FoldCase; - - position = search_backward (INDIRECT_TAGS_TABLE_LABEL, &indirect); - - if (position == -1) - { - /* This file is malformed. Give up. */ - return; - } - - indirect.start = position; - indirect.end = tags_table_begin; - binding.start = tags_table_begin; - binding.end = tags_table_end; - get_tags_of_indirect_tags_table (file_buffer, &indirect, &binding); - return; - } + long tags_table_begin, tags_table_end; + + binding.end = position; + binding.start = binding.end - 5 - strlen (TAGS_TABLE_END_LABEL); + if (binding.start < 0) + binding.start = 0; + + position = find_node_separator (&binding); + + /* For this test, (and all others here) failure indicates a bogus + tags table. Grovel the file. */ + if (position == -1) + break; + + /* Remember the end of the tags table. */ + binding.start = position; + tags_table_end = binding.start; + binding.end = 0; + + /* Locate the start of the tags table. */ + position = search_backward (TAGS_TABLE_BEG_LABEL, &binding); + + if (position == -1) + break; + + binding.end = position; + binding.start = binding.end - 5 - strlen (TAGS_TABLE_BEG_LABEL); + position = find_node_separator (&binding); + + if (position == -1) + break; + + /* The file contains a valid tags table. Fill the FILE_BUFFER's + tags member. */ + file_buffer->flags |= N_HasTagsTable; + tags_table_begin = position; + + /* If this isn't an indirect tags table, just remember the nodes + described locally in this tags table. Note that binding.end + is pointing to just after the beginning label. */ + binding.start = binding.end; + binding.end = file_buffer->filesize; + + if (!looking_at (TAGS_TABLE_IS_INDIRECT_LABEL, &binding)) + { + binding.start = tags_table_begin; + binding.end = tags_table_end; + get_nodes_of_tags_table (file_buffer, &binding); + return; + } + else + { + /* This is an indirect tags table. Build TAGS member. */ + SEARCH_BINDING indirect; + + indirect.start = tags_table_begin; + indirect.end = 0; + indirect.buffer = binding.buffer; + indirect.flags = S_FoldCase; + + position = search_backward (INDIRECT_TAGS_TABLE_LABEL, &indirect); + + if (position == -1) + { + /* This file is malformed. Give up. */ + return; + } + + indirect.start = position; + indirect.end = tags_table_begin; + binding.start = tags_table_begin; + binding.end = tags_table_end; + get_tags_of_indirect_tags_table (file_buffer, &indirect, &binding); + return; + } } /* This file doesn't contain any kind of tags table. Grovel the @@ -561,37 +540,37 @@ get_nodes_of_info_file (file_buffer) /* If not there, this is not the start of a node. */ if (start == -1) - continue; + continue; /* Find the start of the nodename. */ start += skip_whitespace (nodeline + start); /* Find the end of the nodename. */ end = start + - skip_node_characters (nodeline + start, DONT_SKIP_NEWLINES); + skip_node_characters (nodeline + start, DONT_SKIP_NEWLINES); /* Okay, we have isolated the node name, and we know where the - node starts. Remember this information in a NODE structure. */ + node starts. Remember this information in a NODE structure. */ entry = (TAG *)xmalloc (sizeof (TAG)); entry->nodename = (char *)xmalloc (1 + (end - start)); strncpy (entry->nodename, nodeline + start, end - start); entry->nodename[end - start] = '\0'; entry->nodestart = nodestart; { - SEARCH_BINDING node_body; + SEARCH_BINDING node_body; - node_body.buffer = binding.buffer + binding.start; - node_body.start = 0; - node_body.end = binding.end - binding.start; - node_body.flags = S_FoldCase; - entry->nodelen = get_node_length (&node_body); + node_body.buffer = binding.buffer + binding.start; + node_body.start = 0; + node_body.end = binding.end - binding.start; + node_body.flags = S_FoldCase; + entry->nodelen = get_node_length (&node_body); } entry->filename = file_buffer->fullpath; /* Add this tag to the array of tag structures in this FILE_BUFFER. */ add_pointer_to_array (entry, tags_index, file_buffer->tags, - file_buffer->tags_slots, 100, TAG *); + file_buffer->tags_slots, 100, TAG *); } } @@ -608,7 +587,7 @@ get_node_length (binding) for (i = binding->start, body = binding->buffer; i < binding->end; i++) { if (body[i] == INFO_FF || body[i] == INFO_COOKIE) - break; + break; } return ((long) i - binding->start); } @@ -652,16 +631,16 @@ get_nodes_of_tags_table (file_buffer, buffer_binding) /* Skip past informative "(Indirect)" tags table line. */ if (!tags_index && looking_at (TAGS_TABLE_IS_INDIRECT_LABEL, search)) - continue; + continue; /* Find the label preceding the node name. */ offset = - string_in_line (INFO_NODE_LABEL, search->buffer + search->start); + string_in_line (INFO_NODE_LABEL, search->buffer + search->start); /* If not there, not a defining line, so we must be out of the - tags table. */ + tags table. */ if (offset == -1) - break; + break; /* Point to the beginning of the node definition. */ search->start += offset; @@ -670,11 +649,11 @@ get_nodes_of_tags_table (file_buffer, buffer_binding) /* Move past the node's name. */ for (offset = 0; - (nodedef[offset]) && (nodedef[offset] != INFO_TAGSEP); - offset++); + (nodedef[offset]) && (nodedef[offset] != INFO_TAGSEP); + offset++); if (nodedef[offset] != INFO_TAGSEP) - continue; + continue; entry = (TAG *)xmalloc (sizeof (TAG)); entry->nodename = (char *)xmalloc (1 + offset); @@ -687,13 +666,13 @@ get_nodes_of_tags_table (file_buffer, buffer_binding) entry->nodelen = -1; /* The filename of this node is currently known as the same as the - name of this file. */ + name of this file. */ entry->filename = file_buffer->fullpath; /* Add this node structure to the array of node structures in this - FILE_BUFFER. */ + FILE_BUFFER. */ add_pointer_to_array (entry, tags_index, file_buffer->tags, - file_buffer->tags_slots, 100, TAG *); + file_buffer->tags_slots, 100, TAG *); } free (search); } @@ -734,23 +713,23 @@ get_tags_of_indirect_tags_table (file_buffer, indirect_binding, tags_binding) while (line < end) { - int colon; + int colon; - colon = string_in_line (":", line); + colon = string_in_line (":", line); - if (colon == -1) - break; + if (colon == -1) + break; - subfile = (SUBFILE *)xmalloc (sizeof (SUBFILE)); - subfile->filename = (char *)xmalloc (colon); - strncpy (subfile->filename, line, colon - 1); - subfile->filename[colon - 1] = '\0'; - subfile->first_byte = (long) atol (line + colon); + subfile = (SUBFILE *)xmalloc (sizeof (SUBFILE)); + subfile->filename = (char *)xmalloc (colon); + strncpy (subfile->filename, line, colon - 1); + subfile->filename[colon - 1] = '\0'; + subfile->first_byte = (long) atol (line + colon); - add_pointer_to_array - (subfile, subfiles_index, subfiles, subfiles_slots, 10, SUBFILE *); + add_pointer_to_array + (subfile, subfiles_index, subfiles, subfiles_slots, 10, SUBFILE *); - while (*line++ != '\n'); + while (*line++ != '\n'); } } @@ -768,10 +747,10 @@ get_tags_of_indirect_tags_table (file_buffer, indirect_binding, tags_binding) SEARCH_BINDING binding; /* Find the length of the header of the file containing the indirect - tags table. This header appears at the start of every file. We - want the absolute position of each node within each subfile, so - we subtract the start of the containing subfile from the logical - position of the node, and then add the length of the header in. */ + tags table. This header appears at the start of every file. We + want the absolute position of each node within each subfile, so + we subtract the start of the containing subfile from the logical + position of the node, and then add the length of the header in. */ binding.buffer = file_buffer->contents; binding.start = 0; binding.end = file_buffer->filesize; @@ -779,81 +758,80 @@ get_tags_of_indirect_tags_table (file_buffer, indirect_binding, tags_binding) header_length = find_node_separator (&binding); if (header_length == -1) - header_length = 0; + header_length = 0; /* Build the file buffer's list of subfiles. */ { - char *containing_dir, *temp; - int len_containing_dir; + char *containing_dir, *temp; + int len_containing_dir; - containing_dir = strdup (file_buffer->fullpath); - temp = (char *) strrchr (containing_dir, '/'); + containing_dir = xstrdup (file_buffer->fullpath); + temp = (char *) strrchr (containing_dir, '/'); - if (temp) - *temp = '\0'; + if (temp) + *temp = '\0'; - len_containing_dir = strlen (containing_dir); + len_containing_dir = strlen (containing_dir); - for (i = 0; subfiles[i]; i++); + for (i = 0; subfiles[i]; i++); - file_buffer->subfiles = (char **) xmalloc ((1 + i) * sizeof (char *)); + file_buffer->subfiles = (char **) xmalloc ((1 + i) * sizeof (char *)); - for (i = 0; subfiles[i]; i++) - { - char *fullpath; + for (i = 0; subfiles[i]; i++) + { + char *fullpath; - fullpath = (char *) xmalloc - (2 + strlen (subfiles[i]->filename) + len_containing_dir); + fullpath = (char *) xmalloc + (2 + strlen (subfiles[i]->filename) + len_containing_dir); - sprintf (fullpath, "%s/%s", - containing_dir, subfiles[i]->filename); + sprintf (fullpath, "%s/%s", + containing_dir, subfiles[i]->filename); - file_buffer->subfiles[i] = fullpath; - } - file_buffer->subfiles[i] = (char *)NULL; - free (containing_dir); + file_buffer->subfiles[i] = fullpath; + } + file_buffer->subfiles[i] = (char *)NULL; + free (containing_dir); } /* For each node in the file's tags table, remember the starting - position. */ - for (tags_index = 0; - entry = file_buffer->tags[tags_index]; - tags_index++) - { - for (i = 0; - subfiles[i] && entry->nodestart >= subfiles[i]->first_byte; - i++); - - /* If the Info file containing the indirect tags table is - malformed, then give up. */ - if (!i) - { - /* The Info file containing the indirect tags table is - malformed. Give up. */ - for (i = 0; subfiles[i]; i++) - { - free (subfiles[i]->filename); - free (subfiles[i]); - free (file_buffer->subfiles[i]); - } - file_buffer->subfiles = (char **)NULL; - free_file_buffer_tags (file_buffer); - return; - } - - /* SUBFILES[i] is the index of the first subfile whose logical - first byte is greater than the logical offset of this node's - starting position. This means that the subfile directly - preceding this one is the one containing the node. */ - - entry->filename = file_buffer->subfiles[i - 1]; - entry->nodestart -= subfiles[i -1]->first_byte; - entry->nodestart += header_length; - entry->nodelen = -1; - } + position. */ + for (tags_index = 0; (entry = file_buffer->tags[tags_index]); + tags_index++) + { + for (i = 0; + subfiles[i] && entry->nodestart >= subfiles[i]->first_byte; + i++); + + /* If the Info file containing the indirect tags table is + malformed, then give up. */ + if (!i) + { + /* The Info file containing the indirect tags table is + malformed. Give up. */ + for (i = 0; subfiles[i]; i++) + { + free (subfiles[i]->filename); + free (subfiles[i]); + free (file_buffer->subfiles[i]); + } + file_buffer->subfiles = (char **)NULL; + free_file_buffer_tags (file_buffer); + return; + } + + /* SUBFILES[i] is the index of the first subfile whose logical + first byte is greater than the logical offset of this node's + starting position. This means that the subfile directly + preceding this one is the one containing the node. */ + + entry->filename = file_buffer->subfiles[i - 1]; + entry->nodestart -= subfiles[i -1]->first_byte; + entry->nodestart += header_length; + entry->nodelen = -1; + } /* We have successfully built the tags table. Remember that it - was indirect. */ + was indirect. */ file_buffer->flags |= N_TagsIndirect; } @@ -878,105 +856,105 @@ info_node_of_file_buffer_tags (file_buffer, nodename) register int i; TAG *tag; - for (i = 0; tag = file_buffer->tags[i]; i++) + for (i = 0; (tag = file_buffer->tags[i]); i++) if (strcmp (nodename, tag->nodename) == 0) { - FILE_BUFFER *subfile; - - subfile = info_find_file_internal (tag->filename, INFO_NO_TAGS); - - if (!subfile) - return ((NODE *)NULL); - - if (!subfile->contents) - { - info_reload_file_buffer_contents (subfile); - - if (!subfile->contents) - return ((NODE *)NULL); - } - - /* If we were able to find this file and load it, then return - the node within it. */ - { - NODE *node; - - node = (NODE *)xmalloc (sizeof (NODE)); - node->filename = (subfile->fullpath); - node->nodename = tag->nodename; - node->contents = subfile->contents + tag->nodestart; - node->flags = 0; - node->parent = (char *)NULL; - - if (file_buffer->flags & N_HasTagsTable) - { - node->flags |= N_HasTagsTable; - - if (file_buffer->flags & N_TagsIndirect) - { - node->flags |= N_TagsIndirect; - node->parent = file_buffer->fullpath; - } - } - - if (subfile->flags & N_IsCompressed) - node->flags |= N_IsCompressed; - - /* If TAG->nodelen hasn't been calculated yet, then we aren't - in a position to trust the entry pointer. Adjust things so - that ENTRY->nodestart gets the exact address of the start of - the node separator which starts this node, and NODE->contents - gets the address of the line defining this node. If we cannot - do that, the node isn't really here. */ - if (tag->nodelen == -1) - { - int min, max; - char *node_sep; - SEARCH_BINDING node_body; - char *buff_end; - - min = max = DEFAULT_INFO_FUDGE; - - if (tag->nodestart < DEFAULT_INFO_FUDGE) - min = tag->nodestart; - - if (DEFAULT_INFO_FUDGE > - (subfile->filesize - tag->nodestart)) - max = subfile->filesize - tag->nodestart; - - /* NODE_SEP gets the address of the separator which defines - this node, or (char *)NULL if the node wasn't found. - NODE->contents is side-effected to point to right after - the separator. */ - node_sep = adjust_nodestart (node, min, max); - if (node_sep == (char *)NULL) - { - free (node); - return ((NODE *)NULL); - } - /* Readjust tag->nodestart. */ - tag->nodestart = node_sep - subfile->contents; - - /* Calculate the length of the current node. */ - buff_end = subfile->contents + subfile->filesize; - - node_body.buffer = node->contents; - node_body.start = 0; - node_body.end = buff_end - node_body.buffer; - node_body.flags = 0; - tag->nodelen = get_node_length (&node_body); - } - else - { - /* Since we know the length of this node, we have already - adjusted tag->nodestart to point to the exact start of - it. Simply skip the node separator. */ - node->contents += skip_node_separator (node->contents); - } - - node->nodelen = tag->nodelen; - return (node); - } + FILE_BUFFER *subfile; + + subfile = info_find_file_internal (tag->filename, INFO_NO_TAGS); + + if (!subfile) + return ((NODE *)NULL); + + if (!subfile->contents) + { + info_reload_file_buffer_contents (subfile); + + if (!subfile->contents) + return ((NODE *)NULL); + } + + /* If we were able to find this file and load it, then return + the node within it. */ + { + NODE *node; + + node = (NODE *)xmalloc (sizeof (NODE)); + node->filename = (subfile->fullpath); + node->nodename = tag->nodename; + node->contents = subfile->contents + tag->nodestart; + node->flags = 0; + node->parent = (char *)NULL; + + if (file_buffer->flags & N_HasTagsTable) + { + node->flags |= N_HasTagsTable; + + if (file_buffer->flags & N_TagsIndirect) + { + node->flags |= N_TagsIndirect; + node->parent = file_buffer->fullpath; + } + } + + if (subfile->flags & N_IsCompressed) + node->flags |= N_IsCompressed; + + /* If TAG->nodelen hasn't been calculated yet, then we aren't + in a position to trust the entry pointer. Adjust things so + that ENTRY->nodestart gets the exact address of the start of + the node separator which starts this node, and NODE->contents + gets the address of the line defining this node. If we cannot + do that, the node isn't really here. */ + if (tag->nodelen == -1) + { + int min, max; + char *node_sep; + SEARCH_BINDING node_body; + char *buff_end; + + min = max = DEFAULT_INFO_FUDGE; + + if (tag->nodestart < DEFAULT_INFO_FUDGE) + min = tag->nodestart; + + if (DEFAULT_INFO_FUDGE > + (subfile->filesize - tag->nodestart)) + max = subfile->filesize - tag->nodestart; + + /* NODE_SEP gets the address of the separator which defines + this node, or (char *)NULL if the node wasn't found. + NODE->contents is side-effected to point to right after + the separator. */ + node_sep = adjust_nodestart (node, min, max); + if (node_sep == (char *)NULL) + { + free (node); + return ((NODE *)NULL); + } + /* Readjust tag->nodestart. */ + tag->nodestart = node_sep - subfile->contents; + + /* Calculate the length of the current node. */ + buff_end = subfile->contents + subfile->filesize; + + node_body.buffer = node->contents; + node_body.start = 0; + node_body.end = buff_end - node_body.buffer; + node_body.flags = 0; + tag->nodelen = get_node_length (&node_body); + } + else + { + /* Since we know the length of this node, we have already + adjusted tag->nodestart to point to the exact start of + it. Simply skip the node separator. */ + node->contents += skip_node_separator (node->contents); + } + + node->nodelen = tag->nodelen; + return (node); + } } /* There was a tag table for this file, and the node wasn't found. @@ -985,9 +963,9 @@ info_node_of_file_buffer_tags (file_buffer, nodename) } /* **************************************************************** */ -/* */ -/* Managing file_buffers, nodes, and tags. */ -/* */ +/* */ +/* Managing file_buffers, nodes, and tags. */ +/* */ /* **************************************************************** */ /* Create a new, empty file buffer. */ @@ -1018,7 +996,7 @@ remember_info_file (file_buffer) ; add_pointer_to_array (file_buffer, i, info_loaded_files, - info_loaded_files_slots, 10, FILE_BUFFER *); + info_loaded_files_slots, 10, FILE_BUFFER *); } /* Forget the contents, tags table, nodes list, and names of FILENAME. */ @@ -1032,25 +1010,25 @@ forget_info_file (filename) if (!info_loaded_files) return; - for (i = 0; file_buffer = info_loaded_files[i]; i++) + for (i = 0; (file_buffer = info_loaded_files[i]); i++) if ((strcmp (filename, file_buffer->filename) == 0) || - (strcmp (filename, file_buffer->fullpath) == 0)) + (strcmp (filename, file_buffer->fullpath) == 0)) { - free (file_buffer->filename); - free (file_buffer->fullpath); + free (file_buffer->filename); + free (file_buffer->fullpath); - if (file_buffer->contents) - free (file_buffer->contents); - - /* Note that free_file_buffer_tags () also kills the subfiles - list, since the subfiles list is only of use in conjunction - with tags. */ - free_file_buffer_tags (file_buffer); + if (file_buffer->contents) + free (file_buffer->contents); + + /* Note that free_file_buffer_tags () also kills the subfiles + list, since the subfiles list is only of use in conjunction + with tags. */ + free_file_buffer_tags (file_buffer); - while (info_loaded_files[i] = info_loaded_files[++i]) - ; + while ((info_loaded_files[i] = info_loaded_files[++i])) + ; - break; + break; } } @@ -1065,8 +1043,8 @@ free_file_buffer_tags (file_buffer) { register TAG *tag; - for (i = 0; tag = file_buffer->tags[i]; i++) - free_info_tag (tag); + for (i = 0; (tag = file_buffer->tags[i]); i++) + free_info_tag (tag); free (file_buffer->tags); file_buffer->tags = (TAG **)NULL; @@ -1076,7 +1054,7 @@ free_file_buffer_tags (file_buffer) if (file_buffer->subfiles) { for (i = 0; file_buffer->subfiles[i]; i++) - free (file_buffer->subfiles[i]); + free (file_buffer->subfiles[i]); free (file_buffer->subfiles); file_buffer->subfiles = (char **)NULL; @@ -1160,29 +1138,29 @@ adjust_nodestart (node, min, max) sep_len = skip_node_separator (node->contents); /* If we managed to skip a node separator, then check for this node - being the right one. */ + being the right one. */ if (sep_len != 0) - { - char *nodedef, *nodestart; - int offset; - - nodestart = node_body.buffer + position + sep_len; - nodedef = nodestart; - offset = string_in_line (INFO_NODE_LABEL, nodedef); - - if (offset != -1) - { - nodedef += offset; - nodedef += skip_whitespace (nodedef); - offset = skip_node_characters (nodedef, DONT_SKIP_NEWLINES); - if ((offset == strlen (node->nodename)) && - (strncmp (node->nodename, nodedef, offset) == 0)) - { - node->contents = nodestart; - return (node_body.buffer + position); - } - } - } + { + char *nodedef, *nodestart; + int offset; + + nodestart = node_body.buffer + position + sep_len; + nodedef = nodestart; + offset = string_in_line (INFO_NODE_LABEL, nodedef); + + if (offset != -1) + { + nodedef += offset; + nodedef += skip_whitespace (nodedef); + offset = skip_node_characters (nodedef, DONT_SKIP_NEWLINES); + if ((offset == strlen (node->nodename)) && + (strncmp (node->nodename, nodedef, offset) == 0)) + { + node->contents = nodestart; + return (node_body.buffer + position); + } + } + } } /* Oh well, I guess we have to try to find it in a larger area. */ diff --git a/texinfo/info/nodes.h b/texinfo/info/nodes.h index 7ddea17..a96c07c 100644 --- a/texinfo/info/nodes.h +++ b/texinfo/info/nodes.h @@ -1,9 +1,10 @@ -/* nodes.h -- How we represent nodes internally. */ +/* nodes.h -- How we represent nodes internally. + $Id: nodes.h,v 1.5 1997/07/18 14:33:44 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,15 +22,15 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_NODES_H_) -#define _NODES_H_ +#if !defined (NODES_H) +#define NODES_H -#include "general.h" +#include "info.h" /* **************************************************************** */ -/* */ -/* User Code Interface */ -/* */ +/* */ +/* User Code Interface */ +/* */ /* **************************************************************** */ /* Callers generally only want the node itself. This structure is used @@ -41,45 +42,45 @@ paths, so you might have: node->filename = "/usr/gnu/info/emacs-1", with node->parent = "/usr/gnu/info/emacs". */ typedef struct { - char *filename; /* The physical file containing this node. */ - char *parent; /* Non-null is the logical file name. */ - char *nodename; /* The name of this node. */ - char *contents; /* Characters appearing in this node. */ - long nodelen; /* The length of the CONTENTS member. */ - int flags; /* See immediately below. */ + char *filename; /* The physical file containing this node. */ + char *parent; /* Non-null is the logical file name. */ + char *nodename; /* The name of this node. */ + char *contents; /* Characters appearing in this node. */ + long nodelen; /* The length of the CONTENTS member. */ + int flags; /* See immediately below. */ } NODE; /* Defines that can appear in NODE->flags. All informative. */ -#define N_HasTagsTable 0x01 /* This node was found through a tags table. */ -#define N_TagsIndirect 0x02 /* The tags table was an indirect one. */ -#define N_UpdateTags 0x04 /* The tags table is out of date. */ -#define N_IsCompressed 0x08 /* The file is compressed on disk. */ -#define N_IsInternal 0x10 /* This node was made by Info. */ -#define N_CannotGC 0x20 /* File buffer cannot be gc'ed. */ -#define N_IsManPage 0x40 /* This node is a Un*x manpage. */ +#define N_HasTagsTable 0x01 /* This node was found through a tags table. */ +#define N_TagsIndirect 0x02 /* The tags table was an indirect one. */ +#define N_UpdateTags 0x04 /* The tags table is out of date. */ +#define N_IsCompressed 0x08 /* The file is compressed on disk. */ +#define N_IsInternal 0x10 /* This node was made by Info. */ +#define N_CannotGC 0x20 /* File buffer cannot be gc'ed. */ +#define N_IsManPage 0x40 /* This node is a Un*x manpage. */ /* **************************************************************** */ -/* */ -/* Internal Data Structures */ -/* */ +/* */ +/* Internal Data Structures */ +/* */ /* **************************************************************** */ /* Some defines describing details about Info file contents. */ /* String Constants. */ -#define INFO_FILE_LABEL "File:" -#define INFO_NODE_LABEL "Node:" -#define INFO_PREV_LABEL "Prev:" -#define INFO_ALTPREV_LABEL "Previous:" -#define INFO_NEXT_LABEL "Next:" -#define INFO_UP_LABEL "Up:" -#define INFO_MENU_LABEL "\n* Menu:" -#define INFO_MENU_ENTRY_LABEL "\n* " -#define INFO_XREF_LABEL "*Note" -#define TAGS_TABLE_END_LABEL "\nEnd Tag Table" -#define TAGS_TABLE_BEG_LABEL "Tag Table:\n" -#define INDIRECT_TAGS_TABLE_LABEL "Indirect:\n" -#define TAGS_TABLE_IS_INDIRECT_LABEL "(Indirect)" +#define INFO_FILE_LABEL "File:" +#define INFO_NODE_LABEL "Node:" +#define INFO_PREV_LABEL "Prev:" +#define INFO_ALTPREV_LABEL "Previous:" +#define INFO_NEXT_LABEL "Next:" +#define INFO_UP_LABEL "Up:" +#define INFO_MENU_LABEL "\n* Menu:" +#define INFO_MENU_ENTRY_LABEL "\n* " +#define INFO_XREF_LABEL "*Note" +#define TAGS_TABLE_END_LABEL "\nEnd Tag Table" +#define TAGS_TABLE_BEG_LABEL "Tag Table:\n" +#define INDIRECT_TAGS_TABLE_LABEL "Indirect:\n" +#define TAGS_TABLE_IS_INDIRECT_LABEL "(Indirect)" /* Character Constants. */ #define INFO_COOKIE '\037' @@ -94,10 +95,10 @@ typedef struct { member in the structure below simply contains the name of the current file. The following structure describes a single node within a file. */ typedef struct { - char *filename; /* The file where this node can be found. */ - char *nodename; /* The node pointed to by this tag. */ - long nodestart; /* The offset of the start of this node. */ - long nodelen; /* The length of this node. */ + char *filename; /* The file where this node can be found. */ + char *nodename; /* The node pointed to by this tag. */ + long nodestart; /* The offset of the start of this node. */ + long nodelen; /* The length of this node. */ } TAG; /* The following structure is used to remember information about the contents @@ -108,21 +109,21 @@ typedef struct { corresponding SLOTS member which says how many slots have been allocated (with malloc ()) for this array. */ typedef struct { - char *filename; /* The filename used to find this file. */ - char *fullpath; /* The full pathname of this info file. */ - struct stat finfo; /* Information about this file. */ - char *contents; /* The contents of this particular file. */ - long filesize; /* The number of bytes this file expands to. */ - char **subfiles; /* If non-null, the list of subfiles. */ - TAG **tags; /* If non-null, the indirect tags table. */ - int tags_slots; /* Number of slots allocated for TAGS. */ - int flags; /* Various flags. Mimics of N_* flags. */ + char *filename; /* The filename used to find this file. */ + char *fullpath; /* The full pathname of this info file. */ + struct stat finfo; /* Information about this file. */ + char *contents; /* The contents of this particular file. */ + long filesize; /* The number of bytes this file expands to. */ + char **subfiles; /* If non-null, the list of subfiles. */ + TAG **tags; /* If non-null, the indirect tags table. */ + int tags_slots; /* Number of slots allocated for TAGS. */ + int flags; /* Various flags. Mimics of N_* flags. */ } FILE_BUFFER; /* **************************************************************** */ -/* */ -/* Externally Visible Functions */ -/* */ +/* */ +/* Externally Visible Functions */ +/* */ /* **************************************************************** */ /* Array of FILE_BUFFER * which represents the currently loaded info files. */ @@ -165,4 +166,4 @@ extern char *info_recent_file_error; /* Create a new, empty file buffer. */ extern FILE_BUFFER *make_file_buffer (); -#endif /* !_NODES_H_ */ +#endif /* !NODES_H */ diff --git a/texinfo/info/search.c b/texinfo/info/search.c index c5fd477..0e8e619 100644 --- a/texinfo/info/search.c +++ b/texinfo/info/search.c @@ -3,7 +3,7 @@ /* This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,17 +21,11 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#include <ctype.h> -#include <sys/types.h> -#include <sys/stat.h> -#include "general.h" +#include "info.h" + #include "search.h" #include "nodes.h" -#if !defined (NULL) -# define NULL 0x0 -#endif /* !NULL */ - /* The search functions take two arguments: 1) a string to search for, and @@ -73,9 +67,9 @@ copy_binding (binding) /* **************************************************************** */ -/* */ -/* The Actual Searching Functions */ -/* */ +/* */ +/* The Actual Searching Functions */ +/* */ /* **************************************************************** */ /* Search forwards or backwards for the text delimited by BINDING. @@ -115,15 +109,15 @@ search_forward (string, binding) if (binding->flags & S_FoldCase) { - alternate = strdup (string); + alternate = xstrdup (string); for (i = 0; i < len; i++) - { - if (islower (alternate[i])) - alternate[i] = toupper (alternate[i]); - else if (isupper (alternate[i])) - alternate[i] = tolower (alternate[i]); - } + { + if (islower (alternate[i])) + alternate[i] = toupper (alternate[i]); + else if (isupper (alternate[i])) + alternate[i] = tolower (alternate[i]); + } } buff = binding->buffer + binding->start; @@ -132,21 +126,21 @@ search_forward (string, binding) while (buff < (end - len)) { for (i = 0; i < len; i++) - { - c = buff[i]; + { + c = buff[i]; - if ((c != string[i]) && (!alternate || c != alternate[i])) - break; - } + if ((c != string[i]) && (!alternate || c != alternate[i])) + break; + } if (!string[i]) - { - if (alternate) - free (alternate); - if (binding->flags & S_SkipDest) - buff += len; - return ((long) (buff - binding->buffer)); - } + { + if (alternate) + free (alternate); + if (binding->flags & S_SkipDest) + buff += len; + return ((long) (buff - binding->buffer)); + } buff++; } @@ -184,15 +178,15 @@ search_backward (input_string, binding) if (binding->flags & S_FoldCase) { - alternate = strdup (string); + alternate = xstrdup (string); for (i = 0; i < len; i++) - { - if (islower (alternate[i])) - alternate[i] = toupper (alternate[i]); - else if (isupper (alternate[i])) - alternate[i] = tolower (alternate[i]); - } + { + if (islower (alternate[i])) + alternate[i] = toupper (alternate[i]); + else if (isupper (alternate[i])) + alternate[i] = tolower (alternate[i]); + } } buff = binding->buffer + binding->start - 1; @@ -201,23 +195,23 @@ search_backward (input_string, binding) while (buff > (end + len)) { for (i = 0; i < len; i++) - { - c = *(buff - i); + { + c = *(buff - i); - if (c != string[i] && (alternate && c != alternate[i])) - break; - } + if (c != string[i] && (alternate && c != alternate[i])) + break; + } if (!string[i]) - { - free (string); - if (alternate) - free (alternate); + { + free (string); + if (alternate) + free (alternate); - if (binding->flags & S_SkipDest) - buff -= len; - return ((long) (1 + (buff - binding->buffer))); - } + if (binding->flags & S_SkipDest) + buff -= len; + return ((long) (1 + (buff - binding->buffer))); + } buff--; } @@ -268,9 +262,9 @@ looking_at (string, binding) } /* **************************************************************** */ -/* */ -/* Small String Searches */ -/* */ +/* */ +/* Small String Searches */ +/* */ /* **************************************************************** */ /* Function names that start with "skip" are passed a string, and return @@ -346,37 +340,43 @@ skip_node_characters (string, newlines_okay) for (; string && (c = string[i]); i++) { if (paren) - { - if (c == '(') - paren++; - else if (c == ')') - paren--; - - continue; - } + { + if (c == '(') + paren++; + else if (c == ')') + paren--; + + continue; + } /* If the character following the close paren is a space or period, - then this node name has no more characters associated with it. */ + then this node name has no more characters associated with it. */ if (c == '\t' || - c == ',' || - c == INFO_TAGSEP || - ((!newlines_okay) && (c == '\n')) || - ((paren_seen && string[i - 1] == ')') && - (c == ' ' || c == '.')) || - (c == '.' && - ((!string[i + 1]) || - (whitespace_or_newline (string[i + 1])) || - (string[i + 1] == ')')))) - break; + c == ',' || + c == INFO_TAGSEP || + ((!newlines_okay) && (c == '\n')) || + ((paren_seen && string[i - 1] == ')') && + (c == ' ' || c == '.')) || + (c == '.' && + ( +#if 0 +/* This test causes a node name ending in a period, like `This.', not to + be found. The trailing . is stripped. This occurs in the jargon + file (`I see no X here.' is a node name). */ + (!string[i + 1]) || +#endif + (whitespace_or_newline (string[i + 1])) || + (string[i + 1] == ')')))) + break; } return (i); } /* **************************************************************** */ -/* */ -/* Searching FILE_BUFFER's */ -/* */ +/* */ +/* Searching FILE_BUFFER's */ +/* */ /* **************************************************************** */ /* Return the absolute position of the first occurence of a node separator in @@ -397,11 +397,11 @@ find_node_separator (binding) table (if present) and the indirect tags table (if present). */ for (i = binding->start; i < binding->end - 1; i++) if (((body[i] == INFO_FF && body[i + 1] == INFO_COOKIE) && - (body[i + 2] == '\n' || - (body[i + 2] == INFO_FF && body[i + 3] == '\n'))) || - ((body[i] == INFO_COOKIE) && - (body[i + 1] == '\n' || - (body[i + 1] == INFO_FF && body[i + 2] == '\n')))) + (body[i + 2] == '\n' || + (body[i + 2] == INFO_FF && body[i + 3] == '\n'))) || + ((body[i] == INFO_COOKIE) && + (body[i + 1] == '\n' || + (body[i + 1] == INFO_FF && body[i + 2] == '\n')))) return (i); return (-1); } @@ -467,7 +467,7 @@ find_tags_table (binding) search.start += skip_node_separator (search.buffer + search.start); if (looking_at (TAGS_TABLE_BEG_LABEL, &search)) - return (position); + return (position); } return (-1); } @@ -482,8 +482,8 @@ find_node_in_binding (nodename, binding) char *nodename; SEARCH_BINDING *binding; { - register long position; - register int offset, namelen; + long position; + int offset, namelen; SEARCH_BINDING search; namelen = strlen (nodename); @@ -501,19 +501,19 @@ find_node_in_binding (nodename, binding) offset = string_in_line (INFO_NODE_LABEL, search.buffer + search.start); if (offset == -1) - continue; + continue; search.start += offset; search.start += skip_whitespace (search.buffer + search.start); offset = skip_node_characters - (search.buffer + search.start, DONT_SKIP_NEWLINES); + (search.buffer + search.start, DONT_SKIP_NEWLINES); /* Notice that this is an exact match. You cannot grovel through - the buffer with this function looking for random nodes. */ + the buffer with this function looking for random nodes. */ if ((offset == namelen) && - (search.buffer[search.start] == nodename[0]) && - (strncmp (search.buffer + search.start, nodename, offset) == 0)) - return (position); + (search.buffer[search.start] == nodename[0]) && + (strncmp (search.buffer + search.start, nodename, offset) == 0)) + return (position); } return (-1); } diff --git a/texinfo/info/search.h b/texinfo/info/search.h index 72695c3..6425536 100644 --- a/texinfo/info/search.h +++ b/texinfo/info/search.h @@ -1,9 +1,10 @@ -/* search.h -- Structure used to search large bodies of text, with bounds. */ +/* search.h -- Structure used to search large bodies of text, with bounds. + $Id: search.h,v 1.3 1997/07/15 18:43:49 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,18 +32,18 @@ They return a long, which is the offset from the start of the buffer at which the match was found. An offset of -1 indicates failure. */ -#if !defined (_SEARCH_H_) -#define _SEARCH_H_ +#ifndef INFO_SEARCH_H +#define INFO_SEARCH_H typedef struct { - char *buffer; /* The buffer of text to search. */ - long start; /* Offset of the start of the search. */ - long end; /* Offset of the end of the searh. */ - int flags; /* Flags controlling the type of search. */ + char *buffer; /* The buffer of text to search. */ + long start; /* Offset of the start of the search. */ + long end; /* Offset of the end of the searh. */ + int flags; /* Flags controlling the type of search. */ } SEARCH_BINDING; -#define S_FoldCase 0x01 /* Set means fold case in searches. */ -#define S_SkipDest 0x02 /* Set means return pointing after the dest. */ +#define S_FoldCase 0x01 /* Set means fold case in searches. */ +#define S_SkipDest 0x02 /* Set means return pointing after the dest. */ SEARCH_BINDING *make_binding (), *copy_binding (); extern long search_forward (), search_backward (), search (); @@ -71,5 +72,4 @@ extern int skip_node_characters (), skip_node_separator (); extern long find_node_separator (), find_tags_table (); extern long find_node_in_binding (); -#endif /* !_SEARCH_H_ */ - +#endif /* not INFO_SEARCH_H */ diff --git a/texinfo/info/session.c b/texinfo/info/session.c index be3076c..a30bbfe 100644 --- a/texinfo/info/session.c +++ b/texinfo/info/session.c @@ -1,9 +1,7 @@ -/* session.c -- The user windowing interface to Info. */ +/* session.c -- The user windowing interface to Info. + $Id: session.c,v 1.12 1997/07/24 21:34:00 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993, 96 Free Software Foundation, Inc. + Copyright (C) 1993, 96, 97 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 @@ -22,11 +20,7 @@ Written by Brian Fox (bfox@ai.mit.edu). */ #include "info.h" -#if defined (HAVE_SYS_FILE_H) -#include <sys/file.h> -#endif /* HAVE_SYS_FILE_H */ #include <sys/ioctl.h> -#include <fcntl.h> #if defined (HAVE_SYS_TIME_H) # include <sys/time.h> @@ -41,28 +35,28 @@ static void info_clear_pending_input (), info_set_pending_input (); static void info_handle_pointer (); /* **************************************************************** */ -/* */ -/* Running an Info Session */ -/* */ +/* */ +/* Running an Info Session */ +/* */ /* **************************************************************** */ /* The place that we are reading input from. */ -static FILE *info_input_stream = (FILE *)NULL; +static FILE *info_input_stream = NULL; /* The last executed command. */ -VFunction *info_last_executed_command = (VFunction *)NULL; +VFunction *info_last_executed_command = NULL; /* Becomes non-zero when 'q' is typed to an Info window. */ int quit_info_immediately = 0; /* Array of structures describing for each window which nodes have been visited in that window. */ -INFO_WINDOW **info_windows = (INFO_WINDOW **)NULL; +INFO_WINDOW **info_windows = NULL; /* Where to add the next window, if we need to add one. */ static int info_windows_index = 0; -/* Number of slots allocated to INFO_WINDOWS. */ +/* Number of slots allocated to `info_windows'. */ static int info_windows_slots = 0; void remember_window_and_node (), forget_window_and_nodes (); @@ -87,52 +81,52 @@ begin_multiple_window_info_session (filename, nodenames) node = info_get_node (filename, nodenames[i]); if (!node) - break; + break; /* If this is the first node, initialize the info session. */ if (!window) - { - initialize_info_session (node); - window = active_window; - } + { + initialize_info_session (node, 1); + window = active_window; + } else - { - /* Find the largest window in WINDOWS, and make that be the active - one. Then split it and add our window and node to the list - of remembered windows and nodes. Then tile the windows. */ - register WINDOW *win, *largest = (WINDOW *)NULL; - int max_height = 0; - - for (win = windows; win; win = win->next) - if (win->height > max_height) - { - max_height = win->height; - largest = win; - } - - if (!largest) - { - display_update_display (windows); - info_error (CANT_FIND_WIND); - info_session (); - exit (0); - } - - active_window = largest; - window = window_make_window (node); - if (window) - { - window_tile_windows (TILE_INTERNALS); - remember_window_and_node (window, node); - } - else - { - display_update_display (windows); - info_error (WIN_TOO_SMALL); - info_session (); - exit (0); - } - } + { + /* Find the largest window in WINDOWS, and make that be the active + one. Then split it and add our window and node to the list + of remembered windows and nodes. Then tile the windows. */ + register WINDOW *win, *largest = (WINDOW *)NULL; + int max_height = 0; + + for (win = windows; win; win = win->next) + if (win->height > max_height) + { + max_height = win->height; + largest = win; + } + + if (!largest) + { + display_update_display (windows); + info_error (CANT_FIND_WIND); + info_session (); + exit (0); + } + + active_window = largest; + window = window_make_window (node); + if (window) + { + window_tile_windows (TILE_INTERNALS); + remember_window_and_node (window, node); + } + else + { + display_update_display (windows); + info_error (WIN_TOO_SMALL); + info_session (); + exit (0); + } + } } display_startup_message_and_start (); } @@ -145,7 +139,7 @@ begin_info_session_with_error (initial_node, format, arg) char *format; void *arg; { - initialize_info_session (initial_node); + initialize_info_session (initial_node, 1); info_error (format, arg, (void *)NULL); info_session (); } @@ -155,7 +149,7 @@ void begin_info_session (initial_node) NODE *initial_node; { - initialize_info_session (initial_node); + initialize_info_session (initial_node, 1); display_startup_message_and_start (); } @@ -165,7 +159,7 @@ display_startup_message_and_start () char *format; format = replace_in_documentation - ("Welcome to Info version %s. \"\\[get-help-window]\" for help, \"\\[menu-item]\" for menu item."); + (_("Welcome to Info version %s. \"\\[get-help-window]\" for help, \"\\[menu-item]\" for menu item.")); window_message_in_echo_area (format, version_string ()); info_session (); @@ -175,9 +169,8 @@ display_startup_message_and_start () void info_session () { - terminal_prep_terminal (); display_update_display (windows); - info_last_executed_command = (VFunction *)NULL; + info_last_executed_command = NULL; info_read_and_dispatch (); /* On program exit, leave the cursor at the bottom of the window, and restore the terminal I/O. */ @@ -202,19 +195,19 @@ info_read_and_dispatch () int lk; /* If we haven't just gone up or down a line, there is no - goal column for this window. */ + goal column for this window. */ if ((info_last_executed_command != info_next_line) && - (info_last_executed_command != info_prev_line)) - active_window->goal_column = -1; + (info_last_executed_command != info_prev_line)) + active_window->goal_column = -1; if (echo_area_is_active) - { - lk = echo_area_last_command_was_kill; - echo_area_prep_read (); - } + { + lk = echo_area_last_command_was_kill; + echo_area_prep_read (); + } if (!info_any_buffered_input_p ()) - display_update_display (windows); + display_update_display (windows); display_cursor_at_point (active_window); info_initialize_numeric_arg (); @@ -223,9 +216,9 @@ info_read_and_dispatch () key = info_get_input_char (); /* No errors yet. We just read a character, that's all. Only clear - the echo_area if it is not currently active. */ + the echo_area if it is not currently active. */ if (!echo_area_is_active) - window_clear_echo_area (); + window_clear_echo_area (); info_error_was_printed = 0; @@ -233,26 +226,26 @@ info_read_and_dispatch () info_dispatch_on_key (key, active_window->keymap); if (echo_area_is_active) - { - /* Echo area commands that do killing increment the value of - ECHO_AREA_LAST_COMMAND_WAS_KILL. Thus, if there is no - change in the value of this variable, the last command - executed was not a kill command. */ - if (lk == echo_area_last_command_was_kill) - echo_area_last_command_was_kill = 0; - - if (ea_last_executed_command == ea_newline || - info_aborted_echo_area) - { - ea_last_executed_command = (VFunction *)NULL; - done = 1; - } - - if (info_last_executed_command == info_quit) - quit_info_immediately = 1; - } + { + /* Echo area commands that do killing increment the value of + ECHO_AREA_LAST_COMMAND_WAS_KILL. Thus, if there is no + change in the value of this variable, the last command + executed was not a kill command. */ + if (lk == echo_area_last_command_was_kill) + echo_area_last_command_was_kill = 0; + + if (ea_last_executed_command == ea_newline || + info_aborted_echo_area) + { + ea_last_executed_command = (VFunction *)NULL; + done = 1; + } + + if (info_last_executed_command == info_quit) + quit_info_immediately = 1; + } else if (info_last_executed_command == info_quit) - done = 1; + done = 1; } } @@ -260,26 +253,30 @@ info_read_and_dispatch () extern void initialize_info_signal_handler (); /* Initialize the first info session by starting the terminal, window, - and display systems. */ + and display systems. If CLEAR_SCREEN is 0, don't clear the screen. */ void -initialize_info_session (node) +initialize_info_session (node, clear_screen) NODE *node; + int clear_screen; { - char *getenv (), *term_name; - - term_name = getenv ("TERM"); + char *term_name = getenv ("TERM"); terminal_initialize_terminal (term_name); if (terminal_is_dumb_p) { if (!term_name) - term_name = "dumb"; + term_name = "dumb"; info_error (TERM_TOO_DUMB, term_name); exit (1); } - terminal_clear_screen (); + if (clear_screen) + { + terminal_prep_terminal (); + terminal_clear_screen (); + } + initialize_info_keymaps (); window_initialize_windows (screenwidth, screenheight); initialize_info_signal_handler (); @@ -290,9 +287,13 @@ initialize_info_session (node) asynchronously deleted (e.g., user resizes window very small). */ window_deletion_notifier = forget_window_and_nodes; - /* If input has not been redirected yet, make it come from STDIN. */ + /* If input has not been redirected yet, make it come from unbuffered + standard input. */ if (!info_input_stream) - info_input_stream = stdin; + { + setbuf(stdin, NULL); + info_input_stream = stdin; + } info_windows_initialized_p = 1; } @@ -361,10 +362,8 @@ remember_window_and_node (window, node) WINDOW *window; NODE *node; { - INFO_WINDOW *info_win; - /* See if we already have this window in our list. */ - info_win = get_info_window_of_window (window); + INFO_WINDOW *info_win = get_info_window_of_window (window); /* If the window wasn't already on our list, then make a new entry. */ if (!info_win) @@ -379,21 +378,19 @@ remember_window_and_node (window, node) info_win->nodes_slots = 0; add_pointer_to_array (info_win, info_windows_index, info_windows, - info_windows_slots, 10, INFO_WINDOW *); + info_windows_slots, 10, INFO_WINDOW *); } /* If this node, the current pagetop, and the current point are the - same as the last saved node and pagetop, don't really add this to - the list of history nodes. */ - { - int ni = info_win->nodes_index - 1; - - if ((ni != -1) && - (info_win->nodes[ni]->contents == node->contents) && - (info_win->pagetops[ni] == window->pagetop) && - (info_win->points[ni] == window->point)) - return; - } + same as the current saved node and pagetop, don't really add this to + the list of history nodes. This may happen only at the very + beginning of the program, I'm not sure. --karl */ + if (info_win->nodes + && info_win->current >= 0 + && info_win->nodes[info_win->current]->contents == node->contents + && info_win->pagetops[info_win->current] == window->pagetop + && info_win->points[info_win->current] == window->point) + return; /* Remember this node, the currently displayed pagetop, and the current location of point in this window. Because we are updating pagetops @@ -401,22 +398,20 @@ remember_window_and_node (window, node) add_pointer_to_array macro here. */ if (info_win->nodes_index + 2 >= info_win->nodes_slots) { - info_win->nodes = (NODE **) - xrealloc (info_win->nodes, - (info_win->nodes_slots += 20) * sizeof (NODE *)); - - info_win->pagetops = (int *) - xrealloc (info_win->pagetops, info_win->nodes_slots * sizeof (int)); - - info_win->points = (long *) - xrealloc (info_win->points, info_win->nodes_slots * sizeof (long)); + info_win->nodes_slots += 20; + info_win->nodes = (NODE **) xrealloc (info_win->nodes, + info_win->nodes_slots * sizeof (NODE *)); + info_win->pagetops = (int *) xrealloc (info_win->pagetops, + info_win->nodes_slots * sizeof (int)); + info_win->points = (long *) xrealloc (info_win->points, + info_win->nodes_slots * sizeof (long)); } info_win->nodes[info_win->nodes_index] = node; info_win->pagetops[info_win->nodes_index] = window->pagetop; info_win->points[info_win->nodes_index] = window->point; info_win->current = info_win->nodes_index++; - info_win->nodes[info_win->nodes_index] = (NODE *)NULL; + info_win->nodes[info_win->nodes_index] = NULL; info_win->pagetops[info_win->nodes_index] = 0; info_win->points[info_win->nodes_index] = 0; } @@ -427,18 +422,17 @@ static void consistency_check_info_windows () { register int i; - INFO_WINDOW *info_win; for (i = 0; i < info_windows_index; i++) { WINDOW *win; for (win = windows; win; win = win->next) - if (win == info_windows[i]->window) - break; + if (win == info_windows[i]->window) + break; if (!win) - abort (); + abort (); } } #endif /* DEBUG_FORGET_WINDOW_AND_NODES */ @@ -459,27 +453,27 @@ forget_window_and_nodes (window) if (info_win) { while (i < info_windows_index) - { - info_windows[i] = info_windows[i + 1]; - i++; - } + { + info_windows[i] = info_windows[i + 1]; + i++; + } info_windows_index--; info_windows[info_windows_index] = (INFO_WINDOW *)NULL; if (info_win->nodes) - { - /* Free the node structures which held onto internal node contents - here. This doesn't free the contents; we have a garbage collector - which does that. */ - for (i = 0; info_win->nodes[i]; i++) - if (internal_info_node_p (info_win->nodes[i])) - free (info_win->nodes[i]); - free (info_win->nodes); - - maybe_free (info_win->pagetops); - maybe_free (info_win->points); - } + { + /* Free the node structures which held onto internal node contents + here. This doesn't free the contents; we have a garbage collector + which does that. */ + for (i = 0; info_win->nodes[i]; i++) + if (internal_info_node_p (info_win->nodes[i])) + free (info_win->nodes[i]); + free (info_win->nodes); + + maybe_free (info_win->pagetops); + maybe_free (info_win->points); + } free (info_win); } @@ -510,9 +504,9 @@ info_set_node_of_window (window, node) /* **************************************************************** */ -/* */ -/* Info Movement Commands */ -/* */ +/* */ +/* Info Movement Commands */ +/* */ /* **************************************************************** */ /* Change the pagetop of WINDOW to DESIRED_TOP, perhaps scrolling the screen @@ -556,8 +550,8 @@ set_window_pagetop (window, desired_top) amount = desired_top - old_pagetop; if ((amount >= window->height) || - (((window->height - amount) * 10) < window->height)) - return; + (((window->height - amount) * 10) < window->height)) + return; start = amount + window->first_row; end = window->height + window->first_row; @@ -571,8 +565,8 @@ set_window_pagetop (window, desired_top) amount = old_pagetop - desired_top; if ((amount >= window->height) || - (((window->height - amount) * 10) < window->height)) - return; + (((window->height - amount) * 10) < window->height)) + return; start = window->first_row; end = (window->first_row + window->height) - amount; @@ -620,7 +614,7 @@ move_to_new_line (old, new, window) int goal; if (new >= window->line_count || new < 0) - return; + return; goal = window_get_goal_column (window); window->goal_column = goal; @@ -632,7 +626,7 @@ move_to_new_line (old, new, window) } /* Move WINDOW's point down to the next line if possible. */ -DECLARE_INFO_COMMAND (info_next_line, "Move down to the next line") +DECLARE_INFO_COMMAND (info_next_line, _("Move down to the next line")) { int old_line, new_line; @@ -647,7 +641,7 @@ DECLARE_INFO_COMMAND (info_next_line, "Move down to the next line") } /* Move WINDOW's point up to the previous line if possible. */ -DECLARE_INFO_COMMAND (info_prev_line, "Move up to the previous line") +DECLARE_INFO_COMMAND (info_prev_line, _("Move up to the previous line")) { int old_line, new_line; @@ -662,7 +656,7 @@ DECLARE_INFO_COMMAND (info_prev_line, "Move up to the previous line") } /* Move WINDOW's point to the end of the true line. */ -DECLARE_INFO_COMMAND (info_end_of_line, "Move to the end of the line") +DECLARE_INFO_COMMAND (info_end_of_line, _("Move to the end of the line")) { register int point, len; register char *buffer; @@ -682,7 +676,7 @@ DECLARE_INFO_COMMAND (info_end_of_line, "Move to the end of the line") } /* Move WINDOW's point to the beginning of the true line. */ -DECLARE_INFO_COMMAND (info_beginning_of_line, "Move to the start of the line") +DECLARE_INFO_COMMAND (info_beginning_of_line, _("Move to the start of the line")) { register int point; register char *buffer; @@ -701,7 +695,7 @@ DECLARE_INFO_COMMAND (info_beginning_of_line, "Move to the start of the line") } /* Move point forward in the node. */ -DECLARE_INFO_COMMAND (info_forward_char, "Move forward a character") +DECLARE_INFO_COMMAND (info_forward_char, _("Move forward a character")) { if (count < 0) info_backward_char (window, -count, key); @@ -710,14 +704,14 @@ DECLARE_INFO_COMMAND (info_forward_char, "Move forward a character") window->point += count; if (window->point >= window->node->nodelen) - window->point = window->node->nodelen - 1; + window->point = window->node->nodelen - 1; info_show_point (window); } } /* Move point backward in the node. */ -DECLARE_INFO_COMMAND (info_backward_char, "Move backward a character") +DECLARE_INFO_COMMAND (info_backward_char, _("Move backward a character")) { if (count < 0) info_forward_char (window, -count, key); @@ -726,7 +720,7 @@ DECLARE_INFO_COMMAND (info_backward_char, "Move backward a character") window->point -= count; if (window->point < 0) - window->point = 0; + window->point = 0; info_show_point (window); } @@ -735,7 +729,7 @@ DECLARE_INFO_COMMAND (info_backward_char, "Move backward a character") #define alphabetic(c) (islower (c) || isupper (c) || isdigit (c)) /* Move forward a word in this node. */ -DECLARE_INFO_COMMAND (info_forward_word, "Move forward a word") +DECLARE_INFO_COMMAND (info_forward_word, _("Move forward a word")) { long point; char *buffer; @@ -754,37 +748,37 @@ DECLARE_INFO_COMMAND (info_forward_word, "Move forward a word") while (count) { if (point + 1 >= end) - return; + return; /* If we are not in a word, move forward until we are in one. - Then, move forward until we hit a non-alphabetic character. */ + Then, move forward until we hit a non-alphabetic character. */ c = buffer[point]; if (!alphabetic (c)) - { - while (++point < end) - { - c = buffer[point]; - if (alphabetic (c)) - break; - } - } + { + while (++point < end) + { + c = buffer[point]; + if (alphabetic (c)) + break; + } + } if (point >= end) return; while (++point < end) - { - c = buffer[point]; - if (!alphabetic (c)) - break; - } + { + c = buffer[point]; + if (!alphabetic (c)) + break; + } --count; } window->point = point; info_show_point (window); } -DECLARE_INFO_COMMAND (info_backward_word, "Move backward a word") +DECLARE_INFO_COMMAND (info_backward_word, _("Move backward a word")) { long point; char *buffer; @@ -802,31 +796,31 @@ DECLARE_INFO_COMMAND (info_backward_word, "Move backward a word") while (count) { if (point == 0) - break; + break; /* Like info_forward_word (), except that we look at the - characters just before point. */ + characters just before point. */ c = buffer[point - 1]; if (!alphabetic (c)) - { - while (--point) - { - c = buffer[point - 1]; - if (alphabetic (c)) - break; - } - } + { + while (--point) + { + c = buffer[point - 1]; + if (alphabetic (c)) + break; + } + } while (point) - { - c = buffer[point - 1]; - if (!alphabetic (c)) - break; - else - --point; - } + { + c = buffer[point - 1]; + if (!alphabetic (c)) + break; + else + --point; + } --count; } window->point = point; @@ -858,9 +852,9 @@ times_description (count) break; if (counter_names[i]) - sprintf (td_buffer, "%s%s", counter_names[i], count > 2 ? " times" : ""); + sprintf (td_buffer, "%s%s", counter_names[i], count > 2 ? _(" times") : ""); else - sprintf (td_buffer, "%d times", count); + sprintf (td_buffer, _("%d times"), count); return (td_buffer); } @@ -869,11 +863,11 @@ times_description (count) already at the bottom of a node. Possible values are defined in session.h. The meanings are: - IS_Continuous Try to get first menu item, or failing that, the - "Next:" pointer, or failing that, the "Up:" and - "Next:" of the up. - IS_NextOnly Try to get "Next:" menu item. - IS_PageOnly Simply give up at the bottom of a node. */ + IS_Continuous Try to get first menu item, or failing that, the + "Next:" pointer, or failing that, the "Up:" and + "Next:" of the up. + IS_NextOnly Try to get "Next:" menu item. + IS_PageOnly Simply give up at the bottom of a node. */ int info_scroll_behaviour = IS_Continuous; @@ -898,136 +892,136 @@ forward_move_node_structure (window, behaviour) case IS_NextOnly: info_next_label_of_node (window->node); if (!info_parsed_nodename && !info_parsed_filename) - info_error ("No \"Next\" pointer for this node."); + info_error (_("No \"Next\" pointer for this node.")); else - { - window_message_in_echo_area ("Following \"Next\" node..."); - info_handle_pointer ("Next", window); - } + { + window_message_in_echo_area (_("Following \"Next\" node...")); + info_handle_pointer (_("Next"), window); + } break; case IS_Continuous: { - /* First things first. If this node contains a menu, move down - into the menu. */ - { - REFERENCE **menu; - - menu = info_menu_of_node (window->node); - - if (menu) - { - info_free_references (menu); - window_message_in_echo_area ("Selecting first menu item..."); - info_menu_digit (window, 1, '1'); - return; - } - } - - /* Okay, this node does not contain a menu. If it contains a - "Next:" pointer, use that. */ - info_next_label_of_node (window->node); - if (info_label_was_found) - { - window_message_in_echo_area ("Selecting \"Next\" node..."); - info_handle_pointer ("Next", window); - return; - } - - /* Okay, there wasn't a "Next:" for this node. Move "Up:" until we - can move "Next:". If that isn't possible, complain that there - are no more nodes. */ - { - int up_counter, old_current; - INFO_WINDOW *info_win; - - /* Remember the current node and location. */ - info_win = get_info_window_of_window (window); - old_current = info_win->current; - - /* Back up through the "Up:" pointers until we have found a "Next:" - that isn't the same as the first menu item found in that node. */ - up_counter = 0; - while (!info_error_was_printed) - { - info_up_label_of_node (window->node); - if (info_label_was_found) - { - info_handle_pointer ("Up", window); - if (info_error_was_printed) - continue; - - up_counter++; - - info_next_label_of_node (window->node); - - /* If no "Next" pointer, keep backing up. */ - if (!info_label_was_found) - continue; - - /* If this node's first menu item is the same as this node's - Next pointer, keep backing up. */ - if (!info_parsed_filename) - { - REFERENCE **menu; - char *next_nodename; - - /* Remember the name of the Next node, since reading - the menu can overwrite the contents of the - info_parsed_xxx strings. */ - next_nodename = strdup (info_parsed_nodename); - - menu = info_menu_of_node (window->node); - if (menu && - (strcmp - (menu[0]->nodename, next_nodename) == 0)) - { - info_free_references (menu); - free (next_nodename); - continue; - } - else - { - /* Restore the world to where it was before - reading the menu contents. */ - info_free_references (menu); - free (next_nodename); - info_next_label_of_node (window->node); - } - } - - /* This node has a "Next" pointer, and it is not the - same as the first menu item found in this node. */ - window_message_in_echo_area - ("Moving \"Up\" %s, then \"Next\".", - times_description (up_counter)); - - info_handle_pointer ("Next", window); - return; - } - else - { - /* No more "Up" pointers. Print an error, and call it - quits. */ - register int i; - - for (i = 0; i < up_counter; i++) - { - info_win->nodes_index--; - free (info_win->nodes[info_win->nodes_index]); - info_win->nodes[info_win->nodes_index] = (NODE *)NULL; - } - info_win->current = old_current; - window->node = info_win->nodes[old_current]; - window->pagetop = info_win->pagetops[old_current]; - window->point = info_win->points[old_current]; - recalculate_line_starts (window); - window->flags |= W_UpdateWindow; - info_error ("No more nodes."); - } - } - } - break; + /* First things first. If this node contains a menu, move down + into the menu. */ + { + REFERENCE **menu; + + menu = info_menu_of_node (window->node); + + if (menu) + { + info_free_references (menu); + window_message_in_echo_area (_("Selecting first menu item...")); + info_menu_digit (window, 1, '1'); + return; + } + } + + /* Okay, this node does not contain a menu. If it contains a + "Next:" pointer, use that. */ + info_next_label_of_node (window->node); + if (info_label_was_found) + { + window_message_in_echo_area (_("Selecting \"Next\" node...")); + info_handle_pointer (_("Next"), window); + return; + } + + /* Okay, there wasn't a "Next:" for this node. Move "Up:" until we + can move "Next:". If that isn't possible, complain that there + are no more nodes. */ + { + int up_counter, old_current; + INFO_WINDOW *info_win; + + /* Remember the current node and location. */ + info_win = get_info_window_of_window (window); + old_current = info_win->current; + + /* Back up through the "Up:" pointers until we have found a "Next:" + that isn't the same as the first menu item found in that node. */ + up_counter = 0; + while (!info_error_was_printed) + { + info_up_label_of_node (window->node); + if (info_label_was_found) + { + info_handle_pointer (_("Up"), window); + if (info_error_was_printed) + continue; + + up_counter++; + + info_next_label_of_node (window->node); + + /* If no "Next" pointer, keep backing up. */ + if (!info_label_was_found) + continue; + + /* If this node's first menu item is the same as this node's + Next pointer, keep backing up. */ + if (!info_parsed_filename) + { + REFERENCE **menu; + char *next_nodename; + + /* Remember the name of the Next node, since reading + the menu can overwrite the contents of the + info_parsed_xxx strings. */ + next_nodename = xstrdup (info_parsed_nodename); + + menu = info_menu_of_node (window->node); + if (menu && + (strcmp + (menu[0]->nodename, next_nodename) == 0)) + { + info_free_references (menu); + free (next_nodename); + continue; + } + else + { + /* Restore the world to where it was before + reading the menu contents. */ + info_free_references (menu); + free (next_nodename); + info_next_label_of_node (window->node); + } + } + + /* This node has a "Next" pointer, and it is not the + same as the first menu item found in this node. */ + window_message_in_echo_area + ("Moving \"Up\" %s, then \"Next\".", + times_description (up_counter)); + + info_handle_pointer (_("Next"), window); + return; + } + else + { + /* No more "Up" pointers. Print an error, and call it + quits. */ + register int i; + + for (i = 0; i < up_counter; i++) + { + info_win->nodes_index--; + free (info_win->nodes[info_win->nodes_index]); + info_win->nodes[info_win->nodes_index] = (NODE *)NULL; + } + info_win->current = old_current; + window->node = info_win->nodes[old_current]; + window->pagetop = info_win->pagetops[old_current]; + window->point = info_win->points[old_current]; + recalculate_line_starts (window); + window->flags |= W_UpdateWindow; + info_error (_("No more nodes.")); + } + } + } + break; } } } @@ -1047,115 +1041,115 @@ backward_move_node_structure (window, behaviour) case IS_NextOnly: info_prev_label_of_node (window->node); if (!info_parsed_nodename && !info_parsed_filename) - info_error ("No \"Prev\" for this node."); + info_error (_("No \"Prev\" for this node.")); else - { - window_message_in_echo_area ("Moving \"Prev\" in this window."); - info_handle_pointer ("Prev", window); - } + { + window_message_in_echo_area (_("Moving \"Prev\" in this window.")); + info_handle_pointer (_("Prev"), window); + } break; case IS_Continuous: info_prev_label_of_node (window->node); if (!info_parsed_nodename && !info_parsed_filename) - { - info_up_label_of_node (window->node); - if (!info_parsed_nodename && !info_parsed_filename) - info_error ("No \"Prev\" or \"Up\" for this node."); - else - { - window_message_in_echo_area ("Moving \"Up\" in this window."); - info_handle_pointer ("Up", window); - } - } + { + info_up_label_of_node (window->node); + if (!info_parsed_nodename && !info_parsed_filename) + info_error (_("No \"Prev\" or \"Up\" for this node.")); + else + { + window_message_in_echo_area (_("Moving \"Up\" in this window.")); + info_handle_pointer (_("Up"), window); + } + } else - { - REFERENCE **menu; - int inhibit_menu_traversing = 0; - - /* Watch out! If this node's Prev is the same as the Up, then - move Up. Otherwise, we could move Prev, and then to the last - menu item in the Prev. This would cause the user to loop - through a subsection of the info file. */ - if (!info_parsed_filename && info_parsed_nodename) - { - char *pnode; - - pnode = strdup (info_parsed_nodename); - info_up_label_of_node (window->node); - - if (!info_parsed_filename && info_parsed_nodename && - strcmp (info_parsed_nodename, pnode) == 0) - { - /* The nodes are the same. Inhibit moving to the last - menu item. */ - free (pnode); - inhibit_menu_traversing = 1; - } - else - { - free (pnode); - info_prev_label_of_node (window->node); - } - } - - /* Move to the previous node. If this node now contains a menu, - and we have not inhibited movement to it, move to the node - corresponding to the last menu item. */ - window_message_in_echo_area ("Moving \"Prev\" in this window."); - info_handle_pointer ("Prev", window); - - if (!inhibit_menu_traversing) - { - while (!info_error_was_printed && - (menu = info_menu_of_node (window->node))) - { - info_free_references (menu); - window_message_in_echo_area - ("Moving to \"Prev\"'s last menu item."); - info_menu_digit (window, 1, '0'); - } - } - } + { + REFERENCE **menu; + int inhibit_menu_traversing = 0; + + /* Watch out! If this node's Prev is the same as the Up, then + move Up. Otherwise, we could move Prev, and then to the last + menu item in the Prev. This would cause the user to loop + through a subsection of the info file. */ + if (!info_parsed_filename && info_parsed_nodename) + { + char *pnode; + + pnode = xstrdup (info_parsed_nodename); + info_up_label_of_node (window->node); + + if (!info_parsed_filename && info_parsed_nodename && + strcmp (info_parsed_nodename, pnode) == 0) + { + /* The nodes are the same. Inhibit moving to the last + menu item. */ + free (pnode); + inhibit_menu_traversing = 1; + } + else + { + free (pnode); + info_prev_label_of_node (window->node); + } + } + + /* Move to the previous node. If this node now contains a menu, + and we have not inhibited movement to it, move to the node + corresponding to the last menu item. */ + window_message_in_echo_area (_("Moving \"Prev\" in this window.")); + info_handle_pointer (_("Prev"), window); + + if (!inhibit_menu_traversing) + { + while (!info_error_was_printed && + (menu = info_menu_of_node (window->node))) + { + info_free_references (menu); + window_message_in_echo_area + (_("Moving to \"Prev\"'s last menu item.")); + info_menu_digit (window, 1, '0'); + } + } + } break; } } /* Move continuously forward through the node structure of this info file. */ DECLARE_INFO_COMMAND (info_global_next_node, - "Move forwards or down through node structure") + _("Move forwards or down through node structure")) { if (count < 0) info_global_prev_node (window, -count, key); else { while (count && !info_error_was_printed) - { - forward_move_node_structure (window, IS_Continuous); - count--; - } + { + forward_move_node_structure (window, IS_Continuous); + count--; + } } } /* Move continuously backward through the node structure of this info file. */ DECLARE_INFO_COMMAND (info_global_prev_node, - "Move backwards or up through node structure") + _("Move backwards or up through node structure")) { if (count < 0) info_global_next_node (window, -count, key); else { while (count && !info_error_was_printed) - { - backward_move_node_structure (window, IS_Continuous); - count--; - } + { + backward_move_node_structure (window, IS_Continuous); + count--; + } } } /* Show the next screen of WINDOW's node. */ -DECLARE_INFO_COMMAND (info_scroll_forward, "Scroll forward in this window") +DECLARE_INFO_COMMAND (info_scroll_forward, _("Scroll forward in this window")) { if (count < 0) info_scroll_backward (window, -count, key); @@ -1164,43 +1158,43 @@ DECLARE_INFO_COMMAND (info_scroll_forward, "Scroll forward in this window") int desired_top; /* Without an explicit numeric argument, scroll the bottom two - lines to the top of this window, Or, if at bottom of window, - and the user wishes to scroll through nodes get the "Next" node - for this window. */ + lines to the top of this window, Or, if at bottom of window, + and the user wishes to scroll through nodes get the "Next" node + for this window. */ if (!info_explicit_arg && count == 1) - { - desired_top = window->pagetop + (window->height - 2); - - /* If there are no more lines to scroll here, error, or get - another node, depending on INFO_SCROLL_BEHAVIOUR. */ - if (desired_top > window->line_count) - { - int behaviour = info_scroll_behaviour; - - /* Here is a hack. If the key being used is not SPC, do the - PageOnly behaviour. */ - if (key != SPC && key != DEL) - behaviour = IS_PageOnly; - - forward_move_node_structure (window, behaviour); - return; - } - } + { + desired_top = window->pagetop + (window->height - 2); + + /* If there are no more lines to scroll here, error, or get + another node, depending on INFO_SCROLL_BEHAVIOUR. */ + if (desired_top > window->line_count) + { + int behaviour = info_scroll_behaviour; + + /* Here is a hack. If the key being used is not SPC, do the + PageOnly behaviour. */ + if (key != SPC && key != DEL) + behaviour = IS_PageOnly; + + forward_move_node_structure (window, behaviour); + return; + } + } else - desired_top = window->pagetop + count; + desired_top = window->pagetop + count; if (desired_top >= window->line_count) - desired_top = window->line_count - 2; + desired_top = window->line_count - 2; if (window->pagetop > desired_top) - return; + return; else - set_window_pagetop (window, desired_top); + set_window_pagetop (window, desired_top); } } /* Show the previous screen of WINDOW's node. */ -DECLARE_INFO_COMMAND (info_scroll_backward, "Scroll backward in this window") +DECLARE_INFO_COMMAND (info_scroll_backward, _("Scroll backward in this window")) { if (count < 0) info_scroll_forward (window, -count, key); @@ -1209,58 +1203,58 @@ DECLARE_INFO_COMMAND (info_scroll_backward, "Scroll backward in this window") int desired_top; /* Without an explicit numeric argument, scroll the top two lines - to the bottom of this window, or move to the previous, or Up'th - node. */ + to the bottom of this window, or move to the previous, or Up'th + node. */ if (!info_explicit_arg && count == 1) - { - desired_top = window->pagetop - (window->height - 2); - - if ((desired_top < 0) && (window->pagetop == 0)) - { - int behaviour = info_scroll_behaviour; - - /* Same kind of hack as in info_scroll_forward. If the key - used to invoke this command is not DEL, do only the PageOnly - behaviour. */ - if (key != DEL && key != SPC) - behaviour = IS_PageOnly; - - backward_move_node_structure (window, behaviour); - return; - } - } + { + desired_top = window->pagetop - (window->height - 2); + + if ((desired_top < 0) && (window->pagetop == 0)) + { + int behaviour = info_scroll_behaviour; + + /* Same kind of hack as in info_scroll_forward. If the key + used to invoke this command is not DEL, do only the PageOnly + behaviour. */ + if (key != DEL && key != SPC) + behaviour = IS_PageOnly; + + backward_move_node_structure (window, behaviour); + return; + } + } else - desired_top = window->pagetop - count; + desired_top = window->pagetop - count; if (desired_top < 0) - desired_top = 0; + desired_top = 0; set_window_pagetop (window, desired_top); } } /* Move to the beginning of the node. */ -DECLARE_INFO_COMMAND (info_beginning_of_node, "Move to the start of this node") +DECLARE_INFO_COMMAND (info_beginning_of_node, _("Move to the start of this node")) { window->pagetop = window->point = 0; window->flags |= W_UpdateWindow; } /* Move to the end of the node. */ -DECLARE_INFO_COMMAND (info_end_of_node, "Move to the end of this node") +DECLARE_INFO_COMMAND (info_end_of_node, _("Move to the end of this node")) { window->point = window->node->nodelen - 1; info_show_point (window); } /* **************************************************************** */ -/* */ -/* Commands for Manipulating Windows */ -/* */ +/* */ +/* Commands for Manipulating Windows */ +/* */ /* **************************************************************** */ /* Make the next window in the chain be the active window. */ -DECLARE_INFO_COMMAND (info_next_window, "Select the next window") +DECLARE_INFO_COMMAND (info_next_window, _("Select the next window")) { if (count < 0) { @@ -1278,20 +1272,20 @@ DECLARE_INFO_COMMAND (info_next_window, "Select the next window") while (count--) { if (window->next) - window = window->next; + window = window->next; else - { - if (window == the_echo_area || !echo_area_is_active) - window = windows; - else - window = the_echo_area; - } + { + if (window == the_echo_area || !echo_area_is_active) + window = windows; + else + window = the_echo_area; + } } if (active_window != window) { if (auto_footnotes_p) - info_get_or_remove_footnotes (window); + info_get_or_remove_footnotes (window); window->flags |= W_UpdateWindow; active_window = window; @@ -1299,7 +1293,7 @@ DECLARE_INFO_COMMAND (info_next_window, "Select the next window") } /* Make the previous window in the chain be the active window. */ -DECLARE_INFO_COMMAND (info_prev_window, "Select the previous window") +DECLARE_INFO_COMMAND (info_prev_window, _("Select the previous window")) { if (count < 0) { @@ -1318,30 +1312,30 @@ DECLARE_INFO_COMMAND (info_prev_window, "Select the previous window") while (count--) { /* If we are in the echo area, or if the echo area isn't active and we - are in the first window, find the last window in the chain. */ + are in the first window, find the last window in the chain. */ if (window == the_echo_area || - (window == windows && !echo_area_is_active)) - { - register WINDOW *win, *last; + (window == windows && !echo_area_is_active)) + { + register WINDOW *win, *last; - for (win = windows; win; win = win->next) - last = win; + for (win = windows; win; win = win->next) + last = win; - window = last; - } + window = last; + } else - { - if (window == windows) - window = the_echo_area; - else - window = window->prev; - } + { + if (window == windows) + window = the_echo_area; + else + window = window->prev; + } } if (active_window != window) { if (auto_footnotes_p) - info_get_or_remove_footnotes (window); + info_get_or_remove_footnotes (window); window->flags |= W_UpdateWindow; active_window = window; @@ -1350,7 +1344,7 @@ DECLARE_INFO_COMMAND (info_prev_window, "Select the previous window") /* Split WINDOW into two windows, both showing the same node. If we are automatically tiling windows, re-tile after the split. */ -DECLARE_INFO_COMMAND (info_split_window, "Split the current window") +DECLARE_INFO_COMMAND (info_split_window, _("Split the current window")) { WINDOW *split, *old_active; int pagetop; @@ -1374,54 +1368,54 @@ DECLARE_INFO_COMMAND (info_split_window, "Split the current window") #if defined (SPLIT_BEFORE_ACTIVE) /* Try to scroll the old window into its new postion. */ if (pagetop == window->pagetop) - { - int start, end, amount; - - start = split->first_row; - end = start + window->height; - amount = split->height + 1; - display_scroll_display (start, end, amount); - } + { + int start, end, amount; + + start = split->first_row; + end = start + window->height; + amount = split->height + 1; + display_scroll_display (start, end, amount); + } #else /* !SPLIT_BEFORE_ACTIVE */ /* Make sure point still appears in the active window. */ info_show_point (window); #endif /* !SPLIT_BEFORE_ACTIVE */ /* If the window just split was one internal to Info, try to display - something else in it. */ + something else in it. */ if (internal_info_node_p (split->node)) - { - register int i, j; - INFO_WINDOW *iw; - NODE *node = (NODE *)NULL; - char *filename; - - for (i = 0; iw = info_windows[i]; i++) - { - for (j = 0; j < iw->nodes_index; j++) - if (!internal_info_node_p (iw->nodes[j])) - { - if (iw->nodes[j]->parent) - filename = iw->nodes[j]->parent; - else - filename = iw->nodes[j]->filename; - - node = info_get_node (filename, iw->nodes[j]->nodename); - if (node) - { - window_set_node_of_window (split, node); - i = info_windows_index - 1; - break; - } - } - } - } + { + register int i, j; + INFO_WINDOW *iw; + NODE *node = (NODE *)NULL; + char *filename; + + for (i = 0; (iw = info_windows[i]); i++) + { + for (j = 0; j < iw->nodes_index; j++) + if (!internal_info_node_p (iw->nodes[j])) + { + if (iw->nodes[j]->parent) + filename = iw->nodes[j]->parent; + else + filename = iw->nodes[j]->filename; + + node = info_get_node (filename, iw->nodes[j]->nodename); + if (node) + { + window_set_node_of_window (split, node); + i = info_windows_index - 1; + break; + } + } + } + } split->pagetop = window->pagetop; if (auto_tiling_p) - window_tile_windows (DONT_TILE_INTERNALS); + window_tile_windows (DONT_TILE_INTERNALS); else - window_adjust_pagetop (split); + window_adjust_pagetop (split); remember_window_and_node (split, split->node); } @@ -1431,7 +1425,7 @@ DECLARE_INFO_COMMAND (info_split_window, "Split the current window") automatically displaying footnotes, show or remove the footnotes window. If we are automatically tiling windows, re-tile after the deletion. */ -DECLARE_INFO_COMMAND (info_delete_window, "Delete the current window") +DECLARE_INFO_COMMAND (info_delete_window, _("Delete the current window")) { if (!windows->next) { @@ -1439,17 +1433,17 @@ DECLARE_INFO_COMMAND (info_delete_window, "Delete the current window") } else if (window->flags & W_WindowIsPerm) { - info_error ("Cannot delete a permanent window"); + info_error (_("Cannot delete a permanent window")); } else { info_delete_window_internal (window); if (auto_footnotes_p) - info_get_or_remove_footnotes (active_window); + info_get_or_remove_footnotes (active_window); if (auto_tiling_p) - window_tile_windows (DONT_TILE_INTERNALS); + window_tile_windows (DONT_TILE_INTERNALS); } } @@ -1462,19 +1456,19 @@ info_delete_window_internal (window) if (windows->next && ((window->flags & W_WindowIsPerm) == 0)) { /* We not only delete the window from the display, we forget it from - our list of remembered windows. */ + our list of remembered windows. */ forget_window_and_nodes (window); window_delete_window (window); if (echo_area_is_active) - echo_area_inform_of_deleted_window (window); + echo_area_inform_of_deleted_window (window); } } /* Just keep WINDOW, deleting all others. */ -DECLARE_INFO_COMMAND (info_keep_one_window, "Delete all other windows") +DECLARE_INFO_COMMAND (info_keep_one_window, _("Delete all other windows")) { - int num_deleted; /* The number of windows we deleted. */ + int num_deleted; /* The number of windows we deleted. */ int pagetop, start, end; /* Remember a few things about this window. We may be able to speed up @@ -1490,14 +1484,14 @@ DECLARE_INFO_COMMAND (info_keep_one_window, "Delete all other windows") WINDOW *win; /* Find an eligible window and delete it. If no eligible windows - are found, we are done. A window is eligible for deletion if - is it not permanent, and it is not WINDOW. */ + are found, we are done. A window is eligible for deletion if + is it not permanent, and it is not WINDOW. */ for (win = windows; win; win = win->next) - if (win != window && ((win->flags & W_WindowIsPerm) == 0)) - break; + if (win != window && ((win->flags & W_WindowIsPerm) == 0)) + break; if (!win) - break; + break; info_delete_window_internal (win); num_deleted++; @@ -1518,7 +1512,7 @@ DECLARE_INFO_COMMAND (info_keep_one_window, "Delete all other windows") } /* Scroll the "other" window of WINDOW. */ -DECLARE_INFO_COMMAND (info_scroll_other_window, "Scroll the other window") +DECLARE_INFO_COMMAND (info_scroll_other_window, _("Scroll the other window")) { WINDOW *other; @@ -1538,7 +1532,7 @@ DECLARE_INFO_COMMAND (info_scroll_other_window, "Scroll the other window") } /* Change the size of WINDOW by AMOUNT. */ -DECLARE_INFO_COMMAND (info_grow_window, "Grow (or shrink) this window") +DECLARE_INFO_COMMAND (info_grow_window, _("Grow (or shrink) this window")) { window_change_window_height (window, count); } @@ -1549,22 +1543,22 @@ int auto_tiling_p = 0; /* Tile all of the visible windows. */ DECLARE_INFO_COMMAND (info_tile_windows, - "Divide the available screen space among the visible windows") + _("Divide the available screen space among the visible windows")) { window_tile_windows (TILE_INTERNALS); } /* Toggle the state of this window's wrapping of lines. */ DECLARE_INFO_COMMAND (info_toggle_wrap, - "Toggle the state of line wrapping in the current window") + _("Toggle the state of line wrapping in the current window")) { window_toggle_wrap (window); } /* **************************************************************** */ -/* */ -/* Info Node Commands */ -/* */ +/* */ +/* Info Node Commands */ +/* */ /* **************************************************************** */ /* Using WINDOW for various defaults, select the node referenced by ENTRY @@ -1586,12 +1580,12 @@ info_select_reference (window, entry) filename = window->node->filename; if (filename) - filename = strdup (filename); + filename = xstrdup (filename); if (entry->nodename) - nodename = strdup (entry->nodename); + nodename = xstrdup (entry->nodename); else - nodename = strdup ("Top"); + nodename = xstrdup ("Top"); node = info_get_node (filename, nodename); @@ -1601,25 +1595,25 @@ info_select_reference (window, entry) if (!node) { if (info_recent_file_error) - file_system_error = strdup (info_recent_file_error); + file_system_error = xstrdup (info_recent_file_error); if (entry->nodename && (strcmp (entry->nodename, entry->label) == 0)) - { - node = info_get_node (entry->label, "Top"); - if (!node && info_recent_file_error) - { - maybe_free (file_system_error); - file_system_error = strdup (info_recent_file_error); - } - } + { + node = info_get_node (entry->label, "Top"); + if (!node && info_recent_file_error) + { + maybe_free (file_system_error); + file_system_error = xstrdup (info_recent_file_error); + } + } } if (!node) { if (file_system_error) - info_error (file_system_error); + info_error (file_system_error); else - info_error (CANT_FIND_NODE, nodename); + info_error (CANT_FIND_NODE, nodename); } maybe_free (file_system_error); @@ -1669,42 +1663,42 @@ info_handle_pointer (label, window) filename = nodename = (char *)NULL; if (info_parsed_filename) - filename = strdup (info_parsed_filename); + filename = xstrdup (info_parsed_filename); else - { - if (window->node->parent) - filename = strdup (window->node->parent); - else if (window->node->filename) - filename = strdup (window->node->filename); - } + { + if (window->node->parent) + filename = xstrdup (window->node->parent); + else if (window->node->filename) + filename = xstrdup (window->node->filename); + } if (info_parsed_nodename) - nodename = strdup (info_parsed_nodename); + nodename = xstrdup (info_parsed_nodename); else - nodename = strdup ("Top"); + nodename = xstrdup ("Top"); node = info_get_node (filename, nodename); if (node) - { - INFO_WINDOW *info_win; - - info_win = get_info_window_of_window (window); - if (info_win) - { - info_win->pagetops[info_win->current] = window->pagetop; - info_win->points[info_win->current] = window->point; - } - set_remembered_pagetop_and_point (window); - info_set_node_of_window (window, node); - } + { + INFO_WINDOW *info_win; + + info_win = get_info_window_of_window (window); + if (info_win) + { + info_win->pagetops[info_win->current] = window->pagetop; + info_win->points[info_win->current] = window->point; + } + set_remembered_pagetop_and_point (window); + info_set_node_of_window (window, node); + } else - { - if (info_recent_file_error) - info_error (info_recent_file_error); - else - info_error (CANT_FILE_NODE, filename, nodename); - } + { + if (info_recent_file_error) + info_error (info_recent_file_error); + else + info_error (CANT_FILE_NODE, filename, nodename); + } free (filename); free (nodename); @@ -1717,30 +1711,30 @@ info_handle_pointer (label, window) /* Make WINDOW display the "Next:" node of the node currently being displayed. */ -DECLARE_INFO_COMMAND (info_next_node, "Select the `Next' node") +DECLARE_INFO_COMMAND (info_next_node, _("Select the `Next' node")) { info_next_label_of_node (window->node); - info_handle_pointer ("Next", window); + info_handle_pointer (_("Next"), window); } /* Make WINDOW display the "Prev:" node of the node currently being displayed. */ -DECLARE_INFO_COMMAND (info_prev_node, "Select the `Prev' node") +DECLARE_INFO_COMMAND (info_prev_node, _("Select the `Prev' node")) { info_prev_label_of_node (window->node); - info_handle_pointer ("Prev", window); + info_handle_pointer (_("Prev"), window); } /* Make WINDOW display the "Up:" node of the node currently being displayed. */ -DECLARE_INFO_COMMAND (info_up_node, "Select the `Up' node") +DECLARE_INFO_COMMAND (info_up_node, _("Select the `Up' node")) { info_up_label_of_node (window->node); - info_handle_pointer ("Up", window); + info_handle_pointer (_("Up"), window); } /* Make WINDOW display the last node of this info file. */ -DECLARE_INFO_COMMAND (info_last_node, "Select the last node in this file") +DECLARE_INFO_COMMAND (info_last_node, _("Select the last node in this file")) { register int i; FILE_BUFFER *fb = file_buffer_of_window (window); @@ -1753,7 +1747,7 @@ DECLARE_INFO_COMMAND (info_last_node, "Select the last node in this file") } if (!node) - info_error ("This window has no additional nodes"); + info_error (_("This window has no additional nodes")); else { set_remembered_pagetop_and_point (window); @@ -1762,7 +1756,7 @@ DECLARE_INFO_COMMAND (info_last_node, "Select the last node in this file") } /* Make WINDOW display the first node of this info file. */ -DECLARE_INFO_COMMAND (info_first_node, "Select the first node in this file") +DECLARE_INFO_COMMAND (info_first_node, _("Select the first node in this file")) { FILE_BUFFER *fb = file_buffer_of_window (window); NODE *node = (NODE *)NULL; @@ -1771,7 +1765,7 @@ DECLARE_INFO_COMMAND (info_first_node, "Select the first node in this file") node = info_get_node (fb->filename, fb->tags[0]->nodename); if (!node) - info_error ("This window has no additional nodes"); + info_error (_("This window has no additional nodes")); else { set_remembered_pagetop_and_point (window); @@ -1779,55 +1773,15 @@ DECLARE_INFO_COMMAND (info_first_node, "Select the first node in this file") } } -/* Make WINDOW display the previous node displayed in this window. */ -DECLARE_INFO_COMMAND (info_history_node, - "Select the most recently selected node") -{ - INFO_WINDOW *info_win; - - /* Find the INFO_WINDOW which contains WINDOW. */ - info_win = get_info_window_of_window (window); - - if (!info_win) - { - info_error ("Requested window is not present!"); - return; - } - - set_remembered_pagetop_and_point (window); - if (!info_win->current) - { - if (info_win->nodes_index > 1) - { - window_message_in_echo_area - ("Now wrapped around to beginning of history."); - info_win->current = info_win->nodes_index; - } - else - { - info_error ("No earlier nodes in this window."); - return; - } - } - - info_win->current--; - window_set_node_of_window (window, info_win->nodes[info_win->current]); - window->pagetop = info_win->pagetops[info_win->current]; - window->point = info_win->points[info_win->current]; - window->flags |= W_UpdateWindow; - if (auto_footnotes_p) - info_get_or_remove_footnotes (window); -} - /* Select the last menu item in WINDOW->node. */ DECLARE_INFO_COMMAND (info_last_menu_item, - "Select the last item in this node's menu") + _("Select the last item in this node's menu")) { info_menu_digit (window, 1, '0'); } /* Use KEY (a digit) to select the Nth menu item in WINDOW->node. */ -DECLARE_INFO_COMMAND (info_menu_digit, "Select this menu item") +DECLARE_INFO_COMMAND (info_menu_digit, _("Select this menu item")) { register int i, item; register REFERENCE *entry, **menu; @@ -1848,15 +1802,15 @@ DECLARE_INFO_COMMAND (info_menu_digit, "Select this menu item") for (i = 0; menu[i + 1]; i++); else { - for (i = 0; entry = menu[i]; i++) - if (i == item - 1) - break; + for (i = 0; (entry = menu[i]); i++) + if (i == item - 1) + break; } if (menu[i]) info_select_reference (window, menu[i]); else - info_error ("There aren't %d items in this menu.", item); + info_error (_("There aren't %d items in this menu."), item); info_free_references (menu); return; @@ -1883,9 +1837,9 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) if (!menu) { if (builder == info_menu_of_node) - info_error (NO_MENU_NODE); + info_error (NO_MENU_NODE); else - info_error (NO_XREF_NODE); + info_error (NO_XREF_NODE); return; } @@ -1899,77 +1853,77 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) if (point_line != -1) { - SEARCH_BINDING binding; - - binding.buffer = window->node->contents; - binding.start = window->line_starts[point_line] - binding.buffer; - if (window->line_starts[point_line + 1]) - binding.end = window->line_starts[point_line + 1] - binding.buffer; - else - binding.end = window->node->nodelen; - binding.flags = 0; - - if (builder == info_menu_of_node) - { - if (point_line) - { - binding.start--; - refs = info_menu_items (&binding); - } - } - else - { + SEARCH_BINDING binding; + + binding.buffer = window->node->contents; + binding.start = window->line_starts[point_line] - binding.buffer; + if (window->line_starts[point_line + 1]) + binding.end = window->line_starts[point_line + 1] - binding.buffer; + else + binding.end = window->node->nodelen; + binding.flags = 0; + + if (builder == info_menu_of_node) + { + if (point_line) + { + binding.start--; + refs = info_menu_items (&binding); + } + } + else + { #if defined (HANDLE_MAN_PAGES) - if (window->node->flags & N_IsManPage) - refs = manpage_xrefs_in_binding (window->node, &binding); - else + if (window->node->flags & N_IsManPage) + refs = manpage_xrefs_in_binding (window->node, &binding); + else #endif /* HANDLE_MAN_PAGES */ - refs = info_xrefs (&binding); - } - - if (refs) - { - if ((strcmp (refs[0]->label, "Menu") != 0) || - (builder == info_xrefs_of_node)) - { - int which = 0; - - /* Find the closest reference to point. */ - if (builder == info_xrefs_of_node) - { - int closest = -1; - - for (; refs[which]; which++) - { - if ((window->point >= refs[which]->start) && - (window->point <= refs[which]->end)) - { - closest = which; - break; - } - else if (window->point < refs[which]->start) - { - break; - } - } - if (closest == -1) - which--; - else - which = closest; - } - - defentry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); - defentry->label = strdup (refs[which]->label); - defentry->filename = refs[which]->filename; - defentry->nodename = refs[which]->nodename; - - if (defentry->filename) - defentry->filename = strdup (defentry->filename); - if (defentry->nodename) - defentry->nodename = strdup (defentry->nodename); - } - info_free_references (refs); - } + refs = info_xrefs (&binding); + } + + if (refs) + { + if ((strcmp (refs[0]->label, "Menu") != 0) || + (builder == info_xrefs_of_node)) + { + int which = 0; + + /* Find the closest reference to point. */ + if (builder == info_xrefs_of_node) + { + int closest = -1; + + for (; refs[which]; which++) + { + if ((window->point >= refs[which]->start) && + (window->point <= refs[which]->end)) + { + closest = which; + break; + } + else if (window->point < refs[which]->start) + { + break; + } + } + if (closest == -1) + which--; + else + which = closest; + } + + defentry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); + defentry->label = xstrdup (refs[which]->label); + defentry->filename = refs[which]->filename; + defentry->nodename = refs[which]->nodename; + + if (defentry->filename) + defentry->filename = xstrdup (defentry->filename); + if (defentry->nodename) + defentry->nodename = xstrdup (defentry->nodename); + } + info_free_references (refs); + } } } @@ -1980,24 +1934,24 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) /* Build the prompt string. */ if (defentry) - prompt = (char *)xmalloc (20 + strlen (defentry->label)); + prompt = (char *)xmalloc (20 + strlen (defentry->label)); else - prompt = (char *)xmalloc (20); + prompt = (char *)xmalloc (20); if (builder == info_menu_of_node) - { - if (defentry) - sprintf (prompt, "Menu item (%s): ", defentry->label); - else - sprintf (prompt, "Menu item: "); - } + { + if (defentry) + sprintf (prompt, _("Menu item (%s): "), defentry->label); + else + sprintf (prompt, _("Menu item: ")); + } else - { - if (defentry) - sprintf (prompt, "Follow xref (%s): ", defentry->label); - else - sprintf (prompt, "Follow xref: "); - } + { + if (defentry) + sprintf (prompt, _("Follow xref (%s): "), defentry->label); + else + sprintf (prompt, _("Follow xref: ")); + } line = info_read_completing_in_echo_area (window, prompt, menu); free (prompt); @@ -2006,31 +1960,31 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) /* User aborts, just quit. */ if (!line) - { - maybe_free (defentry); - info_free_references (menu); - info_abort_key (window, 0, 0); - return; - } + { + maybe_free (defentry); + info_free_references (menu); + info_abort_key (window, 0, 0); + return; + } /* If we had a default and the user accepted it, use that. */ if (!*line) - { - free (line); - if (defentry) - line = strdup (defentry->label); - else - line = (char *)NULL; - } + { + free (line); + if (defentry) + line = xstrdup (defentry->label); + else + line = (char *)NULL; + } } else { /* Not going to ask any questions. If we have a default entry, use - that, otherwise return. */ + that, otherwise return. */ if (!defentry) - return; + return; else - line = strdup (defentry->label); + line = xstrdup (defentry->label); } if (line) @@ -2039,42 +1993,42 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) entry = info_get_labeled_reference (line, menu); if (!entry && defentry) - info_error ("The reference disappeared! (%s).", line); + info_error (_("The reference disappeared! (%s)."), line); else - { - NODE *orig; - - orig = window->node; - info_select_reference (window, entry); - if ((builder == info_xrefs_of_node) && (window->node != orig)) - { - long offset; - long start; - - if (window->line_count > 0) - start = window->line_starts[1] - window->node->contents; - else - start = 0; - - offset = - info_target_search_node (window->node, entry->label, start); - - if (offset != -1) - { - window->point = offset; - window_adjust_pagetop (window); - } - } - } + { + NODE *orig; + + orig = window->node; + info_select_reference (window, entry); + if ((builder == info_xrefs_of_node) && (window->node != orig)) + { + long offset; + long start; + + if (window->line_count > 0) + start = window->line_starts[1] - window->node->contents; + else + start = 0; + + offset = + info_target_search_node (window->node, entry->label, start); + + if (offset != -1) + { + window->point = offset; + window_adjust_pagetop (window); + } + } + } free (line); if (defentry) - { - free (defentry->label); - maybe_free (defentry->filename); - maybe_free (defentry->nodename); - free (defentry); - } + { + free (defentry->label); + maybe_free (defentry->filename); + maybe_free (defentry->nodename); + free (defentry); + } } info_free_references (menu); @@ -2085,7 +2039,7 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) /* Read a line (with completion) which is the name of a menu item, and select that item. */ -DECLARE_INFO_COMMAND (info_menu_item, "Read a menu item and select its node") +DECLARE_INFO_COMMAND (info_menu_item, _("Read a menu item and select its node")) { info_menu_or_ref_item (window, count, key, info_menu_of_node, 1); } @@ -2093,13 +2047,13 @@ DECLARE_INFO_COMMAND (info_menu_item, "Read a menu item and select its node") /* Read a line (with completion) which is the name of a reference to follow, and select the node. */ DECLARE_INFO_COMMAND - (info_xref_item, "Read a footnote or cross reference and select its node") + (info_xref_item, _("Read a footnote or cross reference and select its node")) { info_menu_or_ref_item (window, count, key, info_xrefs_of_node, 1); } /* Position the cursor at the start of this node's menu. */ -DECLARE_INFO_COMMAND (info_find_menu, "Move to the start of this node's menu") +DECLARE_INFO_COMMAND (info_find_menu, _("Move to the start of this node's menu")) { SEARCH_BINDING binding; long position; @@ -2123,7 +2077,7 @@ DECLARE_INFO_COMMAND (info_find_menu, "Move to the start of this node's menu") /* Visit as many menu items as is possible, each in a separate window. */ DECLARE_INFO_COMMAND (info_visit_menu, - "Visit as many menu items at once as possible") + _("Visit as many menu items at once as possible")) { register int i; REFERENCE *entry, **menu; @@ -2141,20 +2095,19 @@ DECLARE_INFO_COMMAND (info_visit_menu, window_tile_windows (TILE_INTERNALS); if (!new) - info_error (WIN_TOO_SMALL); + info_error (WIN_TOO_SMALL); else - { - active_window = new; - info_select_reference (new, entry); - } + { + active_window = new; + info_select_reference (new, entry); + } } } /* Read a line of input which is a node name, and go to that node. */ -DECLARE_INFO_COMMAND (info_goto_node, "Read a node name and select it") +DECLARE_INFO_COMMAND (info_goto_node, _("Read a node name and select it")) { char *line; - NODE *node; #define GOTO_COMPLETES #if defined (GOTO_COMPLETES) @@ -2170,54 +2123,54 @@ DECLARE_INFO_COMMAND (info_goto_node, "Read a node name and select it") for (fbi = 0; info_loaded_files && info_loaded_files[fbi]; fbi++) { - FILE_BUFFER *fb; - REFERENCE *entry; - int this_is_the_current_fb; - - fb = info_loaded_files[fbi]; - this_is_the_current_fb = (current == fb); - - entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); - entry->filename = entry->nodename = (char *)NULL; - entry->label = (char *)xmalloc (4 + strlen (fb->filename)); - sprintf (entry->label, "(%s)*", fb->filename); - - add_pointer_to_array - (entry, items_index, items, items_slots, 10, REFERENCE *); - - if (fb->tags) - { - for (i = 0; fb->tags[i]; i++) - { - entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); - entry->filename = entry->nodename = (char *)NULL; - entry->label = (char *) xmalloc - (4 + strlen (fb->filename) + strlen (fb->tags[i]->nodename)); - sprintf (entry->label, "(%s)%s", - fb->filename, fb->tags[i]->nodename); - - add_pointer_to_array - (entry, items_index, items, items_slots, 100, REFERENCE *); - } - - if (this_is_the_current_fb) - { - for (i = 0; fb->tags[i]; i++) - { - entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); - entry->filename = entry->nodename = (char *)NULL; - entry->label = strdup (fb->tags[i]->nodename); - add_pointer_to_array (entry, items_index, items, - items_slots, 100, REFERENCE *); - } - } - } + FILE_BUFFER *fb; + REFERENCE *entry; + int this_is_the_current_fb; + + fb = info_loaded_files[fbi]; + this_is_the_current_fb = (current == fb); + + entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); + entry->filename = entry->nodename = (char *)NULL; + entry->label = (char *)xmalloc (4 + strlen (fb->filename)); + sprintf (entry->label, "(%s)*", fb->filename); + + add_pointer_to_array + (entry, items_index, items, items_slots, 10, REFERENCE *); + + if (fb->tags) + { + for (i = 0; fb->tags[i]; i++) + { + entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); + entry->filename = entry->nodename = (char *)NULL; + entry->label = (char *) xmalloc + (4 + strlen (fb->filename) + strlen (fb->tags[i]->nodename)); + sprintf (entry->label, "(%s)%s", + fb->filename, fb->tags[i]->nodename); + + add_pointer_to_array + (entry, items_index, items, items_slots, 100, REFERENCE *); + } + + if (this_is_the_current_fb) + { + for (i = 0; fb->tags[i]; i++) + { + entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); + entry->filename = entry->nodename = (char *)NULL; + entry->label = xstrdup (fb->tags[i]->nodename); + add_pointer_to_array (entry, items_index, items, + items_slots, 100, REFERENCE *); + } + } + } } - line = info_read_maybe_completing (window, "Goto Node: ", items); + line = info_read_maybe_completing (window, _("Goto Node: "), items); info_free_references (items); } #else /* !GOTO_COMPLETES */ - line = info_read_in_echo_area (window, "Goto Node: "); + line = info_read_in_echo_area (window, _("Goto Node: ")); #endif /* !GOTO_COMPLETES */ /* If the user aborted, quit now. */ @@ -2238,12 +2191,11 @@ DECLARE_INFO_COMMAND (info_goto_node, "Read a node name and select it") } #if defined (HANDLE_MAN_PAGES) -DECLARE_INFO_COMMAND (info_man, "Read a manpage reference and select it") +DECLARE_INFO_COMMAND (info_man, _("Read a manpage reference and select it")) { char *line; - NODE *node; - line = info_read_in_echo_area (window, "Get Manpage: "); + line = info_read_in_echo_area (window, _("Get Manpage: ")); if (!line) { @@ -2258,7 +2210,7 @@ DECLARE_INFO_COMMAND (info_man, "Read a manpage reference and select it") char *goto_command; goto_command = (char *)xmalloc - (4 + strlen (MANPAGE_FILE_BUFFER_NAME) + strlen (line)); + (4 + strlen (MANPAGE_FILE_BUFFER_NAME) + strlen (line)); sprintf (goto_command, "(%s)%s", MANPAGE_FILE_BUFFER_NAME, line); @@ -2273,61 +2225,70 @@ DECLARE_INFO_COMMAND (info_man, "Read a manpage reference and select it") #endif /* HANDLE_MAN_PAGES */ /* Move to the "Top" node in this file. */ -DECLARE_INFO_COMMAND (info_top_node, "Select the node `Top' in this file") +DECLARE_INFO_COMMAND (info_top_node, _("Select the node `Top' in this file")) { - info_parse_and_select ("Top", window); + info_parse_and_select (_("Top"), window); } /* Move to the node "(dir)Top". */ -DECLARE_INFO_COMMAND (info_dir_node, "Select the node `(dir)'") +DECLARE_INFO_COMMAND (info_dir_node, _("Select the node `(dir)'")) { info_parse_and_select ("(dir)Top", window); } -/* Try to delete the current node appearing in this window, showing the most - recently selected node in this window. */ -DECLARE_INFO_COMMAND (info_kill_node, "Kill this node") + +/* Read the name of a node to kill. The list of available nodes comes + from the nodes appearing in the current window configuration. */ +static char * +read_nodename_to_kill (window) + WINDOW *window; { - register int iw, i; - register INFO_WINDOW *info_win; - char *nodename = (char *)NULL; - NODE *temp = (NODE *)NULL; + int iw; + char *nodename; + INFO_WINDOW *info_win; + REFERENCE **menu = NULL; + int menu_index = 0, menu_slots = 0; + char *default_nodename = xstrdup (active_window->node->nodename); + char *prompt = xmalloc (40 + strlen (default_nodename)); - /* Read the name of a node to kill. The list of available nodes comes - from the nodes appearing in the current window configuration. */ - { - REFERENCE **menu = (REFERENCE **)NULL; - int menu_index = 0, menu_slots = 0; - char *default_nodename, *prompt; + sprintf (prompt, _("Kill node (%s): "), default_nodename); - for (iw = 0; info_win = info_windows[iw]; iw++) - { - REFERENCE *entry; + for (iw = 0; (info_win = info_windows[iw]); iw++) + { + REFERENCE *entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); + entry->label = xstrdup (info_win->window->node->nodename); + entry->filename = entry->nodename = (char *)NULL; - entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); - entry->label = strdup (info_win->window->node->nodename); - entry->filename = entry->nodename = (char *)NULL; + add_pointer_to_array (entry, menu_index, menu, menu_slots, 10, + REFERENCE *); + } - add_pointer_to_array - (entry, menu_index, menu, menu_slots, 10, REFERENCE *); - } + nodename = info_read_completing_in_echo_area (window, prompt, menu); + free (prompt); + info_free_references (menu); + if (nodename && !*nodename) + { + free (nodename); + nodename = default_nodename; + } + else + free (default_nodename); - default_nodename = strdup (active_window->node->nodename); - prompt = (char *)xmalloc (40 + strlen (default_nodename)); - sprintf (prompt, "Kill node (%s): ", default_nodename); + return nodename; +} - nodename = info_read_completing_in_echo_area (window, prompt, menu); - free (prompt); - info_free_references (menu); - if (nodename && !*nodename) - { - free (nodename); - nodename = default_nodename; - } - else - free (default_nodename); - } +/* Delete NODENAME from this window, showing the most + recently selected node in this window. */ +static void +kill_node (window, nodename) + WINDOW *window; + char *nodename; +{ + int iw, i; + INFO_WINDOW *info_win; + NODE *temp; + /* If there is no nodename to kill, quit now. */ if (!nodename) { @@ -2336,16 +2297,16 @@ DECLARE_INFO_COMMAND (info_kill_node, "Kill this node") } /* If there is a nodename, find it in our window list. */ - for (iw = 0; info_win = info_windows[iw]; iw++) + for (iw = 0; (info_win = info_windows[iw]); iw++) if (strcmp (nodename, info_win->nodes[info_win->current]->nodename) == 0) break; if (!info_win) { if (*nodename) - info_error ("Cannot kill the node `%s'", nodename); + info_error (_("Cannot kill node `%s'"), nodename); else - window_clear_echo_area (); + window_clear_echo_area (); return; } @@ -2353,13 +2314,12 @@ DECLARE_INFO_COMMAND (info_kill_node, "Kill this node") /* If there are no more nodes left anywhere to view, complain and exit. */ if (info_windows_index == 1 && info_windows[0]->nodes_index == 1) { - info_error ("Cannot kill the last node"); + info_error (_("Cannot kill the last node")); return; } - /* INFO_WIN contains the node that the user wants to stop viewing. - Delete this node from the list of nodes previously shown in this - window. */ + /* INFO_WIN contains the node that the user wants to stop viewing. Delete + this node from the list of nodes previously shown in this window. */ for (i = info_win->current; i < info_win->nodes_index; i++) info_win->nodes[i] = info_win->nodes[i++]; @@ -2378,41 +2338,40 @@ DECLARE_INFO_COMMAND (info_kill_node, "Kill this node") long point; if (info_windows[iw + 1]) - stealer = info_windows[iw + 1]; + stealer = info_windows[iw + 1]; else - stealer = info_windows[0]; + stealer = info_windows[0]; /* If the node being displayed in the next window is not the most - recently loaded one, get the most recently loaded one. */ + recently loaded one, get the most recently loaded one. */ if ((stealer->nodes_index - 1) != stealer->current) - which = stealer->nodes_index - 1; + which = stealer->nodes_index - 1; /* Else, if there is another node behind the stealers current node, - use that one. */ + use that one. */ else if (stealer->current > 0) - which = stealer->current - 1; + which = stealer->current - 1; /* Else, just use the node appearing in STEALER's window. */ else - which = stealer->current; + which = stealer->current; /* Copy this node. */ { - NODE *copy; - - temp = stealer->nodes[which]; - point = stealer->points[which]; - pagetop = stealer->pagetops[which]; - - copy = (NODE *)xmalloc (sizeof (NODE)); - copy->filename = temp->filename; - copy->parent = temp->parent; - copy->nodename = temp->nodename; - copy->contents = temp->contents; - copy->nodelen = temp->nodelen; - copy->flags = temp->flags; - - temp = copy; + NODE *copy = xmalloc (sizeof (NODE)); + + temp = stealer->nodes[which]; + point = stealer->points[which]; + pagetop = stealer->pagetops[which]; + + copy->filename = temp->filename; + copy->parent = temp->parent; + copy->nodename = temp->nodename; + copy->contents = temp->contents; + copy->nodelen = temp->nodelen; + copy->flags = temp->flags; + + temp = copy; } window_set_node_of_window (info_win->window, temp); @@ -2425,16 +2384,39 @@ DECLARE_INFO_COMMAND (info_kill_node, "Kill this node") temp = info_win->nodes[info_win->current]; window_set_node_of_window (info_win->window, temp); } + if (!info_error_was_printed) window_clear_echo_area (); + + if (auto_footnotes_p) + info_get_or_remove_footnotes (window); +} + +/* Kill current node, thus going back one in the node history. I (karl) + do not think this is completely correct yet, because of the + window-changing stuff in kill_node, but it's a lot better than the + previous implementation, which did not account for nodes being + visited twice at all. */ +DECLARE_INFO_COMMAND (info_history_node, + _("Select the most recently selected node")) +{ + kill_node (window, active_window->node->nodename); +} + +/* Kill named node. */ +DECLARE_INFO_COMMAND (info_kill_node, _("Kill this node")) +{ + char *nodename = read_nodename_to_kill (window); + kill_node (window, nodename); } + /* Read the name of a file and select the entire file. */ -DECLARE_INFO_COMMAND (info_view_file, "Read the name of a file and select it") +DECLARE_INFO_COMMAND (info_view_file, _("Read the name of a file and select it")) { char *line; - line = info_read_in_echo_area (window, "Find file: "); + line = info_read_in_echo_area (window, _("Find file: ")); if (!line) { info_abort_key (active_window, 1, 0); @@ -2447,17 +2429,17 @@ DECLARE_INFO_COMMAND (info_view_file, "Read the name of a file and select it") node = info_get_node (line, "*"); if (!node) - { - if (info_recent_file_error) - info_error (info_recent_file_error); - else - info_error ("Cannot find \"%s\".", line); - } + { + if (info_recent_file_error) + info_error (info_recent_file_error); + else + info_error (_("Cannot find \"%s\"."), line); + } else - { - set_remembered_pagetop_and_point (active_window); - info_set_node_of_window (window, node); - } + { + set_remembered_pagetop_and_point (active_window); + info_set_node_of_window (window, node); + } free (line); } @@ -2466,9 +2448,9 @@ DECLARE_INFO_COMMAND (info_view_file, "Read the name of a file and select it") } /* **************************************************************** */ -/* */ -/* Dumping and Printing Nodes */ -/* */ +/* */ +/* Dumping and Printing Nodes */ +/* */ /* **************************************************************** */ #define VERBOSE_NODE_DUMPING @@ -2498,7 +2480,7 @@ dump_nodes_to_file (filename, nodenames, output_filename, dump_subnodes) if (!output_stream) { - info_error ("Could not create output file \"%s\".", output_filename); + info_error (_("Could not create output file \"%s\"."), output_filename); return; } @@ -2511,7 +2493,7 @@ dump_nodes_to_file (filename, nodenames, output_filename, dump_subnodes) fclose (output_stream); #if defined (VERBOSE_NODE_DUMPING) - info_error ("Done."); + info_error (_("Done.")); #endif /* VERBOSE_NODE_DUMPING */ } @@ -2543,15 +2525,15 @@ dump_node_to_stream (filename, nodename, stream, dump_subnodes) if (!node) { if (info_recent_file_error) - info_error (info_recent_file_error); + info_error (info_recent_file_error); else - { - if (filename && *nodename != '(') - info_error - (CANT_FILE_NODE, filename_non_directory (filename), nodename); - else - info_error (CANT_FIND_NODE, nodename); - } + { + if (filename && *nodename != '(') + info_error + (CANT_FILE_NODE, filename_non_directory (filename), nodename); + else + info_error (CANT_FIND_NODE, nodename); + } return; } @@ -2559,19 +2541,19 @@ dump_node_to_stream (filename, nodename, stream, dump_subnodes) for (i = 0; i < dumped_already_index; i++) if (strcmp (node->nodename, dumped_already[i]) == 0) { - free (node); - return; + free (node); + return; } add_pointer_to_array (node->nodename, dumped_already_index, dumped_already, - dumped_already_slots, 50, char *); + dumped_already_slots, 50, char *); #if defined (VERBOSE_NODE_DUMPING) /* Maybe we should print some information about the node being output. */ if (node->filename) - info_error ("Writing node \"(%s)%s\"...", - filename_non_directory (node->filename), node->nodename); + info_error (_("Writing node \"(%s)%s\"..."), + filename_non_directory (node->filename), node->nodename); else - info_error ("Writing node \"%s\"...", node->nodename); + info_error (_("Writing node \"%s\"..."), node->nodename); #endif /* VERBOSE_NODE_DUMPING */ write_node_to_stream (node, stream); @@ -2584,20 +2566,20 @@ dump_node_to_stream (filename, nodename, stream, dump_subnodes) /* If this node is an Index, do not dump the menu references. */ if (string_in_line ("Index", node->nodename) == -1) - menu = info_menu_of_node (node); + menu = info_menu_of_node (node); if (menu) - { - for (i = 0; menu[i]; i++) - { - /* We don't dump Info files which are different than the - current one. */ - if (!menu[i]->filename) - dump_node_to_stream - (filename, menu[i]->nodename, stream, dump_subnodes); - } - info_free_references (menu); - } + { + for (i = 0; menu[i]; i++) + { + /* We don't dump Info files which are different than the + current one. */ + if (!menu[i]->filename) + dump_node_to_stream + (filename, menu[i]->nodename, stream, dump_subnodes); + } + info_free_references (menu); + } } free (node); @@ -2623,7 +2605,7 @@ dump_node_to_file (node, filename, dump_subnodes) if (!output_stream) { - info_error ("Could not create output file \"%s\".", filename); + info_error (_("Could not create output file \"%s\"."), filename); return; } @@ -2640,7 +2622,7 @@ dump_node_to_file (node, filename, dump_subnodes) fclose (output_stream); #if defined (VERBOSE_NODE_DUMPING) - info_error ("Done."); + info_error (_("Done.")); #endif /* VERBOSE_NODE_DUMPING */ } @@ -2649,7 +2631,7 @@ dump_node_to_file (node, filename, dump_subnodes) #endif /* !DEFAULT_INFO_PRINT_COMMAND */ DECLARE_INFO_COMMAND (info_print_node, - "Pipe the contents of this node through INFO_PRINT_COMMAND") + _("Pipe the contents of this node through INFO_PRINT_COMMAND")) { print_node (window->node); } @@ -2659,10 +2641,8 @@ void print_node (node) NODE *node; { - char *print_command, *getenv (); FILE *printer_pipe; - - print_command = getenv ("INFO_PRINT_COMMAND"); + char *print_command = getenv ("INFO_PRINT_COMMAND"); if (!print_command || !*print_command) print_command = DEFAULT_INFO_PRINT_COMMAND; @@ -2671,24 +2651,24 @@ print_node (node) if (!printer_pipe) { - info_error ("Cannot open pipe to \"%s\".", print_command); + info_error (_("Cannot open pipe to \"%s\"."), print_command); return; } #if defined (VERBOSE_NODE_DUMPING) /* Maybe we should print some information about the node being output. */ if (node->filename) - info_error ("Printing node \"(%s)%s\"...", - filename_non_directory (node->filename), node->nodename); + info_error (_("Printing node \"(%s)%s\"..."), + filename_non_directory (node->filename), node->nodename); else - info_error ("Printing node \"%s\"...", node->nodename); + info_error (_("Printing node \"%s\"..."), node->nodename); #endif /* VERBOSE_NODE_DUMPING */ write_node_to_stream (node, printer_pipe); pclose (printer_pipe); #if defined (VERBOSE_NODE_DUMPING) - info_error ("Done."); + info_error (_("Done.")); #endif /* VERBOSE_NODE_DUMPING */ } @@ -2701,9 +2681,9 @@ write_node_to_stream (node, stream) } /* **************************************************************** */ -/* */ -/* Info Searching Commands */ -/* */ +/* */ +/* Info Searching Commands */ +/* */ /* **************************************************************** */ /* Variable controlling the garbage collection of files briefly visited @@ -2778,7 +2758,7 @@ info_search_in_node (string, node, start, window, dir) { set_remembered_pagetop_and_point (window); if (window->node != node) - window_set_node_of_window (window, node); + window_set_node_of_window (window, node); window->point = offset; window_adjust_pagetop (window); } @@ -2798,7 +2778,7 @@ info_target_search_node (node, string, start) long offset; char *target; - target = strdup (string); + target = xstrdup (string); i = strlen (target); /* Try repeatedly searching for this string while removing words from @@ -2809,7 +2789,7 @@ info_target_search_node (node, string, start) offset = info_search_in_node (target, node, start, (WINDOW *)NULL, 1); if (offset != -1) - break; + break; /* Delete the last word from TARGET. */ for (; i && (!whitespace (target[i]) && (target[i] != ',')); i--); @@ -2843,22 +2823,22 @@ info_search_internal (string, window, dir) (strcmp (last_searched_for_string, string) == 0)) { ret = info_search_in_node - (string, window->node, window->point + dir, window, dir); + (string, window->node, window->point + dir, window, dir); } else { ret = info_search_in_node - (string, window->node, window->point, window, dir); + (string, window->node, window->point, window, dir); } maybe_free (last_searched_for_string); - last_searched_for_string = strdup (string); + last_searched_for_string = xstrdup (string); if (ret != -1) { /* We won! */ if (!echo_area_is_active && !isearch_is_active) - window_clear_echo_area (); + window_clear_echo_area (); return (0); } @@ -2879,91 +2859,91 @@ info_search_internal (string, window, dir) /* Find number of tags and current tag. */ last_subfile = (char *)NULL; for (i = 0; file_buffer->tags[i]; i++) - if (strcmp (initial_nodename, file_buffer->tags[i]->nodename) == 0) - { - current_tag = i; - last_subfile = file_buffer->tags[i]->filename; - } + if (strcmp (initial_nodename, file_buffer->tags[i]->nodename) == 0) + { + current_tag = i; + last_subfile = file_buffer->tags[i]->filename; + } number_of_tags = i; /* If there is no last_subfile, our tag wasn't found. */ if (!last_subfile) - return (-1); + return (-1); /* Search through subsequent nodes, wrapping around to the top - of the info file until we find the string or return to this - window's node and point. */ + of the info file until we find the string or return to this + window's node and point. */ while (1) - { - NODE *node; - - /* Allow C-g to quit the search, failing it if pressed. */ - return_if_control_g (-1); - - current_tag += dir; - - if (current_tag < 0) - current_tag = number_of_tags - 1; - else if (current_tag == number_of_tags) - current_tag = 0; - - tag = file_buffer->tags[current_tag]; - - if (!echo_area_is_active && (last_subfile != tag->filename)) - { - window_message_in_echo_area - ("Searching subfile \"%s\"...", - filename_non_directory (tag->filename)); - - last_subfile = tag->filename; - } - - node = info_get_node (file_buffer->filename, tag->nodename); - - if (!node) - { - /* If not doing i-search... */ - if (!echo_area_is_active) - { - if (info_recent_file_error) - info_error (info_recent_file_error); - else - info_error (CANT_FILE_NODE, - filename_non_directory (file_buffer->filename), - tag->nodename); - } - return (-1); - } - - if (dir < 0) - start = tag->nodelen; - - ret = - info_search_in_node (string, node, start, window, dir); - - /* Did we find the string in this node? */ - if (ret != -1) - { - /* Yes! We win. */ - remember_window_and_node (window, node); - if (!echo_area_is_active) - window_clear_echo_area (); - return (0); - } - - /* No. Free this node, and make sure that we haven't passed - our starting point. */ - free (node); - - if (strcmp (initial_nodename, tag->nodename) == 0) - return (-1); - } + { + NODE *node; + + /* Allow C-g to quit the search, failing it if pressed. */ + return_if_control_g (-1); + + current_tag += dir; + + if (current_tag < 0) + current_tag = number_of_tags - 1; + else if (current_tag == number_of_tags) + current_tag = 0; + + tag = file_buffer->tags[current_tag]; + + if (!echo_area_is_active && (last_subfile != tag->filename)) + { + window_message_in_echo_area + (_("Searching subfile \"%s\"..."), + filename_non_directory (tag->filename)); + + last_subfile = tag->filename; + } + + node = info_get_node (file_buffer->filename, tag->nodename); + + if (!node) + { + /* If not doing i-search... */ + if (!echo_area_is_active) + { + if (info_recent_file_error) + info_error (info_recent_file_error); + else + info_error (CANT_FILE_NODE, + filename_non_directory (file_buffer->filename), + tag->nodename); + } + return (-1); + } + + if (dir < 0) + start = tag->nodelen; + + ret = + info_search_in_node (string, node, start, window, dir); + + /* Did we find the string in this node? */ + if (ret != -1) + { + /* Yes! We win. */ + remember_window_and_node (window, node); + if (!echo_area_is_active) + window_clear_echo_area (); + return (0); + } + + /* No. Free this node, and make sure that we haven't passed + our starting point. */ + free (node); + + if (strcmp (initial_nodename, tag->nodename) == 0) + return (-1); + } } return (-1); } -DECLARE_INFO_COMMAND (info_search, "Read a string and search for it") +DECLARE_INFO_COMMAND (info_search, _("Read a string and search for it")) { char *line, *prompt; int result, old_pagetop; @@ -2983,9 +2963,9 @@ DECLARE_INFO_COMMAND (info_search, "Read a string and search for it") prompt = (char *)xmalloc (50 + strlen (search_string)); - sprintf (prompt, "%s for string [%s]: ", - direction < 0 ? "Search backward" : "Search", - search_string); + sprintf (prompt, _("%s for string [%s]: "), + direction < 0 ? _("Search backward") : _("Search"), + search_string); line = info_read_in_echo_area (window, prompt); free (prompt); @@ -2999,8 +2979,8 @@ DECLARE_INFO_COMMAND (info_search, "Read a string and search for it") if (*line) { if (strlen (line) + 1 > search_string_size) - search_string = (char *) - xrealloc (search_string, (search_string_size += 50 + strlen (line))); + search_string = (char *) + xrealloc (search_string, (search_string_size += 50 + strlen (line))); strcpy (search_string, line); search_string_index = strlen (line); @@ -3011,7 +2991,7 @@ DECLARE_INFO_COMMAND (info_search, "Read a string and search for it") result = info_search_internal (search_string, active_window, direction); if (result != 0 && !info_error_was_printed) - info_error ("Search failed."); + info_error (_("Search failed.")); else if (old_pagetop != active_window->pagetop) { int new_pagetop; @@ -3020,7 +3000,7 @@ DECLARE_INFO_COMMAND (info_search, "Read a string and search for it") active_window->pagetop = old_pagetop; set_window_pagetop (active_window, new_pagetop); if (auto_footnotes_p) - info_get_or_remove_footnotes (active_window); + info_get_or_remove_footnotes (active_window); } /* Perhaps free the unreferenced file buffers that were searched, but @@ -3029,21 +3009,21 @@ DECLARE_INFO_COMMAND (info_search, "Read a string and search for it") } /* **************************************************************** */ -/* */ -/* Incremental Searching */ -/* */ +/* */ +/* Incremental Searching */ +/* */ /* **************************************************************** */ static void incremental_search (); DECLARE_INFO_COMMAND (isearch_forward, - "Search interactively for a string as you type it") + _("Search interactively for a string as you type it")) { incremental_search (window, count, key); } DECLARE_INFO_COMMAND (isearch_backward, - "Search interactively for a string as you type it") + _("Search interactively for a string as you type it")) { incremental_search (window, -count, key); } @@ -3060,10 +3040,10 @@ static unsigned char isearch_terminate_search_key = ESC; /* Structure defining the current state of an incremental search. */ typedef struct { - WINDOW_STATE_DECL; /* The node, pagetop and point. */ - int search_index; /* Offset of the last char in the search string. */ - int direction; /* The direction that this search is heading in. */ - int failing; /* Whether or not this search failed. */ + WINDOW_STATE_DECL; /* The node, pagetop and point. */ + int search_index; /* Offset of the last char in the search string. */ + int direction; /* The direction that this search is heading in. */ + int failing; /* Whether or not this search failed. */ } SEARCH_STATE; /* Array of search states. */ @@ -3086,7 +3066,7 @@ push_isearch (window, search_index, direction, failing) state->failing = failing; add_pointer_to_array (state, isearch_states_index, isearch_states, - isearch_states_slots, 20, SEARCH_STATE *); + isearch_states_slots, 20, SEARCH_STATE *); } /* Pop the state of this search to WINDOW, SEARCH_INDEX, and DIRECTION. */ @@ -3137,9 +3117,9 @@ show_isearch_prompt (dir, string, failing_p) int prompt_len, p_rep_index, p_rep_size; if (dir < 0) - prefix = "I-search backward: "; + prefix = _("I-search backward: "); else - prefix = "I-search: "; + prefix = _("I-search: "); p_rep_index = p_rep_size = 0; p_rep = (char *)NULL; @@ -3148,15 +3128,15 @@ show_isearch_prompt (dir, string, failing_p) char *rep; switch (string[i]) - { - case ' ': rep = " "; break; - case LFD: rep = "\\n"; break; - case TAB: rep = "\\t"; break; - default: - rep = pretty_keyname (string[i]); - } + { + case ' ': rep = " "; break; + case LFD: rep = "\\n"; break; + case TAB: rep = "\\t"; break; + default: + rep = pretty_keyname (string[i]); + } if ((p_rep_index + strlen (rep) + 1) >= p_rep_size) - p_rep = (char *)xrealloc (p_rep, p_rep_size += 100); + p_rep = (char *)xrealloc (p_rep, p_rep_size += 100); strcpy (p_rep + p_rep_index, rep); p_rep_index += strlen (rep); @@ -3164,8 +3144,8 @@ show_isearch_prompt (dir, string, failing_p) prompt_len = strlen (prefix) + p_rep_index + 20; prompt = (char *)xmalloc (prompt_len); - sprintf (prompt, "%s%s%s", failing_p ? "Failing " : "", prefix, - p_rep ? p_rep : ""); + sprintf (prompt, "%s%s%s", failing_p ? _("Failing ") : "", prefix, + p_rep ? p_rep : ""); window_message_in_echo_area ("%s", prompt); maybe_free (p_rep); @@ -3208,202 +3188,202 @@ incremental_search (window, count, ignore) int quoted = 0; /* If a recent display was interrupted, then do the redisplay now if - it is convenient. */ + it is convenient. */ if (!info_any_buffered_input_p () && display_was_interrupted_p) - { - display_update_one_window (window); - display_cursor_at_point (active_window); - } + { + display_update_one_window (window); + display_cursor_at_point (active_window); + } /* Read a character and dispatch on it. */ key = info_get_input_char (); window_get_state (window, &mystate); if (key == DEL) - { - /* User wants to delete one level of search? */ - if (!isearch_states_index) - { - terminal_ring_bell (); - continue; - } - else - { - pop_isearch - (window, &isearch_string_index, &dir, &search_result); - isearch_string[isearch_string_index] = '\0'; - show_isearch_prompt (dir, isearch_string, search_result); - goto after_search; - } - } + { + /* User wants to delete one level of search? */ + if (!isearch_states_index) + { + terminal_ring_bell (); + continue; + } + else + { + pop_isearch + (window, &isearch_string_index, &dir, &search_result); + isearch_string[isearch_string_index] = '\0'; + show_isearch_prompt (dir, isearch_string, search_result); + goto after_search; + } + } else if (key == Control ('q')) - { - key = info_get_input_char (); - quoted = 1; - } + { + key = info_get_input_char (); + quoted = 1; + } /* We are about to search again, or quit. Save the current search. */ push_isearch (window, isearch_string_index, dir, search_result); if (quoted) - goto insert_and_search; + goto insert_and_search; if (!Meta_p (key) || (ISO_Latin_p && key < 160)) - { - func = window->keymap[key].function; - - /* If this key invokes an incremental search, then this means that - we will either search again in the same direction, search - again in the reverse direction, or insert the last search - string that was accepted through incremental searching. */ - if (func == isearch_forward || func == isearch_backward) - { - if ((func == isearch_forward && dir > 0) || - (func == isearch_backward && dir < 0)) - { - /* If the user has typed no characters, then insert the - last successful search into the current search string. */ - if (isearch_string_index == 0) - { - /* Of course, there must be something to insert. */ - if (last_isearch_accepted) - { - if (strlen (last_isearch_accepted) + 1 >= - isearch_string_size) - isearch_string = (char *) - xrealloc (isearch_string, - isearch_string_size += 10 + - strlen (last_isearch_accepted)); - strcpy (isearch_string, last_isearch_accepted); - isearch_string_index = strlen (isearch_string); - goto search_now; - } - else - continue; - } - else - { - /* Search again in the same direction. This means start - from a new place if the last search was successful. */ - if (search_result == 0) - window->point += dir; - } - } - else - { - /* Reverse the direction of the search. */ - dir = -dir; - } - } - else if (isprint (key) || func == (VFunction *)NULL) - { - insert_and_search: - - if (isearch_string_index + 2 >= isearch_string_size) - isearch_string = (char *)xrealloc - (isearch_string, isearch_string_size += 100); - - isearch_string[isearch_string_index++] = key; - isearch_string[isearch_string_index] = '\0'; - goto search_now; - } - else if (func == info_abort_key) - { - /* If C-g pressed, and the search is failing, pop the search - stack back to the last unfailed search. */ - if (isearch_states_index && (search_result != 0)) - { - terminal_ring_bell (); - while (isearch_states_index && (search_result != 0)) - pop_isearch - (window, &isearch_string_index, &dir, &search_result); - isearch_string[isearch_string_index] = '\0'; - show_isearch_prompt (dir, isearch_string, search_result); - continue; - } - else - goto exit_search; - } - else - goto exit_search; - } + { + func = window->keymap[key].function; + + /* If this key invokes an incremental search, then this means that + we will either search again in the same direction, search + again in the reverse direction, or insert the last search + string that was accepted through incremental searching. */ + if (func == isearch_forward || func == isearch_backward) + { + if ((func == isearch_forward && dir > 0) || + (func == isearch_backward && dir < 0)) + { + /* If the user has typed no characters, then insert the + last successful search into the current search string. */ + if (isearch_string_index == 0) + { + /* Of course, there must be something to insert. */ + if (last_isearch_accepted) + { + if (strlen (last_isearch_accepted) + 1 >= + isearch_string_size) + isearch_string = (char *) + xrealloc (isearch_string, + isearch_string_size += 10 + + strlen (last_isearch_accepted)); + strcpy (isearch_string, last_isearch_accepted); + isearch_string_index = strlen (isearch_string); + goto search_now; + } + else + continue; + } + else + { + /* Search again in the same direction. This means start + from a new place if the last search was successful. */ + if (search_result == 0) + window->point += dir; + } + } + else + { + /* Reverse the direction of the search. */ + dir = -dir; + } + } + else if (isprint (key) || func == (VFunction *)NULL) + { + insert_and_search: + + if (isearch_string_index + 2 >= isearch_string_size) + isearch_string = (char *)xrealloc + (isearch_string, isearch_string_size += 100); + + isearch_string[isearch_string_index++] = key; + isearch_string[isearch_string_index] = '\0'; + goto search_now; + } + else if (func == info_abort_key) + { + /* If C-g pressed, and the search is failing, pop the search + stack back to the last unfailed search. */ + if (isearch_states_index && (search_result != 0)) + { + terminal_ring_bell (); + while (isearch_states_index && (search_result != 0)) + pop_isearch + (window, &isearch_string_index, &dir, &search_result); + isearch_string[isearch_string_index] = '\0'; + show_isearch_prompt (dir, isearch_string, search_result); + continue; + } + else + goto exit_search; + } + else + goto exit_search; + } else - { - exit_search: - /* The character is not printable, or it has a function which is - non-null. Exit the search, remembering the search string. If - the key is not the same as the isearch_terminate_search_key, - then push it into pending input. */ - if (isearch_string_index && func != info_abort_key) - { - maybe_free (last_isearch_accepted); - last_isearch_accepted = strdup (isearch_string); - } - - if (key != isearch_terminate_search_key) - info_set_pending_input (key); - - if (func == info_abort_key) - { - if (isearch_states_index) - window_set_state (window, &orig_state); - } - - if (!echo_area_is_active) - window_clear_echo_area (); - - if (auto_footnotes_p) - info_get_or_remove_footnotes (active_window); - - isearch_is_active = 0; - continue; - } + { + exit_search: + /* The character is not printable, or it has a function which is + non-null. Exit the search, remembering the search string. If + the key is not the same as the isearch_terminate_search_key, + then push it into pending input. */ + if (isearch_string_index && func != info_abort_key) + { + maybe_free (last_isearch_accepted); + last_isearch_accepted = xstrdup (isearch_string); + } + + if (key != isearch_terminate_search_key) + info_set_pending_input (key); + + if (func == info_abort_key) + { + if (isearch_states_index) + window_set_state (window, &orig_state); + } + + if (!echo_area_is_active) + window_clear_echo_area (); + + if (auto_footnotes_p) + info_get_or_remove_footnotes (active_window); + + isearch_is_active = 0; + continue; + } /* Search for the contents of isearch_string. */ search_now: show_isearch_prompt (dir, isearch_string, search_result); if (search_result == 0) - { - /* Check to see if the current search string is right here. If - we are looking at it, then don't bother calling the search - function. */ - if (((dir < 0) && - (strncasecmp (window->node->contents + window->point, - isearch_string, isearch_string_index) == 0)) || - ((dir > 0) && - ((window->point - isearch_string_index) >= 0) && - (strncasecmp (window->node->contents + - (window->point - (isearch_string_index - 1)), - isearch_string, isearch_string_index) == 0))) - { - if (dir > 0) - window->point++; - } - else - search_result = info_search_internal (isearch_string, window, dir); - } + { + /* Check to see if the current search string is right here. If + we are looking at it, then don't bother calling the search + function. */ + if (((dir < 0) && + (strncasecmp (window->node->contents + window->point, + isearch_string, isearch_string_index) == 0)) || + ((dir > 0) && + ((window->point - isearch_string_index) >= 0) && + (strncasecmp (window->node->contents + + (window->point - (isearch_string_index - 1)), + isearch_string, isearch_string_index) == 0))) + { + if (dir > 0) + window->point++; + } + else + search_result = info_search_internal (isearch_string, window, dir); + } /* If this search failed, and we didn't already have a failed search, - then ring the terminal bell. */ + then ring the terminal bell. */ if (search_result != 0 && last_search_result == 0) - terminal_ring_bell (); + terminal_ring_bell (); after_search: show_isearch_prompt (dir, isearch_string, search_result); if (search_result == 0) - { - if ((mystate.node == window->node) && - (mystate.pagetop != window->pagetop)) - { - int newtop = window->pagetop; - window->pagetop = mystate.pagetop; - set_window_pagetop (window, newtop); - } - display_update_one_window (window); - display_cursor_at_point (window); - } + { + if ((mystate.node == window->node) && + (mystate.pagetop != window->pagetop)) + { + int newtop = window->pagetop; + window->pagetop = mystate.pagetop; + set_window_pagetop (window, newtop); + } + display_update_one_window (window); + display_cursor_at_point (window); + } last_search_result = search_result; } @@ -3433,52 +3413,52 @@ info_gc_file_buffers () if (!info_loaded_files) return; - for (fb_index = 0; fb = info_loaded_files[fb_index]; fb_index++) + for (fb_index = 0; (fb = info_loaded_files[fb_index]); fb_index++) { int fb_referenced_p = 0; /* If already gc-ed, do nothing. */ if (!fb->contents) - continue; + continue; /* If this file had to be uncompressed, check to see if we should - gc it. This means that the user-variable "gc-compressed-files" - is non-zero. */ + gc it. This means that the user-variable "gc-compressed-files" + is non-zero. */ if ((fb->flags & N_IsCompressed) && !gc_compressed_files) - continue; + continue; /* If this file's contents are not gc-able, move on. */ if (fb->flags & N_CannotGC) - continue; + continue; /* Check each INFO_WINDOW to see if it has any nodes which reference - this file. */ - for (iw_index = 0; iw = info_windows[iw_index]; iw_index++) - { - for (i = 0; iw->nodes && iw->nodes[i]; i++) - { - if ((strcmp (fb->fullpath, iw->nodes[i]->filename) == 0) || - (strcmp (fb->filename, iw->nodes[i]->filename) == 0)) - { - fb_referenced_p = 1; - break; - } - } - } + this file. */ + for (iw_index = 0; (iw = info_windows[iw_index]); iw_index++) + { + for (i = 0; iw->nodes && iw->nodes[i]; i++) + { + if ((strcmp (fb->fullpath, iw->nodes[i]->filename) == 0) || + (strcmp (fb->filename, iw->nodes[i]->filename) == 0)) + { + fb_referenced_p = 1; + break; + } + } + } /* If this file buffer wasn't referenced, free its contents. */ if (!fb_referenced_p) - { - free (fb->contents); - fb->contents = (char *)NULL; - } + { + free (fb->contents); + fb->contents = (char *)NULL; + } } } /* **************************************************************** */ -/* */ -/* Traversing and Selecting References */ -/* */ +/* */ +/* Traversing and Selecting References */ +/* */ /* **************************************************************** */ /* Move to the next or previous cross reference in this node. */ @@ -3513,8 +3493,8 @@ info_move_to_xref (window, count, key, dir) char *text = node->contents + firstmenu; if (strncmp (text, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL)) == 0) - firstmenu = info_search_in_node - (INFO_MENU_ENTRY_LABEL, node, firstmenu + dir, (WINDOW *)NULL, dir); + firstmenu = info_search_in_node + (INFO_MENU_ENTRY_LABEL, node, firstmenu + dir, (WINDOW *)NULL, dir); } firstxref = @@ -3529,7 +3509,7 @@ info_move_to_xref (window, count, key, dir) if (firstmenu == -1 && firstxref == -1) { - info_error ("No cross references in this node."); + info_error (_("No cross references in this node.")); return; } @@ -3553,8 +3533,8 @@ info_move_to_xref (window, count, key, dir) char *text = node->contents + nextmenu; if (strncmp (text, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL)) == 0) - nextmenu = info_search_in_node - (INFO_MENU_ENTRY_LABEL, node, nextmenu + dir, (WINDOW *)NULL, dir); + nextmenu = info_search_in_node + (INFO_MENU_ENTRY_LABEL, node, nextmenu + dir, (WINDOW *)NULL, dir); } /* If there is both a next menu entry, and a next xref entry, choose the @@ -3563,10 +3543,10 @@ info_move_to_xref (window, count, key, dir) if (nextmenu != -1 && nextxref != -1) { if (((dir == 1) && (nextmenu < nextxref)) || - ((dir == -1) && (nextmenu > nextxref))) - placement = nextmenu + 1; + ((dir == -1) && (nextmenu > nextxref))) + placement = nextmenu + 1; else - placement = nextxref; + placement = nextxref; } else if (nextmenu != -1) placement = nextmenu + 1; @@ -3578,17 +3558,17 @@ info_move_to_xref (window, count, key, dir) if (placement == -1) { if (firstmenu != -1 && firstxref != -1) - { - if (((dir == 1) && (firstmenu < firstxref)) || - ((dir == -1) && (firstmenu > firstxref))) - placement = firstmenu + 1; - else - placement = firstxref; - } + { + if (((dir == 1) && (firstmenu < firstxref)) || + ((dir == -1) && (firstmenu > firstxref))) + placement = firstmenu + 1; + else + placement = firstxref; + } else if (firstmenu != -1) - placement = firstmenu + 1; + placement = firstmenu + 1; else - placement = firstxref; + placement = firstxref; } window->point = placement; window_adjust_pagetop (window); @@ -3596,7 +3576,7 @@ info_move_to_xref (window, count, key, dir) } DECLARE_INFO_COMMAND (info_move_to_prev_xref, - "Move to the previous cross reference") + _("Move to the previous cross reference")) { if (count < 0) info_move_to_prev_xref (window, -count, key); @@ -3605,7 +3585,7 @@ DECLARE_INFO_COMMAND (info_move_to_prev_xref, } DECLARE_INFO_COMMAND (info_move_to_next_xref, - "Move to the next cross reference") + _("Move to the next cross reference")) { if (count < 0) info_move_to_next_xref (window, -count, key); @@ -3615,7 +3595,7 @@ DECLARE_INFO_COMMAND (info_move_to_next_xref, /* Select the menu item or reference that appears on this line. */ DECLARE_INFO_COMMAND (info_select_reference_this_line, - "Select reference or menu item appearing on this line") + _("Select reference or menu item appearing on this line")) { char *line; NODE *orig; @@ -3631,20 +3611,20 @@ DECLARE_INFO_COMMAND (info_select_reference_this_line, } /* **************************************************************** */ -/* */ -/* Miscellaneous Info Commands */ -/* */ +/* */ +/* Miscellaneous Info Commands */ +/* */ /* **************************************************************** */ /* What to do when C-g is pressed in a window. */ -DECLARE_INFO_COMMAND (info_abort_key, "Cancel current operation") +DECLARE_INFO_COMMAND (info_abort_key, _("Cancel current operation")) { /* If error printing doesn't oridinarily ring the bell, do it now, since C-g always rings the bell. Otherwise, let the error printer do it. */ if (!info_error_rings_bell_p) terminal_ring_bell (); - info_error ("Quit"); + info_error (_("Quit")); info_initialize_numeric_arg (); info_clear_pending_input (); @@ -3653,7 +3633,7 @@ DECLARE_INFO_COMMAND (info_abort_key, "Cancel current operation") /* Move the cursor to the desired line of the window. */ DECLARE_INFO_COMMAND (info_move_to_window_line, - "Move to the cursor to a specific line of the window") + _("Move to the cursor to a specific line of the window")) { int line; @@ -3663,9 +3643,9 @@ DECLARE_INFO_COMMAND (info_move_to_window_line, else { if (count < 0) - line = (window->height + count) + window->pagetop; + line = (window->height + count) + window->pagetop; else - line = window->pagetop + count; + line = window->pagetop + count; } /* If the line doesn't appear in this window, make it do so. */ @@ -3685,7 +3665,7 @@ DECLARE_INFO_COMMAND (info_move_to_window_line, /* Clear the screen and redraw its contents. Given a numeric argument, move the line the cursor is on to the COUNT'th line of the window. */ -DECLARE_INFO_COMMAND (info_redraw_display, "Redraw the display") +DECLARE_INFO_COMMAND (info_redraw_display, _("Redraw the display")) { if ((!info_explicit_arg && count == 1) || echo_area_is_active) { @@ -3702,18 +3682,18 @@ DECLARE_INFO_COMMAND (info_redraw_display, "Redraw the display") point_line = window_line_of_point (window) - window->pagetop; if (count < 0) - desired_line = window->height + count; + desired_line = window->height + count; else - desired_line = count; + desired_line = count; if (desired_line < 0) - desired_line = 0; + desired_line = 0; if (desired_line >= window->height) - desired_line = window->height - 1; + desired_line = window->height - 1; if (desired_line == point_line) - return; + return; new_pagetop = window->pagetop + (point_line - desired_line); @@ -3722,14 +3702,14 @@ DECLARE_INFO_COMMAND (info_redraw_display, "Redraw the display") } /* This command does nothing. It is the fact that a key is bound to it that has meaning. See the code at the top of info_session (). */ -DECLARE_INFO_COMMAND (info_quit, "Quit using Info") +DECLARE_INFO_COMMAND (info_quit, _("Quit using Info")) {} /* **************************************************************** */ -/* */ -/* Reading Keys and Dispatching on Them */ -/* */ +/* */ +/* Reading Keys and Dispatching on Them */ +/* */ /* **************************************************************** */ /* Declaration only. Special cased in info_dispatch_on_key (). */ @@ -3745,14 +3725,14 @@ dispatch_error (keyseq) rep = pretty_keyseq (keyseq); if (!echo_area_is_active) - info_error ("Unknown command (%s).", rep); + info_error (_("Unknown command (%s)."), rep); else { char *temp; - temp = (char *)xmalloc (1 + strlen (rep) + strlen ("\"\" is invalid")); + temp = (char *)xmalloc (1 + strlen (rep) + strlen (_("\"\" is invalid"))); - sprintf (temp, "\"%s\" is invalid", rep); + sprintf (temp, _("\"%s\" is invalid"), rep); terminal_ring_bell (); inform_in_echo_area (temp); free (temp); @@ -3798,8 +3778,8 @@ pretty_keyseq (keyseq) for (i = 0; keyseq[i]; i++) { sprintf (keyseq_rep + strlen (keyseq_rep), "%s%s", - strlen (keyseq_rep) ? " " : "", - pretty_keyname (keyseq[i])); + strlen (keyseq_rep) ? " " : "", + pretty_keyname (keyseq[i])); } return (keyseq_rep); @@ -3832,25 +3812,30 @@ display_info_keyseq (expecting_future_input) unsigned char info_get_another_input_char () { - int ready = 0; + int ready = !info_keyseq_displayed_p; /* ready if new and pending key */ /* If there isn't any input currently available, then wait a moment looking for input. If we don't get it fast enough, prompt a little bit with the current key sequence. */ - if (!info_keyseq_displayed_p && - !info_any_buffered_input_p () && - !info_input_pending_p ()) + if (!info_keyseq_displayed_p) { + ready = 1; + if (!info_any_buffered_input_p () && + !info_input_pending_p ()) + { #if defined (FD_SET) - struct timeval timer; - fd_set readfds; - - FD_ZERO (&readfds); - FD_SET (fileno (info_input_stream), &readfds); - timer.tv_sec = 1; - timer.tv_usec = 750; - ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer); + struct timeval timer; + fd_set readfds; + + FD_ZERO (&readfds); + FD_SET (fileno (info_input_stream), &readfds); + timer.tv_sec = 1; + timer.tv_usec = 750; + ready = select (fileno(info_input_stream)+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer); +#else + ready = 0; #endif /* FD_SET */ + } } if (!ready) @@ -3869,16 +3854,16 @@ info_dispatch_on_key (key, map) if (Meta_p (key) && (!ISO_Latin_p || map[key].function != ea_insert)) { if (map[ESC].type == ISKMAP) - { - map = (Keymap)map[ESC].function; - add_char_to_keyseq (ESC); - key = UnMeta (key); - info_dispatch_on_key (key, map); - } + { + map = (Keymap)map[ESC].function; + add_char_to_keyseq (ESC); + key = UnMeta (key); + info_dispatch_on_key (key, map); + } else - { - dispatch_error (info_keyseq); - } + { + dispatch_error (info_keyseq); + } return; } @@ -3886,74 +3871,74 @@ info_dispatch_on_key (key, map) { case ISFUNC: { - VFunction *func; - - func = map[key].function; - if (func != (VFunction *)NULL) - { - /* Special case info_do_lowercase_version (). */ - if (func == info_do_lowercase_version) - { - info_dispatch_on_key (tolower (key), map); - return; - } - - add_char_to_keyseq (key); - - if (info_keyseq_displayed_p) - display_info_keyseq (0); - - { - WINDOW *where; - - where = active_window; - (*map[key].function) - (active_window, info_numeric_arg * info_numeric_arg_sign, key); - - /* If we have input pending, then the last command was a prefix - command. Don't change the value of the last function vars. - Otherwise, remember the last command executed in the var - appropriate to the window in which it was executed. */ - if (!info_input_pending_p ()) - { - if (where == the_echo_area) - ea_last_executed_command = map[key].function; - else - info_last_executed_command = map[key].function; - } - } - } - else - { - add_char_to_keyseq (key); - dispatch_error (info_keyseq); - return; - } + VFunction *func; + + func = map[key].function; + if (func != (VFunction *)NULL) + { + /* Special case info_do_lowercase_version (). */ + if (func == info_do_lowercase_version) + { + info_dispatch_on_key (tolower (key), map); + return; + } + + add_char_to_keyseq (key); + + if (info_keyseq_displayed_p) + display_info_keyseq (0); + + { + WINDOW *where; + + where = active_window; + (*map[key].function) + (active_window, info_numeric_arg * info_numeric_arg_sign, key); + + /* If we have input pending, then the last command was a prefix + command. Don't change the value of the last function vars. + Otherwise, remember the last command executed in the var + appropriate to the window in which it was executed. */ + if (!info_input_pending_p ()) + { + if (where == the_echo_area) + ea_last_executed_command = map[key].function; + else + info_last_executed_command = map[key].function; + } + } + } + else + { + add_char_to_keyseq (key); + dispatch_error (info_keyseq); + return; + } } break; case ISKMAP: add_char_to_keyseq (key); if (map[key].function != (VFunction *)NULL) - { - unsigned char newkey; + { + unsigned char newkey; - newkey = info_get_another_input_char (); - info_dispatch_on_key (newkey, (Keymap)map[key].function); - } + newkey = info_get_another_input_char (); + info_dispatch_on_key (newkey, (Keymap)map[key].function); + } else - { - dispatch_error (info_keyseq); - return; - } + { + dispatch_error (info_keyseq); + return; + } break; } } /* **************************************************************** */ -/* */ -/* Numeric Arguments */ -/* */ +/* */ +/* Numeric Arguments */ +/* */ /* **************************************************************** */ /* Handle C-u style numeric args, as well as M--, and M-digits. */ @@ -3970,7 +3955,7 @@ int info_numeric_arg = 1; /* Add the current digit to the argument in progress. */ DECLARE_INFO_COMMAND (info_add_digit_to_numeric_arg, - "Add this digit to the current numeric argument") + _("Add this digit to the current numeric argument")) { info_numeric_arg_digit_loop (window, 0, key); } @@ -3979,7 +3964,7 @@ DECLARE_INFO_COMMAND (info_add_digit_to_numeric_arg, Read a key. If the key has nothing to do with arguments, then dispatch on it. If the key is the abort character then abort. */ DECLARE_INFO_COMMAND (info_universal_argument, - "Start (or multiply by 4) the current numeric argument") + _("Start (or multiply by 4) the current numeric argument")) { info_numeric_arg *= 4; info_numeric_arg_digit_loop (window, 0, 0); @@ -3994,7 +3979,7 @@ info_initialize_numeric_arg () } DECLARE_INFO_COMMAND (info_numeric_arg_digit_loop, - "Internally used by \\[universal-argument]") + _("Internally used by \\[universal-argument]")) { unsigned char pure_key; Keymap keymap = window->keymap; @@ -4002,64 +3987,64 @@ DECLARE_INFO_COMMAND (info_numeric_arg_digit_loop, while (1) { if (key) - pure_key = key; + pure_key = key; else - { - if (display_was_interrupted_p && !info_any_buffered_input_p ()) - display_update_display (windows); + { + if (display_was_interrupted_p && !info_any_buffered_input_p ()) + display_update_display (windows); - if (active_window != the_echo_area) - display_cursor_at_point (active_window); + if (active_window != the_echo_area) + display_cursor_at_point (active_window); - pure_key = key = info_get_another_input_char (); + pure_key = key = info_get_another_input_char (); - if (Meta_p (key)) - add_char_to_keyseq (ESC); + if (Meta_p (key)) + add_char_to_keyseq (ESC); - add_char_to_keyseq (UnMeta (key)); - } + add_char_to_keyseq (UnMeta (key)); + } if (Meta_p (key)) - key = UnMeta (key); + key = UnMeta (key); if (keymap[key].type == ISFUNC && - keymap[key].function == info_universal_argument) - { - info_numeric_arg *= 4; - key = 0; - continue; - } + keymap[key].function == info_universal_argument) + { + info_numeric_arg *= 4; + key = 0; + continue; + } if (isdigit (key)) - { - if (info_explicit_arg) - info_numeric_arg = (info_numeric_arg * 10) + (key - '0'); - else - info_numeric_arg = (key - '0'); - info_explicit_arg = 1; - } + { + if (info_explicit_arg) + info_numeric_arg = (info_numeric_arg * 10) + (key - '0'); + else + info_numeric_arg = (key - '0'); + info_explicit_arg = 1; + } else - { - if (key == '-' && !info_explicit_arg) - { - info_numeric_arg_sign = -1; - info_numeric_arg = 1; - } - else - { - info_keyseq_index--; - info_dispatch_on_key (pure_key, keymap); - return; - } - } + { + if (key == '-' && !info_explicit_arg) + { + info_numeric_arg_sign = -1; + info_numeric_arg = 1; + } + else + { + info_keyseq_index--; + info_dispatch_on_key (pure_key, keymap); + return; + } + } key = 0; } } /* **************************************************************** */ -/* */ -/* Input Character Buffering */ -/* */ +/* */ +/* Input Character Buffering */ +/* */ /* **************************************************************** */ /* Character waiting to be read next. */ @@ -4108,7 +4093,7 @@ info_push_typeahead (key) { info_input_buffer[push_index++] = key; if (push_index >= sizeof (info_input_buffer)) - push_index = 0; + push_index = 0; } } @@ -4147,23 +4132,6 @@ info_any_buffered_input_p () return (push_index != pop_index); } -/* Push KEY into the *front* of the input buffer. Returns non-zero if - successful, zero if there is no space left in the buffer. */ -static int -info_replace_key_to_typeahead (key) - unsigned char key; -{ - if (info_input_buffer_space_available ()) - { - pop_index--; - if (pop_index < 0) - pop_index = sizeof (info_input_buffer) - 1; - info_input_buffer[pop_index] = key; - return (1); - } - return (0); -} - /* If characters are available to be read, then read them and stuff them into info_input_buffer. Otherwise, do nothing. */ void @@ -4188,7 +4156,7 @@ info_gather_typeahead () chars_avail = space_avail; if (chars_avail) - read (tty, &input[0], chars_avail); + chars_avail = read (tty, &input[0], chars_avail); } #else /* !FIONREAD */ # if defined (O_NDELAY) @@ -4230,34 +4198,42 @@ info_get_input_char () else if (info_get_key_from_typeahead (&keystroke) == 0) { int rawkey; + unsigned char c; + int tty = fileno (info_input_stream); + + /* Using stream I/O causes FIONREAD etc to fail to work + so unless someone can find a portable way of finding + out how many characters are currently buffered, we + should stay with away from stream I/O. + --Egil Kvaleberg <egilk@sn.no>, January 1997. */ + rawkey = (read (tty, &c, 1) == 1) ? c : EOF; - rawkey = getc (info_input_stream); keystroke = rawkey; if (rawkey == EOF) - { - if (info_input_stream != stdin) - { - fclose (info_input_stream); - info_input_stream = stdin; - display_inhibited = 0; - display_update_display (windows); - display_cursor_at_point (active_window); - rawkey = getc (info_input_stream); - keystroke = rawkey; - } - - if (rawkey == EOF) - { - terminal_unprep_terminal (); - close_dribble_file (); - exit (0); - } - } + { + if (info_input_stream != stdin) + { + fclose (info_input_stream); + info_input_stream = stdin; + display_inhibited = 0; + display_update_display (windows); + display_cursor_at_point (active_window); + rawkey = (read (tty, &c, 1) == 1) ? c : EOF; + keystroke = rawkey; + } + + if (rawkey == EOF) + { + terminal_unprep_terminal (); + close_dribble_file (); + exit (0); + } + } } if (info_dribble_file) dribble (keystroke); - return (keystroke); + return keystroke; } diff --git a/texinfo/info/session.h b/texinfo/info/session.h index 98b8ccf..f1e5b23 100644 --- a/texinfo/info/session.h +++ b/texinfo/info/session.h @@ -21,10 +21,10 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_SESSION_H_) -#define _SESSION_H_ +#if !defined (SESSION_H) +#define SESSION_H -#include "general.h" +#include "info.h" #include "dribble.h" /* All commands that can be invoked from within info_session () receive @@ -55,11 +55,11 @@ extern int info_scroll_behaviour; extern char *info_scroll_choices[]; /* Values for info_scroll_behaviour. */ -#define IS_Continuous 0 /* Try to get first menu item, or failing that, the - "Next:" pointer, or failing that, the "Up:" and - "Next:" of the up. */ +#define IS_Continuous 0 /* Try to get first menu item, or failing that, the + "Next:" pointer, or failing that, the "Up:" and + "Next:" of the up. */ #define IS_NextOnly 1 /* Try to get "Next:" menu item. */ -#define IS_PageOnly 2 /* Simply give up at the bottom of a node. */ +#define IS_PageOnly 2 /* Simply give up at the bottom of a node. */ /* Utility functions found in session.c */ extern void info_dispatch_on_key (); @@ -143,4 +143,4 @@ extern void info_print_node (); /* Miscellaneous commands. */ extern void info_abort_key (), info_quit (), info_do_lowercase_version (); -#endif /* _SESSION_H_ */ +#endif /* SESSION_H */ diff --git a/texinfo/info/signals.c b/texinfo/info/signals.c index a60777fe..b93a585 100644 --- a/texinfo/info/signals.c +++ b/texinfo/info/signals.c @@ -25,9 +25,9 @@ #include "signals.h" /* **************************************************************** */ -/* */ -/* Pretending That We Have POSIX Signals */ -/* */ +/* */ +/* Pretending That We Have POSIX Signals */ +/* */ /* **************************************************************** */ #if !defined (HAVE_SIGPROCMASK) && defined (HAVE_SIGSETMASK) @@ -57,33 +57,32 @@ sigprocmask (operation, newset, oldset) #endif /* !HAVE_SIGPROCMASK && HAVE_SIGSETMASK */ /* **************************************************************** */ -/* */ -/* Signal Handling for Info */ -/* */ +/* */ +/* Signal Handling for Info */ +/* */ /* **************************************************************** */ -typedef void SigHandlerType; -typedef SigHandlerType SigHandler (); +typedef RETSIGTYPE signal_handler (); -static SigHandlerType info_signal_handler (); -static SigHandler *old_TSTP, *old_TTOU, *old_TTIN; -static SigHandler *old_WINCH, *old_INT; +static RETSIGTYPE info_signal_handler (); +static signal_handler *old_TSTP, *old_TTOU, *old_TTIN; +static signal_handler *old_WINCH, *old_INT; void initialize_info_signal_handler () { #if defined (SIGTSTP) - old_TSTP = (SigHandler *) signal (SIGTSTP, info_signal_handler); - old_TTOU = (SigHandler *) signal (SIGTTOU, info_signal_handler); - old_TTIN = (SigHandler *) signal (SIGTTIN, info_signal_handler); + old_TSTP = (signal_handler *) signal (SIGTSTP, info_signal_handler); + old_TTOU = (signal_handler *) signal (SIGTTOU, info_signal_handler); + old_TTIN = (signal_handler *) signal (SIGTTIN, info_signal_handler); #endif /* SIGTSTP */ #if defined (SIGWINCH) - old_WINCH = (SigHandler *) signal (SIGWINCH, info_signal_handler); + old_WINCH = (signal_handler *) signal (SIGWINCH, info_signal_handler); #endif #if defined (SIGINT) - old_INT = (SigHandler *) signal (SIGINT, info_signal_handler); + old_INT = (signal_handler *) signal (SIGINT, info_signal_handler); #endif } @@ -98,11 +97,11 @@ redisplay_after_signal () fflush (stdout); } -static SigHandlerType +static RETSIGTYPE info_signal_handler (sig) int sig; { - SigHandler **old_signal_handler; + signal_handler **old_signal_handler; switch (sig) { @@ -116,56 +115,56 @@ info_signal_handler (sig) #endif { #if defined (SIGTSTP) - if (sig == SIGTSTP) - old_signal_handler = &old_TSTP; - if (sig == SIGTTOU) - old_signal_handler = &old_TTOU; - if (sig == SIGTTIN) - old_signal_handler = &old_TTIN; + if (sig == SIGTSTP) + old_signal_handler = &old_TSTP; + if (sig == SIGTTOU) + old_signal_handler = &old_TTOU; + if (sig == SIGTTIN) + old_signal_handler = &old_TTIN; #endif /* SIGTSTP */ - if (sig == SIGINT) - old_signal_handler = &old_INT; - - /* For stop signals, restore the terminal IO, leave the cursor - at the bottom of the window, and stop us. */ - terminal_goto_xy (0, screenheight - 1); - terminal_clear_to_eol (); - fflush (stdout); - terminal_unprep_terminal (); - signal (sig, *old_signal_handler); - UNBLOCK_SIGNAL (sig); - kill (getpid (), sig); - - /* The program is returning now. Restore our signal handler, - turn on terminal handling, redraw the screen, and place the - cursor where it belongs. */ - terminal_prep_terminal (); - *old_signal_handler = (SigHandler *) signal (sig, info_signal_handler); - redisplay_after_signal (); - fflush (stdout); + if (sig == SIGINT) + old_signal_handler = &old_INT; + + /* For stop signals, restore the terminal IO, leave the cursor + at the bottom of the window, and stop us. */ + terminal_goto_xy (0, screenheight - 1); + terminal_clear_to_eol (); + fflush (stdout); + terminal_unprep_terminal (); + signal (sig, *old_signal_handler); + UNBLOCK_SIGNAL (sig); + kill (getpid (), sig); + + /* The program is returning now. Restore our signal handler, + turn on terminal handling, redraw the screen, and place the + cursor where it belongs. */ + terminal_prep_terminal (); + *old_signal_handler = (signal_handler *) signal (sig, info_signal_handler); + redisplay_after_signal (); + fflush (stdout); } break; #if defined (SIGWINCH) case SIGWINCH: { - /* Turn off terminal IO, tell our parent that the window has changed, - then reinitialize the terminal and rebuild our windows. */ - old_signal_handler = &old_WINCH; - terminal_goto_xy (0, 0); - fflush (stdout); - terminal_unprep_terminal (); - signal (sig, *old_signal_handler); - UNBLOCK_SIGNAL (sig); - kill (getpid (), sig); - - /* After our old signal handler returns... */ - terminal_get_screen_size (); - terminal_prep_terminal (); - display_initialize_display (screenwidth, screenheight); - window_new_screen_size (screenwidth, screenheight, (VFunction *)NULL); - *old_signal_handler = (SigHandler *) signal (sig, info_signal_handler); - redisplay_after_signal (); + /* Turn off terminal IO, tell our parent that the window has changed, + then reinitialize the terminal and rebuild our windows. */ + old_signal_handler = &old_WINCH; + terminal_goto_xy (0, 0); + fflush (stdout); + terminal_unprep_terminal (); + signal (sig, *old_signal_handler); + UNBLOCK_SIGNAL (sig); + kill (getpid (), sig); + + /* After our old signal handler returns... */ + terminal_get_screen_size (); + terminal_prep_terminal (); + display_initialize_display (screenwidth, screenheight); + window_new_screen_size (screenwidth, screenheight, (VFunction *)NULL); + *old_signal_handler = (signal_handler *) signal (sig, info_signal_handler); + redisplay_after_signal (); } break; #endif /* SIGWINCH */ diff --git a/texinfo/info/signals.h b/texinfo/info/signals.h index ab87a3b..3a45925 100644 --- a/texinfo/info/signals.h +++ b/texinfo/info/signals.h @@ -1,9 +1,10 @@ -/* signals.h -- Header to include system dependent signal definitions. */ +/* signals.h -- Header to include system dependent signal definitions. + $Id: signals.h,v 1.3 1997/07/15 18:35:59 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,11 +22,17 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_SIGNALS_H_) -#define _SIGNALS_H_ +#ifndef INFO_SIGNALS_H +#define INFO_SIGNALS_H +#include <sys/types.h> #include <signal.h> +/* For sysV68 --phdm@info.ucl.ac.be. */ +#if !defined (SIGCHLD) && defined (SIGCLD) +#define SIGCHLD SIGCLD +#endif + #if !defined (HAVE_SIGPROCMASK) && !defined (sigmask) # define sigmask(x) (1 << ((x)-1)) #endif /* !HAVE_SIGPROCMASK && !sigmask */ @@ -86,4 +93,4 @@ # define UNBLOCK_SIGNAL(sig) #endif /* !HAVE_SIGPROCMASK && !HAVE_SIGSETMASK */ -#endif /* !_SIGNALS_H_ */ +#endif /* not INFO_SIGNALS_H */ diff --git a/texinfo/info/terminal.h b/texinfo/info/terminal.h index 7cb1158..2e27268 100644 --- a/texinfo/info/terminal.h +++ b/texinfo/info/terminal.h @@ -3,7 +3,7 @@ /* This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 96 Free Software Foundation, Inc. + Copyright (C) 1993, 96, 97 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 @@ -21,15 +21,10 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_TERMINAL_H_) -#define _TERMINAL_H_ +#if !defined (TERMINAL_H) +#define TERMINAL_H -/* We use the following data type to talk about pointers to functions. */ -#if !defined (__FUNCTION_DEF) -# define __FUNCTION_DEF -typedef int Function (); -typedef void VFunction (); -#endif /* _FUNCTION_DEF */ +#include "info.h" /* For almost every function externally visible from terminal.c, there is a corresponding "hook" function which can be bound in order to replace @@ -125,5 +120,6 @@ extern VFunction *terminal_ring_bell_hook; /* The key sequences output by the arrow keys, if this terminal has any. */ extern char *term_ku, *term_kd, *term_kr, *term_kl; +extern char *term_kP, *term_kN; -#endif /* !_TERMINAL_H_ */ +#endif /* !TERMINAL_H */ diff --git a/texinfo/info/tilde.c b/texinfo/info/tilde.c index 817f909..fef953a 100644 --- a/texinfo/info/tilde.c +++ b/texinfo/info/tilde.c @@ -1,5 +1,5 @@ /* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). - $Id: tilde.c,v 1.1 1997/08/21 22:58:05 jason Exp $ + $Id: tilde.c,v 1.8 1997/07/24 21:49:03 karl Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. @@ -22,6 +22,10 @@ Written by Brian Fox (bfox@ai.mit.edu). */ +/* Include config.h before doing alloca. */ +#include "info.h" + +#ifndef alloca #if defined (__GNUC__) # define alloca __builtin_alloca #else /* !__GNUC__ */ @@ -33,28 +37,10 @@ # endif /* HAVE_ALLOCA_H */ # endif /* !AIX */ #endif /* !__GNUC__ */ - -#if defined (HAVE_STDLIB_H) -#include <stdlib.h> -#endif - -#include "tilde.h" -#include <pwd.h> - -#if defined (HAVE_STRING_H) -#include <string.h> -#endif - -#include "clib.h" - -#if !defined (NULL) -# define NULL 0x0 -#endif +#endif /* ! defined alloca */ #if defined (TEST) || defined (STATIC_MALLOC) static void *xmalloc (), *xrealloc (); -#else -extern void *xmalloc (), *xrealloc (); #endif /* TEST || STATIC_MALLOC */ /* The default value of tilde_additional_prefixes. This is set to @@ -105,16 +91,16 @@ tilde_find_prefix (string, len) if (prefixes) { for (i = 0; i < string_len; i++) - { - for (j = 0; prefixes[j]; j++) - { - if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0) - { - *len = strlen (prefixes[j]) - 1; - return (i + *len); - } - } - } + { + for (j = 0; prefixes[j]; j++) + { + if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0) + { + *len = strlen (prefixes[j]) - 1; + return (i + *len); + } + } + } } return (string_len); } @@ -133,13 +119,13 @@ tilde_find_suffix (string) for (i = 0; i < string_len; i++) { if (string[i] == '/' || !string[i]) - break; + break; for (j = 0; suffixes && suffixes[j]; j++) - { - if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0) - return (i); - } + { + if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0) + return (i); + } } return (i); } @@ -167,7 +153,7 @@ tilde_expand (string) /* Copy the skipped text into the result. */ if ((result_index + start + 1) > result_size) - result = (char *)xrealloc (result, 1 + (result_size += (start + 20))); + result = (char *)xrealloc (result, 1 + (result_size += (start + 20))); strncpy (result + result_index, string, start); result_index += start; @@ -176,12 +162,12 @@ tilde_expand (string) string += start; /* Make END be the index of one after the last character of the - username. */ + username. */ end = tilde_find_suffix (string); /* If both START and END are zero, we are all done. */ if (!start && !end) - break; + break; /* Expand the entire tilde word, and copy it into RESULT. */ tilde_word = (char *)xmalloc (1 + end); @@ -194,7 +180,7 @@ tilde_expand (string) len = strlen (expansion); if ((result_index + len + 1) > result_size) - result = (char *)xrealloc (result, 1 + (result_size += (len + 20))); + result = (char *)xrealloc (result, 1 + (result_size += (len + 20))); strcpy (result + result_index, expansion); result_index += len; @@ -214,88 +200,87 @@ tilde_expand_word (filename) { char *dirname; - dirname = filename ? strdup (filename) : (char *)NULL; + dirname = filename ? xstrdup (filename) : (char *)NULL; if (dirname && *dirname == '~') { char *temp_name; if (!dirname[1] || dirname[1] == '/') - { - /* Prepend $HOME to the rest of the string. */ - extern char *getenv (); - char *temp_home = getenv ("HOME"); - - /* If there is no HOME variable, look up the directory in - the password database. */ - if (!temp_home) - { - struct passwd *entry; - - entry = (struct passwd *) getpwuid (getuid ()); - if (entry) - temp_home = entry->pw_dir; - } - - temp_name = (char *) - alloca (1 + strlen (&dirname[1]) - + (temp_home ? strlen (temp_home) : 0)); - temp_name[0] = '\0'; - if (temp_home) - strcpy (temp_name, temp_home); - strcat (temp_name, &dirname[1]); - free (dirname); - dirname = strdup (temp_name); - } + { + /* Prepend $HOME to the rest of the string. */ + char *temp_home = getenv ("HOME"); + + /* If there is no HOME variable, look up the directory in + the password database. */ + if (!temp_home) + { + struct passwd *entry; + + entry = (struct passwd *) getpwuid (getuid ()); + if (entry) + temp_home = entry->pw_dir; + } + + temp_name = (char *) + alloca (1 + strlen (&dirname[1]) + + (temp_home ? strlen (temp_home) : 0)); + temp_name[0] = '\0'; + if (temp_home) + strcpy (temp_name, temp_home); + strcat (temp_name, &dirname[1]); + free (dirname); + dirname = xstrdup (temp_name); + } else - { - struct passwd *user_entry; - char *username = (char *)alloca (257); - int i, c; - - for (i = 1; c = dirname[i]; i++) - { - if (c == '/') - break; - else - username[i - 1] = c; - } - username[i - 1] = '\0'; - - if (!(user_entry = (struct passwd *) getpwnam (username))) - { - /* If the calling program has a special syntax for - expanding tildes, and we couldn't find a standard - expansion, then let them try. */ - if (tilde_expansion_failure_hook) - { - char *expansion; - - expansion = (*tilde_expansion_failure_hook) (username); - - if (expansion) - { - temp_name = (char *)alloca - (1 + strlen (expansion) + strlen (&dirname[i])); - strcpy (temp_name, expansion); - strcat (temp_name, &dirname[i]); - free (expansion); - goto return_name; - } - } - /* We shouldn't report errors. */ - } - else - { - temp_name = (char *)alloca - (1 + strlen (user_entry->pw_dir) + strlen (&dirname[i])); - strcpy (temp_name, user_entry->pw_dir); - strcat (temp_name, &dirname[i]); - return_name: - free (dirname); - dirname = strdup (temp_name); - } - endpwent (); - } + { + struct passwd *user_entry; + char *username = (char *)alloca (257); + int i, c; + + for (i = 1; (c = dirname[i]); i++) + { + if (c == '/') + break; + else + username[i - 1] = c; + } + username[i - 1] = '\0'; + + if (!(user_entry = (struct passwd *) getpwnam (username))) + { + /* If the calling program has a special syntax for + expanding tildes, and we couldn't find a standard + expansion, then let them try. */ + if (tilde_expansion_failure_hook) + { + char *expansion; + + expansion = (*tilde_expansion_failure_hook) (username); + + if (expansion) + { + temp_name = (char *)alloca + (1 + strlen (expansion) + strlen (&dirname[i])); + strcpy (temp_name, expansion); + strcat (temp_name, &dirname[i]); + free (expansion); + goto return_name; + } + } + /* We shouldn't report errors. */ + } + else + { + temp_name = (char *)alloca + (1 + strlen (user_entry->pw_dir) + strlen (&dirname[i])); + strcpy (temp_name, user_entry->pw_dir); + strcat (temp_name, &dirname[i]); + return_name: + free (dirname); + dirname = xstrdup (temp_name); + } + endpwent (); + } } return (dirname); } @@ -318,15 +303,15 @@ main (argc, argv) fflush (stdout); if (!gets (line)) - strcpy (line, "done"); + strcpy (line, "done"); if ((strcmp (line, "done") == 0) || - (strcmp (line, "quit") == 0) || - (strcmp (line, "exit") == 0)) - { - done = 1; - break; - } + (strcmp (line, "quit") == 0) || + (strcmp (line, "exit") == 0)) + { + done = 1; + break; + } result = tilde_expand (line); printf (" --> %s\n", result); @@ -369,7 +354,7 @@ xrealloc (pointer, bytes) static void memory_error_and_abort () { - fprintf (stderr, "readline: Out of virtual memory!\n"); + fprintf (stderr, _("readline: Out of virtual memory!\n")); abort (); } #endif /* TEST */ diff --git a/texinfo/info/tilde.h b/texinfo/info/tilde.h index d66aee9..83f534b 100644 --- a/texinfo/info/tilde.h +++ b/texinfo/info/tilde.h @@ -25,13 +25,10 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -/* Function pointers can be declared as (Function *)foo. */ -#if !defined (__FUNCTION_DEF) -# define __FUNCTION_DEF -typedef int Function (); -typedef void VFunction (); -typedef char *CFunction (); -#endif /* _FUNCTION_DEF */ +#ifndef TILDE_H +#define TILDE_H + +#include "info.h" /* If non-null, this contains the address of a function to call if the standard meaning for expanding a tilde fails. The function is called @@ -56,3 +53,4 @@ extern char *tilde_expand (); tilde. If there is no expansion, call tilde_expansion_failure_hook. */ extern char *tilde_expand_word (); +#endif /* not TILDE_H */ diff --git a/texinfo/info/variables.c b/texinfo/info/variables.c index 7798701..248c8af 100644 --- a/texinfo/info/variables.c +++ b/texinfo/info/variables.c @@ -1,9 +1,10 @@ -/* variables.c -- How to manipulate user visible variables in Info. */ +/* variables.c -- How to manipulate user visible variables in Info. + $Id: variables.c,v 1.5 1997/07/18 14:34:23 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,9 +26,9 @@ #include "variables.h" /* **************************************************************** */ -/* */ -/* User Visible Variables in Info */ -/* */ +/* */ +/* User Visible Variables in Info */ +/* */ /* **************************************************************** */ /* Choices used by the completer when reading a zero/non-zero value for @@ -36,73 +37,75 @@ static char *on_off_choices[] = { "Off", "On", (char *)NULL }; VARIABLE_ALIST info_variables[] = { { "automatic-footnotes", - "When \"On\", footnotes appear and disappear automatically", + N_("When \"On\", footnotes appear and disappear automatically"), &auto_footnotes_p, (char **)on_off_choices }, { "automatic-tiling", - "When \"On\", creating or deleting a window resizes other windows", + N_("When \"On\", creating or deleting a window resizes other windows"), &auto_tiling_p, (char **)on_off_choices }, { "visible-bell", - "When \"On\", flash the screen instead of ringing the bell", + N_("When \"On\", flash the screen instead of ringing the bell"), &terminal_use_visible_bell_p, (char **)on_off_choices }, { "errors-ring-bell", - "When \"On\", errors cause the bell to ring", + N_("When \"On\", errors cause the bell to ring"), &info_error_rings_bell_p, (char **)on_off_choices }, { "gc-compressed-files", - "When \"On\", Info garbage collects files which had to be uncompressed", + N_("When \"On\", Info garbage collects files which had to be uncompressed"), &gc_compressed_files, (char **)on_off_choices }, { "show-index-match", - "When \"On\", the portion of the matched search string is highlighted", + N_("When \"On\", the portion of the matched search string is highlighted"), &show_index_match, (char **)on_off_choices }, { "scroll-behaviour", - "Controls what happens when scrolling is requested at the end of a node", + N_("Controls what happens when scrolling is requested at the end of a node"), &info_scroll_behaviour, (char **)info_scroll_choices }, { "scroll-step", - "The number lines to scroll when the cursor moves out of the window", + N_("The number lines to scroll when the cursor moves out of the window"), &window_scroll_step, (char **)NULL }, { "ISO-Latin", - "When \"On\", Info accepts and displays ISO Latin characters", + N_("When \"On\", Info accepts and displays ISO Latin characters"), &ISO_Latin_p, (char **)on_off_choices }, { (char *)NULL, (char *)NULL, (int *)NULL, (char **)NULL } }; -DECLARE_INFO_COMMAND (describe_variable, "Explain the use of a variable") +DECLARE_INFO_COMMAND (describe_variable, _("Explain the use of a variable")) { VARIABLE_ALIST *var; char *description; /* Get the variable's name. */ - var = read_variable_name ("Describe variable: ", window); + var = read_variable_name (_("Describe variable: "), window); if (!var) return; - description = (char *)xmalloc (20 + strlen (var->name) + strlen (var->doc)); + description = (char *)xmalloc (20 + strlen (var->name) + + strlen (_(var->doc))); if (var->choices) sprintf (description, "%s (%s): %s.", - var->name, var->choices[*(var->value)], var->doc); + var->name, var->choices[*(var->value)], _(var->doc)); else - sprintf (description, "%s (%d): %s.", var->name, *(var->value), var->doc); + sprintf (description, "%s (%d): %s.", + var->name, *(var->value), _(var->doc)); window_message_in_echo_area ("%s", description); free (description); } -DECLARE_INFO_COMMAND (set_variable, "Set the value of an Info variable") +DECLARE_INFO_COMMAND (set_variable, _("Set the value of an Info variable")) { VARIABLE_ALIST *var; char *line; /* Get the variable's name and value. */ - var = read_variable_name ("Set variable: ", window); + var = read_variable_name (_("Set variable: "), window); if (!var) return; @@ -113,86 +116,86 @@ DECLARE_INFO_COMMAND (set_variable, "Set the value of an Info variable") if (!var->choices) { - int potential_value; + int potential_value; - if (info_explicit_arg || count != 1) - potential_value = count; - else - potential_value = *(var->value); + if (info_explicit_arg || count != 1) + potential_value = count; + else + potential_value = *(var->value); - sprintf (prompt, "Set %s to value (%d): ", - var->name, potential_value); - line = info_read_in_echo_area (active_window, prompt); + sprintf (prompt, _("Set %s to value (%d): "), + var->name, potential_value); + line = info_read_in_echo_area (active_window, prompt); - /* If no error was printed, clear the echo area. */ - if (!info_error_was_printed) - window_clear_echo_area (); + /* If no error was printed, clear the echo area. */ + if (!info_error_was_printed) + window_clear_echo_area (); - /* User aborted? */ - if (!line) - return; + /* User aborted? */ + if (!line) + return; - /* If the user specified a value, get that, otherwise, we are done. */ - canonicalize_whitespace (line); - if (*line) - *(var->value) = atoi (line); - else - *(var->value) = potential_value; + /* If the user specified a value, get that, otherwise, we are done. */ + canonicalize_whitespace (line); + if (*line) + *(var->value) = atoi (line); + else + *(var->value) = potential_value; - free (line); + free (line); } else { - register int i; - REFERENCE **array = (REFERENCE **)NULL; - int array_index = 0; - int array_slots = 0; - - for (i = 0; var->choices[i]; i++) - { - REFERENCE *entry; - - entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); - entry->label = strdup (var->choices[i]); - entry->nodename = (char *)NULL; - entry->filename = (char *)NULL; - - add_pointer_to_array - (entry, array_index, array, array_slots, 10, REFERENCE *); - } - - sprintf (prompt, "Set %s to value (%s): ", - var->name, var->choices[*(var->value)]); - - /* Ask the completer to read a variable value for us. */ - line = info_read_completing_in_echo_area (window, prompt, array); - - info_free_references (array); - - if (!echo_area_is_active) - window_clear_echo_area (); - - /* User aborted? */ - if (!line) - { - info_abort_key (active_window, 0, 0); - return; - } - - /* User accepted default choice? If so, no change. */ - if (!*line) - { - free (line); - return; - } - - /* Find the choice in our list of choices. */ - for (i = 0; var->choices[i]; i++) - if (strcmp (var->choices[i], line) == 0) - break; - - if (var->choices[i]) - *(var->value) = i; + register int i; + REFERENCE **array = (REFERENCE **)NULL; + int array_index = 0; + int array_slots = 0; + + for (i = 0; var->choices[i]; i++) + { + REFERENCE *entry; + + entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); + entry->label = xstrdup (var->choices[i]); + entry->nodename = (char *)NULL; + entry->filename = (char *)NULL; + + add_pointer_to_array + (entry, array_index, array, array_slots, 10, REFERENCE *); + } + + sprintf (prompt, _("Set %s to value (%s): "), + var->name, var->choices[*(var->value)]); + + /* Ask the completer to read a variable value for us. */ + line = info_read_completing_in_echo_area (window, prompt, array); + + info_free_references (array); + + if (!echo_area_is_active) + window_clear_echo_area (); + + /* User aborted? */ + if (!line) + { + info_abort_key (active_window, 0, 0); + return; + } + + /* User accepted default choice? If so, no change. */ + if (!*line) + { + free (line); + return; + } + + /* Find the choice in our list of choices. */ + for (i = 0; var->choices[i]; i++) + if (strcmp (var->choices[i], line) == 0) + break; + + if (var->choices[i]) + *(var->value) = i; } } } @@ -259,13 +262,13 @@ make_variable_completions_array () { REFERENCE *entry; - entry = (REFERENCE *)xmalloc (sizeof (REFERENCE)); - entry->label = strdup (info_variables[i].name); + entry = (REFERENCE *) xmalloc (sizeof (REFERENCE)); + entry->label = xstrdup (info_variables[i].name); entry->nodename = (char *)NULL; entry->filename = (char *)NULL; add_pointer_to_array - (entry, array_index, array, array_slots, 200, REFERENCE *); + (entry, array_index, array, array_slots, 200, REFERENCE *); } return (array); diff --git a/texinfo/info/variables.h b/texinfo/info/variables.h index 85bde27..1afcfb8 100644 --- a/texinfo/info/variables.h +++ b/texinfo/info/variables.h @@ -1,9 +1,10 @@ -/* variables.h -- Description of user visible variables in Info. */ +/* variables.h -- Description of user visible variables in Info. + $Id: variables.h,v 1.3 1997/07/15 18:44:23 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,8 +22,8 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_VARIABLES_H_) -#define _VARIABLES_H_ +#ifndef INFO_VARIABLES_H +#define INFO_VARIABLES_H /* A variable (in the Info sense) is an integer value with a user-visible name. You may supply an array of strings to complete over when the @@ -32,10 +33,10 @@ /* Structure describing a user visible variable. */ typedef struct { - char *name; /* Polite name. */ - char *doc; /* Documentation string. */ - int *value; /* Address of value. */ - char **choices; /* Array of strings or NULL if numeric only. */ + char *name; /* Polite name. */ + char *doc; /* Documentation string. */ + int *value; /* Address of value. */ + char **choices; /* Array of strings or NULL if numeric only. */ } VARIABLE_ALIST; /* Read the name of an Info variable in the echo area and return the @@ -61,4 +62,4 @@ extern int info_scroll_behaviour; extern int window_scroll_step; extern int ISO_Latin_p; -#endif /* _VARIABLES_H_ */ +#endif /* not INFO_VARIABLES_H */ diff --git a/texinfo/info/window.c b/texinfo/info/window.c index 304e89c..56a3108 100644 --- a/texinfo/info/window.c +++ b/texinfo/info/window.c @@ -1,9 +1,10 @@ -/* window.c -- Windows in Info. */ +/* window.c -- Windows in Info. + $Id: window.c,v 1.4 1997/07/15 18:35:59 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,10 +22,7 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#include <stdio.h> -#include <ctype.h> -#include <sys/types.h> -#include <sys/stat.h> +#include "info.h" #include "nodes.h" #include "window.h" #include "display.h" @@ -136,36 +134,36 @@ window_new_screen_size (width, height) while ((height - echo_area_required) / numwins <= WINDOW_MIN_SIZE) { /* If only one window, make the size of it be zero, and return - immediately. */ + immediately. */ if (!windows->next) - { - windows->height = 0; - maybe_free (windows->line_starts); - windows->line_starts = (char **)NULL; - windows->line_count = 0; - break; - } + { + windows->height = 0; + maybe_free (windows->line_starts); + windows->line_starts = (char **)NULL; + windows->line_count = 0; + break; + } /* If we have some temporary windows, delete one of them. */ for (win = windows; win; win = win->next) - if (win->flags & W_TempWindow) - break; + if (win->flags & W_TempWindow) + break; /* Otherwise, delete the first window, and try again. */ if (!win) - win = windows; + win = windows; if (window_deletion_notifier) - (*window_deletion_notifier) (win); + (*window_deletion_notifier) (win); window_delete_window (win); numwins--; } /* The screen has changed height and width. */ - delta_height = height - the_screen->height; /* This is how much. */ - the_screen->height = height; /* This is the new height. */ - the_screen->width = width; /* This is the new width. */ + delta_height = height - the_screen->height; /* This is how much. */ + the_screen->height = height; /* This is the new height. */ + the_screen->width = width; /* This is the new width. */ /* Set the start of the echo area. */ the_echo_area->first_row = height - the_echo_area->height; @@ -186,34 +184,34 @@ window_new_screen_size (width, height) for (win = windows; win; win = win->next) { if ((win->width != width) && ((win->flags & W_InhibitMode) == 0)) - { - win->width = width; - maybe_free (win->modeline); - win->modeline = (char *)xmalloc (1 + width); - } + { + win->width = width; + maybe_free (win->modeline); + win->modeline = (char *)xmalloc (1 + width); + } win->height += delta_each; /* If the previous height of this window was zero, it was the only - window, and it was not visible. Thus we need to compensate for - the echo_area. */ + window, and it was not visible. Thus we need to compensate for + the echo_area. */ if (win->height == delta_each) - win->height -= (1 + the_echo_area->height); + win->height -= (1 + the_echo_area->height); /* If this is not the first window in the chain, then change the - first row of it. We cannot just add delta_each to the first row, - since this window's first row is the sum of the collective increases - that have gone before it. So we just add one to the location of the - previous window's modeline. */ + first row of it. We cannot just add delta_each to the first row, + since this window's first row is the sum of the collective increases + that have gone before it. So we just add one to the location of the + previous window's modeline. */ if (win->prev) - win->first_row = (win->prev->first_row + win->prev->height) + 1; + win->first_row = (win->prev->first_row + win->prev->height) + 1; /* The last window in the chain gets the extra space (or shrinkage). */ if (!win->next) - win->height += delta_leftover; + win->height += delta_leftover; if (win->node) - recalculate_line_starts (win); + recalculate_line_starts (win); win->flags |= W_UpdateWindow; } @@ -232,32 +230,32 @@ window_new_screen_size (width, height) win = windows; while (win) - { - if ((win->height < WINDOW_MIN_HEIGHT) || - (win->height > avail)) - { - WINDOW *lastwin; - - /* Split the space among the available windows. */ - delta_each = avail / numwins; - delta_leftover = avail - (delta_each * numwins); - - for (win = windows; win; win = win->next) - { - lastwin = win; - if (win->prev) - win->first_row = - (win->prev->first_row + win->prev->height) + 1; - win->height = delta_each; - } - - /* Give the leftover space (if any) to the last window. */ - lastwin->height += delta_leftover; - break; - } - else - win= win->next; - } + { + if ((win->height < WINDOW_MIN_HEIGHT) || + (win->height > avail)) + { + WINDOW *lastwin; + + /* Split the space among the available windows. */ + delta_each = avail / numwins; + delta_leftover = avail - (delta_each * numwins); + + for (win = windows; win; win = win->next) + { + lastwin = win; + if (win->prev) + win->first_row = + (win->prev->first_row + win->prev->height) + 1; + win->height = delta_each; + } + + /* Give the leftover space (if any) to the last window. */ + lastwin->height += delta_leftover; + break; + } + else + win= win->next; + } } } @@ -412,25 +410,25 @@ window_change_window_height (window, amount) /* WINDOW decreasing in size? */ if (amount < 0) { - int abs_amount = -amount; /* It is easier to deal with this way. */ + int abs_amount = -amount; /* It is easier to deal with this way. */ /* If the resultant window would be too small, stop here. */ if ((window->height - abs_amount) < WINDOW_MIN_HEIGHT) - return; + return; /* If we have two neighboring windows, choose the smaller one to get - larger. */ + larger. */ if (next && prev) - { - if (prev->height < next->height) - shrink_me_growing_prev (window, prev, abs_amount); - else - shrink_me_growing_next (window, next, abs_amount); - } + { + if (prev->height < next->height) + shrink_me_growing_prev (window, prev, abs_amount); + else + shrink_me_growing_next (window, next, abs_amount); + } else if (next) - shrink_me_growing_next (window, next, abs_amount); + shrink_me_growing_next (window, next, abs_amount); else - shrink_me_growing_prev (window, prev, abs_amount); + shrink_me_growing_prev (window, prev, abs_amount); } /* WINDOW increasing in size? */ @@ -439,65 +437,65 @@ window_change_window_height (window, amount) int total_avail, next_avail = 0, prev_avail = 0; if (next) - next_avail = next->height - WINDOW_MIN_SIZE; + next_avail = next->height - WINDOW_MIN_SIZE; if (prev) - prev_avail = prev->height - WINDOW_MIN_SIZE; + prev_avail = prev->height - WINDOW_MIN_SIZE; total_avail = next_avail + prev_avail; /* If there isn't enough space available to grow this window, give up. */ if (amount > total_avail) - return; + return; /* If there aren't two neighboring windows, or if one of the neighbors - is larger than the other one by at least AMOUNT, grow that one. */ + is larger than the other one by at least AMOUNT, grow that one. */ if ((next && !prev) || ((next_avail - amount) >= prev_avail)) - grow_me_shrinking_next (window, next, amount); + grow_me_shrinking_next (window, next, amount); else if ((prev && !next) || ((prev_avail - amount) >= next_avail)) - grow_me_shrinking_prev (window, prev, amount); + grow_me_shrinking_prev (window, prev, amount); else - { - int change; - - /* This window has two neighbors. They both must be shrunk in to - make enough space for WINDOW to grow. Make them both the same - size. */ - if (prev_avail > next_avail) - { - change = prev_avail - next_avail; - grow_me_shrinking_prev (window, prev, change); - amount -= change; - } - else - { - change = next_avail - prev_avail; - grow_me_shrinking_next (window, next, change); - amount -= change; - } - - /* Both neighbors are the same size. Split the difference in - AMOUNT between them. */ - while (amount) - { - window->height++; - amount--; - - /* Odd numbers grow next, even grow prev. */ - if (amount & 1) - { - prev->height--; - window->first_row--; - } - else - { - next->height--; - next->first_row++; - } - } - window_adjust_pagetop (prev); - window_adjust_pagetop (next); - } + { + int change; + + /* This window has two neighbors. They both must be shrunk in to + make enough space for WINDOW to grow. Make them both the same + size. */ + if (prev_avail > next_avail) + { + change = prev_avail - next_avail; + grow_me_shrinking_prev (window, prev, change); + amount -= change; + } + else + { + change = next_avail - prev_avail; + grow_me_shrinking_next (window, next, change); + amount -= change; + } + + /* Both neighbors are the same size. Split the difference in + AMOUNT between them. */ + while (amount) + { + window->height++; + amount--; + + /* Odd numbers grow next, even grow prev. */ + if (amount & 1) + { + prev->height--; + window->first_row--; + } + else + { + next->height--; + next->first_row++; + } + } + window_adjust_pagetop (prev); + window_adjust_pagetop (next); + } } if (prev) prev->flags |= W_UpdateWindow; @@ -526,10 +524,10 @@ window_tile_windows (style) for (win = windows; win; win = win->next) if (do_internals || !win->node || - (win->node->flags & N_IsInternal) == 0) + (win->node->flags & N_IsInternal) == 0) { - avail += win->height; - numwins++; + avail += win->height; + numwins++; } if (numwins <= 1 || !the_screen->height) @@ -544,11 +542,11 @@ window_tile_windows (style) for (win = windows; win; win = win->next) { if (do_internals || !win->node || - (win->node->flags & N_IsInternal) == 0) - { - last_adjusted = win; - win->height = per_win_height; - } + (win->node->flags & N_IsInternal) == 0) + { + last_adjusted = win; + win->height = per_win_height; + } } if (last_adjusted) @@ -558,7 +556,7 @@ window_tile_windows (style) for (win = windows; win; win = win->next) { if (win->prev) - win->first_row = win->prev->first_row + win->prev->height + 1; + win->first_row = win->prev->first_row + win->prev->height + 1; window_adjust_pagetop (win); win->flags |= W_UpdateWindow; @@ -591,11 +589,11 @@ window_toggle_wrap (window) window_adjust_pagetop (window); /* If the pagetop hasn't changed maybe we can do some scrolling now - to speed up the display. Many of the line starts will be the same, - so scrolling here is a very good optimization.*/ + to speed up the display. Many of the line starts will be the same, + so scrolling here is a very good optimization.*/ if (old_pagetop == window->pagetop) - display_scroll_line_starts - (window, old_pagetop, old_starts, old_lines); + display_scroll_line_starts + (window, old_pagetop, old_starts, old_lines); maybe_free (old_starts); } window->flags |= W_UpdateWindow; @@ -650,12 +648,12 @@ window_delete_window (window) if (window == active_window) { /* If there isn't a next window, then there must be a previous one, - since we cannot delete the last window. If there is a next window, - prefer to use that as the active window. */ + since we cannot delete the last window. If there is a next window, + prefer to use that as the active window. */ if (next) - active_window = next; + active_window = next; else - active_window = prev; + active_window = prev; } if (next && active_window == next) @@ -674,13 +672,13 @@ window_delete_window (window) int diff; /* Try to adjust the visible part of the node so that as little - text as possible has to move. */ + text as possible has to move. */ diff = window_to_fix->first_row - window->first_row; window_to_fix->first_row = window->first_row; window_to_fix->pagetop -= diff; if (window_to_fix->pagetop < 0) - window_to_fix->pagetop = 0; + window_to_fix->pagetop = 0; } /* The `+ 1' is to offset the difference between the first_row locations. @@ -732,17 +730,17 @@ character_width (character, hpos) else if (iscntrl (character)) { switch (character) - { - case '\r': - case '\n': - width = the_screen->width - hpos; - break; - case '\t': - width = ((hpos + 8) & 0xf8) - hpos; - break; - default: - width = 2; - } + { + case '\r': + case '\n': + width = the_screen->width - hpos; + break; + case '\t': + width = ((hpos + 8) & 0xf8) - hpos; + break; + default: + width = 2; + } } else if (character == DEL) width = 2; @@ -820,61 +818,61 @@ calculate_line_starts (window) unsigned int cwidth, c; add_pointer_to_array (line, line_starts_index, line_starts, - line_starts_slots, 100, char *); + line_starts_slots, 100, char *); if (bump_index) - { - i++; - bump_index = 0; - } + { + i++; + bump_index = 0; + } while (1) - { - c = node->contents[i]; - cwidth = character_width (c, hpos); - - /* If this character fits within this line, just do the next one. */ - if ((hpos + cwidth) < window->width) - { - i++; - hpos += cwidth; - continue; - } - else - { - /* If this character would position the cursor at the start of - the next printed screen line, then do the next line. */ - if (c == '\n' || c == '\r' || c == '\t') - { - i++; - hpos = 0; - break; - } - else - { - /* This character passes the window width border. Postion - the cursor after the printed character, but remember this - line start as where this character is. A bit tricky. */ - - /* If this window doesn't wrap lines, proceed to the next - physical line here. */ - if (window->flags & W_NoWrap) - { - hpos = 0; - while (i < node->nodelen && node->contents[i] != '\n') - i++; - - if (node->contents[i] == '\n') - i++; - } - else - { - hpos = the_screen->width - hpos; - bump_index++; - } - break; - } - } - } + { + c = node->contents[i]; + cwidth = character_width (c, hpos); + + /* If this character fits within this line, just do the next one. */ + if ((hpos + cwidth) < window->width) + { + i++; + hpos += cwidth; + continue; + } + else + { + /* If this character would position the cursor at the start of + the next printed screen line, then do the next line. */ + if (c == '\n' || c == '\r' || c == '\t') + { + i++; + hpos = 0; + break; + } + else + { + /* This character passes the window width border. Postion + the cursor after the printed character, but remember this + line start as where this character is. A bit tricky. */ + + /* If this window doesn't wrap lines, proceed to the next + physical line here. */ + if (window->flags & W_NoWrap) + { + hpos = 0; + while (i < node->nodelen && node->contents[i] != '\n') + i++; + + if (node->contents[i] == '\n') + i++; + } + else + { + hpos = the_screen->width - hpos; + bump_index++; + } + break; + } + } + } } window->line_starts = line_starts; window->line_count = line_starts_index; @@ -916,7 +914,7 @@ window_adjust_pagetop (window) line_start = window->line_starts[line]; if ((line_start - contents) > window->point) - break; + break; } /* The line index preceding the line start which is past point is the @@ -929,26 +927,26 @@ window_adjust_pagetop (window) (line - window->pagetop > (window->height - 1))) { /* The user-settable variable "scroll-step" is used to attempt - to make point visible, iff it is non-zero. If that variable - is zero, then the line containing point is centered within - the window. */ + to make point visible, iff it is non-zero. If that variable + is zero, then the line containing point is centered within + the window. */ if (window_scroll_step < window->height) - { - if ((line < window->pagetop) && - ((window->pagetop - window_scroll_step) <= line)) - window->pagetop -= window_scroll_step; - else if ((line - window->pagetop > (window->height - 1)) && - ((line - (window->pagetop + window_scroll_step) - < window->height))) - window->pagetop += window_scroll_step; - else - window->pagetop = line - ((window->height - 1) / 2); - } + { + if ((line < window->pagetop) && + ((window->pagetop - window_scroll_step) <= line)) + window->pagetop -= window_scroll_step; + else if ((line - window->pagetop > (window->height - 1)) && + ((line - (window->pagetop + window_scroll_step) + < window->height))) + window->pagetop += window_scroll_step; + else + window->pagetop = line - ((window->height - 1) / 2); + } else - window->pagetop = line - ((window->height - 1) / 2); + window->pagetop = line - ((window->height - 1) / 2); if (window->pagetop < 0) - window->pagetop = 0; + window->pagetop = 0; window->flags |= W_UpdateWindow; } } @@ -970,7 +968,7 @@ window_line_of_point (window) for (i = start; i < window->line_count; i++) { if ((window->line_starts[i] - window->node->contents) > window->point) - break; + break; } return (i - 1); @@ -1029,7 +1027,7 @@ window_chars_to_goal (line, goal) check = hpos + character_width (line[i], hpos); if (check > goal) - break; + break; hpos = check; } @@ -1056,26 +1054,26 @@ window_make_modeline (window) if (window->pagetop == 0) { if (lines_remaining <= window->height) - strcpy (location_indicator, "All"); + strcpy (location_indicator, "All"); else - strcpy (location_indicator, "Top"); + strcpy (location_indicator, "Top"); } else { if (lines_remaining <= window->height) - strcpy (location_indicator, "Bot"); + strcpy (location_indicator, "Bot"); else - { - float pt, lc; - int percentage; + { + float pt, lc; + int percentage; - pt = (float)window->pagetop; - lc = (float)window->line_count; + pt = (float)window->pagetop; + lc = (float)window->line_count; - percentage = 100 * (pt / lc); + percentage = 100 * (pt / lc); - sprintf (location_indicator, "%2d%%", percentage); - } + sprintf (location_indicator, "%2d%%", percentage); + } } /* Calculate the maximum size of the information to stick in MODELINE. */ @@ -1088,49 +1086,49 @@ window_make_modeline (window) if (node) { - if (node->nodename) - nodename = node->nodename; + if (node->nodename) + nodename = node->nodename; - if (node->parent) - { - parent = filename_non_directory (node->parent); - modeline_len += strlen ("Subfile: ") + strlen (node->filename); - } + if (node->parent) + { + parent = filename_non_directory (node->parent); + modeline_len += strlen ("Subfile: ") + strlen (node->filename); + } - if (node->filename) - filename = filename_non_directory (node->filename); + if (node->filename) + filename = filename_non_directory (node->filename); - if (node->flags & N_UpdateTags) - update_message = "--*** Tags out of Date ***"; + if (node->flags & N_UpdateTags) + update_message = _("--*** Tags out of Date ***"); } if (update_message) modeline_len += strlen (update_message); modeline_len += strlen (filename); modeline_len += strlen (nodename); - modeline_len += 4; /* strlen (location_indicator). */ + modeline_len += 4; /* strlen (location_indicator). */ /* 10 for the decimal representation of the number of lines in this node, and the remainder of the text that can appear in the line. */ - modeline_len += 10 + strlen ("-----Info: (), lines ----, "); + modeline_len += 10 + strlen (_("-----Info: (), lines ----, ")); modeline_len += window->width; modeline = (char *)xmalloc (1 + modeline_len); /* Special internal windows have no filename. */ if (!parent && !*filename) - sprintf (modeline, "-%s---Info: %s, %d lines --%s--", - (window->flags & W_NoWrap) ? "$" : "-", - nodename, window->line_count, location_indicator); + sprintf (modeline, _("-%s---Info: %s, %d lines --%s--"), + (window->flags & W_NoWrap) ? "$" : "-", + nodename, window->line_count, location_indicator); else - sprintf (modeline, "-%s%s-Info: (%s)%s, %d lines --%s--", - (window->flags & W_NoWrap) ? "$" : "-", - (node && (node->flags & N_IsCompressed)) ? "zz" : "--", - parent ? parent : filename, - nodename, window->line_count, location_indicator); + sprintf (modeline, _("-%s%s-Info: (%s)%s, %d lines --%s--"), + (window->flags & W_NoWrap) ? "$" : "-", + (node && (node->flags & N_IsCompressed)) ? "zz" : "--", + parent ? parent : filename, + nodename, window->line_count, location_indicator); if (parent) - sprintf (modeline + strlen (modeline), " Subfile: %s", filename); + sprintf (modeline + strlen (modeline), _(" Subfile: %s"), filename); if (update_message) sprintf (modeline + strlen (modeline), "%s", update_message); @@ -1141,9 +1139,9 @@ window_make_modeline (window) modeline[window->width] = '\0'; else { - while (i < window->width) - modeline[i++] = '-'; - modeline[i] = '\0'; + while (i < window->width) + modeline[i++] = '-'; + modeline[i] = '\0'; } strcpy (window->modeline, modeline); @@ -1197,9 +1195,9 @@ window_set_state (window, state) /* **************************************************************** */ -/* */ -/* Manipulating Home-Made Nodes */ -/* */ +/* */ +/* Manipulating Home-Made Nodes */ +/* */ /* **************************************************************** */ /* A place to buffer echo area messages. */ @@ -1259,8 +1257,8 @@ message_in_echo_area (format, arg1, arg2) if (echo_area_node) { add_pointer_to_array (echo_area_node, old_echo_area_nodes_index, - old_echo_area_nodes, old_echo_area_nodes_slots, - 4, NODE *); + old_echo_area_nodes, old_echo_area_nodes_slots, + 4, NODE *); } echo_area_node = (NODE *)NULL; window_message_in_echo_area (format, arg1, arg2); @@ -1299,7 +1297,7 @@ message_buffer_resize (length) while (message_buffer_size <= message_buffer_index + length) message_buffer = (char *) xrealloc (message_buffer, - message_buffer_size += 100 + (2 * length)); + message_buffer_size += 100 + (2 * length)); } /* Format MESSAGE_BUFFER with the results of printing FORMAT with ARG1 and @@ -1323,70 +1321,70 @@ build_message_buffer (format, arg1, arg2) for (i = 0; format[i]; i++) { if (format[i] != '%') - { - message_buffer[message_buffer_index++] = format[i]; - len--; - } + { + message_buffer[message_buffer_index++] = format[i]; + len--; + } else - { - char c; - - c = format[++i]; - - switch (c) - { - case '%': /* Insert a percent sign. */ - message_buffer_resize (len + 1); - message_buffer[message_buffer_index++] = '%'; - break; - - case 's': /* Insert the current arg as a string. */ - { - char *string; - int string_len; - - string = (char *)args[arg_index++]; - string_len = strlen (string); - - message_buffer_resize (len + string_len); - sprintf - (message_buffer + message_buffer_index, "%s", string); - message_buffer_index += string_len; - } - break; - - case 'd': /* Insert the current arg as an integer. */ - { - long long_val; - int integer; - - long_val = (long)args[arg_index++]; - integer = (int)long_val; - - message_buffer_resize (len + 32); - sprintf - (message_buffer + message_buffer_index, "%d", integer); - message_buffer_index = strlen (message_buffer); - } - break; - - case 'c': /* Insert the current arg as a character. */ - { - long long_val; - int character; - - long_val = (long)args[arg_index++]; - character = (int)long_val; - - message_buffer_resize (len + 1); - message_buffer[message_buffer_index++] = character; - } - break; - - default: - abort (); - } - } + { + char c; + + c = format[++i]; + + switch (c) + { + case '%': /* Insert a percent sign. */ + message_buffer_resize (len + 1); + message_buffer[message_buffer_index++] = '%'; + break; + + case 's': /* Insert the current arg as a string. */ + { + char *string; + int string_len; + + string = (char *)args[arg_index++]; + string_len = strlen (string); + + message_buffer_resize (len + string_len); + sprintf + (message_buffer + message_buffer_index, "%s", string); + message_buffer_index += string_len; + } + break; + + case 'd': /* Insert the current arg as an integer. */ + { + long long_val; + int integer; + + long_val = (long)args[arg_index++]; + integer = (int)long_val; + + message_buffer_resize (len + 32); + sprintf + (message_buffer + message_buffer_index, "%d", integer); + message_buffer_index = strlen (message_buffer); + } + break; + + case 'c': /* Insert the current arg as a character. */ + { + long long_val; + int character; + + long_val = (long)args[arg_index++]; + character = (int)long_val; + + message_buffer_resize (len + 1); + message_buffer[message_buffer_index++] = character; + } + break; + + default: + abort (); + } + } } message_buffer[message_buffer_index] = '\0'; } @@ -1474,7 +1472,7 @@ pad_to (count, string) else { while (i < count) - string[i++] = ' '; + string[i++] = ' '; } string[i] = '\0'; diff --git a/texinfo/info/window.h b/texinfo/info/window.h index 5bde64a..17367cb 100644 --- a/texinfo/info/window.h +++ b/texinfo/info/window.h @@ -1,9 +1,10 @@ -/* window.h -- Structure and flags used in manipulating Info windows. */ +/* window.h -- Structure and flags used in manipulating Info windows. + $Id: window.h,v 1.4 1997/07/15 18:45:47 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation + This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,8 +22,8 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#if !defined (_WINDOW_H_) -#define _WINDOW_H_ +#ifndef INFO_WINDOW_H +#define INFO_WINDOW_H #include "nodes.h" #include "infomap.h" @@ -44,9 +45,9 @@ if you need to change window state information, here is where you would do it. NB> The last element does NOT end with a semi-colon. */ #define WINDOW_STATE_DECL \ - NODE *node; /* The node displayed in this window. */ \ - int pagetop; /* LINE_STARTS[PAGETOP] is first line in WINDOW. */ \ - long point /* Offset within NODE of the cursor position. */ + NODE *node; /* The node displayed in this window. */ \ + int pagetop; /* LINE_STARTS[PAGETOP] is first line in WINDOW. */ \ + long point /* Offset within NODE of the cursor position. */ /* Structure which defines a window. Windows are doubly linked, next and prev. The list of windows is kept on WINDOWS. The structure member @@ -54,37 +55,38 @@ (0, window->height + window->first_row) is the first character of this windows modeline. The number of lines that can be displayed in a window is equal to window->height - 1. */ -typedef struct __window__ { - struct __window__ *next; /* Next window in this chain. */ - struct __window__ *prev; /* Previous window in this chain. */ - int width; /* Width of this window. */ - int height; /* Height of this window. */ - int first_row; /* Offset of the first line in the_screen. */ - int goal_column; /* The column we would like the cursor to appear in. */ - Keymap keymap; /* Keymap used to read commands in this window. */ - WINDOW_STATE_DECL; /* Node, pagetop and point. */ - char *modeline; /* Calculated text of the modeline for this window. */ - char **line_starts; /* Array of printed line starts for this node. */ - int line_count; /* Number of lines appearing in LINE_STARTS. */ - int flags; /* See below for details. */ +typedef struct window_struct +{ + struct window_struct *next; /* Next window in this chain. */ + struct window_struct *prev; /* Previous window in this chain. */ + int width; /* Width of this window. */ + int height; /* Height of this window. */ + int first_row; /* Offset of the first line in the_screen. */ + int goal_column; /* The column we would like the cursor to appear in. */ + Keymap keymap; /* Keymap used to read commands in this window. */ + WINDOW_STATE_DECL; /* Node, pagetop and point. */ + char *modeline; /* Calculated text of the modeline for this window. */ + char **line_starts; /* Array of printed line starts for this node. */ + int line_count; /* Number of lines appearing in LINE_STARTS. */ + int flags; /* See below for details. */ } WINDOW; typedef struct { - WINDOW_STATE_DECL; /* What gets saved. */ + WINDOW_STATE_DECL; /* What gets saved. */ } WINDOW_STATE; -#define W_UpdateWindow 0x01 /* WINDOW needs updating. */ -#define W_WindowIsPerm 0x02 /* This WINDOW is a permanent object. */ -#define W_WindowVisible 0x04 /* This WINDOW is currently visible. */ -#define W_InhibitMode 0x08 /* This WINDOW has no modeline. */ -#define W_NoWrap 0x10 /* Lines do not wrap in this window. */ -#define W_InputWindow 0x20 /* Window accepts input. */ -#define W_TempWindow 0x40 /* Window is less important. */ +#define W_UpdateWindow 0x01 /* WINDOW needs updating. */ +#define W_WindowIsPerm 0x02 /* This WINDOW is a permanent object. */ +#define W_WindowVisible 0x04 /* This WINDOW is currently visible. */ +#define W_InhibitMode 0x08 /* This WINDOW has no modeline. */ +#define W_NoWrap 0x10 /* Lines do not wrap in this window. */ +#define W_InputWindow 0x20 /* Window accepts input. */ +#define W_TempWindow 0x40 /* Window is less important. */ -extern WINDOW *windows; /* List of visible Info windows. */ -extern WINDOW *active_window; /* The currently active window. */ -extern WINDOW *the_screen; /* The Info screen is just another window. */ -extern WINDOW *the_echo_area; /* THE_ECHO_AREA is a window in THE_SCREEN. */ +extern WINDOW *windows; /* List of visible Info windows. */ +extern WINDOW *active_window; /* The currently active window. */ +extern WINDOW *the_screen; /* The Info screen is just another window. */ +extern WINDOW *the_echo_area; /* THE_ECHO_AREA is a window in THE_SCREEN. */ /* Global variable control redisplay of scrolled windows. If non-zero, it is the desired number of lines to scroll the window in order to make @@ -226,4 +228,4 @@ extern void window_get_state (), window_set_state (); offset of GOAL. */ extern int window_chars_to_goal (); -#endif /* !_WINDOW_H_ */ +#endif /* not INFO_WINDOW_H */ diff --git a/texinfo/makeinfo/Makefile.in b/texinfo/makeinfo/Makefile.in index fe81fcd..842b26e 100644 --- a/texinfo/makeinfo/Makefile.in +++ b/texinfo/makeinfo/Makefile.in @@ -1,116 +1,271 @@ -# Makefile for GNU makeinfo. -# $Id: Makefile.in,v 1.1 1997/08/21 22:58:07 jason Exp $ -# -# Copyright (C) 1993, 96 Free Software Foundation, Inc. +# Makefile.in generated automatically by automake 1.2 from Makefile.am -# 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. +# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#### Start of system configuration section. #### +SHELL = /bin/sh srcdir = @srcdir@ -VPATH = $(srcdir):$(common) +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include -common = $(srcdir)/../libtxi +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ -EXEEXT = @EXEEXT@ -CC = @CC@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = true +PRE_INSTALL = true +POST_INSTALL = true +NORMAL_UNINSTALL = true +PRE_UNINSTALL = true +POST_UNINSTALL = true +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +TERMLIBS = @TERMLIBS@ +TEXCONFIG = @TEXCONFIG@ +TEXMF = @TEXMF@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +l = @l@ + +bin_PROGRAMS = makeinfo + +localedir = $(datadir)/locale +INCLUDES = -I$(top_srcdir)/lib -I../intl -DLOCALEDIR=\"$(localedir)\" +LDADD = ../lib/libtxi.a @INTLLIBS@ + +makeinfo_SOURCES = makeinfo.c makeinfo.h multi.c + +EXTRA_DIST = README +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = makeinfo$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +makeinfo_OBJECTS = makeinfo.o multi.o +makeinfo_LDADD = $(LDADD) +makeinfo_DEPENDENCIES = ../lib/libtxi.a +makeinfo_LDFLAGS = +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = README Makefile.am Makefile.in -LN = ln -RM = rm -f -MKDIR = mkdir -DEFS = @DEFS@ -LIBS = -L../libtxi -ltxi @LIBS@ -LOADLIBES = $(LIBS) +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -SHELL = /bin/sh +TAR = tar +GZIP = --best +SOURCES = $(makeinfo_SOURCES) +OBJECTS = $(makeinfo_OBJECTS) -CFLAGS = @CFLAGS@ -LDFLAGS = @LDFLAGS@ +default: all -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -# Prefix for each installed program, normally empty or `g'. -binprefix = -infodir = @infodir@ +.SUFFIXES: +.SUFFIXES: .c .o +$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus makeinfo/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-binPROGRAMS: -#### End of system configuration section. #### +clean-binPROGRAMS: + test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -SRCS = makeinfo.c multi.c -OBJS = makeinfo.o multi.o +distclean-binPROGRAMS: -PROGS = makeinfo$(EXEEXT) +maintainer-clean-binPROGRAMS: -all: $(PROGS) makeinfo.info -sub-all: all +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`"; \ + $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + $(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \ + done .c.o: - $(CC) -c $(CPPFLAGS) -I. -I$(srcdir) -I$(common) $(DEFS) $(CFLAGS) $< + $(COMPILE) -c $< + +mostlyclean-compile: + rm -f *.o core + +clean-compile: + +distclean-compile: + rm -f *.tab.c + +maintainer-clean-compile: + +makeinfo$(EXEEXT): $(makeinfo_OBJECTS) $(makeinfo_DEPENDENCIES) + @rm -f makeinfo$(EXEEXT) + $(LINK) $(makeinfo_LDFLAGS) $(makeinfo_OBJECTS) $(makeinfo_LDADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) + here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) + tags=; \ + here=`pwd`; \ + test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = makeinfo -makeinfo$(EXEEXT): $(OBJS) ../libtxi/libtxi.a - $(CC) $(LDFLAGS) -o makeinfo $(OBJS) $(LOADLIBES) +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done +info: +dvi: +check: all + $(MAKE) +installcheck: +install-info: +install-exec: install-binPROGRAMS + @$(NORMAL_INSTALL) -../libtxi/libtxi.a: - (cd ../libtxi && $(MAKE) $(MFLAGS) libtxi.a) +install-data: + @$(NORMAL_INSTALL) -makeinfo.o: makeinfo.c $(common)/getopt.h +install: install-exec install-data all + @: -$(OBJS): makeinfo.h +uninstall: uninstall-binPROGRAMS -info makeinfo.info: ./makeinfo makeinfo.texi #macro.texi - ./makeinfo --no-split -I$(srcdir) makeinfo.texi +all: Makefile $(PROGRAMS) -# makeinfo.texi: ./makeinfo makeinfo.mki -# ./makeinfo -E makeinfo.texi -I$(srcdir) makeinfo.mki +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install +installdirs: + $(mkinstalldirs) $(bindir) -dvi makeinfo.dvi: ./makeinfo makeinfo.texi #macro.texi - $(srcdir)/../util/texi2dvi makeinfo.txi -install: all - $(INSTALL_PROGRAM) makeinfo$(EXEEXT) $(bindir)/$(binprefix)makeinfo$(EXEEXT) - -d=$(srcdir); test -f ./makeinfo.info && d=.; $(INSTALL_DATA) $$d/makeinfo.info $(infodir)/makeinfo.info - $(POST_INSTALL) +mostlyclean-generic: + test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) -install-info: - -d=$(srcdir); test -f ./makeinfo.info && d=.; $(INSTALL_DATA) $$d/makeinfo.info $(infodir)/makeinfo.info - ../util/install-info --info-dir=$(infodir) $(infodir)/makeinfo.info +clean-generic: + test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) -uninstall: - for f in $(PROGS); do rm -f $(bindir)/$(binprefix)$$f; done - rm -f $(infodir)/makeinfo.info +distclean-generic: + rm -f Makefile $(DISTCLEANFILES) + rm -f config.cache config.log stamp-h stamp-h[0-9]* + test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -TAGS: $(SRCS) - etags $(SRCS) +maintainer-clean-generic: + test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-binPROGRAMS mostlyclean-compile \ + mostlyclean-tags mostlyclean-generic -clean: - rm -f *.o a.out core core.* $(PROGS) +clean: clean-binPROGRAMS clean-compile clean-tags clean-generic \ + mostlyclean -mostlyclean: clean +distclean: distclean-binPROGRAMS distclean-compile distclean-tags \ + distclean-generic clean + rm -f config.status -distclean: clean - rm -f TAGS Makefile config.status *.info */*.info +maintainer-clean: maintainer-clean-binPROGRAMS maintainer-clean-compile \ + maintainer-clean-tags maintainer-clean-generic \ + distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." -realclean: distclean -maintainer-clean: distclean +.PHONY: default mostlyclean-binPROGRAMS distclean-binPROGRAMS \ +clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \ +install-binPROGRAMS mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info dvi installcheck \ +install-info install-exec install-data install uninstall all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean -Makefile: Makefile.in ../config.status - cd .. && sh config.status -# Prevent GNU make v3 from overflowing arg limit on SysV. +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/texinfo/makeinfo/makeinfo.h b/texinfo/makeinfo/makeinfo.h index 399764e..205a3bd 100644 --- a/texinfo/makeinfo/makeinfo.h +++ b/texinfo/makeinfo/makeinfo.h @@ -1,7 +1,7 @@ /* makeinfo.h -- Declarations for Makeinfo. - $Id: makeinfo.h,v 1.1 1997/08/21 22:58:08 jason Exp $ + $Id: makeinfo.h,v 1.3 1997/07/15 18:28:38 karl Exp $ - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 97 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 @@ -35,12 +35,14 @@ enum insertion_type { - menu, detailmenu, quotation, lisp, smalllisp, example, smallexample, - display, itemize, format, enumerate, cartouche, multitable, table, - ftable, vtable, group, ifinfo, flushleft, flushright, ifset, - ifclear, deffn, defun, defmac, defspec, defvr, defvar, defopt, - deftypefn, deftypefun, deftypevr, deftypevar, defcv, defivar, defop, - defmethod, deftypemethod, deftp, direntry, bad_type + cartouche, defcv, deffn, defivar, defmac, defmethod, + defop, defopt, defspec, deftp, deftypefn, deftypefun, + deftypemethod, deftypevar, deftypevr, defun, defvar, + defvr, detailmenu, direntry, display, enumerate, example, + flushleft, flushright, format, ftable, group, ifclear, + ifinfo, ifnothtml, ifnottex, ifset, itemize, lisp, menu, + multitable, quotation, smallexample, smalllisp, table, vtable, + bad_type }; DECLARE (int, insertion_level, 0); @@ -48,13 +50,13 @@ DECLARE (int, insertion_level, 0); #if defined (COMPILING_MAKEINFO) char *insertion_type_names[] = { - "menu", "detailmenu", "quotation", "lisp", "smalllisp", "example", - "smallexample", "display", "itemize", "format", "enumerate", - "cartouche", "multitable", "table", "ftable", "vtable", "group", - "ifinfo", "flushleft", "flushright", "ifset", "ifclear", "deffn", - "defun", "defmac", "defspec", "defvr", "defvar", "defopt", - "deftypefn", "deftypefun", "deftypevr", "deftypevar", "defcv", - "defivar", "defop", "defmethod", "deftypemethod", "deftp", "direntry", + "cartouche", "defcv", "deffn", "defivar", "defmac", "defmethod", + "defop", "defopt", "defspec", "deftp", "deftypefn", "deftypefun", + "deftypemethod", "deftypevar", "deftypevr", "defun", "defvar", + "defvr", "detailmenu", "direntry", "display", "enumerate", "example", + "flushleft", "flushright", "format", "ftable", "group", "ifclear", + "ifinfo", "ifnothtml", "ifnottex", "ifset", "itemize", "lisp", "menu", + "multitable", "quotation", "smallexample", "smalllisp", "table", "vtable", "bad_type" }; #endif @@ -107,15 +109,15 @@ DECLARE (int, line_number, 0); #define curchar() input_text[input_text_offset] /* **************************************************************** */ -/* */ -/* Global Defines */ -/* */ +/* */ +/* Global Defines */ +/* */ /* **************************************************************** */ /* Error levels */ #define NO_ERROR 0 -#define SYNTAX 2 -#define FATAL 4 +#define SYNTAX 2 +#define FATAL 4 /* C's standard macros don't check to make sure that the characters being changed are within range. So I have to check explicitly. */ @@ -164,29 +166,29 @@ DECLARE (int, line_number, 0); #define SPLIT_SIZE_THRESHOLD 70000 /* What's good enough for Stallman... */ #define DEFAULT_SPLIT_SIZE 50000 /* Is probably good enough for me. */ -DECLARE (int, splitting, 1); /* Defaults to true for now. */ +DECLARE (int, splitting, 1); /* Defaults to true for now. */ typedef void COMMAND_FUNCTION (); /* So I can say COMMAND_FUNCTION *foo; */ #define command_char(c) ((!whitespace(c)) && \ - ((c) != '\n') && \ - ((c) != '{') && \ - ((c) != '}') && \ - ((c) != '=')) + ((c) != '\n') && \ + ((c) != '{') && \ + ((c) != '}') && \ + ((c) != '=')) #define skip_whitespace() \ while ((input_text_offset != size_of_input_text) && \ - whitespace (curchar())) \ + whitespace (curchar())) \ input_text_offset++ #define skip_whitespace_and_newlines() \ do { \ while ((input_text_offset != size_of_input_text) && \ - (whitespace (curchar ()) || (curchar () == '\n'))) \ + (whitespace (curchar ()) || (curchar () == '\n'))) \ { \ - if (curchar () == '\n') \ - line_number++; \ - input_text_offset++; \ + if (curchar () == '\n') \ + line_number++; \ + input_text_offset++; \ } \ } while (0) diff --git a/texinfo/makeinfo/multi.c b/texinfo/makeinfo/multi.c index 5d4bb70b..99c380d 100644 --- a/texinfo/makeinfo/multi.c +++ b/texinfo/makeinfo/multi.c @@ -1,7 +1,7 @@ -/* multi.c -- Multitable stuff for makeinfo. - $Id: multi.c,v 1.1 1997/08/21 22:58:08 jason Exp $ +/* multi.c -- multitable stuff for makeinfo. + $Id: multi.c,v 1.9 1997/07/24 22:01:00 karl Exp $ - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 97 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 @@ -17,10 +17,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <stdio.h> +#include "system.h" #include "makeinfo.h" -#define MAXCOLS 100 /* remove this limit later @@ */ +#define MAXCOLS 100 /* remove this limit later @@ */ /* @@ -38,7 +38,7 @@ * `select_output_environment' function switches from one output * environment to another. * - * Environment #0 (i.e. element #0 of the table) is the regular + * Environment #0 (i.e., element #0 of the table) is the regular * environment that is used when we're not formatting a multitable. * * Environment #N (where N = 1,2,3,...) is the env. for column #N of @@ -55,7 +55,7 @@ struct env int paragraph_is_open; int current_indent; int fill_column; -} envs[MAXCOLS]; /* the environment table */ +} envs[MAXCOLS]; /* the environment table */ /* index in environment table of currently selected environment */ static int current_env_no; @@ -67,6 +67,40 @@ static int last_column; to be drawn, separating rows and columns in the current multitable. */ static int hsep, vsep; +/* Output a row. Have to keep `output_position' up-to-date for each + character we output, or the tags table will be off, leading to + chopped-off output files and undefined nodes (because they're in the + wrong file, etc.). Perhaps it would be better to accumulate this + value somewhere and add it once at the end of the table, or return it + as the value, but this seems simplest. */ +static void +out_char (ch) + int ch; +{ + extern int output_position; + putc (ch, output_stream); + output_position++; +} + + +void +draw_horizontal_separator () +{ + int i, j, s; + + for (s = 0; s < envs[0].current_indent; s++) + out_char (' '); + if (vsep) + out_char ('+'); + for (i = 1; i <= last_column; i++) { + for (j = 0; j <= envs[i].fill_column; j++) + out_char ('-'); + if (vsep) + out_char ('+'); + } + out_char ('\n'); +} + void do_multitable () { @@ -116,7 +150,7 @@ setup_multitable_parameters () char *params = insertion_stack->item_function; int nchars; float columnfrac; - char command[200]; + char command[200]; /* naughty, should be no fixed limits */ int i = 1; /* We implement @hsep and @vsep even though TeX doesn't. @@ -129,22 +163,32 @@ setup_multitable_parameters () params++; if (*params == '@') { - sscanf (params, "%s%n", command, &nchars); + sscanf (params, "%200s", command); + nchars = strlen (command); params += nchars; if (strcmp (command, "@hsep") == 0) - hsep++; + hsep++; else if (strcmp (command, "@vsep") == 0) - vsep++; + vsep++; else if (strcmp (command, "@columnfractions") == 0) { - /* Clobber old environments and create new ones, - starting at #1. Environment #0 is the normal standard output, - so we don't mess with it. */ - for ( ; i <= MAXCOLS; i++) { - if (sscanf (params, "%f%n", &columnfrac, &nchars) < 1) - goto done; - params += nchars; - setup_output_environment (i, (int) (columnfrac * fill_column + .5)); - } + /* Clobber old environments and create new ones, starting at #1. + Environment #0 is the normal output, so don't mess with it. */ + for ( ; i <= MAXCOLS; i++) { + if (sscanf (params, "%f", &columnfrac) < 1) + goto done; + /* Unfortunately, can't use %n since some m68k-hp-bsd libc + doesn't support it. So skip whitespace (preceding the + number) and then non-whitespace (the number). */ + while (*params && (*params == ' ' || *params == '\t')) + params++; + /* Hmm, but what what @columnfractions 3foo. Well, I suppose + it's invalid input anyway. */ + while (*params && *params != ' ' && *params != '\t' + && *params != '\n' && *params != '@') + params++; + setup_output_environment (i, + (int) (columnfrac * (fill_column - current_indent) + .5)); + } } } else if (*params == '{') { @@ -154,18 +198,17 @@ setup_multitable_parameters () } /* This gives us two spaces between columns. Seems reasonable. Really should expand the text, though, so a template of - `@code{foo}' has a width of three, not ten. Also have to match - braces, then. */ + `@code{foo}' has a width of five, not ten. Also have to match + braces, then. How to take into account current_indent here? */ setup_output_environment (i++, params++ - start); } else { - warning ("ignoring stray text `%s' after @multitable", params); + warning (_("ignoring stray text `%s' after @multitable"), params); break; } } done: - flush_output (); inhibit_output_flushing (); @@ -227,12 +270,12 @@ select_output_environment (n) } /* advance to the next environment number */ -int +void nselect_next_environment () { if (current_env_no >= last_column) { - line_error ("Too many columns in multitable item (max %d)", last_column); - return 1; + line_error (_("Too many columns in multitable item (max %d)"), last_column); + return; } select_output_environment (current_env_no + 1); } @@ -240,12 +283,25 @@ nselect_next_environment () static void output_multitable_row (); +/* do anything needed at the beginning of processing a + multitable column. */ +void +init_column () +{ + /* don't indent 1st paragraph in the item */ + cm_noindent (); + + /* throw away possible whitespace after @item or @tab command */ + skip_whitespace (); +} + /* start a new item (row) of a multitable */ +int multitable_item () { if (!multitable_active) { /* impossible, I think. */ - error ("multitable item not in active multitable"); + error (_("multitable item not in active multitable")); exit (1); } if (current_env_no > 0) { @@ -254,7 +310,7 @@ multitable_item () /* start at column 1 */ select_output_environment (1); if (!output_paragraph) { - line_error ("Cannot select column #%d in multitable", current_env_no); + line_error (_("Cannot select column #%d in multitable"), current_env_no); exit (FATAL); } @@ -263,38 +319,10 @@ multitable_item () return 0; } -/* do anything needed at the beginning of processing a - multitable column. */ -init_column () -{ - /* don't indent 1st paragraph in the item */ - cm_noindent (); - - /* throw away possible whitespace after @item or @tab command */ - skip_whitespace (); -} - -/* Output a row. Have to keep `output_position' up-to-date for each - character we output, or the tags table will be off, leading to - chopped-off output files and undefined nodes (because they're in the - wrong file, etc.). Perhaps it would be better to accumulate this - value somewhere and add it once at the end of the table, or return it - as the value, but this seems simplest. */ - -static void -out_char (ch) - int ch; -{ - extern int output_position; - putc (ch, output_stream); - output_position++; -} - - static void output_multitable_row () { - int i, j, remaining; + int i, j, s, remaining; /* offset in the output paragraph of the next char needing to be output for that column. */ @@ -325,29 +353,34 @@ output_multitable_row () /* first, see if there is any work to do */ for (i = 1; i <= last_column; i++) { if (CHAR_ADDR (0) < envs[i].output_paragraph_offset) { - remaining = 1; - break; + remaining = 1; + break; } } if (!remaining) break; - + + for (s = 0; s < envs[0].current_indent; s++) + out_char (' '); + if (vsep) out_char ('|'); for (i = 1; i <= last_column; i++) { + for (s = 0; i < envs[i].current_indent; s++) + out_char (' '); for (j = 0; CHAR_ADDR (j) < envs[i].output_paragraph_offset; j++) { - if (CHAR_AT (j) == '\n') - break; - out_char (CHAR_AT (j)); + if (CHAR_AT (j) == '\n') + break; + out_char (CHAR_AT (j)); } - offset[i] += j + 1; /* skip last text plus skip the newline */ + offset[i] += j + 1; /* skip last text plus skip the newline */ for (; j <= envs[i].fill_column; j++) - out_char (' '); + out_char (' '); if (vsep) - out_char ('|'); /* draw column separator */ + out_char ('|'); /* draw column separator */ } - out_char ('\n'); /* end of line */ + out_char ('\n'); /* end of line */ } if (hsep) @@ -363,27 +396,12 @@ output_multitable_row () #undef CHAR_AT #undef CHAR_ADDR -int -draw_horizontal_separator () -{ - int i, j; - if (vsep) - out_char ('+'); - for (i = 1; i <= last_column; i++) { - for (j = 0; j <= envs[i].fill_column; j++) - out_char ('-'); - if (vsep) - out_char ('+'); - } - out_char ('\n'); -} - /* select a new column in current row of multitable */ void cm_tab () { if (!multitable_active) - error ("ignoring @tab outside of multitable"); + error (_("ignoring @tab outside of multitable")); nselect_next_environment (); init_column (); @@ -394,8 +412,6 @@ cm_tab () void end_multitable () { - int i; - output_multitable_row (); /* Multitables cannot be nested. Otherwise, we'd have to save the @@ -409,10 +425,10 @@ end_multitable () uninhibit_output_flushing (); #if 0 - printf ("** Multicolumn output from last row:\n"); + printf (_("** Multicolumn output from last row:\n")); for (i = 1; i <= last_column; i++) { select_output_environment (i); - printf ("* column #%d: output = %s\n", i, output_paragraph); + printf (_("* column #%d: output = %s\n"), i, output_paragraph); } #endif } diff --git a/texinfo/texinfo.tex b/texinfo/texinfo.tex index 9634531..2ce38f9 100644 --- a/texinfo/texinfo.tex +++ b/texinfo/texinfo.tex @@ -1,5 +1,5 @@ %% TeX macros to handle Texinfo files. -%% $Id: texinfo.tex,v 1.1 1997/08/21 22:57:53 jason Exp $ +%% $Id: texinfo.tex,v 2.218 1997/07/26 19:12:35 karl Exp $ % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, % 94, 95, 96, 97 Free Software Foundation, Inc. @@ -36,7 +36,7 @@ % This automatically updates the version number based on RCS. \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}} -\deftexinfoversion$Revision: 1.1 $ +\deftexinfoversion$Revision: 2.218 $ \message{Loading texinfo package [Version \texinfoversion]:} % If in a .fmt file, print the version number @@ -101,6 +101,7 @@ \hyphenation{ap-pen-dix} \hyphenation{mini-buf-fer mini-buf-fers} \hyphenation{eshell} +\hyphenation{white-space} % Margin to add to right of even pages, to left of odd pages. \newdimen \bindingoffset @@ -185,7 +186,13 @@ % \unvbox\headlinebox \pagebody{#1}% - \unvbox\footlinebox + \ifdim\ht\footlinebox > 0pt + % Only leave this space if the footline is nonempty. + % (We lessened \vsize for it in \oddfootingxxx.) + % The \baselineskip=24pt in plain's \makefootline has no effect. + \vskip 2\baselineskip + \unvbox\footlinebox + \fi % \ifcropmarks \egroup % end of \vbox\bgroup @@ -729,10 +736,11 @@ where each line of input produces a line of output.} % \def\ignore{\doignore{ignore}} -% Also ignore @ifinfo, @ifhtml, @html, @menu, and @direntry text. +% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text. % \def\ifinfo{\doignore{ifinfo}} \def\ifhtml{\doignore{ifhtml}} +\def\ifnottex{\doignore{ifnottex}} \def\html{\doignore{html}} \def\menu{\doignore{menu}} \def\direntry{\doignore{direntry}} @@ -759,6 +767,10 @@ where each line of input produces a line of output.} % Make sure that spaces turn into tokens that match what \doignoretext wants. \catcode32 = 10 % + % Ignore braces, too, so mismatched braces don't cause trouble. + \catcode`\{ = 9 + \catcode`\} = 9 + % % And now expand that command. \doignoretext } @@ -850,7 +862,7 @@ where each line of input produces a line of output.} \pretolerance = 10000 % % Do not execute instructions in @tex - \def\tex{\doignore{tex}} + \def\tex{\doignore{tex}}% } % @set VAR sets the variable VAR to an empty value. @@ -926,11 +938,16 @@ where each line of input produces a line of output.} \def\ifclearfail{\nestedignore{ifclear}} \defineunmatchedend{ifclear} -% @iftex always succeeds; we read the text following, through @end -% iftex). But `@end iftex' should be valid only after an @iftex. +% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text +% following, through the first @end iftex (etc.). Make `@end iftex' +% (etc.) valid only after an @iftex. % \def\iftex{\conditionalsucceed{iftex}} +\def\ifnothtml{\conditionalsucceed{ifnothtml}} +\def\ifnotinfo{\conditionalsucceed{ifnotinfo}} \defineunmatchedend{iftex} +\defineunmatchedend{ifnothtml} +\defineunmatchedend{ifnotinfo} % We can't just want to start a group at @iftex (for example) and end it % at @end iftex, since then @set commands inside the conditional have no @@ -1006,6 +1023,15 @@ where each line of input produces a line of output.} \openindices \fixbackslash % Turn off hack to swallow `\input texinfo'. \global\let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + % Just to be on the safe side, close the input stream before the \input. + \openin 1 texinfo.cnf + \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi + \closein1 + \temp + % \comment % Ignore the actual filename. } @@ -1041,8 +1067,9 @@ where each line of input produces a line of output.} % We don't need math for this one. \def\ttsl{\tenttsl} -%% Try out Computer Modern fonts at \magstephalf -\let\mainmagstep=\magstephalf +% Use Computer Modern fonts at \magstephalf (11pt). +\newcount\mainmagstep +\mainmagstep=\magstephalf % Set the font macro #1 to the font named #2, adding on the % specified font prefix (normally `cm'). @@ -1114,13 +1141,26 @@ where each line of input produces a line of output.} \font\indi=cmmi9 \font\indsy=cmsy9 +% Fonts for title page: +\setfont\titlerm\rmbshape{12}{\magstep3} +\setfont\titleit\itbshape{10}{\magstep4} +\setfont\titlesl\slbshape{10}{\magstep4} +\setfont\titlett\ttbshape{12}{\magstep3} +\setfont\titlettsl\ttslshape{10}{\magstep4} +\setfont\titlesf\sfbshape{17}{\magstep1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\authorrm{\secrm} + % Chapter (and unnumbered) fonts (17.28pt). \setfont\chaprm\rmbshape{12}{\magstep2} \setfont\chapit\itbshape{10}{\magstep3} \setfont\chapsl\slbshape{10}{\magstep3} \setfont\chaptt\ttbshape{12}{\magstep2} \setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{12}{\magstep2} +\setfont\chapsf\sfbshape{17}{1000} \let\chapbf=\chaprm \setfont\chapsc\scbshape{10}{\magstep3} \font\chapi=cmmi12 scaled \magstep2 @@ -1157,19 +1197,15 @@ where each line of input produces a line of output.} \setfont\ssecit\itbshape{10}{1315} \setfont\ssecsl\slbshape{10}{1315} \setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{\magstep1} +\setfont\ssecttsl\ttslshape{10}{1315} \setfont\ssecsf\sfbshape{12}{\magstephalf} \let\ssecbf\ssecrm \setfont\ssecsc\scbshape{10}{\magstep1} \font\sseci=cmmi12 scaled \magstephalf -\font\ssecsy=cmsy10 scaled \magstep1 +\font\ssecsy=cmsy10 scaled 1315 % The smallcaps and symbol fonts should actually be scaled \magstep1.5, % but that is not a standard magnification. -% Fonts for title page: -\setfont\titlerm\rmbshape{12}{\magstep3} -\let\authorrm = \secrm - % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since % texinfo doesn't allow for producing subscripts and superscripts, we @@ -1194,6 +1230,13 @@ where each line of input produces a line of output.} \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl \resetmathfonts} +\def\titlefonts{% + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy + \let\tenttsl=\titlettsl + \resetmathfonts \setleading{25pt}} +\def\titlefont#1{{\titlefonts #1}} \def\chapfonts{% \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc @@ -1330,18 +1373,56 @@ where each line of input produces a line of output.} % @kbd is like @code, except that if the argument is just one @key command, % then @kbd has no effect. -% + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\def\kbdinputstyle{\parsearg\kbdinputstylexxx} +\def\kbdinputstylexxx#1{% + \def\arg{#1}% + \ifx\arg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\arg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\arg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is kbdinputdistinct. (Too much of a hassle to call the macro, +% the catcodes are wrong for parsearg to work.) +\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} + \def\xkey{\key} \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% \ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\ttsl\look}}\fi -\else{\tclose{\ttsl\look}}\fi} +\else{\tclose{\kbdfont\look}}\fi +\else{\tclose{\kbdfont\look}}\fi} + +% @url. Quotes do not seem necessary, so use \code. +\let\url=\code + +% @uref (abbreviation for `urlref') takes an optional second argument +% specifying the text to display. First (mandatory) arg is the url. +% Perhaps eventually put in a hypertex \special here. +% +\def\uref#1{\urefxxx #1,,\finish} +\def\urefxxx#1,#2,#3\finish{% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \unhbox0\ (\code{#1})% + \else + \code{#1}% + \fi +} -% @url, @email. Quotes do not seem necessary. -\let\url=\code % perhaps include a hypertex \special eventually % rms does not like the angle brackets --karl, 17may97. +% So now @email is just like @uref. %\def\email#1{$\langle${\tt #1}$\rangle$} -\let\email=\code +\let\email=\uref % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and @@ -1378,8 +1459,6 @@ where each line of input produces a line of output.} \newskip\titlepagebottomglue \titlepagebottomglue = 2pc % First the title page. Must do @settitle before @titlepage. -\def\titlefont#1{{\titlerm #1}} - \newif\ifseenauthor \newif\iffinishedtitlepage @@ -1401,7 +1480,7 @@ where each line of input produces a line of output.} % % Now you can print the title using @title. \def\title{\parsearg\titlezzz}% - \def\titlezzz##1{\leftline{\titlefont{##1}} + \def\titlezzz##1{\leftline{\titlefonts\rm ##1} % print a rule at the page bottom also. \finishedtitlepagefalse \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% @@ -1490,10 +1569,7 @@ where each line of input produces a line of output.} \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} -\gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish} -\gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{% -\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}} -\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} +\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% @@ -1501,12 +1577,15 @@ where each line of input produces a line of output.} \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% -\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% + % + % Leave some space for the footline. Hopefully ok to assume + % @evenfooting will not be used by itself. + \global\advance\pageheight by -\baselineskip + \global\advance\vsize by -\baselineskip +} -\gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish} -\gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{% -\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}} -\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} +\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} % }% unbind the catcode of @. @@ -2230,7 +2309,13 @@ width0pt\relax} \fi %\def\char{\realbackslash char}% \def\TeX{\realbackslash TeX}% \def\dots{\realbackslash dots }% -\def\copyright{\realbackslash copyright }% +\def\result{\realbackslash result}% +\def\equiv{\realbackslash equiv}% +\def\expansion{\realbackslash expansion}% +\def\print{\realbackslash print}% +\def\error{\realbackslash error}% +\def\point{\realbackslash point}% +\def\copyright{\realbackslash copyright}% \def\tclose##1{\realbackslash tclose {##1}}% \def\code##1{\realbackslash code {##1}}% \def\dotless##1{\realbackslash dotless {##1}}% @@ -2248,6 +2333,7 @@ width0pt\relax} \fi \def\kbd##1{\realbackslash kbd {##1}}% \def\dfn##1{\realbackslash dfn {##1}}% \def\emph##1{\realbackslash emph {##1}}% +\def\value##1{\realbackslash value {##1}}% \unsepspaces } @@ -2682,6 +2768,12 @@ width0pt\relax} \fi \def\print{\realbackslash print}% \def\TeX{\realbackslash TeX}% \def\dots{\realbackslash dots}% + \def\result{\realbackslash result}% + \def\equiv{\realbackslash equiv}% + \def\expansion{\realbackslash expansion}% + \def\print{\realbackslash print}% + \def\error{\realbackslash error}% + \def\point{\realbackslash point}% \def\copyright{\realbackslash copyright}% \def\tt{\realbackslash tt}% \def\bf{\realbackslash bf}% @@ -3208,7 +3300,9 @@ width0pt\relax} \fi \unnumbchapmacro{#1}\def\thischapter{}% \begingroup % Set up to handle contents files properly. \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 - \catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi + % We can't do this, because then an actual ^ in a section + % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. + %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi \raggedbottom % Worry more about breakpoints than the bottom. \advance\hsize by -\contentsrightmargin % Don't use the full line length. } @@ -3563,11 +3657,12 @@ width0pt\relax} \fi % \def\nonfillfinish{\afterenvbreak\endgroup}% -% This macro is \def\lisp{\begingroup \nonfillstart \let\Elisp = \nonfillfinish \tt + % Make @kbd do something special, if requested. + \let\kbdfont\kbdexamplefont \rawbackslash % have \ input char produce \ char from current font \gobble } @@ -4303,29 +4398,27 @@ width0pt\relax} \fi % Read the last existing aux file, if any. No error if none exists. \def\readauxfile{\begingroup \catcode`\^^@=\other - \catcode`\=\other - \catcode`\=\other + \catcode`\^^A=\other + \catcode`\^^B=\other \catcode`\^^C=\other \catcode`\^^D=\other \catcode`\^^E=\other \catcode`\^^F=\other \catcode`\^^G=\other \catcode`\^^H=\other - \catcode`\=\other + \catcode`\^^K=\other \catcode`\^^L=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode26=\other + \catcode`\^^N=\other + \catcode`\^^P=\other + \catcode`\^^Q=\other + \catcode`\^^R=\other + \catcode`\^^S=\other + \catcode`\^^T=\other + \catcode`\^^U=\other + \catcode`\^^V=\other + \catcode`\^^W=\other + \catcode`\^^X=\other + \catcode`\^^Z=\other \catcode`\^^[=\other \catcode`\^^\=\other \catcode`\^^]=\other @@ -4403,7 +4496,7 @@ width0pt\relax} \fi % space to prevent strange expansion errors.) \def\supereject{\par\penalty -20000\footnoteno =0 } -% @footnotestyle is meaningful for info output only.. +% @footnotestyle is meaningful for info output only. \let\footnotestyle=\comment \let\ptexfootnote=\footnote @@ -4518,9 +4611,51 @@ width0pt\relax} \fi % \def\finalout{\overfullrule=0pt} +% @image. We use the macros from epsf.tex to support this. +% If epsf.tex is not installed and @image is used, we complain. +% +% Check for and read epsf.tex up front. If we read it only at @image +% time, we might be inside a group, and then its definitions would get +% undone and the next image would fail. +\openin 1 = xepsf.tex +\ifeof 1 \else + \closein 1 + \def\epsfannounce{\toks0 = }% do not bother showing banner + \input epsf.tex +\fi +% +\newif\ifwarnednoepsf +\newhelp\noepsfhelp{epsf.tex must be installed for images to + work. It is also included in the Texinfo distribution, or you can get + it from ftp://ftp.tug.org/tex/epsf.tex.} +% +% Only complain once about lack of epsf.tex. +\def\image#1{% + \ifx\epsfbox\undefined + \ifwarnednoepsf \else + \errhelp = \noepsfhelp + \errmessage{epsf.tex not found, images will be ignored}% + \global\warnednoepsftrue + \fi + \else + \imagexxx #1,,,\finish + \fi +} +% +% Arguments to @image: +% #1 is (mandatory) image filename; we tack on .eps extension. +% #2 is (optional) width, #3 is (optional) height. +% #4 is just the usual extra ignored arg for parsing this stuff. +\def\imagexxx#1,#2,#3,#4\finish{% + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \epsfbox{#1.eps}% +} % End of control word definitions. + \message{and turning on texinfo input format.} \def\openindices{% diff --git a/texinfo/util/Makefile.in b/texinfo/util/Makefile.in index 9108632..a848e61 100644 --- a/texinfo/util/Makefile.in +++ b/texinfo/util/Makefile.in @@ -1,105 +1,323 @@ -# Makefile for GNU Texindex and other utilities. -# $Id: Makefile.in,v 1.1 1997/08/21 22:58:12 jason Exp $ -# -# Copyright (C) 1990, 91, 92, 96 Free Software Foundation, Inc. +# Makefile.in generated automatically by automake 1.2 from Makefile.am -# 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. +# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. -# 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. +SHELL = /bin/sh -# 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. +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ -#### Start of system configuration section. #### +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include -srcdir = @srcdir@ -VPATH = $(srcdir):$(common) +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ -common = $(srcdir)/../libtxi +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ -EXEEXT = @EXEEXT@ -CC = @CC@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ -LN = ln -RM = rm -f -MKDIR = mkdir +NORMAL_INSTALL = true +PRE_INSTALL = true +POST_INSTALL = true +NORMAL_UNINSTALL = true +PRE_UNINSTALL = true +POST_UNINSTALL = true +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +TERMLIBS = @TERMLIBS@ +TEXCONFIG = @TEXCONFIG@ +TEXMF = @TEXMF@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +l = @l@ -DEFS = @DEFS@ -LIBS = -L../libtxi -ltxi @LIBS@ -LOADLIBES = $(LIBS) +bin_PROGRAMS = texindex +bin_SCRIPTS = texi2dvi -SHELL = /bin/sh +noinst_PROGRAMS = install-inf +install_inf_SOURCES = install-info.c -CFLAGS = @CFLAGS@ +localedir = $(datadir)/locale +INCLUDES = -I$(top_srcdir)/lib -I../intl -DLOCALEDIR=\"$(localedir)\" +LDADD = ../lib/libtxi.a @INTLLIBS@ + +EXTRA_DIST = README deref.c fixfonts gen-dir-node tex3patch texi2dvi \ + update-info +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = texindex$(EXEEXT) +noinst_PROGRAMS = install-inf$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +texindex_SOURCES = texindex.c +texindex_OBJECTS = texindex.o +texindex_LDADD = $(LDADD) +texindex_DEPENDENCIES = ../lib/libtxi.a +texindex_LDFLAGS = +install_inf_OBJECTS = install-info.o +install_inf_LDADD = $(LDADD) +install_inf_DEPENDENCIES = ../lib/libtxi.a +install_inf_LDFLAGS = +SCRIPTS = $(bin_SCRIPTS) -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -# Prefix for each installed program, normally empty or `g'. -binprefix = -# Prefix for each installed man page, normally empty or `g'. -manprefix = -mandir = @mandir@/man1 -manext = 1 -infodir = @infodir@ +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = README Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP = --best +SOURCES = texindex.c $(install_inf_SOURCES) +OBJECTS = texindex.o $(install_inf_OBJECTS) + +default: all + +.SUFFIXES: +.SUFFIXES: .c .o +$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus util/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-binPROGRAMS: -#### End of system configuration section. #### +clean-binPROGRAMS: + test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -all: texindex$(EXEEXT) install-info$(EXEEXT) -sub-all: all +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`"; \ + $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + $(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \ + done + +mostlyclean-noinstPROGRAMS: + +clean-noinstPROGRAMS: + test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) + +distclean-noinstPROGRAMS: + +maintainer-clean-noinstPROGRAMS: .c.o: - $(CC) -c $(CPPFLAGS) $(DEFS) -I. -I$(srcdir) -I$(common) $(CFLAGS) $< + $(COMPILE) -c $< +mostlyclean-compile: + rm -f *.o core -install: all - $(INSTALL_PROGRAM) texindex$(EXEEXT) $(bindir)/texindex$(EXEEXT) - $(INSTALL_PROGRAM) $(srcdir)/texi2dvi $(bindir)/texi2dvi - $(INSTALL_PROGRAM) install-info$(EXEEXT) $(bindir)/install-info$(EXEEXT) +clean-compile: -install-info: +distclean-compile: + rm -f *.tab.c + +maintainer-clean-compile: + +texindex$(EXEEXT): $(texindex_OBJECTS) $(texindex_DEPENDENCIES) + @rm -f texindex$(EXEEXT) + $(LINK) $(texindex_LDFLAGS) $(texindex_OBJECTS) $(texindex_LDADD) $(LIBS) + +install-inf$(EXEEXT): $(install_inf_OBJECTS) $(install_inf_DEPENDENCIES) + @rm -f install-inf$(EXEEXT) + $(LINK) $(install_inf_LDFLAGS) $(install_inf_OBJECTS) $(install_inf_LDADD) $(LIBS) + +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(bindir) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_SCRIPT) $$p $(bindir)/`echo $$p|sed '$(transform)'`$(EXEEXT)"; \ + $(INSTALL_SCRIPT) $$p $(bindir)/`echo $$p|sed '$(transform)'`$(EXEEXT); \ + else if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(bindir)/`echo $$p|sed '$(transform)'`$(EXEEXT)"; \ + $(INSTALL_SCRIPT) $(srcdir)/$$p $(bindir)/`echo $$p|sed '$(transform)'`$(EXEEXT); \ + else :; fi; fi; \ + done + +uninstall-binSCRIPTS: + $(NORMAL_UNINSTALL) + list='$(bin_SCRIPTS)'; for p in $$list; do \ + rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) + here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) + tags=; \ + here=`pwd`; \ + test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = util + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done +info: dvi: +check: all + $(MAKE) +installcheck: +install-info: +install-exec: install-binPROGRAMS install-binSCRIPTS install-exec-local + @$(NORMAL_INSTALL) + +install-data: + @$(NORMAL_INSTALL) + +install: install-exec install-data all + @: + +uninstall: uninstall-binPROGRAMS uninstall-binSCRIPTS + +all: Makefile $(PROGRAMS) $(SCRIPTS) + +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install +installdirs: + $(mkinstalldirs) $(bindir) $(bindir) -uninstall: - rm -f $(bindir)/texindex$(EXEEXT) $(bindir)/texi2dvi $(bindir)/install-info$(EXEEXT) -Makefile: Makefile.in ../config.status - cd ..; $(SHELL) config.status +mostlyclean-generic: + test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) -TAGS: - etags *.c *.h $(common)/getopt*.c $(common)/getopt.h +clean-generic: + test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) -clean: - rm -f *.o a.out core core.* texindex install-info +distclean-generic: + rm -f Makefile $(DISTCLEANFILES) + rm -f config.cache config.log stamp-h stamp-h[0-9]* + test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -mostlyclean: clean +maintainer-clean-generic: + test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \ + mostlyclean-compile mostlyclean-tags \ + mostlyclean-generic -distclean: clean - rm -f Makefile config.status +clean: clean-binPROGRAMS clean-noinstPROGRAMS clean-compile clean-tags \ + clean-generic mostlyclean -realclean: distclean - rm -f TAGS +distclean: distclean-binPROGRAMS distclean-noinstPROGRAMS \ + distclean-compile distclean-tags distclean-generic \ + clean + rm -f config.status -texindex: texindex.o ../libtxi/libtxi.a - $(CC) $(LDFLAGS) -o texindex texindex.o $(LOADLIBES) +maintainer-clean: maintainer-clean-binPROGRAMS \ + maintainer-clean-noinstPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-generic distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." -texindex.o: texindex.c $(common)/getopt.h +.PHONY: default mostlyclean-binPROGRAMS distclean-binPROGRAMS \ +clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \ +install-binPROGRAMS mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ +clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile uninstall-binSCRIPTS install-binSCRIPTS tags \ +mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \ +distdir info dvi installcheck install-info install-exec install-data \ +install uninstall all installdirs mostlyclean-generic distclean-generic \ +clean-generic maintainer-clean-generic clean mostlyclean distclean \ +maintainer-clean -install-info: install-info.o - $(CC) $(LDFLAGS) -o install-info install-info.o $(LOADLIBES) -install-info.o: install-info.c $(common)/getopt.h +install-exec-local: $(noinst_PROGRAMS) + $(mkinstalldirs) $(bindir) + $(INSTALL_PROGRAM) install-inf$(EXEEXT) $(bindir)/`echo install-info$(EXEEXT)|sed '$(transform)'`; \ -# Prevent GNU make v3 from overflowing arg limit on SysV. +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/texinfo/util/gen-dir-node b/texinfo/util/gen-dir-node index ed82504..c7ef670 100755 --- a/texinfo/util/gen-dir-node +++ b/texinfo/util/gen-dir-node @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: gen-dir-node,v 1.1 1997/08/21 22:58:12 jason Exp $ +# $Id: gen-dir-node,v 1.1 1997/05/22 22:02:43 karl Exp $ # Generate the top-level Info node, given a directory of Info files # and (optionally) a skeleton file. The output will be suitable for a # top-level dir file. The skeleton file contains info topic names in the @@ -164,9 +164,14 @@ else fi for file in ${infofiles}; do + case $file in + *.gz) zcat=zcat; file=`echo $file|sed 's/\.gz$//'`; gz=.gz;; + *) zcat=cat; gz=;; + esac infoname=`echo $file | sed 's/\.info$//'` - entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \ - -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/${file}` + entry=`$zcat ${INFODIR}/${file}$gz \ + |sed -e '1,/START-INFO-DIR-ENTRY/d' \ + -e '/END-INFO-DIR-ENTRY/,$d'` if [ ! -z "${entry}" ] ; then echo "${entry}" diff --git a/texinfo/util/texi2dvi b/texinfo/util/texi2dvi index d9f1b3e..67a9512 100755 --- a/texinfo/util/texi2dvi +++ b/texinfo/util/texi2dvi @@ -3,7 +3,7 @@ # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# $Id: texi2dvi,v 1.1 1997/08/21 22:58:13 jason Exp $ +# $Id: texi2dvi,v 0.6 1997/07/14 19:23:18 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 @@ -47,7 +47,7 @@ progname=`echo "$0" | sed -e 's/[^\/]*\///g'` # This string is expanded by rcs automatically when this file is checked out. -rcs_revision='$Revision: 1.1 $' +rcs_revision='$Revision: 0.6 $' version=`set - $rcs_revision; echo $2` # To prevent hairy quoting and escaping later. @@ -329,39 +329,6 @@ done $verbose "$0 done." true # exit successfully. - -# texi2dvi ends here -# $Log: texi2dvi,v $ -# Revision 1.1 1997/08/21 22:58:13 jason -# Initial revision -# -# Revision 1.10 1996/10/04 18:21:55 karl -# Include only the current year in the copyright message. -# -# Revision 1.9 1996/10/04 11:49:48 karl -# Exit successfully. From arnold. -# -# Revision 1.8 1996/10/03 23:14:26 karl -# Only show diff if verbose. -# Update version number. -# -# Revision 1.7 1996/09/29 22:56:08 karl -# Use $progname instead of $0 for --version. -# -# Revision 1.6 1996/09/28 21:01:23 karl -# Recompute original index files each time through loop. -# Make indentation uniform. -# Use same basename for the temp input files. -# Standardize --version output. -# -# Revision 1.5 1996/09/26 14:46:34 karl -# (texi2dvi): Run TeX until the aux/index files stabilize, instead of just -# twice. From: David Shaw <daves@gsms01.alcatel.com.au>. -# -# Revision 1.4 1996/08/27 18:59:26 karl -# Include bug reporting address. -# -# Revision 1.3 1996/07/26 18:20:56 karl # Do macro expansion with makeinfo before running TeX. # Various expansion safety measures added for test; avoid use of -o. # diff --git a/texinfo/util/texindex.c b/texinfo/util/texindex.c index 306aa1f..2b3bd20 100644 --- a/texinfo/util/texindex.c +++ b/texinfo/util/texindex.c @@ -1,7 +1,7 @@ /* Prepare TeX index dribble output into an actual index. - $Id: texindex.c,v 1.1 1997/08/21 22:58:13 jason Exp $ + $Id: texindex.c,v 1.17 1997/07/24 23:34:45 karl Exp $ - Copyright (C) 1987, 91, 92, 96 Free Software Foundation, Inc. + Copyright (C) 1987, 91, 92, 96, 97 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 @@ -17,12 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307. */ -#include <stdio.h> -#include <ctype.h> -#include <errno.h> -#include "getopt.h" - -#define TEXINDEX_VERSION_STRING "GNU Texindex (Texinfo 3.9) 2.1" +#include "system.h" +#include <getopt.h> #if defined (emacs) # include "../src/config.h" @@ -33,26 +29,6 @@ # undef open #endif -#if defined (HAVE_STRING_H) -# include <string.h> -#endif /* HAVE_STRING_H */ - -#if !defined (HAVE_STRCHR) -char *strrchr (); -#endif /* !HAVE_STRCHR */ - -#if defined (STDC_HEADERS) -# include <stdlib.h> -#else /* !STDC_HEADERS */ -char *getenv (), *malloc (), *realloc (); -#endif /* !STDC_HEADERS */ - -#if defined (HAVE_UNISTD_H) -# include <unistd.h> -#else /* !HAVE_UNISTD_H */ -off_t lseek (); -#endif /* !HAVE_UNISTD_H */ - #if !defined (HAVE_MEMSET) #undef memset #define memset(ptr, ignore, count) bzero (ptr, count) @@ -89,38 +65,31 @@ char *mktemp (); # define SEEK_END 2 #endif /* !SEEK_SET */ -#ifndef errno -extern int errno; -#endif -#ifndef strerror -extern char *strerror (); -#endif - /* When sorting in core, this structure describes one line and the position and length of its first keyfield. */ struct lineinfo { - char *text; /* The actual text of the line. */ + char *text; /* The actual text of the line. */ union { - char *text; /* The start of the key (for textual comparison). */ - long number; /* The numeric value (for numeric comparison). */ + char *text; /* The start of the key (for textual comparison). */ + long number; /* The numeric value (for numeric comparison). */ } key; - long keylen; /* Length of KEY field. */ + long keylen; /* Length of KEY field. */ }; /* This structure describes a field to use as a sort key. */ struct keyfield { - int startwords; /* Number of words to skip. */ - int startchars; /* Number of additional chars to skip. */ - int endwords; /* Number of words to ignore at end. */ - int endchars; /* Ditto for characters of last word. */ - char ignore_blanks; /* Non-zero means ignore spaces and tabs. */ - char fold_case; /* Non-zero means case doesn't matter. */ - char reverse; /* Non-zero means compare in reverse order. */ - char numeric; /* Non-zeros means field is ASCII numeric. */ - char positional; /* Sort according to file position. */ - char braced; /* Count balanced-braced groupings as fields. */ + int startwords; /* Number of words to skip. */ + int startchars; /* Number of additional chars to skip. */ + int endwords; /* Number of words to ignore at end. */ + int endchars; /* Ditto for characters of last word. */ + char ignore_blanks; /* Non-zero means ignore spaces and tabs. */ + char fold_case; /* Non-zero means case doesn't matter. */ + char reverse; /* Non-zero means compare in reverse order. */ + char numeric; /* Non-zeros means field is ASCII numeric. */ + char positional; /* Sort according to file position. */ + char braced; /* Count balanced-braced groupings as fields. */ }; /* Vector of keyfields to use. */ @@ -214,6 +183,15 @@ main (argc, argv) else program_name = argv[0]; +#ifdef HAVE_SETLOCALE + /* Set locale via LC_ALL. */ + setlocale (LC_ALL, ""); +#endif + + /* Set the text message domain. */ + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + /* Describe the kind of sorting to do. */ /* The first keyfield uses the first braced field and folds case. */ keyfields[0].braced = 1; @@ -247,7 +225,7 @@ main (argc, argv) desc = open (infiles[i], O_RDONLY, 0); if (desc < 0) - pfatal_with_name (infiles[i]); + pfatal_with_name (infiles[i]); lseek (desc, (off_t) 0, SEEK_END); ptr = (long) lseek (desc, (off_t) 0, SEEK_CUR); @@ -255,15 +233,15 @@ main (argc, argv) outfile = outfiles[i]; if (!outfile) - { - outfile = concat (infiles[i], "s", ""); - } + { + outfile = concat (infiles[i], "s", ""); + } if (ptr < MAX_IN_CORE_SORT) - /* Sort a small amount of data. */ - sort_in_core (infiles[i], ptr, outfile); + /* Sort a small amount of data. */ + sort_in_core (infiles[i], ptr, outfile); else - sort_offline (infiles[i], ptr, outfile); + sort_offline (infiles[i], ptr, outfile); } flush_tempfiles (tempcount); @@ -282,15 +260,15 @@ typedef struct TEXINDEX_OPTION texindex_options[] = { { "--keep", "-k", &keep_tempfiles, 1, (char *)NULL, - "keep temporary files around after processing" }, + N_("keep temporary files around after processing") }, { "--no-keep", 0, &keep_tempfiles, 0, (char *)NULL, - "do not keep temporary files around after processing (default)" }, + N_("do not keep temporary files around after processing (default)") }, { "--output", "-o", (int *)NULL, 0, "FILE", - "send output to FILE" }, + N_("send output to FILE") }, { "--version", (char *)NULL, (int *)NULL, 0, (char *)NULL, - "display version information and exit" }, + N_("display version information and exit") }, { "--help", "-h", (int *)NULL, 0, (char *)NULL, - "display this help and exit" }, + N_("display this help and exit") }, { (char *)NULL, (char *)NULL, (int *)NULL, 0, (char *)NULL } }; @@ -301,25 +279,25 @@ usage (result_value) register int i; FILE *f = result_value ? stderr : stdout; - fprintf (f, "Usage: %s [OPTION]... FILE...\n", program_name); - fprintf (f, "Generate a sorted index for each TeX output FILE.\n"); + fprintf (f, _("Usage: %s [OPTION]... FILE...\n"), program_name); + fprintf (f, _("Generate a sorted index for each TeX output FILE.\n")); /* Avoid trigraph nonsense. */ - fprintf (f, "Usually FILE... is `foo.??\' for a document `foo.texi'.\n"); - fprintf (f, "\nOptions:\n"); + fprintf (f, _("Usually FILE... is `foo.??\' for a document `foo.texi'.\n")); + fprintf (f, _("\nOptions:\n")); for (i = 0; texindex_options[i].long_name; i++) { if (texindex_options[i].short_name) - fprintf (f, "%s, ", texindex_options[i].short_name); + fprintf (f, "%s, ", texindex_options[i].short_name); fprintf (f, "%s %s", - texindex_options[i].long_name, - texindex_options[i].arg_name + texindex_options[i].long_name, + texindex_options[i].arg_name ? texindex_options[i].arg_name : ""); - fprintf (f, "\t%s\n", texindex_options[i].doc_string); + fprintf (f, "\t%s\n", _(texindex_options[i].doc_string)); } - puts ("\nEmail bug reports to bug-texinfo@prep.ai.mit.edu."); + puts (_("\nEmail bug reports to bug-texinfo@prep.ai.mit.edu.")); exit (result_value); } @@ -333,7 +311,6 @@ decode_command (argc, argv) char **argv; { int arg_index = 1; - int optc; char **ip; char **op; @@ -364,46 +341,46 @@ decode_command (argc, argv) char *arg = argv[arg_index++]; if (*arg == '-') - { - if (strcmp (arg, "--version") == 0) - { - puts (TEXINDEX_VERSION_STRING); -puts ("Copyright (C) 1996 Free Software Foundation, Inc.\n\ + { + if (strcmp (arg, "--version") == 0) + { + printf (_("texindex (GNU %s %s) 2.1\n"), PACKAGE, VERSION); +puts (_("Copyright (C) 1996 Free Software Foundation, Inc.\n\ There is NO warranty. You may redistribute this software\n\ under the terms of the GNU General Public License.\n\ -For more information about these matters, see the files named COPYING."); - exit (0); - } - else if ((strcmp (arg, "--keep") == 0) || - (strcmp (arg, "-k") == 0)) - { - keep_tempfiles = 1; - } - else if ((strcmp (arg, "--help") == 0) || - (strcmp (arg, "-h") == 0)) - { - usage (0); - } - else if ((strcmp (arg, "--output") == 0) || - (strcmp (arg, "-o") == 0)) - { - if (argv[arg_index] != (char *)NULL) - { - arg_index++; - if (op > outfiles) - *(op - 1) = argv[arg_index]; - } - else - usage (1); - } - else - usage (1); - } +For more information about these matters, see the files named COPYING.")); + exit (0); + } + else if ((strcmp (arg, "--keep") == 0) || + (strcmp (arg, "-k") == 0)) + { + keep_tempfiles = 1; + } + else if ((strcmp (arg, "--help") == 0) || + (strcmp (arg, "-h") == 0)) + { + usage (0); + } + else if ((strcmp (arg, "--output") == 0) || + (strcmp (arg, "-o") == 0)) + { + if (argv[arg_index] != (char *)NULL) + { + arg_index++; + if (op > outfiles) + *(op - 1) = argv[arg_index]; + } + else + usage (1); + } + else + usage (1); + } else - { - *ip++ = arg; - *op++ = (char *)NULL; - } + { + *ip++ = arg; + *op++ = (char *)NULL; + } } /* Record number of keyfields and terminate list of filenames. */ @@ -459,7 +436,7 @@ tempcopy (idesc) int nread = read (idesc, buffer, BUFSIZE); write (odesc, buffer, nread); if (!nread) - break; + break; } close (odesc); @@ -485,16 +462,16 @@ compare_full (line1, line2) char *start1 = find_field (&keyfields[i], *line1, &length1); char *start2 = find_field (&keyfields[i], *line2, &length2); int tem = compare_field (&keyfields[i], start1, length1, *line1 - text_base, - start2, length2, *line2 - text_base); + start2, length2, *line2 - text_base); if (tem) - { - if (keyfields[i].reverse) - return -tem; - return tem; - } + { + if (keyfields[i].reverse) + return -tem; + return tem; + } } - return 0; /* Lines match exactly. */ + return 0; /* Lines match exactly. */ } /* Compare LINE1 and LINE2, described by structures @@ -514,19 +491,19 @@ compare_prepared (line1, line2) if (keyfields->positional) { if (line1->text - text_base > line2->text - text_base) - tem = 1; + tem = 1; else - tem = -1; + tem = -1; } else if (keyfields->numeric) tem = line1->key.number - line2->key.number; else tem = compare_field (keyfields, line1->key.text, line1->keylen, 0, - line2->key.text, line2->keylen, 0); + line2->key.text, line2->keylen, 0); if (tem) { if (keyfields->reverse) - return -tem; + return -tem; return tem; } @@ -543,16 +520,16 @@ compare_prepared (line1, line2) char *start1 = find_field (&keyfields[i], text1, &length1); char *start2 = find_field (&keyfields[i], text2, &length2); int tem = compare_field (&keyfields[i], start1, length1, text1 - text_base, - start2, length2, text2 - text_base); + start2, length2, text2 - text_base); if (tem) - { - if (keyfields[i].reverse) - return -tem; - return tem; - } + { + if (keyfields[i].reverse) + return -tem; + return tem; + } } - return 0; /* Lines match exactly. */ + return 0; /* Lines match exactly. */ } /* Like compare_full but more general. @@ -578,16 +555,16 @@ compare_general (str1, str2, pos1, pos2, use_keyfields) char *start1 = find_field (&keyfields[i], str1, &length1); char *start2 = find_field (&keyfields[i], str2, &length2); int tem = compare_field (&keyfields[i], start1, length1, pos1, - start2, length2, pos2); + start2, length2, pos2); if (tem) - { - if (keyfields[i].reverse) - return -tem; - return tem; - } + { + if (keyfields[i].reverse) + return -tem; + return tem; + } } - return 0; /* Lines match exactly. */ + return 0; /* Lines match exactly. */ } /* Find the start and length of a field in STR according to KEYFIELD. @@ -610,23 +587,23 @@ find_field (keyfield, str, lengthptr) fun = find_pos; start = (*fun) (str, keyfield->startwords, keyfield->startchars, - keyfield->ignore_blanks); + keyfield->ignore_blanks); if (keyfield->endwords < 0) { if (keyfield->braced) - end = find_braced_end (start); + end = find_braced_end (start); else - { - end = start; - while (*end && *end != '\n') - end++; - } + { + end = start; + while (*end && *end != '\n') + end++; + } } else { end = (*fun) (str, keyfield->endwords, keyfield->endchars, 0); if (end - str < start - str) - end = start; + end = start; } *lengthptr = end - start; return start; @@ -651,11 +628,11 @@ find_pos (str, words, chars, ignore_blanks) char c; /* Find next bunch of nonblanks and skip them. */ while ((c = *p) == ' ' || c == '\t') - p++; + p++; while ((c = *p) && c != '\n' && !(c == ' ' || c == '\t')) - p++; + p++; if (!*p || *p == '\n') - return p; + return p; } while (*p == ' ' || *p == '\t') @@ -664,7 +641,7 @@ find_pos (str, words, chars, ignore_blanks) for (i = 0; i < chars; i++) { if (!*p || *p == '\n') - break; + break; p++; } return p; @@ -688,19 +665,19 @@ find_braced_pos (str, words, chars, ignore_blanks) { bracelevel = 1; while ((c = *p++) != '{' && c != '\n' && c) - /* Do nothing. */ ; + /* Do nothing. */ ; if (c != '{') - return p - 1; + return p - 1; while (bracelevel) - { - c = *p++; - if (c == '{') - bracelevel++; - if (c == '}') - bracelevel--; - if (c == 0 || c == '\n') - return p - 1; - } + { + c = *p++; + if (c == '{') + bracelevel++; + if (c == '}') + bracelevel--; + if (c == 0 || c == '\n') + return p - 1; + } } while ((c = *p++) != '{' && c != '\n' && c) @@ -716,7 +693,7 @@ find_braced_pos (str, words, chars, ignore_blanks) for (i = 0; i < chars; i++) { if (!*p || *p == '\n') - break; + break; p++; } return p; @@ -738,11 +715,11 @@ find_braced_end (str) { c = *p++; if (c == '{') - bracelevel++; + bracelevel++; if (c == '}') - bracelevel--; + bracelevel--; if (c == 0 || c == '\n') - return p - 1; + return p - 1; } return p - 1; } @@ -755,7 +732,7 @@ find_value (start, length) while (length != 0L) { if (isdigit (*start)) - return atol (start); + return atol (start); length--; start++; } @@ -801,17 +778,17 @@ compare_field (keyfield, start1, length1, pos1, start2, length2, pos2) if (keyfields->positional) { if (pos1 > pos2) - return 1; + return 1; else - return -1; + return -1; } if (keyfield->numeric) { long value = find_value (start1, length1) - find_value (start2, length2); if (value > 0) - return 1; + return 1; if (value < 0) - return -1; + return -1; return 0; } else @@ -822,46 +799,46 @@ compare_field (keyfield, start1, length1, pos1, start2, length2, pos2) char *e2 = start2 + length2; while (1) - { - int c1, c2; - - if (p1 == e1) - c1 = 0; - else - c1 = *p1++; - if (p2 == e2) - c2 = 0; - else - c2 = *p2++; - - if (char_order[c1] != char_order[c2]) - return char_order[c1] - char_order[c2]; - if (!c1) - break; - } + { + int c1, c2; + + if (p1 == e1) + c1 = 0; + else + c1 = *p1++; + if (p2 == e2) + c2 = 0; + else + c2 = *p2++; + + if (char_order[c1] != char_order[c2]) + return char_order[c1] - char_order[c2]; + if (!c1) + break; + } /* Strings are equal except possibly for case. */ p1 = start1; p2 = start2; while (1) - { - int c1, c2; - - if (p1 == e1) - c1 = 0; - else - c1 = *p1++; - if (p2 == e2) - c2 = 0; - else - c2 = *p2++; - - if (c1 != c2) - /* Reverse sign here so upper case comes out last. */ - return c2 - c1; - if (!c1) - break; - } + { + int c1, c2; + + if (p1 == e1) + c1 = 0; + else + c1 = *p1++; + if (p2 == e2) + c2 = 0; + else + c2 = *p2++; + + if (c1 != c2) + /* Reverse sign here so upper case comes out last. */ + return c2 - c1; + if (!c1) + break; + } return 0; } @@ -903,17 +880,17 @@ readline (linebuffer, stream) { int c = getc (stream); if (p == end) - { - buffer = (char *) xrealloc (buffer, linebuffer->size *= 2); - p += buffer - linebuffer->buffer; - end += buffer - linebuffer->buffer; - linebuffer->buffer = buffer; - } + { + buffer = (char *) xrealloc (buffer, linebuffer->size *= 2); + p += buffer - linebuffer->buffer; + end += buffer - linebuffer->buffer; + linebuffer->buffer = buffer; + } if (c < 0 || c == '\n') - { - *p = 0; - break; - } + { + *p = 0; + break; + } *p++ = c; } @@ -946,7 +923,7 @@ sort_offline (infile, nfiles, total, outfile) if (lb.buffer[0] != '\\' && lb.buffer[0] != '@') { - error ("%s: not a texinfo index file", infile); + error (_("%s: not a texinfo index file"), infile); return; } @@ -960,34 +937,34 @@ sort_offline (infile, nfiles, total, outfile) long tempsize = 0; if (!ostream) - pfatal_with_name (outname); + pfatal_with_name (outname); tempfiles[i] = outname; /* Copy lines into this temp file as long as it does not make file - "too big" or until there are no more lines. */ + "too big" or until there are no more lines. */ while (tempsize + linelength + 1 <= MAX_IN_CORE_SORT) - { - tempsize += linelength + 1; - fputs (lb.buffer, ostream); - putc ('\n', ostream); - - /* Read another line of input data. */ - - linelength = readline (&lb, istream); - if (!linelength && feof (istream)) - break; - - if (lb.buffer[0] != '\\' && lb.buffer[0] != '@') - { - error ("%s: not a texinfo index file", infile); - failure = 1; - goto fail; - } - } + { + tempsize += linelength + 1; + fputs (lb.buffer, ostream); + putc ('\n', ostream); + + /* Read another line of input data. */ + + linelength = readline (&lb, istream); + if (!linelength && feof (istream)) + break; + + if (lb.buffer[0] != '\\' && lb.buffer[0] != '@') + { + error (_("%s: not a texinfo index file"), infile); + failure = 1; + goto fail; + } + } fclose (ostream); if (feof (istream)) - break; + break; } free (lb.buffer); @@ -1006,7 +983,7 @@ fail: char *newtemp = maketempname (++tempcount); sort_in_core (&tempfiles[i], MAX_IN_CORE_SORT, newtemp); if (!keep_tempfiles) - unlink (tempfiles[i]); + unlink (tempfiles[i]); tempfiles[i] = newtemp; } @@ -1041,12 +1018,12 @@ sort_in_core (infile, total, outfile) int desc = open (infile, O_RDONLY, 0); if (desc < 0) - fatal ("failure reopening %s", infile); + fatal (_("failure reopening %s"), infile); for (file_size = 0;;) { i = read (desc, data + file_size, total - file_size); if (i <= 0) - break; + break; file_size += i; } file_data = data; @@ -1056,7 +1033,7 @@ sort_in_core (infile, total, outfile) if (file_size > 0 && data[0] != '\\' && data[0] != '@') { - error ("%s: not a texinfo index file", infile); + error (_("%s: not a texinfo index file"), infile); return; } @@ -1084,7 +1061,7 @@ sort_in_core (infile, total, outfile) nextline = parsefile (infile, nextline, file_data, file_size); if (nextline == 0) { - error ("%s: not a texinfo index file", infile); + error (_("%s: not a texinfo index file"), infile); return; } @@ -1102,18 +1079,18 @@ sort_in_core (infile, total, outfile) char **p; for (lp = lineinfo, p = linearray; p != nextline; lp++, p++) - { - lp->text = *p; - lp->key.text = find_field (keyfields, *p, &lp->keylen); - if (keyfields->numeric) - lp->key.number = find_value (lp->key.text, lp->keylen); - } + { + lp->text = *p; + lp->key.text = find_field (keyfields, *p, &lp->keylen); + if (keyfields->numeric) + lp->key.number = find_value (lp->key.text, lp->keylen); + } qsort (lineinfo, nextline - linearray, sizeof (struct lineinfo), compare_prepared); for (lp = lineinfo, p = linearray; p != nextline; lp++, p++) - *p = lp->text; + *p = lp->text; free (lineinfo); } @@ -1126,7 +1103,7 @@ sort_in_core (infile, total, outfile) { ostream = fopen (outfile, "w"); if (!ostream) - pfatal_with_name (outfile); + pfatal_with_name (outfile); } writelines (linearray, nextline - linearray, ostream); @@ -1160,21 +1137,21 @@ parsefile (filename, nextline, data, size) while (p != end) { if (p[0] != '\\' && p[0] != '@') - return 0; + return 0; *line = p; while (*p && *p != '\n') - p++; + p++; if (p != end) - p++; + p++; line++; if (line == linearray + nlines) - { - char **old = linearray; - linearray = (char **) xrealloc (linearray, sizeof (char *) * (nlines *= 4)); - line += linearray - old; - } + { + char **old = linearray; + linearray = (char **) xrealloc (linearray, sizeof (char *) * (nlines *= 4)); + line += linearray - old; + } } return line; @@ -1266,7 +1243,7 @@ indexify (line, ostream) { initial = p; /* Get length of inner pair of braces starting at `p', - including that inner pair of braces. */ + including that inner pair of braces. */ initiallength = find_braced_end (p + 1) + 1 - p; } else @@ -1277,7 +1254,7 @@ indexify (line, ostream) initiallength = 1; if (initial1[0] >= 'a' && initial1[0] <= 'z') - initial1[0] -= 040; + initial1[0] -= 040; } pagenumber = find_braced_pos (line, 1, 0, 0); @@ -1298,52 +1275,52 @@ indexify (line, ostream) { /* Close off current secondary entry first, if one is open. */ if (pending) - { - fputs ("}\n", ostream); - pending = 0; - } + { + fputs ("}\n", ostream); + pending = 0; + } /* If this primary has a different initial, include an entry for - the initial. */ + the initial. */ if (initiallength != lastinitiallength || - strncmp (initial, lastinitial, initiallength)) - { - fprintf (ostream, "\\initial {"); - fwrite (initial, 1, initiallength, ostream); - fprintf (ostream, "}\n", initial); - if (initial == initial1) - { - lastinitial = lastinitial1; - *lastinitial1 = *initial1; - } - else - { - lastinitial = initial; - } - lastinitiallength = initiallength; - } + strncmp (initial, lastinitial, initiallength)) + { + fprintf (ostream, "\\initial {"); + fwrite (initial, 1, initiallength, ostream); + fputs ("}\n", ostream); + if (initial == initial1) + { + lastinitial = lastinitial1; + *lastinitial1 = *initial1; + } + else + { + lastinitial = initial; + } + lastinitiallength = initiallength; + } /* Make the entry for the primary. */ if (nosecondary) - fputs ("\\entry {", ostream); + fputs ("\\entry {", ostream); else - fputs ("\\primary {", ostream); + fputs ("\\primary {", ostream); fwrite (primary, primarylength, 1, ostream); if (nosecondary) - { - fputs ("}{", ostream); - pending = 1; - } + { + fputs ("}{", ostream); + pending = 1; + } else - fputs ("}\n", ostream); + fputs ("}\n", ostream); /* Record name of most recent primary. */ if (lastprimarylength < primarylength) - { - lastprimarylength = primarylength + 100; - lastprimary = (char *) xrealloc (lastprimary, - 1 + lastprimarylength); - } + { + lastprimarylength = primarylength + 100; + lastprimary = (char *) xrealloc (lastprimary, + 1 + lastprimarylength); + } strncpy (lastprimary, primary, primarylength); lastprimary[primarylength] = 0; @@ -1354,16 +1331,16 @@ indexify (line, ostream) /* Should not have an entry with no subtopic following one with a subtopic. */ if (nosecondary && *lastsecondary) - error ("entry %s follows an entry with a secondary name", line); + error (_("entry %s follows an entry with a secondary name"), line); /* Start a new secondary entry if necessary. */ if (!nosecondary && strncmp (secondary, lastsecondary, secondarylength)) { if (pending) - { - fputs ("}\n", ostream); - pending = 0; - } + { + fputs ("}\n", ostream); + pending = 0; + } /* Write the entry for the secondary. */ fputs ("\\secondary {", ostream); @@ -1373,18 +1350,18 @@ indexify (line, ostream) /* Record name of most recent secondary. */ if (lastsecondarylength < secondarylength) - { - lastsecondarylength = secondarylength + 100; - lastsecondary = (char *) xrealloc (lastsecondary, - 1 + lastsecondarylength); - } + { + lastsecondarylength = secondarylength + 100; + lastsecondary = (char *) xrealloc (lastsecondary, + 1 + lastsecondarylength); + } strncpy (lastsecondary, secondary, secondarylength); lastsecondary[secondarylength] = 0; } /* Here to add one more page number to the current entry. */ if (pending++ != 1) - fputs (", ", ostream); /* Punctuate first, if this is not the first. */ + fputs (", ", ostream); /* Punctuate first, if this is not the first. */ fwrite (pagenumber, pagelength, 1, ostream); } @@ -1422,16 +1399,16 @@ writelines (linearray, nlines, ostream) if (next_line == linearray /* Compare previous line with this one, using only the explicitly specd keyfields. */ - || compare_general (*(next_line - 1), *next_line, 0L, 0L, num_keyfields - 1)) - { - char *p = *next_line; - char c; - - while ((c = *p++) && c != '\n') - /* Do nothing. */ ; - *(p - 1) = 0; - indexify (*next_line, ostream); - } + || compare_general (*(next_line - 1), *next_line, 0L, 0L, num_keyfields - 1)) + { + char *p = *next_line; + char c; + + while ((c = *p++) && c != '\n') + /* Do nothing. */ ; + *(p - 1) = 0; + indexify (*next_line, ostream); + } } finish_index (ostream); @@ -1470,7 +1447,7 @@ merge_files (infiles, nfiles, outfile) { int nf = MAX_DIRECT_MERGE; if (i + 1 == ntemps) - nf = nfiles - i * MAX_DIRECT_MERGE; + nf = nfiles - i * MAX_DIRECT_MERGE; tempfiles[i] = maketempname (++tempcount); value |= merge_direct (&infiles[i * MAX_DIRECT_MERGE], nf, tempfiles[i]); } @@ -1525,7 +1502,7 @@ merge_direct (infiles, nfiles, outfile) if (nfiles == 0) { if (outfile) - fclose (ostream); + fclose (ostream); return 0; } @@ -1567,7 +1544,7 @@ merge_direct (infiles, nfiles, outfile) file_lossage[i] = 0; streams[i] = fopen (infiles[i], "r"); if (!streams[i]) - pfatal_with_name (infiles[i]); + pfatal_with_name (infiles[i]); readline (thisline[i], streams[i]); } @@ -1585,48 +1562,48 @@ merge_direct (infiles, nfiles, outfile) /* Look at the next avail line of each file; choose the least one. */ for (i = 0; i < nfiles; i++) - { - if (thisline[i] && - (!best || - 0 < compare_general (best->buffer, thisline[i]->buffer, - (long) bestfile, (long) i, num_keyfields))) - { - best = thisline[i]; - bestfile = i; - } - } + { + if (thisline[i] && + (!best || + 0 < compare_general (best->buffer, thisline[i]->buffer, + (long) bestfile, (long) i, num_keyfields))) + { + best = thisline[i]; + bestfile = i; + } + } /* Output that line, unless it matches the previous one and we - don't want duplicates. */ + don't want duplicates. */ if (!(prev_out && - !compare_general (prev_out->buffer, - best->buffer, 0L, 1L, num_keyfields - 1))) - indexify (best->buffer, ostream); + !compare_general (prev_out->buffer, + best->buffer, 0L, 1L, num_keyfields - 1))) + indexify (best->buffer, ostream); prev_out = best; /* Now make the line the previous of its file, and fetch a new - line from that file. */ + line from that file. */ exch = prevline[bestfile]; prevline[bestfile] = thisline[bestfile]; thisline[bestfile] = exch; while (1) - { - /* If the file has no more, mark it empty. */ - - if (feof (streams[bestfile])) - { - thisline[bestfile] = 0; - /* Update the number of files still not empty. */ - nleft--; - break; - } - readline (thisline[bestfile], streams[bestfile]); - if (thisline[bestfile]->buffer[0] || !feof (streams[bestfile])) - break; - } + { + /* If the file has no more, mark it empty. */ + + if (feof (streams[bestfile])) + { + thisline[bestfile] = 0; + /* Update the number of files still not empty. */ + nleft--; + break; + } + readline (thisline[bestfile], streams[bestfile]); + if (thisline[bestfile]->buffer[0] || !feof (streams[bestfile])) + break; + } } finish_index (ostream); @@ -1692,7 +1669,7 @@ pfatal_with_name (name) s = strerror (errno); printf ("%s: ", program_name); - printf ("%s; for file `%s'.\n", s, name); + printf (_("%s; for file `%s'.\n"), s, name); exit (TI_FATAL_ERROR); } @@ -1745,6 +1722,21 @@ strrchr (string, character) } #endif /* HAVE_STRCHR */ +void +memory_error (callers_name, bytes_wanted) + char *callers_name; + int bytes_wanted; +{ + char printable_string[80]; + + sprintf (printable_string, + _("Virtual memory exhausted in %s ()! Needed %d bytes."), + callers_name, bytes_wanted); + + error (printable_string); + abort (); +} + /* Just like malloc, but kills the program in case of fatal error. */ void * xmalloc (nbytes) @@ -1776,18 +1768,3 @@ xrealloc (pointer, nbytes) return (temp); } - -memory_error (callers_name, bytes_wanted) - char *callers_name; - int bytes_wanted; -{ - char printable_string[80]; - - sprintf (printable_string, - "Virtual memory exhausted in %s ()! Needed %d bytes.", - callers_name, bytes_wanted); - - error (printable_string); - abort (); -} - |