diff options
author | Karl Berry <karl@freefriends.org> | 2021-08-27 22:42:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-08-27 22:42:05 +0000 |
commit | eeb7f50af3eaecaf525bfdb721b837386ceb9935 (patch) | |
tree | 7f18c91a76e29970f6c361b17eea0a6db002989f /Master/texmf-dist/source/latex/l3kernel/l3msg.dtx | |
parent | ed2f495bcd8d0143ff2053a21ac19555fd477846 (diff) |
l3 (28aug21)
git-svn-id: svn://tug.org/texlive/trunk@60338 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3msg.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3msg.dtx | 558 |
1 files changed, 180 insertions, 378 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index d08550273e9..0c689251a4d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2021-07-12} +% \date{Released 2021-08-27} % % \maketitle % @@ -693,7 +693,7 @@ { \msg_if_exist:nnT {#1} {#2} { - \__kernel_msg_error:nnxx { msg } { already-defined } + \msg_error:nnxx { msg } { already-defined } {#1} {#2} } } @@ -1166,8 +1166,12 @@ % } % For an error, the interrupt routine is called. We check if there is % a \enquote{more text} by comparing that control sequence with a -% permanently empty text. +% permanently empty text. We have to undefine the bootstrap versions +% here. % \begin{macrocode} + \cs_undefine:N \msg_error:nnxx + \cs_undefine:N \msg_error:nnx + \cs_undefine:N \msg_error:nn \@@_class_new:nn { error } { \@@_interrupt:NnnnN @@ -1180,6 +1184,7 @@ % % \begin{macro} % { +% \@@_info_aux:NNnnnnnn , % \msg_warning:nnnnnn , % \msg_warning:nnnnn , % \msg_warning:nnnn , @@ -1188,38 +1193,7 @@ % \msg_warning:nnxxxx , % \msg_warning:nnxxx , % \msg_warning:nnxx , -% \msg_warning:nnx -% } -% Warnings are printed to the terminal. -% \begin{macrocode} - \@@_class_new:nn { warning } - { - \str_set:Nx \l_@@_text_str { \msg_warning_text:n {#1} } - \str_set:Nx \l_@@_name_str { \msg_module_name:n {#1} } - \iow_term:n { } - \iow_wrap:nxnN - { - \l_@@_text_str : ~ - \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} - } - { - ( \l_@@_name_str ) - \prg_replicate:nn - { - \str_count:N \l_@@_text_str - - \str_count:N \l_@@_name_str - } - { ~ } - } - { } \iow_term:n - \iow_term:n { } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro} -% { -% \@@_info_aux:Nnn , +% \msg_warning:nnx , % \msg_note:nnnnnn , % \msg_note:nnnnn , % \msg_note:nnnn , @@ -1237,27 +1211,22 @@ % \msg_info:nnxxxx , % \msg_info:nnxxx , % \msg_info:nnxx , -% \msg_info:nnx +% \msg_info:nnx , % } -% Information has no decoration and goes either to the log or both -% log and terminal. +% Warnings and information messages have no decoration. Warnings are +% printed to the terminal while information can either go to the log +% or both log and terminal. % \begin{macrocode} - \@@_class_new:nn { note } - { - \@@_info_aux:Nnn \iow_term:n {#1} - { \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } - } - \@@_class_new:nn { info } + \cs_new_protected:Npn \@@_info_aux:NNnnnnnn #1#2#3#4#5#6#7#8 { - \@@_info_aux:Nnn \iow_log:n {#1} - { \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } - } - \cs_new_protected:Npn \@@_info_aux:Nnn #1#2#3 - { - \str_set:Nx \l_@@_text_str { \msg_info_text:n {#2} } - \str_set:Nx \l_@@_name_str { \msg_module_name:n {#2} } + \str_set:Nx \l_@@_text_str { #2 {#3} } + \str_set:Nx \l_@@_name_str { \msg_module_name:n {#3} } #1 { } - \iow_wrap:nxnN { \l_@@_text_str : ~ #3 } + \iow_wrap:nxnN + { + \l_@@_text_str : ~ + \use:c { \c_@@_text_prefix_tl #3 / #4 } {#5} {#6} {#7} {#8} + } { ( \l_@@_name_str ) \prg_replicate:nn @@ -1270,6 +1239,21 @@ { } #1 #1 { } } + \@@_class_new:nn { warning } + { + \@@_info_aux:NNnnnnnn \iow_term:n \msg_warning_text:n + {#1} {#2} {#3} {#4} {#5} {#6} + } + \@@_class_new:nn { note } + { + \@@_info_aux:NNnnnnnn \iow_term:n \msg_info_text:n + {#1} {#2} {#3} {#4} {#5} {#6} + } + \@@_class_new:nn { info } + { + \@@_info_aux:NNnnnnnn \iow_log:n \msg_info_text:n + {#1} {#2} {#3} {#4} {#5} {#6} + } % \end{macrocode} % \end{macro} % @@ -1283,22 +1267,7 @@ % \msg_log:nnxxxx , % \msg_log:nnxxx , % \msg_log:nnxx , -% \msg_log:nnx -% } -% \enquote{Log} data is very similar to information, but with no extras -% added. -% \begin{macrocode} - \@@_class_new:nn { log } - { - \iow_wrap:nnnN - { \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } - { } { } \iow_log:n - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro} -% { +% \msg_log:nnx , % \msg_term:nnnnnn , % \msg_term:nnnnn , % \msg_term:nnnn , @@ -1307,12 +1276,20 @@ % \msg_term:nnxxxx , % \msg_term:nnxxx , % \msg_term:nnxx , -% \msg_term:nnx +% \msg_term:nnx , % } +% \enquote{Log} data is very similar to information, but with no extras +% added. % \enquote{Term} is used for communicating with the user through the % terminal, like diagnostic messages, and debugging. This is similar % to \enquote{log} messages, but uses the terminal output. % \begin{macrocode} + \@@_class_new:nn { log } + { + \iow_wrap:nnnN + { \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } + { } { } \iow_log:n + } \@@_class_new:nn { term } { \iow_wrap:nnnN @@ -1415,7 +1392,7 @@ \cs_new:Npn \@@_class_chk_exist:nT #1 { \cs_if_free:cTF { @@_ #1 _code:nnnnnn } - { \__kernel_msg_error:nnx { msg } { class-unknown } {#1} } + { \msg_error:nnx { msg } { class-unknown } {#1} } } % \end{macrocode} % \end{macro} @@ -1485,7 +1462,7 @@ \@@_use_redirect_name:n { #2 / #3 } } } - { \__kernel_msg_error:nnxx { msg } { unknown } {#2} {#3} } + { \msg_error:nnxx { msg } { unknown } {#2} {#3} } \cs_if_exist_use:N \conditionally@traceon } \cs_new_protected:Npn \@@_use_code: { } @@ -1635,7 +1612,7 @@ \tl_if_eq:NNTF \l_@@_class_tl \l_@@_current_class_tl { \prop_put:cnn { l_@@_redirect_ #2 _prop } {#3} {#2} - \__kernel_msg_warning:nnxxxx + \msg_warning:nnxxxx { msg } { redirect-loop } { \seq_item:Nn \l_@@_class_loop_seq { 1 } } { \seq_item:Nn \l_@@_class_loop_seq { 2 } } @@ -1659,177 +1636,64 @@ % % \subsection{Kernel-specific functions} % -% \begin{macro}{\__kernel_msg_new:nnnn, \__kernel_msg_new:nnn} -% \begin{macro}{\__kernel_msg_set:nnnn, \__kernel_msg_set:nnn} -% The kernel needs some messages of its own. These are created using -% pre-built functions. Two functions are provided: one more general -% and one which only has the short text part. -% \begin{macrocode} -\cs_new_protected:Npn \__kernel_msg_new:nnnn #1#2 - { \msg_new:nnnn { LaTeX } { #1 / #2 } } -\cs_new_protected:Npn \__kernel_msg_new:nnn #1#2 - { \msg_new:nnn { LaTeX } { #1 / #2 } } -\cs_new_protected:Npn \__kernel_msg_set:nnnn #1#2 - { \msg_set:nnnn { LaTeX } { #1 / #2 } } -\cs_new_protected:Npn \__kernel_msg_set:nnn #1#2 - { \msg_set:nnn { LaTeX } { #1 / #2 } } -% \end{macrocode} -% \end{macro} -% \end{macro} +% These are all retained purely for older \pkg{xparse} support. % -% \begin{macro}{\@@_kernel_class_new:nN} -% \begin{macro}{\@@_kernel_class_new_aux:nN} -% All the functions for kernel messages come in variants ranging -% from~$0$ to~$4$ arguments. Those with less than~$4$ arguments are -% defined in terms of the $4$-argument variant, in a way very similar -% to \cs{@@_class_new:nn}. This auxiliary is destroyed at the end of -% the group. -% \begin{macrocode} -\group_begin: - \cs_set_protected:Npn \@@_kernel_class_new:nN #1 - { \@@_kernel_class_new_aux:nN { __kernel_msg_ #1 } } - \cs_set_protected:Npn \@@_kernel_class_new_aux:nN #1#2 - { - \cs_new_protected:cpn { #1 :nnnnnn } ##1##2##3##4##5##6 - { - \use:x - { - \exp_not:n { #2 { LaTeX } { ##1 / ##2 } } - { \tl_to_str:n {##3} } { \tl_to_str:n {##4} } - { \tl_to_str:n {##5} } { \tl_to_str:n {##6} } - } - } - \cs_new_protected:cpx { #1 :nnnnn } ##1##2##3##4##5 - { \exp_not:c { #1 :nnnnnn } {##1} {##2} {##3} {##4} {##5} { } } - \cs_new_protected:cpx { #1 :nnnn } ##1##2##3##4 - { \exp_not:c { #1 :nnnnnn } {##1} {##2} {##3} {##4} { } { } } - \cs_new_protected:cpx { #1 :nnn } ##1##2##3 - { \exp_not:c { #1 :nnnnnn } {##1} {##2} {##3} { } { } { } } - \cs_new_protected:cpx { #1 :nn } ##1##2 - { \exp_not:c { #1 :nnnnnn } {##1} {##2} { } { } { } { } } - \cs_new_protected:cpx { #1 :nnxxxx } ##1##2##3##4##5##6 - { - \use:x - { - \exp_not:N \exp_not:n - { \exp_not:c { #1 :nnnnnn } {##1} {##2} } - {##3} {##4} {##5} {##6} - } - } - \cs_new_protected:cpx { #1 :nnxxx } ##1##2##3##4##5 - { \exp_not:c { #1 :nnxxxx } {##1} {##2} {##3} {##4} {##5} { } } - \cs_new_protected:cpx { #1 :nnxx } ##1##2##3##4 - { \exp_not:c { #1 :nnxxxx } {##1} {##2} {##3} {##4} { } { } } - \cs_new_protected:cpx { #1 :nnx } ##1##2##3 - { \exp_not:c { #1 :nnxxxx } {##1} {##2} {##3} { } { } { } } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro} -% { -% \__kernel_msg_fatal:nnnnnn , -% \__kernel_msg_fatal:nnnnn , -% \__kernel_msg_fatal:nnnn , -% \__kernel_msg_fatal:nnn , -% \__kernel_msg_fatal:nn , -% \__kernel_msg_fatal:nnxxxx , -% \__kernel_msg_fatal:nnxxx , -% \__kernel_msg_fatal:nnxx , -% \__kernel_msg_fatal:nnx , -% \__kernel_msg_critical:nnnnnn , -% \__kernel_msg_critical:nnnnn , -% \__kernel_msg_critical:nnnn , -% \__kernel_msg_critical:nnn , -% \__kernel_msg_critical:nn , -% \__kernel_msg_critical:nnxxxx , -% \__kernel_msg_critical:nnxxx , -% \__kernel_msg_critical:nnxx , -% \__kernel_msg_critical:nnx , -% \__kernel_msg_error:nnnnnn , -% \__kernel_msg_error:nnnnn , -% \__kernel_msg_error:nnnn , -% \__kernel_msg_error:nnn , -% \__kernel_msg_error:nn , -% \__kernel_msg_error:nnxxxx , -% \__kernel_msg_error:nnxxx , -% \__kernel_msg_error:nnxx , -% \__kernel_msg_error:nnx -% } -% Neither fatal kernel errors nor kernel errors can be redirected. We -% directly use the code for (non-kernel) fatal errors and errors, -% adding the \enquote{\LaTeX{}} module name. Three functions are -% already defined by \pkg{l3basics}; we need to undefine them to avoid -% errors. +% \begin{macro}{\__kernel_msg_new:nnnn, \__kernel_msg_new:nnn} % \begin{macrocode} - \@@_kernel_class_new:nN { fatal } \@@_fatal_code:nnnnnn - \@@_kernel_class_new:nN { critical } \@@_critical_code:nnnnnn - \cs_undefine:N \__kernel_msg_error:nnxx - \cs_undefine:N \__kernel_msg_error:nnx - \cs_undefine:N \__kernel_msg_error:nn - \@@_kernel_class_new:nN { error } \@@_error_code:nnnnnn +\cs_new_protected:Npn \__kernel_msg_new:nnnn #1 + { \msg_new:nnnn { LaTeX / #1 } } +\cs_new_protected:Npn \__kernel_msg_new:nnn #1 + { \msg_new:nnn { LaTeX / #1 } } % \end{macrocode} % \end{macro} % % \begin{macro} % { -% \__kernel_msg_warning:nnnnnn , -% \__kernel_msg_warning:nnnnn , -% \__kernel_msg_warning:nnnn , -% \__kernel_msg_warning:nnn , -% \__kernel_msg_warning:nn , -% \__kernel_msg_warning:nnxxxx , -% \__kernel_msg_warning:nnxxx , -% \__kernel_msg_warning:nnxx , -% \__kernel_msg_warning:nnx , -% \__kernel_msg_info:nnnnnn , -% \__kernel_msg_info:nnnnn , -% \__kernel_msg_info:nnnn , -% \__kernel_msg_info:nnn , -% \__kernel_msg_info:nn , -% \__kernel_msg_info:nnxxxx , -% \__kernel_msg_info:nnxxx , -% \__kernel_msg_info:nnxx , -% \__kernel_msg_info:nnx +% \__kernel_msg_info:nnxx , +% \__kernel_msg_warning:nnx , +% \__kernel_msg_warning:nnxx , +% \__kernel_msg_error:nnx , +% \__kernel_msg_error:nnxx , +% \__kernel_msg_error:nnxxx % } -% Kernel messages which can be redirected simply use the machinery for -% normal messages, with the module name \enquote{\LaTeX{}}. % \begin{macrocode} - \@@_kernel_class_new:nN { warning } \msg_warning:nnxxxx - \@@_kernel_class_new:nN { info } \msg_info:nnxxxx +\cs_new_protected:Npn \__kernel_msg_info:nnxx #1 + { \msg_info:nnxx { LaTeX / #1 } } +\cs_new_protected:Npn \__kernel_msg_warning:nnx #1 + { \msg_warning:nnx { LaTeX / #1 } } +\cs_new_protected:Npn \__kernel_msg_warning:nnxx #1 + { \msg_warning:nnxx { LaTeX / #1 } } +\cs_new_protected:Npn \__kernel_msg_error:nnx #1 + { \msg_error:nnx { LaTeX / #1 } } +\cs_new_protected:Npn \__kernel_msg_error:nnxx #1 + { \msg_error:nnxx { LaTeX / #1 } } +\cs_new_protected:Npn \__kernel_msg_error:nnxxx #1 + { \msg_error:nnxxx { LaTeX / #1 } } % \end{macrocode} % \end{macro} % % \begin{macro} % { -% \__kernel_msg_log:nnnnnn, \__kernel_msg_log:nnxxxx, -% \__kernel_msg_term:nnnnnn, \__kernel_msg_term:nnxxxx, -% \__kernel_msg_show:nnnnnn, \__kernel_msg_show:nnxxxx +% \__kernel_msg_expandable_error:nnn , +% \__kernel_msg_expandable_error:nnf , +% \__kernel_msg_expandable_error:nnff % } -% For showing messages. % \begin{macrocode} -\cs_new_protected:Npn \__kernel_msg_log:nnnnnn #1 - { \msg_log:nnnnnn { LaTeX / #1 } } -\cs_generate_variant:Nn \__kernel_msg_log:nnnnnn { nnxxxx } -\cs_new_protected:Npn \__kernel_msg_term:nnnnnn #1 - { \msg_term:nnnnnn { LaTeX / #1 } } -\cs_generate_variant:Nn \__kernel_msg_term:nnnnnn { nnxxxx } -\cs_new_protected:Npn \__kernel_msg_show:nnnnnn #1 - { \msg_show:nnnnnn { LaTeX / #1 } } -\cs_generate_variant:Nn \__kernel_msg_show:nnnnnn { nnxxxx } +\cs_new:Npn \__kernel_msg_expandable_error:nnn #1 + { \msg_expandable_error:nnn { LaTeX / #1 } } +\cs_new:Npn \__kernel_msg_expandable_error:nnf #1 + { \msg_expandable_error:nnf { LaTeX / #1 } } +\cs_new:Npn \__kernel_msg_expandable_error:nnff #1 + { \msg_expandable_error:nnff { LaTeX / #1 } } % \end{macrocode} % \end{macro} % -% End the group to eliminate \cs{@@_kernel_class_new:nN}. -% \begin{macrocode} -\group_end: -% \end{macrocode} +% \subsection{Internal messages} % % Error messages needed to actually implement the message system % itself. % \begin{macrocode} -\__kernel_msg_new:nnnn { msg } { already-defined } +\msg_new:nnnn { msg } { already-defined } { Message~'#2'~for~module~'#1'~already~defined. } { \c_@@_coding_error_text_tl @@ -1837,7 +1701,7 @@ by~the~module~'#1':~this~message~already~exists. \c_@@_return_text_tl } -\__kernel_msg_new:nnnn { msg } { unknown } +\msg_new:nnnn { msg } { unknown } { Unknown~message~'#2'~for~module~'#1'. } { \c_@@_coding_error_text_tl @@ -1845,14 +1709,14 @@ by~the~module~'#1':~this~message~does~not~exist. \c_@@_return_text_tl } -\__kernel_msg_new:nnnn { msg } { class-unknown } +\msg_new:nnnn { msg } { class-unknown } { Unknown~message~class~'#1'. } { LaTeX~has~been~asked~to~redirect~messages~to~a~class~'#1':\\ this~was~never~defined. \c_@@_return_text_tl } -\__kernel_msg_new:nnnn { msg } { redirect-loop } +\msg_new:nnnn { msg } { redirect-loop } { Message~redirection~loop~caused~by~ {#1} ~=>~ {#2} \tl_if_empty:nF {#3} { ~for~module~' \use_none:n #3 ' } . @@ -1868,7 +1732,7 @@ % Messages for earlier kernel modules plus a few for \pkg{l3keys} which % cover coding errors. % \begin{macrocode} -\__kernel_msg_new:nnnn { kernel } { bad-number-of-arguments } +\msg_new:nnnn { kernel } { bad-number-of-arguments } { Function~'#1'~cannot~be~defined~with~#2~arguments. } { \c_@@_coding_error_text_tl @@ -1876,7 +1740,7 @@ #2~arguments.~ TeX~allows~between~0~and~9~arguments~for~a~single~function. } -\__kernel_msg_new:nnnn { kernel } { command-already-defined } +\msg_new:nnnn { kernel } { command-already-defined } { Control~sequence~#1~already~defined. } { \c_@@_coding_error_text_tl @@ -1885,28 +1749,21 @@ The~current~meaning~is:\\ \ \ #2 } -\__kernel_msg_new:nnnn { kernel } { command-not-defined } +\msg_new:nnnn { kernel } { command-not-defined } { Control~sequence~#1~undefined. } { \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~use~a~control~sequence~'#1':\\ this~has~not~been~defined~yet. } -\__kernel_msg_new:nnnn { kernel } { empty-search-pattern } +\msg_new:nnnn { kernel } { empty-search-pattern } { Empty~search~pattern. } { \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~replace~an~empty~pattern~by~'#1':~that~ would~lead~to~an~infinite~loop! } -\__kernel_msg_new:nnnn { kernel } { out-of-registers } - { No~room~for~a~new~#1. } - { - TeX~only~supports~\int_use:N \c_max_register_int \ % - of~each~type.~All~the~#1~registers~have~been~used.~ - This~run~will~be~aborted~now. - } -\__kernel_msg_new:nnnn { kernel } { non-base-function } +\msg_new:nnnn { kernel } { non-base-function } { Function~'#1'~is~not~a~base~function } { \c_@@_coding_error_text_tl @@ -1916,7 +1773,7 @@ To~define~variants~use~\iow_char:N\\cs_generate_variant:Nn~ and~to~define~other~functions~use~\iow_char:N\\cs_new:Npn. } -\__kernel_msg_new:nnnn { kernel } { missing-colon } +\msg_new:nnnn { kernel } { missing-colon } { Function~'#1'~contains~no~':'. } { \c_@@_coding_error_text_tl @@ -1925,36 +1782,36 @@ needed~when~defining~conditionals~or~variants,~or~when~building~a~ parameter~text~from~the~number~of~arguments~of~the~function. } -\__kernel_msg_new:nnnn { kernel } { overflow } +\msg_new:nnnn { kernel } { overflow } { Integers~larger~than~2^{30}-1~cannot~be~stored~in~arrays. } { An~attempt~was~made~to~store~#3~ \tl_if_empty:nF {#2} { at~position~#2~ } in~the~array~'#1'.~ The~largest~allowed~value~#4~will~be~used~instead. } -\__kernel_msg_new:nnnn { kernel } { out-of-bounds } +\msg_new:nnnn { kernel } { out-of-bounds } { Access~to~an~entry~beyond~an~array's~bounds. } { An~attempt~was~made~to~access~or~store~data~at~position~#2~of~the~ array~'#1',~but~this~array~has~entries~at~positions~from~1~to~#3. } -\__kernel_msg_new:nnnn { kernel } { protected-predicate } +\msg_new:nnnn { kernel } { protected-predicate } { Predicate~'#1'~must~be~expandable. } { \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~define~'#1'~as~a~protected~predicate.~ Only~expandable~tests~can~have~a~predicate~version. } -\__kernel_msg_new:nnn { kernel } { randint-backward-range } - { Bounds~ordered~backwards~in~\iow_char:N\\int_rand:nn~{#1}~{#2}. } -\__kernel_msg_new:nnnn { kernel } { conditional-form-unknown } +\msg_new:nnn { kernel } { randint-backward-range } + { Wrong~order~of~bounds~in~\iow_char:N\\int_rand:nn{#1}{#2}. } +\msg_new:nnnn { kernel } { conditional-form-unknown } { Conditional~form~'#1'~for~function~'#2'~unknown. } { \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~define~the~conditional~form~'#1'~of~ the~function~'#2',~but~only~'TF',~'T',~'F',~and~'p'~forms~exist. } -\__kernel_msg_new:nnnn { kernel } { variant-too-long } +\msg_new:nnnn { kernel } { variant-too-long } { Variant~form~'#1'~longer~than~base~signature~of~'#2'. } { \c_@@_coding_error_text_tl @@ -1962,7 +1819,7 @@ with~a~signature~starting~with~'#1',~but~that~is~longer~than~ the~signature~(part~after~the~colon)~of~'#2'. } -\__kernel_msg_new:nnnn { kernel } { invalid-variant } +\msg_new:nnnn { kernel } { invalid-variant } { Variant~form~'#1'~invalid~for~base~form~'#2'. } { \c_@@_coding_error_text_tl @@ -1970,7 +1827,7 @@ with~a~signature~starting~with~'#1',~but~cannot~change~an~argument~ from~type~'#3'~to~type~'#4'. } -\__kernel_msg_new:nnnn { kernel } { invalid-exp-args } +\msg_new:nnnn { kernel } { invalid-exp-args } { Invalid~variant~specifier~'#1'~in~'#2'. } { \c_@@_coding_error_text_tl @@ -1978,7 +1835,7 @@ function~with~signature~'N#2'~but~'#1'~is~not~a~valid~argument~ specifier. } -\__kernel_msg_new:nnn { kernel } { deprecated-variant } +\msg_new:nnn { kernel } { deprecated-variant } { Variant~form~'#1'~deprecated~for~base~form~'#2'.~ One~should~not~change~an~argument~from~type~'#3'~to~type~'#4' @@ -1989,20 +1846,20 @@ {#4} { :~base~form~is~already~a~variant. } } { . } } -\__kernel_msg_new:nnn { char } { active } +\msg_new:nnn { char } { active } { Cannot~generate~active~chars. } -\__kernel_msg_new:nnn { char } { invalid-catcode } +\msg_new:nnn { char } { invalid-catcode } { Invalid~catcode~for~char~generation. } -\__kernel_msg_new:nnn { char } { null-space } +\msg_new:nnn { char } { null-space } { Cannot~generate~null~char~as~a~space. } -\__kernel_msg_new:nnn { char } { out-of-range } +\msg_new:nnn { char } { out-of-range } { Charcode~requested~out~of~engine~range. } -\__kernel_msg_new:nnn { char } { space } +\msg_new:nnn { char } { space } { Cannot~generate~space~chars. } -\__kernel_msg_new:nnnn { ior } { quote-in-shell } +\msg_new:nnnn { ior } { quote-in-shell } { Quotes~in~shell~command~'#1'. } { Shell~commands~cannot~contain~quotes~("). } -\__kernel_msg_new:nnnn { keys } { no-property } +\msg_new:nnnn { keys } { no-property } { No~property~given~in~definition~of~key~'#1'. } { \c_@@_coding_error_text_tl @@ -2011,27 +1868,27 @@ \iow_indent:n { #1 .<property> } \\ \\ LaTeX~did~not~find~a~'.'~to~indicate~the~start~of~a~property. } -\__kernel_msg_new:nnnn { keys } { property-boolean-values-only } +\msg_new:nnnn { keys } { property-boolean-values-only } { The~property~'#1'~accepts~boolean~values~only. } { \c_@@_coding_error_text_tl The~property~'#1'~only~accepts~the~values~'true'~and~'false'. } -\__kernel_msg_new:nnnn { keys } { property-requires-value } +\msg_new:nnnn { keys } { property-requires-value } { The~property~'#1'~requires~a~value. } { \c_@@_coding_error_text_tl LaTeX~was~asked~to~set~property~'#1'~for~key~'#2'.\\ No~value~was~given~for~the~property,~and~one~is~required. } -\__kernel_msg_new:nnnn { keys } { property-unknown } +\msg_new:nnnn { keys } { property-unknown } { The~key~property~'#1'~is~unknown. } { \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~set~the~property~'#1'~for~key~'#2':~ this~property~is~not~defined. } -\__kernel_msg_new:nnnn { quark } { invalid-function } +\msg_new:nnnn { quark } { invalid-function } { Quark~test~function~'#1'~is~invalid. } { \c_@@_coding_error_text_tl @@ -2043,14 +1900,14 @@ } \__kernel_msg_new:nnn { quark } { invalid } { Invalid~quark~variable~'#1'. } -\__kernel_msg_new:nnnn { scanmark } { already-defined } +\msg_new:nnnn { scanmark } { already-defined } { Scan~mark~#1~already~defined. } { \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~create~a~new~scan~mark~'#1'~ but~this~name~has~already~been~used~for~a~scan~mark. } -\__kernel_msg_new:nnnn { seq } { shuffle-too-large } +\msg_new:nnnn { seq } { shuffle-too-large } { The~sequence~#1~is~too~long~to~be~shuffled~by~TeX. } { TeX~has~ \int_eval:n { \c_max_register_int + 1 } ~ @@ -2058,14 +1915,14 @@ \int_use:N \c_max_register_int \ items.~ The~list~will~not~be~shuffled. } -\__kernel_msg_new:nnnn { kernel } { variable-not-defined } +\msg_new:nnnn { kernel } { variable-not-defined } { Variable~#1~undefined. } { \c_@@_coding_error_text_tl LaTeX~has~been~asked~to~show~a~variable~#1,~but~this~has~not~ been~defined~yet. } -\__kernel_msg_new:nnnn { kernel } { bad-type } +\msg_new:nnnn { kernel } { bad-type } { Variable~'#1'~is~not~a~valid~#3. } { \c_@@_coding_error_text_tl @@ -2081,7 +1938,7 @@ { internal~structure:\\\\\iow_indent:n {#4} } } } -\__kernel_msg_new:nnnn { kernel } { non-clist } +\msg_new:nnnn { clist } { non-clist } { Variable~'#1'~is~not~a~valid~clist. } { \c_@@_coding_error_text_tl @@ -2097,7 +1954,7 @@ % \texttt{log-functions}, or on the contrary if debugging is turned off. % In format mode the error is somewhat different. % \begin{macrocode} -\__kernel_msg_new:nnnn { debug } { enable-debug } +\msg_new:nnnn { debug } { enable-debug } { To~use~'#1'~set~the~'enable-debug'~option. } { The~function~'#1'~will~be~ignored~because~it~can~only~work~if~ @@ -2111,55 +1968,55 @@ % Some errors only appear in expandable settings, % hence don't need a \enquote{more-text} argument. % \begin{macrocode} -\__kernel_msg_new:nnn { kernel } { bad-exp-end-f } +\msg_new:nnn { kernel } { bad-exp-end-f } { Misused~\exp_end_continue_f:w or~:nw } -\__kernel_msg_new:nnn { kernel } { bad-variable } +\msg_new:nnn { kernel } { bad-variable } { Erroneous~variable~#1 used! } -\__kernel_msg_new:nnn { seq } { misused } +\msg_new:nnn { seq } { misused } { A~sequence~was~misused. } -\__kernel_msg_new:nnn { prop } { misused } +\msg_new:nnn { prop } { misused } { A~property~list~was~misused. } -\__kernel_msg_new:nnn { prg } { negative-replication } +\msg_new:nnn { prg } { negative-replication } { Negative~argument~for~\iow_char:N\\prg_replicate:nn. } -\__kernel_msg_new:nnn { prop } { prop-keyval } +\msg_new:nnn { prop } { prop-keyval } { Missing/extra~'='~in~'#1'~(in~'..._keyval:Nn') } -\__kernel_msg_new:nnn { kernel } { unknown-comparison } - { Relation~'#1'~unknown:~use~=,~<,~>,~==,~!=,~<=,~>=. } -\__kernel_msg_new:nnn { kernel } { zero-step } - { Zero~step~size~for~step~function~#1. } +\msg_new:nnn { kernel } { unknown-comparison } + { Relation~'#1'~not~among~=,<,>,==,!=,<=,>=. } +\msg_new:nnn { kernel } { zero-step } + { Zero~step~size~for~function~#1. } \cs_if_exist:NF \tex_expanded:D { - \__kernel_msg_new:nnn { kernel } { e-type } + \msg_new:nnn { kernel } { e-type } { #1 ~ in~e-type~argument } } % \end{macrocode} % % Messages used by the \enquote{\texttt{show}} functions. % \begin{macrocode} -\__kernel_msg_new:nnn { clist } { show } +\msg_new:nnn { clist } { show } { The~comma~list~ \tl_if_empty:nF {#1} { #1 ~ } \tl_if_empty:nTF {#2} { is~empty \\>~ . } { contains~the~items~(without~outer~braces): #2 . } } -\__kernel_msg_new:nnn { intarray } { show } +\msg_new:nnn { intarray } { show } { The~integer~array~#1~contains~#2~items: \\ #3 . } -\__kernel_msg_new:nnn { prop } { show } +\msg_new:nnn { prop } { show } { The~property~list~#1~ \tl_if_empty:nTF {#2} { is~empty \\>~ . } { contains~the~pairs~(without~outer~braces): #2 . } } -\__kernel_msg_new:nnn { seq } { show } +\msg_new:nnn { seq } { show } { The~sequence~#1~ \tl_if_empty:nTF {#2} { is~empty \\>~ . } { contains~the~items~(without~outer~braces): #2 . } } -\__kernel_msg_new:nnn { kernel } { show-streams } +\msg_new:nnn { kernel } { show-streams } { \tl_if_empty:nTF {#2} { No~ } { The~following~ } \str_case:nn {#1} @@ -2174,13 +2031,13 @@ % % System layer messages % \begin{macrocode} -\__kernel_msg_new:nnnn { sys } { backend-set } +\msg_new:nnnn { sys } { backend-set } { Backend~configuration~already~set. } { Run-time~backend~selection~may~only~be~carried~out~once~during~a~run.~ This~second~attempt~to~set~them~will~be~ignored. } -\__kernel_msg_new:nnnn { sys } { wrong-backend } +\msg_new:nnnn { sys } { wrong-backend } { Backend~request~inconsistent~with~engine:~using~'#2'~backend. } { You~have~requested~backend~'#1',~but~this~is~not~suitable~for~use~with~the~ @@ -2190,104 +2047,31 @@ % % \subsection{Expandable errors} % -% \begin{macro}{\@@_expandable_error:n} -% \begin{macro}{\@@_expandable_error:w} +% \begin{macro}{\@@_expandable_error:nn} % In expansion only context, we cannot use the normal means of -% reporting errors. Instead, we feed \TeX{} an undefined control -% sequence, \cs[module = {}]{LaTeX3 error:}. It is thus interrupted, and shows +% reporting errors. Instead, we rely on a low-level \TeX{} error +% caused by expanding a macro \cs{???} with parameter text ``|?|'' +% (this could be any token) which we used followed by something else +% (here, a space). This shows % the context, which thanks to the odd-looking \cs{use:n} is % \begin{verbatim} -% <argument> \LaTeX3 error: -% The error message. +% <argument> \??? +% ! mypkg Error: The error message. % \end{verbatim} % In other words, \TeX{} is processing the argument of \cs{use:n}, -% which is \cs[module = {}]{LaTeX3 error:} \meta{error message}. -% Then \cs{@@_expandable_error:w} cleans up. In fact, there -% is an extra subtlety: if the user inserts tokens for error recovery, -% they should be kept. Thus we also use an odd space character -% (with category code $7$) and keep tokens until that space character, -% dropping everything else until \cs{s_@@_stop}. The \cs{exp_end:} prevents -% losing braces around the user-inserted text if any, and stops the -% expansion of \cs{exp:w}. The group is used to prevent -% |\LaTeX3~error:| from being globally equal to \cs{scan_stop:}. +% which is \cs{???} \meta{space} |!| \meta{error type} |:| \meta{error message}. % \begin{macrocode} -\group_begin: -\cs_set_protected:Npn \@@_tmp:w #1#2 +\cs_set_protected:Npn \@@_tmp:w #1 { - \cs_new:Npn \@@_expandable_error:n ##1 + \cs_new:Npn #1 ? { } + \cs_new:Npn \@@_expandable_error:nn ##1##2 { - \exp:w \exp_after:wN \exp_after:wN - \exp_after:wN \@@_expandable_error:w - \exp_after:wN \exp_after:wN - \exp_after:wN \exp_end: - \use:n { #1 #2 ##1 } #2 + \exp_after:wN \@@_use_none_delimit_by_s_stop:w + \use:n { #1 ~ ! ~ ##2 : ~ ##1 } \s_@@_stop } - \cs_new:Npn \@@_expandable_error:w ##1 #2 ##2 #2 {##1} } -\exp_args:Ncx \@@_tmp:w { LaTeX3~error: } - { \char_generate:nn { `\ } { 7 } } -\group_end: -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro} -% { -% \__kernel_msg_expandable_error:nnnnnn, -% \__kernel_msg_expandable_error:nnnnn, -% \__kernel_msg_expandable_error:nnnn, -% \__kernel_msg_expandable_error:nnn, -% \__kernel_msg_expandable_error:nn, -% \__kernel_msg_expandable_error:nnffff, -% \__kernel_msg_expandable_error:nnfff, -% \__kernel_msg_expandable_error:nnff, -% \__kernel_msg_expandable_error:nnf, -% } -% The command built from the csname -% \cs{c_@@_text_prefix_tl} |LaTeX / #1 / #2| -% takes four arguments and builds the error text, which is fed to -% \cs{@@_expandable_error:n} with appropriate expansion: just as for -% usual messages the arguments are first turned to strings, then the -% message is fully expanded. -% \begin{macrocode} -\exp_args_generate:n { oooo } -\cs_new:Npn \__kernel_msg_expandable_error:nnnnnn #1#2#3#4#5#6 - { - \exp_args:Ne \@@_expandable_error:n - { - \exp_args:Nc \exp_args:Noooo - { \c_@@_text_prefix_tl LaTeX / #1 / #2 } - { \tl_to_str:n {#3} } - { \tl_to_str:n {#4} } - { \tl_to_str:n {#5} } - { \tl_to_str:n {#6} } - } - } -\cs_new:Npn \__kernel_msg_expandable_error:nnnnn #1#2#3#4#5 - { - \__kernel_msg_expandable_error:nnnnnn - {#1} {#2} {#3} {#4} {#5} { } - } -\cs_new:Npn \__kernel_msg_expandable_error:nnnn #1#2#3#4 - { - \__kernel_msg_expandable_error:nnnnnn - {#1} {#2} {#3} {#4} { } { } - } -\cs_new:Npn \__kernel_msg_expandable_error:nnn #1#2#3 - { - \__kernel_msg_expandable_error:nnnnnn - {#1} {#2} {#3} { } { } { } - } -\cs_new:Npn \__kernel_msg_expandable_error:nn #1#2 - { - \__kernel_msg_expandable_error:nnnnnn - {#1} {#2} { } { } { } { } - } -\cs_generate_variant:Nn \__kernel_msg_expandable_error:nnnnnn { nnffff } -\cs_generate_variant:Nn \__kernel_msg_expandable_error:nnnnn { nnfff } -\cs_generate_variant:Nn \__kernel_msg_expandable_error:nnnn { nnff } -\cs_generate_variant:Nn \__kernel_msg_expandable_error:nnn { nnf } +\exp_args:Nc \@@_tmp:w { ??? } % \end{macrocode} % \end{macro} % @@ -2303,12 +2087,17 @@ % \msg_expandable_error:nnff , % \msg_expandable_error:nnf % } -% \begin{macro}{\@@_expandable_error_module:nn} -% Pass to an auxiliary the message to display and the module name +% The command built from the csname +% \cs{c_@@_text_prefix_tl} |#1 / #2| +% takes four arguments and builds the error text, which is fed to +% \cs{@@_expandable_error:n} with appropriate expansion: just as for +% usual messages the arguments are first turned to strings, then the +% message is fully expanded. The module name also has to be determined. % \begin{macrocode} +\exp_args_generate:n { oooo } \cs_new:Npn \msg_expandable_error:nnnnnn #1#2#3#4#5#6 { - \exp_args:Ne \@@_expandable_error_module:nn + \exp_args:Nee \@@_expandable_error:nn { \exp_args:Nc \exp_args:Noooo { \c_@@_text_prefix_tl #1 / #2 } @@ -2317,7 +2106,7 @@ { \tl_to_str:n {#5} } { \tl_to_str:n {#6} } } - {#1} + { \msg_error_text:n {#1} } } \cs_new:Npn \msg_expandable_error:nnnnn #1#2#3#4#5 { \msg_expandable_error:nnnnnn {#1} {#2} {#3} {#4} {#5} { } } @@ -2331,15 +2120,28 @@ \cs_generate_variant:Nn \msg_expandable_error:nnnnn { nnfff } \cs_generate_variant:Nn \msg_expandable_error:nnnn { nnff } \cs_generate_variant:Nn \msg_expandable_error:nnn { nnf } -\cs_new:Npn \@@_expandable_error_module:nn #1#2 +% \end{macrocode} +% \end{macro} +% +% \subsection{Message formatting} +% +% \begin{macrocode} +\prop_gput:Nnn \g_msg_module_name_prop { kernel } { LaTeX3 } +\prop_gput:Nnn \g_msg_module_type_prop { kernel } { } +\clist_map_inline:nn { - \exp_after:wN \exp_after:wN - \exp_after:wN \@@_use_none_delimit_by_s_stop:w - \use:n { \::error ! ~ #2 : ~ #1 } \s_@@_stop + char , clist , coffin , debug , deprecation , msg , + quark , prg , prop , scanmark , seq , sys } + { + \prop_gput:Nnn \g_msg_module_name_prop {#1} { LaTeX3 } + \prop_gput:Nnn \g_msg_module_type_prop {#1} { } + } +\prop_gput:Nnn \g_msg_module_name_prop { LaTeX / cmd } { LaTeX3 } +\prop_gput:Nnn \g_msg_module_type_prop { LaTeX / cmd } { } +\prop_gput:Nnn \g_msg_module_name_prop { LaTeX / ltcmd } { LaTeX3 } +\prop_gput:Nnn \g_msg_module_type_prop { LaTeX / ltcmd } { } % \end{macrocode} -% \end{macro} -% \end{macro} % % \begin{macrocode} %</package> |