summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/context.mkiv
blob: ff4c7f6c6b7b1966b584bbb4132ac82ab0c96202 (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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
%D \module
%D   [       file=context,
%D        version=2008.28.10, % 1995.10.10,
%D          title=\CONTEXT,
%D       subtitle=\CONTEXT\ Format Generation,
%D         author=Hans Hagen, % ɦɑns ɦɑˈχən
%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.

% Here is some timing (2015-04-01) luajittex format generation:
%
% 2.6 sec : normal make
% 2.0 sec : with terminal output piped to file
% 0.2 sec : format dumped
% 0.2 sec : char-def/char-ini (no bytecode)
%
%D So a format still saves some 1.5 seconds (with luajjitex) startup and on network
%D shares cq. when no files are cached by the os it's of course much worse. A zero
%D run is .27 sec with luajittex. In luametatex it's faster anyway (2.4 sec).

%D The real minimal startup time can be measured by uncommenting \type {\normalend}
%D in the \type {cont-new.mkiv} file. When we subtract .250 for \LUA\ initialization
%D from 0.300 runtime and also subtract some 0.030 for the resolver, we get about
%D 0.020 for format loading which is pretty fast. We're talking \LUAMETATEX\ here.

% http://build.contextgarden.net/waterfall?tag=c/lua(meta)tex

%D Welcome to context, pronounced as kontekst (rather dutch) and not as conτεχt.

\catcode`\{=1 \catcode`\}=2 \catcode`\#=6

%D From the next string (which is set by the script that assembles the distribution)
%D later on we will calculate a number that can be used by use modules to identify
%D the feature level. Starting with version 2004.8.30 the low level interface is
%D english. Watch out and adapt your styles an modules.

% \everypar{\writestatus{!!!!}{some spurious input in line \the\inputlineno}\wait}

%D The order of loading will change when all modules have been cleaned up and the
%D dependencies are more consistent. Beware, the version number has to match \type
%D {YYYY.MM.DD HH:MM} format.

\edef\contextformat {\jobname}
\edef\contextversion{2020.03.10 14:44}
\edef\contextkind   {beta}

%D Kind of special:

\chardef\contextlmtxmode\directlua{tex.print(CONTEXTLMTXMODE or 0)}\relax

%D For those who want to use this:

\let\fmtname   \contextformat
\let\fmtversion\contextversion

%D Loading:

\edef\mksuffix   {mkiv}
\edef\contextmark{MKIV}

\ifx\normalinput\undefined \let\normalinput\input \fi

\def\loadmarkfile#1{\normalinput{#1.\mksuffix}}
\def\loadmkivfile#1{\normalinput{#1.mkiv}}
\def\loadmkvifile#1{\normalinput{#1.mkvi}}
%def\loadmkilfile#1{\normalinput{#1.mkil}}
%def\loadmklifile#1{\normalinput{#1.mkli}}

%D First we load the system modules. These implement a lot of manipulation macros.
%D We start with setting up some basic \TEX\ machinery.

\loadmarkfile{syst-ini}

%D We just quit if new functionality is expected.

\ifnum\luatexversion<110 % also change message
    \writestatus{!!!!}{Your luatex binary is too old, you need at least version 1.10!}
    \expandafter\end
\fi

%D Some checking (more primitives are now defined):

\ifdefined\defaultinterface   \else \def\defaultinterface  {english}         \fi
%ifdefined\messageinterface   \else \let\messageinterface  \defaultinterface \fi
\ifdefined\defaultlanguagetag \else \def\defaultlanguagetag{en}              \fi

%D There is only this way to pass the version info to \LUA\ (currently). Hm, we could
%D now put it into the environment.

\newtoks\contextversiontoks \contextversiontoks\expandafter{\contextversion}
\newtoks\contextkindtoks    \contextkindtoks   \expandafter{\contextkind}

% \normaleverypar{\wait} % uncomment for test of funny injections

%D Now the more fundamental code gets defined.

\loadmarkfile{norm-ctx}
\loadmarkfile{syst-pln}
\loadmarkfile{syst-mes}

\loadmarkfile{luat-cod}
\loadmarkfile{luat-bas}
\loadmarkfile{luat-lib}
\loadmarkfile{luat-soc}

\loadmarkfile{catc-ini}
\loadmarkfile{catc-act}
\loadmarkfile{catc-def}
\loadmarkfile{catc-ctx}
\loadmarkfile{catc-sym}

\loadmarkfile{toks-ini}
\loadmarkfile{cldf-ini}

% \tracecatcodetables

%D From here on we have \unexpanded being \normalprotected, as we already had
%D \type {\unexpanded} long before etex came around.

\loadmarkfile{luat-ini}
\loadmarkfile{toks-scn}

\loadmarkfile{syst-aux}
\loadmarkfile{syst-lua}
\loadmarkfile{syst-con}

\loadmarkfile{syst-fnt}
\loadmarkfile{syst-rtp}

\loadmarkfile{luat-usr}

\loadmkvifile{file-ini}
\loadmkvifile{file-res}
\loadmkvifile{file-lib}

%D This needs more checking for clashes:
%D
%D \starttyping
%D \doifelsefileexists{l-macro-imp-codes-luatex.lua}{\registerctxluafile{l-macro-imp-codes-luatex}{}}{}
%D \stoptyping

\loadmarkfile{supp-dir}

\loadmarkfile{char-utf} % generic code (i.e. not much tex) ... could become unic-ini
\loadmarkfile{char-ini} % tex / context specific
\loadmarkfile{char-act} % even more specific

\loadmarkfile{mult-ini}
\loadmarkfile{mult-sys}
\loadmarkfile{mult-aux}
\loadmarkfile{mult-def}
\loadmarkfile{mult-chk}
\loadmkvifile{mult-dim}

\loadmarkfile{cldf-int} % interface

\loadmarkfile{trac-ctx} % maybe move up

% \loadmarkfile{luat-ini}

\loadmarkfile{toks-tra}
\loadmarkfile{toks-aux}
%loadmarkfile{toks-map} % obsolete, never used

\loadmarkfile{attr-ini}

\loadmarkfile{core-ini}
\loadmarkfile{core-env}

\loadmarkfile{layo-ini}

\loadmarkfile{node-ini}

\loadmarkfile{cldf-bas} % basics / depends on nodes

\loadmarkfile{node-fin}
\loadmarkfile{node-mig}
%loadmarkfile{node-pag}

\loadmarkfile{driv-ini} % lmtx

\loadmarkfile{back-ini}
\loadmarkfile{back-res}
\loadmarkfile{back-trf}

\loadmarkfile{attr-col}
\loadmarkfile{attr-lay}
\loadmarkfile{attr-neg}
\loadmarkfile{attr-eff}
\loadmarkfile{attr-mkr}

\loadmarkfile{trac-tex}
\loadmarkfile{trac-deb} % will move up

%loadmarkfile{blob-ini} % not to be used, we only use a helper

\loadmarkfile{supp-box}

\loadmarkfile{supp-ran}
\loadmarkfile{supp-mat}

\loadmarkfile{core-uti}
\loadmkvifile{file-job}

\loadmarkfile{anch-pos}

\loadmarkfile{typo-ini}
\loadmarkfile{typo-lin}
\loadmarkfile{typo-bld} % par builders

\loadmarkfile{typo-inj}

\loadmkvifile{file-syn}
\loadmkvifile{file-mod}

\loadmarkfile{core-sys}
\loadmarkfile{core-con}

\loadmarkfile{cont-fil}

\loadmarkfile{regi-ini}
\loadmarkfile{enco-ini}
\loadmarkfile{hand-ini}

\loadmarkfile{lang-ini}
\loadmarkfile{lang-hyp} % also loads dis
\loadmarkfile{lang-lab}

\loadmarkfile{unic-ini}

% \loadmarkfile{core-uti}
\loadmarkfile{core-two}
\loadmarkfile{core-dat}

\loadmarkfile{colo-ini}
\loadmarkfile{colo-grp} % optional
\loadmarkfile{colo-ext}

\loadmarkfile{node-bck} % overloads anch-pgr (experimental and undocumented)

\loadmarkfile{pack-cut}

\loadmarkfile{lang-mis}
\loadmarkfile{lang-url}
\loadmarkfile{lang-def}

% \loadmkvifile{file-job} % why so late?

\loadmarkfile{symb-ini} % brrr depends on fonts

\loadmarkfile{sort-ini}

\loadmkvifile{pack-mis}
\loadmarkfile{pack-rul}
\loadmarkfile{pack-mrl}
\loadmkvifile{pack-bck}
\loadmarkfile{pack-fen}

\loadmarkfile{lxml-ini}
\loadmarkfile{lxml-sor}

\loadmkvifile{typo-prc}

% \loadmarkfile{anch-pos}

\loadmkvifile{strc-ini}
\loadmarkfile{strc-tag}
\loadmarkfile{strc-doc}
\loadmarkfile{strc-num}
\loadmarkfile{strc-mar}
\loadmarkfile{strc-sbe}
\loadmkvifile{strc-lst}
\loadmarkfile{strc-sec}
\loadmarkfile{strc-pag} % hm, depends on core-num
\loadmarkfile{strc-ren}
\loadmarkfile{strc-xml}
\loadmarkfile{strc-def} % might happen later
\loadmkvifile{strc-ref}
%loadmarkfile{strc-reg}
\loadmkvifile{strc-lev} % experiment

\loadmarkfile{spac-hor}
\loadmarkfile{spac-ali}
\loadmarkfile{spac-flr}
\loadmarkfile{spac-ver} % beware, hooks into strc-sec
\loadmarkfile{spac-lin}
\loadmarkfile{spac-pag}
\loadmarkfile{spac-par}
\loadmarkfile{spac-def}
\loadmkvifile{spac-prf}
\loadmarkfile{spac-grd}

%loadmarkfile{anch-pos}

\loadmkvifile{scrn-ini}
\loadmkvifile{scrn-ref}

\loadmarkfile{pack-obj}

\loadmkvifile{strc-itm}

\loadmkvifile{strc-con}
\loadmkvifile{strc-des}
\loadmkvifile{strc-enu}

\loadmarkfile{strc-ind}
\loadmarkfile{strc-lab}
\loadmarkfile{strc-syn}

% \loadmarkfile{core-sys}

\loadmarkfile{page-var}
\loadmkvifile{page-otr}
\loadmarkfile{page-ini}
\loadmarkfile{page-ins}
\loadmarkfile{page-fac}
\loadmarkfile{page-brk}
\loadmarkfile{page-col}
\loadmarkfile{page-inf}
\loadmarkfile{page-flt}
\loadmarkfile{page-bck}
\loadmarkfile{page-not}
\loadmarkfile{page-one}
\loadmarkfile{page-lay}
\loadmkvifile{page-box}
\loadmkvifile{page-txt}
\loadmarkfile{page-sid} % when

\loadmkvifile{strc-flt}

\loadmarkfile{page-pst}
\loadmkvifile{page-mbk}
%loadmarkfile{page-mul} % \usecolumns[old-multicolumns]
\loadmarkfile{page-mix}
\loadmarkfile{page-smp}
%loadmarkfile{page-set} % \usecolumns[old-columnsets]
\loadmarkfile{page-cst}
\loadmarkfile{page-pcl} % new
\loadmarkfile{pack-lyr}
\loadmarkfile{pack-pos}
\loadmkvifile{page-mak}

\loadmarkfile{strc-reg} % uses mixed columns

\loadmkvifile{page-lin}
\loadmarkfile{page-par}
\loadmarkfile{typo-pag}
\loadmarkfile{typo-mar}
\loadmarkfile{typo-itm}

\loadmarkfile{buff-ini}
\loadmarkfile{buff-ver}
\loadmkvifile{buff-par}

\loadmarkfile{buff-imp-tex}        % optional as also runtime if not loaded
\loadmarkfile{buff-imp-mp}         % optional as also runtime if not loaded
\loadmarkfile{buff-imp-lua}        % optional as also runtime if not loaded
\loadmarkfile{buff-imp-xml}        % optional as also runtime if not loaded

\loadmarkfile{buff-imp-parsed-xml} % optional
%loadmarkfile{buff-imp-parsed-lua} % optional

\loadmarkfile{strc-blk}

\loadmarkfile{page-imp}
\loadmkvifile{page-sel} % optional
\loadmkvifile{page-inj} % optional

\loadmkvifile{scrn-pag}
\loadmkvifile{scrn-wid}
\loadmkvifile{scrn-but}
\loadmkvifile{scrn-bar}

\loadmarkfile{page-com} % optional (after scrn-pag)

\loadmarkfile{strc-bkm} % bookmarks

\loadmarkfile{java-ini}

\loadmkvifile{scrn-fld}
\loadmkvifile{scrn-hlp}

\loadmarkfile{char-enc} % will move up

\loadmkvifile{font-lib} % way too late but after language
\loadmkvifile{font-fil}
\loadmkvifile{font-var}
\loadmkvifile{font-fea}
\loadmkvifile{font-mat}
\loadmkvifile{font-ini}
\loadmkvifile{font-sym}
\loadmkvifile{font-sty}
\loadmkvifile{font-set}
\loadmkvifile{font-emp}
\loadmarkfile{font-pre}
\loadmarkfile{font-unk}
\loadmarkfile{font-tra}
\loadmarkfile{font-chk}
\loadmarkfile{font-uni}
\loadmkvifile{font-col}
\loadmkvifile{font-gds}
\loadmkvifile{font-aux}
\loadmkvifile{font-sel}

\loadmarkfile{typo-tal}
\loadmarkfile{typo-par} % par builders (uses fonts)

\loadmarkfile{tabl-com}
\loadmarkfile{tabl-pln}

\loadmarkfile{tabl-tab} % thrd-tab stripped and merged

\loadmarkfile{tabl-tbl}
\loadmarkfile{tabl-ntb}
\loadmarkfile{tabl-nte}
\loadmarkfile{tabl-ltb}
\loadmarkfile{tabl-frm}
\loadmarkfile{tabl-tsp}
\loadmkvifile{tabl-xtb}
\loadmarkfile{tabl-mis}

\loadmarkfile{typo-lan}

\loadmarkfile{lxml-css}

\loadmarkfile{spac-chr} % depends on fonts

\loadmarkfile{blob-ini} % not to be used, we only use a helper

\loadmarkfile{trac-vis}
\loadmarkfile{trac-jus}

\loadmarkfile{typo-cln}
\loadmarkfile{typo-wrp}
\loadmarkfile{typo-spa}
\loadmarkfile{typo-krn}
\loadmkvifile{typo-itc}
\loadmarkfile{typo-dir}
\loadmarkfile{typo-brk}
\loadmarkfile{typo-cap}
\loadmarkfile{typo-dig}
\loadmarkfile{typo-rep}
\loadmkvifile{typo-txt}
\loadmarkfile{typo-drp}
\loadmarkfile{typo-fln}
\loadmarkfile{typo-sus}
\loadmarkfile{typo-lig}
\loadmarkfile{typo-chr}
\loadmarkfile{typo-rub}
\loadmkivfile{typo-fkr}
\loadmkivfile{typo-pnc}

\loadmkvifile{type-ini}
\loadmarkfile{type-set}

\loadmarkfile{scrp-ini}

\loadmarkfile{symb-emj}

\loadmarkfile{lang-wrd} % can be optional (discussion with mm sideeffect)
\loadmarkfile{lang-rep} % can be optional (bt 2013 side effect)

\loadmarkfile{prop-ini} % only for downward compatibility

\loadmarkfile{mlib-ctx} % messy order

\loadmarkfile{meta-ini}
\loadmarkfile{meta-tex}
\loadmarkfile{meta-fun}
\loadmarkfile{meta-pag}
\loadmarkfile{meta-grd}
\loadmarkfile{meta-fnt}
\loadmarkfile{meta-nod}
\loadmarkfile{meta-lua}

\loadmarkfile{page-mrk} % depends on mp

\loadmarkfile{page-flw}
\loadmarkfile{page-spr}
\loadmarkfile{page-plg}
\loadmarkfile{page-str}

\loadmarkfile{anch-pgr} % can be moved up (nicer for dependencies)
\loadmkvifile{anch-bck}
\loadmarkfile{anch-tab} % overloads tabl-tbl
\loadmarkfile{anch-bar}
%loadmarkfile{anch-snc} % when needed this one will be redone

\loadmarkfile{math-ini} % way after font-pre !
\loadmarkfile{math-pln}
\loadmarkfile{math-for}
\loadmarkfile{math-def} % also saves some meanings
\loadmarkfile{math-ali}
%loadmarkfile{math-arr}
\loadmkvifile{math-stc}
\loadmarkfile{math-frc}
\loadmarkfile{math-mis}
\loadmarkfile{math-scr}
\loadmarkfile{math-int}
\loadmarkfile{math-del}
\loadmarkfile{math-fen}
\loadmkvifile{math-acc}
\loadmkvifile{math-rad}
\loadmarkfile{math-inl}
\loadmarkfile{math-dis}
%loadmarkfile{math-lan}

%loadmarkfile{phys-dim} % moved to after typo-scr

\loadmarkfile{strc-mat}

\loadmarkfile{chem-ini}
\loadmarkfile{chem-str}

\loadmarkfile{typo-scr}
\loadmarkfile{phys-dim}

\loadmarkfile{node-rul} % beware, defined \underbar so after math
\loadmkvifile{font-sol} % font solutions

\loadmkvifile{strc-not}
\loadmkvifile{strc-lnt}
\loadmkivfile{strc-tnt}
\loadmkivfile{strc-usr}

\loadmarkfile{pack-com}
\loadmarkfile{typo-del}

\loadmarkfile{grph-trf}
\loadmarkfile{grph-inc}
\loadmarkfile{grph-fig}
\loadmarkfile{grph-raw}
\loadmarkfile{grph-rul}
\loadmarkfile{grph-pat}

\loadmarkfile{pack-box}
\loadmarkfile{pack-bar}
\loadmarkfile{page-app}
\loadmarkfile{meta-fig}

\loadmarkfile{page-ffl}

\loadmarkfile{lang-spa} % will become obsolete

\loadmarkfile{typo-ovl} % fuzzy project (tracing) code

% old bibtex support: (will be m-oldbibtex.mkiv)

% \loadmarkfile{bibl-bib}
% \loadmarkfile{bibl-tra}

% new bibtex support:

\loadmarkfile{publ-ini}
\loadmarkfile{publ-tra}
\loadmarkfile{publ-xml}
\loadmarkfile{publ-old}

%loadmarkfile{x-xtag}  % no longer preloaded

\loadmarkfile{meta-xml}

\loadmarkfile{cont-log}

% \loadmarkfile{task-ini}

\loadmarkfile{cldf-ver} % verbatim, this can come late
\loadmarkfile{cldf-com} % commands, this can come late

\loadmarkfile{core-ctx} % this order might change but we need to check depedencies / move to another namespace

\loadmarkfile{core-def}

%usemodule[x][res-04] % xml resource libraries
%usemodule[x][res-08] % rlx runtime conversion
%usemodule[x][res-12] % rli external indentification

% now we hook in backend code (needs checking)

\loadmarkfile{back-exp}
\loadmarkfile{back-pdf}

\loadmarkfile{mlib-pdf}
\loadmarkfile{mlib-pps}
\loadmarkfile{meta-pdf}
\loadmarkfile{meta-blb}
\loadmarkfile{grph-epd}

\loadmarkfile{math-inc} % an experiment
\loadmarkfile{publ-inc} % an experiment

\loadmarkfile{task-ini}

\loadmarkfile{syst-cmp} % compatibility stuff moved here

\loadmarkfile{cont-run} % the main runner (used in cont-yes.mkiv)

\setupcurrentlanguage[\defaultlanguagetag]

\prependtoks
    \ctxlua{statistics.starttiming(statistics)}%
\to \everyjob

\appendtoks
    \ctxlua{statistics.stoptiming(statistics)}%
\to \everyjob

% \appendtoks
%     \ctxlua{job.prepare()}%
% \to \everyjob

% \appendtoks
%     \enabletrackers[*]%
% \to \everyjob

\appendtoks
    \ctxlua{statistics.savefmtstatus("\jobname","\contextversion","context.mkiv","\contextkind","\contextbanner")}% can become automatic
\to \everydump

\errorstopmode \dump \endinput