summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-ro.mkii1
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/data-crl.lua2
-rw-r--r--tex/context/base/mkiv/enco-ini.mkiv4
-rw-r--r--tex/context/base/mkiv/math-ali.mkiv78
-rw-r--r--tex/context/base/mkiv/math-ini.mkiv86
-rw-r--r--tex/context/base/mkiv/mtx-context-meaning.tex18
-rw-r--r--tex/context/base/mkiv/mult-def.lua4
-rw-r--r--tex/context/base/mkiv/mult-sys.mkiv2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25581 -> 25545 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin250148 -> 250920 bytes
-rw-r--r--tex/context/base/mkiv/tabl-ntb.mkiv13
-rw-r--r--tex/context/base/mkiv/tabl-tbl.mkiv12
-rw-r--r--tex/context/interface/mkii/keys-ro.xml1
-rw-r--r--tex/context/interface/mkiv/context-en.xml6
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin847129 -> 847309 bytes
-rw-r--r--tex/context/interface/mkiv/i-math.xml5
-rw-r--r--tex/context/interface/mkiv/i-mathmatrix.xml5
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60776 -> 60774 bytes
-rw-r--r--tex/context/modules/common/s-abr-01.tex1
-rw-r--r--tex/context/modules/mkiv/m-cweb.mkiv915
-rw-r--r--tex/context/modules/mkiv/m-matrix.mkiv16
-rw-r--r--tex/context/modules/mkiv/m-scite.mkiv3
-rw-r--r--tex/context/modules/mkiv/s-setups-macros.mkiv203
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
28 files changed, 666 insertions, 719 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 2ca1104be..fe034a5fc 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2018.01.17 13:06}
+\newcontextversion{2018.01.19 13:42}
%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/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index 5e3c46a5f..0704eecb1 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.01.17 13:06}
+\edef\contextversion{2018.01.19 13:42}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-ro.mkii b/tex/context/base/mkii/mult-ro.mkii
index 7862b2d30..ad4e4f214 100644
--- a/tex/context/base/mkii/mult-ro.mkii
+++ b/tex/context/base/mkii/mult-ro.mkii
@@ -1162,6 +1162,7 @@
\setinterfaceconstant{sidespacebefore}{spatiulateralinainte}
\setinterfaceconstant{sidethreshold}{sidethreshold}
\setinterfaceconstant{sign}{semn}
+\setinterfaceconstant{simplecommand}{simplecommand}
\setinterfaceconstant{size}{dimensiune}
\setinterfaceconstant{slantedfeatures}{slantedfeatures}
\setinterfaceconstant{slantedfont}{slantedfont}
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 431e378c8..1242ca657 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2018.01.17 13:06}
+\newcontextversion{2018.01.19 13:42}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index cac8be0c6..ca15299f4 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -41,7 +41,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.01.17 13:06}
+\edef\contextversion{2018.01.19 13:42}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/data-crl.lua b/tex/context/base/mkiv/data-crl.lua
index ec517fba3..dec9972f1 100644
--- a/tex/context/base/mkiv/data-crl.lua
+++ b/tex/context/base/mkiv/data-crl.lua
@@ -26,7 +26,7 @@ local runner = sandbox.registerrunner {
name = "curl resolver",
method = "execute",
program = "curl",
- template = "--silent -- insecure --create-dirs --output %cachename% %original%",
+ template = "--silent --insecure --create-dirs --output %cachename% %original%",
checkers = {
cachename = "cache",
original = "url",
diff --git a/tex/context/base/mkiv/enco-ini.mkiv b/tex/context/base/mkiv/enco-ini.mkiv
index f1428e7c2..f78643975 100644
--- a/tex/context/base/mkiv/enco-ini.mkiv
+++ b/tex/context/base/mkiv/enco-ini.mkiv
@@ -537,6 +537,10 @@
\hbox\bgroup
\enco_periods_nop}
+%D Was missing:
+
+\unexpanded\def\ampersand{\mathortext\mathampersand\textampersand}
+
%D Left-overs:
\appendtoks
diff --git a/tex/context/base/mkiv/math-ali.mkiv b/tex/context/base/mkiv/math-ali.mkiv
index 4de35723b..083fb7645 100644
--- a/tex/context/base/mkiv/math-ali.mkiv
+++ b/tex/context/base/mkiv/math-ali.mkiv
@@ -1138,6 +1138,84 @@
%D
%D \typebuffer % does not run well: \getbuffer
+%D Handy for the \type {m-matrix} module:
+
+\unexpanded\def\startnamedmatrix
+ {\dodoubleempty\math_matrix_start_named}
+
+\def\math_matrix_start_named[#1][#2]%
+ {\begingroup
+ \edef\currentmathmatrix{#1}%
+ \ifsecondargument
+ \setupcurrentmathmatrix[#2]%
+ \fi
+ \math_matrix_start\currentmathmatrix}
+
+\def\stopnamedmatrix
+ {\math_matrix_stop
+ \endgroup}
+
+%D The following code is derived from Aditya's simplematrix prototype but
+%D adapted to regular mathmatrices (which saves some code so it can go into
+%D the core):
+
+\def\math_matrix_simple_row#1%
+ {\rawprocesscommalist[#1]\math_matrix_simple_col
+ \toksapp\scratchtoks{\NR}}
+
+\def\math_matrix_simple_col#1%
+ {\toksapp\scratchtoks{\NC#1}}
+
+\unexpanded\def\math_matrix_simple[#1][#2]#3%
+ {\begingroup
+ \edef\currentmathmatrix{#1}%
+ \ifsecondargument
+ \setupcurrentmathmatrix[#2]%
+ \fi
+ \scratchtoks\emptytoks
+ \processlist[];\math_matrix_simple_row[#3]%
+ \math_matrix_start\currentmathmatrix
+ \the\scratchtoks
+ \math_matrix_stop
+ \endgroup}
+
+%D We hook it into the normal mathmatrix code:
+
+\appendtoks
+ \edef\p_simplecommand{\mathmatrixparameter\c!simplecommand}%
+ \ifx\p_simplecommand\empty\else
+ \setuevalue{\p_simplecommand}{\dodoubleempty\math_matrix_simple[\currentmathmatrix]}%
+ \fi
+\to \everydefinemathmatrix
+
+%D And predefine some matrices:
+
+\definemathmatrix[matrix:parentheses][\c!left={\left(\mskip\thinmuskip},\c!right={\mskip\thinmuskip\right)},\c!align=\v!middle]
+\definemathmatrix[matrix:brackets] [\c!left={\left[\mskip\thinmuskip},\c!right={\mskip\thinmuskip\right]},\c!align=\v!middle]
+\definemathmatrix[matrix:bars] [\c!left={\left|\mskip\thinmuskip},\c!right={\mskip\thinmuskip\right|},\c!align=\v!middle]
+
+\definemathmatrix[thematrix][matrix:parentheses][\c!simplecommand=thematrix]
+
+%D \startbuffer
+%D \startformula
+%D \thematrix{1,2,3,4;5,6,7,8;9,10,11,12}
+%D \stopformula
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+%D
+%D \startbuffer
+%D \startformula
+%D \startthematrix
+%D \NC 1\NC 2\NC 3\NC 4\NR
+%D \NC 5\NC 6\NC 7\NC 8\NR
+%D \NC 9\NC10\NC11\NC12\NR
+%D \stopthematrix
+%D \stopformula
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+
%D \macros
%D {startintertext}
%D
diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv
index e4c02b6c2..d815e587d 100644
--- a/tex/context/base/mkiv/math-ini.mkiv
+++ b/tex/context/base/mkiv/math-ini.mkiv
@@ -939,6 +939,75 @@
\activatemathcharacter\underscoreasciicode
\activatemathcharacter\ampersandasciicode
+\appendtoks
+ \edef\p_ampersand{\mathematicsparameter\s!ampersand}%
+ \ifx\p_ampersand\v!normal
+ \let\specialmathaligntab\normalmathaligntab
+ \else
+ \let\specialmathaligntab\mathampersand
+ \fi
+\to \everysetupmathematics
+
+%D A simplified version of this code is:
+%D
+%D \starttyping
+%D \catcode"26=12
+%D
+%D \bgroup
+%D \global\mathcode"26="8000
+%D
+%D \catcode"26=4
+%D
+%D \xdef\normalmathaligntab{&}
+%D
+%D \catcode"26=13
+%D
+%D \global\everymath{\def&{\normalmathaligntab}}
+%D \egroup
+%D \stoptyping
+%D
+%D The following works okay:
+%D
+%D \starttyping
+%D A & B
+%D \stoptyping
+%D
+%D As does:
+%D
+%D \starttyping
+%D $A \Umathchar"2"0"26 B$
+%D \stoptyping
+%D
+%D But the next code:
+%D
+%D \starttyping
+%D $A \char"26 B$
+%D \stoptyping
+%D
+%D fails with: \type{Misplaced alignment tab character &} and here is the
+%D reason.
+%D
+%D When we have a letter or other category a check happens for an active
+%D character and when it has one then it gets expanded and fed back into the
+%D scanner (sort of).
+%D
+%D A \type {\char} is also fed back as raw character and again when it's letter
+%D of other goes through the same process.
+%D
+%D This means that we cannot have a definition like:
+%D
+%D \starttyping
+%D \def\AND{\char"26\relax}
+%D \stoptyping
+%D
+%D that can be used in math mode, which is why the cweb macros do:
+%D
+%D \starttyping
+%D \def\AND{\def\AND{\mathchar"2026\relax}\AND}
+%D \stoptyping
+%D
+%D Maybe we need an option to treat chars like chars.
+
% \activatemathcharacter\primeasciicode
% not used:
@@ -1056,22 +1125,33 @@
%
% \egroup
+% $\char26$ gives an error because it expands to an active character that
+% then becomes an & which is then seen as an alignment character; anyway,
+% even when we switch like this the diufferen tmeaning only happens when
+% we're in math mode which can be delayed till we're in a cell
+
\bgroup
\catcode\underscoreasciicode\activecatcode
\catcode\circumflexasciicode\activecatcode
\catcode\ampersandasciicode \activecatcode
+ \glet\specialmathaligntab\normalmathaligntab
+
\unexpanded\gdef\obeymathcatcodes
{\let _\normalsubscript
\let ^\normalsuperscript
- \let &\normalmathaligntab}
+ \def &\specialmathaligntab
+ }
\doglobal \appendtoks
\let _\normalsubscript
\let ^\normalsuperscript
- \let &\normalmathaligntab % use \def when it's \aligntab
- \to \everymathematics
+ \let &\specialmathaligntab
+ \to \everymathematics
+
+ % \unexpanded\gdef\normalmathampersands
+ % {\let\specialmathaligntab\mathampersand}
\egroup
diff --git a/tex/context/base/mkiv/mtx-context-meaning.tex b/tex/context/base/mkiv/mtx-context-meaning.tex
index c65ec7f46..88b81ef04 100644
--- a/tex/context/base/mkiv/mtx-context-meaning.tex
+++ b/tex/context/base/mkiv/mtx-context-meaning.tex
@@ -21,7 +21,8 @@
% context --extra=meaning setuplayout
% context --extra=meaning setup_layout
% context --extra=meaning --once --noconsole --nostatistics setuplayout
-% mtxrun --silent --script context --extra=meaning --once --noconsole --nostatistics setuplayout
+% mtxrun --silent --script context --extra=meaning --once --noconsole --nostatistics setuplayout
+% mtxrun --script interface --meaning setuplayout
%
% end help
@@ -39,22 +40,21 @@
\starttext
+\usemodule[setups-macros]
+
\startluacode
local h = tex.hashtokens()
local function showmeaning(str)
- local s = string.gsub(str,"^\\","")
- local p = "^" .. string.topattern(s) .. "$"
+ local h = interfaces.macros.collect(str)
context("pattern: ")
- context.type(s)
+ context.type(str)
context.blank()
for i=1,#h do
local hi = h[i]
- if string.find(h[i],p) then
- context.type(hi)
- context.par()
- context.showmeaning(hi)
- end
+ context.type(hi)
+ context.par()
+ context.showmeaning(hi)
end
context.page()
end
diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua
index 0cb60487d..59c2ed605 100644
--- a/tex/context/base/mkiv/mult-def.lua
+++ b/tex/context/base/mkiv/mult-def.lua
@@ -11107,6 +11107,10 @@ return {
["pe"]="رنگ‌عنوان",
["ro"]="culoaretitlu",
},
+ ["simplecommand"]={
+ ["en"]="simplecommand",
+ ["nl"]="simpelcommando",
+ },
["titlecommand"]={
["cs"]="titlecommand",
["de"]="titlecommand",
diff --git a/tex/context/base/mkiv/mult-sys.mkiv b/tex/context/base/mkiv/mult-sys.mkiv
index ead318b71..03e1856ee 100644
--- a/tex/context/base/mkiv/mult-sys.mkiv
+++ b/tex/context/base/mkiv/mult-sys.mkiv
@@ -363,6 +363,8 @@
\definesystemconstant {kernpairs}
\definesystemconstant {mixedcolumn}
+\definesystemconstant {ampersand}
+
%definesystemconstant {property}
%definesystemconstant {overprint}
%definesystemconstant {layer}
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 9091299a5..39922f868 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 5715fe76e..b7a223056 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/tabl-ntb.mkiv b/tex/context/base/mkiv/tabl-ntb.mkiv
index 62bdec0e8..b74694c02 100644
--- a/tex/context/base/mkiv/tabl-ntb.mkiv
+++ b/tex/context/base/mkiv/tabl-ntb.mkiv
@@ -383,7 +383,12 @@
\newif\iftightTBLrowspan \tightTBLrowspantrue
\newif\iftightTBLcolspan \tightTBLcolspanfalse
-\newif\iftraceTABLE \traceTABLEfalse
+\newconditional \c_tabl_ntb_trace_widths
+
+\installtextracker
+ {tables.natural.widths}
+ {\settrue \c_tabl_ntb_trace_widths}
+ {\setfalse\c_tabl_ntb_trace_widths}
% so far
@@ -1684,7 +1689,7 @@
\def\tabl_ntb_check_widths_two{\tabl_ntb_check_widths_indeed\plusone } % 1 = real run
\def\tabl_ntb_check_widths_indeed#1%
- {\iftraceTABLE\tabl_ntb_show_widths B#1\fi
+ {\ifconditional\c_tabl_ntb_trace_widths\tabl_ntb_show_widths B#1\fi
\!!counta\zerocount
\!!dimena\dimexpr
\hsize
@@ -1717,7 +1722,7 @@
\fi
\fi
\fi}%
- \iftraceTABLE\tabl_ntb_show_widths M#1\fi
+ \ifconditional\c_tabl_ntb_trace_widths\tabl_ntb_show_widths M#1\fi
\ifcase\!!counta \else \divide\!!dimena \!!counta \fi
\dorecurse\c_tabl_ntb_maximum_col
{\scratchdimen\tabl_ntb_get_wid\recurselevel\relax
@@ -1730,7 +1735,7 @@
\tabl_ntb_set_wid\recurselevel{\the\!!dimena}%
\fi
\fi}%
- \iftraceTABLE\tabl_ntb_show_widths E#1\fi}
+ \ifconditional\c_tabl_ntb_trace_widths\tabl_ntb_show_widths E#1\fi}
\def\tabl_ntb_check_heights_one_indeed
{\!!countb\tabl_ntb_get_row\c_tabl_ntb_current_row_three\c_tabl_ntb_current_col_three\relax
diff --git a/tex/context/base/mkiv/tabl-tbl.mkiv b/tex/context/base/mkiv/tabl-tbl.mkiv
index f80df82d7..7a0d2c8a8 100644
--- a/tex/context/base/mkiv/tabl-tbl.mkiv
+++ b/tex/context/base/mkiv/tabl-tbl.mkiv
@@ -227,7 +227,6 @@
\let \m_tabl_tabulate_separator_factor \empty % fraction
-\newif \iftracetabulate % will become a tracker
\newtoks \everytabulatepar % where used ?
\newtoks \everytabulate % public ?
@@ -308,11 +307,16 @@
\kern-\linewidth
\tabl_tabulate_break_no}
+\installtextracker
+ {tables.tabulate.breaks}
+ {\let\tabl_tabulate_break_no_tracer\tabl_tabulate_nobreak_inject_tracer}
+ {\let\tabl_tabulate_break_no_tracer\donothing}
+
+\let\tabl_tabulate_break_no_tracer\donothing
+
\def\tabl_tabulate_nobreak_inject_indeed
{\tabl_tabulate_break_no
- \iftracetabulate
- \tabl_tabulate_nobreak_inject_tracer
- \fi}
+ \tabl_tabulate_break_no_tracer}
\def\tabl_tabulate_nobreak_inject
{\tabulatenoalign{\tabl_tabulate_nobreak_inject_indeed}}
diff --git a/tex/context/interface/mkii/keys-ro.xml b/tex/context/interface/mkii/keys-ro.xml
index 5fcab2cae..175c60ee3 100644
--- a/tex/context/interface/mkii/keys-ro.xml
+++ b/tex/context/interface/mkii/keys-ro.xml
@@ -1168,6 +1168,7 @@
<cd:constant name='sidespacebefore' value='spatiulateralinainte'/>
<cd:constant name='sidethreshold' value='sidethreshold'/>
<cd:constant name='sign' value='semn'/>
+ <cd:constant name='simplecommand' value='simplecommand'/>
<cd:constant name='size' value='dimensiune'/>
<cd:constant name='slantedfeatures' value='slantedfeatures'/>
<cd:constant name='slantedfont' value='slantedfont'/>
diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml
index a097626db..9e5ae6ba4 100644
--- a/tex/context/interface/mkiv/context-en.xml
+++ b/tex/context/interface/mkiv/context-en.xml
@@ -21660,6 +21660,9 @@
<cd:constant type="ams"/>
<cd:constant default="yes" type="ctx"/>
</cd:parameter>
+ <cd:parameter name="ampersand">
+ <cd:constant type="normal"/>
+ </cd:parameter>
</cd:assignments>
</cd:arguments>
</cd:command>
@@ -22498,6 +22501,9 @@
<cd:parameter name="distance">
<cd:constant type="cd:dimension"/>
</cd:parameter>
+ <cd:parameter name="simplecommand">
+ <cd:constant type="cd:text"/>
+ </cd:parameter>
<cd:parameter name="location">
<cd:constant type="top"/>
<cd:constant type="bottom"/>
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 7e2e1b944..98476832c 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-math.xml b/tex/context/interface/mkiv/i-math.xml
index 6ae5e97ce..af9d87cb8 100644
--- a/tex/context/interface/mkiv/i-math.xml
+++ b/tex/context/interface/mkiv/i-math.xml
@@ -106,6 +106,9 @@
<cd:constant type="ams"/>
<cd:constant type="ctx" default="yes"/>
</cd:parameter>
+ <cd:parameter name="ampersand">
+ <cd:constant type="normal"/>
+ </cd:parameter>
</cd:assignments>
</cd:arguments>
</cd:command>
@@ -496,4 +499,4 @@
</cd:arguments>
</cd:command>
-</cd:interface> \ No newline at end of file
+</cd:interface>
diff --git a/tex/context/interface/mkiv/i-mathmatrix.xml b/tex/context/interface/mkiv/i-mathmatrix.xml
index 64056dee6..bd1452cdc 100644
--- a/tex/context/interface/mkiv/i-mathmatrix.xml
+++ b/tex/context/interface/mkiv/i-mathmatrix.xml
@@ -41,6 +41,9 @@
<cd:parameter name="distance">
<cd:constant type="cd:dimension"/>
</cd:parameter>
+ <cd:parameter name="simplecommand">
+ <cd:constant type="cd:text"/>
+ </cd:parameter>
<cd:parameter name="location">
<cd:constant type="top"/>
<cd:constant type="bottom"/>
@@ -135,4 +138,4 @@
<cd:command name="bbordermatrix" type="environment" level="document" category="mathematics tables" file="math-pln.mkiv"/>
-</cd:interface> \ No newline at end of file
+</cd:interface>
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 7c54b4af0..f321d93ea 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/modules/common/s-abr-01.tex b/tex/context/modules/common/s-abr-01.tex
index ee10bda6e..a0e3829e4 100644
--- a/tex/context/modules/common/s-abr-01.tex
+++ b/tex/context/modules/common/s-abr-01.tex
@@ -149,6 +149,7 @@
\logo [JPEG] {jpeg}
\logo [JPG] {jpg}
\logo [JBIG] {jbig}
+\logo [JSON] {json}
\logo [KPATHSEA] {kpathsea}
\logo [KPSE] {kpse}
\logo [KVM] {kvm}
diff --git a/tex/context/modules/mkiv/m-cweb.mkiv b/tex/context/modules/mkiv/m-cweb.mkiv
index 2546b2342..eb2395e48 100644
--- a/tex/context/modules/mkiv/m-cweb.mkiv
+++ b/tex/context/modules/mkiv/m-cweb.mkiv
@@ -11,90 +11,54 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%D This module has to be redone in the mkiv way.
+%D This module has to be redone in the mkiv way. Stepwise.
-%D First some auxiliary stuff, to be moved to system module.
-
-\def\dodofindfirstcharacter#1%
- {\ifx#1\relax
- \let\next=\egroup
- \else
- \handlecase
- {\expandafter\ifnum\expandafter\catcode\expandafter`#1=11
- \def\next##1\relax{\egroup\def\firstcharacter{#1}}%
- \fi}%
- \fi
- \next}
-
-\def\dofindfirstcharacter#1#2%
- {\def\firstcharacter{}%
- \bgroup
- \defconvertedargument\ascii{#2}%
- \let\next\dodofindfirstcharacter
- \let\handlecase#1%
- \expandafter\next\ascii\relax}
-
-\def\normalcase#1%
- {#1}
-
-\def\findfirstcharacter%
- {\dofindfirstcharacter\lowercase}
-
-\def\FindFirstCharacter%
- {\dofindfirstcharacter\normalcase}
-
-\def\FINDFIRSTCHARACTER%
- {\dofindfirstcharacter\uppercase}
-
-% nog doen:
+% todo:
%
% \deactivateCWEB in output routine
% status info
-% gelinkte entries
+% linked entries
% parskip en parindent
+% breaks and whitespace
+% fonts ... now math abuse down here
%D \gdef\CWEBquote#1.{{\em Quote :}\ #1.} % checks the .
-
-%D This module (re)implements the \CWEB\ macros as defined in
-%D the file \type{cwebmac.tex}.
%D
-%D \CWEB\ uses short, often one character long, names for
-%D macros. This is no real problem because no one is supposed
-%D to read and understand the files generated by \CWEB. The
-%D standard macros are meant for \PLAIN\ \TEX\ users. In
-%D \CONTEXT\ and other macro packages however, there is a
-%D potential conflict with format specific or user defined
-%D commands. Furthermore, the \CWEB\ macros implement their own
-%D output routines. When integrating \CWEB\ documents in
-%D another environment, the \CWEB\ specific macros have to be
-%D made local. The first part of this module is dedicated to
-%D this feature.
+%D This module (re)implements the \CWEB\ macros as defined in the file
+%D \type{cwebmac.tex}.
%D
-%D Instead of using \type{\def} and \type{\let} for defining
-%D macros, we use:
+%D \CWEB\ uses short, often one character long, names for macros. This is no real
+%D problem because no one is supposed to read and understand the files generated by
+%D \CWEB. The standard macros are meant for \PLAIN\ \TEX\ users. In \CONTEXT\ and
+%D other macro packages however, there is a potential conflict with format specific
+%D or user defined commands. Furthermore, the \CWEB\ macros implement their own
+%D output routines. When integrating \CWEB\ documents in another environment, the
+%D \CWEB\ specific macros have to be made local. The first part of this module is
+%D dedicated to this feature.
+%D
+%D Instead of using \type{\def} and \type{\let} for defining macros, we use:
%D
%D \starttyping
%D \defCEBmacro arguments {meaning}
%D \letCEBmacro arguments {meaning}
%D \stoptyping
%D
-%D \CWEB files contain implicit calls to macros that generate
-%D the table of contents, the lists of sections and the index.
-%D Because we want to be much more flexible, we implemented our
-%D own alternatives, and therefore have to bypass the original
-%D ones. The next macro is used for defining these obsolete
-%D \CWEB\ macros. The dummies take care of arguments.
+%D \CWEB files contain implicit calls to macros that generate the table of contents,
+%D the lists of sections and the index. Because we want to be much more flexible, we
+%D implemented our own alternatives, and therefore have to bypass the original ones.
+%D The next macro is used for defining these obsolete \CWEB\ macros. The dummies
+%D take care of arguments.
%D
%D \starttyping
%D \defCEBdummy arguments {meaning}
%D \stoptyping
%D
-%D The list of \CWEB\ specific macro names is saved in a
-%D \TOKENLIST. This serves two purposes. First it enables us to
-%D activate the \CWEB\ macros, which are saved under a
-%D different name, second it can be used to temporary restore
-%D the meanings, for instance when the output routine builds
-%D the page.
+%D The list of \CWEB\ specific macro names is saved in a \TOKENLIST. This serves two
+%D purposes. First it enables us to activate the \CWEB\ macros, which are saved
+%D under a different name, second it can be used to temporary restore the meanings,
+%D for instance when the output routine builds the page.
+
+\unprotect
\newtoks\CWEBmacros
@@ -107,97 +71,79 @@
%D
%D Which are implemented as:
-\def\activateCWEB%
- {\let\doCWEB=\activateCWEBmacro
+\unexpanded\def\activateCWEB
+ {\let\doCWEB\activateCWEBmacro
\the\CWEBmacros}
-\def\deactivateCWEB%
- {\let\doCWEB=\deactivateCWEBmacro
+\unexpanded\def\deactivateCWEB
+ {\let\doCWEB\deactivateCWEBmacro
\the\CWEBmacros}
-%D The three definition macros append the name of the macro to
-%D the list. The first two macros save the meaning, the last one
-%D assigns \type{{}} to the macro and gobbles original meaning.
+%D The three definition macros append the name of the macro to the list. The first
+%D two macros save the meaning, the last one assigns \type{{}} to the macro and
+%D gobbles original meaning.
-\long\def\defCWEBmacro#1%
+\installcorenamespace{newCWEB}
+\installcorenamespace{oldCWEB}
+
+\unexpanded\def\defCWEBmacro#1%
{\appendtoks\doCWEB#1\to\CWEBmacros
- \setvalue{newCWEB\string#1}}
+ \setuvalue{\??newCWEB\string#1}}
-\long\def\letCWEBmacro#1%
+\unexpanded\def\letCWEBmacro#1%
{\appendtoks\doCWEB#1\to\CWEBmacros
- \letvalue{newCWEB\string#1}}
+ \letvalue{\??newCWEB\string#1}}
-\long\def\defCWEBdummy#1#2#%
+\unexpanded\def\defCWEBdummy#1#2#%
{\appendtoks\doCWEB#1\to\CWEBmacros
- \setvalue{newCWEB\string#1}#2{}%
+ \setuvalue{\??newCWEB\string#1}#2{}%
\gobbleoneargument}
-%D The macro \type{\defCWEBdummy} of course takes care of the
-%D argument. This leaves the two (de|)|activating macros:
+%D The macro \type{\defCWEBdummy} of course takes care of the argument. This leaves
+%D the two (de|)|activating macros:
-\def\CWEBmacro#1%
- {\getvalue{newCWEB\string#1}}
+\unexpanded\def\CWEBmacro#1%
+ {\getvalue{\??newCWEB\string#1}}
-\def\activateCWEBmacro#1%
- {\letvalue{oldCWEB\string#1}=#1%
- \def#1{\CWEBmacro#1}}
+\unexpanded\def\activateCWEBmacro#1%
+ {\letvalue{\??oldCWEB\string#1}=#1%
+ \unexpanded\def#1{\CWEBmacro#1}} % really \unexpanded here?
-\def\deactivateCWEBmacro#1%
- {\expandafter\let\expandafter#1\expandafter=\csname oldCWEB\string#1\endcsname}
+\unexpanded\def\deactivateCWEBmacro#1%
+ {\expandafter\let\expandafter#1\csname\??oldCWEB\string#1\endcsname}
-%D I did consider loading the \CWEB\ macros using temporary
-%D substitutes of \type{\def}, \type{\font}, \type{\newbox} etc.
-%D The main problem is that the file contains more than
-%D definitions and taking all kind of assignments into account
-%D too would not make things easier. So I decided to stick to
-%D the method as just described.
+\protect
-%D Now we're ready for the real job. What follows is a partial
-%D adaption of the file \type{cwebmac.tex}, version 3.1, dated
-%D September 1994 and written by Levy and Knuth. When possible
-%D we kept the original meaning, but we've granted ourselves
+%D I did consider loading the \CWEB\ macros using temporary substitutes of \type
+%D {\def}, \type {\font}, \type {\newbox} etc. The main problem is that the file
+%D contains more than definitions and taking all kind of assignments into account
+%D too would not make things easier. So I decided to stick to the method as just
+%D described.
+%D
+%D Now we're ready for the real job. What follows is a partial adaption of the file
+%D \type {cwebmac.tex}, version 3.1, dated September 1994 and written by Levy and
+%D Knuth. When possible we kept the original meaning, but we've granted ourselves
%D the freedom to reformat the macro's for readibility.
%D
-%D We'll only present the macros we actually use. The source
-%D however contains the original implementation.
-
-% standard macros for CWEB listings (in addition to plain.tex)
-% Version 3.1 --- September 1994.
-%
-% \ifx\documentstyle\undefined\else\endinput\fi % LaTeX will use other macros
-%
-% \xdef\fmtversion{\fmtversion+CWEB3.1}
-
+%D We'll only present the macros we actually use. The source however contains the
+%D original implementation.
+%D
+%D The next is based on the standard macros for CWEB listings (in addition to \type
+%D {plain.tex}) Version 3.1 --- September 1994.
+%D
%D \macros{.}{}
%D
-%D \CWEBquote preserve a way to get the dot accent (all
-%D other accents will still work as usual).
+%D \CWEBquote preserve a way to get the dot accent (all other accents will still
+%D work as usual).
\letCWEBmacro\: = \.
-% \parskip = 0pt % no stretch between paragraphs
-% \parindent = 1em % for paragraphs and for the first line of C text
-
-% \font\ninerm = cmr9
-% \let\mc = \ninerm % medium caps
-% \font\eightrm = cmr8
-% \let\sc = \eightrm % small caps (NOT a caps-and-small-caps font)
-% \let\mainfont = \tenrm
-% \let\cmntfont = \tenrm
-% \font\tenss = cmss10
-% \let\cmntfont = \tenss % alternative comment font
-% \font\titlefont = cmr7 scaled \magstep4 % title on the contents page
-% \font\ttitlefont = cmtt10 scaled \magstep2 % typewriter type in title
-% \font\tentex = cmtex10 % TeX extended character set (used in strings)
-% \fontextraspace\tentex = 0pt % no double space after sentences
-
%D \macros{mc,sc,cmntfont,eightrm}{}
%D
-%D The naming of the fonts in in line with those in \PLAIN\
-%D \TEX. Although \CONTEXT\ implements its own scheme, there is
-%D still support for the \PLAIN\ ones. We keep the original
-%D names, but change their meaning. That way the macros obey
-%D switching to other sizes or styles.
+%D The naming of the fonts in in line with those in \PLAIN\ \TEX. Although \CONTEXT\
+%D implements its own scheme, there is still support for the \PLAIN\ ones. We keep
+%D the original names, but change their meaning. That way the macros obey switching
+%D to other sizes or styles.
\defCWEBmacro\mc {\tx}
\defCWEBmacro\sc {\txx}
@@ -206,80 +152,70 @@
%D \macros{tentex,sevenrm,sevensy,teni}{}
%D
-%D The next one uses a temporary solution. The \type{cmtex10}
-%D font is not part of the default mechanism. We make use of
-%D the \CONTEXT\ variables \type{\textface}, \type{\scriptface}
-%D and \type{\scriptscriptface}, which hold the current
-%D sizes.
+%D The next one uses a temporary solution. The \type {cmtex10} font is not part of
+%D the default mechanism. We make use of the \CONTEXT\ variables \type {\textface},
+%D \type {\scriptface} and \type {\scriptscriptface}, which hold the current sizes.
-\defCWEBmacro\tentex%
- {\font\next=cmtex10 at \textface
- \fontextraspace\next\zeropoint
- \next}
+\defCWEBmacro\tentex {\tttf}
-\defCWEBmacro\sevenrm {\getvalue{\scriptface rmtf}}
-\defCWEBmacro\sevensy {\getvalue{\scriptface mmsy}}
-\defCWEBmacro\teni {\getvalue{\textface mmmi}}
+% \defCWEBmacro\sevenrm {\getvalue{\scriptface rmtf}}
+% \defCWEBmacro\sevensy {\getvalue{\scriptface mmsy}}
+% \defCWEBmacro\teni {\getvalue{\textface mmmi}}
%D \macros{CWEBpt}{}
%D
-%D The original macros are based on a 10~point bodyfont size. We
-%D therefore have to specify dimension in points a bit
-%D different. Specifications like .6pt are changed to
-%D \type{.06} times \type{\bodyfontsize}.
+%D The original macros are based on a 10~point bodyfont size. We therefore have to
+%D specify dimension in points a bit different. Specifications like .6pt are changed
+%D to \type {.06} times \type {\bodyfontsize}.
-\defCWEBmacro\CWEBpt {\bodyfontsize} % still dutch
+\defCWEBmacro\CWEBpt {\bodyfontsize}
%D \macros{CEE,UNIX,TEX,CPLUSPLUS}{}
%D
-%D Next come some logo's. It does not make much sense to use
-%D the \CONTEXT\ logo mechanism here, so we simply say:
+%D Next come some logo's. It does not make much sense to use the \CONTEXT\ logo
+%D mechanism here, so we simply say:
-\defCWEBmacro \CEE/{{\mc C\spacefactor1000}}
-\defCWEBmacro \UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}}
+\defCWEBmacro \CEE/{{\tx C\spacefactor1000}}
+\defCWEBmacro \UNIX/{{\tx UNIX\spacefactor1000}}
\defCWEBmacro \TEX/{\TeX}
-\defCWEBmacro\CPLUSPLUS/{{\mc C\PP\spacefactor1000}}
+\defCWEBmacro\CPLUSPLUS/{{\tx C\PP\spacefactor1000}}
\defCWEBmacro \Cee{\CEE/} % for backward compatibility
%D \macros{\ }{}
%D
-%D Now we come to the real work: the short commands that make
-%D up the typography.
+%D Now we come to the real work: the short commands that make up the typography.
%D
%D \CWEBquote italic type for identifiers.
\defCWEBmacro\\#1%
- {\leavevmode\hbox{\it#1\/\kern.05em}}
+ {\dontleavehmode
+ \hbox{\it#1\/\kern.05em}}
%D \macros{\string|}{}
%D
%D \CWEBquote one letter identifiers look better this way.
\defCWEBmacro\|#1%
- {\leavevmode\hbox{$#1$}}
+ {\dontleavehmode
+ \hbox{$#1$}}
%D \macros{\string\&}{}
%D
%D \CWEBquote boldface type for reserved words.
\defCWEBmacro\&#1%
- {\leavevmode
- \hbox
- {\def\_%
- {\kern.04em
- \vbox{\hrule width.3em height .06\CWEBpt}% .6pt}%
- \kern.08em}%
- \bf#1\/\kern.05em}}
+ {\dontleavehmode
+ \hbox{\bf#1\/\kern.05em}}
%D \macros{.}{}
%D
-%D Here we use the previously saved period. This macro
-%D takes care of special characters in strings.
+%D Here we use the previously saved period. This macro takes care of special
+%D characters in strings.
\defCWEBmacro\.#1%
- {\leavevmode
+ {\dontleavehmode
\hbox
- {\tentex % typewriter type for strings
+ {\tttf % typewriter type for strings
\let\\=\BS % backslash in a string
\let\{=\LB % left brace in a string
\let\}=\RB % right brace in a string
@@ -295,12 +231,11 @@
%D Some discretionary hack.
\defCWEBmacro\)%
- {\discretionary{\hbox{\tentex\BS}}{}{}}
+ {\discretionary{\hbox{\tttf\BS}}{}{}}
%D \macros{AT}{}
%D
-%D \CWEBquote at sign for control text (not needed in versions
-%D $>=$ 2.9).
+%D \CWEBquote at sign for control text (not needed in versions $>=$ 2.9).
\defCWEBmacro\AT{@}
@@ -308,7 +243,7 @@
%D
%D A two step macro that handles whatever.
-\defCWEBmacro\ATL%
+\defCWEBmacro\ATL
{\par
\noindent
\bgroup
@@ -316,7 +251,7 @@
\postATL}
\defCWEBmacro\postATL#1 #2 %
- {\bf letter \\{\uppercase{\char"#1}} tangles as \tentex "#2"%
+ {\bf letter \\{\WORD{\char"#1}} tangles as \tttf "#2"%
\egroup
\par}
@@ -327,107 +262,77 @@
%D
%D \CWEBquote suppress output from \type{@l}.
-\defCWEBmacro\noatl%
- {\let\ATL=\noATL}
+\defCWEBmacro\noatl
+ {\let\ATL\noATL}
% \defCWEBmacro\ATH%
% {\X\kern-.5em:Preprocessor definitions\X}
%D \macros{PB}
%D
-%D \CWEBquote hook for program brackets {\tttf\string|...\string|}
-%D in TeX part or section name.
+%D \CWEBquote hook for program brackets {\tttf\string|...\string|} in \TEX\ part or
+%D section name.
-\defCWEBmacro\PB%
+\defCWEBmacro\PB
{\relax}
-% \chardef\AM = `\& % ampersand character in a string
-% \chardef\BS = `\\ % backslash in a string
-% \chardef\LB = `\{ % left brace in a string
-% \chardef\RB = `\} % right brace in a string
-% \chardef\TL = `\~ % tilde in a string
-% \chardef\UL = `\_ % underline character in a string
-% \chardef\CF = `\^ % circumflex character in a string
-
-\defCWEBmacro\AM {\char`\&} % ampersand character in a string
-\defCWEBmacro\BS {\char`\\} % backslash in a string
-\defCWEBmacro\LB {\char`\{} % left brace in a string
-\defCWEBmacro\RB {\char`\}} % right brace in a string
-\defCWEBmacro\TL {\char`\~} % tilde in a string
-\defCWEBmacro\UL {\char`\_} % underline character in a string
-\defCWEBmacro\CF {\char`\^} % circumflex character in a string
-
-\defCWEBmacro\SP {{\tt\char`\ }} % (visible) space in a string
-
-% \newbox\PPbox \setbox\PPbox=\hbox
-% {\kern.5pt\raise1pt\hbox{\sevenrm+\kern-1pt+}\kern.5pt}
-% \newbox\MMbox \setbox\MMbox=\hbox
-% {\kern.5pt\raise1pt\hbox{\sevensy\char0\kern-1pt\char0}\kern.5pt}
-% \newbox\MGbox \setbox\MGbox=\hbox % symbol for ->
-% {\kern-2pt\lower3pt\hbox{\teni\char'176}\kern1pt}
-% \newbox\MODbox \setbox\MODbox=\hbox
-% {\eightrm\%}
-%
-% \def\PP {\copy\PPbox}
-% \def\MM {\copy\MMbox}
-% \def\MG {\copy\MGbox}
-% \def\MOD {\mathbin{\copy\MODbox}}
+\letCWEBmacro\AM \letterampersand % ampersand character in a string
+\letCWEBmacro\BS \letterbackslash % backslash in a string
+\letCWEBmacro\LB \letterleftbrace % left brace in a string
+\letCWEBmacro\RB \letterrightbrace % right brace in a string
+\letCWEBmacro\TL \lettertilde % tilde in a string
+\letCWEBmacro\UL \letterunderscore % underline character in a string
+\letCWEBmacro\CF \letterhat % circumflex character in a string
+\letCWEBmacro\SP \textvisiblespace % (visible) space in a string
-\defCWEBmacro\PP% symbol for ++
+\defCWEBmacro\PP % symbol for ++
{\kern.05\CWEBpt
- \raise.1\CWEBpt\hbox{\sevenrm+\kern-.1\CWEBpt+}%
+ \raise.1\CWEBpt\hbox{$\scriptstyle+\kern-.1\CWEBpt+$}%
\kern.05\CWEBpt}
-\defCWEBmacro\MM%
+\defCWEBmacro\MM % symbol for --
{\kern.05\CWEBpt
- \raise.1\CWEBpt\hbox{\sevensy\char0\kern-.1\CWEBpt\char0}%
+ \raise.1\CWEBpt\hbox{$\scriptstyle-\kern-.1\CWEBpt-$}%
\kern.05\CWEBpt}
-\defCWEBmacro\MG%
+\defCWEBmacro\MG
{\kern-.2\CWEBpt
- \lower.3\CWEBpt\hbox{\teni\char'176}%
+ \lower.3\CWEBpt\hbox{$\rightarrow$}%
\kern .1\CWEBpt}
+% \defCWEBmacro\PP{\raise.15em\hbox{\tx\textplus \kern-.05em\textplus }} % symbol for ++
+% \defCWEBmacro\MM{\raise.15em\hbox{\tx\textminus\kern .10em\textminus}} % symbol for --
+% \defCWEBmacro\MG{\raise.15em\hbox{\rightarrow}}
+
\defCWEBmacro\MRL#1%
{\mathrel{\let\K==#1}}
-% \def\MRL#1%
-% {\KK#1}
-% \def\KK#1#2%
-% {\buildrel\;#1\over{#2}}
+% \def\MRL #1{\KK#1}
+% \def\KK #1#2{\buildrel\;#1\over{#2}}
\letCWEBmacro\GG = \gg
\letCWEBmacro\LL = \ll
\letCWEBmacro\NULL = \Lambda
-% \mathchardef\AND = "2026 % bitwise and; also \& (unary operator)
-
-\defCWEBmacro\AND% redefines itself (funny)
- {\mathchardef\AND="2026 \AND} % bitwise and; also \& (unary operator)
+\letCWEBmacro\AND = \mathampersand % bitwise and; also \& (unary operator)
\letCWEBmacro\OR = \mid % bitwise or
\letCWEBmacro\XOR = \oplus % bitwise exclusive or
\defCWEBmacro\CM {{\sim}} % bitwise complement
-\defCWEBmacro\MOD {\mathbin{\eightrm\%}}
+\defCWEBmacro\MOD {\mathbin{\tx\%}}
\defCWEBmacro\DC {\kern.1em{::}\kern.1em} % symbol for ::
\defCWEBmacro\PA {\mathbin{.*}} % symbol for .*
\defCWEBmacro\MGA {\mathbin{\MG*}} % symbol for ->*
\defCWEBmacro\this {\&{this}}
-% \newbox \bak % backspace one em
-% \newbox \bakk % backspace two ems
-%
-% \setbox\bak =\hbox to -1em{}
-% \setbox\bakk=\hbox to -2em{}
-
\newcount\CWEBind % current indentation in ems
\defCWEBmacro\1% indent one more notch
- {\global\advance\CWEBind by 1
- \hangindent\CWEBind em}
+ {\global\advance\CWEBind \plusone
+ \hangindent\CWEBind \emwidth}
\defCWEBmacro\2% indent one less notch
- {\global\advance\CWEBind by -1 }
+ {\global\advance\CWEBind \minusone}
\defCWEBmacro\3#1% optional break within a statement
{\hfil
@@ -471,41 +376,15 @@
\newcount\secpagedepth
\secpagedepth=3 % page breaks will occur for depths -1, 0, and 1
-% \newtoks\gtitle % title of current major group
-% \newskip\intersecskip
-% \intersecskip=12pt minus 3pt % space between sections
-
-% \let\yskip=\smallskip
-
\defCWEBmacro\?%
{\mathrel?}
-% \def\note#1#2.%
-% {\Y\noindent
-% {\hangindent2em\baselineskip10pt\eightrm#1~#2.\par}}
-
-\defCWEBmacro\lapstar%
+\defCWEBmacro\lapstar
{\rlap{*}}
-% \def\stsec%
-% {\rightskip=0pt % get out of C mode (cf. \B)
-% \sfcode`;=1500
-% \pretolerance 200
-% \hyphenpenalty 50
-% \exhyphenpenalty 50
-% \noindent{\let\*=\lapstar\bf\secstar.\quad}}
-%
-% \let\startsection=\stsec
-
\defCWEBmacro\defin#1%
{\global\advance\CWEBind by 2 \1\&{#1 } } % begin `define' or `format'
-% \def\A% xref for doubly defined section name
-% {\note{See also section}}
-%
-% \def\As% xref for multiply defined section name
-% {\note{See also sections}}
-
\defCWEBmacro\B%
{\rightskip=0pt plus 100pt minus 10pt % go into C mode
\sfcode`;=3000
@@ -515,15 +394,10 @@
\global\CWEBind=2 \1\ \unskip}
\defCWEBmacro\C#1%
- {\5\5\quad$/\ast\,${\cmntfont #1}$\,\ast/$}
-
-% \let\SHC\C % "// short comments" treated like "/* ordinary comments */"
+ {\5\5\quad$/\ast\,${\ss\detokenize{#1}}$\,\ast/$}
\defCWEBmacro\SHC#1%
- {\5\5\quad$//\,${\cmntfont#1}}
-
-% \def\C#1{\5\5\quad$\triangleright\,${\cmntfont#1}$\,\triangleleft$}
-% \def\SHC#1{\5\5\quad$\diamond\,${\cmntfont#1}}
+ {\5\5\quad$//\,${\ss#1}}
\defCWEBmacro\D% macro definition
{\defin{\#define}}
@@ -548,61 +422,9 @@
\defCWEBmacro\J% TANGLE's join operation
{\.{@\&}}
-% \let\K== % assignment operator
-
\letCWEBmacro\K = \leftarrow % "honest" alternative to standard assignment operator
% \L is Polish letter suppressed-L
-
-% \outer\def\M#1%
-% {\MN{#1}%
-% \ifon
-% \vfil
-% \penalty-100
-% \vfilneg % beginning of section
-% \vskip\intersecskip
-% \startsection
-% \ignorespaces}
-%
-% \outer\def\N#1#2#3.%
-% {\gdepth=#1%
-% \gtitle={#3}%
-% \MN{#2}% beginning of starred section
-% \ifon
-% \ifnum#1<\secpagedepth
-% \vfil
-% \eject % force page break if depth is small
-% \else
-% \vfil
-% \penalty-100
-% \vfilneg
-% \vskip\intersecskip
-% \fi
-% \fi
-% \message{*\secno}% progress report
-% \edef\next%
-% {\write\cont % write to contents file
-% {\ZZ{#3}{#1}{\secno}{\noexpand\the\pageno}}}%
-% \next % \ZZ{title}{depth}{sec}{page}
-% \ifon
-% \startsection
-% {\bf#3.\quad}%
-% \ignorespaces}
-%
-% \def\MN#1%
-% {\par % common code for \M, \N
-% {\xdef\secstar{#1}%
-% \let\*=\empty
-% \xdef\secno{#1}}% remove \* from section name
-% \ifx\secno\secstar
-% \onmaybe
-% \else
-% \ontrue
-% \fi
-% \mark{{{\tensy x}\secno}{\the\gdepth}{\the\gtitle}}}
-%
-% each \mark is {section reference or null}{depth plus 1}{group title}
-
% \O is Scandinavian letter O-with-slash
% \P is paragraph sign
@@ -612,7 +434,7 @@
% \S is section sign
\defCWEBmacro\T#1%
- {\leavevmode % octal, hex or decimal constant
+ {\dontleavehmode % octal, hex or decimal constant
\hbox
{$\def\?{\kern.2em}%
\def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant
@@ -628,16 +450,6 @@
\letCWEBmacro\V = \lor % logical or
\letCWEBmacro\W = \land % logical and
-% defined later on
-%
-% \def\X#1:#2\X%
-% {\ifmmode
-% \gdef\XX{\null$\null}%
-% \else
-% \gdef\XX{}%
-% \fi % section name
-% \XX$\langle\,${#2\eightrm\kern.5em#1}$\,\rangle$\XX}
-
\unprotect
\def\theCWEByskip {\blank[\v!small]}
@@ -649,21 +461,21 @@
{\par
\yskip}
-\defCWEBmacro\yskip%
+\defCWEBmacro\yskip
{\theCWEByskip}
\letCWEBmacro\Z = \le
% \letCWEBmacro\ZZ = \let % now you can \write the control sequence \ZZ
\letCWEBmacro\* = *
-\defCWEBmacro\oct%
+\defCWEBmacro\oct
{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}}
\defCWEBmacro\hex%
{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}}
\defCWEBmacro\vb#1%
- {\leavevmode
+ {\dontleavehmode
\hbox
{\kern.2\CWEBpt
\vrule
@@ -675,231 +487,31 @@
\vrule
\kern.2\CWEBpt}} % verbatim string
-\def\onmaybe%
+\def\onmaybe
{\let\ifon=\maybe}
\let\maybe=\iftrue
\newif\ifon
-% \newif\iftitle
-% \newif\ifpagesaved
-%
-% \def\lheader%
-% {\mainfont
-% \the\pageno
-% \eightrm
-% \qquad
-% \grouptitle
-% \hfill
-% \title
-% \qquad
-% \mainfont
-% \topsecno} % top line on left-hand pages
-%
-% \def\rheader%
-% {\mainfont
-% \topsecno
-% \eightrm
-% \qquad
-% \title
-% \hfill
-% \grouptitle
-% \qquad
-% \mainfont
-% \the\pageno} % top line on right-hand pages
-%
-% \def\grouptitle
-% {\let\i=I
-% \let\j=J
-% \uppercase\expandafter{\expandafter\takethree\topmark}}
-%
-% \def\topsecno%
-% {\expandafter\takeone\topmark}
-%
-% \def\takeone #1#2#3{#1}
-% \def\taketwo #1#2#3{#2}
-% \def\takethree #1#2#3{#3}
-%
-% \def\nullsec%
-% {\eightrm
-% \kern-2em} % the \kern-2em cancels \qquad in headers
-%
-% \let\page=\pagebody % \def\page {\box255 }
-% \raggedbottom % \normalbottom % faster, but loses plain TeX footnotes
-%
-% \def\normaloutput#1#2#3%
-% {\shipout\vbox
-% {\ifodd
-% \pageno
-% \hoffset=\pageshift
-% \fi
-% \vbox to \fullpageheight
-% {\iftitle
-% \global\titlefalse
-% \else
-% \hbox to \pagewidth
-% {\vbox to 10pt{}%
-% \ifodd\pageno #3\else#2\fi}
-% \fi
-% \vfill#1}} % parameter #1 is the page itself
-% \global\advance\pageno by 1}
-%
-% \gtitle={\.{CWEB} output} % this running head is reset by starred sections
-%
-% \mark{\noexpand\nullsec0{\the\gtitle}}
-%
-% \def\title%
-% {\expandafter\uppercase\expandafter{\jobname}}
-%
-% \def\topofcontents%
-% {\centerline{\titlefont\title}
-% \vskip.7in
-% \vfill} % this material will start the table of contents page
-
-\def\botofcontents%
+\def\botofcontents
{\vfill
\centerline{\covernote}} % this material will end the table of contents page
-\def\covernote%
+\def\covernote
{}
% some leftover
\defCWEBmacro\contentspagenumber{0} % default page number for table of contents
-% \newdimen\pagewidth \pagewidth = 158mm % the width of each page
-% \newdimen\pageheight \pageheight = 223mm % the height of each page
-% \newdimen\fullpageheight \fullpageheight = 240mm % page height including headlines
-% \newdimen\pageshift \pageshift = 0in % shift righthand pages wrt lefthand ones
-%
-% \def\magnify#1%
-% {\mag=#1
-% \pagewidth=6.5truein
-% \pageheight=8.7truein
-% \fullpageheight=9truein
-% \setpage}
-%
-% \def\setpage%
-% {\hsize\pagewidth
-% \vsize\pageheight} % use after changing page size
-%
-% \def\contentsfile {\jobname.toc} % file that gets table of contents info
-% \def\readcontents {\input \contentsfile}
-% \def\readindex {\input \jobname.idx}
-% \def\readsections {\input \jobname.scn}
-%
-% \newwrite\cont
-% \output{\setbox0=\page % the first page is garbage
-% \openout\cont=\contentsfile
-% \write\cont{\catcode `\noexpand\@=11\relax} % \makeatletter
-% \global\output{\normaloutput\page\lheader\rheader}}
-% \setpage
-% \vbox to \vsize{} % the first \topmark won't be null
-
\defCWEBdummy\magnify#1% magnify the page
{}
-\defCWEBmacro\ch%
+\defCWEBmacro\ch
{\note{The following sections were changed by the change file:}
\let\*=\relax}
-% \newbox\sbox % saved box preceding the index
-% \newbox\lbox % lefthand column in the index
-%
-% \def\inx%
-% {\par\vskip6pt plus 1fil % we are beginning the index
-% \def\page{\box255 }
-% \normalbottom
-% \write\cont{} % ensure that the contents file isn't empty
-% \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother
-% \closeout\cont % the contents information has been fully gathered
-% \output
-% {\ifpagesaved
-% \normaloutput{\box\sbox}\lheader\rheader
-% \fi
-% \global\setbox\sbox=\page
-% \global\pagesavedtrue}
-% \pagesavedfalse
-% \eject % eject the page-so-far and predecessors
-% \setbox\sbox\vbox{\unvbox\sbox} % take it out of its box
-% \vsize=\pageheight
-% \advance\vsize by -\ht\sbox % the remaining height
-% \hsize=.5\pagewidth
-% \advance\hsize by -10pt
-% % column width for the index (20pt between cols)
-% \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines
-% \def\lr{L} % this tells whether the left or right column is next
-% \output
-% {\if L\lr
-% \global\setbox\lbox=\page
-% \gdef\lr{R}
-% \else
-% \normaloutput
-% {\vbox to\pageheight
-% {\box\sbox
-% \vss
-% \hbox to\pagewidth{\box\lbox\hfil\page}}}
-% \lheader
-% \rheader
-% \global\vsize\pageheight\gdef\lr{L}\global\pagesavedfalse\fi}
-% \message{Index:}
-% \parskip 0pt plus .5pt
-% \outer\def\I##1, {\par\hangindent2em\noindent##1:\kern1em} % index entry
-% \def\[##1]{$\underline{##1}$} % underlined index item
-% \rm
-% \rightskip0pt plus 2.5em
-% \tolerance 10000
-% \let\*=\lapstar
-% \hyphenpenalty 10000
-% \parindent0pt
-% \readindex}
-%
-% \def\fin%
-% {\par\vfill\eject % this is done when we are ending the index
-% \ifpagesaved\null\vfill\eject\fi % output a null index column
-% \if L\lr\else\null\vfill\eject\fi % finish the current page
-% \parfillskip 0pt plus 1fil
-% \def\grouptitle{NAMES OF THE SECTIONS}
-% \let\topsecno=\nullsec
-% \message{Section names:}
-% \output={\normaloutput\page\lheader\rheader}
-% \setpage
-% \def\note##1##2.{\quad{\eightrm##1~##2.}}
-% \def\Q{\note{Cited in section}} % crossref for mention of a section
-% \def\Qs{\note{Cited in sections}} % crossref for mentions of a section
-% \def\U{\note{Used in section}} % crossref for use of a section
-% \def\Us{\note{Used in sections}} % crossref for uses of a section
-% \def\I{\par\hangindent 2em}\let\*=*
-% \readsections}
-%
-% \def\con%
-% {\par\vfill\eject % finish the section names
-% %\ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
-% \rightskip = 0pt
-% \hyphenpenalty = 50
-% \tolerance = 200
-% \setpage
-% \output={\normaloutput\page\lheader\rheader}
-% \titletrue % prepare to output the table of contents
-% \pageno=\contentspagenumber
-% \def\grouptitle{TABLE OF CONTENTS}
-% \message{Table of contents:}
-% \topofcontents
-% \line{\hfil Section\hbox to3em{\hss Page}}
-% \let\ZZ=\contentsline
-% \readcontents\relax % read the contents info
-% \botofcontents
-% \end} % print the contents page(s) and terminate
-%
-% \def\contentsline#1#2#3#4%
-% {\ifnum#2=0
-% \smallbreak
-% \fi
-% \line{\consetup{#2}#1
-% \rm\leaders\hbox to .5em{.\hfil}\hfil\ #3\hbox to3em{\hss#4}}}
-%
-
\defCWEBmacro\consetup#1%
{\ifcase#1 \bf % depth -1 (@**)
\or % depth 0 (@*)
@@ -927,65 +539,14 @@
\thinspace
\fi}
-% \def\noinx%
-% {\let\inx=\end}
-%
-% \def\nosecs%
-% {\let\FIN=\fin
-% \def\fin%
-% {\let\parfillskip=\end
-% \FIN}}
-%
-% \def\nocon%
-% {\let\con=\end}
-%
-% \newcount\twodigits
-%
-% \def\hours%
-% {\twodigits=\time
-% \divide\twodigits by 60
-% \printtwodigits
-% \multiply\twodigits by -60
-% \advance\twodigits by \time
-% :\printtwodigits}
-%
-% \def\gobbleone1{}
-%
-% \def\printtwodigits%
-% {\advance\twodigits by 100
-% \expandafter\gobbleone\number\twodigits
-% \advance\twodigits by -100 }
-%
-% \def\today%
-% {\ifcase\month
-% \or January\or February\or March\or April\or May\or June%
-% \or July\or August\or September\or October\or November\or December%
-% \fi
-% \space
-% \number\day, \number\year}
-%
-% \def\datethis%
-% {\def\startsection%
-% {\leftline{\sc\today\ at \hours}
-% \bigskip
-% \let\startsection=\stsec
-% \stsec}}
-%
-% \def\datecontentspage%
-% {\def\topofcontents%
-% {\leftline{\sc\today\ at \hours}
-% \bigskip
-% \centerline{\titlefont\title}
-% \vfill}}
-
\defCWEBdummy\datethis {} % say `\datethis' in limbo, to get your listing timestamped before section 1
\defCWEBdummy\datecontentspage {} % timestamps the contents page
-\defCWEBmacro\TeX%
+\defCWEBmacro\TeX
{{\ifmmode\it\fi
- \leavevmode
+ \dontleavehmode
\hbox{T\kern-.1667em\lower.424ex\hbox{E}\hskip-.125em X}}}
-
+
% alternative implementation
\newif\ifCWEBnotes
@@ -999,44 +560,13 @@
\defCWEBmacro\A {\CWEBnotesfalse \note{See also section}} % xref for doubly defined section name
\defCWEBmacro\As {\CWEBnotestrue \note{See also sections}} % xref for multiply defined section name
-\defCWEBmacro\ET% conjunction between two section numbers
+\defCWEBmacro\ET % conjunction between two section numbers
{ and~}
-\defCWEBmacro\ETs% conjunction between the last two of several section numbers
+\defCWEBmacro\ETs % conjunction between the last two of several section numbers
{, and~}
-%\def\processCWEBsectionnumbers[#1]%
-% {\bgroup
-% \def\CWEBcomma%
-% {\def\CWEBcomma{, }}%
-% \def\docommand##1%
-% {\bgroup
-% \def\[####1]{####1}%
-% \xdef\CWEBreference{##1}%
-% \egroup
-% \CWEBcomma{\naar{\donottest{##1}}[web:\CWEBreference]}}%
-% \processcommalist[{#1}]\docommand
-% \egroup}
-
-% \def\processCWEBsectionnumbers[#1]%
-% {\bgroup
-% \def\CWEBcomma%
-% {\def\CWEBcomma{, }}%
-% \def\docommand##1%
-% {\bgroup
-% \def\(####1){####1}%
-% \xdef\CWEBreference{##1}%
-% \egroup
-% \CWEBcomma
-% {\localcolortrue\naar{\donottest{##1}}[web:\CWEBreference]}}%
-% \bgroup
-% \def\[##1]{\(##1)}\let\(=\relax\xdef\CWEBreferences{#1}%
-% \egroup
-% \unexpanded\def\(##1){\[##1]}%
-% \processcommacommand[\CWEBreferences]\docommand
-% \egroup}
-
-\def\processCWEBsectionnumbers[#1]%
+\unexpanded\def\processCWEBsectionnumbers[#1]%
{\bgroup
\def\CWEBcomma%
{\def\CWEBcomma{, }}%
@@ -1045,15 +575,15 @@
\def\[####1]{####1}%
\xdef\CWEBreference{##1}%
\egroup
- \CWEBcomma{\localcolortrue\goto{\donottest{##1}}[web:\CWEBreference]}}%
+ \CWEBcomma{\goto{##1}[web:\CWEBreference]}}%
\processlist{(}{)}{,}\docommand(#1)
\egroup}
-\def\processCWEBsectionnotes%
+\unexpanded\def\processCWEBsectionnotes
{\catcode`\s=12
\doprocessCWEBsectionnotes}
-\def\doprocessCWEBsectionnotes#1.%
+\unexpanded\def\doprocessCWEBsectionnotes#1.%
{\ifCWEBnotes
\def\next##1\ET##2##3.%
{\processCWEBsectionnumbers[##1]%
@@ -1077,27 +607,27 @@
\def\afterCWEBnote{\par}%
\hangindent2em
%\baselineskip10pt
- \eightrm#1~\processCWEBsectionnotes}
+ \tx#1~\processCWEBsectionnotes}
-\def\oldCWEBmacroX#1:#2\X% original
+\unexpanded\def\oldCWEBmacroX#1:#2\X% original
{\ifmmode
\gdef\XX{\null$\null}%
\else
\gdef\XX{}%
\fi % section name
- \XX$\langle\,${#2\eightrm\kern.5em#1}$\,\rangle$\XX}
+ \XX$\langle\,${#2\tx\kern.5em#1}$\,\rangle$\XX}
-\defCWEBmacro\ATH%
+\defCWEBmacro\ATH
{\oldCWEBmacroX\kern-.5em:Preprocessor definitions\X}
-\def\newCWEBmacroX#1:#2\X% original
+\unexpanded\def\newCWEBmacroX#1:#2\X% original
{\ifmmode
\gdef\XX{\null$\null}%
\else
\gdef\XX{}%
\fi % section name
\XX$\langle\,$%
- {#2\eightrm\kern.5em\processCWEBsectionnumbers[{#1}]}%
+ {#2\tx\kern.5em\processCWEBsectionnumbers[{#1}]}%
$\,\rangle$\XX}
\defCWEBmacro\X#1:#2\X%
@@ -1122,12 +652,12 @@
\ignorespaces}
\defCWEBmacro\N#1#2#3.%
- {\gdepth=#1%
+ {\writestatus{cweb}{*\secno}% progress report
+ \gdepth=#1%
\MN{#2}% beginning of starred section
\ifon
\ifnum#1<\secpagedepth
- \vfil
- \eject % force page break if depth is small
+ \page
\else
\vfil
\penalty-100
@@ -1135,14 +665,13 @@
\theCWEBvskip
\fi
\fi
- \message{*\secno}% progress report
- \makesectionformat % context
+% \makesectionformat % context
\defconvertedargument\ascii{#3}%
- \edef\next%
- {\write\CWEBcont % write to contents file
- {\string\ZZ{\ascii}{#1}{\secno}%
- {\sectionformat::\noexpand\userfolio}{\noexpand\realfolio}}}%
- \next % \ZZ{title}{depth}{sec}{page}
+% \edef\next%
+% {\write\CWEBcont % write to contents file
+% {\string\ZZ{\ascii}{#1}{\secno}%
+% {\sectionformat::\noexpand\userfolio}{\noexpand\realfolio}}}%
+% \next % \ZZ{title}{depth}{sec}{page}
\ifon
\startsection
\pagereference[web:#2]%
@@ -1171,12 +700,11 @@
\unprotect
-\def\gotoCWEBsection#1[#2]%
+\unexpanded\def\gotoCWEBsection#1[#2]%
{\iflinktoCWEBfile
\bgroup
\setupinteraction[\c!color=,\c!style=]%
\let\savedreferenceprefix=\referenceprefix
- \localcolortrue
\goto{#1}[\otherCWEBfile::\savedreferenceprefix web:#2]%
\egroup
\else
@@ -1185,7 +713,7 @@
\protect
-\defCWEBmacro\startsection%
+\defCWEBmacro\startsection
{\rightskip=0pt % get out of C mode (cf. \B)
\sfcode`;=1500
\pretolerance 200
@@ -1197,12 +725,12 @@
\gotoCWEBsection{\bf\secstar.\quad}[\secno]%
\egroup}
-\def\ignoreCWEBinput%
+\unexpanded\def\ignoreCWEBinput
{\let\normalinput=\input
\def\input ##1 %
{\let\input=\normalinput}}
-\def\loadCWEBmacros#1%
+\unexpanded\def\loadCWEBmacros#1%
{\let\oldN=\N
\def\N{\bgroup\setbox0=\vbox\bgroup\endinput}%
\ignoreCWEBinput
@@ -1210,7 +738,7 @@
\egroup\egroup
\let\N=\oldN}
-\def\resetCWEBcontext%
+\unexpanded\def\resetCWEBcontext
{\catcode`\|=12 % used in context discretionaries
\everypar{} % used for context indentation and floats
\parskip=0pt % no stretch between cweb paragraphs
@@ -1218,14 +746,14 @@
\newwrite\CWEBcont
-\def\processCWEBsource #1 %
+\unexpanded\def\processCWEBsource #1 %
{\bgroup
+ \writestatus{cweb}{Source:}
\resetCWEBcontext
\activateCWEB
\ignoreCWEBinput
\immediate\openout\CWEBcont=#1.toc
\write\CWEBcont{\noexpand\unprotect}
- \message{Source:}
\marking[CWEBfilename]{#1}
\ReadFile{#1.tex}\relax
\write\CWEBcont{\noexpand\protect}
@@ -1233,10 +761,10 @@
\par
\egroup}
-\def\resetCWEBindexentry%
+\unexpanded\def\resetCWEBindexentry
{\xdef\currentCWEBindexentry{}}
-\def\showCWEBindexentry#1% can be redefined
+\unexpanded\def\showCWEBindexentry#1% can be redefined
{\theCWEBvskip
\vskip3\lineheight
\goodbreak
@@ -1244,7 +772,32 @@
{\pagereference[web:#1]\bf#1}%
\theCWEBvskip}
-\def\checkCWEBindexentry#1%
+
+ \def\dodofindfirstcharacter#1%
+ {\ifx#1\relax
+ \let\next=\egroup
+ \else
+ \handlecase
+ {\expandafter\ifnum\expandafter\catcode\expandafter`#1=11
+ \def\next##1\relax{\egroup\def\firstcharacter{#1}}%
+ \fi}%
+ \fi
+ \next}
+
+ \def\dofindfirstcharacter#1#2%
+ {\def\firstcharacter{}%
+ \bgroup
+ \defconvertedargument\ascii{#2}%
+ \let\next\dodofindfirstcharacter
+ \let\handlecase#1%
+ \expandafter\next\ascii\relax}
+
+ \def\FINDFIRSTCHARACTER
+ {\dofindfirstcharacter\uppercase}
+
+
+
+\unexpanded\def\checkCWEBindexentry#1%
{\bgroup
\def\\##1{##1}% a dummy that also removes the {}
\def\|##1{##1}% another dummy
@@ -1261,11 +814,12 @@
\showCWEBindexentry{\currentCWEBindexentry}}}%
\egroup}
-\def\theCWEBbeforeindex {\startcolumns}
-\def\theCWEBafterindex {\stopcolumns}
+\unexpanded\def\theCWEBbeforeindex {\startcolumns}
+\unexpanded\def\theCWEBafterindex {\stopcolumns}
-\def\processCWEBindex #1 %
+\unexpanded\def\processCWEBindex #1 %
{\bgroup
+ \writestatus{cweb}{Index:}
\resetCWEBcontext
\activateCWEB
\resetCWEBindexentry
@@ -1286,9 +840,8 @@
\tolerance 10000
\hyphenpenalty 10000
\parindent0pt
- \message{Index:}
- \marking[CWEBfilename] {#1}
- \marking[CWEBsectiontitle] {index}
+ \marking[CWEBfilename]{#1}
+ \marking[CWEBsectiontitle]{index}
\marking[CWEBsectionnumber]{}
\marking[CWEBsectiondepth]{}
\loadCWEBmacros{#1}
@@ -1298,8 +851,9 @@
\par
\egroup}
-\def\processCWEBsections #1 %
+\unexpanded\def\processCWEBsections #1 %
{\bgroup
+ \writestatus{cweb}{Section names:}
\resetCWEBcontext
\activateCWEB
\loadCWEBmacros{#1}
@@ -1309,7 +863,7 @@
\def\note##1%
{\quad
\bgroup
- \eightrm
+ \tx
##1~\processCWEBsectionnotes}
\def\Q {\CWEBnotesfalse \note{Cited in section}} % crossref for mention of a section
\def\Qs{\CWEBnotestrue \note{Cited in sections}} % crossref for mentions of a section
@@ -1317,9 +871,8 @@
\def\Us{\CWEBnotestrue \note{Used in sections}} % crossref for uses of a section
\def\I {\par\hangindent 2em}%
\let\*=*
- \message{Section names:}
- \marking[CWEBfilename] {#1}
- \marking[CWEBsectiontitle] {sections}
+ \marking[CWEBfilename]{#1}
+ \marking[CWEBsectiontitle]{sections}
\marking[CWEBsectionnumber]{}
\marking[CWEBsectiondepth]{}
\loadCWEBmacros{#1}
@@ -1329,8 +882,9 @@
\par
\egroup}
-\def\processCWEBcontents #1 %
+\unexpanded\def\processCWEBcontents #1 %
{\bgroup
+ \writestatus{cweb}{Table of contents:}
\resetCWEBcontext
\activateCWEB
\loadCWEBmacros{#1}
@@ -1340,9 +894,8 @@
\parindent = 0pt
\line{\hfil Section\hbox to3em{\hss Page}}
\let\ZZ=\contentsline
- \message{Table of contents:}
- \marking[CWEBfilename] {#1}
- \marking[CWEBsectiontitle] {table of contents}
+ \marking[CWEBfilename]{#1}
+ \marking[CWEBsectiontitle]{table of contents}
\marking[CWEBsectionnumber]{}
\marking[CWEBsectiondepth]{}
\loadCWEBmacros{#1}
@@ -1350,24 +903,16 @@
\par
\egroup}
+\unprotect
+
\defCWEBmacro\contentsline#1#2#3#4#5%
- {\ifnum#2=0
- \smallbreak
+ {\ifnum#2=\zerocount
+ \blank[\v!small]%
\fi
- \line{\consetup{#2}#1
- \rm
- \leaders\hbox to .5em{.\hfil}\hfil\
- {\localcolortrue\goto{#3}[web:#3]}% below: \gotorealpage ? should be changed
- \hbox to3em{\localcolortrue\hss\gotorealpage{}{}{#5}{\translatednumber[#4]\presetgoto}}}}
-
-%D A last hack, needed because a file can overload of the
-%D above. (Some day: a check like \type{\ifx#1\CWEBdefined}.)
-
-\def\outer#1#2%
- {\ifx#2\undefined
- \expandafter#1\expandafter#2%
- \else
- \expandafter#1\expandafter\ThrowAway
- \fi}
+ \line{\consetup{#2}#1\rm\leaders\hbox to .5em{.\hfil}\hfil\
+ {\goto{#3}[web:#3]}% below: \gotorealpage ? should be changed
+ \hbox to3em{\hss\gotorealpage{}{}{#5}{\translatednumber[#4]\presetgoto}}}}
+
+\protect
\endinput
diff --git a/tex/context/modules/mkiv/m-matrix.mkiv b/tex/context/modules/mkiv/m-matrix.mkiv
index c5ace0b33..9cac69672 100644
--- a/tex/context/modules/mkiv/m-matrix.mkiv
+++ b/tex/context/modules/mkiv/m-matrix.mkiv
@@ -70,10 +70,16 @@ end
-- todo: define a matrix at the tex end so that we have more control
+-- local fences = {
+-- parentheses = { left = "\\left(\\,", right = "\\,\\right)" },
+-- brackets = { left = "\\left[\\,", right = "\\,\\right]" },
+-- bars = { left = "\\left|\\,", right = "\\,\\right|" },
+-- }
+
local fences = {
- parentheses = { left = "\\left(\\,", right = "\\,\\right)" },
- brackets = { left = "\\left[\\,", right = "\\,\\right]" },
- bars = { left = "\\left|\\,", right = "\\,\\right|" },
+ parentheses = { "matrix:parentheses" },
+ brackets = { "matrix:brackets" },
+ bars = { "matrix:bars" },
}
-- one can add more fences
@@ -104,7 +110,7 @@ function matrix.typeset(m,options)
elseif tonumber(template) then
template = "%0." .. template .. "F"
end
- context.startmatrix(whatever)
+ context.startnamedmatrix(whatever)
if type(m[1]) ~= "table" then
m = { copy(m) }
end
@@ -121,7 +127,7 @@ function matrix.typeset(m,options)
end
context.NR()
end
- context.stopmatrix()
+ context.stopnamedmatrix()
elseif m then
context(m)
end
diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv
index e6dffaeb5..4e8c07df5 100644
--- a/tex/context/modules/mkiv/m-scite.mkiv
+++ b/tex/context/modules/mkiv/m-scite.mkiv
@@ -226,6 +226,7 @@ local function lexdata(data,lexname)
end
data = indent(data)
end
+io.savedata("temp.logs ",data)
assignbuffer("lex",data)
end
@@ -321,7 +322,7 @@ visualizers.register("txt", visualizer)
\unexpanded\def\buff_scite_slxe
{\par}
-\unexpanded\def\buff_scite_slxs {\hskip\scitespaceskip}
+\unexpanded\def\buff_scite_slxs {\hskip\scitespaceskip\relax}
\unexpanded\def\buff_scite_slxf#1{\hskip#1\scitespaceskip\relax}
\unexpanded\def\installscitecommandsinline
diff --git a/tex/context/modules/mkiv/s-setups-macros.mkiv b/tex/context/modules/mkiv/s-setups-macros.mkiv
new file mode 100644
index 000000000..42c6b38a2
--- /dev/null
+++ b/tex/context/modules/mkiv/s-setups-macros.mkiv
@@ -0,0 +1,203 @@
+%D \module
+%D [ file=setups-macros,
+%D version=2018.01.15,
+%D title=\CONTEXT\ Setup Definitions,
+%D subtitle=Macro Properties,
+%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.
+
+\startluacode
+
+ local find = string.find
+ local gsub = string.gsub
+ local topattern = string.topattern
+ local concat = table.concat
+ local sort = table.sort
+ local sortedkeys = table.sortedkeys
+ local sortedhash = table.sortedhash
+ local getmacro = tokens.getters.macro
+ local gethash = tex.hashtokens
+
+ local lpegmatch, P, R, C, S = lpeg.match, lpeg.P, lpeg.R, lpeg.C, lpeg.S
+
+ local macros = interfaces.macros or { }
+ interfaces.macros = macros
+
+ local hashtable = nil
+
+ -- table.save("temp.lua",gethash())
+
+ local prefix = P("??")
+ local initial = R("09")^1 * P(">")
+ local name = C(R("az","AZ") * (R("az","AZ","09")+S(" "))^0)
+ local parent = P(":parent")
+ local eos = P(-1)
+
+ local pattern1 = initial^0
+ * name
+ * parent^0
+ * eos
+ local pattern2 = prefix
+ * name
+ * eos
+ local pattern3 = C(initial^1)
+ * name
+ * parent^1 -- so no e.g. measure here
+ * eos
+
+
+ local function reload()
+ hashtable = gethash()
+ sort(hashtable)
+ end
+
+ interfaces.macros.reload = reload
+
+ function interfaces.macros.instances(str)
+ local namespace = getmacro("??"..str)
+ if namespace then
+ local found = { }
+ local pattern = P(namespace) * pattern1
+ if not hashtable then
+ reload()
+ end
+ for i=1,#hashtable do
+ local hi = hashtable[i]
+ local pi = lpegmatch(pattern,hi)
+ if pi then
+ found[pi] = true
+ end
+ end
+ return sortedkeys(found)
+ end
+ end
+
+ function interfaces.macros.namespaces()
+ local found = { }
+ if not hashtable then
+ reload()
+ end
+ for i=1,#hashtable do
+ local hi = hashtable[i]
+ local pi = lpegmatch(pattern2,hi)
+ if pi then
+ found[pi] = true
+ end
+ end
+ return sortedkeys(found)
+ end
+
+ function interfaces.macros.allinstances()
+ local found = { }
+ local reverse = { }
+ local all = { }
+ if not hashtable then
+ reload()
+ end
+ for i=1,#hashtable do
+ local hi = hashtable[i]
+ local pi = lpegmatch(pattern2,hi)
+ if pi then
+ found[pi] = true
+ reverse[getmacro("??"..pi)] = pi
+ end
+ end
+ for i=1,#hashtable do
+ local hi = hashtable[i]
+ local ni, pi = lpegmatch(pattern3,hi)
+ if ni and pi then
+ local ri = reverse[ni]
+ if ri and found[ri] then
+ local a = all[ri]
+ if a then
+ a[pi] = true
+ else
+ all[ri] = { [pi] = true }
+ end
+ end
+ end
+ end
+ return all
+ end
+
+ function interfaces.macros.collect(str)
+ local asked = gsub(str,"^\\","")
+ local found = { }
+ local pattern = "^" .. topattern(asked) .. "$"
+ if not hashtable then
+ reload()
+ end
+ for i=1,#hashtable do
+ local hi = hashtable[i]
+ if find(hi,pattern) then
+ found[hi] = true
+ end
+ end
+ return sortedkeys(found)
+ end
+
+ function commands.getinstances(str,separator)
+ local i = interfaces.macros.instances(str)
+ if i then
+ context(concat(i,separator or ", "))
+ end
+ end
+ function commands.getnamespaces(separator)
+ local i = interfaces.macros.namespaces()
+ if i then
+ context(concat(i,separator or ", "))
+ end
+ end
+
+ function commands.showallinstances()
+ local i = interfaces.macros.allinstances()
+ if i then
+ local ctxcmd = context.showoneinstance
+ for k, v in sortedhash(i) do
+ ctxcmd(k,concat(sortedkeys(v),", "))
+ end
+ end
+ end
+
+\stopluacode
+
+\unprotect
+
+\def\getinstances #1{\ctxlua{commands.getinstances("#1")}} % expandable
+\def\getnamespaces {\ctxlua{commands.getnamespaces()}} % expandable
+
+\unexpanded\def\showoneinstance#1#2%
+ {\begingroup
+ \hangindent\emwidth
+ \hangafter\plusone
+ \veryraggedright
+ \dontleavehmode
+ \ttbf#1:\space
+ \tttf#2\par
+ \endgroup}
+
+\unexpanded\def\showallinstances
+ {\ctxlua{commands.showallinstances()}}
+
+\protect
+
+\continueifinputfile{s-setups-macros.mkiv}
+
+\usemodule[art-01]
+
+\starttext
+
+% \getinstances{measure} \page
+% \getinstances{framed} \page
+% \getinstances{layout} \page
+%
+% \getnamespaces \page
+
+\showallinstances
+
+\stoptext
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index b1e0036a7..4588db88f 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 01/17/18 13:06:36
+-- merge date : 01/19/18 13:42:33
do -- begin closure to overcome local limits and interference