%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 ADE \& \CONTEXT\ Development Team}]
%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% immediate, so not \unexpanded
  {\ctxlua{job.variables.save("\strippedcsname#1","#2")}}

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

\appendtoks
    \ctxlua {
        job.initialize("\jobname.tuc","\jobname.tua")
    }%
\to \everyjob

\protect \endinput
