summaryrefslogtreecommitdiff
path: root/doc/context/presentations/context/2012/context-2012-visual-debugging.tex
blob: 4be8d5e725421ebe8760c171a241fa951e2506f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
\usemodule[present-stepwise,present-bars,abr-01]

\startdocument
  [title=Visual debugging,
   color=darkmagenta]

\StartSteps

\startsubject[title=How it started]

    \startitemize[packed]

        \startitem Some 15 years ago I wanted some more feedback. \stopitem \FlushStep
        \startitem So I figured out a way to visualize boxes, kerns, glue, etc. \stopitem \FlushStep
        \startitem Some aspects were tricky, like stretch and shrink (no \ETEX\ yet), fillers, leaders, etc. \stopitem \FlushStep
        \startitem I gave some presentations and it was nice to see the puzzled faces. \stopitem \FlushStep
        \startitem As unboxing does not work, it is somewhat interfering. \stopitem \FlushStep
        \startitem When not enabed there is no overhead but we did disable it at some places. \stopitem \FlushStep

    \stopitemize

\stopsubject

\startsubject[title=Do we need it]

    \startitemize[packed]

        \startitem I wonder if anyone ever used it. \stopitem \FlushStep
        \startitem Some of the helpers are quite handy, like \type {\ruledhbox}. \stopitem \FlushStep
        \startitem So these had to be provided anyway, so: where to stop? \stopitem \FlushStep

    \stopitemize

\stopsubject

\StopSteps \page \StartSteps

\startsubject[title=All kind of debugging]

    \startitemize[packed]

        \startitem We have more debugging, much shows up when writing new code. \stopitem \FlushStep
        \startitem Think of fonts, math, graphics, characters, etc. \stopitem \FlushStep
        \startitem Some make no sense in \MKIV, so they're gone, but new ones show up. \stopitem \FlushStep
        \startitem In due time this will all be normalized (as most lives in modules). \stopitem \FlushStep

    \stopitemize

\stopsubject

\StopSteps \page \StartSteps

\startsubject[title=Why we kept it]

    \startitemize[packed]

        \startitem When cleaning up the code I had to decide to keep it or redo it as it could be done \MKIV-ish. \stopitem \FlushStep
        \startitem But as we already had some \LUA\ based extras it made sense to redo it. \stopitem \FlushStep
        \startitem The old code is still there as module (also because it had some more funstuff). \stopitem \FlushStep

    \stopitemize

\stopsubject

\startsubject[title=How it worked]

    \startitemize[packed]

        \startitem In \MKII\ primitives are overloaded. \stopitem \FlushStep
        \startitem So effectively, when enabled, \type {\hbox} cum suis become macros. \stopitem \FlushStep
        \startitem We use rules (and leaders) to visualize properties. \stopitem \FlushStep
        \startitem Some constructs interfere so we need to compensate side effects. \stopitem \FlushStep

    \stopitemize

\stopsubject

\StopSteps \page \StartSteps

\startsubject[title=How it works]

    \startitemize[packed]

        \startitem The basics were a rather trivial quick job as we had a lot in place already. \stopitem \FlushStep
        \startitem Interpreting the node list and injecting visualizers. \stopitem \FlushStep
        \startitem We use colors, rules and text but much can be overlayed. \stopitem \FlushStep
        \startitem Control over what gets visualized at the \TEX\ end. \stopitem \FlushStep
        \startitem Control over what gets shown by using layers. \stopitem \FlushStep
        \startitem As usual most time went into visualization choices and optimzation. \stopitem \FlushStep
        \startitem Some visualizers interfered with (hardcoded) expectations in the backend. \stopitem \FlushStep
        \startitem When I decided to use layers I had to adapt some oter code (mostly out of efficiency). \stopitem \FlushStep
        \startitem There is room for more (but first I want the bitlib of \LUA\ 5.2). \stopitem \FlushStep

    \stopitemize

\stopsubject

