mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Update from Gnulib by running admin/merge-gnulib
This commit is contained in:
parent
9bd91a3751
commit
7b05ffda80
3 changed files with 320 additions and 355 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
% Load plain if necessary, i.e., if running under initex.
|
% Load plain if necessary, i.e., if running under initex.
|
||||||
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
|
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
|
||||||
%
|
%
|
||||||
\def\texinfoversion{2022-04-09.08}
|
\def\texinfoversion{2022-08-20.19}
|
||||||
%
|
%
|
||||||
% Copyright 1985, 1986, 1988, 1990-2022 Free Software Foundation, Inc.
|
% Copyright 1985, 1986, 1988, 1990-2022 Free Software Foundation, Inc.
|
||||||
%
|
%
|
||||||
|
|
@ -725,32 +725,22 @@ where each line of input produces a line of output.}
|
||||||
\dimen2 = \ht\strutbox
|
\dimen2 = \ht\strutbox
|
||||||
\advance\dimen2 by \dp\strutbox
|
\advance\dimen2 by \dp\strutbox
|
||||||
\ifdim\dimen0 > \dimen2
|
\ifdim\dimen0 > \dimen2
|
||||||
|
% This is similar to the 'needspace' module in LaTeX.
|
||||||
|
% The first penalty allows a break if the end of the page is
|
||||||
|
% not too far away. Following penalties and skips are discarded.
|
||||||
|
% Otherwise, require at least \dimen0 of vertical space.
|
||||||
%
|
%
|
||||||
% Do a \strut just to make the height of this box be normal, so the
|
% (We used to use a \vtop to reserve space, but this had spacing issues
|
||||||
% normal leading is inserted relative to the preceding line.
|
% when followed by a section heading, as it was not a "discardable item".
|
||||||
% And a page break here is fine.
|
% This also has the benefit of providing glue before the page break if
|
||||||
\vtop to #1\mil{\strut\vfil}%
|
% there isn't enough space.)
|
||||||
%
|
\vskip0pt plus \dimen0
|
||||||
% TeX does not even consider page breaks if a penalty added to the
|
\penalty-100
|
||||||
% main vertical list is 10000 or more. But in order to see if the
|
\vskip0pt plus -\dimen0
|
||||||
% empty box we just added fits on the page, we must make it consider
|
\vskip \dimen0
|
||||||
% page breaks. On the other hand, we don't want to actually break the
|
|
||||||
% page after the empty box. So we use a penalty of 9999.
|
|
||||||
%
|
|
||||||
% There is an extremely small chance that TeX will actually break the
|
|
||||||
% page at this \penalty, if there are no other feasible breakpoints in
|
|
||||||
% sight. (If the user is using lots of big @group commands, which
|
|
||||||
% almost-but-not-quite fill up a page, TeX will have a hard time doing
|
|
||||||
% good page breaking, for example.) However, I could not construct an
|
|
||||||
% example where a page broke at this \penalty; if it happens in a real
|
|
||||||
% document, then we can reconsider our strategy.
|
|
||||||
\penalty9999
|
\penalty9999
|
||||||
%
|
\vskip -\dimen0
|
||||||
% Back up by the size of the box, whether we did a page break or not.
|
\penalty0\relax % this hides the above glue from \safewhatsit and \dobreak
|
||||||
\kern -#1\mil
|
|
||||||
%
|
|
||||||
% Do not allow a page break right after this kern.
|
|
||||||
\nobreak
|
|
||||||
\fi
|
\fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2558,7 +2548,7 @@ end
|
||||||
\def\it{\fam=\itfam \setfontstyle{it}}
|
\def\it{\fam=\itfam \setfontstyle{it}}
|
||||||
\def\sl{\fam=\slfam \setfontstyle{sl}}
|
\def\sl{\fam=\slfam \setfontstyle{sl}}
|
||||||
\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
|
\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
|
||||||
\def\tt{\fam=\ttfam \setfontstyle{tt}}\def\ttstylename{tt}
|
\def\tt{\fam=\ttfam \setfontstyle{tt}}
|
||||||
|
|
||||||
% Texinfo sort of supports the sans serif font style, which plain TeX does not.
|
% Texinfo sort of supports the sans serif font style, which plain TeX does not.
|
||||||
% So we set up a \sf.
|
% So we set up a \sf.
|
||||||
|
|
@ -2691,6 +2681,14 @@ end
|
||||||
%
|
%
|
||||||
\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
|
\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
|
||||||
|
|
||||||
|
% Check if internal flag is clear, i.e. has not been @set.
|
||||||
|
\def\ifflagclear#1#2#3{%
|
||||||
|
\expandafter\ifx\csname SET#1\endcsname\relax
|
||||||
|
#2\else#3\fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
\catcode`\'=\active
|
\catcode`\'=\active
|
||||||
\catcode`\`=\active
|
\catcode`\`=\active
|
||||||
|
|
@ -2707,14 +2705,14 @@ end
|
||||||
%
|
%
|
||||||
\def\codequoteright{%
|
\def\codequoteright{%
|
||||||
\ifmonospace
|
\ifmonospace
|
||||||
\expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
|
\ifflagclear{txicodequoteundirected}{%
|
||||||
\expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
|
\ifflagclear{codequoteundirected}{%
|
||||||
'%
|
'%
|
||||||
\else \char'15 \fi
|
}{\char'15 }%
|
||||||
\else \char'15 \fi
|
}{\char'15 }%
|
||||||
\else
|
\else
|
||||||
'%
|
'%
|
||||||
\fi
|
\fi
|
||||||
}
|
}
|
||||||
%
|
%
|
||||||
% and a similar option for the left quote char vs. a grave accent.
|
% and a similar option for the left quote char vs. a grave accent.
|
||||||
|
|
@ -2723,16 +2721,16 @@ end
|
||||||
%
|
%
|
||||||
\def\codequoteleft{%
|
\def\codequoteleft{%
|
||||||
\ifmonospace
|
\ifmonospace
|
||||||
\expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
|
\ifflagclear{txicodequotebacktick}{%
|
||||||
\expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
|
\ifflagclear{codequotebacktick}{%
|
||||||
% [Knuth] pp. 380,381,391
|
% [Knuth] pp. 380,381,391
|
||||||
% \relax disables Spanish ligatures ?` and !` of \tt font.
|
% \relax disables Spanish ligatures ?` and !` of \tt font.
|
||||||
\relax`%
|
\relax`%
|
||||||
\else \char'22 \fi
|
}{\char'22 }%
|
||||||
\else \char'22 \fi
|
}{\char'22 }%
|
||||||
\else
|
\else
|
||||||
\relax`%
|
\relax`%
|
||||||
\fi
|
\fi
|
||||||
}
|
}
|
||||||
|
|
||||||
% Commands to set the quote options.
|
% Commands to set the quote options.
|
||||||
|
|
@ -2779,15 +2777,16 @@ end
|
||||||
\def\dosmartslant#1#2{%
|
\def\dosmartslant#1#2{%
|
||||||
\ifusingtt
|
\ifusingtt
|
||||||
{{\ttsl #2}\let\next=\relax}%
|
{{\ttsl #2}\let\next=\relax}%
|
||||||
{\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
|
{\def\next{{#1#2}\smartitaliccorrection}}%
|
||||||
\next
|
\next
|
||||||
}
|
}
|
||||||
\def\smartslanted{\dosmartslant\sl}
|
\def\smartslanted{\dosmartslant\sl}
|
||||||
\def\smartitalic{\dosmartslant\it}
|
\def\smartitalic{\dosmartslant\it}
|
||||||
|
|
||||||
% Output an italic correction unless \next (presumed to be the following
|
% Output an italic correction unless the following character is such as
|
||||||
% character) is such as not to need one.
|
% not to need one.
|
||||||
\def\smartitaliccorrection{%
|
\def\smartitaliccorrection{\futurelet\next\smartitaliccorrectionx}
|
||||||
|
\def\smartitaliccorrectionx{%
|
||||||
\ifx\next,%
|
\ifx\next,%
|
||||||
\else\ifx\next-%
|
\else\ifx\next-%
|
||||||
\else\ifx\next.%
|
\else\ifx\next.%
|
||||||
|
|
@ -2798,18 +2797,18 @@ end
|
||||||
\aftersmartic
|
\aftersmartic
|
||||||
}
|
}
|
||||||
|
|
||||||
% Unconditional use \ttsl, and no ic. @var is set to this for defuns.
|
% @cite unconditionally uses \sl with \smartitaliccorrection.
|
||||||
\def\ttslanted#1{{\ttsl #1}}
|
\def\cite#1{{\sl #1}\smartitaliccorrection}
|
||||||
|
|
||||||
% @cite is like \smartslanted except unconditionally use \sl. We never want
|
|
||||||
% ttsl for book titles, do we?
|
|
||||||
\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
|
|
||||||
|
|
||||||
|
% @var unconditionally uses \sl. This gives consistency for
|
||||||
|
% parameter names whether they are in @def, @table @code or a
|
||||||
|
% regular paragraph.
|
||||||
|
% The \null is to reset \spacefactor.
|
||||||
\def\aftersmartic{}
|
\def\aftersmartic{}
|
||||||
\def\var#1{%
|
\def\var#1{%
|
||||||
\let\saveaftersmartic = \aftersmartic
|
\let\saveaftersmartic = \aftersmartic
|
||||||
\def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
|
\def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
|
||||||
\smartslanted{#1}%
|
{\sl #1}\smartitaliccorrection
|
||||||
}
|
}
|
||||||
|
|
||||||
\let\i=\smartitalic
|
\let\i=\smartitalic
|
||||||
|
|
@ -2817,8 +2816,14 @@ end
|
||||||
\let\dfn=\smartslanted
|
\let\dfn=\smartslanted
|
||||||
\let\emph=\smartitalic
|
\let\emph=\smartitalic
|
||||||
|
|
||||||
% Explicit font changes: @r, @sc, undocumented @ii.
|
% @r for roman font, used for code comment
|
||||||
\def\r#1{{\rm #1}} % roman font
|
\def\r#1{{%
|
||||||
|
\usenormaldash % get --, --- ligatures even if in @code
|
||||||
|
\defcharsdefault % in case on def line
|
||||||
|
\rm #1}}
|
||||||
|
{\catcode`-=\active \gdef\usenormaldash{\let-\normaldash}}
|
||||||
|
|
||||||
|
% @sc, undocumented @ii.
|
||||||
\def\sc#1{{\smallcaps#1}} % smallcaps font
|
\def\sc#1{{\smallcaps#1}} % smallcaps font
|
||||||
\def\ii#1{{\it #1}} % italic font
|
\def\ii#1{{\it #1}} % italic font
|
||||||
|
|
||||||
|
|
@ -2856,7 +2861,7 @@ end
|
||||||
|
|
||||||
% @t, explicit typewriter.
|
% @t, explicit typewriter.
|
||||||
\def\t#1{%
|
\def\t#1{%
|
||||||
{\tt \plainfrenchspacing #1}%
|
{\tt \defcharsdefault \plainfrenchspacing #1}%
|
||||||
\null
|
\null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4432,7 +4437,7 @@ $$%
|
||||||
|
|
||||||
\message{conditionals,}
|
\message{conditionals,}
|
||||||
|
|
||||||
% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
|
% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotlatex, @ifnotplaintext,
|
||||||
% @ifnotxml always succeed. They currently do nothing; we don't
|
% @ifnotxml always succeed. They currently do nothing; we don't
|
||||||
% attempt to check whether the conditionals are properly nested. But we
|
% attempt to check whether the conditionals are properly nested. But we
|
||||||
% have to remember that they are conditionals, so that @end doesn't
|
% have to remember that they are conditionals, so that @end doesn't
|
||||||
|
|
@ -4446,6 +4451,7 @@ $$%
|
||||||
\makecond{ifnotdocbook}
|
\makecond{ifnotdocbook}
|
||||||
\makecond{ifnothtml}
|
\makecond{ifnothtml}
|
||||||
\makecond{ifnotinfo}
|
\makecond{ifnotinfo}
|
||||||
|
\makecond{ifnotlatex}
|
||||||
\makecond{ifnotplaintext}
|
\makecond{ifnotplaintext}
|
||||||
\makecond{ifnotxml}
|
\makecond{ifnotxml}
|
||||||
|
|
||||||
|
|
@ -4458,10 +4464,12 @@ $$%
|
||||||
\def\ifdocbook{\doignore{ifdocbook}}
|
\def\ifdocbook{\doignore{ifdocbook}}
|
||||||
\def\ifhtml{\doignore{ifhtml}}
|
\def\ifhtml{\doignore{ifhtml}}
|
||||||
\def\ifinfo{\doignore{ifinfo}}
|
\def\ifinfo{\doignore{ifinfo}}
|
||||||
|
\def\iflatex{\doignore{iflatex}}
|
||||||
\def\ifnottex{\doignore{ifnottex}}
|
\def\ifnottex{\doignore{ifnottex}}
|
||||||
\def\ifplaintext{\doignore{ifplaintext}}
|
\def\ifplaintext{\doignore{ifplaintext}}
|
||||||
\def\ifxml{\doignore{ifxml}}
|
\def\ifxml{\doignore{ifxml}}
|
||||||
\def\ignore{\doignore{ignore}}
|
\def\ignore{\doignore{ignore}}
|
||||||
|
\def\latex{\doignore{latex}}
|
||||||
\def\menu{\doignore{menu}}
|
\def\menu{\doignore{menu}}
|
||||||
\def\xml{\doignore{xml}}
|
\def\xml{\doignore{xml}}
|
||||||
|
|
||||||
|
|
@ -4985,25 +4993,24 @@ $$%
|
||||||
\catcode`\-=13
|
\catcode`\-=13
|
||||||
\catcode`\`=13
|
\catcode`\`=13
|
||||||
\gdef\indexnonalnumdisappear{%
|
\gdef\indexnonalnumdisappear{%
|
||||||
\expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
|
\ifflagclear{txiindexlquoteignore}{}{%
|
||||||
% @set txiindexlquoteignore makes us ignore left quotes in the sort term.
|
% @set txiindexlquoteignore makes us ignore left quotes in the sort term.
|
||||||
% (Introduced for FSFS 2nd ed.)
|
% (Introduced for FSFS 2nd ed.)
|
||||||
\let`=\empty
|
\let`=\empty
|
||||||
\fi
|
}%
|
||||||
%
|
%
|
||||||
\expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
|
\ifflagclear{txiindexbackslashignore}{}{%
|
||||||
\backslashdisappear
|
\backslashdisappear
|
||||||
\fi
|
}%
|
||||||
%
|
\ifflagclear{txiindexhyphenignore}{}{%
|
||||||
\expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
|
|
||||||
\def-{}%
|
\def-{}%
|
||||||
\fi
|
}%
|
||||||
\expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
|
\ifflagclear{txiindexlessthanignore}{}{%
|
||||||
\def<{}%
|
\def<{}%
|
||||||
\fi
|
}%
|
||||||
\expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
|
\ifflagclear{txiindexatsignignore}{}{%
|
||||||
\def\@{}%
|
\def\@{}%
|
||||||
\fi
|
}%
|
||||||
}
|
}
|
||||||
|
|
||||||
\gdef\indexnonalnumreappear{%
|
\gdef\indexnonalnumreappear{%
|
||||||
|
|
@ -5295,9 +5302,7 @@ $$%
|
||||||
%
|
%
|
||||||
\atdummies
|
\atdummies
|
||||||
%
|
%
|
||||||
\expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax\else
|
\ifflagclear{txiindexescapeisbackslash}{}{\escapeisbackslash}%
|
||||||
\escapeisbackslash
|
|
||||||
\fi
|
|
||||||
%
|
%
|
||||||
% For texindex which always views { and } as separators.
|
% For texindex which always views { and } as separators.
|
||||||
\def\{{\lbracechar{}}%
|
\def\{{\lbracechar{}}%
|
||||||
|
|
@ -5481,9 +5486,9 @@ $$%
|
||||||
% old index files using \ as the escape character. Reading this would
|
% old index files using \ as the escape character. Reading this would
|
||||||
% at best lead to typesetting garbage, at worst a TeX syntax error.
|
% at best lead to typesetting garbage, at worst a TeX syntax error.
|
||||||
\def\printindexzz#1#2\finish{%
|
\def\printindexzz#1#2\finish{%
|
||||||
\expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax
|
\ifflagclear{txiindexescapeisbackslash}{%
|
||||||
\uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
|
\uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
|
||||||
\expandafter\ifx\csname SETtxiskipindexfileswithbackslash\endcsname\relax
|
\ifflagclear{txiskipindexfileswithbackslash}{%
|
||||||
\errmessage{%
|
\errmessage{%
|
||||||
ERROR: A sorted index file in an obsolete format was skipped.
|
ERROR: A sorted index file in an obsolete format was skipped.
|
||||||
To fix this problem, please upgrade your version of 'texi2dvi'
|
To fix this problem, please upgrade your version of 'texi2dvi'
|
||||||
|
|
@ -5499,15 +5504,15 @@ this, Texinfo will try to use index files in the old format.
|
||||||
If you continue to have problems, deleting the index files and starting again
|
If you continue to have problems, deleting the index files and starting again
|
||||||
might help (with 'rm \jobname.?? \jobname.??s')%
|
might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
}%
|
}%
|
||||||
\else
|
}{%
|
||||||
(Skipped sorted index file in obsolete format)
|
(Skipped sorted index file in obsolete format)
|
||||||
\fi
|
}%
|
||||||
\else
|
\else
|
||||||
\begindoublecolumns
|
\begindoublecolumns
|
||||||
\input \jobname.\indexname s
|
\input \jobname.\indexname s
|
||||||
\enddoublecolumns
|
\enddoublecolumns
|
||||||
\fi
|
\fi
|
||||||
\else
|
}{%
|
||||||
\begindoublecolumns
|
\begindoublecolumns
|
||||||
\catcode`\\=0\relax
|
\catcode`\\=0\relax
|
||||||
%
|
%
|
||||||
|
|
@ -5517,7 +5522,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
\catcode`\@=0\relax
|
\catcode`\@=0\relax
|
||||||
\input \jobname.\indexname s
|
\input \jobname.\indexname s
|
||||||
\enddoublecolumns
|
\enddoublecolumns
|
||||||
\fi
|
}%
|
||||||
}
|
}
|
||||||
|
|
||||||
% These macros are used by the sorted index file itself.
|
% These macros are used by the sorted index file itself.
|
||||||
|
|
@ -7277,22 +7282,6 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
}
|
}
|
||||||
\let\Eraggedright\par
|
\let\Eraggedright\par
|
||||||
|
|
||||||
\envdef\raggedleft{%
|
|
||||||
\parindent=0pt \leftskip0pt plus2em
|
|
||||||
\spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
|
|
||||||
\hbadness=10000 % Last line will usually be underfull, so turn off
|
|
||||||
% badness reporting.
|
|
||||||
}
|
|
||||||
\let\Eraggedleft\par
|
|
||||||
|
|
||||||
\envdef\raggedcenter{%
|
|
||||||
\parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
|
|
||||||
\spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
|
|
||||||
\hbadness=10000 % Last line will usually be underfull, so turn off
|
|
||||||
% badness reporting.
|
|
||||||
}
|
|
||||||
\let\Eraggedcenter\par
|
|
||||||
|
|
||||||
|
|
||||||
% @quotation does normal linebreaking (hence we can't use \nonfillstart)
|
% @quotation does normal linebreaking (hence we can't use \nonfillstart)
|
||||||
% and narrows the margins. We keep \parskip nonzero in general, since
|
% and narrows the margins. We keep \parskip nonzero in general, since
|
||||||
|
|
@ -7515,9 +7504,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
% file; b) letting users define the frontmatter in as flexible order as
|
% file; b) letting users define the frontmatter in as flexible order as
|
||||||
% possible is desirable.
|
% possible is desirable.
|
||||||
%
|
%
|
||||||
\def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
|
\def\copying{\checkenv{}\begingroup\macrobodyctxt\docopying}
|
||||||
\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
|
{\catcode`\ =\other
|
||||||
%
|
\gdef\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
|
||||||
|
}
|
||||||
|
|
||||||
\def\insertcopying{%
|
\def\insertcopying{%
|
||||||
\begingroup
|
\begingroup
|
||||||
\parindent = 0pt % paragraph indentation looks wrong on title page
|
\parindent = 0pt % paragraph indentation looks wrong on title page
|
||||||
|
|
@ -7599,21 +7590,15 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
|
|
||||||
\def\Edefun{\endgraf\medbreak}
|
\def\Edefun{\endgraf\medbreak}
|
||||||
|
|
||||||
% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
|
% \makedefun{deffoo}{ (definition of \deffooheader) }
|
||||||
% the only thing remaining is to define \deffnheader.
|
|
||||||
%
|
%
|
||||||
|
% Define \deffoo, \deffoox \Edeffoo and \deffooheader.
|
||||||
\def\makedefun#1{%
|
\def\makedefun#1{%
|
||||||
\expandafter\let\csname E#1\endcsname = \Edefun
|
\expandafter\let\csname E#1\endcsname = \Edefun
|
||||||
\edef\temp{\noexpand\domakedefun
|
\edef\temp{\noexpand\domakedefun
|
||||||
\makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
|
\makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
|
||||||
\temp
|
\temp
|
||||||
}
|
}
|
||||||
|
|
||||||
% \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
|
|
||||||
%
|
|
||||||
% Define \deffn and \deffnx, without parameters.
|
|
||||||
% \deffnheader has to be defined explicitly.
|
|
||||||
%
|
|
||||||
\def\domakedefun#1#2#3{%
|
\def\domakedefun#1#2#3{%
|
||||||
\envdef#1{%
|
\envdef#1{%
|
||||||
\startdefun
|
\startdefun
|
||||||
|
|
@ -7646,74 +7631,51 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
\fi\fi
|
\fi\fi
|
||||||
}
|
}
|
||||||
|
|
||||||
% \dosubind {index}{topic}{subtopic}
|
|
||||||
%
|
|
||||||
% If SUBTOPIC is present, precede it with a space, and call \doind.
|
|
||||||
% (At some time during the 20th century, this made a two-level entry in an
|
|
||||||
% index such as the operation index. Nobody seemed to notice the change in
|
|
||||||
% behaviour though.)
|
|
||||||
\def\dosubind#1#2#3{%
|
|
||||||
\def\thirdarg{#3}%
|
|
||||||
\ifx\thirdarg\empty
|
|
||||||
\doind{#1}{#2}%
|
|
||||||
\else
|
|
||||||
\doind{#1}{#2\space#3}%
|
|
||||||
\fi
|
|
||||||
}
|
|
||||||
|
|
||||||
% Untyped functions:
|
% Untyped functions:
|
||||||
|
|
||||||
% @deffn category name args
|
% @deffn category name args
|
||||||
\makedefun{deffn}{\deffngeneral{}}
|
\makedefun{deffn}#1 #2 #3\endheader{%
|
||||||
|
\doind{fn}{\code{#2}}%
|
||||||
|
\defname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
|
||||||
|
}
|
||||||
|
|
||||||
% @deffn category class name args
|
% @defop category class name args
|
||||||
\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
|
\makedefun{defop}#1 {\defopheaderx{#1\ \putwordon}}
|
||||||
|
\def\defopheaderx#1#2 #3 #4\endheader{%
|
||||||
% \defopon {category on}class name args
|
\doind{fn}{\code{#3}\space\putwordon\ \code{#2}}%
|
||||||
\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
|
\defname{#1\ \code{#2}}{}{#3}\magicamp\defunargs{#4\unskip}%
|
||||||
|
|
||||||
% \deffngeneral {subind}category name args
|
|
||||||
%
|
|
||||||
\def\deffngeneral#1#2 #3 #4\endheader{%
|
|
||||||
\dosubind{fn}{\code{#3}}{#1}%
|
|
||||||
\defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
|
|
||||||
}
|
}
|
||||||
|
|
||||||
% Typed functions:
|
% Typed functions:
|
||||||
|
|
||||||
% @deftypefn category type name args
|
% @deftypefn category type name args
|
||||||
\makedefun{deftypefn}{\deftypefngeneral{}}
|
\makedefun{deftypefn}#1 #2 #3 #4\endheader{%
|
||||||
|
\doind{fn}{\code{#3}}%
|
||||||
|
\doingtypefntrue
|
||||||
|
\defname{#1}{#2}{#3}\defunargs{#4\unskip}%
|
||||||
|
}
|
||||||
|
|
||||||
% @deftypeop category class type name args
|
% @deftypeop category class type name args
|
||||||
\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
|
\makedefun{deftypeop}#1 {\deftypeopheaderx{#1\ \putwordon}}
|
||||||
|
\def\deftypeopheaderx#1#2 #3 #4 #5\endheader{%
|
||||||
% \deftypeopon {category on}class type name args
|
\doind{fn}{\code{#4}\space\putwordon\ \code{#1\ \code{#2}}}%
|
||||||
\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
|
|
||||||
|
|
||||||
% \deftypefngeneral {subind}category type name args
|
|
||||||
%
|
|
||||||
\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
|
|
||||||
\dosubind{fn}{\code{#4}}{#1}%
|
|
||||||
\doingtypefntrue
|
\doingtypefntrue
|
||||||
\defname{#2}{#3}{#4}\defunargs{#5\unskip}%
|
\defname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
|
||||||
}
|
}
|
||||||
|
|
||||||
% Typed variables:
|
% Typed variables:
|
||||||
|
|
||||||
% @deftypevr category type var args
|
% @deftypevr category type var args
|
||||||
\makedefun{deftypevr}{\deftypecvgeneral{}}
|
\makedefun{deftypevr}#1 #2 #3 #4\endheader{%
|
||||||
|
\doind{vr}{\code{#3}}%
|
||||||
|
\defname{#1}{#2}{#3}\defunargs{#4\unskip}%
|
||||||
|
}
|
||||||
|
|
||||||
% @deftypecv category class type var args
|
% @deftypecv category class type var args
|
||||||
\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
|
\makedefun{deftypecv}#1 {\deftypecvheaderx{#1\ \putwordof}}
|
||||||
|
\def\deftypecvheaderx#1#2 #3 #4 #5\endheader{%
|
||||||
% \deftypecvof {category of}class type var args
|
\doind{vr}{\code{#4}\space\putwordof\ \code{#2}}%
|
||||||
\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
|
\defname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
|
||||||
|
|
||||||
% \deftypecvgeneral {subind}category type var args
|
|
||||||
%
|
|
||||||
\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
|
|
||||||
\dosubind{vr}{\code{#4}}{#1}%
|
|
||||||
\defname{#2}{#3}{#4}\defunargs{#5\unskip}%
|
|
||||||
}
|
}
|
||||||
|
|
||||||
% Untyped variables:
|
% Untyped variables:
|
||||||
|
|
@ -7722,10 +7684,8 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
|
\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
|
||||||
|
|
||||||
% @defcv category class var args
|
% @defcv category class var args
|
||||||
\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
|
\makedefun{defcv}#1 {\defcvheaderx{#1\ \putwordof}}
|
||||||
|
\def\defcvheaderx#1#2 {\deftypecvheaderx{#1}#2 {} }
|
||||||
% \defcvof {category of}class var args
|
|
||||||
\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
|
|
||||||
|
|
||||||
% Types:
|
% Types:
|
||||||
|
|
||||||
|
|
@ -7743,10 +7703,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
\makedefun{defvar}{\defvrheader{\putwordDefvar} }
|
\makedefun{defvar}{\defvrheader{\putwordDefvar} }
|
||||||
\makedefun{defopt}{\defvrheader{\putwordDefopt} }
|
\makedefun{defopt}{\defvrheader{\putwordDefopt} }
|
||||||
\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
|
\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
|
||||||
\makedefun{defmethod}{\defopon\putwordMethodon}
|
\makedefun{defmethod}{\defopheaderx\putwordMethodon}
|
||||||
\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
|
\makedefun{deftypemethod}{\deftypeopheaderx\putwordMethodon}
|
||||||
\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
|
\makedefun{defivar}{\defcvheaderx\putwordInstanceVariableof}
|
||||||
\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
|
\makedefun{deftypeivar}{\deftypecvheaderx\putwordInstanceVariableof}
|
||||||
|
|
||||||
% \defname, which formats the name of the @def (not the args).
|
% \defname, which formats the name of the @def (not the args).
|
||||||
% #1 is the category, such as "Function".
|
% #1 is the category, such as "Function".
|
||||||
|
|
@ -7765,9 +7725,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
\rettypeownlinefalse
|
\rettypeownlinefalse
|
||||||
\ifdoingtypefn % doing a typed function specifically?
|
\ifdoingtypefn % doing a typed function specifically?
|
||||||
% then check user option for putting return type on its own line:
|
% then check user option for putting return type on its own line:
|
||||||
\expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
|
\ifflagclear{txideftypefnnl}{}{\rettypeownlinetrue}%
|
||||||
\rettypeownlinetrue
|
|
||||||
\fi
|
|
||||||
\fi
|
\fi
|
||||||
%
|
%
|
||||||
% How we'll format the category name. Putting it in brackets helps
|
% How we'll format the category name. Putting it in brackets helps
|
||||||
|
|
@ -7832,30 +7790,18 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
\fi % no return type
|
\fi % no return type
|
||||||
#3% output function name
|
#3% output function name
|
||||||
}%
|
}%
|
||||||
{\rm\enskip}% hskip 0.5 em of \rmfont
|
\ifflagclear{txidefnamenospace}{%
|
||||||
|
{\rm\enskip}% hskip 0.5 em of \rmfont
|
||||||
|
}{}%
|
||||||
%
|
%
|
||||||
\boldbrax
|
\boldbrax
|
||||||
% arguments will be output next, if any.
|
% arguments will be output next, if any.
|
||||||
}
|
}
|
||||||
|
|
||||||
% Print arguments in slanted roman (not ttsl), inconsistently with using
|
% Print arguments. Use slanted for @def*, typewriter for @deftype*.
|
||||||
% tt for the name. This is because literal text is sometimes needed in
|
|
||||||
% the argument list (groff manual), and ttsl and tt are not very
|
|
||||||
% distinguishable. Prevent hyphenation at `-' chars.
|
|
||||||
%
|
|
||||||
\def\defunargs#1{%
|
\def\defunargs#1{%
|
||||||
% use sl by default (not ttsl),
|
\df \ifdoingtypefn \tt \else \sl \fi
|
||||||
% tt for the names.
|
|
||||||
\df \sl \hyphenchar\font=0
|
|
||||||
%
|
|
||||||
% On the other hand, if an argument has two dashes (for instance), we
|
|
||||||
% want a way to get ttsl. We used to recommend @var for that, so
|
|
||||||
% leave the code in, but it's strange for @var to lead to typewriter.
|
|
||||||
% Nowadays we recommend @code, since the difference between a ttsl hyphen
|
|
||||||
% and a tt hyphen is pretty tiny. @code also disables ?` !`.
|
|
||||||
\def\var##1{{\setregularquotes\ttslanted{##1}}}%
|
|
||||||
#1%
|
#1%
|
||||||
\sl\hyphenchar\font=45
|
|
||||||
}
|
}
|
||||||
|
|
||||||
% We want ()&[] to print specially on the defun line.
|
% We want ()&[] to print specially on the defun line.
|
||||||
|
|
@ -7874,9 +7820,12 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
% so TeX would otherwise complain about undefined control sequence.
|
% so TeX would otherwise complain about undefined control sequence.
|
||||||
{
|
{
|
||||||
\activeparens
|
\activeparens
|
||||||
\global\let(=\lparen \global\let)=\rparen
|
\gdef\defcharsdefault{%
|
||||||
\global\let[=\lbrack \global\let]=\rbrack
|
\let(=\lparen \let)=\rparen
|
||||||
\global\let& = \&
|
\let[=\lbrack \let]=\rbrack
|
||||||
|
\let& = \&%
|
||||||
|
}
|
||||||
|
\globaldefs=1 \defcharsdefault
|
||||||
|
|
||||||
\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
|
\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
|
||||||
\gdef\magicamp{\let&=\amprm}
|
\gdef\magicamp{\let&=\amprm}
|
||||||
|
|
@ -8060,24 +8009,17 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
\catcode`\_=\other
|
\catcode`\_=\other
|
||||||
\catcode`\|=\other
|
\catcode`\|=\other
|
||||||
\catcode`\~=\other
|
\catcode`\~=\other
|
||||||
|
\catcode`\@=\other
|
||||||
|
\catcode`\^^M=\other
|
||||||
|
\catcode`\\=\active
|
||||||
\passthroughcharstrue
|
\passthroughcharstrue
|
||||||
}
|
}
|
||||||
|
|
||||||
\def\scanargctxt{% used for copying and captions, not macros.
|
\def\macrobodyctxt{% used for @macro definitions and @copying
|
||||||
\scanctxt
|
|
||||||
\catcode`\@=\other
|
|
||||||
\catcode`\\=\other
|
|
||||||
\catcode`\^^M=\other
|
|
||||||
}
|
|
||||||
|
|
||||||
\def\macrobodyctxt{% used for @macro definitions
|
|
||||||
\scanctxt
|
\scanctxt
|
||||||
\catcode`\ =\other
|
\catcode`\ =\other
|
||||||
\catcode`\@=\other
|
|
||||||
\catcode`\{=\other
|
\catcode`\{=\other
|
||||||
\catcode`\}=\other
|
\catcode`\}=\other
|
||||||
\catcode`\^^M=\other
|
|
||||||
\usembodybackslash
|
|
||||||
}
|
}
|
||||||
|
|
||||||
% Used when scanning braced macro arguments. Note, however, that catcode
|
% Used when scanning braced macro arguments. Note, however, that catcode
|
||||||
|
|
@ -8086,14 +8028,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
\def\macroargctxt{%
|
\def\macroargctxt{%
|
||||||
\scanctxt
|
\scanctxt
|
||||||
\catcode`\ =\active
|
\catcode`\ =\active
|
||||||
\catcode`\@=\other
|
|
||||||
\catcode`\^^M=\other
|
|
||||||
\catcode`\\=\active
|
|
||||||
}
|
}
|
||||||
|
|
||||||
\def\macrolineargctxt{% used for whole-line arguments without braces
|
\def\macrolineargctxt{% used for whole-line arguments without braces
|
||||||
\scanctxt
|
\scanctxt
|
||||||
\catcode`\@=\other
|
|
||||||
\catcode`\{=\other
|
\catcode`\{=\other
|
||||||
\catcode`\}=\other
|
\catcode`\}=\other
|
||||||
}
|
}
|
||||||
|
|
@ -8137,7 +8075,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
\global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
|
\global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
|
||||||
\addtomacrolist{\the\macname}%
|
\addtomacrolist{\the\macname}%
|
||||||
\fi
|
\fi
|
||||||
\begingroup \macrobodyctxt
|
\begingroup \macrobodyctxt \usembodybackslash
|
||||||
\ifrecursive \expandafter\parsermacbody
|
\ifrecursive \expandafter\parsermacbody
|
||||||
\else \expandafter\parsemacbody
|
\else \expandafter\parsemacbody
|
||||||
\fi}
|
\fi}
|
||||||
|
|
@ -8941,7 +8879,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
% output the `[mynode]' via the macro below so it can be overridden.
|
% output the `[mynode]' via the macro below so it can be overridden.
|
||||||
\xrefprintnodename\printedrefname
|
\xrefprintnodename\printedrefname
|
||||||
%
|
%
|
||||||
\expandafter\ifx\csname SETtxiomitxrefpg\endcsname\relax
|
\ifflagclear{txiomitxrefpg}{%
|
||||||
% But we always want a comma and a space:
|
% But we always want a comma and a space:
|
||||||
,\space
|
,\space
|
||||||
%
|
%
|
||||||
|
|
@ -8956,7 +8894,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
\tokenafterxref ,% @NL
|
\tokenafterxref ,% @NL
|
||||||
\else\ifx\tie\tokenafterxref ,% @tie
|
\else\ifx\tie\tokenafterxref ,% @tie
|
||||||
\fi\fi\fi\fi\fi\fi
|
\fi\fi\fi\fi\fi\fi
|
||||||
\fi
|
}{}%
|
||||||
\fi\fi
|
\fi\fi
|
||||||
\fi
|
\fi
|
||||||
\endlink
|
\endlink
|
||||||
|
|
@ -9604,7 +9542,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
|
||||||
%
|
%
|
||||||
\def\caption{\docaption\thiscaption}
|
\def\caption{\docaption\thiscaption}
|
||||||
\def\shortcaption{\docaption\thisshortcaption}
|
\def\shortcaption{\docaption\thisshortcaption}
|
||||||
\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
|
\def\docaption{\checkenv\float \bgroup\scanctxt\defcaption}
|
||||||
\def\defcaption#1#2{\egroup \def#1{#2}}
|
\def\defcaption#1#2{\egroup \def#1{#2}}
|
||||||
|
|
||||||
% The parameter is the control sequence identifying the counter we are
|
% The parameter is the control sequence identifying the counter we are
|
||||||
|
|
@ -10324,9 +10262,9 @@ directory should work if nowhere else does.}
|
||||||
% Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
|
% Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
|
||||||
% to the corresponding UTF-8 sequence.
|
% to the corresponding UTF-8 sequence.
|
||||||
\gdef\parseXMLCharref{%
|
\gdef\parseXMLCharref{%
|
||||||
\ifnum\countUTFz < "A0\relax
|
\ifnum\countUTFz < "20\relax
|
||||||
\errhelp = \EMsimple
|
\errhelp = \EMsimple
|
||||||
\errmessage{Cannot define Unicode char value < 00A0}%
|
\errmessage{Cannot define Unicode char value < 0020}%
|
||||||
\else\ifnum\countUTFz < "800\relax
|
\else\ifnum\countUTFz < "800\relax
|
||||||
\parseUTFviiiA,%
|
\parseUTFviiiA,%
|
||||||
\parseUTFviiiB C\UTFviiiTwoOctetsName.,%
|
\parseUTFviiiB C\UTFviiiTwoOctetsName.,%
|
||||||
|
|
@ -10396,6 +10334,103 @@ directory should work if nowhere else does.}
|
||||||
% least make most of the characters not bomb out.
|
% least make most of the characters not bomb out.
|
||||||
%
|
%
|
||||||
\def\unicodechardefs{%
|
\def\unicodechardefs{%
|
||||||
|
\DeclareUnicodeCharacter{0020}{ } % space
|
||||||
|
\DeclareUnicodeCharacter{0021}{\char"21 }% % space to terminate number
|
||||||
|
\DeclareUnicodeCharacter{0022}{\char"22 }%
|
||||||
|
\DeclareUnicodeCharacter{0023}{\char"23 }%
|
||||||
|
\DeclareUnicodeCharacter{0024}{\char"24 }%
|
||||||
|
\DeclareUnicodeCharacter{0025}{\char"25 }%
|
||||||
|
\DeclareUnicodeCharacter{0026}{\char"26 }%
|
||||||
|
\DeclareUnicodeCharacter{0027}{\char"27 }%
|
||||||
|
\DeclareUnicodeCharacter{0028}{\char"28 }%
|
||||||
|
\DeclareUnicodeCharacter{0029}{\char"29 }%
|
||||||
|
\DeclareUnicodeCharacter{002A}{\char"2A }%
|
||||||
|
\DeclareUnicodeCharacter{002B}{\char"2B }%
|
||||||
|
\DeclareUnicodeCharacter{002C}{\char"2C }%
|
||||||
|
\DeclareUnicodeCharacter{002D}{\char"2D }%
|
||||||
|
\DeclareUnicodeCharacter{002E}{\char"2E }%
|
||||||
|
\DeclareUnicodeCharacter{002F}{\char"2F }%
|
||||||
|
\DeclareUnicodeCharacter{0030}{0}%
|
||||||
|
\DeclareUnicodeCharacter{0031}{1}%
|
||||||
|
\DeclareUnicodeCharacter{0032}{2}%
|
||||||
|
\DeclareUnicodeCharacter{0033}{3}%
|
||||||
|
\DeclareUnicodeCharacter{0034}{4}%
|
||||||
|
\DeclareUnicodeCharacter{0035}{5}%
|
||||||
|
\DeclareUnicodeCharacter{0036}{6}%
|
||||||
|
\DeclareUnicodeCharacter{0037}{7}%
|
||||||
|
\DeclareUnicodeCharacter{0038}{8}%
|
||||||
|
\DeclareUnicodeCharacter{0039}{9}%
|
||||||
|
\DeclareUnicodeCharacter{003A}{\char"3A }%
|
||||||
|
\DeclareUnicodeCharacter{003B}{\char"3B }%
|
||||||
|
\DeclareUnicodeCharacter{003C}{\char"3C }%
|
||||||
|
\DeclareUnicodeCharacter{003D}{\char"3D }%
|
||||||
|
\DeclareUnicodeCharacter{003E}{\char"3E }%
|
||||||
|
\DeclareUnicodeCharacter{003F}{\char"3F }%
|
||||||
|
\DeclareUnicodeCharacter{0040}{\char"40 }%
|
||||||
|
\DeclareUnicodeCharacter{0041}{A}%
|
||||||
|
\DeclareUnicodeCharacter{0042}{B}%
|
||||||
|
\DeclareUnicodeCharacter{0043}{C}%
|
||||||
|
\DeclareUnicodeCharacter{0044}{D}%
|
||||||
|
\DeclareUnicodeCharacter{0045}{E}%
|
||||||
|
\DeclareUnicodeCharacter{0046}{F}%
|
||||||
|
\DeclareUnicodeCharacter{0047}{G}%
|
||||||
|
\DeclareUnicodeCharacter{0048}{H}%
|
||||||
|
\DeclareUnicodeCharacter{0049}{I}%
|
||||||
|
\DeclareUnicodeCharacter{004A}{J}%
|
||||||
|
\DeclareUnicodeCharacter{004B}{K}%
|
||||||
|
\DeclareUnicodeCharacter{004C}{L}%
|
||||||
|
\DeclareUnicodeCharacter{004D}{M}%
|
||||||
|
\DeclareUnicodeCharacter{004E}{N}%
|
||||||
|
\DeclareUnicodeCharacter{004F}{O}%
|
||||||
|
\DeclareUnicodeCharacter{0050}{P}%
|
||||||
|
\DeclareUnicodeCharacter{0051}{Q}%
|
||||||
|
\DeclareUnicodeCharacter{0052}{R}%
|
||||||
|
\DeclareUnicodeCharacter{0053}{S}%
|
||||||
|
\DeclareUnicodeCharacter{0054}{T}%
|
||||||
|
\DeclareUnicodeCharacter{0055}{U}%
|
||||||
|
\DeclareUnicodeCharacter{0056}{V}%
|
||||||
|
\DeclareUnicodeCharacter{0057}{W}%
|
||||||
|
\DeclareUnicodeCharacter{0058}{X}%
|
||||||
|
\DeclareUnicodeCharacter{0059}{Y}%
|
||||||
|
\DeclareUnicodeCharacter{005A}{Z}%
|
||||||
|
\DeclareUnicodeCharacter{005B}{\char"5B }%
|
||||||
|
\DeclareUnicodeCharacter{005C}{\char"5C }%
|
||||||
|
\DeclareUnicodeCharacter{005D}{\char"5D }%
|
||||||
|
\DeclareUnicodeCharacter{005E}{\char"5E }%
|
||||||
|
\DeclareUnicodeCharacter{005F}{\char"5F }%
|
||||||
|
\DeclareUnicodeCharacter{0060}{\char"60 }%
|
||||||
|
\DeclareUnicodeCharacter{0061}{a}%
|
||||||
|
\DeclareUnicodeCharacter{0062}{b}%
|
||||||
|
\DeclareUnicodeCharacter{0063}{c}%
|
||||||
|
\DeclareUnicodeCharacter{0064}{d}%
|
||||||
|
\DeclareUnicodeCharacter{0065}{e}%
|
||||||
|
\DeclareUnicodeCharacter{0066}{f}%
|
||||||
|
\DeclareUnicodeCharacter{0067}{g}%
|
||||||
|
\DeclareUnicodeCharacter{0068}{h}%
|
||||||
|
\DeclareUnicodeCharacter{0069}{i}%
|
||||||
|
\DeclareUnicodeCharacter{006A}{j}%
|
||||||
|
\DeclareUnicodeCharacter{006B}{k}%
|
||||||
|
\DeclareUnicodeCharacter{006C}{l}%
|
||||||
|
\DeclareUnicodeCharacter{006D}{m}%
|
||||||
|
\DeclareUnicodeCharacter{006E}{n}%
|
||||||
|
\DeclareUnicodeCharacter{006F}{o}%
|
||||||
|
\DeclareUnicodeCharacter{0070}{p}%
|
||||||
|
\DeclareUnicodeCharacter{0071}{q}%
|
||||||
|
\DeclareUnicodeCharacter{0072}{r}%
|
||||||
|
\DeclareUnicodeCharacter{0073}{s}%
|
||||||
|
\DeclareUnicodeCharacter{0074}{t}%
|
||||||
|
\DeclareUnicodeCharacter{0075}{u}%
|
||||||
|
\DeclareUnicodeCharacter{0076}{v}%
|
||||||
|
\DeclareUnicodeCharacter{0077}{w}%
|
||||||
|
\DeclareUnicodeCharacter{0078}{x}%
|
||||||
|
\DeclareUnicodeCharacter{0079}{y}%
|
||||||
|
\DeclareUnicodeCharacter{007A}{z}%
|
||||||
|
\DeclareUnicodeCharacter{007B}{\char"7B }%
|
||||||
|
\DeclareUnicodeCharacter{007C}{\char"7C }%
|
||||||
|
\DeclareUnicodeCharacter{007D}{\char"7D }%
|
||||||
|
\DeclareUnicodeCharacter{007E}{\char"7E }%
|
||||||
|
% \DeclareUnicodeCharacter{007F}{} % DEL
|
||||||
|
%
|
||||||
\DeclareUnicodeCharacter{00A0}{\tie}%
|
\DeclareUnicodeCharacter{00A0}{\tie}%
|
||||||
\DeclareUnicodeCharacter{00A1}{\exclamdown}%
|
\DeclareUnicodeCharacter{00A1}{\exclamdown}%
|
||||||
\DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
|
\DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
|
||||||
|
|
@ -11080,24 +11115,26 @@ directory should work if nowhere else does.}
|
||||||
% provide a definition macro to replace/pass-through a Unicode character
|
% provide a definition macro to replace/pass-through a Unicode character
|
||||||
%
|
%
|
||||||
\def\DeclareUnicodeCharacterNative#1#2{%
|
\def\DeclareUnicodeCharacterNative#1#2{%
|
||||||
\catcode"#1=\active
|
\ifnum"#1>"7F % only make non-ASCII chars active
|
||||||
\def\dodeclareunicodecharacternative##1##2##3{%
|
\catcode"#1=\active
|
||||||
|
\def\dodeclareunicodecharacternative##1##2##3{%
|
||||||
|
\begingroup
|
||||||
|
\uccode`\~="##2\relax
|
||||||
|
\uppercase{\gdef~}{%
|
||||||
|
\ifpassthroughchars
|
||||||
|
##1%
|
||||||
|
\else
|
||||||
|
##3%
|
||||||
|
\fi
|
||||||
|
}
|
||||||
|
\endgroup
|
||||||
|
}
|
||||||
\begingroup
|
\begingroup
|
||||||
\uccode`\~="##2\relax
|
\uccode`\.="#1\relax
|
||||||
\uppercase{\gdef~}{%
|
\uppercase{\def\UTFNativeTmp{.}}%
|
||||||
\ifpassthroughchars
|
\expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
|
||||||
##1%
|
|
||||||
\else
|
|
||||||
##3%
|
|
||||||
\fi
|
|
||||||
}
|
|
||||||
\endgroup
|
\endgroup
|
||||||
}
|
\fi
|
||||||
\begingroup
|
|
||||||
\uccode`\.="#1\relax
|
|
||||||
\uppercase{\def\UTFNativeTmp{.}}%
|
|
||||||
\expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
|
|
||||||
\endgroup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
% Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
|
% Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
|
||||||
|
|
@ -11276,7 +11313,7 @@ directory should work if nowhere else does.}
|
||||||
\textleading = 12.5pt
|
\textleading = 12.5pt
|
||||||
%
|
%
|
||||||
\internalpagesizes{160mm}{120mm}%
|
\internalpagesizes{160mm}{120mm}%
|
||||||
{\voffset}{\hoffset}%
|
{\voffset}{-11.4mm}%
|
||||||
{\bindingoffset}{8pt}%
|
{\bindingoffset}{8pt}%
|
||||||
{210mm}{148mm}%
|
{210mm}{148mm}%
|
||||||
%
|
%
|
||||||
|
|
@ -11358,6 +11395,7 @@ directory should work if nowhere else does.}
|
||||||
\message{and turning on texinfo input format.}
|
\message{and turning on texinfo input format.}
|
||||||
|
|
||||||
\def^^L{\par} % remove \outer, so ^L can appear in an @comment
|
\def^^L{\par} % remove \outer, so ^L can appear in an @comment
|
||||||
|
\catcode`\^^K = 10 % treat vertical tab as whitespace
|
||||||
|
|
||||||
% DEL is a comment character, in case @c does not suffice.
|
% DEL is a comment character, in case @c does not suffice.
|
||||||
\catcode`\^^? = 14
|
\catcode`\^^? = 14
|
||||||
|
|
|
||||||
194
lib/tempname.c
194
lib/tempname.c
|
|
@ -20,16 +20,10 @@
|
||||||
# include "tempname.h"
|
# include "tempname.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifndef P_tmpdir
|
|
||||||
# define P_tmpdir "/tmp"
|
|
||||||
#endif
|
|
||||||
#ifndef TMP_MAX
|
#ifndef TMP_MAX
|
||||||
# define TMP_MAX 238328
|
# define TMP_MAX 238328
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -43,27 +37,23 @@
|
||||||
# error report this to bug-gnulib@gnu.org
|
# error report this to bug-gnulib@gnu.org
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdalign.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/random.h>
|
#include <sys/random.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#if _LIBC
|
#if _LIBC
|
||||||
# define struct_stat64 struct stat64
|
# define struct_stat64 struct __stat64_t64
|
||||||
# define __secure_getenv __libc_secure_getenv
|
|
||||||
#else
|
#else
|
||||||
# define struct_stat64 struct stat
|
# define struct_stat64 struct stat
|
||||||
# define __gen_tempname gen_tempname
|
# define __gen_tempname gen_tempname
|
||||||
# define __mkdir mkdir
|
# define __mkdir mkdir
|
||||||
# define __open open
|
# define __open open
|
||||||
# define __lstat64(file, buf) lstat (file, buf)
|
# define __lstat64_time64(file, buf) lstat (file, buf)
|
||||||
# define __stat64(file, buf) stat (file, buf)
|
|
||||||
# define __getrandom getrandom
|
# define __getrandom getrandom
|
||||||
# define __clock_gettime64 clock_gettime
|
# define __clock_gettime64 clock_gettime
|
||||||
# define __timespec64 timespec
|
# define __timespec64 timespec
|
||||||
|
|
@ -77,101 +67,57 @@ typedef uint_fast64_t random_value;
|
||||||
#define BASE_62_DIGITS 10 /* 62**10 < UINT_FAST64_MAX */
|
#define BASE_62_DIGITS 10 /* 62**10 < UINT_FAST64_MAX */
|
||||||
#define BASE_62_POWER (62LL * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62)
|
#define BASE_62_POWER (62LL * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62)
|
||||||
|
|
||||||
#if _LIBC || (defined CLOCK_MONOTONIC && HAVE_CLOCK_GETTIME)
|
/* Return the result of mixing the entropy from R and S.
|
||||||
# define HAS_CLOCK_ENTROPY true
|
Assume that R and S are not particularly random,
|
||||||
#else
|
and that the result should look randomish to an untrained eye. */
|
||||||
# define HAS_CLOCK_ENTROPY false
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static random_value
|
static random_value
|
||||||
random_bits (random_value var, bool use_getrandom)
|
mix_random_values (random_value r, random_value s)
|
||||||
|
{
|
||||||
|
/* As this code is used only when high-quality randomness is neither
|
||||||
|
available nor necessary, there is no need for fancier polynomials
|
||||||
|
such as those in the Linux kernel's 'random' driver. */
|
||||||
|
return (2862933555777941757 * r + 3037000493) ^ s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set *R to a random value.
|
||||||
|
Return true if *R is set to high-quality value taken from getrandom.
|
||||||
|
Otherwise return false, falling back to a low-quality *R that might
|
||||||
|
depend on S.
|
||||||
|
|
||||||
|
This function returns false only when getrandom fails.
|
||||||
|
On GNU systems this should happen only early in the boot process,
|
||||||
|
when the fallback should be good enough for programs using tempname
|
||||||
|
because any attacker likely has root privileges already. */
|
||||||
|
|
||||||
|
static bool
|
||||||
|
random_bits (random_value *r, random_value s)
|
||||||
{
|
{
|
||||||
random_value r;
|
|
||||||
/* Without GRND_NONBLOCK it can be blocked for minutes on some systems. */
|
/* Without GRND_NONBLOCK it can be blocked for minutes on some systems. */
|
||||||
if (use_getrandom && __getrandom (&r, sizeof r, GRND_NONBLOCK) == sizeof r)
|
if (__getrandom (r, sizeof *r, GRND_NONBLOCK) == sizeof *r)
|
||||||
return r;
|
return true;
|
||||||
#if HAS_CLOCK_ENTROPY
|
|
||||||
/* Add entropy if getrandom did not work. */
|
/* If getrandom did not work, use ersatz entropy based on low-order
|
||||||
|
clock bits. On GNU systems getrandom should fail only
|
||||||
|
early in booting, when ersatz should be good enough.
|
||||||
|
Do not use ASLR-based entropy, as that would leak ASLR info into
|
||||||
|
the resulting file name which is typically public.
|
||||||
|
|
||||||
|
Of course we are in a state of sin here. */
|
||||||
|
|
||||||
|
random_value v = s;
|
||||||
|
|
||||||
|
#if _LIBC || (defined CLOCK_REALTIME && HAVE_CLOCK_GETTIME)
|
||||||
struct __timespec64 tv;
|
struct __timespec64 tv;
|
||||||
__clock_gettime64 (CLOCK_MONOTONIC, &tv);
|
__clock_gettime64 (CLOCK_REALTIME, &tv);
|
||||||
var ^= tv.tv_nsec;
|
v = mix_random_values (v, tv.tv_sec);
|
||||||
|
v = mix_random_values (v, tv.tv_nsec);
|
||||||
#endif
|
#endif
|
||||||
return 2862933555777941757 * var + 3037000493;
|
|
||||||
|
*r = mix_random_values (v, clock ());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _LIBC
|
|
||||||
/* Return nonzero if DIR is an existent directory. */
|
|
||||||
static int
|
|
||||||
direxists (const char *dir)
|
|
||||||
{
|
|
||||||
struct_stat64 buf;
|
|
||||||
return __stat64 (dir, &buf) == 0 && S_ISDIR (buf.st_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
|
|
||||||
non-null and exists, uses it; otherwise uses the first of $TMPDIR,
|
|
||||||
P_tmpdir, /tmp that exists. Copies into TMPL a template suitable
|
|
||||||
for use with mk[s]temp. Will fail (-1) if DIR is non-null and
|
|
||||||
doesn't exist, none of the searched dirs exists, or there's not
|
|
||||||
enough space in TMPL. */
|
|
||||||
int
|
|
||||||
__path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
|
|
||||||
int try_tmpdir)
|
|
||||||
{
|
|
||||||
const char *d;
|
|
||||||
size_t dlen, plen;
|
|
||||||
|
|
||||||
if (!pfx || !pfx[0])
|
|
||||||
{
|
|
||||||
pfx = "file";
|
|
||||||
plen = 4;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plen = strlen (pfx);
|
|
||||||
if (plen > 5)
|
|
||||||
plen = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (try_tmpdir)
|
|
||||||
{
|
|
||||||
d = __secure_getenv ("TMPDIR");
|
|
||||||
if (d != NULL && direxists (d))
|
|
||||||
dir = d;
|
|
||||||
else if (dir != NULL && direxists (dir))
|
|
||||||
/* nothing */ ;
|
|
||||||
else
|
|
||||||
dir = NULL;
|
|
||||||
}
|
|
||||||
if (dir == NULL)
|
|
||||||
{
|
|
||||||
if (direxists (P_tmpdir))
|
|
||||||
dir = P_tmpdir;
|
|
||||||
else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
|
|
||||||
dir = "/tmp";
|
|
||||||
else
|
|
||||||
{
|
|
||||||
__set_errno (ENOENT);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dlen = strlen (dir);
|
|
||||||
while (dlen > 1 && dir[dlen - 1] == '/')
|
|
||||||
dlen--; /* remove trailing slashes */
|
|
||||||
|
|
||||||
/* check we have room for "${dir}/${pfx}XXXXXX\0" */
|
|
||||||
if (tmpl_len < dlen + 1 + plen + 6 + 1)
|
|
||||||
{
|
|
||||||
__set_errno (EINVAL);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* _LIBC */
|
|
||||||
|
|
||||||
#if _LIBC
|
#if _LIBC
|
||||||
static int try_tempname_len (char *, int, void *, int (*) (char *, void *),
|
static int try_tempname_len (char *, int, void *, int (*) (char *, void *),
|
||||||
size_t);
|
size_t);
|
||||||
|
|
@ -197,7 +143,7 @@ try_nocreate (char *tmpl, _GL_UNUSED void *flags)
|
||||||
{
|
{
|
||||||
struct_stat64 st;
|
struct_stat64 st;
|
||||||
|
|
||||||
if (__lstat64 (tmpl, &st) == 0 || errno == EOVERFLOW)
|
if (__lstat64_time64 (tmpl, &st) == 0 || errno == EOVERFLOW)
|
||||||
__set_errno (EEXIST);
|
__set_errno (EEXIST);
|
||||||
return errno == ENOENT ? 0 : -1;
|
return errno == ENOENT ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
@ -267,32 +213,17 @@ try_tempname_len (char *tmpl, int suffixlen, void *args,
|
||||||
unsigned int attempts = ATTEMPTS_MIN;
|
unsigned int attempts = ATTEMPTS_MIN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* A random variable. The initial value is used only the for fallback path
|
/* A random variable. */
|
||||||
on 'random_bits' on 'getrandom' failure. Its initial value tries to use
|
random_value v = 0;
|
||||||
some entropy from the ASLR and ignore possible bits from the stack
|
|
||||||
alignment. */
|
|
||||||
random_value v = ((uintptr_t) &v) / alignof (max_align_t);
|
|
||||||
|
|
||||||
#if !HAS_CLOCK_ENTROPY
|
/* A value derived from the random variable, and how many random
|
||||||
/* Arrange gen_tempname to return less predictable file names on
|
base-62 digits can currently be extracted from VDIGBUF. */
|
||||||
systems lacking clock entropy <https://bugs.gnu.org/57129>. */
|
random_value vdigbuf;
|
||||||
static random_value prev_v;
|
|
||||||
v ^= prev_v;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* How many random base-62 digits can currently be extracted from V. */
|
|
||||||
int vdigits = 0;
|
int vdigits = 0;
|
||||||
|
|
||||||
/* Whether to consume entropy when acquiring random bits. On the
|
/* Least biased value for V. If V is less than this, V can generate
|
||||||
first try it's worth the entropy cost with __GT_NOCREATE, which
|
BASE_62_DIGITS unbiased digits. Otherwise the digits are biased. */
|
||||||
is inherently insecure and can use the entropy to make it a bit
|
random_value const biased_min
|
||||||
more secure. On the (rare) second and later attempts it might
|
|
||||||
help against DoS attacks. */
|
|
||||||
bool use_getrandom = tryfunc == try_nocreate;
|
|
||||||
|
|
||||||
/* Least unfair value for V. If V is less than this, V can generate
|
|
||||||
BASE_62_DIGITS digits fairly. Otherwise it might be biased. */
|
|
||||||
random_value const unfair_min
|
|
||||||
= RANDOM_VALUE_MAX - RANDOM_VALUE_MAX % BASE_62_POWER;
|
= RANDOM_VALUE_MAX - RANDOM_VALUE_MAX % BASE_62_POWER;
|
||||||
|
|
||||||
len = strlen (tmpl);
|
len = strlen (tmpl);
|
||||||
|
|
@ -312,18 +243,16 @@ try_tempname_len (char *tmpl, int suffixlen, void *args,
|
||||||
{
|
{
|
||||||
if (vdigits == 0)
|
if (vdigits == 0)
|
||||||
{
|
{
|
||||||
do
|
/* Worry about bias only if the bits are high quality. */
|
||||||
{
|
while (random_bits (&v, v) && biased_min <= v)
|
||||||
v = random_bits (v, use_getrandom);
|
continue;
|
||||||
use_getrandom = true;
|
|
||||||
}
|
|
||||||
while (unfair_min <= v);
|
|
||||||
|
|
||||||
|
vdigbuf = v;
|
||||||
vdigits = BASE_62_DIGITS;
|
vdigits = BASE_62_DIGITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
XXXXXX[i] = letters[v % 62];
|
XXXXXX[i] = letters[vdigbuf % 62];
|
||||||
v /= 62;
|
vdigbuf /= 62;
|
||||||
vdigits--;
|
vdigits--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -331,9 +260,6 @@ try_tempname_len (char *tmpl, int suffixlen, void *args,
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
{
|
{
|
||||||
__set_errno (save_errno);
|
__set_errno (save_errno);
|
||||||
#if !HAS_CLOCK_ENTROPY
|
|
||||||
prev_v = v;
|
|
||||||
#endif
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
else if (errno != EEXIST)
|
else if (errno != EEXIST)
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,8 @@ AC_DEFUN([gl_COMMON_BODY], [
|
||||||
#else
|
#else
|
||||||
# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
|
# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
|
||||||
#endif
|
#endif
|
||||||
/* Alternative spelling of this macro, for convenience. */
|
/* Alternative spelling of this macro, for convenience and for
|
||||||
|
compatibility with glibc/include/libc-symbols.h. */
|
||||||
#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
|
#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
|
||||||
/* Earlier spellings of this macro. */
|
/* Earlier spellings of this macro. */
|
||||||
#define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED
|
#define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue