From 76955d84451b6ee69a2420d86c0a2c2eeea06d7d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 24 Aug 2012 23:40:06 +0000 Subject: morewrites (24aug12) git-svn-id: svn://tug.org/texlive/trunk@27516 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/morewrites/README | 8 --- .../texmf-dist/doc/latex/morewrites/morewrites.pdf | Bin 626922 -> 592451 bytes .../texmf-dist/doc/latex/morewrites/primargs.pdf | Bin 555751 -> 525528 bytes .../source/latex/morewrites/morewrites.dtx | 70 ++++++++++++++------- .../source/latex/morewrites/primargs.dtx | 13 ++-- .../texmf-dist/tex/latex/morewrites/morewrites.sty | 27 ++++---- .../texmf-dist/tex/latex/morewrites/primargs.sty | 7 ++- 7 files changed, 70 insertions(+), 55 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/morewrites/README b/Master/texmf-dist/doc/latex/morewrites/README index e31e09ec4e7..ba3e7ba1b15 100644 --- a/Master/texmf-dist/doc/latex/morewrites/README +++ b/Master/texmf-dist/doc/latex/morewrites/README @@ -13,11 +13,3 @@ with "\usepackage{morewrites}" as early as possible. This package uses the l3kernel bundle. This is work in progress, all suggestions/comments/bug reports are welcome! - -The package is extracted by running - - make package - -The documentation is produced by running - - make documentation diff --git a/Master/texmf-dist/doc/latex/morewrites/morewrites.pdf b/Master/texmf-dist/doc/latex/morewrites/morewrites.pdf index bc86919c649..2c1f86362e4 100644 Binary files a/Master/texmf-dist/doc/latex/morewrites/morewrites.pdf and b/Master/texmf-dist/doc/latex/morewrites/morewrites.pdf differ diff --git a/Master/texmf-dist/doc/latex/morewrites/primargs.pdf b/Master/texmf-dist/doc/latex/morewrites/primargs.pdf index 0ad04329ba8..e1655cef32a 100644 Binary files a/Master/texmf-dist/doc/latex/morewrites/primargs.pdf and b/Master/texmf-dist/doc/latex/morewrites/primargs.pdf differ diff --git a/Master/texmf-dist/source/latex/morewrites/morewrites.dtx b/Master/texmf-dist/source/latex/morewrites/morewrites.dtx index 4766f3abe5e..cb1f7da2b54 100644 --- a/Master/texmf-dist/source/latex/morewrites/morewrites.dtx +++ b/Master/texmf-dist/source/latex/morewrites/morewrites.dtx @@ -11,9 +11,6 @@ %% %% ----------------------------------------------------------------------- % -%<*driver|package> -\RequirePackage{l3names} -% %<*driver> \RequirePackage{morewrites} \documentclass[full]{l3doc} @@ -29,9 +26,9 @@ % % \title{The \textsf{morewrites} package: \\ % Always room for a new \cs{write}\thanks{This -% file has version number v0.2, last revised 2012-07-10.}} +% file has version number v0.2c, last revised 2012/08/24.}} % \author{Bruno Le Floch} -% \date{July 10, 2012} +% \date{2012/08/24} % % \maketitle % \tableofcontents @@ -64,12 +61,15 @@ % bundle needs to be up to date. If Heiko Oberdiek's package % \pkg{atbegshi} is available, it will be used. % -% \section{Known deficiencies} +% \section{Known deficiencies and open questions} % % Some distributions of \TeX{} allow a quoted syntax for file names with % spaces. I haven't yet coded that. A temporary fix is to avoid file % names with spaces. % +% The current code trims spaces at the end of every line that is written +% to a file. I might be able to change the code to avoid this. +% % The package code is not very legible, and definitely uses too many % |:D| control sequences, whose name means \enquote{do not use}. The % author does not see a way to avoid using primitives in this package, @@ -79,6 +79,12 @@ % code with \pkg{expl3}; go and see Joseph Wright's \pkg{siunitx} % instead.} % +% Things that I need to do. +% \begin{itemize} +% \item Redefine the \LaTeX3 functions to use \pkg{morewrites} too? +% \item Should \tn{newwrite} be protected? +% \end{itemize} +% % \end{documentation} % % \begin{implementation} @@ -87,9 +93,10 @@ % %<*package> % \begin{macrocode} +\RequirePackage {expl3} [2012/08/14] +\RequirePackage {primargs} [2012/08/24] \ProvidesExplPackage - {morewrites} {2012/07/10} {0.2} {Always room for a new write} -\RequirePackage{expl3, primargs} + {morewrites} {2012/08/24} {0.2c} {Always room for a new write} % \end{macrocode} % % \begin{macrocode} @@ -182,6 +189,15 @@ % assignment of the form \tn{toks}|0=|\meta{general text}. % \end{itemize} % +% \subsection{Variants} +% +% \begin{macro}[aux]{\prop_gpop:NVNT} +% We need this function later. +% \begin{macrocode} +\cs_generate_variant:Nn \prop_gpop:NnNT { NV } +% \end{macrocode} +% \end{macro} +% % \subsection{Renaming primitives (again)} % % \begin{macro}[int] @@ -306,7 +322,7 @@ \tex_aftergroup:D #1 \primargs_remove_equals:N \@@_parse_file_name: } -\cs_new_protected:Npn \@@_parse_file_name: +\cs_new_protected_nopar:Npn \@@_parse_file_name: { \primargs_get_file_name:N \group_end: } % \end{macrocode} % \end{macro} @@ -394,8 +410,7 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_immediate_closeout_aux: { - \exp_args:NNV \prop_pop:NnNT \g_@@_iow_prop - \g_@@_stream_int \l_@@_internal_tl + \prop_gpop:NVNT \g_@@_iow_prop \g_@@_stream_int \l_@@_internal_tl { \@@_immediate_write_and_close:nn { \g_@@_stream_int } { \l_@@_internal_tl } @@ -480,7 +495,7 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_immediate_write_aux:n { - \prop_if_in:NVTF \g_@@_iow_prop \g_@@_stream_int + \prop_get:NVNTF \g_@@_iow_prop \g_@@_stream_int \l_@@_internal_tl { \@@_immediate_write_open:n } { \@@_immediate_write_closed:n } } @@ -562,8 +577,6 @@ % strange delimiters). After each shipout, we can read the file to see % which output operations we need to perform, and in what order. % -% ^^A todo: check "_nopar"? -% % \subsubsection{Replacement for primitives} % % \begin{macro}[aux]{\@@_late:n} @@ -654,6 +667,18 @@ % % \subsubsection{Shipout business} % +% In this section, we hook into the \cs{shipout} primitive, and redefine +% it to first build a box with the material to ship out, then perform +% \begin{quote} +% \cs{@@_before_shipout:} \\ +% \meta{primitive shipout} \meta{collected box} \\ +% \cs{@@_after_shipout:} +% \end{quote} +% This is correct even if the values of the \tn{newlinechar} is changed +% within the user code which builds the shipped out box, because the +% value that \TeX{} uses is the value in effect immediately after +% \tn{shipout}. +% % \begin{macro}[aux]{\@@_before_shipout:} % Immediately before the shipout, we must open the writing stream % \cs{g_@@_iow}. Each delayed output operation has been replaced by @@ -671,7 +696,6 @@ % \end{macrocode} % \end{macro} % -%% ^^A todo: \shipout{\immediate\write4{}} => bug. % \begin{macro}[aux]{\@@_after_shipout:} % \begin{macro}[aux, rEXP]{\@@_after_shipout_loop:ww} % Immediately after all the \tn{write}s are performed, close the file, @@ -700,13 +724,13 @@ \tl_map_inline:nn { `(0123456789) } { \char_set_catcode_other:n {`##1} } \etex_everyeof:D { `() \exp_not:N } - \exp_args:NNx + \tl_gset:Nx \g_@@_internal_tl + { + \exp_after:wN \@@_after_shipout_loop:ww + \tex_input:D \g_@@_tmp_file_tl \c_space_tl + } \group_end: - \tl_map_inline:nn - { - \exp_after:wN \@@_after_shipout_loop:ww - \tex_input:D \g_@@_tmp_file_tl \c_space_tl %^^A bug? - } + \tl_map_inline:Nn \g_@@_internal_tl { \tl_use:c { c_@@_late_write_ ##1 _tl } } } \cs_new:Npn \@@_after_shipout_loop:ww #1 `( #2 ) @@ -841,8 +865,8 @@ % We need to allow \cs{newwrite} to allocate more than $16$ writes, % but beware that $18$ is reserved, and that packages might expect % $16$ or $17$ to write to the terminal. So instead skip until $20$, -% to be on the safe side. -% % ^^A todo: redefine the LaTeX3 things too? +% to be on the safe side. This really ought to be \tn{protected}, but +% none of the formats does that. % \begin{macrocode} \cs_new:Npn \@@_newwrite:N #1 { diff --git a/Master/texmf-dist/source/latex/morewrites/primargs.dtx b/Master/texmf-dist/source/latex/morewrites/primargs.dtx index a88bc6169e8..cff44ae4fb3 100644 --- a/Master/texmf-dist/source/latex/morewrites/primargs.dtx +++ b/Master/texmf-dist/source/latex/morewrites/primargs.dtx @@ -11,9 +11,6 @@ %% %% ----------------------------------------------------------------------- % -%<*driver|package> -\RequirePackage{l3names} -% %<*driver> \documentclass[full]{l3doc} \newcommand{\proc}[1]{\texttt{#1}} @@ -25,9 +22,9 @@ % % \title{The \textsf{primargs} package: \\ % Parsing arguments of primitives\thanks{This -% file has version number v0.1, last revised 2012-07-10.}} +% file has version number v0.2c, last revised 2012/08/24.}} % \author{Bruno Le Floch} -% \date{2012-07-10} +% \date{2012/08/24} % % \maketitle % \tableofcontents @@ -151,9 +148,9 @@ % %<*package> % \begin{macrocode} +\RequirePackage {expl3} [2012/08/14] \ProvidesExplPackage - {primargs}{2012/07/10}{0.1}{Parsing~arguments~of~primitives} -\RequirePackage{expl3} + {primargs} {2012/08/24} {0.2c} {Parsing arguments of primitives} % \end{macrocode} % % \begin{macrocode} @@ -465,6 +462,8 @@ \msg_warning:nn { primargs } { get-mudimen } \primargs_get_muglue:N } +\msg_new:nnn { primargs } { get-mudimen } + { The~\iow_char:N\\primargs_get_mudimen:N~function~is~buggy. } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/tex/latex/morewrites/morewrites.sty b/Master/texmf-dist/tex/latex/morewrites/morewrites.sty index fe8cbf1ee6e..df1f34cd584 100644 --- a/Master/texmf-dist/tex/latex/morewrites/morewrites.sty +++ b/Master/texmf-dist/tex/latex/morewrites/morewrites.sty @@ -19,10 +19,11 @@ %% http://www.latex-project.org/lppl.txt %% %% ----------------------------------------------------------------------- -\RequirePackage{l3names} +\RequirePackage {expl3} [2012/08/14] +\RequirePackage {primargs} [2012/08/24] \ProvidesExplPackage - {morewrites} {2012/07/10} {0.2} {Always room for a new write} -\RequirePackage{expl3, primargs} + {morewrites} {2012/08/24} {0.2c} {Always room for a new write} +\cs_generate_variant:Nn \prop_gpop:NnNT { NV } \cs_new_eq:NN \__morewrites_tex_immediate:w \tex_immediate:D \cs_new_eq:NN \__morewrites_tex_openout:w \tex_openout:D \cs_new_eq:NN \__morewrites_tex_write:w \tex_write:D @@ -47,7 +48,7 @@ \tex_aftergroup:D #1 \primargs_remove_equals:N \__morewrites_parse_file_name: } -\cs_new_protected:Npn \__morewrites_parse_file_name: +\cs_new_protected_nopar:Npn \__morewrites_parse_file_name: { \primargs_get_file_name:N \group_end: } \cs_new_protected_nopar:Npn \__morewrites_immediate:w { \primargs_read_x_token:N \__morewrites_immediate_ii: } @@ -84,8 +85,7 @@ } \cs_new_protected_nopar:Npn \__morewrites_immediate_closeout_aux: { - \exp_args:NNV \prop_pop:NnNT \g__morewrites_iow_prop - \g__morewrites_stream_int \l__morewrites_internal_tl + \prop_gpop:NVNT \g__morewrites_iow_prop \g__morewrites_stream_int \l__morewrites_internal_tl { \__morewrites_immediate_write_and_close:nn { \g__morewrites_stream_int } { \l__morewrites_internal_tl } @@ -124,7 +124,7 @@ } \cs_new_protected_nopar:Npn \__morewrites_immediate_write_aux:n { - \prop_if_in:NVTF \g__morewrites_iow_prop \g__morewrites_stream_int + \prop_get:NVNTF \g__morewrites_iow_prop \g__morewrites_stream_int \l__morewrites_internal_tl { \__morewrites_immediate_write_open:n } { \__morewrites_immediate_write_closed:n } } @@ -220,7 +220,6 @@ \__morewrites_tex_immediate:w \__morewrites_tex_openout:w \g__morewrites_iow \g__morewrites_tmp_file_tl \scan_stop: } -%% ^^A todo: \shipout{\immediate\write4{}} => bug. \cs_new_protected_nopar:Npn \__morewrites_after_shipout: { \__morewrites_tex_immediate:w \__morewrites_tex_closeout:w \g__morewrites_iow @@ -230,13 +229,13 @@ \tl_map_inline:nn { `(0123456789) } { \char_set_catcode_other:n {`##1} } \etex_everyeof:D { `() \exp_not:N } - \exp_args:NNx + \tl_gset:Nx \g__morewrites_internal_tl + { + \exp_after:wN \__morewrites_after_shipout_loop:ww + \tex_input:D \g__morewrites_tmp_file_tl \c_space_tl + } \group_end: - \tl_map_inline:nn - { - \exp_after:wN \__morewrites_after_shipout_loop:ww - \tex_input:D \g__morewrites_tmp_file_tl \c_space_tl %^^A bug? - } + \tl_map_inline:Nn \g__morewrites_internal_tl { \tl_use:c { c__morewrites_late_write_ ##1 _tl } } } \cs_new:Npn \__morewrites_after_shipout_loop:ww #1 `( #2 ) diff --git a/Master/texmf-dist/tex/latex/morewrites/primargs.sty b/Master/texmf-dist/tex/latex/morewrites/primargs.sty index 81ed7e6c153..34d9f76fcfb 100644 --- a/Master/texmf-dist/tex/latex/morewrites/primargs.sty +++ b/Master/texmf-dist/tex/latex/morewrites/primargs.sty @@ -19,10 +19,9 @@ %% http://www.latex-project.org/lppl.txt %% %% ----------------------------------------------------------------------- -\RequirePackage{l3names} +\RequirePackage {expl3} [2012/08/14] \ProvidesExplPackage - {primargs}{2012/07/10}{0.1}{Parsing~arguments~of~primitives} -\RequirePackage{expl3} + {primargs} {2012/08/24} {0.2c} {Parsing arguments of primitives} \cs_new_protected_nopar:Npn \g__primargs_code_tl { } \cs_new_protected_nopar:Npn \__primargs_no_afterassignment: { \tex_afterassignment:D \tex_relax:D } @@ -151,6 +150,8 @@ \msg_warning:nn { primargs } { get-mudimen } \primargs_get_muglue:N } +\msg_new:nnn { primargs } { get-mudimen } + { The~\iow_char:N\\primargs_get_mudimen:N~function~is~buggy. } \cs_new_protected_nopar:Npn \primargs_get_muglue:N { \__primargs_get_rhs:NoN \tex_thinmuskip:D -- cgit v1.2.3