1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16\writestatus
{
loading
}{
ConTeXt
File
Macros
Job
Handling
}
17
18\unprotect
19
20\registerctxluafile
{
file
job
}{}
21
22
23
24\unexpanded
\def
\doifelseinputfile
#
name
25 {
\clf_doifelseinputfile
{
#
name
}}
26
27\let
\doifinputfileelse\doifelseinputfile
28
29\unexpanded
\def
\processfile
#
name
30 {
\clf_processfile
{
#
name
}}
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45\unexpanded
\def
\usepath
[#
path
]
46 {
\clf_usepath
{
#
path
}}
47
48\unexpanded
\def
\usesubpath
[#
path
]
49 {
\clf_usesubpath
{
#
path
}}
50
51\unexpanded
\def
\pushpath
[#
path
]
52 {
\clf_pushpath
{
#
path
}}
53
54\unexpanded
\def
\poppath
55 {
\clf_poppath
}
56
57\unexpanded
\def
\resetpath
58 {
\clf_resetpath
}
59
60\def
\allinputpaths
61 {
\clf_allinputpaths
}
62
63
64
65\let
\locatedfilepath
\empty
66
67\unexpanded
\def
\locatefilepath
#
name
68 {
\edef
\locatedfilepath
{
\clf_locatefilepath
{
#
name
}}}
69
70
71
72
73
74
75
76
77
78
79
80\unexpanded
\def
\usezipfile
81 {
\dodoubleempty
\syst_files_use_zip_file
}
82
83\def
\syst_files_use_zip_file
[#
zipname
][#
subtree
]
84 {
\clf_usezipfile
{
#
zipname
}{
#
subtree
}}
85
86
87
88\unexpanded
\def
\loadexamodes
89 {
\dosingleempty
\syst_files_load_exa_modes
}
90
91\def
\syst_files_load_exa_modes
[#
name
]
92 {
\clf_loadexamodes
{
#
name
}}
93
94
95
96
97
98
99\unexpanded
\def
\syst_files_load
100 {
\syst_files_load_indeed
\f!newfilename
101 \syst_files_load_indeed
\f!locfilename
102 \syst_files_load_indeed
\f!expfilename
103 \syst_files_load_indeed
\f!sysfilename
104
105 }
106
107\def
\syst_files_load_indeed
#
name
108 {
\readsysfile
{
#
name
}{
\showmessage
\m!system
2
{
#
name
}}
\donothing
}
109
110
111
112\ifdefined
\textlevel
\else
\newcount
\textlevel
\fi
113\ifdefined
\strc_pagenumbers_flush_final_page
\else
\let
\strc_pagenumbers_flush_final_page
\relax
\fi
114
115\unexpanded
\def
\dostarttext
116 {
\glet
\dostarttext
\relax
117 \the
\everystarttext
118 \global
\everystarttext\emptytoks
}
119
120\unexpanded
\def
\dostoptext
121 {
\glet
\dostoptext
\relax
122 \strc_pagenumbers_flush_final_page
123 \page
124 \the
\everystoptext
125 \global
\everystoptext\emptytoks
126 \the
\everybye
127 \global
\everybye
\emptytoks
128 \the
\everygoodbye
129 \global
\everygoodbye
\emptytoks
130 \doifelsesometoks
\everynotabene
{
\writeline
\the
\everynotabene
\writeline
}
\donothing
131 \normalend
}
132
133\unexpanded
\def
\starttext
{
\clf_starttext
}
134\unexpanded
\def
\stoptext
{
\clf_stoptext
}
135\unexpanded
\def
\forcequitjob
{
\clf_forcequitjob
}
136\unexpanded
\def\end
{
\clf_forceendjob
}
137\unexpanded
\def
\autostarttext
{
\clf_autostarttext
}
138\unexpanded
\def
\autostoptext
{
\clf_autostoptext
}
139
140\unexpanded
\def
\finishjob
{
\stoptext
}
141
142\newtoks
\everystartnotext
143\newtoks
\everystopnotext
144
145\unexpanded
\def
\startnotext
{
\the
\everystartnotext
}
146\unexpanded
\def
\stopnotext
{
\the
\everystopnotext
\normalend
}
147
148
149
150\unexpanded
\def
\processfilemany
#
name
{
\clf_processfilemany
{
#
name
}}
151\unexpanded
\def
\processfileonce
#
name
{
\clf_processfileonce
{
#
name
}}
152\unexpanded
\def
\processfilenone
#
name
{
\clf_processfilenone
{
#
name
}}
153
154\unexpanded
\def
\project
{
\doifelsenextoptionalcs
\useproject
\syst_structure_arg_project
}
155\unexpanded
\def
\product
{
\doifelsenextoptionalcs
\useproduct
\syst_structure_arg_product
}
156\unexpanded
\def
\component
{
\doifelsenextoptionalcs
\usecomponent
\syst_structure_arg_component
}
157\unexpanded
\def
\environment
{
\doifelsenextoptionalcs
\useenvironment
\syst_structure_arg_environment
}
158
159\def
\syst_structure_arg_project
#
name
{
\clf_useproject
{
#
name
}}
160\def
\syst_structure_arg_product
#
name
{
\clf_useproduct
{
#
name
}}
161\def
\syst_structure_arg_component
#
name
{
\clf_usecomponent
{
#
name
}}
162\def
\syst_structure_arg_environment
#
name
{
\clf_useenvironment
{
#
name
}}
163
164\unexpanded
\def
\startproject
{
\doifelsenextoptionalcs
\syst_structure_start_opt_project
\syst_structure_start_arg_project
}
165\unexpanded
\def
\startproduct
{
\doifelsenextoptionalcs
\syst_structure_start_opt_product
\syst_structure_start_arg_product
}
166\unexpanded
\def
\startcomponent
{
\doifelsenextoptionalcs
\syst_structure_start_opt_component
\syst_structure_start_arg_component
}
167\unexpanded
\def
\startenvironment
{
\doifelsenextoptionalcs
\syst_structure_start_opt_environment
\syst_structure_start_arg_environment
}
168
169\def
\syst_structure_start_arg_project
#
name
{
\clf_startproject
{
#
name
}}
170\def
\syst_structure_start_arg_product
#
name
{
\clf_startproduct
{
#
name
}}
171\def
\syst_structure_start_arg_component
#
name
{
\clf_startcomponent
{
#
name
}}
172\def
\syst_structure_start_arg_environment
#
name
{
\clf_startenvironment
{
#
name
}}
173
174\unexpanded
\def
\useproject
[#
name
]
{
\clf_useproject
{
#
name
}}
175\unexpanded
\def
\useproduct
[#
name
]
{
\clf_useproduct
{
#
name
}}
176\unexpanded
\def
\usecomponent
[#
name
]
{
\clf_usecomponent
{
#
name
}}
177\unexpanded
\def
\useenvironment
[#
name
]
{
\clf_useenvironment
{
#
name
}}
178
179\unexpanded
\def
\syst_structure_start_opt_project
[#
name
]
{
\clf_startproject
{
#
name
}}
180\unexpanded
\def
\syst_structure_start_opt_product
[#
name
]
{
\clf_startproduct
{
#
name
}}
181\unexpanded
\def
\syst_structure_start_opt_component
[#
name
]
{
\clf_startcomponent
{
#
name
}}
182\unexpanded
\def
\syst_structure_start_opt_environment
[#
name
]
{
\clf_startenvironment
{
#
name
}}
183
184\newconditional
\endofinput
185
186\unexpanded
\def
\signalendofinput
#
1
187 {
\global
\settrue
\endofinput
}
188
189\unexpanded
\def
\honorendofinput
190 {
\ifconditional
\endofinput
191 \global
\setfalse
\endofinput
192 \endinput
193 \fi
}
194
195\unexpanded
\def
\stopproject
{
\clf_stopproject
\honorendofinput
}
196\unexpanded
\def
\stopproduct
{
\clf_stopproduct
\honorendofinput
}
197\unexpanded
\def
\stopcomponent
{
\clf_stopcomponent
\honorendofinput
}
198\unexpanded
\def
\stopenvironment
{
\clf_stopenvironment
\honorendofinput
}
199
200 \let
\currentproject
\clf_currentproject
201 \let
\currentproduct
\clf_currentproduct
202 \let
\currentcomponent
\clf_currentcomponent
203 \let
\currentenvironment
\clf_currentenvironment
204 \let
\processedfile
\clf_processedfile
205 \let
\processedfiles
\clf_processedfiles
206
207\unexpanded
\def
\dostarttextfile
#
name
{
\clf_dostarttextfile
{
name
}}
208\unexpanded
\def
\dostoptextfile
{
\clf_dostoptextfile
}
209
210\unexpanded
\def
\loadtexfile
[#
name
]
{
\clf_usetexfile
{
#
name
}}
211\unexpanded
\def
\loadluafile
[#
name
]
{
\clf_useluafile
{
#
name
}}
212\unexpanded
\def
\loadcldfile
[#
name
]
{
\clf_usecldfile
{
#
name
}}
213\unexpanded
\def
\loadanyfile
[#
name
]
{
\clf_useanyfile
{
#
name
}}
214
215\unexpanded
\def
\loadtexfileonce
[#
name
]
{
\clf_usetexfileonce
{
#
name
}}
216\unexpanded
\def
\loadluafileonce
[#
name
]
{
\clf_useluafileonce
{
#
name
}}
217\unexpanded
\def
\loadcldfileonce
[#
name
]
{
\clf_usecldfileonce
{
#
name
}}
218\unexpanded
\def
\loadanyfileonce
[#
name
]
{
\clf_useanyfileonce
{
#
name
}}
219
220
221
222\unexpanded
\def
\continueifinputfile
#
name
223 {
\clf_doifelsecontinuewithfile
{
#
name
}
\relax\endinput
}
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\neverypar
\emptytoks
250
251
252
253\newsystemmode
\v!project
254\newsystemmode
\v!product
255\newsystemmode
\v!component
256\newsystemmode
\v!environment
257
258\unexpanded
\def
\startprojectindeed
259 {
260 \pushsystemmode
\v!project
261 \setsystemmode
\v!project
}
262
263\unexpanded
\def
\stopprojectindeed
264 {
\popsystemmode
\v!project
265
266 \signalendofinput
\v!project
}
267
268\unexpanded
\def
\startproductindeed
269 {
\starttext
270 \pushsystemmode
\v!product
271 \setsystemmode
\v!product
}
272
273\unexpanded
\def
\stopproductindeed
274 {
\popsystemmode
\v!product
275 \stoptext
276 \signalendofinput
\v!product
}
277
278\unexpanded
\def
\startcomponentindeed
279 {
\starttext
280 \pushreferenceprefix
\currentcomponent
281 \pushsystemmode
\v!component
282 \setsystemmode
\v!component
}
283
284\unexpanded
\def
\stopcomponentindeed
285 {
\popsystemmode
\v!component
286 \popreferenceprefix
287 \stoptext
288 \signalendofinput
\v!component
}
289
290\unexpanded
\def
\startenvironmentindeed
291 {
\pushsystemmode
\v!environment
292 \setsystemmode
\v!environment
}
293
294\unexpanded
\def
\stopenvironmentindeed
295 {
\popsystemmode
\v!environment
296 \signalendofinput
\v!environment
}
297
298
299
300
301
302\unexpanded
\def
\startdocument
303 {
\dosingleargument
\syst_structure_document_start
}
304
305\unexpanded
\def
\syst_structure_document_start
[#
settings
]
306 {
\setvariables
[
\s!document
][#
settings
]
307 \the
\everysetupdocument
\relax
308 \starttext
309 \documentvariable
\c!before
}
310
311\unexpanded
\def
\stopdocument
312 {
\documentvariable
\c!after
313 \stoptext
}
314
315\unexpanded
\def
\doifelsedocumentvariable
#
name
{
\doifelsesomething
{
\documentvariable
{
#
name
}}}
316\unexpanded
\def
\doifdocumentvariable
#
name
{
\doifsomething
{
\documentvariable
{
#
name
}}}
317\unexpanded
\def
\doifnotdocumentvariable
#
name
{
\doifnot
{
\documentvariable
{
#
name
}}}
318
319\let
\doifdocumentvariableelse\doifelsedocumentvariable
320
321\def
\documentvariable
#
name
322 {
\getvariable
\s!document
{
#
name
}}
323
324\unexpanded
\def
\unexpandeddocumentvariable
#
name
325 {
\getvariable
\s!document
{
#
name
}}
326
327\unexpanded
\def
\setupdocument
[#
settings
]
328 {
\setvariables
[
\s!document
][#
settings
]
329 \the
\everysetupdocument
\relax
}
330
331\unexpanded
\def
\presetdocument
[#
settings
]
332 {
\checkvariables
[
\s!document
][#
settings
]
}
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347\setvariables
348 [
document
]
349 [
\c!before
=
\directsetup
{
\s!document
:
start
}
,
350 \c!after
=
\directsetup
{
\s!document
:
stop
}
]
351
352
353
354
355
356
357
358
359
360
361
362
363
364\unexpanded
\def
\samplefile
#
1
365 {
\clf_samplefile
{
#
1
}}
366
367\protect
\endinput
368