summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-10-01 22:02:30 +0000
committerKarl Berry <karl@freefriends.org>2015-10-01 22:02:30 +0000
commit32e22e34d4214466a3051adf47ffd4334b7b28d5 (patch)
tree52d0cf75f3932d84e9ba31a73328e5c5aceda11f /Master
parent79239bc6a14e7f5723e2027696b349d1f8cc11c9 (diff)
ctablestack (1oct15)
git-svn-id: svn://tug.org/texlive/trunk@38514 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/luatex/ctablestack/README.md4
-rw-r--r--Master/texmf-dist/doc/luatex/ctablestack/ctablestack.pdfbin0 -> 151121 bytes
-rw-r--r--Master/texmf-dist/source/luatex/ctablestack/ctablestack.dtx207
-rw-r--r--Master/texmf-dist/source/luatex/ctablestack/ctablestack.ins10
-rw-r--r--Master/texmf-dist/tex/luatex/ctablestack/ctablestack.sty59
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rw-r--r--Master/tlpkg/tlpsrc/collection-luatex.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/ctablestack.tlpsrc0
8 files changed, 282 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/luatex/ctablestack/README.md b/Master/texmf-dist/doc/luatex/ctablestack/README.md
new file mode 100644
index 00000000000..6f9e145f268
--- /dev/null
+++ b/Master/texmf-dist/doc/luatex/ctablestack/README.md
@@ -0,0 +1,4 @@
+This package provides a stack system for category code tables in LuaTeX.
+The code here builds on the LaTeX kernel support for LuaTeX (LaTeX2e
+2015/10/01 onward), which is also available as `ltluatex.tex` for plain
+TeX users and those with older LaTeX kernel implementations.
diff --git a/Master/texmf-dist/doc/luatex/ctablestack/ctablestack.pdf b/Master/texmf-dist/doc/luatex/ctablestack/ctablestack.pdf
new file mode 100644
index 00000000000..b083b9e3fc5
--- /dev/null
+++ b/Master/texmf-dist/doc/luatex/ctablestack/ctablestack.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/luatex/ctablestack/ctablestack.dtx b/Master/texmf-dist/source/luatex/ctablestack/ctablestack.dtx
new file mode 100644
index 00000000000..63a3260a37d
--- /dev/null
+++ b/Master/texmf-dist/source/luatex/ctablestack/ctablestack.dtx
@@ -0,0 +1,207 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2015 David Carlisle and Joseph Wright
+%
+% It may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License (LPPL), either version 1.3c of
+% this license or (at your option) any later version. The latest
+% version of this license is in the file:
+%
+% http://www.latex-project.org/lppl.txt
+%
+%<package>\ifx
+%<package> \ProvidesPackage\undefined\begingroup\def\ProvidesPackage
+%<package> #1#2[#3]{\endgroup\immediate\write-1{Package: #1 #3}}
+%<package>\fi
+%<package>\ProvidesPackage{ctablestack}
+%<*driver>
+\ProvidesFile{ctablestack.dtx}
+%</driver>
+%<*package>
+ [2015/10/01 v1.0 Catcode table stable support]
+%</package>
+%<*driver>
+\documentclass{ltxdoc}
+\GetFileInfo{ctablestack.dtx}
+\begin{document}
+\title{\filename\\Catcode table stable support}
+\author{David Carlisle and Joseph Wright}
+\date{\filedate}
+\maketitle
+\setcounter{tocdepth}{2}
+\tableofcontents
+\DocInput{\filename}
+\end{document}
+%</driver>
+% \fi
+%
+% \section{Overview}
+%
+% This small package adds support for a stack of category code tables to
+% the core support for Lua\TeX{} provided by the \LaTeX{} kernel and
+% available for plain users as |ltluatex.tex|. As such, the
+% code here may be used with both plain \TeX{} and \LaTeX{}, and requires
+% either an up-to-date \LaTeX{} kernel (2016 onward), use of \textsf{latexrelease}
+% with older kernels or loading |ltluatex.tex| for plain users.
+%
+% The commands here are aimed mainly for use by package authors to develop
+% environments needing specific catcode regimes. As such the package does
+% not define any user level commands.
+%
+% \noindent
+% \DescribeMacro{\@setrangecatcode}
+% |\@setrangecatcode{|\meta{start}|}{|\meta{end}|}{|\meta{catcode}|}|\\
+% Sets all characters in the range \meta{start}--\meta{end} inclusive to
+% have the \meta{catcode} specified.
+%
+% \noindent
+% \DescribeMacro{\@pushcatcodetable}
+% \DescribeMacro{\@popcatcodetable}
+% |\@pushcatcodetable|\\
+% |\@popcatcodetable|\\
+% This pair of commands enable the current category code r\'{e}gime to
+% be saved and restored meaning that arbitrary catcode changes can be made.
+% This functionality will normally be used in concert with applying
+% catcode tables. For example
+% \begin{verbatim}
+% \catcode`\Z=4 %
+% \@pushcatcodetable
+% \catcodetable\catcodetable@latex
+% % Code here
+% \@popcatcodetable
+% \showthe\catcode`\Z
+% \end{verbatim}
+% will ensure that the `content' is set with normal category codes but
+% allow restoration of the non-standard codes at the conclusion. Importantly,
+% it does not require that anything is known about the catcode situation in
+% advance (\emph{cf.}~a more traditional approach to saving the state of
+% targeting characters).
+%
+% \StopEventually{}
+%
+% \section{Implementation}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%
+% \begin{macrocode}
+\edef\ctstackatcatcode{\the\catcode`\@}
+\catcode`\@=11
+% \end{macrocode}
+%
+% Check for \textsf{ltluatex} functionality using \cs{newluafunction} as a marker.
+% \begin{macrocode}
+\ifx\newluafunction\@undefined
+ \input{ltluatex}%
+\fi
+% \end{macrocode}
+%
+% \begin{macro}{\@setcatcodetable}
+% Save a catcode table specified in |#1| using the catcode settings specified in |#2|.
+% These settings are executed in a local group to avoid affecting surrounding code.
+% (Saving a catcode table is always a global operation.)
+% \begin{macrocode}1
+\def\@setcatcodetable#1#2{%
+ \begingroup
+ #2%
+ \savecatcodetable#1%
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@setrangecatcode}
+% Set a range of characters from |#1| to |#2| inclusive to the catcode specified in |#3|.
+% \begin{macrocode}
+\def\@setrangecatcode#1#2#3{%
+ \ifnum#1>#2 %
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+ {%
+ \catcode#1=#3 %
+ \expandafter\@setrangecatcode\expandafter
+ {\number\numexpr#1+1\relax}{#2}{#3}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@catcodetablelist}
+% \begin{macro}{\@catcodetablestack}
+% Data structures for a stack: a list of free tables in the stack and
+% the stack record itself.
+% \begin{macrocode}
+\def\@catcodetablelist{}
+\def\@catcodetablestack{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@catcodetablestackcnt}
+% A count for adding to the list of scratch tables.
+% \begin{macrocode}
+\newcount\@catcodetablestackcnt
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@pushcatcodetable}
+% \begin{macro}{\@pushctbl}
+% To push a table, first check there is a free one in the pool and if
+% not create one. Then take the top table in the pool and use it to save
+% the current table.
+% \begin{macrocode}
+\def\@pushcatcodetable{%
+ \ifx\@catcodetablelist\empty
+ \global\advance\@catcodetablestackcnt by\@ne
+ \edef\@tempa{\csname ct@\the\@catcodetablestackcnt\endcsname}%
+ \expandafter\newcatcodetable\@tempa
+ \xdef\@catcodetablelist{\@tempa}%
+ \fi
+ \expandafter\@pushctbl\@catcodetablelist\@nil
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\@pushctbl#1#2\@nil{%
+ \gdef\@catcodetablelist{#2}%
+ \xdef\@catcodetablestack{#1\@catcodetablestack}%
+ \savecatcodetable#1%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@popcatcodetable}
+% \begin{macro}{\@popctbl}
+% Much the same in reverse.
+% \begin{macrocode}
+\def\@popcatcodetable{%
+ \if!\@catcodetablestack!%
+ \errmessage{Attempt to pop empty catcodetable stack}%
+ \else
+ \expandafter\@popctbl\@catcodetablestack\@nil
+ \fi
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\@popctbl#1#2\@nil{%
+ \gdef\@catcodetablestack{#2}%
+ \xdef\@catcodetablelist{\@catcodetablelist#1}%
+ \catcodetable#1%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+\catcode`\@\ctstackatcatcode\relax
+% \end{macrocode}
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \Finale
diff --git a/Master/texmf-dist/source/luatex/ctablestack/ctablestack.ins b/Master/texmf-dist/source/luatex/ctablestack/ctablestack.ins
new file mode 100644
index 00000000000..3da7318eedf
--- /dev/null
+++ b/Master/texmf-dist/source/luatex/ctablestack/ctablestack.ins
@@ -0,0 +1,10 @@
+\input docstrip
+\keepsilent
+\nopreamble
+\nopostamble
+
+\askforoverwritefalse
+
+\generate{\file{ctablestack.sty}{\from{ctablestack.dtx}{package}}}
+
+\endbatchfile
diff --git a/Master/texmf-dist/tex/luatex/ctablestack/ctablestack.sty b/Master/texmf-dist/tex/luatex/ctablestack/ctablestack.sty
new file mode 100644
index 00000000000..0a118a124ef
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/ctablestack/ctablestack.sty
@@ -0,0 +1,59 @@
+\ifx
+ \ProvidesPackage\undefined\begingroup\def\ProvidesPackage
+ #1#2[#3]{\endgroup\immediate\write-1{Package: #1 #3}}
+\fi
+\ProvidesPackage{ctablestack}
+ [2015/10/01 v1.0 Catcode table stable support]
+\edef\ctstackatcatcode{\the\catcode`\@}
+\catcode`\@=11
+\ifx\newluafunction\@undefined
+ \input{ltluatex}%
+\fi
+\def\@setcatcodetable#1#2{%
+ \begingroup
+ #2%
+ \savecatcodetable#1%
+ \endgroup
+}
+\def\@setrangecatcode#1#2#3{%
+ \ifnum#1>#2 %
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+ {%
+ \catcode#1=#3 %
+ \expandafter\@setrangecatcode\expandafter
+ {\number\numexpr#1+1\relax}{#2}{#3}%
+ }%
+}
+\def\@catcodetablelist{}
+\def\@catcodetablestack{}
+\newcount\@catcodetablestackcnt
+\def\@pushcatcodetable{%
+ \ifx\@catcodetablelist\empty
+ \global\advance\@catcodetablestackcnt by\@ne
+ \edef\@tempa{\csname ct@\the\@catcodetablestackcnt\endcsname}%
+ \expandafter\newcatcodetable\@tempa
+ \xdef\@catcodetablelist{\@tempa}%
+ \fi
+ \expandafter\@pushctbl\@catcodetablelist\@nil
+}
+\def\@pushctbl#1#2\@nil{%
+ \gdef\@catcodetablelist{#2}%
+ \xdef\@catcodetablestack{#1\@catcodetablestack}%
+ \savecatcodetable#1%
+}
+\def\@popcatcodetable{%
+ \if!\@catcodetablestack!%
+ \errmessage{Attempt to pop empty catcodetable stack}%
+ \else
+ \expandafter\@popctbl\@catcodetablestack\@nil
+ \fi
+}
+\def\@popctbl#1#2\@nil{%
+ \gdef\@catcodetablestack{#2}%
+ \xdef\@catcodetablelist{\@catcodetablelist#1}%
+ \catcodetable#1%
+}
+\catcode`\@\ctstackatcatcode\relax
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 716c47abcd9..41efe11b494 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -162,7 +162,7 @@ my @TLP_working = qw(
cprotect
crbox crop crossreference crossrefware crossword crosswrd cryptocode cryst
cs csbulletin cslatex csplain csquotes csquotes-de csvsimple cstex
- ctan_chk ctanify ctanupload ctable ctex ctex-faq
+ ctan_chk ctanify ctanupload ctable ctablestack ctex ctex-faq
cursolatex cuisine
currfile currvita curve curve2e curves
custom-bib cutwin cv cv4tw cweb-latex
diff --git a/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc b/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
index 4cec0ec2719..886cfd801c6 100644
--- a/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
@@ -8,6 +8,7 @@ depend collection-basic
depend checkcites
depend chickenize
depend cloze
+depend ctablestack
depend enigma
depend interpreter
depend lua-check-hyphen
diff --git a/Master/tlpkg/tlpsrc/ctablestack.tlpsrc b/Master/tlpkg/tlpsrc/ctablestack.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/ctablestack.tlpsrc