diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-23 17:15:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-23 17:15:00 +0000 |
commit | 134349701bddf7cbbacf6030c6b9f9838aff96fa (patch) | |
tree | ec1140c46e1c0347a671a6fa3cf8af5a79e95f93 /Master/texmf-dist/source/latex/l3kernel/l3msg.dtx | |
parent | f7855c12c18bb97b7b9e49ab685ee558d8c0b47b (diff) |
l3kernel 3990 (17jul12)
git-svn-id: svn://tug.org/texlive/trunk@27108 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 | 1823 |
1 files changed, 993 insertions, 830 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 89362b7e7d4..a545ab5e126 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -35,8 +35,8 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3msg.dtx 3568 2012-04-23 13:23:58Z joseph $ - {L3 Experimental messages} +\GetIdInfo$Id: l3msg.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Messages} %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -91,12 +91,7 @@ % % \section{Creating new messages} % -% ^^A Wrong: "\msg_new:nnnn" is (as it should) global. -% ^^A However, redirections are indeed local. -% All messages have to be created before they can be used. All message -% setting is local, with the general assumption that messages will -% be managed as part of module set up outside of any \TeX{} grouping. -% +% All messages have to be created before they can be used. % The text of messages will automatically by wrapped to the length % available in the console. As a result, formatting is only needed % where it will help to show meaning. In particular, |\\| may be @@ -124,9 +119,8 @@ % \meta{more text} if the user requests it. If no \meta{more text} is % available then a standard text is given instead. Within \meta{text} % and \meta{more text} four parameters (|#1| to |#4|) can be used: -% these will be supplied at the time the message is used. The -% parameters will be expanded when the message is used. An error will -% be raised if the \meta{message} already exists. +% these will be supplied at the time the message is +% used. An error will be raised if the \meta{message} already exists. % \end{function} % % \begin{function}{\msg_set:nnnn, \msg_set:nnn, \msg_gset:nnnn, \msg_gset:nnn} @@ -138,11 +132,10 @@ % \meta{more text} if the user requests it. If no \meta{more text} is % available then a standard text is given instead. Within \meta{text} % and \meta{more text} four parameters (|#1| to |#4|) can be used: -% these will be supplied at the time the message is used. The -% parameters will be expanded when the message is used. +% these will be supplied at the time the message is used. % \end{function} % -% \begin{function}[EXP,pTF, added=2012-03-03]{\msg_if_exist:nn} +% \begin{function}[EXP, pTF, added = 2012-03-03]{\msg_if_exist:nn} % \begin{syntax} % \cs{msg_if_exist_p:nn} \Arg{module} \Arg{message} % \cs{msg_if_exist:nnTF} \Arg{module} \Arg{message} \Arg{true code} \Arg{false code} @@ -169,33 +162,15 @@ % Prints the current line number when a message is given. % \end{function} % -% \begin{variable}{\c_msg_return_text_tl} -% Standard text to indicate that the user should try pressing -% \meta{return} to continue. The standard definition reads: -% \begin{verbatim} -% Try typing <return> to proceed. -% -% If that doesn't work, type X <return> to quit. -% \end{verbatim} -% \end{variable} -% -% \begin{variable}{\c_msg_trouble_text_tl} -% Standard text to indicate that the more errors are likely and -% that aborting the run is advised. The standard definition reads: -% \begin{verbatim} -% More errors will almost certainly follow: -% the LaTeX run should be aborted. -% \end{verbatim} -% \end{variable} -% % \begin{function}[EXP]{\msg_fatal_text:n} % \begin{syntax} % \cs{msg_fatal_text:n} \Arg{module} % \end{syntax} -% Produces the standard text: -% \begin{verbatim} -% Fatal <module> error -% \end{verbatim} +% Produces the standard text +% \begin{quote} +% \ttfamily +% Fatal \meta{module} error +% \end{quote} % This function can be redefined to alter the language in which the % message is given, using |#1| as the name of the \meta{module} to % be included. @@ -205,10 +180,11 @@ % \begin{syntax} % \cs{msg_critical_text:n} \Arg{module} % \end{syntax} -% Produces the standard text: -% \begin{verbatim} -% Critical <module> error -% \end{verbatim} +% Produces the standard text +% \begin{quote} +% \ttfamily +% Critical \meta{module} error +% \end{quote} % This function can be redefined to alter the language in which the % message is given, using |#1| as the name of the \meta{module} to % be included. @@ -218,10 +194,11 @@ % \begin{syntax} % \cs{msg_error_text:n} \Arg{module} % \end{syntax} -% Produces the standard text: -% \begin{verbatim} -% <module> error -% \end{verbatim} +% Produces the standard text +% \begin{quote} +% \ttfamily +% \meta{module} error +% \end{quote} % This function can be redefined to alter the language in which the % message is given, using |#1| as the name of the \meta{module} to % be included. @@ -231,10 +208,11 @@ % \begin{syntax} % \cs{msg_warning_text:n} \Arg{module} % \end{syntax} -% Produces the standard text: -% \begin{verbatim} -% <module> warning -% \end{verbatim} +% Produces the standard text +% \begin{quote} +% \ttfamily +% \meta{module} warning +% \end{quote} % This function can be redefined to alter the language in which the % message is given, using |#1| as the name of the \meta{module} to % be included. @@ -245,161 +223,184 @@ % \cs{msg_info_text:n} \Arg{module} % \end{syntax} % Produces the standard text: -% \begin{verbatim} -% <module> info -% \end{verbatim} +% \begin{quote} +% \ttfamily +% \meta{module} info +% \end{quote} % This function can be redefined to alter the language in which the % message is given, using |#1| as the name of the \meta{module} to % be included. % \end{function} -% -% \section{Issuing messages} -% -% Messages behave differently depending on the message class. A number -% of standard message classes are supplied, but more can be -% created. -% -% When issuing messages, any arguments passed should use -% \cs{tl_to_str:n} or \cs{token_to_str:N} to prevent unwanted expansion -% of the material. -% -% \begin{function}[updated = 2012-04-12]{\msg_class_set:nn} +% +% \begin{function}[EXP]{\msg_see_documentation_text:n} % \begin{syntax} -% \cs{msg_class_set:nn} \Arg{class} \Arg{code} +% \cs{msg_see_documentation_text:n} \Arg{module} % \end{syntax} -% Sets a \meta{class} to output a message, using \meta{code} -% to process the message text. The \meta{class} should be a text -% value, while the \meta{code} may be any arbitrary material. -% The \meta{code} will receive~$6$ arguments: the module -% name (|#1|), the message name (|#2|) and the four arguments -% taken by the message text (|#3| to |#6|). -% ^^A Add an example? An application could be that an IDE redirects -% ^^A classes from 'error' to 'IDEerror', 'warning' to 'IDEwarning', -% ^^A etc, and defines 'IDEerror' and 'IDEwarning' to produce messages -% ^^A which are simpler to parse. +% Produces the standard text +% \begin{quote} +% \ttfamily +% +% See the \meta{module} documentation for further information. +% \end{quote} +% This function can be redefined to alter the language in which the +% message is given, using |#1| as the name of the \meta{module} to +% be included. % \end{function} % -% The kernel defines several common message classes. The following -% describes the standard behaviour of each class if no redirection of -% the class or message is active. In all cases, the message may be -% issued supplying~$0$ to~$4$ arguments. The code will -% ensure that there an no errors if the number of arguments supplied -% here does not match the number in the definition of the message -% (although of course the sense of the message may be impaired). +% \section{Issuing messages} +% +% Messages behave differently depending on the message class. In all cases, +% the message may be issued supplying~$0$ to~$4$ arguments. If the number of +% arguments supplied here does not match the number in the definition of the +% message, extra arguments will be ignored, or empty arguments added (of +% course the sense of the message may be impaired). The four arguments will +% be converted to strings before being added to the message text: the +% \texttt{x}-type variants should be used to expand material. % -% \begin{function} +% \begin{function}[updated = 2012-06-29] % { +% \msg_fatal:nnnnnn , +% \msg_fatal:nnnnn , +% \msg_fatal:nnnn , +% \msg_fatal:nnn , +% \msg_fatal:nn , % \msg_fatal:nnxxxx , % \msg_fatal:nnxxx , % \msg_fatal:nnxx , -% \msg_fatal:nnx , -% \msg_fatal:nn +% \msg_fatal:nnx % } % \begin{syntax} -% \cs{msg_fatal:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_fatal:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues \meta{module} error \meta{message}, passing \meta{arg one} to % \meta{arg four} to the text-creating functions. After issuing a % fatal error the \TeX{} run will halt. % \end{function} % -% \begin{function} +% \begin{function}[updated = 2012-06-29] % { +% \msg_critical:nnnnnn , +% \msg_critical:nnnnn , +% \msg_critical:nnnn , +% \msg_critical:nnn , +% \msg_critical:nn , % \msg_critical:nnxxxx , % \msg_critical:nnxxx , % \msg_critical:nnxx , -% \msg_critical:nnx , -% \msg_critical:nn +% \msg_critical:nnx % } % \begin{syntax} -% \cs{msg_critical:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_critical:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues \meta{module} error \meta{message}, passing \meta{arg one} to -% \meta{arg four} to the text-creating functions. After issuing the -% message reading the current input file will stop. This may halt -% the \TeX{} run (if the current file is the main file) or -% may abort reading a sub-file. +% \meta{arg four} to the text-creating functions. After issuing a +% critical error, \TeX{} will stop reading the current input file. +% This may halt the \TeX{} run (if the current file is the main file) +% or may abort reading a sub-file. +% \begin{texnote} +% The \TeX{} \tn{endinput} primitive is used to exit the file. In +% particular, the rest of the current line remains in the input +% stream. ^^A Can we fix that? +% \end{texnote} % \end{function} -% ^^A Perhaps add detection that we are in the main file to really do -% ^^A '\tex_end:D' in that case? % -% \begin{function} +% \begin{function}[updated = 2012-06-29] % { +% \msg_error:nnnnnn , +% \msg_error:nnnnn , +% \msg_error:nnnn , +% \msg_error:nnn , +% \msg_error:nn , % \msg_error:nnxxxx , % \msg_error:nnxxx , % \msg_error:nnxx , -% \msg_error:nnx , -% \msg_error:nn +% \msg_error:nnx % } % \begin{syntax} -% \cs{msg_error:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_error:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues \meta{module} error \meta{message}, passing \meta{arg one} to -% \meta{arg four} to the text-creating functions. The error will -% stop processing and issue the text at the terminal. After user input, -% the run will continue. +% \meta{arg four} to the text-creating functions. The error will +% interrupt processing and issue the text at the terminal. After user +% input, the run will continue. % \end{function} % -% \begin{function} -% { -% \msg_warning:nnxxxx , -% \msg_warning:nnxxx , -% \msg_warning:nnxx , -% \msg_warning:nnx , -% \msg_warning:nn -% } -% \begin{syntax} -% \cs{msg_warning:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} -% \end{syntax} -% Issues \meta{module} warning \meta{message}, passing \meta{arg one} to -% \meta{arg four} to the text-creating functions. The warning text -% will be added to the log file, but the \TeX{} run will not be -% interrupted. -% \end{function} +% \begin{function}[updated = 2012-06-29] +% { +% \msg_warning:nnnnnn , +% \msg_warning:nnnnn , +% \msg_warning:nnnn , +% \msg_warning:nnn , +% \msg_warning:nn , +% \msg_warning:nnxxxx , +% \msg_warning:nnxxx , +% \msg_warning:nnxx , +% \msg_warning:nnx +% } +% \begin{syntax} +% \cs{msg_warning:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \end{syntax} +% Issues \meta{module} warning \meta{message}, passing \meta{arg one} +% to \meta{arg four} to the text-creating functions. The warning text +% will be added to the log file and the terminal, but the \TeX{} run +% will not be interrupted. +% \end{function} % -% \begin{function} +% \begin{function}[updated = 2012-06-29] % { +% \msg_info:nnnnnn , +% \msg_info:nnnnn , +% \msg_info:nnnn , +% \msg_info:nnn , +% \msg_info:nn , % \msg_info:nnxxxx , % \msg_info:nnxxx , % \msg_info:nnxx , -% \msg_info:nnx , -% \msg_info:nn +% \msg_info:nnx % } % \begin{syntax} -% \cs{msg_info:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_info:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues \meta{module} information \meta{message}, passing % \meta{arg one} to \meta{arg four} to the text-creating functions. % The information text will be added to the log file. % \end{function} % -% \begin{function} +% \begin{function}[updated = 2012-07-14] % { +% \msg_log:nnnnnn , +% \msg_log:nnnnn , +% \msg_log:nnnn , +% \msg_log:nnn , +% \msg_log:nn , % \msg_log:nnxxxx , % \msg_log:nnxxx , % \msg_log:nnxx , -% \msg_log:nnx , -% \msg_log:nn +% \msg_log:nnx % } % \begin{syntax} -% \cs{msg_log:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_log:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues \meta{module} information \meta{message}, passing % \meta{arg one} to \meta{arg four} to the text-creating functions. % The information text will be added to the log file: the output -% is briefer than \cs{msg_info:nnxxxx}. +% is briefer than \cs{msg_info:nnnnnn}. % \end{function} % -% \begin{function} +% \begin{function}[updated = 2012-06-29] % { +% \msg_none:nnnnnn , +% \msg_none:nnnnn , +% \msg_none:nnnn , +% \msg_none:nnn , +% \msg_none:nn , % \msg_none:nnxxxx , % \msg_none:nnxxx , % \msg_none:nnxx , -% \msg_none:nnx , -% \msg_none:nn +% \msg_none:nnx % } % \begin{syntax} -% \cs{msg_none:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_none:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Does nothing: used as a message class to prevent any output at % all (see the discussion of message redirection). @@ -434,18 +435,23 @@ % it is possible to select out an individual message for special treatment % even if the entire class is already redirected. % -% \begin{function}[updated = 2012-04-12]{\msg_redirect_class:nn} +% Multiple redirections are possible. Redirections can be cancelled by +% providing an empty argument for the target class. Redirection to a +% missing class will raise errors immediately. Infinite loops are +% prevented by eliminating the redirection starting from the target of +% the redirection that caused the loop to appear. Namely, if +% redirections are requested as $A \to B$, $B \to C$ and $C \to A$ in +% this order, then the $A \to B$ redirection is cancelled. +% +% \begin{function}[updated = 2012-04-27]{\msg_redirect_class:nn} % \begin{syntax} % \cs{msg_redirect_class:nn} \Arg{class one} \Arg{class two} % \end{syntax} % Changes the behaviour of messages of \meta{class one} so that they -% are processed using the code for those of \meta{class two}. Multiple -% redirections are possible. Redirection to a missing class or -% infinite loops will raise errors when the messages are used, -% rather than at the point of redirection. +% are processed using the code for those of \meta{class two}. % \end{function} % -% \begin{function}[updated = 2012-04-12]{\msg_redirect_module:nnn} +% \begin{function}[updated = 2012-04-27]{\msg_redirect_module:nnn} % \begin{syntax} % \cs{msg_redirect_module:nnn} \Arg{module} \Arg{class one} \Arg{class two} % \end{syntax} @@ -460,14 +466,14 @@ % \end{verbatim} % \end{function} % -% \begin{function}[updated = 2012-04-12]{\msg_redirect_name:nnn} +% \begin{function}[updated = 2012-04-27]{\msg_redirect_name:nnn} % \begin{syntax} % \cs{msg_redirect_name:nnn} \Arg{module} \Arg{message} \Arg{class} % \end{syntax} -% Redirects a specific \meta{message} from a specific \meta{module} -% to act as a member of \meta{class} of messages. This function can -% be used to make a selected message \enquote{silent} without -% changing global parameters: +% Redirects a specific \meta{message} from a specific \meta{module} to +% act as a member of \meta{class} of messages. No further redirection +% is performed. This function can be used to make a selected message +% \enquote{silent} without changing global parameters: % \begin{verbatim} % \msg_redirect_name:nnn { module } { annoying-message } { none } % \end{verbatim} @@ -479,18 +485,9 @@ % higher-level system. However, there are occasions where direct % access to these functions is desirable. % -% \begin{function}[EXP]{\msg_newline:, \msg_two_newlines:} -% \begin{syntax} -% \cs{msg_newline:} -% \end{syntax} -% Forces a new line in a message. This is a low-level function, which -% will not include any additional printing information in the message: -% contrast with |\\| in messages. The |two| version adds two lines. -% \end{function} -% -% \begin{function}{\msg_interrupt:xxx} +% \begin{function}[added = 2012-06-28]{\msg_interrupt:nnn} % \begin{syntax} -% \cs{msg_interrupt:xxx} \Arg{first line} \Arg{text} \Arg{extra text} +% \cs{msg_interrupt:nnn} \Arg{first line} \Arg{text} \Arg{extra text} % \end{syntax} % Interrupts the \TeX{} run, issuing a formatted message comprising % \meta{first line} and \meta{text} laid out in the format @@ -511,13 +508,15 @@ % | <extra text> % |............................................... % \end{verbatim} -% where the \meta{extra text} will be wrapped to fit within the current -% line length. +% where the \meta{extra text} will be wrapped within the current +% line length. Wrapping of both \meta{text} and \meta{more text} takes place +% using \cs{iow_wrap:nnnN}; the documentation for the latter should be +% consulted for full details. % \end{function} % -% \begin{function}{\msg_log:x} +% \begin{function}[added = 2012-06-28]{\msg_log:n} % \begin{syntax} -% \cs{msg_log:x} \Arg{text} +% \cs{msg_log:n} \Arg{text} % \end{syntax} % Writes to the log file with the \meta{text} laid out in the format % \begin{verbatim} @@ -526,12 +525,13 @@ % ................................................. % \end{verbatim} % where the \meta{text} will be wrapped to fit within the current -% line length. +% line length. Wrapping takes place using \cs{iow_wrap:nnnN}; the +% documentation for the latter should be consulted for full details. % \end{function} % -% \begin{function}{\msg_term:x} +% \begin{function}[added = 2012-06-28]{\msg_term:n} % \begin{syntax} -% \cs{msg_term:x} \Arg{text} +% \cs{msg_term:n} \Arg{text} % \end{syntax} % Writes to the terminal and log file with the \meta{text} laid out in the % format @@ -541,7 +541,8 @@ % ************************************************* % \end{verbatim} % where the \meta{text} will be wrapped to fit within the current -% line length. +% line length. Wrapping takes place using \cs{iow_wrap:nnnN}; the +% documentation for the latter should be consulted for full details. % \end{function} % % \section{Kernel-specific functions} @@ -551,59 +552,65 @@ % and also ensures that serious errors can be handled properly. % % \begin{function}[updated = 2011-08-16] -% {\msg_kernel_new:nnnn, \msg_kernel_new:nnn} +% {\__msg_kernel_new:nnnn, \__msg_kernel_new:nnn} % \begin{syntax} -% \cs{msg_kernel_new:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} +% \cs{__msg_kernel_new:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} % \end{syntax} % Creates a kernel \meta{message} for a given \meta{module}. % The message will be defined to first give \meta{text} and then % \meta{more text} if the user requests it. If no \meta{more text} is % available then a standard text is given instead. Within \meta{text} % and \meta{more text} four parameters (|#1| to |#4|) can be used: -% these will be supplied at the time the message is used. The -% parameters will be expanded when the message is used. An error will -% be raised if the \meta{message} already exists. +% these will be supplied and expanded at the time the message is used. +% An error will be raised if the \meta{message} already exists. % \end{function} % -% \begin{function}{\msg_kernel_set:nnnn, \msg_kernel_set:nnn} +% \begin{function}{\__msg_kernel_set:nnnn, \__msg_kernel_set:nnn} % \begin{syntax} -% \cs{msg_kernel_set:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} +% \cs{__msg_kernel_set:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} % \end{syntax} % Sets up the text for a kernel \meta{message} for a given \meta{module}. % The message will be defined to first give \meta{text} and then % \meta{more text} if the user requests it. If no \meta{more text} is % available then a standard text is given instead. Within \meta{text} % and \meta{more text} four parameters (|#1| to |#4|) can be used: -% these will be supplied at the time the message is used. The -% parameters will be expanded when the message is used. +% these will be supplied and expanded at the time the message is used. % \end{function} % -% \begin{function} +% \begin{function}[updated = 2012-06-29] % { -% \msg_kernel_fatal:nnxxxx , -% \msg_kernel_fatal:nnxxx , -% \msg_kernel_fatal:nnxx , -% \msg_kernel_fatal:nnx , -% \msg_kernel_fatal:nn +% \__msg_kernel_fatal:nnnnnn , +% \__msg_kernel_fatal:nnnnn , +% \__msg_kernel_fatal:nnnn , +% \__msg_kernel_fatal:nnn , +% \__msg_kernel_fatal:nn , +% \__msg_kernel_fatal:nnxxxx , +% \__msg_kernel_fatal:nnxxx , +% \__msg_kernel_fatal:nnxx , +% \__msg_kernel_fatal:nnx % } % \begin{syntax} -% \cs{msg_kernel_fatal:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{__msg_kernel_fatal:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues kernel \meta{module} error \meta{message}, passing \meta{arg one} % to \meta{arg four} to the text-creating functions. After issuing a % fatal error the \TeX{} run will halt. Cannot be redirected. % \end{function} % -% \begin{function} +% \begin{function}[updated = 2012-06-29] % { -% \msg_kernel_error:nnxxxx , -% \msg_kernel_error:nnxxx , -% \msg_kernel_error:nnxx , -% \msg_kernel_error:nnx , -% \msg_kernel_error:nn +% \__msg_kernel_error:nnnnnn , +% \__msg_kernel_error:nnnnn , +% \__msg_kernel_error:nnnn , +% \__msg_kernel_error:nnn , +% \__msg_kernel_error:nn , +% \__msg_kernel_error:nnxxxx , +% \__msg_kernel_error:nnxxx , +% \__msg_kernel_error:nnxx , +% \__msg_kernel_error:nnx % } % \begin{syntax} -% \cs{msg_kernel_error:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{__msg_kernel_error:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues kernel \meta{module} error \meta{message}, passing \meta{arg one} % to @@ -612,34 +619,42 @@ % the run will continue. Cannot be redirected. % \end{function} % -% \begin{function} -% { -% \msg_kernel_warning:nnxxxx , -% \msg_kernel_warning:nnxxx , -% \msg_kernel_warning:nnxx , -% \msg_kernel_warning:nnx , -% \msg_kernel_warning:nn -% } -% \begin{syntax} -% \cs{msg_kernel_warning:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} -% \end{syntax} -% Issues kernel \meta{module} warning \meta{message}, passing -% \meta{arg one} to -% \meta{arg four} to the text-creating functions. The warning text -% will be added to the log file, but the \TeX{} run will not be -% interrupted. -% \end{function} +% \begin{function}[updated = 2012-06-29] +% { +% \__msg_kernel_warning:nnnnnn , +% \__msg_kernel_warning:nnnnn , +% \__msg_kernel_warning:nnnn , +% \__msg_kernel_warning:nnn , +% \__msg_kernel_warning:nn , +% \__msg_kernel_warning:nnxxxx , +% \__msg_kernel_warning:nnxxx , +% \__msg_kernel_warning:nnxx , +% \__msg_kernel_warning:nnx +% } +% \begin{syntax} +% \cs{__msg_kernel_warning:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \end{syntax} +% Issues kernel \meta{module} warning \meta{message}, passing +% \meta{arg one} to +% \meta{arg four} to the text-creating functions. The warning text +% will be added to the log file, but the \TeX{} run will not be +% interrupted. +% \end{function} % -% \begin{function} +% \begin{function}[updated = 2012-06-29] % { -% \msg_kernel_info:nnxxxx , -% \msg_kernel_info:nnxxx , -% \msg_kernel_info:nnxx , -% \msg_kernel_info:nnx , -% \msg_kernel_info:nn +% \__msg_kernel_info:nnnnnn , +% \__msg_kernel_info:nnnnn , +% \__msg_kernel_info:nnnn , +% \__msg_kernel_info:nnn , +% \__msg_kernel_info:nn , +% \__msg_kernel_info:nnxxxx , +% \__msg_kernel_info:nnxxx , +% \__msg_kernel_info:nnxx , +% \__msg_kernel_info:nnx % } % \begin{syntax} -% \cs{msg_kernel_info:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{__msg_kernel_info:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues kernel \meta{module} information \meta{message}, passing % \meta{arg one} to \meta{arg four} to the text-creating functions. @@ -658,14 +673,14 @@ % % \begin{function}[EXP, added = 2011-11-23] % { -% \msg_expandable_kernel_error:nnnnnn, -% \msg_expandable_kernel_error:nnnnn, -% \msg_expandable_kernel_error:nnnn, -% \msg_expandable_kernel_error:nnn, -% \msg_expandable_kernel_error:nn +% \__msg_kernel_expandable_error:nnnnnn, +% \__msg_kernel_expandable_error:nnnnn, +% \__msg_kernel_expandable_error:nnnn, +% \__msg_kernel_expandable_error:nnn, +% \__msg_kernel_expandable_error:nn % } % \begin{syntax} -% \cs{msg_expandable_kernel_error:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{__msg_kernel_expandable_error:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues an error, passing \meta{arg one} to \meta{arg four} % to the text-creating functions. The resulting string must @@ -673,9 +688,9 @@ % \end{function} % % \begin{function}[EXP, added = 2011-08-11, updated = 2011-08-13] -% {\msg_expandable_error:n} +% {\__msg_expandable_error:n} % \begin{syntax} -% \cs{msg_expandable_error:n} \Arg{error message} +% \cs{__msg_expandable_error:n} \Arg{error message} % \end{syntax} % Issues an \enquote{Undefined error} message from \TeX{} itself, % and prints the \meta{error message}. The \meta{error message} @@ -692,30 +707,53 @@ % % The following functions are used in several kernel modules. % -% \begin{function}{\msg_aux_use:nn, \msg_aux_use:nnxxxx} +% \begin{function} +% { +% \__msg_term:nnnnnn, +% \__msg_term:nnnnnV, +% \__msg_term:nnnnn, +% \__msg_term:nnn , +% \__msg_term:nn +% } % \begin{syntax} -% \cs{msg_aux_use:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{__msg_term:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} -% Prints the \meta{message} from \meta{module} in the terminal, -% without formatting. +% Prints the \meta{message} from \meta{module} in the terminal without +% formatting. Used in messages which print complex variable contents +% completely. % \end{function} -% -% \begin{function}{\msg_aux_show:x} +% +% \begin{function}{\__msg_show_variable:Nnn, \__msg_show_variable:Nnx} % \begin{syntax} -% \cs{msg_aux_show:x} \Arg{formatted string} +% \cs{__msg_show_variable:Nnn} \meta{variable} \Arg{type} \Arg{formatted content} +% \end{syntax} +% Displays the \meta{formatted content} of the \meta{variable} of \meta{type} +% in the terminal. The \meta{formatted content} will typically be generated +% by \texttt{x}-type expansion using the \cs{__msg_show_variable:Nnx} variant: +% the nature of the formatting is dependent on the calling module. +% \end{function} +% +% \begin{function}{\__msg_show_variable:n, \__msg_show_variable:x} +% \begin{syntax} +% \cs{__msg_show_variable:n} \Arg{formatted string} % \end{syntax} % Shows the \meta{formatted string} on the terminal. After expansion, % unless it is empty, the \meta{formatted string} must contain |>|, % and the part of \meta{formatted string} before the first |>| is % removed. Failure to do so causes low-level \TeX{} errors. % \end{function} -% -% \begin{function}{\msg_aux_show:Nnx} +% +% \begin{function} +% {\__msg_show_item:n, \__msg_show_item:nn, \__msg_show_item_unbraced:nn} % \begin{syntax} -% \cs{msg_aux_show:Nnx} \meta{variable} \Arg{module} \Arg{token list} +% \cs{__msg_show_item:n} \meta{item} +% \cs{__msg_show_item:nn} \meta{item-key} \meta{item-value} % \end{syntax} -% Auxiliary common to \pkg{l3clist}, \pkg{l3prop} and \pkg{seq}, -% which displays an appropriate message and the contents of the variable. +% Auxiliary functions used within the argument of +% \cs{__msg_show_variable:Nnx} to format variable items correctly for +% display. The \cs{__msg_show_item:n} version is used for simple lists, +% the \cs{__msg_show_item:nn} and \cs{__msg_show_item_ubraced:nn} versions +% for key--value like data structures. % \end{function} % % \end{documentation} @@ -727,19 +765,23 @@ % \begin{macrocode} %<*initex|package> % \end{macrocode} +% +% \begin{macrocode} +%<@@=msg> +% \end{macrocode} % % \begin{macrocode} %<*package> \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: %</package> % \end{macrocode} % -% \begin{variable}{\l_msg_internal_tl} +% \begin{variable}{\l_@@_internal_tl} % A general scratch for the module. % \begin{macrocode} -\tl_new:N \l_msg_internal_tl +\tl_new:N \l_@@_internal_tl % \end{macrocode} % \end{variable} % @@ -749,11 +791,11 @@ % the code here. First, a mechanism for creating message text. % This is pretty simple, as there is not actually a lot to do. % -% \begin{variable}{\c_msg_text_prefix_tl, \c_msg_more_text_prefix_tl} +% \begin{variable}{\c_@@_text_prefix_tl, \c_@@_more_text_prefix_tl} % Locations for the text of messages. % \begin{macrocode} -\tl_const:Nn \c_msg_text_prefix_tl { msg~text~>~ } -\tl_const:Nn \c_msg_more_text_prefix_tl { msg~extra~text~>~ } +\tl_const:Nn \c_@@_text_prefix_tl { msg~text~>~ } +\tl_const:Nn \c_@@_more_text_prefix_tl { msg~extra~text~>~ } % \end{macrocode} % \end{variable} % @@ -763,37 +805,37 @@ % \begin{macrocode} \prg_new_conditional:Npnn \msg_if_exist:nn #1#2 { p , T , F , TF } { - \cs_if_exist:cTF { \c_msg_text_prefix_tl #1 / #2 } + \cs_if_exist:cTF { \c_@@_text_prefix_tl #1 / #2 } { \prg_return_true: } { \prg_return_false: } } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\chk_if_free_msg:nn} -% This auxiliary is similar to \cs{chk_if_free_cs:N}, and is used when +% \begin{macro}[aux]{\__chk_if_free_msg:nn} +% This auxiliary is similar to \cs{__chk_if_free_cs:N}, and is used when % defining messages with \cs{msg_new:nnnn}. It could be inlined in % \cs{msg_new:nnnn}, but the experimental \pkg{l3trace} module needs % to disable this check when reloading a package with the extra % tracing information. % \begin{macrocode} -\cs_new_protected:Npn \chk_if_free_msg:nn #1#2 +\cs_new_protected:Npn \__chk_if_free_msg:nn #1#2 { \msg_if_exist:nnT {#1} {#2} { - \msg_kernel_error:nnxx { msg } { message-already-defined } + \@@_kernel_error:nnxx { kernel } { message-already-defined } {#1} {#2} } } %<*package> \tex_ifodd:D \l@expl@log@functions@bool - \cs_gset_protected:Npn \chk_if_free_msg:nn #1#2 + \cs_gset_protected:Npn \__chk_if_free_msg:nn #1#2 { \msg_if_exist:nnT {#1} {#2} { - \msg_kernel_error:nnxx { msg } { message-already-defined } + \@@_kernel_error:nnxx { kernel } { message-already-defined } {#1} {#2} } - \iow_log:x { Defining~message~#1/#2~ \msg_line_context: } + \iow_log:x { Defining~message~ #1 / #2 ~\msg_line_context: } } \fi: %</package> @@ -808,25 +850,25 @@ % \begin{macrocode} \cs_new_protected:Npn \msg_new:nnnn #1#2 { - \chk_if_free_msg:nn {#1} {#2} + \__chk_if_free_msg:nn {#1} {#2} \msg_gset:nnnn {#1} {#2} } \cs_new_protected:Npn \msg_new:nnn #1#2#3 { \msg_new:nnnn {#1} {#2} {#3} { } } \cs_new_protected:Npn \msg_set:nnnn #1#2#3#4 { - \cs_set:cpn { \c_msg_text_prefix_tl #1 / #2 } + \cs_set:cpn { \c_@@_text_prefix_tl #1 / #2 } ##1##2##3##4 {#3} - \cs_set:cpn { \c_msg_more_text_prefix_tl #1 / #2 } + \cs_set:cpn { \c_@@_more_text_prefix_tl #1 / #2 } ##1##2##3##4 {#4} } \cs_new_protected:Npn \msg_set:nnn #1#2#3 { \msg_set:nnnn {#1} {#2} {#3} { } } \cs_new_protected:Npn \msg_gset:nnnn #1#2#3#4 { - \cs_gset:cpn { \c_msg_text_prefix_tl #1 / #2 } + \cs_gset:cpn { \c_@@_text_prefix_tl #1 / #2 } ##1##2##3##4 {#3} - \cs_gset:cpn { \c_msg_more_text_prefix_tl #1 / #2 } + \cs_gset:cpn { \c_@@_more_text_prefix_tl #1 / #2 } ##1##2##3##4 {#4} } \cs_new_protected:Npn \msg_gset:nnn #1#2#3 @@ -887,15 +929,7 @@ % \end{macrocode} % \end{variable} % -% \begin{macro}{\msg_newline:, \msg_two_newlines:} -% New lines are printed in the same way as for low-level file writing. -% \begin{macrocode} -\cs_new_nopar:Npn \msg_newline: { ^^J } -\cs_new_nopar:Npn \msg_two_newlines: { ^^J ^^J } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\msg_line_number, \msg_line_context:} +% \begin{macro}{\msg_line_number:, \msg_line_context:} % For writing the line number nicely. \cs{msg_line_context:} was set up % earlier, so this is not \texttt{new}. % \begin{macrocode} @@ -911,7 +945,7 @@ % % \subsection{Showing messages: low level mechanism} % -% \begin{macro}{\msg_interrupt:xxx} +% \begin{macro}{\msg_interrupt:nnn} % The low-level interruption macro is rather opaque, unfortunately. % Depending on the availability of more information there is a choice % of how to set up the further help. We feed the extra help text and @@ -919,36 +953,36 @@ % must first setup \TeX{}'s \tn{errhelp} register before issuing an % \tn{errmessage}. % \begin{macrocode} -\cs_new_protected:Npn \msg_interrupt:xxx #1#2#3 +\cs_new_protected:Npn \msg_interrupt:nnn #1#2#3 { \tl_if_empty:nTF {#3} { - \msg_interrupt_wrap:xx { \\ \c_msg_no_info_text_tl } + \@@_interrupt_wrap:nn { \\ \c_msg_no_info_text_tl } {#1 \\\\ #2 \\\\ \c_msg_continue_text_tl } } { - \msg_interrupt_wrap:xx { \\ #3 } + \@@_interrupt_wrap:nn { \\ #3 } {#1 \\\\ #2 \\\\ \c_msg_help_text_tl } } } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\msg_interrupt_wrap:xx} -% \begin{macro}[aux]{\msg_interrupt_more_text:n} +% \begin{macro}[aux]{\@@_interrupt_wrap:nn} +% \begin{macro}[aux]{\@@_interrupt_more_text:n} % First setup \TeX{}'s \tn{errhelp} register with the extra help |#1|, % then build a nice-looking error message with |#2|. Everything is % done using \texttt{x}-type expansion as the new line markers are % different for the two type of text and need to be correctly set up. -% The auxiliary \cs{msg_interrupt_more_text:n} recieves its argument +% The auxiliary \cs{@@_interrupt_more_text:n} receives its argument % as a line-wrapped string, which is thus unaffected by expansion. % \begin{macrocode} -\cs_new_protected:Npn \msg_interrupt_wrap:xx #1#2 +\cs_new_protected:Npn \@@_interrupt_wrap:nn #1#2 { - \iow_wrap:xnnnN {#1} { | ~ } { 2 } { } \msg_interrupt_more_text:n - \iow_wrap:xnnnN {#2} { ! ~ } { 2 } { } \msg_interrupt_text:n + \iow_wrap:nnnN {#1} { | ~ } { } \@@_interrupt_more_text:n + \iow_wrap:nnnN {#2} { ! ~ } { } \@@_interrupt_text:n } -\cs_new_protected:Npn \msg_interrupt_more_text:n #1 +\cs_new_protected:Npn \@@_interrupt_more_text:n #1 { \exp_args:Nx \tex_errhelp:D { @@ -961,17 +995,16 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\msg_interrupt_text:n} -% \begin{variable}{\c_msg_hide_tl<dots>} +% \begin{macro}[aux]{\@@_interrupt_text:n} % The business end of the process starts by producing some visual % separation of the message from the main part of the log. The error % message needs to be printed with everything made % \enquote{invisible}: \TeX{}'s own information involves the macro in % which \tn{errmessage} is called, and the end of the argument of the % \tn{errmessage}, including the closing brace. We use an active |!| -% to call the \tn{errmessage} primitive, and end its argument with an -% odd \cs{c_msg_hide_tl<dots>} which fills the output with dots. The -% trailing closing brace is turned into a space to hide it as well. +% to call the \tn{errmessage} primitive, and end its argument with +% \cs{use_none:n} \Arg{dots} which fills the output with dots. Two +% trailing closing braces are turned into spaces to hide them as well. % The group in which we alter the definition of the active |!| is % closed before producing the message: this ensures that tokens % inserted by typing |I| in the command-line will bee inserted after @@ -982,13 +1015,10 @@ \char_set_lccode:nn {`\}} {`\ } \char_set_lccode:nn {`\&} {`\!} \char_set_catcode_active:N \& - \char_set_catcode_letter:N \. - \tl_new:N - \c_msg_hide_tl............................................ \tl_to_lowercase:n { \group_end: - \cs_new_protected:Npn \msg_interrupt_text:n #1 + \cs_new_protected:Npn \@@_interrupt_text:n #1 { \iow_term:x { @@ -1003,7 +1033,8 @@ \tex_errmessage:D { #1 - \c_msg_hide_tl............................................ + \use_none:n + { ............................................ } } } \exp_after:wN @@ -1012,27 +1043,24 @@ } } % \end{macrocode} -% \end{variable} % \end{macro} % -% \begin{macro}{\msg_log:x} -% \begin{macro}{\msg_term:x} +% \begin{macro}{\msg_log:n} +% \begin{macro}{\msg_term:n} % Printing to the log or terminal without a stop is rather easier. % A bit of simple visual work sets things off nicely. % \begin{macrocode} -\cs_new_protected:Npn \msg_log:x #1 +\cs_new_protected:Npn \msg_log:n #1 { - \iow_log:x { ................................................. } - \iow_wrap:xnnnN { . ~ #1} { . ~ } { 2 } { } - \iow_log:x - \iow_log:x { ................................................. } + \iow_log:n { ................................................. } + \iow_wrap:nnnN { . ~ #1} { . ~ } { } \iow_log:n + \iow_log:n { ................................................. } } -\cs_new_protected:Npn \msg_term:x #1 +\cs_new_protected:Npn \msg_term:n #1 { - \iow_term:x { ************************************************* } - \iow_wrap:xnnnN { * ~ #1} { * ~ } { 2 } { } - \iow_term:x - \iow_term:x { ************************************************* } + \iow_term:n { ************************************************* } + \iow_wrap:nnnN { * ~ #1} { * ~ } { } \iow_term:n + \iow_term:n { ************************************************* } } % \end{macrocode} % \end{macro} @@ -1041,8 +1069,12 @@ % \subsection{Displaying messages} % % \LaTeX{} is handling error messages and so the \TeX{} ones are disabled. +% This is already done by the \LaTeXe{} kernel, so to avoid messing up any +% deliberate change by a user this is only set in format mode. % \begin{macrocode} -\int_gset:Nn \tex_errorcontextlines:D { -1 } +%<*initex> +\int_gset_eq:NN \tex_errorcontextlines:D \c_minus_one +%</initex> % \end{macrocode} % % \begin{macro} @@ -1054,7 +1086,7 @@ % \msg_info_text:n % } % A function for issuing messages: both the text and order could -% in principal vary. +% in principle vary. % \begin{macrocode} \cs_new:Npn \msg_fatal_text:n #1 { Fatal~#1~error } \cs_new:Npn \msg_critical_text:n #1 { Critical~#1~error } @@ -1065,591 +1097,637 @@ % \end{macro} % % \begin{macro}{\msg_see_documentation_text:n} -% Contextual footer information. +% Contextual footer information. The \LaTeX{} module only comprises +% \LaTeX3 code, so we refer to the \LaTeX3 documentation rather than +% simply \enquote{\LaTeX{}}. % \begin{macrocode} \cs_new:Npn \msg_see_documentation_text:n #1 - { \\ \\ See~the~#1~documentation~for~further~information. } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\msg_class_set:nn} -% Setting up a message class does two tasks. Any existing redirection -% is cleared, and the various message functions are created -% to simply use the code stored for the message. -% \begin{macrocode} -\cs_new_protected:Npn \msg_class_set:nn #1#2 { - \prop_clear_new:c { l_msg_redirect_ #1 _prop } - \cs_set_protected:cpn { msg_ #1 :nnxxxx } ##1##2##3##4##5##6 - { \msg_use:nnnnxxxx {#1} {#2} {##1} {##2} {##3} {##4} {##5} {##6} } - \cs_set_protected:cpx { msg_ #1 :nnxxx } ##1##2##3##4##5 - { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} {##5} { } } - \cs_set_protected:cpx { msg_ #1 :nnxx } ##1##2##3##4 - { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} { } { } } - \cs_set_protected:cpx { msg_ #1 :nnx } ##1##2##3 - { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} { } { } { } } - \cs_set_protected:cpx { msg_ #1 :nn } ##1##2 - { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} { } { } { } { } } + \\ \\ See~the~ + \str_if_eq:nnTF {#1} { LaTeX } { LaTeX3 } {#1} ~ + documentation~for~further~information. } % \end{macrocode} % \end{macro} -% -% \begin{macro}[pTF]{\msg_if_more_text:N, \msg_if_more_text:c} -% \begin{macro}[aux]{\msg_no_more_text:xxxx} -% A test to see if any more text is available, using a -% permanently-empty text function. -% ^^A It would be more efficient to not define the more-text when absent. +% +% \begin{macro}{\@@_class_new:nn} % \begin{macrocode} -\prg_new_conditional:Npnn \msg_if_more_text:N #1 { p , T , F , TF } - { - \cs_if_eq:NNTF #1 \msg_no_more_text:xxxx - { \prg_return_false: } - { \prg_return_true: } - } -\cs_new:Npn \msg_no_more_text:xxxx #1#2#3#4 { } -\cs_generate_variant:Nn \msg_if_more_text_p:N { c } -\cs_generate_variant:Nn \msg_if_more_text:NT { c } -\cs_generate_variant:Nn \msg_if_more_text:NF { c } -\cs_generate_variant:Nn \msg_if_more_text:NTF { c } +\group_begin: + \cs_set_protected:Npn \@@_class_new:nn #1#2 + { + \prop_new:c { l_@@_redirect_ #1 _prop } + \cs_new_protected:cpn { @@_ #1 _code:nnnnnn } ##1##2##3##4##5##6 {#2} + \cs_new_protected:cpn { msg_ #1 :nnnnnn } ##1##2##3##4##5##6 + { + \@@_use:nnnnnnn {#1} {##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 { msg_ #1 :nnnnn } ##1##2##3##4##5 + { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} {##3} {##4} {##5} { } } + \cs_new_protected:cpx { msg_ #1 :nnnn } ##1##2##3##4 + { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} {##3} {##4} { } { } } + \cs_new_protected:cpx { msg_ #1 :nnn } ##1##2##3 + { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} {##3} { } { } { } } + \cs_new_protected:cpx { msg_ #1 :nn } ##1##2 + { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} { } { } { } { } } + \cs_new_protected:cpn { msg_ #1 :nnxxxx } ##1##2##3##4##5##6 + { + \use:x + { + \@@_use:nnnnnnn + { \exp_not:n {#1} } { \exp_not:n {##1} } { \exp_not:n {##2} } + {##3} {##4} {##5} {##6} + } + } + \cs_new_protected:cpx { msg_ #1 :nnxxx } ##1##2##3##4##5 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} {##5} { } } + \cs_new_protected:cpx { msg_ #1 :nnxx } ##1##2##3##4 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} { } { } } + \cs_new_protected:cpx { msg_ #1 :nnx } ##1##2##3 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} { } { } { } } + } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro} -% { -% \msg_fatal:nnxxxx , -% \msg_fatal:nnxxx , -% \msg_fatal:nnxx , -% \msg_fatal:nnx , -% \msg_fatal:nn -% } +% { +% \msg_fatal:nnnnnn , +% \msg_fatal:nnnnn , +% \msg_fatal:nnnn , +% \msg_fatal:nnn , +% \msg_fatal:nn , +% \msg_fatal:nnxxxx , +% \msg_fatal:nnxxx , +% \msg_fatal:nnxx , +% \msg_fatal:nnx +% } % For fatal errors, after the error message \TeX{} bails out. % \begin{macrocode} -\msg_class_set:nn { fatal } - { - \msg_interrupt:xxx - { \msg_fatal_text:n {#1} : ~ "#2" } - { - \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n {#1} - } - { \c_msg_fatal_text_tl } - \tex_end:D - } + \@@_class_new:nn { fatal } + { + \msg_interrupt:nnn + { \msg_fatal_text:n {#1} : ~ "#2" } + { + \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n {#1} + } + { \c_msg_fatal_text_tl } + \tex_end:D + } % \end{macrocode} % \end{macro} % % \begin{macro} % { +% \msg_critical:nnnnnn , +% \msg_critical:nnnnn , +% \msg_critical:nnnn , +% \msg_critical:nnn , +% \msg_critical:nn , % \msg_critical:nnxxxx , % \msg_critical:nnxxx , % \msg_critical:nnxx , -% \msg_critical:nnx , -% \msg_critical:nn -% } +% \msg_critical:nnx +% } % Not quite so bad: just end the current file. % \begin{macrocode} -\msg_class_set:nn { critical } - { - \msg_interrupt:xxx - { \msg_critical_text:n {#1} : ~ "#2" } - { - \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n {#1} - } - { \c_msg_critical_text_tl } - \tex_endinput:D - } + \@@_class_new:nn { critical } + { + \msg_interrupt:nnn + { \msg_critical_text:n {#1} : ~ "#2" } + { + \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n {#1} + } + { \c_msg_critical_text_tl } + \tex_endinput:D + } % \end{macrocode} % \end{macro} % % \begin{macro} % { +% \msg_error:nnnnnn , +% \msg_error:nnnnn , +% \msg_error:nnnn , +% \msg_error:nnn , +% \msg_error:nn , % \msg_error:nnxxxx , % \msg_error:nnxxx , % \msg_error:nnxx , -% \msg_error:nnx , -% \msg_error:nn +% \msg_error:nnx % } -% For an error, the interrupt routine is called, then any recovery code -% is tried. +% \begin{macro}[aux]{\@@_error:cnnnnn, \@@_no_more_text:nnnn} +% 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. % \begin{macrocode} -\msg_class_set:nn { error } - { - \msg_if_more_text:cTF { \c_msg_more_text_prefix_tl #1 / #2 } - { - \msg_interrupt:xxx - { \msg_error_text:n {#1} : ~ "#2" } - { - \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n {#1} - } - { \use:c { \c_msg_more_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } - } - { - \msg_interrupt:xxx - { \msg_error_text:n {#1} : ~ "#2" } - { - \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n {#1} - } - { } - } - } + \@@_class_new:nn { error } + { + \@@_error:cnnnnn + { \c_@@_more_text_prefix_tl #1 / #2 } + {#3} {#4} {#5} {#6} + { + \msg_interrupt:nnn + { \msg_error_text:n {#1} : ~ "#2" } + { + \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n {#1} + } + } + } + \cs_new_protected:Npn \@@_error:cnnnnn #1#2#3#4#5#6 + { + \cs_if_eq:cNTF {#1} \@@_no_more_text:nnnn + { #6 { } } + { #6 { \use:c {#1} {#2} {#3} {#4} {#5} } } + } + \cs_new:Npn \@@_no_more_text:nnnn #1#2#3#4 { } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro} % { +% \msg_warning:nnnnnn , +% \msg_warning:nnnnn , +% \msg_warning:nnnn , +% \msg_warning:nnn , +% \msg_warning:nn , % \msg_warning:nnxxxx , % \msg_warning:nnxxx , % \msg_warning:nnxx , -% \msg_warning:nnx , -% \msg_warning:nn +% \msg_warning:nnx % } % Warnings are printed to the terminal. % \begin{macrocode} -\msg_class_set:nn { warning } - { - \msg_term:x - { - \msg_warning_text:n {#1} : ~ "#2" \\ \\ - \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} - } - } + \@@_class_new:nn { warning } + { + \msg_term:n + { + \msg_warning_text:n {#1} : ~ "#2" \\ \\ + \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + } + } % \end{macrocode} % \end{macro} % % \begin{macro} % { +% \msg_info:nnnnnn , +% \msg_info:nnnnn , +% \msg_info:nnnn , +% \msg_info:nnn , +% \msg_info:nn , % \msg_info:nnxxxx , % \msg_info:nnxxx , % \msg_info:nnxx , -% \msg_info:nnx , -% \msg_info:nn +% \msg_info:nnx % } % Information only goes into the log. % \begin{macrocode} -\msg_class_set:nn { info } - { - \msg_log:x - { - \msg_info_text:n {#1} : ~ "#2" \\ \\ - \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} - } - } + \@@_class_new:nn { info } + { + \msg_log:n + { + \msg_info_text:n {#1} : ~ "#2" \\ \\ + \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + } + } % \end{macrocode} % \end{macro} % % \begin{macro} % { +% \msg_log:nnnnnn , +% \msg_log:nnnnn , +% \msg_log:nnnn , +% \msg_log:nnn , +% \msg_log:nn , % \msg_log:nnxxxx , % \msg_log:nnxxx , % \msg_log:nnxx , -% \msg_log:nnx , -% \msg_log:nn +% \msg_log:nnx % } % \enquote{Log} data is very similar to information, but with no extras % added. % \begin{macrocode} -\msg_class_set:nn { log } - { - \msg_log:x - { \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } - } + \@@_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_none:nnnnnn , +% \msg_none:nnnnn , +% \msg_none:nnnn , +% \msg_none:nnn , +% \msg_none:nn , % \msg_none:nnxxxx , % \msg_none:nnxxx , % \msg_none:nnxx , -% \msg_none:nnx , -% \msg_none:nn +% \msg_none:nnx % } % The \texttt{none} message type is needed so that input can be gobbled. % \begin{macrocode} -\msg_class_set:nn { none } { } + \@@_class_new:nn { none } { } % \end{macrocode} % \end{macro} % -% \begin{variable}{\l_msg_class_tl, \l_msg_current_class_tl} +% End the group to eliminate \cs{@@_class_new:nn}. +% \begin{macrocode} +\group_end: +% \end{macrocode} +% +% \begin{macro}[aux]{\@@_class_chk_exist:nT} +% Checking that a message class exists. We build this from +% \cs{cs_if_free:cTF} rather than \cs{cs_if_exist:cTF} because that +% avoids reading the second argument earlier than necessary. +% \begin{macrocode} +\cs_new:Npn \@@_class_chk_exist:nT #1 + { + \cs_if_free:cTF { @@_ #1 _code:nnnnnn } + { \@@_kernel_error:nnx { kernel } { message-class-unknown } {#1} } + } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\l_@@_class_tl, \l_@@_current_class_tl} % Support variables needed for the redirection system. % \begin{macrocode} -\tl_new:N \l_msg_class_tl -\tl_new:N \l_msg_current_class_tl +\tl_new:N \l_@@_class_tl +\tl_new:N \l_@@_current_class_tl % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_msg_redirect_classes_prop, \l_msg_redirect_names_prop} -% For filtering messages, a list of all messages and of those which have -% to be modified is required. +% \begin{variable}{\l_@@_redirect_prop} +% For redirection of individually-named messages % \begin{macrocode} -\prop_new:N \l_msg_redirect_classes_prop -\prop_new:N \l_msg_redirect_names_prop +\prop_new:N \l_@@_redirect_prop % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_msg_redirect_prop} -% For redirection of individually-named messages +% \begin{variable}{\l_@@_hierarchy_seq} +% During redirection, split the message name into a sequence with +% items |{/module/submodule}|, |{/module}|, and |{}|. % \begin{macrocode} -\prop_new:N \l_msg_redirect_prop +\seq_new:N \l_@@_hierarchy_seq % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_msg_use_direct_bool} -% Used to force redirection when a name is given directly. +% \begin{variable}{\l_@@_class_loop_seq} +% Classes encountered when following redirections to check for loops. % \begin{macrocode} -\bool_new:N \l_msg_use_direct_bool +\seq_new:N \l_@@_class_loop_seq % \end{macrocode} % \end{variable} % -% \begin{macro}[int]{\msg_use:nnnnxxxx} -% \begin{macro}[aux]{\msg_use_code:, \msg_use_or_change_class:} -% \begin{macro}[aux]{\msg_use_aux_i:nn, \msg_use_aux_ii:nn} -% \begin{macro}[aux]{\msg_use_aux_iii:w} -% \begin{macro}[aux]{\msg_use_aux_iv:w} -% \begin{macro}[aux]{\msg_use_aux_v:} -% Actually using a message is a multi-step process. First, some safety -% checks on the message and class requested. The code and arguments are -% then stored to avoid passing them around. +% \begin{macro}[int]{\@@_use:nnnnnnn} +% \begin{macro}[aux] +% { +% \@@_use_redirect_name:n , \@@_use_hierarchy:nwwN , +% \@@_use_redirect_module:n, \@@_use_code: +% } +% Actually using a message is a multi-step process. First, some +% safety checks on the message and class requested. The code and +% arguments are then stored to avoid passing them around. The +% assignment to \cs{@@_use_code:} is similar to \cs{tl_set:Nn}. +% The message is eventually produced with whatever \cs{l_@@_class_tl} +% is when \cs{@@_use_code:} is called. % \begin{macrocode} -\cs_new_protected:Npn \msg_use:nnnnxxxx #1#2#3#4#5#6#7#8 +\cs_new_protected:Npn \@@_use:nnnnnnn #1#2#3#4#5#6#7 { - \msg_if_exist:nnTF {#3} {#4} + \msg_if_exist:nnTF {#2} {#3} { - \cs_if_exist:cTF { msg_ #1 :nnxxxx } + \@@_class_chk_exist:nT {#1} { - \tl_set:Nn \l_msg_current_class_tl {#1} - \cs_set_protected_nopar:Npx \msg_use_code: { \exp_not:n {#2} } - \cs_set_protected_nopar:Npn \msg_use_or_change_class: + \tl_set:Nn \l_@@_current_class_tl {#1} + \cs_set_protected_nopar:Npx \@@_use_code: { - \tl_if_eq:NNTF \l_msg_current_class_tl \l_msg_class_tl - { \msg_use_code: } + \exp_not:n { - \use:c { msg_ \l_msg_class_tl :nnxxxx } - {#3} {#4} {#5} {#6} {#7} {#8} + \use:c { @@_ \l_@@_class_tl _code:nnnnnn } + {#2} {#3} {#4} {#5} {#6} {#7} } } - \bool_if:NTF \l_msg_use_direct_bool - { - \bool_set_false:N \l_msg_use_direct_bool - \msg_use_code: - } - { \msg_use_aux_i:nn {#3} {#4} } + \@@_use_redirect_name:n { #2 / #3 } } - { \msg_kernel_error:nnx { msg } { message-class-unknown } {#1} } } - { \msg_kernel_error:nnxx { msg } { message-unknown } {#3} {#4} } + { \@@_kernel_error:nnxx { kernel } { message-unknown } {#2} {#3} } } -\cs_new_protected_nopar:Npn \msg_use_code: { } -\cs_new_protected_nopar:Npn \msg_use_or_change_class: { } +\cs_new_protected_nopar:Npn \@@_use_code: { } % \end{macrocode} -% The first check is for a individual message redirection. If this applies -% then no further redirection is attempted. +% The first check is for a individual message redirection. If this +% applies then no further redirection is attempted. Otherwise, split +% the message name into \texttt{module/submodule/message} (with an +% arbitrary number of slashes), and store |{/module/submodule}|, +% |{/module}| and |{}| into \cs{l_@@_hierarchy_seq}. We will then +% map through this sequence, applying the most specific redirection. % \begin{macrocode} -\cs_new_protected:Npn \msg_use_aux_i:nn #1#2 +\cs_new_protected:Npn \@@_use_redirect_name:n #1 { - \prop_get:NnNTF \l_msg_redirect_prop { #1 / #2 } \l_msg_class_tl + \prop_get:NnNTF \l_@@_redirect_prop { / #1 } \l_@@_class_tl + { \@@_use_code: } { - \bool_set_true:N \l_msg_use_direct_bool - \msg_use_or_change_class: + \seq_clear:N \l_@@_hierarchy_seq + \@@_use_hierarchy:nwwN { } + #1 \q_mark \@@_use_hierarchy:nwwN + / \q_mark \use_none_delimit_by_q_stop:w + \q_stop + \@@_use_redirect_module:n { } } - { \msg_use_aux_ii:nn {#1} {#2} } } -% \end{macrocode} -% Next check if there is a redirection by module or by submodule. -% \begin{macrocode} -\cs_new_protected:Npn \msg_use_aux_ii:nn #1#2 +\cs_new_protected:Npn \@@_use_hierarchy:nwwN #1#2 / #3 \q_mark #4 { - \prop_get:coNTF { l_msg_redirect_ \l_msg_current_class_tl _ prop } - { \msg_use_aux_iii:w #1 / #2 / \q_stop } \l_msg_class_tl - { \msg_use_or_change_class: } - { - \prop_get:coNTF { l_msg_redirect_ \l_msg_current_class_tl _ prop } - { \msg_use_aux_iv:w #1 / #2 \q_stop } \l_msg_class_tl - { \msg_use_or_change_class: } - { \msg_use_aux_v: } - } + \seq_put_left:Nn \l_@@_hierarchy_seq {#1} + #4 { #1 / #2 } #3 \q_mark #4 } -\cs_new:Npn \msg_use_aux_iii:w #1 / #2 / #3 \q_stop { #1 / #2 } -\cs_new:Npn \msg_use_aux_iv:w #1 / #2 \q_stop { #1 } % \end{macrocode} -% Finally test for redirection of an entire class. +% At this point, the items of \cs{l_@@_hierarchy_seq} are the +% various levels at which we should look for a redirection. +% Redirections which are less specific than the argument of +% \cs{@@_use_redirect_module:n} are not attempted. This argument is +% empty for a class redirection, \texttt{/module} for a module +% redirection, \emph{etc.} Loop through the sequence to find the most +% specific redirection, with module |##1|. The loop is interrupted +% after testing for a redirection for |##1| equal to the argument |#1| +% (least specific redirection allowed). When a redirection is found, +% break the mapping, then if the redirection targets the same class, +% output the code with that class, and otherwise set the target as the +% new current class, and search for further redirections. Those +% redirections should be at least as specific as |##1|. % \begin{macrocode} -\cs_new_protected:Npn \msg_use_aux_v: +\cs_new_protected:Npn \@@_use_redirect_module:n #1 { - \prop_get:cnNF { l_msg_redirect_ \l_msg_current_class_tl _ prop } - { * } \l_msg_class_tl - { \tl_set_eq:NN \l_msg_class_tl \l_msg_current_class_tl } - \msg_use_or_change_class: + \seq_map_inline:Nn \l_@@_hierarchy_seq + { + \prop_get:cnNTF { l_@@_redirect_ \l_@@_current_class_tl _prop } + {##1} \l_@@_class_tl + { + \seq_map_break:n + { + \tl_if_eq:NNTF \l_@@_current_class_tl \l_@@_class_tl + { \@@_use_code: } + { + \tl_set_eq:NN \l_@@_current_class_tl \l_@@_class_tl + \@@_use_redirect_module:n {##1} + } + } + } + { + \str_if_eq:nnT {##1} {#1} + { + \tl_set_eq:NN \l_@@_class_tl \l_@@_current_class_tl + \seq_map_break:n { \@@_use_code: } + } + } + } } % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\msg_redirect_class:nn} -% \begin{macro}[aux]{\msg_redirect_class_aux:nnn, \msg_redirect_class_aux:nVn} -% Converts class one into class two. +% \begin{macro}{\msg_redirect_name:nnn} +% Named message will always use the given class even if that class is +% redirected further. An empty target class cancels any existing +% redirection for that message. % \begin{macrocode} -\cs_new_protected:Npn \msg_redirect_class:nn #1#2 - { - \cs_if_exist:cTF { msg_ #1 :nnxxxx } - { - \cs_if_exist:cTF { msg_ #2 :nnxxxx } - { - \tl_set:Nn \l_msg_current_class_tl {#1} - \msg_redirect_class_aux:nnn {#1} {#2} {#2} - } - { \msg_kernel_error:nnx { msg } { message-class-unknown } {#2} } - } - { \msg_kernel_error:nnx { msg } { message-class-unknown } {#1} } - } -\cs_new_protected:Npn \msg_redirect_class_aux:nnn #1#2#3 +\cs_new_protected:Npn \msg_redirect_name:nnn #1#2#3 { - \prop_get:cnNTF { l_msg_redirect_ #2 _prop } { * } \l_msg_class_tl + \tl_if_empty:nTF {#3} + { \prop_remove:Nn \l_@@_redirect_prop { / #1 / #2 } } { - \tl_if_eq:NNTF \l_msg_class_tl \l_msg_current_class_tl - { \msg_kernel_error:nnxx { msg } { message-loop } {#1} {#3} } - { \msg_redirect_class_aux:nVn {#1} \l_msg_class_tl {#3} } + \@@_class_chk_exist:nT {#3} + { \prop_put:Nnn \l_@@_redirect_prop { / #1 / #2 } {#3} } } - { \prop_put:cnn { l_msg_redirect_ #1 _prop } { * } {#3} } } -\cs_generate_variant:Nn \msg_redirect_class_aux:nnn { nV } % \end{macrocode} % \end{macro} -% \end{macro} % -% \begin{macro}{\msg_redirect_module:nnn} -% \begin{macro}[aux] -% {\msg_redirect_module_aux:nnnn, \msg_redirect_module_aux:nnVn} -% For when all messages of a class should be altered for a given module. +% \begin{macro}{\msg_redirect_class:nn, \msg_redirect_module:nnn} +% \begin{macro}[aux]{\@@_redirect:nnn, \@@_redirect_loop_chk:nnn} +% \begin{macro}[aux]{\@@_redirect_loop_list:n} +% If the target class is empty, eliminate the corresponding +% redirection. Otherwise, add the redirection. We must then check +% for a loop: as an initialization, we start by storing the initial +% class in \cs{l_@@_current_class_tl}. % \begin{macrocode} -\cs_new_protected:Npn \msg_redirect_module:nnn #1#2#3 +\cs_new_protected_nopar:Npn \msg_redirect_class:nn + { \@@_redirect:nnn { } } +\cs_new_protected:Npn \msg_redirect_module:nnn #1 + { \@@_redirect:nnn { / #1 } } +\cs_new_protected:Npn \@@_redirect:nnn #1#2#3 { - \cs_if_exist:cTF { msg_ #2 :nnxxxx } + \@@_class_chk_exist:nT {#2} { - \cs_if_exist:cTF { msg_ #3 :nnxxxx } + \tl_if_empty:nTF {#3} + { \prop_remove:cn { l_@@_redirect_ #2 _prop } {#1} } { - \tl_set:Nn \l_msg_current_class_tl {#1} - \msg_redirect_module_aux:nnnn {#1} {#2} {#3} {#3} + \@@_class_chk_exist:nT {#3} + { + \prop_put:cnn { l_@@_redirect_ #2 _prop } {#1} {#3} + \tl_set:Nn \l_@@_current_class_tl {#2} + \seq_clear:N \l_@@_class_loop_seq + \@@_redirect_loop_chk:nnn {#2} {#3} {#1} + } } - { \msg_kernel_error:nnx { msg } { message-class-unknown } {#3} } } - { \msg_kernel_error:nnx { msg } { message-class-unknown } {#2} } } -\cs_new_protected:Npn \msg_redirect_module_aux:nnnn #1#2#3#4 +% \end{macrocode} +% Since multiple redirections can only happen with increasing +% specificity, a loop requires that all steps are of the same +% specificity. The new redirection can thus only create a loop with +% other redirections for the exact same module, |#1|, and not +% submodules. After some initialization above, follow redirections +% with \cs{l_@@_class_tl}, and keep track in +% \cs{l_@@_class_loop_seq} of the various classes encountered. A +% redirection from a class to itself, or the absence of redirection +% both mean that there is no loop. A redirection to the initial class +% marks a loop. To break it, we must decide which redirection to +% cancel. The user most likely wants the newly added redirection to +% hold with no further redirection. We thus remove the redirection +% starting from |#2|, target of the new redirection. Note that no +% message is emitted by any of the underlying functions: otherwise we +% may get an infinite loop because of a message from the message +% system itself. +% \begin{macrocode} +\cs_new_protected:Npn \@@_redirect_loop_chk:nnn #1#2#3 { - \prop_get:cnNTF { l_msg_redirect_ #3 _prop } {#1} \l_msg_class_tl + \seq_put_right:Nn \l_@@_class_loop_seq {#1} + \prop_get:cnNT { l_@@_redirect_ #1 _prop } {#3} \l_@@_class_tl { - \tl_if_eq:NNTF \l_msg_class_tl \l_msg_current_class_tl - { \msg_kernel_error:nnxx { msg } { message-loop } {#2} {#4} } - { \msg_redirect_moduel_aux:nVn {#1} {#2} \l_msg_class_tl {#4} } + \str_if_eq_x:nnF { \l_@@_class_tl } {#1} + { + \tl_if_eq:NNTF \l_@@_class_tl \l_@@_current_class_tl + { + \prop_put:cnn { l_@@_redirect_ #2 _prop } {#3} {#2} + \@@_kernel_warning:nnxxxx { kernel } { message-redirect-loop } + { \seq_item:Nn \l_@@_class_loop_seq { \c_one } } + { \seq_item:Nn \l_@@_class_loop_seq { \c_two } } + {#3} + { + \seq_map_function:NN \l_@@_class_loop_seq + \@@_redirect_loop_list:n + { \seq_item:Nn \l_@@_class_loop_seq { \c_one } } + } + } + { \@@_redirect_loop_chk:onn \l_@@_class_tl {#2} {#3} } + } } - { \prop_put:cnn { l_msg_redirect_ #2 _prop } {#1} {#4} } } -\cs_generate_variant:Nn \msg_redirect_module_aux:nnnn { nnV } +\cs_generate_variant:Nn \@@_redirect_loop_chk:nnn { o } +\cs_new:Npn \@@_redirect_loop_list:n #1 { {#1} ~ => ~ } % \end{macrocode} % \end{macro} % \end{macro} -% -% \begin{macro}{\msg_redirect_name:nnn} -% Named message will always use the given class even if that class is -% redirected further. -% \begin{macrocode} -\cs_new_protected:Npn \msg_redirect_name:nnn #1#2#3 - { - \cs_if_exist:cTF { msg_ #3 :nnxxxx } - { \prop_put:Nnn \l_msg_redirect_prop { #1 / #2 } {#3} } - { \msg_kernel_error:nnx { msg } { message-class-unknown } {#3} } - } -% \end{macrocode} % \end{macro} % % \subsection{Kernel-specific functions} % -% \begin{macro}{\msg_kernel_new:nnnn} -% \begin{macro}{\msg_kernel_new:nnn} -% \begin{macro}{\msg_kernel_set:nnnn} -% \begin{macro}{\msg_kernel_set:nnn} +% \begin{macro}{\@@_kernel_new:nnnn, \@@_kernel_new:nnn} +% \begin{macro}{\@@_kernel_set:nnnn, \@@_kernel_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 \msg_kernel_new:nnnn #1#2 +\cs_new_protected:Npn \@@_kernel_new:nnnn #1#2 { \msg_new:nnnn { LaTeX } { #1 / #2 } } -\cs_new_protected:Npn \msg_kernel_new:nnn #1#2 +\cs_new_protected:Npn \@@_kernel_new:nnn #1#2 { \msg_new:nnn { LaTeX } { #1 / #2 } } -\cs_new_protected:Npn \msg_kernel_set:nnnn #1#2 +\cs_new_protected:Npn \@@_kernel_set:nnnn #1#2 { \msg_set:nnnn { LaTeX } { #1 / #2 } } -\cs_new_protected:Npn \msg_kernel_set:nnn #1#2 +\cs_new_protected:Npn \@@_kernel_set:nnn #1#2 { \msg_set:nnn { LaTeX } { #1 / #2 } } % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\msg_kernel_fatal:nnxxxx} -% \begin{macro}{\msg_kernel_fatal:nnxxx} -% \begin{macro}{\msg_kernel_fatal:nnxx} -% \begin{macro}{\msg_kernel_fatal:nnx} -% \begin{macro}{\msg_kernel_fatal:nn} -% Fatal kernel errors cannot be re-defined. +% \begin{macro}[aux]{\@@_kernel_class_new:nn} +% \begin{macro}[aux]{\@@_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{msg_class_set:nn}. This auxiliary is destroyed at the end of +% the group. % \begin{macrocode} -\cs_new_protected:Npn \msg_kernel_fatal:nnxxxx #1#2#3#4#5#6 - { - \msg_interrupt:xxx - { \msg_fatal_text:n { LaTeX } : ~ "#1 / #2" } - { - \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } - {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n { LaTeX3 } - } - { \c_msg_fatal_text_tl } - \tex_end:D - } -\cs_new_protected:Npn \msg_kernel_fatal:nnxxx #1#2#3#4#5 - {\msg_kernel_fatal:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } -\cs_new_protected:Npn \msg_kernel_fatal:nnxx #1#2#3#4 - { \msg_kernel_fatal:nnxxxx {#1} {#2} {#3} {#4} { } { } } -\cs_new_protected:Npn \msg_kernel_fatal:nnx #1#2#3 - { \msg_kernel_fatal:nnxxxx {#1} {#2} {#3} { } { } { } } -\cs_new_protected:Npn \msg_kernel_fatal:nn #1#2 - { \msg_kernel_fatal:nnxxxx {#1} {#2} { } { } { } { } } +\group_begin: + \cs_set_protected:Npn \@@_kernel_class_new:nn #1 + { \@@_kernel_class_new_aux:nn { kernel_ #1 } } + \cs_set_protected:Npn \@@_kernel_class_new_aux:nn #1#2 + { + \cs_new_protected:cpn { @@_ #1 :nnnnnn } ##1##2 {#2} + \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:c { @@_ #1 :nnnnnn } + { \exp_not:N \exp_not:n {##1} } + { \exp_not:N \exp_not:n {##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} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\msg_kernel_error:nnxxxx} -% \begin{macro}{\msg_kernel_error:nnxxx} -% \begin{macro}{\msg_kernel_error:nnxx} -% \begin{macro}{\msg_kernel_error:nnx} -% \begin{macro}{\msg_kernel_error:nn} -% Neither can kernel errors. +% \begin{macro} +% { +% \@@_kernel_fatal:nnnnnn , +% \@@_kernel_fatal:nnnnn , +% \@@_kernel_fatal:nnnn , +% \@@_kernel_fatal:nnn , +% \@@_kernel_fatal:nn , +% \@@_kernel_fatal:nnxxxx , +% \@@_kernel_fatal:nnxxx , +% \@@_kernel_fatal:nnxx , +% \@@_kernel_fatal:nnx , +% \@@_kernel_error:nnnnnn , +% \@@_kernel_error:nnnnn , +% \@@_kernel_error:nnnn , +% \@@_kernel_error:nnn , +% \@@_kernel_error:nn , +% \@@_kernel_error:nnxxxx , +% \@@_kernel_error:nnxxx , +% \@@_kernel_error:nnxx , +% \@@_kernel_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{macrocode} -\cs_new_protected:Npn \msg_kernel_error:nnxxxx #1#2#3#4#5#6 - { - \msg_if_more_text:cTF { \c_msg_more_text_prefix_tl LaTeX / #1 / #2 } - { - \msg_interrupt:xxx - { \msg_error_text:n { LaTeX } : ~ " #1 / #2 " } - { - \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } - {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n { LaTeX3 } - } - { - \use:c { \c_msg_more_text_prefix_tl LaTeX / #1 / #2 } - {#3} {#4} {#5} {#6} - } - } - { - \msg_interrupt:xxx - { \msg_error_text:n { LaTeX } : ~ " #1 / #2 " } - { - \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } - {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n { LaTeX3 } - } - { } - } - } -\cs_new_protected:Npn \msg_kernel_error:nnxxx #1#2#3#4#5 - {\msg_kernel_error:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } -\cs_gset_protected:Npn \msg_kernel_error:nnxx #1#2#3#4 - { \msg_kernel_error:nnxxxx {#1} {#2} {#3} {#4} { } { } } -\cs_gset_protected:Npn \msg_kernel_error:nnx #1#2#3 - { \msg_kernel_error:nnxxxx {#1} {#2} {#3} { } { } { } } -\cs_gset_protected:Npn \msg_kernel_error:nn #1#2 - { \msg_kernel_error:nnxxxx {#1} {#2} { } { } { } { } } + \@@_kernel_class_new:nn { fatal } + { \@@_fatal_code:nnnnnn { LaTeX } { #1 / #2 } } + \cs_undefine:N \@@_kernel_error:nnxx + \cs_undefine:N \@@_kernel_error:nnx + \cs_undefine:N \@@_kernel_error:nn + \@@_kernel_class_new:nn { error } + { \@@_error_code:nnnnnn { LaTeX } { #1 / #2 } } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\msg_kernel_warning:nnxxxx} -% \begin{macro}{\msg_kernel_warning:nnxxx} -% \begin{macro}{\msg_kernel_warning:nnxx} -% \begin{macro}{\msg_kernel_warning:nnx} -% \begin{macro}{\msg_kernel_warning:nn} -% \begin{macro}{\msg_kernel_info:nnxxxx} -% \begin{macro}{\msg_kernel_info:nnxxx} -% \begin{macro}{\msg_kernel_info:nnxx} -% \begin{macro}{\msg_kernel_info:nnx} -% \begin{macro}{\msg_kernel_info:nn} -% Kernel messages which can be redirected. +% \begin{macro} +% { +% \@@_kernel_warning:nnnnnn , +% \@@_kernel_warning:nnnnn , +% \@@_kernel_warning:nnnn , +% \@@_kernel_warning:nnn , +% \@@_kernel_warning:nn , +% \@@_kernel_warning:nnxxxx , +% \@@_kernel_warning:nnxxx , +% \@@_kernel_warning:nnxx , +% \@@_kernel_warning:nnx , +% \@@_kernel_info:nnnnnn , +% \@@_kernel_info:nnnnn , +% \@@_kernel_info:nnnn , +% \@@_kernel_info:nnn , +% \@@_kernel_info:nn , +% \@@_kernel_info:nnxxxx , +% \@@_kernel_info:nnxxx , +% \@@_kernel_info:nnxx , +% \@@_kernel_info:nnx +% } +% Kernel messages which can be redirected simply use the machinery for +% normal messages, with the module name \enquote{\LaTeX{}}. % \begin{macrocode} -\prop_new:N \l_msg_redirect_kernel_warning_prop -\cs_new_protected:Npn \msg_kernel_warning:nnxxxx #1#2#3#4#5#6 - { - \msg_use:nnnnxxxx { warning } - { - \msg_term:x - { - \msg_warning_text:n { LaTeX } : ~ " #1 / #2 " \\ \\ - \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } - {#3} {#4} {#5} {#6} - } - } - { LaTeX } { #1 / #2 } {#3} {#4} {#5} {#6} - } -\cs_new_protected:Npn \msg_kernel_warning:nnxxx #1#2#3#4#5 - { \msg_kernel_warning:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } -\cs_new_protected:Npn \msg_kernel_warning:nnxx #1#2#3#4 - { \msg_kernel_warning:nnxxxx {#1} {#2} {#3} {#4} { } { } } -\cs_new_protected:Npn \msg_kernel_warning:nnx #1#2#3 - { \msg_kernel_warning:nnxxxx {#1} {#2} {#3} { } { } { } } -\cs_new_protected:Npn \msg_kernel_warning:nn #1#2 - { \msg_kernel_warning:nnxxxx {#1} {#2} { } { } { } { } } -\prop_new:N \l_msg_redirect_kernel_info_prop -\cs_new_protected:Npn \msg_kernel_info:nnxxxx #1#2#3#4#5#6 - { - \msg_use:nnnnxxxx { info } - { - \msg_log:x - { - \msg_info_text:n { LaTeX } : ~ " #1 / #2 " \\ \\ - \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } - {#3} {#4} {#5} {#6} - } - } - { LaTeX } { #1 / #2 } {#3} {#4} {#5} {#6} - } -\cs_new_protected:Npn \msg_kernel_info:nnxxx #1#2#3#4#5 - { \msg_kernel_info:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } -\cs_new_protected:Npn \msg_kernel_info:nnxx #1#2#3#4 - { \msg_kernel_info:nnxxxx {#1} {#2} {#3} {#4} { } { } } -\cs_new_protected:Npn \msg_kernel_info:nnx #1#2#3 - { \msg_kernel_info:nnxxxx {#1} {#2} {#3} { } { } { } } -\cs_new_protected:Npn \msg_kernel_info:nn #1#2 - { \msg_kernel_info:nnxxxx {#1} {#2} { } { } { } { } } + \@@_kernel_class_new:nn { warning } + { \msg_warning:nnxxxx { LaTeX } { #1 / #2 } } + \@@_kernel_class_new:nn { info } + { \msg_info:nnxxxx { LaTeX } { #1 / #2 } } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} +% +% End the group to eliminate \cs{@@_kernel_class_new:nn}. +% \begin{macrocode} +\group_end: +% \end{macrocode} % % Error messages needed to actually implement the message system % itself. % \begin{macrocode} -\msg_kernel_new:nnnn { msg } { message-already-defined } +\@@_kernel_new:nnnn { kernel } { message-already-defined } { Message~'#2'~for~module~'#1'~already~defined. } { \c_msg_coding_error_text_tl @@ -1657,41 +1735,45 @@ by~the~module~'#1':~this~message~already~exists. \c_msg_return_text_tl } -\msg_kernel_new:nnnn { msg } { message-unknown } +\@@_kernel_new:nnnn { kernel } { message-unknown } { Unknown~message~'#2'~for~module~'#1'. } { \c_msg_coding_error_text_tl LaTeX~was~asked~to~display~a~message~called~'#2'\\ - by~the~module~'#1'~module:~this~message~does~not~exist. + by~the~module~'#1':~this~message~does~not~exist. \c_msg_return_text_tl } -\msg_kernel_new:nnnn { msg } { message-class-unknown } +\@@_kernel_new:nnnn { kernel } { message-class-unknown } { Unknown~message~class~'#1'. } { LaTeX~has~been~asked~to~redirect~messages~to~a~class~'#1':\\ this~was~never~defined. \c_msg_return_text_tl } -\msg_kernel_new:nnnn { msg } { redirect-loop } - { Message~redirection~loop~for~message~class~'#1'. } +\@@_kernel_new:nnnn { kernel } { message-redirect-loop } + { + Message~redirection~loop~caused~by~ {#1} ~=>~ {#2} + \tl_if_empty:nF {#3} { ~for~module~' \use_none:n #3 ' } . + } { - LaTeX~has~been~asked~to~redirect~messages~in~an~infinite~loop.\\ - The~original~message~here~has~been~lost. - \c_msg_return_text_tl + Adding~the~message~redirection~ {#1} ~=>~ {#2} + \tl_if_empty:nF {#3} { ~for~the~module~' \use_none:n #3 ' } ~ + created~an~infinite~loop\\\\ + \iow_indent:n { #4 \\\\ } } % \end{macrocode} % % Messages for earlier kernel modules. % \begin{macrocode} -\msg_kernel_new:nnnn { kernel } { bad-number-of-arguments } +\@@_kernel_new:nnnn { kernel } { bad-number-of-arguments } { Function~'#1'~cannot~be~defined~with~#2~arguments. } { \c_msg_coding_error_text_tl LaTeX~has~been~asked~to~define~a~function~'#1'~with~ - #2~arguments. \\ + #2~arguments.~ TeX~allows~between~0~and~9~arguments~for~a~single~function. } -\msg_kernel_new:nnnn { kernel } { command-already-defined } +\@@_kernel_new:nnnn { kernel } { command-already-defined } { Control~sequence~#1~already~defined. } { \c_msg_coding_error_text_tl @@ -1700,102 +1782,123 @@ The~current~meaning~is:\\ \ \ #2 } -\msg_kernel_new:nnnn { kernel } { command-not-defined } +\@@_kernel_new:nnnn { kernel } { command-not-defined } { Control~sequence~#1~undefined. } { \c_msg_coding_error_text_tl LaTeX~has~been~asked~to~use~a~command~#1,~but~this~has~not~ been~defined~yet. } -\msg_kernel_new:nnnn { kernel } { out-of-registers } +\@@_kernel_new:nnnn { kernel } { empty-search-pattern } + { Empty~search~pattern. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~replace~an~empty~pattern~by~'#1':~that~ + would~lead~to~an~infinite~loop! + } +\@@_kernel_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. } -\msg_kernel_new:nnnn { kernel } { variable-not-defined } - { Variable~#1~undefined. } +\@@_kernel_new:nnnn { kernel } { missing-colon } + { Function~'#1'~contains~no~':'. } { \c_msg_coding_error_text_tl - LaTeX~has~been~asked~to~show~a~variable~#1,~but~this~has~not~ - been~defined~yet. + Code-level~functions~must~contain~':'~to~separate~the~ + argument~specification~from~the~function~name.~This~is~ + needed~when~defining~conditionals~or~when~building~a~ + parameter~text~from~the~number~of~arguments~of~the~function. } -\msg_kernel_new:nnnn { seq } { empty-sequence } - { Empty~sequence~#1. } +\@@_kernel_new:nnnn { kernel } { protected-predicate } + { Predicate~'#1'~must~be~expandable. } { \c_msg_coding_error_text_tl - LaTeX~has~been~asked~to~recover~an~entry~from~a~sequence~that~ - has~no~content:~that~cannot~happen! + LaTeX~has~been~asked~to~define~'#1'~as~a~protected~predicate.~ + Only~expandable~tests~can~have~a~predicate~version. } -\msg_kernel_new:nnnn { tl } { empty-search-pattern } - { Empty~search~pattern. } +\@@_kernel_new:nnnn { kernel } { conditional-form-unknown } + { Conditional~form~'#1'~for~function~'#2'~unknown. } { \c_msg_coding_error_text_tl - LaTeX~has~been~asked~to~replace~an~empty~pattern~by~'#1':~that~% - would~lead~to~an~infinite~loop! + LaTeX~has~been~asked~to~define~the~conditional~form~'#1'~of~ + the~function~'#2',~but~only~'TF',~'T',~'F',~and~'p'~forms~exist. } -\msg_kernel_new:nnnn { scan } { already-defined } +\@@_kernel_new:nnnn { kernel } { scanmark-already-defined } { Scan~mark~#1~already~defined. } { \c_msg_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_new:nnnn { kernel } { variable-not-defined } + { Variable~#1~undefined. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~show~a~variable~#1,~but~this~has~not~ + been~defined~yet. + } +\@@_kernel_new:nnnn { kernel } { variant-too-long } + { Variant~form~'#1'~longer~than~base~signature~of~'#2'. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~create~a~variant~of~the~function~'#2'~ + with~a~signature~starting~with~'#1',~but~that~is~longer~than~ + the~signature~(part~after~the~colon)~of~'#2'. + } % \end{macrocode} % % Some errors only appear in expandable settings, % hence don't need a \enquote{more-text} argument. % \begin{macrocode} -\msg_kernel_new:nnn { seq } { misused } - { A~sequence~was~misused. } -\msg_kernel_new:nnn { kernel } { bad-var } +\@@_kernel_new:nnn { kernel } { bad-variable } { Erroneous~variable~#1 used! } -\msg_kernel_new:nnn { prg } { zero-step } - { Zero~step~size~for~stepwise~function~#1. } -\msg_kernel_new:nnn { prg } { replicate-neg } +\@@_kernel_new:nnn { kernel } { misused-sequence } + { A~sequence~was~misused. } +\@@_kernel_new:nnn { kernel } { negative-replication } { Negative~argument~for~\prg_replicate:nn. } -\msg_kernel_new:nnn { kernel } { unknown-comparison } +\@@_kernel_new:nnn { kernel } { unknown-comparison } { Relation~symbol~'#1'~unknown:~use~=,~<,~>,~==,~!=,~<=,~>=. } +\@@_kernel_new:nnn { kernel } { zero-step } + { Zero~step~size~for~step~function~#1. } % \end{macrocode} % % Messages used by the \enquote{\texttt{show}} functions. % \begin{macrocode} -\msg_kernel_new:nnn { seq } { show } +\@@_kernel_new:nnn { kernel } { show-clist } { - The~sequence~\token_to_str:N #1~ - \seq_if_empty:NTF #1 + The~comma~list~ + \str_if_eq:nnF {#1} { \l__clist_internal_clist } { \token_to_str:N #1~} + \clist_if_empty:NTF #1 { is~empty } { contains~the~items~(without~outer~braces): } } -\msg_kernel_new:nnn { prop } { show } +\@@_kernel_new:nnn { kernel } { show-prop } { The~property~list~\token_to_str:N #1~ \prop_if_empty:NTF #1 { is~empty } { contains~the~pairs~(without~outer~braces): } } -\msg_kernel_new:nnn { clist } { show } +\@@_kernel_new:nnn { kernel } { show-seq } { - The~comma~list~ - \str_if_eq:nnF {#1} { \l_clist_internal_clist } { \token_to_str:N #1~} - \clist_if_empty:NTF #1 + The~sequence~\token_to_str:N #1~ + \seq_if_empty:NTF #1 { is~empty } { contains~the~items~(without~outer~braces): } } -\msg_kernel_new:nnn { ior } { show-no-stream } - { No~input~streams~are~open } -\msg_kernel_new:nnn { ior } { show-open-streams } - { The~following~input~streams~are~in~use: } -\msg_kernel_new:nnn { iow } { show-no-stream } - { No~output~streams~are~open } -\msg_kernel_new:nnn { iow } { show-open-streams } - { The~following~output~streams~are~in~use: } +\@@_kernel_new:nnn { kernel } { show-no-stream } + { No~ #1 ~streams~are~open } +\@@_kernel_new:nnn { kernel } { show-open-streams } + { The~following~ #1 ~streams~are~in~use: } % \end{macrocode} % % \subsection{Expandable errors} % -% \begin{macro}[int]{\msg_expandable_error:n} +% \begin{macro}[int]{\@@_expandable_error:n} +% \begin{macro}[aux]{\@@_expandable_error:w} % In expansion only context, we cannot use the normal means of % reporting errors. Instead, we feed \TeX{} an undefined control % sequence, \cs{LaTeX3 error:}. It is thus interrupted, and shows @@ -1806,7 +1909,7 @@ % \end{verbatim} % In other words, \TeX{} is processing the argument of \cs{use:n}, % which is \cs{LaTeX3 error:} \meta{error message}. -% Then \cs{msg_expandable_error_aux:w} cleans up. In fact, there +% 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, @@ -1816,70 +1919,71 @@ % \begin{macrocode} \group_begin: \char_set_catcode_math_superscript:N \^ -\char_set_lccode:nn {`^} {`\ } -\char_set_lccode:nn {`L} {`L} -\char_set_lccode:nn {`T} {`T} -\char_set_lccode:nn {`X} {`X} +\char_set_lccode:nn { `^ } { `\ } +\char_set_lccode:nn { `L } { `L } +\char_set_lccode:nn { `T } { `T } +\char_set_lccode:nn { `X } { `X } \tl_to_lowercase:n { - \cs_new:Npx \msg_expandable_error:n #1 + \cs_new:Npx \@@_expandable_error:n #1 { \exp_not:n { \tex_romannumeral:D \exp_after:wN \exp_after:wN - \exp_after:wN \msg_expandable_error_aux:w + \exp_after:wN \@@_expandable_error:w \exp_after:wN \exp_after:wN \exp_after:wN \c_zero } \exp_not:N \use:n { \exp_not:c { LaTeX3~error: } ^ #1 } ^ } - \cs_new:Npn \msg_expandable_error_aux:w #1 ^ #2 ^ { #1 } + \cs_new:Npn \@@_expandable_error:w #1 ^ #2 ^ { #1 } } \group_end: % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro} % { -% \msg_expandable_kernel_error:nnnnnn, -% \msg_expandable_kernel_error:nnnnn, -% \msg_expandable_kernel_error:nnnn, -% \msg_expandable_kernel_error:nnn, -% \msg_expandable_kernel_error:nn +% \@@_kernel_expandable_error:nnnnnn, +% \@@_kernel_expandable_error:nnnnn, +% \@@_kernel_expandable_error:nnnn, +% \@@_kernel_expandable_error:nnn, +% \@@_kernel_expandable_error:nn % } % The command built from the csname -% |\c_msg_text_prefix_tl LaTeX / #1 / #2| +% |\c_@@_text_prefix_tl LaTeX / #1 / #2| % takes four arguments and builds the error text, which is fed to -% \cs{msg_expandable_error:n}. +% \cs{@@_expandable_error:n}. % \begin{macrocode} -\cs_new:Npn \msg_expandable_kernel_error:nnnnnn #1#2#3#4#5#6 +\cs_new:Npn \@@_kernel_expandable_error:nnnnnn #1#2#3#4#5#6 { - \exp_args:Nf \msg_expandable_error:n + \exp_args:Nf \@@_expandable_error:n { \exp_args:NNc \exp_after:wN \exp_stop_f: - { \c_msg_text_prefix_tl LaTeX / #1 / #2 } + { \c_@@_text_prefix_tl LaTeX / #1 / #2 } {#3} {#4} {#5} {#6} } } -\cs_new:Npn \msg_expandable_kernel_error:nnnnn #1#2#3#4#5 +\cs_new:Npn \@@_kernel_expandable_error:nnnnn #1#2#3#4#5 { - \msg_expandable_kernel_error:nnnnnn + \@@_kernel_expandable_error:nnnnnn {#1} {#2} {#3} {#4} {#5} { } } -\cs_new:Npn \msg_expandable_kernel_error:nnnn #1#2#3#4 +\cs_new:Npn \@@_kernel_expandable_error:nnnn #1#2#3#4 { - \msg_expandable_kernel_error:nnnnnn + \@@_kernel_expandable_error:nnnnnn {#1} {#2} {#3} {#4} { } { } } -\cs_new:Npn \msg_expandable_kernel_error:nnn #1#2#3 +\cs_new:Npn \@@_kernel_expandable_error:nnn #1#2#3 { - \msg_expandable_kernel_error:nnnnnn + \@@_kernel_expandable_error:nnnnnn {#1} {#2} {#3} { } { } { } } -\cs_new:Npn \msg_expandable_kernel_error:nn #1#2 +\cs_new:Npn \@@_kernel_expandable_error:nn #1#2 { - \msg_expandable_kernel_error:nnnnnn + \@@_kernel_expandable_error:nnnnnn {#1} {#2} { } { } { } { } } % \end{macrocode} @@ -1888,93 +1992,103 @@ % \subsection{Showing variables} % % Functions defined in this section are used for diagnostic functions -% in \pkg{l3clist}, \pkg{l3io}, \pkg{l3prop}, \pkg{l3seq}, \pkg{xtemplate} -% -% \begin{macro}[aux]{\msg_aux_use:nn} -% \begin{macro}[aux]{\msg_aux_use:nnxxxx} -% Print the text of a message to the terminal, without formatting. +% in \pkg{l3clist}, \pkg{l3file}, \pkg{l3prop}, \pkg{l3seq}, \pkg{xtemplate} +% +% \begin{macro}[int] +% {\@@_term:nnnnnn, \@@_term:nnnnnV} +% \begin{macro}[int]{\@@_term:nnnnn} +% \begin{macro}[int]{\@@_term:nnn} +% \begin{macro}[int]{\@@_term:nn} +% Print the text of a message to the terminal without formatting: +% short cuts around \cs{iow_wrap:nnnN}. % \begin{macrocode} -\cs_new_protected:Npn \msg_aux_use:nn #1#2 - { \msg_aux_use:nnxxxx {#1} {#2} { } { } { } { } } -\cs_new_protected:Npn \msg_aux_use:nnxxxx #1#2#3#4#5#6 - { - \iow_wrap:xnnnN - { - \use:c { \c_msg_text_prefix_tl #1 / #2 } - {#3} {#4} {#5} {#6} - } - { } \c_zero { } \iow_term:x - } +\cs_new_protected:Npn \@@_term:nnnnnn #1#2#3#4#5#6 + { + \iow_wrap:nnnN + { \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } + { } { } \iow_term:n + } +\cs_generate_variant:Nn \@@_term:nnnnnn { nnnnnV } +\cs_new_protected:Npn \@@_term:nnnnn #1#2#3#4#5 + { \@@_term:nnnnnn {#1} {#2} {#3} {#4} {#5} { } } +\cs_new_protected:Npn \@@_term:nnn #1#2#3 + { \@@_term:nnnnnn {#1} {#2} {#3} { } { } { } } +\cs_new_protected:Npn \@@_term:nn #1#2 + { \@@_term:nnnnnn {#1} {#2} { } { } { } { } } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % -% \begin{macro}[int]{\msg_aux_show:Nnx} -% \begin{macro}[aux]{\msg_aux_show:x} -% \begin{macro}[aux,EXP]{\msg_aux_show:w} -% The arguments of \cs{msg_aux_show:Nnx} are +% \begin{macro}[int]{\@@_show_variable:Nnn, \@@_show_variable:Nnn} +% \begin{macro}[int]{\@@_show_variable:n, \@@_show_variable:x} +% \begin{macro}[aux,EXP]{\@@_show_variable:w} +% The arguments of \cs{@@_show_variable:Nnn} are % \begin{itemize} -% \item The \meta{variable} to be shown. -% \item The \texttt{TF} emptyness conditional for that type of variables. -% \item The type of the variable. -% \item A mapping of the form \cs{seq_map_function:NN} \meta{variable} -% \cs{msg_aux_show:n}, which produces the formatted string. +% \item The \meta{variable} to be shown. +% \item The \texttt{TF} emptiness conditional for that type of variables. +% \item The type of the variable. +% \item A mapping of the form \cs{seq_map_function:NN} \meta{variable} +% \cs{@@_show_item:n}, which produces the formatted string. % \end{itemize} % We remove a new line and \verb*|> | from the first item using % a \texttt{w}-type auxiliary, and the fact that \texttt{f}-expansion % removes a space. To avoid a low-level \TeX{} error if there is % an empty argument, a simple test is used to keep the output -% \enquote{clean}. The odd \cs{exp_after:wN} and trailing -% \cs{prg_do_nothing:} improve the output slightly. +% \enquote{clean}. The odd \cs{exp_after:wN} which expands the closing +% brace improves the output slightly. % \begin{macrocode} -\cs_new_protected:Npn \msg_aux_show:Nnx #1#2#3 +\cs_new_protected:Npn \@@_show_variable:Nnn #1#2#3 { \cs_if_exist:NTF #1 { - \msg_aux_use:nnxxxx { LaTeX / #2 } { show } {#1} { } { } { } - \msg_aux_show:x {#3} + \@@_term:nnn { LaTeX / kernel } { show- #2 } {#1} + \@@_show_variable:x {#3} } { - \msg_kernel_error:nnx { kernel } { variable-not-defined } + \@@_kernel_error:nnx { kernel } { variable-not-defined } { \token_to_str:N #1 } } } -\cs_new_protected:Npn \msg_aux_show:x #1 +\cs_generate_variant:Nn \@@_show_variable:Nnn { Nnx } +\cs_new_protected:Npn \@@_show_variable:n #1 { - \tl_set:Nx \l_msg_internal_tl {#1} - \tl_if_empty:NT \l_msg_internal_tl - { \tl_set:Nx \l_msg_internal_tl { > } } - \exp_args:Nf \etex_showtokens:D + \tl_set:Nn \l_@@_internal_tl {#1} + \tl_if_empty:NTF \l_@@_internal_tl + { \etex_showtokens:D \exp_after:wN { } } { - \exp_after:wN \exp_after:wN - \exp_after:wN \msg_aux_show:w - \exp_after:wN \l_msg_internal_tl - \exp_after:wN + \exp_args:Nf \etex_showtokens:D + { + \exp_after:wN \exp_after:wN + \exp_after:wN \@@_show_variable:w + \exp_after:wN \l_@@_internal_tl + } } - \prg_do_nothing: } -\cs_new:Npn \msg_aux_show:w #1 > { } +\cs_generate_variant:Nn \@@_show_variable:n { x } +\cs_new:Npn \@@_show_variable:w #1 > { } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}[aux,EXP]{\msg_aux_show:n} -% \begin{macro}[aux,EXP]{\msg_aux_show:nn} -% \begin{macro}[aux,EXP]{\msg_aux_show_unbraced:nn} +% \begin{macro}[int,EXP]{\@@_show_item:n} +% \begin{macro}[int,EXP]{\@@_show_item:nn} +% \begin{macro}[int,EXP]{\@@_show_item_unbraced:nn} % Each item in the variable is formatted using one of % the following functions. % \begin{macrocode} -\cs_new:Npn \msg_aux_show:n #1 +\cs_new:Npn \@@_show_item:n #1 { \iow_newline: > \c_space_tl \c_space_tl { \exp_not:n {#1} } } -\cs_new:Npn \msg_aux_show:nn #1#2 +\cs_new:Npn \@@_show_item:nn #1#2 { \iow_newline: > \c_space_tl \c_space_tl { \exp_not:n {#1} } \c_space_tl \c_space_tl => \c_space_tl \c_space_tl { \exp_not:n {#2} } } -\cs_new:Npn \msg_aux_show_unbraced:nn #1#2 +\cs_new:Npn \@@_show_item_unbraced:nn #1#2 { \iow_newline: > \c_space_tl \c_space_tl \exp_not:n {#1} \c_space_tl \c_space_tl => \c_space_tl \c_space_tl \exp_not:n {#2} @@ -2042,22 +2156,22 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\msg_kernel_bug:x} -% \begin{variable}{\c_msg_kernel_bug_text_tl, \c_msg_kernel_bug_more_text_tl} +% \begin{macro}{\@@_kernel_bug:x} +% \begin{variable}{\c_@@_kernel_bug_text_tl, \c_@@_kernel_bug_more_text_tl} % \begin{macrocode} %<*deprecated> -\cs_set_protected:Npn \msg_kernel_bug:x #1 +\cs_set_protected:Npn \@@_kernel_bug:x #1 { - \msg_interrupt:xxx { \c_msg_kernel_bug_text_tl } + \msg_interrupt:nnn { \c_@@_kernel_bug_text_tl } { #1 \msg_see_documentation_text:n { LaTeX3 } } - { \c_msg_kernel_bug_more_text_tl } + { \c_@@_kernel_bug_more_text_tl } } -\tl_const:Nn \c_msg_kernel_bug_text_tl +\tl_const:Nn \c_@@_kernel_bug_text_tl { This~is~a~LaTeX~bug:~check~coding! } -\tl_const:Nn \c_msg_kernel_bug_more_text_tl +\tl_const:Nn \c_@@_kernel_bug_more_text_tl { There~is~a~coding~bug~somewhere~around~here. \\ This~probably~needs~examining~by~an~expert. @@ -2067,6 +2181,55 @@ % \end{macrocode} % \end{variable} % \end{macro} +% +% Deprecated on 2012-06-28, for removal by 2012-12-31. +% +% \begin{macro}{\msg_newline:, \msg_two_newlines:} +% New lines are printed in the same way as for low-level file writing. +% \begin{macrocode} +\cs_new_nopar:Npn \msg_newline: { ^^J } +\cs_new_nopar:Npn \msg_two_newlines: { ^^J ^^J } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\msg_log:x, \msg_term:x} +% \begin{macro}{\msg_interrupt:xxx} +% These were all misnamed. +% \begin{macrocode} +\cs_generate_variant:Nn \msg_log:n { x } +\cs_generate_variant:Nn \msg_term:n { x } +\cs_generate_variant:Nn \msg_interrupt:nnn { xxx } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Deprecated on 2012-06-29, for removal by 2012-12-31. +% +% \begin{macro}{\msg_class_set:nn} +% Setting up a message class does two tasks. Any existing redirection +% is cleared, and the various message functions are created +% to simply use the code stored for the message. +% \begin{macrocode} +\cs_new_protected:Npn \msg_class_set:nn #1#2 + { + \cs_if_exist:cTF { @@_ #1 _code:nnnnnn } + \cs_set_protected:cpn + \cs_new_protected:cpn + { @@_ #1 _code:nnnnnn } ##1##2##3##4##5##6 {#2} + \prop_clear_new:c { l_@@_redirect_ #1 _prop } + \cs_set_protected_nopar:cpn { msg_ #1 :nnxxxx } + { \@@_use:nnnnnnn {#1} } + \cs_set_protected:cpx { msg_ #1 :nnxxx } ##1##2##3##4##5 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} {##5} { } } + \cs_set_protected:cpx { msg_ #1 :nnxx } ##1##2##3##4 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} { } { } } + \cs_set_protected:cpx { msg_ #1 :nnx } ##1##2##3 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} { } { } { } } + \cs_set_protected:cpx { msg_ #1 :nn } ##1##2 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} { } { } { } { } } + } +% \end{macrocode} +% \end{macro} % % \begin{macrocode} %</initex|package> |