context.mkiv /size: 14 Kb    last modification: 2024-01-16 09:02
1%D \module
2%D   [       file=context,
3%D        version=2008.28.10, % 1995.10.10,
4%D          title=\CONTEXT,
5%D       subtitle=\CONTEXT\ Format Generation,
6%D         author=Hans Hagen, % ɦɑns ɦɑˈχən
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%D There is some residual code in \MKIV\ that results from the transition to \LMTX\
15%D but removeing it can have side effects due to oversights. There is no impact on
16%D performance to I leave at that.
17
18% Here is some timing (2015-04-01) luajittex format generation:
19%
20% 2.6 sec : normal make
21% 2.0 sec : with terminal output piped to file
22% 0.2 sec : format dumped
23% 0.2 sec : char-def/char-ini (no bytecode)
24%
25%D So a format still saves some 1.5 seconds (with luajjitex) startup and on network
26%D shares cq. when no files are cached by the os it's of course much worse. A zero
27%D run is .27 sec with luajittex. In luametatex it's faster anyway (2.4 sec).
28
29%D The real minimal startup time can be measured by uncommenting \type {\normalend}
30%D in the \type {cont-new.mkiv} file. When we subtract .250 for \LUA\ initialization
31%D from 0.300 runtime and also subtract some 0.030 for the resolver, we get about
32%D 0.020 for format loading which is pretty fast. We're talking \LUAMETATEX\ here.
33
34% http://build.contextgarden.net/waterfall?tag=c/lua(meta)tex
35
36%D Welcome to context, pronounced as kontekst (rather dutch) and not as conτεχt.
37
38\catcode`\{=1 \catcode`\}=2 \catcode`\#=6
39
40%D From the next string (which is set by the script that assembles the distribution)
41%D later on we will calculate a number that can be used by use modules to identify
42%D the feature level. Starting with version 2004.8.30 the low level interface is
43%D english. Watch out and adapt your styles an modules.
44
45% \everypar{\writestatus{!!!!}{some spurious input in line \the\inputlineno}\wait}
46
47%D The order of loading will change when all modules have been cleaned up and the
48%D dependencies are more consistent. Beware, the version number has to match \type
49%D {YYYY.MM.DD HH:MM} format.
50
51\edef\contextformat {\jobname}
52\edef\contextversion{2024.01.08 11:23}
53
54%D Kind of special:
55
56\chardef\contextlmtxmode\directlua{tex.print(CONTEXTLMTXMODE or 0)}\relax
57
58%D For those who want to use this:
59
60\let\fmtname   \contextformat
61\let\fmtversion\contextversion
62
63%D Loading:
64
65\edef\mksuffix   {mkiv}
66\edef\contextmark{MKIV}
67
68\ifx\normalinput\undefined \let\normalinput\input \fi
69
70\def\loadmarkfile#1{\normalinput{#1.\mksuffix}}
71\def\loadmkivfile#1{\normalinput{#1.mkiv}}
72\def\loadmkvifile#1{\normalinput{#1.mkvi}}
73%def\loadmkilfile#1{\normalinput{#1.mkil}}
74%def\loadmklifile#1{\normalinput{#1.mkli}}
75
76%D First we load the system modules. These implement a lot of manipulation macros.
77%D We start with setting up some basic \TEX\ machinery.
78
79\loadmarkfile{syst-ini}
80
81%D We just quit if new functionality is expected.
82
83\ifnum\luatexversion<110 % also change message
84    \writestatus{!!!!}{Your luatex binary is too old, you need at least version 1.10!}
85    \expandafter\end
86\fi
87
88%D Some checking (more primitives are now defined):
89
90\ifdefined\defaultinterface   \else \def\defaultinterface  {english}         \fi
91%ifdefined\messageinterface   \else \let\messageinterface  \defaultinterface \fi
92\ifdefined\defaultlanguagetag \else \def\defaultlanguagetag{en}              \fi
93
94%D There is only this way to pass the version info to \LUA\ (currently). Hm, we could
95%D now put it into the environment.
96
97\newtoks\contextversiontoks \contextversiontoks\expandafter{\contextversion}
98
99% \normaleverypar{\wait} % uncomment for test of funny injections
100
101%D Now the more fundamental code gets defined.
102
103\loadmarkfile{norm-ctx}
104\loadmarkfile{syst-pln}
105\loadmarkfile{syst-mes}
106
107\loadmarkfile{luat-cod}
108\loadmarkfile{luat-bas}
109\loadmarkfile{luat-lib}
110\loadmarkfile{luat-soc}
111
112\loadmarkfile{catc-ini}
113\loadmarkfile{catc-act}
114\loadmarkfile{catc-def}
115\loadmarkfile{catc-ctx}
116\loadmarkfile{catc-sym}
117
118\loadmarkfile{toks-ini}
119\loadmarkfile{cldf-ini}
120
121% \tracecatcodetables
122
123%D From here on we have \unexpanded being \normalprotected, as we already had
124%D \type {\unexpanded} long before etex came around.
125
126\loadmarkfile{luat-ini}
127\loadmarkfile{toks-scn}
128
129\loadmarkfile{syst-aux}
130\loadmarkfile{syst-lua}
131\loadmarkfile{syst-con}
132
133\loadmarkfile{syst-fnt}
134\loadmarkfile{syst-rtp}
135
136\loadmarkfile{luat-usr}
137
138\loadmkvifile{file-ini}
139\loadmkvifile{file-res}
140\loadmkivfile{file-lib}
141
142%D This needs more checking for clashes:
143%D
144%D \starttyping
145%D \doifelsefileexists{l-macro-imp-codes-luatex.lua}{\registerctxluafile{l-macro-imp-codes-luatex}{}}{}
146%D \stoptyping
147
148\loadmarkfile{supp-dir}
149
150\loadmarkfile{char-utf} % generic code (i.e. not much tex) ... could become unic-ini
151\loadmarkfile{char-ini} % tex / context specific
152\loadmarkfile{char-act} % even more specific
153
154\loadmarkfile{mult-ini}
155\loadmarkfile{mult-sys}
156\loadmarkfile{mult-aux}
157\loadmarkfile{mult-def}
158\loadmarkfile{mult-chk}
159\loadmkvifile{mult-dim}
160
161\loadmarkfile{cldf-int} % interface
162
163\loadmarkfile{trac-ctx} % maybe move up
164
165% \loadmarkfile{luat-ini}
166
167%loadmarkfile{toks-tra}
168\loadmarkfile{toks-aux}
169%loadmarkfile{toks-map} % obsolete, never used
170
171\loadmarkfile{attr-ini}
172
173\loadmarkfile{core-ini}
174\loadmarkfile{core-env}
175
176\loadmarkfile{layo-ini}
177
178\loadmarkfile{node-ini}
179
180\loadmarkfile{cldf-bas} % basics / depends on nodes
181
182\loadmarkfile{node-fin}
183\loadmarkfile{node-mig}
184%loadmarkfile{node-pag}
185
186\loadmarkfile{driv-ini} % lmtx
187
188\loadmarkfile{back-ini}
189\loadmarkfile{back-res}
190\loadmarkfile{back-trf}
191
192\loadmarkfile{attr-col}
193\loadmarkfile{attr-lay}
194\loadmarkfile{attr-neg}
195\loadmarkfile{attr-eff}
196\loadmarkfile{attr-mkr}
197
198\loadmarkfile{trac-tex}
199\loadmarkfile{trac-deb} % will move up
200
201\loadmarkfile{supp-box}
202
203\loadmarkfile{supp-ran}
204\loadmarkfile{supp-mat}
205
206\loadmarkfile{core-uti}
207\loadmkvifile{file-job}
208
209\loadmarkfile{anch-pos}
210
211\loadmarkfile{typo-ini}
212\loadmarkfile{typo-lin}
213\loadmarkfile{typo-bld} % par builders
214
215\loadmarkfile{typo-inj}
216
217\loadmkvifile{file-syn}
218\loadmkvifile{file-mod}
219
220\loadmarkfile{core-sys}
221\loadmarkfile{core-con}
222
223\loadmarkfile{cont-fil}
224
225\loadmarkfile{regi-ini}
226\loadmarkfile{enco-ini}
227\loadmarkfile{hand-ini}
228
229\loadmarkfile{lang-ini}
230\loadmarkfile{lang-hyp} % also loads dis
231\loadmarkfile{lang-lab}
232
233\loadmarkfile{unic-ini}
234
235% \loadmarkfile{core-uti}
236\loadmarkfile{core-two}
237\loadmarkfile{core-dat}
238
239\loadmarkfile{colo-ini}
240\loadmarkfile{colo-grp} % optional
241\loadmarkfile{colo-ext}
242
243\loadmarkfile{node-bck} % overloads anch-pgr (experimental and undocumented)
244
245\loadmarkfile{pack-cut}
246
247\loadmarkfile{lang-mis}
248\loadmarkfile{lang-url}
249\loadmarkfile{lang-def}
250
251% \loadmkvifile{file-job} % why so late?
252
253\loadmarkfile{symb-ini} % brrr depends on fonts
254
255\loadmarkfile{sort-ini}
256
257\loadmkvifile{pack-mis}
258\loadmarkfile{pack-rul}
259\loadmarkfile{pack-mrl}
260\loadmkvifile{pack-bck}
261\loadmarkfile{pack-fen}
262
263\loadmarkfile{lxml-ini}
264\loadmarkfile{lxml-sor}
265
266\loadmkvifile{typo-prc}
267\loadmkivfile{typo-plc}
268
269% \loadmarkfile{anch-pos}
270
271\loadmkvifile{strc-ini}
272\loadmarkfile{strc-tag}
273\loadmarkfile{strc-doc}
274\loadmarkfile{strc-num}
275\loadmarkfile{strc-mar}
276\loadmarkfile{strc-sbe}
277\loadmkvifile{strc-lst}
278\loadmarkfile{strc-sec}
279\loadmarkfile{strc-pag} % hm, depends on core-num
280\loadmarkfile{strc-ren}
281\loadmarkfile{strc-xml}
282\loadmarkfile{strc-def} % might happen later
283\loadmkvifile{strc-ref}
284%loadmarkfile{strc-reg}
285\loadmkvifile{strc-lev} % experiment
286
287\loadmarkfile{spac-hor}
288\loadmarkfile{spac-ali}
289\loadmarkfile{spac-flr}
290\loadmarkfile{spac-ver} % beware, hooks into strc-sec
291\loadmarkfile{spac-lin}
292\loadmarkfile{spac-pag}
293\loadmarkfile{spac-par}
294\loadmarkfile{spac-def}
295\loadmkvifile{spac-prf}
296\loadmarkfile{spac-grd}
297
298%loadmarkfile{anch-pos}
299
300\loadmkvifile{scrn-ini}
301\loadmkvifile{scrn-ref}
302
303\loadmarkfile{pack-obj}
304
305\loadmkvifile{strc-itm}
306
307\loadmkvifile{strc-con}
308\loadmkvifile{strc-des}
309\loadmkvifile{strc-enu}
310
311\loadmarkfile{strc-ind}
312\loadmarkfile{strc-lab}
313\loadmarkfile{strc-syn}
314
315% \loadmarkfile{core-sys}
316
317\loadmarkfile{page-var}
318\loadmkvifile{page-otr}
319\loadmarkfile{page-ini}
320\loadmarkfile{page-ins}
321\loadmarkfile{page-fac}
322\loadmarkfile{page-brk}
323\loadmarkfile{page-col}
324\loadmarkfile{page-inf}
325\loadmarkfile{page-flt}
326\loadmarkfile{page-bck}
327\loadmarkfile{page-not}
328\loadmarkfile{page-one}
329\loadmarkfile{page-lay}
330\loadmkvifile{page-box}
331\loadmkvifile{page-txt}
332\loadmarkfile{page-sid} % when
333
334\loadmkvifile{strc-flt}
335
336\loadmarkfile{page-pst}
337\loadmkvifile{page-mbk}
338%loadmarkfile{page-mul} % \usecolumns[old-multicolumns]
339\loadmarkfile{page-mix}
340\loadmarkfile{page-smp}
341%loadmarkfile{page-set} % \usecolumns[old-columnsets]
342\loadmarkfile{page-cst}
343\loadmarkfile{page-pcl} % new
344\loadmarkfile{pack-lyr}
345\loadmarkfile{pack-pos}
346\loadmkvifile{page-mak}
347
348\loadmarkfile{strc-reg} % uses mixed columns
349
350\loadmkvifile{page-lin}
351\loadmarkfile{page-par}
352\loadmarkfile{typo-pag}
353\loadmarkfile{typo-mar}
354\loadmarkfile{typo-itm}
355
356\loadmarkfile{buff-ini}
357\loadmarkfile{buff-ver}
358\loadmkvifile{buff-par}
359
360\loadmarkfile{buff-imp-tex}        % optional as also runtime if not loaded
361\loadmarkfile{buff-imp-mp}         % optional as also runtime if not loaded
362\loadmarkfile{buff-imp-lua}        % optional as also runtime if not loaded
363\loadmarkfile{buff-imp-xml}        % optional as also runtime if not loaded
364
365\loadmarkfile{buff-imp-parsed-xml} % optional
366%loadmarkfile{buff-imp-parsed-lua} % optional
367
368\loadmarkfile{strc-blk}
369
370\loadmarkfile{page-imp}
371\loadmkvifile{page-sel} % optional
372\loadmkvifile{page-inj} % optional
373
374\loadmkvifile{scrn-pag}
375\loadmkvifile{scrn-wid}
376\loadmkvifile{scrn-but}
377\loadmkvifile{scrn-bar}
378
379\loadmarkfile{page-com} % optional (after scrn-pag)
380
381\loadmarkfile{strc-bkm} % bookmarks
382
383\loadmarkfile{java-ini}
384
385\loadmkvifile{scrn-fld}
386\loadmkvifile{scrn-hlp}
387
388\loadmarkfile{char-enc} % will move up
389
390\loadmkvifile{font-lib} % way too late but after language
391\loadmkvifile{font-fil}
392\loadmkvifile{font-var}
393\loadmkvifile{font-fea}
394\loadmkvifile{font-mat}
395\loadmkvifile{font-ini}
396\loadmkvifile{font-sym}
397\loadmkvifile{font-sty}
398\loadmkvifile{font-set}
399\loadmkvifile{font-emp}
400\loadmarkfile{font-pre}
401\loadmarkfile{font-unk}
402\loadmarkfile{font-tra}
403\loadmarkfile{font-chk}
404\loadmarkfile{font-uni}
405\loadmkvifile{font-col}
406\loadmkvifile{font-gds}
407\loadmkvifile{font-aux}
408\loadmkvifile{font-sel}
409
410\loadmarkfile{typo-tal}
411\loadmarkfile{typo-par} % par builders (uses fonts)
412
413\loadmarkfile{tabl-com}
414\loadmarkfile{tabl-pln}
415
416\loadmarkfile{tabl-tab} % thrd-tab stripped and merged
417
418\loadmarkfile{tabl-tbl}
419\loadmarkfile{tabl-ntb}
420\loadmarkfile{tabl-nte}
421\loadmarkfile{tabl-ltb}
422\loadmarkfile{tabl-frm}
423\loadmarkfile{tabl-tsp}
424\loadmkvifile{tabl-xtb}
425\loadmarkfile{tabl-mis}
426
427\loadmarkfile{typo-lan}
428
429\loadmarkfile{lxml-css}
430
431\loadmarkfile{spac-chr} % depends on fonts
432
433\loadmarkfile{blob-ini}
434
435\loadmarkfile{trac-vis}
436\loadmarkfile{trac-jus}
437
438\loadmarkfile{typo-cln}
439\loadmarkfile{typo-wrp}
440\loadmarkfile{typo-spa}
441\loadmarkfile{typo-krn}
442\loadmkvifile{typo-itc}
443\loadmarkfile{typo-dir}
444\loadmarkfile{typo-brk}
445\loadmarkfile{typo-cap}
446\loadmarkfile{typo-dig}
447\loadmarkfile{typo-rep}
448\loadmkvifile{typo-txt}
449\loadmarkfile{typo-drp}
450\loadmarkfile{typo-fln}
451\loadmarkfile{typo-sus}
452\loadmarkfile{typo-lig}
453\loadmarkfile{typo-chr}
454\loadmarkfile{typo-rub}
455\loadmkivfile{typo-fkr}
456\loadmkivfile{typo-pnc}
457
458\loadmkvifile{type-ini}
459\loadmarkfile{type-set}
460
461\loadmarkfile{scrp-ini}
462
463\loadmarkfile{symb-emj}
464
465\loadmarkfile{lang-tra}
466\loadmarkfile{lang-wrd} % can be optional (discussion with mm sideeffect)
467\loadmarkfile{lang-rep} % can be optional (bt 2013 side effect)
468
469\loadmarkfile{mlib-ctx} % messy order
470
471\loadmarkfile{meta-ini}
472\loadmarkfile{meta-tex}
473\loadmarkfile{meta-fun}
474\loadmarkfile{meta-pag}
475\loadmarkfile{meta-grd}
476\loadmarkfile{meta-fnt}
477\loadmarkfile{meta-nod}
478\loadmarkfile{meta-lua}
479
480\loadmarkfile{page-mrk} % depends on mp
481
482\loadmarkfile{page-flw}
483\loadmarkfile{page-spr}
484\loadmarkfile{page-plg}
485\loadmarkfile{page-str}
486
487\loadmarkfile{anch-pgr} % can be moved up (nicer for dependencies)
488\loadmkvifile{anch-bck}
489\loadmarkfile{anch-tab} % overloads tabl-tbl
490\loadmarkfile{anch-bar}
491%loadmarkfile{anch-snc} % when needed this one will be redone
492
493\loadmarkfile{math-ini} % way after font-pre !
494\loadmarkfile{math-pln}
495\loadmarkfile{math-for}
496\loadmarkfile{math-def} % also saves some meanings
497\loadmarkfile{math-ali}
498%loadmarkfile{math-arr}
499\loadmkvifile{math-stc}
500\loadmarkfile{math-frc}
501\loadmarkfile{math-mis}
502\loadmarkfile{math-scr}
503\loadmarkfile{math-int}
504\loadmarkfile{math-del}
505\loadmarkfile{math-fen}
506\loadmkvifile{math-acc}
507\loadmkvifile{math-rad}
508\loadmarkfile{math-inl}
509\loadmarkfile{math-dis}
510%loadmarkfile{math-lan}
511
512%loadmarkfile{phys-dim} % moved to after typo-scr
513
514\loadmarkfile{strc-mat}
515
516\loadmarkfile{chem-ini}
517\loadmarkfile{chem-str}
518
519\loadmarkfile{typo-scr}
520\loadmarkfile{phys-dim}
521
522\loadmarkfile{node-rul} % beware, defined \underbar so after math
523\loadmkvifile{font-sol} % font solutions
524
525\loadmkvifile{strc-not}
526\loadmkvifile{strc-lnt}
527\loadmkivfile{strc-tnt}
528\loadmkivfile{strc-usr}
529
530\loadmarkfile{pack-com}
531\loadmarkfile{typo-del}
532
533\loadmarkfile{grph-trf}
534\loadmarkfile{grph-inc}
535\loadmarkfile{grph-fig}
536\loadmarkfile{grph-raw}
537\loadmarkfile{grph-rul}
538\loadmarkfile{grph-pat}
539
540\loadmarkfile{pack-box}
541\loadmarkfile{pack-bar}
542\loadmarkfile{page-app}
543\loadmarkfile{meta-fig}
544
545\loadmarkfile{page-ffl}
546
547\loadmarkfile{lang-spa} % will become obsolete
548
549\loadmarkfile{typo-ovl} % fuzzy project (tracing) code
550
551% old bibtex support: (will be m-oldbibtex.mkiv)
552
553% \loadmarkfile{bibl-bib}
554% \loadmarkfile{bibl-tra}
555
556% new bibtex support:
557
558\loadmarkfile{publ-ini}
559\loadmarkfile{publ-tra}
560\loadmarkfile{publ-xml}
561\loadmarkfile{publ-old}
562
563%loadmarkfile{x-xtag}  % no longer preloaded
564
565\loadmarkfile{meta-xml}
566
567\loadmarkfile{cont-log}
568
569% \loadmarkfile{task-ini}
570
571\loadmarkfile{cldf-ver} % verbatim, this can come late
572\loadmarkfile{cldf-com} % commands, this can come late
573
574\loadmarkfile{core-ctx} % this order might change but we need to check depedencies / move to another namespace
575
576\loadmarkfile{core-def}
577
578%usemodule[x][res-04] % xml resource libraries
579%usemodule[x][res-08] % rlx runtime conversion
580%usemodule[x][res-12] % rli external indentification
581
582% now we hook in backend code (needs checking)
583
584\loadmarkfile{back-exp}
585\loadmarkfile{back-pdf}
586
587\loadmarkfile{mlib-pdf}
588\loadmarkfile{mlib-pps}
589\loadmarkfile{meta-pdf}
590\loadmarkfile{meta-blb}
591\loadmarkfile{grph-epd}
592
593\loadmarkfile{math-inc} % an experiment
594\loadmarkfile{publ-inc} % an experiment
595
596\loadmarkfile{task-ini}
597
598\loadmarkfile{syst-cmp} % compatibility stuff moved here
599
600\loadmarkfile{cont-run} % the main runner (used in cont-yes.mkiv)
601
602\setupcurrentlanguage[\defaultlanguagetag]
603
604\prependtoks
605    \ctxlua{statistics.starttiming(statistics)}%
606\to \everyjob
607
608\appendtoks
609    \ctxlua{statistics.stoptiming(statistics)}%
610\to \everyjob
611
612% \appendtoks
613%     \ctxlua{job.prepare()}%
614% \to \everyjob
615
616% \appendtoks
617%     \enabletrackers[*]%
618% \to \everyjob
619
620\appendtoks
621    \ctxlua{statistics.savefmtstatus("\jobname","\contextversion","context.mkiv","\contextbanner")}% can become automatic
622\to \everydump
623
624\errorstopmode \dump \endinput
625