summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/ctablestack
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/texmf-dist/tex/luatex/ctablestack
parent79239bc6a14e7f5723e2027696b349d1f8cc11c9 (diff)
ctablestack (1oct15)
git-svn-id: svn://tug.org/texlive/trunk@38514 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/ctablestack')
-rw-r--r--Master/texmf-dist/tex/luatex/ctablestack/ctablestack.sty59
1 files changed, 59 insertions, 0 deletions
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