diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/expl3/l3precom.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/expl3/l3precom.dtx | 78 |
1 files changed, 33 insertions, 45 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/l3precom.dtx b/Master/texmf-dist/source/latex/expl3/l3precom.dtx index d5b39b0b12e..5ee345dc70c 100644 --- a/Master/texmf-dist/source/latex/expl3/l3precom.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3precom.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3precom.dtx 1453 2009-08-08 14:38:49Z joseph $ +\GetIdInfo$Id: l3precom.dtx 1793 2010-02-09 20:36:19Z joseph $ {L3 Experimental precompilation module} %\iffalse %<*driver> @@ -152,7 +152,7 @@ % Sequence in which the symbols to be dumped are stored. % \end{variable} % -% \begin{variable}{\c_cs_dump_stream} +% \begin{variable}{\g_cs_dump_stream} % Output stream used for writing out the definitions of the % recorded <tl var.>. % \end{variable} @@ -179,32 +179,20 @@ % % We start by ensuring that the required packages are loaded. % \begin{macrocode} -%<package>\ProvidesExplPackage -%<package> {\filename}{\filedate}{\fileversion}{\filedescription} -%<package>\RequirePackage{l3num} -%<package>\RequirePackage{l3io} -%<package>\RequirePackage{l3seq} -%<package>\RequirePackage{l3int} +%<*package> +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\package_check_loaded_expl: +%</package> % \end{macrocode} % -% \begin{macro}{\c_cs_dump_stream} -% We need to allocate an output stream in order to be able to write -% the precompiled code out. -% Stream number for the dump. -% -% \begin{macrocode} -%<*initex|package> -%<*precompile> -\iow_new:N\c_cs_dump_stream -% \end{macrocode} -% \end{macro} -% -% % \begin{macro}{\g_cs_dump_name_tl} % This \m{tl var.}~is used to store the name of the file. % % \begin{macrocode} -\tl_new:Nn\g_cs_dump_name_tl{} +%<*initex|package> +%<*precompile> +\tl_new:N \g_cs_dump_name_tl % \end{macrocode} % \end{macro} % @@ -248,14 +236,14 @@ % \begin{macrocode} \cs_new_nopar:Npn\cs_dump:{ \iow_term:x{Precompiling~style~into~(\g_cs_dump_name_tl)} -\iow_open:Nn\c_cs_dump_stream{\g_cs_dump_name_tl} +\iow_open:Nn\g_cs_dump_stream{\g_cs_dump_name_tl} % \end{macrocode} % The first thing we write on a `dump' file is a command that % allows us to use |*| in control sequences. We also need to be % able to write to (and read from) the file internal control % sequences, containing |_| and |:|. % \begin{macrocode} -\iow_now:Nx\c_cs_dump_stream +\iow_now:Nx\g_cs_dump_stream {\group_begin: \tex_catcode:D`\token_to_str:N\*=11\scan_stop: \token_to_str:N\ExplSyntaxOn @@ -263,7 +251,7 @@ \seq_map_inline:Nn \g_cs_dump_seq {\tex_message:D{.} -\iow_now:Nx\c_cs_dump_stream +\iow_now:Nx\g_cs_dump_stream % \end{macrocode} % We use a direct |\cs_gset_nopar:Npn| to disable any type of local/global % check on the pointers. @@ -273,18 +261,18 @@ } % \end{macrocode} % We also need to remember the current values of the -% |\g_gen_sym_num| and |\g_ggen_sym_num| counters to allow +% |\g_gen_sym_int| and |\g_ggen_sym_int| counters to allow % further updates after a database was dumped. % \begin{macrocode} -\iow_now:Nx \c_cs_dump_stream {\exp_not:n{\num_gset:Nn - \g_gen_sym_num} - {\num_use:N\g_gen_sym_num}^^J -\exp_not:n{\num_gset:Nn \g_ggen_sym_num} - {\num_use:N\g_ggen_sym_num}} +\iow_now:Nx \g_cs_dump_stream {\exp_not:n{\int_gset:Nn + \g_gen_sym_int} + {\int_use:N\g_gen_sym_int}^^J +\exp_not:n{\int_gset:Nn \g_ggen_sym_int} + {\int_use:N\g_ggen_sym_int}} \iow_now:Nx -\c_cs_dump_stream +\g_cs_dump_stream {\group_end:} -\iow_close:N\c_cs_dump_stream +\iow_close:N\g_cs_dump_stream \tex_message:D{~finished} } %</precompile> @@ -314,14 +302,13 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\g_gen_sym_num} -% \begin{macro}{\g_ggen_sym_num} +% \begin{macro}{\g_gen_sym_int} +% \begin{macro}{\g_ggen_sym_int} % Two counters to make up new local or global \textsl{short} names % in pointer structures like the \textsc{ldb}. -% We use a fake counters since operations with them are seldom. % \begin{macrocode} -\num_new:N\g_gen_sym_num \num_gset:Nn\g_gen_sym_num{0} -\num_new:N\g_ggen_sym_num \num_gset:Nn\g_ggen_sym_num{0} +\int_new:N\g_gen_sym_int \int_gset:Nn\g_gen_sym_int{0} +\int_new:N\g_ggen_sym_int \int_gset:Nn\g_ggen_sym_int{0} % \end{macrocode} % \end{macro} % \end{macro} @@ -336,8 +323,8 @@ % % \begin{macrocode} \cs_new_nopar:Npn\cs_gen_sym:N#1{ -\num_gincr:N\g_gen_sym_num -\tl_set:Nc#1{l*\tex_romannumeral:D\num_use:N\g_gen_sym_num} +\int_gincr:N\g_gen_sym_num +\tl_set:Nc#1{l*\tex_romannumeral:D\int_use:N\g_gen_sym_int} %<*precompile> \exp_after:wN\cs_record_name:N#1 %</precompile> @@ -351,8 +338,8 @@ % The global variant % \begin{macrocode} \cs_new_nopar:Npn\cs_ggen_sym:N#1{ -\num_gincr:N\g_ggen_sym_num -\tl_set:Nc#1{g*\tex_romannumeral:D\num_use:N\g_ggen_sym_num} +\int_gincr:N\g_ggen_sym_int +\tl_set:Nc#1{g*\tex_romannumeral:D\int_use:N\g_ggen_sym_int} %<*precompile> \exp_after:wN\cs_record_name:N#1 %</precompile> @@ -416,11 +403,11 @@ % \begin{macrocode} \cs_new_nopar:Npn\dumpLaTeXstate#1{ \iow_term:x{Dumping~commands~into~(#1.dmp)} - \iow_open:Nn\c_cs_dump_stream{#1.dmp} + \iow_open:Nn\g_cs_dump_stream{#1.dmp} \seq_map_inline:Nn \g_cs_trace_seq {\tex_message:D{.} - \iow_now:Nx\c_cs_dump_stream + \iow_now:Nx\g_cs_dump_stream {\token_to_str:N##1~ \token_to_meaning:N##1} } @@ -428,10 +415,11 @@ \seq_map_inline:Nn \g_register_trace_seq {\tex_message:D{.} - \iow_now:Nx\c_cs_dump_stream + \iow_now:Nx\g_cs_dump_stream {\token_to_str:N##1 \toks_use:N##1} } + \iow_clos:Nn \g_cs_dump_stream \tex_message:D{~finished} } %</trace> |