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}{}
19
20\unprotect
21
22
23
24\unexpanded\def\newcontextversion#1
25 {\doifelse{#1}\contextversion
26 {\let\newcontextversion\gobbleoneargument}
27 {\writeline
28 \writestatus{Fatal Error}{Your format does not match the base files!}
29 \writeline
30 \writestatus{Format Version}{\contextversion\space\contextmark}
31 \writestatus{Files Version}{#1}
32 \batchmode
33 \normalend}}
34
35
36
37
38\let\operatingsystem\clf_operatingsystem
39
40
41
42
43\let\jobfilefullname\clf_jobfilefullname
44\let\jobfilename \clf_jobfilename
45\let\jobfilesuffix \clf_jobfilesuffix
46
47
48
49\let\inputfilebarename \clf_inputfilebarename
50\let\inputfilerealsuffix\clf_inputfilerealsuffix
51\let\inputfilesuffix \clf_inputfilesuffix
52\let\inputfilename \clf_inputfilename
53
54
55
56\let\outputfilename\clf_outputfilename
57
58\installcorenamespace{system}
59
60\installdirectcommandhandler \??system {system}
61
62\appendtoks
63
64
65\to \everysetupsystem
66
67\appendtoks
68 \ifcase\directsystemparameter\c!n\relax
69
70 \or
71 \setsystemmode\v!first
72 \or
73
74 \or
75 \setsystemmode\v!first
76 \or
77 \setsystemmode\v!last
78 \fi
79\to \everysetupsystem
80
81\newconditional\prerollrun
82
83
84
85
86
87
88\def\jobfullname{\jobfilename.\jobfilesuffix}
89
90\unexpanded\def\setjobfullname#1
91 {\doifelsenothing\jobfilename
92 {\let\jobfullname\empty}
93 {\doif\jobfilesuffix\c!tex{\edef\jobfullname{\jobfilename.#1}}}}
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108\appendtoks
109 \edef\outputresolution{\directsystemparameter\c!resolution}
110\to \everysetupsystem
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125\unexpanded\def\setuprandomize[#1]
126 {\doifsomething{#1}
127 {\begingroup
128
129 \scratchcounter\normaltime
130 \processaction
131 [#1]
132 [ \v!small=>\divide\scratchcounter 15,
133 \v!medium=>\divide\scratchcounter 30,
134 \v!big=>\divide\scratchcounter 60,
135 \v!normal=>\scratchcounter\newrandomseed,
136 \s!default=>\scratchcounter\newrandomseed,
137 \s!unknown=>\scratchcounter#1]
138 \setrandomseed\scratchcounter
139
140 \endgroup}}
141
142\setupsystem
143 [\c!directory=,
144 \c!n=0,
145 \c!resolution=600,
146
147
148
149 \c!type=unix,
150 \c!bodyfont=\normalizedlocalbodyfontsize]
151
152
153
154
155
156
157
158\unexpanded\def\start
159 {\dosingleempty\syst_start}
160
161\def\syst_start
162 {\bgroup
163 \iffirstargument
164 \expandafter\syst_start_yes
165 \else
166 \expandafter\syst_start_nop
167 \fi}
168
169\def\syst_start_yes[#1]
170 {\edef\m_syst_start_stop{#1}
171 \ifx\m_syst_start_stop\empty
172 \let\syst_stop_indeed\donothing
173 \else\ifcsname\e!start\m_syst_start_stop\endcsname
174 \expandafter\let\expandafter\syst_stop_indeed\csname\e!stop\m_syst_start_stop\endcsname
175 \csname\e!start\m_syst_start_stop\expandafter\expandafter\expandafter\endcsname
176 \else
177 \let\syst_stop_indeed\donothing
178 \fi\fi}
179
180\def\syst_start_nop[#1]
181 {\let\syst_stop_indeed\donothing}
182
183\unexpanded\def\stop
184 {\syst_stop_indeed
185 \egroup}
186
187
188
189\installcorenamespace{startstop}
190
191\installcommandhandler \??startstop {startstop} \??startstop
192
193\appendtoks
194 \setuevalue{\e!start\currentstartstop}{\syst_startstop_start {\currentstartstop}}
195 \setuevalue{\e!stop \currentstartstop}{\syst_startstop_stop {\currentstartstop}}
196 \setuevalue {\currentstartstop}{\syst_startstop_indeed{\currentstartstop}}
197\to \everydefinestartstop
198
199\ifdefined\dotagconstruct \else \let\dotagconstruct\relax \fi
200
201\unexpanded\def\syst_startstop_start#1
202 {\namedstartstopparameter{#1}\c!before\relax
203 \bgroup
204 \def\currentstartstop{#1}
205
206 \startstopparameter\c!commands\relax
207
208 \usesetupsparameter\startstopparameter\relax
209 \dostarttagged\t!construct\currentstartstop
210 \usestartstopstyleandcolor\c!style\c!color
211 \dotagconstruct}
212
213\unexpanded\def\syst_startstop_stop#1
214 {\dostoptagged
215 \egroup
216 \namedstartstopparameter{#1}\c!after\relax}
217
218\unexpanded\def\syst_startstop_indeed#1
219 {\groupedcommand
220 {\def\currentstartstop{#1}
221 \startstopparameter\c!commands\relax
222 \dostarttagged\t!construct\currentstartstop
223 \usestartstopstyleandcolor\c!style\c!color
224 \startstopparameter\c!left\relax}
225 {\def\currentstartstop{#1}
226 \startstopparameter\c!right\relax
227 \dostoptagged
228 \startstopparameter\c!inbetween\relax}}
229
230
231
232
233
234
235
236
237
238\installcorenamespace{highlight}
239
240\installcommandhandler \??highlight {highlight} \??highlight
241
242\setuphighlight
243 [\c!command=\v!yes]
244
245\appendtoks
246 \edef\p_command{\highlightparameter\c!command}
247 \ifx\p_command\v!yes
248 \setuevalue\currenthighlight{\typo_highlights_indeed{\currenthighlight}}
249 \fi
250\to \everydefinehighlight
251
252\ifdefined\dotaghighlight \else \let\dotaghighlight\relax \fi
253
254\unexpanded\def\typo_highlights_indeed#1
255 {\dontleavehmode\groupedcommand
256 {\def\currenthighlight{#1}
257 \dostarttagged\t!highlight\currenthighlight
258 \usehighlightstyleandcolor\c!style\c!color
259 \dotaghighlight}
260 {\dostoptagged}}
261
262\unexpanded\def\highlight[#1]
263 {\typo_highlights_indeed{#1}}
264
265\unexpanded\def\starthighlight[#1]
266 {\begingroup
267 \def\currenthighlight{#1}
268 \dostarttagged\t!highlight\currenthighlight
269 \usehighlightstyleandcolor\c!style\c!color
270 \dotaghighlight}
271
272\unexpanded\def\stophighlight
273 {\dostoptagged
274 \endgroup}
275
276\let\directhighlight\typo_highlights_indeed
277
278\unexpanded\def\defineexpandable
279 {\doifelsenextoptional
280 {\syst_basics_define_yes\def}
281 {\syst_basics_define_nop\def}}
282
283\unexpanded\def\define
284 {\doifelsenextoptional
285 {\syst_basics_define_yes{\unexpanded\def}}
286 {\syst_basics_define_nop{\unexpanded\def}}}
287
288\unexpanded\def\syst_basics_define_yes#1[#2]#3#4
289 {\ifdefined#3
290 \showmessage\m!system4{\string#3}
291 \fi
292 \ifcase0#2\relax
293 #1#3{#4}\or
294 #1#3##1{#4}\or
295 #1#3##1##2{#4}\or
296 #1#3##1##2##3{#4}\or
297 #1#3##1##2##3##4{#4}\or
298 #1#3##1##2##3##4##5{#4}\or
299 #1#3##1##2##3##4##5##6{#4}\or
300 #1#3##1##2##3##4##5##6##7{#4}\or
301 #1#3##1##2##3##4##5##6##7##8{#4}\or
302 #1#3##1##2##3##4##5##6##7##8##9{#4}\else
303 #1#3{#4}\fi}
304
305\unexpanded\def\syst_basics_define_nop#1#2#3
306 {\ifdefined#2
307 \showmessage\m!system4{\string#2}
308 \fi
309 #1#2{#3}}
310
311
312
313
314
315
316\unexpanded\def\unique#1#2
317 {\ifdefined#2
318 \showmessage\m!system4{\string#2}
319 \expandafter#1\expandafter\gobbleddefinition
320 \else
321 \expandafter#1
322 \fi#2}
323
324\unexpanded\def\checked#1#2
325 {\ifdefined#2
326 \showmessage\m!system4{\string#2}
327 \fi
328 #1#2}
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\unexpanded\def\macroname#1
412
413 {\begincsname#1\endcsname}
414
415
416
417
418
419
420
421
422
423
424\unexpanded\def\syst_log_indeed#1#2#3
425 {\ctxcommand{systemlog("#1","#2",\!!bs#3\!!es)}}
426
427\let\systemlog\syst_log_indeed
428
429\unexpanded\def\systemlogfirst
430 {\ifcase\directsystemparameter\c!n\relax
431 \expandafter\syst_log_indeed
432 \or
433 \expandafter\syst_log_indeed
434 \else
435 \expandafter\gobblethreearguments
436 \fi}
437
438\unexpanded\def\systemloglast
439 {\ifcase\directsystemparameter\c!n\relax
440 \expandafter\syst_log_indeed
441 \or
442 \expandafter\gobblethreearguments
443 \or
444 \expandafter\gobblethreearguments
445 \or
446 \expandafter\gobblethreearguments
447 \or
448 \expandafter\syst_log_indeed
449 \fi}
450
451\protect \endinput
452 |