\StopSteps

\page

\defineoverlay[invoke][\overlaybutton{NextPage}]

\defineframed
  [MyFramed]
  [background=color,
   backgroundcolor=yellow,
   offset=overlay,
   frame=off]

\startbuffer
\ruledhbox{j}
\ruledhbox{jj}
\ruledhbox{jjj}
\ruledhbox{jjjj}
\ruledhbox{jjjjj}
\stopbuffer

\startsubject[title=Details 1]

    \scale[width=\textwidth]{\MyFramed \bgroup
         {\getbuffer}\removeunwantedspaces
    \egroup}

    \typebuffer

\stopsubject

\page

\startbuffer
\ruledhbox{take boxes}
\stopbuffer

\startsubject[title=Details 2a]

    \scale[width=\textwidth]{\MyFramed \bgroup
         {\getbuffer}\removeunwantedspaces
    \egroup}

    \typebuffer

\stopsubject

\page

\startbuffer
\ruledhbox{some depth too}
\stopbuffer

\startsubject[title=Details 2b]

    \scale[width=\textwidth]{\MyFramed \bgroup
         {\getbuffer}\removeunwantedspaces
    \egroup}

    \typebuffer

\stopsubject

\page

\startbuffer
\showmakeup \hbox{again an hbox}
\stopbuffer

\startsubject[title=Details 3a]

    \scale[width=\textwidth]{\MyFramed \bgroup
         {\getbuffer}\removeunwantedspaces
    \egroup}

    \typebuffer

\stopsubject

\page

\startbuffer
\ruledvtop{\ruledvbox{\ruledhbox{multiple boxes}}}
\stopbuffer

\startsubject[title=Details 3b]

    \scale[width=\textwidth]{\MyFramed \bgroup
         {\getbuffer}\removeunwantedspaces
    \egroup}

    \typebuffer

\stopsubject

\page

\startbuffer
\showmakeup \hbox{multiple boxes}
\stopbuffer

\startsubject[title=Details 3c]

    \scale[width=\textwidth]{\MyFramed \bgroup
        \hskip.5em
         {\getbuffer}\removeunwantedspaces
        \hskip.5em
    \egroup}

    \typebuffer

\stopsubject

\page

\startbuffer
\showmakeup \vbox{\hbox{multiple boxes}}
\stopbuffer

\startsubject[title=Details 3c]

    \scale[width=\textwidth]{\MyFramed \bgroup
        \hskip.5em
         {\getbuffer}\removeunwantedspaces
        \hskip.5em
    \egroup}

    \typebuffer

\stopsubject

\page

\startbuffer
\showmakeup \vtop{\vbox{\hbox{multiple boxes}}}
\stopbuffer

\startsubject[title=Details 3d]

    \scale[width=\textwidth]{\MyFramed \bgroup
        \hskip.5em
         {\getbuffer}\removeunwantedspaces
        \hskip.5em
    \egroup}

    \typebuffer

\stopsubject

\page

\startbuffer
\showstruts why \strut use \strut's
\stopbuffer

\startsubject[title=Details 4]

    \scale[width=\textwidth]{\MyFramed \bgroup
         {\getbuffer}\removeunwantedspaces
    \egroup}

    \typebuffer

\stopsubject

\page

\startbuffer
\showglyphs glyphs
\stopbuffer

\startsubject[title=Details 5]

    \scale[width=\textwidth]{\MyFramed \bgroup
         {\getbuffer}\removeunwantedspaces
    \egroup}

    \typebuffer

\stopsubject
\page

\startbuffer
\enabletrackers[visualizers.whatsit]glyphs \righttoleft glyphs
\stopbuffer

\startsubject[title=Details 6]

    \scale[width=\textwidth]{\MyFramed \bgroup
         \hskip.75em
         {\getbuffer}\removeunwantedspaces
         \hskip.75em
    \egroup}

    \typebuffer

\stopsubject

\stopdocument