diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/syst-cat.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/syst-cat.mkiv | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/syst-cat.mkiv b/Master/texmf-dist/tex/context/base/syst-cat.mkiv new file mode 100644 index 00000000000..46ee0f394db --- /dev/null +++ b/Master/texmf-dist/tex/context/base/syst-cat.mkiv @@ -0,0 +1,120 @@ +%D \module +%D [ file=syst-cat, +%D version=2006.09.18, +%D title=\CONTEXT\ System Macros, +%D subtitle=Catcode Handling, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +\def\newcatcodetable#1% + {\global\advance\cctdefcounter\plusone + \expandafter\xdef\csname @@ccn:\number\cctdefcounter\endcsname{\string#1}% logging + \global\mathchardef#1\cctdefcounter} + +\newcatcodetable \scratchcatcodetable \initcatcodetable\scratchcatcodetable + +\ifx\nilcatcodes \undefined \newcatcodetable \nilcatcodes \fi +\ifx\texcatcodes \undefined \newcatcodetable \texcatcodes \fi +\ifx\ctxcatcodes \undefined \newcatcodetable \ctxcatcodes \fi +\ifx\notcatcodes \undefined \newcatcodetable \notcatcodes \fi +\ifx\mthcatcodes \undefined \newcatcodetable \mthcatcodes \fi % brrr +\ifx\vrbcatcodes \undefined \newcatcodetable \vrbcatcodes \fi +\ifx\prtcatcodes \undefined \newcatcodetable \prtcatcodes \fi +\ifx\xmlcatcodesn\undefined \newcatcodetable \xmlcatcodesn \fi % normal +\ifx\xmlcatcodese\undefined \newcatcodetable \xmlcatcodese \fi % entitle +\ifx\xmlcatcodesr\undefined \newcatcodetable \xmlcatcodesr \fi % reduce + +\newtoks \setdefaultcatcodes + +\setdefaultcatcodes + {\catcode`\\ 12 + \catcode`\^^M 12 + \catcode`\ 12 + \catcode`\% 12 + \catcode127 12 } + +\long\def\startcatcodetable#1#2\stopcatcodetable + {\bgroup + \catcodetable\scratchcatcodetable + \the\setdefaultcatcodes + #2% + \savecatcodetable#1\relax + \egroup} + +\newcatcodetable\dummycatcodes + +% \long\def\startextendcatcodetable#1#2\stopextendcatcodetable +% {\bgroup +% \catcodetable#1\relax +% #2% +% \savecatcodetable\dummycatcodes +% \catcodetable\dummycatcodes +% \savecatcodetable#1\relax +% \egroup} + +\long\def\startextendcatcodetable#1#2\stopextendcatcodetable + {\bgroup + \catcodetable#1\relax + \globaldefs\plusone + #2% + \globaldefs\zerocount + \egroup} + +% == +% +% \long\def\startextendcatcodetable#1#2\stopextendcatcodetable +% {\bgroup +% \scratchcounter\the\catcodetable +% \catcodetable #1 #2 +% \catcodetable\scratchcounter +% \egroup} + +\def\letcatcodecommand + {\afterassignment\letcatcodecommanda\cctcountera} + +\def\letcatcodecommanda + {\afterassignment\letcatcodecommandb\cctcounterb} + +% construct the definition in lua +% +% \def\letcatcodecommandb +% {\scratchcounter\catcode\cctcounterb \catcode\cctcounterb=13 +% \directlua\CTXlua{tex.print(tex.texcatcodes,"\\xdef " .. string.char(\number\cctcounterb) +% .. "{\\noexpand\\catcodecommand{\number\cctcounterb}}")}% +% \catcode\cctcounterb\scratchcounter +% \expandafter\let\csname cc:\number\cctcountera:\number\cctcounterb\endcsname} +% +% or less messy: +% +% \def\letcatcodecommandb +% {\chardef\savedcctcode\catcode\cctcounterb +% \catcode\cctcounterb=13 +% \expandafter\edef\directlua\CTXlua{tex.sprint(tex.texcatcodes,string.char(\number\cctcounterb))}% +% {\noexpand\catcodecommand{\number\cctcounterb}}% +% \catcode\cctcounterb\savedcctcode +% \expandafter\let\csname cc:\number\cctcountera:\number\cctcounterb\endcsname} + +\let\currentcatcodetable\catcodetable + +\startruntimectxluacode + tex.nilcatcodes = \number\nilcatcodes ; + tex.texcatcodes = \number\texcatcodes ; + tex.ctxcatcodes = \number\ctxcatcodes ; + tex.notcatcodes = \number\notcatcodes ; + tex.mthcatcodes = \number\mthcatcodes ; + tex.vrbcatcodes = \number\vrbcatcodes ; + tex.prtcatcodes = \number\prtcatcodes ; + tex.xmlcatcodes = \number\xmlcatcodesn ; + tex.xmlcatcodesn = \number\xmlcatcodesn ; % normal + tex.xmlcatcodese = \number\xmlcatcodese ; % entitle + tex.xmlcatcodesr = \number\xmlcatcodesr ; % reduce +\stopruntimectxluacode + +\protect \endinput |