rework aux file writing
This commit is contained in:
parent
bbfdb29cec
commit
64fbca35dd
1 changed files with 36 additions and 9 deletions
45
src/wip/cache/cache.pysty3
vendored
45
src/wip/cache/cache.pysty3
vendored
|
@ -17,7 +17,8 @@ __HEADER__(Cache definitions of previous LaTeX runs to avoid computations)
|
||||||
\int_new:N \g__cache_cache_version_aux_int
|
\int_new:N \g__cache_cache_version_aux_int
|
||||||
\int_gset:Nn \g__cache_cache_version_aux_int { -1 }
|
\int_gset:Nn \g__cache_cache_version_aux_int { -1 }
|
||||||
|
|
||||||
\tl_new:N \g__cache_dump_auxfile_tl
|
\clist_new:N \g__cache_dump_auxfile_clist %% usual dump
|
||||||
|
\clist_new:N \g__cache_dump_cache_clist %% will be dumped such that it is restored as \g__cache_lazy_auxfile_tl on next run.
|
||||||
\tl_new:N \g__cache_lazy_document_tl
|
\tl_new:N \g__cache_lazy_document_tl
|
||||||
\tl_new:N \g__cache_lazy_auxfile_tl
|
\tl_new:N \g__cache_lazy_auxfile_tl
|
||||||
|
|
||||||
|
@ -39,22 +40,48 @@ __HEADER__(Cache definitions of previous LaTeX runs to avoid computations)
|
||||||
\bool_if:NTF \g__cache_cache_bool
|
\bool_if:NTF \g__cache_cache_bool
|
||||||
{
|
{
|
||||||
%% Writing things (at one go) to aux file at end of document:
|
%% Writing things (at one go) to aux file at end of document:
|
||||||
\cs_new:Npn \__cache_put_aux:n #1
|
\cs_new:Npn \__cache_dump_auxfile:n
|
||||||
{
|
{
|
||||||
\tl_gput_right:Nn \g__cache_dump_auxfile_tl { #1 }
|
\clist_gput_right:Nn \g__cache_dump_auxfile_clist
|
||||||
}
|
}
|
||||||
\cs_generate_variant:Nn \__cache_put_aux:n { x, V }
|
\cs_generate_variant:Nn \__cache_dump_auxfile:n { x }
|
||||||
|
|
||||||
\cs_generate_variant:Nn \iow_now:Nn { c V }
|
\cs_new:Npn \__cache_dump_cache:n
|
||||||
|
{
|
||||||
|
\clist_gput_right:Nn \g__cache_dump_cache_clist
|
||||||
|
}
|
||||||
|
\cs_generate_variant:Nn \__cache_dump_cache:n { V }
|
||||||
|
|
||||||
|
|
||||||
|
\cs_new:Npn \__cache_write_auxout:n
|
||||||
|
{
|
||||||
|
\iow_now:cn { @auxout }
|
||||||
|
}
|
||||||
|
\cs_generate_variant:Nn \__cache_write_auxout:n { x }
|
||||||
|
|
||||||
%%% Handles dumping data to aux file at end of document
|
%%% Handles dumping data to aux file at end of document
|
||||||
\hook_gput_code:nnn { enddocument } { cache }
|
\hook_gput_code:nnn { enddocument } { cache }
|
||||||
{
|
{
|
||||||
\iow_now:cV { @auxout } \g__cache_dump_auxfile_tl
|
\clist_map_function:NN \g__cache_dump_auxfile_clist
|
||||||
|
\__cache_write_auxout:n
|
||||||
|
|
||||||
|
\__cache_write_auxout:n
|
||||||
|
{
|
||||||
|
\csname tl_gput_right:cn \endcsname
|
||||||
|
{
|
||||||
|
g__cache_lazy_auxfile_tl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\__cache_write_auxout:x { \str_use:N \c_left_brace_str }
|
||||||
|
|
||||||
|
\clist_map_function:NN \g__cache_dump_cache_clist
|
||||||
|
\__cache_write_auxout:n
|
||||||
|
|
||||||
|
\__cache_write_auxout:x { \str_use:N \c_right_brace_str }
|
||||||
}
|
}
|
||||||
|
|
||||||
%%% Writes the current cache version into aux file
|
%%% Writes the current cache version into aux file
|
||||||
\__cache_put_aux:x
|
\__cache_dump_auxfile:x
|
||||||
{
|
{
|
||||||
\ExplSyntaxOn
|
\ExplSyntaxOn
|
||||||
\int_gset:Nn \exp_not:N \g__cache_cache_version_aux_int
|
\int_gset:Nn \exp_not:N \g__cache_cache_version_aux_int
|
||||||
|
@ -77,10 +104,10 @@ __HEADER__(Cache definitions of previous LaTeX runs to avoid computations)
|
||||||
{
|
{
|
||||||
\tl_set:Nn \l_tmpa_tl
|
\tl_set:Nn \l_tmpa_tl
|
||||||
{
|
{
|
||||||
\csname tl_gput_right:cn \endcsname { g__cache_lazy_auxfile_tl } { #1 }
|
{ #1 }
|
||||||
}
|
}
|
||||||
\regex_replace_all:nnN { \cP\# } { \cO\# } \l_tmpa_tl
|
\regex_replace_all:nnN { \cP\# } { \cO\# } \l_tmpa_tl
|
||||||
\__cache_put_aux:V \l_tmpa_tl
|
\__cache_dump_cache:V \l_tmpa_tl
|
||||||
}
|
}
|
||||||
|
|
||||||
%%% This handles loading either the cached definitions
|
%%% This handles loading either the cached definitions
|
||||||
|
|
Loading…
Reference in a new issue