1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16\writestatus{loading}{ConTeXt Core Macros System}
17
18\registerctxluafile{coresys}{autosuffix}
19
20\unprotect
21
22
23
24\permanent\protected\def\newcontextversion#1
25 {\ifcstok{#1}\contextversion
26 \aliased\let\newcontextversion\gobbleoneargument
27 \else
28 \writeline
29 \writestatus{Fatal Error}{Your format does not match the base files!}
30 \writeline
31 \writestatus{Format Version}{\contextversion\space\contextmark}
32 \writestatus{Files Version}{#1}
33 \batchmode
34 \normalend
35 \fi}
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\installcorenamespace{system}
62
63\installdirectcommandhandler \??system {system}
64
65\appendtoks
66
67
68\to \everysetupsystem
69
70\appendtoks
71 \ifcase\directsystemparameter\c!n\relax
72
73 \or
74 \setsystemmode\v!first
75 \or
76
77 \or
78 \setsystemmode\v!first
79 \or
80 \setsystemmode\v!last
81 \fi
82\to \everysetupsystem
83
84\newconditional\prerollrun
85
86
87
88
89
90
91\permanent\def\jobfullname{\jobfilename.\jobfilesuffix}
92
93\permanent\protected\def\setjobfullname#1
94 {\ifempty\jobfilename
95 \lettonothing\jobfullname
96 \orelse\ifcstok\jobfilesuffix\c!tex
97 \edef\jobfullname{\jobfilename.#1}
98 \fi}
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\permanent\protected\def\setuprandomize[#1]
130 {\ifempty{#1}\else
131 \begingroup
132
133 \scratchcounter\normaltime
134 \processaction
135 [#1]
136 [ \v!small=>\divideby\scratchcounter 15,
137 \v!medium=>\divideby\scratchcounter 30,
138 \v!big=>\divideby\scratchcounter 60,
139 \v!normal=>\scratchcounter\newrandomseed,
140 \s!default=>\scratchcounter\newrandomseed,
141 \s!unknown=>\scratchcounter#1]
142 \setrandomseed\scratchcounter
143
144 \endgroup
145 \fi}
146
147\setupsystem
148 [\c!directory=,
149 \c!n=0,
150
151
152
153
154 \c!type=unix,
155 \c!bodyfont=\normalizedlocalbodyfontsize]
156
157
158
159
160
161
162\permanent\tolerant\protected\def\start[#1]
163 {\bgroup
164 \ifparameters
165 \expandafter\syst_start_nop
166 \else
167 \edef\m_syst_start_stop{#1}
168 \expandafter\syst_start_yes
169 \fi}
170
171\let\syst_stop_indeed\donothing
172
173\def\syst_start_yes
174 {\ifempty\m_syst_start_stop
175 \let\syst_stop_indeed\donothing
176 \orelse\ifcsname\e!start\m_syst_start_stop\endcsname
177 \expandafter\let\expandafter\syst_stop_indeed\csname\e!stop\m_syst_start_stop\endcsname
178 \csname\e!start\m_syst_start_stop\expandafter\expandafter\expandafter\endcsname
179 \else
180 \let\syst_stop_indeed\donothing
181 \fi}
182
183\def\syst_start_nop
184 {\let\syst_stop_indeed\donothing}
185
186\permanent\protected\def\stop
187 {\syst_stop_indeed
188 \egroup}
189
190
191
192\installcorenamespace{startstop}
193
194\installcommandhandler \??startstop {startstop} \??startstop
195
196\appendtoks
197 \frozen\instance\protected\edefcsname \currentstartstop\endcsname{\syst_startstop_indeed{\currentstartstop}}
198 \frozen\instance\protected\edefcsname\e!start\currentstartstop\endcsname{\syst_startstop_start {\currentstartstop}}
199 \frozen\instance\protected\edefcsname\e!stop \currentstartstop\endcsname{\syst_startstop_stop {\currentstartstop}}
200\to \everydefinestartstop
201
202\ifdefined\dotagconstruct \else \aliased\let\dotagconstruct\relax \fi
203
204\protected\def\syst_startstop_start#1
205 {\namedstartstopparameter{#1}\c!before\relax
206 \bgroup
207 \cdef\currentstartstop{#1}
208
209 \startstopparameter\c!commands\relax
210
211 \usesetupsparameter\startstopparameter\relax
212 \dostarttagged\t!construct\currentstartstop
213 \usestartstopstyleandcolor\c!style\c!color
214 \dotagconstruct}
215
216\protected\def\syst_startstop_stop#1
217 {\dostoptagged
218 \egroup
219 \namedstartstopparameter{#1}\c!after\relax}
220
221\protected\def\syst_startstop_indeed#1
222 {\groupedcommand
223 {\cdef\currentstartstop{#1}
224 \startstopparameter\c!commands\relax
225 \dostarttagged\t!construct\currentstartstop
226 \usestartstopstyleandcolor\c!style\c!color
227 \startstopparameter\c!left\relax}
228 {\cdef\currentstartstop{#1}
229 \startstopparameter\c!right\relax
230 \dostoptagged
231 \startstopparameter\c!inbetween\relax}}
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254\installcorenamespace{highlight}
255
256\installcommandhandler \??highlight {highlight} \??highlight
257
258\setuphighlight
259 [\c!define=\v!yes]
260
261
262
263\appendtoks
264 \ifcstok{\highlightparameter\c!define}\v!yes
265 \frozen\instance\protected\edefcsname\currenthighlight\endcsname
266 {\typo_highlights_indeed{\currenthighlight}}
267 \fi
268\to \everydefinehighlight
269
270\ifdefined\dotaghighlight \else \aliased\let\dotaghighlight\relax \fi
271
272\permanent\protected\def\typo_highlights_indeed#1
273 {\dontleavehmode\groupedcommand
274 {\cdef\currenthighlight{#1}
275 \dostarttagged\t!highlight\currenthighlight
276 \usehighlightstyleandcolor\c!style\c!color
277
278
279 \dotaghighlight}
280 {\dostoptagged}}
281
282\permanent\protected\def\highlight[#1]
283 {\typo_highlights_indeed{#1}}
284
285\permanent\protected\def\starthighlight[#1]
286 {\begingroup
287 \cdef\currenthighlight{#1}
288 \dostarttagged\t!highlight\currenthighlight
289 \usehighlightstyleandcolor\c!style\c!color
290
291
292 \dotaghighlight}
293
294\permanent\protected\def\stophighlight
295 {\dostoptagged
296 \endgroup}
297
298\aliased\let\directhighlight\typo_highlights_indeed
299
300
301
302\permanent\protected\def\defineexpandable
303 {\integerdef\c_syst_parameter_catcode\catcode\hashasciicode
304 \catcode\hashasciicode\parametercatcode
305 \doifelsenextoptional
306 {\syst_basics_define_yes\def}
307 {\syst_basics_define_nop\def}}
308
309\permanent\protected\def\define
310 {\integerdef\c_syst_parameter_catcode\catcode\hashasciicode
311 \catcode\hashasciicode\parametercatcode
312 \doifelsenextoptional
313 {\syst_basics_define_yes{\protected\def}}
314 {\syst_basics_define_nop{\protected\def}}}
315
316\protected\def\syst_basics_define_yes#1[#2]#3#4
317 {\ifdefined#3
318 \showmessage\m!system4{\string#3}
319 \fi
320 \ifcase0#2\relax
321 #1#3{#4}\or
322 #1#3##1{#4}\or
323 #1#3##1##2{#4}\or
324 #1#3##1##2##3{#4}\or
325 #1#3##1##2##3##4{#4}\or
326 #1#3##1##2##3##4##5{#4}\or
327 #1#3##1##2##3##4##5##6{#4}\or
328 #1#3##1##2##3##4##5##6##7{#4}\or
329 #1#3##1##2##3##4##5##6##7##8{#4}\or
330 #1#3##1##2##3##4##5##6##7##8##9{#4}\else
331 #1#3##1##2##3##4##5##6##7##8##9##A{#4}\else
332 #1#3##1##2##3##4##5##6##7##8##9##A##B{#4}\else
333 #1#3##1##2##3##4##5##6##7##8##9##A##B##C{#4}\else
334 #1#3##1##2##3##4##5##6##7##8##9##A##B##C##D{#4}\else
335 #1#3##1##2##3##4##5##6##7##8##9##A##B##C##D##E{#4}\else
336 #1#3{#4}\fi
337 \catcode\hashasciicode\c_syst_parameter_catcode}
338
339\protected\def\syst_basics_define_nop#1#2#3
340 {\ifdefined#2
341 \showmessage\m!system4{\string#2}
342 \fi
343 #1#2{#3}
344 \catcode\hashasciicode\c_syst_parameter_catcode}
345
346\aliased\let\redefine\define
347
348
349
350
351
352
353\mutable\let\gobbleddefinition\relax
354
355\permanent\protected\def\unique#1#2
356 {\ifdefined#2
357 \showmessage\m!system4{\string#2}
358 \expandafter#1\expandafter\gobbleddefinition
359 \else
360 \expandafter#1
361 \fi#2}
362
363\permanent\protected\def\checked#1#2
364 {\ifdefined#2
365 \showmessage\m!system4{\string#2}
366 \fi
367 #1#2}
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\permanent\protected\def\macroname#1
451 {\begincsname#1\endcsname}
452
453
454
455\permanent\protected\def\systemlogfirst
456 {\ifcase\directsystemparameter\c!n\relax
457 \expandafter\systemlog
458 \or
459 \expandafter\systemlog
460 \else
461 \expandafter\gobblethreearguments
462 \fi}
463
464\permanent\protected\def\systemloglast
465 {\ifcase\directsystemparameter\c!n\relax
466 \expandafter\systemlog
467 \or
468 \expandafter\gobblethreearguments
469 \or
470 \expandafter\gobblethreearguments
471 \or
472 \expandafter\gobblethreearguments
473 \or
474 \expandafter\systemlog
475 \fi}
476
477\protect \endinput
478 |