diff options
author | Marius <mariausol@gmail.com> | 2010-09-08 15:27:58 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2010-09-08 15:27:58 +0300 |
commit | 821d6141a92d80d6195b87fe1c25fb2fd83042d5 (patch) | |
tree | 53f8c98927a0435184c3ae40324cfdc996e8bd4a | |
parent | 16895587e51f8243a7e4dc6185979894fb199d4f (diff) | |
download | context-821d6141a92d80d6195b87fe1c25fb2fd83042d5.tar.gz |
beta 2010.09.05 13:23
124 files changed, 1263 insertions, 1580 deletions
diff --git a/tex/context/base/anch-pgr.mkiv b/tex/context/base/anch-pgr.mkiv index 8c6065305..2b63ade6f 100644 --- a/tex/context/base/anch-pgr.mkiv +++ b/tex/context/base/anch-pgr.mkiv @@ -1289,9 +1289,9 @@ \graphicvadjust{\dontleavehmode\box#1}% dontleavehmode is needed to get direction right \egroup} -\chardef\marginrepositionmethod\plusone % sidemethod -\chardef\margincontentmethod \plusthree % textmethod % beware: 1 = old method -\chardef\marginpagecheckmethod \plusone % splitmethod +% \setnewconstant\marginrepositionmethod\plusone % sidemethod +% \setnewconstant\margincontentmethod \plusthree % textmethod % beware: 1 = old method +% \setnewconstant\marginpagecheckmethod \plusone % splitmethod %D For a right menu, a sequence of calls to \type %D {right_menu_button} is generated. @@ -1314,17 +1314,17 @@ \appendtoks \global\MPmenutoks\emptytoks \to \everyshipout -% 0=notfound 1=found 2=currentpage +\newconstant\currentamrealpagemode % 0=notfound 1=found 2=currentpage \def\domenuitemposition#1#2#3% {\doifelsevalue{\??am#1\c!position}\v!yes {\doglobal\increment\currentamposition \doifreferencefoundelse{#2}% 0=not found, 1=same page, >1=elsewhere - {\chardef\currentamrealpage\ifnum\currentreferencerealpage=\realpageno\plusone\else\plustwo\fi}% - {\chardef\currentamrealpage\plustwo}% - \expanded + {\currentamrealpagemode\ifnum\currentreferencerealpage=\realpageno\plusone\else\plustwo\fi}% + {\currentamrealpagemode\plustwo}% + \expanded % \doglobal\appendetoks {\doglobal\noexpand\appendtoks - #1_menu_button(\number\currentamposition,\the\currentamrealpage,\MPpos{#1:\currentamposition}) ; + #1_menu_button(\number\currentamposition,\the\currentamrealpagemode,\MPpos{#1:\currentamposition}) ; \to \MPmenutoks}% \hpos{#1:\currentamposition}{#3}} {#3}} @@ -1459,11 +1459,11 @@ \def\tabulatenormalcolumn#1% overloaded later in node-bck {&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi - &\global\chardef\tabulatetype#1&} + &\global\tabulatetype#1&} \def\tabulateequalcolumn#1% overloaded {&\tabulateequalpos - &\global\chardef\tabulatetype#1&} + &\global\tabulatetype#1&} \appendtoks \global\advance\noftabpositions\plusone diff --git a/tex/context/base/anch-pos.mkiv b/tex/context/base/anch-pos.mkiv index ba668f6ac..6fdd7324a 100644 --- a/tex/context/base/anch-pos.mkiv +++ b/tex/context/base/anch-pos.mkiv @@ -151,8 +151,9 @@ %D page box and therefore flushed first. So, when present, it %D is applied to all positions except itself. -\chardef\positionanchormode=0 % don't relocate page origin -\chardef\positionanchormode=1 % relocate page origin once +% 0 = don't relocate page origin 1 = relocate page origin once + +\setnewconstant\positionanchormode\plusone %D The core set macros. @@ -501,7 +502,6 @@ \newcount\parposcounter \newif \ifpositioningpar -\chardef \parposstrut = 1 % 0 => no strut data, so fall backs used \newif \iftracepositions % we can check for used entries, and if not, then not add one @@ -594,7 +594,7 @@ \def\getnodelocationn#1{\countervalue{\@@noden#1}} \def\getnodelocationo#1{\getvalue {\@@nodeo#1}} -\chardef\nodelocationmode\plusone +\setnewconstant\nodelocationmode\plusone \def\analyzenodelocation#1% {\ifcsname\@@noden#1\endcsname diff --git a/tex/context/base/attr-ini.mkiv b/tex/context/base/attr-ini.mkiv index 15ace0145..c3d33ddb5 100644 --- a/tex/context/base/attr-ini.mkiv +++ b/tex/context/base/attr-ini.mkiv @@ -33,34 +33,39 @@ \newtoks \attributesresetlist -\ifdefined \v!global \else \def\v!global{global} \fi % for metatex +\ifdefined \s!global \else \def\s!global{global} \fi % for metatex % or hard check later +\ifdefined \s!public \else \def\s!public{public} \fi % for metatex % or hard check later \unexpanded\def\defineattribute {\dodoubleempty\dodefineattribute} \def\dodefineattribute[#1][#2]% alternatively we can let lua do the housekeeping {\expandafter\newattribute\csname @attr@#1\endcsname - \expandafter \xdef\csname :attr:#1\endcsname{\number\lastallocatedattribute}% + \expandafter\newconstant \csname :attr:#1\endcsname + \csname :attr:#1\endcsname\lastallocatedattribute \ctxlua{attributes.define("#1",\number\lastallocatedattribute)}% %\writestatus\m!systems{defining attribute #1 with number \number\lastallocatedattribute}% - \doifnotinset\v!global{#2}{\appendetoks\csname @attr@#1\endcsname\attributeunsetvalue\to\attributesresetlist}} + \doifnotinset\s!global{#2}{\appendetoks\csname @attr@#1\endcsname\attributeunsetvalue\to\attributesresetlist}% + \doifinset \s!public{#2}{\expandafter\let\csname#1attribute\expandafter\endcsname\csname :attr:#1\endcsname}} \unexpanded\def\definesystemattribute {\dodoubleempty\dodefinesystemattribute} \def\dodefinesystemattribute[#1][#2]% alternatively we can let lua do the housekeeping {\scratchcounter\ctxlua{tex.print(attributes.private("#1"))}\relax - \global\expandafter\attributedef\csname @attr@#1\endcsname\scratchcounter - \expandafter \xdef\csname :attr:#1\endcsname{\number\scratchcounter}% + \expandafter\attributedef\csname @attr@#1\endcsname\scratchcounter + \expandafter\newconstant \csname :attr:#1\endcsname + \csname :attr:#1\endcsname\scratchcounter %\writestatus\m!systems{defining system attribute #1 with number \number\scratchcounter}% - \doifnotinset\v!global{#2}{\appendetoks\csname @attr@#1\endcsname\attributeunsetvalue\to\attributesresetlist}} + \doifnotinset\s!global{#2}{\appendetoks\csname @attr@#1\endcsname\attributeunsetvalue\to\attributesresetlist}% + \doifinset \s!public{#2}{\expandafter\let\csname#1attribute\expandafter\endcsname\csname :attr:#1\endcsname}} % expandable so we can \edef them for speed \def\dosetattribute#1#2{\csname @attr@#1\endcsname#2\relax} \def\doresetattribute#1{\csname @attr@#1\endcsname\attributeunsetvalue} \def\dogetattribute #1{\number\csname @attr@#1\endcsname} -\def\dogetattributeid#1{\csname :attr:#1\endcsname} +\def\dogetattributeid#1{\number\csname :attr:#1\endcsname} \let\dompattribute\gobbletwoarguments @@ -68,22 +73,22 @@ %D For the moment we put this here (later it will move to where it's used): -\definesystemattribute[state] -\definesystemattribute[skip] -\definesystemattribute[penalty] -\definesystemattribute[colormodel][global] \chardef\colormodelattribute \dogetattributeid{colormodel} -\definesystemattribute[color] \chardef\colorattribute \dogetattributeid{color} -\definesystemattribute[transparency] \chardef\transparencyattribute \dogetattributeid{transparency} -\definesystemattribute[background] \chardef\backgroundattribute \dogetattributeid{background} -\definesystemattribute[colorintent] \chardef\colorintentattribute \dogetattributeid{colorintent} -\definesystemattribute[negative] \chardef\negativeattribute \dogetattributeid{negative} -\definesystemattribute[effect] \chardef\effectattribute \dogetattributeid{effect} -\definesystemattribute[viewerlayer] \chardef\viewerlayerattribute \dogetattributeid{viewerlayer} -\definesystemattribute[layoutcomponent] \chardef\layoutcomponentattribute\dogetattributeid{layoutcomponent} -\definesystemattribute[reference] \chardef\referenceattribute \dogetattributeid{reference} -\definesystemattribute[destination] \chardef\destinationattribute \dogetattributeid{destination} -\definesystemattribute[graphicvadjust] \chardef\graphicvadjustattribute \dogetattributeid{graphicvadjust} -\definesystemattribute[ruled] \chardef\ruledattribute \dogetattributeid{ruled} -\definesystemattribute[shifted] \chardef\shiftedattribute \dogetattributeid{shifted} +\definesystemattribute [state] +\definesystemattribute [skip] +\definesystemattribute [penalty] +\definesystemattribute [colormodel] [public,global] +\definesystemattribute [color] [public] +\definesystemattribute [transparency] [public] +\definesystemattribute [background] [public] +\definesystemattribute [colorintent] [public] +\definesystemattribute [negative] [public] +\definesystemattribute [effect] [public] +\definesystemattribute [viewerlayer] [public] +\definesystemattribute [layoutcomponent] [public] +\definesystemattribute [reference] [public] +\definesystemattribute [destination] [public] +\definesystemattribute [graphicvadjust] [public] +\definesystemattribute [ruled] [public] +\definesystemattribute [shifted] [public] \protect \endinput diff --git a/tex/context/base/bibl-tra.mkiv b/tex/context/base/bibl-tra.mkiv index 656e80217..f74fc56eb 100644 --- a/tex/context/base/bibl-tra.mkiv +++ b/tex/context/base/bibl-tra.mkiv @@ -295,12 +295,12 @@ %D We can omit already shown references (\v!global) or use fresh %D lists each time (\v!local). -\chardef\bibtexoncemode\plusone % 0=disable, 1=local, 2=global +\setnewconstant\bibtexoncemode\plusone % 0=disable, 1=local, 2=global \appendtoks \doifelse\@@pbmethod\v!local - {\chardef\bibtexoncemode\plusone}% - {\chardef\bibtexoncemode\plustwo}% + {\bibtexoncemode\plusone}% + {\bibtexoncemode\plustwo}% \to \everysetuppublications %D Cite lists are compressed, if possible. This is set later on. diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv index 64bc66149..2ea660dc1 100644 --- a/tex/context/base/buff-ini.mkiv +++ b/tex/context/base/buff-ini.mkiv @@ -60,10 +60,9 @@ \unprotect -\chardef\buffernestmode\plusone % 0: not nested, 1: startbuffer nested, 2: all buffers nested +\setnewconstant\buffernestmode\plusone % 0: not nested, 1: startbuffer nested, 2: all buffers nested -\newif\ifsegmentatebuffer -\newif\ifemptybufferline +\newconditional\segmentatebuffermode % not implemented in mkiv (yet) \def\currentbuffer{\jobname} @@ -95,10 +94,12 @@ \def\dododostartbuffer#1#2#3#4% {%\showmessage\m!systems{15}{#2}% \doifelsevalue{\??bu#1\c!paragraph}\v!yes - {\segmentatebuffertrue} % todo in mkiv - {\doifnumberelse{\getvalue{\??bu#1\c!paragraph}}\segmentatebuffertrue\segmentatebufferfalse}% + {\settrue\segmentatebuffermode} % todo in mkiv + {\doifnumberelse{\getvalue{\??bu#1\c!paragraph}} + {\settrue \segmentatebuffermode} + {\setfalse\segmentatebuffermode}}% \doifvalue{\??bu#1\c!local}\v!yes - {\chardef\buffernestmode\plustwo}% permit nesting + {\buffernestmode\plustwo}% permit nesting \setcurrentbuffer{#2}% \doifelsenothing{#4} {\normalexpanded{\noexpand\setbuffercapsules{\e!start\v!buffer}{\e!stop\v!buffer}}% diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv index 6b80fbb7a..9fdc19ca4 100644 --- a/tex/context/base/buff-ver.mkiv +++ b/tex/context/base/buff-ver.mkiv @@ -21,7 +21,7 @@ \ifdefined\stoplinenumbering \else \let\stoplinenumbering \relax \fi \ifdefined\setuplinenumbering\else \unexpanded\def\setuplinenumbering[#1]{} \fi -\definesystemattribute[verbatim-line] \chardef\verbatimlineattribute \dogetattributeid{verbatim-line} +\definesystemattribute[verbatimline][public] \appendtoksonce \attribute\verbatimlineattribute \attributeunsetvalue \to \everyforgetall @@ -320,8 +320,8 @@ % \begstrut \let\currenttypingclass\??ty \edef\currenttyping{#1}% - \catcode`\<=\@@other - \catcode`\>=\@@other + \catcode`\<=\othercatcode + \catcode`\>=\othercatcode \futurelet\next\dodotype} \def\dodotype @@ -482,8 +482,8 @@ %D \def\dospecialtype#1#2% %D {\bgroup %D \initializetype -%D \catcode`\{=\@@begingroup -%D \catcode`\}=\@@endgroup +%D \catcode`\{=\begingroupcatcode +%D \catcode`\}=\endgroupcatcode %D \def\dospecialtype% %D {\def\dospecialtype{#2\egroup}% %D \bgroup @@ -504,8 +504,8 @@ \verbatimcolor \dosetverbatimfont %\setcatcodetable \typcatcodesa - \catcode`\{=\@@begingroup - \catcode`\}=\@@endgroup} + \catcode`\{=\begingroupcatcode + \catcode`\}=\endgroupcatcode} \unexpanded\def\tex{\groupedcommand{\setgroupedtype\texescape}{\relax}} \unexpanded\def\arg{\groupedcommand{\setgroupedtype\leftargument}{\rightargument}} diff --git a/tex/context/base/catc-ini.mkiv b/tex/context/base/catc-ini.mkiv index fe178b532..009c15074 100644 --- a/tex/context/base/catc-ini.mkiv +++ b/tex/context/base/catc-ini.mkiv @@ -21,25 +21,21 @@ %D implement a fake method in the \MKII\ file. There is some %D overlap in code with \MKII\ but we take that for granted. -\ifx\zerocount\undefined \chardef \zerocount= 0 \fi -\ifx\plusone \undefined \chardef \plusone = 1 \fi -\ifx\minusone \undefined \newcount\minusone \minusone =-1 \fi - -\chardef\escapecatcode = 0 -\chardef\begingroupcatcode = 1 -\chardef\endgroupcatcode = 2 -\chardef\mathshiftcatcode = 3 -\chardef\alignmentcatcode = 4 -\chardef\endoflinecatcode = 5 -\chardef\parametercatcode = 6 -\chardef\superscriptcatcode = 7 -\chardef\subscriptcatcode = 8 -\chardef\ignorecatcode = 9 -\chardef\spacecatcode = 10 -\chardef\lettercatcode = 11 -\chardef\othercatcode = 12 \chardef\other = 12 -\chardef\activecatcode = 13 \chardef\active = 13 -\chardef\commentcatcode = 14 +\setnewconstant\escapecatcode 0 +\setnewconstant\begingroupcatcode 1 +\setnewconstant\endgroupcatcode 2 +\setnewconstant\mathshiftcatcode 3 +\setnewconstant\alignmentcatcode 4 +\setnewconstant\endoflinecatcode 5 +\setnewconstant\parametercatcode 6 +\setnewconstant\superscriptcatcode 7 +\setnewconstant\subscriptcatcode 8 +\setnewconstant\ignorecatcode 9 +\setnewconstant\spacecatcode 10 +\setnewconstant\lettercatcode 11 +\setnewconstant\othercatcode 12 \let\other \othercatcode +\setnewconstant\activecatcode 13 \let\active\activecatcode +\setnewconstant\commentcatcode 14 \ifx\gobbleoneargument\undefined \long\def\gobbleoneargument#1{} \fi @@ -54,7 +50,8 @@ \def\newcatcodetable#1% {\global\advance\cctdefcounter\plusone \expandafter\xdef\csname @@ccn:\number\cctdefcounter\endcsname{\string#1}% logging - \global\chardef#1\cctdefcounter + \newconstant#1% + #1\cctdefcounter \ctxlua{catcodes.register("\expandafter\gobbleoneargument\string#1",\number#1)}} \newcatcodetable \scratchcatcodes \initcatcodetable\scratchcatcodes @@ -109,7 +106,7 @@ %D mechanism? Future versions of \MKIV\ might only use %D active characters for very special cases. -\chardef\activehackcode=`\~ +\setnewconstant\activehackcode `\~ %D Once a catcode is assigned, the next assignments will happen faster. @@ -185,7 +182,7 @@ \uppercase{\normalprotected\xdef~{\noexpand\catcodecommand{\number\cctcounterb}}}% \egroup} -\chardef\defaultcatcodetable\zerocount +\newconstant\defaultcatcodetable \def\catcodecommand#1% {\csname CCC:\number diff --git a/tex/context/base/char-act.mkiv b/tex/context/base/char-act.mkiv index 2dc7823f0..e38eb2c4e 100644 --- a/tex/context/base/char-act.mkiv +++ b/tex/context/base/char-act.mkiv @@ -49,12 +49,12 @@ \def\controlspace{\hbox{\char32}} % rather tex \def\normalspace { } -\def\normalspaces{\catcode`\ =\@@space} +\def\normalspaces{\catcode`\ =\spacecatcode} \bgroup -\catcode`\ =\@@active -\gdef\obeyspaces{\catcode`\ =\@@active\def {\obeyedspace}} -\gdef\setcontrolspaces{\catcode`\ =\@@active\def {\controlspace}} +\catcode`\ =\activecatcode +\gdef\obeyspaces{\catcode`\ =\activecatcode\def {\obeyedspace}} +\gdef\setcontrolspaces{\catcode`\ =\activecatcode\def {\controlspace}} \egroup %D \macros @@ -66,25 +66,25 @@ %D \NEWPAGE\ character locally, we redefine the meaning of %D this (often already) active character. -\catcode`\^^L=\@@active \def^^L{\par} +\catcode`\^^L=\activecatcode \def^^L{\par} %D The following indirect definitions enable us to implement %D all kind of \type{\obeyed} handlers. \bgroup -\catcode`\^^I=\@@active -\catcode`\^^M=\@@active -\catcode`\^^L=\@@active +\catcode`\^^I=\activecatcode +\catcode`\^^M=\activecatcode +\catcode`\^^L=\activecatcode -\gdef\obeytabs {\catcode`\^^I=\@@active\def^^I{\obeyedtab}} -\gdef\obeylines {\catcode`\^^M=\@@active\def^^M{\obeyedline}} -\gdef\obeypages {\catcode`\^^L=\@@active\def^^L{\obeyedpage}} +\gdef\obeytabs {\catcode`\^^I=\activecatcode\def^^I{\obeyedtab}} +\gdef\obeylines {\catcode`\^^M=\activecatcode\def^^M{\obeyedline}} +\gdef\obeypages {\catcode`\^^L=\activecatcode\def^^L{\obeyedpage}} -\gdef\ignoretabs {\catcode`\^^I=\@@active\def^^I{\obeyedspace}} -\gdef\ignorelines {\catcode`\^^M=\@@active\def^^M{\obeyedspace}} -\gdef\ignorepages {\catcode`\^^L=\@@ignore} % \@@active\def^^L{\obeyedline}} -\gdef\ignoreeofs {\catcode`\^^Z=\@@ignore} +\gdef\ignoretabs {\catcode`\^^I=\activecatcode\def^^I{\obeyedspace}} +\gdef\ignorelines {\catcode`\^^M=\activecatcode\def^^M{\obeyedspace}} +\gdef\ignorepages {\catcode`\^^L=\ignorecatcode} % \activecatcode\def^^L{\obeyedline}} +\gdef\ignoreeofs {\catcode`\^^Z=\ignorecatcode} \egroup diff --git a/tex/context/base/char-ini.mkiv b/tex/context/base/char-ini.mkiv index a89c448be..65140604e 100644 --- a/tex/context/base/char-ini.mkiv +++ b/tex/context/base/char-ini.mkiv @@ -35,8 +35,8 @@ %D them (unless of course we have adapted the table). It is on the agenda %D to do this with \type {tex.lccode} cum suis once they're available. -\def\setcclcuc#1#2#3{\global\catcode#1=\@@letter\global\lccode#1=#2\global\uccode#1=#3\relax} -\def\setcclcucself#1{\global\catcode#1=\@@letter\global\lccode#1=#1\global\uccode#1=#1\relax } +\def\setcclcuc#1#2#3{\global\catcode#1=\lettercatcode\global\lccode#1=#2\global\uccode#1=#3\relax} +\def\setcclcucself#1{\global\catcode#1=\lettercatcode\global\lccode#1=#1\global\uccode#1=#1\relax } \ctxlua{characters.setcodes()} diff --git a/tex/context/base/cont-cs.tex b/tex/context/base/cont-cs.tex index f878920aa..10fd16748 100644 --- a/tex/context/base/cont-cs.tex +++ b/tex/context/base/cont-cs.tex @@ -19,8 +19,6 @@ \setupcurrentlanguage[\s!cs] -\loaduserspecifications - \installlanguage [\s!en] [\c!state=\v!start] \installlanguage [\s!de] [\c!state=\v!start] \installlanguage [\s!sk] [\c!state=\v!start] diff --git a/tex/context/base/cont-de.tex b/tex/context/base/cont-de.tex index 460ca7eca..19743527e 100644 --- a/tex/context/base/cont-de.tex +++ b/tex/context/base/cont-de.tex @@ -19,8 +19,6 @@ \setupcurrentlanguage[\s!de] -\loaduserspecifications - \installlanguage [\s!us] [\c!state=\v!start] \installlanguage [\s!gb] [\c!state=\v!start] \installlanguage [\s!de] [\c!state=\v!start] diff --git a/tex/context/base/cont-en.tex b/tex/context/base/cont-en.tex index e2b09ecbe..42ad12b1a 100644 --- a/tex/context/base/cont-en.tex +++ b/tex/context/base/cont-en.tex @@ -19,8 +19,6 @@ \setupcurrentlanguage[\s!en] -\loaduserspecifications - % Do we need more defaults? or maybe all languages? \installlanguage [\s!us] [\c!state=\v!start] diff --git a/tex/context/base/cont-fr.tex b/tex/context/base/cont-fr.tex index d812b28f9..0b9b98df2 100644 --- a/tex/context/base/cont-fr.tex +++ b/tex/context/base/cont-fr.tex @@ -19,8 +19,6 @@ \setupcurrentlanguage[\s!fr] -\loaduserspecifications - \installlanguage [\s!us] [\c!state=\v!start] \installlanguage [\s!gb] [\c!state=\v!start] \installlanguage [\s!de] [\c!state=\v!start] diff --git a/tex/context/base/cont-gb.tex b/tex/context/base/cont-gb.tex index 99d297425..bd18f20ff 100644 --- a/tex/context/base/cont-gb.tex +++ b/tex/context/base/cont-gb.tex @@ -19,8 +19,6 @@ \setupcurrentlanguage[\s!gb] -\loaduserspecifications - \installlanguage [\s!us] [\c!state=\v!start] \installlanguage [\s!gb] [\c!state=\v!start] \installlanguage [\s!de] [\c!state=\v!start] diff --git a/tex/context/base/cont-it.tex b/tex/context/base/cont-it.tex index 2141e3bc9..03a1e5175 100644 --- a/tex/context/base/cont-it.tex +++ b/tex/context/base/cont-it.tex @@ -19,8 +19,6 @@ \setupcurrentlanguage[\s!it] -\loaduserspecifications - \installlanguage [\s!us] [\c!state=\v!start] \installlanguage [\s!gb] [\c!state=\v!start] \installlanguage [\s!de] [\c!state=\v!start] diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 0fdce6595..19871222b 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.09.03 11:05} +\newcontextversion{2010.09.05 13:23} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-nl.tex b/tex/context/base/cont-nl.tex index 32b82b01a..1b02d4242 100644 --- a/tex/context/base/cont-nl.tex +++ b/tex/context/base/cont-nl.tex @@ -19,8 +19,6 @@ \setupcurrentlanguage[\s!nl] -\loaduserspecifications - \installlanguage [\s!us] [\c!state=\v!start] \installlanguage [\s!gb] [\c!state=\v!start] \installlanguage [\s!de] [\c!state=\v!start] diff --git a/tex/context/base/cont-pe.tex b/tex/context/base/cont-pe.tex index fdf47d680..cd3557f9c 100644 --- a/tex/context/base/cont-pe.tex +++ b/tex/context/base/cont-pe.tex @@ -19,8 +19,6 @@ \setupcurrentlanguage[\s!pe] -\loaduserspecifications - % Do we need more defaults? or maybe all languages? \installlanguage [\s!us] [\c!state=\v!start] diff --git a/tex/context/base/cont-ro.tex b/tex/context/base/cont-ro.tex index 9be9b1162..0b1dc2c09 100644 --- a/tex/context/base/cont-ro.tex +++ b/tex/context/base/cont-ro.tex @@ -19,8 +19,6 @@ \setupcurrentlanguage[\s!ro] -\loaduserspecifications - \installlanguage [\s!en] [\c!state=\v!start] \installlanguage [\s!de] [\c!state=\v!start] \installlanguage [\s!ro] [\c!state=\v!start] diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 494462f6a..c50e3fb7b 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.09.03 11:05} +\edef\contextversion{2010.09.05 13:23} %D For those who want to use this: diff --git a/tex/context/base/core-ctx.mkiv b/tex/context/base/core-ctx.mkiv index 56d17ec88..5d3e27dc2 100644 --- a/tex/context/base/core-ctx.mkiv +++ b/tex/context/base/core-ctx.mkiv @@ -15,7 +15,7 @@ \unprotect -\chardef\preprocessmethod \plustwo % always check in mkiv +\setnewconstant\preprocessmethod\plustwo % always check in mkiv \registerctxluafile{core-ctx}{1.000} diff --git a/tex/context/base/core-env.mkiv b/tex/context/base/core-env.mkiv index b60a01454..33b9c8607 100644 --- a/tex/context/base/core-env.mkiv +++ b/tex/context/base/core-env.mkiv @@ -217,41 +217,6 @@ \def\doifsetupselse#1% to be done: grid {\doifdefinedelse{\??su:#1}} % doto: ifcsname -% % % % - -% \chardef\setupseolmode\plusone -% -% \unexpanded\def\startsetups {\xxstartsetups\plusone \stopsetups } \let\stopsetups \relax -% \unexpanded\def\startlocalsetups{\xxstartsetups\plusone \stoplocalsetups} \let\stoplocalsetups\relax -% \unexpanded\def\startrawsetups {\xxstartsetups\zerocount\stoprawsetups } \let\stoprawsetups \relax -% \unexpanded\def\startxmlsetups {\xxstartsetups\plustwo \stopxmlsetups } \let\stopxmlsetups \relax -% -% \def\xxstartsetups#1#2% -% {\begingroup\let\setupseolmode#1\doifnextoptionalelse{\dostartsetupsA#2}{\dostartsetupsB#2}} -% -% \def\dostartsetupsA#1% [ ] delimited -% {\ifcase\setupseolmode\or\catcode`\^^M\@@ignore\or\catcode`\^^M\@@ignore\catcode`\|\@@other\fi -% \dotripleempty\dostartsetups[#1]} -% -% \def\dostartsetupsB#1#2 % space delimited -% {\ifcase\setupseolmode\or\catcode`\^^M\@@ignore\or\catcode`\^^M\@@ignore\catcode`\|\@@other\fi -% \dodostartsetups#1\empty{#2}} -% -% \def\dostartsetupsC[#1][#2][#3]{\dodostartsetups#1{#2}{#3}} % [..] [..] -% \def\dostartsetupsD[#1][#2][#3]{\dodostartsetups#1\empty{#2}} % [..] -% -% \def\dostartsetups -% {\ifthirdargument\@EA\dostartsetupsC\else\@EA\dostartsetupsD\fi} -% -% \long\def\dodostartsetups#1#2#3% needs a speedup -% {\long\def\dododostartsetups##1#1% -% {\endgroup -% \dodoglobal % bah -% \long\expandafter\def\csname\??su#2:#3\expandafter\endcsname\expandafter####\expandafter1\expandafter{##1}}% -% \dododostartsetups\empty} % the empty trick prevents the { } in {arg} from being eaten up - -% % % % - % \startluasetups oeps % tex.print("DONE") % a = 1 @@ -285,11 +250,11 @@ % \ctxluabuffer \newtoks\everydefinesetups \appendtoks - \catcode`\^^M\@@ignore + \catcode`\^^M\ignorecatcode \to \everydefinesetups \newtoks\everydefinelocalsetups \appendtoks - \catcode`\^^M\@@ignore + \catcode`\^^M\ignorecatcode \to \everydefinelocalsetups \newtoks\everydefinerawsetups \appendtoks @@ -297,8 +262,8 @@ \to \everydefinerawsetups \newtoks\everydefinexmlsetups \appendtoks - \catcode`\^^M\@@ignore - \catcode`\|\@@other + \catcode`\^^M\ignorecatcode + \catcode`\|\othercatcode \to \everydefinexmlsetups \newtoks\everydefineluasetups \appendtoks diff --git a/tex/context/base/core-fnt.mkiv b/tex/context/base/core-fnt.mkiv index a7c84a5a0..b48eddad4 100644 --- a/tex/context/base/core-fnt.mkiv +++ b/tex/context/base/core-fnt.mkiv @@ -26,7 +26,7 @@ %D so test\compound{}test can be used instead of test||test %D \stoptyping -\bgroup \catcode`\|=\@@active \gdef\compound#1{|#1|} \egroup +\bgroup \catcode`\|=\activecatcode \gdef\compound#1{|#1|} \egroup %D Here we hook some code into the clean up mechanism needed %D for verbatim data. diff --git a/tex/context/base/core-job.mkii b/tex/context/base/core-job.mkii index 5c280c15b..d33f7bfdf 100644 --- a/tex/context/base/core-job.mkii +++ b/tex/context/base/core-job.mkii @@ -152,13 +152,13 @@ %D Loading of \type {cont-usr.tex} (edited by the user) %D and \type {cont-fmt.tex} (generated by texexec). -\def\loaduserspecifications - {% this used to be the file where users can tune their system, especially patterns - \readsysfile\f!usrfilename{\showmessage\m!systems2\f!usrfilename}\donothing - % this one took care of user preferences (fonts, messages) but lm made this obsolete - \readjobfile\f!fmtfilename{\showmessage\m!systems2\f!fmtfilename}\donothing - % from now on we preload all patterns (only in mkii) - \preloadallpatterns} +% \def\loaduserspecifications +% {% this used to be the file where users can tune their system, especially patterns +% \readsysfile\f!usrfilename{\showmessage\m!systems2\f!usrfilename}\donothing +% % this one took care of user preferences (fonts, messages) but lm made this obsolete +% \readjobfile\f!fmtfilename{\showmessage\m!systems2\f!fmtfilename}\donothing +% % from now on we preload all patterns (only in mkii) +% \preloadallpatterns} \let\loaduserspecifications\relax diff --git a/tex/context/base/core-mis.mkiv b/tex/context/base/core-mis.mkiv index 88da7fb5e..771dd3da6 100644 --- a/tex/context/base/core-mis.mkiv +++ b/tex/context/base/core-mis.mkiv @@ -576,8 +576,8 @@ \unexpanded\def\ongeveer {\mathematics\pm} - -\chardef\boundarycharactermode\plusone + +\setnewconstant\boundarycharactermode\plusone \def\midboundarycharacter#1#2% {\ifcase\boundarycharactermode @@ -590,7 +590,7 @@ \or \languageparameter#1% \fi - \chardef\boundarycharactermode\plusone} + \boundarycharactermode\plusone} \def\leftboundarycharacter#1#2% {\ifcase\boundarycharactermode @@ -601,7 +601,7 @@ \or \languageparameter#1% \fi - \chardef\boundarycharactermode\plusone} + \boundarycharactermode\plusone} \def\rightboundarycharacter#1#2% {\ifcase\boundarycharactermode @@ -612,7 +612,7 @@ \or \languageparameter#1% \fi - \chardef\boundarycharactermode\plusone} + \boundarycharactermode\plusone} % actually this is pretty old, but temporary moved here % @@ -1623,31 +1623,34 @@ \let\next=} \hbox} +\setnewconstant\pairedlocationa\plusone +\setnewconstant\pairedlocationb\plusfour + \def\beforefirstpairedbox - {\chardef\pairedlocationa1 % left - \chardef\pairedlocationb4 % middle + {\pairedlocationa\plusone % left + \pairedlocationb\plusfour % middle \getfromcommacommand[\@@ldlocation][1]% \processaction [\commalistelement] - [ \v!left=>\chardef\pairedlocationa0, - \v!right=>\chardef\pairedlocationa1, - \v!top=>\chardef\pairedlocationa2, - \v!bottom=>\chardef\pairedlocationa3]% + [ \v!left=>\pairedlocationa\zerocount, + \v!right=>\pairedlocationa\plusone, + \v!top=>\pairedlocationa\plustwo, + \v!bottom=>\pairedlocationa\plusthree]% \getfromcommacommand[\@@ldlocation][2]% \processaction [\commalistelement] - [ \v!left=>\chardef\pairedlocationb0, - \v!right=>\chardef\pairedlocationb1, - \v!high=>\chardef\pairedlocationb2, - \v!top=>\chardef\pairedlocationb2, - \v!low=>\chardef\pairedlocationb3, - \v!bottom=>\chardef\pairedlocationb3, - \v!middle=>\chardef\pairedlocationb4]} + [ \v!left=>\pairedlocationb\zerocount, + \v!right=>\pairedlocationb\plusone, + \v!high=>\pairedlocationb\plustwo, + \v!top=>\pairedlocationb\plustwo, + \v!low=>\pairedlocationb\plusthree, + \v!bottom=>\pairedlocationb\plusthree, + \v!middle=>\pairedlocationb\plusfour]} \def\betweenbothpairedboxes {\switchtobodyfont[\@@ldbodyfont]% split under same regime \setbox\firstpairedbox\flushnextbox - \ifnum\pairedlocationa<2 + \ifnum\pairedlocationa<\plustwo \hsize\wd\firstpairedbox % trick \hsize\@@ldwidth \scratchdimen\wd\firstpairedbox @@ -1676,9 +1679,9 @@ \else \flushnextbox \fi}% - \ifnum\pairedlocationa<2\hbox\else\vbox\fi\bgroup % hide vsize + \ifnum\pairedlocationa<\plustwo\hbox\else\vbox\fi\bgroup % hide vsize \forgetall - \ifnum\pairedlocationa<2 + \ifnum\pairedlocationa<\plustwo \scratchdimen\maxoftwoboxdimens\ht\firstpairedbox\secondpairedbox \vsize\scratchdimen \ifdim\scratchdimen<\@@ldheight\relax % can be \vsize @@ -1703,9 +1706,9 @@ \fi \ifdim\scratchdimen>\ht\secondpairedbox \setbox\secondpairedbox\vbox to \scratchdimen - {\ifnum\pairedlocationa=3 \vss\fi % + {\ifnum\pairedlocationa=\plusthree \vss\fi % \box\secondpairedbox - \ifnum\pairedlocationa=2 \vss\fi}% \kern\zeropoint + \ifnum\pairedlocationa=\plustwo \vss\fi}% \kern\zeropoint \fi \fi \ifcase\pairedlocationa @@ -1987,7 +1990,7 @@ \def\dostartfloatcombination[#1][#2]% {\vbox\bgroup %\insidecolumnstrue % trick, forces no centering, todo: proper switch/feature - \chardef\postcenterfloatmethod\zerocount + \postcenterfloatmethod\zerocount \forcelocalfloats \unexpanded\def\stopfloatcombination {\scratchtoks\emptytoks @@ -2333,7 +2336,7 @@ %D character and the fractional digits (we use 57 as %D sample). Here we combine all methods in one macros. -\chardef\vulgarfractionmethod=3 +\setnewconstant\vulgarfractionmethod\plusthree \definehspace[vulgarfraction][.25em] % [.15em] \definesymbol[vulgarfraction][/] % [\raise.2ex\hbox{/}] @@ -2366,10 +2369,10 @@ %D \HL %D \NC \bf method \NC \bf visualization \NC\NR %D \HL -%D \NC 0 \NC \chardef\vulgarfractionmethod0\vulgarfraction{1}{2} \NC\NR -%D \NC 1 \NC \chardef\vulgarfractionmethod1\vulgarfraction{1}{2} \NC\NR -%D \NC 2 \NC \chardef\vulgarfractionmethod2\vulgarfraction{1}{2} \NC\NR -%D \NC 3 \NC \chardef\vulgarfractionmethod3\vulgarfraction{1}{2} \NC\NR +%D \NC 0 \NC \vulgarfractionmethod0 \vulgarfraction{1}{2} \NC\NR +%D \NC 1 \NC \vulgarfractionmethod1 \vulgarfraction{1}{2} \NC\NR +%D \NC 2 \NC \vulgarfractionmethod2 \vulgarfraction{1}{2} \NC\NR +%D \NC 3 \NC \vulgarfractionmethod3 \vulgarfraction{1}{2} \NC\NR %D \HL %D \stoptabulate diff --git a/tex/context/base/core-var.mkiv b/tex/context/base/core-var.mkiv index 60b15437e..6238cb7b8 100644 --- a/tex/context/base/core-var.mkiv +++ b/tex/context/base/core-var.mkiv @@ -243,7 +243,7 @@ %D Concepts: -\chardef\conceptmode\zerocount +\newconstant\conceptmode \def\doifconcepttracing {\ifnum\conceptmode>\plustwo diff --git a/tex/context/base/font-ext.lua b/tex/context/base/font-ext.lua index e083f1edb..11ec77b93 100644 --- a/tex/context/base/font-ext.lua +++ b/tex/context/base/font-ext.lua @@ -113,11 +113,14 @@ local function get_class_and_vector(tfmdata,value,where) -- "expansions" local g_where = tfmdata.goodies and tfmdata.goodies[where] local f_where = fonts[where] local g_classes = g_where and g_where.classes - local class = g_where and g_where[value] or f_where.classes[value] + local f_classes = f_where and f_where.classes + local class = (g_classes and g_classes[value]) or (f_classes and f_classes[value]) +--~ print(value,class,f_where,f_classes) if class then local class_vector = class.vector local g_vectors = g_where and g_where.vectors - local vector = g_vectors and g_vectors[class_vector] or f_where.vectors[class_vector] + local f_vectors = f_where and f_where.vectors + local vector = (g_vectors and g_vectors[class_vector]) or (f_vectors and f_vectors[class_vector]) return class, vector end end @@ -183,7 +186,8 @@ function initializers.common.expansion(tfmdata,value) if vector then local stretch, shrink, step, factor = class.stretch or 0, class.shrink or 0, class.step or 0, class.factor or 1 if trace_expansion then - report_fonts("set expansion class %s, vector: %s, factor: %s, stretch: %s, shrink: %s, step: %s",value,class_vector,factor,stretch,shrink,step) + report_fonts("set expansion class %s, vector: %s, factor: %s, stretch: %s, shrink: %s, step: %s", + value,class.vector,factor,stretch,shrink,step) end tfmdata.stretch, tfmdata.shrink, tfmdata.step, tfmdata.auto_expand = stretch * 10, shrink * 10, step * 10, true local data = characters and characters.data @@ -209,7 +213,7 @@ function initializers.common.expansion(tfmdata,value) end end elseif trace_expansion then - report_fonts("unknown expansion vector '%s' in class '%s",class_vector,value) + report_fonts("unknown expansion vector '%s' in class '%s",class.vector,value) end elseif trace_expansion then report_fonts("unknown expansion class '%s'",value) @@ -237,9 +241,9 @@ fonts.protrusions = allocate() local protrusions = fonts.protrusions protrusions.classes = allocate() -protrusions.vectors = protrusions.vectors or { } +protrusions.vectors = allocate() -local classes = allocate() +local classes = protrusions.classes local vectors = protrusions.vectors -- the values need to be revisioned @@ -459,7 +463,8 @@ function initializers.common.protrusion(tfmdata,value) local left = class.left or 1 local right = class.right or 1 if trace_protrusion then - report_fonts("set protrusion class %s, vector: %s, factor: %s, left: %s, right: %s",value,class_vector,factor,left,right) + report_fonts("set protrusion class %s, vector: %s, factor: %s, left: %s, right: %s", + value,class.vector,factor,left,right) end local data = characters.data local emwidth = tfmdata.parameters.quad @@ -494,7 +499,7 @@ function initializers.common.protrusion(tfmdata,value) end end elseif trace_protrusion then - report_fonts("unknown protrusion vector '%s' in class '%s",class_vector,value) + report_fonts("unknown protrusion vector '%s' in class '%s",class.vector,value) end elseif trace_protrusion then report_fonts("unknown protrusion class '%s'",value) diff --git a/tex/context/base/font-gds.mkiv b/tex/context/base/font-gds.mkiv index 1677aaa97..5f400e119 100644 --- a/tex/context/base/font-gds.mkiv +++ b/tex/context/base/font-gds.mkiv @@ -39,7 +39,7 @@ \definecolor[colorscheme:2:2][m=.75] \definecolor[colorscheme:2:1][y=.75] -\definesystemattribute[colorscheme] \chardef\colorschemeattribute \dogetattributeid{colorscheme} +\definesystemattribute[colorscheme][public] \def\setfontcolorscheme {\ctxlua{fonts.goodies.colorschemes.enable()}% diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv index 2987bd36d..f44ec9a58 100644 --- a/tex/context/base/font-ini.mkiv +++ b/tex/context/base/font-ini.mkiv @@ -474,11 +474,11 @@ %D check for fontclass being default or empty and save a few %D tests but it does not help us when no math is defined. -\chardef\mrfam\zerocount % math regular -\chardef\mbfam\plusone % math bold +\let\mrfam\zerocount % math regular +\let\mbfam\plusone % math bold -\unexpanded\def\mr{\ifmmode\fam\zerocount\else\setcurrentfontalternative\c!mr\fi} % \fam\csname\c!mr fam\endcsname -\unexpanded\def\mb{\ifmmode\fam\plusone \else\setcurrentfontalternative\c!mb\fi} % \fam\csname\c!mb fam\endcsname +\unexpanded\def\mr{\ifmmode\fam\mrfam\else\setcurrentfontalternative\c!mr\fi} +\unexpanded\def\mb{\ifmmode\fam\mbfam\else\setcurrentfontalternative\c!mb\fi} \def\mathtextsuffix {-text} \def\mathscriptsuffix {-script} @@ -536,29 +536,14 @@ % not official ! -\chardef\boldmathmode\zerocount % might change ... maybe \mathfontsupport 1 (normal) 2 (bold too) +\newconditional\boldmathmode % might change ... maybe \mathfontsupport 1 (normal) 2 (bold too) -\def\enableboldmath {\chardef\boldmathmode\plusone } % todo: \setupbodyfont[boldmath,...] -\def\disableboldmath{\chardef\boldmathmode\zerocount} +\def\enableboldmath {\settrue \boldmathmode} % todo: \setupbodyfont[boldmath,...] +\def\disableboldmath{\setfalse\boldmathmode} \appendtoks - \ifcase\boldmathmode\or\dosetmathfamily\mbfam\c!mb\fi + \ifconditional\boldmathmode\dosetmathfamily\mbfam\c!mb\fi \to \mathstrategies - -% \chardef\msfam\plustwo % math symbol -% -% \def\c!ms{ms} -% -% \unexpanded\def\ms{\ifmmode\fam\plustwo\else\setcurrentfontalternative\c!ms\fi} -% -% \chardef\symbolmathmode\zerocount -% -% \def\enablesymbolmath {\chardef\symbolmathmode\plusone } -% \def\disablesymbolmath{\chardef\symbolmathmode\zerocount} -% -% \appendtoks -% \ifcase\symbolmathmode\or\dosetmathfamily\msfam\c!ms\fi -% \to \mathstrategies %D All used styles, like rm, ss and tt, are saved in a comma %D separated list. Appart from practical limitations one can @@ -1295,6 +1280,12 @@ %D expands to the current size in terms of \type {a} \unknown %D \type {d}, nothing, or \type {x} \unknown \type {xx}. +%D In the following macros we use \type{\currentxfontsize} to +%D hold the current x||size of the font. This enables us to +%D support for instance \type{\sl} inside a \type{\tx} switch. + +\newconstant\currentxfontsize + \def\xfontsize{\ifcase\currentxfontsize\fontsize\or\c!x\else\c!xx\fi} %D A typical use of this command is in commands that switch @@ -1886,7 +1877,7 @@ %D often not the way users specify the bodyfont size. Therefore %D we also store the normalized value. -\chardef\fontdigits=2 % was 1 +\setnewconstant\fontdigits\plustwo % was 1 % \def\normalizebodyfontsize#1\to#2% % {\@EA\@EA\@EA\donormalizedbodyfontsize\@EA\WITHOUTPT\the\dimexpr#1+\ifcase\fontdigits.5\or.05\or.005\fi\points\relax000\to#2} @@ -2061,7 +2052,7 @@ \let\defaultfontclass\fontclass \fi \fi}% - \chardef\currentxfontsize\zerocount} + \currentxfontsize\zerocount} \def\dodosetfont#1#2% #1 = set/switch state | check fo rempty, else space {\doifsomething{#2}{\dododosetfont{#1}{#2}{\showmessage\m!fonts4{#2}}}} @@ -2117,12 +2108,6 @@ % % % -%D In the previous macros we use \type{\currentxfontsize} to -%D hold the current x||size of the font. This enables us to -%D support for instance \type{\sl} inside a \type{\tx} switch. - -\chardef\currentxfontsize=0 - %D When users specify for instance a 13 point bodyfont while no %D such bodyfont is defined, the system automatically tries to %D find a best fit, that is the nearest smaller defined @@ -2227,7 +2212,7 @@ % 0=never 1=everymath 2=always -\chardef\synchronizebigmathflag=1 +\setnewconstant\synchronizebigmathflag\plusone \appendtoks \ifcase\synchronizebigmathflag @@ -2239,9 +2224,9 @@ \fi \to \everymathematics -\def\nobigmath {\chardef\synchronizebigmathflag\zerocount} -\def\autobigmath{\chardef\synchronizebigmathflag\plusone\synchronizebigmath} -\def\bigmath {\chardef\synchronizebigmathflag\plustwo\synchronizebigmath} +\def\nobigmath {\synchronizebigmathflag\zerocount} +\def\autobigmath{\synchronizebigmathflag\plusone\synchronizebigmath} +\def\bigmath {\synchronizebigmathflag\plustwo\synchronizebigmath} \let\bigmathfontsize\empty @@ -2482,7 +2467,7 @@ %D used. Here we also set \type{\currentxfontsize}. \def\dosetcurrentfontxxxalternative#1#2#3#4% - {\chardef\currentxfontsize#2\relax + {\currentxfontsize#2\relax \ifmmode #4% \else\ifcsname\bodyfontvariable{\normalizedbodyfontsize#3}\endcsname @@ -2500,7 +2485,7 @@ \def\checknestedxfontsize % option {\ifcase\currentxfontsize\else\ifx\fontsize\empty\else - \chardef\currentxfontsize\zeropoint + \currentxfontsize\zerocount \let\fontsize\empty \let\tx\normaltx \let\txx\normaltxx @@ -2641,8 +2626,6 @@ % \newtoks \everysetupbodyfont % \newtoks \everyswitchtobodyfont -\chardef\bodyfontsetstate=0 - \definecomplexorsimple\setupbodyfont \def\simplesetupbodyfont @@ -2938,7 +2921,7 @@ \def\fullrestoreglobalbodyfont {\let\fontsize\defaultfontsize \let\fontbody\defaultfontbody - \chardef\currentxfontsize\zerocount + \currentxfontsize\zerocount \let\fontclass\globalfontclass \doswitchpoints[\normalizedglobalbodyfontsize]% \doswitchstyle[\globalfontstyle]% @@ -2951,7 +2934,7 @@ \def\partialrestoreglobalbodyfont {\let\fontsize\defaultfontsize \let\fontbody\defaultfontbody - \chardef\currentxfontsize\zerocount + \currentxfontsize\zerocount \redoconvertfont \tf \the\everybodyfont % indeed needed diff --git a/tex/context/base/lang-mis.mkiv b/tex/context/base/lang-mis.mkiv index 11374e8b5..80b36c810 100644 --- a/tex/context/base/lang-mis.mkiv +++ b/tex/context/base/lang-mis.mkiv @@ -223,10 +223,10 @@ \def\installdiscretionaries#1#2{\writestatus\m!systems{use \string \installdiscretionary}} % obsolete -\chardef\discretionarymode\plusone +\setnewconstant\discretionarymode\plusone \def\ignorediscretionaries - {\chardef\discretionarymode\zerocount} + {\discretionarymode\zerocount} \def\discretionarycommand {% if direct if, we need \relax for lookahead in math mode @@ -542,7 +542,7 @@ %D approach for defining the active character itself. In MK II as %D well as in MK IV we now use the catcode vectors. -\chardef\compoundcharactermode\plusone +\setnewconstant\compoundcharactermode\plusone \def\installcompoundcharacter #1#2#3 #4% {#4} no grouping {\ifcase\compoundcharactermode @@ -553,8 +553,6 @@ \def\!!stringa{#3}% \@EA\def\csname\ifx\!!stringa\empty\@cc@\else\@cs@\fi\detokenize{#1#2#3}\endcsname{#4}% \setevalue{\@cx@\detokenize{#1}}{\noexpand\handlecompoundcharacter{\detokenize{#1}}}% beter nr's -% \@EA\letcatcodecommand\@EA\prtcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname -% \@EA\letcatcodecommand\@EA\texcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname \@EA\letcatcodecommand\@EA\ctxcatcodes\@EA\thecompoundcharacter\csname\@cx@\detokenize{#1}\endcsname \fi} @@ -574,7 +572,7 @@ %D this macro is supposed to be used grouped! \def\ignorecompoundcharacter - {\chardef\compoundcharactermode\zerocount} + {\compoundcharactermode\zerocount} \let\restorecompoundcharacter \gobbleoneargument % obsolete \let\enableactivediscretionaries\relax % obsolete diff --git a/tex/context/base/lang-url.mkiv b/tex/context/base/lang-url.mkiv index 0f6b23d05..c21acc033 100644 --- a/tex/context/base/lang-url.mkiv +++ b/tex/context/base/lang-url.mkiv @@ -38,8 +38,6 @@ %D %D \typebuffer -\ifx\urlsplitmode\undefined \chardef\urlsplitmode\zerocount \fi % not supported in mkiv - \newtoks\everyhyphenatedurl \appendtoks @@ -72,8 +70,8 @@ % \sethyphenatedurlafter{ABCDEF} -\chardef\hyphenatedurllefthyphenmin = 3 -\chardef\hyphenatedurlrighthyphenmin = 3 +\setnewconstant\hyphenatedurllefthyphenmin \plusthree +\setnewconstant\hyphenatedurlrighthyphenmin\plusthree \unexpanded \def\hyphenatedurl#1% {\dontleavehmode diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua index ef1f31ab6..a56c8fdeb 100644 --- a/tex/context/base/lpdf-ano.lua +++ b/tex/context/base/lpdf-ano.lua @@ -245,9 +245,7 @@ function codeinjections.prerollreference(actions) -- share can become option end end -local shareannotations experiments.register("backend.shareannotations",function() shareannotations = true end) - -if not shareannotations then +local lln = latelua_node() if not node.has_field(lln,'string') then function nodeinjections.reference(width,height,depth,prerolled) -- keep this one if prerolled then @@ -258,8 +256,13 @@ if not shareannotations then end end + function codeinjections.finishreference() + end + else + report_references("hashing annotations") + local delayed = { } local hashed = { } local sharing = true -- we can do this for special refs (so we need an extra argument) @@ -290,8 +293,8 @@ else if not n then n = pdfreserveobject() -- todo: share delayed[n] = annot ---~ n = pdf.obj(annot) ---~ pdf.refobj(n) + --~ n = pdf.obj(annot) + --~ pdf.refobj(n) if sharing then hashed[annot] = n end @@ -306,13 +309,13 @@ else if trace_references then report_references("w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled) end ---~ local luacode = format("backends.pdf.codeinjections.finishreference(%s,%s,%s,'%s')",width,height,depth,prerolled) + -- local luacode = format("backends.pdf.codeinjections.finishreference(%s,%s,%s,'%s')",width,height,depth,prerolled) local luacode = format("_bpnf_(%s,%s,%s,'%s')",width,height,depth,prerolled) return latelua_node(luacode) end end -end +end node.free(lln) function nodeinjections.destination(width,height,depth,name,view) if trace_destinations then diff --git a/tex/context/base/luat-bwc.lua b/tex/context/base/luat-bwc.lua index 138c0deba..f893c7c5b 100644 --- a/tex/context/base/luat-bwc.lua +++ b/tex/context/base/luat-bwc.lua @@ -8,21 +8,25 @@ if not modules then modules = { } end modules ['luat-bwc'] = { -- backward compatibility -local box = tex.box +if not tex.wd then -local wd = { } setmetatable(wd, { - __index = function(t,k) local bk = box[k] return bk and bk.width or 0 end, - __newindex = function(t,k,v) local bk = box[k] if bk then bk.width = v end end, -} + local box = tex.box -local ht = { } setmetatable(ht, { - __index = function(t,k) local bk = box[k] return bk and bk.height or 0 end, - __newindex = function(t,k,v) local bk = box[k] if bk then bk.height = v end end, -} + local wd = { } setmetatable(wd, { + __index = function(t,k) local bk = box[k] return bk and bk.width or 0 end, + __newindex = function(t,k,v) local bk = box[k] if bk then bk.width = v end end, + } ) -local dp = { } setmetatable(dp, { - __index = function(t,k) local bk = box[k] return bk and bk.depth or 0 end, - __newindex = function(t,k,v) local bk = box[k] if bk then bk.depth = v end end, -} + local ht = { } setmetatable(ht, { + __index = function(t,k) local bk = box[k] return bk and bk.height or 0 end, + __newindex = function(t,k,v) local bk = box[k] if bk then bk.height = v end end, + } ) + + local dp = { } setmetatable(dp, { + __index = function(t,k) local bk = box[k] return bk and bk.depth or 0 end, + __newindex = function(t,k,v) local bk = box[k] if bk then bk.depth = v end end, + } ) + +--~ tex.wd, tex.ht, tex.dp = wd, ht, dp -tex.wd, tex.ht, tex.dp = wd, ht, dp +end diff --git a/tex/context/base/luat-cod.mkiv b/tex/context/base/luat-cod.mkiv index 5104f3e6b..f2495a285 100644 --- a/tex/context/base/luat-cod.mkiv +++ b/tex/context/base/luat-cod.mkiv @@ -25,7 +25,7 @@ %D bytecode arrays do. And so the following is obsolete: %D %D \starttyping -%D \chardef\ctxluaembeddingmode \plusone +%D \setnewconstant\ctxluaembeddingmode \plusone %D %D 0 = external compilation and loading %D 1 = runtime compilation and embedding diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv index 83a9825bf..fc6381b3a 100644 --- a/tex/context/base/lxml-ini.mkiv +++ b/tex/context/base/lxml-ini.mkiv @@ -280,13 +280,12 @@ % \def\xmlctxdirective#1#2#3{\doif{#1}{clue}{\doif{#2}{page}}{\page[#3]}} -\chardef\xmlprocessingmode=0 % 0=unset, 1=text, 2=hidden +\newconstant\xmlprocessingmode % 0=unset, 1=text, 2=hidden \newtoks\everysetupxml \unexpanded\def\setupxml[#1]{\getparameters[\??xm][#1]\the\everysetupxml} - \letvalue{\??xm:\s!default:\v!normal}\zerocount \letvalue{\??xm:\s!default:\v!none }\zerocount \letvalue{\??xm:\s!default:\v!text }\plusone @@ -304,7 +303,7 @@ \fi} \appendtoks - \chardef\xmlprocessingmode\executeifdefined{\??xm:\s!default:\@@xmdefault}\plusone + \xmlprocessingmode\executeifdefined{\??xm:\s!default:\@@xmdefault}\plusone \to \everysetupxml \def\xmlinitialize{\the\everysetupxml} @@ -331,7 +330,7 @@ %D Entities: -\chardef\xmlautoentities=1 % 0=off, 1=upper, 2=upper,lower +\setnewconstant\xmlautoentities\plusone % 0=off, 1=upper, 2=upper,lower \let\isolatedentity\firstofoneargument diff --git a/tex/context/base/math-ali.mkiv b/tex/context/base/math-ali.mkiv index 31f71219a..872cc3b82 100644 --- a/tex/context/base/math-ali.mkiv +++ b/tex/context/base/math-ali.mkiv @@ -61,7 +61,7 @@ % preamble is scanned for tabskips so we need the span to prevent an error message -\chardef\eqalignmode\plusone +\setnewconstant\eqalignmode\plusone \def\preparereqalignno {\!!toksa{\strut\firstineqalign\hfil\leftofeqalign\span\mathineqalign{##}\rightofeqalign\tabskip\zeropoint}% @@ -73,7 +73,7 @@ \else \!!toksc{\hfil\tabskip\centering&\llap{\span\textineqalign{##}}\tabskip\zeropoint}% \fi\fi - \global\chardef\mathnumberstatus\zerocount + \global\mathnumberstatus\zerocount \buildeqalign \presetdisplaymath \tabskip\centering} @@ -89,7 +89,7 @@ \else \!!toksc{\hfil\tabskip\centering&\kern-\displaywidth\rlap{\span\textineqalign{##}}\tabskip\displaywidth}% \fi\fi - \global\chardef\mathnumberstatus\zerocount + \global\mathnumberstatus\zerocount \buildeqalign \presetdisplaymath \tabskip\centering} @@ -109,7 +109,7 @@ \def\dobothaligneqalignno#1% {\ifmmode \displ@y - \global\chardef\mathnumberstatus\plusone + \global\mathnumberstatus\plusone \ifcase\mathraggedstatus \def\finishalignno{\crcr\egroup}% \else @@ -127,12 +127,12 @@ \xdef\mathnumbercorrection{\the\wd\scratchbox}% \fi \box\scratchbox - \global\chardef\mathnumberstatus\plustwo} + \global\mathnumberstatus\plustwo} % \def\dobothaligneqalignno#1% % {\ifmmode % \displ@y -% \global\chardef\mathnumberstatus\plusone +% \global\mathnumberstatus\plusone % we're in a mathbox % \vcenter\bgroup % \def\finishalignno{\crcr\egroup\egroup}% @@ -1069,14 +1069,15 @@ \def\mathhbox {\iftracemath\ruledhbox\else\hbox\fi} -\chardef\mathraggedstatus=0 % normal left center right -\chardef\mathnumberstatus=0 % nothing normal shift_right +\newconstant\mathraggedstatus % normal left center right +\newconstant\mathnumberstatus % nothing normal shift_right + \let\mathnumbercorrection\!!zeropoint \unexpanded\def\startmathbox#1% {\hsize\displaywidth - \global\chardef\mathnumberstatus\plusone - \chardef\mathraggedstatus#1\relax + \global\mathnumberstatus\plusone + \mathraggedstatus#1\relax \let\mathnumbercorrection\!!zeropoint \global\let\@eqno \empty \def\eqno {\gdef\@eqno }% \global\let\@leqno\empty \def\leqno{\gdef\@leqno}% diff --git a/tex/context/base/math-def.mkiv b/tex/context/base/math-def.mkiv index ce6bdb23d..4d8883c0f 100644 --- a/tex/context/base/math-def.mkiv +++ b/tex/context/base/math-def.mkiv @@ -15,8 +15,6 @@ \unprotect -\ifx\mrfam\undefined \chardef\mrfam\plusone \fi - \startluacode mathematics.define() mathematics.xml.registerentities() @@ -108,10 +106,10 @@ % using attributes -\chardef\bigmathdelimitermethod\plusone +\setnewconstant\bigmathdelimitermethod\plusone \def\plainbigdelimiters % traditional method - {\chardef\bigmathdelimitermethod\plustwo} + {\bigmathdelimitermethod\plustwo} \plainbigdelimiters % is default for the moment but not so nice diff --git a/tex/context/base/math-frc.mkiv b/tex/context/base/math-frc.mkiv index 2305cec30..9ef2cc6cf 100644 --- a/tex/context/base/math-frc.mkiv +++ b/tex/context/base/math-frc.mkiv @@ -71,14 +71,16 @@ \def\dofrac#1#2#3{\relax\mathematics{\Ustack{{#1{#2}}\normalover{#1{#3}}}}} \def\nofrac #1#2{\relax\mathematics{\Ustack{{#1}\normalover{#2}}}} -% \chardef\mathfracmode=0 $\frac{1}{2}$ -% \chardef\mathfracmode=1 $\frac{1}{2}$ -% \chardef\mathfracmode=2 $\frac{1}{2}$ -% \chardef\mathfracmode=3 $\frac{1}{2}$ -% \chardef\mathfracmode=4 $\frac{1}{2}$ -% \chardef\mathfracmode=5 $\frac{1}{2}$ +% $\mathfracmode0 \frac{1}{2}$ +% $\mathfracmode1 \frac{1}{2}$ +% $\mathfracmode2 \frac{1}{2}$ +% $\mathfracmode3 \frac{1}{2}$ +% $\mathfracmode4 \frac{1}{2}$ +% $\mathfracmode5 \frac{1}{2}$ -\chardef\mathfracmode=0 % 0=auto, 1=displaystyle, 2=textstyle, 3=scriptstyle, 4=scriptscriptstyle, 5=mathstyle +% 0=auto, 1=displaystyle, 2=textstyle, 3=scriptstyle, 4=scriptscriptstyle, 5=mathstyle + +\setnewconstant\mathfracmode\zerocount \unexpanded\def\frac {\ifcase\mathfracmode @@ -151,8 +153,8 @@ \bgroup -\catcode`\/=\@@other \global \let\normalforwardslash/ -\catcode`\/=\@@active \doglobal\appendtoks\let/\normalforwardslash\to\everymathematics +\catcode`\/=\othercatcode \global \let\normalforwardslash/ +\catcode`\/=\activecatcode \doglobal\appendtoks\let/\normalforwardslash\to\everymathematics \egroup diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua index 838ed0e80..ad4eea5f7 100644 --- a/tex/context/base/math-ini.lua +++ b/tex/context/base/math-ini.lua @@ -12,6 +12,7 @@ if not modules then modules = { } end modules ['math-ext'] = { local utf = unicode.utf8 local texsprint, format, utfchar, utfbyte = tex.sprint, string.format, utf.char, utf.byte +local setmathcode, setdelcode = tex.setmathcode, tex.setdelcode local allocate = utilities.storage.allocate @@ -103,57 +104,101 @@ local function mathbotaccent(class,family,slot) return format('\\Umathbotaccent "%X "%X "%X ',0,family,slot) -- no class end local function mathtopdelimiter(class,family,slot) - return format('\\Uoverdelimiter "%X "%X ',0,family,slot) -- no class + return format('\\Udelimiterover "%X "%X ',family,slot) -- no class end local function mathbotdelimiter(class,family,slot) - return format('\\Uunderdelimiter "%X "%X ',0,family,slot) -- no class + return format('\\Udelimiterunder "%X "%X ',family,slot) -- no class end local escapes = characters.filters.utf.private.escapes -local function setmathsymbol(name,class,family,slot) - if class == classes.accent then - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathaccent(class,family,slot))) - elseif class == classes.topaccent then - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathtopaccent(class,family,slot))) - elseif class == classes.botaccent then - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathbotaccent(class,family,slot))) - elseif class == classes.over then - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathtopdelimiter(class,family,slot))) - elseif class == classes.under then - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathbotdelimiter(class,family,slot))) - elseif class == classes.open or class == classes.close then - texsprint(delcode(slot,family,slot)) - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,delimiter(class,family,slot))) - elseif class == classes.delimiter then - texsprint(delcode(slot,family,slot)) - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,delimiter(0,family,slot))) - elseif class == classes.radical then - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,radical(family,slot))) - else - -- beware, open/close and other specials should not end up here ---~ local ch = utfchar(slot) ---~ if escapes[ch] then ---~ texsprint(format("\\xdef\\%s{\\char%s }",name,slot)) ---~ else - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathchar(class,family,slot))) ---~ end +local setmathcharacter, setmathsynonym, setmathsymbol -- once updated we will inline them + +if setmathcode then + + setmathcharacter = function(class,family,slot,unicode,firsttime) + if not firsttime and class <= 7 then + setmathcode(slot,{class,family,unicode or slot}) + end end -end -local function setmathcharacter(class,family,slot,unicode,firsttime) - if not firsttime and class <= 7 then - texsprint(mathcode(slot,class,family,unicode or slot)) + setmathsynonym = function(class,family,slot,unicode,firsttime) + if not firsttime and class <= 7 then + setmathcode(slot,{class,family,unicode}) + end + if class == classes.open or class == classes.close then + setdelcode(slot,{family,unicode,0,0}) + end end -end -local function setmathsynonym(class,family,slot,unicode,firsttime) - if not firsttime and class <= 7 then - texsprint(mathcode(slot,class,family,unicode)) + setmathsymbol = function(name,class,family,slot) -- hex is nicer for tracing + if class == classes.accent then + texsprint(format([[\unexpanded\gdef\%s{\Umathaccent 0 "%X "%X }]],name,family,slot)) + elseif class == classes.topaccent then + texsprint(format([[\unexpanded\gdef\%s{\Umathaccent 0 "%X "%X }]],name,family,slot)) + elseif class == classes.botaccent then + texsprint(format([[\unexpanded\gdef\%s{\Umathbotaccent 0 "%X "%X }]],name,family,slot)) + elseif class == classes.over then + texsprint(format([[\unexpanded\gdef\%s{\Udelimiterover "%X "%X }]],name,family,slot)) + elseif class == classes.under then + texsprint(format([[\unexpanded\gdef\%s{\Udelimiterunder "%X "%X }]],name,family,slot)) + elseif class == classes.open or class == classes.close then + setdelcode(slot,{family,slot,0,0}) + texsprint(format([[\unexpanded\gdef\%s{\Udelimiter "%X "%X "%X }]],name,class,family,slot)) + elseif class == classes.delimiter then + setdelcode(slot,{family,slot,0,0}) + texsprint(format([[\unexpanded\gdef\%s{\Udelimiter 0 "%X "%X }]],name,family,slot)) + elseif class == classes.radical then + texsprint(format([[\unexpanded\gdef\%s{\Uradical "%X "%X }]],name,family,slot)) + else + -- beware, open/close and other specials should not end up here + texsprint(format([[\unexpanded\gdef\%s{\Umathchar "%X "%X "%X }]],name,class,family,slot)) + end end - if class == classes.open or class == classes.close then - texsprint(delcode(slot,family,unicode)) + + +else + + setmathcharacter = function(class,family,slot,unicode,firsttime) + if not firsttime and class <= 7 then + texsprint(mathcode(slot,class,family,unicode or slot)) + end + end + + setmathsynonym = function(class,family,slot,unicode,firsttime) + if not firsttime and class <= 7 then + texsprint(mathcode(slot,class,family,unicode)) + end + if class == classes.open or class == classes.close then + texsprint(delcode(slot,family,unicode)) + end end + + setmathsymbol = function(name,class,family,slot) + if class == classes.accent then + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathaccent(class,family,slot))) + elseif class == classes.topaccent then + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathtopaccent(class,family,slot))) + elseif class == classes.botaccent then + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathbotaccent(class,family,slot))) + elseif class == classes.over then + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathtopdelimiter(class,family,slot))) + elseif class == classes.under then + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathbotdelimiter(class,family,slot))) + elseif class == classes.open or class == classes.close then + texsprint(delcode(slot,family,slot)) + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,delimiter(class,family,slot))) + elseif class == classes.delimiter then + texsprint(delcode(slot,family,slot)) + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,delimiter(0,family,slot))) + elseif class == classes.radical then + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,radical(family,slot))) + else + -- beware, open/close and other specials should not end up here + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathchar(class,family,slot))) + end + end + end local function report(class,family,unicode,name) @@ -214,14 +259,12 @@ function mathematics.define(slots,family) report(class,family,unicode,name) end setmathsymbol(name,class,family,unicode) - -- setmathcharacter(class,family,unicode,unicode,i) else name = class == classes.variable or class == classes.number and character.adobename if name then if trace_defining then report(class,family,unicode,name) end - -- setmathcharacter(class,family,unicode,unicode,i) end end setmathcharacter(class,family,unicode,unicode,i) diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index 74f40543d..26fb94033 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -48,11 +48,11 @@ \registerctxluafile{math-noa}{1.001} \registerctxluafile{math-tag}{1.001} -\definesystemattribute[mathalphabet] \chardef\mathalphabetattribute \dogetattributeid{mathalphabet} -\definesystemattribute[mathsize] \chardef\mathsizeattribute \dogetattributeid{mathsize} -\definesystemattribute[mathpunctuation] \chardef\mathpunctuationattribute \dogetattributeid{mathpunctuation} -\definesystemattribute[mathgreek] \chardef\mathgreekattribute \dogetattributeid{mathgreek} -\definesystemattribute[mathalternate] \chardef\mathalternateattribute \dogetattributeid{mathalternate} +\definesystemattribute[mathalphabet] [public] +\definesystemattribute[mathsize] [public] +\definesystemattribute[mathpunctuation][public] +\definesystemattribute[mathgreek] [public] +\definesystemattribute[mathalternate] [public] % experiment @@ -181,23 +181,23 @@ \def\@@mathboxcomm #1{\dontleavehmode\hbox\Ustartmath\mathsurround\zeropoint#1\Ustopmath} \def\@@mathchoicecomm#1{[todo #1]} -\chardef\mathordcode = 0 \let\mathordcomm \mathord -\chardef\mathopcode = 1 \let\mathopcomm \mathop -\chardef\mathbincode = 2 \let\mathbincomm \mathbin -\chardef\mathrelcode = 3 \let\mathrelcomm \mathrel -\chardef\mathopencode = 4 \let\mathopencomm \mathopen -\chardef\mathclosecode = 5 \let\mathclosecomm \mathclose -\chardef\mathpunctcode = 6 \let\mathpunctcomm \mathpunct -\chardef\mathalphacode = 7 \let\mathalphacomm \firstofoneargument -\chardef\mathinnercode = 0 \let\mathinnercomm \mathinner -\chardef\mathnothingcode= 0 \let\mathnothingcomm \firstofoneargument -\chardef\mathlimopcode = 1 \let\mathlimopcomm \@@mathlimopcomm -\chardef\mathnolopcode = 1 \let\mathnolopcomm \@@mathnolopcomm -\chardef\mathchoicecode = 0 \let\mathchoicecomm \@@mathchoicecomm -\chardef\mathboxcode = 0 \let\mathboxcomm \@@mathboxcomm - -\chardef\mathaccentcode = 8 -\chardef\mathradicalcode= 9 +\setnewconstant\mathordcode 0 \let\mathordcomm \mathord +\setnewconstant\mathopcode 1 \let\mathopcomm \mathop +\setnewconstant\mathbincode 2 \let\mathbincomm \mathbin +\setnewconstant\mathrelcode 3 \let\mathrelcomm \mathrel +\setnewconstant\mathopencode 4 \let\mathopencomm \mathopen +\setnewconstant\mathclosecode 5 \let\mathclosecomm \mathclose +\setnewconstant\mathpunctcode 6 \let\mathpunctcomm \mathpunct +\setnewconstant\mathalphacode 7 \let\mathalphacomm \firstofoneargument +\setnewconstant\mathinnercode 0 \let\mathinnercomm \mathinner +\setnewconstant\mathnothingcode 0 \let\mathnothingcomm \firstofoneargument +\setnewconstant\mathlimopcode 1 \let\mathlimopcomm \@@mathlimopcomm +\setnewconstant\mathnolopcode 1 \let\mathnolopcomm \@@mathnolopcomm +\setnewconstant\mathchoicecode 0 \let\mathchoicecomm \@@mathchoicecomm +\setnewconstant\mathboxcode 0 \let\mathboxcomm \@@mathboxcomm + +\setnewconstant\mathaccentcode 8 +\setnewconstant\mathradicalcode 9 \def\puremathcode#1{\the\csname math#1code\endcsname} \def\puremathcomm#1{\csname math#1comm\endcsname} @@ -366,9 +366,9 @@ \bgroup - \catcode`_=\active - \catcode`^=\active - \catcode`&=\active + \catcode`_=\activecatcode + \catcode`^=\activecatcode + \catcode`&=\activecatcode \global \everynonknuthmode {\appendtoks \let_\normalsuber @@ -382,30 +382,30 @@ \mathcode`_="8000 \mathcode`^="8000 \mathcode`&="8000 - \catcode`_=\@@other - \catcode`^=\@@other - \catcode`&=\@@other + \catcode`_=\othercatcode + \catcode`^=\othercatcode + \catcode`&=\othercatcode \to \everynonknuthmode \appendtoks - \catcode`_=\@@subscript - \catcode`^=\@@superscript - \catcode`&=\@@alignment + \catcode`_=\subscriptcatcode + \catcode`^=\superscriptcatcode + \catcode`&=\alignmentcatcode \to \everydonknuthmode \appendtoks \startextendcatcodetable\ctxcatcodes - \catcode`_=\@@other - \catcode`^=\@@other - \catcode`&=\@@other + \catcode`_=\othercatcode + \catcode`^=\othercatcode + \catcode`&=\othercatcode \stopextendcatcodetable \to \everynonknuthmode \appendtoks \startextendcatcodetable\ctxcatcodes - \catcode`_=\@@subscript - \catcode`^=\@@superscript - \catcode`&=\@@alignment + \catcode`_=\subscriptcatcode + \catcode`^=\superscriptcatcode + \catcode`&=\alignmentcatcode \stopextendcatcodetable \to \everydonknuthmode diff --git a/tex/context/base/math-int.mkiv b/tex/context/base/math-int.mkiv index 9bb7b1a14..a99142a04 100644 --- a/tex/context/base/math-int.mkiv +++ b/tex/context/base/math-int.mkiv @@ -33,19 +33,19 @@ %D %D Limits: \setupmathematics[integral=limits] \getbuffer -\chardef\intlimitcode\zerocount % 0 nolimits 1 displaylimits 2 limits +\newconstant\mathintlimitmode % 0 nolimits 1 displaylimits 2 limits \def\intlimits - {\ifcase\intlimitcode \nolimits \or \displaylimits \or \limits \fi} + {\ifcase\mathintlimitmode \nolimits \or \displaylimits \or \limits \fi} \ifx\v!integral\undefined \def\v!integral{integral} \fi \appendtoks \processaction [\mathematicsparameter\v!integral] - [ nolimits=>\chardef\intlimitcode\zerocount, - displaylimits=>\chardef\intlimitcode\plusone, - limits=>\chardef\intlimitcode\plustwo]% + [ nolimits=>\mathintlimitmode\zerocount, + displaylimits=>\mathintlimitmode\plusone, + limits=>\mathintlimitmode\plustwo]% \to \everysetupmathematics \setupmathematics @@ -103,7 +103,7 @@ {\ifx\next\limits \dointlimitcorrection \else \ifx\next\displaylimits \dointlimitcorrection \else \ifx\next\nolimits \donothing \else - \ifcase\intlimitcode\else \dointlimitcorrection \fi\fi\fi\fi + \ifcase\mathintlimitmode\else \dointlimitcorrection \fi\fi\fi\fi \dodorepeatintegral} \def\dointlimitcorrection diff --git a/tex/context/base/math-scr.mkiv b/tex/context/base/math-scr.mkiv index eb1db4714..caedd5722 100644 --- a/tex/context/base/math-scr.mkiv +++ b/tex/context/base/math-scr.mkiv @@ -51,12 +51,12 @@ %D and \type {\sub} by saying \type {\enablesupersub}. \bgroup -\catcode`\^=\@@active -\catcode`\_=\@@active +\catcode`\^=\activecatcode +\catcode`\_=\activecatcode \gdef\enablesupersub - {\catcode`\^=\@@active + {\catcode`\^=\activecatcode \def^{\ifmmode\expandafter\super\else\expandafter\normalsuper\fi}% - \catcode`\_=\@@active + \catcode`\_=\activecatcode \def_{\ifmmode\expandafter\suber\else\expandafter\normalsuber\fi}} \egroup diff --git a/tex/context/base/meta-ini.mkii b/tex/context/base/meta-ini.mkii index c7bad9ebf..c07a5ada9 100644 --- a/tex/context/base/meta-ini.mkii +++ b/tex/context/base/meta-ini.mkii @@ -815,10 +815,12 @@ \box\scratchbox \egroup} +\ifx\makeMPintoPDFobject\undefined \newcount\makeMPintoPDFobject \fi + \def\includeMPasPDF#1% {\bgroup \the\everyinsertMPfile - \ifinobject \else \chardef\makeMPintoPDFobject\plustwo \fi % when needed + \ifinobject \else \makeMPintoPDFobject\plustwo \fi % when needed \convertMPtoPDF{#1}{1}{1}% no \plusone ! \egroup} diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv index c23220250..d1f4b422f 100644 --- a/tex/context/base/meta-ini.mkiv +++ b/tex/context/base/meta-ini.mkiv @@ -403,10 +403,9 @@ %D \uniqueMPgraphic{meta:hash}{gap=10pt,angle=30} %D \stoptyping -\newcount\MPobjectcounter -\newbox \MPgraphicbox - -\chardef\MPboxmode\zerocount +\newcount \MPobjectcounter +\newbox \MPgraphicbox +\newconstant\MPboxmode \def\doobeyMPboxdepth % mode = 1 {\setbox\MPgraphicbox\hbox{\hskip\MPllx\onebasepoint\raise\MPlly\onebasepoint\box\MPgraphicbox}} @@ -418,9 +417,9 @@ \ht\MPgraphicbox\the\ht\MPgraphicbox \dp\MPgraphicbox\the\dp\MPgraphicbox}} -\def\obeyMPboxdepth {\chardef\MPboxmode\plusone} -\def\ignoreMPboxdepth{\chardef\MPboxmode\plustwo} -\def\normalMPboxdepth{\chardef\MPboxmode\zerocount} +\def\obeyMPboxdepth {\MPboxmode\plusone} +\def\ignoreMPboxdepth{\MPboxmode\plustwo} +\def\normalMPboxdepth{\MPboxmode\zerocount} % compatibility hack: @@ -639,8 +638,6 @@ def data_mpy_file = "\MPdataMPYfile" enddef ; \stopMPextensions -\chardef\currentMPgraphic\plusone - \def\getMPdata {\let\MPdata\secondoftwoarguments \startreadingfile @@ -984,58 +981,6 @@ \newtoks\everyinsertMPfile -% removed in backend: -% -% \def\doinsertMPfile#1% -% {\doiffileelse{./#1}{\includeMPasPDF{./#1}}{\message{[MP #1]}}} -% -% \let\insertMPfileARG\insertMPfile -% -% \def\insertMPfile#1#2% in context #2 is empty -% {\doifelsenothing{#2}{\doinsertMPfile{#1}}{\insertMPfileARG{#1}{#2}}} -% -% \def\includeMPasEPS#1% untested !! -% {\bgroup -% \message{[MP as EPS #1]}% -% \the\everyinsertMPfile -% \dogetEPSboundingbox{#1}\!!widtha\!!heighta\!!widthb\!!heightb -% \setbox\scratchbox\vbox to \!!heightb -% {\vfill -% \let \@@DriverImageType \c!mps -% \def \@@DriverImageFile {#1}% -% \edef\@@DriverImageWidth {\the\!!widthb }% -% \edef\@@DriverImageHeight{\the\!!heightb}% -% \doinsertfile}% -% \wd\scratchbox\!!widthb -% \dp\scratchbox\zeropoint -% \box\scratchbox -% \egroup} -% -% \def\includeMPasPDF#1% -% {\bgroup -% \the\everyinsertMPfile -% \ifinobject \else \chardef\makeMPintoPDFobject\plustwo \fi % when needed -% \convertMPtoPDF{#1}{1}{1}% no \plusone ! -% \egroup} -% -% %D So, using a low level approach (thereby avoiding the slower -% %D figure analysis macros) pays off. This kind of -% %D optimizations are a bit tricky since we must make sure that -% %D special resources end up in the (PDF) files. Because the -% %D \METAPOST\ to \PDF\ can handle objects itself, it is not -% %D that complicated. -% -% %D We hook a couple of initializations into the graphic -% %D macros. -% -% \appendtoks -% \let\figuretypes\c!mps -% \runutilityfilefalse -% \consultutilityfilefalse -% \to \everyinsertMPfile -% -% %D One more: (still needed?) - \startMPextensions def initialize_form_numbers = do_initialize_numbers; @@ -1220,16 +1165,16 @@ %D \stopuseMPgraphic %D %D \starttabulate -%D \NC 0\quad \NC \chardef\MPcolormethod0 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR -%D \NC 1\quad \NC \chardef\MPcolormethod1 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR -%D \NC 2\quad \NC \chardef\MPcolormethod2 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR -%D \NC 3\quad \NC \chardef\MPcolormethod3 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR +%D \NC 0\quad \NC \MPcolormethod0 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR +%D \NC 1\quad \NC \MPcolormethod1 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR +%D \NC 2\quad \NC \MPcolormethod2 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR +%D \NC 3\quad \NC \MPcolormethod3 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR %D \stoptabulate %D \stopbuffer %D %D \typebuffer \getbuffer -\chardef\MPcolormethod\zerocount +\newconstant\MPcolormethod % can be faster, just @@ -1258,7 +1203,7 @@ %D behave in unexpected ways. \appendtoks - \doifelse\@@mpcolor\v!global{\chardef\MPcolormethod\plusone}{\chardef\MPcolormethod\zerocount}% + \doifelse\@@mpcolor\v!global{\MPcolormethod\plusone}{\MPcolormethod\zerocount}% \to \everysetupMPgraphics \setupMPgraphics diff --git a/tex/context/base/meta-pdf.mkii b/tex/context/base/meta-pdf.mkii index 2099b0d37..0ba3fb979 100644 --- a/tex/context/base/meta-pdf.mkii +++ b/tex/context/base/meta-pdf.mkii @@ -149,9 +149,9 @@ %D The last object number used is avaliable in the macro %D \type {\lastPDFMPobject}. -\ifx\makeMPintoPDFobject \undefined \chardef\makeMPintoPDFobject \zerocount \fi -\ifx\blackoutMPgraphic \undefined \chardef\blackoutMPgraphic \plusone \fi -\ifx\everyMPtoPDFconversion\undefined \newtoks\everyMPtoPDFconversion \fi +\ifx\makeMPintoPDFobject \undefined \newcount\makeMPintoPDFobject \fi +\ifx\blackoutMPgraphic \undefined \chardef\blackoutMPgraphic\plusone \fi +\ifx\everyMPtoPDFconversion\undefined \newtoks\everyMPtoPDFconversion \fi \let\lastPDFMPobject \!!zerocount \let\currentPDFresources\empty @@ -238,7 +238,7 @@ \def\dopackageMPgraphic#1% #1 = boxregister {\ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else % an existing value of 2 signals object support (set elsewhere) - \chardef\makeMPintoPDFobject\plusone + \makeMPintoPDFobject\plusone \fi\fi \ifcase\makeMPintoPDFobject \box#1% diff --git a/tex/context/base/meta-pdh.mkiv b/tex/context/base/meta-pdh.mkiv index 2a8aabed4..ec9bab9d8 100644 --- a/tex/context/base/meta-pdh.mkiv +++ b/tex/context/base/meta-pdh.mkiv @@ -36,7 +36,7 @@ %D First we define a handy constant: -\bgroup \catcode`\%=\@@other \xdef\letterpercent{\string%} \egroup +\bgroup \catcode`\%=\othercatcode \xdef\letterpercent{\string%} \egroup %D \macros %D {convertMPtoPDF} @@ -78,8 +78,8 @@ %D The last object number used is avaliable in the macro %D \type {\lastPDFMPobject}. -\ifx\makeMPintoPDFobject \undefined \chardef\makeMPintoPDFobject \zerocount \fi -\ifx\everyMPtoPDFconversion\undefined \newtoks\everyMPtoPDFconversion \fi +\ifx\makeMPintoPDFobject \undefined \newconstant\makeMPintoPDFobject \fi +\ifx\everyMPtoPDFconversion\undefined \newtoks \everyMPtoPDFconversion \fi \let\lastPDFMPobject \!!zerocount \let\currentPDFresources\empty @@ -144,7 +144,7 @@ \def\dopackageMPgraphic#1% #1 = boxregister {\ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else % an existing value of 2 signals object support (set elsewhere) - \chardef\makeMPintoPDFobject\plusone + \makeMPintoPDFobject\plusone \fi\fi \ifcase\makeMPintoPDFobject \box#1% diff --git a/tex/context/base/mlib-ctx.lua b/tex/context/base/mlib-ctx.lua index 00d043ad1..5a557c046 100644 --- a/tex/context/base/mlib-ctx.lua +++ b/tex/context/base/mlib-ctx.lua @@ -75,7 +75,7 @@ end statistics.register("metapost processing time", function() local n = metapost.n - if n > 0 then + if n and n > 0 then local e, t = metapost.makempy.nofconverted, statistics.elapsedtime local str = format("%s seconds, loading: %s seconds, execution: %s seconds, n: %s", t(metapost), t(mplib), t(metapost.exectime), n) diff --git a/tex/context/base/mult-ini.mkiv b/tex/context/base/mult-ini.mkiv index 493a04cea..de00af83b 100644 --- a/tex/context/base/mult-ini.mkiv +++ b/tex/context/base/mult-ini.mkiv @@ -361,7 +361,7 @@ \unexpanded\def\startmessages #1 library: #2 % {\bgroup \ifcsname\m!prefix!#2\endcsname\else\setgvalue{\m!prefix!#2}{#2}\fi - \catcode13=\active + \catcode13=\activecatcode \doifinsetelse{#1}{\currentresponses,all}\dostartmessages\nostartmessages{#2}} \def\dostartmessages#1#2\stopmessages diff --git a/tex/context/base/node-bck.mkiv b/tex/context/base/node-bck.mkiv index 41a6da2cb..e7ec49d27 100644 --- a/tex/context/base/node-bck.mkiv +++ b/tex/context/base/node-bck.mkiv @@ -69,10 +69,10 @@ {\doiffastoptionalcheckelse{\tabulatenormalcolumnyes#1}{\tabulatenormalcolumnnop#1}} \def\tabulatenormalcolumnnop#1% overloads anch-pgr - {&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi&\global\chardef\tabulatetype#1&} + {&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi&\global\tabulatetype#1&} \def\tabulatenormalcolumnyes#1[#2]% - {&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi&\global\chardef\tabulatetype#1&% + {&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi&\global\tabulatetype#1&% \iftrialtypesetting\else\settabulatecolor{#2}\fi\ignorespaces} \newcount\maxtabularcolorcolumn diff --git a/tex/context/base/node-fin.mkiv b/tex/context/base/node-fin.mkiv index 8e3ce5c3d..ffa4b8bf5 100644 --- a/tex/context/base/node-fin.mkiv +++ b/tex/context/base/node-fin.mkiv @@ -20,7 +20,7 @@ \registerctxluafile{node-fin}{1.001} % we might generalize this one -\definesystemattribute[trigger] \chardef\triggerattribute \dogetattributeid{trigger} % feature inheritance +\definesystemattribute[trigger][public] \def\finalizeobjectbox #1{\ctxlua{nodes.handlers.finalize(tex.box[\number#1])}} \def\finalizeshipoutbox#1{\ctxlua{nodes.handlers.finalize(tex.box[\number#1])}} diff --git a/tex/context/base/node-par.mkiv b/tex/context/base/node-par.mkiv index 28c8931d3..2e9efde1f 100644 --- a/tex/context/base/node-par.mkiv +++ b/tex/context/base/node-par.mkiv @@ -30,7 +30,7 @@ \registerctxluafile{node-par}{1.001} -\definesystemattribute[parbuilder] \chardef\parbuilderattribute \dogetattributeid{parbuilder} +\definesystemattribute[parbuilder][public] % todo auto-enable diff --git a/tex/context/base/node-res.lua b/tex/context/base/node-res.lua index ea34f935c..1487faa66 100644 --- a/tex/context/base/node-res.lua +++ b/tex/context/base/node-res.lua @@ -183,10 +183,18 @@ function pool.rule(width,height,depth,dir) return n end -function pool.latelua(code) - local n = copy_node(latelua) - n.data = code - return n +if node.has_field(latelua,'string') then + function pool.latelua(code) + local n = copy_node(latelua) + n.string = code + return n + end +else + function pool.latelua(code) + local n = copy_node(latelua) + n.data = code + return n + end end function pool.leftmarginkern(glyph,width) diff --git a/tex/context/base/node-spl.mkiv b/tex/context/base/node-spl.mkiv index 062ce35fe..8ad6795a5 100644 --- a/tex/context/base/node-spl.mkiv +++ b/tex/context/base/node-spl.mkiv @@ -15,7 +15,7 @@ \registerctxluafile{node-spl}{1.001} -\definesystemattribute[splitter] \chardef\splitterattribute \dogetattributeid{splitter} +\definesystemattribute[splitter][public] %D This module is specially made for the oriental \TEX\ project. The working is as %D follows (and tuned for fonts like Idris' Husayni. The following method came to diff --git a/tex/context/base/pack-lyr.mkiv b/tex/context/base/pack-lyr.mkiv index 0cb3ee244..7ef6baea4 100644 --- a/tex/context/base/pack-lyr.mkiv +++ b/tex/context/base/pack-lyr.mkiv @@ -237,8 +237,6 @@ \newdimen\layerwidth \newdimen\layerheight -\chardef\@@lacome=1 % LAyerCOnstructionMEthod / temp, will be default - \def\dododosetlayer[#1][#2][#3]% will be sped up {% we use the global width, never change this \def\currentlayer{#1}% @@ -343,20 +341,16 @@ \ifdim\scratchdimen<\getboxllx\layerpagebox \gsetboxllx\layerpagebox\scratchdimen \fi - \ifcase\@@lacome\or % this test will become obsolete - \advance\scratchdimen\nextboxwd - \nextboxwd\ifdim\scratchdimen>\lastlayerwidth \scratchdimen \else \lastlayerwidth \fi - \fi + \advance\scratchdimen\nextboxwd + \nextboxwd\ifdim\scratchdimen>\lastlayerwidth \scratchdimen \else \lastlayerwidth \fi \scratchdimen\dimexpr\@@layerypos+\@@layeryoff\relax \ifdim\scratchdimen<\getboxlly\layerpagebox \gsetboxlly\layerpagebox\scratchdimen \fi % ll compensation - \ifcase\@@lacome\or % this test will become obsolete - \advance\scratchdimen\dimexpr\nextboxht+\nextboxdp\relax - \nextboxht\ifdim\scratchdimen>\lastlayerheight \scratchdimen \else \lastlayerheight \fi - \nextboxdp\zeropoint - \fi + \advance\scratchdimen\dimexpr\nextboxht+\nextboxdp\relax + \nextboxht\ifdim\scratchdimen>\lastlayerheight \scratchdimen \else \lastlayerheight \fi + \nextboxdp\zeropoint % placement \hsize\layerparameter\c!width % new, keep box small \vbox to \layerparameter\c!height \bgroup diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index b0e9f858d..22d7ee3b4 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -571,8 +571,6 @@ %D start with defining some booleans. These give an impression %D of what we are going to take into account. -% todo: chardefs - \newif\ifboxhasoffset \newif\ifboxhaswidth \newif\ifboxhasheight @@ -1629,13 +1627,13 @@ %D Beware, since we entered a group and either or not grab the next %D bgroup token, we need to finish the group in the oneliner mode. -\ifx\raggedoneliner\undefined \chardef\raggedoneliner\zerocount \fi +\ifdefined\raggedonelinerstate \else \newconditional\raggedonelinerstate \fi \def\doformatonelinerbox % beware: assumes explicit preceding bgroup - {\ifcase\raggedoneliner - \expandafter\nodoformatonelinerbox - \else + {\ifconditional\raggedonelinerstate \expandafter\dodoformatonelinerbox + \else + \expandafter\nodoformatonelinerbox \fi} \def\dodoformatonelinerbox @@ -2368,25 +2366,27 @@ %D %D which looks like: \thinrules[n=2] +\newconstant\ruletype + \def\thinrule {\strut \bgroup - \chardef\ruletype\plusone + \ruletype\plusone \processaction [\@@dlalternative] - [ \v!a=>\chardef\ruletype0,% no line - %\v!b=>\chardef\ruletype1,% height/depth - \v!c=>\chardef\ruletype2,% topheight/botdepth - % 11=>\chardef\ruletype1,% fallback for backgrounds - 0=>\chardef\ruletype0,% compatible with backgrounds - % 1=>\chardef\ruletype1,% compatible with backgrounds - 2=>\chardef\ruletype2]% compatible with backgrounds + [ \v!a=>\ruletype\zerocount,% no line + %\v!b=>\ruletype\plusone ,% height/depth + \v!c=>\ruletype\plustwo ,% topheight/botdepth + % 11=>\ruletype\plusone ,% fallback for backgrounds + 0=>\ruletype\zerocount,% compatible with backgrounds + % 1=>\ruletype\plusone ,% compatible with backgrounds + 2=>\ruletype\plustwo ]% compatible with backgrounds \doifsomething\@@dlrulethickness {\linewidth\@@dlrulethickness}% \ifdim\linewidth=\zeropoint - \chardef\ruletype\zerocount + \ruletype\zerocount \else - \doifnot\@@dlframe\v!on{\chardef\ruletype\zerocount}% + \doifnot\@@dlframe\v!on{\ruletype\zerocount}% \fi \ifnum\ruletype=\plusone \doif\@@dlheight\v!max{\let\@@dlheight\!!plusone}% @@ -3235,7 +3235,7 @@ % 0=no-split, 1=no-split+indent, 2=split, 3=split+indent -\chardef\backgroundsplitmode\plusthree +\setnewconstant\backgroundsplitmode\plusthree %D The \type{\vbox to \lineheight{}\vskip\zeropoint} %D construction gives the first real line a decent height by @@ -3264,7 +3264,7 @@ \dimen2\leftskip % new ** \forgetall \ifinsidefloat - \chardef\backgroundsplitmode\zerocount + \backgroundsplitmode\zerocount \fi \ifcase\backgroundsplitmode \localframed[\??ag][\c!offset=\v!overlay]{\box0}% @@ -3278,11 +3278,11 @@ \loop \ifdim\pagetotal=\zeropoint % empty page \scratchdimen\textheight - \chardef\backgroundsplit\plusone % split to max height + \backgroundsplit\plusone % split to max height \else \setbox\scratchbox\vbox{\@@agbefore}% \scratchdimen\dimexpr\pagegoal-\ht\scratchbox-\pagetotal\relax - \chardef\backgroundsplit\plustwo % split to partial height + \backgroundsplit\plustwo % split to partial height \fi \advance\scratchdimen\dimexpr-\@@agtopoffset-\@@agbottomoffset\relax \ifdim\scratchdimen>2\lineheight\relax % reasonable, will be configurable @@ -3290,7 +3290,7 @@ \setbox2\vsplit0 to \scratchdimen \else \setbox2\box0 - \chardef\backgroundsplit\zerocount % no split + \backgroundsplit\zerocount % no split \fi \setbox2\vbox \ifcase\backgroundsplit\or to \textheight \fi % max split {\vskip\@@agtopoffset diff --git a/tex/context/base/page-bck.mkiv b/tex/context/base/page-bck.mkiv index 93400943d..ddea18c5f 100644 --- a/tex/context/base/page-bck.mkiv +++ b/tex/context/base/page-bck.mkiv @@ -13,8 +13,6 @@ \writestatus{loading}{ConTeXt Page Macros / Backgrounds} -% \chardef\kindofpagetextareas=1 will isolate graphics from backgrounds - % todo \fastlocalframed -> \localbackgroundframed \unprotect @@ -248,8 +246,8 @@ %D background at the same time since something may have %D changed halfway a page. -\chardef\newrightbackground\zerocount -\chardef\newleftbackground \zerocount +\newconditional\newrightbackground +\newconditional\newleftbackground \def\recalculatebackgrounds {\global\newbackgroundtrue} @@ -262,28 +260,31 @@ \ifx\@@mastate\v!repeat\else\global\newbackgroundfalse\fi} \def\dosetbackgroundboxesr - {\global\chardef\newrightbackground\plusone - \global\chardef\newleftbackground\plusone + {\global\settrue\newrightbackground + \global\settrue\newleftbackground \global\setbox\leftbackground\emptybox \global\setbox\rightbackground\emptybox} + \def\dosetbackgroundboxesa - {\ifcase\newleftbackground \else + {\ifconditional\newleftbackground % \showmessage\m!layouts8\empty \setbackgroundbox\leftbackground\relax - \global\chardef\newleftbackground\zerocount - \global\chardef\newrightbackground\zerocount + \global\setfalse\newleftbackground + \global\setfalse\newrightbackground \fi} + \def\dosetbackgroundboxesb - {\ifcase\newleftbackground \else + {\ifconditional\newleftbackground % \showmessage\m!layouts8\empty \setbackgroundbox\leftbackground\relax - \global\chardef\newleftbackground\zerocount + \global\setfalse\newleftbackground \fi} + \def\dosetbackgroundboxesc - {\ifcase\newrightbackground \else + {\ifconditional\newrightbackground % \showmessage\m!layouts8\empty \setbackgroundbox\rightbackground\doswapmargins - \global\chardef\newrightbackground\zerocount + \global\setfalse\newrightbackground \fi} \def\addmainbackground#1% todo: dimension spec diff --git a/tex/context/base/page-imp.mkiv b/tex/context/base/page-imp.mkiv index e66924e61..ec13e240c 100644 --- a/tex/context/base/page-imp.mkiv +++ b/tex/context/base/page-imp.mkiv @@ -148,9 +148,10 @@ % \stoptypen \newcount\shippedoutpages +\newcount\combinedpagescounter -\let\pagestoshipout\empty % {1,3,6} -\chardef\whichpagetoshipout=0 % 0=all 1=odd 2=even +\let\pagestoshipout\empty % {1,3,6} +\newconstant\whichpagetoshipout % 0=all 1=odd 2=even \newbox\shipoutscratchbox @@ -235,12 +236,15 @@ \def\arrangedrotationO{0} \def\arrangedrotationE{0} -\newcounter\arrangedpageN -\newcounter\arrangedpageM +\newcount\arrangedpageN +\newcount\arrangedpageM -\chardef\arrangedpageT=1 -\chardef\arrangedpageX=1 -\chardef\arrangedpageY=1 +\newcount\arrangedpageT \arrangedpageT\plusone +\newcount\arrangedpageX \arrangedpageX\plusone +\newcount\arrangedpageY \arrangedpageY\plusone + +% \newcount\horizontalcutmarks +% \newcount\verticalcutmarks \def\calculatepaperoffsets#1% {\scratchdimen\getvalue{\??pp#1\c!offset}% @@ -280,7 +284,7 @@ \global\arrangingpagesfalse \fi \doifcommonelse{#1}{90,270,\v!rotated} - {\swapmacros\horizontalcutmarks\verticalcutmarks}{}% ugly solution + {\swapcounts\horizontalcutmarks\verticalcutmarks}{}% ugly solution \setuppapersize \fi} @@ -291,11 +295,11 @@ {\executeifdefined{\??pp\??pp#1}\donothing} \def\dosetuparrangement#1#2#3#4#5#6#7#8% - {\global\chardef\arrangedpageX #1% - \global\chardef\arrangedpageY #2% - \global\chardef\arrangedpageT #3% - \global\chardef\horizontalcutmarks#4% - \global\chardef\verticalcutmarks #5% + {\global\arrangedpageX #1% + \global\arrangedpageY #2% + \global\arrangedpageT #3% + \global\horizontalcutmarks#4% + \global\verticalcutmarks #5% \global\let \pusharrangedpage #6% \global\let \poparrangedpages #7% \global\let \handlearrangedpage#8} @@ -430,11 +434,11 @@ \paperheight\arrangedpageY\paperheight \outputarrangedbox\arrangedpageA \outputarrangedbox\arrangedpageB - \doglobal\newcounter\arrangedpageN + \global\arrangedpageN\zerocount \fi} \def\pusharrangedpageTHIRTYTWO#1% taco's challenge - {\doglobal\increment\arrangedpageN + {\global\advance\arrangedpageN\plusone \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}033\arrangedpageA % 1 @@ -473,7 +477,7 @@ \fi} \def\pusharrangedpageSIXTEEN#1% changed to match the official way of doing - {\doglobal\increment\arrangedpageN + {\global\advance\arrangedpageN\plusone \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}031\arrangedpageA % 1 @@ -496,7 +500,7 @@ \fi} \def\pusharrangedpageEIGHT#1% changed to match the official way of doing - {\doglobal\increment\arrangedpageN + {\global\advance\arrangedpageN\plusone \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}011\arrangedpageA % 1 @@ -514,7 +518,7 @@ \def\pusharrangedpageFOURB{\pusharrangedpageFOURdo10} \def\pusharrangedpageFOURdo#1#2#3% - {\doglobal\increment\arrangedpageN + {\global\advance\arrangedpageN\plusone \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#3}010\arrangedpageA % 1 @@ -525,7 +529,7 @@ \fi} \def\pusharrangedpageSIDETOP#1% - {\doglobal\increment\arrangedpageN + {\global\advance\arrangedpageN\plusone \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}000\arrangedpageA % 1 @@ -610,11 +614,11 @@ \ifdim\ht\arrangedpageB=\zeropoint \exitloop \fi}% - \doglobal\newcounter\arrangedpageN + \global\arrangedpageN\zerocount \fi} \def\pusharrangedpageTWO#1% - {\doglobal\increment\arrangedpageN + {\global\advance\arrangedpageN\plusone \reportarrangedpage\arrangedpageN \global\setbox\arrangedpageB\vbox {%\forgetall @@ -628,16 +632,18 @@ \def\poparrangedpagesTWOTOPSIDE {\ifnum\arrangedpageN>\zerocount \bgroup - \gdef\arrangedpageN{2}\poparrangedpagesTWO + \global\arrangedpageN\plustwo + \poparrangedpagesTWO \let\arrangedpageA\arrangedpageC \let\arrangedpageB\arrangedpageD - \gdef\arrangedpageN{2}\poparrangedpagesTWO - \doglobal\newcounter\arrangedpageN + \global\arrangedpageN\plustwo + \poparrangedpagesTWO + \global\arrangedpageN\zerocount \egroup \fi} \def\pusharrangedpageTWOTOPSIDE#1% - {\doglobal\increment\arrangedpageN + {\global\advance\arrangedpageN\plusone \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}000\arrangedpageA % 1 @@ -662,7 +668,7 @@ \outputarrangedbox\arrangedpageF \outputarrangedbox\arrangedpageG \outputarrangedbox\arrangedpageH - \doglobal\newcounter\arrangedpageN + \global\arrangedpageN\zerocount \fi} % to arrange 16 pages on 2 sheets to form one booklet @@ -676,13 +682,13 @@ \outputarrangedbox\arrangedpageB \outputarrangedbox\arrangedpageC \outputarrangedbox\arrangedpageD - \doglobal\newcounter\arrangedpageN + \global\arrangedpageN\zerocount \fi} % to arrange 16 pages on 4 sheets to form one booklet \def\pusharrangedpageSIXTEENFOUR#1% - {\doglobal\increment\arrangedpageN + {\global\advance\arrangedpageN\plusone \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1 @@ -707,7 +713,7 @@ % to arrange 16 pages on 2 sheets to form one booklet \def\pusharrangedpageSIXTEENTWO#1% - {\doglobal\increment\arrangedpageN + {\global\advance\arrangedpageN\plusone \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}011\arrangedpageA % 1 @@ -742,10 +748,10 @@ % \starttext \dorecurse{30}{test \recurselevel \page} \stoptext \def\pusharrangedpageXY#1% - {\doglobal\increment\arrangedpageN - \reportarrangedpage\arrangedpageN - \doglobal\increment\arrangedpageM - \global\setbox\arrangedpageB\hbox + {\global\advance\arrangedpageN\plusone + \reportarrangedpage\arrangedpageN + \global\advance\arrangedpageM\plusone + \global\setbox\arrangedpageB\hbox \ifdim\@@ppwidth>\zeropoint to \@@ppwidth \fi {\ifvoid\arrangedpageB\else \unhbox\arrangedpageB @@ -765,7 +771,7 @@ \ifdim\@@ppdy>\zeropoint \else \vss\fi \fi \box\arrangedpageB}% - \doglobal\newcounter\arrangedpageM + \global\arrangedpageM\zerocount \fi \ifnum\arrangedpageN<\arrangedpageT\else \poparrangedpages @@ -777,8 +783,8 @@ \paperwidth\arrangedpageX\paperwidth \paperheight \arrangedpageY\paperheight \outputarrangedbox\arrangedpageA - \doglobal\newcounter\arrangedpageN - \doglobal\newcounter\arrangedpageM + \global\arrangedpageN\zerocount + \global\arrangedpageM\zerocount \fi} \installpagearrangement XY @@ -1033,7 +1039,7 @@ \egroup} \setvalue{\??ip::\c!alternative:\v!a}% - {\globallet\combinedpagescounter\@@ipstart + {\global\combinedpagescounter\@@ipstart \doloop {\vbox to \textheight {\hsize\textwidth % ? ? @@ -1054,7 +1060,7 @@ \else\ifnum\combinedpagescounter>\@@ipn \else \externalfigure[\@@ipname] [\c!object=\v!no, - \c!page=\combinedpagescounter, + \c!page=\number\combinedpagescounter, \c!factor=\v!max, \c!background=\@@ipbackground, \c!backgroundcolor=\@@ipbackgroundcolor, @@ -1062,7 +1068,7 @@ \fi\fi \@@ipright} \@@ipbottom}% - \doglobal\increment\combinedpagescounter + \global\advance\combinedpagescounter\plusone \hfil}% \hfilneg} \vfil}% @@ -1071,7 +1077,7 @@ \ifnum\combinedpagescounter>\@@ipn \exitloop\fi}} \setvalue{\??ip::\c!alternative:\v!c}% - {\globallet\combinedpagescounter\@@ipstart + {\global\combinedpagescounter\@@ipstart \doloop {\vbox to \textheight {\hsize\textwidth % ? ? @@ -1094,13 +1100,13 @@ \else\ifnum\combinedpagescounter>\@@ipn \else \externalfigure[\@@ipname] [\c!object=\v!no, - \c!page=\combinedpagescounter, + \c!page=\number\combinedpagescounter, \c!factor=\v!max, \c!background=\@@ipbackground, \c!backgroundcolor=\@@ipbackgroundcolor, \c!frame=\@@ipframe]% \fi\fi}} - \doglobal\increment\combinedpagescounter + \global\advance\combinedpagescounter\plusone \@@ipbottom}% \vfil}% \vfilneg} @@ -1113,17 +1119,17 @@ \setvalue{\??ip::\c!alternative:\v!vertical }{\getvalue{\??ip::\c!alternative:\v!c}} \setvalue{\??ip::\c!alternative:\v!b}% - {\globallet\combinedpagescounter\@@ipstart + {\global\combinedpagescounter\@@ipstart \doloop {\startbaselinecorrection \scratchdimen\@@ipdistance \!!widtha\dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax \hbox to \hsize {\dorecurse\@@ipnx - {\doglobal\increment\combinedpagescounter + {\global\advance\combinedpagescounter\plusone \ifnum\combinedpagescounter>\@@ipn \else \normalexpanded{\noexpand\externalfigure[\@@ipname] - [\c!page=\combinedpagescounter, + [\c!page=\number\combinedpagescounter, \c!width=\the\!!widtha,% todo \freezedimenmacro \c!background=\@@ipbackground, \c!backgroundcolor=\@@ipbackgroundcolor, diff --git a/tex/context/base/page-ini.mkiv b/tex/context/base/page-ini.mkiv index 111a10511..3cc0778f9 100644 --- a/tex/context/base/page-ini.mkiv +++ b/tex/context/base/page-ini.mkiv @@ -28,7 +28,7 @@ \def\m!otr{otr} -\chardef\normalpagebox=255 +% \setnewconstant\normalpagebox 255 % already set \newbox\pagebox @@ -335,8 +335,8 @@ \newcount\nofcolumns \nofcolumns = 1 \newcount\mofcolumns \mofcolumns = 1 -\chardef\maxnofcolumns = 50 -\chardef\allocatednofcolumns = 0 +\setnewconstant\maxnofcolumns 50 +\setnewconstant\allocatednofcolumns 0 %D The next dimensions reports the final column height @@ -369,7 +369,7 @@ \@EA\newbox\csname\@col@-\recurselevel-h\endcsname % top insert \@EA\newbox\csname\@col@-\recurselevel-l\endcsname % top insert \fi}% - \global\chardef\allocatednofcolumns=\nofcolumns + \global\allocatednofcolumns\nofcolumns \fi} \def\firstcolumnbox {\columntextbox\plusone} @@ -451,7 +451,7 @@ \newdimen\localcolumnwidth \newdimen\savedpagetotal -\chardef\columndirection=0 % 0:lr 1:rl +\newconstant\columndirection % 0:lr 1:rl \def\minbalancetoplines {1} \def\minfreecolumnlines {2} @@ -579,8 +579,6 @@ \maxdeadcycles=1000 -% will be installable tracer; better use chardef - % this needs a real cleanup \def\doplaceversiontext#1#2% @@ -615,13 +613,13 @@ % tot hier \def\doversion[#1]% - {\chardef\conceptmode\zerocount + {\conceptmode\zerocount \overfullrule\zeropoint \processaction % \v!final=> [#1] - [ \v!concept=>\chardef\conceptmode\plusone, % simple banner - \v!file=>\chardef\conceptmode\plustwo, % full banner - \v!temporary=>\chardef\conceptmode\plusthree % full banner plus + [ \v!concept=>\conceptmode\plusone, % simple banner + \v!file=>\conceptmode\plustwo, % full banner + \v!temporary=>\conceptmode\plusthree % full banner plus \overfullrule5\points]} % info in the margin \def\version @@ -702,28 +700,28 @@ \newtoks\afterpage \newtoks\aftereverypage \newtoks\beforepage \newtoks\beforeeverypage -\chardef\showgridstate=0 +\newconstant\showgridstate \def\showgrid {\dosingleempty\doshowgrid} \def\doshowgrid[#1]% - {\chardef\showgridstate \plusone % downward compatible default - \chardef\gridboxlinemode \plusone - \chardef\gridboxlinenomode\plusone + {\showgridstate \plusone % downward compatible default + \gridboxlinemode \plusone + \gridboxlinenomode\plusone \processallactionsinset [#1]% - [ \v!reset=>\chardef\showgridstate \zerocount, - \v!bottom=>\chardef\showgridstate \plusone, - \v!top=>\chardef\showgridstate \plustwo, - \v!none=>\chardef\gridboxlinemode \zerocount, - \v!all=>\chardef\gridboxlinemode \plusone, - \v!lines=>\chardef\gridboxlinemode \plustwo, - \v!frame=>\chardef\gridboxlinemode \plusthree, - \v!nonumber=>\chardef\gridboxlinenomode\zerocount, - \v!right=>\chardef\gridboxlinenomode\plusone, - \v!left=>\chardef\gridboxlinenomode\plustwo, - \v!outer=>\chardef\gridboxlinenomode\plusthree]% + [ \v!reset=>\showgridstate \zerocount, + \v!bottom=>\showgridstate \plusone, + \v!top=>\showgridstate \plustwo, + \v!none=>\gridboxlinemode \zerocount, + \v!all=>\gridboxlinemode \plusone, + \v!lines=>\gridboxlinemode \plustwo, + \v!frame=>\gridboxlinemode \plusthree, + \v!nonumber=>\gridboxlinenomode\zerocount, + \v!right=>\gridboxlinenomode\plusone, + \v!left=>\gridboxlinenomode\plustwo, + \v!outer=>\gridboxlinenomode\plusthree]% \ifcase\showgridstate \let\addtextgridlayer\gobbleoneargument \else % 1=bottom 2=top @@ -784,14 +782,14 @@ \newif\ifarrangingpages \arrangingpagesfalse -\chardef\pageornamentstate\zerocount % 0=on 1=one-off 2=always-off +\newconstant\pageornamentstate % 0=on 1=one-off 2=always-off -\def\pagebodyornamentstrue {\chardef\pageornamentstate\zerocount} % for a while -\def\pagebodyornamentsfalse{\chardef\pageornamentstate\plusone} % for a while +\def\pagebodyornamentstrue {\pageornamentstate\zerocount} % for a while +\def\pagebodyornamentsfalse{\pageornamentstate\plusone} % for a while \appendtoks \ifcase\pageornamentstate\or - \chardef\pageornamentstate\zerocount + \pageornamentstate\zerocount \fi \to \everyaftershipout @@ -809,7 +807,7 @@ \def\reportarrangedpage#1% {\showmessage\m!systems - {23}{\the\realpageno.\the\pageno\ifnum\subpageno>0 .\the\subpageno\fi,#1}} + {23}{\the\realpageno.\the\pageno\ifnum\subpageno>0 .\the\subpageno\fi,\number#1}} \newif\ifsavepagebody \newbox\savedpagebody @@ -922,8 +920,8 @@ \newif\ifpagebreakdisabled \pagebreakdisabledfalse -\chardef\testpagemethod \zerocount % todo: \testnewpage[method=,lines=,voffset=] -\chardef\testpagetrigger\zerocount +\newconstant\testpagemethod % todo: \testnewpage[method=,lines=,voffset=] +\newconstant\testpagetrigger \def\testpage {\dotripleempty\dotestpage[\plusone ]} % \def\testpageonly{\dotripleempty\dotestpage[\plustwo ]} % no penalties added to the mvl @@ -1060,7 +1058,7 @@ \edef\prevrealpageno{\the\realpageno}% \ifcase\pageornamentstate \or % disable reset after shipout - \global\chardef\pageornamentstate\plustwo + \global\pageornamentstate\plustwo \fi \iffirstargument % or if empty i.e. [] \executepagebreakhandlers{#1}% @@ -1073,7 +1071,7 @@ % as WS found out so we have to wait till the next side % effect shows up % \ifcase\pageornamentstate\or - \global\chardef\pageornamentstate\zerocount + \global\pageornamentstate\zerocount % \fi \fi \egroup} @@ -1109,7 +1107,7 @@ {} % do nothing if empty \installpagebreakhandler \v!reset - {% better not: \global\chardef\pageornamentstate\zerocount + {% better not: \global\pageornamentstate\zerocount \resetpagebreak} \installpagebreakhandler \v!disable @@ -1131,7 +1129,7 @@ \installpagebreakhandler \v!blank {\ifcase\pageornamentstate - \global\chardef\pageornamentstate\plusone + \global\pageornamentstate\plusone \fi} \installpagebreakhandler \v!no @@ -1497,7 +1495,7 @@ {\ifvoid\facingpage\else \ifnum\realpageno>\plusone \bgroup - \chardef\pageornamentstate\plusone + \pageornamentstate\plusone \finishfacingpage \myshipout{\buildpagebody\box\facingpage}% \egroup diff --git a/tex/context/base/page-lay.mkiv b/tex/context/base/page-lay.mkiv index 28f9be594..0c7c7b769 100644 --- a/tex/context/base/page-lay.mkiv +++ b/tex/context/base/page-lay.mkiv @@ -266,10 +266,10 @@ %D We keep track of these features with the following %D variables. -\chardef\papermirror =0 \chardef\printmirror =0 -\chardef\paperorientation=0 \chardef\printorientation=0 % beware: later no chardef -\chardef\paperreverse =0 \chardef\printreverse =0 -\chardef\paperlandscape =0 \chardef\printlandscape =0 +\newconditional\papermirror \newconditional\printmirror +\newconstant \paperorientation \newconstant \printorientation +\newconstant \paperreverse \newconstant \printreverse +\newconditional\paperlandscape \newconditional\printlandscape \let\papersize\empty \let\printpapersize\empty @@ -361,10 +361,10 @@ \global\setdimentoatleast\paperheight \onepoint \global\setdimentoatleast\printpaperwidth \onepoint \global\setdimentoatleast\printpaperheight\onepoint - \ifcase\paperlandscape\else + \ifconditional\paperlandscape \doglobal\swapdimens\paperwidth\paperheight \fi - \ifcase\printlandscape\else + \ifconditional\printlandscape \doglobal\swapdimens\printpaperwidth\printpaperheight \fi % this check can be confusing, so we've added the possibility @@ -372,12 +372,16 @@ \doif\@@ppoption\v!max % \v!fit is {\bgroup % we need to pre-swap else we get the wrong paper size - \ifcase\paperorientation\else - \doifinset\paperorientation{90,270}{\swapdimens\paperwidth\paperheight}% - \fi - \ifcase\printorientation\else - \doifinset\printorientation{90,270}{\swapdimens\printpaperwidth\printpaperheight}% - \fi + \ifnum\paperorientation=\rightrotatioangle + \swapdimens\paperwidth\paperheight + \else\ifnum\paperorientation=\leftrotatioangle + \swapdimens\paperwidth\paperheight + \fi\fi + \ifnum\printorientation=\rightrotatioangle + \swapdimens\printpaperwidth\printpaperheight + \else\ifnum\printorientation=\leftrotatioangle + \swapdimens\printpaperwidth\printpaperheight + \fi\fi \ifdim\paperheight>\printpaperheight \global\printpaperheight\paperheight \writestatus\m!systems{print height forced to paper height}% @@ -389,20 +393,24 @@ \egroup}} \def\dosetuppaperorientation#1#2#3#4#5% - {\global\chardef#2\zerocount - \global\chardef#5\zerocount - \globallet#3\!!zerocount - \globallet#4\!!zerocount + {\global\setfalse#2% + \global\setfalse#5% + \global#3\uprotationangle + \global#4\uprotationangle \global\negateprintboxfalse \processallactionsinset [#1] - [ \v!landscape=>\global\chardef#2\plusone, - \v!mirrored=>\global\chardef#5\plusone, - \v!rotated=>\gdef#3{90}\gdef#4{270}, + [ \v!landscape=>\global\settrue#2, + \v!mirrored=>\global\settrue#5, + \v!rotated=>\global#3\rightrotatioangle + \global#4\leftrotatioangle, \v!negative=>\global\negateprintboxtrue, - 90=>\gdef#3{90}\gdef#4{270}, - 180=>\gdef#3{180}\gdef#4{0}, - 270=>\gdef#3{270}\gdef#4{90}]} + 90=>\global#3\rightrotatioangle + \global#4\leftrotatioangle, + 180=>\global#3\downrotatioangle + \global#4\zerocount, + 270=>\global#3\leftrotatioangle + \global#4\rightrotatioangle]} \ifx\calculatepaperoffsets\undefined @@ -826,28 +834,22 @@ \fi} \def\orientpagebodybox#1#2#3% - {\ifnum#2#3>\zerocount - \setbox#1\vbox - {\edef\somerotation{\ifdoublesided\ifodd\realpageno#2\else#3\fi\else#2\fi}% - \dorotatebox\somerotation\hbox{\box#1}}% + {\ifnum\number#1\number#2>\zerocount + \setbox#3\vbox + {\edef\somerotation{\number\ifdoublesided\ifodd\realpageno#1\else#2\fi\else#1\fi}% + \dorotatebox\somerotation\hbox{\box#3}}% \fi} -\def\orientpaperbox#1% - {\orientpagebodybox{#1}\paperorientation\paperreverse} - -\def\orientprintbox#1% - {\orientpagebodybox{#1}\printorientation\printreverse} +\def\orientpaperbox{\orientpagebodybox\paperorientation\paperreverse} +\def\orientprintbox{\orientpagebodybox\printorientation\printreverse} \def\mirrorpagebodybox#1#2% - {\ifcase#2\or - \setbox#1\vbox{\domirrorbox\vbox{\box#1}}% + {\ifconditional#1\relax + \setbox#2\vbox{\domirrorbox\vbox{\box#2}}% \fi} -\def\mirrorpaperbox#1% - {\mirrorpagebodybox{#1}\papermirror} - -\def\mirrorprintbox#1% - {\mirrorpagebodybox{#1}\printmirror} +\def\mirrorpaperbox{\mirrorpagebodybox\papermirror} +\def\mirrorprintbox{\mirrorpagebodybox\printmirror} \def\scalepagebox#1% {\ifdim\@@lyscale\points=\onepoint \else @@ -910,8 +912,8 @@ \def\doaddpagecolormarks#1#2% {\makepagecutbox{#2}% - \ifnum\horizontalcutmarks>\plustwo \chardef\colormarkoffset\plusfour \fi - \ifnum\verticalcutmarks >\plustwo \chardef\colormarkoffset\plusfour \fi + \ifnum\horizontalcutmarks>\plustwo \def\colormarkoffset{\plusfour}\fi + \ifnum\verticalcutmarks >\plustwo \def\colormarkoffset{\plusfour}\fi #1{#2}} % NOG EENS NAGAAN WANNEER NU GLOBAL EN WANNEER NIET @@ -963,10 +965,10 @@ \newdimen\innermakeupwidth % special purpose \newdimen\innermakeupmargin % special purpose -\chardef\innermakeupcompensation\plusone +\newconditional\innermakeupcompensation \settrue\innermakeupcompensation \def\compensatedinnermakeupmargin - {\dimexpr\ifnum\innermakeupcompensation=\plusone+\innermakeupmargin\else\zeropoint\fi\relax} + {\dimexpr\ifconditional\innermakeupcompensation+\innermakeupmargin\else\zeropoint\fi\relax} \def\freezetextwidth % \makeupwidth may be set to \textwidth {\textwidth\makeupwidth % which is a tricky but valid value diff --git a/tex/context/base/page-lin.lua b/tex/context/base/page-lin.lua index 7a525172c..473685c4f 100644 --- a/tex/context/base/page-lin.lua +++ b/tex/context/base/page-lin.lua @@ -34,22 +34,22 @@ storage.register("lines/data", lines.data, "nodes.lines.data") -- if there is demand for it, we can support multiple numbering streams -- and use more than one attibute -local variables = interfaces.variables +local variables = interfaces.variables -local nodecodes = nodes.nodecodes +local nodecodes = nodes.nodecodes -local hlist_code = nodecodes.hlist -local vlist_code = nodecodes.vlist -local whatsit_code = nodecodes.whatsit +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local whatsit_code = nodecodes.whatsit -local display_math = attributes.private('display-math') -local line_number = attributes.private('line-number') -local line_reference = attributes.private('line-reference') -local verbatim_line = attributes.private('verbatim-line') +local a_displaymath = attributes.private('displaymath') +local a_linenumber = attributes.private('linenumber') +local a_linereference = attributes.private('linereference') +local a_verbatimline = attributes.private('verbatimline') -local current_list = { } -local cross_references = { } -local chunksize = 250 -- not used in boxed +local current_list = { } +local cross_references = { } +local chunksize = 250 -- not used in boxed local has_attribute = node.has_attribute local traverse_id = node.traverse_id @@ -72,7 +72,7 @@ local function resolve(n,m) -- we can now check the 'line' flag (todo) while n do local id = n.id if id == whatsit_code then -- why whatsit - local a = has_attribute(n,line_reference) + local a = has_attribute(n,a_linereference) if a then cross_references[a] = m end @@ -189,7 +189,7 @@ function boxed.stage_one(n) -- skip funny hlists else local list = n.list - local a = has_attribute(list,line_number) + local a = has_attribute(list,a_linenumber) if a and a > 0 then if last_a ~= a then if data[a].method == variables.next then @@ -197,12 +197,12 @@ function boxed.stage_one(n) end last_a = a end - if has_attribute(n,display_math) then + if has_attribute(n,a_displaymath) then if nodes.is_display_math(n) then check_number(n,a,skip) end else - local v = has_attribute(list,verbatim_line) + local v = has_attribute(list,a_verbatimline) if not v or v ~= last_v then last_v = v check_number(n,a,skip) diff --git a/tex/context/base/page-lin.mkiv b/tex/context/base/page-lin.mkiv index 9b08ab07e..e3ea155c9 100644 --- a/tex/context/base/page-lin.mkiv +++ b/tex/context/base/page-lin.mkiv @@ -23,8 +23,8 @@ \registerctxluafile{page-lin}{1.001} -\definesystemattribute[line-number] \chardef\linenumberattribute \dogetattributeid{line-number} -\definesystemattribute[line-reference] \chardef\linereferenceattribute \dogetattributeid{line-reference} +\definesystemattribute[linenumber] [public] +\definesystemattribute[linereference][public] \appendtoksonce \attribute\linenumberattribute \attributeunsetvalue \to \everyforgetall \appendtoksonce \attribute\displaymathattribute\plusone \to \everybeforedisplayformula @@ -113,9 +113,9 @@ \let\currentlinenumbering\empty -\chardef\linenumbermode = 1 % 0=continue, 1=restart -\chardef\linenumberlocation = 1 % 0=middle, 1=left, 2=right, 3=inner, 4=outer, 5=text, 6=begin, 7=end -\chardef\linenumberalignment = 5 % 0=middle, 1=left, 2=right, 5=auto +\setnewconstant\linenumbermode \plusone % 0=continue, 1=restart +\setnewconstant\linenumberlocation \plusone % 0=middle, 1=left, 2=right, 3=inner, 4=outer, 5=text, 6=begin, 7=end +\setnewconstant\linenumberalignment\plusfive % 0=middle, 1=left, 2=right, 5=auto \newevery \beforeeverylinenumbering \relax \newevery \aftereverylinenumbering \relax @@ -176,29 +176,29 @@ % todo: text -\expandafter\chardef\csname\??rn:l:\v!middle \endcsname \zerocount -\expandafter\chardef\csname\??rn:l:\v!left \endcsname \plusone -\expandafter\chardef\csname\??rn:l:\v!margin \endcsname \plusone -\expandafter\chardef\csname\??rn:l:\v!inmargin\endcsname \plusone -\expandafter\chardef\csname\??rn:l:\v!inleft \endcsname \plusone -\expandafter\chardef\csname\??rn:l:\v!right \endcsname \plustwo -\expandafter\chardef\csname\??rn:l:\v!inright \endcsname \plustwo -\expandafter\chardef\csname\??rn:l:\v!inner \endcsname \plusthree -\expandafter\chardef\csname\??rn:l:\v!outer \endcsname \plusfour -\expandafter\chardef\csname\??rn:l:\v!text \endcsname \plusfive -\expandafter\chardef\csname\??rn:l:\v!begin \endcsname \plussix -\expandafter\chardef\csname\??rn:l:\v!end \endcsname \plusseven - -\expandafter\chardef\csname\??rn:a:\v!middle \endcsname \zerocount -\expandafter\chardef\csname\??rn:a:\v!right \endcsname \plusone -\expandafter\chardef\csname\??rn:a:\v!flushleft \endcsname \plusone -\expandafter\chardef\csname\??rn:a:\v!left \endcsname \plustwo -\expandafter\chardef\csname\??rn:a:\v!flushright\endcsname \plustwo -\expandafter\chardef\csname\??rn:a:\v!auto \endcsname \plusfive +\expandafter\let\csname\??rn:l:\v!middle \endcsname \zerocount +\expandafter\let\csname\??rn:l:\v!left \endcsname \plusone +\expandafter\let\csname\??rn:l:\v!margin \endcsname \plusone +\expandafter\let\csname\??rn:l:\v!inmargin \endcsname \plusone +\expandafter\let\csname\??rn:l:\v!inleft \endcsname \plusone +\expandafter\let\csname\??rn:l:\v!right \endcsname \plustwo +\expandafter\let\csname\??rn:l:\v!inright \endcsname \plustwo +\expandafter\let\csname\??rn:l:\v!inner \endcsname \plusthree +\expandafter\let\csname\??rn:l:\v!outer \endcsname \plusfour +\expandafter\let\csname\??rn:l:\v!text \endcsname \plusfive +\expandafter\let\csname\??rn:l:\v!begin \endcsname \plussix +\expandafter\let\csname\??rn:l:\v!end \endcsname \plusseven + +\expandafter\let\csname\??rn:a:\v!middle \endcsname \zerocount +\expandafter\let\csname\??rn:a:\v!right \endcsname \plusone +\expandafter\let\csname\??rn:a:\v!flushleft \endcsname \plusone +\expandafter\let\csname\??rn:a:\v!left \endcsname \plustwo +\expandafter\let\csname\??rn:a:\v!flushright\endcsname \plustwo +\expandafter\let\csname\??rn:a:\v!auto \endcsname \plusfive \def\dostartlinenumbering[#1][#2]% todo: c!continue {\begingroup - \chardef\linenumbermode\plusone + \linenumbermode\plusone \ifsecondargument \def\currentlinenumbering{#1}% \doifassignmentelse{#2} @@ -207,7 +207,7 @@ {\setvalue{\??rn#1\c!start}{#2}}% {\doif{#2}\v!continue {\getparameters[\??rn\currentlinenumbering][\c!continue=\v!yes]% - \chardef\linenumbermode\zerocount}}}% + \linenumbermode\zerocount}}}% \else\iffirstargument \doifnumberelse{#1}% downward compatible {\let\currentlinenumbering\empty @@ -215,11 +215,11 @@ {\doifelse{#1}\v!continue {\let\currentlinenumbering\empty \getparameters[\??rn\currentlinenumbering][\c!continue=\v!yes]% - \chardef\linenumbermode\zerocount} + \linenumbermode\zerocount} {\def\currentlinenumbering{#1}}}% \fi\fi \doif{\linenumberparameter\c!continue}\v!yes - {\chardef\linenumbermode\zerocount}% + {\linenumbermode\zerocount}% \numberinglinestrue \the\beforeeverylinenumbering \mkstarttextlinenumbering\currentlinenumbering\linenumbermode} @@ -273,12 +273,15 @@ \fi} \newconditional\faketextlinenumber +\newconstant \linenumberbox +\newconstant \linenumbercolumn +\newconstant \linenumberlastcolumn \def\mkaddtextlinenumbers#1#2#3% box col max {\bgroup - \chardef\linenumberbox #1\relax - \chardef\linenumbercolumn #2\relax - \chardef\linenumberlastcolumn#3\relax + \linenumberbox #1\relax + \linenumbercolumn #2\relax + \linenumberlastcolumn#3\relax \fullrestoreglobalbodyfont \let\makelinenumber\maketextlinenumber \mkprocesstextlinenumbers\linenumberbox @@ -291,8 +294,8 @@ \else \setfalse\faketextlinenumber \fi - \chardef\linenumberlocation \executeifdefined{\??rn:l:\linenumberparameter\c!location}\plusone % left - \chardef\linenumberalignment\executeifdefined{\??rn:a:\linenumberparameter\c!align }\plusfive % auto + \linenumberlocation \executeifdefined{\??rn:l:\linenumberparameter\c!location}\plusone % left + \linenumberalignment\executeifdefined{\??rn:a:\linenumberparameter\c!align }\plusfive % auto \ifcase\linenumberlastcolumn\relax \settrue \faketextlinenumber \or @@ -320,34 +323,34 @@ \or \let\domakelinenumber\mkleftlinenumber \ifcase\linenumberlocation\or - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \or - \chardef\linenumberlocation\plustwo + \linenumberlocation\plustwo \else - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \or - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \or - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \or - \chardef\linenumberlocation\plusone % todo + \linenumberlocation\plusone % todo \or - \chardef\linenumberlocation\plusone % todo + \linenumberlocation\plusone % todo \fi \else \let\domakelinenumber\mkrightlinenumber \ifcase\linenumberlocation\or - \chardef\linenumberlocation\plustwo + \linenumberlocation\plustwo \or - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \or - \chardef\linenumberlocation\plustwo + \linenumberlocation\plustwo \or - \chardef\linenumberlocation\plustwo + \linenumberlocation\plustwo \or - \chardef\linenumberlocation\plustwo % todo + \linenumberlocation\plustwo % todo \or - \chardef\linenumberlocation\plustwo % todo + \linenumberlocation\plustwo % todo \fi \fi\fi \domakelinenumber{#1}} @@ -370,19 +373,19 @@ \def\mkdobeginlinenumber #1#2#3#4#5#6% {\ifcase\istltdir#6\relax - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \expandafter\mkdoleftlinenumber \else - \chardef\linenumberlocation\plustwo + \linenumberlocation\plustwo \expandafter\mkdorightlinenumber \fi{#1}{#2}{#3}{#4}{#5}{#6}} \def\mkdoendlinenumber#1#2#3#4#5#6% {\ifcase\istltdir#6\relax - \chardef\linenumberlocation\plustwo + \linenumberlocation\plustwo \expandafter\mkdorightlinenumber \else - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \expandafter\mkdoleftlinenumber \fi{#1}{#2}{#3}{#4}{#5}{#6}} @@ -397,16 +400,16 @@ \ifcase#2\relax\or\hskip\linenumberdistance\fi\relax \ifnum\linenumberlocation=\plusfive \scratchdimen\dimexpr#4\scaledpoint-\linenumberdistance\relax - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \else \scratchdimen\zeropoint \fi \ifcase\linenumberalignment - \chardef\linenumberlocation\zerocount % middle + \linenumberlocation\zerocount % middle \or - \chardef\linenumberlocation\plusone % left + \linenumberlocation\plusone % left \or - \chardef\linenumberlocation\plustwo % right + \linenumberlocation\plustwo % right \fi \ifconditional\tracelinenumbering\ruledhbox\else\hbox\fi to \linenumberwidth {\ifcase\linenumberlocation diff --git a/tex/context/base/page-mar.mkiv b/tex/context/base/page-mar.mkiv index 3eac9b1d4..d5e7dbae1 100644 --- a/tex/context/base/page-mar.mkiv +++ b/tex/context/base/page-mar.mkiv @@ -186,13 +186,13 @@ %D The next bunch of macros looks messy which is due to its %D multi-purpose character. -\chardef\margincontentdisplacement \zerocount -\let \margincontentdistance \!!zeropoint -\let \margincontenthoffset \!!zeropoint -\def \margincontentlines {1} -\def \margincontenttag {0} -\let \margincontentseparator \empty -\def \margincontentstrutheight {\strutht} +\setnewconstant\margincontentdisplacement \zerocount +\let \margincontentdistance \!!zeropoint +\let \margincontenthoffset \!!zeropoint +\def \margincontentlines {1} +\def \margincontenttag {0} +\let \margincontentseparator \empty +\def \margincontentstrutheight {\strutht} \newcount\margincontentlevel \newdimen\margincontentheight @@ -355,8 +355,9 @@ % 2 only natural height % 3 also stack height -\chardef\margincontentmethod \plusthree % beware: 1 = old method -\chardef\marginpagecheckmethod\plusone +\setnewconstant\margincontentmethod \plusthree % beware: 1 = old method +\setnewconstant\marginpagecheckmethod \plusone +\setnewconstant\marginrepositionmethod\plusone \def\margincontentextralines{1} % old method, play safe \def\nofmargincontentlines {0} @@ -614,15 +615,15 @@ {\bgroup % old stuff, a bit tricky, but now interfaced \edef\currentmargincontent{#1}% - \chardef\marginrepositionmethod\executeifdefined{\??im\currentmargincontent\c!sidemethod }\plusone - \chardef\margincontentmethod \executeifdefined{\??im\currentmargincontent\c!textmethod }\plusthree - \chardef\marginpagecheckmethod \executeifdefined{\??im\currentmargincontent\c!splitmethod}\plusone + \marginrepositionmethod\executeifdefined{\??im\currentmargincontent\c!sidemethod }\plusone + \margincontentmethod \executeifdefined{\??im\currentmargincontent\c!textmethod }\plusthree + \marginpagecheckmethod \executeifdefined{\??im\currentmargincontent\c!splitmethod}\plusone % so far \forgetall % otherwise sidefloat problems, added 2005/07/20, maybe dangerous \postponenotes % group is (somehow) needed \doifinsetelse\v!low{#4} - {\chardef\margincontentdisplacement\plusone} - {\chardef\margincontentdisplacement\zerocount}% + {\margincontentdisplacement\plusone} + {\margincontentdisplacement\zerocount}% \doif\v!reverse{#2} {\swapmacros\dorightmarginblock\doleftmarginblock}% \processaction @@ -666,10 +667,10 @@ \def\margintitle{\margintext} % txt mark as well \newtoks\collectedmargintexts % so .. delayed! -\chardef\margintextcollected \zerocount +\newconditional\margintextcollected \def\domargincontent[#1][#2]#3% we used to check for #2/#1 being number, no longer now - {\global\chardef\margintextcollected\plusone + {\global\settrue\margintextcollected \global\let\flushmargincontents\doflushmargincontents \edef\margincontenttag{#1}% \ifx\margincontenttag\empty @@ -764,14 +765,14 @@ \def\resetmargincontent {\global\margincontentlevel\zerocount - \global\chardef\margintextcollected\zerocount + \global\setfalse\margintextcollected \global\collectedmargintexts\emptytoks} \unexpanded\def\placemargincontent - {\ifcase\margintextcollected\else % was level check + {\ifconditional\margintextcollected % was level check \bgroup \redoconvertfont % !! - \chardef\graphicvadjustmode\zerocount + %\setfalse\graphicvadjustmode % not used \flushmargincontentsindeed \egroup \fi} diff --git a/tex/context/base/page-mul.mkiv b/tex/context/base/page-mul.mkiv index ff0c9e502..70f5bd337 100644 --- a/tex/context/base/page-mul.mkiv +++ b/tex/context/base/page-mul.mkiv @@ -358,8 +358,7 @@ \newdimen\mcscratchdimen \newcount\nofcolumnlines -\chardef\multicolumnlinemethod\zerocount % 0: overshoot (old default), 1: tight -% \chardef\multicolumnlinemethod\plusone +\newconstant\multicolumnlinemethod % 0: overshoot (old default), 1: tight \def\getmulticolumnlines {\mcscratchdimen-\columntextoffset @@ -477,7 +476,7 @@ %D e.g. when there is no text given between \type{\begin..} %D and \type{\end..}. The \type{\par} is needed! -\chardef\multicolumnendsyncmethod\plusone % 1: old sync 2: new sync (cont-loc/project) / may fail ! ! ! ! +\setnewconstant\multicolumnendsyncmethod\plusone % 1: old sync 2: new sync (cont-loc/project) / may fail ! ! ! ! \def\endmulticolumns {%\par @@ -575,8 +574,8 @@ \edef\maxcolumndepth{\the\dp\currentcolumnbox}% \fi}} -\chardef\multicolumntopflushmethod\plusone % 0: no correction, 1: correction when topstuff, 2: correction, 3: correction++ -\chardef\multicolumntopalignmethod\plustwo % 0: nothing, 1: force grid, 2: follow grid +\setnewconstant\multicolumntopflushmethod\plusone % 0: no correction, 1: correction when topstuff, 2: correction, 3: correction++ +\setnewconstant\multicolumntopalignmethod\plustwo % 0: nothing, 1: force grid, 2: follow grid \def\flushprecolumnboxnogrid {\unvbox\precolumnbox} diff --git a/tex/context/base/page-one.mkiv b/tex/context/base/page-one.mkiv index bbd35181e..1ac769637 100644 --- a/tex/context/base/page-one.mkiv +++ b/tex/context/base/page-one.mkiv @@ -59,8 +59,6 @@ \fi \fi} -\chardef\kindofpagetextareas=2 % whole page (public variable! never change) - % can we avoind the extra vboxing here? \def\OTRONEregisteredtextarea#1% @@ -72,8 +70,6 @@ #1% \fi} -% \chardef\kindofpagetextareas\plusone - \def\doOTRONEregisteredtextareaA#1% {\ifregistertextareas \xypos{pbd:\realfolio:b}% we could save bytes by only saving the y @@ -104,6 +100,10 @@ \let\OTRONEregisteredtextareaA\firstofoneargument \let\OTRONEregisteredtextareaB\firstofoneargument +% 1 = partial page, 2 = whole page, 3 = partial page + +\setnewconstant\kindofpagetextareas\plustwo + \def\OTRONEdopagecontents#1#2% \box<n> \unvbox<n> {\bgroup % niet breedte zetten, kan fractie zijn! \ifcase\kindofpagetextareas @@ -285,7 +285,7 @@ \fi \fi} -\chardef\topinserttopskipmode=0 % 1 no topskip +\newconstant\topinserttopskipmode % 1 = no topskip \def\OTRONEdotopinsertions {\ifvoid\topins\else @@ -433,7 +433,7 @@ % [before force] \input thuan % \placefigure[force]{force}{\framed[height=8cm,width=8cm]{}}} -\chardef\fixedfloatmethod=3 +\setnewconstant\fixedfloatmethod\plusthree % \def\OTRONEsomefixdfloat % [#1] % {\docheckiffloatfits diff --git a/tex/context/base/page-plg.mkiv b/tex/context/base/page-plg.mkiv index 7d7612153..83c3155fe 100644 --- a/tex/context/base/page-plg.mkiv +++ b/tex/context/base/page-plg.mkiv @@ -190,7 +190,7 @@ % {\long\setvalue{\??ly\c!method:#1}{#2}} \long\unexpanded\def\startpagelayout - {\bgroup\catcode`\^^M=\@@ignore\dostartpagelayout} + {\bgroup\catcode`\^^M=\ignorecatcode\dostartpagelayout} \long\def\dostartpagelayout[#1]#2\stoppagelayout {\egroup\long\setvalue{\??ly\c!method:#1}{#2}} diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv index cc6fbb5e6..0cb83a1dc 100644 --- a/tex/context/base/page-set.mkiv +++ b/tex/context/base/page-set.mkiv @@ -739,7 +739,7 @@ % 2 = a solution that works ok, is experimental and above % all messy -\chardef\OTRSETflushtextmode=0 +\newconstant\OTRSETflushtextmode % will be replaced \def\OTRSETflushtextsofar {\ifcase\OTRSETflushtextmode @@ -1148,7 +1148,7 @@ \pofcolumns \pofcolumns +\currenthcell \columnmaxcells\preferedrow-\currentvcell{#1}} -\chardef\OTRSETforcefixedfloats=0 +\newconstant\OTRSETforcefixedfloats \def\OTRSETstoreincolumnslotHERE#1% fixed column {\ifcase\OTRSETforcefixedfloats @@ -1179,9 +1179,9 @@ \ifdim\scratchdimen<\pagegoal %OTRSETprepareforcolumnslot3{#1}% %ruledvskip\columnslotspacing\lineheight - \blank[\columnslotspacing*\v!line]% + \blank[\number\columnslotspacing*\v!line]% \snaptogrid\hbox to \hsize{\hss\box#1\hss}% strange, why the centering - \blank[\columnslotspacing*\v!line]% + \blank[\number\columnslotspacing*\v!line]% \else \OTRSETstoreincolumnslotSOMEWHERE2{#1}% \fi @@ -1279,7 +1279,7 @@ \OTRSETsavebox{#9}% \fi} -\chardef\columnslotspacing \plusone +\setnewconstant\columnslotspacing\plusone \def\OTRSETstoreincolumnslot#1% #2 % {method} {box} % alleen last {% no messing around here @@ -1624,7 +1624,8 @@ \newcounter\columnsetlevel \let\currentcolumnset\empty -\chardef\OTRSETfinish\zerocount + +\newconditional\OTRSETfinish % never checked \unexpanded\def\startcolumnset {\dodoubleempty\dostartcolumnset} @@ -1632,7 +1633,7 @@ \def\dostartcolumnset[#1][#2]% {\increment\columnsetlevel\relax \globallet\localcolumnmaxcells\!!zerocount - \global\chardef\OTRSETfinish\zerocount + \global\setfalse\OTRSETfinish \resetOTRSETmarks \ifnum\columnsetlevel=\plusone \bgroup @@ -1666,7 +1667,7 @@ {\OTRSETdoifcellelse{1}{1} {\bgroup \OTRSETcentergridcells - \chardef\OTRSETbalancemethod\plusone + \OTRSETbalancemethod\plusone \OTRSETreducegridbox \global\setbox\OTRfinalpagebox\OTRSETmakegridbox \global\ht\OTRfinalpagebox\textheight % signals output that there is content @@ -1679,7 +1680,7 @@ {\relax \ifnum\columnsetlevel=\plusone \endgraf % needed, else wrong vsize in one par case - \global\chardef\OTRSETfinish\plusone + \global\settrue\OTRSETfinish % no, extra page \pagebreak % (test on pascal toc) \dostopcolumnset \egroup @@ -1694,7 +1695,7 @@ \box\OTRfinalpagebox \fi \fi - \global\chardef\OTRSETfinish\zerocount + \global\setfalse\OTRSETfinish \ifsomefloatwaiting \setvsize \pagebreak \setvsize \fi \OTRSETflushleftovers \else @@ -1702,7 +1703,7 @@ \fi \decrement\columnsetlevel\relax} -\chardef\OTRSETbalancemethod\zerocount +\newconstant\OTRSETbalancemethod \def\dostopcolumnset {%\OTRSETdofinalflushfloats % yes/no @@ -1826,15 +1827,15 @@ \getrawnoflines\textheight\xdef\columnmaxcells{\the\noflines}% % direction \doifelsevalue{\??mc\OTRSETidentifier\c!direction}\v!right - {\chardef\columndirection\zerocount} - {\chardef\columndirection\plusone}% + {\columndirection\zerocount} + {\columndirection\plusone}% % balancing - \chardef\OTRSETbalancemethod\zerocount + \OTRSETbalancemethod\zerocount \processaction [\getvalue{\??mc\OTRSETidentifier\c!balance}] - [ \v!yes=>\chardef\OTRSETbalancemethod\plusone, - \v!top=>\chardef\OTRSETbalancemethod\plustwo, - \v!bottom=>\chardef\OTRSETbalancemethod\plusthree]} + [ \v!yes=>\OTRSETbalancemethod\plusone, + \v!top=>\OTRSETbalancemethod\plustwo, + \v!bottom=>\OTRSETbalancemethod\plusthree]} % test: % @@ -2522,7 +2523,7 @@ % % \setbox\scratchbox\frozenhbox to \hsize % {\dontcomplain -% \chardef\alignstrutmode\zerocount +% \alignstrutmode\zerocount % \alignedline{\framedtextparameter{cs:#1}\c!plaats}\v!midden % {\box\scratchbox}}% % @@ -2531,8 +2532,8 @@ \else\ifnum\columnsetlevel>\zerocount % we only set \columnsetspacing when asked for, else bottom problems % don't change this any more (test naw) - \chardef\columnslotspacing\framedtextparameter{cs:#1}\c!nlines\relax - % todo: nboven/onder & \chardef\columnslotlocation2 + \columnslotspacing\framedtextparameter{cs:#1}\c!nlines\relax + % todo: nboven/onder %\OTRSETstoreincolumnslotHERE\scratchbox \edef\floatmethod{\framedtextparameter{cs:#1}\c!default}% \@EA\uppercasestring\floatmethod\to\floatmethod diff --git a/tex/context/base/page-sid.mkiv b/tex/context/base/page-sid.mkiv index c30204a4e..e54b4ecd5 100644 --- a/tex/context/base/page-sid.mkiv +++ b/tex/context/base/page-sid.mkiv @@ -84,16 +84,16 @@ % 7 = rightedge % 8 = cutspace -\chardef\sidefloattype\zerocount +\newconstant\sidefloattype -\def\backspacefloat {\global\chardef\sidefloattype1 \putsidefloat} -\def\leftedgefloat {\global\chardef\sidefloattype2 \putsidefloat} -\def\leftmarginfloat {\global\chardef\sidefloattype3 \putsidefloat} -\def\leftfloat {\global\chardef\sidefloattype4 \putsidefloat} -\def\rightfloat {\global\chardef\sidefloattype5 \putsidefloat} -\def\rightmarginfloat {\global\chardef\sidefloattype6 \putsidefloat} -\def\rightedgefloat {\global\chardef\sidefloattype7 \putsidefloat} -\def\cutspacefloat {\global\chardef\sidefloattype8 \putsidefloat} +\def\backspacefloat {\global\sidefloattype1 \putsidefloat} +\def\leftedgefloat {\global\sidefloattype2 \putsidefloat} +\def\leftmarginfloat {\global\sidefloattype3 \putsidefloat} +\def\leftfloat {\global\sidefloattype4 \putsidefloat} +\def\rightfloat {\global\sidefloattype5 \putsidefloat} +\def\rightmarginfloat {\global\sidefloattype6 \putsidefloat} +\def\rightedgefloat {\global\sidefloattype7 \putsidefloat} +\def\cutspacefloat {\global\sidefloattype8 \putsidefloat} \let\marginfloat \cutspacefloat @@ -474,9 +474,9 @@ \fi\fi \else \ifnum\sidefloattype<\plusfour - \global\chardef\sidefloattype\plusfour + \global\sidefloattype\plusfour \else\ifnum\sidefloattype>\plusfive - \global\chardef\sidefloattype\plusfive + \global\sidefloattype\plusfive \fi\fi \fi \previoussidefloat diff --git a/tex/context/base/page-spr.mkiv b/tex/context/base/page-spr.mkiv index 75b91dff7..ff0561a5d 100644 --- a/tex/context/base/page-spr.mkiv +++ b/tex/context/base/page-spr.mkiv @@ -20,7 +20,7 @@ \newbox\spreadbox \newif \ifinspread -\chardef\showspreadmode\plusone +\setnewconstant\showspreadmode\plusone % beware, ugly overload, to be redone diff --git a/tex/context/base/ppchtex.mkiv b/tex/context/base/ppchtex.mkiv index e81551eea..5a038e9a3 100644 --- a/tex/context/base/ppchtex.mkiv +++ b/tex/context/base/ppchtex.mkiv @@ -97,13 +97,15 @@ \doifundefined{fiverm} % In the more recent LaTeX versions {\font\fiverm=cmr5 } % \fiverm is no longer (pre)defined. +\newconstant\chemicaldrawingmode + \doifdefinedelse{beginpicture} % PiCTeX {\doifdefinedelse{startMPdrawing} - {\chardef\chemicaldrawingmode=2 } % MetaPost - {\chardef\chemicaldrawingmode=0 }} % raw + {\chemicaldrawingmode\plustwo } % MetaPost + {\chemicaldrawingmode\zerocount}} % raw {\doifdefinedelse{psaxes} - {\chardef\chemicaldrawingmode=1 } % PSTricks - {\chardef\chemicaldrawingmode=3 }} % unknown + {\chemicaldrawingmode\plusone } % PSTricks + {\chemicaldrawingmode\plusthree}} % unknown \ifcase\chemicaldrawingmode \writestatus{ppchtex}{using PiCTeX} @@ -719,8 +721,8 @@ \ignorespaces} \def\dostartchemical% - {\catcode`\^=\@@superscript% t.b.v. \enableduplication - \catcode`\_=\@@subscript % t.b.v. de zekerheid + {\catcode`\^=\superscriptcatcode% t.b.v. \enableduplication + \catcode`\_=\subscriptcatcode % t.b.v. de zekerheid \begingroup \inchemicaltrue \def\toptext##1{\gdef\thetoptext{##1}\ignorespaces}\toptext{}% @@ -1204,7 +1206,7 @@ % #3: x-coordinaat eindpunt % #4: y-coordinaat eindpunt -\chardef\chemicallinetype=0 +\newconstant\chemicallinetype \def\doplotchemicalline {\!!counte=\!!countc \advance\!!counte by -\!!counta @@ -1407,7 +1409,7 @@ \getvalue{\s!chemicallinesegment#2#1}} \def\doprocesschemicallinesegment#1#2#3#4#5% - {\chardef\chemicallinetype=#1 + {\chemicallinetype#1\relax \def\chemicallineposition{#2}% \def\doprocess[##1##2##3##4##5]% {\doifelse{##1}{?} @@ -1778,8 +1780,8 @@ \innerchemicalfalse \fi \bgroup - \catcode`\^=\@@superscript % t.b.v. \enableduplication - \catcode`\_=\@@subscript % t.b.v. de zekerheid + \catcode`\^=\superscriptcatcode % t.b.v. \enableduplication + \catcode`\_=\subscriptcatcode % t.b.v. de zekerheid \ifmmode \ifinnerchemical \def\next{\dotriplegroupempty\dosimplechemicalA}% diff --git a/tex/context/base/scrn-bar.mkiv b/tex/context/base/scrn-bar.mkiv index dbeaf6d7f..0b2dfc627 100644 --- a/tex/context/base/scrn-bar.mkiv +++ b/tex/context/base/scrn-bar.mkiv @@ -263,6 +263,8 @@ \!!height.5\interactionbarheight \!!depth.5\interactionbardepth \else \!!height \interactionbarheight \!!depth \interactionbardepth \fi} +\newconstant\interactionbarwhatmode + \unexpanded\def\@@commoninteractionbarx#1% {\doifelse{\interactionbarparameter\c!symbol}\v!yes {\setupsymbolset[\@@iasymbolset]% @@ -270,11 +272,11 @@ {\let\dogotox\@@commoninteractionbargotob}% \dorecurse\nofsubpages {\scratchcounter\numexpr\recurselevel+\firstsubpage+\minusone\relax - \chardef\what + \interactionbarwhatmode \ifnum\scratchcounter<\realpageno \zerocount \else \ifnum\scratchcounter=\realpageno \plusone \else \plustwo \fi\fi - \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\dogotox\what}[page(\the\scratchcounter)]}% + \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\dogotox\interactionbarwhatmode}[page(\the\scratchcounter)]}% #1}% \unskip} @@ -346,7 +348,7 @@ \advance\!!countf \plusone \ifnum\recurselevel=\firstsubpage\relax \!!doneatrue \fi \ifnum\recurselevel=\lastsubpage \relax \!!doneatrue \fi - \chardef\what \if!!donea + \interactionbarwhatmode \if!!donea \ifnum\recurselevel<\realpageno \zerocount \else \ifnum\recurselevel>\realpageno \plustwo \else \plusfour \fi\fi @@ -355,7 +357,7 @@ \ifnum\recurselevel>\realpageno \plusthree \else \plustwo \fi\fi \fi \fi - \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\dogotox\what}[page(\recurselevel)]}% + \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\dogotox\interactionbarwhatmode}[page(\recurselevel)]}% \hss \!!countf\zerocount}% \unskip diff --git a/tex/context/base/scrn-fld.mkiv b/tex/context/base/scrn-fld.mkiv index f895089e8..3ba91ff48 100644 --- a/tex/context/base/scrn-fld.mkiv +++ b/tex/context/base/scrn-fld.mkiv @@ -323,7 +323,7 @@ \fi \egroup} -\chardef\fitfieldmode\plusone % 3 = best +\setnewconstant\fitfieldmode\plusone % 3 = best \def\dohandlefitfield[#1][#2][#3][#4][#5]% alleen check {\presetlocalframed[\??fd]% diff --git a/tex/context/base/scrn-men.mkiv b/tex/context/base/scrn-men.mkiv index 63f72c463..b3e97f608 100644 --- a/tex/context/base/scrn-men.mkiv +++ b/tex/context/base/scrn-men.mkiv @@ -478,14 +478,13 @@ % [name] [location] % [name] [location] [pars] -\expandafter\chardef\csname\??am:\c!location:\v!yes \endcsname\zerocount -\expandafter\chardef\csname\??am:\c!location:\v!empty \endcsname\plusone -\expandafter\chardef\csname\??am:\c!location:\v!no \endcsname\plustwo -\expandafter\chardef\csname\??am:\c!location:\v!none \endcsname\plusthree - -\expandafter\chardef\csname\??am:\c!location:\v!normal \endcsname\plusone % default -\expandafter\chardef\csname\??am:\c!location:\s!default\endcsname\plusone % default -\expandafter\chardef\csname\??am:\c!location:\s!empty \endcsname\plusone % default +\expandafter\let\csname\??am:\c!location:\v!yes \endcsname\zerocount +\expandafter\let\csname\??am:\c!location:\v!empty \endcsname\plusone +\expandafter\let\csname\??am:\c!location:\v!no \endcsname\plustwo +\expandafter\let\csname\??am:\c!location:\v!none \endcsname\plusthree +\expandafter\let\csname\??am:\c!location:\v!normal \endcsname\plusone % default +\expandafter\let\csname\??am:\c!location:\s!default\endcsname\plusone % default +\expandafter\let\csname\??am:\c!location:\s!empty \endcsname\plusone % default \def\dodomenulistelement#1#2#3#4#5#6#7% {\addsomemenuitem{\domenuitemposition\currentmenu{internal(#3)}% diff --git a/tex/context/base/scrp-ini.mkiv b/tex/context/base/scrp-ini.mkiv index 6e6b10610..09d747d42 100644 --- a/tex/context/base/scrp-ini.mkiv +++ b/tex/context/base/scrp-ini.mkiv @@ -16,8 +16,8 @@ \registerctxluafile{scrp-ini}{1.001} \registerctxluafile{scrp-cjk}{1.001} -\definesystemattribute[preproc] \chardef\preprocattribute \dogetattributeid{preproc} -\definesystemattribute[prestat] \chardef\prestatattribute \dogetattributeid{prestat} +\definesystemattribute[preproc][public] +\definesystemattribute[prestat][public] %D Since scripts need specific \LUA\ code we use hard coded attribute %D values, but we might have more tricks at some time, so we use a diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv index a9a84e82a..d0736dd5f 100644 --- a/tex/context/base/spac-ali.mkiv +++ b/tex/context/base/spac-ali.mkiv @@ -119,7 +119,7 @@ {\everyraggedcommand\emptytoks \let\raggedtopcommand\empty \let\raggedbottomcommand\empty - \chardef\raggedoneliner\zerocount + \setfalse\raggedonelinerstate \doifsomething{#1} {\doifinsetelse\v!broad{#1}\!!doneatrue\!!doneafalse \doifinsetelse\v!wide {#1}\!!donebtrue\!!donebfalse @@ -223,10 +223,10 @@ \setvalue{\@@ragged@@command\v!disable}% for one liners {\appendtoks\raggedright\parfillskip\zeropoint\to\everyraggedcommand} -\chardef\raggedoneliner\zerocount +\ifdefined\raggedonelinerstate \else \newconditional\raggedonelinerstate \fi \setvalue{\@@ragged@@command\v!line}% - {\chardef\raggedoneliner\plusone} + {\settrue\raggedonelinerstate} % More alignments: @@ -234,7 +234,7 @@ % \tolerance >= 1500 % was 200 % \raggedness = 2 .. 6\bodyfontsize -\chardef\raggedstatus=0 % normal left center right +\newconstant\raggedstatus % normal left center right \def\leftraggedness {2\bodyfontsize} \def\rightraggedness {2\bodyfontsize} @@ -285,7 +285,7 @@ \updateraggedskips} \def\dosetraggedskips#1#2#3#4#5#6#7% - {\chardef \raggedstatus#1\relax + {\raggedstatus#1\relax \leftskip 1\leftskip \!!plus#2\relax % zie: Tex By Topic 8.1.3 \rightskip 1\rightskip\!!plus#3\relax % zie: Tex By Topic 8.1.3 \spaceskip #4\relax @@ -347,7 +347,7 @@ \def\raggedxspaceamount {.5em} \unexpanded\def\notragged - {\chardef\raggedstatus\zerocount + {\raggedstatus\zerocount \leftskip 1\leftskip \rightskip 1\rightskip \spaceskip \zeropoint @@ -504,7 +504,7 @@ \def\dosetupalign[#1]% can be made faster by checking for defined #1 {\!!doneafalse \!!donebfalse - \chardef\raggedstatus\zerocount + \raggedstatus\zerocount \processcommacommand[#1]\dodosetupngila \processcommacommand[#1]\dodosetupalign} @@ -525,7 +525,7 @@ {\par \egroup} -\chardef\alignstrutmode=1 +\setnewconstant\alignstrutmode\plusone % see later for the real definition, which in the simple case is: diff --git a/tex/context/base/spac-grd.mkiv b/tex/context/base/spac-grd.mkiv index bd5c51a85..0cd2b15e9 100644 --- a/tex/context/base/spac-grd.mkiv +++ b/tex/context/base/spac-grd.mkiv @@ -208,11 +208,11 @@ %D is not needed, but I want to look the visualization as good %D as possible too. -\chardef\baselinecorrectionmode\plusone +\setnewconstant\baselinecorrectionmode\plusone -\def\onbaselinecorrection {\chardef\baselinecorrectionmode\plusone } -\def\offbaselinecorrection {\chardef\baselinecorrectionmode\plustwo } -\def\forcebaselinecorrection{\chardef\baselinecorrectionmode\plusthree} +\def\onbaselinecorrection {\baselinecorrectionmode\plusone } +\def\offbaselinecorrection {\baselinecorrectionmode\plustwo } +\def\forcebaselinecorrection{\baselinecorrectionmode\plusthree} %D \macros %D {topbaselinecorrection,botbaselinecorrection} diff --git a/tex/context/base/spac-hor.mkiv b/tex/context/base/spac-hor.mkiv index 9f902678a..6364b02af 100644 --- a/tex/context/base/spac-hor.mkiv +++ b/tex/context/base/spac-hor.mkiv @@ -23,8 +23,9 @@ \newdimen \ctxparindent \parindent\ctxparindent % for the show -\newif \ifindentfirstparagraph \indentfirstparagraphtrue -\chardef\indentingtoggle\zerocount +\newif\ifindentfirstparagraph \indentfirstparagraphtrue + +\newconstant\indentingtogglestate %D After a blank or comparable situation (left side floats) we %D need to check if the next paragraph has to be indented. @@ -48,7 +49,7 @@ \doifsomething\currentindenting % handy when a parameter is passed {% not here: \indentfirstparagraphtrue % not here: \parindent\ctxparindent - % not here: \chardef\indentingtoggle\zerocount + % not here: \indentingtogglestate\zerocount % we use commacommand in order to catch #1 being a command (expanded parameter) \processcommacommand[\currentindenting]\docomplexsetupindentingA % catch small, medium, etc \processcommacommand[\currentindenting]\docomplexsetupindentingB % catch rest @@ -89,10 +90,10 @@ \defineindentingmethod [\v!always] {\parindent\ctxparindent\relax} % no \indent ! \defineindentingmethod [\v!never] {\parindent\zeropoint\relax % no \indent ! - \chardef\indentingtoggle\zerocount} + \indentingtogglestate\zerocount} -\defineindentingmethod [\v!odd] {\chardef\indentingtoggle\plusone} -\defineindentingmethod [\v!even] {\chardef\indentingtoggle\plustwo} +\defineindentingmethod [\v!odd] {\indentingtogglestate\plusone} +\defineindentingmethod [\v!even] {\indentingtogglestate\plustwo} \defineindentingmethod [\v!normal] {\ifx\normalindentation\empty\else \let\currentindentation\normalindentation @@ -101,7 +102,7 @@ \defineindentingmethod [\v!reset] {\indentfirstparagraphtrue \parindent\zeropoint - \chardef\indentingtoggle\zerocount} + \indentingtogglestate\zerocount} \def\noindenting{\indenting[\v!no, \v!next ]} \def\doindenting{\indenting[\v!yes,\v!first]} @@ -159,7 +160,7 @@ \fi \fi} \def\toggleindentation % does not play well with noindentation - {\ifcase\indentingtoggle + {\ifcase\indentingtogglestate % nothing \or \notoggleindentation @@ -186,27 +187,15 @@ \popmacro\checkindentation \to \everypopsomestate -% we need to save the state if we want to adapt behaviour to empty lines -% -% \def\setlasthvmode -% {\global\chardef\savedhvmode\ifhmode\plusone\else\ifvmode\plustwo\else\zerocount\fi\fi} -% -% \def\resetlasthvmode -% {\global\chardef\savedhvmode\zerocount} -% -% \chardef\savedhvmode\zerocount - % This is a user requested hack (using the auto-hook). -\chardef\recheckindentationmode\zerocount +\newconditional\recheckindentationmode \def\dontrechecknextindentation - {\global\chardef\recheckindentationmode\zerocount} + {\global\setfalse\recheckindentationmode} \def\dorechecknextindentation - {\ifcase\recheckindentationmode - % nothing - \or + {\ifconditional\recheckindentationmode \dontrechecknextindentation \expandafter\doautoindentation \fi} @@ -215,7 +204,7 @@ {\doifnextcharelse\par\donothing\noindentation} \def\autoindentation - {\global\chardef\recheckindentationmode\plusone} + {\global\settrue\recheckindentationmode} %D An example of usage: %D diff --git a/tex/context/base/spac-pag.mkiv b/tex/context/base/spac-pag.mkiv index 353afa536..96a65e9f8 100644 --- a/tex/context/base/spac-pag.mkiv +++ b/tex/context/base/spac-pag.mkiv @@ -25,10 +25,10 @@ \def\setalignmentswitch#1% {\chardef\alignmentswitch0\csname\??as#1\endcsname\relax} -\newcount \noftrackedpagestates -\newif \ifpagestatemismatch -\newcount \realpagestateno -\chardef \frozenpagestate \zerocount +\newcount \noftrackedpagestates +\newif \ifpagestatemismatch +\newcount \realpagestateno +\newconstant\frozenpagestate \def\dotrackpagestate#1#2% {\ifdoublesided \ifinpagebody \else @@ -113,8 +113,8 @@ \@EA\secondoftwoarguments \fi} -\def\freezepagestate {\chardef\frozenpagestate\plusone } -\def\defrostpagestate{\chardef\frozenpagestate\zerocount} +\def\freezepagestate {\frozenpagestate\plusone } +\def\defrostpagestate{\frozenpagestate\zerocount} % we can make more of these on top, but how to deal with mixed frozen states diff --git a/tex/context/base/spac-par.mkiv b/tex/context/base/spac-par.mkiv index 3477b1c1b..4093edcac 100644 --- a/tex/context/base/spac-par.mkiv +++ b/tex/context/base/spac-par.mkiv @@ -52,7 +52,7 @@ \newtoks\everynextparagraphintro \newtoks\@@everyparagraphtoks -\chardef\everyparagraphintro\zerocount +\newconstant\everyparagraphintrostate \unexpanded\def\setupparagraphintro {\dodoubleempty\dosetupparagraphintro} @@ -60,14 +60,14 @@ \def\dosetupparagraphintro[#1][#2]% {\processallactionsinset [#1] - [ \v!reset=>\global\chardef\everyparagraphintro\zerocount + [ \v!reset=>\global\everyparagraphintrostate\zerocount \global\everyfirstparagraphintro\emptytoks \global\everynextparagraphintro \emptytoks, - \v!first=>\global\chardef\everyparagraphintro\plusone + \v!first=>\global\everyparagraphintrostate\plusone \doglobal\appendtoks#2\to\everyfirstparagraphintro, - \v!next=>\ifcase\everyparagraphintro\global\chardef\everyparagraphintro\plusone\fi + \v!next=>\ifcase\everyparagraphintrostate\global\everyparagraphintrostate\plusone\fi \doglobal\appendtoks#2\to\everynextparagraphintro, - \v!each=>\ifcase\everyparagraphintro\global\chardef\everyparagraphintro\plustwo\fi + \v!each=>\ifcase\everyparagraphintrostate\global\everyparagraphintrostate\plustwo\fi \doglobal\appendtoks#2\to\everyfirstparagraphintro \doglobal\appendtoks#2\to\everynextparagraphintro]} @@ -84,22 +84,22 @@ %D \stoptyping \def\flushatparagraph#1% - {\global\chardef\everyparagraphintro\plusone + {\global\everyparagraphintrostate\plusone \global\appendtoks{#1}\to\everyfirstparagraphintro \global\let\insertparagraphintro\doinsertparagraphintro} \def\doinsertparagraphintro % can be merged with the next - {\ifcase\everyparagraphintro\else\@EA\dodoinsertparagraphintro\fi} + {\ifcase\everyparagraphintrostate\else\@EA\dodoinsertparagraphintro\fi} \def\dodoinsertparagraphintro {\begingroup \everypar\emptytoks - \ifcase\everyparagraphintro\relax + \ifcase\everyparagraphintrostate\relax % no data \@@everyparagraphtoks\emptytoks \or % first data - \global\chardef\everyparagraphintro\plustwo + \global\everyparagraphintrostate\plustwo \@@everyparagraphtoks\everyfirstparagraphintro \global\everyfirstparagraphintro\emptytoks \or diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index f5573b0bd..0bcad2640 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -51,13 +51,12 @@ local report_vspacing = logs.new("vspacing") local report_collapser = logs.new("collapser") local report_snapper = logs.new("snapper") -local skip_category = attributes.private('skip-category') -local skip_penalty = attributes.private('skip-penalty') -local skip_order = attributes.private('skip-order') -local snap_category = attributes.private('snap-category') -local display_math = attributes.private('display-math') -local snap_method = attributes.private('snap-method') -local snap_vbox = attributes.private('snap-vbox') +local a_skipcategory = attributes.private('skipcategory') +local a_skippenalty = attributes.private('skippenalty') +local a_skiporder = attributes.private('skiporder') +----- snap_category = attributes.private('snapcategory') +local a_snapmethod = attributes.private('snapmethod') +local a_snapvbox = attributes.private('snapvbox') local has_attribute = node.has_attribute local unset_attribute = node.unset_attribute @@ -217,7 +216,7 @@ local function validvbox(parentid,list) end end -local function already_done(parentid,list,snap_method) -- todo: done when only boxes and all snapped +local function already_done(parentid,list,a_snapmethod) -- todo: done when only boxes and all snapped -- problem: any snapped vbox ends up in a line if list and parentid == hlist_code then local id = list.id @@ -230,9 +229,9 @@ local function already_done(parentid,list,snap_method) -- todo: done when only b --~ local i = 0 for n in traverse_nodes(list) do local id = n.id ---~ i = i + 1 print(i,nodecodes[id],has_attribute(n,snap_method)) +--~ i = i + 1 print(i,nodecodes[id],has_attribute(n,a_snapmethod)) if id == hlist_code or id == vlist_code then - local a = has_attribute(n,snap_method) + local a = has_attribute(n,a_snapmethod) if not a then -- return true -- not snapped at all elseif a == 0 then @@ -447,8 +446,8 @@ h, d = ch, cd t[#t+1] = format("after offset: %s (width %s height %s depth %s)", points(offset),points(current.width),points(current.height),points(current.depth)) end - set_attribute(shifted,snap_method,0) - set_attribute(current,snap_method,0) + set_attribute(shifted,a_snapmethod,0) + set_attribute(current,a_snapmethod,0) end if not height then current.height = ch @@ -740,7 +739,7 @@ function vspacing.snapbox(n,how) local box = texbox[n] local list = box.list if list then - local s = has_attribute(list,snap_method) + local s = has_attribute(list,a_snapmethod) if s == 0 then if trace_vsnapping then -- report_snapper("box list not snapped, already done") @@ -760,8 +759,8 @@ function vspacing.snapbox(n,how) report_snapper("box list snapped from (%s,%s) to (%s,%s) using method '%s' (%s) for '%s' (%s lines): %s", h,d,ch,cd,sv.name,sv.specification,"direct",lines,listtoutf(list)) end - set_attribute(box, snap_method,0) -- - set_attribute(list,snap_method,0) -- yes or no + set_attribute(box, a_snapmethod,0) -- + set_attribute(list,a_snapmethod,0) -- yes or no end end end @@ -786,7 +785,7 @@ local function forced_skip(head,current,width,where,trace) return head, current end -local function collapser(head,where,what,trace,snap,snap_method) -- maybe also pass tail +local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also pass tail if trace then reset_tracing(head) end @@ -832,7 +831,7 @@ local function collapser(head,where,what,trace,snap,snap_method) -- maybe also p -- needs checking, why so many calls if snap then local list = current.list - local s = has_attribute(current,snap_method) + local s = has_attribute(current,a_snapmethod) if not s then -- if trace_vsnapping then -- report_snapper("mvl list not snapped") @@ -845,7 +844,7 @@ local function collapser(head,where,what,trace,snap,snap_method) -- maybe also p local sv = snapmethods[s] if sv then -- check if already snapped - if list and already_done(id,list,snap_method) then + if list and already_done(id,list,a_snapmethod) then local ht, dp = current.height, current.depth -- assume that the box is already snapped if trace_vsnapping then @@ -861,7 +860,7 @@ local function collapser(head,where,what,trace,snap,snap_method) -- maybe also p elseif trace_vsnapping then report_snapper("mvl %s not snapped due to unknown snap specification: %s",nodecodes[id],listtoutf(list)) end - set_attribute(current,snap_method,0) + set_attribute(current,a_snapmethod,0) end else -- @@ -885,9 +884,9 @@ local function collapser(head,where,what,trace,snap,snap_method) -- maybe also p flush("something else") current = current.next elseif subtype == userskip_code then -- todo, other subtypes, like math - local sc = has_attribute(current,skip_category) -- has no default, no unset (yet) - local so = has_attribute(current,skip_order ) or 1 -- has 1 default, no unset (yet) - local sp = has_attribute(current,skip_penalty ) -- has no default, no unset (yet) + local sc = has_attribute(current,a_skipcategory) -- has no default, no unset (yet) + local so = has_attribute(current,a_skiporder ) or 1 -- has 1 default, no unset (yet) + local sp = has_attribute(current,a_skippenalty ) -- has no default, no unset (yet) if sp and sc == penalty then if not penalty_data then penalty_data = sp @@ -1012,9 +1011,9 @@ local function collapser(head,where,what,trace,snap,snap_method) -- maybe also p end elseif subtype == lineskip_code then if snap then - local s = has_attribute(current,snap_method) + local s = has_attribute(current,a_snapmethod) if s and s ~= 0 then - set_attribute(current,snap_method,0) + set_attribute(current,a_snapmethod,0) if current.spec.writable then local spec = writable_spec(current) spec.width = 0 @@ -1033,9 +1032,9 @@ local function collapser(head,where,what,trace,snap,snap_method) -- maybe also p current = current.next elseif subtype == baselineskip_code then if snap then - local s = has_attribute(current,snap_method) + local s = has_attribute(current,a_snapmethod) if s and s ~= 0 then - set_attribute(current,snap_method,0) + set_attribute(current,a_snapmethod,0) if current.spec.writable then local spec = writable_spec(current) spec.width = 0 @@ -1072,9 +1071,9 @@ local function collapser(head,where,what,trace,snap,snap_method) -- maybe also p end elseif subtype == topskip_code or subtype == splittopskip_code then if snap then - local s = has_attribute(current,snap_method) + local s = has_attribute(current,a_snapmethod) if s and s ~= 0 then - set_attribute(current,snap_method,0) + set_attribute(current,a_snapmethod,0) local sv = snapmethods[s] local w, cw = snap_topskip(current,sv) if trace_vsnapping then @@ -1186,7 +1185,7 @@ function vspacing.pagehandler(newhead,where) local id = n.id if id == glue_code then if n.subtype == userskip_code then - if has_attribute(n,skip_category) then + if has_attribute(n,a_skipcategory) then stackhack = true else flush = true @@ -1209,8 +1208,8 @@ function vspacing.pagehandler(newhead,where) if stackhack then stackhack = false if trace_collect_vspacing then report("processing %s nodes: %s",newhead) end ---~ texlists.contrib_head = collapser(newhead,"page",where,trace_page_vspacing,true,snap_method) - newhead = collapser(newhead,"page",where,trace_page_vspacing,true,snap_method) +--~ texlists.contrib_head = collapser(newhead,"page",where,trace_page_vspacing,true,a_snapmethod) + newhead = collapser(newhead,"page",where,trace_page_vspacing,true,a_snapmethod) else if trace_collect_vspacing then report("flushing %s nodes: %s",newhead) end --~ texlists.contrib_head = newhead @@ -1242,17 +1241,17 @@ local ignore = table.tohash { function vspacing.vboxhandler(head,where) if head and not ignore[where] and head.next then -- starttiming(vspacing) - head = collapser(head,"vbox",where,trace_vbox_vspacing,true,snap_vbox) -- todo: local snapper + head = collapser(head,"vbox",where,trace_vbox_vspacing,true,a_snapvbox) -- todo: local snapper -- stoptiming(vspacing) end return head end -function vspacing.collapsevbox(n) -- for boxes but using global snap_method +function vspacing.collapsevbox(n) -- for boxes but using global a_snapmethod local list = texbox[n].list if list then -- starttiming(vspacing) - texbox[n].list = vpack_node(collapser(list,"snapper","vbox",trace_vbox_vspacing,true,snap_method)) + texbox[n].list = vpack_node(collapser(list,"snapper","vbox",trace_vbox_vspacing,true,a_snapmethod)) -- stoptiming(vspacing) end end diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index d544d237b..28b889b98 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -468,6 +468,8 @@ \dosetupwhitespace \fi} +\newconstant\baselinegridmode % option in layout / 1=permit_half_lines + \def\dosetupwhitespace % quick test for no list {\ifcsname\??ws\??ws\currentwhitespace\endcsname \csname\??ws\??ws\currentwhitespace\endcsname @@ -495,8 +497,6 @@ \fi \parskip\ctxparskip} -\chardef\baselinegridmode=0 % option in layout / 1=permit_half_lines - \def\dodosetupwhitespace {\ifgridsnapping \setfalse\flexiblewhitespace @@ -1281,7 +1281,7 @@ %D Page spacing -\chardef\bottomraggedness=0 % 0=ragged 1=normal/align 2=baseline +\newconstant\bottomraggednessmode % 0=ragged 1=normal/align 2=baseline \def\bottomalignlimit{3\lineheight} @@ -1294,21 +1294,21 @@ \r@ggedbottomfalse} \def\raggedbottom - {\chardef\bottomraggedness\zerocount + {\bottomraggednessmode\zerocount \n@rmalbottomfalse \r@ggedbottomtrue \b@selinebottomfalse \settopskip} \def\alignbottom - {\chardef\bottomraggedness\plusone + {\bottomraggednessmode\plusone \n@rmalbottomtrue \r@ggedbottomfalse \b@selinebottomfalse \settopskip} \def\baselinebottom - {\chardef\bottomraggedness\plustwo + {\bottomraggednessmode\plustwo \n@rmalbottomfalse \r@ggedbottomfalse \b@selinebottomtrue @@ -1318,27 +1318,26 @@ % so, the new one will be % -% \chardef\bottomraggedness=0 % 0=ragged 1=normal/align 2=baseline +% \bottomraggednessmode=0 % 0=ragged 1=normal/align 2=baseline % % \def\bottomalignlimit{3\lineheight} % will be settable % -% \def\raggedbottom {\chardef\bottomraggedness=0 \settopskip} -% \def\alignbottom {\chardef\bottomraggedness=1 \settopskip} -% \def\baselinebottom{\chardef\bottomraggedness=2 \settopskip} +% \def\raggedbottom {\bottomraggednessmode\zerocount\settopskip} +% \def\alignbottom {\bottomraggednessmode\plusone \settopskip} +% \def\baselinebottom{\bottomraggednessmode\plustwo \settopskip} % % \let\normalbottom =\alignbottom %D Good old blank redone: -\definesystemattribute[kern-chars] -\definesystemattribute[skip-category] \chardef\skipcategoryattribute \dogetattributeid{skip-category} -\definesystemattribute[skip-penalty] \chardef\skippenaltyattribute \dogetattributeid{skip-penalty} -\definesystemattribute[skip-order] \chardef\skiporderattribute \dogetattributeid{skip-order} -\definesystemattribute[display-math] \chardef\displaymathattribute \dogetattributeid{display-math} -\definesystemattribute[snap-method] \chardef\snapmethodattribute \dogetattributeid{snap-method} -\definesystemattribute[snap-vbox] \chardef\snapvboxattribute \dogetattributeid{snap-vbox} - -%definesystemattribute[snap-category] \chardef\snapcategoryattribute \dogetattributeid{snap-category} +%definesystemattribute[kernchars] [public] +\definesystemattribute[skipcategory] [public] +\definesystemattribute[skippenalty] [public] +\definesystemattribute[skiporder] [public] +\definesystemattribute[displaymath] [public] +\definesystemattribute[snapmethod] [public] +\definesystemattribute[snapvbox] [public] +%definesystemattribute[snapcategory] [public] % TODO: NAMED SNAPPERS @@ -1536,8 +1535,8 @@ \hss}% \flushnextbox}}} -\chardef\gridboxlinenomode\plusone % 0:nothing 1:all 2:lines 3:frame 4:l/r -\chardef\gridboxlinemode \plusone +\setnewconstant\gridboxlinenomode\plusone % 0:nothing 1:all 2:lines 3:frame 4:l/r +\setnewconstant\gridboxlinemode \plusone \def\gridboxvbox {\ifcase\gridboxlinemode\vbox\or\ruledvbox\or\vbox\or\ruledvbox\else\ruledvbox\fi} \def\gridboxwidth{\ifcase\gridboxlinemode0\or.5\or.5\or0\else.5\fi\testrulewidth} @@ -1550,7 +1549,7 @@ \hsize#2% \baselinerulefalse \ifnum\gridboxlinenomode=\plusthree - \chardef\gridboxlinenomode\ifodd\realpageno\plusone\else\plustwo\fi + \gridboxlinenomode\ifodd\realpageno\plusone\else\plustwo\fi \fi \gridboxvbox % calculated size {\getrawnoflines{#3}% \getnoflines{#3}% diff --git a/tex/context/base/spec-mis.mkii b/tex/context/base/spec-mis.mkii index 3d263eace..d56eca27e 100644 --- a/tex/context/base/spec-mis.mkii +++ b/tex/context/base/spec-mis.mkii @@ -196,8 +196,10 @@ %D %D \METAPOST\ support. +\ifx\makeMPintoPDFobject\undefined \newcount\makeMPintoPDFobject \fi + \appendtoks - \chardef\makeMPintoPDFobject\zerocount + \makeMPintoPDFobject\zerocount \def\setMPPDFobject#1#2{\def\getMPPDFobject{\box#2}}% \to \everyresetspecials diff --git a/tex/context/base/strc-des.mkiv b/tex/context/base/strc-des.mkiv index b0a240612..9929cc1c5 100644 --- a/tex/context/base/strc-des.mkiv +++ b/tex/context/base/strc-des.mkiv @@ -321,8 +321,10 @@ %D A new key 'headalign' in definitions. +\newconstant\nesteddescriptionstate + \def\resetdescriptions % to be used in e.g. footnotes - {\chardef\nesteddescriptionstate\zerocount} + {\nesteddescriptionstate\zerocount} \resetdescriptions @@ -359,9 +361,9 @@ \normalexpanded{\noexpand\indenting[\descriptionparameter\c!indenting]}% % better a system mode \ifcase\nesteddescriptionstate - \chardef\nesteddescriptionstate\plusone + \nesteddescriptionstate\plusone \or - \chardef\nesteddescriptionstate\plustwo + \nesteddescriptionstate\plustwo \fi % now happens elsewhere : \noindent\ignorespaces \@@resetdescriptionclosesymbol} diff --git a/tex/context/base/strc-flt.mkiv b/tex/context/base/strc-flt.mkiv index e50306ead..ff849517f 100644 --- a/tex/context/base/strc-flt.mkiv +++ b/tex/context/base/strc-flt.mkiv @@ -518,18 +518,18 @@ \def\preparefloatnumber#1% {\xdef\floatcaptionnumber{#1}% \doifelsenodelocation{\v!float\@@thenumber{#1}} - \donothing {\chardef\nodelocationmode\zerocount}% + \donothing {\nodelocationmode\zerocount}% \doifelse{\floatsharedparameter\c!numbering}\v!nocheck {\incrementnumber[#1]% \makesectionnumber[#1]% \ifconditional\retainfloatnumber\decrementnumber[#1]\fi} {\ifinsidecolumns - \chardef\nodelocationmode\zerocount + \nodelocationmode\zerocount % to be perfected: - % \chardef\nodelocationmode\plustwo + % \nodelocationmode\plustwo \fi % FOR THE MOMENT NOT AVAILABLE -\chardef\nodelocationmode\zerocount +\nodelocationmode\zerocount % BUT NOT THAT HARD TO DO \ifcase\nodelocationmode \incrementnumber[#1]% @@ -647,8 +647,9 @@ \def\xxdocompletefloat#1#2% {\rightorleftpageaction{\let\@@extrafloat#1}{\let\@@extrafloat#2}} -\chardef\textfloatmethod=0 % 0=raw 1=safe (.99) 2=tight (-1pt) -\chardef\sidefloatmethod=1 % 0=raw 1=safe (.99) 2=tight (-1pt) +\setnewconstant\sidefloatalign \zerocount +\setnewconstant\textfloatmethod\zerocount % 0=raw 1=safe (.99) 2=tight (-1pt) +\setnewconstant\sidefloatmethod\plusone % 0=raw 1=safe (.99) 2=tight (-1pt) \let\floatrotation\!!zerocount @@ -667,26 +668,26 @@ \fi \global\sidefloatshift\zeropoint \global\sidefloatmaximum\zeropoint - \global\chardef\sidefloatmethod\floatparameter\c!sidemethod - \global\chardef\textfloatmethod\floatparameter\c!textmethod - \global\chardef\sidefloatalign\zerocount + \global\sidefloatmethod\floatparameter\c!sidemethod + \global\textfloatmethod\floatparameter\c!textmethod + \global\sidefloatalign\zerocount \globallet\floatrotation\!!zerocount \calculatefloatskips \ifparfloat \processaction [\floatparameter\c!sidealign] - [\v!height=>\global\chardef\sidefloatalign\plusone,% - \v!line=>\global\chardef\sidefloatalign\plustwo,% (***) - \v!depth=>\global\chardef\sidefloatalign\plusthree,% - \v!grid=>\global\chardef\sidefloatalign\plusfour,% - \v!halfline=>\global\chardef\sidefloatalign\plusfive]% - % todo (test first): \doifinset\v!lokaal{#2}{\chardef\sidefloatalign\zerocount}% + [\v!height=>\global\sidefloatalign\plusone,% + \v!line=>\global\sidefloatalign\plustwo,% (***) + \v!depth=>\global\sidefloatalign\plusthree,% + \v!grid=>\global\sidefloatalign\plusfour,% + \v!halfline=>\global\sidefloatalign\plusfive]% + % todo (test first): \doifinset\v!lokaal{#2}{\global\sidefloatalign\zerocount}% \ifcase\sidefloatalign\relax % todo: optie v!lokaal => \else - \doifinset\v!height {#2}{\global\chardef\sidefloatalign\plusone}% - \doifinset\v!line {#2}{\global\chardef\sidefloatalign\plustwo}% - \doifinset\v!depth {#2}{\global\chardef\sidefloatalign\plusthree}% - \doifinset\v!grid {#2}{\global\chardef\sidefloatalign\plusfour}% - \doifinset\v!halfline{#2}{\global\chardef\sidefloatalign\plusfive}% meant for 'none' + \doifinset\v!height {#2}{\global\sidefloatalign\plusone}% + \doifinset\v!line {#2}{\global\sidefloatalign\plustwo}% + \doifinset\v!depth {#2}{\global\sidefloatalign\plusthree}% + \doifinset\v!grid {#2}{\global\sidefloatalign\plusfour}% + \doifinset\v!halfline{#2}{\global\sidefloatalign\plusfive}% meant for 'none' \fi \doifinset\v!high{#2}{\global\sidefloattopskip \zeropoint}% \doifinset\v!low {#2}{\global\sidefloatbottomskip\zeropoint}% @@ -1212,14 +1213,14 @@ \ifdefined\moveboxontogrid\else \let\movecaptionontogrid\gobblethreearguments \fi \def\locatefloatbox - {\chardef\alignstrutmode\zerocount + {\alignstrutmode\zerocount \shiftalignedline {\floatparameter\c!leftmargin }{\floatparameter\c!rightmargin}% {\floatparameter\c!innermargin}{\floatparameter\c!outermargin}% \alignedline{\floatparameter\c!location}\v!middle} \def\locatecaptionbox - {\chardef\alignstrutmode\zerocount + {\alignstrutmode\zerocount \shiftalignedline {\floatcaptionparameter\c!leftmargin }{\floatcaptionparameter\c!rightmargin}% {\floatcaptionparameter\c!innermargin}{\floatcaptionparameter\c!outermargin}% @@ -1732,7 +1733,7 @@ \newif\ifpostponecolumnfloats \postponecolumnfloatsfalse % don't change -\chardef\postcenterfloatmethod\plusone +\setnewconstant\postcenterfloatmethod\plusone \def\postcenterfloatbox#1% {\scratchdimen @@ -1808,7 +1809,7 @@ \let\locatecaption\relax \def\locatesidefloat##1% {\begingroup - \chardef\alignstrutmode\zerocount + \alignstrutmode\zerocount \hsize\tempfloatwidth \forgetall \alignedline{\floatparameter\c!location}\v!middle{##1}% \endgroup}% diff --git a/tex/context/base/strc-itm.mkiv b/tex/context/base/strc-itm.mkiv index 8b8b6d243..6211fd9b6 100644 --- a/tex/context/base/strc-itm.mkiv +++ b/tex/context/base/strc-itm.mkiv @@ -1150,7 +1150,7 @@ % \setupitemize[each][atmargin][width=3em] % \startitemize[n,repeat,packed] \getbuffer \stopitemize -\chardef\autoitemgroupspacing=2 % 0 = voor/na, 1=tussen als geen voor 2=(prev)tussen=old/normal +\setnewconstant\autoitemgroupspacing\plustwo % 0 = voor/na, 1=tussen als geen voor 2=(prev)tussen=old/normal % todo: assume startitem ... stopitem and do an autostopitem .. cleaner for % elements diff --git a/tex/context/base/strc-lst.mkiv b/tex/context/base/strc-lst.mkiv index 875cfa799..59b69d516 100644 --- a/tex/context/base/strc-lst.mkiv +++ b/tex/context/base/strc-lst.mkiv @@ -88,6 +88,7 @@ userdata = structures.helpers.touserdata(\!!bs\detokenize{#3}\!!es) }}}% \edef\structurelistsynchronize{\getvalue{\??li::inject::#2::synchronize}}% + % we can do the enhance injection at the lua end which saves tokenization and a call \ifx\structurelistsynchronize\v!yes % this injects nodes ! \expanded{\ctxlatelua{structures.lists.enhance(\currentlistnumber)}}% diff --git a/tex/context/base/strc-mat.mkiv b/tex/context/base/strc-mat.mkiv index ca4d4b2c5..0d2e4a240 100644 --- a/tex/context/base/strc-mat.mkiv +++ b/tex/context/base/strc-mat.mkiv @@ -87,6 +87,13 @@ \newtoks\everyresetformulas +% 0=unset, 1=forced, 2=none, 3=reference + +\newconstant\placeformulanumbermode +\newconstant\formulasnumbermode +\newconstant\subformulasnumbermode +\newconstant\nestedformulanumbermode + \newconditional\insideplaceformula \newconditional\insideplacesubformula \newconditional\insideformulas @@ -636,20 +643,11 @@ % place -% 0=unset, 1=forced, 2=none, 3=reference - -\chardef\placeformulanumbermode \zerocount -\chardef\formulanumbermode \zerocount -\chardef\formulasnumbermode \zerocount -\chardef\subformulasnumbermode \zerocount -\chardef\nestedformulanumbermode\zerocount - \def\inhibitformulanumberflag{-} \def\forceformulanumberflag {+} \def\docheckformulareference#1#2% - {\chardef#1% - \unless\ifx\namedformulaentry\relax % new 29/8/2010 + {#1\unless\ifx\namedformulaentry\relax % new 29/8/2010 \plusthree \else\ifx#2\empty \zerocount diff --git a/tex/context/base/strc-not.mkiv b/tex/context/base/strc-not.mkiv index 361d7dfb0..cfbfcea96 100644 --- a/tex/context/base/strc-not.mkiv +++ b/tex/context/base/strc-not.mkiv @@ -353,10 +353,9 @@ \def\clevernotes % compatibility hack, will be redone {\numexpr\ifcase\namednoteparameter\v!footnote\s!noteloc\or0\or2\or2\or1\else0\fi\relax} -\def\setnotelocation #1{\expandafter\chardef\csname\??vn\currentnote\s!noteloc\endcsname#1\relax} -\def\setnoteposition #1{\expandafter\chardef\csname\??vn\currentnote\s!notepos\endcsname#1\relax} -\def\setnoteformatting#1{\expandafter\chardef\csname\??vn\currentnote\s!notefmt\endcsname#1\relax} -\def\setnotecolumns #1{\expandafter\chardef\csname\??vn\currentnote\s!notecol\endcsname#1\relax} +\def\setnotelocation #1{\expandafter\let\csname\??vn\currentnote\s!noteloc\endcsname#1\relax} +\def\setnoteposition #1{\expandafter\let\csname\??vn\currentnote\s!notepos\endcsname#1\relax} +\def\setnoteformatting#1{\expandafter\let\csname\??vn\currentnote\s!notefmt\endcsname#1\relax} \def\currentnofcolumns{\@@kln} diff --git a/tex/context/base/strc-pag.mkiv b/tex/context/base/strc-pag.mkiv index 4b76dced6..2d6a6aaf1 100644 --- a/tex/context/base/strc-pag.mkiv +++ b/tex/context/base/strc-pag.mkiv @@ -224,7 +224,7 @@ \appendtoks \decrementstructurecounter[\s!realpage]% \decrementstructurecounter[\s!userpage]% - \decrementstructurecounter[\s!subpage]% + \decrementstructurecounter[\s!subpage ]% \to\everygoodbye % Equivalents (compatibility): @@ -390,17 +390,17 @@ % compatible. So, in fact there can be multiple handlers active at the % same time, but only the current one does something. -\chardef\realpagenumberstate =2 % counter state : 0=stop, 1=start, 2=start and visible -\chardef\userpagenumberstate =2 % counter state : 0=stop, 1=start, 2=start and visible -\chardef\subpagenumberstate =2 % counter state : 0=stop, 1=start, 2=start and visible -\chardef\overallpagenumberstate=1 % general number: 0=invisible, 1=visible +\setnewconstant\realpagenumberstate \plustwo % counter state : 0=stop, 1=start, 2=start and visible +\setnewconstant\userpagenumberstate \plustwo % counter state : 0=stop, 1=start, 2=start and visible +\setnewconstant\subpagenumberstate \plustwo % counter state : 0=stop, 1=start, 2=start and visible +\setnewconstant\overallpagenumberstate\plusone % general number: 0=invisible, 1=visible \def\checkpagenumberstatechange#1#2% {\edef\newpagenumberstate{\structurecounterparameter#1\c!state}% \ifx\newpagenumberstate\oldpagenumberstate \else \doifelse\newpagenumberstate\v!start - {\chardef#2\plustwo}% - {\chardef#2\zerocount}% + {#2\plustwo}% + {#2\zerocount}% \fi} \appendtoks % todo: set state: none, start, stop, reset @@ -417,8 +417,8 @@ \appendtoks % todo: set state: none, start, stop, reset \doifelse\@@nmstate\v!start - {\chardef\overallpagenumberstate\plusone}% - {\chardef\overallpagenumberstate\zerocount}% + {\overallpagenumberstate\plusone }% + {\overallpagenumberstate\zerocount}% \to \everysetuppagenumbering % Done diff --git a/tex/context/base/strc-ref.mkiv b/tex/context/base/strc-ref.mkiv index 214303edf..dfa1704c5 100644 --- a/tex/context/base/strc-ref.mkiv +++ b/tex/context/base/strc-ref.mkiv @@ -649,7 +649,8 @@ %D document). By setting the \type{interaction} variable, one %D can influences the way interactive references are set. -\chardef\autocrossfilereferences=0 +\newconstant\autocrossfilereferences % not yet supported in mkiv +\newconstant\referencefilecaseswap % not yet supported in mkiv \unexpanded\def\setupreferencing {\dosingleargument\dosetupreferencing} @@ -668,16 +669,16 @@ \v!label=>\let\dowantedreference\dolabelonlyreference, \v!text=>\let\dowantedreference\dotextonlyreference, \v!symbol=>\let\dowantedreference\dosymbolreference]% - \chardef\autocrossfilereferences\zerocount + \autocrossfilereferences\zerocount \processaction [\@@rfautofile] - [ \v!yes=>\chardef\autocrossfilereferences\plusone, - \v!page=>\chardef\autocrossfilereferences\plustwo]% - \chardef\referencefilecase\zerocount + [ \v!yes=>\autocrossfilereferences\plusone, + \v!page=>\autocrossfilereferences\plustwo]% + \referencefilecaseswap\zerocount \processaction[\@@rfconvertfile] - [ \v!yes=>\chardef\referencefilecase\plusone, - \v!big=>\chardef\referencefilecase\plusone, - \v!small=>\chardef\referencefilecase\plustwo]% + [ \v!yes=>\referencefilecaseswap\plusone, + \v!big=>\referencefilecaseswap\plusone, + \v!small=>\referencefilecaseswap\plustwo]% \setupreferenceprefix[\@@rfprefix]% \doifelse\@@rfglobal\v!yes {\settrue \autoglobalfilereferences} @@ -1580,8 +1581,6 @@ %D key \type{file}, which is interpreted as the file to jump %D to, that is, when one clicks on the title. -\newif\ifautocrossdocument - \def\coupledocument {\doquadrupleempty\docoupledocument} diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv index 06c719a97..118ba2a35 100644 --- a/tex/context/base/strc-reg.mkiv +++ b/tex/context/base/strc-reg.mkiv @@ -805,390 +805,13 @@ \setregisterpagerendering \to \everyplaceregister -% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % -% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % -% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % - -%D The following code will be reimplemented (not that hard) when it's needed +%D The linked register code will be reimplemented (not that hard) when it's needed %D again and/or when I'm bored. -% \def\getalllistreferences#1#2% -% {\gdefconvertexpanded\currentregisterentry{\getvalue{\??id#1\c!expansion}}{#2}% -% \doifdefinedelse{\??id#1\??id\currentregisterentry} -% {\edef\alllistreferences% -% {\getvalue{\??id#1\??id\currentregisterentry}}% -% \beforesplitstring\alllistreferences\at::\to\internallistreference -% \aftersplitstring \alllistreferences\at::\to\alllistreferences} -% {\let\alllistreferences\empty -% \def\internallistreference{0}}} - -% \def\dosetlinkregister#1% is die page reference echt nodig? -% {\setregisterpage{#1}% -% \global\let\currentregisterentry\empty -% \global\firstsubentrytrue % not needed -% \global\firstsubsubentrytrue % not needed too -% \setvalue{#1\s!entrya}##1{\dosetlinkregisterentrya{#1}{##1}}% -% \setvalue{#1\s!entry }##1{\dosetpageregisterletter{#1}{##1}}} - -% \def\dosetlinkregisterentrya#1#2% -% {\c!entryletter -% \iflocation -% \getalllistreferences{#1}{#2}% -% % no \endgraf -% \hangindent1em\noindent\c!entryreference -% % -% %\thisissomeinternal{\s!lin}{\internallistreference}% -% % -% \pagereference[-:\s!lin:\internallistreference]% -: added -% % -% \getcommacommandsize[\alllistreferences]% -% \getfromcommacommand[\alllistreferences][1]% -% \ifnum\commalistsize=1 -% \let\firstlistreference\empty -% \let\midlistreference\commalistelement -% \let\lastlistreference\empty -% \else -% \let\firstlistreference\commalistelement -% \getfromcommacommand[\alllistreferences][\commalistsize]% -% \let\lastlistreference\commalistelement -% \ifnum\commalistsize=2 -% \let\midlistreference\empty -% \else -% \!!counta\commalistsize -% \divide\!!counta 2 -% \getfromcommacommand[\alllistreferences][\!!counta]% -% \let\midlistreference\commalistelement -% \fi -% \fi -% % aangepast -% \def\dodocommand[##1-##2]% -% {\gotonextinternal{\s!ind}{##1}{##2}{\box0}}% -% \doifelsevalue{\??id#1\c!interaction}\v!pagenumber -% {\limitedregisterentry{#1}{#2}} % paginanummer -% {{\setbox0\hbox{\limitedregisterentry{#1}{\begstrut#2}}% -% \ifx\firstlistreference\empty % tekst,alles -% \ifx\midlistreference\empty -% \box0 -% \else -% \expandafter\dodocommand\expandafter[\midlistreference]% -% \fi -% \else -% \expandafter\dodocommand\expandafter[\firstlistreference]% -% \fi}}% -% \doifvalue{\??id#1\c!number}\v!yes -% {\hskip\getvalue{\??id#1\c!distance}(\commalistsize)}% -% \doifnotvalue{\??id#1\c!interaction}\v!text % paginanummer,alles -% {\def\docommand##1##2% -% {{\setbox0\hbox{\showlocation{\hbox to 1em{\hss\symbol[##2]\hss}}}% -% \ifx##1\empty -% % \hskip\wd0 % (optioneel maken) -% \else -% \expandafter\dodocommand\expandafter[##1]% -% \fi}}% -% \hskip\getvalue{\??id#1\c!distance}% -% \docommand\firstlistreference\v!previous -% \docommand\midlistreference\v!somewhere -% \docommand\lastlistreference\v!next}% -% % tot hier -% \else -% % no \endgraf -% \noindent\c!entryreference -% \limitedregisterentry{#1}{#2}% -% \fi -% \endgraf} - -% \def\dosetregister#1% -% {\doifelsevalue{\??id#1\c!coupling}\v!yes -% {\ifautoregisterhack -% \dosetautoregister{#1}% -% \else -% \dosetlinkregister{#1}% -% \fi} -% {\dosetpageregister{#1}}} - -% \def\dosetregister#1% -% {\dosetpageregister{#1}} - -% \newcounter\internallistreference - -% \def\doloadregisterlinks#1% -% {\setregisterpage{#1}% -% \global\let\currentregisterentry\empty -% \global\firstregisterpagetrue -% \setvalue{#1\s!entrya}##1% -% {\global\firstregisterpagetrue -% \gdefconvertedargument\currentregisterentry{##1}% global nodig? -% \doglobal\increment\internallistreference}% -% \setvalue{#1\s!from}% -% {\getvalue{#1\s!page}}% -% \ifautoregisterhack -% \setvalue{#1\s!page}##1##2##3##4% -% {\doifreglevelelse[##3] -% {\iffirstregisterpage -% \@EA\xdef\csname\??id#1\??id\currentregisterentry\endcsname -% {\internallistreference::##4}% -% \else % catches errors in index -% \ifcsname\??id#1\??id\currentregisterentry\endcsname -% \@EA\xdef\csname\??id#1\??id\currentregisterentry\endcsname -% {\csname\??id#1\??id\currentregisterentry\endcsname,##4}% -% \fi -% \fi} -% {}}% -% \else -% \setvalue{#1\s!page}##1##2##3##4% -% {\doifreglevelelse[##3] -% {\iffirstregisterpage -% \global\firstregisterpagefalse -% \@EA\xdef\csname\??id#1\??id\currentregisterentry\endcsname -% {\internallistreference::##2-##4}% -% \else % catches errors in index -% \ifcsname\??id#1\??id\currentregisterentry\endcsname -% \@EA\xdef\csname\??id#1\??id\currentregisterentry\endcsname -% {\csname\??id#1\??id\currentregisterentry\endcsname,##2-##4}% -% \fi -% \fi} -% {}}% -% \fi} - -% \def\docoupleregister[#1][#2]% -% {\iflocation -% \ifcase0\countervalue{autolink:#1}\relax % only once -% \begingroup -% \let\dosetregister\doloadregisterlinks -% \def\currentregister{#1}% -% \setupregister[#1][#2]% -% \mkloadregister\currentregister\dobeforeplaceregister\doafterplaceregister -% \endgroup -% \ifautoregisterhack -% \doinitializeautoregister{#1}% -% \else -% \doinitializelinkregister{#1}% -% \fi -% \fi -% \fi} - -% \def\coupleregister -% {\dodoubleempty\docoupleregister} - -% \def\dodocommandprolinrefAA[#1-#2]% -% {\def\lastlistreference{#1-#2}} - -% \def\dodocommandprolinrefA[#1-#2]% -% {\def\lastlistreference{#1-#2}% -% \ifx\firstlistreference\empty -% \let\firstlistreference\lastlistreference -% \fi -% \ifnum#1<\nextinternalreference\relax -% \let\prevlistreference\lastlistreference -% \else\ifnum#1>\nextinternalreference\relax -% \let\nextlistreference\lastlistreference -% \let\dodocommandprolinrefA\dodocommandprolinrefAA -% \else -% \let\selflistreference\lastlistreference -% \fi\fi} - -% \def\docommandprolinrefA#1% -% {\dodocommandprolinrefA[#1]} - -% \def\dodocommandprolinrefB[#1-#2]% -% {\gotonextinternal{\s!ind}{#1}{#2}{\box0}} - -% \def\docommandprolinrefB#1#2#3% -% {\bgroup -% \ifx#2\empty -% \doifvalue{\??id#1\c!unknownreference}\v!empty{\hskip1em}% -% \else -% \setbox0\hbox to 1em{\hss\showlocation{\symbol[#3]}\hss}% -% \expandafter\dodocommandprolinrefB\expandafter[#2]% -% \fi -% \egroup} - -% \def\doprocesslinkregister[#1][#2]#3% -% {\hbox -% {\doprocesspageregister{}{#2}{}{#3}% -% \let\firstlistreference\empty -% \let\lastlistreference\empty -% \let\selflistreference\empty -% \let\prevlistreference\empty -% \let\nextlistreference\empty -% \getalllistreferences{#1}{#3}% -% \ifx\alllistreferences\empty \else -% \normalexpanded{\noexpand\rawprocesscommalist[\alllistreferences]}\docommandprolinrefA -% \fi -% \ifx\prevlistreference\empty -% \let\prevlistreference\lastlistreference -% \fi -% \ifx\nextlistreference\empty -% \let\nextlistreference\firstlistreference -% \fi -% \ifx\prevlistreference\selflistreference -% \let\prevlistreference\empty -% \let\nextlistreference\empty -% \fi -% \setalignmentswitch{\getvalue{\??id#1\c!location}}% -% \ifcase\alignmentswitch -% % links -% \docommandprolinrefB{#1}\prevlistreference\v!previous -% \docommandprolinrefB{#1}\nextlistreference\v!next -% \or -% % midden -% \docommandprolinrefB{#1}\prevlistreference\v!previous -% \or -% % rechts -% \fi -% \doifreferencefoundelse{\s!lin:\internallistreference} -% {\gotosomeinternal -% \s!lin \internallistreference \currentrealreference -% {\showlocation{\limitedregisterentry{#1}{#3}}}} -% {\hbox{\limitedregisterentry{#1}{#3}}}% -% \ifcase\alignmentswitch -% % links -% \or -% % midden -% \docommandprolinrefB{#1}\nextlistreference\v!next -% \or -% % rechts -% \docommandprolinrefB{#1}\prevlistreference\v!previous -% \docommandprolinrefB{#1}\nextlistreference\v!next -% \fi}} - -% \def\doprocesslinkedregister[#1][#2]#3% page auto link -% {\bgroup -% \chardef\registerpagestatus\plusone -% \def\currentregister{#1}% -% \iflocation % \next is not needed -% \ifautoregisterhack -% \def\next{\doprocessautoregister[#1][#2]}% -% \else -% \def\next{\doprocesslinkregister[#1][#2]}% -% \fi -% \else -% \def\next{\doprocesspageregister{}{#2}{}}% -% \fi -% \next{#3}% -% \egroup} - -% \def\dodolinkedregister[#1][#2]#3% page auto link -% {\doflushatpar{\doprocesslinkedregister[#1][#2]{#3}}} - -% \def\dolinkedregister#1% -% {\dodoubleempty\dodolinkedregister[#1]} - -% \def\dosetautoregister#1% -% {\makecounter{autolink:#1}% -% \setregisterpage{#1}% -% \global\let\currentregisterentry\empty -% \global\firstsubentrytrue % not needed -% \global\firstsubsubentrytrue % not needed too -% \setvalue{#1\s!entrya}##1{\dosetautoregisterentrya{#1}{##1}}% -% \setvalue{#1\s!entry }##1{\dosetpageregisterletter{#1}{##1}}} - -% \def\dosetautoregisterentrya#1#2% -% {\c!entryletter -% \iflocation -% \getalllistreferences{#1}{#2}% -% \endgraf\hangindent1em\noindent\c!entryreference -% \pagereference[-:\s!lin:\internallistreference]% -% \pluscounter{autolink:#1}% -% \bgroup -% %\setupinteraction[\c!color=,\c!contrastcolor=,\c!style=]% kan sneller -% \resetinteractionparameter\c!color -% \resetinteractionparameter\c!contrastcolor -% \resetinteractionparameter\c!style -% \gotobox -% {\limitedregisterentry{#1}{\begstrut#2}}% -% [JS(SetRegisterEntry{\v!register,\countervalue{autolink:#1},#2,{\alllistreferences}})]% -% \egroup -% \else -% \endgraf\noindent\c!entryreference -% \limitedregisterentry{#1}{#2}% -% \fi} - -% \def\doprocessautoregister[#1][#2]#3% -% {\hbox -% {\doprocesspageregister{}{#2}{}{#3}% -% \doifreferencefoundelse{\s!lin:\internallistreference} -% {\gotosomeinternal \s!lin -% {\internallistreference}{\currentrealreference} -% {\showlocation{\limitedregisterentry{#1}{#3}}}} -% {\hbox{\limitedregisterentry{#1}{#3}}}}} - -% \appendmacro aan openpaginaactie (in shipout) - -%D The first implementation used one main field with clones. -%D In a 2500 page document this resulted in a rather (anoying) -%D long start||up time. This \quote {every page its own field} -%D solution, combined with a \quote {page open action}, works -%D much faster, but is conceptually pretty weak. - -% \def\complexregisterfield[#1]% -% {\definefield[#1:\realfolio][line][\v!register]% -% \field[#1:\realfolio]} - -% \def\simpleregisterfield -% {\complexregisterfield[\v!register]} - -% \definecomplexorsimple\registerfield - -% \appendtoks -% % for now -% \setupfield -% [\v!register] -% [\c!width=10em, -% \c!height=3ex, -% \c!align=\v!middle, -% \c!option=\v!readonly, -% \c!location=\v!low] -% \to \everydump - -% \def\doinitializeautoregister#1% -% {\useJSscripts[reg]% -% \useJSpreamblenow{LinkedRegisters}% -% \setupinteraction[\c!openpageaction=JS(UpdateRegisterField{\v!register})]% -% \definereference[\v!reset\v!register][JS(ResetRegisterEntry{\v!register})]% -% \definereference[\v!first\v!register][JS(GotoFirstRegisterEntry{\v!register})]% -% \definereference[\v!previous\v!register][JS(GotoPreviousRegisterEntry{\v!register})]% -% \definereference[\v!next\v!register][JS(GotoNextRegisterEntry{\v!register})]% -% \definereference[\v!last\v!register][JS(GotoLastRegisterEntry{\v!register})]} - -% \def\doinitializelinkregister#1% -% {} - -% todo ruwe register - %D Default index: \defineregister [\v!index] [\v!indices] -% \setupregister[index][koppeling=ja] -% -% \stelveldenin -% [register][achtergrond=raster,kader=uit] -% -% \stelvoettekstenin -% [{\field[index]}] -% -% \stelhoofdtekstenin -% [{\naar {first}[eersteindex]\quad -% \naar{previous}[vorigeindex]\quad -% \naar {next}[volgendeindex]\quad -% \naar {last}[laatsteindex]\quad\quad -% \naar {index}[index]}] -% -% \starttekst -% -% oeps~~~\gekoppeldeindex{oeps} \blanko -% flop~~~\gekoppeldeindex{flop} \blanko -% test~~~\gekoppeldeindex{test} \pagina -% flop~~~\gekoppeldeindex{flop} \blanko -% test~~~\gekoppeldeindex{test} \pagina -% oeps~~~\gekoppeldeindex{oeps} \blanko -% test~~~\gekoppeldeindex{test} \pagina -% flop~~~\gekoppeldeindex{flop} \blanko -% oeps~~~\gekoppeldeindex{oeps} \pagina -% -% \volledigeindex - \protect \endinput diff --git a/tex/context/base/strc-ren.mkiv b/tex/context/base/strc-ren.mkiv index abec640ac..82ac1c166 100644 --- a/tex/context/base/strc-ren.mkiv +++ b/tex/context/base/strc-ren.mkiv @@ -15,10 +15,8 @@ \unprotect -\chardef\headtimingmode=0 +\newconstant\headtimingmode -% \chardef\headtimingmode=1 % 0 also works ok now too -% % Martin Kolarik's problem: % % \setuphead[section][command=\doTitle] diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index bf1399a31..b2b962183 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -692,8 +692,10 @@ % the next one was: \somebreakmethod -% \chardef\somestructureheadbreakmethod\plusone % 0=nothing, 1=weighted, 2=strict, 3=vspacing -\chardef\somestructureheadbreakmethod\plusthree + +% 0 = nothing, 1 = weighted, 2 = strict, 3 = vspacing + +\setnewconstant\somestructureheadbreakmethod\plusthree % \def\dopreventbreakafterstructureheadauto % used after \c!before % {\ifcase\somestructureheadbreakmethod diff --git a/tex/context/base/strc-tag.mkiv b/tex/context/base/strc-tag.mkiv index cdf4fe9b7..94bd94c7c 100644 --- a/tex/context/base/strc-tag.mkiv +++ b/tex/context/base/strc-tag.mkiv @@ -100,8 +100,8 @@ % the real code -\definesystemattribute[tagged] \chardef\taggedattribute \dogetattributeid{tagged} -\definesystemattribute[image] \chardef\imageattribute \dogetattributeid{image} +\definesystemattribute[tagged][public] +\definesystemattribute[image] [public] \def\setelementbackendtag{\dodoubleargument\dosetelementbackendtag} \def\setelementnature {\dodoubleargument\dosetelementnature} diff --git a/tex/context/base/supp-fil.mkiv b/tex/context/base/supp-fil.mkiv index 5b425df0c..33cf3ea78 100644 --- a/tex/context/base/supp-fil.mkiv +++ b/tex/context/base/supp-fil.mkiv @@ -71,14 +71,14 @@ \def\pushendofline {\advance\endoflinelevel\plusone \expandafter\chardef\csname :eol:\number\endoflinelevel\endcsname\catcode\newlinecode - \catcode\newlinecode\@@comment\relax} + \catcode\newlinecode\commentcatcode\relax} \def\popendofline {\catcode\newlinecode\csname :eol:\number\endoflinelevel\endcsname \advance\endoflinelevel\minusone} \def\restoreendofline - {\catcode\newlinecode\@@endofline} + {\catcode\newlinecode\endoflinecatcode} %D \macros %D {scratchread, scratchwrite} diff --git a/tex/context/base/supp-mat.mkiv b/tex/context/base/supp-mat.mkiv index 02da286c3..8549aaa36 100644 --- a/tex/context/base/supp-mat.mkiv +++ b/tex/context/base/supp-mat.mkiv @@ -165,12 +165,12 @@ %D and \type {\suber} by saying \type {\enablesupsub}. \bgroup -\catcode`\^=\@@active -\catcode`\_=\@@active +\catcode`\^=\activecatcode +\catcode`\_=\activecatcode \gdef\enablesupsub - {\catcode`\^=\@@active + {\catcode`\^=\activecatcode \def^{\ifmmode\expandafter\super\else\expandafter\normalsuper\fi}% - \catcode`\_=\@@active + \catcode`\_=\activecatcode \def_{\ifmmode\expandafter\suber\else\expandafter\normalsuber\fi}} \egroup diff --git a/tex/context/base/supp-mpe.mkii b/tex/context/base/supp-mpe.mkii index 67b27919c..f28176292 100644 --- a/tex/context/base/supp-mpe.mkii +++ b/tex/context/base/supp-mpe.mkii @@ -35,7 +35,7 @@ %D %D \MPcmykcolorstrue %D \MPspotcolorstrue -%D \chardef\makeMPintoPDFobject\plusone +%D \makeMPintoPDFobject\plusone %D \stoptyping \ifx\writestatus\undefined diff --git a/tex/context/base/supp-pdf.mkii b/tex/context/base/supp-pdf.mkii index c54b0c6bc..4d3619d4b 100644 --- a/tex/context/base/supp-pdf.mkii +++ b/tex/context/base/supp-pdf.mkii @@ -2020,7 +2020,7 @@ %D The last object number used is avaliable in the macro %D \type {\lastPDFMPobject}. -\ifx\makeMPintoPDFobject\undefined \chardef\makeMPintoPDFobject=0 \fi +\ifx\makeMPintoPDFobject\undefined \newcount\makeMPintoPDFobject \fi \def\lastPDFMPobject{0} @@ -2096,17 +2096,17 @@ \def\dopackageMPgraphic#1% #1 = boxregister {%\ifx\pdfxform\undefined - % \chardef\makeMPintoPDFobject0 % no pdftex at all + % \makeMPintoPDFobject0 % no pdftex at all %\else\ifx\pdftexversion\undefined - % \chardef\makeMPintoPDFobject0 % no pdftex at all + % \makeMPintoPDFobject0 % no pdftex at all %\else\ifnum\pdftexversion<14 - % \chardef\makeMPintoPDFobject0 % no resource support + % \makeMPintoPDFobject0 % no resource support %\else % % keep the default value %\fi\fi\fi \ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else % an existing value of 2 signals object support (set elsewhere) - \chardef\makeMPintoPDFobject1 + \makeMPintoPDFobject1 \fi\fi \ifcase\makeMPintoPDFobject \box#1% diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 2d3355b72..3989294e3 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -107,6 +107,11 @@ \def\!!plustwo {2} % alongside \plustwo \def\!!plusthree {3} % alongside \plusthree +\setnewconstant\uprotationangle 0 +\setnewconstant\rightrotatioangle 90 +\setnewconstant\downrotatioangle 180 +\setnewconstant\leftrotatioangle 270 + \ifdefined\data \else \let\data \relax \fi % dep checker %D \macros @@ -2236,8 +2241,8 @@ % idea: \ignorespaces afterwards -\chardef\noexpectedarguments=0 -\chardef\expectedarguments =0 +\setnewconstant\noexpectedarguments\zerocount +\setnewconstant\expectedarguments \zerocount \def\showargumenterror#1#2% {\writestatus{systems}{\number#1 argument(s) expected in line #2}} @@ -2753,8 +2758,8 @@ %D of the identification string with the macro \type %D {\statuswidth}. -\chardef\statuswidth=15 -\chardef\statuswrite=16 +\setnewconstant\statuswidth 15 +\setnewconstant\statuswrite 16 \ifdefined\writestring \else @@ -2935,7 +2940,7 @@ \dostarttexdefinition} \gdef\dostarttexdefinition #1 - {\catcode13=\@@ignore% + {\catcode13=\ignorecatcode% \doifinstringelse\letterhash{\detokenize{#1}}\dodostarttexdefinition\nonostarttexdefinition#1 } @@ -3139,8 +3144,7 @@ %D conditionals. The next implementation is abaou as fast %D and just as straightforward: -% \def\settrue #1{\chardef#1\zerocount} -% \def\setfalse#1{\chardef#1\plusone} +% maybe reserve special zero and plusone \def\settrue #1{\let#1\zerocount} \def\setfalse#1{\let#1\plusone} @@ -4434,7 +4438,7 @@ %D \starttyping %D \bgroup %D -%D \catcode`\*=\@@superscript +%D \catcode`\*=\superscriptcatcode %D %D \gdef\redorepeatwithcommand[#1]% %D {\redodorepeatwithcommand#1*\empty*\relax} @@ -4941,9 +4945,9 @@ %D \PtToCm{dimension} %D \stoptyping -{\catcode`\.=\@@other - \catcode`\p=\@@other - \catcode`\t=\@@other +{\catcode`\.=\othercatcode + \catcode`\p=\othercatcode + \catcode`\t=\othercatcode \gdef\WITHOUTPT#1pt{#1}} \def\withoutpt#1% @@ -4976,18 +4980,16 @@ \def\numberofpoints #1{\the\numexpr\dimexpr#1\relax/\maxcard\relax} %D \macros -%D {swapdimens,swapmacros} +%D {swapdimens,swapcounts,swapmacros} %D %D Simple but effective are the next two macros. There name %D exactly states their purpose. The \type{\scratchdimen} and %D \type{\!!stringa} can only be swapped when being the first %D argument. -\def\swapdimens#1#2% - {\scratchdimen #1\redoglobal #1#2\dodoglobal #2\scratchdimen} - -\def\swapmacros#1#2% - {\let\!!stringa#1\redoglobal\let#1#2\dodoglobal\let#2\!!stringa} +\def\swapdimens#1#2{\scratchdimen #1\redoglobal #1#2\dodoglobal #2\scratchdimen} +\def\swapcounts#1#2{\scratchcounter#1\redoglobal #1#2\dodoglobal #2\scratchcounter} +\def\swapmacros#1#2{\let\!!stringa #1\redoglobal\let#1#2\dodoglobal\let#2\!!stringa} %D \macros %D {pushmacro,popmacro} @@ -5619,8 +5621,8 @@ \def\untexsomething {\begingroup - \catcode`\{=\@@ignore - \catcode`\}=\@@ignore + \catcode`\{=\ignorecatcode + \catcode`\}=\ignorecatcode \escapechar\minusone \dountexsomething} @@ -6420,10 +6422,11 @@ %D %D This is a dirty one: we simply append a unit and discard it when needed. -\newdimen\roundingeps \roundingeps=10sp +\newdimen \roundingeps \roundingeps=10sp +\newconstant\compresult \def\comparedimension#1#2% - {\chardef\compresult + {\compresult \ifdim#1<#2% \zerocount \else\ifdim#1<#2% @@ -6433,7 +6436,7 @@ \fi\fi} \def\comparedimensioneps#1#2% todo: use eps feature - {\chardef\compresult + {\compresult \ifdim\dimexpr#1-#2\relax<\roudingeps \zerocount \else\ifdim\dimexpr#2-#1\relax<\roudingeps @@ -6479,7 +6482,7 @@ \def\unspaceargument#1\to#2% {\scratchcounter\catcode32\relax - \catcode32\@@ignore\scantextokens{\edef#2{#1}}% + \catcode32\ignorecatcode\scantextokens{\edef#2{#1}}% \catcode32\scratchcounter} \def\unspaceafter#1#2% @@ -6689,13 +6692,13 @@ \gdef\insideduplication {\ifmmode\expandafter^\else\expandafter\egroup\fi} -\catcode`\^=\@@active +\catcode`\^=\activecatcode \gdef\enableduplication - {\catcode`\^=\@@active \let^\checkduplication} + {\catcode`\^=\activecatcode \let^\checkduplication} \gdef\disableduplication - {\catcode`\^=\@@superscript} + {\catcode`\^=\superscriptcatcode} \gdef\startduplication {\bgroup \duplicatetrue \let^\insideduplication} diff --git a/tex/context/base/syst-ini.tex b/tex/context/base/syst-ini.tex index 7c9d72127..d4b024c30 100644 --- a/tex/context/base/syst-ini.tex +++ b/tex/context/base/syst-ini.tex @@ -50,7 +50,7 @@ %....... %catcode`\z = 11 -\chardef\active = 13 +\chardef\activecatcode = 13 % later this will become a counter \def ^^L{\par} \def\^^M{\ } % control <return> = control <space> @@ -94,29 +94,27 @@ \ifnum\texengine=\luatexengine \directlua 0 { % this info is stored in the format - if lua.name then - lua.name[0] = "main ctx instance" + lua.name[0] = "main ctx instance" + local extraprimitives = tex.extraprimitives + local enableprimitives = tex.enableprimitives + local core = extraprimitives('core') + local btex = extraprimitives('tex') + local etex = extraprimitives('etex') + local pdftex = extraprimitives('pdftex') + local luatex = extraprimitives('luatex') + local omega = { + "textdir", "pagedir", "mathdir", "pardir", "bodydir", + "leftghost", "rightghost", "localleftbox", "localrightbox", + "localinterlinepenalty", "localbrokenpenalty", + } + local aleph = { + "boxdir", "pagebottomoffset", "pagerightoffset", + } + for _, subset in next, { etex, pdftex, luatex, omega, aleph } do + enableprimitives('',subset) end - if tex.extraprimitives then - local core = tex.extraprimitives('core') - local btex = tex.extraprimitives('tex') - local etex = tex.extraprimitives('etex') - local pdftex = tex.extraprimitives('pdftex') - local luatex = tex.extraprimitives('luatex') - local omega = { - "textdir", "pagedir", "mathdir", "pardir", "bodydir", - "leftghost", "rightghost", "localleftbox", "localrightbox", - "localinterlinepenalty", "localbrokenpenalty", - } - local aleph = { - "boxdir", "pagebottomoffset", "pagerightoffset", - } - for _, subset in pairs { etex, pdftex, luatex, omega, aleph } do - tex.enableprimitives('',subset) - end - for _, subset in pairs { core, btex, etex, pdftex, luatex, omega, aleph } do - tex.enableprimitives('normal',subset) - end + for _, subset in next, { core, btex, etex, pdftex, luatex, omega, aleph } do + enableprimitives('normal',subset) end } \fi @@ -157,6 +155,12 @@ %D %D We reserve some registers for special (management) purposes: +% 0 - 20 : scratch +% 21 - 127 : internal +% 128 - 254 : inserts +% 255 : page +% 256 - : user + \countdef \minallocatedregister = 52 \minallocatedregister = 256 \countdef \maxallocatedregister = 53 \maxallocatedregister = 32767 \countdef \minallocatediochannel = 54 \minallocatediochannel = -1 @@ -177,22 +181,28 @@ \countdef \lastallocatedread = 38 \lastallocatedread = \minallocatediochannel \countdef \lastallocatedwrite = 39 \lastallocatedwrite = \minallocatediochannel \countdef \lastallocatedmarks = 40 \lastallocatedmarks = \minallocatedregister -\countdef \lastallocatedlanguage = 41 \lastallocatedlanguage = \minallocatedlanguage +\countdef \lastallocatedlanguage = 41 \lastallocatedlanguage = \minallocatedlanguage % not used in context \countdef \lastallocatedinsertion = 42 \lastallocatedinsertion = \minallocatedinsert -\countdef \lastallocatedfamily = 43 \lastallocatedfamily = \minallocatedfamily +\countdef \lastallocatedfamily = 43 \lastallocatedfamily = \minallocatedfamily % not used in context \countdef \lastallocatedattribute = 44 \lastallocatedattribute = \minallocatedregister \countdef \mincountervalue = 125 \mincountervalue = -"7FFFFFFF % beware, we use index 125 at the lua end \countdef \maxcountervalue = 126 \maxcountervalue = "7FFFFFFF % beware, we use index 126 at the lua end -\countdef \minusone = 127 \minusone = -1 -\chardef \zerocount = 0 -\chardef \plusone = 1 -\chardef \normalpagebox = 255 % hardcoded in the engine +%countdef \minusone = 127 \minusone = -1 +%chardef \zerocount = 0 +%chardef \plusone = 1 + +\countdef \zerocount = 120 \zerocount = 0 +\countdef \plusone = 121 \plusone = 1 +\countdef \minusone = 122 \minusone = -1 + +%chardef \normalpagebox = 255 +\countdef \normalpagebox = 127 \normalpagebox = 255 % hardcoded in pdftex/xetex % A few traditional allocations: -\countdef \count@ = 255 % hm, used in \newif +\countdef \count@ = 255 % hm, used in \newif .. todo: replace it there \dimendef \dimen@ = 0 \dimendef \dimen@i = 1 % global only \dimendef \dimen@ii = 2 @@ -216,12 +226,23 @@ \def\newread {\allocateregister\lastallocatedread \read \chardef \maxallocatediochannel} \def\newwrite {\allocateregister\lastallocatedwrite \write \chardef \maxallocatediochannel} \def\newmarks {\allocateregister\lastallocatedmarks \marks \mathchardef\maxallocatedregister} -\def\newlanguage{\allocateregister\lastallocatedlanguage \language\chardef \maxallocatedlanguage} \def\newinsert {\allocateregister\lastallocatedinsertion\insert \chardef \maxallocatedinsert} + +%D We don't need these in \CONTEXT: + +\def\newlanguage{\allocateregister\lastallocatedlanguage \language\chardef \maxallocatedlanguage} \def\newfamily {\allocateregister\lastallocatedfamily \fam \chardef \maxallocatedfamily} \let\newfam\newfamily +% watch out, for the moment we disable the check for already being defined +% later we will revert this but first all chardefs must be replaced + +\def\newconstant #1{\ifdefined#1\let#1\undefined\fi\newcount#1} +\def\setnewconstant#1{\ifdefined#1\let#1\undefined\fi\newcount#1#1} % just a number + +% matbe setconstant with check + % %D The next definitions are really needed (in \CONTEXT): %newlinechar=10 \def\outputnewlinechar{\rawcharacter{10}} @@ -318,7 +339,7 @@ \newtoks \emptytoks -%D And even more: +%D And even more: (todo: countdefs 60+) %newcount \minusone \minusone = -1 \newcount \minustwo \minustwo = -2 @@ -424,7 +445,8 @@ %D characters. Because we are not that good at remembering numbers, %D we introduce some symbolic names. -%D As we now have catc-* files, we also have more readable names +%D As we now have catc-* files, we also have more readable names but +%D We will keep the following around for a while. \chardef\@@escape = 0 \chardef\@@begingroup = 1 @@ -438,8 +460,8 @@ \chardef\@@ignore = 9 \chardef\@@space = 10 \chardef\@@letter = 11 -\chardef\@@other = 12 \chardef\other = 12 -\chardef\@@active = 13 \chardef\active = 13 +\chardef\@@other = 12 +\chardef\@@active = 13 \chardef\@@comment = 14 %D Constants to be used with \type {\currentgrouptype}. @@ -634,13 +656,13 @@ %D change. \bgroup - \catcode`\^^M=\active% - \gdef\obeylines{\catcode`\^^M\active \let^^M\par}% + \catcode`\^^M=\activecatcode% + \gdef\obeylines{\catcode`\^^M\activecatcode \let^^M\par}% \global\let^^M\par% \egroup \bgroup - \gdef\obeyspaces{\catcode`\ \active}% + \gdef\obeyspaces{\catcode`\ \activecatcode}% \obeyspaces\global\let =\space% \egroup diff --git a/tex/context/base/syst-mes.mkiv b/tex/context/base/syst-mes.mkiv index 586d8bb8c..af792aba9 100644 --- a/tex/context/base/syst-mes.mkiv +++ b/tex/context/base/syst-mes.mkiv @@ -11,8 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\chardef\statuswidth=15 -\chardef\statuswrite=16 +\setnewconstant\statuswidth 15 +\setnewconstant\statuswrite 16 \newtoks\everywritestring diff --git a/tex/context/base/tabl-ltb.mkiv b/tex/context/base/tabl-ltb.mkiv index 34d93e5a9..66d3c0265 100644 --- a/tex/context/base/tabl-ltb.mkiv +++ b/tex/context/base/tabl-ltb.mkiv @@ -59,8 +59,9 @@ \unprotect -\chardef\linetablesplitstate\zerocount -\chardef\linetableheadstate \zerocount +\newconstant\linetablesplitstate +\newconstant\linetableheadstate +\newconstant\linetablemode \edef\??ler{\??le:r:} \edef\??lec{\??le:c:} @@ -89,9 +90,9 @@ \initializetablebox \zerocount % holds repeater -\chardef\linetablehmode \zerocount -\chardef\linetablepage \zerocount -\chardef\linetablerepeat\zerocount +\newconstant\linetablehmode +\newconstant\linetablepage +\newconstant\linetablerepeat \unexpanded\def\setuplinetable {\dotripleempty\dosetuplinetable} @@ -206,7 +207,7 @@ }% \global\linetablecolumn\scratchcounter \fi - \chardef\linetablemode + \linetablemode \iflinetablepreroll \ifdim\scratchdimen>\zeropoint \zerocount \else \plustwo \fi \else @@ -218,7 +219,7 @@ \or % fit, keep it simple \or - \chardef\linetablemode\plusone % line + \linetablemode\plusone % line \else % some already calculated height \fi @@ -375,14 +376,14 @@ \else % after, later \fi - \chardef\linetableheadstate\plusthree + \linetableheadstate\plusthree \global\setbox\tablebox\zerocount\emptybox % here \fi % reset \linetablerow will be an option, currently % starts at zero after split \globallet\linetablerow\!!zerocount \globallet\linetableline\!!zerocount - \global\chardef\linetablepage\zerocount + \global\linetablepage\zerocount \global\linetablewidth\zeropoint \setnoftableslines \fi} @@ -448,9 +449,9 @@ \savelinetablepart \fi \ifcase\linetablepage \or - \global\chardef\linetablepage \plustwo + \global\linetablepage \plustwo \else - \global\chardef\linetablepage \plusone + \global\linetablepage \plusone \fi \doglobal\increment\linetablepart \global\linetablewidth\wd\tablebox\zerocount @@ -482,9 +483,9 @@ \stoplinetablepart \savelinetablepart \ifcase\linetablepage \or - \global\chardef\linetablepage \plustwo + \global\linetablepage \plustwo \else - \global\chardef\linetablepage \plusone + \global\linetablepage \plusone \fi \doglobal\increment\linetablepart \ifnum\linetablepart>\noflinetableparts @@ -524,8 +525,8 @@ [\linetableparameter\c!stretch] [ \v!no=>{\setuplinetable[\c!stretch=\maxdimen]},% no stretch \v!yes=>{\setuplinetable[\c!stretch=\zeropoint]}]% max stretch - \chardef\linetablerepeat\linetableparameter\c!nleft - \chardef\linetablesplitstate % = + \linetablerepeat\linetableparameter\c!nleft + \linetablesplitstate % = \ifdim\linetableparameter\c!maxwidth>\zeropoint \zerocount \else \plusone \fi @@ -573,7 +574,7 @@ \unexpanded\def\stoplinetablerun {\globallet\linetableline\!!maxcard - \chardef\linetableheadstate\zerocount % blocked + \linetableheadstate\zerocount % blocked \flushlinetableparts \iflinetablepreroll \else \linetableparameter\c!after @@ -649,7 +650,7 @@ % \else\ifx\linetableheight\v!fit % % keep it simple % \else\ifx\linetableheight\v!line -% \chardef\linetablemode\plusone +% \linetablemode\plusone % \else % \!!heighta\linetableheight % \advance\!!heighta-\strutdepth @@ -658,11 +659,11 @@ \linetableheight\zeropoint \edef\!!stringa{\linetablerparameter\c!height}% \ifx\!!stringa\empty - \chardef\linetablehmode\zerocount + \linetablehmode\zerocount \else\ifx\!!stringa\v!fit - \chardef\linetablehmode\plusone + \linetablehmode\plusone \else\ifx\!!stringa\v!line - \chardef\linetablehmode\plustwo + \linetablehmode\plustwo \else \linetableheight\!!stringa \advance\linetableheight-\strutdepth @@ -703,10 +704,10 @@ \flushlinetablehead} \def\checklinetablepage - {\global\chardef\linetablepage\zerocount + {\global\linetablepage\zerocount \ifcase\linetablerepeat \else \ifcase\linetablepage \doif{\linetableparameter\c!repeat}\v!no - {\global\chardef\linetablepage\doifoddpageelse\plusone\plustwo}% + {\global\linetablepage\doifoddpageelse\plusone\plustwo}% \fi \fi} \def\flushlinetablehead @@ -718,9 +719,9 @@ % 2 head done \or % 3 trigger flush - \chardef\linetableheadstate\plusone + \linetableheadstate\plusone \the\@@linetablehead\relax - \chardef\linetableheadstate\plustwo + \linetableheadstate\plustwo \fi} \def\linetableNC % first time special treatment @@ -771,7 +772,7 @@ {\ifinlinetable \@@linetablehead\emptytoks \fi - \chardef\linetableheadstate3 % full + \linetableheadstate\plusthree % full \@@linetablehead{#1}% \ifinlinetable \flushlinetablehead diff --git a/tex/context/base/tabl-ntb.mkiv b/tex/context/base/tabl-ntb.mkiv index 79835d92e..80e1ff20d 100644 --- a/tex/context/base/tabl-ntb.mkiv +++ b/tex/context/base/tabl-ntb.mkiv @@ -667,7 +667,7 @@ \let\pushTBL\relax \let\popTBL \relax -\chardef\tblpass=0 +\newconstant\tblpass \def\presetallTABLEparameters% each odd|even level / can be sped up but only once per table {\executeifdefined{\@@rawtblprefix\v!start\v!each}\relax @@ -959,7 +959,7 @@ {\global\tblspn\zerocount \global\tblrow\zerocount \global\tblcol\zerocount - \chardef\tblpass\zerocount + \tblpass\zerocount \tbltoks\emptytoks} \def\flushtbltoks{\begintbl\the\tbltoks\endtbl} @@ -1060,7 +1060,7 @@ \lettbldis\recurselevel\zeropoint}% \dorecurse\maximumrow {\lettblhei\recurselevel\maxdimen}% - \chardef\tblpass\plusone + \tblpass\plusone \let\makeTBL\domakeTBLone \let\handleTBLcell\dohandleTBLcellA \setbox0\vbox{\settrialtypesetting \flushtbltoks}% @@ -1092,13 +1092,13 @@ \setbox\scratchbox\vbox{\settrialtypesetting \flushtbltoks}% \fi\fi\fi\fi \let\handleTBLcell\dohandleTBLcellD - \chardef\tblpass\plustwo + \tblpass\plustwo \let\makeTBL\domakeTBLtwo \setbox\scratchbox\vbox{\settrialtypesetting \flushtbltoks}% \checktblheightsone \checktblheightstwo \let\handleTBLcell\dohandleTBLcellE - \chardef\tblpass\plusthree + \tblpass\plusthree \let\makeTBL\domakeTBLthree \ifnum\TBLlevel>\plusone \@EA\notsplittblbox @@ -1617,8 +1617,6 @@ \appendtoks\let\TB\TableTB \to\everytable \appendtoks\let\TB\TabulateTB\to\everytabulate % strange place -\appendtoks \chardef\recodeverbatimmode\plustwo \to \everytable - % new (for Olivier Turlier) % % \defineTABLEsetup [xx] [foregroundcolor=red] diff --git a/tex/context/base/tabl-tab.mkiv b/tex/context/base/tabl-tab.mkiv index d926dab98..01b483a7e 100644 --- a/tex/context/base/tabl-tab.mkiv +++ b/tex/context/base/tabl-tab.mkiv @@ -326,39 +326,49 @@ %D implemented by keeping track of the state, often the last %D command on a row. -\chardef\TABLEunknown = 0 - -\chardef\TABLEseparaterow = 1 -\chardef\TABLEfirstrow = 2 -\chardef\TABLEmidrow = 3 -\chardef\TABLElastrow = 4 -\chardef\TABLErule = 5 -\chardef\TABLEskip = 6 -\chardef\TABLEautorow = 7 - -\chardef\TABLEforcefirstrow = 1 -\chardef\TABLEforcelastrow = 2 - -\chardef\TABLEmissingrow = 1 -\chardef\TABLEmissingcolumn = 2 -\chardef\TABLEspanoverflow = 3 -\chardef\TABLEdivisionoverflow = 4 - -%D We store these states using efficient \type {\chardef}'s. -%D Like most variables, these are global ones. When needed, +\setnewconstant\TABLEunknown 0 + +\setnewconstant\TABLEseparaterow 1 +\setnewconstant\TABLEfirstrow 2 +\setnewconstant\TABLEmidrow 3 +\setnewconstant\TABLElastrow 4 +\setnewconstant\TABLErule 5 +\setnewconstant\TABLEskip 6 +\setnewconstant\TABLEautorow 7 + +\setnewconstant\TABLEforcefirstrow 1 +\setnewconstant\TABLEforcelastrow 2 + +\setnewconstant\TABLEmissingrow 1 +\setnewconstant\TABLEmissingcolumn 2 +\setnewconstant\TABLEspanoverflow 3 +\setnewconstant\TABLEdivisionoverflow 4 + +\newconstant\TABLErowfactor +\newconstant\TABLEendofrowdepth +\newconstant\TABLEendofrowheight +\newconstant\TABLEcr +\newconstant\TABLErowzero +\newconstant\TABLEn +\newconstant\TABLEerror +\newconstant\TABLEforce +\newconstant\TABLEaction + +%D We store these states using \type {constants}'s and +%D like most variables, these are global ones. When needed, %D especially when we flush the backgrounds, we can temporary %D disable the assignment. \newif\ifsetTABLEaction \def\setTABLEaction#1% - {\ifsetTABLEaction\global\chardef\TABLEaction#1\fi} + {\ifsetTABLEaction\global\TABLEaction#1\fi} \def\setTABLEforce#1% - {\ifsetTABLEaction\global\chardef\TABLEforce#1\fi} + {\ifsetTABLEaction\global\TABLEforce#1\fi} \def\setTABLEerror#1% - {\global\chardef\TABLEerror#1} + {\global\TABLEerror#1} %D Before we come to using these variables, we redefine and/or %D adapt some \TABLE\ macros. Within \TABLE's the \type{|} and @@ -372,13 +382,13 @@ % \bgroup -% \catcode`\|=\@@active -% \catcode`\"=\@@active +% \catcode`\|=\activecatcode +% \catcode`\"=\activecatcode % % \gdef\pushouterbarandquote % {\ifForgetTableBarAndQuote -% \ifnum\catcode`\|=\@@active \let\outertablebar |\else\let\outertablebar \relax\fi -% \ifnum\catcode`\"=\@@active \let\outertablequote"\else\let\outertablequote\relax\fi +% \ifnum\catcode`\|=\activecatcode \let\outertablebar |\else\let\outertablebar \relax\fi +% \ifnum\catcode`\"=\activecatcode \let\outertablequote"\else\let\outertablequote\relax\fi % \let|\letterbar % \let"\letterdoublequote % \fi} @@ -1020,7 +1030,7 @@ {\bgroup % kan-ie weg? \global\intabletrue \pushouterbarandquote - %catcode`\|=\@@other + %catcode`\|=\othercatcode \complexorsimple\secondstagestartTABLE} \def\simplesecondstagestartTABLE#1% @@ -1047,7 +1057,7 @@ \unexpanded\def\definetabletemplate % to be redone {\bgroup - \catcode`\|=\@@other + \catcode`\|=\othercatcode \doquadrupleempty\dodefinetabletemplate} \def\dodefinetabletemplate[#1][#2][#3][#4]% @@ -1120,7 +1130,7 @@ \fi \fi \TABLEnoalign{\globalpopmacro\simpleTableHL}} -\bgroup \catcode`|=\@@other \catcode`"=\@@other +\bgroup \catcode`|=\othercatcode \catcode`"=\othercatcode \gdef\complexsecondstagestartTABLE#1[#2]% brr nested mess {\bgroup @@ -1439,7 +1449,7 @@ %D handles alignments, we cannot automate spacing for colored %D rows and columns. -\chardef\TABLErowzero=0 +\setnewconstant\TABLErowzero\zerocount \def\checkTABLErow#1% pure for message purposes {\unskip % added @@ -1651,13 +1661,13 @@ %D \TABLE\ changes the catcode when needed.} \bgroup - \catcode`\|=\@@other \gdef\@@otherbar {|} - \catcode`\"=\@@other \gdef\@@otherquote {"} - \catcode`\|=\@@active \gdef\@@useotherbar {\let|\@@otherbar} - \catcode`\"=\@@active \gdef\@@useotherquote{\let"\@@otherquote} + \catcode`\|=\othercatcode \gdef\@@otherbar {|} + \catcode`\"=\othercatcode \gdef\@@otherquote {"} + \catcode`\|=\activecatcode \gdef\@@useotherbar {\let|\@@otherbar} + \catcode`\"=\activecatcode \gdef\@@useotherquote{\let"\@@otherquote} \egroup -\bgroup \catcode`\|=\@@other +\bgroup \catcode`\|=\othercatcode \gdef\getTABLEnofcolumns#1% {\bgroup @@ -1913,8 +1923,8 @@ \fi} % \bgroup -% \catcode`\|=\@@active -% \catcode`\"=\@@active +% \catcode`\|=\activecatcode +% \catcode`\"=\activecatcode % \gdef\redefinetablebarandquote % {\def|{\VL}% % \normalTABLEsimplebar % \def\|##1{\VL[##1]}% % \normalTABLEcomplexbar @@ -2057,8 +2067,8 @@ \globallet\lastTABLEc\@@tibackgroundcolor \globallet\lastTABLEr\@@tibackgroundscreen \doifinsetelse\@@tibackground{c,color} % \v!color - {\global\chardef\TABLEcr\plusone} - {\global\chardef\TABLEcr\plustwo}} + {\global\TABLEcr\plusone} + {\global\TABLEcr\plustwo}} \def\TableBC {\ifTABLEgrayline @@ -2111,13 +2121,13 @@ {\dodoanalyzeTABLEcr[1,#1,#2]}} \def\dodoanalyzeTABLEcr[#1,#2,#3]% - {\global\chardef\TABLEn#1\relax + {\global\TABLEn#1\relax \processaction [#2] - [ c=>\global\chardef\TABLEcr1,% - color=>\global\chardef\TABLEcr1,% - r=>\global\chardef\TABLEcr2,% - raster=>\global\chardef\TABLEcr2]% + [ c=>\global\TABLEcr\plusone,% + color=>\global\TABLEcr\plusone,% + r=>\global\TABLEcr\plustwo,% + raster=>\global\TABLEcr\plustwo]% \ifcase\TABLEcr \or \doifsomething{#3}{\xdef\lastTABLEc{#3}}% \or @@ -2322,28 +2332,28 @@ \def\endTABLEgrayrow#1#2#3% {\ifcase#1\relax - \global\chardef\TABLEendofrowheight\TABLErowfactor - \global\chardef\TABLEendofrowdepth \TABLErowfactor + \global\TABLEendofrowheight\TABLErowfactor + \global\TABLEendofrowdepth \TABLErowfactor \or - \global\chardef\TABLEendofrowheight\TABLErowfactor - \global\chardef\TABLEendofrowdepth \TABLErowfactor + \global\TABLEendofrowheight\TABLErowfactor + \global\TABLEendofrowdepth \TABLErowfactor \or - \global\chardef\TABLEendofrowheight\TABLErowfactor - \global\chardef\TABLEendofrowdepth \TABLErowzero + \global\TABLEendofrowheight\TABLErowfactor + \global\TABLEendofrowdepth \TABLErowzero \or \ifnum\TABLEforce=\TABLEforcelastrow - \global\chardef\TABLEendofrowheight\TABLErowzero - \global\chardef\TABLEendofrowdepth \TABLErowfactor + \global\TABLEendofrowheight\TABLErowzero + \global\TABLEendofrowdepth \TABLErowfactor \else\ifnum\TABLEforce=\TABLEforcefirstrow - \global\chardef\TABLEendofrowheight\TABLErowfactor - \global\chardef\TABLEendofrowdepth \TABLErowzero + \global\TABLEendofrowheight\TABLErowfactor + \global\TABLEendofrowdepth \TABLErowzero \else - \global\chardef\TABLEendofrowheight\TABLErowzero - \global\chardef\TABLEendofrowdepth \TABLErowzero + \global\TABLEendofrowheight\TABLErowzero + \global\TABLEendofrowdepth \TABLErowzero \fi\fi \or - \global\chardef\TABLEendofrowheight\TABLErowzero - \global\chardef\TABLEendofrowdepth \TABLErowfactor + \global\TABLEendofrowheight\TABLErowzero + \global\TABLEendofrowdepth \TABLErowfactor \fi} \unexpanded\def\defineTABLEshorthands% @@ -2363,8 +2373,8 @@ \v!medium=>\OpenUp11\def\LOW{\Lower7 }, \v!big=>\OpenUp22\def\LOW{\Lower8 }]% \doifelse\@@tidistance\v!none - {\chardef\TABLErowfactor\zerocount} - {\chardef\TABLErowfactor\plustwo }} + {\TABLErowfactor\zerocount} + {\TABLErowfactor\plustwo }} \def\dohandlebar % here ? {\ifmmode diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv index 6af82c740..656c56bfd 100644 --- a/tex/context/base/tabl-tbl.mkiv +++ b/tex/context/base/tabl-tbl.mkiv @@ -550,7 +550,7 @@ \def\tabulatesetpreamblewidthsimple {\dodosettabulatepreamble\xbskip\xeskip} -\bgroup \catcode`\|=\@@other +\bgroup \catcode`\|=\othercatcode \gdef\nexttabulate#1|% {\let\tabulatealign\@@tabulatealign @@ -680,7 +680,7 @@ % \starttabulate[preamble] % \starttabulate -> \starttabulate[|l|p|] -\bgroup \catcode`\|=\@@other +\bgroup \catcode`\|=\othercatcode \gdef\definetabulate {\dotripleempty\dodefinetabulate} @@ -803,18 +803,17 @@ % An example of its usage: -\appendtoks \optimizeverbatimfalse \to \everytabulate -\appendtoks \let\recodeverbatimmode\plustwo \to \everytabulate +\appendtoks \optimizeverbatimfalse \to \everytabulate % A status variable: -\chardef\tabulatepass=0 +\newconstant\tabulatepass \def\tabulateparameter#1{\csname\??tt\currenttabulate#1\endcsname} \bgroup - \catcode`\|=\@@other \gdef\@@otherbar{|} - \catcode`\|=\@@active \gdef\@@useotherbar{\let|\@@otherbar} + \catcode`\|=\othercatcode \gdef\@@otherbar{|} + \catcode`\|=\activecatcode \gdef\@@useotherbar{\let|\@@otherbar} \egroup \def\doparsetabulate @@ -872,7 +871,7 @@ \doifvaluesomething{\??tt\currenttabulate\c!bodyfont} {\expanded{\switchtobodyfont[\tabulateparameter\c!bodyfont]}}% \postponenotes % new, to be tested / will be configurable - \let\tabulatepass\plusone + \tabulatepass\plusone \widowpenalty\zerocount % otherwise lines are not broken \clubpenalty \zerocount % but overlap in funny ways \the\everytabulate @@ -890,7 +889,7 @@ \tabulatecontent {\@EA\processtabulate\@EA[\the\!!toksb]}} -\chardef\tabulatetype=0 +\newconstant\tabulatetype % 0 = NC column next EQ equal column % 1 = RC column raw RQ equal column raw @@ -903,19 +902,19 @@ \global\tabulateequalfalse} % \def\tabulatenormalcolumn#1% -% {&\iftabulateequal\tabulateEQ\fi&\global\chardef\tabulatetype#1&} +% {&\iftabulateequal\tabulateEQ\fi&\global\tabulatetype#1&} % % \def\tabulateequalcolumn#1% -% {&\tabulateEQ&\global\chardef\tabulatetype#1&} +% {&\tabulateEQ&\global\tabulatetype#1&} % % however, \unskip en \ignorespaces permit usage in complex XML/\starttabulate \def\tabulatenormalcolumn#1% - {\unskip&\iftabulateequal\tabulateEQ\fi&\global\chardef\tabulatetype#1&% + {\unskip&\iftabulateequal\tabulateEQ\fi&\global\tabulatetype#1&% \ignorespaces} \def\tabulateequalcolumn#1% - {\unskip&\tabulateEQ&\global\chardef\tabulatetype#1&% + {\unskip&\tabulateEQ&\global\tabulatetype#1&% \ignorespaces} \def\tabulateautocolumn @@ -1023,8 +1022,7 @@ %D cum suis, since \TEX's hard coded noalign lookahead fails %D on it! I mistakenly added this for a while. -\chardef\tabulaterepeathead\zerocount - +\newcount\tabulaterepeathead \newcount\noftabulatelines \newcount\totalnoftabulatelines \newcount\minusnoftabulatelines @@ -1255,7 +1253,7 @@ \newtoks\everytabulatepar -\bgroup \catcode`\|=\@@other +\bgroup \catcode`\|=\othercatcode \gdef\processtabulate[|#1|]% in the process of optimizing {\tabulateunit\tabulateparameter\c!unit @@ -1282,7 +1280,7 @@ \donetrue \fi\fi \ifdone - \chardef\tabulaterepeathead\executeifdefined{\??tt:\c!header:\tabulateparameter\c!header}\zerocount + \tabulaterepeathead\executeifdefined{\??tt:\c!header:\tabulateparameter\c!header}\zerocount \fi \let\NC\tabulateNCone \let\RC\tabulateRCone @@ -1372,7 +1370,7 @@ \let\FL\tabulateFLfive \let\ML\tabulateMLfive \let\LL\tabulateLLfive - \let\tabulatepass\plustwo + \tabulatepass\plustwo % \ifcase\tabulaterepeathead \ifinsidesplitfloat diff --git a/tex/context/base/tabl-tsp.mkiv b/tex/context/base/tabl-tsp.mkiv index 9ceb3af6e..4471147ff 100644 --- a/tex/context/base/tabl-tsp.mkiv +++ b/tex/context/base/tabl-tsp.mkiv @@ -113,7 +113,7 @@ {\forgetall \dontcomplain \global\settrue\splitfloatdone - \chardef\nodelocationmode\zerocount % bypass auto-renumbering + \nodelocationmode\zerocount % bypass auto-renumbering \incrementnumber[\??si]% \ifcase\rawnumber[\??si]\or \ifconditional\onlyonesplitofffloat \let\floatcaptionsuffix\empty @@ -161,7 +161,7 @@ {\doif\extrasplitfloatlines\v!auto {\bgroup \settrue\retainfloatnumber - \chardef\nodelocationmode\zerocount + \nodelocationmode\zerocount \forcelocalfloats \setuplocalfloats[\c!before=,\c!after=,\c!inbetween=]% \splitfloatcommand{\hbox to \wd#1{\strut}}% dummy line diff --git a/tex/context/base/trac-vis.mkiv b/tex/context/base/trac-vis.mkiv index 6b0fdba94..2056dc635 100644 --- a/tex/context/base/trac-vis.mkiv +++ b/tex/context/base/trac-vis.mkiv @@ -261,11 +261,11 @@ \newdimen\tractempheight \newdimen\tractempdepth -\def\cutmarklength {2\bodyfontsize} +\def \cutmarklength {2\bodyfontsize} -\chardef\horizontalcutmarks = 2 -\chardef\verticalcutmarks = 2 -\chardef\cutmarkoffset = 1 +\newcount\horizontalcutmarks \horizontalcutmarks = 2 +\newcount\verticalcutmarks \verticalcutmarks = 2 +\newcount\cutmarkoffset \cutmarkoffset = 1 \let\cutmarksymbol = \relax \let\cutmarktoptext = \empty diff --git a/tex/context/base/type-ini.mkiv b/tex/context/base/type-ini.mkiv index 8fb2c077a..0d7e0b137 100644 --- a/tex/context/base/type-ini.mkiv +++ b/tex/context/base/type-ini.mkiv @@ -90,6 +90,8 @@ \newtoks\documenttypescripts +% tricky ... here we push/pop + \chardef\typescriptmethod\plusone % 1: empty==all==true 2: empty==false \chardef\typescriptstate \plustwo % 1: process 2: store diff --git a/tex/context/base/typo-brk.mkiv b/tex/context/base/typo-brk.mkiv index bfb79a126..8be00fd8a 100644 --- a/tex/context/base/typo-brk.mkiv +++ b/tex/context/base/typo-brk.mkiv @@ -17,7 +17,7 @@ \registerctxluafile{typo-brk}{1.001} -\definesystemattribute[breakpoint] \chardef\breakpointattribute \dogetattributeid{breakpoint} +\definesystemattribute[breakpoint][public] % compound stuff (under construction) diff --git a/tex/context/base/typo-cap.mkiv b/tex/context/base/typo-cap.mkiv index a7f59f10f..749f9fcbd 100644 --- a/tex/context/base/typo-cap.mkiv +++ b/tex/context/base/typo-cap.mkiv @@ -17,7 +17,7 @@ \registerctxluafile{typo-cap}{1.001} -\definesystemattribute[case] \chardef\caseattribute \dogetattributeid{case} +\definesystemattribute[case][public] %D \macros %D {Word, Words, WORD, WORDS} diff --git a/tex/context/base/typo-dig.mkiv b/tex/context/base/typo-dig.mkiv index 365afebce..6e0299291 100644 --- a/tex/context/base/typo-dig.mkiv +++ b/tex/context/base/typo-dig.mkiv @@ -17,7 +17,7 @@ \registerctxluafile{typo-dig}{1.001} -\definesystemattribute[digits] \chardef\digitsattribute \dogetattributeid{digits} +\definesystemattribute[digits][public] %D This could as well be a dynamic font feature but why bother. %D diff --git a/tex/context/base/typo-dir.mkiv b/tex/context/base/typo-dir.mkiv index ec071d0a1..5487e7979 100644 --- a/tex/context/base/typo-dir.mkiv +++ b/tex/context/base/typo-dir.mkiv @@ -17,7 +17,7 @@ \registerctxluafile{typo-dir}{1.001} -\definesystemattribute[directions] \chardef\directionsattribute \dogetattributeid{directions} +\definesystemattribute[directions][public] % experimental directions @@ -34,7 +34,7 @@ {\getparameters[\??di][#1]% \the\everysetupdirections} -\chardef\directionsbidimode=0 +\newconstant\directionsbidimode \letvalue{\??di:bidi:\v!off }\zerocount \letvalue{\??di:bidi:\v!global}\plusone @@ -42,7 +42,7 @@ \letvalue{\??di:bidi:\v!on }\plustwo \appendtoks - \chardef\directionsbidimode\executeifdefined{\??di:bidi:\@@dibidi}\zerocount\relax + \directionsbidimode\executeifdefined{\??di:bidi:\@@dibidi}\zerocount\relax \ifcase\directionsbidimode \resetdirection \or diff --git a/tex/context/base/typo-krn.mkiv b/tex/context/base/typo-krn.mkiv index 7bb3a10a7..bb4a48a5d 100644 --- a/tex/context/base/typo-krn.mkiv +++ b/tex/context/base/typo-krn.mkiv @@ -17,7 +17,7 @@ \registerctxluafile{typo-krn}{1.001} -\definesystemattribute[kern] \chardef\kernattribute\dogetattributeid{kern} +\definesystemattribute[kern][public] % more % diff --git a/tex/context/base/typo-rep.mkiv b/tex/context/base/typo-rep.mkiv index 123ab8830..89999c3c7 100644 --- a/tex/context/base/typo-rep.mkiv +++ b/tex/context/base/typo-rep.mkiv @@ -35,7 +35,7 @@ \registerctxluafile{typo-rep}{1.001} -\definesystemattribute[stripping] \chardef\strippingattribute \dogetattributeid{stripping} +\definesystemattribute[stripping][public] \def\setcharacterstripping {\ctxlua{nodes.stripping.enable()}% diff --git a/tex/context/base/typo-spa.mkiv b/tex/context/base/typo-spa.mkiv index 2f6aaf43b..7a72e95ad 100644 --- a/tex/context/base/typo-spa.mkiv +++ b/tex/context/base/typo-spa.mkiv @@ -17,7 +17,7 @@ \registerctxluafile{typo-spa}{1.001} -\definesystemattribute[spacing] \chardef\spacingattribute \dogetattributeid{spacing} +\definesystemattribute[spacing][public] % experimental spacing % diff --git a/tex/context/base/unic-004.mkii b/tex/context/base/unic-004.mkii index b6e210193..67ce87728 100644 --- a/tex/context/base/unic-004.mkii +++ b/tex/context/base/unic-004.mkii @@ -284,8 +284,8 @@ % Мама и Папа % Some russian characters % \stopbuffer % -% \chardef\utfunicodetracer=0 \blank \getbuffer \blank -% \chardef\utfunicodetracer=2 \blank \getbuffer \blank -% \chardef\utfunicodetracer=7 \blank \getbuffer \blank +% \utfunicodetracer=0 \blank \getbuffer \blank +% \utfunicodetracer=2 \blank \getbuffer \blank +% \utfunicodetracer=7 \blank \getbuffer \blank % % \stoptext diff --git a/tex/context/base/unic-ini.mkii b/tex/context/base/unic-ini.mkii index f386494f2..3e4c574f3 100644 --- a/tex/context/base/unic-ini.mkii +++ b/tex/context/base/unic-ini.mkii @@ -276,10 +276,10 @@ %D By default, the converter produces a character representation, %D but for tracing purposes, you can set a trace option. -\chardef\utfunicodetracer=0 +\newconstant\utfunicodetracer %D \def\TraceUnic#1% -%D {\chardef\utfunicodetracer#1\relax\enableregime[utf]Ű} +%D {\utfunicodetracer#1\relax\enableregime[utf]Ű} %D %D \starttabulate[|c|c|c|c|c|c|] %D \NC option \NC number\NC mapping\NC glyph\NC string\NC example \NC \NR @@ -317,7 +317,7 @@ %D \startbuffer %D \enableregime[utf] \dostepwiserecurse{0}{8}{1} %D {\recurselevel: -%D \chardef\utfunicodetracer=\recurselevel aap‒noot coördinatie – één +%D \utfunicodetracer\recurselevel aap‒noot coördinatie – één %D \crlf} %D \stopbuffer %D diff --git a/tex/context/base/unic-ini.mkiv b/tex/context/base/unic-ini.mkiv index 51c300e4c..7146d7c0a 100644 --- a/tex/context/base/unic-ini.mkiv +++ b/tex/context/base/unic-ini.mkiv @@ -15,8 +15,8 @@ \unprotect -\let \keeputfcharacters\relax % used in xtag -\chardef\utfunicodetracer \zerocount % used in xtag +\let\keeputfcharacters\relax % used in xtag +\newconstant\utfunicodetracer % used in xtag \def\unicodechar #1{\char\numexpr#1\relax} % no lookahead \def\unicodenumber #1{\the \numexpr#1\relax} % no lookahead diff --git a/tex/context/base/unic-run.mkii b/tex/context/base/unic-run.mkii index b8e154fd4..09c701511 100644 --- a/tex/context/base/unic-run.mkii +++ b/tex/context/base/unic-run.mkii @@ -39,8 +39,8 @@ \stoptable} %D \starttyping -%D \chardef\utfunicodetracer=0 -%D \chardef\utfunicodetracer=7 +%D \utfunicodetracer=0 +%D \utfunicodetracer=7 %D %D \showunicodevector[000] %D \showunicodevector[001] @@ -66,11 +66,11 @@ \dostepwiserecurse{0}{15}{1} {\bTD \edef\entrypoint{\the\numexpr#1*256+#2+##1*16\relax}% - \chardef\utfunicodetracer0{\dontleavehmode \strut\unicodechar\entrypoint\endgraf}% + \utfunicodetracer\zerocount{\dontleavehmode \strut\unicodechar\entrypoint\endgraf}% \tt - \chardef\utfunicodetracer7{\dontleavehmode\txx\strut\unicodechar\entrypoint\endgraf}% - \chardef\utfunicodetracer3{\dontleavehmode\txx\strut\unicodechar\entrypoint\endgraf}% - \chardef\utfunicodetracer8{\dontleavehmode\txx\strut\unicodechar\entrypoint\endgraf}% + \utfunicodetracer\plusseven{\dontleavehmode\txx\strut\unicodechar\entrypoint\endgraf}% + \utfunicodetracer\plusthree{\dontleavehmode\txx\strut\unicodechar\entrypoint\endgraf}% + \utfunicodetracer\pluseight{\dontleavehmode\txx\strut\unicodechar\entrypoint\endgraf}% \eTD}% \bTD\uchexnumber{#2}\eTD \eTR} diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex index 0c17d1dcc..8d463a3a1 100644 --- a/tex/context/base/xtag-ini.tex +++ b/tex/context/base/xtag-ini.tex @@ -2328,7 +2328,7 @@ \simplifyXMLelements \let\getXMLentity\firstofoneargument \XMLrawentitiestrue - \chardef\utfunicodetracer7% new + \utfunicodetracer\plusseven % new \xdef\@@XML@@string{\csname\@@XMLdata:#2\endcsname}% \egroup \defconvertedcommand#1\@@XML@@string} @@ -2344,7 +2344,7 @@ \enableXMLexpansion \simplifyXMLelements \simplifyXMLentities - \chardef\utfunicodetracer7% new + \utfunicodetracer\plusseven % new \let\getXMLentity\expandedXMLentity % should this go in \simplify ? \xdef\@@XML@@string{\csname\@@XMLdata:#2\endcsname}% \egroup diff --git a/tex/context/base/xtag-run.tex b/tex/context/base/xtag-run.tex index 9a4603731..035268104 100644 --- a/tex/context/base/xtag-run.tex +++ b/tex/context/base/xtag-run.tex @@ -234,7 +234,7 @@ \let\executeXMLentity\@XMLentity \enableXML\verbatimXML \enableregime[utf]% - \chardef\utfunicodetracer8 + \utfunicodetracer\pluseight \veryraggedright \readfile{\truefilename{#1}}\donothing\donothing\endgraf \removelastskip % really needed diff --git a/tex/context/test/pdf-a1a-2005.mkiv b/tex/context/test/pdf-a1a-2005.mkiv new file mode 100644 index 000000000..4600e7a09 --- /dev/null +++ b/tex/context/test/pdf-a1a-2005.mkiv @@ -0,0 +1,43 @@ +% PDF/A-1a:2005 + +\enabletrackers[structure.tags,backend.tags] + +\setupbackend + [format=PDF/A-1a:2005, + intent=sRGB IEC61966-2.1, % use <info> entry here; otherwise problems with predefined default profile + profile=sRGB.icc, % use <filename> here + level=0, + ] + +\setupstructure[state=start] + +\setupcolors[cmyk=no] +\definecolor[rgbblack][b=0.01] +\definecolor[transtest][r=1,g=1,t=.5] + + +\placebookmarks[chapter][all][force=yes] + + +\starttext + +\starttextcolor[rgbblack] + +\startchapter[title=aa,bookmark=bb,list=cc,marking=dd] + +Test it + +\stopchapter + +\stoptextcolor + +\hbox\bgroup + \blackrule[width=1cm,height=1cm,color=red] + \blackrule[width=1cm,height=1cm,color=green] + \blackrule[width=1cm,height=1cm,color=blue] + \blackrule[width=1cm,height=1cm,color=rgbblack] + \blackrule[width=1cm,height=1cm,color=transtest]\hskip-.5cm + \blackrule[width=1cm,height=1cm,color=transtest] +\egroup + +\stoptext diff --git a/tex/context/test/pdf-a1b-2005.mkiv b/tex/context/test/pdf-a1b-2005.mkiv new file mode 100644 index 000000000..8a032395c --- /dev/null +++ b/tex/context/test/pdf-a1b-2005.mkiv @@ -0,0 +1,42 @@ +% PDF/A-1b:2005 + +\enabletrackers[structure.tags,backend.tags] + +\setupbackend + [format=PDF/A-1a:2005, + intent=sRGB IEC61966-2.1, % use <info> entry here; otherwise problems with predefined default profile + profile=sRGB.icc, % use <filename> here + level=0, + ] + +\setupstructure[state=start] % needed even for 'b'-version + +\setupcolors[cmyk=no] +\definecolor[rgbblack][b=0.01] +\definecolor[transtest][r=1,g=1,t=.5] + + + +\starttext + +\starttextcolor[rgbblack] % forced /DeviceGray causes problems; we need a trigger + +Text is needed, otherwise tagging base entries are not applied. + +\stopchapter + +\stoptextcolor + +%\startTEXpage +\hbox\bgroup + \blackrule[width=1cm,height=1cm,color=red] + \blackrule[width=1cm,height=1cm,color=green] + \blackrule[width=1cm,height=1cm,color=blue] + \blackrule[width=1cm,height=1cm,color=rgbblack] + \blackrule[width=1cm,height=1cm,color=transtest]\hskip-.5cm + \blackrule[width=1cm,height=1cm,color=transtest] +\egroup +%\stopTEXpage + + +\stoptext diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 65a6db854..3e64855a8 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 09/03/10 11:05:53 +-- merge date : 09/05/10 13:23:12 do -- begin closure to overcome local limits and interference diff --git a/tex/generic/context/mptopdf.tex b/tex/generic/context/mptopdf.tex index 1f229678d..a0ac34a42 100644 --- a/tex/generic/context/mptopdf.tex +++ b/tex/generic/context/mptopdf.tex @@ -110,11 +110,13 @@ %D different vision on paths, the graphic is positioned in %D such a way that accuracy in \PDF\ xforms is guaranteed. +\ifx\makeMPintoPDFobject\undefined \newcount\makeMPintoPDFobject \fi + \def\processMPfile#1 % {\pdfoutput=1 \pdfpkresolution600 \pdfcompresslevel=9 - \chardef\makeMPintoPDFobject=1 + \makeMPintoPDFobject=1 \hsize=100in \vsize=\hsize \hoffset=-1in |