trac-riv.mkxl /size: 2828 b    last modification: 2024-01-16 10:22
1%D \module
2%D   [       file=trac-riv,
3%D        version=2023.08.15, % follow up
4%D          title=\CONTEXT\ Tracing Macros,
5%D       subtitle=Rivers,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14\writestatus{loading}{ConTeXt Tracing Macros / Rivers}
15
16\registerctxluafile{trac-riv}{autosuffix}
17
18\unprotect
19
20\permanent\tolerant\protected\def\startshowrivers[#1]#*%
21  {\begingroup
22   \letdummyparameter\c!margin\zeropoint
23   \letdummyparameter\c!step\!!twopoint
24   \setdummyparameter\c!height{.2\bodyfontsize}%
25   \setdummyparameter\c!depth {.2\bodyfontsize}%
26   \setdummyparameter\c!spaceinbetween{.1\lineheight}%
27   \letdummyparameter\c!criterium\plusfour
28   \letdummyparameter\c!option\empty
29   \getdummyparameters[#1]%
30   \setbox\scratchboxone\vbox\bgroup}
31
32\permanent\tolerant\protected\def\stopshowrivers
33  {\egroup
34   \clf_getrivers
35      box    \scratchboxone
36      margin \dimexpr\dummyparameter\c!margin\relax
37      skip   \dimexpr\dummyparameter\c!spaceinbetween\relax
38      step   \dimexpr\dummyparameter\c!step\relax
39      height \dimexpr\dummyparameter\c!height\relax
40      depth  \dimexpr\dummyparameter\c!depth\relax
41   \relax
42   \setbox\scratchboxtwo\hbox\bgroup
43     \startMPcode
44        lmt_showrivers (
45           \the\numexpr\dummyparameter\c!criterium\relax,
46           \the\dimexpr\wd  \scratchboxone\relax,
47           \the\dimexpr\htdp\scratchboxone\relax,
48           \ifcstok{\dummyparameter\c!option}\v!test true\else false\fi
49        ) ;
50     \stopMPcode
51   \egroup
52   \startoverlay
53      {\box\scratchboxtwo}
54      {\box\scratchboxone}
55   \stopoverlay
56   \endgroup}
57
58\permanent\tolerant\protected\def\addriverstobox[#1]#2%
59  {\begingroup
60   \letdummyparameter\c!margin\zeropoint
61   \letdummyparameter\c!step\!!twopoint
62   \setdummyparameter\c!height{.2\bodyfontsize}%
63   \setdummyparameter\c!depth {.2\bodyfontsize}%
64   \setdummyparameter\c!spaceinbetween{.1\lineheight}%
65   \getdummyparameters[#1]%
66   \clf_addrivers
67      box    \numexpr#2\relax
68      margin \dimexpr\dummyparameter\c!margin\relax
69      skip   \dimexpr\dummyparameter\c!spaceinbetween\relax
70      step   \dimexpr\dummyparameter\c!step\relax
71      height \dimexpr\dummyparameter\c!height\relax
72      depth  \dimexpr\dummyparameter\c!depth\relax
73   \relax
74   \endgroup}
75
76% \def\page_one_show_rivers#1%
77%   {\addriverstobox{#1}}
78%
79% \installtextracker
80%   {typesetting.rivers}
81%   {\let\page_one_hook_for_checks\page_one_show_rivers}
82%   {\let\page_one_hook_for_checks\gobbleoneargument}
83
84\permanent\tolerant\protected\def\showrivers[#1]%
85  {\def\page_one_hook_for_checks##1{\addriverstobox[#1]{##1}}}
86
87\protect \endinput
88