diff options
author | Hans Hagen <pragma@wxs.nl> | 2007-08-07 01:37:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2007-08-07 01:37:00 +0200 |
commit | aacdde41ef02392949aee16b2e428a8913d27efe (patch) | |
tree | 1ca125418e41b0335ee115a24cf27acb8fa7eae9 /tex/context/base/syst-cat.mkiv | |
parent | dbcaab8b8f76309b9fc4e05bf8a42f6b56e61893 (diff) | |
download | context-aacdde41ef02392949aee16b2e428a8913d27efe.tar.gz |
stable 2007.08.07 01:37
Diffstat (limited to 'tex/context/base/syst-cat.mkiv')
-rw-r--r-- | tex/context/base/syst-cat.mkiv | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/tex/context/base/syst-cat.mkiv b/tex/context/base/syst-cat.mkiv new file mode 100644 index 000000000..6f3f605b8 --- /dev/null +++ b/tex/context/base/syst-cat.mkiv @@ -0,0 +1,116 @@ +%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\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.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 |