1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18\writestatus{loading}{ConTeXt Tracing Macros Breakpoints}
19
20\registerctxluafile{tracbrk}{}
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35\unprotect
36
37\newcount\c_line_break_check
38\newcount\c_balance_check
39
40\gdef\trac_start_show_breakpoints#1#2#3
41 {\begingroup
42 \getdummyparameters[\c!option=,\c!list=,\c!offset=\zeropoint,\c!level=0,#1]
43 \ctxlua{tracers.breakpoints.start {
44 option = "\dummyparameter\c!option",
45 level = "\dummyparameter\c!level",
46 list = "\dummyparameter\c!list",
47 offset = \number\dimexpr\dummyparameter\c!offset\relax,
48 }}
49 \endgroup
50 #2#3
51 #3\plusone}
52
53\gdef\trac_stop_show_breakpoints#1#2
54 {\par
55 #2#1
56 \ctxlua{tracers.breakpoints.stop()}}
57
58\gdef\trac_show_breakpoints#1
59 {\begingroup
60 \getdummyparameters[\c!option=,#1]
61 \switchtobodyfont[6pt]
62 \dorecurse{\cldcontext{tracers.breakpoints.nofresults()}} {
63 \startcolumns[\c!n=3,\c!notes=\v!no,#1,\c!option=]
64 \ctxlua{tracers.breakpoints.typesetresult(##1,"\dummyparameter\c!option")}
65 \stopcolumns
66 }
67
68 \endgroup}
69
70\gdef\trac_draw_breakpoints#1
71 {\begingroup
72 \getdummyparameters[
73 \c!dx=3fs,
74 \c!dy=2fs,
75 \c!sx=1.5fs,
76 \c!sy=1.125fs,
77 \c!rulethickness=0.15fs,
78 #1]
79 \startMPcode
80 lua.mp.show_breakpoints(
81 \todimension{\dummyparameter\c!dx},
82 \todimension{\dummyparameter\c!dy},
83 \todimension{\dummyparameter\c!sx},
84 \todimension{\dummyparameter\c!sy},
85 \todimension{\dummyparameter\c!rulethickness}
86 ) ;
87 \stopMPcode
88 \endgroup}
89
90
91
92
93\permanent\tolerant\protected\gdef\startshowbreakpoints[#1]
94 {\trac_start_show_breakpoints{#1}\c_line_break_check\linebreakchecks}
95
96\permanent\protected\gdef\stopshowbreakpoints
97 {\trac_stop_show_breakpoints\c_line_break_check\linebreakchecks}
98
99\permanent\tolerant\protected\gdef\showbreakpoints[#1]
100 {\trac_show_breakpoints{#1}}
101
102\permanent\tolerant\protected\gdef\drawbreakpoints[#1]
103 {\trac_draw_breakpoints{#1}}
104
105
106
107
108
109
110\permanent\tolerant\protected\gdef\startshowbalancepoints[#1]
111 {\trac_start_show_breakpoints{#1,\c!level=1}\c_balance_check\balancechecks}
112
113\permanent\protected\gdef\stopshowbalancepoints
114 {\trac_stop_show_breakpoints\c_balance_check\balancechecks}
115
116\permanent\tolerant\protected\gdef\showbalancepoints[#1]
117 {\trac_show_breakpoints{#1}}
118
119\permanent\tolerant\protected\gdef\drawbalancepoints[#1]
120 {\trac_draw_breakpoints{#1}}
121
122
123
124
125\protect \endinput
126 |