| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
%% File: l3msg.dtx |
| 4 |
% |
| 5 |
% Copyright (C) 2009-2026 The LaTeX Project |
| 6 |
% |
| 7 |
% It may be distributed and/or modified under the conditions of the |
| 8 |
% LaTeX Project Public License (LPPL), either version 1.3c of this |
| 9 |
% license or (at your option) any later version. The latest version |
| 10 |
% of this license is in the file |
| 11 |
% |
| 12 |
% https://www.latex-project.org/lppl.txt |
| 13 |
% |
| 14 |
% This file is part of the "l3kernel bundle" (The Work in LPPL) |
| 15 |
% and all files in that bundle must be distributed together. |
| 16 |
% |
| 17 |
% ----------------------------------------------------------------------- |
| 18 |
% |
| 19 |
% The development version of the bundle can be found at |
| 20 |
% |
| 21 |
% https://github.com/latex3/latex3 |
| 22 |
% |
| 23 |
% for those people who are interested. |
| 24 |
% |
| 25 |
%<*driver> |
| 26 |
\documentclass[full,kernel]{l3doc} |
| 27 |
\begin{document} |
| 28 |
\DocInput{\jobname.dtx} |
| 29 |
\end{document} |
| 30 |
%</driver> |
| 31 |
% \fi |
| 32 |
% |
| 33 |
% \title{^^A |
| 34 |
% The \pkg{l3msg} module\\ Messages^^A |
| 35 |
% } |
| 36 |
% |
| 37 |
% \author{^^A |
| 38 |
% The \LaTeX{} Project\thanks |
| 39 |
% {^^A |
| 40 |
% E-mail: |
| 41 |
% \href{mailto:[email protected]} |
| 42 |
% {[email protected]}^^A |
| 43 |
% }^^A |
| 44 |
% } |
| 45 |
% |
| 46 |
% \date{Released 2026-05-15} |
| 47 |
% |
| 48 |
% \maketitle |
| 49 |
% |
| 50 |
% \begin{documentation} |
| 51 |
% |
| 52 |
% Messages need to be passed to the user by modules, either when errors |
| 53 |
% occur or to indicate how the code is proceeding. The \pkg{l3msg} |
| 54 |
% module provides a consistent method for doing this (as opposed to |
| 55 |
% writing directly to the terminal or log). |
| 56 |
% |
| 57 |
% The system used by \pkg{l3msg} to create messages divides the process |
| 58 |
% into two distinct parts. Named messages are created in the first part |
| 59 |
% of the process; at this stage, no decision is made about the type of |
| 60 |
% output that the message will produce. The second part of the process |
| 61 |
% is actually producing a message. At this stage a choice of message |
| 62 |
% \emph{class} has to be made, for example \texttt{error}, |
| 63 |
% \texttt{warning} or \texttt{info}. |
| 64 |
% |
| 65 |
% By separating out the creation and use of messages, several benefits |
| 66 |
% are available. First, the messages can be altered later without |
| 67 |
% needing details of where they are used in the code. This makes it |
| 68 |
% possible to alter the language used, the detail level and so on. |
| 69 |
% Secondly, the output which results from a given message can be |
| 70 |
% altered. This can be done on a message class, module or message name |
| 71 |
% basis. In this way, message behavior can be altered and messages can |
| 72 |
% be entirely suppressed. |
| 73 |
% |
| 74 |
% \section{Creating new messages} |
| 75 |
% |
| 76 |
% All messages have to be created before they can be used. |
| 77 |
% The text of messages is automatically wrapped to the length |
| 78 |
% available in the console. As a result, formatting is only needed |
| 79 |
% where it helps to show meaning. In particular, |\\| may be |
| 80 |
% used to force a new line and \verb*|\ | forces an explicit space. |
| 81 |
% Additionally, |\{|, |\#|, |\}|, |\%| and |\~| can be used to produce |
| 82 |
% the corresponding character. |
| 83 |
% |
| 84 |
% Messages may be subdivided \emph{by one level} using the~|/| |
| 85 |
% character. This is used within the message filtering system to allow |
| 86 |
% for example the \LaTeX{} kernel messages to belong to the module |
| 87 |
% \texttt{LaTeX} while still being filterable at a more granular level. |
| 88 |
% Thus for example |
| 89 |
% \begin{verbatim} |
| 90 |
% \msg_new:nnnn { mymodule } { submodule / message } ... |
| 91 |
% \end{verbatim} |
| 92 |
% will allow to filter out specifically messages from the \texttt{submodule}. |
| 93 |
% |
| 94 |
% Some authors may find the need to include spaces as |~| characters |
| 95 |
% tedious. This can be avoided by locally resetting the category code |
| 96 |
% of \verb*| |. |
| 97 |
% \begin{verbatim} |
| 98 |
% \char_set_catcode_space:n { `\ } |
| 99 |
% \msg_new:nnn {foo} {bar} |
| 100 |
% {Some message text using '#1' and usual message shorthands \{ \ \ \}.} |
| 101 |
% \char_set_catcode_ignore:n { `\ } |
| 102 |
% \end{verbatim} |
| 103 |
% although in general this may be confusing; simply writing the messages |
| 104 |
% using |~| characters is the method favored by the team. |
| 105 |
% |
| 106 |
% \begin{function}[updated = 2011-08-16] |
| 107 |
% { |
| 108 |
% \msg_new:nnnn, \msg_new:nnee, |
| 109 |
% \msg_new:nnn, \msg_new:nne |
| 110 |
% } |
| 111 |
% \begin{syntax} |
| 112 |
% \cs{msg_new:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} |
| 113 |
% \end{syntax} |
| 114 |
% Creates a \meta{message} for a given \meta{module}. |
| 115 |
% The message is defined to first give \meta{text} and then |
| 116 |
% \meta{more text} if the user requests it. If no \meta{more text} is |
| 117 |
% available then a standard text is given instead. Within \meta{text} |
| 118 |
% and \meta{more text} four parameters (|#1| to |#4|) can be used: |
| 119 |
% these will be supplied at the time the message is |
| 120 |
% used. An error is raised if the \meta{message} already exists. |
| 121 |
% \end{function} |
| 122 |
% |
| 123 |
% \begin{function}{\msg_set:nnnn, \msg_set:nnn} |
| 124 |
% \begin{syntax} |
| 125 |
% \cs{msg_set:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} |
| 126 |
% \end{syntax} |
| 127 |
% Sets up the text for a \meta{message} for a given \meta{module}. |
| 128 |
% The message is defined to first give \meta{text} and then |
| 129 |
% \meta{more text} if the user requests it. If no \meta{more text} is |
| 130 |
% available then a standard text is given instead. Within \meta{text} |
| 131 |
% and \meta{more text} four parameters (|#1| to |#4|) can be used: |
| 132 |
% these will be supplied at the time the message is used. |
| 133 |
% \end{function} |
| 134 |
% |
| 135 |
% \begin{function}[EXP, pTF, added = 2012-03-03]{\msg_if_exist:nn} |
| 136 |
% \begin{syntax} |
| 137 |
% \cs{msg_if_exist_p:nn} \Arg{module} \Arg{message} |
| 138 |
% \cs{msg_if_exist:nnTF} \Arg{module} \Arg{message} \Arg{true code} \Arg{false code} |
| 139 |
% \end{syntax} |
| 140 |
% Tests whether the \meta{message} for the \meta{module} is currently |
| 141 |
% defined. |
| 142 |
% \end{function} |
| 143 |
% |
| 144 |
% \section{Customizable information for message modules} |
| 145 |
% |
| 146 |
% \begin{function}[EXP, added = 2018-10-10]{\msg_module_name:n} |
| 147 |
% \begin{syntax} |
| 148 |
% \cs{msg_module_name:n} \Arg{module} |
| 149 |
% \end{syntax} |
| 150 |
% Expands to the public name of the \meta{module} as defined by |
| 151 |
% \cs{g_msg_module_name_prop} (or otherwise leaves the \meta{module} |
| 152 |
% unchanged). |
| 153 |
% \end{function} |
| 154 |
% |
| 155 |
% \begin{function}[EXP, added = 2018-10-10]{\msg_module_type:n} |
| 156 |
% \begin{syntax} |
| 157 |
% \cs{msg_module_type:n} \Arg{module} |
| 158 |
% \end{syntax} |
| 159 |
% Expands to the description which applies to the \meta{module}, |
| 160 |
% for example a |Package| or |Class|. The information here is defined |
| 161 |
% in \cs{g_msg_module_type_prop}, and will default to |Package| if an |
| 162 |
% entry is not present. |
| 163 |
% \end{function} |
| 164 |
% |
| 165 |
% \begin{variable}[added = 2018-10-10]{\g_msg_module_name_prop} |
| 166 |
% Provides a mapping between the module name used for messages, and that |
| 167 |
% for documentation. |
| 168 |
% \end{variable} |
| 169 |
% |
| 170 |
% \begin{variable}[added = 2018-10-10]{\g_msg_module_type_prop} |
| 171 |
% Provides a mapping between the module name used for messages, and that |
| 172 |
% type of module. For example, for \LaTeX{}3 core messages, an empty entry |
| 173 |
% is set here meaning that they are not described using the standard |
| 174 |
% |Package| text. |
| 175 |
% \end{variable} |
| 176 |
% |
| 177 |
% \section{Contextual information for messages} |
| 178 |
% |
| 179 |
% \begin{function}[rEXP]{\msg_line_context:} |
| 180 |
% \begin{syntax} |
| 181 |
% \cs{msg_line_context:} |
| 182 |
% \end{syntax} |
| 183 |
% Prints the current line number when a message is given, and |
| 184 |
% thus suitable for giving context to messages. The number itself |
| 185 |
% is proceeded by the text |on line|. |
| 186 |
% \end{function} |
| 187 |
% |
| 188 |
% \begin{function}[EXP]{\msg_line_number:} |
| 189 |
% \begin{syntax} |
| 190 |
% \cs{msg_line_number:} |
| 191 |
% \end{syntax} |
| 192 |
% Prints the current line number when a message is given. |
| 193 |
% \end{function} |
| 194 |
% |
| 195 |
% \begin{function}[EXP]{\msg_fatal_text:n} |
| 196 |
% \begin{syntax} |
| 197 |
% \cs{msg_fatal_text:n} \Arg{module} |
| 198 |
% \end{syntax} |
| 199 |
% Produces the standard text |
| 200 |
% \begin{quote} |
| 201 |
% \ttfamily |
| 202 |
% Fatal Package \meta{module} Error |
| 203 |
% \end{quote} |
| 204 |
% This function can be redefined to alter the language in which the |
| 205 |
% message is given, using |#1| as the name of the \meta{module} to |
| 206 |
% be included. Any redefinition \emph{must} produce output containing |
| 207 |
% the \meta{module} name, and will affect all messages using the |
| 208 |
% \pkg{expl3} mechanism. |
| 209 |
% \end{function} |
| 210 |
% |
| 211 |
% \begin{function}[EXP]{\msg_critical_text:n} |
| 212 |
% \begin{syntax} |
| 213 |
% \cs{msg_critical_text:n} \Arg{module} |
| 214 |
% \end{syntax} |
| 215 |
% Produces the standard text |
| 216 |
% \begin{quote} |
| 217 |
% \ttfamily |
| 218 |
% Critical Package \meta{module} Error |
| 219 |
% \end{quote} |
| 220 |
% This function can be redefined to alter the language in which the |
| 221 |
% message is given, using |#1| as the name of the \meta{module} to |
| 222 |
% be included. Any redefinition \emph{must} produce output containing |
| 223 |
% the \meta{module} name, and will affect all messages using the |
| 224 |
% \pkg{expl3} mechanism. |
| 225 |
% \end{function} |
| 226 |
% |
| 227 |
% \begin{function}[EXP]{\msg_error_text:n} |
| 228 |
% \begin{syntax} |
| 229 |
% \cs{msg_error_text:n} \Arg{module} |
| 230 |
% \end{syntax} |
| 231 |
% Produces the standard text |
| 232 |
% \begin{quote} |
| 233 |
% \ttfamily |
| 234 |
% Package \meta{module} Error |
| 235 |
% \end{quote} |
| 236 |
% This function can be redefined to alter the language in which the |
| 237 |
% message is given, using |#1| as the name of the \meta{module} to |
| 238 |
% be included. Any redefinition \emph{must} produce output containing |
| 239 |
% the \meta{module} name, and will affect all messages using the |
| 240 |
% \pkg{expl3} mechanism. |
| 241 |
% \end{function} |
| 242 |
% |
| 243 |
% \begin{function}[EXP]{\msg_warning_text:n} |
| 244 |
% \begin{syntax} |
| 245 |
% \cs{msg_warning_text:n} \Arg{module} |
| 246 |
% \end{syntax} |
| 247 |
% Produces the standard text |
| 248 |
% \begin{quote} |
| 249 |
% \ttfamily |
| 250 |
% Package \meta{module} Warning |
| 251 |
% \end{quote} |
| 252 |
% This function can be redefined to alter the language in which the |
| 253 |
% message is given, using |#1| as the name of the \meta{module} to |
| 254 |
% be included. The \meta{type} of \meta{module} may be adjusted: |
| 255 |
% |Package| is the standard outcome: see \cs{msg_module_type:n}. |
| 256 |
% Any redefinition \emph{must} produce output containing |
| 257 |
% the \meta{module} name, and will affect all messages using the |
| 258 |
% \pkg{expl3} mechanism. |
| 259 |
% \end{function} |
| 260 |
% |
| 261 |
% \begin{function}[EXP]{\msg_info_text:n} |
| 262 |
% \begin{syntax} |
| 263 |
% \cs{msg_info_text:n} \Arg{module} |
| 264 |
% \end{syntax} |
| 265 |
% Produces the standard text: |
| 266 |
% \begin{quote} |
| 267 |
% \ttfamily |
| 268 |
% Package \meta{module} Info |
| 269 |
% \end{quote} |
| 270 |
% This function can be redefined to alter the language in which the |
| 271 |
% message is given, using |#1| as the name of the \meta{module} to |
| 272 |
% be included. The \meta{type} of \meta{module} may be adjusted: |
| 273 |
% |Package| is the standard outcome: see \cs{msg_module_type:n}. |
| 274 |
% Any redefinition \emph{must} produce output containing |
| 275 |
% the \meta{module} name, and will affect all messages using the |
| 276 |
% \pkg{expl3} mechanism. |
| 277 |
% \end{function} |
| 278 |
% |
| 279 |
% \begin{function}[EXP,updated = 2018-09-30]{\msg_see_documentation_text:n} |
| 280 |
% \begin{syntax} |
| 281 |
% \cs{msg_see_documentation_text:n} \Arg{module} |
| 282 |
% \end{syntax} |
| 283 |
% Produces the standard text |
| 284 |
% \begin{quote} |
| 285 |
% \ttfamily |
| 286 |
% |
| 287 |
% See the \meta{module} documentation for further information. |
| 288 |
% \end{quote} |
| 289 |
% This function can be redefined to alter the language in which the |
| 290 |
% message is given, using |#1| as the name of the \meta{module} to |
| 291 |
% be included. The name of the \meta{module} is produced using |
| 292 |
% \cs{msg_module_name:n}. |
| 293 |
% \end{function} |
| 294 |
% |
| 295 |
% \section{Issuing messages} |
| 296 |
% |
| 297 |
% Messages behave differently depending on the message class. In all cases, |
| 298 |
% the message may be issued supplying~$0$ to~$4$ arguments. If the number of |
| 299 |
% arguments supplied here does not match the number in the definition of the |
| 300 |
% message, extra arguments are ignored, or empty arguments added (of |
| 301 |
% course the sense of the message may be impaired). The four arguments are |
| 302 |
% converted to strings before being added to the message text: the |
| 303 |
% \texttt{e}-type variants should be used to expand material. |
| 304 |
% Note that this expansion takes place with the standard definitions in |
| 305 |
% effect, which means that shorthands such as |\~| or |\\| are |
| 306 |
% \emph{not} available; instead one should use \cs{iow_char:N} |\~| and |
| 307 |
% \cs{iow_newline:}, respectively. |
| 308 |
% The following message classes exist: |
| 309 |
% \begin{itemize} |
| 310 |
% \item \texttt{fatal}, ending the \TeX{} run; |
| 311 |
% \item \texttt{critical}, ending the file being input; |
| 312 |
% \item \texttt{error}, interrupting the \TeX{} run without ending it; |
| 313 |
% \item \texttt{warning}, written to terminal and log file, for |
| 314 |
% important messages that may require corrections by the user; |
| 315 |
% \item \texttt{note} (less common than \texttt{info}) for important |
| 316 |
% information messages written to the terminal and log file; |
| 317 |
% \item \texttt{info} for normal information messages written to the log |
| 318 |
% file only; |
| 319 |
% \item \texttt{term} and \texttt{log} for un-decorated messages written |
| 320 |
% to the terminal and log file, or to the log file only; |
| 321 |
% \item \texttt{none} for suppressed messages. |
| 322 |
% \end{itemize} |
| 323 |
% |
| 324 |
% \begin{function}[updated = 2012-08-11] |
| 325 |
% { |
| 326 |
% \msg_fatal:nnnnnn , |
| 327 |
% \msg_fatal:nnnnn , |
| 328 |
% \msg_fatal:nnnn , |
| 329 |
% \msg_fatal:nnn , |
| 330 |
% \msg_fatal:nn , |
| 331 |
% \msg_fatal:nnVV , |
| 332 |
% \msg_fatal:nnVn , |
| 333 |
% \msg_fatal:nnnV , |
| 334 |
% \msg_fatal:nnV , |
| 335 |
% \msg_fatal:nneeee , |
| 336 |
% \msg_fatal:nneee , |
| 337 |
% \msg_fatal:nnnee , |
| 338 |
% \msg_fatal:nnee , |
| 339 |
% \msg_fatal:nnne , |
| 340 |
% \msg_fatal:nne |
| 341 |
% } |
| 342 |
% \begin{syntax} |
| 343 |
% \cs{msg_fatal:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} |
| 344 |
% \end{syntax} |
| 345 |
% Issues \meta{module} error \meta{message}, passing \meta{arg one} to |
| 346 |
% \meta{arg four} to the text-creating functions. After issuing a |
| 347 |
% fatal error the \TeX{} run halts. No PDF file will be produced in |
| 348 |
% this case (DVI mode runs may produce a truncated DVI file). |
| 349 |
% \end{function} |
| 350 |
% |
| 351 |
% \begin{function}[updated = 2012-08-11] |
| 352 |
% { |
| 353 |
% \msg_critical:nnnnnn , |
| 354 |
% \msg_critical:nnnnn , |
| 355 |
% \msg_critical:nnnn , |
| 356 |
% \msg_critical:nnn , |
| 357 |
% \msg_critical:nn , |
| 358 |
% \msg_critical:nnVV , |
| 359 |
% \msg_critical:nnVn , |
| 360 |
% \msg_critical:nnnV , |
| 361 |
% \msg_critical:nnV , |
| 362 |
% \msg_critical:nneeee , |
| 363 |
% \msg_critical:nneee , |
| 364 |
% \msg_critical:nnnee , |
| 365 |
% \msg_critical:nnee , |
| 366 |
% \msg_critical:nnne , |
| 367 |
% \msg_critical:nne |
| 368 |
% } |
| 369 |
% \begin{syntax} |
| 370 |
% \cs{msg_critical:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} |
| 371 |
% \end{syntax} |
| 372 |
% Issues \meta{module} error \meta{message}, passing \meta{arg one} to |
| 373 |
% \meta{arg four} to the text-creating functions. After issuing a |
| 374 |
% critical error, \TeX{} stops reading the current input file. |
| 375 |
% This may halt the \TeX{} run (if the current file is the main file) |
| 376 |
% or may abort reading a sub-file. |
| 377 |
% \begin{texnote} |
| 378 |
% The \TeX{} \tn{endinput} primitive is used to exit the file. In |
| 379 |
% particular, the rest of the current line remains in the input |
| 380 |
% stream. |
| 381 |
% \end{texnote} |
| 382 |
% \end{function} |
| 383 |
% |
| 384 |
% \begin{function}[updated = 2012-08-11] |
| 385 |
% { |
| 386 |
% \msg_error:nnnnnn , |
| 387 |
% \msg_error:nnnnn , |
| 388 |
% \msg_error:nnnn , |
| 389 |
% \msg_error:nnn , |
| 390 |
% \msg_error:nn , |
| 391 |
% \msg_error:nnVV , |
| 392 |
% \msg_error:nnVn , |
| 393 |
% \msg_error:nnnV , |
| 394 |
% \msg_error:nnV , |
| 395 |
% \msg_error:nneeee , |
| 396 |
% \msg_error:nneee , |
| 397 |
% \msg_error:nnnee , |
| 398 |
% \msg_error:nnee , |
| 399 |
% \msg_error:nnne , |
| 400 |
% \msg_error:nne |
| 401 |
% } |
| 402 |
% \begin{syntax} |
| 403 |
% \cs{msg_error:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} |
| 404 |
% \end{syntax} |
| 405 |
% Issues \meta{module} error \meta{message}, passing \meta{arg one} to |
| 406 |
% \meta{arg four} to the text-creating functions. The error |
| 407 |
% interrupts processing and issues the text at the terminal. After user |
| 408 |
% input, the run continues. |
| 409 |
% \end{function} |
| 410 |
% |
| 411 |
% \begin{function}[updated = 2012-08-11] |
| 412 |
% { |
| 413 |
% \msg_warning:nnnnnn , |
| 414 |
% \msg_warning:nnnnn , |
| 415 |
% \msg_warning:nnnn , |
| 416 |
% \msg_warning:nnn , |
| 417 |
% \msg_warning:nn , |
| 418 |
% \msg_warning:nnVV , |
| 419 |
% \msg_warning:nnVn , |
| 420 |
% \msg_warning:nnnV , |
| 421 |
% \msg_warning:nnV , |
| 422 |
% \msg_warning:nneeee , |
| 423 |
% \msg_warning:nneee , |
| 424 |
% \msg_warning:nnnee , |
| 425 |
% \msg_warning:nnee , |
| 426 |
% \msg_warning:nnne , |
| 427 |
% \msg_warning:nne |
| 428 |
% } |
| 429 |
% \begin{syntax} |
| 430 |
% \cs{msg_warning:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} |
| 431 |
% \end{syntax} |
| 432 |
% Issues \meta{module} warning \meta{message}, passing \meta{arg one} |
| 433 |
% to \meta{arg four} to the text-creating functions. The warning text |
| 434 |
% is added to the log file and the terminal, but the \TeX{} run |
| 435 |
% is not interrupted. |
| 436 |
% \end{function} |
| 437 |
% |
| 438 |
% \begin{function}[added = 2021-05-18] |
| 439 |
% { |
| 440 |
% \msg_note:nnnnnn , |
| 441 |
% \msg_note:nnnnn , |
| 442 |
% \msg_note:nnnn , |
| 443 |
% \msg_note:nnn , |
| 444 |
% \msg_note:nn , |
| 445 |
% \msg_note:nnVV , |
| 446 |
% \msg_note:nnVn , |
| 447 |
% \msg_note:nnnV , |
| 448 |
% \msg_note:nnV , |
| 449 |
% \msg_note:nneeee , |
| 450 |
% \msg_note:nneee , |
| 451 |
% \msg_note:nnnee , |
| 452 |
% \msg_note:nnee , |
| 453 |
% \msg_note:nnne , |
| 454 |
% \msg_note:nne , |
| 455 |
% \msg_info:nnnnnn , |
| 456 |
% \msg_info:nnnnn , |
| 457 |
% \msg_info:nnnn , |
| 458 |
% \msg_info:nnn , |
| 459 |
% \msg_info:nn , |
| 460 |
% \msg_info:nnVV , |
| 461 |
% \msg_info:nnVn , |
| 462 |
% \msg_info:nnnV , |
| 463 |
% \msg_info:nnV , |
| 464 |
% \msg_info:nneeee , |
| 465 |
% \msg_info:nneee , |
| 466 |
% \msg_info:nnnee , |
| 467 |
% \msg_info:nnee , |
| 468 |
% \msg_info:nnne , |
| 469 |
% \msg_info:nne |
| 470 |
% } |
| 471 |
% \begin{syntax} |
| 472 |
% \cs{msg_note:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} |
| 473 |
% \cs{msg_info:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} |
| 474 |
% \end{syntax} |
| 475 |
% Issues \meta{module} information \meta{message}, passing |
| 476 |
% \meta{arg one} to \meta{arg four} to the text-creating functions. |
| 477 |
% For the more common \cs{msg_info:nnnnnn}, the information text is |
| 478 |
% added to the log file only, while \cs{msg_note:nnnnnn} adds the |
| 479 |
% info text to both the log file and the terminal. The \TeX{} run is |
| 480 |
% not interrupted. |
| 481 |
% \end{function} |
| 482 |
% |
| 483 |
% \begin{function}[updated = 2012-08-11] |
| 484 |
% { |
| 485 |
% \msg_term:nnnnnn , |
| 486 |
% \msg_term:nnnnn , |
| 487 |
% \msg_term:nnnn , |
| 488 |
% \msg_term:nnn , |
| 489 |
% \msg_term:nn , |
| 490 |
% \msg_term:nnVV , |
| 491 |
% \msg_term:nnVn , |
| 492 |
% \msg_term:nnnV , |
| 493 |
% \msg_term:nnV , |
| 494 |
% \msg_term:nneeee , |
| 495 |
% \msg_term:nneee , |
| 496 |
% \msg_term:nnnee , |
| 497 |
% \msg_term:nnee , |
| 498 |
% \msg_term:nnne , |
| 499 |
% \msg_term:nne , |
| 500 |
% \msg_log:nnnnnn , |
| 501 |
% \msg_log:nnnnn , |
| 502 |
% \msg_log:nnnn , |
| 503 |
% \msg_log:nnn , |
| 504 |
% \msg_log:nn , |
| 505 |
% \msg_log:nnVV , |
| 506 |
% \msg_log:nnVn , |
| 507 |
% \msg_log:nnnV , |
| 508 |
% \msg_log:nnV , |
| 509 |
% \msg_log:nneeee , |
| 510 |
% \msg_log:nneee , |
| 511 |
% \msg_log:nnnee , |
| 512 |
% \msg_log:nnee , |
| 513 |
% \msg_log:nnne , |
| 514 |
% \msg_log:nne |
| 515 |
% } |
| 516 |
% \begin{syntax} |
| 517 |
% \cs{msg_term:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} |
| 518 |
% \cs{msg_log:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} |
| 519 |
% \end{syntax} |
| 520 |
% Issues \meta{module} information \meta{message}, passing |
| 521 |
% \meta{arg one} to \meta{arg four} to the text-creating functions. |
| 522 |
% The output is briefer than \cs{msg_info:nnnnnn}, omitting for |
| 523 |
% instance the module name. It is added to the log file by |
| 524 |
% \cs{msg_log:nnnnnn} while \cs{msg_term:nnnnnn} also prints it on the |
| 525 |
% terminal. |
| 526 |
% \end{function} |
| 527 |
% |
| 528 |
% \begin{function}[updated = 2012-08-11] |
| 529 |
% { |
| 530 |
% \msg_none:nnnnnn , |
| 531 |
% \msg_none:nnnnn , |
| 532 |
% \msg_none:nnnn , |
| 533 |
% \msg_none:nnn , |
| 534 |
% \msg_none:nn , |
| 535 |
% \msg_none:nnVV , |
| 536 |
% \msg_none:nnVn , |
| 537 |
% \msg_none:nnnV , |
| 538 |
% \msg_none:nnV , |
| 539 |
% \msg_none:nneeee , |
| 540 |
% \msg_none:nneee , |
| 541 |
% \msg_none:nnnee , |
| 542 |
% \msg_none:nnee , |
| 543 |
% \msg_none:nnne , |
| 544 |
% \msg_none:nne |
| 545 |
% } |
| 546 |
% \begin{syntax} |
| 547 |
% \cs{msg_none:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} |
| 548 |
% \end{syntax} |
| 549 |
% Does nothing: used as a message class to prevent any output at |
| 550 |
% all (see the discussion of message redirection). |
| 551 |
% \end{function} |
| 552 |
% |
| 553 |
% \subsection{Messages for showing material} |
| 554 |
% |
| 555 |
% \begin{function}[added = 2017-12-04] |
| 556 |
% { |
| 557 |
% \msg_show:nnnnnn , |
| 558 |
% \msg_show:nnnnn , |
| 559 |
% \msg_show:nnnn , |
| 560 |
% \msg_show:nnn , |
| 561 |
% \msg_show:nn , |
| 562 |
% \msg_show:nnVV , |
| 563 |
% \msg_show:nnVn , |
| 564 |
% \msg_show:nnnV , |
| 565 |
% \msg_show:nnV , |
| 566 |
% \msg_show:nneeee , |
| 567 |
% \msg_show:nneee , |
| 568 |
% \msg_show:nnnee , |
| 569 |
% \msg_show:nnee , |
| 570 |
% \msg_show:nnne , |
| 571 |
% \msg_show:nne |
| 572 |
% } |
| 573 |
% \begin{syntax} |
| 574 |
% \cs{msg_show:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} |
| 575 |
% \end{syntax} |
| 576 |
% Issues \meta{module} information \meta{message}, passing \meta{arg |
| 577 |
% one} to \meta{arg four} to the text-creating functions. The |
| 578 |
% information text is shown on the terminal and the \TeX{} run is |
| 579 |
% interrupted in a manner similar to \cs{tl_show:n}. This is used in |
| 580 |
% conjunction with \cs{msg_show_item:n} and similar functions to print |
| 581 |
% complex variable contents completely. If the formatted text does |
| 582 |
% not contain |>~| at the start of a line, an additional line |>~.| |
| 583 |
% will be put at the end. In addition, a final period is added if not |
| 584 |
% present. |
| 585 |
% \end{function} |
| 586 |
% |
| 587 |
% \begin{function}[EXP, added = 2017-12-04] |
| 588 |
% {\msg_show_item:n, \msg_show_item_unbraced:n, \msg_show_item:nn, \msg_show_item_unbraced:nn} |
| 589 |
% \begin{syntax} |
| 590 |
% \cs{seq_map_function:NN} \meta{seq var} \cs{msg_show_item:n} |
| 591 |
% \cs{prop_map_function:NN} \meta{property list} \cs{msg_show_item:nn} |
| 592 |
% \end{syntax} |
| 593 |
% Used in the text of messages for \cs{msg_show:nnnnnn} to show or log |
| 594 |
% a list of items or key--value pairs. The output of |
| 595 |
% \cs{msg_show_item:n} produces a newline, the prefix |>|, two spaces, |
| 596 |
% then the braced string representation of its argument. |
| 597 |
% The two-argument versions separates the key and value using |
| 598 |
% \verb*| => |, and the \texttt{unbraced} versions don't print the |
| 599 |
% surrounding braces. |
| 600 |
% |
| 601 |
% These functions are suitable for usage with iterator functions like |
| 602 |
% \cs{seq_map_function:NN}, \cs{prop_map_function:NN}, etc. For |
| 603 |
% example, with a sequence \cs[no-index]{l_tmpa_seq} containing |a|, |
| 604 |
% |{b}| and |\c|, |
| 605 |
% \begin{verbatim} |
| 606 |
% \seq_map_function:NN \l_tmpa_seq \msg_show_item:n |
| 607 |
% \end{verbatim} |
| 608 |
% would expand to three lines: |
| 609 |
% \begin{quotation} |
| 610 |
% \noindent\verb*|> {a}|\\ |
| 611 |
% \verb*|> {{b}}|\\ |
| 612 |
% \verb*|> {\c }| |
| 613 |
% \end{quotation} |
| 614 |
% \end{function} |
| 615 |
% |
| 616 |
% \subsection{Expandable error messages} |
| 617 |
% |
| 618 |
% In very rare cases it may be necessary to produce errors in an |
| 619 |
% expansion-only context. The functions in this section should only be |
| 620 |
% used if there is no alternative approach using \cs{msg_error:nnnnnn} |
| 621 |
% or other non-expandable commands from the previous section. Despite |
| 622 |
% having a similar interface as non-expandable messages, expandable |
| 623 |
% errors must be handled internally very differently from normal error |
| 624 |
% messages, as none of the tools to print to the terminal or the log |
| 625 |
% file are expandable. As a result, short-hands such as |\{| or |\\| do |
| 626 |
% not work, and messages must be very short (with default settings, |
| 627 |
% they are truncated after approximately 50 characters). It is |
| 628 |
% advisable to ensure that the message is understandable even when |
| 629 |
% truncated, by putting the most important information up front. |
| 630 |
% Another particularity of expandable messages is that they |
| 631 |
% cannot be redirected or turned off by the user. |
| 632 |
% |
| 633 |
% \begin{function}[EXP, added = 2015-08-06, updated = 2019-02-28] |
| 634 |
% { |
| 635 |
% \msg_expandable_error:nnnnnn , |
| 636 |
% \msg_expandable_error:nnnnn , |
| 637 |
% \msg_expandable_error:nnnn , |
| 638 |
% \msg_expandable_error:nnn , |
| 639 |
% \msg_expandable_error:nn , |
| 640 |
% \msg_expandable_error:nneeee , |
| 641 |
% \msg_expandable_error:nneee , |
| 642 |
% \msg_expandable_error:nnee , |
| 643 |
% \msg_expandable_error:nne , |
| 644 |
% \msg_expandable_error:nnffff , |
| 645 |
% \msg_expandable_error:nnfff , |
| 646 |
% \msg_expandable_error:nnff , |
| 647 |
% \msg_expandable_error:nnf , |
| 648 |
% } |
| 649 |
% \begin{syntax} |
| 650 |
% \cs{msg_expandable_error:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} |
| 651 |
% \end{syntax} |
| 652 |
% Issues an \enquote{Undefined error} message from \TeX{} itself |
| 653 |
% using the undefined control sequence \cs{???} then prints |
| 654 |
% \enquote{! \meta{module}: \meta{error message}}, which should be |
| 655 |
% short. With default settings, anything beyond approximately $60$ |
| 656 |
% characters long (or bytes in some engines) is cropped. A leading |
| 657 |
% space might be removed as well. |
| 658 |
% \end{function} |
| 659 |
% |
| 660 |
% \section{Redirecting messages} |
| 661 |
% |
| 662 |
% Each message has a \enquote{name}, which can be used to alter the behavior |
| 663 |
% of the message when it is given. Thus we might have |
| 664 |
% \begin{verbatim} |
| 665 |
% \msg_new:nnnn { module } { my-message } { Some~text } { Some~more~text } |
| 666 |
% \end{verbatim} |
| 667 |
% to define a message, with |
| 668 |
% \begin{verbatim} |
| 669 |
% \msg_error:nn { module } { my-message } |
| 670 |
% \end{verbatim} |
| 671 |
% when it is used. With no filtering, this raises an error. However, we |
| 672 |
% could alter the behavior with |
| 673 |
% \begin{verbatim} |
| 674 |
% \msg_redirect_class:nn { error } { warning } |
| 675 |
% \end{verbatim} |
| 676 |
% to turn all errors into warnings, or with |
| 677 |
% \begin{verbatim} |
| 678 |
% \msg_redirect_module:nnn { module } { error } { warning } |
| 679 |
% \end{verbatim} |
| 680 |
% to alter only messages from that module, or even |
| 681 |
% \begin{verbatim} |
| 682 |
% \msg_redirect_name:nnn { module } { my-message } { warning } |
| 683 |
% \end{verbatim} |
| 684 |
% to target just one message. Redirection applies first to individual messages, |
| 685 |
% then to messages from one module and finally to messages of one class. Thus |
| 686 |
% it is possible to select out an individual message for special treatment |
| 687 |
% even if the entire class is already redirected. |
| 688 |
% |
| 689 |
% Multiple redirections are possible. Redirections can be cancelled by |
| 690 |
% providing an empty argument for the target class. Redirection to a |
| 691 |
% missing class raises an error immediately. Infinite loops are |
| 692 |
% prevented by eliminating the redirection starting from the target of |
| 693 |
% the redirection that caused the loop to appear. Namely, if |
| 694 |
% redirections are requested as $A \to B$, $B \to C$ and $C \to A$ in |
| 695 |
% this order, then the $A \to B$ redirection is cancelled. |
| 696 |
% |
| 697 |
% \begin{function}[updated = 2012-04-27]{\msg_redirect_class:nn} |
| 698 |
% \begin{syntax} |
| 699 |
% \cs{msg_redirect_class:nn} \Arg{class one} \Arg{class two} |
| 700 |
% \end{syntax} |
| 701 |
% Changes the behavior of messages of \meta{class one} so that they |
| 702 |
% are processed using the code for those of \meta{class two}. |
| 703 |
% Each \meta{class} can be one of \texttt{fatal}, \texttt{critical}, |
| 704 |
% \texttt{error}, \texttt{warning}, \texttt{note}, \texttt{info}, |
| 705 |
% \texttt{term}, \texttt{log}, \texttt{none}. |
| 706 |
% \end{function} |
| 707 |
% |
| 708 |
% \begin{function}[updated = 2012-04-27]{\msg_redirect_module:nnn} |
| 709 |
% \begin{syntax} |
| 710 |
% \cs{msg_redirect_module:nnn} \Arg{module} \Arg{class one} \Arg{class two} |
| 711 |
% \end{syntax} |
| 712 |
% Redirects message of \meta{class one} for \meta{module} to act as |
| 713 |
% though they were from \meta{class two}. Messages of \meta{class one} |
| 714 |
% from sources other than \meta{module} are not affected by this |
| 715 |
% redirection. This function can be used to make some messages |
| 716 |
% \enquote{silent} by default. For example, all of the |
| 717 |
% \texttt{warning} messages of \meta{module} could be turned off with: |
| 718 |
% \begin{verbatim} |
| 719 |
% \msg_redirect_module:nnn { module } { warning } { none } |
| 720 |
% \end{verbatim} |
| 721 |
% \end{function} |
| 722 |
% |
| 723 |
% \begin{function}[updated = 2012-04-27]{\msg_redirect_name:nnn} |
| 724 |
% \begin{syntax} |
| 725 |
% \cs{msg_redirect_name:nnn} \Arg{module} \Arg{message} \Arg{class} |
| 726 |
% \end{syntax} |
| 727 |
% Redirects a specific \meta{message} from a specific \meta{module} to |
| 728 |
% act as a member of \meta{class} of messages. No further redirection |
| 729 |
% is performed. This function can be used to make a selected message |
| 730 |
% \enquote{silent} without changing global parameters: |
| 731 |
% \begin{verbatim} |
| 732 |
% \msg_redirect_name:nnn { module } { annoying-message } { none } |
| 733 |
% \end{verbatim} |
| 734 |
% \end{function} |
| 735 |
% |
| 736 |
% \end{documentation} |
| 737 |
% |
| 738 |
% \begin{implementation} |
| 739 |
% |
| 740 |
% \section{\pkg{l3msg} implementation} |
| 741 |
% |
| 742 |
% \begin{macrocode} |
| 743 |
%<*code> |
| 744 |
% \end{macrocode} |
| 745 |
% |
| 746 |
% \begin{macrocode} |
| 747 |
%<@@=msg> |
| 748 |
% \end{macrocode} |
| 749 |
% |
| 750 |
% \begin{variable}{\l_@@_tmp_tl} |
| 751 |
% A general scratch for the module. |
| 752 |
% \begin{macrocode} |
| 753 |
\tl_new:N \l_@@_tmp_tl |
| 754 |
% \end{macrocode} |
| 755 |
% \end{variable} |
| 756 |
% |
| 757 |
% \begin{variable}{\l_@@_name_str, \l_@@_text_str} |
| 758 |
% Used to save module info when creating messages. |
| 759 |
% \begin{macrocode} |
| 760 |
\str_new:N \l_@@_name_str |
| 761 |
\str_new:N \l_@@_text_str |
| 762 |
% \end{macrocode} |
| 763 |
% \end{variable} |
| 764 |
% |
| 765 |
% \subsection{Internal auxiliaries} |
| 766 |
% |
| 767 |
% \begin{variable}{\s_@@_mark,\s_@@_stop} |
| 768 |
% Internal scan marks. |
| 769 |
% \begin{macrocode} |
| 770 |
\scan_new:N \s_@@_mark |
| 771 |
\scan_new:N \s_@@_stop |
| 772 |
% \end{macrocode} |
| 773 |
% \end{variable} |
| 774 |
% |
| 775 |
% \begin{macro}[EXP]{\@@_use_none_delimit_by_s_stop:w} |
| 776 |
% Functions to gobble up to a scan mark. |
| 777 |
% \begin{macrocode} |
| 778 |
\cs_new:Npn \@@_use_none_delimit_by_s_stop:w #1 \s_@@_stop { } |
| 779 |
% \end{macrocode} |
| 780 |
% \end{macro} |
| 781 |
% |
| 782 |
% \subsection{Creating messages} |
| 783 |
% |
| 784 |
% Messages are created and used separately, so there two parts to |
| 785 |
% the code here. First, a mechanism for creating message text. |
| 786 |
% This is pretty simple, as there is not actually a lot to do. |
| 787 |
% |
| 788 |
% \begin{variable}{\c_@@_text_prefix_tl, \c_@@_more_text_prefix_tl} |
| 789 |
% Locations for the text of messages. |
| 790 |
% \begin{macrocode} |
| 791 |
\tl_const:Nn \c_@@_text_prefix_tl { msg~text~>~ } |
| 792 |
\tl_const:Nn \c_@@_more_text_prefix_tl { msg~extra~text~>~ } |
| 793 |
% \end{macrocode} |
| 794 |
% \end{variable} |
| 795 |
% |
| 796 |
% \begin{macro}[EXP,pTF]{\msg_if_exist:nn} |
| 797 |
% Test whether the control sequence containing the message text exists |
| 798 |
% or not. |
| 799 |
% \begin{macrocode} |
| 800 |
\prg_new_conditional:Npnn \msg_if_exist:nn #1#2 { p , T , F , TF } |
| 801 |
{ |
| 802 |
\cs_if_exist:cTF { \c_@@_text_prefix_tl #1 / #2 } |
| 803 |
{ \prg_return_true: } { \prg_return_false: } |
| 804 |
} |
| 805 |
% \end{macrocode} |
| 806 |
% \end{macro} |
| 807 |
% |
| 808 |
% \begin{macro}{\@@_chk_if_free:nn} |
| 809 |
% This auxiliary is similar to \cs{__kernel_chk_if_free_cs:N}, and is used when |
| 810 |
% defining messages with \cs{msg_new:nnnn}. |
| 811 |
% \begin{macrocode} |
| 812 |
\cs_new_protected:Npn \@@_chk_free:nn #1#2 |
| 813 |
{ |
| 814 |
\msg_if_exist:nnT {#1} {#2} |
| 815 |
{ |
| 816 |
\msg_error:nnnn { msg } { already-defined } |
| 817 |
{#1} {#2} |
| 818 |
} |
| 819 |
} |
| 820 |
% \end{macrocode} |
| 821 |
% \end{macro} |
| 822 |
% |
| 823 |
% \begin{macro} |
| 824 |
% { |
| 825 |
% \msg_new:nnnn, \msg_new:nnee, \msg_new:nnxx, |
| 826 |
% \msg_new:nnn, \msg_new:nne, \msg_new:nnx |
| 827 |
% } |
| 828 |
% \begin{macro}{\msg_set:nnnn, \msg_set:nnn} |
| 829 |
% Setting a message simply means saving the appropriate text |
| 830 |
% into two functions. A sanity check first. |
| 831 |
% \begin{macrocode} |
| 832 |
\cs_new_protected:Npn \msg_new:nnnn #1#2#3#4 |
| 833 |
{ |
| 834 |
\@@_chk_free:nn {#1} {#2} |
| 835 |
\cs_gset:cpn { \c_@@_text_prefix_tl #1 / #2 } |
| 836 |
##1##2##3##4 {#3} |
| 837 |
\cs_gset:cpn { \c_@@_more_text_prefix_tl #1 / #2 } |
| 838 |
##1##2##3##4 {#4} |
| 839 |
} |
| 840 |
\cs_generate_variant:Nn \msg_new:nnnn { nnee , nnxx } |
| 841 |
\cs_new_protected:Npn \msg_new:nnn #1#2#3 |
| 842 |
{ \msg_new:nnnn {#1} {#2} {#3} { } } |
| 843 |
\cs_generate_variant:Nn \msg_new:nnn { nne , nnx } |
| 844 |
\cs_new_protected:Npn \msg_set:nnnn #1#2#3#4 |
| 845 |
{ |
| 846 |
\cs_set:cpn { \c_@@_text_prefix_tl #1 / #2 } |
| 847 |
##1##2##3##4 {#3} |
| 848 |
\cs_set:cpn { \c_@@_more_text_prefix_tl #1 / #2 } |
| 849 |
##1##2##3##4 {#4} |
| 850 |
} |
| 851 |
\cs_new_protected:Npn \msg_set:nnn #1#2#3 |
| 852 |
{ \msg_set:nnnn {#1} {#2} {#3} { } } |
| 853 |
% \end{macrocode} |
| 854 |
% \end{macro} |
| 855 |
% \end{macro} |
| 856 |
% |
| 857 |
% \subsection{Messages: support functions and text} |
| 858 |
% |
| 859 |
% \begin{variable} |
| 860 |
% { |
| 861 |
% \c_@@_coding_error_text_tl , |
| 862 |
% \c_@@_continue_text_tl , |
| 863 |
% \c_@@_critical_text_tl , |
| 864 |
% \c_@@_fatal_text_tl , |
| 865 |
% \c_@@_help_text_tl , |
| 866 |
% \c_@@_no_info_text_tl , |
| 867 |
% \c_@@_on_line_text_tl , |
| 868 |
% \c_@@_return_text_tl , |
| 869 |
% \c_@@_trouble_text_tl |
| 870 |
% } |
| 871 |
% Simple pieces of text for messages. |
| 872 |
% \begin{macrocode} |
| 873 |
\tl_const:Nn \c_@@_coding_error_text_tl |
| 874 |
{ |
| 875 |
This~is~a~coding~error. |
| 876 |
\\ \\ |
| 877 |
} |
| 878 |
\tl_const:Nn \c_@@_continue_text_tl |
| 879 |
{ Type~<return>~to~continue } |
| 880 |
\tl_const:Nn \c_@@_critical_text_tl |
| 881 |
{ Reading~the~current~file~'\g_file_curr_name_str'~will~stop. } |
| 882 |
\tl_const:Nn \c_@@_fatal_text_tl |
| 883 |
{ This~is~a~fatal~error:~LaTeX~will~abort. } |
| 884 |
\tl_const:Nn \c_@@_help_text_tl |
| 885 |
{ For~immediate~help~type~H~<return> } |
| 886 |
\tl_const:Nn \c_@@_no_info_text_tl |
| 887 |
{ |
| 888 |
LaTeX~does~not~know~anything~more~about~this~error,~sorry. |
| 889 |
\c_@@_return_text_tl |
| 890 |
} |
| 891 |
\tl_const:Nn \c_@@_on_line_text_tl { on~line } |
| 892 |
\tl_const:Nn \c_@@_return_text_tl |
| 893 |
{ |
| 894 |
\\ \\ |
| 895 |
Try~typing~<return>~to~proceed. |
| 896 |
\\ |
| 897 |
If~that~doesn't~work,~type~X~<return>~to~quit. |
| 898 |
} |
| 899 |
\tl_const:Nn \c_@@_trouble_text_tl |
| 900 |
{ |
| 901 |
\\ \\ |
| 902 |
More~errors~will~almost~certainly~follow: \\ |
| 903 |
the~LaTeX~run~should~be~aborted. |
| 904 |
} |
| 905 |
% \end{macrocode} |
| 906 |
% \end{variable} |
| 907 |
% |
| 908 |
% \begin{macro}{\msg_line_number:, \msg_line_context:} |
| 909 |
% For writing the line number nicely. \cs{msg_line_context:} was set up |
| 910 |
% earlier, so this is not \texttt{new}. |
| 911 |
% \begin{macrocode} |
| 912 |
\cs_new:Npn \msg_line_number: { \int_use:N \tex_inputlineno:D } |
| 913 |
\cs_gset:Npn \msg_line_context: |
| 914 |
{ |
| 915 |
\c_@@_on_line_text_tl |
| 916 |
\c_space_tl |
| 917 |
\msg_line_number: |
| 918 |
} |
| 919 |
% \end{macrocode} |
| 920 |
% \end{macro} |
| 921 |
% |
| 922 |
% \subsection{Showing messages: low level mechanism} |
| 923 |
% |
| 924 |
% \begin{macro}{\@@_interrupt:Nnnn} |
| 925 |
% \begin{macro}{\@@_no_more_text:nnnn} |
| 926 |
% The low-level interruption macro is rather opaque, unfortunately. |
| 927 |
% Depending on the availability of more information there is a choice |
| 928 |
% of how to set up the further help. We feed the extra help text and |
| 929 |
% the message itself to a wrapping auxiliary, in this order because we |
| 930 |
% must first setup \TeX{}'s \tn{errhelp} register before issuing an |
| 931 |
% \tn{errmessage}. To deal with the various cases of critical or fatal |
| 932 |
% errors with and without help text, there is a bit of argument-passing |
| 933 |
% to do. |
| 934 |
% \begin{macrocode} |
| 935 |
\cs_new_protected:Npn \@@_interrupt:NnnnN #1#2#3#4#5 |
| 936 |
{ |
| 937 |
\str_set:Ne \l_@@_text_str { #1 {#2} } |
| 938 |
\str_set:Ne \l_@@_name_str { \msg_module_name:n {#2} } |
| 939 |
\cs_if_eq:cNTF |
| 940 |
{ \c_@@_more_text_prefix_tl #2 / #3 } |
| 941 |
\@@_no_more_text:nnnn |
| 942 |
{ |
| 943 |
\@@_interrupt_wrap:nnn |
| 944 |
{ \use:c { \c_@@_text_prefix_tl #2 / #3 } #4 } |
| 945 |
{ \c_@@_continue_text_tl } |
| 946 |
{ |
| 947 |
\c_@@_no_info_text_tl |
| 948 |
\tl_if_empty:NF #5 |
| 949 |
{ \\ \\ #5 } |
| 950 |
} |
| 951 |
} |
| 952 |
{ |
| 953 |
\@@_interrupt_wrap:nnn |
| 954 |
{ \use:c { \c_@@_text_prefix_tl #2 / #3 } #4 } |
| 955 |
{ \c_@@_help_text_tl } |
| 956 |
{ |
| 957 |
\use:c { \c_@@_more_text_prefix_tl #2 / #3 } #4 |
| 958 |
\tl_if_empty:NF #5 |
| 959 |
{ \\ \\ #5 } |
| 960 |
} |
| 961 |
} |
| 962 |
} |
| 963 |
\cs_new:Npn \@@_no_more_text:nnnn #1#2#3#4 { } |
| 964 |
% \end{macrocode} |
| 965 |
% \end{macro} |
| 966 |
% \end{macro} |
| 967 |
% |
| 968 |
% \begin{macro}{\@@_interrupt_wrap:nnn} |
| 969 |
% \begin{macro}{\@@_interrupt_text:n, \@@_interrupt_more_text:n} |
| 970 |
% First setup \TeX{}'s \tn{errhelp} register with the extra help |#1|, |
| 971 |
% then build a nice-looking error message with |#2|. Everything is |
| 972 |
% done using \texttt{e}-type expansion as the new line markers are |
| 973 |
% different for the two type of text and need to be correctly set up. |
| 974 |
% The auxiliary \cs{@@_interrupt_more_text:n} receives its argument |
| 975 |
% as a line-wrapped string, which is thus unaffected by expansion. |
| 976 |
% We ave to split the main text into two parts as only the \enquote{message} |
| 977 |
% itself is wrapped with a leader: the generic help is wrapped at full |
| 978 |
% width. We also have to allow for the two characters used by \tn{errmessage} |
| 979 |
% itself. |
| 980 |
% \begin{macrocode} |
| 981 |
\cs_new_protected:Npn \@@_interrupt_wrap:nnn #1#2#3 |
| 982 |
{ |
| 983 |
\iow_wrap:nnnN { \\ #3 } { } { } \@@_interrupt_more_text:n |
| 984 |
\group_begin: |
| 985 |
\int_sub:Nn \l_iow_line_count_int { 2 } |
| 986 |
\iow_wrap:nenN { \l_@@_text_str : ~ #1 } |
| 987 |
{ |
| 988 |
( \l_@@_name_str ) |
| 989 |
\prg_replicate:nn |
| 990 |
{ |
| 991 |
\str_count:N \l_@@_text_str |
| 992 |
- \str_count:N \l_@@_name_str |
| 993 |
+ 2 |
| 994 |
} |
| 995 |
{ ~ } |
| 996 |
} |
| 997 |
{ } \@@_interrupt_text:n |
| 998 |
\iow_wrap:nnnN { \l_@@_tmp_tl \\ \\ #2 } { } { } |
| 999 |
\@@_interrupt:n |
| 1000 |
} |
| 1001 |
\cs_new_protected:Npn \@@_interrupt_text:n #1 |
| 1002 |
{ |
| 1003 |
\group_end: |
| 1004 |
\tl_set:Nn \l_@@_tmp_tl {#1} |
| 1005 |
} |
| 1006 |
\cs_new_protected:Npn \@@_interrupt_more_text:n #1 |
| 1007 |
{ \exp_args:Ne \tex_errhelp:D { #1 \iow_newline: } } |
| 1008 |
% \end{macrocode} |
| 1009 |
% \end{macro} |
| 1010 |
% \end{macro} |
| 1011 |
% |
| 1012 |
% \begin{macro}{\@@_interrupt:n} |
| 1013 |
% The business end of the process starts by producing some visual |
| 1014 |
% separation of the message from the main part of the log. The error |
| 1015 |
% message needs to be printed with everything made |
| 1016 |
% \enquote{invisible}: \TeX{}'s own information involves the macro in |
| 1017 |
% which \tn{errmessage} is called, and the end of the argument of the |
| 1018 |
% \tn{errmessage}, including the closing brace. We use an active |!| |
| 1019 |
% to call the \tn{errmessage} primitive, and end its argument with |
| 1020 |
% \cs{use_none:n} \Arg{spaces} which fills the output with spaces. Two |
| 1021 |
% trailing closing braces are turned into spaces to hide them as well. |
| 1022 |
% The group in which we alter the definition of the active |!| is |
| 1023 |
% closed before producing the message: this ensures that tokens |
| 1024 |
% inserted by typing |I| in the command-line are inserted after |
| 1025 |
% the message is entirely cleaned up. |
| 1026 |
% |
| 1027 |
% The \cs{__kernel_iow_with:Nnn} auxiliary, defined in \pkg{l3file}, expects |
| 1028 |
% an \meta{integer variable}, an integer \meta{value}, and some |
| 1029 |
% \meta{code}. It runs the \meta{code} after ensuring that the |
| 1030 |
% \meta{integer variable} takes the given \meta{value}, then restores |
| 1031 |
% the former value of the \meta{integer variable} if needed. We use |
| 1032 |
% it to ensure that the \tn{newlinechar} is $10$, as needed for |
| 1033 |
% \cs{iow_newline:} to work, and that \tn{errorcontextlines} is $-1$, |
| 1034 |
% to avoid showing irrelevant context. Note that restoring the former |
| 1035 |
% value of these integers requires inserting tokens after the |
| 1036 |
% \tn{errmessage}, which go in the way of tokens which could be |
| 1037 |
% inserted by the user. This is unavoidable. |
| 1038 |
% \begin{macrocode} |
| 1039 |
\group_begin: |
| 1040 |
\char_set_lccode:nn { 38 } { 32 } % & |
| 1041 |
\char_set_lccode:nn { 46 } { 32 } % . |
| 1042 |
\char_set_lccode:nn { 123 } { 32 } % { |
| 1043 |
\char_set_lccode:nn { 125 } { 32 } % } |
| 1044 |
\char_set_catcode_active:N \& |
| 1045 |
\tex_lowercase:D |
| 1046 |
{ |
| 1047 |
\group_end: |
| 1048 |
\cs_new_protected:Npn \@@_interrupt:n #1 |
| 1049 |
{ |
| 1050 |
\iow_term:n { } |
| 1051 |
\__kernel_iow_with:Nnn \tex_newlinechar:D { `\^^J } |
| 1052 |
{ |
| 1053 |
\__kernel_iow_with:Nnn \tex_errorcontextlines:D { -1 } |
| 1054 |
{ |
| 1055 |
\group_begin: |
| 1056 |
\cs_set_protected:Npn & |
| 1057 |
{ |
| 1058 |
\tex_errmessage:D |
| 1059 |
{ |
| 1060 |
#1 |
| 1061 |
\use_none:n |
| 1062 |
{ ............................................ } |
| 1063 |
} |
| 1064 |
} |
| 1065 |
\exp_after:wN |
| 1066 |
\group_end: |
| 1067 |
& |
| 1068 |
} |
| 1069 |
} |
| 1070 |
} |
| 1071 |
} |
| 1072 |
% \end{macrocode} |
| 1073 |
% \end{macro} |
| 1074 |
% |
| 1075 |
% \subsection{Displaying messages} |
| 1076 |
% |
| 1077 |
% \LaTeX{} is handling error messages and so the \TeX{} ones are disabled. |
| 1078 |
% \begin{macrocode} |
| 1079 |
\int_gset:Nn \tex_errorcontextlines:D { -1 } |
| 1080 |
% \end{macrocode} |
| 1081 |
% |
| 1082 |
% \begin{macro}[EXP] |
| 1083 |
% { |
| 1084 |
% \msg_fatal_text:n , |
| 1085 |
% \msg_critical_text:n , |
| 1086 |
% \msg_error_text:n , |
| 1087 |
% \msg_warning_text:n , |
| 1088 |
% \msg_info_text:n |
| 1089 |
% } |
| 1090 |
% \begin{macro}[EXP]{\@@_text:nn} |
| 1091 |
% \begin{macro}[EXP]{\@@_text:n} |
| 1092 |
% A function for issuing messages: both the text and order could |
| 1093 |
% in principle vary. The module name may be empty for kernel messages, |
| 1094 |
% hence the slightly contorted code path for a space. |
| 1095 |
% \begin{macrocode} |
| 1096 |
\cs_new:Npn \msg_fatal_text:n #1 |
| 1097 |
{ |
| 1098 |
Fatal ~ |
| 1099 |
\msg_error_text:n {#1} |
| 1100 |
} |
| 1101 |
\cs_new:Npn \msg_critical_text:n #1 |
| 1102 |
{ |
| 1103 |
Critical ~ |
| 1104 |
\msg_error_text:n {#1} |
| 1105 |
} |
| 1106 |
\cs_new:Npn \msg_error_text:n #1 |
| 1107 |
{ \@@_text:nn {#1} { Error } } |
| 1108 |
\cs_new:Npn \msg_warning_text:n #1 |
| 1109 |
{ \@@_text:nn {#1} { Warning } } |
| 1110 |
\cs_new:Npn \msg_info_text:n #1 |
| 1111 |
{ \@@_text:nn {#1} { Info } } |
| 1112 |
\cs_new:Npn \@@_text:nn #1#2 |
| 1113 |
{ |
| 1114 |
\exp_args:Nf \@@_text:n { \msg_module_type:n {#1} } |
| 1115 |
\exp_args:Nf \@@_text:n { \msg_module_name:n {#1} } |
| 1116 |
#2 |
| 1117 |
} |
| 1118 |
\cs_new:Npn \@@_text:n #1 |
| 1119 |
{ |
| 1120 |
\tl_if_blank:nF {#1} |
| 1121 |
{ #1 ~ } |
| 1122 |
} |
| 1123 |
% \end{macrocode} |
| 1124 |
% \end{macro} |
| 1125 |
% \end{macro} |
| 1126 |
% \end{macro} |
| 1127 |
% |
| 1128 |
% \begin{variable}{\g_msg_module_name_prop, \g_msg_module_type_prop} |
| 1129 |
% For storing public module information: the kernel data is set up |
| 1130 |
% in advance. |
| 1131 |
% \begin{macrocode} |
| 1132 |
\prop_new:N \g_msg_module_name_prop |
| 1133 |
\prop_new:N \g_msg_module_type_prop |
| 1134 |
\prop_gput:Nnn \g_msg_module_type_prop { LaTeX } { } |
| 1135 |
% \end{macrocode} |
| 1136 |
% \end{variable} |
| 1137 |
% |
| 1138 |
% \begin{macro}[EXP]{\msg_module_type:n} |
| 1139 |
% Contextual footer information, with the potential to give modules an |
| 1140 |
% alternative name. |
| 1141 |
% \begin{macrocode} |
| 1142 |
\cs_new:Npn \msg_module_type:n #1 |
| 1143 |
{ |
| 1144 |
\prop_if_in:NnTF \g_msg_module_type_prop {#1} |
| 1145 |
{ \prop_item:Nn \g_msg_module_type_prop {#1} } |
| 1146 |
{ Package } |
| 1147 |
} |
| 1148 |
% \end{macrocode} |
| 1149 |
% \end{macro} |
| 1150 |
% |
| 1151 |
% \begin{macro}[EXP]{\msg_module_name:n, \msg_see_documentation_text:n} |
| 1152 |
% Contextual footer information, with the potential to give modules an |
| 1153 |
% alternative name. |
| 1154 |
% \begin{macrocode} |
| 1155 |
\cs_new:Npn \msg_module_name:n #1 |
| 1156 |
{ |
| 1157 |
\prop_if_in:NnTF \g_msg_module_name_prop {#1} |
| 1158 |
{ \prop_item:Nn \g_msg_module_name_prop {#1} } |
| 1159 |
{#1} |
| 1160 |
} |
| 1161 |
\cs_new:Npn \msg_see_documentation_text:n #1 |
| 1162 |
{ |
| 1163 |
See~the~ \msg_module_name:n {#1} ~ |
| 1164 |
documentation~for~further~information. |
| 1165 |
} |
| 1166 |
% \end{macrocode} |
| 1167 |
% \end{macro} |
| 1168 |
% |
| 1169 |
% \begin{macro}{\@@_class_new:nn} |
| 1170 |
% \begin{macrocode} |
| 1171 |
\group_begin: |
| 1172 |
\cs_set_protected:Npn \@@_class_new:nn #1#2 |
| 1173 |
{ |
| 1174 |
\prop_new:c { l_@@_redirect_ #1 _prop } |
| 1175 |
\cs_new_protected:cpn { @@_ #1 _code:nnnnnn } |
| 1176 |
##1##2##3##4##5##6 {#2} |
| 1177 |
\cs_new_protected:cpn { msg_ #1 :nnnnnn } ##1##2##3##4##5##6 |
| 1178 |
{ |
| 1179 |
\use:e |
| 1180 |
{ |
| 1181 |
\exp_not:n { \@@_use:nnnnnnn {#1} {##1} {##2} } |
| 1182 |
{ \tl_to_str:n {##3} } { \tl_to_str:n {##4} } |
| 1183 |
{ \tl_to_str:n {##5} } { \tl_to_str:n {##6} } |
| 1184 |
} |
| 1185 |
} |
| 1186 |
\cs_new_protected:cpe { msg_ #1 :nnnnn } ##1##2##3##4##5 |
| 1187 |
{ \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} {##3} {##4} {##5} { } } |
| 1188 |
\cs_new_protected:cpe { msg_ #1 :nnnn } ##1##2##3##4 |
| 1189 |
{ \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} {##3} {##4} { } { } } |
| 1190 |
\cs_new_protected:cpe { msg_ #1 :nnn } ##1##2##3 |
| 1191 |
{ \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} {##3} { } { } { } } |
| 1192 |
\cs_new_protected:cpe { msg_ #1 :nn } ##1##2 |
| 1193 |
{ \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} { } { } { } { } } |
| 1194 |
\cs_generate_variant:cn { msg_ #1 :nnn } |
| 1195 |
{ nnV , nne , nnx } |
| 1196 |
\cs_generate_variant:cn { msg_ #1 :nnnn } |
| 1197 |
{ nnVV , nnVn , nnnV , nnne , nnnx , nnee , nnxx } |
| 1198 |
\cs_generate_variant:cn { msg_ #1 :nnnnn } |
| 1199 |
{ nnnee , nnnxx , nneee , nnxxx } |
| 1200 |
\cs_generate_variant:cn { msg_ #1 :nnnnnn } { nneeee , nnxxxx } |
| 1201 |
} |
| 1202 |
% \end{macrocode} |
| 1203 |
% \end{macro} |
| 1204 |
% |
| 1205 |
% \begin{macro} |
| 1206 |
% { |
| 1207 |
% \msg_fatal:nnnnnn , |
| 1208 |
% \msg_fatal:nnnnn , |
| 1209 |
% \msg_fatal:nnnn , |
| 1210 |
% \msg_fatal:nnn , |
| 1211 |
% \msg_fatal:nn , |
| 1212 |
% \msg_fatal:nnVV , |
| 1213 |
% \msg_fatal:nnVn , |
| 1214 |
% \msg_fatal:nnnV , |
| 1215 |
% \msg_fatal:nnV , |
| 1216 |
% \msg_fatal:nneeee , |
| 1217 |
% \msg_fatal:nneee , |
| 1218 |
% \msg_fatal:nnxxxx , |
| 1219 |
% \msg_fatal:nnxxx , |
| 1220 |
% \msg_fatal:nnnee , |
| 1221 |
% \msg_fatal:nnee , |
| 1222 |
% \msg_fatal:nnnxx , |
| 1223 |
% \msg_fatal:nnxx , |
| 1224 |
% \msg_fatal:nnnx , |
| 1225 |
% \msg_fatal:nnne , |
| 1226 |
% \msg_fatal:nne , |
| 1227 |
% \msg_fatal:nnx |
| 1228 |
% } |
| 1229 |
% \begin{macro}{\@@_fatal_exit:} |
| 1230 |
% For fatal errors, after the error message \TeX{} bails out. We force |
| 1231 |
% a bail out rather than using \tn{end} as this means it does not |
| 1232 |
% matter if we are in a context where normally the run cannot end. |
| 1233 |
% \begin{macrocode} |
| 1234 |
\@@_class_new:nn { fatal } |
| 1235 |
{ |
| 1236 |
\@@_interrupt:NnnnN |
| 1237 |
\msg_fatal_text:n {#1} {#2} |
| 1238 |
{ {#3} {#4} {#5} {#6} } |
| 1239 |
\c_@@_fatal_text_tl |
| 1240 |
\@@_fatal_exit: |
| 1241 |
} |
| 1242 |
\cs_new_protected:Npn \@@_fatal_exit: |
| 1243 |
{ |
| 1244 |
\tex_batchmode:D |
| 1245 |
\tex_read:D -1 to \l_@@_tmp_tl |
| 1246 |
} |
| 1247 |
% \end{macrocode} |
| 1248 |
% \end{macro} |
| 1249 |
% \end{macro} |
| 1250 |
% |
| 1251 |
% \begin{macro} |
| 1252 |
% { |
| 1253 |
% \msg_critical:nnnnnn , |
| 1254 |
% \msg_critical:nnnnn , |
| 1255 |
% \msg_critical:nnnn , |
| 1256 |
% \msg_critical:nnn , |
| 1257 |
% \msg_critical:nn , |
| 1258 |
% \msg_critical:nnVV , |
| 1259 |
% \msg_critical:nnVn , |
| 1260 |
% \msg_critical:nnnV , |
| 1261 |
% \msg_critical:nnV , |
| 1262 |
% \msg_critical:nneeee , |
| 1263 |
% \msg_critical:nneee , |
| 1264 |
% \msg_critical:nnxxxx , |
| 1265 |
% \msg_critical:nnxxx , |
| 1266 |
% \msg_critical:nnnee , |
| 1267 |
% \msg_critical:nnee , |
| 1268 |
% \msg_critical:nnnxx , |
| 1269 |
% \msg_critical:nnxx , |
| 1270 |
% \msg_critical:nnnx , |
| 1271 |
% \msg_critical:nnne , |
| 1272 |
% \msg_critical:nne , |
| 1273 |
% \msg_critical:nnx |
| 1274 |
% } |
| 1275 |
% Not quite so bad: just end the current file. |
| 1276 |
% \begin{macrocode} |
| 1277 |
\@@_class_new:nn { critical } |
| 1278 |
{ |
| 1279 |
\@@_interrupt:NnnnN |
| 1280 |
\msg_critical_text:n {#1} {#2} |
| 1281 |
{ {#3} {#4} {#5} {#6} } |
| 1282 |
\c_@@_critical_text_tl |
| 1283 |
\tex_endinput:D |
| 1284 |
} |
| 1285 |
% \end{macrocode} |
| 1286 |
% \end{macro} |
| 1287 |
% |
| 1288 |
% \begin{macro} |
| 1289 |
% { |
| 1290 |
% \msg_error:nnnnnn , |
| 1291 |
% \msg_error:nnnnn , |
| 1292 |
% \msg_error:nnnn , |
| 1293 |
% \msg_error:nnn , |
| 1294 |
% \msg_error:nn , |
| 1295 |
% \msg_error:nnVV , |
| 1296 |
% \msg_error:nnVn , |
| 1297 |
% \msg_error:nnnV , |
| 1298 |
% \msg_error:nnV , |
| 1299 |
% \msg_error:nneeee , |
| 1300 |
% \msg_error:nneee , |
| 1301 |
% \msg_error:nnxxxx , |
| 1302 |
% \msg_error:nnxxx , |
| 1303 |
% \msg_error:nnnee , |
| 1304 |
% \msg_error:nnee , |
| 1305 |
% \msg_error:nnnxx , |
| 1306 |
% \msg_error:nnxx , |
| 1307 |
% \msg_error:nnnx , |
| 1308 |
% \msg_error:nnne , |
| 1309 |
% \msg_error:nne , |
| 1310 |
% \msg_error:nnx |
| 1311 |
% } |
| 1312 |
% For an error, the interrupt routine is called. We check if there is |
| 1313 |
% a \enquote{more text} by comparing that control sequence with a |
| 1314 |
% permanently empty text. We have to undefine the bootstrap versions |
| 1315 |
% here. |
| 1316 |
% \begin{macrocode} |
| 1317 |
\cs_undefine:N \msg_error:nnee |
| 1318 |
\cs_undefine:N \msg_error:nne |
| 1319 |
\cs_undefine:N \msg_error:nn |
| 1320 |
\@@_class_new:nn { error } |
| 1321 |
{ |
| 1322 |
\@@_interrupt:NnnnN |
| 1323 |
\msg_error_text:n {#1} {#2} |
| 1324 |
{ {#3} {#4} {#5} {#6} } |
| 1325 |
\c_empty_tl |
| 1326 |
} |
| 1327 |
% \end{macrocode} |
| 1328 |
% \end{macro} |
| 1329 |
% |
| 1330 |
% \begin{macro} |
| 1331 |
% { |
| 1332 |
% \@@_info_aux:NNnnnnnn , |
| 1333 |
% \msg_warning:nnnnnn , |
| 1334 |
% \msg_warning:nnnnn , |
| 1335 |
% \msg_warning:nnnn , |
| 1336 |
% \msg_warning:nnn , |
| 1337 |
% \msg_warning:nn , |
| 1338 |
% \msg_warning:nnVV , |
| 1339 |
% \msg_warning:nnVn , |
| 1340 |
% \msg_warning:nnnV , |
| 1341 |
% \msg_warning:nnV , |
| 1342 |
% \msg_warning:nneeee , |
| 1343 |
% \msg_warning:nneee , |
| 1344 |
% \msg_warning:nnxxxx , |
| 1345 |
% \msg_warning:nnxxx , |
| 1346 |
% \msg_warning:nnnee , |
| 1347 |
% \msg_warning:nnee , |
| 1348 |
% \msg_warning:nnnxx , |
| 1349 |
% \msg_warning:nnxx , |
| 1350 |
% \msg_warning:nnnx , |
| 1351 |
% \msg_warning:nnne , |
| 1352 |
% \msg_warning:nne , |
| 1353 |
% \msg_warning:nnx , |
| 1354 |
% \msg_note:nnnnnn , |
| 1355 |
% \msg_note:nnnnn , |
| 1356 |
% \msg_note:nnnn , |
| 1357 |
% \msg_note:nnn , |
| 1358 |
% \msg_note:nn , |
| 1359 |
% \msg_note:nnVV , |
| 1360 |
% \msg_note:nnVn , |
| 1361 |
% \msg_note:nnnV , |
| 1362 |
% \msg_note:nnV , |
| 1363 |
% \msg_note:nneeee , |
| 1364 |
% \msg_note:nneee , |
| 1365 |
% \msg_note:nnxxxx , |
| 1366 |
% \msg_note:nnxxx , |
| 1367 |
% \msg_note:nnnee , |
| 1368 |
% \msg_note:nnee , |
| 1369 |
% \msg_note:nnnxx , |
| 1370 |
% \msg_note:nnxx , |
| 1371 |
% \msg_note:nnnx , |
| 1372 |
% \msg_note:nnne , |
| 1373 |
% \msg_note:nne , |
| 1374 |
% \msg_note:nnx , |
| 1375 |
% \msg_info:nnnnnn , |
| 1376 |
% \msg_info:nnnnn , |
| 1377 |
% \msg_info:nnnn , |
| 1378 |
% \msg_info:nnn , |
| 1379 |
% \msg_info:nn , |
| 1380 |
% \msg_info:nnVV , |
| 1381 |
% \msg_info:nnVn , |
| 1382 |
% \msg_info:nnnV , |
| 1383 |
% \msg_info:nnV , |
| 1384 |
% \msg_info:nneeee , |
| 1385 |
% \msg_info:nneee , |
| 1386 |
% \msg_info:nnxxxx , |
| 1387 |
% \msg_info:nnxxx , |
| 1388 |
% \msg_info:nnnee , |
| 1389 |
% \msg_info:nnee , |
| 1390 |
% \msg_info:nnnxx , |
| 1391 |
% \msg_info:nnxx , |
| 1392 |
% \msg_info:nnnx , |
| 1393 |
% \msg_info:nnne , |
| 1394 |
% \msg_info:nne , |
| 1395 |
% \msg_info:nnx |
| 1396 |
% } |
| 1397 |
% Warnings and information messages have no decoration. Warnings are |
| 1398 |
% printed to the terminal while information can either go to the log |
| 1399 |
% or both log and terminal. |
| 1400 |
% \begin{macrocode} |
| 1401 |
\cs_new_protected:Npn \@@_info_aux:NNnnnnnn #1#2#3#4#5#6#7#8 |
| 1402 |
{ |
| 1403 |
\str_set:Ne \l_@@_text_str { #2 {#3} } |
| 1404 |
\str_set:Ne \l_@@_name_str { \msg_module_name:n {#3} } |
| 1405 |
#1 { } |
| 1406 |
\iow_wrap:nenN |
| 1407 |
{ |
| 1408 |
\l_@@_text_str : ~ |
| 1409 |
\use:c { \c_@@_text_prefix_tl #3 / #4 } {#5} {#6} {#7} {#8} |
| 1410 |
} |
| 1411 |
{ |
| 1412 |
( \l_@@_name_str ) |
| 1413 |
\prg_replicate:nn |
| 1414 |
{ |
| 1415 |
\str_count:N \l_@@_text_str |
| 1416 |
- \str_count:N \l_@@_name_str |
| 1417 |
} |
| 1418 |
{ ~ } |
| 1419 |
} |
| 1420 |
{ } #1 |
| 1421 |
#1 { } |
| 1422 |
} |
| 1423 |
\@@_class_new:nn { warning } |
| 1424 |
{ |
| 1425 |
\@@_info_aux:NNnnnnnn \iow_term:n \msg_warning_text:n |
| 1426 |
{#1} {#2} {#3} {#4} {#5} {#6} |
| 1427 |
} |
| 1428 |
\@@_class_new:nn { note } |
| 1429 |
{ |
| 1430 |
\@@_info_aux:NNnnnnnn \iow_term:n \msg_info_text:n |
| 1431 |
{#1} {#2} {#3} {#4} {#5} {#6} |
| 1432 |
} |
| 1433 |
\@@_class_new:nn { info } |
| 1434 |
{ |
| 1435 |
\@@_info_aux:NNnnnnnn \iow_log:n \msg_info_text:n |
| 1436 |
{#1} {#2} {#3} {#4} {#5} {#6} |
| 1437 |
} |
| 1438 |
% \end{macrocode} |
| 1439 |
% \end{macro} |
| 1440 |
% |
| 1441 |
% \begin{macro} |
| 1442 |
% { |
| 1443 |
% \msg_term:nnnnnn , |
| 1444 |
% \msg_term:nnnnn , |
| 1445 |
% \msg_term:nnnn , |
| 1446 |
% \msg_term:nnn , |
| 1447 |
% \msg_term:nn , |
| 1448 |
% \msg_term:nnVV , |
| 1449 |
% \msg_term:nnVn , |
| 1450 |
% \msg_term:nnnV , |
| 1451 |
% \msg_term:nnV , |
| 1452 |
% \msg_term:nneeee , |
| 1453 |
% \msg_term:nneee , |
| 1454 |
% \msg_term:nnxxxx , |
| 1455 |
% \msg_term:nnxxx , |
| 1456 |
% \msg_term:nnnee , |
| 1457 |
% \msg_term:nnee , |
| 1458 |
% \msg_term:nnnxx , |
| 1459 |
% \msg_term:nnxx , |
| 1460 |
% \msg_term:nnnx , |
| 1461 |
% \msg_term:nnne , |
| 1462 |
% \msg_term:nne , |
| 1463 |
% \msg_term:nnx , |
| 1464 |
% \msg_log:nnnnnn , |
| 1465 |
% \msg_log:nnnnn , |
| 1466 |
% \msg_log:nnnn , |
| 1467 |
% \msg_log:nnn , |
| 1468 |
% \msg_log:nn , |
| 1469 |
% \msg_log:nnVV , |
| 1470 |
% \msg_log:nnVn , |
| 1471 |
% \msg_log:nnnV , |
| 1472 |
% \msg_log:nnV , |
| 1473 |
% \msg_log:nneeee , |
| 1474 |
% \msg_log:nneee , |
| 1475 |
% \msg_log:nnxxxx , |
| 1476 |
% \msg_log:nnxxx , |
| 1477 |
% \msg_log:nnnee , |
| 1478 |
% \msg_log:nnee , |
| 1479 |
% \msg_log:nnnxx , |
| 1480 |
% \msg_log:nnxx , |
| 1481 |
% \msg_log:nnnx , |
| 1482 |
% \msg_log:nnne , |
| 1483 |
% \msg_log:nne , |
| 1484 |
% \msg_log:nnx |
| 1485 |
% } |
| 1486 |
% \enquote{Log} data is very similar to information, but with no extras |
| 1487 |
% added. |
| 1488 |
% \enquote{Term} is used for communicating with the user through the |
| 1489 |
% terminal, like diagnostic messages, and debugging. This is similar |
| 1490 |
% to \enquote{log} messages, but uses the terminal output. |
| 1491 |
% \begin{macrocode} |
| 1492 |
\@@_class_new:nn { log } |
| 1493 |
{ |
| 1494 |
\iow_wrap:nnnN |
| 1495 |
{ \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } |
| 1496 |
{ } { } \iow_log:n |
| 1497 |
} |
| 1498 |
\@@_class_new:nn { term } |
| 1499 |
{ |
| 1500 |
\iow_wrap:nnnN |
| 1501 |
{ \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } |
| 1502 |
{ } { } \iow_term:n |
| 1503 |
} |
| 1504 |
% \end{macrocode} |
| 1505 |
% \end{macro} |
| 1506 |
% |
| 1507 |
% \begin{macro} |
| 1508 |
% { |
| 1509 |
% \msg_none:nnnnnn , |
| 1510 |
% \msg_none:nnnnn , |
| 1511 |
% \msg_none:nnnn , |
| 1512 |
% \msg_none:nnn , |
| 1513 |
% \msg_none:nn , |
| 1514 |
% \msg_none:nnVV , |
| 1515 |
% \msg_none:nnVn , |
| 1516 |
% \msg_none:nnnV , |
| 1517 |
% \msg_none:nnV , |
| 1518 |
% \msg_none:nneeee , |
| 1519 |
% \msg_none:nneee , |
| 1520 |
% \msg_none:nnxxxx , |
| 1521 |
% \msg_none:nnxxx , |
| 1522 |
% \msg_none:nnnee , |
| 1523 |
% \msg_none:nnee , |
| 1524 |
% \msg_none:nnnxx , |
| 1525 |
% \msg_none:nnxx , |
| 1526 |
% \msg_none:nnnx , |
| 1527 |
% \msg_none:nnne , |
| 1528 |
% \msg_none:nne , |
| 1529 |
% \msg_none:nnx |
| 1530 |
% } |
| 1531 |
% The \texttt{none} message type is needed so that input can be gobbled. |
| 1532 |
% \begin{macrocode} |
| 1533 |
\@@_class_new:nn { none } { } |
| 1534 |
% \end{macrocode} |
| 1535 |
% \end{macro} |
| 1536 |
% |
| 1537 |
% \begin{macro} |
| 1538 |
% { |
| 1539 |
% \msg_show:nnnnnn , |
| 1540 |
% \msg_show:nnnnn , |
| 1541 |
% \msg_show:nnnn , |
| 1542 |
% \msg_show:nnn , |
| 1543 |
% \msg_show:nn , |
| 1544 |
% \msg_show:nnVV , |
| 1545 |
% \msg_show:nnVn , |
| 1546 |
% \msg_show:nnnV , |
| 1547 |
% \msg_show:nnV , |
| 1548 |
% \msg_show:nneeee , |
| 1549 |
% \msg_show:nneee , |
| 1550 |
% \msg_show:nnxxxx , |
| 1551 |
% \msg_show:nnxxx , |
| 1552 |
% \msg_show:nnnee , |
| 1553 |
% \msg_show:nnee , |
| 1554 |
% \msg_show:nnnxx , |
| 1555 |
% \msg_show:nnxx , |
| 1556 |
% \msg_show:nnnx , |
| 1557 |
% \msg_show:nnne , |
| 1558 |
% \msg_show:nne , |
| 1559 |
% \msg_show:nnx |
| 1560 |
% } |
| 1561 |
% \begin{macro}{\@@_show:n, \@@_show:w, \@@_show_dot:w, \@@_show:nn} |
| 1562 |
% The \texttt{show} message type is used for \cs{seq_show:N} and |
| 1563 |
% similar complicated data structures. Wrap the given text with a |
| 1564 |
% trailing dot (important later) then pass it to \cs{@@_show:n}. If |
| 1565 |
% there is |\\>~| (or if the whole thing starts with |>~|) we split |
| 1566 |
% there, print the first part and show the second part using |
| 1567 |
% \tn{showtokens} (the \cs{exp_after:wN} ensure a nice display). Note |
| 1568 |
% that this primitive adds a leading |>~| and trailing dot. That is |
| 1569 |
% why we included a trailing dot before wrapping and removed it |
| 1570 |
% afterwards. If there is no |\\>~| do the same but with an empty |
| 1571 |
% second part which adds a spurious but inevitable |>~.| |
| 1572 |
% \begin{macrocode} |
| 1573 |
\@@_class_new:nn { show } |
| 1574 |
{ |
| 1575 |
\iow_wrap:nnnN |
| 1576 |
{ \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } |
| 1577 |
{ } { } \@@_show:n |
| 1578 |
} |
| 1579 |
\cs_new_protected:Npn \@@_show:n #1 |
| 1580 |
{ |
| 1581 |
\tl_if_in:nnTF { ^^J #1 } { ^^J > ~ } |
| 1582 |
{ |
| 1583 |
\tl_if_in:nnTF { #1 \s_@@_mark } { . \s_@@_mark } |
| 1584 |
{ \@@_show_dot:w } { \@@_show:w } |
| 1585 |
^^J #1 \s_@@_stop |
| 1586 |
} |
| 1587 |
{ \@@_show:nn { ? #1 } { } } |
| 1588 |
} |
| 1589 |
\cs_new:Npn \@@_show_dot:w #1 ^^J > ~ #2 . \s_@@_stop |
| 1590 |
{ \@@_show:nn {#1} {#2} } |
| 1591 |
\cs_new:Npn \@@_show:w #1 ^^J > ~ #2 \s_@@_stop |
| 1592 |
{ \@@_show:nn {#1} {#2} } |
| 1593 |
\cs_new_protected:Npn \@@_show:nn #1#2 |
| 1594 |
{ |
| 1595 |
\tl_if_empty:nF {#1} |
| 1596 |
{ \exp_args:No \iow_term:n { \use_none:n #1 } } |
| 1597 |
\tl_set:Nn \l_@@_tmp_tl {#2} |
| 1598 |
\__kernel_iow_with:Nnn \tex_newlinechar:D { 10 } |
| 1599 |
{ |
| 1600 |
\__kernel_iow_with:Nnn \tex_errorcontextlines:D { -1 } |
| 1601 |
{ |
| 1602 |
\tex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN |
| 1603 |
{ \exp_after:wN \l_@@_tmp_tl } |
| 1604 |
} |
| 1605 |
} |
| 1606 |
} |
| 1607 |
% \end{macrocode} |
| 1608 |
% \end{macro} |
| 1609 |
% \end{macro} |
| 1610 |
% |
| 1611 |
% End the group to eliminate \cs{@@_class_new:nn}. |
| 1612 |
% \begin{macrocode} |
| 1613 |
\group_end: |
| 1614 |
% \end{macrocode} |
| 1615 |
% |
| 1616 |
% \begin{macro}[EXP]{\msg_show_item:n} |
| 1617 |
% \begin{macro}[EXP]{\msg_show_item_unbraced:n} |
| 1618 |
% \begin{macro}[EXP]{\msg_show_item:nn} |
| 1619 |
% \begin{macro}[EXP]{\msg_show_item_unbraced:nn} |
| 1620 |
% Each item in the variable is formatted using one of the following |
| 1621 |
% functions. We cannot use |\\| and so on because these short-hands |
| 1622 |
% cannot be used inside the arguments of messages, only when defining |
| 1623 |
% the messages. We need to use |^^J| here directly as \pkg{l3file} is |
| 1624 |
% not yet loaded. |
| 1625 |
% \begin{macrocode} |
| 1626 |
\cs_new:Npe \msg_show_item:n #1 |
| 1627 |
{ ^^J > ~ \c_space_tl \exp_not:N \tl_to_str:n { {#1} } } |
| 1628 |
\cs_new:Npe \msg_show_item_unbraced:n #1 |
| 1629 |
{ ^^J > ~ \c_space_tl \exp_not:N \tl_to_str:n {#1} } |
| 1630 |
\cs_new:Npe \msg_show_item:nn #1#2 |
| 1631 |
{ |
| 1632 |
^^J > \use:nn { ~ } { ~ } |
| 1633 |
\exp_not:N \tl_to_str:n { {#1} } |
| 1634 |
\use:nn { ~ } { ~ } => \use:nn { ~ } { ~ } |
| 1635 |
\exp_not:N \tl_to_str:n { {#2} } |
| 1636 |
} |
| 1637 |
\cs_new:Npe \msg_show_item_unbraced:nn #1#2 |
| 1638 |
{ |
| 1639 |
^^J > \use:nn { ~ } { ~ } |
| 1640 |
\exp_not:N \tl_to_str:n {#1} |
| 1641 |
\use:nn { ~ } { ~ } => \use:nn { ~ } { ~ } |
| 1642 |
\exp_not:N \tl_to_str:n {#2} |
| 1643 |
} |
| 1644 |
% \end{macrocode} |
| 1645 |
% \end{macro} |
| 1646 |
% \end{macro} |
| 1647 |
% \end{macro} |
| 1648 |
% \end{macro} |
| 1649 |
% |
| 1650 |
% \begin{macro}{\@@_class_chk_exist:nT} |
| 1651 |
% Checking that a message class exists. We build this from |
| 1652 |
% \cs{cs_if_free:cTF} rather than \cs{cs_if_exist:cTF} because that |
| 1653 |
% avoids reading the second argument earlier than necessary. |
| 1654 |
% \begin{macrocode} |
| 1655 |
\cs_new:Npn \@@_class_chk_exist:nT #1 |
| 1656 |
{ |
| 1657 |
\cs_if_free:cTF { @@_ #1 _code:nnnnnn } |
| 1658 |
{ \msg_error:nnn { msg } { class-unknown } {#1} } |
| 1659 |
} |
| 1660 |
% \end{macrocode} |
| 1661 |
% \end{macro} |
| 1662 |
% |
| 1663 |
% \begin{variable}{\l_@@_class_tl, \l_@@_current_class_tl} |
| 1664 |
% Support variables needed for the redirection system. |
| 1665 |
% \begin{macrocode} |
| 1666 |
\tl_new:N \l_@@_class_tl |
| 1667 |
\tl_new:N \l_@@_current_class_tl |
| 1668 |
% \end{macrocode} |
| 1669 |
% \end{variable} |
| 1670 |
% |
| 1671 |
% \begin{variable}{\l_@@_redirect_prop} |
| 1672 |
% For redirection of individually-named messages |
| 1673 |
% \begin{macrocode} |
| 1674 |
\prop_new:N \l_@@_redirect_prop |
| 1675 |
% \end{macrocode} |
| 1676 |
% \end{variable} |
| 1677 |
% |
| 1678 |
% \begin{variable}{\l_@@_hierarchy_seq} |
| 1679 |
% During redirection, split the message name into a sequence: |
| 1680 |
% |{/module/submodule}|, |{/module}|, and |{}|. |
| 1681 |
% \begin{macrocode} |
| 1682 |
\seq_new:N \l_@@_hierarchy_seq |
| 1683 |
% \end{macrocode} |
| 1684 |
% \end{variable} |
| 1685 |
% |
| 1686 |
% \begin{variable}{\l_@@_class_loop_seq} |
| 1687 |
% Classes encountered when following redirections to check for loops. |
| 1688 |
% \begin{macrocode} |
| 1689 |
\seq_new:N \l_@@_class_loop_seq |
| 1690 |
% \end{macrocode} |
| 1691 |
% \end{variable} |
| 1692 |
% |
| 1693 |
% \begin{macro}{\@@_use:nnnnnnn} |
| 1694 |
% \begin{macro} |
| 1695 |
% { |
| 1696 |
% \@@_use_redirect_name:n , \@@_use_hierarchy:nwwN , |
| 1697 |
% \@@_use_redirect_module:n, \@@_use_code: |
| 1698 |
% } |
| 1699 |
% Actually using a message is a multi-step process. First, some |
| 1700 |
% safety checks on the message and class requested. The code and |
| 1701 |
% arguments are then stored to avoid passing them around. The |
| 1702 |
% assignment to \cs{@@_use_code:} is similar to \cs{tl_set:Nn}. |
| 1703 |
% The message is eventually produced with whatever \cs{l_@@_class_tl} |
| 1704 |
% is when \cs{@@_use_code:} is called. |
| 1705 |
% Here is also a good place to suppress tracing output if the |
| 1706 |
% \pkg{trace} package is loaded since all (non-expandable) messages go |
| 1707 |
% through this auxiliary. |
| 1708 |
% \begin{macrocode} |
| 1709 |
\cs_new_protected:Npn \@@_use:nnnnnnn #1#2#3#4#5#6#7 |
| 1710 |
{ |
| 1711 |
\cs_if_exist_use:N \conditionally@traceoff |
| 1712 |
\msg_if_exist:nnTF {#2} {#3} |
| 1713 |
{ |
| 1714 |
\@@_class_chk_exist:nT {#1} |
| 1715 |
{ |
| 1716 |
\tl_set:Nn \l_@@_current_class_tl {#1} |
| 1717 |
\cs_set_protected:Npe \@@_use_code: |
| 1718 |
{ |
| 1719 |
\exp_not:n |
| 1720 |
{ |
| 1721 |
\use:c { @@_ \l_@@_class_tl _code:nnnnnn } |
| 1722 |
{#2} {#3} {#4} {#5} {#6} {#7} |
| 1723 |
} |
| 1724 |
} |
| 1725 |
\@@_use_redirect_name:n { #2 / #3 } |
| 1726 |
} |
| 1727 |
} |
| 1728 |
{ \msg_error:nnnn { msg } { unknown } {#2} {#3} } |
| 1729 |
\cs_if_exist_use:N \conditionally@traceon |
| 1730 |
} |
| 1731 |
\cs_new_protected:Npn \@@_use_code: { } |
| 1732 |
% \end{macrocode} |
| 1733 |
% The first check is for a individual message redirection. If this |
| 1734 |
% applies then no further redirection is attempted. Otherwise, split |
| 1735 |
% the message name into \meta{module}, \meta{submodule} and \meta{message} |
| 1736 |
% (with an |
| 1737 |
% arbitrary number of slashes), and store |{/module/submodule}|, |
| 1738 |
% |{/module}| and |{}| into \cs{l_@@_hierarchy_seq}. We then |
| 1739 |
% map through this sequence, applying the most specific redirection. |
| 1740 |
% \begin{macrocode} |
| 1741 |
\cs_new_protected:Npn \@@_use_redirect_name:n #1 |
| 1742 |
{ |
| 1743 |
\prop_get:NnNTF \l_@@_redirect_prop { / #1 } \l_@@_class_tl |
| 1744 |
{ \@@_use_code: } |
| 1745 |
{ |
| 1746 |
\seq_clear:N \l_@@_hierarchy_seq |
| 1747 |
\@@_use_hierarchy:nwwN { } |
| 1748 |
#1 \s_@@_mark \@@_use_hierarchy:nwwN |
| 1749 |
/ \s_@@_mark \@@_use_none_delimit_by_s_stop:w |
| 1750 |
\s_@@_stop |
| 1751 |
\@@_use_redirect_module:n { } |
| 1752 |
} |
| 1753 |
} |
| 1754 |
\cs_new_protected:Npn \@@_use_hierarchy:nwwN #1#2 / #3 \s_@@_mark #4 |
| 1755 |
{ |
| 1756 |
\seq_put_left:Nn \l_@@_hierarchy_seq {#1} |
| 1757 |
#4 { #1 / #2 } #3 \s_@@_mark #4 |
| 1758 |
} |
| 1759 |
% \end{macrocode} |
| 1760 |
% At this point, the items of \cs{l_@@_hierarchy_seq} are the |
| 1761 |
% various levels at which we should look for a redirection. |
| 1762 |
% Redirections which are less specific than the argument of |
| 1763 |
% \cs{@@_use_redirect_module:n} are not attempted. This argument is |
| 1764 |
% empty for a class redirection, \texttt{/module} for a module |
| 1765 |
% redirection, etc. Loop through the sequence to find the most |
| 1766 |
% specific redirection, with module |##1|. The loop is interrupted |
| 1767 |
% after testing for a redirection for |##1| equal to the argument |#1| |
| 1768 |
% (least specific redirection allowed). When a redirection is found, |
| 1769 |
% break the mapping, then if the redirection targets the same class, |
| 1770 |
% output the code with that class, and otherwise set the target as the |
| 1771 |
% new current class, and search for further redirections. Those |
| 1772 |
% redirections should be at least as specific as |##1|. |
| 1773 |
% \begin{macrocode} |
| 1774 |
\cs_new_protected:Npn \@@_use_redirect_module:n #1 |
| 1775 |
{ |
| 1776 |
\seq_map_inline:Nn \l_@@_hierarchy_seq |
| 1777 |
{ |
| 1778 |
\prop_get:cnNTF { l_@@_redirect_ \l_@@_current_class_tl _prop } |
| 1779 |
{##1} \l_@@_class_tl |
| 1780 |
{ |
| 1781 |
\seq_map_break:n |
| 1782 |
{ |
| 1783 |
\tl_if_eq:NNTF \l_@@_current_class_tl \l_@@_class_tl |
| 1784 |
{ \@@_use_code: } |
| 1785 |
{ |
| 1786 |
\tl_set_eq:NN \l_@@_current_class_tl \l_@@_class_tl |
| 1787 |
\@@_use_redirect_module:n {##1} |
| 1788 |
} |
| 1789 |
} |
| 1790 |
} |
| 1791 |
{ |
| 1792 |
\str_if_eq:nnT {##1} {#1} |
| 1793 |
{ |
| 1794 |
\tl_set_eq:NN \l_@@_class_tl \l_@@_current_class_tl |
| 1795 |
\seq_map_break:n { \@@_use_code: } |
| 1796 |
} |
| 1797 |
} |
| 1798 |
} |
| 1799 |
} |
| 1800 |
% \end{macrocode} |
| 1801 |
% \end{macro} |
| 1802 |
% \end{macro} |
| 1803 |
% |
| 1804 |
% \begin{macro}{\msg_redirect_name:nnn} |
| 1805 |
% Named message always use the given class even if that class is |
| 1806 |
% redirected further. An empty target class cancels any existing |
| 1807 |
% redirection for that message. |
| 1808 |
% \begin{macrocode} |
| 1809 |
\cs_new_protected:Npn \msg_redirect_name:nnn #1#2#3 |
| 1810 |
{ |
| 1811 |
\tl_if_empty:nTF {#3} |
| 1812 |
{ \prop_remove:Nn \l_@@_redirect_prop { / #1 / #2 } } |
| 1813 |
{ |
| 1814 |
\@@_class_chk_exist:nT {#3} |
| 1815 |
{ \prop_put:Nnn \l_@@_redirect_prop { / #1 / #2 } {#3} } |
| 1816 |
} |
| 1817 |
} |
| 1818 |
% \end{macrocode} |
| 1819 |
% \end{macro} |
| 1820 |
% |
| 1821 |
% \begin{macro}{\msg_redirect_class:nn, \msg_redirect_module:nnn} |
| 1822 |
% \begin{macro}{\@@_redirect:nnn, \@@_redirect_loop_chk:nnn} |
| 1823 |
% \begin{macro}{\@@_redirect_loop_list:n} |
| 1824 |
% If the target class is empty, eliminate the corresponding |
| 1825 |
% redirection. Otherwise, add the redirection. We must then check |
| 1826 |
% for a loop: as an initialization, we start by storing the initial |
| 1827 |
% class in \cs{l_@@_current_class_tl}. |
| 1828 |
% \begin{macrocode} |
| 1829 |
\cs_new_protected:Npn \msg_redirect_class:nn |
| 1830 |
{ \@@_redirect:nnn { } } |
| 1831 |
\cs_new_protected:Npn \msg_redirect_module:nnn #1 |
| 1832 |
{ \@@_redirect:nnn { / #1 } } |
| 1833 |
\cs_new_protected:Npn \@@_redirect:nnn #1#2#3 |
| 1834 |
{ |
| 1835 |
\@@_class_chk_exist:nT {#2} |
| 1836 |
{ |
| 1837 |
\tl_if_empty:nTF {#3} |
| 1838 |
{ \prop_remove:cn { l_@@_redirect_ #2 _prop } {#1} } |
| 1839 |
{ |
| 1840 |
\@@_class_chk_exist:nT {#3} |
| 1841 |
{ |
| 1842 |
\prop_put:cnn { l_@@_redirect_ #2 _prop } {#1} {#3} |
| 1843 |
\tl_set:Nn \l_@@_current_class_tl {#2} |
| 1844 |
\seq_clear:N \l_@@_class_loop_seq |
| 1845 |
\@@_redirect_loop_chk:nnn {#2} {#3} {#1} |
| 1846 |
} |
| 1847 |
} |
| 1848 |
} |
| 1849 |
} |
| 1850 |
% \end{macrocode} |
| 1851 |
% Since multiple redirections can only happen with increasing |
| 1852 |
% specificity, a loop requires that all steps are of the same |
| 1853 |
% specificity. The new redirection can thus only create a loop with |
| 1854 |
% other redirections for the exact same module, |#1|, and not |
| 1855 |
% submodules. After some initialization above, follow redirections |
| 1856 |
% with \cs{l_@@_class_tl}, and keep track in |
| 1857 |
% \cs{l_@@_class_loop_seq} of the various classes encountered. A |
| 1858 |
% redirection from a class to itself, or the absence of redirection |
| 1859 |
% both mean that there is no loop. A redirection to the initial class |
| 1860 |
% marks a loop. To break it, we must decide which redirection to |
| 1861 |
% cancel. The user most likely wants the newly added redirection to |
| 1862 |
% hold with no further redirection. We thus remove the redirection |
| 1863 |
% starting from |#2|, target of the new redirection. Note that no |
| 1864 |
% message is emitted by any of the underlying functions: otherwise we |
| 1865 |
% may get an infinite loop because of a message from the message |
| 1866 |
% system itself. |
| 1867 |
% \begin{macrocode} |
| 1868 |
\cs_new_protected:Npn \@@_redirect_loop_chk:nnn #1#2#3 |
| 1869 |
{ |
| 1870 |
\seq_put_right:Nn \l_@@_class_loop_seq {#1} |
| 1871 |
\prop_get:cnNT { l_@@_redirect_ #1 _prop } {#3} \l_@@_class_tl |
| 1872 |
{ |
| 1873 |
\str_if_eq:VnF \l_@@_class_tl {#1} |
| 1874 |
{ |
| 1875 |
\tl_if_eq:NNTF \l_@@_class_tl \l_@@_current_class_tl |
| 1876 |
{ |
| 1877 |
\prop_put:cnn { l_@@_redirect_ #2 _prop } {#3} {#2} |
| 1878 |
\msg_warning:nneeee |
| 1879 |
{ msg } { redirect-loop } |
| 1880 |
{ \seq_item:Nn \l_@@_class_loop_seq { 1 } } |
| 1881 |
{ \seq_item:Nn \l_@@_class_loop_seq { 2 } } |
| 1882 |
{#3} |
| 1883 |
{ |
| 1884 |
\seq_map_function:NN \l_@@_class_loop_seq |
| 1885 |
\@@_redirect_loop_list:n |
| 1886 |
{ \seq_item:Nn \l_@@_class_loop_seq { 1 } } |
| 1887 |
} |
| 1888 |
} |
| 1889 |
{ \@@_redirect_loop_chk:onn \l_@@_class_tl {#2} {#3} } |
| 1890 |
} |
| 1891 |
} |
| 1892 |
} |
| 1893 |
\cs_generate_variant:Nn \@@_redirect_loop_chk:nnn { o } |
| 1894 |
\cs_new:Npn \@@_redirect_loop_list:n #1 { {#1} ~ => ~ } |
| 1895 |
% \end{macrocode} |
| 1896 |
% \end{macro} |
| 1897 |
% \end{macro} |
| 1898 |
% \end{macro} |
| 1899 |
% |
| 1900 |
% \subsection{Kernel-specific functions} |
| 1901 |
% |
| 1902 |
% \begin{macro}{\__kernel_msg_show_eval:Nn, \__kernel_msg_log_eval:Nn, \@@_show_eval:nnN} |
| 1903 |
% A short-hand used for \cs{int_show:n} and similar functions that |
| 1904 |
% passes to \cs{tl_show:n} the result of applying |#1| (a |
| 1905 |
% function such as \cs{int_eval:n}) to the expression |#2|. The use of |
| 1906 |
% \texttt{f}-expansion ensures that |#1| is expanded in the scope in which the |
| 1907 |
% show command is called, rather than in the group created by |
| 1908 |
% \cs{iow_wrap:nnnN}. This is only important for expressions |
| 1909 |
% involving the \tn{currentgrouplevel} or \tn{currentgrouptype}. |
| 1910 |
% On the other hand we want the expression to be converted to a string |
| 1911 |
% with the usual escape character, hence within the wrapping code. |
| 1912 |
% \begin{macrocode} |
| 1913 |
\cs_new_protected:Npn \__kernel_msg_show_eval:Nn #1#2 |
| 1914 |
{ \exp_args:Nf \@@_show_eval:nnN { #1 {#2} } {#2} \tl_show:n } |
| 1915 |
\cs_new_protected:Npn \__kernel_msg_log_eval:Nn #1#2 |
| 1916 |
{ \exp_args:Nf \@@_show_eval:nnN { #1 {#2} } {#2} \tl_log:n } |
| 1917 |
\cs_new_protected:Npn \@@_show_eval:nnN #1#2#3 { #3 { #2 = #1 } } |
| 1918 |
% \end{macrocode} |
| 1919 |
% \end{macro} |
| 1920 |
% |
| 1921 |
% These are all retained purely for older \pkg{xparse} support. |
| 1922 |
% |
| 1923 |
% \begin{macro}{\__kernel_msg_new:nnnn, \__kernel_msg_new:nnn} |
| 1924 |
% \begin{macrocode} |
| 1925 |
\cs_new_protected:Npn \__kernel_msg_new:nnnn #1 |
| 1926 |
{ \msg_new:nnnn { LaTeX / #1 } } |
| 1927 |
\cs_new_protected:Npn \__kernel_msg_new:nnn #1 |
| 1928 |
{ \msg_new:nnn { LaTeX / #1 } } |
| 1929 |
% \end{macrocode} |
| 1930 |
% \end{macro} |
| 1931 |
% |
| 1932 |
% \begin{macro} |
| 1933 |
% { |
| 1934 |
% \__kernel_msg_info:nnxx , |
| 1935 |
% \__kernel_msg_warning:nnx , |
| 1936 |
% \__kernel_msg_warning:nnxx , |
| 1937 |
% \__kernel_msg_error:nnx , |
| 1938 |
% \__kernel_msg_error:nnxx , |
| 1939 |
% \__kernel_msg_error:nnxxx |
| 1940 |
% } |
| 1941 |
% \begin{macrocode} |
| 1942 |
\cs_new_protected:Npn \__kernel_msg_info:nnxx #1 |
| 1943 |
{ \msg_info:nnee { LaTeX / #1 } } |
| 1944 |
\cs_new_protected:Npn \__kernel_msg_warning:nnx #1 |
| 1945 |
{ \msg_warning:nne { LaTeX / #1 } } |
| 1946 |
\cs_new_protected:Npn \__kernel_msg_warning:nnxx #1 |
| 1947 |
{ \msg_warning:nnee { LaTeX / #1 } } |
| 1948 |
\cs_new_protected:Npn \__kernel_msg_error:nnx #1 |
| 1949 |
{ \msg_error:nne { LaTeX / #1 } } |
| 1950 |
\cs_new_protected:Npn \__kernel_msg_error:nnxx #1 |
| 1951 |
{ \msg_error:nnee { LaTeX / #1 } } |
| 1952 |
\cs_new_protected:Npn \__kernel_msg_error:nnxxx #1 |
| 1953 |
{ \msg_error:nneee { LaTeX / #1 } } |
| 1954 |
% \end{macrocode} |
| 1955 |
% \end{macro} |
| 1956 |
% |
| 1957 |
% \begin{macro} |
| 1958 |
% { |
| 1959 |
% \__kernel_msg_expandable_error:nnn , |
| 1960 |
% \__kernel_msg_expandable_error:nnf , |
| 1961 |
% \__kernel_msg_expandable_error:nnff |
| 1962 |
% } |
| 1963 |
% \begin{macrocode} |
| 1964 |
\cs_new:Npn \__kernel_msg_expandable_error:nnn #1 |
| 1965 |
{ \msg_expandable_error:nnn { LaTeX / #1 } } |
| 1966 |
\cs_new:Npn \__kernel_msg_expandable_error:nnf #1 |
| 1967 |
{ \msg_expandable_error:nnf { LaTeX / #1 } } |
| 1968 |
\cs_new:Npn \__kernel_msg_expandable_error:nnff #1 |
| 1969 |
{ \msg_expandable_error:nnff { LaTeX / #1 } } |
| 1970 |
% \end{macrocode} |
| 1971 |
% \end{macro} |
| 1972 |
% |
| 1973 |
% \subsection{Internal messages} |
| 1974 |
% |
| 1975 |
% Error messages needed to actually implement the message system |
| 1976 |
% itself. |
| 1977 |
% \begin{macrocode} |
| 1978 |
\msg_new:nnnn { msg } { already-defined } |
| 1979 |
{ Message~'#2'~for~module~'#1'~already~defined. } |
| 1980 |
{ |
| 1981 |
\c_@@_coding_error_text_tl |
| 1982 |
LaTeX~was~asked~to~define~a~new~message~called~'#2'\\ |
| 1983 |
by~the~module~'#1':~this~message~already~exists. |
| 1984 |
\c_@@_return_text_tl |
| 1985 |
} |
| 1986 |
\msg_new:nnnn { msg } { unknown } |
| 1987 |
{ Unknown~message~'#2'~for~module~'#1'. } |
| 1988 |
{ |
| 1989 |
\c_@@_coding_error_text_tl |
| 1990 |
LaTeX~was~asked~to~display~a~message~called~'#2'\\ |
| 1991 |
by~the~module~'#1':~this~message~does~not~exist. |
| 1992 |
\c_@@_return_text_tl |
| 1993 |
} |
| 1994 |
\msg_new:nnnn { msg } { class-unknown } |
| 1995 |
{ Unknown~message~class~'#1'. } |
| 1996 |
{ |
| 1997 |
LaTeX~has~been~asked~to~redirect~messages~to~a~class~'#1':\\ |
| 1998 |
this~was~never~defined. |
| 1999 |
\c_@@_return_text_tl |
| 2000 |
} |
| 2001 |
\msg_new:nnnn { msg } { redirect-loop } |
| 2002 |
{ |
| 2003 |
Message~redirection~loop~caused~by~ {#1} ~=>~ {#2} |
| 2004 |
\tl_if_empty:nF {#3} { ~for~module~' \use_none:n #3 ' } . |
| 2005 |
} |
| 2006 |
{ |
| 2007 |
Adding~the~message~redirection~ {#1} ~=>~ {#2} |
| 2008 |
\tl_if_empty:nF {#3} { ~for~the~module~' \use_none:n #3 ' } ~ |
| 2009 |
created~an~infinite~loop\\\\ |
| 2010 |
\iow_indent:n { #4 \\\\ } |
| 2011 |
} |
| 2012 |
% \end{macrocode} |
| 2013 |
% |
| 2014 |
% Messages for earlier kernel modules plus a few for \pkg{l3keys} which |
| 2015 |
% cover coding errors. |
| 2016 |
% \begin{macrocode} |
| 2017 |
\msg_new:nnnn { kernel } { bad-number-of-arguments } |
| 2018 |
{ Function~'#1'~cannot~be~defined~with~#2~arguments. } |
| 2019 |
{ |
| 2020 |
\c_@@_coding_error_text_tl |
| 2021 |
LaTeX~has~been~asked~to~define~a~function~'#1'~with~ |
| 2022 |
#2~arguments.~ |
| 2023 |
TeX~allows~between~0~and~9~arguments~for~a~single~function. |
| 2024 |
} |
| 2025 |
\msg_new:nnnn { kernel } { command-already-defined } |
| 2026 |
{ Control~sequence~#1~already~defined. } |
| 2027 |
{ |
| 2028 |
\c_@@_coding_error_text_tl |
| 2029 |
LaTeX~has~been~asked~to~create~a~new~control~sequence~'#1'~ |
| 2030 |
but~this~name~has~already~been~used~elsewhere. \\ \\ |
| 2031 |
The~current~meaning~is:\\ |
| 2032 |
\ \ #2 |
| 2033 |
} |
| 2034 |
\msg_new:nnnn { kernel } { command-not-defined } |
| 2035 |
{ Control~sequence~#1~undefined. } |
| 2036 |
{ |
| 2037 |
\c_@@_coding_error_text_tl |
| 2038 |
LaTeX~has~been~asked~to~use~a~control~sequence~'#1':\\ |
| 2039 |
this~has~not~been~defined~yet. |
| 2040 |
} |
| 2041 |
\msg_new:nnnn { kernel } { empty-search-pattern } |
| 2042 |
{ Empty~search~pattern. } |
| 2043 |
{ |
| 2044 |
\c_@@_coding_error_text_tl |
| 2045 |
LaTeX~has~been~asked~to~replace~an~empty~pattern~by~'#1':~that~ |
| 2046 |
would~lead~to~an~infinite~loop! |
| 2047 |
} |
| 2048 |
\msg_new:nnnn { kernel } { non-base-function } |
| 2049 |
{ Function~'#1'~is~not~a~base~function } |
| 2050 |
{ |
| 2051 |
\c_@@_coding_error_text_tl |
| 2052 |
Functions~defined~through~\iow_char:N\\cs_new:Nn~must~have~ |
| 2053 |
a~signature~consisting~of~only~normal~arguments~'N'~and~'n'.~ |
| 2054 |
The~signature~'#2'~of~'#1'~contains~other~arguments~'#3'.~ |
| 2055 |
To~define~variants~use~\iow_char:N\\cs_generate_variant:Nn~ |
| 2056 |
and~to~define~other~functions~use~\iow_char:N\\cs_new:Npn. |
| 2057 |
} |
| 2058 |
\msg_new:nnnn { kernel } { missing-colon } |
| 2059 |
{ Function~'#1'~contains~no~':'. } |
| 2060 |
{ |
| 2061 |
\c_@@_coding_error_text_tl |
| 2062 |
Code-level~functions~must~contain~':'~to~separate~the~ |
| 2063 |
argument~specification~from~the~function~name.~This~is~ |
| 2064 |
needed~when~defining~conditionals~or~variants,~or~when~building~a~ |
| 2065 |
parameter~text~from~the~number~of~arguments~of~the~function. |
| 2066 |
} |
| 2067 |
\msg_new:nnnn { kernel } { overflow } |
| 2068 |
{ Integers~larger~than~2^{30}-1~cannot~be~stored~in~arrays. } |
| 2069 |
{ |
| 2070 |
An~attempt~was~made~to~store~#3~ |
| 2071 |
\tl_if_empty:nF {#2} { at~position~#2~ } in~the~array~'#1'.~ |
| 2072 |
The~largest~allowed~value~#4~will~be~used~instead. |
| 2073 |
} |
| 2074 |
\msg_new:nnnn { kernel } { out-of-bounds } |
| 2075 |
{ Access~to~an~entry~beyond~an~array's~bounds. } |
| 2076 |
{ |
| 2077 |
An~attempt~was~made~to~access~or~store~data~at~position~#2~of~the~ |
| 2078 |
array~'#1',~but~this~array~has~entries~at~positions~from~1~to~#3. |
| 2079 |
} |
| 2080 |
\msg_new:nnnn { kernel } { protected-predicate } |
| 2081 |
{ Predicate~'#1'~must~be~expandable. } |
| 2082 |
{ |
| 2083 |
\c_@@_coding_error_text_tl |
| 2084 |
LaTeX~has~been~asked~to~define~'#1'~as~a~protected~predicate.~ |
| 2085 |
Only~expandable~tests~can~have~a~predicate~version. |
| 2086 |
} |
| 2087 |
\msg_new:nnn { kernel } { randint-backward-range } |
| 2088 |
{ Wrong~order~of~bounds~in~\iow_char:N\\int_rand:nn{#1}{#2}. } |
| 2089 |
\msg_new:nnnn { kernel } { conditional-base-undefined } |
| 2090 |
{ Undefined~conditional~base~function~'#1'. } |
| 2091 |
{ |
| 2092 |
\c_@@_coding_error_text_tl |
| 2093 |
LaTeX~has~been~asked~to~define~a~variant~of~the~conditional~'#1',~ |
| 2094 |
but~the~latter~is~not~defined. |
| 2095 |
} |
| 2096 |
\msg_new:nnnn { kernel } { conditional-form-unknown } |
| 2097 |
{ Conditional~form~'#1'~for~function~'#2'~unknown. } |
| 2098 |
{ |
| 2099 |
\c_@@_coding_error_text_tl |
| 2100 |
LaTeX~has~been~asked~to~define~the~conditional~form~'#1'~of~ |
| 2101 |
the~function~'#2',~but~only~'TF',~'T',~'F',~and~'p'~forms~exist. |
| 2102 |
} |
| 2103 |
\msg_new:nnnn { kernel } { variant-same-as-base } |
| 2104 |
{ Variant~form~same~as~base~form~'#1'. } |
| 2105 |
{ |
| 2106 |
\c_@@_coding_error_text_tl |
| 2107 |
LaTeX~has~been~asked~to~create~a~variant~of~the~function~'#1'~ |
| 2108 |
with~the~same~signature. |
| 2109 |
} |
| 2110 |
\msg_new:nnnn { kernel } { variant-too-long } |
| 2111 |
{ Variant~form~'#1'~longer~than~base~signature~of~'#2'. } |
| 2112 |
{ |
| 2113 |
\c_@@_coding_error_text_tl |
| 2114 |
LaTeX~has~been~asked~to~create~a~variant~of~the~function~'#2'~ |
| 2115 |
with~a~signature~starting~with~'#1',~but~that~is~longer~than~ |
| 2116 |
the~signature~(part~after~the~colon)~of~'#2'. |
| 2117 |
} |
| 2118 |
\msg_new:nnnn { kernel } { invalid-variant } |
| 2119 |
{ Variant~form~'#1'~invalid~for~base~form~'#2'. } |
| 2120 |
{ |
| 2121 |
\c_@@_coding_error_text_tl |
| 2122 |
LaTeX~has~been~asked~to~create~a~variant~of~the~function~'#2'~ |
| 2123 |
with~a~signature~starting~with~'#1',~but~cannot~change~an~argument~ |
| 2124 |
from~type~'#3'~to~type~'#4'. |
| 2125 |
} |
| 2126 |
\msg_new:nnnn { kernel } { invalid-exp-args } |
| 2127 |
{ Invalid~variant~specifier~'#1'~in~'#2'. } |
| 2128 |
{ |
| 2129 |
\c_@@_coding_error_text_tl |
| 2130 |
LaTeX~has~been~asked~to~create~an~\iow_char:N\\exp_args:N...~ |
| 2131 |
function~with~signature~'N#2'~but~'#1'~is~not~a~valid~argument~ |
| 2132 |
specifier. |
| 2133 |
} |
| 2134 |
\msg_new:nnn { kernel } { deprecated-variant } |
| 2135 |
{ |
| 2136 |
Variant~form~'#1'~deprecated~for~base~form~'#2'.~ |
| 2137 |
One~should~not~change~an~argument~from~type~'#3'~to~type~'#4' |
| 2138 |
\str_case:nnF {#3} |
| 2139 |
{ |
| 2140 |
{ n } { :~use~a~'\token_if_eq_charcode:NNTF #4 c v V'~variant? } |
| 2141 |
{ N } { :~base~form~only~accepts~a~single~token~argument. } |
| 2142 |
{#4} { :~base~form~is~already~a~variant. } |
| 2143 |
} { . } |
| 2144 |
} |
| 2145 |
\msg_new:nnn { char } { active } |
| 2146 |
{ Cannot~generate~active~chars. } |
| 2147 |
\msg_new:nnn { char } { invalid-catcode } |
| 2148 |
{ Invalid~catcode~for~char~generation. } |
| 2149 |
\msg_new:nnn { char } { null-space } |
| 2150 |
{ Cannot~generate~null~char~as~a~space. } |
| 2151 |
\msg_new:nnn { char } { out-of-range } |
| 2152 |
{ Charcode~requested~out~of~engine~range. } |
| 2153 |
\msg_new:nnn { dim } { zero-unit } |
| 2154 |
{ Zero~unit~in~conversion. } |
| 2155 |
\msg_new:nnnn { kernel } { quote-in-shell } |
| 2156 |
{ Quotes~in~shell~command~'#1'. } |
| 2157 |
{ Shell~commands~cannot~contain~quotes~("). } |
| 2158 |
\msg_new:nnnn { keys } { no-property } |
| 2159 |
{ No~property~given~in~definition~of~key~'#1'. } |
| 2160 |
{ |
| 2161 |
\c_@@_coding_error_text_tl |
| 2162 |
Inside~\keys_define:nn each~key~name~ |
| 2163 |
needs~a~property: \\ \\ |
| 2164 |
\iow_indent:n { #1 .<property> } \\ \\ |
| 2165 |
LaTeX~did~not~find~a~'.'~to~indicate~the~start~of~a~property. |
| 2166 |
} |
| 2167 |
\msg_new:nnnn { keys } { property-boolean-values-only } |
| 2168 |
{ The~property~'#1'~accepts~boolean~values~only. } |
| 2169 |
{ |
| 2170 |
\c_@@_coding_error_text_tl |
| 2171 |
The~property~'#1'~only~accepts~the~values~'true'~and~'false'. |
| 2172 |
} |
| 2173 |
\msg_new:nnnn { keys } { property-requires-value } |
| 2174 |
{ The~property~'#1'~requires~a~value. } |
| 2175 |
{ |
| 2176 |
\c_@@_coding_error_text_tl |
| 2177 |
LaTeX~was~asked~to~set~property~'#1'~for~key~'#2'.\\ |
| 2178 |
No~value~was~given~for~the~property,~and~one~is~required. |
| 2179 |
} |
| 2180 |
\msg_new:nnnn { keys } { property-unknown } |
| 2181 |
{ The~key~property~'#1'~is~unknown. } |
| 2182 |
{ |
| 2183 |
\c_@@_coding_error_text_tl |
| 2184 |
LaTeX~has~been~asked~to~set~the~property~'#1'~for~key~'#2':~ |
| 2185 |
this~property~is~not~defined. |
| 2186 |
} |
| 2187 |
\msg_new:nnnn { quark } { invalid-function } |
| 2188 |
{ Quark~test~function~'#1'~is~invalid. } |
| 2189 |
{ |
| 2190 |
\c_@@_coding_error_text_tl |
| 2191 |
LaTeX~has~been~asked~to~create~quark~test~function~'#1'~ |
| 2192 |
\tl_if_empty:nTF {#2} |
| 2193 |
{ but~that~name~ } |
| 2194 |
{ with~signature~'#2',~but~that~signature~ } |
| 2195 |
is~not~valid. |
| 2196 |
} |
| 2197 |
\__kernel_msg_new:nnn { quark } { invalid } |
| 2198 |
{ Invalid~quark~variable~'#1'. } |
| 2199 |
\msg_new:nnnn { scanmark } { already-defined } |
| 2200 |
{ Scan~mark~#1~already~defined. } |
| 2201 |
{ |
| 2202 |
\c_@@_coding_error_text_tl |
| 2203 |
LaTeX~has~been~asked~to~create~a~new~scan~mark~'#1'~ |
| 2204 |
but~this~name~has~already~been~used~for~a~scan~mark. |
| 2205 |
} |
| 2206 |
\msg_new:nnnn { seq } { item-too-large } |
| 2207 |
{ Sequence~'#1'~does~not~have~an~item~#3 } |
| 2208 |
{ |
| 2209 |
An~attempt~was~made~to~push~or~pop~the~item~at~position~#3~ |
| 2210 |
of~'#1',~but~this~ |
| 2211 |
\int_compare:nTF { #3 = 0 } |
| 2212 |
{ position~does~not~exist. } |
| 2213 |
{ sequence~only~has~#2~item \int_compare:nF { #2 = 1 } {s}. } |
| 2214 |
} |
| 2215 |
\msg_new:nnnn { seq } { shuffle-too-large } |
| 2216 |
{ The~sequence~#1~is~too~long~to~be~shuffled~by~TeX. } |
| 2217 |
{ |
| 2218 |
TeX~has~ \int_eval:n { \c_max_register_int + 1 } ~ |
| 2219 |
toks~registers:~this~only~allows~to~shuffle~up~to~ |
| 2220 |
\int_use:N \c_max_register_int \ items.~ |
| 2221 |
The~list~will~not~be~shuffled. |
| 2222 |
} |
| 2223 |
\msg_new:nnnn { kernel } { variable-not-defined } |
| 2224 |
{ Variable~#1~undefined. } |
| 2225 |
{ |
| 2226 |
\c_@@_coding_error_text_tl |
| 2227 |
LaTeX~has~been~asked~to~show~a~variable~#1,~but~this~has~not~ |
| 2228 |
been~defined~yet. |
| 2229 |
} |
| 2230 |
\msg_new:nnnn { kernel } { bad-type } |
| 2231 |
{ Variable~'#1'~is~not~a~valid~#3. } |
| 2232 |
{ |
| 2233 |
\c_@@_coding_error_text_tl |
| 2234 |
The~variable~'#1'~with~\tl_if_empty:nTF {#4} {meaning} {value}\\\\ |
| 2235 |
\iow_indent:n {#2}\\\\ |
| 2236 |
should~be~a~#3~variable,~but~ |
| 2237 |
\tl_if_empty:nTF {#4} |
| 2238 |
{ it~is~not \str_if_eq:nnF {#3} { bool } { ~a~short~macro } . } |
| 2239 |
{ |
| 2240 |
it~does~not~have~the~correct~ |
| 2241 |
\str_if_eq:nnTF {#2} {#4} |
| 2242 |
{ category~codes. } |
| 2243 |
{ internal~structure:\\\\\iow_indent:n {#4} } |
| 2244 |
} |
| 2245 |
} |
| 2246 |
\msg_new:nnnn { prop } { bad-link } |
| 2247 |
{ Variable~'#1'~is~not~a~valid~(linked)~prop. } |
| 2248 |
{ |
| 2249 |
\c_@@_coding_error_text_tl |
| 2250 |
The~variable~'#1'~has~an~incorrect~internal~structure.~ |
| 2251 |
Its~internal~entry~'#2'~points~to~'#3',~whose~name~is~not~of~the~ |
| 2252 |
form~'#4~<key>'. |
| 2253 |
} |
| 2254 |
\msg_new:nnnn { clist } { non-clist } |
| 2255 |
{ Variable~'#1'~is~not~a~valid~clist. } |
| 2256 |
{ |
| 2257 |
\c_@@_coding_error_text_tl |
| 2258 |
The~variable~'#1'~with~value\\\\ |
| 2259 |
\iow_indent:n {#2}\\\\ |
| 2260 |
should~be~a~clist~variable,~but~it~includes~empty~or~blank~items~ |
| 2261 |
without~braces. |
| 2262 |
} |
| 2263 |
\msg_new:nnnn { prop } { misused } |
| 2264 |
{ A~property~list~was~misused. } |
| 2265 |
{ |
| 2266 |
\c_@@_coding_error_text_tl |
| 2267 |
A~property~list~variable~was~used~without~an~accessor~function.~ |
| 2268 |
It~ |
| 2269 |
\tl_if_empty:nTF {#1} |
| 2270 |
{ is~empty. } |
| 2271 |
{ contains~the~key-value~pairs \use_none:n #1 . } |
| 2272 |
} |
| 2273 |
\msg_new:nnnn { prop } { inner-make } |
| 2274 |
{ '#1'~ cannot~ be~ used~ in~ a~ group. } |
| 2275 |
{ |
| 2276 |
\c_@@_coding_error_text_tl |
| 2277 |
The~ command~ '#1'~ was~ applied~ to~ the~ property~ list~ |
| 2278 |
variable~ '#2', but~ the~ storage~ type~ can~ only~ be~ changed~ |
| 2279 |
at~ the~ outermost~ group~ level. |
| 2280 |
} |
| 2281 |
% \end{macrocode} |
| 2282 |
% |
| 2283 |
% Some errors only appear in expandable settings, |
| 2284 |
% hence don't need a \enquote{more-text} argument. |
| 2285 |
% \begin{macrocode} |
| 2286 |
\msg_new:nnn { kernel } { bad-exp-end-f } |
| 2287 |
{ Misused~\exp_end_continue_f:w or~:nw } |
| 2288 |
\msg_new:nnn { kernel } { bad-variable } |
| 2289 |
{ Erroneous~variable~#1 used! } |
| 2290 |
\msg_new:nnn { seq } { misused } |
| 2291 |
{ A~sequence~was~misused. } |
| 2292 |
\msg_new:nnn { prg } { negative-replication } |
| 2293 |
{ Negative~argument~for~\iow_char:N\\prg_replicate:nn. } |
| 2294 |
\msg_new:nnn { prop } { prop-keyval } |
| 2295 |
{ Missing~'='~in~'#1'~(in~'..._keyval:Nn') } |
| 2296 |
\msg_new:nnn { kernel } { unknown-comparison } |
| 2297 |
{ Relation~'#1'~not~among~=,<,>,==,!=,<=,>=. } |
| 2298 |
\msg_new:nnn { kernel } { zero-step } |
| 2299 |
{ Zero~step~size~for~function~#1. } |
| 2300 |
% \end{macrocode} |
| 2301 |
% |
| 2302 |
% Messages used by the \enquote{\texttt{show}} functions. |
| 2303 |
% \begin{macrocode} |
| 2304 |
\msg_new:nnn { clist } { show } |
| 2305 |
{ |
| 2306 |
The~comma~list~ \tl_if_empty:nF {#1} { #1 ~ } |
| 2307 |
\tl_if_empty:nTF {#2} |
| 2308 |
{ is~empty \\>~ . } |
| 2309 |
{ contains~the~items~(without~outer~braces): #2 . } |
| 2310 |
} |
| 2311 |
\msg_new:nnn { intarray } { show } |
| 2312 |
{ The~integer~array~#1~contains~#2~items: \\ #3 . } |
| 2313 |
\msg_new:nnn { prop } { show } |
| 2314 |
{ |
| 2315 |
The~ \str_if_eq:nnF {#3} { flat } { #3~ } |
| 2316 |
property~list~#1~ |
| 2317 |
\tl_if_empty:nTF {#2} |
| 2318 |
{ is~empty \\>~ . } |
| 2319 |
{ contains~the~pairs~(without~outer~braces): #2 . } |
| 2320 |
} |
| 2321 |
\msg_new:nnn { seq } { show } |
| 2322 |
{ |
| 2323 |
The~sequence~#1~ |
| 2324 |
\tl_if_empty:nTF {#2} |
| 2325 |
{ is~empty \\>~ . } |
| 2326 |
{ contains~the~items~(without~outer~braces): #2 . } |
| 2327 |
} |
| 2328 |
\msg_new:nnn { kernel } { show-streams } |
| 2329 |
{ |
| 2330 |
\tl_if_empty:nTF {#2} { No~ } { The~following~ } |
| 2331 |
\str_case:nn {#1} |
| 2332 |
{ |
| 2333 |
{ ior } { input ~ } |
| 2334 |
{ iow } { output ~ } |
| 2335 |
} |
| 2336 |
streams~are~ |
| 2337 |
\tl_if_empty:nTF {#2} { open } { in~use: #2 . } |
| 2338 |
} |
| 2339 |
% \end{macrocode} |
| 2340 |
% |
| 2341 |
% System layer messages |
| 2342 |
% \begin{macrocode} |
| 2343 |
\msg_new:nnnn { sys } { backend-set } |
| 2344 |
{ Backend~configuration~already~set. } |
| 2345 |
{ |
| 2346 |
Run-time~backend~selection~may~only~be~carried~out~once~during~a~run.~ |
| 2347 |
This~second~attempt~to~set~them~will~be~ignored. |
| 2348 |
} |
| 2349 |
\msg_new:nnnn { sys } { load-debug-in-preamble } |
| 2350 |
{ Load~debug~support~in~the~preamble. } |
| 2351 |
{ |
| 2352 |
Debugging~requires~support~loaded~in~the~preamble: \\ |
| 2353 |
Use~\sys_load_debug:~before~\begin{document}. |
| 2354 |
} |
| 2355 |
\msg_new:nnnn { sys } { wrong-backend } |
| 2356 |
{ Backend~request~inconsistent~with~engine:~using~'#2'~backend. } |
| 2357 |
{ |
| 2358 |
You~have~requested~backend~'#1',~but~this~is~not~suitable~for~use~with~the~ |
| 2359 |
active~engine.~LaTeX~will~use~the~'#2'~backend~instead. |
| 2360 |
} |
| 2361 |
% \end{macrocode} |
| 2362 |
% |
| 2363 |
% \subsection{Expandable errors} |
| 2364 |
% |
| 2365 |
% \begin{macro}{\__kernel_msg_expandable_error:nn} |
| 2366 |
% In expansion only context, we cannot use the normal means of |
| 2367 |
% reporting errors. Instead, we rely on a low-level \TeX{} error |
| 2368 |
% caused by expanding a macro \cs{???} with parameter text ``|?|'' |
| 2369 |
% (this could be any token) which we used followed by something else |
| 2370 |
% (here, a space). This shows |
| 2371 |
% the context, which thanks to the odd-looking \cs{use:n} is |
| 2372 |
% \begin{verbatim} |
| 2373 |
% <argument> \??? |
| 2374 |
% ! mypkg Error: The error message. |
| 2375 |
% \end{verbatim} |
| 2376 |
% In other words, \TeX{} is processing the argument of \cs{use:n}, |
| 2377 |
% which is \cs{???} \meta{space} |!| \meta{error type} |:| \meta{error message}. |
| 2378 |
% \begin{macrocode} |
| 2379 |
\cs_set_protected:Npn \@@_tmp:w #1 |
| 2380 |
{ |
| 2381 |
\cs_new:Npn #1 ? { } |
| 2382 |
\cs_new:Npn \__kernel_msg_expandable_error:nn ##1##2 |
| 2383 |
{ |
| 2384 |
\exp_after:wN \exp_after:wN |
| 2385 |
\exp_after:wN \@@_use_none_delimit_by_s_stop:w |
| 2386 |
\use:n { #1 ~ ! ~ ##2 : ~ ##1 } \s_@@_stop |
| 2387 |
} |
| 2388 |
} |
| 2389 |
\exp_args:Nc \@@_tmp:w { ??? } |
| 2390 |
% \end{macrocode} |
| 2391 |
% \end{macro} |
| 2392 |
% |
| 2393 |
% \begin{macro}[EXP] |
| 2394 |
% { |
| 2395 |
% \msg_expandable_error:nnnnnn , |
| 2396 |
% \msg_expandable_error:nnnnn , |
| 2397 |
% \msg_expandable_error:nnnn , |
| 2398 |
% \msg_expandable_error:nnn , |
| 2399 |
% \msg_expandable_error:nn , |
| 2400 |
% \msg_expandable_error:nneeee , |
| 2401 |
% \msg_expandable_error:nneee , |
| 2402 |
% \msg_expandable_error:nnee , |
| 2403 |
% \msg_expandable_error:nne , |
| 2404 |
% \msg_expandable_error:nnffff , |
| 2405 |
% \msg_expandable_error:nnfff , |
| 2406 |
% \msg_expandable_error:nnff , |
| 2407 |
% \msg_expandable_error:nnf |
| 2408 |
% } |
| 2409 |
% The command built from the csname |
| 2410 |
% \cs{c_@@_text_prefix_tl} |#1 / #2| |
| 2411 |
% takes four arguments and builds the error text, which is fed to |
| 2412 |
% \cs{__kernel_msg_expandable_error:nn} with appropriate expansion: just as for |
| 2413 |
% usual messages the arguments are first turned to strings, then the |
| 2414 |
% message is fully expanded. The module name also has to be determined. |
| 2415 |
% \begin{macrocode} |
| 2416 |
\exp_args_generate:n { oooo } |
| 2417 |
\cs_new:Npn \msg_expandable_error:nnnnnn #1#2#3#4#5#6 |
| 2418 |
{ |
| 2419 |
\exp_args:Nee \__kernel_msg_expandable_error:nn |
| 2420 |
{ |
| 2421 |
\exp_args:Nc \exp_args:Noooo |
| 2422 |
{ \c_@@_text_prefix_tl #1 / #2 } |
| 2423 |
{ \tl_to_str:n {#3} } |
| 2424 |
{ \tl_to_str:n {#4} } |
| 2425 |
{ \tl_to_str:n {#5} } |
| 2426 |
{ \tl_to_str:n {#6} } |
| 2427 |
} |
| 2428 |
{ \msg_error_text:n {#1} } |
| 2429 |
} |
| 2430 |
\cs_new:Npn \msg_expandable_error:nnnnn #1#2#3#4#5 |
| 2431 |
{ \msg_expandable_error:nnnnnn {#1} {#2} {#3} {#4} {#5} { } } |
| 2432 |
\cs_new:Npn \msg_expandable_error:nnnn #1#2#3#4 |
| 2433 |
{ \msg_expandable_error:nnnnnn {#1} {#2} {#3} {#4} { } { } } |
| 2434 |
\cs_new:Npn \msg_expandable_error:nnn #1#2#3 |
| 2435 |
{ \msg_expandable_error:nnnnnn {#1} {#2} {#3} { } { } { } } |
| 2436 |
\cs_new:Npn \msg_expandable_error:nn #1#2 |
| 2437 |
{ \msg_expandable_error:nnnnnn {#1} {#2} { } { } { } { } } |
| 2438 |
\cs_generate_variant:Nn \msg_expandable_error:nnnnnn { nneeee , nnffff } |
| 2439 |
\cs_generate_variant:Nn \msg_expandable_error:nnnnn { nneee , nnfff } |
| 2440 |
\cs_generate_variant:Nn \msg_expandable_error:nnnn { nnee , nnff } |
| 2441 |
\cs_generate_variant:Nn \msg_expandable_error:nnn { nne , nnf } |
| 2442 |
% \end{macrocode} |
| 2443 |
% \end{macro} |
| 2444 |
% |
| 2445 |
% \subsection{Message formatting} |
| 2446 |
% |
| 2447 |
% \begin{macrocode} |
| 2448 |
\prop_gput:Nnn \g_msg_module_name_prop { kernel } { LaTeX } |
| 2449 |
\prop_gput:Nnn \g_msg_module_type_prop { kernel } { } |
| 2450 |
\clist_map_inline:nn |
| 2451 |
{ |
| 2452 |
char , clist , coffin , debug , deprecation , dim, msg , |
| 2453 |
quark , prg , prop , scanmark , seq , sys |
| 2454 |
} |
| 2455 |
{ |
| 2456 |
\prop_gput:Nnn \g_msg_module_name_prop {#1} { LaTeX } |
| 2457 |
\prop_gput:Nnn \g_msg_module_type_prop {#1} { } |
| 2458 |
} |
| 2459 |
\prop_gput:Nnn \g_msg_module_name_prop { LaTeX / cmd } { LaTeX } |
| 2460 |
\prop_gput:Nnn \g_msg_module_type_prop { LaTeX / cmd } { } |
| 2461 |
\prop_gput:Nnn \g_msg_module_name_prop { LaTeX / ltcmd } { LaTeX } |
| 2462 |
\prop_gput:Nnn \g_msg_module_type_prop { LaTeX / ltcmd } { } |
| 2463 |
% \end{macrocode} |
| 2464 |
% |
| 2465 |
% \begin{macrocode} |
| 2466 |
%</code> |
| 2467 |
% \end{macrocode} |
| 2468 |
% |
| 2469 |
% \end{implementation} |
| 2470 |
% |
| 2471 |
% \PrintIndex |