diff options
Diffstat (limited to 'tex')
45 files changed, 1130 insertions, 1540 deletions
diff --git a/tex/context/base/catc-act.mkiv b/tex/context/base/catc-act.mkiv index c1a044df1..91940ad4f 100644 --- a/tex/context/base/catc-act.mkiv +++ b/tex/context/base/catc-act.mkiv @@ -14,17 +14,22 @@ %D This module deals with some active character handling. Use %D with care. +\unprotect + %D \macros %D {installactivecharacter} -\def\installactivecharacter#1 % - {\edef\temp{\detokenize{#1}}% - \cctcounterc\expandafter`\temp\relax % relax needed +\let\m_system_catcodes_temp\empty + +\normalprotected\def\installactivecharacter#1 % + {\edef\m_system_catcodes_temp{\detokenize{#1}}% + \c_system_catcodes_c\expandafter`\m_system_catcodes_temp\relax % relax needed \expandafter\startextendcatcodetable - \expandafter\ctxcatcodes\expandafter\catcode\the\cctcounterc\activecatcode + \expandafter\ctxcatcodes\expandafter\catcode\the\c_system_catcodes_c\activecatcode \stopextendcatcodetable - \letcatcodecommand \ctxcatcodes \cctcounterc \temp \relax - \ifnum\currentcatcodetable=\ctxcatcodes \setcatcodetable\ctxcatcodes \fi} + \letcatcodecommand \ctxcatcodes \c_system_catcodes_c \m_system_catcodes_temp \relax + \ifnum\currentcatcodetable=\ctxcatcodes \setcatcodetable\ctxcatcodes \fi + \let\m_system_catcodes_temp\empty} %D \macros %D {defineactivecharacter} @@ -32,34 +37,36 @@ %D Use this one with care, esp in combination with catcode %D vectors. There are better ways now. -\chardef\activehackcode=`~ +\setnewconstant\c_system_catcodes_hack\tildeasciicode % also defined in catc-ini.mkiv -\def\defineactivecharacter #1#2 #3% - {\cctcounterc\uccode\activehackcode - \if#1"\uccode\activehackcode\expandafter\doifnumberelse\expandafter{\string#1#2}\empty #1#2\else - \uccode\activehackcode\expandafter\doifnumberelse\expandafter{\string#1#2}\empty`#1#2\fi - \catcode\uccode\activehackcode\activecatcode - \uppercase{\def\next{~}}% - \uccode\activehackcode\cctcounterc - \expandafter\expandafter\expandafter\def\expandafter\next\expandafter - {\expandafter\dohandleactivecharacter\next{#3}}} +\normalprotected\def\defineactivecharacter #1#2 #3% uses \doifnumberelse which is not yet defined + {\c_system_catcodes_c\uccode\c_system_catcodes_hack + \if#1"\uccode\c_system_catcodes_hack\expandafter\doifnumberelse\expandafter{\string#1#2}\empty #1#2\else + \uccode\c_system_catcodes_hack\expandafter\doifnumberelse\expandafter{\string#1#2}\empty`#1#2\fi + \catcode\uccode\c_system_catcodes_hack\activecatcode + \uppercase{\def\m_system_catcodes_temp{~}}% brrr + \uccode\c_system_catcodes_hack\c_system_catcodes_c + \expandafter\expandafter\expandafter\def\expandafter\m_system_catcodes_temp\expandafter + {\expandafter\system_catcodes_handle\m_system_catcodes_temp{#3}}% + \let\m_system_catcodes_temp\empty} \chardef\activecharactermode\plusone % overloading still backward compatible -\def\dodohandleactivecharacter#1#2{#2} -\def\donthandleactivecharacter#1#2{\noexpand#1} - -\def\dohandleactivecharacter +\def\system_catcodes_handle {\ifcase\activecharactermode - \expandafter\donthandleactivecharacter + \expandafter\system_catcodes_handle_nop \else - \expandafter\dodohandleactivecharacter + \expandafter\system_catcodes_handle_yes \fi} -\def\makecharacteractive #1 {\catcode`#1\active} +\def\system_catcodes_handle_yes#1#2{#2} +\def\system_catcodes_handle_nop#1#2{\noexpand#1} + +\normalprotected\def\makecharacteractive #1 % + {\catcode`#1\activecatcode} -\def\installanddefineactivecharacter #1 % #2% +\normalprotected\def\installanddefineactivecharacter #1 % #2% {\normalexpanded{\noexpand\installactivecharacter \utfchar{#1} }% \defineactivecharacter #1 }% {#2}} -\endinput +\protect \endinput diff --git a/tex/context/base/catc-ctx.mkiv b/tex/context/base/catc-ctx.mkiv index 7eeee80ee..bd5c16d69 100644 --- a/tex/context/base/catc-ctx.mkiv +++ b/tex/context/base/catc-ctx.mkiv @@ -21,7 +21,7 @@ \ifdefined \tpacatcodes \else \newcatcodetable \tpacatcodes \fi % { } \ifdefined \tpbcatcodes \else \newcatcodetable \tpbcatcodes \fi % < > -\chardef\doublecommentsignal="10FF25 %% < 110000 (last valid range) +\setnewconstant \doublecommentsignal "10FF25 %% < 110000 (last valid range) \startcatcodetable \ctxcatcodes \catcode\tabasciicode \spacecatcode @@ -46,26 +46,26 @@ \stopcatcodetable \startcatcodetable \prtcatcodes - \catcode\tabasciicode \spacecatcode - \catcode\endoflineasciicode \endoflinecatcode - \catcode\formfeedasciicode \endoflinecatcode - \catcode\spaceasciicode \spacecatcode - \catcode\endoffileasciicode \ignorecatcode - \catcode\circumflexasciicode\superscriptcatcode % candidate - \catcode\underscoreasciicode\lettercatcode - \catcode\ampersandasciicode \alignmentcatcode -% \catcode\colonasciicode \lettercatcode % candidate - \catcode\backslashasciicode \escapecatcode - \catcode\leftbraceasciicode \begingroupcatcode - \catcode\rightbraceasciicode\endgroupcatcode - \catcode\dollarasciicode \mathshiftcatcode - \catcode\hashasciicode \parametercatcode - \catcode\commentasciicode \commentcatcode - \catcode`\@ \lettercatcode - \catcode`\! \lettercatcode - \catcode`\? \lettercatcode - \catcode\tildeasciicode \activecatcode - \catcode\barasciicode \activecatcode + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode \superscriptcatcode % candidate + \catcode\underscoreasciicode \lettercatcode + \catcode\ampersandasciicode \alignmentcatcode +% \catcode\colonasciicode \lettercatcode % candidate + \catcode\backslashasciicode \escapecatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode \endgroupcatcode + \catcode\dollarasciicode \mathshiftcatcode + \catcode\hashasciicode \parametercatcode + \catcode\commentasciicode \commentcatcode + \catcode\atsignasciicode \lettercatcode + \catcode\exclamationmarkasciicode\lettercatcode + \catcode\questionmarkasciicode \lettercatcode + \catcode\tildeasciicode \activecatcode + \catcode\barasciicode \activecatcode \stopcatcodetable %startcatcodetable \mthcatcodes @@ -104,8 +104,8 @@ \catcode\formfeedasciicode \othercatcode \catcode\spaceasciicode \othercatcode \catcode\endoffileasciicode \othercatcode - \catcode`\< \begingroupcatcode - \catcode`\> \endgroupcatcode + \catcode\lessthanasciicode \begingroupcatcode + \catcode\morethanasciicode \endgroupcatcode \stopcatcodetable \startcatcodetable \txtcatcodes diff --git a/tex/context/base/catc-def.mkiv b/tex/context/base/catc-def.mkiv index 264056e4b..26e8cb11e 100644 --- a/tex/context/base/catc-def.mkiv +++ b/tex/context/base/catc-def.mkiv @@ -65,27 +65,27 @@ \stopcatcodetable \startcatcodetable \notcatcodes % probably less needed - \catcode\tabasciicode \spacecatcode - \catcode\endoflineasciicode \endoflinecatcode - \catcode\formfeedasciicode \endoflinecatcode - \catcode\spaceasciicode \spacecatcode - \catcode\endoffileasciicode \ignorecatcode - \catcode\circumflexasciicode\othercatcode - \catcode\underscoreasciicode\othercatcode - \catcode\ampersandasciicode \othercatcode - \catcode\tildeasciicode \othercatcode - \catcode\hashasciicode \othercatcode - \catcode\dollarasciicode \othercatcode - \catcode\commentasciicode \othercatcode - \catcode`\< \othercatcode - \catcode`\> \othercatcode - \catcode\leftbraceasciicode \othercatcode - \catcode\rightbraceasciicode\othercatcode - \catcode`\" \othercatcode - \catcode`\' \othercatcode - \catcode`\/ \othercatcode - \catcode\backslashasciicode \othercatcode - \catcode\barasciicode \othercatcode + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode \othercatcode + \catcode\underscoreasciicode \othercatcode + \catcode\ampersandasciicode \othercatcode + \catcode\tildeasciicode \othercatcode + \catcode\hashasciicode \othercatcode + \catcode\dollarasciicode \othercatcode + \catcode\commentasciicode \othercatcode + \catcode\lessthanasciicode \othercatcode + \catcode\morethanasciicode \othercatcode + \catcode\leftbraceasciicode \othercatcode + \catcode\rightbraceasciicode \othercatcode + \catcode\doublequoteasciicode \othercatcode + \catcode\singlequoteasciicode \othercatcode + \catcode\forwardslashasciicode\othercatcode + \catcode\backslashasciicode \othercatcode + \catcode\barasciicode \othercatcode \stopcatcodetable \startcatcodetable \vrbcatcodes % probably less needed @@ -97,48 +97,48 @@ \stopcatcodetable \startcatcodetable \prtcatcodes - \catcode\tabasciicode \spacecatcode - \catcode\endoflineasciicode \endoflinecatcode - \catcode\formfeedasciicode \endoflinecatcode - \catcode\spaceasciicode \spacecatcode - \catcode\endoffileasciicode \ignorecatcode - \catcode\circumflexasciicode\superscriptcatcode -% \catcode\underscoreasciicode\subscriptcatcode - \catcode\underscoreasciicode\lettercatcode - \catcode\ampersandasciicode \alignmentcatcode - \catcode\backslashasciicode \escapecatcode - \catcode\leftbraceasciicode \begingroupcatcode - \catcode\rightbraceasciicode\endgroupcatcode - \catcode\dollarasciicode \mathshiftcatcode - \catcode\hashasciicode \parametercatcode - \catcode\commentasciicode \commentcatcode - \catcode`\@ \lettercatcode - \catcode`\! \lettercatcode - \catcode`\? \lettercatcode - \catcode\tildeasciicode \activecatcode - \catcode\barasciicode \activecatcode + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode \superscriptcatcode + %catcode\underscoreasciicode \subscriptcatcode + \catcode\underscoreasciicode \lettercatcode + \catcode\ampersandasciicode \alignmentcatcode + \catcode\backslashasciicode \escapecatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode \endgroupcatcode + \catcode\dollarasciicode \mathshiftcatcode + \catcode\hashasciicode \parametercatcode + \catcode\commentasciicode \commentcatcode + \catcode\atsignasciicode \lettercatcode + \catcode\exclamationmarkasciicode\lettercatcode + \catcode\questionmarkasciicode \lettercatcode + \catcode\tildeasciicode \activecatcode + \catcode\barasciicode \activecatcode \stopcatcodetable %D Because some characters have a special meaning, we provide %D shortcuts to their character representation. -\chardef\^=\circumflexasciicode -\chardef\_=\underscoreasciicode % but way too wide in lm, so ... until that's fixed: -\chardef\&=\ampersandasciicode -\chardef\%=\commentasciicode -\chardef\#=\hashasciicode -\chardef\$=\dollarasciicode -\chardef\{=\leftbraceasciicode -\chardef\}=\rightbraceasciicode -\chardef\\=\backslashasciicode -\chardef\|=\barasciicode +\chardef \^ = \circumflexasciicode +\chardef \_ = \underscoreasciicode % but way too wide in lm, so ... until that's fixed: +\chardef \& = \ampersandasciicode +\chardef \% = \commentasciicode +\chardef \# = \hashasciicode +\chardef \$ = \dollarasciicode +\chardef \{ = \leftbraceasciicode +\chardef \} = \rightbraceasciicode +\chardef \\ = \backslashasciicode +\chardef \| = \barasciicode %def\_{\leavevmode \kern.06em \vbox{\hrule width.3em}} \def\_{\dontleavehmode \kern.06em \vbox{\hrule width.3em}} % this will become a \chardef %D From now on we can use the protection mechanisms. -\def\unprotect {\pushcatcodetable\setcatcodetable\prtcatcodes} -\def\protect {\popcatcodetable} +\normalprotected\def\unprotect{\pushcatcodetable\setcatcodetable\prtcatcodes} +\normalprotected\def\protect {\popcatcodetable} \endinput diff --git a/tex/context/base/catc-ini.mkiv b/tex/context/base/catc-ini.mkiv index fc4af92d1..0bf9c81c8 100644 --- a/tex/context/base/catc-ini.mkiv +++ b/tex/context/base/catc-ini.mkiv @@ -16,47 +16,57 @@ \registerctxluafile{catc-ini}{1.001} +\unprotect + %D A long standing wish has been the availability of catcode %D arrays. Because traditional \TEX\ does not provide this we %D implement a fake method in the \MKII\ file. There is some %D overlap in code with \MKII\ but we take that for granted. -\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 -\setnewconstant\invalidcatcode 15 - -\setnewconstant\tabasciicode 9 -\setnewconstant\newlineasciicode 10 % don't confuse this one with \endoflineasciicode -\setnewconstant\formfeedasciicode 12 -\setnewconstant\endoflineasciicode 13 % somewhat messy but this can be the active \par -\setnewconstant\endoffileasciicode 26 -\setnewconstant\spaceasciicode 32 -\setnewconstant\hashasciicode 35 -\setnewconstant\dollarasciicode 36 -\setnewconstant\commentasciicode 37 -\setnewconstant\ampersandasciicode 38 -\setnewconstant\colonasciicode 58 -\setnewconstant\backslashasciicode 92 % `\\ -\setnewconstant\circumflexasciicode 94 -\setnewconstant\underscoreasciicode 95 -\setnewconstant\leftbraceasciicode 123 % `\{ -\setnewconstant\barasciicode 124 % `\| -\setnewconstant\rightbraceasciicode 125 % `\} -\setnewconstant\tildeasciicode 126 % `\~ -\setnewconstant\delasciicode 127 +\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 % the short names are to be avoided +\setnewconstant\activecatcode 13 \let\active\activecatcode % the short names are to be avoided +\setnewconstant\commentcatcode 14 +\setnewconstant\invalidcatcode 15 + +\setnewconstant\tabasciicode 9 +\setnewconstant\newlineasciicode 10 % don't confuse this one with \endoflineasciicode +\setnewconstant\formfeedasciicode 12 +\setnewconstant\endoflineasciicode 13 % somewhat messy but this can be the active \par +\setnewconstant\endoffileasciicode 26 +\setnewconstant\spaceasciicode 32 +\setnewconstant\exclamationmarkasciicode 33 % ! used in namespace protection +\setnewconstant\doublequoteasciicode 34 % " +\setnewconstant\hashasciicode 35 +\setnewconstant\dollarasciicode 36 +\setnewconstant\commentasciicode 37 +\setnewconstant\ampersandasciicode 38 +\setnewconstant\singlequoteasciicode 39 % ' +\setnewconstant\forwardslashasciicode 47 % / +\setnewconstant\colonasciicode 58 +\setnewconstant\lessthanasciicode 60 % < used as alternative verbatim { +\setnewconstant\morethanasciicode 62 % > used as alternative verbatim } +\setnewconstant\questionmarkasciicode 63 % ? used in namespace protection +\setnewconstant\atsignasciicode 64 % @ used in namespace protection +\setnewconstant\backslashasciicode 92 % `\\ +\setnewconstant\circumflexasciicode 94 +\setnewconstant\underscoreasciicode 95 +\setnewconstant\leftbraceasciicode 123 % `\{ +\setnewconstant\barasciicode 124 % `\| +\setnewconstant\rightbraceasciicode 125 % `\} +\setnewconstant\tildeasciicode 126 % `\~ +\setnewconstant\delasciicode 127 \begingroup \catcode \tabasciicode \activecatcode \gdef\activetabtoken {^^I} @@ -76,28 +86,21 @@ \xdef\outputnewlinechar{^^J}% \endgroup} -\ifx\gobbleoneargument\undefined \long\def\gobbleoneargument#1{} \fi - -\newif \ifrecatcodeuppercharacters % only used in good old tex - -\newcount\cctdefcounter \cctdefcounter\zerocount % 0 = signal, so advance before allocate +\newcount\c_system_catcodes_n \c_system_catcodes_n\zerocount % 0 = signal, so advance before allocate +\newcount\c_system_catcodes_a +\newcount\c_system_catcodes_b +\newcount\c_system_catcodes_c -\newcount\cctcountera -\newcount\cctcounterb -\newcount\cctcounterc - -\def\newcatcodetable#1% we could move the cctdefcounter to lua - {\global\advance\cctdefcounter\plusone - \expandafter\xdef\csname @@ccn:\number\cctdefcounter\endcsname{\string#1}% logging +\normalprotected\def\newcatcodetable#1% we could move the cctdefcounter to lua + {\global\advance\c_system_catcodes_n\plusone + \expandafter\xdef\csname\??qm:n:\number\c_system_catcodes_n\endcsname{\string#1}% logging \newconstant#1% - #1\cctdefcounter + #1\c_system_catcodes_n \ctxlua{catcodes.register("\expandafter\gobbleoneargument\string#1",\number#1)}} -\newcatcodetable \scratchcatcodes \initcatcodetable\scratchcatcodes - -\newtoks \setdefaultcatcodes +\newtoks \everysetdefaultcatcodes -\setdefaultcatcodes +\everysetdefaultcatcodes % this might get dropped {\catcode\backslashasciicode\othercatcode \catcode\endoflineasciicode\othercatcode \catcode\spaceasciicode \othercatcode @@ -106,18 +109,13 @@ \long\normalprotected\def\startcatcodetable#1#2\stopcatcodetable {\begingroup - \catcodetable\scratchcatcodes - \the\setdefaultcatcodes + \catcodetable\inicatcodes + \the\everysetdefaultcatcodes #2% \savecatcodetable#1\relax \endgroup} -\def\permitcircumflexescape % to be used grouped - {\catcode\circumflexasciicode\superscriptcatcode} - -\let\permitcaretescape\permitcircumflexescape - -\newcatcodetable\dummycatcodes +\let\stopcatcodetable\relax \long\normalprotected\def\startextendcatcodetable#1#2\stopextendcatcodetable {\begingroup @@ -127,6 +125,13 @@ \globaldefs\zerocount \endgroup} +\let\stopextendcatcodetable\relax + +\normalprotected\def\permitcircumflexescape % to be used grouped + {\catcode\circumflexasciicode\superscriptcatcode} + +\let\permitcaretescape\permitcircumflexescape + % == % % \long\normalprotected\def\startextendcatcodetable#1#2\stopextendcatcodetable @@ -136,101 +141,93 @@ % \catcodetable\scratchcounter % \egroup} -\def\letcatcodecommand - {\afterassignment\letcatcodecommanda\cctcountera} - -\def\letcatcodecommanda - {\afterassignment\letcatcodecommandb\cctcounterb} - -\let\currentcatcodetable\catcodetable - %D The next command can be defined in a cleaner way in the %D Mk IV file but we want to have a fast one with a minimal %D chance for interference. Do we still need this complex %D mechanism? Future versions of \MKIV\ might only use %D active characters for very special cases. -\setnewconstant\activehackcode \tildeasciicode +\setnewconstant\c_system_catcodes_hack\tildeasciicode -%D Once a catcode is assigned, the next assignments will happen faster. +%D Once a catcode is assigned, the next assignments will happen +%D faster. We predefine some prefixes ahead of mult-sys. -% (expandable) let +\def\??ql{@@ql} % let : \let +\def\??qd{@@qd} % def : \def +\def\??qu{@@qu} % ued : \unexpanded\def +\def\??qm{@@qm} % \meaning -\def\letcatcodecommand {\afterassignment\letcatcodecommanda\cctcountera} -\def\letcatcodecommanda{\afterassignment\letcatcodecommandb\cctcounterb} +\def\letcatcodecommand{\afterassignment\system_catcodes_let_a\c_system_catcodes_a} +\def\defcatcodecommand{\afterassignment\system_catcodes_def_a\c_system_catcodes_a} +\def\uedcatcodecommand{\afterassignment\system_catcodes_ued_a\c_system_catcodes_a} -\def\letcatcodecommandb % each time - {\ifcsname CCL:\number\cctcountera:\number\cctcounterb\endcsname - \csname CCL:\number\cctcountera:\number\cctcounterb\expandafter\endcsname +\def\system_catcodes_let_a{\afterassignment\system_catcodes_let_b\c_system_catcodes_b} +\def\system_catcodes_def_a{\afterassignment\system_catcodes_def_b\c_system_catcodes_b} +\def\system_catcodes_ued_a{\afterassignment\system_catcodes_ued_b\c_system_catcodes_b} + +\def\system_catcodes_let_b % each time + {\ifcsname\??ql:\number\c_system_catcodes_a:\number\c_system_catcodes_b\endcsname + \csname\??ql:\number\c_system_catcodes_a:\number\c_system_catcodes_b\expandafter\endcsname \else - \expandafter\letcatcodecommandc + \expandafter\system_catcodes_let_c \fi} -\def\letcatcodecommandc % only first time - {\expandafter\gdef\csname CCL:\number\cctcountera:\number\cctcounterb\expandafter\endcsname\expandafter - {\expandafter\let\csname CCC:\number\cctcountera:\number\cctcounterb\endcsname}% - \reinstatecatcodecommandua % unexpanded - \csname CCL:\number\cctcountera:\number\cctcounterb\endcsname} - -% expandable def - -\def\defcatcodecommand {\afterassignment\defcatcodecommanda\cctcountera} -\def\defcatcodecommanda{\afterassignment\defcatcodecommandb\cctcounterb} - -\def\defcatcodecommandb % each time - {\ifcsname CCD:\number\cctcountera:\number\cctcounterb\endcsname - \csname CCD:\number\cctcountera:\number\cctcounterb\expandafter\endcsname +\def\system_catcodes_def_b % each time + {\ifcsname\??qd:\number\c_system_catcodes_a:\number\c_system_catcodes_b\endcsname + \csname\??qd:\number\c_system_catcodes_a:\number\c_system_catcodes_b\expandafter\endcsname \else - \expandafter\defcatcodecommandc + \expandafter\system_catcodes_def_c \fi} -\def\defcatcodecommandc % only first time (we could use \normalexpanded here) - {\expandafter\gdef\csname CCD:\number\cctcountera:\number\cctcounterb\expandafter\endcsname - \expandafter##\expandafter1\expandafter - {\expandafter\def\csname CCC:\number\cctcountera:\number\cctcounterb\endcsname{##1}}% - \reinstatecatcodecommanda - \csname CCD:\number\cctcountera:\number\cctcounterb\endcsname} +\def\system_catcodes_ued_b % each time + {\ifcsname\??qu:\number\c_system_catcodes_a:\number\c_system_catcodes_b\endcsname + \csname\??qu:\number\c_system_catcodes_a:\number\c_system_catcodes_b\expandafter\endcsname + \else + \expandafter\system_catcodes_ued_c + \fi} -% unexpandable def (e.g. used for discretionaries) +\def\system_catcodes_let_c % only first time + {\expandafter\gdef\csname\??ql:\number\c_system_catcodes_a:\number\c_system_catcodes_b\expandafter\endcsname\expandafter + {\expandafter\let\csname\??qm:\number\c_system_catcodes_a:\number\c_system_catcodes_b\endcsname}% + \system_catcodes_reinstate_unexpanded + \csname\??ql:\number\c_system_catcodes_a:\number\c_system_catcodes_b\endcsname} -\def\uedcatcodecommand {\afterassignment\uedcatcodecommanda\cctcountera} -\def\uedcatcodecommanda{\afterassignment\uedcatcodecommandb\cctcounterb} -\def\uedcatcodecommandb % each time - {\ifcsname CCU:\number\cctcountera:\number\cctcounterb\endcsname - \csname CCU:\number\cctcountera:\number\cctcounterb\expandafter\endcsname - \else - \expandafter\uedcatcodecommandc - \fi} +\def\system_catcodes_def_c % only first time (we could use \normalexpanded here) + {\expandafter\gdef\csname\??qd:\number\c_system_catcodes_a:\number\c_system_catcodes_b\expandafter\endcsname + \expandafter##\expandafter1\expandafter + {\expandafter\def\csname\??qm:\number\c_system_catcodes_a:\number\c_system_catcodes_b\endcsname{##1}}% + \system_catcodes_reinstate_normal + \csname\??qd:\number\c_system_catcodes_a:\number\c_system_catcodes_b\endcsname} -\def\uedcatcodecommandc % only first time - {\expandafter\gdef\csname CCU:\number\cctcountera:\number\cctcounterb\expandafter\endcsname +\def\system_catcodes_ued_c % only first time + {\expandafter\gdef\csname\??qu:\number\c_system_catcodes_a:\number\c_system_catcodes_b\expandafter\endcsname \expandafter##\expandafter1\expandafter - {\expandafter\normalprotected\expandafter\def\csname CCC:\number\cctcountera:\number\cctcounterb\endcsname{##1}}% - \reinstatecatcodecommandua % unexpanded - \csname CCU:\number\cctcountera:\number\cctcounterb\endcsname} + {\expandafter\normalprotected\expandafter\def\csname\??qm:\number\c_system_catcodes_a:\number\c_system_catcodes_b\endcsname{##1}}% + \system_catcodes_reinstate_unexpanded + \csname\??qu:\number\c_system_catcodes_a:\number\c_system_catcodes_b\endcsname} -\def\reinstatecatcodecommand{\afterassignment\reinstatecatcodecommanda\cctcounterb} +\def\reinstatecatcodecommand{\afterassignment\system_catcodes_reinstate_normal\c_system_catcodes_b} -\def\reinstatecatcodecommanda % can be used when a direct definition has been done - {\begingroup % and the selector has been lost - \uccode\activehackcode\cctcounterb - \catcode\uccode\activehackcode\activecatcode - \uppercase{\xdef~{\noexpand\catcodecommand{\number\cctcounterb}}}% +\def\system_catcodes_reinstate_normal % can be used when a direct definition has been done + {\begingroup % and the selector has been lost + \uccode\c_system_catcodes_hack\c_system_catcodes_b + \catcode\uccode\c_system_catcodes_hack\activecatcode + \uppercase{\xdef~{\noexpand\catcodecommand{\number\c_system_catcodes_b}}}% \endgroup} -\def\reinstatecatcodecommandua % can be used when a direct definition has been done - {\begingroup % and the selector has been lost - \uccode\activehackcode\cctcounterb - \catcode\uccode\activehackcode\activecatcode - \uppercase{\normalprotected\xdef~{\noexpand\catcodecommand{\number\cctcounterb}}}% +\def\system_catcodes_reinstate_unexpanded % can be used when a direct definition has been done + {\begingroup % and the selector has been lost + \uccode\c_system_catcodes_hack\c_system_catcodes_b + \catcode\uccode\c_system_catcodes_hack\activecatcode + \uppercase{\normalprotected\xdef~{\noexpand\catcodecommand{\number\c_system_catcodes_b}}}% \endgroup} \newconstant\defaultcatcodetable \def\catcodecommand#1% - {\csname CCC:\number - \ifcsname CCC:\number\currentcatcodetable:\number#1\endcsname + {\csname\??qm:\number + \ifcsname\??qm:\number\currentcatcodetable:\number#1\endcsname \currentcatcodetable \else \defaultcatcodetable \fi :\number#1\endcsname} @@ -248,107 +245,77 @@ %D what the next macros do. Saving the catcodes can be %D disabled by saying \type{\localcatcodestrue}. -% quite likely we will define \unexpanded earlier on so -% that \normalprotected will go - -\let\savedcatcodetable\relax - -\newcount\catcoderestorelevel +\newcount\c_system_catcodes_level \normalprotected\def\pushcatcodetable - {\advance\catcoderestorelevel\plusone - \tracepushcatcodetable - \expandafter\chardef\csname scct:\number\catcoderestorelevel\endcsname\currentcatcodetable} + {\advance\c_system_catcodes_level\plusone + \system_catcodes_trace_push + \expandafter\chardef\csname\??qm:t:\number\c_system_catcodes_level\endcsname\currentcatcodetable} \normalprotected\def\popcatcodetable - {\ifcase\catcoderestorelevel - \showcatcodenestingerror + {\ifcase\c_system_catcodes_level + \system_catcodes_trace_nesting_error \else - \expandafter\catcodetable\csname scct:\number\catcoderestorelevel\endcsname - \tracepopcatcodetable - \advance\catcoderestorelevel\minusone + \expandafter\catcodetable\csname\??qm:t:\number\c_system_catcodes_level\endcsname + \system_catcodes_trace_pop + \advance\c_system_catcodes_level\minusone \fi} -\normalprotected\def\showcatcodenestingerror % can be overloaded +\normalprotected\def\system_catcodes_trace_nesting_error {\immediate\write16{}% - \immediate\write16{Fatal error: catcode push/pop mismatch. Fix this! (restore level: \number\catcoderestorelevel)}\wait\end + \immediate\write16{Fatal error: catcode push/pop mismatch. Fix this! (restore level: \number\c_system_catcodes_level)}\wait\end \immediate\write16{}} \normalprotected\def\restorecatcodes % takes previous level - {\ifnum\catcoderestorelevel>\plusone - \expandafter\catcodetable\csname scct:\number\numexpr\catcoderestorelevel-1\relax\endcsname + {\ifnum\c_system_catcodes_level>\plusone + \expandafter\catcodetable\csname\??qm:t:\number\numexpr\c_system_catcodes_level-1\relax\endcsname \fi} -\newtoks\everycatcodetable +% \newtoks\everycatcodetable \normalprotected\def\setcatcodetable#1% {\catcodetable#1% - \the\everycatcodetable - \tracesetcatcodetable} +% \the\everycatcodetable + \system_catcodes_trace_set} -\def\dotracecatcodetable#1{\immediate\write16{[#1]}} +%D Handy for debugging: +%D +%D \starttyping +%D \tracecatcodetables +%D \stoptyping + +\normalprotected\def\tracecatcodetables + {\def\system_catcodes_trace_set {\system_catcodes_trace{set \catcodetablename\space at \number\c_system_catcodes_level}}% + \def\system_catcodes_trace_push{\system_catcodes_trace{push \catcodetablename\space from \system_catcodes_prev\space at \number\c_system_catcodes_level}}% + \def\system_catcodes_trace_pop {\system_catcodes_trace{pop \catcodetablename\space to \system_catcodes_prev\space at \number\c_system_catcodes_level}}} -\def\tracecatcodetables - {\def\tracesetcatcodetable {\dotracecatcodetable{set \catcodetablename\space at \number\catcoderestorelevel}}% - \def\tracepushcatcodetable{\dotracecatcodetable{push \catcodetablename\space from \catcodetableprev\space at \number\catcoderestorelevel}}% - \def\tracepopcatcodetable {\dotracecatcodetable{pop \catcodetablename\space to \catcodetableprev\space at \number\catcoderestorelevel}}} +\def\system_catcodes_trace#1{\immediate\write16{[#1]}} -\def\catcodetableprev - {\ifnum\numexpr\catcoderestorelevel-1\relax>\zerocount - \csname @@ccn:\number\csname scct:\number\numexpr\catcoderestorelevel-1\relax\endcsname\endcsname +\def\system_catcodes_prev + {\ifnum\numexpr\c_system_catcodes_level-1\relax>\zerocount + \csname\??qm:n:\number\csname\??qm:t:\number\numexpr\c_system_catcodes_level-1\relax\endcsname\endcsname \else -% \fi} \def\catcodetablename {\ifnum\currentcatcodetable>\zerocount - \csname @@ccn:\number\currentcatcodetable\endcsname + \csname\??qm:n:\number\currentcatcodetable\endcsname \else -% \fi} -\ifx\empty\undefined \def\empty{} \fi +\let\system_catcodes_trace_set \empty +\let\system_catcodes_trace_push\empty +\let\system_catcodes_trace_pop \empty -\let\tracesetcatcodetable \empty -\let\tracepushcatcodetable\empty -\let\tracepopcatcodetable \empty +\protect -%D Handy for debugging: +%D We still have to define these so let's do that now: -% \tracecatcodetables - -% D Only in \MKIV\ (to be used when crossing pages with changed catcodes -% D in the current vector): -% D -% D \starttyping -% D \normalprotected\def\startcrap -% D {\bgroup -% D \pushcatcodes -% D \whitespace -% D \obeylines -% D \activatespacehandler\v!yes -% D \strut} -% D -% D \normalprotected\def\stopcrap -% D {\popcatcodes -% D \egroup} -% D \stoptyping -% -% \newcount\catcodetablelevel -% -% \def\pushcatcodes -% {\begingroup -% \global\advance\catcodetablelevel\plusone -% \ifcsname @@ccf:\number\catcodetablelevel\endcsname \else -% \global\advance\cctdefcounter\plusone -% \expandafter\global\expandafter\chardef\csname @@ccf:\number\catcodetablelevel\endcsname\cctdefcounter -% \fi -% \catcodetable\ctxcatcodes -% \expandafter\savecatcodetable\csname @@ccf:\number\catcodetablelevel\endcsname -% \endgroup -% \expandafter\catcodetable\csname @@ccf:\number\catcodetablelevel\endcsname} -% -% \def\popcatcodes -% {\global\advance\catcodetablelevel\minusone} +\newcatcodetable \inicatcodes +\initcatcodetable\inicatcodes + +\let\currentcatcodetable\catcodetable \endinput diff --git a/tex/context/base/catc-sym.mkiv b/tex/context/base/catc-sym.mkiv index 55782f11e..82169d994 100644 --- a/tex/context/base/catc-sym.mkiv +++ b/tex/context/base/catc-sym.mkiv @@ -63,13 +63,13 @@ %D them for convenience and compatibility. Some old engine code %D has been removed. -\def\uncatcodespecials {\setcatcodetable\nilcatcodes \uncatcodespacetokens} -\def\setnaturalcatcodes {\setcatcodetable\nilcatcodes} -\def\setnormalcatcodes {\setcatcodetable\ctxcatcodes} % maybe \texcatcodes -\def\uncatcodecharacters {\setcatcodetable\nilcatcodes} % was fast version, gone now -\def\uncatcodeallcharacters{\setcatcodetable\nilcatcodes} % was slow one, with restore +\normalprotected\def\uncatcodespecials {\setcatcodetable\nilcatcodes \uncatcodespacetokens} +\normalprotected\def\setnaturalcatcodes {\setcatcodetable\nilcatcodes} +\normalprotected\def\setnormalcatcodes {\setcatcodetable\ctxcatcodes} % maybe \texcatcodes +\normalprotected\def\uncatcodecharacters {\setcatcodetable\nilcatcodes} % was fast version, gone now +\normalprotected\def\uncatcodeallcharacters{\setcatcodetable\nilcatcodes} % was slow one, with restore -\def\uncatcodespacetokens +\normalprotected\def\uncatcodespacetokens {\catcode\spaceasciicode \spacecatcode \catcode\formfeedasciicode \ignorecatcode \catcode\endoflineasciicode\endoflinecatcode @@ -84,10 +84,10 @@ \newtoks\everyverbosechacters -\def\setverbosecscharacter#1% +\normalprotected\def\setverbosecscharacter#1% {\edef#1{\string#1}} -\def\setverbosecscharacters +\normalprotected\def\setverbosecscharacters {\the\everyverbosechacters} \bgroup @@ -180,8 +180,8 @@ \long\def\rescanwithsetup#1#2{\begingroup\directsetup{#1}\scantokens{#2\ignorespaces}\endgroup} \ifx\scantextokens\undefined \else - \long\def\rescan#1{\scantextokens{#1}} - \long\def\rescanwithsetup#1#2{\begingroup\directsetup{#1}\scantextokens{#2}\endgroup} + \long\def\rescan#1{\scantextokens{#1}} + \long\def\rescanwithsetup#1#2{\begingroup\directsetup{#1}\scantextokens{#2}\endgroup} \fi \endinput diff --git a/tex/context/base/char-act.mkiv b/tex/context/base/char-act.mkiv index 472bf89ae..011c29d07 100644 --- a/tex/context/base/char-act.mkiv +++ b/tex/context/base/char-act.mkiv @@ -15,18 +15,7 @@ \unprotect -%D \macros -%D {processingverbatim} -%D -%D Typesetting a file in most cases results in more than one -%D page. Because we don't want problems with files that are -%D read in during the construction of the page, we set \type -%D {\ifprocessingverbatim}, so the output routine can adapt -%D its behavior. Originally we used \type {\scratchread}, but -%D because we want to support nesting, we decided to use a -%D separate input file. - -\newif\ifprocessingverbatim +\ifdefined\page_otr_fill_and_eject_page \else \let\page_otr_fill_and_eject_page\relax \fi % forward reference %D \macros %D {obeyedspace, obeyedtab, obeyedline, obeyedpage} @@ -35,7 +24,7 @@ %D \NEWLINE\ and \NEWPAGE\ active and assigning them %D \type{\obeysomething}, but first we set some default values. -\def\obeyedspace {\ifprocessingverbatim\hbox{ }\else\space\fi} +\def\obeyedspace {\space} \def\obeyedtab {\obeyedspace} \def\obeyedline {\par} \def\obeyedpage {\page_otr_fill_and_eject_page} @@ -47,14 +36,13 @@ %D spaces (control spaces) we only have to adapt the definition %D of \type{\obeyedspace} to: -\def\controlspace{\hbox{\char32}} % rather tex -\def\normalspace { } -\def\normalspaces{\catcode\spaceasciicode\spacecatcode} +\unexpanded\def\controlspace{\hbox{\char32}} % rather tex, we need the unicode value +\unexpanded\def\normalspaces{\catcode\spaceasciicode\spacecatcode} \bgroup -\catcode\spaceasciicode\activecatcode -\gdef\obeyspaces{\catcode\spaceasciicode\activecatcode\def {\obeyedspace}} -\gdef\setcontrolspaces{\catcode\spaceasciicode\activecatcode\def {\controlspace}} + \catcode\spaceasciicode\activecatcode + \unexpanded\gdef\obeyspaces{\catcode\spaceasciicode\activecatcode\def {\obeyedspace}} + \unexpanded\gdef\setcontrolspaces{\catcode\spaceasciicode\activecatcode\def {\controlspace}} \egroup %D \macros @@ -66,44 +54,19 @@ %D \NEWPAGE\ character locally, we redefine the meaning of %D this (often already) active character. -% \bgroup \permitcircumflexescape - -% \catcode\formfeedasciicode\activecatcode - -% \gdef^^L{\par} - -% \egroup - \expandafter\def\activeformfeedtoken{\par} %D The following indirect definitions enable us to implement %D all kind of \type{\obeyed} handlers. -% \bgroup \permitcircumflexescape - -% \catcode\tabasciicode \activecatcode -% \catcode\endoflineasciicode\activecatcode -% \catcode\formfeedasciicode \activecatcode +\unexpanded\def\obeytabs {\catcode\tabasciicode \activecatcode\expandafter\def\activetabtoken {\obeyedtab }} +\unexpanded\def\obeylines {\catcode\endoflineasciicode\activecatcode\expandafter\def\activeendoflinetoken{\obeyedline}} +\unexpanded\def\obeypages {\catcode\formfeedasciicode \activecatcode\expandafter\def\activeformfeedtoken {\obeyedpage}} -% \gdef\obeytabs {\catcode\tabasciicode \activecatcode\def^^I{\obeyedtab }} -% \gdef\obeylines {\catcode\endoflineasciicode\activecatcode\def^^M{\obeyedline}} -% \gdef\obeypages {\catcode\formfeedasciicode \activecatcode\def^^L{\obeyedpage}} - -% \gdef\ignoretabs {\catcode\tabasciicode \activecatcode\def^^I{\obeyedspace}} -% \gdef\ignorelines{\catcode\endoflineasciicode\activecatcode\def^^M{\obeyedspace}} -% \gdef\ignorepages{\catcode\formfeedasciicode \ignorecatcode} -% \gdef\ignoreeofs {\catcode\endoffileasciicode\ignorecatcode} - -% \egroup - -\def\obeytabs {\catcode\tabasciicode \activecatcode\expandafter\def\activetabtoken {\obeyedtab }} -\def\obeylines {\catcode\endoflineasciicode\activecatcode\expandafter\def\activeendoflinetoken{\obeyedline}} -\def\obeypages {\catcode\formfeedasciicode \activecatcode\expandafter\def\activeformfeedtoken {\obeyedpage}} - -\def\ignoretabs {\catcode\tabasciicode \activecatcode\expandafter\def\activetabtoken {\obeyedspace}} -\def\ignorelines{\catcode\endoflineasciicode\activecatcode\expandafter\def\activeendoflinetoken{\obeyedspace}} -\def\ignorepages{\catcode\formfeedasciicode \ignorecatcode} -\def\ignoreeofs {\catcode\endoffileasciicode\ignorecatcode} +\unexpanded\def\ignoretabs {\catcode\tabasciicode \activecatcode\expandafter\def\activetabtoken {\obeyedspace}} +\unexpanded\def\ignorelines{\catcode\endoflineasciicode\activecatcode\expandafter\def\activeendoflinetoken{\obeyedspace}} +\unexpanded\def\ignorepages{\catcode\formfeedasciicode \ignorecatcode} +\unexpanded\def\ignoreeofs {\catcode\endoffileasciicode\ignorecatcode} %D \macros %D {naturaltextext} @@ -112,29 +75,11 @@ %D too. We also introduce a switch that can be used in the %D drivers and set in higher level shell macros. -\def\naturaltextext#1\relax - {\bgroup +\unexpanded\def\naturaltextext#1\relax % this command will become obsolete + {\begingroup \def\ascii{#1}% \setcatcodetable\ctxcatcodes \prettynaturalfont{\scantextokens\expandafter{\ascii}\ifhmode\unskip\fi}% - \egroup} + \endgroup} \endinput \protect - -% obsolete (old hack for idris) - -% %D This is a hack, and only meant for special situations. We don't -% %D support this in for instance verbatim. The active characters map -% %D onto the \CONTEXT\ names and font handling etc. is up to the user. -% -% \registerctxluafile{char-act}{1.001} -% -% \def\enableactiveutf {\ctxlua{characters.active.enable()}} -% \def\disableactiveutf{\ctxlua{characters.active.disable()}} -% \def\testactiveutf #1{\ctxlua{characters.active.test("#1")}} - -%D Usage: -%D -%D \starttyping -%D \enableactiveutf \testactiveutf{eacute} -%D \stoptyping diff --git a/tex/context/base/cldf-ini.mkiv b/tex/context/base/cldf-ini.mkiv index 1b6786013..4ad31d81e 100644 --- a/tex/context/base/cldf-ini.mkiv +++ b/tex/context/base/cldf-ini.mkiv @@ -28,6 +28,8 @@ %D \stopbuffer %D %D \typebuffer \getbuffer +%D +%D Anyway \unknown\ the following are {\em not} user commands: \def\cldf#1{\directlua\zerocount{_cldf_(#1)}} % global (functions) \def\cldn#1{\directlua\zerocount{_cldn_(#1)}} % global (nodes) diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index c5c0ef7df..9b77a93bf 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.12.22 16:52} +\newcontextversion{2011.12.23 09:52} %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-new.mkiv b/tex/context/base/cont-new.mkiv index 80810ec48..ca975ac2a 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.12.22 16:52} +\newcontextversion{2011.12.23 09:52} %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/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 3e0fcb290..ffed26193 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 2725c5338..fca899a4d 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 8aabd179f..e179ef31b 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.12.22 16:52} +\edef\contextversion{2011.12.23 09:52} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 4be4b8ba2..b68913a10 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -23,7 +23,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2011.12.22 16:52} +\edef\contextversion{2011.12.23 09:52} %D For those who want to use this: diff --git a/tex/context/base/core-var.mkiv b/tex/context/base/core-var.mkiv index 0d9e3ee1c..db056c3e7 100644 --- a/tex/context/base/core-var.mkiv +++ b/tex/context/base/core-var.mkiv @@ -86,8 +86,8 @@ \newtoks \everyendofpar %newtoks \everyparflush -\def\bpar{\dostarttagged\t!paragraph\empty\the\everybeginofpar\ignorespaces} % may interfere with \everypar -\def\epar{\ifhmode\removeunwantedspaces\the\everyendofpar\fi\dostoptagged } % test prevents problems with \bpar\epar +\unexpanded\def\bpar{\dostarttagged\t!paragraph\empty\the\everybeginofpar\ignorespaces} % may interfere with \everypar +\unexpanded\def\epar{\ifhmode\removeunwantedspaces\the\everyendofpar\fi\dostoptagged } % test prevents problems with \bpar\epar %D Lists: diff --git a/tex/context/base/file-ini.mkvi b/tex/context/base/file-ini.mkvi index d9b2b506e..b0f6244aa 100644 --- a/tex/context/base/file-ini.mkvi +++ b/tex/context/base/file-ini.mkvi @@ -39,8 +39,8 @@ %D the number of files is limited to~16, so use this one when %D possible. We also define a scratch output file. -\ifx\undefined\scratchread \newread \scratchread \fi -\ifx\undefined\scratchwrite \newwrite\scratchwrite \fi +\ifdefined\scratchread \else \newread \scratchread \fi +\ifdefined\scratchwrite \else \newwrite\scratchwrite \fi %D Seldom needed: @@ -73,18 +73,18 @@ %D \popendofline %D \stoptyping -\newcount\endoflinelevel +\newcount\c_system_files_eol_level -\def\pushendofline - {\advance\endoflinelevel\plusone - \expandafter\chardef\csname :eol:\number\endoflinelevel\endcsname\catcode\endoflineasciicode - \catcode\endoflineasciicode\commentcatcode\relax} +\unexpanded\def\pushendofline + {\advance\c_system_files_eol_level\plusone + \expandafter\chardef\csname\??fi:eol:\number\c_system_files_eol_level\endcsname\catcode\endoflineasciicode + \catcode\endoflineasciicode\commentcatcode} -\def\popendofline - {\catcode\endoflineasciicode\csname :eol:\number\endoflinelevel\endcsname - \advance\endoflinelevel\minusone} +\unexpanded\def\popendofline + {\catcode\endoflineasciicode\csname\??fi:eol:\number\c_system_files_eol_level\endcsname + \advance\c_system_files_eol_level\minusone} -\def\restoreendofline +\unexpanded\def\restoreendofline {\catcode\endoflineasciicode\endoflinecatcode} %D \macros @@ -92,7 +92,7 @@ %D %D A low level capsule: -\newcount\readingfilelevel +\newcount\readingfilelevel % no longer needed \newtoks \everystartreadingfile \newtoks \everystopreadingfile @@ -109,15 +109,6 @@ \the\everystopreadingfile \global\advance\readingfilelevel\minusone} -% %D \macros -% %D {unlinkfile} -% %D -% %D Sometimes we want to make sure a file is deleted, so here -% %D is a macro that does the job. It's named after the \PERL\ -% %D one. -% -% \def\unlinkfile#name{\ctxlua{os.remove([[#name]])}} % obsolete - %D \macros %D {input, normalinput} %D @@ -209,21 +200,26 @@ %D \doendinputonce{filename} %D \stoptyping %D -%D This command obeys the standard method for locating files. +%D This command obeys the standard method for locating files. We could +%D move this function to the \LUA\ end. \unexpanded\def\doonlyonce#whatever% - {\doifundefinedelse{@@@#whatever@@@} - {\letgvalue{@@@#whatever@@@}\empty - \firstofoneargument} - {\gobbleoneargument}} + {\ifcsname\??fi:#whatever\endcsname + \expandafter\gobbleoneargument + \else + \letgvalue{\??fi:#whatever}\relax + \expandafter\firstofoneargument + \fi} \unexpanded\def\doinputonce#name% {\doonlyonce{#name}{\doiffileelse{#name}{\inputgivenfile{#name}}\donothing}} \unexpanded\def\doendinputonce#name% - {\doifdefined{@@@#name@@@}\endinput} + {\ifcsname\??fi:#name\endcsname + \expandafter\endinput + \fi} \unexpanded\def\forgetdoingonce#whatever% - {\global\letbeundefined{@@@#whatever@@@}} + {\global\letbeundefined{\??fi:#whatever}} \protect \endinput diff --git a/tex/context/base/file-mod.mkvi b/tex/context/base/file-mod.mkvi index 6259a04d8..a3a2194d7 100644 --- a/tex/context/base/file-mod.mkvi +++ b/tex/context/base/file-mod.mkvi @@ -138,7 +138,7 @@ %D global. %D %D \starttyping -%D \fetchruntimecommand\showaccents{\f!encodingprefix ...} +%D \fetchruntimecommand\showaccents{\f!colorprefix ...} %D \stoptyping \def\fetchruntimecommand#1#2% diff --git a/tex/context/base/file-res.mkvi b/tex/context/base/file-res.mkvi index c2d2cdec3..c3f2065b1 100644 --- a/tex/context/base/file-res.mkvi +++ b/tex/context/base/file-res.mkvi @@ -67,15 +67,17 @@ %D \type{\input} when needed, for instance when loading third %D party libraries. -\def\doreadfile#protocol#path#name% #true #false +\let\readfilename\empty + +\def\system_files_read_file#protocol#path#name% #true #false {\edef\readfilename{\ctxcommand{getreadfilename("#protocol","#path","#name")}}% \ifx\readfilename\empty \expandafter\secondoftwoarguments \else - \expandafter\dodoreadfile + \expandafter\system_files_read_file_indeed \fi} -\long\def\dodoreadfile#true#false% +\def\system_files_read_file_indeed#true#false% {#true \relax \normalinput{\readfilename}% @@ -105,13 +107,13 @@ %D %D The most liberal is \type {\readfile}. -\unexpanded\def\readjobfile #name{\doreadfile{job} {.}{#name}} % current path, no backtracking -\unexpanded\def\readlocfile #name{\doreadfile{loc} {.}{#name}} % current path, backtracking -\unexpanded\def\readsysfile #name{\doreadfile{sys} {.}{#name}} % current path, obeys tex search -\unexpanded\def\readfixfile#path#name{\doreadfile{fix}{#path}{#name}} % specified path, backtracking -\unexpanded\def\readsetfile#path#name{\doreadfile{set}{#path}{#name}} % specified path, no backtracking -\unexpanded\def\readfile #name{\doreadfile{any} {.}{#name}} -\unexpanded\def\ReadFile #name{\doreadfile{any} {.}{#name}\donothing\donothing} +\unexpanded\def\readjobfile #name{\system_files_read_file{job} {.}{#name}} % current path, no backtracking +\unexpanded\def\readlocfile #name{\system_files_read_file{loc} {.}{#name}} % current path, backtracking +\unexpanded\def\readsysfile #name{\system_files_read_file{sys} {.}{#name}} % current path, obeys tex search +\unexpanded\def\readfixfile#path#name{\system_files_read_file{fix}{#path}{#name}} % specified path, backtracking +\unexpanded\def\readsetfile#path#name{\system_files_read_file{set}{#path}{#name}} % specified path, no backtracking +\unexpanded\def\readfile #name{\system_files_read_file{any} {.}{#name}} +\unexpanded\def\ReadFile #name{\system_files_read_file{any} {.}{#name}\donothing\donothing} %D So now we've got ourselves five file loading commands: %D @@ -124,13 +126,15 @@ %D \readsysfile {directory} {filename} {before loading} {not found} %D \stoptyping -\def\readtexfile#name#true#false% - {\pushcatcodetable \catcodetable \ctxcatcodes +\unexpanded\def\readtexfile#name#true#false% + {\pushcatcodetable + \catcodetable\ctxcatcodes \readfile{#name}{#true}{#false}% \popcatcodetable} -\def\readxmlfile#name#true#false% - {\pushcatcodetable \catcodetable \xmlcatcodes +\unexpanded\def\readxmlfile#name#true#false% + {\pushcatcodetable + \catcodetable\xmlcatcodes \readfile{#name}{#true}{#false}% \popcatcodetable} diff --git a/tex/context/base/grph-epd.mkiv b/tex/context/base/grph-epd.mkiv index eba93fcea..015298de1 100644 --- a/tex/context/base/grph-epd.mkiv +++ b/tex/context/base/grph-epd.mkiv @@ -17,22 +17,24 @@ \registerctxluafile{grph-epd}{1.001} -\def\figurereference {\ctxlua{figures.tprint("status","reference")}} +\def\figurereference{\ctxlua{figures.tprint("status","reference")}} % might become private -\defineoverlay[epdf-overlay][\directsetup{epdf-overlay}] +\defineoverlay[system:graphics:epdf][\directsetup{system:graphics:epdf}] -\startsetups epdf-overlay +\startsetups system:graphics:epdf \ctxlua{figures.mergegoodies("\@@efinteraction")}% \reference[\figurereference]{}% todo: dest area \stopsetups -\def\doaddpdffiguregoodies +\def\graphics_epdf_add_overlay {\global\setbox\foundexternalfigure\vbox\bgroup - \framed[\c!offset=\v!overlay,\c!background={\v!foreground,epdf-overlay}]{\box\foundexternalfigure}% + \framed[\c!offset=\v!overlay,\c!background={\v!foreground,system:graphics:epdf}]{\box\foundexternalfigure}% \egroup} \appendtoks - \iflocation\doif\figurefiletype{pdf}{\doifnot\@@efinteraction\v!none\doaddpdffiguregoodies}\fi + \iflocation + \doif\figurefiletype{pdf}{\doifnot\@@efinteraction\v!none\graphics_epdf_add_overlay}% + \fi \to \externalfigurepostprocessors \protect \endinput diff --git a/tex/context/base/grph-fig.mkiv b/tex/context/base/grph-fig.mkiv index b3a66eb1c..acf809ef2 100644 --- a/tex/context/base/grph-fig.mkiv +++ b/tex/context/base/grph-fig.mkiv @@ -98,9 +98,6 @@ \def\dodefineexternalfigure[#1][#2]% {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[#1][][][#2]}} -\def\getexternalfigure#1% efef has 4 args already and take an 5th - {\wait} % OBSOLETE - % \useexternalfigure[alpha][koe] % \useexternalfigure[beta] [koe] [breedte=1cm] % \useexternalfigure[gamma][koe][alpha] @@ -135,20 +132,6 @@ \def\useexternalfigure {\doquadrupleempty\douseexternalfigure} -% \def\douseexternalfigure[#1][#2][#3][#4]% -% {\doifelsenothing{#1} -% {\doifsomething{#2} -% {\doifassignmentelse{#3} -% {\setvalue{\??ef\??ef#2}{\doplaceexternalfigure[#2][#2][#3][#4]}} -% {\setvalue{\??ef\??ef#2}{\doplaceexternalfigure[#2][#2][][#4]}}}} -% {\doifelsenothing{#2} -% {\doifassignmentelse{#3} -% {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[#1][#1][][#3]}} -% {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[#1][#1][#3][#4]}}} -% {\doifassignmentelse{#3} -% {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[#1][#2][][#3]}} -% {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[#1][#2][#3][#4]}}}}} - \def\douseexternalfigure[#1][#2][#3][#4]% {\doifelsenothing{#1} {\doifsomething{#2} @@ -262,101 +245,15 @@ {\long\gdef\currentresourcecomment{#1}} \let\currentresourcecomment\empty - + \def\showexternalfigures % maybe run time command is better, but no core-run, unless figs-run ... {%\writestatus\m!system{for \string\showexternalfigures\space see \truefilename{x-res-20}.tex} \usemodule[res-20]\showexternalfigures} % so for the moment we do it this way - + \def\overlayfigure#1% {\externalfigure[#1][\c!width=\overlaywidth,\c!height=\overlayheight]} - -%D Still undocumented! No one uses it I think, better be done with layers. -% when there is need for this i'll reimplement it -% -% \newcount\efreference -% \newdimen\efxsteps -% \newdimen\efysteps -% -% \def\calculateefsteps -% {\ifnum0\@@exxmax=\zerocount -% \ifnum0\@@exymax=\zerocount -% \def\@@exymax{24}% -% \fi -% \efysteps\figureheight \divide\efysteps \@@exymax -% \efxsteps\efysteps -% \dimen0=\figurewidth -% \advance\dimen0 \efysteps -% \divide \dimen0 \efysteps -% \edef\@@exxmax{\number\dimen0}% -% \else -% \efxsteps\figurewidth \divide\efxsteps \@@exxmax -% \efysteps\figureheight \divide\efysteps \@@exymax -% \fi} -% -% \def\efcomment#1(#2,#3)#4(#5,#6)% {kader}(x,y)(h,b)[...]{tekst} -% {\def\complexefdocomment[##1]##2% -% {\position(#2,#3)% -% {\setnostrut -% \framed -% [\c!width=#5\efxsteps, -% \c!height=#6\exysteps, -% \c!offset=\v!none, -% \c!frame=#1, -% ##1]% -% {##2}}}% -% \complexorsimpleempty\efdocomment} -% -% \def\efnocomment(#1,#2)#3(#4,#5)% (x,y)(h,b)[...]{tekst} -% {\def\complexefdonocomment[##1]##2{}% -% \complexorsimpleempty\efdonocomment} -% -% \def\efdomarker(#1,#2)#3#4% (h,b){kader}{tekst} -% {\framed -% [\c!width=#1\efxsteps, -% \c!height=#2\efysteps, -% \c!offset=\v!none, -% \c!frame=#3]% -% {#4}} -% -% \def\effigure#1% -% {\position(0,0){\getvalue{#1}}} -% -% \def\efdoarea(#1,#2)#3#4% (h,b){kader}{tekst} -% {\bgroup -% \setnostrut -% \framed -% [\c!width=#1\efxsteps, -% \c!height=#2\efysteps, -% \c!offset=\!!zeropoint, -% \c!frame=#3] -% {#4}% -% \egroup} -% -% \def\efgoto(#1,#2)#3[#4]% (h,b)kader[ref] -% {\setbox0=\vbox{\efdoarea(#1,#2)#3{}}% -% \gotobox{\copy0}[#4]} -% -% \def\efmark(#1,#2)#3(#4,#5)#6[#7]% -% {\advance\efreference \plusone -% \position(#1,#2) -% {\hbox{\the\efreference}}% -% \position(#1,#2) -% {\gotosomeinternal\s!vwb{#7}\realfolio -% {\efdomarker(#4,#5)\v!on{\thisissomeinternal\s!vwa{#7}}}}} -% -% \def\eftext#1(#2,#3)#4(#5,#6)#7[#8]% -% {\advance\efreference \plusone -% \hbox -% {\quad -% \thisissomeinternal\s!vwb{#8}% -% \gotosomeinternal \s!vwa{#8}\realfolio -% {\hbox to 1.5em{\the\efreference\presetgoto\hfill}}% -% \quad#1 (#2,#3) (#5,#6) [#8]\hfill}% -% \endgraf} -% -% \def\efthisis(#1,#2)#3[#4]% -% {\efdoarea(#1,#2){#3}{\pagereference[#4]}} +%D Whatever \newbox\colorbarbox @@ -573,7 +470,6 @@ \c!maxheight=\@@efheight, \c!bodyfont=\bodyfontsize, \c!directory=, - \c!file=\f!utilityfilename.\f!figureextension, \c!radius=.5\bodyfontsize, \c!corner=\v!rectangular, \c!frame=\v!off, diff --git a/tex/context/base/grph-raw.mkiv b/tex/context/base/grph-raw.mkiv index 8b8c80e1c..5b488cf58 100644 --- a/tex/context/base/grph-raw.mkiv +++ b/tex/context/base/grph-raw.mkiv @@ -45,14 +45,14 @@ \unexpanded\def\bitmapimage[#1]#2% {\hbox\bgroup - \getparameters[@@im][\c!color=rgb,\c!width=,\c!height=,\c!x=,\c!y=,#1]% + \getparameters[\??gb][\c!color=rgb,\c!width=,\c!height=,\c!x=,\c!y=,#1]% \ctxlua{figures.bitmapimage { data = \!!bs#2\!!es, - xresolution = "\@@imx", - yresolution = "\@@imy", - colorspace = "\@@imcolor", - width = "\@@imwidth", - height = "\@@imheight" + xresolution = "\@@gbx", + yresolution = "\@@gby", + colorspace = "\@@gbcolor", + width = "\@@gbwidth", + height = "\@@gbheight" }}% \egroup} diff --git a/tex/context/base/lang-wrd.mkiv b/tex/context/base/lang-wrd.mkiv index 2fda3b344..6d8e28cd5 100644 --- a/tex/context/base/lang-wrd.mkiv +++ b/tex/context/base/lang-wrd.mkiv @@ -40,12 +40,12 @@ \newtoks\everysetupspellchecking \unexpanded\def\setupspellchecking[#1]% todo colors - {\getparameters[\??wl][#1]% + {\getparameters[\??lw][#1]% \the\everysetupspellchecking} \appendtoks - \doifelse\@@wlstate\v!start - {\ctxlua{languages.words.enable { method = "\@@wlmethod", list = "\@@wllist" }}} + \doifelse\@@lwstate\v!start + {\ctxlua{languages.words.enable { method = "\@@lwmethod", list = "\@@lwlist" }}} {\ctxlua{languages.words.disable()}}% \to \everysetupspellchecking diff --git a/tex/context/base/luat-cod.mkiv b/tex/context/base/luat-cod.mkiv index a58a81599..930532df9 100644 --- a/tex/context/base/luat-cod.mkiv +++ b/tex/context/base/luat-cod.mkiv @@ -15,12 +15,22 @@ \unprotect +%D We have this one for a rather long time now but nowadays \ETEX\ +%D provides a command with the same name and different meaning. That +%D one is available as \type {\normalexpanded}. + \long\def\expanded#1{\long\xdef\lastexpanded{\noexpand#1}\lastexpanded} -%long\def\expanded#1{\normalexpanded{\noexpand#1}} % compatible ## mess + +%D We cannot use the following due to the fact that existing usage +%D demanded duplicating hashes. +%D +%D \starttyping +%D \def\expanded#1{\normalexpanded{\noexpand#1}} % ## mess +%D \stoptyping \newif\ifproductionrun -%D Originally we compiled the lua files externally and loaded +%D Originally we compiled the \LUA\ files externally and loaded %D then at runtime, but when the amount grew, we realized that %D we needed away to store them in the format, which is what %D bytecode arrays do. And so the following is obsolete: diff --git a/tex/context/base/luat-ini.mkiv b/tex/context/base/luat-ini.mkiv index 1be2720b6..cfb15c2b4 100644 --- a/tex/context/base/luat-ini.mkiv +++ b/tex/context/base/luat-ini.mkiv @@ -21,38 +21,42 @@ %D we keep outside the format. We will keep code outside \TEX\ files as %D much as possible. -\ifx\setnaturalcatcodes\undefined \let\setnaturalcatcodes\relax \fi -\ifx\obeylualines \undefined \let\obeylualines \relax \fi -\ifx\obeyluatokens \undefined \let\obeyluatokens \relax \fi +\ifdefined\setnaturalcatcodes \else \let\setnaturalcatcodes\relax \fi +\ifdefined\obeylualines \else \let\obeylualines \relax \fi +\ifdefined\obeyluatokens \else \let\obeyluatokens \relax \fi %D A few more goodies: -\long\def\dostartlua +\unexpanded\def\startlua {\system_start_lua } \let\stoplua \relax % tex catcodes +\unexpanded\def\startluacode{\system_start_lua_code} \let\stopluacode\relax % lua catcodes + +% It might makes sense to have a \type {\directelua} so that we can avoid +% the \type {\normalexpanded} around \type {\directlua}. Something to discuss +% in the team. + +\def\system_start_lua {\begingroup \obeylualines - \dodostartlua} + \system_start_lua_indeed} -\long\def\dodostartlua#1\stoplua +\def\system_start_lua_indeed#1\stoplua {\normalexpanded{\endgroup\noexpand\directlua\zerocount{#1}}} -\long\def\dostartluacode +\def\system_start_lua_code {\begingroup \obeylualines \obeyluatokens - \dodostartluacode} + \system_start_lua_code_indeed} -\long\def\dodostartluacode#1\stopluacode +\def\system_start_lua_code_indeed#1\stopluacode {\normalexpanded{\endgroup\noexpand\directlua\zerocount{#1}}} -\unexpanded\def\startlua {\dostartlua } \let\stoplua \relax % tex catcodes -\unexpanded\def\startluacode{\dostartluacode} \let\stopluacode\relax % lua catcodes - %D Some delayed definitions: -\ifx\obeylines \undefined \let\obeylines \relax \fi -\ifx\obeyedline \undefined \let\obeyedline \relax \fi -\ifx\obeyspaces \undefined \let\obeyspaces \relax \fi -\ifx\obeyedspace \undefined \let\obeyedspace \relax \fi +\ifdefined\obeylines \else \let\obeylines \relax \fi +\ifdefined\obeyedline \else \let\obeyedline \relax \fi +\ifdefined\obeyspaces \else \let\obeyspaces \relax \fi +\ifdefined\obeyedspace \else \let\obeyedspace \relax \fi \let\obeylualines\relax @@ -91,7 +95,7 @@ \to \everyluacode \def\obeyluatokens - {\setcatcodetable \luacatcodes + {\setcatcodetable\luacatcodes \the\everyluacode} %D \macros @@ -104,19 +108,19 @@ %D Beware: because \type {\expanded} is een convert command, the error %D message will show \type{<inserted text>} as part of the message. -\long\def\dostartnamedluacode#1% +\def\system_start_named_lua_code#1% {\begingroup \obeylualines \obeyluatokens - \csname dodostartnamed#1\v!code\endcsname} + \csname\??lu:c:#1\endcsname} \unexpanded\def\definenamedlua[#1]#2[#3]% no optional arg handling here yet - {\ifcsname dodostartnamed#1\v!code\endcsname\else + {\ifcsname\??lu:c:#1\endcsname \else \scratchcounter\ctxlua{lua.registername("#1","#3")}% - \normalexpanded{\long\edef\csname dodostartnamed#1\v!code\endcsname##1\csname\e!stop#1\v!code\endcsname}% + \normalexpanded{\edef\csname\??lu:c:#1\endcsname##1\csname\e!stop#1\v!code\endcsname}% {\endgroup\noexpand\directlua\the\scratchcounter{protect("#1\s!data")##1}}% - \long\expandafter\def \csname\e!start#1\v!code\endcsname {\dostartnamedluacode{#1}}% - \long\expandafter\edef\csname #1\v!code\endcsname##1{\noexpand\directlua\the\scratchcounter{protect("#1\s!data")##1}}% + \expandafter\def \csname\e!start#1\v!code\endcsname {\system_start_named_lua_code{#1}}% + \expandafter\edef\csname #1\v!code\endcsname##1{\noexpand\directlua\the\scratchcounter{protect("#1\s!data")##1}}% \fi} %D We predefine a few. @@ -192,12 +196,14 @@ {\begingroup \obeylualines \obeyluatokens - \dostartluaparameterset{#1}} + \system_start_lua_parameter_set{#1}} -\long\def\dostartluaparameterset#1#2\stopluaparameterset +\def\system_start_lua_parameter_set#1#2\stopluaparameterset {\ctxlua{parametersets["#1"]={#2}}% \endgroup} +\let\stopluaparameterset\relax + \def\luaparameterset#1#2{\ctxlua{parametersets["#1"]={#2} context("#1")}} % todo: \mergeparameterset @@ -225,17 +231,19 @@ %D \ctxluacode{context("%0.5f",1/3)} %D \stoptyping -\long\def\ctxluacode +\unexpanded\def\ctxluacode {\begingroup \obeylualines \obeyluatokens \catcode\leftbraceasciicode \plusone \catcode\rightbraceasciicode\plustwo - \afterassignment\doctxluacode + \afterassignment\system_lua_code \scratchtoks=} -\def\doctxluacode - {\normalexpanded{\endgroup\noexpand\directlua\zerocount\expandafter{\the\scratchtoks}}} +% Hm, are we sure that the \* commands work out okay here? We could probably +% use \setcatcodetable\luacatcodes instead of \obeyluatokens now. +\def\system_lua_code + {\normalexpanded{\endgroup\noexpand\directlua\zerocount\expandafter{\the\scratchtoks}}} \protect \endinput diff --git a/tex/context/base/m-quest.tex b/tex/context/base/m-quest.tex deleted file mode 100644 index 596abaa0a..000000000 --- a/tex/context/base/m-quest.tex +++ /dev/null @@ -1,232 +0,0 @@ -%D \module -%D [ file=m-invull, -%D version=1995.01.10, -%D title=\CONTEXT\ Extra Modules, -%D subtitle=Exercise, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -%I Invuloefeningen kunnen worden vormgegeven met het -%I de commando's: -%I -%I \definieerinvulwoord[trefwoord]{woord,woord} -%I \invulwoord[trefwoord] -%I \invulwoord{woord,woord,...} -%I -%I Daarbij kan het een en ander worden ingesteld met -%I -%I \stelinvullenin[status=,nummer=,links=,rechts=,letter=] -%P -%I Er zijn drie manieren om woorden in te vullen. De meest -%I eenvoudige is die waarbij de in te vullen woorden in de -%I tekst staan. -%I -%I bla bla \invulwoord{een,alfa} bla bla bla bla bla bla -%I bla bla bla bla bla bla bla bla \invulwoord{twee,beta}. -%I -%I De gezette tekst hangt af van de instellingen: -%I -%I [status=leeg] ________ -%I [status=vol,nummer=1] 'een' respectievelijk 'twee' -%I [status=vol,nummer=2] 'alfa' respectievelijk 'beta' -%I -%I Het nummer heeft dus betrekking op het volgnummer in de -%I opgegeven reeks. -%P -%I Bij de tweede manier worden eerste de alternatieven -%I gedefinieerd: -%I -%I \definieerinvulwoord{een,alfa} -%I \definieerinvulwoord{twee,beta} -%I -%I die vervolgens worden opgeroepen: -%I -%I bla \invulwoord[+] bla bla bla bla bla bla bla bla bla -%I bla bla bla bla bla bla bla bla bla bla \invulwoord[+]. -%I -%I De mogelijke instellingen komen overeen met die van de -%I eerste manier. -%P -%I De derde manier is een variant op de tweede. Bij grote -%I teksten kan men het overzicht kwijtraken. Het is daarom -%I mogelijk 'logische' namen toe te kennen aan woorden. -%I -%I \definieerinvulwoord[a]{een,alfa} -%I \definieerinvulwoord[b]{twee,beta} -%I -%I die vervolgens worden opgeroepen: -%I -%I bla \invulwoord[a] bla bla bla bla bla bla bla bla bla -%I bla bla bla bla bla bla bla bla bla bla \invulwoord[b]. -%I -%I Dit maakt het bovendien mogelijk woorden meerdere malen -%I (in een willekeurige volgorde op te roepen: -%I -%I bla \invulwoord[a] bla \invulwoord[b] bla bla bla bla -%I bla bla bla bla \invulwoord[b] bla bla \invulwoord[a]. -%P -%I Bij [status=leeg] wordt een streep gezet die in breedte -%I overeenkomt met het woord dat er eigenlijk hoort te -%I staan. De ingevulde tekst komt visueel daardoor overeen -%I met de in te vullen tekst, wat vergelijken vereenvoudigd. -%I -%I Met [status=reset] worden enkele tellers weer op 0 gezet. -%I Dit kan nodig zijn als meerdere invuloefeningen in een -%I tekst worden gezet. -%I -%I Als \versie[voorlopig] is ingesteld, worden bij invullers -%I zonder logische namen tussen haakjes de volgnummers -%I getoond. - -%S \startsetup -%S \command -%S [stelinvullenin] -%S \type -%S [\c!vars!] -%S \variable -%S [\c!letter] -%S [\v!normaal,\v!vet,\v!schuin,\v!vetschuin,\v!type,\v!kap, -%S \v!klein...,\c!command!] -%S [\v!vet] -%S \variable -%S [\c!links] -%S [\c!text!] -%S [] -%S \variable -%S [\c!rechts] -%S [\c!text!] -%S [] -%S \variable -%S [\c!status] -%S [\v!leeg,\v!vol,\v!reset] -%S [\v!vol] -%S \variable -%S [\c!nummer] -%S [\c!number!] -%S [1] -%S \variable -%S [\c!lijn] -%S [\v!aan,\v!uit] -%S [\v!aan] -%S \stopsetup - -%S \startsetup -%S \command -%S [invulwoord] -%S \type -%S [\c!ref!,\c!opt!\c!val!\c!opt!\c!args!] -%S \value -%S [\c!text!] -%S \stopsetup - -%S \startsetup -%S \command -%S [definieerinvulwoord] -%S \type -%S [\c!ref!,\c!opt!\c!val!\c!args!] -%S \value -%S [\c!text!] -%S \stopsetup - -% Mogelijke uitbreidingen -% -% - [breedte=<maat>,passend,ruim] -% - invullijst met nummers -% - weergeven lijst tijdens definitie blokkeren -% - door elkaar definieren - -\unprotect - -\definesystemvariable {iv} - -\definereferenceconstant {fillin} {:iv:} - -\newcount\invulteller \newcount\invulput \newcount\invulget - -\def\stelinvullenin - {\dosingleargument\dostelinvullenin} - -\def\dostelinvullenin[#1]% - {\getparameters[\??iv][#1]% - \doif\@@ivstate\v!reset - {\global\invulput\zerocount - \global\invulget\zerocount - \let\@@ivstate\empty}} - -\def\definieerinvulwoord - {\dosingleempty\dodefinieerinvulwoord} - -\def\dodefinieerinvulwoord[#1]#2% - {\iffirstargument - \setgvalue{\r!fillin#1}{\simpleinvulwoord{#2}}% - \else - \global\advance\invulput \plusone - \setgvalue{\r!fillin\the\invulput}{\simpleinvulwoord{#2}}% - \fi - \doifconcepttracing - {\ifnum\invulput>\zerocount - \setbox\scratchbox\hbox{~\ttx(\the\invulput)}% - \wd\scratchbox\zeropoint - \box\scratchbox - \par - \fi}} - -\def\dosimpleinvulwoord#1% - {\ifnum\@@ivnumber>\zerocount \advance\invulteller \plusone \fi - \ifnum\invulteller=\@@ivnumber\relax - \bgroup - \doconvertfont\@@ivstyle - {\@@ivleft - \doifelse\@@ivstate\v!empty - {\doifelse\@@ivrule\v!on\leeginvulwoord\geeninvulwoord} - {\doifelse\@@ivrule\v!on\underbar \firstofoneargument}% - {#1}% - \@@ivright}% - \egroup - \fi}% - -\def\simpleinvulwoord#1% - {\ifnum\@@ivnumber>0 - \invulteller\zerocount - \processcommalist[#1]\dosimpleinvulwoord - \else - \dosimpleinvulwoord{#1}% - \fi} - -\def\complexinvulwoord[#1]% - {\bgroup - \doifsomething{#1} - {\global\advance\invulget \plusone - \doconvertfont\@@ivstyle - {\@@ivleft\getvalue{\r!fillin\the\invulget}\@@ivright}} - {\doconvertfont\@@ivstyle - {\@@ivleft\getvalue{\r!fillin #1}\@@ivright}}% - \egroup} - -\definecomplexorsimple\invulwoord - -\def\leeginvulwoord#1% - {{\let\redounderbar\dodounderbar - \def\dodounderbar##1{\redounderbar{\hphantom{##1}}}% - \underbar{#1}}} - -\def\geeninvulwoord#1% - {{\def\dodounderbar##1{\hphantom{##1}}% - \underbar{#1}}} - -% when nummer > 0, then commalist processing; beware of $(1,2)$, use { } there - -\stelinvullenin - [\c!number=0, - \c!style=\v!bold, - \c!rule=\v!on, - \c!left=, - \c!right=, - \c!state=] - -\protect \endinput diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv index 4cef621fd..902f88f45 100644 --- a/tex/context/base/mult-aux.mkiv +++ b/tex/context/base/mult-aux.mkiv @@ -75,45 +75,45 @@ % and normally don't do testing of them making sense. % % \testfeatureonce{100000}{\getparameters[bla][a=111,b=222,c=333]}% 1.669s -% \testfeatureonce{100000}{\get_parameters{bla} [a=111,b=222,c=333]}% 1.529s -% \testfeatureonce{100000}{\def\current_parameter_namespace{bla}\get_parameters_indeed[a=111,b=222,c=333]}% 1.466s +% \testfeatureonce{100000}{\interfaces_get_parameters{bla} [a=111,b=222,c=333]}% 1.529s +% \testfeatureonce{100000}{\def\current_parameter_namespace{bla}\interfaces_get_parameters_indeed[a=111,b=222,c=333]}% 1.466s % % \get_parameter {...} [...] % \def\current_parameter_namespace{...} \get_parameter_indeed[...] -\def\get_parameters#1[#2% +\def\interfaces_get_parameters#1[#2% {\if\noexpand#2]% \expandafter\gobbleoneargument \else \def\current_parameter_namespace{#1}% - \expandafter\get_parameters_indeed + \expandafter\interfaces_get_parameters_indeed \fi#2} -% \def\get_parameters#1% we can assume that the test already happened +% \def\interfaces_get_parameters#1% we can assume that the test already happened % {\def\current_parameter_namespace{#1}% -% \get_parameters_indeed} +% \interfaces_get_parameters_indeed} -\def\get_parameters_indeed#1]% namespace already set - {\get_parameters_item#1,],\@relax@} +\def\interfaces_get_parameters_indeed#1]% namespace already set + {\interfaces_get_parameters_item#1,],\@relax@} -\def\get_parameters_item#1,#2% #2 takes space before , +\def\interfaces_get_parameters_item#1,#2% #2 takes space before , {\if,#1,% dirty trick for testing #1=empty - \expandafter\get_parameters_item + \expandafter\interfaces_get_parameters_item \else\if]#1% \doubleexpandafter\gobbleoneargument \else - \get_parameters_assign#1==\empty\@relax@ - \doubleexpandafter\get_parameters_item + \interfaces_get_parameters_assign#1==\empty\@relax@ + \doubleexpandafter\interfaces_get_parameters_item \fi\fi#2} -\def\get_parameters_error#1#2#3% +\def\interfaces_get_parameters_error#1#2#3% {\showassignerror{#2}{\the\inputlineno\space(#1)}} -\def\get_parameters_assign#1=#2=#3#4\@relax@ +\def\interfaces_get_parameters_assign#1=#2=#3#4\@relax@ {\ifx\empty#1\empty - \expandafter\get_parameters_error + \expandafter\interfaces_get_parameters_error \else\ifx#3\empty - \doubleexpandafter\get_parameters_error + \doubleexpandafter\interfaces_get_parameters_error \else \doubleexpandafter\dosetvalue \fi\fi @@ -121,7 +121,7 @@ % End of experimental code. -\unexpanded\def\doinstallparameterhandler#1#2#3#4#5#6#7#8#9% inlining \csname*\endcsname is more efficient (#3 and #6 only) +\unexpanded\def\interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9% inlining \csname*\endcsname is more efficient (#3 and #6 only) {\ifx#2\relax\let#2\empty\fi % it is hardly faster but produces less expansion tracing %\def#3##1{\csname#4{#1#2}{##1}\endcsname}% \def#3##1{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}% @@ -135,7 +135,7 @@ \unexpanded\def\installparameterhandler#1#2% {\normalexpanded - {\doinstallparameterhandler + {\interfaces_install_parameter_handler {\noexpand#1}% \??aa \expandafter\noexpand\csname current#2\endcsname \expandafter\noexpand\csname #2parameter\endcsname @@ -146,18 +146,18 @@ \expandafter\noexpand\csname strict#2parameter\endcsname % checked \expandafter\noexpand\csname direct#2parameter\endcsname}} % unchecked -\unexpanded\def\doinstallrootparameterhandler#1#2#3% +\unexpanded\def\interfaces_install_root_parameter_handler#1#2#3% {\def#2##1{\detokenize\expandafter\expandafter\expandafter{\csname#1:##1\endcsname}}% always root \def#3##1{\csname\ifcsname#1:##1\endcsname#1:##1\else\s!empty\fi\endcsname}} \unexpanded\def\installrootparameterhandler#1#2% {\normalexpanded - {\doinstallrootparameterhandler + {\interfaces_install_root_parameter_handler {\noexpand#1}% \??aa \expandafter\noexpand\csname detokenizedroot#2parameter\endcsname \expandafter\noexpand\csname root#2parameter\endcsname}} -\unexpanded\def\doinstallparameterhashhandler#1#2#3#4#5#6#7#8#9% +\unexpanded\def\interfaces_install_parameter_hash_handler#1#2#3#4#5#6#7#8#9% {\ifx#2\relax\let#2\empty\fi \def#3##1{#4{#1#2}{##1}:}% \def#4##1##2{\ifcsname##1:##2\endcsname##1\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}% @@ -169,7 +169,7 @@ \unexpanded\def\installparameterhashhandler#1#2% {\normalexpanded - {\doinstallparameterhashhandler + {\interfaces_install_parameter_hash_handler {\noexpand#1}% \??aa \expandafter\noexpand\csname current#2\endcsname \expandafter\noexpand\csname #2parameterhash\endcsname @@ -180,7 +180,10 @@ \expandafter\noexpand\csname check#2parent\endcsname \expandafter\noexpand\csname chaintocurrent#2\endcsname}} -\unexpanded\def\doinstallparametersethandler#1#2#3#4#5% we can speed this up for english +% In \MKIV\ we can probably use the english variant for all other +% languages too. + +\unexpanded\def\interfaces_install_parameter_set_handler#1#2#3#4#5% we can speed this up for english {\ifx#2\relax\let#2\empty\fi \unexpanded\def#3{\dosetvalue{#1#2:}}% ##1 {##2} (braces are mandate) \unexpanded\def#4{\doletvalue{#1#2:}}% ##1 ##2 @@ -188,7 +191,7 @@ \startinterface english - \unexpanded\def\doinstallparametersethandler#1#2#3#4#5% + \unexpanded\def\interfaces_install_parameter_set_handler#1#2#3#4#5% {\ifx#2\relax\let#2\empty\fi \unexpanded\def#3##1{\expandafter\def\csname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate) \unexpanded\def#4##1{\expandafter\let\csname#1#2:##1\endcsname}% ##1 ##2 @@ -198,7 +201,7 @@ \unexpanded\def\installparametersethandler#1#2% {\normalexpanded - {\doinstallparametersethandler + {\interfaces_install_parameter_set_handler {\noexpand#1}% \??aa \expandafter\noexpand\csname current#2\endcsname \expandafter\noexpand\csname set#2parameter\endcsname @@ -211,7 +214,7 @@ \let\currentstyleparameter\empty \let\currentcolorparameter\empty -\unexpanded\def\doinstallstyleandcolorhandler#1#2#3#4% +\unexpanded\def\interfaces_install_style_and_color_handler#1#2#3#4% {\unexpanded\def#2##1##2% style color {\edef\currentstyleparameter{#1{##1}}% this name is public \edef\currentcolorparameter{#1{##2}}% this name is public @@ -226,7 +229,7 @@ \unexpanded\def\installstyleandcolorhandler#1#2% {\normalexpanded - {\doinstallstyleandcolorhandler + {\interfaces_install_style_and_color_handler \expandafter\noexpand\csname #2parameter\endcsname \expandafter\noexpand\csname use#2styleandcolor\endcsname % maybe an alias use#2styleandcolorparameters \expandafter\noexpand\csname use#2styleparameter\endcsname @@ -234,7 +237,7 @@ \let\definehandlerparent\empty -\unexpanded\def\doinstalldefinehandler#1#2#3#4#5#6#7#8% +\unexpanded\def\interfaces_install_define_handler#1#2#3#4#5#6#7#8% {\ifx#4\relax\let#4\empty\fi \unexpanded\def#2{\dotripleempty#5}% \newtoks#6% @@ -246,26 +249,26 @@ \ifthirdargument \edef#8{##2}% % \getparameters[#1#4:][\s!parent=#1##2,##3]% - \get_parameters{#1#4:}[\s!parent=#1##2,##3]% + \interfaces_get_parameters{#1#4:}[\s!parent=#1##2,##3]% \else\ifsecondargument \doifassignmentelse{##2} {\let#8\empty % \getparameters[#1#4:][\s!parent=#3,##2]} - \get_parameters{#1#4:}[\s!parent=#3,##2]} + \interfaces_get_parameters{#1#4:}[\s!parent=#3,##2]} {\edef#8{##2}% % \getparameters[#1#4:][\s!parent=#1##2]}% - \get_parameters{#1#4:}[\s!parent=#1##2]}% + \interfaces_get_parameters{#1#4:}[\s!parent=#1##2]}% \else \let#8\empty % \getparameters[#1#4:][\s!parent=#3]% - \get_parameters{#1#4:}[\s!parent=#3]% + \interfaces_get_parameters{#1#4:}[\s!parent=#3]% \fi\fi \the#7% \let#4\saveddefinewhatever}} \unexpanded\def\installdefinehandler#1#2#3% {\normalexpanded - {\doinstalldefinehandler + {\interfaces_install_define_handler {\noexpand#1}% \??aa \expandafter\noexpand\csname define#2\endcsname {\noexpand#3}% root @@ -275,11 +278,11 @@ \expandafter\noexpand\csname everydefine#2\endcsname \expandafter\noexpand\csname current#2parent\endcsname}} -\unexpanded\def\doinstallsetuphandler#1#2#3#4#5#6% +\unexpanded\def\interfaces_install_setup_handler#1#2#3#4#5#6% {\ifx#3\relax\let#3\empty\fi \unexpanded\def#2{\dodoubleempty#4}% % \unexpanded\def#6{\getparameters[#1#3:]}% no every ! don't change it - \unexpanded\def#6{\get_parameters{#1#3:}}% no every ! don't change it + \unexpanded\def#6{\interfaces_get_parameters{#1#3:}}% no every ! don't change it \newtoks#5% \def#4[##1][##2]% maybe helper {\let\savedsetupwhatever#3% @@ -287,20 +290,20 @@ \def\docommand####1% we will have a simple one as well {\edef#3{####1}% % \getparameters[#1#3:][##2]% - \get_parameters{#1#3:}[##2]% + \interfaces_get_parameters{#1#3:}[##2]% \the#5}% \processcommalist[##1]\docommand \else \let#3\empty % \getparameters[#1:][##1]% - \get_parameters{#1:}[##1]% + \interfaces_get_parameters{#1:}[##1]% \the#5% \fi \let#3\savedsetupwhatever}} \unexpanded\def\installsetuphandler#1#2% {\normalexpanded - {\doinstallsetuphandler + {\interfaces_install_setup_handler {\noexpand#1}% \??aa \expandafter\noexpand\csname setup#2\endcsname \expandafter\noexpand\csname current#2\endcsname @@ -308,18 +311,18 @@ \expandafter\noexpand\csname everysetup#2\endcsname \expandafter\noexpand\csname setupcurrent#2\endcsname}} -\unexpanded\def\doinstallswitchsetuphandler#1#2#3#4#5#6% +\unexpanded\def\interfaces_install_switch_setup_handler#1#2#3#4#5#6% {\ifx#3\relax\let#3\empty\fi \unexpanded\def#2{\dodoubleempty#4}% % \unexpanded\def#6{\getparameters[#1#3:]}% - \unexpanded\def#6{\get_parameters{#1#3:}}% + \unexpanded\def#6{\interfaces_get_parameters{#1#3:}}% \newtoks#5% \def#4[##1][##2]% maybe helper {\ifsecondargument % no commalist here \let\savedsetupwhatever#3% \edef#3{##1}% % \getparameters[#1#3:][##2]% - \get_parameters{#1#3:}[##2]% + \interfaces_get_parameters{#1#3:}[##2]% \the#5% \let#3\savedsetupwhatever \else\iffirstargument @@ -327,7 +330,7 @@ {\let\savedsetupwhatever#3% \let#3\empty % \getparameters[#1:][##1]% - \get_parameters{#1:}[##1]% + \interfaces_get_parameters{#1:}[##1]% \the#5% \let#3\savedsetupwhatever} {\edef#3{##1}% this will catch reset @@ -339,7 +342,7 @@ \unexpanded\def\installswitchsetuphandler#1#2% {\normalexpanded - {\doinstallswitchsetuphandler + {\interfaces_install_switch_setup_handler {\noexpand#1}% \??aa \expandafter\noexpand\csname setup#2\endcsname \expandafter\noexpand\csname current#2\endcsname @@ -347,11 +350,11 @@ \expandafter\noexpand\csname everysetup#2\endcsname \expandafter\noexpand\csname setupcurrent#2\endcsname}} -\unexpanded\def\doinstallautosetuphandler#1#2#3#4#5#6#7% +\unexpanded\def\interfaces_install_auto_setup_handler#1#2#3#4#5#6#7% {\ifx#3\relax\let#3\empty\fi \unexpanded\def#2{\dotripleempty#4}% % \unexpanded\def#6{\getparameters[#1#3:]}% - \unexpanded\def#6{\get_parameters{#1#3:}}% + \unexpanded\def#6{\interfaces_get_parameters{#1#3:}}% \newtoks#5% \def#4[##1][##2][##3]% {\let\savedsetupwhatever#3% @@ -359,7 +362,7 @@ \def\docommand####1% {\edef#3{####1}% % \getparameters[#1#3:][\s!parent=#1##2,##3]% - \get_parameters{#1#3:}[\s!parent=#1##2,##3]% always sets parent + \interfaces_get_parameters{#1#3:}[\s!parent=#1##2,##3]% always sets parent \the#5}% \processcommalist[##1]\docommand \else\ifsecondargument @@ -367,20 +370,20 @@ {\edef#3{####1}% #7% checks parent and sets if needed % \getparameters[#1#3:][##2]% - \get_parameters{#1#3:}[##2]% + \interfaces_get_parameters{#1#3:}[##2]% \the#5}% \processcommalist[##1]\docommand \else \let#3\empty % \getparameters[#1:][##1]% - \get_parameters{#1:}[##1]% + \interfaces_get_parameters{#1:}[##1]% \the#5% \fi\fi \let#3\savedsetupwhatever}} \unexpanded\def\installautosetuphandler#1#2% {\normalexpanded - {\doinstallautosetuphandler + {\interfaces_install_auto_setup_handler {\noexpand#1}% \??aa \expandafter\noexpand\csname setup#2\endcsname \expandafter\noexpand\csname current#2\endcsname @@ -462,9 +465,9 @@ % \stoptext \unexpanded\def\definenamespace - {\dodoubleargument\dodefinenamespace} + {\dodoubleargument\interfaces_define_name_space} -\def\dodefinenamespace[#1][#2]% namespace settings +\def\interfaces_define_name_space[#1][#2]% namespace settings {\ctxlua{interfaces.namespaces.define(\!!bs#1\!!es,\!!bs#2\!!es)}} \def\listnamespaces @@ -476,15 +479,15 @@ %D \showparentchain{@@am}{left} %D \stoptyping -\def\doshowparentchain#1% +\def\showparentchain#1#2% + {\writestatus\m!system{chain: [ \interfaces_show_parent_chain{#1#2}]}} + +\def\interfaces_show_parent_chain#1% {#1 => % \ifcsname#1:\s!parent\endcsname - \expandafter\doshowparentchain\csname#1:\s!parent\endcsname + \expandafter\interfaces_show_parent_chain\csname#1:\s!parent\endcsname \fi} -\def\showparentchain#1#2% - {\writestatus\m!system{chain: [ \doshowparentchain{#1#2}]}} - %D Conventions: %D %D \starttyping diff --git a/tex/context/base/mult-chk.lua b/tex/context/base/mult-chk.lua index 0c8d87a61..43e7c5121 100644 --- a/tex/context/base/mult-chk.lua +++ b/tex/context/base/mult-chk.lua @@ -51,11 +51,14 @@ end local prefix, category, keys +local setsomevalue = context.setsomevalue +local invalidkey = interfaces.invalidkey + local function set(key,value) if keys and not keys[key] then - interfaces.invalidkey(category,key) + invalidkey(category,key) else - context.setsomevalue(prefix,key,value) + setsomevalue(prefix,key,value) end end diff --git a/tex/context/base/mult-chk.mkiv b/tex/context/base/mult-chk.mkiv index e3a6a4c54..fc9950fda 100644 --- a/tex/context/base/mult-chk.mkiv +++ b/tex/context/base/mult-chk.mkiv @@ -35,38 +35,38 @@ \registerctxluafile{mult-chk}{1.001} -\def\setvalidparameterkeys{\dodoubleargument\dosetvalidparameterkeys} -\def\addvalidparameterkeys{\dodoubleargument\doaddvalidparameterkeys} +\def\setvalidparameterkeys{\dodoubleargument\interfaces_set_valid_parameter_keys} +\def\addvalidparameterkeys{\dodoubleargument\interfaces_add_valid_parameter_keys} -\def\dosetvalidparameterkeys[#1][#2]{\ctxlua{interfaces.setvalidkeys("#1",\!!bs#2\!!es)}} -\def\doaddvalidparameterkeys[#1][#2]{\ctxlua{interfaces.addvalidkeys("#1",\!!bs#2\!!es)}} +\def\interfaces_set_valid_parameter_keys[#1][#2]{\ctxlua{interfaces.setvalidkeys("#1",\!!bs#2\!!es)}} +\def\interfaces_add_valid_parameter_keys[#1][#2]{\ctxlua{interfaces.addvalidkeys("#1",\!!bs#2\!!es)}} -\def\getcheckedparametersyes[#1]#2[#3]#4[#5% +\def\interfaces_get_checked_parameters_yes[#1]#2[#3]#4[#5% {\if\noexpand#5]% \expandafter\gobblethreearguments \else - \let\setsomevalue\dosetvalue - \expandafter\dogetcheckedparametersyes + \let\setsomevalue\dosetvalue % used at the lua end + \expandafter\interfaces_get_checked_parameters_yes_indeed \fi{#1}{#3}#5} -\def\dogetcheckedparametersyes#1#2#3]% +\def\interfaces_get_checked_parameters_yes_indeed#1#2#3]% %{\ctxlua{_igcp_("#1","#2",\!!bs\detokenize{#3}\!!es)}} {\ctxlua{interfaces.getcheckedparameters("#1","#2",\!!bs\detokenize{#3}\!!es)}} -\def\getcheckedparametersnop[#1]#2[#3]#4[#5% +\def\interfaces_get_checked_parameters_nop[#1]#2[#3]#4[#5% {\if\noexpand#5]% \expandafter\gobbletwoarguments \else - \let\setsomevalue\dosetvalue - \expandafter\dogetcheckedparametersnop + \let\setsomevalue\dosetvalue % used at the lua end + \expandafter\interfaces_get_checked_parameters_nop_indeed \fi{#3}#5} -\def\dogetcheckedparametersnop#1#2]% +\def\interfaces_get_checked_parameters_nop_indeed#1#2]% {\def\p!dogetparameter{\p!doassign#1}% \xprocesscommaitem#2,],\@relax@} -\def\disablecheckparameters{\let\getcheckedparameters\getcheckedparametersnop} -\def\enablecheckparameters {\let\getcheckedparameters\getcheckedparametersyes} +\def\disablecheckparameters{\let\getcheckedparameters\interfaces_get_checked_parameters_nop} +\def\enablecheckparameters {\let\getcheckedparameters\interfaces_get_checked_parameters_yes} \disablecheckparameters diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv index a09809cf7..5e9a94554 100644 --- a/tex/context/base/mult-def.mkiv +++ b/tex/context/base/mult-def.mkiv @@ -13,17 +13,17 @@ \unprotect -\setvalue{@interface@czech@}{cs} -\setvalue{@interface@german@}{de} -\setvalue{@interface@english@}{en} -\setvalue{@interface@french@}{fr} -\setvalue{@interface@italian@}{it} -\setvalue{@interface@dutch@}{nl} -\setvalue{@interface@persian@}{pe} -\setvalue{@interface@romanian@}{ro} +\setvalue{\??mi :czech}{cs} +\setvalue{\??mi :german}{de} +\setvalue{\??mi :english}{en} +\setvalue{\??mi :french}{fr} +\setvalue{\??mi :italian}{it} +\setvalue{\??mi :dutch}{nl} +\setvalue{\??mi :persian}{pe} +\setvalue{\??mi:romanian}{ro} -\def\userinterfacetag{\ifcsname @interface@\currentinterface @\endcsname\csname @interface@\currentinterface @\endcsname\else en\fi} -\def\userresponsestag{\ifcsname @interface@\currentresponses @\endcsname\csname @interface@\currentresponses @\endcsname\else en\fi} +\def\userinterfacetag{\ifcsname\??mi:\currentinterface\endcsname\csname\??mi\currentinterface\endcsname\else en\fi} +\def\userresponsestag{\ifcsname\??mi:\currentresponses\endcsname\csname\??mi\currentresponses\endcsname\else en\fi} % \input mult-\userinterfacetag \relax % \input mult-m\userresponsestag \relax diff --git a/tex/context/base/mult-ini.mkiv b/tex/context/base/mult-ini.mkiv index 0d325e1e0..5f20bec15 100644 --- a/tex/context/base/mult-ini.mkiv +++ b/tex/context/base/mult-ini.mkiv @@ -173,7 +173,7 @@ %D \definefileconstant {name} {meaning} %D \stoptyping -\unexpanded\def\definereferenceconstant #1#2{\expandafter\def\csname\r!prefix!#1\endcsname{#2}} +\unexpanded\def\definereferenceconstant #1#2{\expandafter\def\csname\r!prefix!#1\endcsname{#2}} % obsolete \unexpanded\def\definefileconstant #1#2{\expandafter\def\csname\f!prefix!#1\endcsname{#2}} %D A new one: @@ -218,39 +218,39 @@ %D not ask for interface specifications when these are already %D defined (like in cont-nl.tex and alike). -\ifx\defaultinterface\undefined +\ifdefined\defaultinterface + + \def\selectinterface + {\writestatus{interface}{defining \currentinterface\space interface}% + \writeline + \writestatus{interface}{using \currentresponses\space messages}% + \writeline + \let\selectinterface\relax} + +\else \def\defaultinterface{english} \def\selectinterface - {\def\docommand##1##2% + {\def\selectinterface##1##2% {\bgroup \endlinechar\minusone \global\read16 to ##1 \egroup \doifnothing\currentinterface{\let##1=##2}% \doifundefined{\s!prefix!##1}{\let##1=##2}}% - \docommand\currentinterface\defaultinterface + \selectinterface\currentinterface\defaultinterface \writestatus{interface}{defining \currentinterface\space interface}% \writeline - \docommand\currentresponses\currentinterface + \selectinterface\currentresponses\currentinterface \writestatus{interface}{using \currentresponses\space messages}% \writeline \let\selectinterface\relax} -\else - - \def\selectinterface - {\writestatus{interface}{defining \currentinterface\space interface}% - \writeline - \writestatus{interface}{using \currentresponses\space messages}% - \writeline - \let\selectinterface\relax} - \fi -\ifx\currentinterface\undefined \let\currentinterface\defaultinterface \fi -\ifx\currentresponses\undefined \let\currentresponses\defaultinterface \fi +\ifdefined\currentinterface \else \let\currentinterface\defaultinterface \fi +\ifdefined\currentresponses \else \let\currentresponses\defaultinterface \fi %D \macros %D {startinterface} @@ -363,30 +363,27 @@ \unexpanded\def\startmessages #1 library: #2 % {\bgroup \ifcsname\m!prefix!#2\endcsname\else\setgvalue{\m!prefix!#2}{#2}\fi - \catcode13=\activecatcode - \doifinsetelse{#1}{\currentresponses,all}\dostartmessages\nostartmessages{#2}} + \catcode\endoflineasciicode\activecatcode + \doifinsetelse{#1}{\currentresponses,all}\interfaces_messages_start_yes\interfaces_messages_start_nop{#2}} -\def\dostartmessages#1#2\stopmessages +\def\interfaces_messages_start_yes#1#2\stopmessages {\ctxlua{interfaces.setmessages("#1",\!!bs#2\!!es)}% \egroup} -\def\nostartmessages#1#2\stopmessages +\def\interfaces_messages_start_nop#1#2\stopmessages {\egroup} +\let\stopmessages\relax + \unexpanded\def\setinterfacemessage#1#2#3% {\ifcsname\m!prefix!#1\endcsname\else\setgvalue{\m!prefix!#1}{#1}\fi \ctxlua{interfaces.setmessage("#1","#2",\!!bs#3\!!es)}} -\let\stopmessages\relax - -\unexpanded\def\setmessagetext #1#2{\edef\currentmessagetext{\cldcontext{interfaces.getmessage("#1","#2")}}} -\unexpanded\def\getmessage #1#2{\cldcontext{interfaces.getmessage("#1","#2")}} - -%D Till here. - -\unexpanded\def\doifelsemessage #1#2{\ctxlua{interfaces.doifelsemessage("#1","#2")}} -\unexpanded\def\showmessage #1#2#3{\ctxlua{interfaces.showmessage("#1","#2",\!!bs#3\!!es)}} -\unexpanded\def\writestatus #1#2{\ctxcommand{writestatus("#1",\!!bs#2\!!es)}} +\unexpanded\def\setmessagetext #1#2{\edef\currentmessagetext{\cldcontext{interfaces.getmessage("#1","#2")}}} +\unexpanded\def\getmessage #1#2{\cldcontext{interfaces.getmessage("#1","#2")}} +\unexpanded\def\doifelsemessage #1#2{\ctxlua{interfaces.doifelsemessage("#1","#2")}} +\unexpanded\def\showmessage #1#2#3{\ctxlua{interfaces.showmessage("#1","#2",\!!bs#3\!!es)}} +\unexpanded\def\writestatus #1#2{\ctxcommand{writestatus("#1",\!!bs#2\!!es)}} %D \macros %D {ifshowwarnings, ifshowmessages} @@ -757,10 +754,10 @@ %D We just ignore these: -\unexpanded\def\startvariables{\gobbleuntil\stopvariables} -\unexpanded\def\startconstants{\gobbleuntil\stopconstants} -\unexpanded\def\startelements {\gobbleuntil\stopelements } -\unexpanded\def\startcommands {\gobbleuntil\stopcommands } +\unexpanded\def\startvariables{\gobbleuntil\stopvariables} \let\stopvariables\relax +\unexpanded\def\startconstants{\gobbleuntil\stopconstants} \let\stopconstants\relax +\unexpanded\def\startelements {\gobbleuntil\stopelements } \let\stopelements \relax +\unexpanded\def\startcommands {\gobbleuntil\stopcommands } \let\stopcommands \relax %D For at the \LUA\ end (experiment): @@ -795,11 +792,11 @@ %D macro's can be enhanced with more testing facilities, but %D for the moment they suffice. -\ifdefined\zwnj \else \edef\zwnj{\directlua{utf.char(\number"200C)}} \fi % needed for cont-pe -\ifdefined\zwj \else \edef\zwj {\directlua{utf.char(\number"200D)}} \fi % needed for cont-pe +\ifdefined\zwnj \else \edef\zwnj{\directlua{utf.char(\number"200C)}} \fi % needed for cont-pe % maybe to char-utf.mkiv +\ifdefined\zwj \else \edef\zwj {\directlua{utf.char(\number"200D)}} \fi % needed for cont-pe % maybe to char-utf.mkiv %D Out of convenience we define the banners here. This might move -%D to the Lua end. +%D to the \LUA\ end. \def\contextbanner {ConTeXt \space @@ -807,7 +804,7 @@ fmt: \formatversion \space \space int: \currentinterface/\currentresponses} -\def\showcontextbanner +\unexpanded\def\showcontextbanner {\writeline\writebanner{\contextbanner}\writeline} \edef\formatversion diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index 9e9eb2031..d2bd4f116 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -18,6 +18,7 @@ return { "points", "halfpoint", "zeroskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", + "normalpagebox", -- -- "endoflinetoken", "outputnewlinechar", -- @@ -40,10 +41,25 @@ return { -- "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", -- + "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", -- + "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", + "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", + "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", + -- + "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", + "spaceasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", + "colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", + "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", + "lessthanasciicode", "morethanasciicode", "doublecommentsignal", + "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", + "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", + -- + "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", + -- -- maybe a different class -- "startmode", "stopmode", "startnotmode", "stopnotmode", "doifmode", "doifmodeelse", "doifnotmode", @@ -68,6 +84,11 @@ return { "unvoidbox", "vfilll", -- + "currentcatcodetable", "defaultcatcodetable", "catcodetablename", + "newcatcodetable", "startcatcodetable", "stopcatcodetable", "startextendcatcodetable", "stopextendcatcodetable", + "pushcatcodetable", "popcatcodetable", "restorecatcodes", + "setcatcodetable", "letcatcodecommand", "defcatcodecommand", "uedcatcodecommand", + -- "hglue", "vglue", "hfillneg", "vfillneg", "hfilllneg", "vfilllneg", -- "ruledhss", "ruledhfil", "ruledhfill", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", @@ -146,7 +167,7 @@ return { -- "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", -- - "newconstant", "setnewconstant", "newconditional", "settrue", "setfalse", + "newconstant", "setnewconstant", "newconditional", "settrue", "setfalse", "setconstant", -- "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", diff --git a/tex/context/base/mult-sys.mkiv b/tex/context/base/mult-sys.mkiv index 261ae240d..5467eb32f 100644 --- a/tex/context/base/mult-sys.mkiv +++ b/tex/context/base/mult-sys.mkiv @@ -44,7 +44,8 @@ \definesystemconstant {catalan} \definesystemconstant {ca} \definesystemconstant {chinese} \definesystemconstant {cn} \definesystemconstant {croatian} \definesystemconstant {hr} -\definesystemconstant {czech} \definesystemconstant {cs} \definesystemconstant {cz} +\definesystemconstant {czech} \definesystemconstant {cs} + \definesystemconstant {cz} \definesystemconstant {danish} \definesystemconstant {da} \definesystemconstant {dutch} \definesystemconstant {nl} \definesystemconstant {english} \definesystemconstant {en} @@ -55,7 +56,8 @@ \definesystemconstant {italian} \definesystemconstant {it} \definesystemconstant {latin} \definesystemconstant {la} \definesystemconstant {lithuanian} \definesystemconstant {lt} -\definesystemconstant {bokmal} \definesystemconstant {nb} \definesystemconstant {norwegian} \definesystemconstant {no} +\definesystemconstant {bokmal} \definesystemconstant {nb} +\definesystemconstant {norwegian} \definesystemconstant {no} \definesystemconstant {nynorsk} \definesystemconstant {nn} \definesystemconstant {polish} \definesystemconstant {pl} \definesystemconstant {persian} \definesystemconstant {pe} @@ -69,12 +71,14 @@ \definesystemconstant {swedish} \definesystemconstant {sv} \definesystemconstant {turkish} \definesystemconstant {tr} \definesystemconstant {turkmen} \definesystemconstant {tk} -\definesystemconstant {gbenglish} \definesystemconstant {gb} \definesystemconstant {ukenglish} \definesystemconstant {uk} +\definesystemconstant {gbenglish} \definesystemconstant {gb} +\definesystemconstant {ukenglish} \definesystemconstant {uk} \definesystemconstant {usenglish} \definesystemconstant {us} \definesystemconstant {ukrainian} \definesystemconstant {ua} \definesystemconstant {greek} \definesystemconstant {gr} \definesystemconstant {ancientgreek} \definesystemconstant {agr} -\definesystemconstant {vietnamese} \definesystemconstant {vi} \definesystemconstant {vn} +\definesystemconstant {vietnamese} \definesystemconstant {vi} + \definesystemconstant {vn} \definesystemconstant {chinese} \definesystemconstant {cn} \definesystemconstant {japanese} \definesystemconstant {ja} \definesystemconstant {korean} \definesystemconstant {kr} @@ -90,34 +94,42 @@ \definesystemconstant {Slanted} \definesystemconstant {Unicode} -\definesystemconstant {Serif} \definesystemconstant {Regular} -\definesystemconstant {Sans} \definesystemconstant {Support} -\definesystemconstant {Mono} \definesystemconstant {Type} +\definesystemconstant {Serif} +\definesystemconstant {Sans} +\definesystemconstant {Mono} \definesystemconstant {Math} \definesystemconstant {Handwriting} \definesystemconstant {Calligraphy} \definesystemconstant {Casual} -\definesystemconstant {SerifBold} \definesystemconstant {SansBold} \definesystemconstant {MonoBold} -\definesystemconstant {SerifItalic} \definesystemconstant {SansItalic} \definesystemconstant {MonoItalic} -\definesystemconstant {SerifBoldItalic} \definesystemconstant {SansBoldItalic} \definesystemconstant {MonoBoldItalic} -\definesystemconstant {SerifSlanted} \definesystemconstant {SansSlanted} \definesystemconstant {MonoSlanted} -\definesystemconstant {SerifBoldSlanted} \definesystemconstant {SansBoldSlanted} \definesystemconstant {MonoBoldSlanted} -\definesystemconstant {SerifCaps} \definesystemconstant {SansCaps} \definesystemconstant {MonoCaps} +\definesystemconstant {Regular} +\definesystemconstant {Support} +\definesystemconstant {Type} + +\definesystemconstant {SerifBold} +\definesystemconstant {SerifItalic} +\definesystemconstant {SerifBoldItalic} +\definesystemconstant {SerifSlanted} +\definesystemconstant {SerifBoldSlanted} +\definesystemconstant {SerifCaps} + +\definesystemconstant {SansBold} +\definesystemconstant {SansItalic} +\definesystemconstant {SansBoldItalic} +\definesystemconstant {SansSlanted} +\definesystemconstant {SansBoldSlanted} +\definesystemconstant {SansCaps} + +\definesystemconstant {MonoBold} +\definesystemconstant {MonoItalic} +\definesystemconstant {MonoBoldItalic} +\definesystemconstant {MonoSlanted} +\definesystemconstant {MonoBoldSlanted} +\definesystemconstant {MonoCaps} \definesystemconstant {Normal} \definesystemconstant {Caps} -\definesystemconstant {mnem} % kind of generic short tag - -\definesystemconstant {file} -\definesystemconstant {name} -\definesystemconstant {spec} - -\definesystemconstant {both} - -\definesystemconstant {attribute} - \definesystemconstant {serif} \definesystemconstant {sans} \definesystemconstant {mono} @@ -129,6 +141,16 @@ \definesystemconstant {fallback} +%definesystemconstant {mnem} % kind of generic short tag + +\definesystemconstant {file} +\definesystemconstant {name} +\definesystemconstant {spec} + +\definesystemconstant {both} + +\definesystemconstant {attribute} + \definesystemconstant {none} \definesystemconstant {default} \definesystemconstant {smallcaps} @@ -149,35 +171,6 @@ \definesystemconstant {ss} \definesystemconstant {tt} -%D As the name of their define command states, the next set of -%D constants is used in the message macro's. - -\definemessageconstant {check} -\definemessageconstant {colors} -\definemessageconstant {columns} -\definemessageconstant {regimes} -\definemessageconstant {figures} -\definemessageconstant {fields} -\definemessageconstant {files} -\definemessageconstant {floatblocks} -\definemessageconstant {fonts} -\definemessageconstant {handlings} -\definemessageconstant {interactions} -\definemessageconstant {javascripts} -\definemessageconstant {layouts} -\definemessageconstant {languages} -\definemessageconstant {references} -\definemessageconstant {structures} -\definemessageconstant {symbols} -\definemessageconstant {system} -\definemessageconstant {lua} -\definemessageconstant {textblocks} -\definemessageconstant {verbatims} -\definemessageconstant {versions} -\definemessageconstant {metapost} -\definemessageconstant {chemicals} -\definemessageconstant {publications} - %D Net come some \CONTEXT\ constants, used in the definition %D of private commands: @@ -219,7 +212,6 @@ \definesystemconstant {mkiv} \definesystemconstant {mkii} -\definesystemconstant {entities} \definesystemconstant {normal} \definesystemconstant {bold} @@ -229,19 +221,9 @@ \definesystemconstant {default} \definesystemconstant {smallcaps} -\definesystemconstant {text} -\definesystemconstant {page} -\definesystemconstant {leftpage} -\definesystemconstant {rightpage} -\definesystemconstant {somewhere} - -%D A more experienced \TEX\ user will recognize the next four -%D constants. We need these because font-definitions are -%D partially english. - \definesystemconstant {run} -\definesystemconstant {fam} +%definesystemconstant {fam} \definesystemconstant {text} \definesystemconstant {script} \definesystemconstant {scriptscript} @@ -251,41 +233,66 @@ \definesystemconstant {lefthyphenchar} \definesystemconstant {righthyphenchar} -\definesystemconstant {skewchar} -\definesystemconstant {hyphenchar} +%definesystemconstant {skewchar} +%definesystemconstant {hyphenchar} \definesystemconstant {catcodes} -\definesystemconstant {encoding} -\definesystemconstant {resource} -\definesystemconstant {mapping} +%definesystemconstant {encoding} +%definesystemconstant {entities} +%definesystemconstant {resource} +%definesystemconstant {mapping} \definesystemconstant {language} \definesystemconstant {patterns} \definesystemconstant {rname} \definesystemconstant {rscale} -\definesystemconstant {handling} +%definesystemconstant {handling} \definesystemconstant {features} \definesystemconstant {direction} \definesystemconstant {fallbacks} \definesystemconstant {goodies} -\definesystemconstant {background} -\definesystemconstant {ucmap} +%definesystemconstant {background} +%definesystemconstant {ucmap} -\definesystemconstant {property} -\definesystemconstant {overprint} -\definesystemconstant {layer} -\definesystemconstant {effect} -\definesystemconstant {negative} -\definesystemconstant {color} -\definesystemconstant {transparency} +%definesystemconstant {property} +%definesystemconstant {overprint} +%definesystemconstant {layer} +\definesystemconstant {effect} % todo s +%definesystemconstant {negative} +%definesystemconstant {color} +%definesystemconstant {transparency} \definesystemconstant {black} \definesystemconstant {white} +\definesystemconstant {system} % not yet interfaces messages +\definesystemconstant {user} +\definesystemconstant {check} +\definesystemconstant {reset} +\definesystemconstant {set} +\definesystemconstant {empty} + +\definesystemconstant {realpage} +\definesystemconstant {userpage} +\definesystemconstant {subpage} + +\definesystemconstant {page} +\definesystemconstant {subpage} +\definesystemconstant {leftpage} +\definesystemconstant {rightpage} +\definesystemconstant {somewhere} + +\definesystemconstant {full} +\definesystemconstant {text} +\definesystemconstant {paragraph} +\definesystemconstant {line} + +\definesystemconstant {number} +\definesystemconstant {symbol} \definesystemconstant {format} +\definesystemconstant {data} +\definesystemconstant {float} \definesystemconstant {extensions} \definesystemconstant {initializations} -\definesystemconstant {system} % not yet interfaces messages - %D Just to be complete we define the standard \TEX\ units. \definesystemconstant {cm} @@ -303,179 +310,105 @@ \definesystemconstant {nd} \definesystemconstant {nc} -%D These constants are used for internal and utility -%D commands. - -\definesystemconstant {check} -\definesystemconstant {reset} -\definesystemconstant {set} - -\definesystemconstant {entrya} -\definesystemconstant {entryb} -\definesystemconstant {entryc} -\definesystemconstant {entryd} -\definesystemconstant {entry} -\definesystemconstant {see} -\definesystemconstant {from} -\definesystemconstant {to} -\definesystemconstant {line} -\definesystemconstant {page} -\definesystemconstant {realpage} -\definesystemconstant {userpage} -\definesystemconstant {subpage} - -\definesystemconstant {synonym} - -\definesystemconstant {reference} -\definesystemconstant {main} - -\definesystemconstant {list} - -\definesystemconstant {item} -\definesystemconstant {itemcount} - -\definesystemconstant {number} -\definesystemconstant {symbol} -\definesystemconstant {references} -\definesystemconstant {between} -\definesystemconstant {format} -\definesystemconstant {old} - -\definesystemconstant {thisisblock} -\definesystemconstant {thiswasblock} - -\definesystemconstant {figurepreset} - -\definesystemconstant {empty} - -%D Some \CONTEXT\ commands take a two||pass aproach to -%D optimize the typesetting. Each two||pass object has its -%D own tag. - -\definesystemconstant {pass} +%definesystemconstant {entrya} +%definesystemconstant {entryb} +%definesystemconstant {entryc} +%definesystemconstant {entryd} +%definesystemconstant {entry} +%definesystemconstant {see} +%definesystemconstant {from} +%definesystemconstant {to} +%definesystemconstant {synonym} +%definesystemconstant {reference} +%definesystemconstant {main} +%definesystemconstant {list} +%definesystemconstant {item} +%definesystemconstant {itemcount} +%definesystemconstant {references} +%definesystemconstant {between} +%definesystemconstant {old} +%definesystemconstant {thisisblock} +%definesystemconstant {thiswasblock} +%definesystemconstant {figurepreset} +%definesystemconstant {pass} +%definesystemconstant {list} +%definesystemconstant {margin} +%definesystemconstant {profile} +%definesystemconstant {versionbegin} +%definesystemconstant {versionend} +%definesystemconstant {cross} + +%D Reference constants are no longer used in \MKIV\ but for the +%D moment we keep this mechanism available. +%D +%D \starttyping +%D \definereferenceconstant {whatever} +%D \stoptyping -\definesystemconstant {data} -\definesystemconstant {float} -\definesystemconstant {list} -\definesystemconstant {page} -\definesystemconstant {subpage} -\definesystemconstant {margin} -\definesystemconstant {profile} -\definesystemconstant {versionbegin} -\definesystemconstant {versionend} -\definesystemconstant {cross} -\definesystemconstant {paragraph} +%D As the name of their define command states, the next set of +%D constants is used in the message macro's. -%D A lot of macros use tags to distinguish between different -%D objects, e.g. lists and registers. - -\definesystemconstant {prt} % part (deel) -\definesystemconstant {chp} % chapter (hoofdstuk) -\definesystemconstant {sec} % section (paragraaf) -\definesystemconstant {tit} % title (titel) -\definesystemconstant {sub} % subject (onderwerp) -\definesystemconstant {mar} % margin (marge) -\definesystemconstant {num} % number (doornummeren) -\definesystemconstant {def} % definition (doordefinieren) -\definesystemconstant {for} % formula (formule) -\definesystemconstant {fnt} % footnote (voetnoot) -\definesystemconstant {ind} % index (register) -\definesystemconstant {lin} % linked index -\definesystemconstant {lst} % list (opsomming) -\definesystemconstant {flt} % float (plaatsblok) -\definesystemconstant {pag} % page (pagina) -\definesystemconstant {txt} % text (tekst) -\definesystemconstant {ref} % reference (verwijzing) -\definesystemconstant {lab} % label (label) -\definesystemconstant {aut} % automatic (inhoud, index) -\definesystemconstant {vwa} % automatic (illustrations) -\definesystemconstant {vwb} % automatic (illustrations) - -%D Reference labels can be tagged by users, for instance by -%D means of \type{tag:}. The reference mechanism itself uses -%D some tags too. These are definitely not to be used by users. -%D Here they are: - -\definereferenceconstant {cross} {:c:} % cross reference -\definereferenceconstant {view} {:v:} % view reference -\definereferenceconstant {viewa} {:a:} % view reference test a -\definereferenceconstant {viewb} {:b:} % view reference test b -\definereferenceconstant {page} {:p:} % page referece -\definereferenceconstant {list} {:l:} % list reference -\definereferenceconstant {exec} {:e:} % execution reference -\definereferenceconstant {form} {:m:} % form reference -\definereferenceconstant {syst} {:s:} % system reference - -\definereferenceconstant {from} {:f:} % from list reference -\definereferenceconstant {to} {:t:} % to list reference - -\definereferenceconstant {object} {:o:} % object reference -\definereferenceconstant {driver} {:d:} % driver object reference -\definereferenceconstant {widget} {:w:} % field chain reference - -\definereferenceconstant {java} {:j:} % java scripts +\definemessageconstant {check} +\definemessageconstant {colors} +\definemessageconstant {columns} +\definemessageconstant {regimes} +\definemessageconstant {figures} +\definemessageconstant {fields} +\definemessageconstant {files} +\definemessageconstant {floatblocks} +\definemessageconstant {fonts} +\definemessageconstant {handlings} +\definemessageconstant {interactions} +\definemessageconstant {javascripts} +\definemessageconstant {layouts} +\definemessageconstant {languages} +\definemessageconstant {references} +\definemessageconstant {structures} +\definemessageconstant {symbols} +\definemessageconstant {system} +\definemessageconstant {lua} +\definemessageconstant {textblocks} +\definemessageconstant {verbatims} +\definemessageconstant {versions} +\definemessageconstant {metapost} +\definemessageconstant {chemicals} +\definemessageconstant {publications} %D When we use numbers and dimensions the same applies as %D with the keywords like \type{width} and \type{plus} %D mentioned earlier. -\def\!!ten {10} -\def\!!twelve {12} -\def\!!hundred {100} -\def\!!thousand {1000} -\def\!!tenthousand {10000} -\def\!!maxcard {65536} -\def\!!medcard {32768} - -\def\!!zeropoint {0pt} -\def\!!onepoint {1pt} -\def\!!twopoint {2pt} -\def\!!threepoint {3pt} -\def\!!fourpoint {4pt} -\def\!!fivepoint {5pt} -\def\!!sixpoint {6pt} -\def\!!sevenpoint {7pt} -\def\!!eightpoint {8pt} -\def\!!ninepoint {9pt} -\def\!!tenpoint {10pt} -\def\!!elevenpoint {11pt} -\def\!!twelvepoint {12pt} +\def\!!ten {10} +\def\!!twelve {12} +\def\!!hundred {100} +\def\!!thousand {1000} +\def\!!tenthousand {10000} +\def\!!maxcard {65536} +\def\!!medcard {32768} + +\def\!!zeropoint {0pt} +\def\!!onepoint {1pt} +\def\!!twopoint {2pt} +\def\!!threepoint {3pt} +\def\!!fourpoint {4pt} +\def\!!fivepoint {5pt} +\def\!!sixpoint {6pt} +\def\!!sevenpoint {7pt} +\def\!!eightpoint {8pt} +\def\!!ninepoint {9pt} +\def\!!tenpoint {10pt} +\def\!!elevenpoint {11pt} +\def\!!twelvepoint {12pt} \def\!!fourteenpointfour {14.4pt} -\let\onerealpoint\onepoint % needed for latex - -\def\!!plustoken {+} -\def\!!minustoken{-} - -% D Another optimization is: -% -% \let\points\onepoint - -%D A rough test is: -%D -%D \starttyping -%D \def\TestMe % 7.75 sec on a P4/2G -%D {\dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points -%D \dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points} -%D -%D \def\TestMe % 11.5 sec on a P4/2G -%D {\dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt% -%D \dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt} -%D -%D \def\TestMe % 12.5 sec on a P4/2G -%D {\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt% -%D \dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt} -%D -%D \testfeatureonce {500000}{\TestMe} -%D \stoptyping +\def\!!plustoken {+} +\def\!!minustoken {-} %D Variables are composed of a command specific tag and a user %D supplied variable (system constant). The first tag \type{ag} %D for instance is available as \type{\??ag} and expands to %D \type{@@ag} in composed variables. -% vervallen : hd hr hm vt vr vm tr tn te br bm bo on om or - \definesystemvariable {ab} % AlignedBoxes \definesystemvariable {ac} % ACcent \definesystemvariable {ae} % AttributEs @@ -485,23 +418,23 @@ \definesystemvariable {an} % ANchor \definesystemvariable {as} % AlignmentSwitch \definesystemvariable {at} % ATtachments -\definesystemvariable {ba} % synchronisatieBAlk +%definesystemvariable {ba} % synchronisatieBAlk \definesystemvariable {bc} % BaCkend \definesystemvariable {be} % startstop (BeginEnd) \definesystemvariable {bj} % BlokJe -\definesystemvariable {bk} % Blokken (floats) -\definesystemvariable {bl} % BLanko +%definesystemvariable {bk} % Blokken (floats) +%definesystemvariable {bl} % BLanko \definesystemvariable {bg} % BleedinG \definesystemvariable {bm} % BookMark -\definesystemvariable {bo} % BlankO (definitions) +%definesystemvariable {bo} % BlankO (definitions) \definesystemvariable {bp} % BreakPoint \definesystemvariable {br} % sideBaR -\definesystemvariable {bs} % SelecteerBlokken +%definesystemvariable {bs} % SelecteerBlokken \definesystemvariable {bt} % BuTton \definesystemvariable {bu} % BUffer -\definesystemvariable {bv} % Brieven +%definesystemvariable {bv} % Brieven \definesystemvariable {bx} % BackendExport -\definesystemvariable {by} % Per +%definesystemvariable {by} % Per \definesystemvariable {cb} % CollectBox \definesystemvariable {cc} % Comment \definesystemvariable {ce} % CasEs @@ -515,9 +448,9 @@ \definesystemvariable {co} % COmbinaties \definesystemvariable {cp} % CliP \definesystemvariable {cr} % kleur (ColoR) -\definesystemvariable {cs} % kleur (ColorSeparation +%definesystemvariable {cs} % kleur (ColorSeparation \definesystemvariable {cv} % ConVersie -\definesystemvariable {cy} % CrYteria +%definesystemvariable {cy} % CrYteria \definesystemvariable {da} % DAte \definesystemvariable {db} % Labels \definesystemvariable {dc} % DroppedCaps @@ -531,38 +464,39 @@ \definesystemvariable {du} % DUmmy \definesystemvariable {ds} % DoorSpringen \definesystemvariable {ef} % ExternFiguur -\definesystemvariable {ec} % EnCoding +%definesystemvariable {ec} % EnCoding \definesystemvariable {el} % Elements \definesystemvariable {en} % ENvironments -\definesystemvariable {ep} % ExternfiguurPreset +%definesystemvariable {ep} % ExternfiguurPreset \definesystemvariable {eq} % EQalign \definesystemvariable {er} % external resources \definesystemvariable {et} % EffecT \definesystemvariable {ex} % ExterneFiguren -\definesystemvariable {fa} % font feature +%definesystemvariable {fa} % font feature \definesystemvariable {fb} % FieldBody \definesystemvariable {fc} % FramedContent \definesystemvariable {fd} % FielDgroup -\definesystemvariable {fe} % FoxetExtensions +%definesystemvariable {fe} % FoxetExtensions \definesystemvariable {ff} % FontFile -\definesystemvariable {fg} % FiGuurmaten +%definesystemvariable {fg} % FiGuurmaten \definesystemvariable {fh} % FontHash -\definesystemvariable {fi} % FIle +\definesystemvariable {fi} % FIle Once \definesystemvariable {fl} % Floats \definesystemvariable {fm} % ForMules \definesystemvariable {fn} % subformulas -\definesystemvariable {fo} % xml FO +\definesystemvariable {fo} % xml FO (xtag) \definesystemvariable {fp} % FilegroeP \definesystemvariable {fq} % Features \definesystemvariable {fr} % ForM -\definesystemvariable {fs} % FileSynonym +%definesystemvariable {fs} % FileSynonym \definesystemvariable {ft} % FonTs \definesystemvariable {fu} % FontSolution -\definesystemvariable {fv} % FontVariant +%definesystemvariable {fv} % FontVariant \definesystemvariable {fw} % simpleFonts by Wolfgang \definesystemvariable {fx} % FoXet \definesystemvariable {gr} % GRid \definesystemvariable {gm} % Graphic Metapost +\definesystemvariable {gb} % Graphic Bitmaps \definesystemvariable {gi} % Graphic Instance \definesystemvariable {gt} % Graphic Text \definesystemvariable {gv} % Graphic Variable @@ -573,16 +507,16 @@ \definesystemvariable {hf} % Helpers Framed \definesystemvariable {hl} % HighLight \definesystemvariable {hs} % HSpace -\definesystemvariable {ht} % HiddenText +%definesystemvariable {ht} % HiddenText \definesystemvariable {ia} % Interactie \definesystemvariable {ib} % InteractieBalk -\definesystemvariable {ic} % ICc profiles +%definesystemvariable {ic} % ICc profiles \definesystemvariable {id} % Index -\definesystemvariable {ig} % ItemGroup +%definesystemvariable {ig} % ItemGroup \definesystemvariable {ih} % InHoudsopgave -\definesystemvariable {ii} % stelIndexIn +%definesystemvariable {ii} % stelIndexIn \definesystemvariable {il} % stelInvulRegelsin -\definesystemvariable {im} % InMarge +%definesystemvariable {im} % InMarge \definesystemvariable {in} % INspringen \definesystemvariable {ip} % InsertPages \definesystemvariable {is} % Items @@ -594,14 +528,14 @@ \definesystemvariable {kk} % Kapitalen \definesystemvariable {kl} % KoLommen \definesystemvariable {km} % KenMerk -\definesystemvariable {ko} % KOp(pen) +%definesystemvariable {ko} % KOp(pen) \definesystemvariable {kp} % KopPelteken -\definesystemvariable {kr} % KoRps +%definesystemvariable {kr} % KoRps \definesystemvariable {ks} % KolomSpan \definesystemvariable {kt} % KonTakten \definesystemvariable {kw} % KontaktWaarde \definesystemvariable {la} % LAnguage -\definesystemvariable {lb} % LaBels +%definesystemvariable {lb} % LaBels \definesystemvariable {ld} % LegenDa \definesystemvariable {le} % LinetablE \definesystemvariable {lf} % LocalFigures @@ -609,22 +543,25 @@ \definesystemvariable {li} % LIjst \definesystemvariable {lk} % LinK \definesystemvariable {ll} % Layers -\definesystemvariable {lx} % LayerteXt -\definesystemvariable {ln} % LijNen -\definesystemvariable {lo} % LOgos +%definesystemvariable {ln} % LijNen +%definesystemvariable {lo} % LOgos \definesystemvariable {lt} % LiTeratuur \definesystemvariable {lr} % LayeR \definesystemvariable {ls} % languageScript \definesystemvariable {lt} % LuaTables +\definesystemvariable {lu} % LUacode +\definesystemvariable {lw} % WordList +\definesystemvariable {lx} % LayerteXt \definesystemvariable {ly} % LaYout \definesystemvariable {ma} % MargeAchtergrond \definesystemvariable {mb} % MargeBlokken \definesystemvariable {mc} % MarginCategory \definesystemvariable {md} % MoDule -\definesystemvariable {me} % MultilingualElement (tags) +%definesystemvariable {me} % MultilingualElement (tags) \definesystemvariable {mf} % MarginFramed -\definesystemvariable {mg} % Metapost paGe -\definesystemvariable {mh} % MultilingualHead +%definesystemvariable {mg} % Metapost paGe +%definesystemvariable {mh} % MultilingualHead +\definesystemvariable {mi} % MultilingualInterface \definesystemvariable {mk} % MarKering \definesystemvariable {ml} % MultilingualLabel \definesystemvariable {mm} % MultilingualMath @@ -638,23 +575,24 @@ \definesystemvariable {nm} % Nummering \definesystemvariable {np} % NaastPlaatsen \definesystemvariable {nr} % Nummeren -\definesystemvariable {of} % OFfset +\definesystemvariable {ob} % OBjects +%definesystemvariable {of} % OFfset \definesystemvariable {oi} % OmlijndInstellingen \definesystemvariable {ol} % OmLijnd \definesystemvariable {od} % Omlijnd Defaults (simple) \definesystemvariable {on} % ONderstreep -\definesystemvariable {oo} % OpsOmmingen +%definesystemvariable {oo} % OpsOmmingen \definesystemvariable {op} % OPsomming -\definesystemvariable {or} % OtpfilteR -\definesystemvariable {os} % OffSet -\definesystemvariable {ot} % OTpsequence +%definesystemvariable {or} % OtpfilteR +%definesystemvariable {os} % OffSet +%definesystemvariable {ot} % OTpsequence \definesystemvariable {ov} % OVerlay \definesystemvariable {ox} % OffsetBox \definesystemvariable {pa} % PAlet \definesystemvariable {pb} % PuBlication \definesystemvariable {pc} % PageComment \definesystemvariable {pe} % PagEhandler -\definesystemvariable {pf} % ProFiel +%definesystemvariable {pf} % ProFiel %definesystemvariable {pg} % \definesystemvariable {ph} % ParagrapH \definesystemvariable {pl} % PLaats @@ -672,32 +610,36 @@ \definesystemvariable {qt} % Transparencyattribute (ts) \definesystemvariable {qa} % Colorattribute (ca) \definesystemvariable {qs} % Transparencyattribute (ta) +\definesystemvariable {ql} % catcode table let % already defined +\definesystemvariable {qd} % catcode table def % already defined +\definesystemvariable {qu} % catcode table ued % already defined +\definesystemvariable {qm} % catcode table meaning % already defined \definesystemvariable {ra} % RAise -\definesystemvariable {rd} % RenDering +%definesystemvariable {rd} % RenDering \definesystemvariable {re} % REferenceformat \definesystemvariable {rf} % ReFerencing \definesystemvariable {rg} % ReGel -\definesystemvariable {rl} % ReferentieLijst +%definesystemvariable {rl} % ReferentieLijst \definesystemvariable {rn} % RegelNummer \definesystemvariable {ro} % ROteren -\definesystemvariable {rr} % linenotes +%definesystemvariable {rr} % linenotes \definesystemvariable {rs} % RaSters \definesystemvariable {rt} % RoosTers -\definesystemvariable {rv} % ReserVeerfiguur +%definesystemvariable {rv} % ReserVeerfiguur \definesystemvariable {rw} % RenderingWindow \definesystemvariable {sa} % ScAle \definesystemvariable {sb} % SectieBlok \definesystemvariable {sc} % SCherm \definesystemvariable {sd} % SounD \definesystemvariable {se} % SEctie -\definesystemvariable {sf} % SpeciFics +%definesystemvariable {sf} % SpeciFics \definesystemvariable {sg} % SpacinG \definesystemvariable {sh} % ShapeText \definesystemvariable {si} % SplIt -\definesystemvariable {sk} % SectieKop +%definesystemvariable {sk} % SectieKop \definesystemvariable {sl} % SmalLer \definesystemvariable {sm} % SynonieMen -\definesystemvariable {sn} % SubNummer +%definesystemvariable {sn} % SubNummer \definesystemvariable {so} % SOrteren \definesystemvariable {sp} % SelecteerPapier \definesystemvariable {sr} % SpacehandleR @@ -705,73 +647,71 @@ \definesystemvariable {st} % STickers \definesystemvariable {su} % SetUp \definesystemvariable {sv} % SysteemVariabelen -\definesystemvariable {sw} % SectionWorld +%definesystemvariable {sw} % SectionWorld \definesystemvariable {sx} % Selector -\definesystemvariable {sy} % SYnchronisatie +%definesystemvariable {sy} % SYnchronisatie \definesystemvariable {ta} % TAb \definesystemvariable {tb} % TekstBlokken \definesystemvariable {td} % TextbackgrounDs \definesystemvariable {te} % TEmplate \definesystemvariable {tf} % TypeFace -\definesystemvariable {tg} % Tex paGe +%definesystemvariable {tg} % Tex paGe \definesystemvariable {ti} % TabelInstellingen \definesystemvariable {tk} % Teksten \definesystemvariable {tl} % TekstLijnen \definesystemvariable {tm} % TypesynonyM \definesystemvariable {to} % TOlerance \definesystemvariable {tp} % TyPen -\definesystemvariable {tr} % TRacer +%definesystemvariable {tr} % TRacer \definesystemvariable {ts} % TypeScript \definesystemvariable {tt} % TabulaTe \definesystemvariable {tx} % TeXtflow \definesystemvariable {ty} % TYpe -\definesystemvariable {uc} % Unicode -\definesystemvariable {ui} % UItvoer +%definesystemvariable {uc} % Unicode +%definesystemvariable {ui} % UItvoer \definesystemvariable {un} % UNits \definesystemvariable {ur} % URl \definesystemvariable {ut} % strUT -\definesystemvariable {up} % Utility Program +%definesystemvariable {up} % Utility Program \definesystemvariable {va} % VspAce -\definesystemvariable {ve} % VErsie +%definesystemvariable {ve} % VErsie \definesystemvariable {vn} % VoetNoten \definesystemvariable {vs} % VSpacing -\definesystemvariable {vt} % VerTical -\definesystemvariable {wl} % WordList -\definesystemvariable {wr} % WitRuimte -\definesystemvariable {xf} % XML File -\definesystemvariable {xl} % lxml (mkiv) -\definesystemvariable {wl} % WidgetLabel +%definesystemvariable {vt} % VerTical \definesystemvariable {wc} % WidgetContent -\definesystemvariable {wt} % WidgetTotal -\definesystemvariable {ws} % WidgetStack (not used) \definesystemvariable {wh} % WidgetHelp +\definesystemvariable {wl} % WidgetLabel \definesystemvariable {wp} % WidgetPopuphelp +%definesystemvariable {wr} % WitRuimte +%definesystemvariable {ws} % WidgetStack (not used) +\definesystemvariable {wt} % WidgetTotal \definesystemvariable {wz} % whitespace +\definesystemvariable {xf} % XML File (xtag) +\definesystemvariable {xl} % lxml (mkiv) \definesystemvariable {xm} % xml (mkiv) -\definesystemvariable {xp} % XML Processing +\definesystemvariable {xp} % XML Processing (xtag, so still needed) \definesystemvariable {xy} % schaal \definesystemvariable {za} % layout adapt % ZetspiegelAanpassing \definesystemvariable {zc} % columns \definesystemvariable {zo} % otr %D Next we define some language independant one letter -%D variables and keywords. (should become s!) - -\defineinterfaceconstant {x} {x} % x offset -\defineinterfaceconstant {y} {y} % y offset -\defineinterfaceconstant {w} {w} % width -\defineinterfaceconstant {h} {h} % height -\defineinterfaceconstant {s} {s} % size -\defineinterfaceconstant {t} {t} % title -\defineinterfaceconstant {c} {c} % creator -\defineinterfaceconstant {e} {e} % extension -\defineinterfaceconstant {f} {f} % file - -\defineinterfaceconstant {a} {a} % kunnen weg -\defineinterfaceconstant {b} {b} % kunnen weg -\defineinterfaceconstant {c} {c} % kunnen weg -\defineinterfaceconstant {d} {d} % kunnen weg -\defineinterfaceconstant {e} {e} % kunnen weg +%D variables and keywords. We can actually make these +%D system variables. + +\defineinterfaceconstant {x} {x} +\defineinterfaceconstant {y} {y} +\defineinterfaceconstant {w} {w} +\defineinterfaceconstant {h} {h} +\defineinterfaceconstant {s} {s} +\defineinterfaceconstant {t} {t} + +\defineinterfaceconstant {a} {a} % can go +\defineinterfaceconstant {b} {b} % can go +\defineinterfaceconstant {c} {c} % can go +\defineinterfaceconstant {d} {d} % can go +\defineinterfaceconstant {e} {e} % can go +\defineinterfaceconstant {f} {f} % can go \defineinterfaceconstant {s} {s} \defineinterfaceconstant {r} {r} @@ -784,19 +724,17 @@ \defineinterfaceconstant {a} {a} % alternative \defineinterfaceconstant {t} {t} % transparency \defineinterfaceconstant {p} {p} % percentage - -\defineinterfaceconstant {t} {t} \defineinterfaceconstant {h} {h} -\defineinterfaceconstant {b} {b} +\defineinterfaceconstant {s} {s} +\defineinterfaceconstant {v} {v} \defineinterfaceconstant {rgb} {rgb} -\defineinterfacevariable {rgb} {rgb} - \defineinterfaceconstant {cmyk} {cmyk} -\defineinterfacevariable {cmyk} {cmyk} +\defineinterfaceconstant {mp} {mp} -\defineinterfaceconstant {mp} {mp} -\defineinterfacevariable {mp} {mp} +\defineinterfacevariable {rgb} {rgb} +\defineinterfacevariable {cmyk} {cmyk} +\defineinterfacevariable {mp} {mp} \defineinterfacevariable {s} {s} @@ -814,17 +752,16 @@ %D be recognized by the first two characters of the extension: %D \type{tu}. -\definefileconstant {utilityfilename} {texutil} - -\definefileconstant {blockextension} {tub} -\definefileconstant {figureextension} {tuf} -\definefileconstant {inputextension} {tui} -\definefileconstant {outputextension} {tuo} % tup for previous run +%definefileconstant {utilityfilename} {texutil} +%definefileconstant {blockextension} {tub} +%definefileconstant {figureextension} {tuf} +%definefileconstant {inputextension} {tui} +%definefileconstant {outputextension} {tuo} % tup for previous run \definefileconstant {optionextension} {top} \definefileconstant {temporaryextension} {tmp} -\definefileconstant {patternsextension} {pat} -\definefileconstant {hyphensextension} {hyp} -\definefileconstant {fontmapextension} {map} +%definefileconstant {patternsextension} {pat} +%definefileconstant {hyphensextension} {hyp} +%definefileconstant {fontmapextension} {map} \definefileconstant {bibextension} {bbl} %D These files are loaded at start||up. They may contain system @@ -838,7 +775,8 @@ \definefileconstant {locfilename} {cont-loc} \definefileconstant {expfilename} {cont-exp} -%D Handy for typescripts (we could use s! instead: +%D Handy for typescripts (we could use s! instead) but these +%D might go: \definetypescriptconstant {name} {name} \definetypescriptconstant {default} {default} @@ -846,35 +784,34 @@ \definetypescriptconstant {special} {special} \definetypescriptconstant {size} {size} - %D The setup files for the language, font, color and special %D subsystems have a common prefix. This means that we have at %D most three characters for unique filenames. \definefileconstant {colorprefix} {colo-} -\definefileconstant {encodingprefix} {enco-} -\definefileconstant {filterprefix} {filt-} +%definefileconstant {encodingprefix} {enco-} +%definefileconstant {filterprefix} {filt-} \definefileconstant {fontprefix} {font-} %definefileconstant {handlingprefix} {hand-} %definefileconstant {javascriptprefix} {java-} %definefileconstant {languageprefix} {lang-} -\definefileconstant {mathprefix} {math-} -\definefileconstant {metapostprefix} {meta-} +%definefileconstant {mathprefix} {math-} +%definefileconstant {metapostprefix} {meta-} %definefileconstant {regimeprefix} {regi-} %definefileconstant {specialprefix} {spec-} \definefileconstant {symbolprefix} {symb-} \definefileconstant {typeprefix} {type-} -\definefileconstant {xtagprefix} {xtag-} +%definefileconstant {xtagprefix} {xtag-} %definefileconstant {propprefix} {prop-} %definefileconstant {unicprefix} {unic-} %definefileconstant {sortprefix} {sort-} %definefileconstant {prettyprefix} {pret-} -\definefileconstant {moduleprefix} {m-} -\definefileconstant {styleprefix} {s-} -\definefileconstant {xstyleprefix} {x-} -\definefileconstant {privateprefix} {p-} -\definefileconstant {thirdprefix} {t-} +%definefileconstant {moduleprefix} {m-} +%definefileconstant {styleprefix} {s-} +%definefileconstant {xstyleprefix} {x-} +%definefileconstant {privateprefix} {p-} +%definefileconstant {thirdprefix} {t-} %definefileconstant {beforeprefix} {b-} %definefileconstant {afterprefix} {a-} @@ -883,9 +820,9 @@ %D The macros that are responsible for this 'clever' searching %D make use of two (very important) path specifiers. -\definefileconstant {pathseparator} {/} -\definefileconstant {currentpath} {.} -\definefileconstant {parentpath} {..} +%definefileconstant {pathseparator} {/} +%definefileconstant {currentpath} {.} +%definefileconstant {parentpath} {..} %D The way fonts are defined and called upon is language %D independant. We follow the scheme laid down by Knuth in @@ -926,18 +863,18 @@ %D For figure inclusion we need: -\defineinterfaceconstant {tif} {tif} -\defineinterfaceconstant {eps} {eps} -\defineinterfaceconstant {mps} {mps} -\defineinterfaceconstant {jpg} {jpg} -\defineinterfaceconstant {pdf} {pdf} -\defineinterfaceconstant {png} {png} -\defineinterfaceconstant {avi} {avi} -\defineinterfaceconstant {mov} {mov} -\defineinterfaceconstant {svg} {svg} -\defineinterfaceconstant {tex} {tex} -\defineinterfaceconstant {tmp} {tmp} -\defineinterfaceconstant {cld} {cld} +%defineinterfaceconstant {tif} {tif} +%defineinterfaceconstant {eps} {eps} +%defineinterfaceconstant {mps} {mps} +%defineinterfaceconstant {jpg} {jpg} +%defineinterfaceconstant {pdf} {pdf} +%defineinterfaceconstant {png} {png} +%defineinterfaceconstant {avi} {avi} +%defineinterfaceconstant {mov} {mov} +%defineinterfaceconstant {svg} {svg} +\defineinterfaceconstant {tex} {tex} % Also gone? +%defineinterfaceconstant {tmp} {tmp} +%defineinterfaceconstant {cld} {cld} %D A careful reader will have noticed that in the module %D \type{mult-ini} we defined \type{\selectinterface}. We were diff --git a/tex/context/base/node-ini.mkiv b/tex/context/base/node-ini.mkiv index f14672557..e071506a2 100644 --- a/tex/context/base/node-ini.mkiv +++ b/tex/context/base/node-ini.mkiv @@ -15,7 +15,7 @@ \unprotect -\newcount\filterstate \filterstate\plusone +\newcount\filterstate \filterstate\plusone % hm, public \registerctxluafile{node-ini}{1.001} \registerctxluafile{node-res}{1.001} @@ -32,14 +32,16 @@ %registerctxluafile{node-inj}{1.001} % we might split it off \registerctxluafile{node-acc}{1.001} % experimental -\newcount\shownodescounter +\newcount\c_nodes_show_box % box number -\def\shownextnodes {\afterassignment\doshownodes\shownextnodescounter} -\def\showflatnodes {\afterassignment\doshownodes\showflatnodescounter} -\def\doshownextnodes {\ctxlua{texio.write_nl('log',nodes.serializebox(\number\shownodescounter,false,true))}} -\def\doshowflatnodes {\ctxlua{texio.write_nl('log',nodes.serializebox(\number\shownodescounter,true, true))}} -\def\visualizenextnodes{\dowithnextbox{\ctxlua{nodes.visualizebox(\number\nextbox,false,true)}}} -\def\visualizeflatnodes{\dowithnextbox{\ctxlua{nodes.visualizebox(\number\nextbox,true,true)}}} +\unexpanded\def\shownextnodes{\afterassignment\nodes_show_next\c_nodes_show_box} +\unexpanded\def\showflatnodes{\afterassignment\nodes_show_flat\c_nodes_show_box} + +\def\nodes_show_next{\ctxlua{texio.write_nl('log',nodes.serializebox(\number\c_nodes_show_box,false,true))}} +\def\nodes_show_flat{\ctxlua{texio.write_nl('log',nodes.serializebox(\number\c_nodes_show_box,true, true))}} + +\unexpanded\def\visualizenextnodes{\dowithnextbox{\ctxlua{nodes.visualizebox(\number\nextbox,false,true)}}} +\unexpanded\def\visualizeflatnodes{\dowithnextbox{\ctxlua{nodes.visualizebox(\number\nextbox,true,true)}}} \unexpanded\def\starttracingnodes[#1]{\ctxlua{nodes.tracers.characters.start("#1")}} \unexpanded\def\stoptracingnodes {\ctxlua{nodes.tracers.characters.stop()}} diff --git a/tex/context/base/node-mig.mkiv b/tex/context/base/node-mig.mkiv index 088f256cf..143fd4466 100644 --- a/tex/context/base/node-mig.mkiv +++ b/tex/context/base/node-mig.mkiv @@ -42,8 +42,8 @@ \registerctxluafile{node-mig}{1.001} -\newtoks \everyautomigratefootnotes -\newtoks \everyautomigratemarks +\newtoks\everyautomigratefootnotes +\newtoks\everyautomigratemarks \def\automigrateinserts{\the\everyautomigratefootnotes} % soon default but does not work (yet) for notes in captions (themselves inserts) \def\automigratemarks {\the\everyautomigratemarks} diff --git a/tex/context/base/norm-ctx.mkiv b/tex/context/base/norm-ctx.mkiv index b1a4c7d35..ff1676743 100644 --- a/tex/context/base/norm-ctx.mkiv +++ b/tex/context/base/norm-ctx.mkiv @@ -13,4 +13,6 @@ %D A few more might end up here (like the weird ones in syst-ini). -\let\normalreqno = \normaleqno +\let\normalreqno\normaleqno + +\endinput diff --git a/tex/context/base/pack-obj.mkiv b/tex/context/base/pack-obj.mkiv index 266f34e49..c2bc0587a 100644 --- a/tex/context/base/pack-obj.mkiv +++ b/tex/context/base/pack-obj.mkiv @@ -224,13 +224,13 @@ \def\objectplaceholder{NOT YET FLUSHED}% \def\presetobject#1#2% \global added - {\ifcsname\r!object#1::#2\endcsname\else - \global\@EA\let\csname\r!object#1::#2\endcsname\objectplaceholder + {\ifcsname\??ob:#1::#2\endcsname\else + \global\@EA\let\csname\??ob:#1::#2\endcsname\objectplaceholder \fi} \def\dosetobject#1#2#3% \initializepaper this will move to \everyshipout {% \initializepaper - \ifcsname\r!object#2::#3\endcsname + \ifcsname\??ob:#2::#3\endcsname \expandafter\gobblefivearguments \else % tzt, overload internal referenced objects to save entries \expandafter\dodosetobject @@ -238,7 +238,7 @@ {#1}{#2}{#3}} \def\resetobject#1#2% - {\letbeundefined{\r!object#1::#2}} + {\letbeundefined{\??ob:#1::#2}} %D \macros %D {finalizeobjectbox} @@ -271,7 +271,7 @@ {\begingroup \dontshowcomposition % rather fuzzy in \setxvalue ... \hbox \scratchdimen\objectoffset - \@EA\xdef\csname\r!object#2::#3\endcsname + \@EA\xdef\csname\??ob:#2::#3\endcsname {\noexpand\dohandleobject{#2}{#3}% {\ifhbox\nextbox\hbox\else\vbox\fi}% {\number\nextboxwd}{\number\nextboxht}{\number\nextboxdp}% @@ -288,10 +288,10 @@ \endgroup} \def\getobject#1#2% - {\ifcsname\r!object#1::#2\endcsname + {\ifcsname\??ob:#1::#2\endcsname \begingroup \let\dohandleobject\dogetobject - \csname\r!object#1::#2\expandafter\endcsname + \csname\??ob:#1::#2\expandafter\endcsname \else {\infofont[object #1::#2]}% \fi} @@ -336,7 +336,7 @@ \let\objectwidth \!!zeropoint \let\objectheight\!!zeropoint \let\objectdepth \!!zeropoint - \csname\r!object#1::#2\endcsname} + \csname\??ob:#1::#2\endcsname} %D Apart from this kind of objects, that have typeset content, %D we can have low level driver specific objects. Both types @@ -396,7 +396,7 @@ %D \stoptyping \def\doifobjectfoundelse#1#2% - {\ifcsname\r!object#1::#2\endcsname + {\ifcsname\??ob:#1::#2\endcsname \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments diff --git a/tex/context/base/page-mul.mkiv b/tex/context/base/page-mul.mkiv index 0f33fc37c..4fcb72719 100644 --- a/tex/context/base/page-mul.mkiv +++ b/tex/context/base/page-mul.mkiv @@ -1358,56 +1358,59 @@ \newif\ifflushingcolumnfloats \flushingcolumnfloatstrue \def\doflushcolumnfloat - {\ifpostponecolumnfloats\else\ifflushingcolumnfloats\ifprocessingverbatim\else\ifsomefloatwaiting - \bgroup - \forgetall - \let\doflushcolumnfloat\relax - \getcolumnstatus\column\mofcolumns\total\dimen0\goal\dimen2\\% - \ifdim\dimen0>\zeropoint - \dofloatsgetinfo\s!text - \ifdim\floatwidth>\hsize - % dropped ? - \else - \setbox2\vbox - {\blank[\rootfloatparameter\c!spacebefore] - \snaptogrid\vbox{\vskip\floatheight}}% - \advance\dimen0 \ht2 - \ifdim\dimen0>\dimen2 - \ifnum\mofcolumns<\nofcolumns - \advance\mofcolumns \plusone - \ifdim\ht\currenttopcolumnbox=\zeropoint - \dofloatsflush\s!text{1}% - \global\setbox\currenttopcolumnbox\vbox - {\snaptogrid\vbox{\box\floatbox} - \whitespace % nodig ? - \blank[\rootfloatparameter\c!spaceafter]}% - \dimen4=\htdp\currenttopcolumnbox - \global\advance\vsize -\dimen4 - \advance\dimen4 -\pagegoal - \global\pagegoal-\dimen4 - \showmessage\m!columns{12}a% - \else - \showmessage\m!columns{12}b% - \fi + {\ifpostponecolumnfloats\else\ifflushingcolumnfloats\ifsomefloatwaiting + \doflushcolumnfloatindeed + \fi\fi\fi} + +\def\doflushcolumnfloatindeed + {\bgroup + \forgetall + \let\doflushcolumnfloat\relax + \getcolumnstatus\column\mofcolumns\total\dimen0\goal\dimen2\\% + \ifdim\dimen0>\zeropoint + \dofloatsgetinfo\s!text + \ifdim\floatwidth>\hsize + % dropped ? + \else + \setbox2\vbox + {\blank[\rootfloatparameter\c!spacebefore] + \snaptogrid\vbox{\vskip\floatheight}}% + \advance\dimen0 \ht2 + \ifdim\dimen0>\dimen2 + \ifnum\mofcolumns<\nofcolumns + \advance\mofcolumns \plusone + \ifdim\ht\currenttopcolumnbox=\zeropoint + \dofloatsflush\s!text{1}% + \global\setbox\currenttopcolumnbox\vbox + {\snaptogrid\vbox{\box\floatbox} + \whitespace % nodig ? + \blank[\rootfloatparameter\c!spaceafter]}% + \dimen4=\htdp\currenttopcolumnbox + \global\advance\vsize -\dimen4 + \advance\dimen4 -\pagegoal + \global\pagegoal-\dimen4 + \showmessage\m!columns{12}a% \else - \showmessage\m!columns{12}c% + \showmessage\m!columns{12}b% \fi \else - \ifhmode{\setbox0\lastbox}\fi% waar is die er in geslopen - \par - \ifdim\prevdepth<\zeropoint \else % anders bovenaan kolom witruimte - \nobreak - \blank[\rootfloatparameter\c!spacebefore] - \nobreak - \fi - \dofloatsflush\s!text{1}% - \flushfloatbox - \blank[\rootfloatparameter\c!spaceafter] + \showmessage\m!columns{12}c% \fi + \else + \ifhmode{\setbox0\lastbox}\fi% waar is die er in geslopen + \par + \ifdim\prevdepth<\zeropoint \else % anders bovenaan kolom witruimte + \nobreak + \blank[\rootfloatparameter\c!spacebefore] + \nobreak + \fi + \dofloatsflush\s!text{1}% + \flushfloatbox + \blank[\rootfloatparameter\c!spaceafter] \fi \fi - \egroup - \fi\fi\fi\fi} + \fi + \egroup} %D This one looks complicated. Upto \type{\nofcolumns} floats %D are placed, taking the width of a float into account. This diff --git a/tex/context/base/page-sid.mkiv b/tex/context/base/page-sid.mkiv index ee1962310..2ff15bb37 100644 --- a/tex/context/base/page-sid.mkiv +++ b/tex/context/base/page-sid.mkiv @@ -37,7 +37,7 @@ \newdimen \d_page_sides_width \newdimen \d_page_sides_hsize \newdimen \d_page_sides_vsize -\newdimen \d_page_sides_vsize_reset \d_page_sides_vsize_reset -\onepoint % signal (could be a chardef) +\newdimen \d_page_sides_vsize_reset \d_page_sides_vsize_reset -\onepoint % could be a \let \newdimen \d_page_sides_progress \newdimen \d_page_sides_page_total \newdimen \d_page_sides_saved_depth @@ -57,14 +57,40 @@ \newconditional \c_page_sides_r_eq % messy, needs checking anyway \newconditional \c_page_sides_l_eq % messy, needs checking anyway -\newif \ifroomforfloat % shared (will change) -\newif \iftracesidefloats % public (might change) +\newdimen \d_page_sides_shift +\newdimen \d_page_sides_extrashift +\newdimen \d_page_sided_leftshift +\newdimen \d_page_sided_rightshift +\newdimen \d_page_sides_leftskip +\newdimen \d_page_sides_rightskip +\newdimen \d_page_sides_maximum +\newdimen \d_page_sides_topskip +\newdimen \d_page_sides_bottomskip +\newdimen \d_page_sides_downshift + +\setnewconstant \c_page_sides_align \zerocount +\setnewconstant \c_page_sides_method \plusone % 0=raw 1=safe (.99) 2=tight (-1pt) + +% begin of public variables, this will change +% +% we need a setter and resetter .. or maybe a \placesidefloat[settings] to +% keep variables separated + +\let\sidefloatshift \d_page_sides_shift +\let\sidefloatextrashift\d_page_sides_extrashift +\let\sidefloatleftshift \d_page_sided_leftshift +\let\sidefloatrightshift\d_page_sided_rightshift +\let\sidefloatleftskip \d_page_sides_leftskip +\let\sidefloatrightskip \d_page_sides_rightskip +\let\sidefloatmaximum \d_page_sides_maximum +\let\sidefloattopskip \d_page_sides_topskip +\let\sidefloatbottomskip\d_page_sides_bottomskip +\let\sidefloatdownshift \d_page_sides_downshift + +\let\sidefloatsidelines \c_page_sides_n_of_lines -\newdimen \sidefloatshift % public -\newdimen \sidefloatextrashift % public -\newdimen \sidefloatleftskip % public -\newdimen \sidefloatrightskip % public -\newdimen \sidefloatmaximum % public +\let\sidefloatalign \c_page_sides_align +\let\sidefloatmethod \c_page_sides_method \def\backspacefloat {\global\c_page_sides_float_type\plusone \page_sides_handle_float} \def\leftedgefloat {\global\c_page_sides_float_type\plustwo \page_sides_handle_float} @@ -76,29 +102,33 @@ \def\cutspacefloat {\global\c_page_sides_float_type\pluseight\page_sides_handle_float} \let\marginfloat \cutspacefloat - \let\logsidefloat \relax +\newif\ifroomforfloat % shared (will change) +\newif\iftracesidefloats % public (might change) + +% end of public variables + \def\page_sides_insert_info {\doinsertfloatinfo} \def\page_sides_apply_horizontal_shift - {\ifdim\sidefloatmaximum>\zeropoint + {\ifdim\d_page_sides_maximum>\zeropoint \ifcase\c_page_sides_float_type % invalid \or % backspace \or - \global\sidefloatshift\dimexpr - -\sidefloatmaximum + \global\d_page_sides_shift\dimexpr + -\d_page_sides_maximum -\rightorleftpageaction \leftedgedistance \rightedgedistance -\rightorleftpageaction \leftmarginwidth \rightmarginwidth -\rightorleftpageaction \leftmargindistance \rightmargindistance -\compensatedinnermakeupmargin \relax \or - \global\sidefloatshift\dimexpr - -\sidefloatmaximum + \global\d_page_sides_shift\dimexpr + -\d_page_sides_maximum -\rightorleftpageaction \leftmargindistance \rightmargindistance -\compensatedinnermakeupmargin \relax @@ -107,14 +137,14 @@ \or % right \or - \global\sidefloatshift\dimexpr - -\sidefloatmaximum + \global\d_page_sides_shift\dimexpr + -\d_page_sides_maximum -\rightorleftpageaction \leftmargindistance \rightmargindistance -\compensatedinnermakeupmargin \relax \or - \global\sidefloatshift\dimexpr - -\sidefloatmaximum + \global\d_page_sides_shift\dimexpr + -\d_page_sides_maximum -\rightorleftpageaction \leftedgedistance \rightedgedistance -\rightorleftpageaction \leftmarginwidth \rightmarginwidth -\rightorleftpageaction \leftmargindistance \rightmargindistance @@ -124,13 +154,13 @@ % cutspace \fi \fi - \ifdim\sidefloatshift=\zeropoint \relax + \ifdim\d_page_sides_shift=\zeropoint \relax \ifnum\c_page_sides_float_type=\plusfour - \global\advance\sidefloatshift\sidefloatextrashift - \global\sidefloatextrashift\zeropoint + \global\advance\d_page_sides_shift\d_page_sides_extrashift + \global\d_page_sides_extrashift\zeropoint \else\ifnum\c_page_sides_float_type=\plusfive - \global\advance\sidefloatshift\sidefloatextrashift - \global\sidefloatextrashift\zeropoint + \global\advance\d_page_sides_shift\d_page_sides_extrashift + \global\d_page_sides_extrashift\zeropoint \fi\fi \else \ifnum\c_page_sides_float_type<\plusfour @@ -141,48 +171,48 @@ \fi} \def\page_sides_set_skips - {\global\sidefloatrightskip\zeropoint - \global\sidefloatleftskip \zeropoint + {\global\d_page_sides_rightskip\zeropoint + \global\d_page_sides_leftskip \zeropoint \ifcase\c_page_sides_float_type \or % backspace - \global\sidefloatleftskip\dimexpr + \global\d_page_sides_leftskip\dimexpr +\rightorleftpageaction \backspace \cutspace +\compensatedinnermakeupmargin \relax \or % leftedge - \global\sidefloatleftskip\dimexpr + \global\d_page_sides_leftskip\dimexpr +\rightorleftpageaction \leftmargindistance \rightmargindistance +\rightorleftpageaction \leftmarginwidth \rightmarginwidth +\rightorleftpageaction \leftedgedistance \rightedgedistance +\compensatedinnermakeupmargin \relax \or % leftmargin - \global\sidefloatleftskip\dimexpr + \global\d_page_sides_leftskip\dimexpr +\rightorleftpageaction \leftmargindistance \rightmargindistance +\compensatedinnermakeupmargin \relax \or % leftside \or % rightside \or % rightmargin - \global\sidefloatrightskip\dimexpr + \global\d_page_sides_rightskip\dimexpr +\rightorleftpageaction \rightmargindistance \leftmargindistance +\compensatedinnermakeupmargin \relax \or % rightedge - \global\sidefloatrightskip\dimexpr + \global\d_page_sides_rightskip\dimexpr +\rightorleftpageaction \rightmargindistance \leftmargindistance +\rightorleftpageaction \rightmarginwidth \leftmarginwidth +\rightorleftpageaction \rightedgedistance \leftedgedistance +\compensatedinnermakeupmargin \relax \or % cutspace - \global\sidefloatrightskip\dimexpr + \global\d_page_sides_rightskip\dimexpr +\rightorleftpageaction \cutspace \backspace +\compensatedinnermakeupmargin \relax \fi - \ifdim\sidefloatrightskip>\zeropoint \doglobal\advance\sidefloatrightskip\rightskip \fi - \ifdim\sidefloatleftskip >\zeropoint \doglobal\advance\sidefloatleftskip \leftskip \fi} + \ifdim\d_page_sides_rightskip>\zeropoint \doglobal\advance\d_page_sides_rightskip\rightskip \fi + \ifdim\d_page_sides_leftskip >\zeropoint \doglobal\advance\d_page_sides_leftskip \leftskip \fi} \def\page_sides_flush_floats {\par @@ -195,7 +225,7 @@ \global\setfalse\c_page_sides_flag} \def\page_sides_flush_floats_indeed - {\global\advance\d_page_sides_vsize-\sidefloatbottomskip + {\global\advance\d_page_sides_vsize-\d_page_sides_bottomskip \begingroup \let\page_sides_flush_floats\relax \forgetall @@ -217,9 +247,9 @@ \fi}% \endgroup \ifdim\parskip>\zeropoint % why this test ? - \ifdim\sidefloatbottomskip>\parskip + \ifdim\d_page_sides_bottomskip>\parskip \nowhitespace - \vskip\sidefloatbottomskip + \vskip\d_page_sides_bottomskip \fi \fi} @@ -310,7 +340,7 @@ \else \global\divide\d_page_sides_hsize \plustwo \fi - \hskip\d_page_sides_hsize + \hskip\d_page_sides_hsize % \kern \fi \fi \box\b_page_sides_bottom @@ -328,7 +358,7 @@ \ifinner \else \vadjust{\penalty\minusone}% \fi - \hskip\d_page_sides_width\relax + \hskip\d_page_sides_width\relax % \kern %\else % we have a margin or edge float \fi @@ -336,78 +366,78 @@ % The clean way: % -% \global\setbox\floatbox\hbox % no \hskip, but \kern here +% \global\setbox\floatbox\hbox % {\ifcase\c_page_sides_float_type % \vbox{#1}% % \or % 1 -% \hskip\sidefloatleftshift -% \hskip\sidefloatshift +% \kern\d_page_sided_leftshift +% \kern\d_page_sides_shift % \vbox{#1}% -% \kern-\sidefloatextrashift +% \kern-\d_page_sides_extrashift % \or % 2 -% \hskip\sidefloatshift +% \kern\d_page_sides_shift % \vbox{#1}% -% \kern-\sidefloatextrashift +% \kern-\d_page_sides_extrashift % \or % 3 -% \hskip\sidefloatshift +% \kern\d_page_sides_shift % \vbox{#1}% -% \kern-\sidefloatextrashift +% \kern-\d_page_sides_extrashift % \or % 4 -% \hskip\sidefloatleftshift -% \hskip\sidefloatshift +% \kern\d_page_sided_leftshift +% \kern\d_page_sides_shift % \vbox{#1\removedepth}% -% \kern-\sidefloatextrashift +% \kern-\d_page_sides_extrashift % \or % 5 -% \hskip-\sidefloatextrashift +% \kern-\d_page_sides_extrashift % \vbox{#1}% -% \kern\sidefloatshift -% \kern\sidefloatrightshift +% \kern\d_page_sides_shift +% \kern\d_page_sided_rightshift % \or % 6 -% \hskip-\sidefloatextrashift +% \kern-\d_page_sides_extrashift % \vbox{#1}% -% \kern\sidefloatshift +% \kern\d_page_sides_shift % \or % 7 -% \hskip-\sidefloatextrashift +% \kern-\d_page_sides_extrashift % \vbox{#1}% -% \kern\sidefloatshift +% \kern\d_page_sides_shift % \or % 8 -% \hskip-\sidefloatextrashift +% \kern-\d_page_sides_extrashift % \vbox{#1}% -% \kern\sidefloatshift -% \kern\sidefloatrightshift +% \kern\d_page_sides_shift +% \kern\d_page_sided_rightshift % \fi} % % The compact way: \def\page_sides_relocate_float#1% - {\global\setbox\floatbox\hbox % no \hskip, but \kern here + {\global\setbox\floatbox\hbox {\ifnum\c_page_sides_float_type=\plusfour - \hskip\sidefloatleftshift + \kern\d_page_sided_leftshift \else\ifnum\c_page_sides_float_type=\plusone - \hskip\sidefloatleftshift + \kern\d_page_sided_leftshift \fi\fi \ifnum\c_page_sides_float_type>\plusfour - \hskip-\sidefloatextrashift + \kern-\d_page_sides_extrashift \else - \hskip\sidefloatshift + \kern\d_page_sides_shift \fi - \vbox{#1\ifnum\sidefloatalign=\plusfour \removedepth\fi}% + \vbox{#1\ifnum\c_page_sides_align=\plusfour \removedepth\fi}% \ifnum\c_page_sides_float_type>\plusfour - \kern\sidefloatshift + \kern\d_page_sides_shift \else - \kern-\sidefloatextrashift + \kern-\d_page_sides_extrashift \fi \ifnum\c_page_sides_float_type=\pluseight - \kern\sidefloatrightshift + \kern\d_page_sided_rightshift \else\ifnum\c_page_sides_float_type=\plusfive - \kern\sidefloatrightshift + \kern\d_page_sided_rightshift \fi\fi}} \def\page_sides_apply_vertical_shift - {\ifnum\sidefloatalign=\plusfour + {\ifnum\c_page_sides_align=\plusfour \getnoflines{\ht\floatbox}% \scratchdimen\dimexpr\noflines\lineheight-\strutdepth\relax - \getrawnoflines\sidefloattopskip + \getrawnoflines\d_page_sides_topskip \advance\scratchdimen\noflines\lineheight % todo: maybe rounding problem here % \global\setbox\floatbox\hbox{\lower\lineheight\box\floatbox}% @@ -415,31 +445,31 @@ \ht\floatbox\scratchdimen \dp\floatbox\zeropoint \fi - \ifcase\sidefloatalign \else - \global\sidefloattopskip\zeropoint + \ifcase\c_page_sides_align \else + \global\d_page_sides_topskip\zeropoint \fi \scratchdimen \ifnum\c_page_sides_float_type<\plusfour - \sidefloattopskip + \d_page_sides_topskip \else\ifnum\c_page_sides_float_type>\plusfive - \sidefloattopskip + \d_page_sides_topskip \else \zeropoint \fi\fi % the top of the box is at the previous baseline - \ifcase\sidefloatalign + \ifcase\c_page_sides_align % 0 normal - \advance\scratchdimen\strutdepth % == \sidefloattopoffset + \advance\scratchdimen\strutdepth % or \openstrutdepth \or % 1 height - \advance\scratchdimen\strutdepth % == \sidefloattopoffset + \advance\scratchdimen\strutdepth % or \openstrutdepth \or % 2 line \or % 3 depth - \advance\scratchdimen\lineheight - \advance\scratchdimen\strutdepth + \advance\scratchdimen\lineheight % or \openlineheight + \advance\scratchdimen\strutdepth % or \openstrutdepth \or % 4 grid \scratchdimen\zeropoint \or - \advance\scratchdimen\strutheight + \advance\scratchdimen\strutheight % or \openstrutheight \fi % new \global\c_page_sides_lines_done\zerocount @@ -451,17 +481,17 @@ {\vskip\scratchdimen \nointerlineskip \box\floatbox - \ifnum\sidefloatalign=\plusfive \vskip-\lineheight \fi}}% + \ifnum\c_page_sides_align=\plusfive \vskip-\lineheight \fi}}% \ifnum\c_page_sides_float_type<\plusfour - \global\sidefloattopskip\zeropoint + \global\d_page_sides_topskip\zeropoint \else\ifnum\c_page_sides_float_type>\plusfive - \global\sidefloattopskip\zeropoint + \global\d_page_sides_topskip\zeropoint \fi\fi - \global\sidefloatdownshift\zeropoint} + \global\d_page_sides_downshift\zeropoint} \def\page_sides_place_float - {\ifnum\c_page_sides_float_type=\plusfour \kern\sidefloattopskip \fi - \ifnum\c_page_sides_float_type=\plusfive \kern\sidefloattopskip \fi + {\ifnum\c_page_sides_float_type=\plusfour \kern\d_page_sides_topskip \fi + \ifnum\c_page_sides_float_type=\plusfive \kern\d_page_sides_topskip \fi \d_page_sides_saved_depth\prevdepth \nointerlineskip \ifgridsnapping @@ -514,21 +544,21 @@ \ifcase\c_page_sides_float_type % invalid \or % backspace - \noindent#1{\llap{\rlap{\box\floatbox}\hskip\sidefloatleftskip}}\hfill + \noindent#1{\llap{\rlap{\box\floatbox}\kern\d_page_sides_leftskip}}\hfill \or % leftedge - \noindent#1{\llap{\box\floatbox\hskip\sidefloatleftskip}}\hfill + \noindent#1{\llap{\box\floatbox\kern\d_page_sides_leftskip}}\hfill \or % leftmargin - \noindent#1{\llap{\box\floatbox\hskip\sidefloatleftskip}}\hfill + \noindent#1{\llap{\box\floatbox\kern\d_page_sides_leftskip}}\hfill \or % leftside \noindent#1{\box\floatbox}\hfill \or % rightside \hfill#1{\box\floatbox}% \or % rightmargin - \hfill#1{\rlap{\hskip\sidefloatrightskip\box\floatbox}}% + \hfill#1{\rlap{\kern\d_page_sides_rightskip\box\floatbox}}% \or % rightedge - \hfill#1{\rlap{\hskip\sidefloatrightskip\box\floatbox}}% + \hfill#1{\rlap{\kern\d_page_sides_rightskip\box\floatbox}}% \or % cutspace - \hfill#1{\rlap{\hskip\sidefloatrightskip\llap{\box\floatbox}}}% + \hfill#1{\rlap{\kern\d_page_sides_rightskip\llap{\box\floatbox}}}% \fi \endgroup} @@ -555,12 +585,12 @@ \global\d_page_sides_width\zeropoint \fi \global\d_page_sides_hsize \dimexpr\hsize-\d_page_sides_width\relax - \global\d_page_sides_height\dimexpr\ht\floatbox+\dp\floatbox+\sidefloattopskip\relax + \global\d_page_sides_height\dimexpr\ht\floatbox+\dp\floatbox+\d_page_sides_topskip\relax \global\d_page_sides_vsize \dimexpr\d_page_sides_height+\d_page_sides_page_total\relax \dimen0\d_page_sides_vsize \dimen2\pagegoal \relax - \ifcase\sidefloatmethod + \ifcase\c_page_sides_method % method 0 : raw \or % method 1 : safe @@ -573,13 +603,13 @@ \ifdim\dimen0>\dimen2 \global\roomforfloatfalse \else - \ifdim\dimexpr\pagegoal-\d_page_sides_vsize\relax<\sidefloatbottomskip + \ifdim\dimexpr\pagegoal-\d_page_sides_vsize\relax<\d_page_sides_bottomskip \global\advance\d_page_sides_vsize \dimen0 \global\settrue\c_page_sides_short \page_otr_sides_push_penalties % why was this \global\holdinginserts\plusone \else - \global\advance\d_page_sides_vsize \sidefloatbottomskip + \global\advance\d_page_sides_vsize \d_page_sides_bottomskip \global\setfalse\c_page_sides_short \fi \global\roomforfloattrue @@ -672,10 +702,10 @@ \fi \global\advance\c_page_sides_checks_done \plusone \iftracesidefloats - \hskip-\d_page_sides_width + \hskip-\d_page_sides_width % kern \color[darkgray]% {\vrule\!!height.5\points\!!depth.5\points\!!width\d_page_sides_width - \llap{\showstruts\strut\hskip.25\bodyfontsize}}% + \llap{\showstruts\strut\kern.25\bodyfontsize}}% \fi} \def\page_sides_check_floats_reset @@ -742,7 +772,7 @@ % % \fi -\def\adjustsidefloatdisplaylines +\def\adjustsidefloatdisplaylines % public, will change {\aftergroup\page_sides_adjust_display_lines} \def\page_sides_adjust_display_lines diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 1874b20e4..f6656b7ad 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex c26902eb9..17abf7776 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index 5e9dd5ec5..579890985 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -586,9 +586,7 @@ \fi \float_end_group} -\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) \setnewconstant\floatrotation \zerocount % 0 90 180 270 \def\float_analyze_variables_two @@ -836,11 +834,17 @@ -\v!hang=>\float_move_down_hang\minusone]} \def\float_move_down_line#sign% - {\if!!donea\else\global\sidefloatdownshift\zeropoint\!!doneatrue\fi + {\if!!donea \else + \global\sidefloatdownshift\zeropoint + \!!doneatrue + \fi \global\advance\sidefloatdownshift#sign\lineheight} \def\float_move_down_hang#lines% - {\if!!doneb\else\global\sidefloatsidelines\zerocount\!!donebtrue\fi + {\if!!doneb \else + \global\sidefloatsidelines\zerocount + \!!donebtrue + \fi \global\advance\sidefloatsidelines#lines\relax} \unexpanded\def\movedownsidefloat[#settings]% already in core @@ -936,15 +940,6 @@ \newdimen\floattopskip \floattopskip \floattopskip \newdimen\floatbottomskip \floatbottomskip \floattopskip -\newdimen\sidefloattopskip \sidefloattopskip \floattopskip -\newdimen\sidefloatbottomskip \sidefloatbottomskip\floatbottomskip - -\newskip\sidefloatdownshift -\newskip\sidefloatleftshift -\newskip\sidefloatrightshift - -\def\sidefloattopoffset {\openstrutdepth} % {\strutdp} - \newcount\noftopfloats \noftopfloats=2 \newcount\nofbotfloats \nofbotfloats=0 @@ -965,7 +960,6 @@ \float_calculate_skip\floatbottomskip {\rootfloatparameter\c!spaceafter}% \float_calculate_skip\sidefloattopskip {\rootfloatparameter\c!sidespacebefore}% \float_calculate_skip\sidefloatbottomskip{\rootfloatparameter\c!sidespaceafter}% - \gdef \sidefloattopoffset {\openstrutdepth}% was \def \global\floatsideskip \rootfloatparameter\c!margin \global\sidefloatleftshift \floatparameter\c!leftmargindistance \global\sidefloatrightshift\floatparameter\c!rightmargindistance diff --git a/tex/context/base/strc-ref.mkvi b/tex/context/base/strc-ref.mkvi index b80016e52..b6a644619 100644 --- a/tex/context/base/strc-ref.mkvi +++ b/tex/context/base/strc-ref.mkvi @@ -49,11 +49,6 @@ \let\showcurrentreference \relax \let\setexecutecommandcheck\gobbletwoarguments -\def\s!full{full} -\def\s!user{user} -\def\s!text{text} -\def\s!page{page} - % todo : unknown/illegal reference no arg % todo : +n pages check on 'samepage' (contrastcolor) % todo : multiple text in reference diff --git a/tex/context/base/syst-ini.mkiv b/tex/context/base/syst-ini.mkiv index 62aff5f3f..05002f3f9 100644 --- a/tex/context/base/syst-ini.mkiv +++ b/tex/context/base/syst-ini.mkiv @@ -92,8 +92,6 @@ \expandafter\end \fi -% todo: pdfsave pdfrestore pdfcolor... don't initialize them - \ifnum\texengine=\luatexengine \directlua 0 { % this info is stored in the format lua.name[0] = "main ctx instance" @@ -129,10 +127,22 @@ \mathchardef\etexversion = \numexpr\eTeXversion*100+\expandafter\gobbleoneargument\eTeXrevision\relax %D First we define a simplified version of the \CONTEXT\ -%D protection mechanism. - -\def\protect {\catcode`@=\the\catcode`@ \catcode`_=\the\catcode`_} -\def\unprotect{\catcode`@=11 \catcode`_=11 } +%D protection mechanism. Later we will implement a better +%D variant. + +\def\unprotect + {\edef\protect + {\catcode`@=\the\catcode`@\relax + \catcode`?=\the\catcode`?\relax + \catcode`!=\the\catcode`!\relax + \catcode`_=\the\catcode`_\relax + \let\protect\relax}% + \catcode`@=11 + \catcode`?=11 + \catcode`!=11 + \catcode`_=11 } + +\let\protect\relax \unprotect @@ -191,23 +201,18 @@ \countdef \min_counter_value = 125 \min_counter_value = -"7FFFFFFF % beware, we use index 125 at the lua end \countdef \max_counter_value = 126 \max_counter_value = "7FFFFFFF % beware, we use index 126 at the lua end -%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 +\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 +\countdef \normalpagebox = 127 \normalpagebox = 255 % hardcoded in pdftex/xetex -% A few traditional allocations: +% A few traditional allocations (these might go): -\countdef \count@ = 255 % hm, used in \newif .. todo: replace it there -\dimendef \dimen@ = 0 -\dimendef \dimen@i = 1 % global only -\dimendef \dimen@ii = 2 +\countdef \count@ = 255 % hm, used in \newif .. todo: replace it there +\dimendef \dimen@ = 0 +\dimendef \dimen@i = 1 % global only +\dimendef \dimen@ii = 2 %D So, effectively we start allocating from 256 and upwards. The %D inserts sit in the range 128 upto 254. Page numbers use the @@ -215,7 +220,7 @@ %D scratch registers upto 31 without problem but all others are %D reserved. -\def\wlog#1{} % \def\wlog{\immediate\write\minusone} % write on log file (only) +\let\wlog\gobbleoneargument % Let's get rid of this one. %D The allocators share a common helper macro. @@ -242,7 +247,7 @@ \normalprotected\def\newconstant #1{\ifdefined#1\let#1\undefined\fi\newcount#1} \normalprotected\def\setnewconstant#1{\ifdefined#1\let#1\undefined\fi\newcount#1#1} % just a number -\normalprotected\def\setconstant {} % dummy +\normalprotected\def\setconstant {} % dummy, no checking, so it warns % maybe setconstant with check @@ -304,7 +309,8 @@ %D Not used by \CONTEXT\ but for instance \PICTEX\ needs it. It's a %D trick to force strings instead of tokens that take more memory. -%D It's a trick to trick to force strings. +%D It's a trick to trick to force strings. This macro is never used +%D in \CONTEXT. \normalprotected\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}} @@ -343,14 +349,14 @@ %D More allocations: -\newskip \zeroskip \zeroskip = 0pt plus 0pt minus 0pt -\newdimen\zeropoint \zeropoint = 0pt -\newdimen\onepoint \onepoint = 1pt -\newdimen\halfapoint \halfapoint = 0.5pt -\newdimen\maxdimen \maxdimen = 16383.99999pt -\newdimen\onebasepoint \onebasepoint = 1bp -\newdimen\scaledpoint \scaledpoint = 1sp -\newdimen\thousandpoint\thousandpoint= 1000pt +\newskip \zeroskip \zeroskip = 0pt plus 0pt minus 0pt +\newdimen\zeropoint \zeropoint = 0pt +\newdimen\onepoint \onepoint = 1pt +\newdimen\halfapoint \halfapoint = 0.5pt +\newdimen\maxdimen \maxdimen = 16383.99999pt +\newdimen\onebasepoint \onebasepoint = 1bp +\newdimen\scaledpoint \scaledpoint = 1sp +\newdimen\thousandpoint \thousandpoint = 1000pt \let\points \onepoint \let\halfpoint\halfapoint @@ -771,9 +777,9 @@ %D The following registers are kind of standard and (for the moment) %D we define them here. This might change. -\newskip \bigskipamount \bigskipamount = 12pt plus 4pt minus 4pt -\newskip \medskipamount \medskipamount = 6pt plus 2pt minus 2pt -\newskip \smallskipamount \smallskipamount = 3pt plus 1pt minus 1pt +\newskip \bigskipamount \bigskipamount = 12pt plus 4pt minus 4pt +\newskip \medskipamount \medskipamount = 6pt plus 2pt minus 2pt +\newskip \smallskipamount \smallskipamount = 3pt plus 1pt minus 1pt \baselineskip = 12pt \lineskip = 1pt @@ -788,7 +794,7 @@ {\hskip\hideskip} \def\ialign % initialized \halign - {\everycr{}% + {\everycr\emptytoks \tabskip\zeroskip \halign} diff --git a/tex/context/base/syst-lua.mkiv b/tex/context/base/syst-lua.mkiv index a42634896..0d72e4a01 100644 --- a/tex/context/base/syst-lua.mkiv +++ b/tex/context/base/syst-lua.mkiv @@ -32,7 +32,7 @@ \edef\!!bs{[\luastringsep[} \edef\!!es{]\luastringsep]} -\def\writestatus#1#2{\ctxcommand{writestatus(\!!bs#1\!!es,\!!bs#2\!!es)}} +\unexpanded\def\writestatus#1#2{\ctxcommand{writestatus(\!!bs#1\!!es,\!!bs#2\!!es)}} % a handy helper (we can probably omit the tex.ctxcatcodes here as nowadays we seldom % change the regime at the tex end diff --git a/tex/context/base/toks-ini.mkiv b/tex/context/base/toks-ini.mkiv index 70c4940e3..e8b296210 100644 --- a/tex/context/base/toks-ini.mkiv +++ b/tex/context/base/toks-ini.mkiv @@ -20,11 +20,11 @@ %D Handy for manuals \unknown \unexpanded\def\starttokens [#1]{\ctxlua{tokens.collectors.install("#1","stoptokens")}} -\let\stoptokens \relax -\def\flushtokens [#1]{\ctxlua{tokens.collectors.flush("#1")}} -\def\showtokens [#1]{\ctxlua{tokens.collectors.show("#1")}} -\def\testtokens [#1]{\ctxlua{tokens.collectors.with_words("#1")}} -\def\registertoken #1{\ctxlua{tokens.collectors.register("#1")}} + \let\stoptokens \relax + \def\flushtokens [#1]{\ctxlua{tokens.collectors.flush("#1")}} + \def\showtokens [#1]{\ctxlua{tokens.collectors.show("#1")}} + \def\testtokens [#1]{\ctxlua{tokens.collectors.with_words("#1")}} + \def\registertoken #1{\ctxlua{tokens.collectors.register("#1")}} %D Inspired by a prototype by Taco for Thomas cum suis. @@ -45,33 +45,25 @@ % % \stoptext -% incompatible with mkii ! ! ! ! so we need other names here -% -% \def\dograbuntil#1#2% -% {\long\def\next##1#1{#2##1}\next} -% -% \def\grabuntil#1% -% {\expandafter\dograbuntil\expandafter{\csname#1\endcsname}} +\unexpanded\def\defineremapper[#1]% + {\setuevalue{\e!start#1}{\tokens_start_remapper{#1}}% + \setuevalue{\e!stop #1}{\tokens_stop_remapper {#1}}% + \letvalue{#1}\relax + \normalexpanded{\expandafter\def\csname#1\endcsname##1{\csname\e!start#1\endcsname##1\csname\e!stop#1\endcsname}}} -\def\dostartremapper#1% +\unexpanded\def\tokens_start_remapper#1% {\ctxlua{tokens.collectors.install("#1", "\e!stop#1")}} -\def\dostopremapper#1% +\unexpanded\def\tokens_stop_remapper#1% {\ctxlua{tokens.collectors.handle("#1",function(str) return tokens.collectors.remapper.convert("#1",str) end, true)}} -\def\remaptokens#1% +\unexpanded\def\remaptokens#1% {\ctxlua{tokens.collectors.handle("#1",function(str) return tokens.collectors.remapper.convert("#1",str) end)}} -\unexpanded\def\defineremapper[#1]% - {\setvalue{\e!start#1}{\dostartremapper{#1}}% - \setvalue{\e!stop #1}{\dostopremapper {#1}}% - \def\next##1{\setvalue{#1}####1{\getvalue{\e!start#1}####1##1}}% - \expandafter\next\csname\e!stop#1\endcsname} - -\def\remapcharacter - {\dodoubleempty\doremapcharacter} +\unexpanded\def\remapcharacter + {\dodoubleempty\tokens_remap_character} -\def\doremapcharacter[#1][#2]#3% +\def\tokens_remap_character[#1][#2]#3% {\ctxlua{tokens.collectors.install("store", "ctxlua")}#3% \ctxlua{tokens.collectors.remapper.store("store","#1",\number#2)}} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 062252518..afaef1878 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 12/22/11 16:52:48 +-- merge date : 12/23/11 09:52:45 do -- begin closure to overcome local limits and interference |