1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt File Macros Job Handling}
15
16\unprotect
17
18
19
20
21\ifdefined\textlevel \else \newinteger\textlevel \fi
22
23\registerctxluafile{datahsh}{autosuffix}
24\registerctxluafile{filejob}{autosuffix}
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47\aliased\let\doifinputfileelse\doifelseinputfile
48
49
50
51\mutable\lettonothing\locatedfilepath
52
53\permanent\protected\def\locatefilepath#name
54 {\edef\locatedfilepath{\clf_locatefilepath{#name}}}
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70\protected\def\syst_files_load
71 {\syst_files_load_indeed\f!newfilename
72 \syst_files_load_indeed\f!locfilename
73 \syst_files_load_indeed\f!expfilename
74 \syst_files_load_indeed\f!sysfilename
75
76 }
77
78\def\syst_files_load_indeed#name
79 {\readsysfile{#name}{\showmessage\m!system2{#name}}\donothing}
80
81
82
83\ifdefined\strc_pagenumbers_flush_final_page \else \let\strc_pagenumbers_flush_final_page\relax \fi
84
85\permanent\protected\def\dostarttext
86 {\enforced\glet\dostarttext\relax
87 \expand\everystarttext
88 \global\everystarttext\emptytoks}
89
90\permanent\protected\def\dostoptext
91 {\enforced\glet\dostoptext\relax
92 \strc_pagenumbers_flush_final_page
93 \page
94 \expand\everystoptext
95 \global\everystoptext\emptytoks
96 \expand\everybye
97 \global\everybye\emptytoks
98 \expand\everygoodbye
99 \global\everygoodbye\emptytoks
100 \ifempty\everynotabene\else
101 \writeline
102 \expand\everynotabene
103 \writeline
104 \fi
105
106 \normalend}
107
108
109
110
111
112
113
114\pushoverloadmode
115 \aliased\let\end\forceendjob
116\popoverloadmode
117
118\aliased\let\finishjob\stoptext
119
120\newtoks\everystartnotext
121\newtoks\everystopnotext
122
123\permanent\protected\def\startnotext{\expand\everystartnotext}
124\permanent\protected\def\stopnotext {\expand\everystopnotext\normalend}
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\neverypar\emptytoks
181
182
183
184
185
186\newsystemmode\v!project
187\newsystemmode\v!product
188\newsystemmode\v!component
189\newsystemmode\v!environment
190
191\permanent\protected\defcsname\e!start:\v!project:\v!global\endcsname
192 {
193 \pushsystemmode\v!project
194 \setsystemmode\v!project}
195
196\permanent\protected\defcsname\e!stop:\v!project:\v!global\endcsname
197 {\popsystemmode\v!project
198
199 \endinput}
200
201\permanent\protected\defcsname\e!start:\v!product:\v!global\endcsname
202 {\starttext
203 \pushsystemmode\v!product
204 \setsystemmode\v!product}
205
206\permanent\protected\defcsname\e!stop:\v!product:\v!global\endcsname
207 {\popsystemmode\v!product
208 \stoptext
209 \endinput}
210
211\permanent\protected\defcsname\e!start:\v!component:\v!global\endcsname
212 {\starttext
213 \pushreferenceprefix\currentcomponent
214 \pushsystemmode\v!component
215 \setsystemmode\v!component}
216
217\permanent\protected\defcsname\e!stop:\v!component:\v!global\endcsname
218 {\popsystemmode\v!component
219 \popreferenceprefix
220 \stoptext
221 \endinput}
222
223\permanent\protected\defcsname\e!start:\v!component:\v!local\endcsname
224 {\starttext
225 \pushreferenceprefix\currentcomponent
226 \pushsystemmode\v!component
227 \setsystemmode\v!component}
228
229\permanent\protected\defcsname\e!stop:\v!component:\v!local\endcsname
230 {\popsystemmode\v!component
231 \popreferenceprefix
232 \stoptext}
233
234\permanent\protected\defcsname\e!start:\v!environment:\v!global\endcsname
235 {\pushsystemmode\v!environment
236 \setsystemmode\v!environment}
237
238\permanent\protected\defcsname\e!stop:\v!environment:\v!global\endcsname
239 {\popsystemmode\v!environment
240 \endinput}
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\installcorenamespace {document}
270
271\installcommandhandler \??document \s!document \??document
272
273\setupdocument
274 [\c!before=\directsetup{\s!document:\v!start},
275 \c!after =\directsetup{\s!document:\v!stop}]
276
277
278
279
280
281
282
283
284
285
286
287
288
289\def\syst_document_setup#1
290 {\directsetup{\doifelsesetups{\currentdocument:\v!start}\currentdocument\s!document:\v!start}}
291
292\appendtoks
293 \normalexpanded {
294 \startsetups[\currentdocument:\v!start]\noexpand\directsetup{\ifempty\currentdocumentparent\s!document\else\currentdocumentparent\fi:\v!start}\stopsetups
295 \startsetups[\currentdocument:\v!stop ]\noexpand\directsetup{\ifempty\currentdocumentparent\s!document\else\currentdocumentparent\fi:\v!stop }\stopsetups
296 \permanent\defcsname\e!start\currentdocument\endcsname{\startdocument[\currentdocument]}
297 \permanent\defcsname\e!stop \currentdocument\endcsname{\stopdocument}
298 }
299\to \everydefinedocument
300
301
302
303\permanent\tolerant\protected\def\startdocument[#S#namespace]#spacer[#S#settings]
304 {\pushmacro\currentdocument
305 \ifparameters
306 \or
307 \ifhastok={#namespace}
308 \lettonothing\currentdocument
309 \setupcurrentdocument[#namespace]
310 \else
311 \cdef\currentdocument{#namespace}
312 \fi
313 \or
314 \cdef\currentdocument{#namespace}
315 \setupcurrentdocument[#settings]
316 \fi
317 \ifempty\currentdocument\else\setmode\currentdocument\fi
318 \starttext
319 \expand\everystartdocument
320 \documentvariable\c!before}
321
322\permanent\protected\def\stopdocument
323 {\documentvariable\c!after
324 \expand\everystopdocument
325 \stoptext
326 \ifempty\currentdocument\else\resetmode\currentdocument\fi
327 \popmacro\currentdocument}
328
329\aliased \let\documentvariable \documentparameter
330\permanent\protected\def\unexpandeddocumentvariable{\documentparameter}
331
332\permanent\protected\def\doifelsedocumentvariable#name{\doifelsesomething{\documentvariable{#name}}}
333\permanent\protected\def\doifdocumentvariable #name{\doifsomething {\documentvariable{#name}}}
334\permanent\protected\def\doifnotdocumentvariable #name{\doifnot {\documentvariable{#name}}}
335
336\aliased\let\doifdocumentvariableelse\doifelsedocumentvariable
337
338\permanent\tolerant\protected\def\presetdocument[#S#namespace]#spacer[#S#settings]
339 {\pushmacro\currentdocument
340 \ifparameters
341 \or
342 \ifhastok={#namespace}
343 \lettonothing\currentdocument
344 \setupcurrentdocument[#namespace]
345 \fi
346 \or
347 \cdef\currentdocument{#namespace}
348 \setupcurrentdocument[#settings]
349 \fi
350 \popmacro\currentdocument}
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371\protect \endinput
372 |