Debian Codegraph @

texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx

raw
1 % \iffalse meta-comment
2 %
3 %% File: l3kernel-functions.dtx
4 %
5 % Copyright (C) 2018-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{l3kernel-functions} module\\ Kernel-reserved functions^^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 % \end{documentation}
53 %
54 % \begin{implementation}
55 %
56 % \section{\pkg{l3kernel-functions}: kernel-reserved functions}
57 %
58 % \subsection{Internal \pkg{l3debug} kernel functions}
59 % \label{sec:l3kernel-functions:l3debug-internals}
60 %
61 % These function are only created if debugging is enabled, hence they are
62 % actually defined in \pkg{l3debug}.
63 %
64 % \begin{function}{\__kernel_chk_var_local:N, \__kernel_chk_var_global:N}
65 % \begin{syntax}
66 % \cs{__kernel_chk_var_local:N} \meta{var}
67 % \cs{__kernel_chk_var_global:N} \meta{var}
68 % \end{syntax}
69 % Applies \cs{__kernel_chk_var_exist:N} \meta{var} as well as
70 % \cs{__kernel_chk_var_scope:NN} \meta{scope} \meta{var}, where
71 % \meta{scope} is |l| or~|g|.
72 % \end{function}
73 %
74 % \begin{function}{\__kernel_chk_var_scope:NN}
75 % \begin{syntax}
76 % \cs{__kernel_chk_var_scope:NN} \meta{scope} \meta{var}
77 % \end{syntax}
78 % Checks the \meta{var} has the correct \meta{scope}, and if not
79 % raises a kernel-level error.
80 % The \meta{scope} is a single letter |l|, |g|,
81 % |c| denoting local variables, global variables, or constants. More
82 % precisely, if the variable name starts with a letter and an
83 % underscore (normal \pkg{expl3} convention) the function checks that
84 % this single letter matches the \meta{scope}. Otherwise the function
85 % cannot know the scope \meta{var} the first time: instead, it defines
86 % |\__debug_chk_/|\meta{var name} to store that information for the
87 % next call. Thus, if a given \meta{var} is subject to assignments of
88 % different scopes a kernel error will result.
89 % \end{function}
90 %
91 % \begin{function}
92 % {
93 % \__kernel_chk_cs_exist:N,
94 % \__kernel_chk_cs_exist:c,
95 % \__kernel_chk_var_exist:N
96 % }
97 % \begin{syntax}
98 % \cs{__kernel_chk_cs_exist:N} \meta{cs}
99 % \cs{__kernel_chk_var_exist:N} \meta{var}
100 % \end{syntax}
101 % Checks that their argument is defined according to the criteria for
102 % \cs{cs_if_exist_p:N},
103 % and if not raises a kernel-level error. Error messages are
104 % different.
105 % \end{function}
106 %
107 % \begin{function}[EXP]{\__kernel_chk_flag_exist:NN}
108 % \begin{syntax}
109 % \cs{__kernel_chk_flag_exist:NN}
110 % \meta{function} \meta{flag}
111 % \end{syntax}
112 % Checks that the \meta{flag} is defined according to the criterion for
113 % \cs{flag_if_exist_p:N}, and if not raises a kernel-level error and
114 % calls the function with the argument \cs{l_tmpa_flag} to proceed
115 % somehow without producing too many errors.
116 % \end{function}
117 %
118 % \begin{function}{\__kernel_debug_log:e}
119 % \begin{syntax}
120 % \cs{__kernel_debug_log:e} \Arg{message text}
121 % \end{syntax}
122 % If the \texttt{log-functions} option is active, this function writes
123 % the \meta{message text} to the log file using \cs{iow_log:e}.
124 % Otherwise, the \meta{message text} is ignored using \cs{use_none:n}.
125 % \end{function}
126 %
127 % \subsection{Internal kernel functions}
128 %
129 % \begin{function}{\__kernel_chk_defined:NT}
130 % \begin{syntax}
131 % \cs{__kernel_chk_defined:NT} \meta{variable} \Arg{true code}
132 % \end{syntax}
133 % If \meta{variable} is not defined (according to
134 % \cs{cs_if_exist:NTF}), this triggers an error, otherwise the
135 % \meta{true code} is run.
136 % \end{function}
137 %
138 % \begin{function}{\__kernel_chk_expr:nNnN}
139 % \begin{syntax}
140 % \cs{__kernel_chk_expr:nNnN} \Arg{expr} \meta{eval} \Arg{convert} \meta{caller}
141 % \end{syntax}
142 % This function is only created if debugging is enabled. By default
143 % it is equivalent to \cs{use_i:nnnn}. When expression checking is
144 % enabled, it leaves in the input stream the result of \cs{tex_the:D}
145 % \meta{eval} \meta{expr} \cs{tex_relax:D} after checking that no
146 % token was left over. If any token was not taken as part of the
147 % expression, there is an error message displaying the result of the
148 % evaluation as well as the \meta{caller}. For instance \meta{eval}
149 % can be \cs{__int_eval:w} and \meta{caller} can be \cs{int_eval:n} or
150 % \cs{int_set:Nn}. The argument \meta{convert} is empty except for mu
151 % expressions where it is \cs{tex_mutoglue:D}, used for internal
152 % purposes.
153 % \end{function}
154 %
155 % \begin{function}{\__kernel_chk_tl_type:NnnT}
156 % \begin{syntax}\parskip=0pt\obeylines
157 % \cs{__kernel_chk_tl_type:NnnT} \meta{control sequence} \Arg{specific type} \\
158 % | |\Arg{reconstruction} \Arg{true code}
159 % \end{syntax}
160 % Helper to test that the \meta{control sequence} is a variable of the
161 % given \meta{specific type} of token list. Produces suitable error
162 % messages if the \meta{control sequence} does not exist, or if it is
163 % not a token list variable at all, or if the \meta{control sequence}
164 % differs from the result of |e|-expanding \meta{reconstruction}. If
165 % all of these tests succeed then the \meta{true code} is run.
166 % \end{function}
167 %
168 % \begin{function}[EXP]{\__kernel_codepoint_to_bytes:n}
169 % \begin{syntax}
170 % \cs{__kernel_codepoint_to_bytes:n} \Arg{codepoint}
171 % \end{syntax}
172 % Converts the \meta{codepoint} to UTF-8 bytes. The expansion
173 % of this function comprises four brace groups, each of which will contain
174 % a hexadecimal value: the appropriate byte. As UTF-8 is a variable-length,
175 % one or more of the groups may be empty: the bytes read in the logical order,
176 % such that a two-byte codepoint will have groups |#1| and |#2| filled
177 % and |#3| and |#4| empty.
178 % \end{function}
179 %
180 % \begin{function}[EXP]
181 % {
182 % \__kernel_codepoint_to_grapheme_class:n,
183 % \__kernel_codepoint_to_wordbreak_class:n
184 % }
185 % \begin{syntax}
186 % \cs{__kernel_codepoint_to_grapheme_class:n} \Arg{codepoint}
187 % \cs{__kernel_codepoint_to_wordbreak_class:n} \Arg{codepoint}
188 % \end{syntax}
189 % Expands to the Unicode properties |Grapheme_Cluster_Break| and
190 % |Word_Break|, respectively, of the \meta{codepoint}. Here,
191 % |Grapheme_Cluster_Break| and |Word_Break| are strings matching
192 % exactly the descriptors given in
193 % \url{https://www.unicode.org/reports/tr29/}.
194 % \end{function}
195 %
196 % \begin{function}{\__kernel_cs_parm_from_arg_count:nnF}
197 % \begin{syntax}
198 % \cs{__kernel_cs_parm_from_arg_count:nnF} \Arg{follow-on} \Arg{args} \Arg{false code}
199 % \end{syntax}
200 % Evaluates the number of \meta{args} and leaves the \meta{follow-on} code
201 % followed by a brace group containing the required number of primitive
202 % parameter markers (|#1|, \emph{etc}.). If the number of \meta{args} is outside
203 % the range $[0,9]$, the \meta{false code} is inserted \emph{instead} of
204 % the \meta{follow-on}.
205 % \end{function}
206 %
207 % \begin{function}{
208 % \__kernel_dependency_version_check:Nn,
209 % \__kernel_dependency_version_check:nn,
210 % }
211 % \begin{syntax}
212 % \cs{__kernel_dependency_version_check:Nn} \Arg{\cs{date}} \Arg{file}
213 % \cs{__kernel_dependency_version_check:nn} \Arg{date} \Arg{file}
214 % \end{syntax}
215 % Checks if the loaded version of the \pkg{expl3} kernel is at least \meta{date},
216 % required by \meta{file}. If the kernel date is older than \meta{date}, the
217 % loading of \meta{file} is aborted and an error is raised.
218 % \end{function}
219 %
220 % \begin{function}{\__kernel_deprecation_code:nn}
221 % \begin{syntax}
222 % \cs{__kernel_deprecation_code:nn} \Arg{error code} \Arg{working code}
223 % \end{syntax}
224 % Stores both an \meta{error} and \meta{working} definition for given material
225 % such that they can be exchanged by \cs{debug_on:n} and \cs{debug_off:n}.
226 % \end{function}
227 %
228 % \begin{function}[EXP]{\__kernel_exp_not:w}
229 % \begin{syntax}
230 % \cs{__kernel_exp_not:w} \meta{expandable tokens} \Arg{content}
231 % \end{syntax}
232 % Carries out expansion on the \meta{expandable tokens} before preventing
233 % further expansion of the \meta{content} as for \cs{exp_not:n}. Typically,
234 % the \meta{expandable tokens} will alter the nature of the \meta{content},
235 % i.e., allow it to be generated in some way.
236 % \end{function}
237 %
238 % \begin{variable}{\l__kernel_expl_bool}
239 % A boolean which records the current code syntax status: \texttt{true} if
240 % currently inside a code environment. This variable should only be
241 % set by \cs{ExplSyntaxOn}/\cs{ExplSyntaxOff}.
242 % \end{variable}
243 %
244 % \begin{variable}{\c__kernel_expl_date_tl}
245 % A token list containing the release date of the \pkg{l3kernel} preloaded
246 % in \LaTeXe{} used to check if dependencies match.
247 % \end{variable}
248 %
249 % \begin{function}{\__kernel_file_missing:n}
250 % \begin{syntax}
251 % \cs{__kernel_file_missing:n} \Arg{name}
252 % \end{syntax}
253 % Expands the \meta{name} as per \cs{__kernel_file_name_sanitize:n} then
254 % produces an error message indicating that this file was not found.
255 % \end{function}
256 %
257 % \begin{function}[EXP,updated = 2021-04-17]{\__kernel_file_name_sanitize:n}
258 % \begin{syntax}
259 % \cs{__kernel_file_name_sanitize:n} \Arg{name}
260 % \end{syntax}
261 % Expands the file name using a \tn{csname}-based approach, and
262 % relies on active characters (for example from UTF-8 characters)
263 % being properly set up to expand to a expansion-safe version using
264 % \cs{ifcsname}. This is less conservative than the token-by-token
265 % approach used before, but it is much faster.
266 % \end{function}
267 %
268 % \begin{function}{\__kernel_file_input_push:n, \__kernel_file_input_pop:}
269 % \begin{syntax}
270 % \cs{__kernel_file_input_push:n} \Arg{name}
271 % \cs{__kernel_file_input_pop:}
272 % \end{syntax}
273 % Used to push and pop data from the internal file stack: needed only
274 % in package mode, where interfacing with the \LaTeXe{} kernel is necessary.
275 % \end{function}
276 %
277 % \begin{function}[EXP]{\__kernel_int_add:nnn}
278 % \begin{syntax}
279 % \cs{__kernel_int_add:nnn} \Arg{integer_1} \Arg{integer_2} \Arg{integer_3}
280 % \end{syntax}
281 % Expands to the result of adding the three \meta{integers} (which
282 % must be suitable input for \cs{int_eval:w}), avoiding intermediate
283 % overflow. Overflow occurs only if the overall result is outside
284 % $[-2^{31}+1,2^{31}-1]$. The \meta{integers} may be of the form
285 % \cs{int_eval:w} \dots{} \cs{scan_stop:} but may be evaluated more
286 % than once.
287 % \end{function}
288 %
289 % \begin{function}[EXP]{\__kernel_int_sep:}
290 % \begin{syntax}
291 % \cs{__kernel_int_sep:}
292 % \end{syntax}
293 % Provides a way to stop the expansion in \cs{tex_numexpr:D} with a
294 % token that is not absorbed so that it works as a marker for right-delimited
295 % arguments. Additionally the used token should be impossible to form a valid
296 % expression for these expression primitives (the otherwise previously-used
297 % |;| is turned into a binary operator in some engines for instance).
298 % An unexpandable primitive is used because it is guaranteed
299 % to never be a valid token in such an expression and survives all kinds of
300 % expansion (just like~|;| would in \eTeX{}).
301 % \end{function}
302 %
303 % \begin{function}[added = 2018-03-31]{\__kernel_intarray_gset:Nnn}
304 % \begin{syntax}
305 % \cs{__kernel_intarray_gset:Nnn} \meta{intarray~var} \Arg{index} \Arg{value}
306 % \end{syntax}
307 % Faster version of \cs{intarray_gset:Nnn}. Stores the \meta{value}
308 % into the \meta{integer array variable} at the \meta{position}. The
309 % \meta{index} and \meta{value} must be suitable for a direct
310 % assignment to a \TeX{} count register, for instance expanding to an
311 % integer denotation or obtained through the primitive \tn{numexpr}
312 % (which may be un-terminated). No bound checking is performed: the
313 % caller is responsible for ensuring that the \meta{position} is
314 % between $1$ and the \cs{intarray_count:N}, and the \meta{value}'s
315 % absolute value is at most $2^{30}-1$. Assignments are always
316 % global.
317 % \end{function}
318 %
319 % \begin{function}[EXP, added = 2018-03-31]{\__kernel_intarray_item:Nn}
320 % \begin{syntax}
321 % \cs{__kernel_intarray_item:Nn} \meta{intarray~var} \Arg{index}
322 % \end{syntax}
323 % Faster version of \cs{intarray_item:Nn}. Expands to the integer
324 % entry stored at the \meta{index} in the \meta{integer array
325 % variable}. The \meta{index} must be suitable for a direct
326 % assignment to a \TeX{} count register and must be between $1$ and
327 % the \cs{intarray_count:N}, lest a low-level \TeX{} error occur.
328 % \end{function}
329 %
330 % \begin{function}[rEXP, added = 2020-07-12]{\__kernel_intarray_range_to_clist:Nnn}
331 % \begin{syntax}
332 % \cs{__kernel_intarray_range_to_clist:Nnn} \meta{intarray~var} \Arg{start index} \Arg{end index}
333 % \end{syntax}
334 % Converts to integer denotations separated by commas the entries of
335 % the \meta{intarray} from positions \meta{start index} to \meta{end
336 % index} included. The \meta{start index} and \meta{end index} must
337 % be suitable for a direct assignment to a \TeX{} count register, must
338 % be between $1$ and the \cs{intarray_count:N}, and be suitably
339 % ordered. All tokens have category code other.
340 % \end{function}
341 %
342 % \begin{function}[added = 2020-07-12]{\__kernel_intarray_gset_range_from_clist:Nnn}
343 % \begin{syntax}
344 % \cs{__kernel_intarray_gset_range_from_clist:Nnn} \meta{intarray~var} \Arg{start index} \Arg{integer clist}
345 % \end{syntax}
346 % Stores the entries of the \meta{clist} as entries of the
347 % \meta{intarray~var} starting from the \meta{start index}, upwards.
348 % This is done without any bound checking. The \meta{start index} and
349 % all entries of the \meta{integer comma list} (which do not undergo
350 % space trimming and brace stripping as in normal clist mappings) must
351 % be suitable for a direct assignment to a \TeX{} count register. An
352 % empty entry may stop the loop.
353 % \end{function}
354 %
355 % \begin{function}{\__kernel_ior_open:Nn, \__kernel_ior_open:No}
356 % \begin{syntax}
357 % \cs{__kernel_ior_open:Nn} \meta{stream} \Arg{file name}
358 % \end{syntax}
359 % This function has identical syntax to the public version. However,
360 % is does not take precautions against active characters in the
361 % \meta{file name}, and it does not attempt to add a \meta{path} to
362 % the \meta{file name}: it is therefore intended to be used by
363 % higher-level
364 % functions which have already fully expanded the \meta{file name} and which
365 % need to perform multiple open or close operations. See for example the
366 % implementation of \cs{ior_shell_open:Nn}.
367 % \end{function}
368 %
369 % \begin{function}{\__kernel_iow_open:Nn, \__kernel_iow_open:No}
370 % \begin{syntax}
371 % \cs{__kernel_iow_open:Nn} \meta{stream} \Arg{file name}
372 % \end{syntax}
373 % This function has identical syntax to the public version. However,
374 % is does not take precautions against active characters in the
375 % \meta{file name}, and it does not attempt to add a \meta{path} to
376 % the \meta{file name}: it is therefore intended to be used by
377 % higher-level
378 % functions which have already fully expanded the \meta{file name} and which
379 % need to perform multiple open or close operations. See for example the
380 % implementation of \cs{iow_shell_open:Nn}.
381 % \end{function}
382 %
383 % \begin{function}{\__kernel_iow_with:Nnn}
384 % \begin{syntax}
385 % \cs{__kernel_iow_with:Nnn} \meta{integer} \Arg{value} \Arg{code}
386 % \end{syntax}
387 % If the \meta{integer} is equal to the \meta{value} then this
388 % function simply runs the \meta{code}. Otherwise it saves the
389 % current value of the \meta{integer}, sets it to the \meta{value},
390 % runs the \meta{code}, and restores the \meta{integer} to its former
391 % value. This is used to ensure that the \tn{newlinechar} is~$10$
392 % when writing to a stream, which lets \cs{iow_newline:} work, and
393 % that \tn{errorcontextlines} is $-1$ when displaying a message.
394 % \end{function}
395 %
396 % \begin{function}{\__kernel_msg_expandable_error:nn}
397 % \begin{syntax}
398 % \cs{__kernel_msg_expandable_error:nn} \Arg{type} \Arg{text}
399 % \end{syntax}
400 % Issues a low-level message of \meta{type} \meta{text}, usable in an expansion
401 % context.
402 % \end{function}
403 %
404 % \begin{function}{\__kernel_msg_show_eval:Nn, \__kernel_msg_log_eval:Nn}
405 % \begin{syntax}
406 % \cs{__kernel_msg_show_eval:Nn} \meta{function} \Arg{expression}
407 % \end{syntax}
408 % Shows or logs the \meta{expression} (turned into a string), an equal
409 % sign, and the result of applying the \meta{function} to the
410 % \Arg{expression} (with \texttt{f}-expansion). For instance, if the
411 % \meta{function} is \cs{int_eval:n} and the \meta{expression} is
412 % |1+2| then this logs |> 1+2=3.|
413 % \end{function}
414 %
415 % \begin{function}[EXP]{\__kernel_pdf_object_id:n, \__kernel_pdf_object_id_indexed:nn}
416 % \begin{syntax}
417 % \cs{__kernel_pdf_object_id:n} \Arg{object}
418 % \cs{__kernel_pdf_object_id_indexed:nn} \Arg{class} \Arg{number}
419 % \end{syntax}
420 % Expands to the ID of \meta{object} (or object of \meta{number} within
421 % the \meta{class}), in for example page resource allocation. Depending on
422 % the backend, the result may be the same as
423 % \cs{pdf_object_id:n}/\cs{pdf_object_id_indexed:nn}.
424 % \end{function}
425 %
426 % \begin{variable}{\g__kernel_prg_map_int}
427 % This integer is used by non-expandable mapping functions to track
428 % the level of nesting in force. The functions
429 % \cs[no-index]{\meta{type}_map_1:w},
430 % \cs[no-index]{\meta{type}_map_2:w}, etc., labeled by
431 % \cs{g__kernel_prg_map_int}
432 % hold functions to be mapped over various list datatypes in inline
433 % and variable mappings.
434 % \end{variable}
435 %
436 % \begin{function}{\__kernel_quark_new_test:N}
437 % \begin{syntax}
438 % \cs{__kernel_quark_new_test:N} \cs[no-index]{\meta{name}:\meta{arg spec}}
439 % \end{syntax}
440 % Defines a quark-test function \cs[no-index]{\meta{name}:\meta{arg spec}}
441 % which tests if its argument is \cs[no-index]{q__\meta{namespace}_recursion_tail},
442 % then acts accordingly, as described below for each possible
443 % \meta{arg spec}.
444 %
445 % The \meta{namespace} is determined as the first (nonempty)
446 % |_|-delimited word in \meta{name} and is used internally
447 % in the definition of auxiliaries. The function
448 % \cs{__kernel_quark_new_test:N} does \emph{not} define
449 % the \cs[no-index]{q__\meta{namespace}_recursion_tail} and
450 % \cs[no-index]{q__\meta{namespace}_recursion_stop} quarks.
451 % They should be manually defined with \cs{quark_new:N}.
452 %
453 % There are $6$ different types of quark-test functions. Which one is
454 % defined depends on the \meta{arg spec}, which \emph{must} be one of
455 % the options listed now. Four of them are modeled after
456 % \cs[no-index]{quark_if_recursion_tail:(N|n)} and
457 % \cs[no-index]{quark_if_recursion_tail_do:(N|n)n}.
458 % \begin{description}
459 % \def\makelabel#1{\texttt{#1}}
460 % \item[n] defines \cs[no-index]{\meta{name}:n} such that it
461 % checks if |#1| contains only \cs[no-index]{q__\meta{namespace}_recursion_tail}, and
462 % if so consumes all tokens up to \cs[no-index]{q__\meta{namespace}_recursion_stop}
463 % (\emph{c.f.}~\cs{quark_if_recursion_tail_stop:n}).
464 % \item[nn] defines \cs[no-index]{\meta{name}:nn} such that it
465 % checks if |#1| contains only \cs[no-index]{q__\meta{namespace}_recursion_tail}, and
466 % if so consumes all tokens up to \cs[no-index]{q__\meta{namespace}_recursion_stop},
467 % then executes the code |#2| after that
468 % (\emph{c.f.}~\cs{quark_if_recursion_tail_stop_do:nn}).
469 % \item[N] defines \cs[no-index]{\meta{name}:N} such that it
470 % checks if |#1| is \cs[no-index]{q__\meta{namespace}_recursion_tail}, and if so consumes
471 % all tokens up to \cs[no-index]{q__\meta{namespace}_recursion_stop}
472 % (\emph{c.f.}~\cs{quark_if_recursion_tail_stop:N}).
473 % \item[Nn] defines \cs[no-index]{\meta{name}:Nn} such that it
474 % checks if |#1| is \cs[no-index]{q__\meta{namespace}_recursion_tail}, and if so consumes
475 % all tokens up to \cs[no-index]{q__\meta{namespace}_recursion_stop}, then executes
476 % the code |#2| after that
477 % (\emph{c.f.}~\cs{quark_if_recursion_tail_stop_do:Nn}).
478 % \end{description}
479 % The last two are modeled after
480 % \cs[no-index]{quark_if_recursion_tail_break:(n|N)N}, and in those
481 % cases the quark \cs[no-index]{q__\meta{namespace}_recursion_stop} is
482 % not used (and thus needs not be defined).
483 % \begin{description}
484 % \def\makelabel#1{\texttt{#1}}
485 % \item[nN] defines \cs[no-index]{\meta{name}:nN} such that it
486 % checks if |#1| contains only \cs[no-index]{q__\meta{namespace}_recursion_tail}, and
487 % if so uses the \cs[no-index]{\meta{type}_map_break:} function |#2|.
488 % \item[NN] defines \cs[no-index]{\meta{name}:NN} such that it
489 % checks if |#1| is \cs[no-index]{q__\meta{namespace}_recursion_tail}, and if so uses
490 % the \cs[no-index]{\meta{type}_map_break:} function |#2|.
491 % \end{description}
492 % Any other signature, as well as a function without signature
493 % are errors, and in such case the definition is aborted.
494 % \end{function}
495 %
496 % \begin{function}{\__kernel_quark_new_conditional:Nn}
497 % \begin{syntax}
498 % \cs{__kernel_quark_new_conditional:Nn} \cs[no-index]{__\meta{namespace}_quark_if_\meta{name}:\meta{arg spec}} \Arg{conditions}
499 % \end{syntax}
500 % Defines a collection of quark conditionals that test if their
501 % argument is the quark \cs[no-index]{q__\meta{namespace}_\meta{name}}
502 % and perform suitable actions. The \meta{conditions} are a
503 % comma-separated list of one or more of |p|, |T|, |F|, and |TF|, and
504 % one conditional is defined for each \meta{condition} in the list, as
505 % described for \cs{prg_new_conditional:Npnn}. The conditionals are
506 % defined using \cs{prg_new_conditional:Npnn}, so that their name is
507 % obtained by adding |p|, |T|, |F|, or |TF| to the base name
508 % \cs[no-index]{__\meta{namespace}_quark_if_\meta{name}:\meta{arg spec}}.
509 %
510 % The first argument of \cs{__kernel_quark_new_conditional:Nn} must
511 % contain |_quark_if_| and |:|, as these markers are used to determine
512 % the \meta{name} of the quark
513 % \cs[no-index]{q__\meta{namespace}_\meta{name}} to be tested. This
514 % quark should be manually defined with \cs{quark_new:N}, as
515 % \cs{__kernel_quark_new_conditional:Nn} does \emph{not} define it.
516 %
517 % The function \cs{__kernel_quark_new_conditional:Nn} can define $2$
518 % different types of quark conditionals. Which one is defined depends
519 % on the \meta{arg spec}, which \emph{must} be one of the following
520 % options, modeled after \cs[index=quark_if_nil:NTF]{quark_if_nil:(N|n)(TF)}.
521 % \begin{description}
522 % \def\makelabel#1{\texttt{#1}}
523 % \item[n] defines \cs[no-index]{__\meta{namespace}_quark_if_\meta{name}:n(TF)} such that it
524 % checks if |#1| contains only \cs[no-index]{q__\meta{namespace}_\meta{name}}, and
525 % executes the proper conditional branch.
526 % \item[N] defines \cs[no-index]{__\meta{namespace}_quark_if_\meta{name}:N(TF)} such that it
527 % checks if |#1| is \cs[no-index]{q__\meta{namespace}_\meta{name}}, and
528 % executes the proper conditional branch.
529 % \end{description}
530 % Any other signature, as well as a function without signature
531 % are errors, and in such case the definition is aborted.
532 % \end{function}
533 %
534 % \begin{function}{\__kernel_sys_everyjob:}
535 % \begin{syntax}
536 % \cs{__kernel_sys_everyjob:}
537 % \end{syntax}
538 % Inserts the internal token list required at the start of every run (job).
539 % \end{function}
540 %
541 % \begin{variable}{\c__kernel_randint_max_int}
542 % Maximal allowed argument to \cs{__kernel_randint:n}. Equal to
543 % $2^{17}-1$.
544 % \end{variable}
545 %
546 % \begin{function}{\__kernel_randint:n}
547 % \begin{syntax}
548 % \cs{__kernel_randint:n} \Arg{max}
549 % \end{syntax}
550 % Used in an integer expression this gives a pseudo-random number
551 % between $1$ and $\meta{max}$ included. One must have
552 % $\meta{max}\leq 2^{17}-1$. The \meta{max} must be suitable for
553 % \cs{int_value:w} (and any \cs{int_eval:w} must be terminated by
554 % \cs{scan_stop:} or equivalent).
555 % \end{function}
556 %
557 % \begin{function}{\__kernel_randint:nn}
558 % \begin{syntax}
559 % \cs{__kernel_randint:nn} \Arg{min} \Arg{max}
560 % \end{syntax}
561 % Used in an integer expression this gives a pseudo-random number
562 % between $\meta{min}$ and $\meta{max}$ included. The \meta{min} and
563 % \meta{max} must be suitable for \cs{int_value:w} (and any
564 % \cs{int_eval:w} must be terminated by \cs{scan_stop:} or
565 % equivalent). For small ranges
566 % $R=\meta{max}-\meta{min}+1\leq 2^{17}-1$,
567 % $\meta{min} - 1 + \cs{__kernel_randint:n} |{|R|}|$ is faster.
568 % \end{function}
569 %
570 % \begin{function}{\__kernel_register_show:N, \__kernel_register_show:c}
571 % \begin{syntax}
572 % \cs{__kernel_register_show:N} \meta{register}
573 % \end{syntax}
574 % Used to show the contents of a \TeX{} register at the terminal, formatted
575 % such that internal parts of the mechanism are not visible.
576 % \end{function}
577 %
578 % \begin{function}
579 % {\__kernel_register_log:N, \__kernel_register_log:c}
580 % \begin{syntax}
581 % \cs{__kernel_register_log:N} \meta{register}
582 % \end{syntax}
583 % Used to write the contents of a \TeX{} register to the log file in a
584 % form similar to \cs{__kernel_register_show:N}.
585 % \end{function}
586 %
587 % \begin{function}[EXP]{\__kernel_str_to_other:n}
588 % \begin{syntax}
589 % \cs{__kernel_str_to_other:n} \Arg{token list}
590 % \end{syntax}
591 % Converts the \meta{token list} to a \meta{other string}, where
592 % spaces have category code \enquote{other}. This function can be
593 % \texttt{f}-expanded without fear of losing a leading space, since
594 % spaces do not have category code $10$ in its result. It takes a
595 % time quadratic in the character count of the string.
596 % \end{function}
597 %
598 % \begin{function}[rEXP]{\__kernel_str_to_other_fast:n}
599 % \begin{syntax}
600 % \cs{__kernel_str_to_other_fast:n} \Arg{token list}
601 % \end{syntax}
602 % Same behavior \cs{__kernel_str_to_other:n} but only restricted-expandable.
603 % It takes a time linear in the character count of the string.
604 % \end{function}
605 %
606 % \begin{function}[EXP]{\__kernel_tl_to_str:w}
607 % \begin{syntax}
608 % \cs{__kernel_tl_to_str:w} \meta{expandable tokens} \Arg{tokens}
609 % \end{syntax}
610 % Carries out expansion on the \meta{expandable tokens} before conversion of
611 % the \meta{tokens} to a string as describe for \cs{tl_to_str:n}. Typically,
612 % the \meta{expandable tokens} will alter the nature of the \meta{tokens},
613 % i.e., allow it to be generated in some way. This function requires
614 % only a single expansion.
615 % \end{function}
616 %
617 % \begin{function}{\__kernel_tl_set:Nx, \__kernel_tl_gset:Nx}
618 % \begin{syntax}
619 % \cs{__kernel_tl_set:Nx} \meta{tl~var} \Arg{tokens}
620 % \end{syntax}
621 % Fully expands \meta{tokens} and assigns the result to \meta{tl~var}.
622 % \meta{tokens} must be given in braces and there must be no token between
623 % \meta{tl~var} and \meta{tokens}.
624 % \end{function}
625 %
626 % \begin{function}[EXP]{\__kernel_codepoint_data:nn}
627 % \begin{syntax}
628 % \cs{__kernel_codepoint_data:nn} \Arg{type} \Arg{codepoint}
629 % \end{syntax}
630 % Expands to the appropriate value for the \meta{type} of data
631 % requested for a \meta{codepoint}. The current list of \meta{types} and
632 % results are
633 % \begin{description}
634 % \item[\texttt{lowercase}] The \emph{single} codepoint specified by
635 % \texttt{UnicodeData.txt} for lowercase mapping of the codepoint:
636 % will be equal to the input \meta{codepoint} if there is no mapping
637 % specified in \texttt{UnicodeData.txt}
638 % \item[\texttt{uppercase}] The \emph{single} codepoint specified by
639 % \texttt{UnicodeData.txt} for uppercase mapping of the codepoint:
640 % will be equal to the input \meta{codepoint} if there is no mapping
641 % specified in \texttt{UnicodeData.txt}
642 % \end{description}
643 % \end{function}
644 %
645 % \begin{function}[EXP]{\__kernel_codepoint_case:nn}
646 % \begin{syntax}
647 % \cs{__kernel_codepoint_case:nn} \Arg{mapping} \Arg{codepoint}
648 % \end{syntax}
649 % Expands to a list of three balanced text, of which at least the first
650 % will contain a codepoint. This list of up to three codepoints specifies
651 % the full case mapping for the input \meta{codepoint}. The \meta{mapping}
652 % should be one of
653 % \begin{itemize}
654 % \item \texttt{casefold}
655 % \item \texttt{lowercase}
656 % \item \texttt{titlecase}
657 % \item \texttt{uppercase}
658 % \end{itemize}
659 % \end{function}
660 %
661 % \subsection{Kernel backend functions}
662 %
663 % These functions are required to pass information to the backend. The nature
664 % of these means that they are defined only when the relevant backend is in
665 % use.
666 %
667 % \begin{function}
668 % {
669 % \__kernel_backend_literal:n,
670 % \__kernel_backend_literal:e,
671 % \__kernel_backend_literal:e
672 % }
673 % \begin{syntax}
674 % \cs{__kernel_backend_literal:n} \Arg{content}
675 % \end{syntax}
676 % Adds the \meta{content} literally to the current vertical list as a
677 % whatsit. The nature of the \meta{content} will depend on the backend in
678 % use.
679 % \end{function}
680 %
681 % \begin{function}
682 % {
683 % \__kernel_backend_literal_postscript:n,
684 % \__kernel_backend_literal_postscript:e
685 % }
686 % \begin{syntax}
687 % \cs{__kernel_backend_literal_postscript:n} \Arg{PostScript}
688 % \end{syntax}
689 % Adds the \meta{PostScript} literally to the current vertical list as a
690 % whatsit. No positioning is applied.
691 % \end{function}
692 %
693 % \begin{function}
694 % {
695 % \__kernel_backend_literal_pdf:n,
696 % \__kernel_backend_literal_pdf:e
697 % }
698 % \begin{syntax}
699 % \cs{__kernel_backend_literal_pdf:n} \Arg{PDF instructions}
700 % \end{syntax}
701 % Adds the \meta{PDF instructions} literally to the current vertical list as
702 % a whatsit. No positioning is applied.
703 % \end{function}
704 %
705 % \begin{function}
706 % {
707 % \__kernel_backend_literal_svg:n,
708 % \__kernel_backend_literal_svg:e
709 % }
710 % \begin{syntax}
711 % \cs{__kernel_backend_literal_svg:n} \Arg{SVG instructions}
712 % \end{syntax}
713 % Adds the \meta{SVG instructions} literally to the current vertical list as
714 % a whatsit. No positioning is applied.
715 % \end{function}
716 %
717 % \begin{function}
718 % {
719 % \__kernel_backend_postscript:n,
720 % \__kernel_backend_postscript:e
721 % }
722 % \begin{syntax}
723 % \cs{__kernel_backend_postscript:n} \Arg{PostScript}
724 % \end{syntax}
725 % Adds the \meta{PostScript} to the current vertical list as a
726 % whatsit. The PostScript reference point is adjusted to match the
727 % current position. The PostScript is inserted inside a |SDict begin|/|end|
728 % pair.
729 % \end{function}
730 %
731 % \begin{function}{\__kernel_backend_align_begin:, \__kernel_backend_align_end:}
732 % \begin{syntax}
733 % \cs{__kernel_backend_align_begin:}
734 % \meta{PostScript literals}
735 % \cs{__kernel_backend_align_end:}
736 % \end{syntax}
737 % Arranges to align the PostScript and DVI current positions and scales.
738 % \end{function}
739 %
740 % \begin{function}{\__kernel_backend_scope_begin:, \__kernel_backend_scope_end:}
741 % \begin{syntax}
742 % \cs{__kernel_backend_scope_begin:}
743 % \meta{content}
744 % \cs{__kernel_backend_scope_end:}
745 % \end{syntax}
746 % Creates a scope for instructions at the backend level.
747 % \end{function}
748 %
749 % \begin{function}
750 % {
751 % \__kernel_backend_matrix:n,
752 % \__kernel_backend_matrix:e
753 % }
754 % \begin{syntax}
755 % \cs{__kernel_backend_matrix:n} \Arg{matrix}
756 % \end{syntax}
757 % Applies the \meta{matrix} to the current transformation matrix.
758 % \end{function}
759 %
760 % \begin{function}{\g__kernel_backend_header_bool}
761 % Specifies whether to write headers for the backend.
762 % \end{function}
763 %
764 % \begin{function}{\l__kernel_color_stack_int}
765 % The color stack used in \pdfTeX{} and \LuaTeX{} for the main color.
766 % \end{function}
767 %
768 % \end{implementation}
769 %
770 % \PrintIndex