[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6569] open index files on demand
From: |
Gavin D. Smith |
Subject: |
[6569] open index files on demand |
Date: |
Tue, 25 Aug 2015 10:04:33 +0000 |
Revision: 6569
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6569
Author: gavin
Date: 2015-08-25 10:04:32 +0000 (Tue, 25 Aug 2015)
Log Message:
-----------
open index files on demand
Modified Paths:
--------------
trunk/ChangeLog
trunk/NEWS
trunk/doc/texinfo.tex
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-08-24 18:51:41 UTC (rev 6568)
+++ trunk/ChangeLog 2015-08-25 10:04:32 UTC (rev 6569)
@@ -1,3 +1,14 @@
+2015-08-25 Gavin Smith <address@hidden>
+
+ * doc/texinfo.tex (\setfilename): No longer call \openindices.
+ (\openindices): Place body inline in texinfo.tex.
+ (\requireopenindexfile): New macro.
+ (\dosubind) <not @novalidate>: Use it.
+ (\newindex, \newcodeindex): Don't open an index file, and record
+ the file handle as a dummy value.
+
+ * NEWS: Mention change for opening index files on demand.
+
2015-08-24 Gavin Smith <address@hidden>
* doc/texinfo.tex (\sortas): New macro.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2015-08-24 18:51:41 UTC (rev 6568)
+++ trunk/NEWS 2015-08-25 10:04:32 UTC (rev 6569)
@@ -30,6 +30,11 @@
given explicitly.
* texinfo.tex:
+ . The default indices (cp, ky and so on) now don't get a file opened
+ for them unless they are actually used. This reduces the number of
+ files that a run of TeX produces, and also allows for a greater
+ number of user-defined indices, as you will not bump into TeX's limit
+ of 16 open files at once so soon.
. For initials in indices that are non-alphanumeric characters (for
example, backslash, or braces), avoid use of a typewriter font.
This gives a more consistent appearance.
Modified: trunk/doc/texinfo.tex
===================================================================
--- trunk/doc/texinfo.tex 2015-08-24 18:51:41 UTC (rev 6568)
+++ trunk/doc/texinfo.tex 2015-08-25 10:04:32 UTC (rev 6569)
@@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2015-08-24.20}
+\def\texinfoversion{2015-08-25.12}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -1053,8 +1053,8 @@
\newif\iflinks \linkstrue % by default we want the aux files.
\let\novalidate = \linksfalse
-% @setfilename is done at the beginning of every texinfo file.
-% So open here the files we need to have open while reading the input.
+% @setfilename is done at the beginning of every texinfo file. So open
+% here some of the files we need to have open while reading the input.
% This makes it possible to make a .fmt file for texinfo.
\def\setfilename{%
\iflinks
@@ -1062,7 +1062,6 @@
% Open the new aux file. TeX will close it automatically at exit.
\immediate\openout\auxfile=\jobname.aux
\fi % \openindices needs to do some work in any case.
- \openindices
\let\setfilename=\comment % Ignore extra @setfilename cmds.
%
% If texinfo.cnf is present on the system, read it.
@@ -1074,17 +1073,6 @@
\comment % Ignore the actual filename.
}
-% Called from \setfilename.
-%
-\def\openindices{%
- \newindex{cp}%
- \newcodeindex{fn}%
- \newcodeindex{vr}%
- \newcodeindex{tp}%
- \newcodeindex{ky}%
- \newcodeindex{pg}%
-}
-
% @bye.
\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
@@ -4371,19 +4359,16 @@
% except not \outer, so it can be used within macros and \if's.
\edef\newwrite{\makecsname{ptexnewwrite}}
-% \newindex {foo} defines an index named foo.
-% It automatically defines \fooindex such that
-% \fooindex ...rest of line... puts an entry in the index foo.
-% It also defines \fooindfile to be the number of the output channel for
-% the file that accumulates this index. The file's extension is foo.
+% \newindex {foo} defines an index named IX.
+% It automatically defines \IXindex such that
+% \IXindex ...rest of line... puts an entry in the index IX.
+% It also defines \IXindfile to be the number of the output channel for
+% the file that accumulates this index. The file's extension is IX.
% The name of an index should be no more than 2 characters long
% for the sake of vms.
%
\def\newindex#1{%
- \iflinks
- \expandafter\newwrite \csname#1indfile\endcsname
- \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
- \fi
+ \expandafter\chardef\csname#1indfile\endcsname=0
\expandafter\xdef\csname#1index\endcsname{% % Define @#1index
\noexpand\doindex{#1}}
}
@@ -4397,15 +4382,20 @@
\def\defcodeindex{\parsearg\newcodeindex}
%
\def\newcodeindex#1{%
- \iflinks
- \expandafter\newwrite \csname#1indfile\endcsname
- \openout \csname#1indfile\endcsname \jobname.#1
- \fi
+ \expandafter\chardef\csname#1indfile\endcsname=0
\expandafter\xdef\csname#1index\endcsname{%
\noexpand\docodeindex{#1}}%
}
+% The default indices:
+\newindex{cp}% concepts,
+\newcodeindex{fn}% functions,
+\newcodeindex{vr}% variables,
+\newcodeindex{tp}% types,
+\newcodeindex{ky}% keys
+\newcodeindex{pg}% and programs.
+
% @synindex foo bar makes index foo feed into index bar.
% Do this instead of @defindex foo if you don't want it as a separate index.
%
@@ -4437,15 +4427,12 @@
% Argument #1 is generated by the calling \fooindex macro,
% and it the two-letter name of the index.
-% \doindex just uses \parsearg; it calls \doind for the actual work.
-% This is because \doind is more useful to call from other macros.
+\def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
+\def\doindexxxx #1{\doind{\indexname}{#1}}
-\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
-\def\singleindexer #1{\doind{\indexname}{#1}}
-
% like the previous two, but they put @code around the argument.
-\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
-\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
+\def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
+\def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
% Used when writing an index entry out to an index file, to prevent
% expansion of Texinfo commands that can appear in an index entry.
@@ -4808,6 +4795,7 @@
\def\dosubind#1#2#3{%
\iflinks
{%
+ \requireopenindexfile{#1}%
% Store the main index entry text (including the third arg).
\toks0 = {#2}%
% If third arg is present, precede it with a space.
@@ -4823,6 +4811,13 @@
\fi
}
+% Check if an index file has been opened, and if not, open it.
+\def\requireopenindexfile#1{%
+\ifnum\csname #1indfile\endcsname=0
+ \expandafter\newwrite \csname#1indfile\endcsname
+ \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
+\fi}
+
% Output \ as {\indexbackslash}, because \ is an escape character in
% the index files.
\let\indexbackslash=\relax
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6569] open index files on demand,
Gavin D. Smith <=