trac-riv.mkxl /size: 2688 b    last modification: 2025-02-21 11:03
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 {\dummyparameter\c!margin}
37      skip   {\dummyparameter\c!spaceinbetween}
38      step   {\dummyparameter\c!step}
39      height {\dummyparameter\c!height}
40      depth  {\dummyparameter\c!depth}
41   \relax
42   \setbox\scratchboxtwo\hbox\bgroup
43     \startMPcode
44        lmt_showrivers (
45           \tointeger{\dummyparameter\c!criterium},
46           \todimension{\wd  \scratchboxone},
47           \todimension{\htdp\scratchboxone},
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    {#2}%
68      margin {\dummyparameter\c!margin}%
69      skip   {\dummyparameter\c!spaceinbetween}%
70      step   {\dummyparameter\c!step}%
71      height {\dummyparameter\c!height}%
72      depth  {\dummyparameter\c!depth}%
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