summaryrefslogtreecommitdiff
path: root/tex/context/base/core-uti.mkiv
blob: 6b2dae2c9c93fa3f4dab5e88f8d2846f87381951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
62
63
64
65
66
%D \module
%D   [       file=core-uti,
%D        version=1997.03.31, % 2006.09.19 mkiv
%D          title=\CONTEXT\ Core Macros,
%D       subtitle=Utility File Handling,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Core Macros / Utility File Handling}

\unprotect

\registerctxluafile{core-uti}{1.001}

\def\savecurrentvalue#1#2%
  {\ctxlua{jobvariables.save("\strippedcsname#1","#2")}}

\appendtoks
    \ctxlua{storage.dump()}% will move to lua
\to \everydump

\appendtoks
    \ctxlua{storage.finalize()}% will move to lua
\to \everyfinalizeluacode

\appendtoks
    \ctxlua{nodes.cleanup_reserved()}% will move to lua
\to \everydump

\appendtoks
    \ctxlua {
        job.comment("file: \jobname")
        job.comment("format: \contextformat")
        job.comment("stamp: \contextversion")
        job.comment("escape: \!!bs\space...\space\!!es")
        job.initialize("\jobname.tuc","\jobname.tua")
    }%
\to \everystarttext

\def\notuccompression{\ctxlua{job.pack=false}}

% cleaner, for the moment

% \appendtoks
%     \ctxlua {
%         os.remove("\jobname.tui")
%         os.remove("\jobname.tuo")
%     }%
% \to \everystarttext

%D Some styles might use these use these commands:

\newif \ifutilitydone
\let   \checkutilities         \relax
\let   \currentutilityfilename \jobname
\def   \installprogram         {\dosingleempty\doinstallprogram}
\def   \doinstallprogram   [#1]{\gobbleoneargument}
\def   \installedprogram   [#1]{}
\let   \installplugin          \gobblethreearguments

\protect \endinput