[latex3-commits] [git/LaTeX3-latex3-latex3] master: Order \file_get:nnN arguments correctly in l3auxdata, correct code comments (cc1fef4)
Bruno Le Floch
bruno at le-floch.fr
Wed Jan 16 21:20:43 CET 2019
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/cc1fef45cd1cce40977db2c00f9f8e6d71081f96
>---------------------------------------------------------------
commit cc1fef45cd1cce40977db2c00f9f8e6d71081f96
Author: Bruno Le Floch <bruno at le-floch.fr>
Date: Wed Jan 16 21:20:43 2019 +0100
Order \file_get:nnN arguments correctly in l3auxdata, correct code comments
>---------------------------------------------------------------
cc1fef45cd1cce40977db2c00f9f8e6d71081f96
l3trial/l3auxdata/l3auxdata.dtx | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/l3trial/l3auxdata/l3auxdata.dtx b/l3trial/l3auxdata/l3auxdata.dtx
index 575ebee..5d71274 100644
--- a/l3trial/l3auxdata/l3auxdata.dtx
+++ b/l3trial/l3auxdata/l3auxdata.dtx
@@ -6,7 +6,7 @@
%<*ins>
\iffalse meta-comment
-File l3auxdata.ins Copyright (C) 2014,2017,2018 The LaTeX3 Project
+File l3auxdata.ins Copyright (C) 2014,2017-2019 The LaTeX3 Project
It may be distributed and/or modified under the conditions of the
LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -675,7 +675,7 @@ Don't~ look~ here:~ check~ your~ console~ output!
% \end{macrocode}
%
% \begin{macrocode}
-\usepackage{catchfile,expl3}
+\usepackage{expl3}
% \end{macrocode}
%
% \paragraph{Variables and variants}
@@ -988,13 +988,10 @@ Don't~ look~ here:~ check~ your~ console~ output!
% \item `name' suffix for tl that stores the data. ("cache" at beginning; "final" at end.)
% \end{arguments}
%
-% Reading data from a file to a token list is superficially easy but comes with a few gotchas.
-% For small-ish files, it's often more convenient to use |\CatchFileDef| or |\tl_set_from_file:Nnn|, but it's important to realise that in doing so the entire file is scanned in one go by \TeX; this exhausts its memory after a certain file size (roughly 2MB at time of writing for the present author).
+% Reading data from a file to a token list is done using \cs{file_get:nnN} then copying the result to the desired global token list.
+% The biggest file size allowed by \TeX{} memory may perhaps be doubled by using an \texttt{x}-expanding version of \cs{file_get:nnN} and defining \cs{auxdata:nn} to expand to a non-expanding version of itself. Memory could probably also be saved bystoring a hash of the previous auxdata and comparing it with the final one, or by other means. In any case, until we encounter concrete use cases it is best not to optimize beyond reason.
%
-% Therefore, we use the `expanding' version instead, which at first seems strange; why would you want to expand all input when reading from a file? Because this way, \TeX\ simply moves its input scanner (probably not the right word) to the file to read and can handle much larger file sizes.
-% The trick is simply to have our wrapper macro |\auxdata:nn| defined to expand to non-expanded version of itself with its arguments. (A nice trick courtesy of \eTeX{}.)
-%
-% This method still has limitations, but it helps.
+% Probably \cs{@@_read_setup:} is not needed.
% \begin{macrocode}
\cs_set:Nn \@@_input_aux:nn
{
@@ -1005,11 +1002,11 @@ Don't~ look~ here:~ check~ your~ console~ output!
\prop_get:NVNF \g_@@_cc_prop \l_auxdata_this_ccname_tl \l_auxdata_cc_tl {\ERROR}
\file_get:nnN
+ { \l_auxdata_filename_tl }
{ \@@_read_setup: \l_auxdata_cc_tl }
- { g_auxdata_ #1 _ #2 _tl }
\l_@@_internal_tl
\tl_gset_eq:cN
- { \l_auxdata_filename_tl }
+ { g_auxdata_ #1 _ #2 _tl }
\l_@@_internal_tl
}
}
More information about the latex3-commits
mailing list