diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/catc-ini.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/catc-ini.mkiv | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/Master/texmf-dist/tex/context/base/catc-ini.mkiv b/Master/texmf-dist/tex/context/base/catc-ini.mkiv index 668a55d3bdd..269330a1bbd 100644 --- a/Master/texmf-dist/tex/context/base/catc-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/catc-ini.mkiv @@ -70,7 +70,7 @@ \catcode`\% \othercatcode \catcode127 \othercatcode} -\long\def\startcatcodetable#1#2\stopcatcodetable +\long\normalprotected\def\startcatcodetable#1#2\stopcatcodetable {\bgroup \catcodetable\scratchcatcodes \the\setdefaultcatcodes @@ -80,7 +80,7 @@ \newcatcodetable\dummycatcodes -\long\def\startextendcatcodetable#1#2\stopextendcatcodetable +\long\normalprotected\def\startextendcatcodetable#1#2\stopextendcatcodetable {\bgroup \catcodetable#1\relax \globaldefs\plusone @@ -90,7 +90,7 @@ % == % -% \long\def\startextendcatcodetable#1#2\stopextendcatcodetable +% \long\normalprotected\def\startextendcatcodetable#1#2\stopextendcatcodetable % {\bgroup % \scratchcounter\the\catcodetable % \catcodetable #1 #2 @@ -107,7 +107,9 @@ %D The next command can be defined in a cleaner way in the %D Mk IV file but we want to have a fast one with a minimal -%D chance for interference. +%D chance for interference. Do we still need this complex +%D mechanism? Future versions of \MKIV\ might only use +%D active characters for very special cases. \chardef\activehackcode=`\~ @@ -128,7 +130,7 @@ \def\letcatcodecommandc % only first time {\expandafter\gdef\csname CCL:\number\cctcountera:\number\cctcounterb\expandafter\endcsname\expandafter {\expandafter\let\csname CCC:\number\cctcountera:\number\cctcounterb\endcsname}% - \reinstatecatcodecommanda + \reinstatecatcodecommandua % unexpanded \csname CCL:\number\cctcountera:\number\cctcounterb\endcsname} % expandable def @@ -165,8 +167,8 @@ \def\uedcatcodecommandc % only first time {\expandafter\gdef\csname CCU:\number\cctcountera:\number\cctcounterb\expandafter\endcsname \expandafter##\expandafter1\expandafter - {\expandafter\unexpanded\expandafter\def\csname CCC:\number\cctcountera:\number\cctcounterb\endcsname{##1}}% - \reinstatecatcodecommanda + {\expandafter\normalprotected\expandafter\def\csname CCC:\number\cctcountera:\number\cctcounterb\endcsname{##1}}% + \reinstatecatcodecommandua % unexpanded \csname CCU:\number\cctcountera:\number\cctcounterb\endcsname} \def\reinstatecatcodecommand{\afterassignment\reinstatecatcodecommanda\cctcounterb} @@ -178,6 +180,13 @@ \uppercase{\xdef~{\noexpand\catcodecommand{\number\cctcounterb}}}% \egroup} +\def\reinstatecatcodecommandua % can be used when a direct definition has been done + {\bgroup % and the selector has been lost + \uccode\activehackcode\cctcounterb + \catcode\uccode\activehackcode\activecatcode + \uppercase{\normalprotected\xdef~{\noexpand\catcodecommand{\number\cctcounterb}}}% + \egroup} + \chardef\defaultcatcodetable\zerocount \def\catcodecommand#1% @@ -270,5 +279,39 @@ % \tracecatcodetables +%D Only in \MKIV\ (to be used when crossing pages with changed catcodes +%D in the current vector): +%D +%D \starttyping +%D \normalprotected\def\startcrap +%D {\bgroup +%D \pushcatcodes +%D \whitespace +%D \obeylines +%D \activatespacehandler\v!yes +%D \strut} +%D +%D \normalprotected\def\stopcrap +%D {\popcatcodes +%D \egroup} +%D \stoptyping + +\newcount\catcodetablelevel + +\def\pushcatcodes + {\bgroup + \global\advance\catcodetablelevel\plusone + \ifcsname @@ccf:\number\catcodetablelevel\endcsname \else + \global\advance\cctdefcounter\plusone + \expandafter\global\expandafter\chardef\csname @@ccf:\number\catcodetablelevel\endcsname\cctdefcounter + \fi + \catcodetable\ctxcatcodes + \expandafter\savecatcodetable\csname @@ccf:\number\catcodetablelevel\endcsname + \egroup + \expandafter\catcodetable\csname @@ccf:\number\catcodetablelevel\endcsname} + +\def\popcatcodes + {\global\advance\catcodetablelevel\minusone} + \endinput |