diff options
author | Karl Berry <karl@freefriends.org> | 2011-07-31 18:27:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-07-31 18:27:06 +0000 |
commit | dac945b204407dae96f70ec228206516093156d7 (patch) | |
tree | 02ca182689947e45dec95e17ba08b503c959bd17 /Master/texmf-dist/tex/latex | |
parent | c1840548792cfbc7c9f746da1d53d89b94406e72 (diff) |
l3kernel (5jun11)
git-svn-id: svn://tug.org/texlive/trunk@23282 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
24 files changed, 13286 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty new file mode 100644 index 00000000000..d0ac38f18e1 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty @@ -0,0 +1,179 @@ +%% +%% This is file `expl3.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% expl3.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: expl3.dtx Copyright (C) 1990-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: expl3.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental code bundle wrapper} + %\subsubsection{Variables: scope and type} +\RequirePackage{etex} +\reserveinserts{32} +\RequirePackage{calc} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\newcommand* \@l@expl@check@declarations@bool { 0 } +\newcommand*\@l@expl@log@functions@bool { 0 } +\DeclareOption { check-declarations } + { \def \@l@expl@check@declarations@bool { 1 } } +\DeclareOption { log-functions } + {\def \@l@expl@log@functions@bool { 1 } } +\ProcessOptions \relax +\RequirePackage{ l3basics, l3expan, l3tl } +\ifodd \@l@expl@check@declarations@bool \relax + \cs_new_protected:Npn \tl_check_exists:N #1 + { + \cs_if_exist:NF #1 + { + \msg_kernel_error:nnx { check } { non-declared-variable } + { \token_to_str:N #1 } + } + } + \cs_set_protected:Npn \tl_set:Nn #1#2 + { + \tl_check_exists:N #1 + \cs_set_nopar:Npx #1 { \exp_not:n {#2} } + } + \cs_set_protected:Npn \tl_set:Nx #1#2 + { + \tl_check_exists:N #1 + \cs_set_nopar:Npx #1 {#2} + } + \cs_set_protected:Npn \tl_gset:Nn #1#2 + { + \tl_check_exists:N #1 + \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } + } + \cs_set_protected:Npn \tl_gset:Nx #1#2 + { + \tl_check_exists:N #1 + \cs_gset_nopar:Npx #1 {#2} + } + \cs_set_protected:Npn \tl_set_eq:NN #1#2 + { + \tl_check_exists:N #1 + \tl_check_exists:N #2 + \cs_set_eq:NN #1 #2 + } + \cs_set_protected:Npn \tl_gset_eq:NN #1#2 + { + \tl_check_exists:N #1 + \tl_check_exists:N #2 + \cs_gset_eq:NN #1 #2 + } +\fi +\RequirePackage{ + l3seq, + l3int, + l3quark, + l3prg, + l3clist, + l3token, + l3prop, + l3msg, + l3io, + l3file, + l3skip, + l3box, + l3keyval, + l3keys, + l3fp, + l3luatex +} +\RequirePackage{l3toks} +\bool_if:nT { \@l@expl@check@declarations@bool } + { + \msg_kernel_new:nnnn { check } { non-declared-variable } + { The~variable~#1~has~not~been~declared~\msg_line_context:. } + { + Checking~is~active,~and~you~have~tried~do~so~something~like: \\ + \ \ \tl_set:Nn #1 ~ + \iow_char:N \{ ~ ... ~ \iow_char:N \} \\ + without~first~having: \\ + \ \ \tl_new:N #1 \\ + \\ + LaTeX~will~create~the~variable~and~continue. + } + } +\cs_set_protected_nopar:Npn \ExplSyntaxOn + { + \bool_if:NF \l_expl_status_bool + { + \cs_set_protected_nopar:Npx \ExplSyntaxOff + { + \char_set_catcode:nn { 9 } { \char_value_catcode:n { 9 } } + \char_set_catcode:nn { 32 } { \char_value_catcode:n { 32 } } + \char_set_catcode:nn { 34 } { \char_value_catcode:n { 34 } } + \char_set_catcode:nn { 38 } { \char_value_catcode:n { 38 } } + \char_set_catcode:nn { 58 } { \char_value_catcode:n { 58 } } + \char_set_catcode:nn { 94 } { \char_value_catcode:n { 94 } } + \char_set_catcode:nn { 95 } { \char_value_catcode:n { 95 } } + \char_set_catcode:nn { 124 } { \char_value_catcode:n { 124 } } + \char_set_catcode:nn { 126 } { \char_value_catcode:n { 126 } } + \tex_endlinechar:D = \tex_the:D \tex_endlinechar:D \scan_stop: + \bool_set_false:N \l_expl_status_bool + \cs_set_protected_nopar:Npn \ExplSyntaxOff { } + } + } + \char_set_catcode_ignore:n { 9 } % tab + \char_set_catcode_ignore:n { 32 } % space + \char_set_catcode_other:n { 34 } % double quote + \char_set_catcode_alignment:n { 38 } % ampersand + \char_set_catcode_letter:n { 58 } % colon + \char_set_catcode_math_superscript:n { 94 } % circumflex + \char_set_catcode_letter:n { 95 } % underscore + \char_set_catcode_other:n { 124 } % pipe + \char_set_catcode_space:n { 126 } % tilde + \tex_endlinechar:D = 32 \scan_stop: + \bool_set_true:N \l_expl_status_bool + } +\cs_set_protected_nopar:Npx \ExplSyntaxOff + { + \exp_not:o \ExplSyntaxOff + \cs_set_protected_nopar:Npn \ExplSyntaxOff { } + } +%% +%% +%% End of file `expl3.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty new file mode 100644 index 00000000000..edecb52c1c7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty @@ -0,0 +1,784 @@ +%% +%% This is file `l3basics.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3basics.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3basics.dtx Copyright (C) 1990-2011 The LaTeX3 project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3basics.dtx 2493 2011-07-04 09:50:22Z bruno $ + {L3 Experimental basic definitions} + +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\tex_let:D \cs_set_eq:NwN \tex_let:D +\cs_set_eq:NwN \if_true: \tex_iftrue:D +\cs_set_eq:NwN \if_false: \tex_iffalse:D +\cs_set_eq:NwN \or: \tex_or:D +\cs_set_eq:NwN \else: \tex_else:D +\cs_set_eq:NwN \fi: \tex_fi:D +\cs_set_eq:NwN \reverse_if:N \etex_unless:D +\cs_set_eq:NwN \if:w \tex_if:D +\cs_set_eq:NwN \if_bool:N \tex_ifodd:D +\cs_set_eq:NwN \if_predicate:w \tex_ifodd:D +\cs_set_eq:NwN \if_charcode:w \tex_if:D +\cs_set_eq:NwN \if_catcode:w \tex_ifcat:D +\cs_set_eq:NwN \if_meaning:w \tex_ifx:D +\cs_set_eq:NwN \if_mode_math: \tex_ifmmode:D +\cs_set_eq:NwN \if_mode_horizontal: \tex_ifhmode:D +\cs_set_eq:NwN \if_mode_vertical: \tex_ifvmode:D +\cs_set_eq:NwN \if_mode_inner: \tex_ifinner:D +\cs_set_eq:NwN \if_cs_exist:N \etex_ifdefined:D +\cs_set_eq:NwN \if_cs_exist:w \etex_ifcsname:D +\cs_set_eq:NwN \exp_after:wN \tex_expandafter:D +\cs_set_eq:NwN \exp_not:N \tex_noexpand:D +\cs_set_eq:NwN \exp_not:n \etex_unexpanded:D +\cs_set_eq:NwN \token_to_meaning:N \tex_meaning:D +\cs_set_eq:NwN \token_to_str:N \tex_string:D +\cs_set_eq:NwN \cs:w \tex_csname:D +\cs_set_eq:NwN \cs_end: \tex_endcsname:D +\cs_set_eq:NwN \cs_meaning:N \tex_meaning:D +\cs_set_eq:NwN \cs_show:N \tex_show:D +\cs_set_eq:NwN \scan_stop: \tex_relax:D +\cs_set_eq:NwN \group_begin: \tex_begingroup:D +\cs_set_eq:NwN \group_end: \tex_endgroup:D +\cs_set_eq:NwN \if_int_compare:w \tex_ifnum:D +\cs_set_eq:NwN \int_to_roman:w \tex_romannumeral:D +\cs_set_eq:NwN \group_insert_after:N \tex_aftergroup:D +\cs_set_eq:NwN \pref_global:D \tex_global:D +\cs_set_eq:NwN \pref_long:D \tex_long:D +\cs_set_eq:NwN \pref_protected:D \etex_protected:D +\tex_long:D \tex_def:D \exp_args:Nc #1#2 { \exp_after:wN #1 \cs:w #2 \cs_end: } +%% A small number of variants by hand. +\tex_def:D \cs_meaning:c { \exp_args:Nc \cs_meaning:N } +\tex_def:D \token_to_str:c { \exp_args:Nc \token_to_str:N } +\tex_def:D \cs_show:c { \exp_args:Nc \cs_show:N } +\cs_set_eq:NwN \cs_set_nopar:Npn \tex_def:D +\cs_set_eq:NwN \cs_set_nopar:Npx \tex_edef:D +\pref_protected:D \cs_set_nopar:Npn \cs_set:Npn + { \pref_long:D \cs_set_nopar:Npn } +\pref_protected:D \cs_set_nopar:Npn \cs_set:Npx + { \pref_long:D \cs_set_nopar:Npx } +\pref_protected:D \cs_set_nopar:Npn \cs_set_protected_nopar:Npn + { \pref_protected:D \cs_set_nopar:Npn } +\pref_protected:D \cs_set_nopar:Npn \cs_set_protected_nopar:Npx + { \pref_protected:D \cs_set_nopar:Npx } +\cs_set_protected_nopar:Npn \cs_set_protected:Npn + { \pref_protected:D \pref_long:D \cs_set_nopar:Npn } +\cs_set_protected_nopar:Npn \cs_set_protected:Npx + { \pref_protected:D \pref_long:D \cs_set_nopar:Npx } +\cs_set_eq:NwN \cs_gset_nopar:Npn \tex_gdef:D +\cs_set_eq:NwN \cs_gset_nopar:Npx \tex_xdef:D +\cs_set_protected_nopar:Npn \cs_gset:Npn + { \pref_long:D \cs_gset_nopar:Npn } +\cs_set_protected_nopar:Npn \cs_gset:Npx + { \pref_long:D \cs_gset_nopar:Npx } +\cs_set_protected_nopar:Npn \cs_gset_protected_nopar:Npn + { \pref_protected:D \cs_gset_nopar:Npn } +\cs_set_protected_nopar:Npn \cs_gset_protected_nopar:Npx + { \pref_protected:D \cs_gset_nopar:Npx } +\cs_set_protected_nopar:Npn \cs_gset_protected:Npn + { \pref_protected:D \pref_long:D \cs_gset_nopar:Npn } +\cs_set_protected_nopar:Npn \cs_gset_protected:Npx + { \pref_protected:D \pref_long:D \cs_gset_nopar:Npx } +\cs_set:Npn \use:c #1 { \cs:w #1 \cs_end: } +\cs_set_protected:Npn \use:x #1 + { + \group_begin: + \cs_set:Npx \cs_tmp:w {#1} + \exp_after:wN + \group_end: + \cs_tmp:w + } +\cs_set:Npn \cs_tmp:w { } +\cs_set:Npn \use:n #1 {#1} +\cs_set:Npn \use:nn #1#2 {#1#2} +\cs_set:Npn \use:nnn #1#2#3 {#1#2#3} +\cs_set:Npn \use:nnnn #1#2#3#4 {#1#2#3#4} +\cs_set:Npn \use_i:nn #1#2 {#1} +\cs_set:Npn \use_ii:nn #1#2 {#2} +\cs_set:Npn \use_i:nnn #1#2#3 {#1} +\cs_set:Npn \use_ii:nnn #1#2#3 {#2} +\cs_set:Npn \use_iii:nnn #1#2#3 {#3} +\cs_set:Npn \use_i_ii:nnn #1#2#3 {#1#2} +\cs_set:Npn \use_i:nnnn #1#2#3#4 {#1} +\cs_set:Npn \use_ii:nnnn #1#2#3#4 {#2} +\cs_set:Npn \use_iii:nnnn #1#2#3#4 {#3} +\cs_set:Npn \use_iv:nnnn #1#2#3#4 {#4} +\cs_set:Npn \use_none_delimit_by_q_nil:w #1 \q_nil { } +\cs_set:Npn \use_none_delimit_by_q_stop:w #1 \q_stop { } +\cs_set:Npn \use_none_delimit_by_q_recursion_stop:w #1 \q_recursion_stop { } +\cs_set:Npn \use_i_delimit_by_q_nil:nw #1#2 \q_nil {#1} +\cs_set:Npn \use_i_delimit_by_q_stop:nw #1#2 \q_stop {#1} +\cs_set:Npn \use_i_delimit_by_q_recursion_stop:nw #1#2 \q_recursion_stop {#1} +\cs_set:Npn \use_i_after_fi:nw #1 \fi: { \fi: #1 } +\cs_set:Npn \use_i_after_else:nw #1 \else: #2 \fi: { \fi: #1 } +\cs_set:Npn \use_i_after_or:nw #1 \or: #2 \fi: { \fi: #1 } +\cs_set:Npn \use_i_after_orelse:nw #1#2#3 \fi: { \fi: #1 } +\cs_set:Npn \use_none:n #1 { } +\cs_set:Npn \use_none:nn #1#2 { } +\cs_set:Npn \use_none:nnn #1#2#3 { } +\cs_set:Npn \use_none:nnnn #1#2#3#4 { } +\cs_set:Npn \use_none:nnnnn #1#2#3#4#5 { } +\cs_set:Npn \use_none:nnnnnn #1#2#3#4#5#6 { } +\cs_set:Npn \use_none:nnnnnnn #1#2#3#4#5#6#7 { } +\cs_set:Npn \use_none:nnnnnnnn #1#2#3#4#5#6#7#8 { } +\cs_set:Npn \use_none:nnnnnnnnn #1#2#3#4#5#6#7#8#9 { } +\cs_set_nopar:Npn \prg_return_true: + { \exp_after:wN \use_i:nn \int_to_roman:w } +\cs_set_nopar:Npn \prg_return_false: + { \exp_after:wN \use_ii:nn \int_to_roman:w} +\cs_set_protected:Npn \prg_set_conditional:Npnn #1 + { + \prg_get_parm_aux:nw + { + \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn + \cs_set:Npn { parm } + } + } +\cs_set_protected:Npn \prg_new_conditional:Npnn #1 + { + \prg_get_parm_aux:nw + { + \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn + \cs_new:Npn { parm } + } + } +\cs_set_protected:Npn \prg_set_protected_conditional:Npnn #1 + { + \prg_get_parm_aux:nw{ + \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn + \cs_set_protected:Npn { parm } + } + } +\cs_set_protected:Npn \prg_new_protected_conditional:Npnn #1 + { + \prg_get_parm_aux:nw + { + \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn + \cs_new_protected:Npn { parm } + } + } +\cs_set_protected:Npn \prg_set_conditional:Nnn #1 + { + \exp_args:Nnf \prg_get_count_aux:nn + { + \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn + \cs_set:Npn { count } + } + { \cs_get_arg_count_from_signature:N #1 } + } +\cs_set_protected:Npn \prg_new_conditional:Nnn #1 + { + \exp_args:Nnf \prg_get_count_aux:nn + { + \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn + \cs_new:Npn { count} + } + { \cs_get_arg_count_from_signature:N #1 } + } + +\cs_set_protected:Npn \prg_set_protected_conditional:Nnn #1{ + \exp_args:Nnf \prg_get_count_aux:nn{ + \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn + \cs_set_protected:Npn {count} + }{\cs_get_arg_count_from_signature:N #1} +} + +\cs_set_protected:Npn \prg_new_protected_conditional:Nnn #1 + { + \exp_args:Nnf \prg_get_count_aux:nn + { + \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn + \cs_new_protected:Npn {count} + } + { \cs_get_arg_count_from_signature:N #1 } + } +\cs_set_protected:Npn \prg_set_eq_conditional:NNn #1#2#3 + { \prg_set_eq_conditional_aux:NNNn \cs_set_eq:cc #1#2 {#3} } +\cs_set_protected:Npn \prg_new_eq_conditional:NNn #1#2#3 + { \prg_set_eq_conditional_aux:NNNn \cs_new_eq:cc #1#2 {#3} } +\cs_set:Npn \prg_get_count_aux:nn #1#2 { #1 {#2} } +\cs_set:Npn \prg_get_parm_aux:nw #1#2# { #1 {#2} } +\cs_set_protected:Npn \prg_generate_conditional_aux:nnNNnnnn #1#2#3#4#5#6#7#8 + { + \prg_generate_conditional_aux:nnw {#5} + { + #4 {#1} {#2} {#6} {#8} + } + #7 , ? , \q_recursion_stop + } +\cs_set_protected:Npn \prg_generate_conditional_aux:nnw #1#2#3 , + { + \if:w ?#3 + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \fi: + \use:c { prg_generate_#3_form_#1:Nnnnn } #2 + \prg_generate_conditional_aux:nnw {#1} {#2} + } +\cs_set_protected:Npn \prg_generate_p_form_parm:Nnnnn #1#2#3#4#5 + { + \exp_args:Nc #1 { #2 _p: #3 } #4 + { + #5 \c_zero + \c_true_bool \c_false_bool + } + } +\cs_set_protected:Npn \prg_generate_T_form_parm:Nnnnn #1#2#3#4#5 + { + \exp_args:Nc #1 { #2 : #3 T } #4 + { + #5 \c_zero + \use:n \use_none:n + } + } +\cs_set_protected:Npn \prg_generate_F_form_parm:Nnnnn #1#2#3#4#5 + { + \exp_args:Nc #1 { #2 : #3 F } #4 + { + #5 \c_zero + { } + } + } +\cs_set_protected:Npn \prg_generate_TF_form_parm:Nnnnn #1#2#3#4#5 + { + \exp_args:Nc #1 { #2 : #3 TF } #4 + { #5 \c_zero } + } +\cs_set_protected:Npn \prg_generate_p_form_count:Nnnnn #1#2#3#4#5 + { + \cs_generate_from_arg_count:cNnn { #2 _p: #3 } #1 {#4} + { + #5 \c_zero + \c_true_bool \c_false_bool + } + } +\cs_set_protected:Npn \prg_generate_T_form_count:Nnnnn #1#2#3#4#5 + { + \cs_generate_from_arg_count:cNnn { #2 : #3 T } #1 {#4} + { + #5 \c_zero + \use:n \use_none:n + } + } +\cs_set_protected:Npn \prg_generate_F_form_count:Nnnnn #1#2#3#4#5 + { + \cs_generate_from_arg_count:cNnn { #2 : #3 F } #1 {#4} + { + #5 \c_zero + { } + } + } +\cs_set_protected:Npn \prg_generate_TF_form_count:Nnnnn #1#2#3#4#5 + { + \cs_generate_from_arg_count:cNnn { #2 : #3 TF } #1 {#4} + { #5 \c_zero } + } +\cs_set_protected:Npn \prg_set_eq_conditional_aux:NNNn #1#2#3#4 + { \prg_set_eq_conditional_aux:NNNw #1#2#3#4 , ? , \q_recursion_stop } +\cs_set_protected:Npn \prg_set_eq_conditional_aux:NNNw #1#2#3#4 , + { + \if:w ? #4 \scan_stop: + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \fi: + #1 + { \exp_args:NNc \cs_split_function:NN #2 { prg_conditional_form_#4:nnn } } + { \exp_args:NNc \cs_split_function:NN #3 { prg_conditional_form_#4:nnn } } + \prg_set_eq_conditional_aux:NNNw #1 {#2} {#3} + } +\cs_set:Npn \prg_conditional_form_p:nnn #1#2#3 { #1 _p : #2 } +\cs_set:Npn \prg_conditional_form_TF:nnn #1#2#3 { #1 : #2 TF } +\cs_set:Npn \prg_conditional_form_T:nnn #1#2#3 { #1 : #2 T } +\cs_set:Npn \prg_conditional_form_F:nnn #1#2#3 { #1 : #2 F } +\tex_chardef:D \c_true_bool = 1~ +\tex_chardef:D \c_false_bool = 0~ +\cs_set_nopar:Npn \cs_to_str:N + { + \if:w \int_to_roman:w - `0 \token_to_str:N \ % + \cs_to_str_aux:w + \fi: + \exp_after:wN \use_none:n \token_to_str:N + } +\cs_set_nopar:Npn \cs_to_str_aux:w #1 \use_none:n + { ~ \int_to_roman:w - `0 \fi: } +\group_begin: + \tex_lccode:D `\@ = `\: \scan_stop: + \tex_catcode:D `\@ = 12~ +\tex_lowercase:D + { + \group_end: + \cs_set:Npn \cs_split_function:NN #1#2 + { + \exp_after:wN \cs_split_function_aux:w + \int_to_roman:w - `\q \cs_to_str:N #1 @ a \q_stop #2 + } + \cs_set:Npn \cs_split_function_aux:w #1 @ #2#3 \q_stop #4 + { + \if_meaning:w a #2 + \exp_after:wN \use_i:nn + \else: + \exp_after:wN\use_ii:nn + \fi: + { #4 {#1} { } \c_false_bool } + { \cs_split_function_auxii:w #2#3 \q_stop #4 {#1} } + } + \cs_set:Npn \cs_split_function_auxii:w #1 @a \q_stop #2#3 + { #2{#3}{#1}\c_true_bool } + } +\cs_set:Npn \cs_get_function_name:N #1 + { \cs_split_function:NN #1 \use_i:nnn } +\cs_set:Npn \cs_get_function_signature:N #1 + { \cs_split_function:NN #1 \use_ii:nnn } +\prg_set_conditional:Npnn \cs_if_exist:N #1 { p , T , F , TF } + { + \if_meaning:w #1 \scan_stop: + \prg_return_false: + \else: + \if_cs_exist:N #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + \fi: + } +\prg_set_conditional:Npnn \cs_if_exist:c #1 { p , T , F , TF } + { + \if_cs_exist:w #1 \cs_end: + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn + \fi: + { + \exp_after:wN \if_meaning:w \cs:w #1 \cs_end: \scan_stop: + \prg_return_false: + \else: + \prg_return_true: + \fi: + } + \prg_return_false: + } +\prg_set_conditional:Npnn \cs_if_free:N #1 { p , T , F , TF } + { + \if_meaning:w #1 \scan_stop: + \prg_return_true: + \else: + \if_cs_exist:N #1 + \prg_return_false: + \else: + \prg_return_true: + \fi: + \fi: + } +\prg_set_conditional:Npnn \cs_if_free:c #1 { p , T , F , TF } + { + \if_cs_exist:w #1 \cs_end: + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn + \fi: + { + \exp_after:wN \if_meaning:w \cs:w #1 \cs_end: \scan_stop: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + { \prg_return_true: } + } +\cs_set_eq:NwN \c_minus_one \m@ne +\tex_chardef:D \c_sixteen = 16~ +\tex_chardef:D \c_zero = 0~ +\tex_chardef:D \c_six = 6~ +\tex_chardef:D \c_seven = 7~ +\tex_chardef:D \c_twelve = 12~ +\tex_mathchardef:D \c_max_register_int = 32 767 \scan_stop: +\cs_set_protected_nopar:Npn \iow_log:x + { \tex_immediate:D \tex_write:D \c_minus_one } +\cs_set_protected_nopar:Npn \iow_term:x + { \tex_immediate:D \tex_write:D \c_sixteen } +\cs_set_protected_nopar:Npn \msg_kernel_error:nnxx #1#2#3#4 + { + \tex_errmessage:D + { + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~! ^^J + Argh,~internal~LaTeX3~error! ^^J ^^J + Module ~ #1 , ~ message~name~"#2": ^^J + Arguments~'#3'~and~'#4' ^^J ^^J + This~is~one~for~The~LaTeX3~Project:~bailing~out + } + \tex_end:D + } +\cs_set_protected_nopar:Npn \msg_kernel_error:nnx #1#2#3 + { \msg_kernel_error:nnxx {#1} {#2} {#3} { } } +\cs_set_protected_nopar:Npn \msg_kernel_error:nn #1#2 + { \msg_kernel_error:nnxx {#1} {#2} { } { } } +\cs_set_nopar:Npn \msg_line_context: + { on~line~\tex_the:D \tex_inputlineno:D } +\cs_set:Npn \cs_record_meaning:N #1 { } +\cs_set_protected_nopar:Npn \chk_if_free_cs:N #1 + { + \cs_if_free:NF #1 + { + \msg_kernel_error:nnxx { kernel } { command-already-defined } + { \token_to_str:N #1 } { \token_to_meaning:N #1 } + } +} +\tex_ifodd:D \@l@expl@log@functions@bool + \cs_set_protected_nopar:Npn \chk_if_free_cs:N #1 + { + \cs_if_free:NF #1 + { + \msg_kernel_error:nnxx { kernel } { command-already-defined } + { \token_to_str:N #1 } { \token_to_meaning:N #1 } + } + \iow_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } + } +\fi: +\cs_set_protected_nopar:Npn \chk_if_free_cs:c + { \exp_args:Nc \chk_if_free_cs:N } +\cs_set_protected_nopar:Npn \chk_if_exist_cs:N #1 + { + \cs_if_exist:NF #1 + { + \msg_kernel_error:nnxx { kernel } { command-not-defined } + { \token_to_str:N #1 } { \token_to_meaning:N #1 } + } + } +\cs_set_protected_nopar:Npn \chk_if_exist_cs:c + { \exp_args:Nc \chk_if_exist_cs:N } +\cs_set:Npn \cs_tmp:w #1#2 + { + \cs_set_protected_nopar:Npn #1 ##1 + { + \chk_if_free_cs:N ##1 + #2 ##1 + } + } +\cs_tmp:w \cs_new_nopar:Npn \cs_gset_nopar:Npn +\cs_tmp:w \cs_new_nopar:Npx \cs_gset_nopar:Npx +\cs_tmp:w \cs_new:Npn \cs_gset:Npn +\cs_tmp:w \cs_new:Npx \cs_gset:Npx +\cs_tmp:w \cs_new_protected_nopar:Npn \cs_gset_protected_nopar:Npn +\cs_tmp:w \cs_new_protected_nopar:Npx \cs_gset_protected_nopar:Npx +\cs_tmp:w \cs_new_protected:Npn \cs_gset_protected:Npn +\cs_tmp:w \cs_new_protected:Npx \cs_gset_protected:Npx +\cs_set:Npn \cs_tmp:w #1#2 + { \cs_new_protected_nopar:Npn #1 { \exp_args:Nc #2 } } +\cs_tmp:w \cs_set_nopar:cpn \cs_set_nopar:Npn +\cs_tmp:w \cs_set_nopar:cpx \cs_set_nopar:Npx +\cs_tmp:w \cs_gset_nopar:cpn \cs_gset_nopar:Npn +\cs_tmp:w \cs_gset_nopar:cpx \cs_gset_nopar:Npx +\cs_tmp:w \cs_new_nopar:cpn \cs_new_nopar:Npn +\cs_tmp:w \cs_new_nopar:cpx \cs_new_nopar:Npx +\cs_tmp:w \cs_set:cpn \cs_set:Npn +\cs_tmp:w \cs_set:cpx \cs_set:Npx +\cs_tmp:w \cs_gset:cpn \cs_gset:Npn +\cs_tmp:w \cs_gset:cpx \cs_gset:Npx +\cs_tmp:w \cs_new:cpn \cs_new:Npn +\cs_tmp:w \cs_new:cpx \cs_new:Npx +\cs_tmp:w \cs_set_protected_nopar:cpn \cs_set_protected_nopar:Npn +\cs_tmp:w \cs_set_protected_nopar:cpx \cs_set_protected_nopar:Npx +\cs_tmp:w \cs_gset_protected_nopar:cpn \cs_gset_protected_nopar:Npn +\cs_tmp:w \cs_gset_protected_nopar:cpx \cs_gset_protected_nopar:Npx +\cs_tmp:w \cs_new_protected_nopar:cpn \cs_new_protected_nopar:Npn +\cs_tmp:w \cs_new_protected_nopar:cpx \cs_new_protected_nopar:Npx +\cs_tmp:w \cs_set_protected:cpn \cs_set_protected:Npn +\cs_tmp:w \cs_set_protected:cpx \cs_set_protected:Npx +\cs_tmp:w \cs_gset_protected:cpn \cs_gset_protected:Npn +\cs_tmp:w \cs_gset_protected:cpx \cs_gset_protected:Npx +\cs_tmp:w \cs_new_protected:cpn \cs_new_protected:Npn +\cs_tmp:w \cs_new_protected:cpx \cs_new_protected:Npx +\cs_new_nopar:cpn { use_0_parameter: } { } +\cs_new_nopar:cpn { use_1_parameter: } { {##1} } +\cs_new_nopar:cpn { use_2_parameter: } { {##1} {##2} } +\cs_new_nopar:cpn { use_3_parameter: } { {##1} {##2} {##3} } +\cs_new_nopar:cpn { use_4_parameter: } { {##1} {##2} {##3} {##4} } +\cs_new_nopar:cpn { use_5_parameter: } { {##1} {##2} {##3} {##4} {##5} } +\cs_new_nopar:cpn { use_6_parameter: } { {##1} {##2} {##3} {##4} {##5} {##6} } +\cs_new_nopar:cpn { use_7_parameter: } + { {##1} {##2} {##3} {##4} {##5}{##6} {##7} } +\cs_new_nopar:cpn { use_8_parameter: } + { {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8} } +\cs_new_nopar:cpn{ use_9_parameter: } + { {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8} {##9} } +\cs_new_protected:Npn \cs_set_eq:NN #1 { \cs_set_eq:NwN #1 =~ } +\cs_new_protected_nopar:Npn \cs_set_eq:cN { \exp_args:Nc \cs_set_eq:NN } +\cs_new_protected_nopar:Npn \cs_set_eq:Nc { \exp_args:NNc \cs_set_eq:NN } +\cs_new_protected_nopar:Npn \cs_set_eq:cc { \exp_args:Ncc \cs_set_eq:NN } +\cs_new_protected:Npn \cs_new_eq:NN #1 + { + \chk_if_free_cs:N #1 + \pref_global:D \cs_set_eq:NN #1 + } +\cs_new_protected_nopar:Npn \cs_new_eq:cN { \exp_args:Nc \cs_new_eq:NN } +\cs_new_protected_nopar:Npn \cs_new_eq:Nc { \exp_args:NNc \cs_new_eq:NN } +\cs_new_protected_nopar:Npn \cs_new_eq:cc { \exp_args:Ncc \cs_new_eq:NN } +\cs_new_protected_nopar:Npn \cs_gset_eq:NN { \pref_global:D \cs_set_eq:NN } +\cs_new_protected_nopar:Npn \cs_gset_eq:Nc { \exp_args:NNc \cs_gset_eq:NN } +\cs_new_protected_nopar:Npn \cs_gset_eq:cN { \exp_args:Nc \cs_gset_eq:NN } +\cs_new_protected_nopar:Npn \cs_gset_eq:cc { \exp_args:Ncc \cs_gset_eq:NN } +\cs_new_protected_nopar:Npn \cs_undefine:N #1 + { \cs_gset_eq:NN #1 \c_undefined:D } +\cs_new_protected_nopar:Npn \cs_undefine:c #1 + { \cs_gset_eq:cN {#1} \c_undefined:D } +\cs_new:Npn \cs_get_arg_count_from_signature:N #1 + { \cs_split_function:NN #1 \cs_get_arg_count_from_signature_aux:nnN } +\cs_new:Npn \cs_get_arg_count_from_signature_aux:nnN #1#2#3 + { + \if_predicate:w #3 + \exp_after:wN \use_i:nn + \else: + \exp_after:wN\use_ii:nn + \fi: + { + \exp_after:wN \cs_get_arg_count_from_signature_auxii:w + \use_none:nnnnnnnnn #2 9876543210 \q_stop + } + { -1 } +} +\cs_new:Npn \cs_get_arg_count_from_signature_auxii:w #1#2 \q_stop {#1} +\cs_new_nopar:Npn \cs_get_arg_count_from_signature:c + { \exp_args:Nc \cs_get_arg_count_from_signature:N } +\cs_new_protected:Npn \cs_generate_from_arg_count:NNnn #1#2#3#4 + { + \if_case:w \int_eval:w #3 \int_eval_end: + \use_i_after_orelse:nw {#2#1} + \or: + \use_i_after_orelse:nw {#2#1 ##1} + \or: + \use_i_after_orelse:nw {#2#1 ##1##2} + \or: + \use_i_after_orelse:nw {#2#1 ##1##2##3} + \or: + \use_i_after_orelse:nw {#2#1 ##1##2##3##4} + \or: + \use_i_after_orelse:nw {#2#1 ##1##2##3##4##5} + \or: + \use_i_after_orelse:nw {#2#1 ##1##2##3##4##5##6} + \or: + \use_i_after_orelse:nw {#2#1 ##1##2##3##4##5##6##7} + \or: + \use_i_after_orelse:nw {#2#1 ##1##2##3##4##5##6##7##8} + \or: + \use_i_after_orelse:nw {#2#1 ##1##2##3##4##5##6##7##8##9} + \else: + \use_i_after_fi:nw + { + \cs_generate_from_arg_count_error_msg:Nn #1 {#3} + \use_none:n + } + \fi: + {#4} + } +\cs_new_nopar:Npn \cs_generate_from_arg_count:cNnn + { \exp_args:Nc \cs_generate_from_arg_count:NNnn } +\cs_new:Npn \cs_generate_from_arg_count_error_msg:Nn #1#2 + { + \msg_kernel_error:nnxx { kernel } { bad-number-of-arguments } + { \token_to_str:N #1 } { \int_eval:n {#2} } + } +\cs_set:Npn \cs_tmp:w #1#2#3 + { + \cs_set_protected:cpx { cs_ #1 : #2 } ##1##2 + { + \exp_not:N \cs_generate_from_arg_count:NNnn ##1 + \exp_after:wN \exp_not:N \cs:w cs_#1 : #3 \cs_end: + { \exp_not:N\cs_get_arg_count_from_signature:N ##1 }{##2} + } + } +\cs_tmp:w { set } { Nn } { Npn } +\cs_tmp:w { set } { Nx } { Npx } +\cs_tmp:w { set_nopar } { Nn } { Npn } +\cs_tmp:w { set_nopar } { Nx } { Npx } +\cs_tmp:w { set_protected } { Nn } { Npn } +\cs_tmp:w { set_protected } { Nx } { Npx } +\cs_tmp:w { set_protected_nopar } { Nn } { Npn } +\cs_tmp:w { set_protected_nopar } { Nx } { Npx } +\cs_tmp:w { gset } { Nn } { Npn } +\cs_tmp:w { gset } { Nx } { Npx } +\cs_tmp:w { gset_nopar } { Nn } { Npn } +\cs_tmp:w { gset_nopar } { Nx } { Npx } +\cs_tmp:w { gset_protected } { Nn } { Npn } +\cs_tmp:w { gset_protected } { Nx } { Npx } +\cs_tmp:w { gset_protected_nopar } { Nn } { Npn } +\cs_tmp:w { gset_protected_nopar } { Nx } { Npx } +\cs_tmp:w { new } { Nn } { Npn } +\cs_tmp:w { new } { Nx } { Npx } +\cs_tmp:w { new_nopar } { Nn } { Npn } +\cs_tmp:w { new_nopar } { Nx } { Npx } +\cs_tmp:w { new_protected } { Nn } { Npn } +\cs_tmp:w { new_protected } { Nx } { Npx } +\cs_tmp:w { new_protected_nopar } { Nn } { Npn } +\cs_tmp:w { new_protected_nopar } { Nx } { Npx } +\cs_set:Npn \cs_tmp:w #1#2#3 + { + \cs_set_protected:cpx {cs_#1:#2}##1##2{ + \exp_not:N\cs_generate_from_arg_count:cNnn {##1} + \exp_after:wN \exp_not:N \cs:w cs_#1:#3 \cs_end: + { \exp_not:N \cs_get_arg_count_from_signature:c {##1} } {##2} + } + } +\cs_tmp:w { set } { cn } { Npn } +\cs_tmp:w { set } { cx } { Npx } +\cs_tmp:w { set_nopar } { cn } { Npn } +\cs_tmp:w { set_nopar } { cx } { Npx } +\cs_tmp:w { set_protected } { cn } { Npn } +\cs_tmp:w { set_protected } { cx } { Npx } +\cs_tmp:w { set_protected_nopar } { cn } { Npn } +\cs_tmp:w { set_protected_nopar } { cx } { Npx } +\cs_tmp:w { gset } { cn } { Npn } +\cs_tmp:w { gset } { cx } { Npx } +\cs_tmp:w { gset_nopar } { cn } { Npn } +\cs_tmp:w { gset_nopar } { cx } { Npx } +\cs_tmp:w { gset_protected } { cn } { Npn } +\cs_tmp:w { gset_protected } { cx } { Npx } +\cs_tmp:w { gset_protected_nopar } { cn } { Npn } +\cs_tmp:w { gset_protected_nopar } { cx } { Npx } +\cs_tmp:w { new } { cn } { Npn } +\cs_tmp:w { new } { cx } { Npx } +\cs_tmp:w { new_nopar } { cn } { Npn } +\cs_tmp:w { new_nopar } { cx } { Npx } +\cs_tmp:w { new_protected } { cn } { Npn } +\cs_tmp:w { new_protected } { cx } { Npx } +\cs_tmp:w { new_protected_nopar } { cn } { Npn } +\cs_tmp:w { new_protected_nopar } { cx } { Npx } +\prg_new_conditional:Npnn \cs_if_eq:NN #1#2 { p , T , F , TF } + { + \if_meaning:w #1#2 + \prg_return_true: \else: \prg_return_false: \fi: + } +\cs_new_nopar:Npn \cs_if_eq_p:cN { \exp_args:Nc \cs_if_eq_p:NN } +\cs_new_nopar:Npn \cs_if_eq:cNTF { \exp_args:Nc \cs_if_eq:NNTF } +\cs_new_nopar:Npn \cs_if_eq:cNT { \exp_args:Nc \cs_if_eq:NNT } +\cs_new_nopar:Npn \cs_if_eq:cNF { \exp_args:Nc \cs_if_eq:NNF } +\cs_new_nopar:Npn \cs_if_eq_p:Nc { \exp_args:NNc \cs_if_eq_p:NN } +\cs_new_nopar:Npn \cs_if_eq:NcTF { \exp_args:NNc \cs_if_eq:NNTF } +\cs_new_nopar:Npn \cs_if_eq:NcT { \exp_args:NNc \cs_if_eq:NNT } +\cs_new_nopar:Npn \cs_if_eq:NcF { \exp_args:NNc \cs_if_eq:NNF } +\cs_new_nopar:Npn \cs_if_eq_p:cc { \exp_args:Ncc \cs_if_eq_p:NN } +\cs_new_nopar:Npn \cs_if_eq:ccTF { \exp_args:Ncc \cs_if_eq:NNTF } +\cs_new_nopar:Npn \cs_if_eq:ccT { \exp_args:Ncc \cs_if_eq:NNT } +\cs_new_nopar:Npn \cs_if_eq:ccF { \exp_args:Ncc \cs_if_eq:NNF } +\cs_new_nopar:Npn \kernel_register_show:N #1 + { + \cs_if_exist:NTF #1 + { \tex_showthe:D #1 } + { + \msg_kernel_error:nnx { kernel } { variable-not-defined } + { \token_to_str:N #1 } + } + } +\cs_new_nopar:Npn \kernel_register_show:c { \exp_args:Nc \int_show:N } +\cs_new_eq:NN \luatex_if_engine:T \use_none:n +\cs_new_eq:NN \luatex_if_engine:F \use:n +\cs_new_eq:NN \luatex_if_engine:TF \use_ii:nn +\cs_new_eq:NN \pdftex_if_engine:T \use:n +\cs_new_eq:NN \pdftex_if_engine:F \use_none:n +\cs_new_eq:NN \pdftex_if_engine:TF \use_i:nn +\cs_new_eq:NN \xetex_if_engine:T \use_none:n +\cs_new_eq:NN \xetex_if_engine:F \use:n +\cs_new_eq:NN \xetex_if_engine:TF \use_ii:nn +\cs_new_eq:NN \c_luatex_is_engine_bool \c_false_bool +\cs_new_eq:NN \c_pdftex_is_engine_bool \c_true_bool +\cs_new_eq:NN \c_xetex_is_engine_bool \c_false_bool +\cs_if_exist:NT \xetex_XeTeXversion:D + { + \cs_set_eq:NN \pdftex_if_engine:T \use_none:n + \cs_set_eq:NN \pdftex_if_engine:F \use:n + \cs_set_eq:NN \pdftex_if_engine:TF \use_ii:nn + \cs_set_eq:NN \xetex_if_engine:T \use:n + \cs_set_eq:NN \xetex_if_engine:F \use_none:n + \cs_set_eq:NN \xetex_if_engine:TF \use_i:nn + \cs_set_eq:NN \c_pdftex_is_engine_bool \c_false_bool + \cs_set_eq:NN \c_xetex_is_engine_bool \c_true_bool + } +\cs_if_exist:NT \luatex_directlua:D + { + \cs_set_eq:NN \luatex_if_engine:T \use:n + \cs_set_eq:NN \luatex_if_engine:F \use_none:n + \cs_set_eq:NN \luatex_if_engine:TF \use_i:nn + \cs_set_eq:NN \pdftex_if_engine:T \use_none:n + \cs_set_eq:NN \pdftex_if_engine:F \use:n + \cs_set_eq:NN \pdftex_if_engine:TF \use_ii:nn + \cs_set_eq:NN \c_luatex_is_engine_bool \c_true_bool + \cs_set_eq:NN \c_pdftex_is_engine_bool \c_false_bool + } +\cs_new_nopar:Npn \prg_do_nothing: { } +\prg_new_conditional:Npnn \str_if_eq:nn #1#2 { p , T , F , TF } + { + \if_int_compare:w \pdftex_strcmp:D { \exp_not:n {#1} } { \exp_not:n {#2} } + = \c_zero + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \str_if_eq:xx #1#2 { p , T , F , TF } + { + \if_int_compare:w \pdftex_strcmp:D {#1} {#2} = \c_zero + \prg_return_true: \else: \prg_return_false: \fi: + } +\cs_new_eq:NN \cs_gnew_nopar:Npn \cs_new_nopar:Npn +\cs_new_eq:NN \cs_gnew:Npn \cs_new:Npn +\cs_new_eq:NN \cs_gnew_protected_nopar:Npn \cs_new_protected_nopar:Npn +\cs_new_eq:NN \cs_gnew_protected:Npn \cs_new_protected:Npn +\cs_new_eq:NN \cs_gnew_nopar:Npx \cs_new_nopar:Npx +\cs_new_eq:NN \cs_gnew:Npx \cs_new:Npx +\cs_new_eq:NN \cs_gnew_protected_nopar:Npx \cs_new_protected_nopar:Npx +\cs_new_eq:NN \cs_gnew_protected:Npx \cs_new_protected:Npx +\cs_new_eq:NN \cs_gnew_nopar:cpn \cs_new_nopar:cpn +\cs_new_eq:NN \cs_gnew:cpn \cs_new:cpn +\cs_new_eq:NN \cs_gnew_protected_nopar:cpn \cs_new_protected_nopar:cpn +\cs_new_eq:NN \cs_gnew_protected:cpn \cs_new_protected:cpn +\cs_new_eq:NN \cs_gnew_nopar:cpx \cs_new_nopar:cpx +\cs_new_eq:NN \cs_gnew:cpx \cs_new:cpx +\cs_new_eq:NN \cs_gnew_protected_nopar:cpx \cs_new_protected_nopar:cpx +\cs_new_eq:NN \cs_gnew_protected:cpx \cs_new_protected:cpx +\cs_new_eq:NN \cs_gnew_eq:NN \cs_new_eq:NN +\cs_new_eq:NN \cs_gnew_eq:cN \cs_new_eq:cN +\cs_new_eq:NN \cs_gnew_eq:Nc \cs_new_eq:Nc +\cs_new_eq:NN \cs_gnew_eq:cc \cs_new_eq:cc +\cs_new_eq:NN \cs_gundefine:N \cs_undefine:N +\cs_new_eq:NN \cs_gundefine:c \cs_undefine:c +\cs_new_eq:NN \group_execute_after:N \group_insert_after:N +%% +%% +%% End of file `l3basics.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty b/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty new file mode 100644 index 00000000000..54b4a0cf7c4 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty @@ -0,0 +1,256 @@ +%% +%% This is file `l3bootstrap.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3bootstrap.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3bootstrap.dtx Copyright (C) 2011 The LaTeX3 project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\def\GetIdInfo$% + Id: #1 #2 #3-#4-#5 #6 #7 $#8% + {% + \def\ExplFileDate{#3/#4/#5}% + \def\ExplFileVersion{#2}% + } +\GetIdInfo$Id: l3bootstrap.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 experimental bootstrap code} +\ProvidesPackage{l3bootstrap} + [% + \ExplFileDate\space v\ExplFileVersion\space + L3 Experimental bootstrap code% + ] +\def\@tempa% + {% + \def\@tempa{}% + \RequirePackage{luatex}% + \RequirePackage{pdftexcmds}% + \let\pdfstrcmp\pdf@strcmp + } +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname directlua\endcsname\relax +\else + \expandafter\@tempa +\fi +\protected\edef\ExplSyntaxOff + {% + \catcode 9 = \the\catcode 9\relax + \catcode 32 = \the\catcode 32\relax + \catcode 34 = \the\catcode 34\relax + \catcode 38 = \the\catcode 38\relax + \catcode 58 = \the\catcode 58\relax + \catcode 94 = \the\catcode 94\relax + \catcode 95 = \the\catcode 95\relax + \catcode 124 = \the\catcode 124\relax + \catcode 126 = \the\catcode 126\relax + \endlinechar = \the\endlinechar\relax + \chardef\csname\detokenize{l_expl_status_bool}\endcsname = 0 \relax + } +\protected\edef\ExplSyntaxOn + { + \catcode 9 = 9 \relax + \catcode 32 = 9 \relax + \catcode 34 = 12 \relax + \catcode 58 = 11 \relax + \catcode 94 = 7 \relax + \catcode 95 = 11 \relax + \catcode 124 = 12 \relax + \catcode 126 = 10 \relax + \endlinechar = 32 \relax + \chardef\csname\detokenize{l_expl_status_bool}\endcsname = 1 \relax + } +\expandafter\chardef\csname\detokenize{l_expl_status_bool}\endcsname = 0 \relax +\protected\def\GetIdInfo + { + \begingroup + \catcode 32 = 10 \relax + \GetIdInfoAuxI + } +\protected\def\GetIdInfoAuxI$#1$#2% + { + \def\tempa{#1}% + \def\tempb{Id}% + \ifx\tempa\tempb + \def\tempa + {% + \endgroup + \def\ExplFileDate{0000/00/00}% + \def\ExplFileDescription{#2}% + \def\ExplFileName{[unknown~name]}% + \def\ExplFileVersion{000}% + }% + \else + \def\tempa + {% + \endgroup + \GetIdInfoAuxII$#1${#2}% + }% + \fi + \tempa + } +\protected\def\GetIdInfoAuxII$#1 #2.#3 #4 #5 #6 #7 #8$#9% + {% + \def\ExplFileName{#2}% + \def\ExplFileVersion{#4}% + \def\ExplFileDescription{#9}% + \GetIdInfoAuxIII#5\relax#3\relax#5\relax#6\relax + } +\protected\def\GetIdInfoAuxIII#1#2#3#4#5#6\relax + {% + \ifx#5/% + \expandafter\GetIdInfoAuxCVS + \else + \expandafter\GetIdInfoAuxSVN + \fi + } +\protected\def\GetIdInfoAuxCVS#1,v\relax#2\relax#3\relax + {\def\ExplFileDate{#2}} +\protected\def\GetIdInfoAuxSVN#1\relax#2-#3-#4\relax#5Z\relax + {\def\ExplFileDate{#2/#3/#4}} +\protected\def\ProvidesExplPackage#1#2#3#4% + {% + \ProvidesPackage{#1}[#2 v#3 #4]% + \ExplSyntaxOn + } +\protected\def\ProvidesExplClass#1#2#3#4% + {% + \ProvidesClass{#1}[#2 v#3 #4]% + \ExplSyntaxOn + } +\protected\def\ProvidesExplFile#1#2#3#4% + {% + \ProvidesFile{#1}[#2 v#3 #4]% + \ExplSyntaxOn + } +\edef\@pushfilename + {% + \edef\expandafter\noexpand + \csname\detokenize{l_expl_status_stack_tl}\endcsname + {% + \noexpand\ifodd\expandafter\noexpand + \csname\detokenize{l_expl_status_bool}\endcsname + 1% + \noexpand\else + 0% + \noexpand\fi + \expandafter\noexpand + \csname\detokenize{l_expl_status_stack_tl}\endcsname + }% + \ExplSyntaxOff + \unexpanded\expandafter{\@pushfilename}% + } +\edef\@popfilename + {% + \unexpanded\expandafter{\@popfilename}% + \noexpand\if a\expandafter\noexpand\csname + \detokenize{l_expl_status_stack_tl}\endcsname a% + \ExplSyntaxOff + \noexpand\else + \noexpand\expandafter + \expandafter\noexpand\csname + \detokenize{expl_status_pop:w}\endcsname + \expandafter\noexpand\csname + \detokenize{l_expl_status_stack_tl}\endcsname + \noexpand\@nil + \noexpand\fi + } +\@namedef{\detokenize{l_expl_status_stack_tl}}{0} +\expandafter\edef\csname\detokenize{expl_status_pop:w}\endcsname#1#2\@nil + {% + \def\expandafter\noexpand + \csname\detokenize{l_expl_status_stack_tl}\endcsname{#2}% + \noexpand\ifodd#1\space + \noexpand\expandafter\noexpand\ExplSyntaxOn + \noexpand\else + \noexpand\expandafter\ExplSyntaxOff + \noexpand\fi + } +\expandafter\protected\expandafter\def + \csname\detokenize{package_check_loaded_expl:}\endcsname + {% + \@ifpackageloaded{expl3} + {} + {% + \PackageError{expl3} + {Cannot load the expl3 modules separately} + {% + The expl3 modules cannot be loaded separately;\MessageBreak + please \string\usepackage\string{expl3\string} instead. + }% + }% + } +\begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname pdfstrcmp\endcsname\relax + \let\pdfstrcmp\strcmp +\fi +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname pdfstrcmp\endcsname\relax + \PackageError{l3names}{Required primitive not found: \protect\pdfstrcmp} + {% + LaTeX3 requires the e-TeX primitives and + \string\pdfstrcmp.\MessageBreak + These are available in engine versions: \MessageBreak + - pdfTeX 1.30 \MessageBreak + - XeTeX 0.9994 \MessageBreak + - LuaTeX 0.60 \MessageBreak + or later. \MessageBreak + \MessageBreak + Loading of expl3 will abort! + } + \expandafter\endinput +\fi +\protected\edef\ExplSyntaxNamesOn + {% + \expandafter\noexpand + \csname\detokenize{char_set_catcode_letter:n}\endcsname{58}% + \expandafter\noexpand + \csname\detokenize{char_set_catcode_letter:n}\endcsname{95}% + } +\protected\edef\ExplSyntaxNamesOff + {% + \expandafter\noexpand + \csname\detokenize{char_set_catcode_math_subscript:n}\endcsname{58}% + \expandafter\noexpand + \csname\detokenize{char_set_catcode_other:n}\endcsname{95}% + } +%% +%% +%% End of file `l3bootstrap.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty new file mode 100644 index 00000000000..68db799fdf3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty @@ -0,0 +1,219 @@ +%% +%% This is file `l3box.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3box.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3box.dtx Copyright (C) 2005-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3box.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental boxes} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\cs_new_protected:Npn \box_new:N #1 + { + \chk_if_free_cs:N #1 + \newbox #1 + } +\cs_generate_variant:Nn \box_new:N { c } +\cs_new_protected_nopar:Npn \box_clear:N #1 + { \box_set_eq:NN #1 \c_empty_box } +\cs_new_protected_nopar:Npn \box_gclear:N #1 + { \box_gset_eq:NN #1 \c_empty_box } +\cs_generate_variant:Nn \box_clear:N { c } +\cs_generate_variant:Nn \box_gclear:N { c } +\cs_new_protected_nopar:Npn \box_clear_new:N #1 + { + \cs_if_exist:NTF #1 + { \box_set_eq:NN #1 \c_empty_box } + { \box_new:N #1 } + } +\cs_new_protected_nopar:Npn \box_gclear_new:N #1 + { + \cs_if_exist:NTF #1 + { \box_gset_eq:NN #1 \c_empty_box } + { \box_new:N #1 } + } +\cs_generate_variant:Nn \box_clear_new:N { c } +\cs_generate_variant:Nn \box_gclear_new:N { c } +\cs_new_protected_nopar:Npn \box_set_eq:NN #1#2 + { \tex_setbox:D #1 \tex_copy:D #2 } +\cs_new_protected_nopar:Npn \box_gset_eq:NN + { \pref_global:D \box_set_eq:NN } +\cs_generate_variant:Nn \box_set_eq:NN { cN , Nc , cc } +\cs_generate_variant:Nn \box_gset_eq:NN { cN , Nc , cc } +\cs_new_protected_nopar:Npn \box_set_eq_clear:NN #1#2 + { \tex_setbox:D #1 \tex_box:D #2 } +\cs_new_protected_nopar:Npn \box_gset_eq_clear:NN + { \pref_global:D \box_set_eq_clear:NN } +\cs_generate_variant:Nn \box_set_eq_clear:NN { cN , Nc , cc } +\cs_generate_variant:Nn \box_gset_eq_clear:NN { cN , Nc , cc } +\cs_new_eq:NN \box_ht:N \tex_ht:D +\cs_new_eq:NN \box_dp:N \tex_dp:D +\cs_new_eq:NN \box_wd:N \tex_wd:D +\cs_generate_variant:Nn \box_ht:N { c } +\cs_generate_variant:Nn \box_dp:N { c } +\cs_generate_variant:Nn \box_wd:N { c } +\cs_new_protected_nopar:Npn \box_set_dp:Nn #1#2 + { \box_dp:N #1 \dim_eval:w #2 \dim_eval_end: } +\cs_new_protected_nopar:Npn \box_set_ht:Nn #1#2 + { \box_ht:N #1 \dim_eval:w #2 \dim_eval_end: } +\cs_new_protected_nopar:Npn \box_set_wd:Nn #1#2 + { \box_wd:N #1 \dim_eval:w #2 \dim_eval_end: } +\cs_generate_variant:Nn \box_set_ht:Nn { c } +\cs_generate_variant:Nn \box_set_dp:Nn { c } +\cs_generate_variant:Nn \box_set_wd:Nn { c } +\cs_new_eq:NN \box_use_clear:N \tex_box:D +\cs_new_eq:NN \box_use:N \tex_copy:D +\cs_generate_variant:Nn \box_use_clear:N { c } +\cs_generate_variant:Nn \box_use:N { c } +\cs_new_protected:Npn \box_move_left:nn #1#2 + { \tex_moveleft:D \dim_eval:w #1 \dim_eval_end: #2 } +\cs_new_protected:Npn \box_move_right:nn #1#2 + { \tex_moveright:D \dim_eval:w #1 \dim_eval_end: #2 } +\cs_new_protected:Npn \box_move_up:nn #1#2 + { \tex_raise:D \dim_eval:w #1 \dim_eval_end: #2 } +\cs_new_protected:Npn \box_move_down:nn #1#2 + { \tex_lower:D \dim_eval:w #1 \dim_eval_end: #2 } +\cs_new_eq:NN \if_hbox:N \tex_ifhbox:D +\cs_new_eq:NN \if_vbox:N \tex_ifvbox:D +\cs_new_eq:NN \if_box_empty:N \tex_ifvoid:D +\prg_new_conditional:Npnn \box_if_horizontal:N #1 { p , T , F , TF } + { \if_hbox:N #1 \prg_return_true: \else: \prg_return_false: \fi: } +\prg_new_conditional:Npnn \box_if_vertical:N #1 { p , T , F , TF } + { \if_vbox:N #1 \prg_return_true: \else: \prg_return_false: \fi: } +\cs_generate_variant:Nn \box_if_horizontal_p:N { c } +\cs_generate_variant:Nn \box_if_horizontal:NT { c } +\cs_generate_variant:Nn \box_if_horizontal:NF { c } +\cs_generate_variant:Nn \box_if_horizontal:NTF { c } +\cs_generate_variant:Nn \box_if_vertical_p:N { c } +\cs_generate_variant:Nn \box_if_vertical:NT { c } +\cs_generate_variant:Nn \box_if_vertical:NF { c } +\cs_generate_variant:Nn \box_if_vertical:NTF { c } +\prg_new_conditional:Npnn \box_if_empty:N #1 { p , T , F , TF } + { \if_box_empty:N #1 \prg_return_true: \else: \prg_return_false: \fi: } +\cs_generate_variant:Nn \box_if_empty_p:N { c } +\cs_generate_variant:Nn \box_if_empty:NT { c } +\cs_generate_variant:Nn \box_if_empty:NF { c } +\cs_generate_variant:Nn \box_if_empty:NTF { c } +\cs_new_eq:NN \l_last_box \tex_lastbox:D +\cs_new_protected_nopar:Npn \box_set_to_last:N #1 + { \tex_setbox:D #1 \l_last_box } +\cs_new_protected_nopar:Npn \box_gset_to_last:N + { \pref_global:D \box_set_to_last:N } +\cs_generate_variant:Nn \box_set_to_last:N { c } +\cs_generate_variant:Nn \box_gset_to_last:N { c } +\cs_new_eq:NN \c_empty_box \voidb@x +\cs_new_eq:NN \l_tmpa_box \@tempboxa +\box_new:N \l_tmpb_box +\cs_new_eq:NN \box_show:N \tex_showbox:D +\cs_generate_variant:Nn \box_show:N { c } +\cs_new_protected_nopar:Npn \hbox:n { \tex_hbox:D \scan_stop: } +\cs_new_protected:Npn \hbox_set:Nn #1#2 { \tex_setbox:D #1 \tex_hbox:D {#2} } +\cs_new_protected_nopar:Npn \hbox_gset:Nn { \pref_global:D \hbox_set:Nn } +\cs_generate_variant:Nn \hbox_set:Nn { c } +\cs_generate_variant:Nn \hbox_gset:Nn { c } +\cs_new_protected:Npn \hbox_set_to_wd:Nnn #1#2#3 + { \tex_setbox:D #1 \tex_hbox:D to \dim_eval:w #2 \dim_eval_end: {#3} } +\cs_new_protected_nopar:Npn \hbox_gset_to_wd:Nnn + { \pref_global:D \hbox_set_to_wd:Nnn } +\cs_generate_variant:Nn \hbox_set_to_wd:Nnn { c } +\cs_generate_variant:Nn \hbox_gset_to_wd:Nnn {cnn} +\cs_new_protected_nopar:Npn \hbox_set_inline_begin:N #1 + { \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token } +\cs_new_protected_nopar:Npn \hbox_gset_inline_begin:N + { \pref_global:D \hbox_set_inline_begin:N } +\cs_generate_variant:Nn \hbox_set_inline_begin:N { c } +\cs_generate_variant:Nn \hbox_gset_inline_begin:N { c } +\cs_new_eq:NN \hbox_set_inline_end: \c_group_end_token +\cs_new_eq:NN \hbox_gset_inline_end: \c_group_end_token +\cs_new_protected:Npn \hbox_to_wd:nn #1#2 + { \tex_hbox:D to \dim_eval:w #1 \dim_eval_end: {#2} } +\cs_new_protected:Npn \hbox_to_zero:n #1 { \tex_hbox:D to \c_zero_skip {#1} } +\cs_new_protected:Npn \hbox_overlap_left:n #1 + { \hbox_to_zero:n { \tex_hss:D #1 } } +\cs_new_protected:Npn \hbox_overlap_right:n #1 + { \hbox_to_zero:n { #1 \tex_hss:D } } +\cs_new_eq:NN \hbox_unpack:N \tex_unhcopy:D +\cs_new_eq:NN \hbox_unpack_clear:N \tex_unhbox:D +\cs_generate_variant:Nn \hbox_unpack:N { c } +\cs_generate_variant:Nn \hbox_unpack_clear:N { c } +\cs_new_protected_nopar:Npn \vbox:n { \tex_vbox:D \scan_stop: } +\cs_new_protected_nopar:Npn \vbox_top:n { \tex_vtop:D \scan_stop: } +\cs_new_protected:Npn \vbox_to_ht:nn #1#2 + { \tex_vbox:D to \dim_eval:w #1 \dim_eval_end: {#2} } +\cs_new_protected:Npn \vbox_to_zero:n #1 { \tex_vbox:D to \c_zero_dim {#1} } +\cs_new_protected:Npn \vbox_set:Nn #1#2 { \tex_setbox:D #1 \tex_vbox:D {#2} } +\cs_new_protected_nopar:Npn \vbox_gset:Nn { \pref_global:D \vbox_set:Nn } +\cs_generate_variant:Nn \vbox_set:Nn { c } +\cs_generate_variant:Nn \vbox_gset:Nn { c } +\cs_new_protected:Npn \vbox_set_top:Nn #1#2 + { \tex_setbox:D #1 \tex_vtop:D {#2} } +\cs_new_protected_nopar:Npn \vbox_gset_top:Nn + { \pref_global:D \vbox_set_top:Nn } +\cs_generate_variant:Nn \vbox_set_top:Nn { c } +\cs_generate_variant:Nn \vbox_gset_top:Nn { c } +\cs_new_protected:Npn \vbox_set_to_ht:Nnn #1#2#3 + { \tex_setbox:D #1 \tex_vbox:D to \dim_eval:w #2 \dim_eval_end: {#3} } +\cs_new_protected_nopar:Npn \vbox_gset_to_ht:Nnn + { \pref_global:D \vbox_set_to_ht:Nnn } +\cs_generate_variant:Nn \vbox_set_to_ht:Nnn { c } +\cs_generate_variant:Nn \vbox_gset_to_ht:Nnn { c } +\cs_new_nopar:Npn \vbox_set_inline_begin:N #1 + { \tex_setbox:D #1 \tex_vbox:D \c_group_begin_token } +\cs_new_protected_nopar:Npn \vbox_gset_inline_begin:N + { \pref_global:D \vbox_set_inline_begin:N } +\cs_generate_variant:Nn \vbox_set_inline_begin:N { c } +\cs_generate_variant:Nn \vbox_gset_inline_begin:N { c } +\cs_new_eq:NN \vbox_set_inline_end: \c_group_end_token +\cs_new_eq:NN \vbox_gset_inline_end: \c_group_end_token +\cs_new_eq:NN \vbox_unpack:N \tex_unvcopy:D +\cs_new_eq:NN \vbox_unpack_clear:N \tex_unvbox:D +\cs_generate_variant:Nn \vbox_unpack:N { c } +\cs_generate_variant:Nn \vbox_unpack_clear:N { c } +\cs_new_protected_nopar:Npn \vbox_set_split_to_ht:NNn #1#2#3 + { \tex_setbox:D #1 \tex_vsplit:D #2 to \dim_eval:w #3 \dim_eval_end: } +%% +%% +%% End of file `l3box.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty new file mode 100644 index 00000000000..ab92e649563 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty @@ -0,0 +1,426 @@ +%% +%% This is file `l3clist.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3clist.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3clist.dtx Copyright (C) 2004-2011 Frank Mittelbach, +%% The LaTeX3 project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3clist.dtx 2498 2011-07-09 17:51:47Z joseph $ + {L3 Experimental comma separated lists} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\tl_new:N \l_clist_tmpa_tl +\tl_new:N \l_clist_tmpb_tl +\cs_new_eq:NN \clist_new:N \tl_new:N +\cs_new_eq:NN \clist_new:c \tl_new:c +\cs_new_eq:NN \clist_clear:N \tl_clear:N +\cs_new_eq:NN \clist_clear:c \tl_clear:c +\cs_new_eq:NN \clist_gclear:N \tl_gclear:N +\cs_new_eq:NN \clist_gclear:c \tl_gclear:c +\cs_new_eq:NN \clist_clear_new:N \tl_clear_new:N +\cs_new_eq:NN \clist_clear_new:c \tl_clear_new:c +\cs_new_eq:NN \clist_gclear_new:N \tl_gclear_new:N +\cs_new_eq:NN \clist_gclear_new:c \tl_gclear_new:c +\cs_new_eq:NN \clist_set_eq:NN \tl_set_eq:NN +\cs_new_eq:NN \clist_set_eq:Nc \tl_set_eq:Nc +\cs_new_eq:NN \clist_set_eq:cN \tl_set_eq:cN +\cs_new_eq:NN \clist_set_eq:cc \tl_set_eq:cc +\cs_new_eq:NN \clist_gset_eq:NN \tl_gset_eq:NN +\cs_new_eq:NN \clist_gset_eq:Nc \tl_gset_eq:Nc +\cs_new_eq:NN \clist_gset_eq:cN \tl_gset_eq:cN +\cs_new_eq:NN \clist_gset_eq:cc \tl_gset_eq:cc +\cs_new_protected_nopar:Npn \clist_concat:NNN + { \clist_concat_aux:NNNN \tl_set:Nx } +\cs_new_protected_nopar:Npn \clist_gconcat:NNN + { \clist_concat_aux:NNNN \tl_gset:Nx } +\cs_new_protected_nopar:Npn \clist_concat_aux:NNNN #1#2#3#4 + { + #1 #2 + { + \clist_if_empty:NTF #3 + { \exp_not:o #4 } + { + \exp_not:o #3 + \clist_if_empty:NF #4 + { + , + \exp_not:o #4 + } + } + } + } +\cs_generate_variant:Nn \clist_concat:NNN { ccc } +\cs_generate_variant:Nn \clist_gconcat:NNN { ccc } +\cs_new_protected_nopar:Npn \clist_put_left:Nn + { \clist_put_aux:NNnnNn \tl_set:Nn \tl_put_left:Nn { } , } +\cs_new_protected_nopar:Npn \clist_gput_left:Nn + { \clist_put_aux:NNnnNn \tl_gset:Nn \tl_gput_left:Nn { } , } +\cs_new_protected:Npn \clist_put_aux:NNnnNn #1#2#3#4#5#6 + { + \clist_if_empty:NTF #5 + { #1 #5 {#6} } + { \tl_if_empty:nF {#6} { #2 #5 { #3 #6 #4 } } } + } +\cs_generate_variant:Nn \clist_put_left:Nn { NV , No , Nx } +\cs_generate_variant:Nn \clist_put_left:Nn { c , cV , co , cx } +\cs_generate_variant:Nn \clist_gput_left:Nn { NV , No , Nx } +\cs_generate_variant:Nn \clist_gput_left:Nn { c , cV , co , cx } +\cs_new_protected:Npn \clist_put_right:Nn + { \clist_put_aux:NNnnNn \tl_set:Nn \tl_put_right:Nn , { } } +\cs_new_protected_nopar:Npn \clist_gput_right:Nn + { \clist_put_aux:NNnnNn \tl_gset:Nn \tl_gput_right:Nn , { } } +\cs_generate_variant:Nn \clist_put_right:Nn { NV , No , Nx } +\cs_generate_variant:Nn \clist_put_right:Nn { c , cV , co , cx } +\cs_generate_variant:Nn \clist_gput_right:Nn { NV , No , Nx } +\cs_generate_variant:Nn \clist_gput_right:Nn { c , cV , co , cx } +\cs_new_protected_nopar:Npn \clist_get:NN #1#2 + { \exp_after:wN \clist_get_aux:wN #1 , \q_stop #2 } +\cs_new_protected:Npn \clist_get_aux:wN #1 , #2 \q_stop #3 + { \tl_set:Nn #3 {#1} } +\cs_generate_variant:Nn \clist_get:NN { c } +\cs_new_protected_nopar:Npn \clist_pop:NN + { \clist_pop_aux:NNN \tl_set:Nn } +\cs_new_protected_nopar:Npn \clist_gpop:NN + { \clist_pop_aux:NNN \tl_gset:Nn } +\cs_new_protected_nopar:Npn \clist_pop_aux:NNN #1#2#3 + { \exp_after:wN \clist_pop_aux:wNNN #2 , \q_nil , \q_nil , \q_stop #1#2#3 } +\cs_new_protected:Npn \clist_pop_aux:wNNN #1 , #2 , \q_nil , #3 \q_stop #4#5#6 + { + \quark_if_nil:nTF {#2} + { #4 #5 { } } + { #4 #5 {#2} } + \tl_set:Nn #6 {#1} + } +\cs_generate_variant:Nn \clist_pop:NN { c } +\cs_generate_variant:Nn \clist_gpop:NN { c } +\cs_new_eq:NN \clist_push:Nn \clist_put_left:Nn +\cs_new_eq:NN \clist_push:NV \clist_put_left:NV +\cs_new_eq:NN \clist_push:No \clist_put_left:No +\cs_new_eq:NN \clist_push:Nx \clist_put_left:Nx +\cs_new_eq:NN \clist_push:cn \clist_put_left:cn +\cs_new_eq:NN \clist_push:cV \clist_put_left:cV +\cs_new_eq:NN \clist_push:co \clist_put_left:co +\cs_new_eq:NN \clist_push:cx \clist_put_left:cx +\cs_new_eq:NN \clist_gpush:Nn \clist_gput_left:Nn +\cs_new_eq:NN \clist_gpush:NV \clist_gput_left:NV +\cs_new_eq:NN \clist_gpush:No \clist_gput_left:No +\cs_new_eq:NN \clist_gpush:Nx \clist_gput_left:Nx +\cs_new_eq:NN \clist_gpush:cn \clist_gput_left:cn +\cs_new_eq:NN \clist_gpush:cV \clist_gput_left:cV +\cs_new_eq:NN \clist_gpush:co \clist_gput_left:co +\cs_new_eq:NN \clist_gpush:cx \clist_gput_left:cx +\cs_new_eq:NN \clist_use:N \tl_use:N +\cs_new_eq:NN \clist_use:c \tl_use:c +\clist_new:N \l_clist_remove_clist +\cs_new_protected:Npn \clist_remove_duplicates:N + { \clist_remove_duplicates_aux:NN \clist_set_eq:NN } +\cs_new_protected:Npn \clist_gremove_duplicates:N + { \clist_remove_duplicates_aux:NN \clist_gset_eq:NN } +\cs_new_protected:Npn \clist_remove_duplicates_aux:NN #1#2 + { + \clist_clear:N \l_clist_remove_clist + \clist_map_inline:Nn #2 + { + \clist_if_in:NnF \l_clist_remove_clist {##1} + { \clist_put_right:Nn \l_clist_remove_clist {##1} } + } + #1 #2 \l_clist_remove_clist + } +\cs_generate_variant:Nn \clist_remove_duplicates:N { c } +\cs_generate_variant:Nn \clist_gremove_duplicates:N { c } +\cs_new_protected:Npn \clist_remove_all:Nn + { \clist_remove_all_aux:NNn \clist_set_eq:NN } +\cs_new_protected:Npn \clist_gremove_all:Nn + { \clist_remove_all_aux:NNn \clist_gset_eq:NN } +\cs_new_protected:Npn \clist_remove_all_aux:NNn #1#2#3 + { + \clist_if_empty:NF #2 + { + \clist_clear:N \l_clist_remove_clist + \cs_set_protected:Npn \clist_remove_all_aux:w + ##1 , #3 , ##2 \q_stop + { + \tl_put_right:Nn \l_clist_remove_clist {##1} + \quark_if_no_value:nF {##2} + { \clist_remove_all_aux:w , ##2 \q_stop } + } + \exp_after:wN \clist_remove_all_aux:w + \exp_after:wN , #2 , #3 , \q_no_value \q_stop + \tl_if_empty:NF \l_clist_remove_clist + { + \exp_after:wN \tl_set:No \exp_after:wN + \l_clist_remove_clist \exp_after:wN + { \exp_after:wN \use_none:n \l_clist_remove_clist } + } + #1 #2 \l_clist_remove_clist + } + } +\cs_new_protected:Npn \clist_remove_all_aux:w { } +\cs_generate_variant:Nn \clist_remove_all:Nn { c } +\cs_generate_variant:Nn \clist_gremove_all:Nn { c } +\cs_new:Npn \clist_trim_spaces:n #1 + { + \exp_args:Nf \clist_trim_spaces_aux_i:n + { \clist_map_function:nN {#1} \clist_trim_spaces_aux_ii:n } + } +\cs_new:Npn \clist_trim_spaces_aux_i:n #1 { \use_ii:nn #1 } +\cs_new:Npn \clist_trim_spaces_aux_ii:n #1 + { , \tl_trim_spaces:n {#1} } +\cs_new_protected:Npn \clist_trim_spaces:N #1 + { \tl_set:Nf #1 { \exp_args:No \clist_trim_spaces:n #1 } } +\cs_new_protected:Npn \clist_gtrim_spaces:N #1 + { \tl_gset:Nf #1 { \exp_args:No \clist_trim_spaces:n #1 } } +\cs_generate_variant:Nn \clist_trim_spaces:N { c } +\cs_generate_variant:Nn \clist_gtrim_spaces:N { c } +\cs_new_protected:Npn \clist_tmp:w { } +\prg_new_eq_conditional:NNn \clist_if_empty:N \tl_if_empty:N { p , T , F , TF } +\prg_new_eq_conditional:NNn \clist_if_empty:c \tl_if_empty:c { p , T , F , TF } +\prg_new_eq_conditional:NNn \clist_if_eq:NN \tl_if_eq:NN { p , T , F , TF } +\prg_new_eq_conditional:NNn \clist_if_eq:Nc \tl_if_eq:Nc { p , T , F , TF } +\prg_new_eq_conditional:NNn \clist_if_eq:cN \tl_if_eq:cN { p , T , F , TF } +\prg_new_eq_conditional:NNn \clist_if_eq:cc \tl_if_eq:cc { p , T , F , TF } +\prg_new_protected_conditional:Npnn \clist_if_in:Nn #1#2 + { T , F , TF } + { + \cs_set_protected:Npn \clist_tmp:w ##1 , #2 , ##2##3 \q_stop + { + \if_meaning:w \q_no_value ##2 + \prg_return_false: + \else: + \prg_return_true: + \fi: + } + \exp_last_unbraced:NNo \clist_tmp:w , #1 , #2 , \q_no_value \q_stop + } +\prg_new_protected_conditional:Npnn \clist_if_in:nn #1#2 + { T , F , TF } + { + \cs_set_protected:Npn \clist_tmp:w ##1 , #2 , ##2##3 \q_stop + { + \if_meaning:w \q_no_value ##2 + \prg_return_false: + \else: + \prg_return_true: + \fi: + } + \clist_tmp:w , #1 , #2 , \q_no_value \q_stop + } +\cs_generate_variant:Nn \clist_if_in:NnT { NV , No } +\cs_generate_variant:Nn \clist_if_in:NnT { c , cV , co } +\cs_generate_variant:Nn \clist_if_in:NnF { NV , No } +\cs_generate_variant:Nn \clist_if_in:NnF { c , cV , co } +\cs_generate_variant:Nn \clist_if_in:NnTF { NV , No } +\cs_generate_variant:Nn \clist_if_in:NnTF { c , cV , co } +\cs_generate_variant:Nn \clist_if_in:nnT { nV , no } +\cs_generate_variant:Nn \clist_if_in:nnF { nV , no } +\cs_generate_variant:Nn \clist_if_in:nnTF { nV , no } +\cs_new_nopar:Npn \clist_map_function:NN #1#2 + { + \clist_if_empty:NF #1 + { + \exp_last_unbraced:NNo \clist_map_function_aux:Nw #2 #1 + , \q_recursion_tail , \q_recursion_stop + } + } +\cs_new:Npn \clist_map_function:nN #1#2 + { + \tl_if_empty:nF {#1} + { + \clist_map_function_aux:Nw #2 #1 + , \q_recursion_tail , \q_recursion_stop + } + } +\cs_new:Npn \clist_map_function_aux:Nw #1#2 , + { + \quark_if_recursion_tail_stop:n {#2} + #1 {#2} + \clist_map_function_aux:Nw #1 + } +\cs_generate_variant:Nn \clist_map_function:NN { c } +\int_new:N \g_clist_map_inline_int +\cs_new_protected:Npn \clist_map_inline:Nn #1#2 + { + \int_gincr:N \g_clist_map_inline_int + \cs_gset:cpn { clist_map_inline_ \int_use:N \g_clist_map_inline_int :n } + ##1 + {#2} + \exp_args:NNc \clist_map_function:NN #1 + { clist_map_inline_ \int_use:N \g_clist_map_inline_int :n } + \int_gdecr:N \g_clist_map_inline_int + } +\cs_new_protected:Npn \clist_map_inline:nn #1#2 + { + \int_gincr:N \g_clist_map_inline_int + \cs_gset:cpn { clist_map_inline_ \int_use:N \g_clist_map_inline_int :n } + ##1 + {#2} + \exp_args:Nnc \clist_map_function:nN {#1} + { clist_map_inline_ \int_use:N \g_clist_map_inline_int :n } + \int_gdecr:N \g_clist_map_inline_int + } +\cs_generate_variant:Nn \clist_map_inline:Nn { c } +\cs_new_protected:Npn \clist_map_variable:NNn #1#2#3 + { + \clist_map_inline:Nn #1 + { + \tl_set:Nn #2 {##1} + #3 + } + } +\cs_new_protected:Npn \clist_map_variable:nNn #1#2#3 + { + \clist_map_inline:nn {#1} + { + \tl_set:Nn #2 {##1} + #3 + } + } +\cs_generate_variant:Nn \clist_map_variable:NNn { c } +\cs_new_eq:NN \clist_map_break: \use_none_delimit_by_q_recursion_stop:w +\cs_new_eq:NN \clist_map_break:n \use_i_delimit_by_q_recursion_stop:nw +\cs_new_protected_nopar:Npn \clist_show:N #1 + { + \clist_if_empty:NTF #1 + { + \iow_term:x { Comma~list~\token_to_str:N #1 \c_space_tl is~empty } + \tl_show:n { } + } + { + \iow_term:x + { + Comma~list~\token_to_str:N #1 \c_space_tl + contains~the~items~(without~outer~braces): + } + \tl_set:Nx \l_clist_show_tl + { \clist_map_function:NN #1 \clist_show_aux:n } + \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN + { \exp_after:wN \clist_show_aux:w \l_clist_show_tl } + } + } +\cs_new:Npn \clist_show_aux:n #1 + { + \iow_newline: > \c_space_tl \c_space_tl + \iow_char:N \{ \exp_not:n {#1} \iow_char:N \} + } +\cs_new:Npn \clist_show_aux:w #1 > ~ { } +\cs_generate_variant:Nn \clist_show:N { c } +\cs_new:Npn \clist_length:N #1 + { + \int_eval:n + { + 0 + \clist_map_function:NN #1 \clist_length_aux:n + } + } +\cs_new:Npn \clist_length:n #1 + { + \int_eval:n + { + 0 + \clist_map_function:nN {#1} \clist_length_aux:n + } + } +\cs_new:Npn \clist_length_aux:n #1 { +1 } +\cs_generate_variant:Nn \clist_length:N { c } +\cs_set_nopar:Npn \clist_item:Nn #1#2 + { \exp_args:No \clist_item:nn #1 {#2} } +\cs_set:Npn \clist_item:nn #1#2 + { + \int_compare:nNnTF {#2} < \c_zero + { + \exp_args:Nf \clist_item_aux:nw + { \int_eval:n { \clist_length:n {#1} + #2 } } + #1 , \q_recursion_tail \q_recursion_stop + } + { \clist_item_aux:nw {#2} #1 , \q_recursion_tail \q_recursion_stop } + } +\cs_set:Npn \clist_item_aux:nw #1#2 , #3 + { + \int_compare:nNnTF {#1} = \c_zero + { \use_i_delimit_by_q_recursion_stop:nw {#2} } + { + \quark_if_recursion_tail_stop:n {#3} + \exp_args:Nf \clist_item_aux:nw + { \int_eval:n { #1 - 1 } } + #3 + } + } +\cs_generate_variant:Nn \clist_item:Nn { c } +\cs_new_protected:Npn \clist_set_from_seq:NN #1#2 + { + \seq_if_empty:NTF #2 + { \clist_clear:N #1 } + { + \seq_push_item_def:n { , \exp_not:n {{##1}} } + \tl_set:Nx #1 + { \exp_after:wN \use_none:n \tex_romannumeral:D -`\0 #2 } + \seq_pop_item_def: + } + } +\cs_new_protected:Npn \clist_gset_from_seq:NN #1#2 + { + \seq_if_empty:NTF #2 + { \clist_gclear:N #1 } + { + \seq_push_item_def:n { , \exp_not:n {##1} } + \tl_gset:Nx #1 + { \exp_after:wN \use_none:n \tex_romannumeral:D -`\0 #2 } + \seq_pop_item_def: + } + } +\cs_generate_variant:Nn \clist_set_from_seq:NN { Nc } +\cs_generate_variant:Nn \clist_set_from_seq:NN { c , cc } +\cs_generate_variant:Nn \clist_gset_from_seq:NN { Nc } +\cs_generate_variant:Nn \clist_gset_from_seq:NN { c , cc } +\cs_new_eq:NN \clist_top:NN \clist_get:NN +\cs_new_eq:NN \clist_top:cN \clist_get:cN +\cs_new_eq:NN \clist_remove_element:Nn \clist_remove_all:Nn +\cs_new_eq:NN \clist_gremove_element:Nn \clist_gremove_all:Nn +\cs_new_eq:NN \clist_display:N \clist_show:N +\cs_new_eq:NN \clist_display:c \clist_show:c +%% +%% +%% End of file `l3clist.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls new file mode 100644 index 00000000000..258a8475eb9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls @@ -0,0 +1,1001 @@ +%% +%% This is file `l3doc.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3doc.dtx (with options: `class') +%% +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% +%% File: l3doc.dtx Copyright (C) 1990-2011 The LaTeX3 project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\let \filenameOld \ExplFileName +\let \filedateOld \ExplFileDate +\let \fileversionOld \ExplFileVersion +\let \filedescriptionOld \ExplFileDescription +\GetIdInfo$Id: l3doc.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental documentation class} +\ProvidesExplClass + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\RequirePackage{expl3,xparse} +\let \ExplFileName \filenameOld +\let \ExplFileDate \filedateOld +\let \ExplFileVersion \fileversionOld +\let \ExplFileDescription \filedescriptionOld +\cs_new_nopar:Npn\Team{% + The~\LaTeX3~Project\thanks{% + Frank~Mittelbach,~Denys~Duchier,~Chris~Rowley,~ + Rainer~Sch\"opf,~Johannes~Braams,~Michael~Downes,~ + David~Carlisle,~Alan~Jeffrey,~Morten~H\o{}gholm,~Thomas~Lotze,~ + Javier~Bezos,~Will~Robertson,~Joseph~Wright}} +\DeclareOption{a5paper}{\@latexerr{Option not supported}{}} +\bool_new:N \g_doc_full_bool +\bool_new:N \g_doc_lmodern_bool +\bool_new:N \g_doc_checkfunc_bool +\bool_new:N \g_doc_checktest_bool +\DeclareOption{full}{ \bool_set_true:N \g_doc_full_bool } +\DeclareOption{onlydoc}{ \bool_set_false:N \g_doc_full_bool } +\DeclareOption{check}{ \bool_set_true:N \g_doc_checkfunc_bool } +\DeclareOption{nocheck}{ \bool_set_false:N \g_doc_checkfunc_bool } +\DeclareOption{checktest}{ \bool_set_true:N \g_doc_checktest_bool } +\DeclareOption{nochecktest}{ \bool_set_false:N \g_doc_checktest_bool } +\DeclareOption{cm-default}{ \bool_set_false:N \g_doc_lmodern_bool } +\DeclareOption{lm-default}{ \bool_set_true:N \g_doc_lmodern_bool } +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} +\ExecuteOptions{full,a4paper,nocheck,nochecktest,lm-default} +\InputIfFileExists{l3doc.cfg} + { + \typeout{*************************************^^J + *~Local~config~file~l3doc.cfg~used ^^J + *************************************} + } + { \@input{l3doc.ltx} } +\ProcessOptions +\LoadClass{article} +\RequirePackage{doc} +\RequirePackage{array,alphalph,booktabs,color,fixltx2e,enumitem,textcomp,trace,underscore,csquotes} +\bool_if:NT \g_doc_lmodern_bool { + \RequirePackage[T1]{fontenc} + \RequirePackage{lmodern} +} +\RequirePackage{hypdoc} +\let\doc@verbatim\verbatim +\let\enddoc@verbatim\endverbatim +\let\doc@@verbatim\@verbatim +\expandafter\let\csname doc@verbatim*\expandafter\endcsname + \csname verbatim*\endcsname +\expandafter\let\csname enddoc@verbatim*\expandafter\endcsname + \csname endverbatim*\endcsname +\expandafter\let\csname doc@@verbatim*\expandafter\endcsname + \csname @verbatim*\endcsname +\RequirePackage{verbatim} +\AtBeginDocument{% + \let\verbatim\doc@verbatim + \let\endverbatim\enddoc@verbatim + \let\@verbatim\doc@@verbatim + \expandafter\let\csname verbatim*\expandafter\endcsname + \csname doc@verbatim*\endcsname + \expandafter\let\csname endverbatim*\expandafter\endcsname + \csname enddoc@verbatim*\endcsname + \expandafter\let\csname @verbatim*\expandafter\endcsname + \csname doc@@verbatim*\endcsname +} +\cs_set_nopar:Npn \MakePrivateLetters { + \char_set_catcode_letter:N \@ + \char_set_catcode_letter:N \_ + \char_set_catcode_letter:N \: +} +\setcounter{StandardModuleDepth}{1} +\@addtoreset{CodelineNo}{part} +\cs_set_nopar:Npn \theCodelineNo { + \textcolor[gray]{0.5}{ \sffamily\tiny\arabic{CodelineNo} } +} +\setlength \textwidth { 385pt } +\addtolength \marginparwidth { 30pt } +\addtolength \oddsidemargin { 20pt } +\addtolength \evensidemargin { 20pt } +\cs_set_eq:NN \@@oldlist\list +\cs_set_nopar:Npn \list#1#2{\@@oldlist{#1}{#2\listparindent\z@}} +\setlength \parindent { 0pt } +\setlength \itemindent { 0pt } +\setlength \parskip { \medskipamount } +\AtBeginDocument { + \MakeShortVerb \" + \MakeShortVerb \| +} +\providecommand*\eTeX{ + \if b\expandafter\@car\f@series\@nil\boldmath\fi + $\m@th\varepsilon$-\TeX +} +\providecommand*\IniTeX{Ini\TeX} +\providecommand*\Lua{Lua} +\providecommand*\LuaTeX{\Lua\TeX} +\providecommand*\pdfTeX{pdf\TeX} +\RequirePackage{graphicx} +\cs_if_free:NT \XeTeX { + \cs_new_protected_nopar:Npn \XeTeX + {X\kern-.125em\lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\TeX} +} +\cs_set_nopar:Npn \cmd #1 { \cs{\expandafter\cmd@to@cs\string#1} } +\cs_set_nopar:Npn \cmd@to@cs #1#2 { \char\number`#2\relax } +\DeclareRobustCommand \cs [1] { \texttt { \char`\\ #1 } } +\providecommand\marg[1]{ \texttt{\char`\{} \meta{#1} \texttt{\char`\}} } +\providecommand\oarg[1]{ \texttt[ \meta{#1} \texttt] } +\providecommand\parg[1]{ \texttt( \meta{#1} \texttt) } +\cs_set_eq:NN \m \meta +\cs_set_eq:NN \file \nolinkurl +\DeclareRobustCommand \env {\texttt} +\DeclareRobustCommand \pkg {\textsf} +\DeclareRobustCommand \cls {\textsf} +\newenvironment{texnote}{ + \endgraf + \vspace{3mm} + \small\textbf{\TeX~hackers~note:} +}{ + \vspace{3mm} +} +\newcommand\tn[1]{ + \texttt{\bslash #1} + \index{TeX~and~LaTeX2e~commands\actualchar + \string\TeX{}~and~\string\LaTeXe{}~commands:\levelchar + #1\actualchar{\string\ttfamily\string\bslash{}#1}}} +\cs_new:Npn \doc_implementation: { + \cs_set:Npn \variable {\macro[var]} +} +\cs_new:Npn \doc_docu: { + \cs_set_eq:NN \variable \variabledoc +} +\AtEndOfPackage{\doc_docu:} +\newenvironment{documentation}{\doc_docu:}{} +\newenvironment{implementation}{\doc_implementation:}{} +\newcommand\EnableDocumentation{% + \renewenvironment{documentation}{\doc_docu:}{}% +} +\newcommand\EnableImplementation{% + \renewenvironment{implementation}{\doc_implementation:}{}% +} +\newcommand\DisableDocumentation{% + \cs_set_eq:NN \documentation \comment + \cs_set_eq:NN \enddocumentation \endcomment +} +\newcommand\DisableImplementation{% + \cs_set_eq:NN \implementation \comment + \cs_set_eq:NN \endimplementation \endcomment +} +\newenvironment{arguments}{ + \enumerate[ + nolistsep, + label=\texttt{\#\arabic*}~:, + labelsep=*, + ] +}{ + \endenumerate +} +\char_set_catcode_active:N \< +\DeclareDocumentCommand \function { O{} } { + + \phantomsection + + \bool_gset_false:N \l_doc_meta_TF_bool + \bool_gset_false:N \l_doc_meta_pTF_bool + \bool_gset_false:N \l_doc_meta_EXP_bool + + \cs_set_nopar:Npn \KV_key_no_value_elt:n ##1 { \use:c {doc_meta_opt_##1:} } + \keyval_parse:NNn \KV_key_no_value_elt:n \use_none:nn {#1} + + \char_set_catcode_active:N \< + \cs_set_eq:NN < \doc_open_meta:n + + \group_begin: + \MakePrivateLetters + \char_set_catcode_other:N \| + \char_set_catcode_other:N \\ + \char_set_catcode_space:N \~ + \char_set_catcode_ignore:N \ % space + \char_set_catcode_ignore:N \^^M + \char_set_catcode_ignore:N \^^I + \function_aux:n +} +\char_set_catcode_other:N \< +\cs_set_eq:NN \variabledoc \function +\cs_set:Nn \doc_meta_opt_TF: { + \bool_gset_true:N \l_doc_meta_TF_bool +} +\cs_set:Nn \doc_meta_opt_EXP: { + \bool_gset_true:N \l_doc_meta_EXP_bool +} +\cs_set:Nn \doc_meta_opt_pTF: { + \bool_gset_true:N \l_doc_meta_pTF_bool + \bool_gset_true:N \l_doc_meta_TF_bool + \bool_gset_true:N \l_doc_meta_EXP_bool +} +\group_begin: +\char_set_catcode_other:N \| +\cs_gset_nopar:Npn \function_aux:n #1 { + \cs_set_nopar:Npn \nextnewline{\cs_gset_nopar:Npn\nextnewline{\\}} + \tl_gset_eq:NN \g_doc_macro_tl \c_empty_tl + \bigskip\endgraf\noindent\ttfamily + \tabular[b]{ | l @{} c | } + \hline + \clist_map_inline:nn {#1} {\doc_showmacro:w ##1 | \q_stop} \\ + \hline + \endtabular + \group_end: +} +\group_end: +\group_begin: +\char_set_catcode_other:N \| +\cs_gset_nopar:Npn \doc_showmacro:w #1 | { + \tl_if_blank:nTF {#1} { + \use_none:n + }{ + \doc_showmacro_aux:w #1 / \q_stop + \peek_meaning:NTF \q_stop { \use_none:n } { \doc_showmacro:w } + } +} +\group_end: +\bool_new:N \l_doc_meta_TF_bool +\bool_new:N \l_doc_meta_pTF_bool +\bool_new:N \l_doc_meta_EXP_bool +\cs_new_nopar:Npn \doc_showmacro_aux:w #1 / #2 \q_stop { + + \tl_if_in:nnT {#2} { (TF) } { + \bool_gset_true:N \l_doc_meta_TF_bool + } + + \tl_if_in:nnT {#2} { (EXP) } { + \bool_gset_true:N \l_doc_meta_EXP_bool + } + + \tl_if_in:nnT {#2} { (pTF) } { + \bool_gset_true:N \l_doc_meta_TF_bool + \bool_gset_true:N \l_doc_meta_pTF_bool + \bool_gset_true:N \l_doc_meta_EXP_bool + } + + \bool_if:NT \l_doc_meta_pTF_bool { + \tl_set:Nx \l_doc_pTF_name_tl { \doc_predicate_from_base:w #1 \q_nil } + \doc_special_main_index:o { \l_doc_pTF_name_tl } + \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:N \l_doc_pTF_name_tl } + } + + \bool_if:NTF \l_doc_meta_TF_bool { + \doc_special_main_index:o { #1 TF } + \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n { #1 TF } } + \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n { #1 T } } + \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n { #1 F } } + }{ + \doc_special_main_index:o { #1 } + \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n { #1 } } + } + + \bool_if:NTF \l_doc_meta_pTF_bool { + \bool_gset_false:N \l_doc_meta_TF_bool + \exp_after:wN \doc_showmacro_aux_ii:w \l_doc_pTF_name_tl ::\q_stop + \bool_gset_true:N \l_doc_meta_TF_bool + \doc_showmacro_aux_ii:w #1::\q_stop + }{ + \doc_showmacro_aux_ii:w #1::\q_stop + } +} +\cs_set_nopar:Npn \doc_showmacro_aux_ii:w #1:#2:#3 \q_stop { + \nextnewline + \str_if_eq:xxTF {#1} {\g_doc_macro_tl} { + \doc_typeset_aux:n + }{ + \tl_gset:Nn \g_doc_macro_tl {#1} + \use:n + } + { \g_doc_macro_tl } + #3 + #2 + \bool_if:NT \l_doc_meta_TF_bool { \doc_typeset_TF: } + & + \bool_if:NT \l_doc_meta_EXP_bool { + \hspace{\tabcolsep} + $\star$ + } + \tl_set:Nx \g_doc_macro_tl { \tl_to_str:N \g_doc_macro_tl } + \exp_args:NNf \tl_replace_all_in:Nnn \g_doc_macro_tl {\token_to_str:N _} {/} + \exp_args:NNf \tl_replace_all_in:Nnn \g_doc_macro_tl {\@backslashchar} {} + \bool_if:NT \g_doc_full_bool { + \exp_args:Nf\label{doc/function/\g_doc_macro_tl#3#2} + } +} +\dim_new:N \g_doc_syntax_dim +\dim_set:Nn \g_doc_syntax_dim {0.7\textwidth} +\newenvironment{syntax}{ + \minipage[b]{\g_doc_syntax_dim} + \cs_set_nopar:Npn \meta@font@select{\rmfamily\itshape} % (Will: I HATE italic cmtt!) + \small\ttfamily\raggedright + \obeyspaces\obeylines +}{ + \endminipage + \hfil\break + \global\@ignoretrue +} +\tl_map_inline:nn {0123456789} { \cs_gset_eq:cN {char_other_#1} #1 } +\group_begin: + \tl_map_inline:nn {0123456789} { \char_set_catcode_active:N #1 } + \cs_new:Npn \doc_open_meta:n { + \group_begin: + \tl_map_function:nN {0123456789} \doc_assign_num:n + \doc_close_meta:w + } + \cs_new:Npn \Arg { + \texttt{ \char`\{ } + \group_begin: + \tl_map_function:nN {0123456789} \doc_assign_num:n + \doc_close_Arg:n + } +\group_end: +\cs_new_nopar:Npn \doc_close_meta:w #1> { \meta {#1} \group_end: } +\cs_new_nopar:Npn \doc_close_Arg:n #1 { + \meta {#1} + \group_end: + \texttt{ \char`\} } +} +\cs_new_nopar:Npn \doc_assign_num:n #1 { + \cs_set_eq:cc { \string #1 } { char_other_\string #1 } + \char_set_catcode_active:N #1 + \cs_set_nopar:Npn #1 { \unskip \, $ {} \sb { \use:c { char_other_\string #1 } } $ } +} +\renewcommand \macro [1][] { + + \int_compare:nNnTF \currentgrouplevel=2 + { \int_gzero:N \g_doc_nested_macro_int } + { \int_incr:N \g_doc_nested_macro_int } + + \bool_set_false:N \l_doc_macro_aux_bool + \bool_set_false:N \l_doc_macro_internal_bool + \bool_set_false:N \l_doc_macro_TF_bool + \bool_set_false:N \l_doc_macro_pTF_bool + \bool_set_false:N \l_doc_macro_var_bool + \bool_set_false:N \l_doc_tested_bool + + \cs_set_eq:NN \doc_macroname_prefix:n \use:n + \cs_set_eq:NN \doc_macroname_suffix: \c_empty_tl + + \cs_set_nopar:Npn \KV_key_no_value_elt:n ##1 { \use:c {doc_macro_opt_##1:} } + \keyval_parse:NNn \KV_key_no_value_elt:n \use_none:nn {#1} + + \cs_set_eq:NN \testfile \doc_print_testfile:n + + \group_begin: + \MakePrivateLetters + \char_set_catcode_letter:N \\ + \char_set_catcode_ignore:N \ % space + \char_set_catcode_ignore:N \^^M + \char_set_catcode_ignore:N \^^I + \doc_macro_aux:n +} +\cs_new_nopar:Npn \doc_macro_aux:n #1 { + \group_end: + \cs_set:Npn \l_doc_macro_input_clist {#1} + \bool_if:NTF \l_doc_macro_pTF_bool + { + \clist_map_inline:nn {#1} + { + \tl_if_blank:nF {##1} + { + \exp_args:Nf \doc_macro_single + { \doc_predicate_from_base:w ##1 \q_nil } + } + } + \bool_set_true:N \l_doc_macro_TF_bool + \clist_map_inline:nn {#1} + { \tl_if_blank:nF {##1} { \doc_macro_single {##1} } } + \bool_set_false:N \l_doc_macro_TF_bool + } + { + \clist_map_inline:nn {#1} + { \tl_if_blank:nF {##1} { \doc_macro_single {##1} } } + } +} +\bool_new:N \l_doc_macro_internal_bool +\bool_new:N \l_doc_macro_aux_bool +\bool_new:N \l_doc_macro_TF_bool +\bool_new:N \l_doc_macro_pTF_bool +\bool_new:N \l_doc_macro_var_bool +\cs_set_nopar:Npn \doc_macro_opt_aux: { \bool_set_true:N \l_doc_macro_aux_bool } +\cs_set_nopar:Npn \doc_macro_opt_internal: { \bool_set_true:N \l_doc_macro_internal_bool } +\cs_set_nopar:Npn \doc_macro_opt_TF: { \bool_set_true:N \l_doc_macro_TF_bool } +\cs_set_nopar:Npn \doc_macro_opt_pTF: { \bool_set_true:N \l_doc_macro_pTF_bool } +\cs_set_nopar:Npn \doc_macro_opt_var: { \bool_set_true:N \l_doc_macro_var_bool } +\cs_set:Npn \doc_predicate_from_base:w #1:#2 \q_nil {#1_p:#2} +\int_new:N \l_doc_macro_int +\cs_set_nopar:Npn \doc_macro_single #1 { + \int_incr:N \l_doc_macro_int + \tl_set:Nx \saved@macroname { \token_to_str:N #1 } + \topsep\MacroTopsep + \trivlist + \cs_set_nopar:Npn \makelabel ##1 { \llap{##1} } + \if@inlabel + \cs_set_eq:NN \@tempa \@empty + \count@ \macro@cnt + \loop \ifnum\count@>\z@ + \cs_set_nopar:Npx \@tempa{\@tempa\hbox{\strut}} + \advance\count@\m@ne + \repeat + \cs_set_nopar:Npx \makelabel ##1 { + \llap{\vtop to\baselineskip {\@tempa\hbox{##1}\vss}} + } + \advance \macro@cnt \@ne + \else + \macro@cnt \@ne + \fi + + \bool_if:NT \l_doc_macro_aux_bool { + \cs_set_eq:NN \doc_macroname_prefix:n \doc_typeset_aux:n + } + \bool_if:NT \l_doc_macro_TF_bool { + \cs_set_eq:NN \doc_macroname_suffix: \doc_typeset_TF: + } + + \bool_if:NF \l_doc_macro_aux_bool { + \tl_gset:Nx \l_doc_macro_tl { \tl_to_str:n {#1} } + \exp_args:NNf \tl_greplace_all_in:Nnn \l_doc_macro_tl {\token_to_str:N _} {/} + \exp_args:NNf \tl_greplace_all_in:Nnn \l_doc_macro_tl {\@backslashchar} {} + } + + \use:x { + \exp_not:N \item [ \exp_not:N \doc_print_macroname:n { + \tl_to_str:n {#1} + }] + } + \global\advance \c@CodelineNo \@ne + + \bool_if:NF \l_doc_macro_aux_bool { + \bool_if:NTF \l_doc_macro_TF_bool { + \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:n { #1 TF } } + \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:n { #1 T } } + \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:n { #1 F } } + }{ + \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:n {#1} } + } + } + \bool_if:NTF \l_doc_macro_TF_bool { + \SpecialMainIndex{#1 TF}\nobreak + \DoNotIndex{#1 TF} + }{ + \SpecialMainIndex{#1}\nobreak + \DoNotIndex{#1} + } + + \global\advance \c@CodelineNo \m@ne + \ignorespaces +} +\tl_clear:N \l_doc_macro_tl +\cs_set_nopar:Npn \doc_print_macroname:n #1 { + \strut + \int_compare:nTF { \tl_elt_count:n {#1} <= 28 } + { \MacroFont } { \MacroLongFont } + + % INEFFICIENT: (!) + \exp_args:NNx \seq_if_in:NnTF \g_doc_functions_seq + { #1 \bool_if:NT \l_doc_macro_TF_bool { \tl_to_str:n {TF} } } + { + \hyperref [doc/function/\l_doc_macro_tl] + } + { \use:n } + { + \doc_macroname_prefix:n {#1} \doc_macroname_suffix: \ % space! + } +} +\providecommand \MacroLongFont { + \fontfamily{lmtt}\fontseries{lc}\small +} +\cs_set_nopar:Npn \doc_typeset_TF: { + \itshape TF% + \makebox[0pt][r]{% + \color[gray]{0.5} + \underline { \phantom{\itshape TF} \kern-0.1em } + } +} +\cs_set_nopar:Npn \doc_typeset_aux:n #1 { + {\color[gray]{0.5} #1} +} +\DeclareDocumentCommand \doc_print_testfile:n {m} { + \bool_set_true:N \l_doc_tested_bool + \tl_if_eq:nnF {#1} {*} { + \seq_if_in:NnF \g_doc_testfiles_seq {#1} + { + \par{\footnotesize(\textit{ + The~ test~ suite~ for~ this~ command,~ and~ others~ in~ this~ file,~ is~ \textsf{#1}}. + )\par} + \seq_gput_right:Nn \g_doc_testfiles_seq {#1} + } + } +} +\seq_new:N \g_doc_testfiles_seq +\DeclareDocumentCommand \TestFiles {m} { + \par + {\itshape + The~ following~ test~ files~ are~ used~ for~ this~ code:~ \textsf{#1}. + } + \par\ignorespaces +} +\DeclareDocumentCommand \UnitTested {} { + \testfile* +} +\cs_generate_variant:Nn \prop_gput:Nnn {NVx} +\prop_new:N \g_doc_missing_tests_prop +\DeclareDocumentCommand \TestMissing {m} { + \prop_if_in:NVTF \g_doc_missing_tests_prop \l_doc_macro_input_clist + { + \prop_get:NVN \g_doc_missing_tests_prop \l_doc_macro_input_clist \l_tmpa_tl + \prop_gput:NVx \g_doc_missing_tests_prop \l_doc_macro_input_clist + { + *~ \l_tmpa_tl + ^^J \exp_not:n {\space\space\space\space\space\space} + *~ #1 + } + } + { \prop_gput:NVn \g_doc_missing_tests_prop \l_doc_macro_input_clist {#1} } +} +\int_new:N \g_doc_nested_macro_int +\cs_set:Nn \doc_texttt_comma:n {\,,~\texttt{#1}} +\cs_set:Npn \endmacro { + \int_compare:nT {\g_doc_nested_macro_int<1} + { + \par\nobreak{\footnotesize(\emph{ + End~ definition~ for~ + \prg_case_int:nnn { \clist_length:N \l_doc_macro_input_clist } + { + {1} { \texttt{ \clist_use:N \l_doc_macro_input_clist }. } + {2} + { + \tl_set:Nx \l_clist_first_tl { \clist_item:Nn \l_doc_macro_input_clist {0} } + \tl_set:Nx \l_clist_last_tl { \clist_item:Nn \l_doc_macro_input_clist {1} } + \texttt{\l_clist_first_tl}\,~ and~ \texttt{\l_clist_last_tl}\,. + } + {3} + { + \tl_set:Nx \l_clist_first_tl { \clist_item:Nn \l_doc_macro_input_clist {0} } + \tl_set:Nx \l_clist_mid_tl { \clist_item:Nn \l_doc_macro_input_clist {1} } + \tl_set:Nx \l_clist_last_tl { \clist_item:Nn \l_doc_macro_input_clist {2} } + \texttt{\l_clist_first_tl}\,,~ + \texttt{\l_clist_mid_tl}\,,~ + and~ \texttt{\l_clist_last_tl}\,. + } + } + { + \tl_set:Nx \l_clist_first_tl { \clist_item:Nn \l_doc_macro_input_clist {0} } + \texttt{\l_clist_first_tl}\,~and~others. + } + \bool_if:nT { + !\l_doc_macro_aux_bool && + !\l_doc_macro_internal_bool && + \int_compare_p:n {\g_doc_nested_macro_int<1} + } + { + \int_compare:nNnTF \l_doc_macro_int=1 {~This~} {~These~} + \bool_if:NTF \l_doc_macro_var_bool{variable}{function} + \int_compare:nNnTF \l_doc_macro_int=1 {~is~}{s~are~} + documented~on~page~ + \exp_args:Nx\pageref{doc/function/\l_doc_macro_tl}. + } + })\par} + } + \bool_if:nT + { \g_doc_checktest_bool && + !( \l_doc_macro_aux_bool || \l_doc_macro_var_bool ) && + !\l_doc_tested_bool + } + { + \seq_gput_right:Nx \g_doc_not_tested_seq + { + \l_doc_macro_input_clist + \bool_if:NT \l_doc_macro_pTF_bool {~(pTF)} + \bool_if:NT \l_doc_macro_TF_bool {~(TF)} + } + } +} +\newcommand*{\DescribeOption}{ + \leavevmode + \@bsphack + \begingroup + \MakePrivateLetters + \Describe@Option +} +\newcommand*{\Describe@Option}[1]{ + \endgroup + \marginpar{ + \raggedleft + \PrintDescribeEnv{#1} + } + \SpecialOptionIndex{#1} + \@esphack + \ignorespaces +} +\newcommand*{\SpecialOptionIndex}[1]{ + \@bsphack + \begingroup + \HD@target + \let\HDorg@encapchar\encapchar + \edef\encapchar usage{ + \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage} + } + \index{ + #1\actualchar{\protect\ttfamily#1}~(option) + \encapchar usage + } + \index{ + options:\levelchar#1\actualchar{\protect\ttfamily#1} + \encapchar usage + } + \endgroup + \@esphack +} +\font\manual=manfnt +\cs_set_nopar:Npn \dbend { {\manual\char127} } +\newenvironment {danger} { + \begin{trivlist}\item[]\noindent + \begingroup\hangindent=2pc\hangafter=-2 + \cs_set_nopar:Npn \par{\endgraf\endgroup} + \hbox to0pt{\hskip-\hangindent\dbend\hfill}\ignorespaces +}{ + \par\end{trivlist} +} +\newenvironment {ddanger} { + \begin{trivlist}\item[]\noindent + \begingroup\hangindent=3.5pc\hangafter=-2 + \cs_set_nopar:Npn \par{\endgraf\endgroup} + \hbox to0pt{\hskip-\hangindent\dbend\kern2pt\dbend\hfill}\ignorespaces +}{ + \par\end{trivlist} +} +\newenvironment{TemplateInterfaceDescription}[1] + {\subsection{The~object~type~`#1'}% + \begingroup + \@beginparpenalty\@M + \description + \def\TemplateArgument##1##2{\item[Arg:~##1]##2\par}% + \def\TemplateSemantics{\enddescription\endgroup + \subsubsection*{Semantics:}}% + } + {\par\bigskip} +\newenvironment{TemplateDescription}[2] + {\subsection{The~template~`#2'~(object~type~#1)}% + \subsubsection*{Attributes:}% + \begingroup + \@beginparpenalty\@M + \description + \def\TemplateKey##1##2##3##4{\item[##1~(##2)]##3% + \ifx\TemplateKey##4\TemplateKey\else + \hfill\penalty500\hbox{}\hfill Default:~##4% + \nobreak\hskip-\parfillskip\hskip0pt\relax + \fi + \par}% + \def\TemplateSemantics{\enddescription\endgroup + \subsubsection*{Semantics~\&~Comments:}}% + } + {\par\bigskip} +\newenvironment{InstanceDescription}[4][xxxxxxxxxxxxxxx] + {\subsubsection{The~instance~`#3'~(template~#2/#4)}% + \subsubsection*{Attribute~values:}% + \begingroup + \@beginparpenalty\@M + \def\InstanceKey##1##2{\>\textbf{##1}\>##2\\}% + \def\InstanceSemantics{\endtabbing\endgroup + \vskip-30pt\vskip0pt + \subsubsection*{Layout~description~\&~Comments:}}% + \tabbing + xxxx\=#1\=\kill + } + {\par\bigskip} +\bool_new:N \g_doc_implementation_bool +\cs_set_nopar:Npn \AlsoImplementation { + \bool_set_true:N \g_doc_implementation_bool + \cs_set:Npn \StopEventually ##1 { + \@bsphack + \cs_gset_nopar:Npn \Finale { ##1 \check@checksum } + \init@checksum + \@esphack + } +} +\AlsoImplementation +\cs_set_nopar:Npn \OnlyDescription { + \@bsphack + \bool_set_false:N \g_doc_implementation_bool + \cs_set:Npn \StopEventually ##1 { ##1 \endinput } + \@esphack +} +\cs_set_eq:NN \Finale \relax +\cs_set_nopar:Npn \partname{File} +\clist_new:N \g_docinput_clist +\cs_set:Npn \DocInput #1 { + \clist_map_inline:nn {#1} { + \clist_put_right:Nn \g_docinput_clist {##1} + \MakePercentIgnore + \input{##1} + \MakePercentComment + } +} +\cs_set:Npn \DocInputAgain { + \clist_map_inline:Nn \g_docinput_clist { + \MakePercentIgnore + \input{##1} + \MakePercentComment + } +} +\cs_set_nopar:Npn \partname{File} +\newcommand*{\DocInclude}[1]{% + \relax\clearpage + \docincludeaux + \IfFileExists{#1.fdd}{ + \cs_set_nopar:Npn \currentfile{#1.fdd} + }{ + \cs_set_nopar:Npn \currentfile{#1.dtx} + } + \ifnum\@auxout=\@partaux + \@latexerr{\string\include\space cannot~be~nested}\@eha + \else + \@docinclude #1 + \fi +} +\cs_set_nopar:Npn \@docinclude #1 { + \clearpage + \immediate\write\@mainaux{\string\@input{#1.aux}} + \@tempswatrue + \if@partsw + \@tempswafalse + \cs_set_nopar:Npx \@tempb{#1} + \@for\@tempa:=\@partlist\do{ + \ifx\@tempa\@tempb\@tempswatrue\fi + } + \fi + \if@tempswa + \cs_set_eq:NN \@auxout\@partaux + \immediate\openout\@partaux #1.aux + \immediate\write\@partaux{\relax} + \cs_set_eq:NN \@ltxdoc@PrintIndex\PrintIndex + \cs_set_eq:NN \PrintIndex\relax + \cs_set_eq:NN \@ltxdoc@PrintChanges\PrintChanges + \cs_set_eq:NN \PrintChanges\relax + \cs_set_eq:NN \@ltxdoc@theglossary\theglossary + \cs_set_eq:NN \@ltxdoc@endtheglossary\endtheglossary + \part{\currentfile} + { + \cs_set_eq:NN \ttfamily\relax + \cs_gset_nopar:Npx \filekey{\filekey, \thepart={\ttfamily\currentfile}} + } + \DocInput{\currentfile} + \cs_set_eq:NN \PrintIndex\@ltxdoc@PrintIndex + \cs_set_eq:NN \PrintChanges\@ltxdoc@PrintChanges + \cs_set_eq:NN \theglossary\@ltxdoc@theglossary + \cs_set_eq:NN \endtheglossary\@ltxdoc@endtheglossary + \clearpage + \@writeckpt{#1} + \immediate\closeout\@partaux + \else + \@nameuse{cp@#1} + \fi + \cs_set_eq:NN \@auxout\@mainaux +} +\cs_gset_nopar:Npn \codeline@wrindex #1 { + \immediate\write\@indexfile { + \string\indexentry{#1} + {\filesep\number\c@CodelineNo} + } +} +\cs_set_eq:NN \filesep \@empty +\cs_set_nopar:Npn \docincludeaux { + \cs_set_nopar:Npn \thepart {\alphalph{part}} + \cs_set_nopar:Npn \filesep {\thepart-} + \cs_set_eq:NN \filekey\@gobble + \g@addto@macro\index@prologue{ + \cs_gset_nopar:Npn\@oddfoot{ + \parbox{\textwidth}{ + \strut\footnotesize + \raggedright{\bfseries File~Key:}~\filekey + } + } + \cs_set_eq:NN \@evenfoot\@oddfoot + } + \cs_gset_eq:NN \docincludeaux\relax + \cs_gset_nopar:Npn\@oddfoot{ + \expandafter\ifx\csname ver@\currentfile\endcsname\relax + File~\thepart :~{\ttfamily\currentfile}~ + \else + \GetFileInfo{\currentfile} + File~\thepart :~{\ttfamily\filename}~ + Date:~\ExplFileDate\ % space + Version~\ExplFileVersion + \fi + \hfill\thepage + } + \cs_set_eq:NN \@evenfoot \@oddfoot +} +\seq_new:N \g_doc_functions_seq +\seq_new:N \g_doc_macros_seq +\seq_new:N \g_doc_not_tested_seq +\iow_open:Nn \g_write_func_stream { \jobname.cmds } +\cs_new_nopar:Npn \doc_show_functions_defined: { + \bool_if:nT { \g_doc_implementation_bool && \g_doc_checkfunc_bool } { + \typeout{ ======================================== ^^J } + + \tl_clear:N \l_tmpa_tl + \seq_map_inline:Nn \g_doc_functions_seq { + \seq_if_in:NnT \g_doc_macros_seq {##1} { + \tl_put_right:Nn \l_tmpa_tl { ##1 ^^J } + \iow_now:Nn \g_write_func_stream { ##1 } + } + } + \iow_close:N \g_write_func_stream + \doc_functions_typeout:n { + Functions~both~documented~and~defined:^^J (In~order~of~being~documented) + } + + \seq_map_inline:Nn \g_doc_functions_seq { + \seq_if_in:NnF \g_doc_macros_seq {##1} { + \tl_put_right:Nn \l_tmpa_tl { ##1 ^^J } + } + } + \doc_functions_typeout:n { Functions~documented~but~not~defined: } + + \seq_map_inline:Nn \g_doc_macros_seq { + \seq_if_in:NnF \g_doc_functions_seq {##1} { + \tl_put_right:Nn \l_tmpa_tl { ##1 ^^J } + } + } + \doc_functions_typeout:n { Functions~defined~but~not~documented: } + + \typeout{ ======================================== } + } +} +\AtEndDocument{ \doc_show_functions_defined: } +\cs_set_nopar:Npn \doc_functions_typeout:n #1 { + \tl_if_empty:NF \l_tmpa_tl { + \typeout{ + -------------------------------------- ^^J #1 ^^J + -------------------------------------- ^^J \l_tmpa_tl + } + \tl_clear:N \l_tmpa_tl + } +} +\cs_new:Npn \doc_show_not_tested: { + \bool_if:NT \g_doc_checktest_bool + { + \bool_if:nT { !(\seq_if_empty_p:N \g_doc_not_tested_seq) || + !(\prop_if_empty_p:N \g_doc_missing_tests_prop) } + { + \tl_clear:N \l_tmpa_tl + \prop_if_empty:NF \g_doc_missing_tests_prop + { + \tl_put_right:Nn \l_tmpa_tl + { + ^^J^^JThe~ following~ macro(s)~ have~ incomplete~ tests:^^J + } + \prop_map_inline:Nn \g_doc_missing_tests_prop + { + \tl_put_right:Nn \l_tmpa_tl + {^^J\space\space\space\space ##1 + ^^J\space\space\space\space\space\space ##2} + } + } + \seq_if_empty:NF \g_doc_not_tested_seq + { + \tl_put_right:Nn \l_tmpa_tl + { + ^^J^^J + The~ following~ macro(s)~ do~ not~ have~ any~ tests:^^J + } + \seq_map_inline:Nn \g_doc_not_tested_seq + { + \clist_map_inline:nn {##1} + { + \tl_put_right:Nn \l_tmpa_tl {^^J\space\space\space\space ####1} + } + } + \int_set:Nn \l_tmpa_int {\etex_interactionmode:D} + \errorstopmode + \ClassError{l3doc}{\l_tmpa_tl}{} + \int_set:Nn \etex_interactionmode:D {\l_tmpa_int} + } + } + } +} +\AtEndDocument{ \doc_show_not_tested: } +\g@addto@macro\theindex{\MakePrivateLetters} +\cs_set:Npn \verbatimchar {&} +\setcounter{IndexColumns}{2} +\IndexPrologue{ + \part*{Index} + \markboth{Index}{Index} + \addcontentsline{toc}{part}{Index} + The~italic~numbers~denote~the~pages~where~the~ + corresponding~entry~is~described,~ + numbers~underlined~point~to~the~definition,~ + all~others~indicate~the~places~where~it~is~used. +} + +\cs_set_nopar:Npn \doc_special_main_index:n #1 { + \index{ + \@gobble#1 + \actualchar + \string\verb\quotechar*\verbatimchar#1\verbatimchar + \encapchar + hdpgindex{\thepage}{usage} + } +} +\cs_set_nopar:Npn \doc_special_main_index:o { \exp_args:No \doc_special_main_index:n } +\cs_set_nopar:Npn \hdpgindex #1#2#3 { + \csname\ifx\\#2\\relax\else#2\fi\endcsname{ + \hyperlink{page.#1}{#3} + } +} +\g@addto@macro \PrintIndex { \AtEndDocument{ \typeout{^^J + ========================================^^J + Generate~the~index~by~executing^^J + \c_space_tl \c_space_tl \c_space_tl \c_space_tl + makeindex~-s~l3doc.ist~-o~\jobname.ind~\jobname.idx^^J + ========================================^^J + }} +} +\GlossaryPrologue{ + \part*{Change~History} + {\GlossaryParms\ttfamily\hyphenchar\font=`\-} + \markboth{Change~History}{Change~History} + \addcontentsline{toc}{part}{Change~History} +} +\g@addto@macro \PrintChanges { \AtEndDocument{ \typeout{^^J + ========================================^^J + Generate~the~change~list~by~executing^^J + \c_space_tl \c_space_tl \c_space_tl \c_space_tl + makeindex~-s~gglo.ist~~-o~\jobname.gls~\jobname.glo^^J + ========================================^^J + }} +} +\bool_if:NTF \g_doc_full_bool { + \RecordChanges + \CodelineIndex + \EnableCrossrefs + \AlsoImplementation +}{ + \CodelineNumbered + \DisableCrossrefs + \OnlyDescription +} +%% +%% +%% End of file `l3doc.cls'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty b/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty new file mode 100644 index 00000000000..028e9cd3bc0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty @@ -0,0 +1,394 @@ +%% +%% This is file `l3expan.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3expan.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3expan.dtx Copyright (C) 1990-2011 The LaTeX3 project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3expan.dtx 2480 2011-06-20 17:25:23Z bruno $ + {L3 Experimental argument expansion} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\cs_new_nopar:Npn \l_exp_tl { } +\cs_new:Npn \exp_arg_next:nnn #1#2#3 { #2 \::: { #3 {#1} } } +\cs_new:Npn \exp_arg_next_nobrace:nnn #1#2#3 { #2 \::: { #3 #1 } } +\cs_new:Npn \::: #1 {#1} +\cs_new:Npn \::n #1 \::: #2#3 { #1 \::: { #2 {#3} } } +\cs_new:Npn \::N #1 \::: #2#3 { #1 \::: {#2#3} } +\cs_new:Npn \::c #1 \::: #2#3 + { \exp_after:wN \exp_arg_next_nobrace:nnn \cs:w #3 \cs_end: {#1} {#2} } +\cs_new:Npn \::o #1 \::: #2#3 + { \exp_after:wN \exp_arg_next:nnn \exp_after:wN {#3} {#1} {#2} } +\cs_new:Npn \::f #1 \::: #2#3 + { + \exp_after:wN \exp_arg_next:nnn + \exp_after:wN { \tex_romannumeral:D -`0 #3 } + {#1} {#2} + } +\use:nn { \cs_new_eq:NN \exp_stop_f: } { ~ } +\cs_new_protected:Npn \::x #1 \::: #2#3 + { + \cs_set_nopar:Npx \l_exp_tl { {#3} } + \exp_after:wN \exp_arg_next:nnn \l_exp_tl {#1} {#2} + } +\cs_new:Npn \::V #1 \::: #2#3 + { + \exp_after:wN \exp_arg_next:nnn + \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #3 } + {#1} {#2} +} +\cs_new:Npn \::v # 1\::: #2#3 + { + \exp_after:wN \exp_arg_next:nnn + \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#3} } + {#1} {#2} + } +\cs_new_nopar:Npn \exp_eval_register:N #1 + { + \exp_after:wN \if_meaning:w \exp_not:N #1 #1 + \if_meaning:w \scan_stop: #1 + \exp_eval_error_msg:w + \fi: + \else: + \exp_after:wN \use_i_ii:nnn + \fi: + \exp_after:wN \c_zero \tex_the:D #1 + } +\cs_new_nopar:Npn \exp_eval_register:c #1 + { \exp_after:wN \exp_eval_register:N \cs:w #1 \cs_end: } +\group_begin:% +\tex_catcode:D`\!=11\scan_stop:% +\tex_catcode:D`\ =11\scan_stop:% +\cs_new:Npn\exp_eval_error_msg:w#1\tex_the:D#2{% +\fi:\fi:\exp_after:wN\c_zero\erroneous variable used!}% +\group_end:% +\cs_new:Npn \exp_args:No #1#2 { \exp_after:wN #1 \exp_after:wN {#2} } +\cs_new:Npn \exp_args:NNo #1#2#3 + { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN {#3} } +\cs_new:Npn \exp_args:NNNo #1#2#3#4 + { \exp_after:wN #1 \exp_after:wN#2 \exp_after:wN #3 \exp_after:wN {#4} } +\cs_new:Npn \exp_args:cc #1#2 + { \cs:w #1 \exp_after:wN \cs_end: \cs:w #2 \cs_end: } +\cs_new:Npn \exp_args:NNc #1#2#3 + { \exp_after:wN #1 \exp_after:wN #2 \cs:w # 3\cs_end: } +\cs_new:Npn \exp_args:Ncc #1#2#3 + { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: \cs:w #3 \cs_end: } +\cs_new:Npn \exp_args:Nccc #1#2#3#4 + { + \exp_after:wN #1 + \cs:w #2 \exp_after:wN \cs_end: + \cs:w #3 \exp_after:wN \cs_end: + \cs:w #4 \cs_end: + } +\cs_new:Npn \exp_args:Nf #1#2 + { \exp_after:wN #1 \exp_after:wN { \tex_romannumeral:D -`0 #2 } } +\cs_new:Npn \exp_args:Nv #1#2 + { + \exp_after:wN #1 \exp_after:wN + { \tex_romannumeral:D \exp_eval_register:c {#2} } + } +\cs_new:Npn \exp_args:NV #1#2 + { + \exp_after:wN #1 \exp_after:wN + { \tex_romannumeral:D \exp_eval_register:N #2 } + } +\cs_new:Npn \exp_args:NNf #1#2#3 + { + \exp_after:wN #1 + \exp_after:wN #2 + \exp_after:wN { \tex_romannumeral:D -`0 #3 } + } +\cs_new:Npn \exp_args:NNv #1#2#3 + { + \exp_after:wN #1 + \exp_after:wN #2 + \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#3} } + } +\cs_new:Npn \exp_args:NNV #1#2#3 + { + \exp_after:wN #1 + \exp_after:wN #2 + \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #3 } + } +\cs_new:Npn \exp_args:Nco #1#2#3 + { + \exp_after:wN #1 + \cs:w #2 \exp_after:wN \cs_end: + \exp_after:wN {#3} + } +\cs_new:Npn \exp_args:Ncf #1#2#3 + { + \exp_after:wN #1 + \cs:w #2 \exp_after:wN \cs_end: + \exp_after:wN { \tex_romannumeral:D -`0 #3 } + } +\cs_new_nopar:Npn \exp_args:NVV #1#2#3 + { + \exp_after:wN #1 + \exp_after:wN { \tex_romannumeral:D \exp_after:wN + \exp_eval_register:N \exp_after:wN #2 \exp_after:wN } + \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #3 } + } +\cs_new:Npn \exp_args:NNNV #1#2#3#4 + { + \exp_after:wN #1 + \exp_after:wN #2 + \exp_after:wN #3 + \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #4 } + } +\cs_new:Npn \exp_args:NcNc #1#2#3#4 + { + \exp_after:wN #1 + \cs:w #2 \exp_after:wN \cs_end: + \exp_after:wN #3 + \cs:w #4 \cs_end: + } +\cs_new:Npn \exp_args:NcNo #1#2#3#4 + { + \exp_after:wN #1 + \cs:w #2 \exp_after:wN \cs_end: + \exp_after:wN #3 + \exp_after:wN {#4} + } +\cs_new:Npn \exp_args:Ncco #1#2#3#4 + { + \exp_after:wN #1 + \cs:w #2 \exp_after:wN \cs_end: + \cs:w #3 \exp_after:wN \cs_end: + \exp_after:wN {#4} + } +\cs_new_protected_nopar:Npn \exp_args:Nx { \::x \::: } +\cs_new_nopar:Npn \exp_args:Nnc { \::n \::c \::: } +\cs_new_nopar:Npn \exp_args:Nfo { \::f \::o \::: } +\cs_new_nopar:Npn \exp_args:Nff { \::f \::f \::: } +\cs_new_nopar:Npn \exp_args:Nnf { \::n \::f \::: } +\cs_new_nopar:Npn \exp_args:Nno { \::n \::o \::: } +\cs_new_nopar:Npn \exp_args:NnV { \::n \::V \::: } +\cs_new_nopar:Npn \exp_args:Noc { \::o \::c \::: } +\cs_new_nopar:Npn \exp_args:Noo { \::o \::o \::: } +\cs_new_protected_nopar:Npn \exp_args:NNx { \::N \::x \::: } +\cs_new_protected_nopar:Npn \exp_args:Ncx { \::c \::x \::: } +\cs_new_protected_nopar:Npn \exp_args:Nnx { \::n \::x \::: } +\cs_new_protected_nopar:Npn \exp_args:Nox { \::o \::x \::: } +\cs_new_protected_nopar:Npn \exp_args:Nxo { \::x \::o \::: } +\cs_new_protected_nopar:Npn \exp_args:Nxx { \::x \::x \::: } +\cs_new_nopar:Npn \exp_args:NNno { \::N \::n \::o \::: } +\cs_new_nopar:Npn \exp_args:NNoo { \::N \::o \::o \::: } +\cs_new_nopar:Npn \exp_args:Nnnc { \::n \::n \::c \::: } +\cs_new_nopar:Npn \exp_args:Nnno { \::n \::n \::o \::: } +\cs_new_nopar:Npn \exp_args:Nooo { \::o \::o \::o \::: } +\cs_new_protected_nopar:Npn \exp_args:NNnx { \::N \::n \::x \::: } +\cs_new_protected_nopar:Npn \exp_args:NNox { \::N \::o \::x \::: } +\cs_new_protected_nopar:Npn \exp_args:Nnnx { \::n \::n \::x \::: } +\cs_new_protected_nopar:Npn \exp_args:Nnox { \::n \::o \::x \::: } +\cs_new_protected_nopar:Npn \exp_args:Nccx { \::c \::c \::x \::: } +\cs_new_protected_nopar:Npn \exp_args:Ncnx { \::c \::n \::x \::: } +\cs_new_protected_nopar:Npn \exp_args:Noox { \::o \::o \::x \::: } +\cs_new:Npn \exp_arg_last_unbraced:nn #1#2 { #2#1 } +\cs_new:Npn \::f_unbraced \::: #1#2 + { + \exp_after:wN \exp_arg_last_unbraced:nn + \exp_after:wN { \tex_romannumeral:D -`0 #2 } {#1} + } +\cs_new:Npn \::o_unbraced \::: #1#2 + { \exp_after:wN \exp_arg_last_unbraced:nn \exp_after:wN {#2} {#1} } +\cs_new:Npn \::V_unbraced \::: #1#2 + { + \exp_after:wN \exp_arg_last_unbraced:nn + \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #2 } {#1} + } +\cs_new:Npn \::v_unbraced \::: #1#2 + { + \exp_after:wN \exp_arg_last_unbraced:nn + \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#2} } {#1} + } +\cs_new:Npn \exp_last_unbraced:NV #1#2 + { \exp_after:wN #1 \tex_romannumeral:D \exp_eval_register:N #2 } +\cs_new:Npn \exp_last_unbraced:Nv #1#2 + { \exp_after:wN #1 \tex_romannumeral:D \exp_eval_register:c {#2} } +\cs_new:Npn \exp_last_unbraced:No #1#2 { \exp_after:wN #1 #2 } +\cs_new:Npn \exp_last_unbraced:Nf #1#2 + { \exp_after:wN #1 \tex_romannumeral:D -`0 #2 } +\cs_new:Npn \exp_last_unbraced:NcV #1#2#3 + { + \exp_after:wN #1 + \cs:w #2 \exp_after:wN \cs_end: + \tex_romannumeral:D \exp_eval_register:N #3 + } +\cs_new:Npn \exp_last_unbraced:NNV #1#2#3 + { + \exp_after:wN #1 + \exp_after:wN #2 + \tex_romannumeral:D \exp_eval_register:N #3 + } +\cs_new:Npn \exp_last_unbraced:NNo #1#2#3 + { \exp_after:wN #1 \exp_after:wN #2 #3 } +\cs_new_nopar:Npn \exp_last_unbraced:Noo { \::o \::o_unbraced \::: } +\cs_new_nopar:Npn \exp_last_unbraced:Nfo { \::f \::o_unbraced \::: } +\cs_new:Npn \exp_last_unbraced:NNNV #1#2#3#4 + { + \exp_after:wN #1 + \exp_after:wN #2 + \exp_after:wN #3 + \tex_romannumeral:D \exp_eval_register:N #4 + } +\cs_new:Npn \exp_last_unbraced:NNNo #1#2#3#4 + { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 #4 } +\cs_new:Npn \exp_last_two_unbraced:Noo #1#2#3 + { \exp_after:wN \exp_last_two_unbraced_aux:nnN \exp_after:wN {#3} {#2} #1 } +\cs_new:Npn \exp_last_two_unbraced_aux:nnN #1#2#3 + { \exp_after:wN #3 #2 #1 } +\cs_new:Npn \exp_not:o #1 { \etex_unexpanded:D \exp_after:wN {#1} } +\cs_new:Npn \exp_not:f #1 + { \etex_unexpanded:D \exp_after:wN { \tex_romannumeral:D -`0 #1 } } +\cs_new:Npn \exp_not:V #1 + { + \etex_unexpanded:D \exp_after:wN + { \tex_romannumeral:D \exp_eval_register:N #1 } + } +\cs_new:Npn \exp_not:v #1 + { + \etex_unexpanded:D \exp_after:wN + { \tex_romannumeral:D \exp_eval_register:c {#1} } + } +\cs_new:Npn \exp_not:c #1 { \exp_after:wN \exp_not:N \cs:w #1 \cs_end: } +\cs_new_protected:Npn \cs_generate_variant:Nn #1 + { + \chk_if_exist_cs:N #1 + \cs_split_function:NN #1 \cs_generate_variant_aux:nnNNn + #1 + } +\cs_new:Npn \cs_generate_variant_aux:nnNNn #1#2#3#4#5 + { \cs_generate_variant_aux:Nnnw #4 {#1}{#2} #5 , ? , \q_recursion_stop } +\cs_new:Npn \cs_generate_variant_aux:Nnnw #1#2#3#4 , + { + \if:w ? #4 + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \fi: + \exp_args:NNc \cs_generate_variant_aux:NNn + #1 + { #2 : #4 \use:c { use_none: \cs_generate_variant_aux:N #4 ? } #3 } + {#4} + \cs_generate_variant_aux:Nnnw #1 {#2} {#3} + } +\cs_new:Npn \cs_generate_variant_aux:NNn #1 #2 #3 + { + \cs_if_free:NTF #2 + { + \cs_generate_variant_aux:NNpx #1 #2 + { \exp_not:c { exp_args:N #3 } \exp_not:N #1 } + \cs_generate_internal_variant:n {#3} + } + { + \iow_log:x + { + Variant~\token_to_str:N #2~% + already~defined;~ not~ changing~ it~on~line~% + \tex_the:D \tex_inputlineno:D + } + } + } +\cs_new:Npn \cs_generate_variant_aux:N #1 + { + \if:w ? #1 + \exp_after:wN \use_none:nn + \fi: + n + \cs_generate_variant_aux:N + } +\group_begin: + \tex_lccode:D `\Z = `\d \scan_stop: + \tex_lccode:D `\? =`\\ \scan_stop: + \tex_catcode:D `\P = 12 \scan_stop: + \tex_catcode:D `\R = 12 \scan_stop: + \tex_catcode:D `\O = 12 \scan_stop: + \tex_catcode:D `\T = 12 \scan_stop: + \tex_catcode:D `\E = 12 \scan_stop: + \tex_catcode:D `\C = 12 \scan_stop: + \tex_catcode:D `\Z = 12 \scan_stop: +\tex_lowercase:D + { + \group_end: + \cs_new_nopar:Npn \cs_generate_variant_aux:NNpx #1 + { + \exp_after:wN \cs_generate_variant_aux:w + \token_to_meaning:N #1 ? PROTECTEZ \q_stop + } + \cs_new:Npn \cs_generate_variant_aux:w #1 ? PROTECTEZ #2 \q_stop + { + \if_catcode:w a \etex_detokenize:D \exp_after:wN {#1} a + \exp_after:wN \cs_new_protected_nopar:Npx + \else: + \exp_after:wN \cs_new_nopar:Npx + \fi: + } + } +\cs_new_protected:Npn \cs_generate_internal_variant:n #1 + { + \cs_if_free:cT { exp_args:N #1 } + { + \cs_new:cpx { exp_args:N #1 } + { \cs_generate_internal_variant_aux:N #1 : } + } + } +\cs_new:Npn \cs_generate_internal_variant_aux:N #1 + { + \exp_not:c { :: #1 } + \if_meaning:w #1 : + \exp_after:wN \use_none:n + \fi: + \cs_generate_internal_variant_aux:N + } +\cs_generate_variant:Nn \str_if_eq_p:nn { V , o } +\cs_generate_variant:Nn \str_if_eq_p:nn { nV , no , VV } +\cs_generate_variant:Nn \str_if_eq:nnT { V , o } +\cs_generate_variant:Nn \str_if_eq:nnT { nV , no , VV } +\cs_generate_variant:Nn \str_if_eq:nnF { V , o } +\cs_generate_variant:Nn \str_if_eq:nnF { nV , no , VV } +\cs_generate_variant:Nn \str_if_eq:nnTF { V , o } +\cs_generate_variant:Nn \str_if_eq:nnTF { nV , no , VV } +%% +%% +%% End of file `l3expan.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3file.sty b/Master/texmf-dist/tex/latex/l3kernel/l3file.sty new file mode 100644 index 00000000000..e8272cde35f --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3file.sty @@ -0,0 +1,133 @@ +%% +%% This is file `l3file.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3file.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3file.dtx Copyright (C) 2009-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3file.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental file operations} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\tl_new:N \g_file_current_name_tl +\tl_gset_eq:NN \g_file_current_name_tl \@currname +\seq_new:N \g_file_stack_seq +\seq_new:N \g_file_record_seq +\tl_new:N \l_file_name_tl +\seq_new:N \l_file_search_path_seq +\seq_new:N \l_file_search_path_saved_seq +\cs_new_protected_nopar:Npn \file_add_path:nN #1#2 + { + \ior_open:Nn \g_file_test_stream {#1} + \ior_if_eof:NTF \g_file_test_stream + { \file_add_path_search:nN {#1} #2 } + { + \ior_close:N \g_file_test_stream + \tl_set:Nx #2 {#1} + } + } +\cs_new_protected_nopar:Npn \file_add_path_search:nN #1#2 + { + \tl_clear:N #2 + \cs_if_exist:NT \input@path + { + \seq_set_eq:NN \l_file_search_path_saved_seq \l_file_search_path_seq + \clist_map_inline:Nn \input@path + { \seq_put_right:Nn \l_file_search_path_seq {##1} } + } + \seq_map_inline:Nn \l_file_search_path_seq + { + \ior_open:Nn \g_file_test_stream { ##1 #1 } + \ior_if_eof:NF \g_file_test_stream + { + \tl_set:Nx #2 { ##1 #1 } + \seq_map_break: + } + } + \cs_if_exist:NT \input@path + { \seq_set_eq:NN \l_file_search_path_seq \l_file_search_path_saved_seq } + \ior_close:N \g_file_test_stream + } +\prg_new_protected_conditional:Nnn \file_if_exist:n { T , F , TF } + { + \file_add_path:nN {#1} \l_file_name_tl + \tl_if_empty:NTF \l_file_name_tl + { \prg_return_false: } + { \prg_return_true: } + } +\cs_new_protected_nopar:Npn \file_input:n #1 + { + \file_add_path:nN {#1} \l_file_name_tl + \tl_if_empty:NF \l_file_name_tl + { + \@addtofilelist {#1} + \seq_gpush:NV \g_file_stack_seq \g_file_current_name_tl + \tl_gset:Nn \g_file_current_name_tl {#1} + \exp_after:wN \tex_input:D \l_file_name_tl ~ + \seq_gpop:NN \g_file_stack_seq \g_file_current_name_tl + } + } +\cs_new_protected_nopar:Npn \file_path_include:n #1 + { + \seq_if_in:NnF \l_file_search_path_seq {#1} + { \seq_put_right:Nn \l_file_search_path_seq {#1} } + } +\cs_new_protected_nopar:Npn \file_path_remove:n #1 + { \seq_remove_all:Nn \l_file_search_path_seq {#1} } +\cs_new_protected_nopar:Npn \file_list: + { + \seq_remove_duplicates:N \g_file_record_seq + \iow_log:n { *~File~List~* } + \seq_map_inline:Nn \g_file_record_seq { \iow_log:n {##1} } + \iow_log:n { ************* } + } +\AtBeginDocument + { + \clist_map_inline:Nn \@filelist + { \seq_put_right:Nn \g_file_record_seq {#1} } + } +%% +%% +%% End of file `l3file.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty b/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty new file mode 100644 index 00000000000..d3f98d4353a --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty @@ -0,0 +1,3403 @@ +%% +%% This is file `l3fp.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3fp.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3fp.dtx Copyright (C) 2010,2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3fp.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental floating-point operations} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\int_const:Nn \c_forty_four { 44 } +\int_const:Nn \c_one_million { 1 000 000 } +\int_const:Nn \c_one_hundred_million { 100 000 000 } +\int_const:Nn \c_five_hundred_million { 500 000 000 } +\int_const:Nn \c_one_thousand_million { 1 000 000 000 } +\int_new:N \c_fp_pi_by_four_decimal_int +\int_set:Nn \c_fp_pi_by_four_decimal_int { 785 398 158 } +\int_new:N \c_fp_pi_by_four_extended_int +\int_set:Nn \c_fp_pi_by_four_extended_int { 897 448 310 } +\int_new:N \c_fp_pi_decimal_int +\int_set:Nn \c_fp_pi_decimal_int { 141 592 653 } +\int_new:N \c_fp_pi_extended_int +\int_set:Nn \c_fp_pi_extended_int { 589 793 238 } +\int_new:N \c_fp_two_pi_decimal_int +\int_set:Nn \c_fp_two_pi_decimal_int { 283 185 307 } +\int_new:N \c_fp_two_pi_extended_int +\int_set:Nn \c_fp_two_pi_extended_int { 179 586 477 } +\tl_const:Nn \c_e_fp { + 2.718281828 e 0 } +\tl_const:Nn \c_one_fp { + 1.000000000 e 0 } +\tl_const:Nn \c_pi_fp { + 3.141592654 e 0 } +\tl_const:Nn \c_undefined_fp { X 0.000000000 e 0 } +\tl_const:Nn \c_zero_fp { + 0.000000000 e 0 } +\tl_new:N \l_fp_arg_tl +\int_new:N \l_fp_count_int +\int_new:N \l_fp_div_offset_int +\int_new:N \l_fp_exp_integer_int +\int_new:N \l_fp_exp_decimal_int +\int_new:N \l_fp_exp_extended_int +\int_new:N \l_fp_exp_exponent_int +\int_new:N \l_fp_input_a_sign_int +\int_new:N \l_fp_input_a_integer_int +\int_new:N \l_fp_input_a_decimal_int +\int_new:N \l_fp_input_a_exponent_int +\int_new:N \l_fp_input_b_sign_int +\int_new:N \l_fp_input_b_integer_int +\int_new:N \l_fp_input_b_decimal_int +\int_new:N \l_fp_input_b_exponent_int +\int_new:N \l_fp_input_a_extended_int +\int_new:N \l_fp_input_b_extended_int +\int_new:N \l_fp_mul_a_i_int +\int_new:N \l_fp_mul_a_ii_int +\int_new:N \l_fp_mul_a_iii_int +\int_new:N \l_fp_mul_a_iv_int +\int_new:N \l_fp_mul_a_v_int +\int_new:N \l_fp_mul_a_vi_int +\int_new:N \l_fp_mul_b_i_int +\int_new:N \l_fp_mul_b_ii_int +\int_new:N \l_fp_mul_b_iii_int +\int_new:N \l_fp_mul_b_iv_int +\int_new:N \l_fp_mul_b_v_int +\int_new:N \l_fp_mul_b_vi_int +\int_new:N \l_fp_mul_output_int +\tl_new:N \l_fp_mul_output_tl +\int_new:N \l_fp_output_sign_int +\int_new:N \l_fp_output_integer_int +\int_new:N \l_fp_output_decimal_int +\int_new:N \l_fp_output_exponent_int +\int_new:N \l_fp_output_extended_int +\bool_new:N \l_fp_round_carry_bool +\tl_new:N \l_fp_round_decimal_tl +\int_new:N \l_fp_round_position_int +\int_new:N \l_fp_round_target_int +\tl_new:N \l_fp_sign_tl +\int_new:N \l_fp_split_sign_int +\int_new:N \l_fp_tmp_int +\tl_new:N \l_fp_tmp_tl +\int_new:N \l_fp_trig_octant_int +\int_new:N \l_fp_trig_sign_int +\int_new:N \l_fp_trig_decimal_int +\int_new:N \l_fp_trig_extended_int +\cs_new_protected_nopar:Npn \fp_read:N #1 + { \exp_after:wN \fp_read_aux:w #1 \q_stop } +\cs_new_protected_nopar:Npn \fp_read_aux:w #1#2 . #3 e #4 \q_stop + { + \if:w #1 - + \l_fp_input_a_sign_int \c_minus_one + \else: + \l_fp_input_a_sign_int \c_one + \fi: + \l_fp_input_a_integer_int #2 \scan_stop: + \l_fp_input_a_decimal_int #3 \scan_stop: + \l_fp_input_a_exponent_int #4 \scan_stop: + } +\cs_new_protected_nopar:Npn \fp_split:Nn #1#2 + { + \tl_set:Nx \l_fp_tmp_tl {#2} + \tl_set_rescan:Nno \l_fp_tmp_tl { \char_set_catcode_ignore:n { 32 } } + { \l_fp_tmp_tl } + \l_fp_split_sign_int \c_one + \fp_split_sign: + \use:c { l_fp_input_ #1 _sign_int } \l_fp_split_sign_int + \exp_after:wN \fp_split_exponent:w \l_fp_tmp_tl e e \q_stop #1 + } +\cs_new_protected_nopar:Npn \fp_split_sign: + { + \if_int_compare:w \pdftex_strcmp:D + { \exp_after:wN \tl_head:w \l_fp_tmp_tl ? \q_stop } { - } + = \c_zero + \tl_set:Nx \l_fp_tmp_tl + { + \exp_after:wN + \tl_tail:w \l_fp_tmp_tl \prg_do_nothing: \q_stop + } + \l_fp_split_sign_int -\l_fp_split_sign_int + \exp_after:wN \fp_split_sign: + \else: + \if_int_compare:w \pdftex_strcmp:D + { \exp_after:wN \tl_head:w \l_fp_tmp_tl ? \q_stop } { + } + = \c_zero + \tl_set:Nx \l_fp_tmp_tl + { + \exp_after:wN + \tl_tail:w \l_fp_tmp_tl \prg_do_nothing: \q_stop + } + \exp_after:wN \exp_after:wN \exp_after:wN \fp_split_sign: + \fi: + \fi: + } +\cs_new_protected_nopar:Npn \fp_split_exponent:w #1 e #2 e #3 \q_stop #4 + { + \use:c { l_fp_input_ #4 _exponent_int } + \int_eval:w 0 #2 \scan_stop: + \tex_afterassignment:D \fp_split_aux_i:w + \use:c { l_fp_input_ #4 _integer_int } + \int_eval:w 0 #1 . . \q_stop #4 + } +\cs_new_protected_nopar:Npn \fp_split_aux_i:w #1 . #2 . #3 \q_stop + { \fp_split_aux_ii:w #2 000000000 \q_stop } +\cs_new_protected_nopar:Npn \fp_split_aux_ii:w #1#2#3#4#5#6#7#8#9 + { \fp_split_aux_iii:w {#1#2#3#4#5#6#7#8#9} } +\cs_new_protected_nopar:Npn \fp_split_aux_iii:w #1#2 \q_stop + { + \l_fp_tmp_int 1 #1 \scan_stop: + \exp_after:wN \fp_split_decimal:w + \int_use:N \l_fp_tmp_int 000000000 \q_stop + } +\cs_new_protected_nopar:Npn \fp_split_decimal:w #1#2#3#4#5#6#7#8#9 + { \fp_split_decimal_aux:w {#2#3#4#5#6#7#8#9} } +\cs_new_protected_nopar:Npn \fp_split_decimal_aux:w #1#2#3 \q_stop #4 + { + \use:c { l_fp_input_ #4 _decimal_int } #1#2 \scan_stop: + \if_int_compare:w + \int_eval:w + \use:c { l_fp_input_ #4 _integer_int } + + \use:c { l_fp_input_ #4 _decimal_int } + \scan_stop: + = \c_zero + \use:c { l_fp_input_ #4 _sign_int } \c_one + \fi: + \if_int_compare:w + \use:c { l_fp_input_ #4 _integer_int } < \c_one_thousand_million + \else: + \exp_after:wN \fp_overflow_msg: + \fi: + } +\cs_new_protected_nopar:Npn \fp_standardise:NNNN #1#2#3#4 + { + \if_int_compare:w + \int_eval:w #2 + #3 = \c_zero + #1 \c_one + #4 \c_zero + \exp_after:wN \use_none:nnnn + \else: + \exp_after:wN \fp_standardise_aux:NNNN + \fi: + #1#2#3#4 + } +\cs_new_protected_nopar:Npn \fp_standardise_aux:NNNN #1#2#3#4 + { + \cs_set_protected_nopar:Npn \fp_standardise_aux: + { + \if_int_compare:w #2 = \c_zero + \tex_advance:D #3 \c_one_thousand_million + \exp_after:wN \fp_standardise_aux:w + \int_use:N #3 \q_stop + \exp_after:wN \fp_standardise_aux: + \fi: + } + \cs_set_protected_nopar:Npn + \fp_standardise_aux:w ##1##2##3##4##5##6##7##8##9 \q_stop + { + #2 ##2 \scan_stop: + #3 ##3##4##5##6##7##8##9 0 \scan_stop: + \tex_advance:D #4 \c_minus_one + } + \fp_standardise_aux: + \cs_set_protected_nopar:Npn \fp_standardise_aux: + { + \if_int_compare:w #2 > \c_nine + \tex_advance:D #2 \c_one_thousand_million + \exp_after:wN \use_i:nn \exp_after:wN + \fp_standardise_aux:w \int_use:N #2 + \exp_after:wN \fp_standardise_aux: + \fi: + } + \cs_set_protected_nopar:Npn + \fp_standardise_aux:w ##1##2##3##4##5##6##7##8##9 + { + #2 ##1##2##3##4##5##6##7##8 \scan_stop: + \tex_advance:D #3 \c_one_thousand_million + \tex_divide:D #3 \c_ten + \tl_set:Nx \l_fp_tmp_tl + { + ##9 + \exp_after:wN \use_none:n \int_use:N #3 + } + #3 \l_fp_tmp_tl \scan_stop: + \tex_advance:D #4 \c_one + } + \fp_standardise_aux: + \if_int_compare:w #4 < \c_one_hundred + \if_int_compare:w #4 > -\c_one_hundred + \else: + #1 \c_one + #2 \c_zero + #3 \c_zero + #4 \c_zero + \fi: + \else: + \exp_after:wN \fp_overflow_msg: + \fi: + } +\cs_new_protected_nopar:Npn \fp_standardise_aux: { } +\cs_new_protected_nopar:Npn \fp_standardise_aux:w { } +\cs_new_protected_nopar:Npn \fp_level_input_exponents: + { + \if_int_compare:w \l_fp_input_a_exponent_int > \l_fp_input_b_exponent_int + \exp_after:wN \fp_level_input_exponents_a: + \else: + \exp_after:wN \fp_level_input_exponents_b: + \fi: + } +\cs_new_protected_nopar:Npn \fp_level_input_exponents_a: + { + \if_int_compare:w \l_fp_input_a_exponent_int > \l_fp_input_b_exponent_int + \tex_advance:D \l_fp_input_b_integer_int \c_one_thousand_million + \exp_after:wN \use_i:nn \exp_after:wN + \fp_level_input_exponents_a:NNNNNNNNN + \int_use:N \l_fp_input_b_integer_int + \exp_after:wN \fp_level_input_exponents_a: + \fi: + } +\cs_new_protected_nopar:Npn \fp_level_input_exponents_a:NNNNNNNNN + #1#2#3#4#5#6#7#8#9 + { + \l_fp_input_b_integer_int #1#2#3#4#5#6#7#8 \scan_stop: + \tex_advance:D \l_fp_input_b_decimal_int \c_one_thousand_million + \tex_divide:D \l_fp_input_b_decimal_int \c_ten + \tl_set:Nx \l_fp_tmp_tl + { + #9 + \exp_after:wN \use_none:n + \int_use:N \l_fp_input_b_decimal_int + } + \l_fp_input_b_decimal_int \l_fp_tmp_tl \scan_stop: + \tex_advance:D \l_fp_input_b_exponent_int \c_one + } +\cs_new_protected_nopar:Npn \fp_level_input_exponents_b: + { + \if_int_compare:w \l_fp_input_b_exponent_int > \l_fp_input_a_exponent_int + \tex_advance:D \l_fp_input_a_integer_int \c_one_thousand_million + \exp_after:wN \use_i:nn \exp_after:wN + \fp_level_input_exponents_b:NNNNNNNNN + \int_use:N \l_fp_input_a_integer_int + \exp_after:wN \fp_level_input_exponents_b: + \fi: + } +\cs_new_protected_nopar:Npn \fp_level_input_exponents_b:NNNNNNNNN + #1#2#3#4#5#6#7#8#9 + { + \l_fp_input_a_integer_int #1#2#3#4#5#6#7#8 \scan_stop: + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \tex_divide:D \l_fp_input_a_decimal_int \c_ten + \tl_set:Nx \l_fp_tmp_tl + { + #9 + \exp_after:wN \use_none:n + \int_use:N \l_fp_input_a_decimal_int + } + \l_fp_input_a_decimal_int \l_fp_tmp_tl \scan_stop: + \tex_advance:D \l_fp_input_a_exponent_int \c_one + } +\cs_new_protected_nopar:Npn \fp_tmp:w #1#2 { } +\cs_new_protected_nopar:Npn \fp_new:N #1 + { + \tl_new:N #1 + \tl_gset_eq:NN #1 \c_zero_fp + } +\cs_generate_variant:Nn \fp_new:N { c } +\cs_new_protected_nopar:Npn \fp_const:Nn #1#2 + { + \fp_new:N #1 + \fp_gset:Nn #1 {#2} + } +\cs_generate_variant:Nn \fp_const:Nn { c } +\cs_new_protected_nopar:Npn \fp_zero:N #1 + { \tl_set_eq:NN #1 \c_zero_fp } +\cs_new_protected_nopar:Npn \fp_gzero:N #1 + { \tl_gset_eq:NN #1 \c_zero_fp } +\cs_generate_variant:Nn \fp_zero:N { c } +\cs_generate_variant:Nn \fp_gzero:N { c } +\cs_new_protected_nopar:Npn \fp_set:Nn { \fp_set_aux:NNn \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gset:Nn { \fp_set_aux:NNn \tl_gset:Nn } +\cs_new_protected_nopar:Npn \fp_set_aux:NNn #1#2#3 + { + \group_begin: + \fp_split:Nn a {#3} + \fp_standardise:NNNN + \l_fp_input_a_sign_int + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + \l_fp_input_a_exponent_int + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + #1 \exp_not:N #2 + { + \if_int_compare:w \l_fp_input_a_sign_int < \c_zero + - + \else: + + + \fi: + \int_use:N \l_fp_input_a_integer_int + . + \exp_after:wN \use_none:n + \int_use:N \l_fp_input_a_decimal_int + e + \int_use:N \l_fp_input_a_exponent_int + } + } + \fp_tmp:w + } +\cs_generate_variant:Nn \fp_set:Nn { c } +\cs_generate_variant:Nn \fp_gset:Nn { c } +\cs_new_protected_nopar:Npn \fp_set_from_dim:Nn + { \fp_set_from_dim_aux:NNn \tl_set:Nx } +\cs_new_protected_nopar:Npn \fp_gset_from_dim:Nn + { \fp_set_from_dim_aux:NNn \tl_gset:Nx } +\cs_new_protected_nopar:Npn \fp_set_from_dim_aux:NNn #1#2#3 + { + \group_begin: + \l_fp_tmp_skip \etex_glueexpr:D #3 \scan_stop: + \l_fp_tmp_dim \l_fp_tmp_skip + \fp_split:Nn a + { + \exp_after:wN \fp_set_from_dim_aux:w + \dim_use:N \l_fp_tmp_dim + } + \fp_standardise:NNNN + \l_fp_input_a_sign_int + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + \l_fp_input_a_exponent_int + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + #1 \exp_not:N #2 + { + \if_int_compare:w \l_fp_input_a_sign_int < \c_zero + - + \else: + + + \fi: + \int_use:N \l_fp_input_a_integer_int + . + \exp_after:wN \use_none:n + \int_use:N \l_fp_input_a_decimal_int + e + \int_use:N \l_fp_input_a_exponent_int + } + } + \fp_tmp:w + } +\cs_set_protected_nopar:Npx \fp_set_from_dim_aux:w + { + \cs_set_nopar:Npn \exp_not:N \fp_set_from_dim_aux:w + ##1 \tl_to_str:n { pt } {##1} + } +\fp_set_from_dim_aux:w +\cs_generate_variant:Nn \fp_set_from_dim:Nn { c } +\cs_generate_variant:Nn \fp_gset_from_dim:Nn { c } +\dim_new:N \l_fp_tmp_dim +\skip_new:N \l_fp_tmp_skip +\cs_new_eq:NN \fp_set_eq:NN \tl_set_eq:NN +\cs_new_eq:NN \fp_set_eq:cN \tl_set_eq:cN +\cs_new_eq:NN \fp_set_eq:Nc \tl_set_eq:Nc +\cs_new_eq:NN \fp_set_eq:cc \tl_set_eq:cc +\cs_new_eq:NN \fp_gset_eq:NN \tl_gset_eq:NN +\cs_new_eq:NN \fp_gset_eq:cN \tl_gset_eq:cN +\cs_new_eq:NN \fp_gset_eq:Nc \tl_gset_eq:Nc +\cs_new_eq:NN \fp_gset_eq:cc \tl_gset_eq:cc +\cs_new_eq:NN \fp_show:N \tl_show:N +\cs_new_eq:NN \fp_show:c \tl_show:c +\cs_new_nopar:Npn \fp_use:N #1 + { \exp_after:wN \fp_use_aux:w #1 \q_stop } +\cs_generate_variant:Nn \fp_use:N { c } +\cs_new_nopar:Npn \fp_use_aux:w #1#2 e #3 \q_stop + { + \if:w #1 - + - + \fi: + \if_int_compare:w #3 > \c_zero + \exp_after:wN \fp_use_large:w + \else: + \if_int_compare:w #3 < \c_zero + \exp_after:wN \exp_after:wN \exp_after:wN + \fp_use_small:w + \else: + \exp_after:wN \exp_after:wN \exp_after:wN \fp_use_none:w + \fi: + \fi: + #2 e #3 \q_stop + } +\cs_new_nopar:Npn \fp_use_none:w #1 e #2 \q_stop {#1} +\cs_new_nopar:Npn \fp_use_small:w #1 . #2 e #3 \q_stop + { + 0 . + \prg_replicate:nn { -#3 - 1 } { 0 } + #1#2 + } +\cs_new_nopar:Npn \fp_use_large:w #1 . #2 e #3 \q_stop + { + \if_int_compare:w #3 < \c_ten + \exp_after:wN \fp_use_large_aux_i:w + \else: + \exp_after:wN \fp_use_large_aux_ii:w + \fi: + #1#2 e #3 \q_stop + } +\cs_new_nopar:Npn \fp_use_large_aux_i:w #1#2 e #3 \q_stop + { + #1 + \use:c { fp_use_large_aux_ #3 :w } #2 \q_stop + } +\cs_new_nopar:cpn { fp_use_large_aux_1:w } #1#2 \q_stop { #1 . #2 } +\cs_new_nopar:cpn { fp_use_large_aux_2:w } #1#2#3 \q_stop + { #1#2 . #3 } +\cs_new_nopar:cpn { fp_use_large_aux_3:w } #1#2#3#4 \q_stop + { #1#2#3 . #4 } +\cs_new_nopar:cpn { fp_use_large_aux_4:w } #1#2#3#4#5 \q_stop + { #1#2#3#4 . #5 } +\cs_new_nopar:cpn { fp_use_large_aux_5:w } #1#2#3#4#5#6 \q_stop + { #1#2#3#4#5 . #6 } +\cs_new_nopar:cpn { fp_use_large_aux_6:w } #1#2#3#4#5#6#7 \q_stop + { #1#2#3#4#5#6 . #7 } +\cs_new_nopar:cpn { fp_use_large_aux_7:w } #1#2#3#4#5#6#7#8 \q_stop + { #1#2#3#4#6#7 . #8 } +\cs_new_nopar:cpn { fp_use_large_aux_8:w } #1#2#3#4#5#6#7#8#9 \q_stop + { #1#2#3#4#5#6#7#8 . #9 } +\cs_new_nopar:cpn { fp_use_large_aux_9:w } #1 \q_stop { #1 . } +\cs_new_nopar:Npn \fp_use_large_aux_ii:w #1 e #2 \q_stop + { + #1 + \prg_replicate:nn { #2 - 9 } { 0 } + . + } +\cs_new_nopar:Npn \fp_to_dim:N #1 { \fp_use:N #1 pt } +\cs_generate_variant:Nn \fp_to_dim:N { c } +\cs_new_nopar:Npn \fp_to_int:N #1 + { \exp_after:wN \fp_to_int_aux:w #1 \q_stop } +\cs_generate_variant:Nn \fp_to_int:N { c } +\cs_new_nopar:Npn \fp_to_int_aux:w #1#2 e #3 \q_stop + { + \if:w #1 - + - + \fi: + \if_int_compare:w #3 < \c_zero + \exp_after:wN \fp_to_int_small:w + \else: + \exp_after:wN \fp_to_int_large:w + \fi: + #2 e #3 \q_stop + } +\cs_new_nopar:Npn \fp_to_int_small:w #1 . #2 e #3 \q_stop + { + \if_int_compare:w #3 > \c_one + \else: + \if_int_compare:w #1 < \c_five + 0 + \else: + 1 + \fi: + \fi: + } +\cs_new_nopar:Npn \fp_to_int_large:w #1 . #2 e #3 \q_stop + { + \if_int_compare:w #3 < \c_ten + \exp_after:wN \fp_to_int_large_aux_i:w + \else: + \exp_after:wN \fp_to_int_large_aux_ii:w + \fi: + #1#2 e #3 \q_stop + } +\cs_new_nopar:Npn \fp_to_int_large_aux_i:w #1#2 e #3 \q_stop + { \use:c { fp_to_int_large_aux_ #3 :w } #2 \q_stop {#1} } +\cs_new_nopar:cpn { fp_to_int_large_aux_1:w } #1#2 \q_stop + { \fp_to_int_large_aux:nnn { #2 0 } {#1} } +\cs_new_nopar:cpn { fp_to_int_large_aux_2:w } #1#2#3 \q_stop + { \fp_to_int_large_aux:nnn { #3 00 } {#1#2} } +\cs_new_nopar:cpn { fp_to_int_large_aux_3:w } #1#2#3#4 \q_stop + { \fp_to_int_large_aux:nnn { #4 000 } {#1#2#3} } +\cs_new_nopar:cpn { fp_to_int_large_aux_4:w } #1#2#3#4#5 \q_stop + { \fp_to_int_large_aux:nnn { #5 0000 } {#1#2#3#4} } +\cs_new_nopar:cpn { fp_to_int_large_aux_5:w } #1#2#3#4#5#6 \q_stop + { \fp_to_int_large_aux:nnn { #6 00000 } {#1#2#3#4#5} } +\cs_new_nopar:cpn { fp_to_int_large_aux_6:w } #1#2#3#4#5#6#7 \q_stop + { \fp_to_int_large_aux:nnn { #7 000000 } {#1#2#3#4#5#6} } +\cs_new_nopar:cpn { fp_to_int_large_aux_7:w } #1#2#3#4#5#6#7#8 \q_stop + { \fp_to_int_large_aux:nnn { #8 0000000 } {#1#2#3#4#5#6#7} } +\cs_new_nopar:cpn { fp_to_int_large_aux_8:w } #1#2#3#4#5#6#7#8#9 \q_stop + { \fp_to_int_large_aux:nnn { #9 00000000 } {#1#2#3#4#5#6#7#8} } +\cs_new_nopar:cpn { fp_to_int_large_aux_9:w } #1 \q_stop {#1} +\cs_new_nopar:Npn \fp_to_int_large_aux:nnn #1#2#3 + { + \if_int_compare:w #1 < \c_five_hundred_million + #3#2 + \else: + \int_value:w \int_eval:w #3#2 + 1 \int_eval_end: + \fi: + } +\cs_new_nopar:Npn \fp_to_int_large_aux_ii:w #1 e #2 \q_stop + { + #1 + \prg_replicate:nn { #2 - 9 } { 0 } + } +\cs_new_nopar:Npn \fp_to_tl:N #1 + { \exp_after:wN \fp_to_tl_aux:w #1 \q_stop } +\cs_generate_variant:Nn \fp_to_tl:N { c } +\cs_new_nopar:Npn \fp_to_tl_aux:w #1#2 e #3 \q_stop + { + \if:w #1 - + - + \fi: + \if_int_compare:w #3 < \c_zero + \exp_after:wN \fp_to_tl_small:w + \else: + \exp_after:wN \fp_to_tl_large:w + \fi: + #2 e #3 \q_stop + } +\cs_new_nopar:Npn \fp_to_tl_large:w #1 e #2 \q_stop + { + \if_int_compare:w #2 < \c_ten + \exp_after:wN \fp_to_tl_large_aux_i:w + \else: + \exp_after:wN \fp_to_tl_large_aux_ii:w + \fi: + #1 e #2 \q_stop + } +\cs_new_nopar:Npn \fp_to_tl_large_aux_i:w #1 e #2 \q_stop + { \use:c { fp_to_tl_large_ #2 :w } #1 \q_stop } +\cs_new_nopar:Npn \fp_to_tl_large_aux_ii:w #1 . #2 e #3 \q_stop + { + #1 + \fp_to_tl_large_zeros:NNNNNNNNN #2 + e #3 + } +\cs_new_nopar:cpn { fp_to_tl_large_0:w } #1 . #2 \q_stop + { + #1 + \fp_to_tl_large_zeros:NNNNNNNNN #2 + } +\cs_new_nopar:cpn { fp_to_tl_large_1:w } #1 . #2#3 \q_stop + { + #1#2 + \fp_to_tl_large_zeros:NNNNNNNNN #3 0 + } +\cs_new_nopar:cpn { fp_to_tl_large_2:w } #1 . #2#3#4 \q_stop + { + #1#2#3 + \fp_to_tl_large_zeros:NNNNNNNNN #4 00 + } +\cs_new_nopar:cpn { fp_to_tl_large_3:w } #1 . #2#3#4#5 \q_stop + { + #1#2#3#4 + \fp_to_tl_large_zeros:NNNNNNNNN #5 000 + } +\cs_new_nopar:cpn { fp_to_tl_large_4:w } #1 . #2#3#4#5#6 \q_stop + { + #1#2#3#4#5 + \fp_to_tl_large_zeros:NNNNNNNNN #6 0000 + } +\cs_new_nopar:cpn { fp_to_tl_large_5:w } #1 . #2#3#4#5#6#7 \q_stop + { + #1#2#3#4#5#6 + \fp_to_tl_large_zeros:NNNNNNNNN #7 00000 + } +\cs_new_nopar:cpn { fp_to_tl_large_6:w } #1 . #2#3#4#5#6#7#8 \q_stop + { + #1#2#3#4#5#6#7 + \fp_to_tl_large_zeros:NNNNNNNNN #8 000000 + } +\cs_new_nopar:cpn { fp_to_tl_large_7:w } #1 . #2#3#4#5#6#7#8#9 \q_stop + { + #1#2#3#4#5#6#7#8 + \fp_to_tl_large_zeros:NNNNNNNNN #9 0000000 + } +\cs_new_nopar:cpn { fp_to_tl_large_8:w } #1 . + { + #1 + \use:c { fp_to_tl_large_8_aux:w } + } +\cs_new_nopar:cpn { fp_to_tl_large_8_aux:w } #1#2#3#4#5#6#7#8#9 \q_stop + { + #1#2#3#4#5#6#7#8 + \fp_to_tl_large_zeros:NNNNNNNNN #9 00000000 + } +\cs_new_nopar:cpn { fp_to_tl_large_9:w } #1 . #2 \q_stop {#1#2} +\cs_new_nopar:Npn \fp_to_tl_small:w #1 e #2 \q_stop + { + \if_int_compare:w #2 = \c_minus_one + \exp_after:wN \fp_to_tl_small_one:w + \else: + \if_int_compare:w #2 = -\c_two + \exp_after:wN \exp_after:wN \exp_after:wN \fp_to_tl_small_two:w + \else: + \exp_after:wN \exp_after:wN \exp_after:wN \fp_to_tl_small_aux:w + \fi: + \fi: + #1 e #2 \q_stop + } +\cs_new_nopar:Npn \fp_to_tl_small_one:w #1 . #2 e #3 \q_stop + { + \if_int_compare:w \fp_use_ix:NNNNNNNNN #2 > \c_four + \if_int_compare:w + \int_eval:w #1 \fp_use_i_to_iix:NNNNNNNNN #2 + 1 + < \c_one_thousand_million + 0. + \exp_after:wN \fp_to_tl_small_zeros:NNNNNNNNN + \int_value:w \int_eval:w + #1 \fp_use_i_to_iix:NNNNNNNNN #2 + 1 + \int_eval_end: + \else: + 1 + \fi: + \else: + 0. #1 + \fp_to_tl_small_zeros:NNNNNNNNN #2 + \fi: + } +\cs_new_nopar:Npn \fp_to_tl_small_two:w #1 . #2 e #3 \q_stop + { + \if_int_compare:w \fp_use_iix_ix:NNNNNNNNN #2 > \c_forty_four + \if_int_compare:w + \int_eval:w #1 \fp_use_i_to_vii:NNNNNNNNN #2 0 + \c_ten + < \c_one_thousand_million + 0.0 + \exp_after:wN \fp_to_tl_small_zeros:NNNNNNNNN + \int_value:w \int_eval:w + #1 \fp_use_i_to_vii:NNNNNNNNN #2 0 + \c_ten + \int_eval_end: + \else: + 0.1 + \fi: + \else: + 0.0 + #1 + \fp_to_tl_small_zeros:NNNNNNNNN #2 + \fi: + } +\cs_new_nopar:Npn \fp_to_tl_small_aux:w #1 . #2 e #3 \q_stop + { + #1 + \fp_to_tl_large_zeros:NNNNNNNNN #2 + e #3 + } +\cs_new_nopar:Npn \fp_to_tl_large_zeros:NNNNNNNNN #1#2#3#4#5#6#7#8#9 + { + \if_int_compare:w #9 = \c_zero + \if_int_compare:w #8 = \c_zero + \if_int_compare:w #7 = \c_zero + \if_int_compare:w #6 = \c_zero + \if_int_compare:w #5 = \c_zero + \if_int_compare:w #4 = \c_zero + \if_int_compare:w #3 = \c_zero + \if_int_compare:w #2 = \c_zero + \if_int_compare:w #1 = \c_zero + \else: + . #1 + \fi: + \else: + . #1#2 + \fi: + \else: + . #1#2#3 + \fi: + \else: + . #1#2#3#4 + \fi: + \else: + . #1#2#3#4#5 + \fi: + \else: + . #1#2#3#4#5#6 + \fi: + \else: + . #1#2#3#4#5#6#7 + \fi: + \else: + . #1#2#3#4#5#6#7#8 + \fi: + \else: + . #1#2#3#4#5#6#7#8#9 + \fi: + } +\cs_new_nopar:Npn \fp_to_tl_small_zeros:NNNNNNNNN #1#2#3#4#5#6#7#8#9 + { + \if_int_compare:w #9 = \c_zero + \if_int_compare:w #8 = \c_zero + \if_int_compare:w #7 = \c_zero + \if_int_compare:w #6 = \c_zero + \if_int_compare:w #5 = \c_zero + \if_int_compare:w #4 = \c_zero + \if_int_compare:w #3 = \c_zero + \if_int_compare:w #2 = \c_zero + \if_int_compare:w #1 = \c_zero + \else: + #1 + \fi: + \else: + #1#2 + \fi: + \else: + #1#2#3 + \fi: + \else: + #1#2#3#4 + \fi: + \else: + #1#2#3#4#5 + \fi: + \else: + #1#2#3#4#5#6 + \fi: + \else: + #1#2#3#4#5#6#7 + \fi: + \else: + #1#2#3#4#5#6#7#8 + \fi: + \else: + #1#2#3#4#5#6#7#8#9 + \fi: + } +\cs_new_nopar:Npn \fp_use_iix_ix:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {#8#9} +\cs_new_nopar:Npn \fp_use_ix:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {#9} +\cs_new_nopar:Npn \fp_use_i_to_vii:NNNNNNNNN #1#2#3#4#5#6#7#8#9 + {#1#2#3#4#5#6#7} +\cs_new_nopar:Npn \fp_use_i_to_iix:NNNNNNNNN #1#2#3#4#5#6#7#8#9 + {#1#2#3#4#5#6#7#8} +\cs_new_protected_nopar:Npn \fp_round_figures:Nn + { \fp_round_figures_aux:NNn \tl_set:Nn } +\cs_generate_variant:Nn \fp_round_figures:Nn { c } +\cs_new_protected_nopar:Npn \fp_ground_figures:Nn + { \fp_round_figures_aux:NNn \tl_gset:Nn } +\cs_generate_variant:Nn \fp_ground_figures:Nn { c } +\cs_new_protected_nopar:Npn \fp_round_figures_aux:NNn #1#2#3 + { + \group_begin: + \fp_read:N #2 + \int_set:Nn \l_fp_round_target_int { #3 - 1 } + \if_int_compare:w \l_fp_round_target_int < \c_ten + \exp_after:wN \fp_round: + \fi: + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + #1 \exp_not:N #2 + { + \if_int_compare:w \l_fp_input_a_sign_int < \c_zero + - + \else: + + + \fi: + \int_use:N \l_fp_input_a_integer_int + . + \exp_after:wN \use_none:n + \int_use:N \l_fp_input_a_decimal_int + e + \int_use:N \l_fp_input_a_exponent_int + } + } + \fp_tmp:w + } +\cs_new_protected_nopar:Npn \fp_round_places:Nn + { \fp_round_places_aux:NNn \tl_set:Nn } +\cs_generate_variant:Nn \fp_round_places:Nn { c } +\cs_new_protected_nopar:Npn \fp_ground_places:Nn + { \fp_round_places_aux:NNn \tl_gset:Nn } +\cs_generate_variant:Nn \fp_ground_places:Nn { c } +\cs_new_protected_nopar:Npn \fp_round_places_aux:NNn #1#2#3 + { + \group_begin: + \fp_read:N #2 + \int_set:Nn \l_fp_round_target_int + { #3 + \l_fp_input_a_exponent_int } + \if_int_compare:w \l_fp_round_target_int < \c_ten + \exp_after:wN \fp_round: + \fi: + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + #1 \exp_not:N #2 + { + \if_int_compare:w \l_fp_input_a_sign_int < \c_zero + - + \else: + + + \fi: + \int_use:N \l_fp_input_a_integer_int + . + \exp_after:wN \use_none:n + \int_use:N \l_fp_input_a_decimal_int + e + \int_use:N \l_fp_input_a_exponent_int + } + } + \fp_tmp:w + } +\cs_new_protected_nopar:Npn \fp_round: + { + \bool_set_false:N \l_fp_round_carry_bool + \l_fp_round_position_int \c_eight + \tl_clear:N \l_fp_round_decimal_tl + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \exp_after:wN \use_i:nn \exp_after:wN + \fp_round_aux:NNNNNNNNN \int_use:N \l_fp_input_a_decimal_int + } +\cs_new_protected_nopar:Npn \fp_round_aux:NNNNNNNNN #1#2#3#4#5#6#7#8#9 + { + \fp_round_loop:N #9#8#7#6#5#4#3#2#1 + \bool_if:NT \l_fp_round_carry_bool + { \tex_advance:D \l_fp_input_a_integer_int \c_one } + \l_fp_input_a_decimal_int \l_fp_round_decimal_tl \scan_stop: + \if_int_compare:w \l_fp_input_a_integer_int < \c_ten + \else: + \l_fp_input_a_integer_int \c_one + \tex_divide:D \l_fp_input_a_decimal_int \c_ten + \tex_advance:D \l_fp_input_a_exponent_int \c_one + \fi: + } +\cs_new_protected_nopar:Npn \fp_round_loop:N #1 + { + \if_int_compare:w \l_fp_round_position_int < \l_fp_round_target_int + \bool_if:NTF \l_fp_round_carry_bool + { \l_fp_tmp_int \int_eval:w #1 + \c_one \scan_stop: } + { \l_fp_tmp_int \int_eval:w #1 \scan_stop: } + \if_int_compare:w \l_fp_tmp_int = \c_ten + \l_fp_tmp_int \c_zero + \else: + \bool_set_false:N \l_fp_round_carry_bool + \fi: + \tl_set:Nx \l_fp_round_decimal_tl + { \int_use:N \l_fp_tmp_int \l_fp_round_decimal_tl } + \else: + \tl_set:Nx \l_fp_round_decimal_tl { 0 \l_fp_round_decimal_tl } + \if_int_compare:w \l_fp_round_position_int = \l_fp_round_target_int + \if_int_compare:w #1 > \c_four + \bool_set_true:N \l_fp_round_carry_bool + \fi: + \fi: + \fi: + \tex_advance:D \l_fp_round_position_int \c_minus_one + \if_int_compare:w \l_fp_round_position_int > \c_minus_one + \exp_after:wN \fp_round_loop:N + \fi: + } +\cs_new_protected_nopar:Npn \fp_abs:N { \fp_abs_aux:NN \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gabs:N { \fp_abs_aux:NN \tl_gset:Nn } +\cs_generate_variant:Nn \fp_abs:N { c } +\cs_generate_variant:Nn \fp_gabs:N { c } +\cs_new_protected_nopar:Npn \fp_abs_aux:NN #1#2 + { + \group_begin: + \fp_read:N #2 + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + #1 \exp_not:N #2 + { + + + \int_use:N \l_fp_input_a_integer_int + . + \exp_after:wN \use_none:n + \int_use:N \l_fp_input_a_decimal_int + e + \int_use:N \l_fp_input_a_exponent_int + } + } + \fp_tmp:w + } +\cs_new_protected_nopar:Npn \fp_neg:N { \fp_neg_aux:NN \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gneg:N { \fp_neg_aux:NN \tl_gset:Nn } +\cs_generate_variant:Nn \fp_neg:N { c } +\cs_generate_variant:Nn \fp_gneg:N { c } +\cs_new_protected_nopar:Npn \fp_neg_aux:NN #1#2 + { + \group_begin: + \fp_read:N #2 + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \tl_set:Nx \l_fp_tmp_tl + { + \if_int_compare:w \l_fp_input_a_sign_int < \c_zero + + + \else: + - + \fi: + \int_use:N \l_fp_input_a_integer_int + . + \exp_after:wN \use_none:n + \int_use:N \l_fp_input_a_decimal_int + e + \int_use:N \l_fp_input_a_exponent_int + } + \exp_after:wN \group_end: \exp_after:wN + #1 \exp_after:wN #2 \exp_after:wN { \l_fp_tmp_tl } + } +\cs_new_protected_nopar:Npn \fp_add:Nn { \fp_add_aux:NNn \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gadd:Nn { \fp_add_aux:NNn \tl_gset:Nn } +\cs_generate_variant:Nn \fp_add:Nn { c } +\cs_generate_variant:Nn \fp_gadd:Nn { c } +\cs_new_protected_nopar:Npn \fp_add_aux:NNn #1#2#3 + { + \group_begin: + \fp_read:N #2 + \fp_split:Nn b {#3} + \fp_standardise:NNNN + \l_fp_input_b_sign_int + \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int + \l_fp_input_b_exponent_int + \fp_add_core: + \fp_tmp:w #1#2 + } +\cs_new_protected_nopar:Npn \fp_add_core: + { + \fp_level_input_exponents: + \if_int_compare:w + \int_eval:w + \l_fp_input_a_sign_int * \l_fp_input_b_sign_int + > \c_zero + \exp_after:wN \fp_add_sum: + \else: + \exp_after:wN \fp_add_difference: + \fi: + \l_fp_output_exponent_int \l_fp_input_a_exponent_int + \fp_standardise:NNNN + \l_fp_output_sign_int + \l_fp_output_integer_int + \l_fp_output_decimal_int + \l_fp_output_exponent_int + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + ##1 ##2 + { + \if_int_compare:w \l_fp_output_sign_int < \c_zero + - + \else: + + + \fi: + \int_use:N \l_fp_output_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_output_decimal_int + \c_one_thousand_million + e + \int_use:N \l_fp_output_exponent_int + } + } + } +\cs_new_protected_nopar:Npn \fp_add_sum: + { + \l_fp_output_sign_int \l_fp_input_a_sign_int + \l_fp_output_integer_int + \int_eval:w + \l_fp_input_a_integer_int + \l_fp_input_b_integer_int + \scan_stop: + \l_fp_output_decimal_int + \int_eval:w + \l_fp_input_a_decimal_int + \l_fp_input_b_decimal_int + \scan_stop: + \if_int_compare:w \l_fp_output_decimal_int < \c_one_thousand_million + \else: + \tex_advance:D \l_fp_output_integer_int \c_one + \tex_advance:D \l_fp_output_decimal_int -\c_one_thousand_million + \fi: + } +\cs_new_protected_nopar:Npn \fp_add_difference: + { + \l_fp_output_integer_int + \int_eval:w + \l_fp_input_a_integer_int - \l_fp_input_b_integer_int + \scan_stop: + \l_fp_output_decimal_int + \int_eval:w + \l_fp_input_a_decimal_int - \l_fp_input_b_decimal_int + \scan_stop: + \if_int_compare:w \l_fp_output_decimal_int < \c_zero + \tex_advance:D \l_fp_output_integer_int \c_minus_one + \tex_advance:D \l_fp_output_decimal_int \c_one_thousand_million + \fi: + \if_int_compare:w \l_fp_output_integer_int < \c_zero + \l_fp_output_sign_int \l_fp_input_b_sign_int + \if_int_compare:w \l_fp_output_decimal_int = \c_zero + \l_fp_output_integer_int -\l_fp_output_integer_int + \else: + \l_fp_output_decimal_int + \int_eval:w + \c_one_thousand_million - \l_fp_output_decimal_int + \scan_stop: + \l_fp_output_integer_int + \int_eval:w + - \l_fp_output_integer_int - \c_one + \scan_stop: + \fi: + \else: + \l_fp_output_sign_int \l_fp_input_a_sign_int + \fi: + } +\cs_new_protected_nopar:Npn \fp_sub:Nn { \fp_sub_aux:NNn \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gsub:Nn { \fp_sub_aux:NNn \tl_gset:Nn } +\cs_generate_variant:Nn \fp_sub:Nn { c } +\cs_generate_variant:Nn \fp_gsub:Nn { c } +\cs_new_protected_nopar:Npn \fp_sub_aux:NNn #1#2#3 + { + \group_begin: + \fp_read:N #2 + \fp_split:Nn b {#3} + \fp_standardise:NNNN + \l_fp_input_b_sign_int + \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int + \l_fp_input_b_exponent_int + \tex_multiply:D \l_fp_input_b_sign_int \c_minus_one + \fp_add_core: + \fp_tmp:w #1#2 + } +\cs_new_protected_nopar:Npn \fp_mul:Nn { \fp_mul_aux:NNn \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gmul:Nn { \fp_mul_aux:NNn \tl_gset:Nn } +\cs_generate_variant:Nn \fp_mul:Nn { c } +\cs_generate_variant:Nn \fp_gmul:Nn { c } +\cs_new_protected_nopar:Npn \fp_mul_aux:NNn #1#2#3 + { + \group_begin: + \fp_read:N #2 + \fp_split:Nn b {#3} + \fp_standardise:NNNN + \l_fp_input_b_sign_int + \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int + \l_fp_input_b_exponent_int + \fp_mul_internal: + \l_fp_output_exponent_int + \int_eval:w + \l_fp_input_a_exponent_int + \l_fp_input_b_exponent_int + \scan_stop: + \fp_standardise:NNNN + \l_fp_output_sign_int + \l_fp_output_integer_int + \l_fp_output_decimal_int + \l_fp_output_exponent_int + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + #1 \exp_not:N #2 + { + \if_int_compare:w + \int_eval:w + \l_fp_input_a_sign_int * \l_fp_input_b_sign_int + < \c_zero + \if_int_compare:w + \int_eval:w + \l_fp_output_integer_int + \l_fp_output_decimal_int + = \c_zero + + + \else: + - + \fi: + \else: + + + \fi: + \int_use:N \l_fp_output_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_output_decimal_int + \c_one_thousand_million + e + \int_use:N \l_fp_output_exponent_int + } + } + \fp_tmp:w + } +\cs_new_protected_nopar:Npn \fp_mul_internal: + { + \fp_mul_split:NNNN \l_fp_input_a_decimal_int + \l_fp_mul_a_i_int \l_fp_mul_a_ii_int \l_fp_mul_a_iii_int + \fp_mul_split:NNNN \l_fp_input_b_decimal_int + \l_fp_mul_b_i_int \l_fp_mul_b_ii_int \l_fp_mul_b_iii_int + \l_fp_mul_output_int \c_zero + \tl_clear:N \l_fp_mul_output_tl + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iii_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_i_int + \tex_divide:D \l_fp_mul_output_int \c_one_thousand + \fp_mul_product:NN \l_fp_input_a_integer_int \l_fp_mul_b_iii_int + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_i_int + \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_input_b_integer_int + \fp_mul_end_level: + \fp_mul_product:NN \l_fp_input_a_integer_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_i_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_input_b_integer_int + \fp_mul_end_level: + \fp_mul_product:NN \l_fp_input_a_integer_int \l_fp_mul_b_i_int + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_input_b_integer_int + \fp_mul_end_level: + \l_fp_output_decimal_int 0 \l_fp_mul_output_tl \scan_stop: + \tl_clear:N \l_fp_mul_output_tl + \fp_mul_product:NN \l_fp_input_a_integer_int \l_fp_input_b_integer_int + \fp_mul_end_level: + \l_fp_output_integer_int 0 \l_fp_mul_output_tl \scan_stop: + } +\cs_new_protected_nopar:Npn \fp_mul_split:NNNN #1#2#3#4 + { + \tex_advance:D #1 \c_one_thousand_million + \cs_set_protected_nopar:Npn \fp_mul_split_aux:w + ##1##2##3##4##5##6##7##8##9 \q_stop { + #2 ##2##3##4 \scan_stop: + #3 ##5##6##7 \scan_stop: + #4 ##8##9 \scan_stop: + } + \exp_after:wN \fp_mul_split_aux:w \int_use:N #1 \q_stop + \tex_advance:D #1 -\c_one_thousand_million + } +\cs_new_protected_nopar:Npn \fp_mul_product:NN #1#2 + { + \l_fp_mul_output_int + \int_eval:w \l_fp_mul_output_int + #1 * #2 \scan_stop: + } +\cs_new_protected_nopar:Npn \fp_mul_end_level: + { + \tex_advance:D \l_fp_mul_output_int \c_one_thousand_million + \exp_after:wN \use_i:nn \exp_after:wN + \fp_mul_end_level:NNNNNNNNN \int_use:N \l_fp_mul_output_int + } +\cs_new_protected_nopar:Npn \fp_mul_end_level:NNNNNNNNN #1#2#3#4#5#6#7#8#9 + { + \tl_set:Nx \l_fp_mul_output_tl { #7#8#9 \l_fp_mul_output_tl } + \l_fp_mul_output_int #1#2#3#4#5#6 \scan_stop: + } +\cs_new_protected_nopar:Npn \fp_div:Nn { \fp_div_aux:NNn \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gdiv:Nn { \fp_div_aux:NNn \tl_gset:Nn } +\cs_generate_variant:Nn \fp_div:Nn { c } +\cs_generate_variant:Nn \fp_gdiv:Nn { c } +\cs_new_protected_nopar:Npn \fp_div_aux:NNn #1#2#3 + { + \group_begin: + \fp_read:N #2 + \fp_split:Nn b {#3} + \fp_standardise:NNNN + \l_fp_input_b_sign_int + \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int + \l_fp_input_b_exponent_int + \if_int_compare:w + \int_eval:w + \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int + = \c_zero + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + #1 \exp_not:N #2 { \c_undefined_fp } + } + \else: + \if_int_compare:w + \int_eval:w + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + = \c_zero + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + #1 \exp_not:N #2 { \c_zero_fp } + } + \else: + \exp_after:wN \exp_after:wN \exp_after:wN \fp_div_internal: + \fi: + \fi: + \fp_tmp:w #1#2 + } +\cs_new_protected_nopar:Npn \fp_div_internal: { + \l_fp_output_integer_int \c_zero + \l_fp_output_decimal_int \c_zero + \cs_set_eq:NN \fp_div_store: \fp_div_store_integer: + \l_fp_div_offset_int \c_one_hundred_million + \fp_div_loop: + \l_fp_output_exponent_int + \int_eval:w + \l_fp_input_a_exponent_int - \l_fp_input_b_exponent_int + \scan_stop: + \fp_standardise:NNNN + \l_fp_output_sign_int + \l_fp_output_integer_int + \l_fp_output_decimal_int + \l_fp_output_exponent_int + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + ##1 ##2 + { + \if_int_compare:w + \int_eval:w + \l_fp_input_a_sign_int * \l_fp_input_b_sign_int + < \c_zero + \if_int_compare:w + \int_eval:w + \l_fp_output_integer_int + \l_fp_output_decimal_int + = \c_zero + + + \else: + - + \fi: + \else: + + + \fi: + \int_use:N \l_fp_output_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_output_decimal_int + \c_one_thousand_million + \int_eval_end: + e + \int_use:N \l_fp_output_exponent_int + } + } +} +\cs_new_protected_nopar:Npn \fp_div_loop: + { + \l_fp_count_int \c_zero + \fp_div_divide: + \fp_div_store: + \tex_multiply:D \l_fp_input_a_integer_int \c_ten + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \exp_after:wN \fp_div_loop_step:w + \int_use:N \l_fp_input_a_decimal_int \q_stop + \if_int_compare:w + \int_eval:w \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + > \c_zero + \if_int_compare:w \l_fp_div_offset_int > \c_zero + \exp_after:wN \exp_after:wN \exp_after:wN + \fp_div_loop: + \fi: + \fi: + } +\cs_new_protected_nopar:Npn \fp_div_divide: + { + \if_int_compare:w \l_fp_input_a_integer_int > \l_fp_input_b_integer_int + \exp_after:wN \fp_div_divide_aux: + \else: + \if_int_compare:w \l_fp_input_a_integer_int < \l_fp_input_b_integer_int + \else: + \if_int_compare:w + \l_fp_input_a_decimal_int < \l_fp_input_b_decimal_int + \else: + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \fp_div_divide_aux: + \fi: + \fi: + \fi: + } +\cs_new_protected_nopar:Npn \fp_div_divide_aux: + { + \tex_advance:D \l_fp_count_int \c_one + \tex_advance:D \l_fp_input_a_integer_int -\l_fp_input_b_integer_int + \tex_advance:D \l_fp_input_a_decimal_int -\l_fp_input_b_decimal_int + \if_int_compare:w \l_fp_input_a_decimal_int < \c_zero + \tex_advance:D \l_fp_input_a_integer_int \c_minus_one + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \fi: + \fp_div_divide: + } +\cs_new_protected_nopar:Npn \fp_div_store: { } +\cs_new_protected_nopar:Npn \fp_div_store_integer: + { + \l_fp_output_integer_int \l_fp_count_int + \cs_set_eq:NN \fp_div_store: \fp_div_store_decimal: + } +\cs_new_protected_nopar:Npn \fp_div_store_decimal: + { + \l_fp_output_decimal_int + \int_eval:w + \l_fp_output_decimal_int + + \l_fp_count_int * \l_fp_div_offset_int + \int_eval_end: + \tex_divide:D \l_fp_div_offset_int \c_ten + } +\cs_new_protected_nopar:Npn \fp_div_loop_step:w #1#2#3#4#5#6#7#8#9 \q_stop + { + \l_fp_input_a_integer_int + \int_eval:w #2 + \l_fp_input_a_integer_int \int_eval_end: + \l_fp_input_a_decimal_int #3#4#5#6#7#8#9 0 \scan_stop: + } +\cs_new_protected_nopar:Npn \fp_add:NNNNNNNNN #1#2#3#4#5#6#7#8#9 + { + #7 \int_eval:w #1 + #4 \int_eval_end: + #8 \int_eval:w #2 + #5 \int_eval_end: + #9 \int_eval:w #3 + #6 \int_eval_end: + \if_int_compare:w #9 < \c_one_thousand_million + \else: + \tex_advance:D #8 \c_one + \tex_advance:D #9 -\c_one_thousand_million + \fi: + \if_int_compare:w #8 < \c_one_thousand_million + \else: + \tex_advance:D #7 \c_one + \tex_advance:D #8 -\c_one_thousand_million + \fi: + } +\cs_new_protected_nopar:Npn \fp_sub:NNNNNNNNN #1#2#3#4#5#6#7#8#9 + { + #7 \int_eval:w #1 - #4 \int_eval_end: + #8 \int_eval:w #2 - #5 \int_eval_end: + #9 \int_eval:w #3 - #6 \int_eval_end: + \if_int_compare:w #9 < \c_zero + \tex_advance:D #8 \c_minus_one + \tex_advance:D #9 \c_one_thousand_million + \fi: + \if_int_compare:w #8 < \c_zero + \tex_advance:D #7 \c_minus_one + \tex_advance:D #8 \c_one_thousand_million + \fi: + \if_int_compare:w #7 < \c_zero + \if_int_compare:w \int_eval:w #8 + #9 = \c_zero + #7 -#7 + \else: + \tex_advance:D #7 \c_one + #8 \int_eval:w \c_one_thousand_million - #8 \int_eval_end: + #9 \int_eval:w \c_one_thousand_million - #9 \int_eval_end: + \fi: + \fi: + } +\cs_new_protected_nopar:Npn \fp_mul:NNNNNN #1#2#3#4#5#6 + { + \fp_mul_split:NNNN #1 + \l_fp_mul_a_i_int \l_fp_mul_a_ii_int \l_fp_mul_a_iii_int + \fp_mul_split:NNNN #2 + \l_fp_mul_a_iv_int \l_fp_mul_a_v_int \l_fp_mul_a_vi_int + \fp_mul_split:NNNN #3 + \l_fp_mul_b_i_int \l_fp_mul_b_ii_int \l_fp_mul_b_iii_int + \fp_mul_split:NNNN #4 + \l_fp_mul_b_iv_int \l_fp_mul_b_v_int \l_fp_mul_b_vi_int + \l_fp_mul_output_int \c_zero + \tl_clear:N \l_fp_mul_output_tl + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_vi_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_v_int + \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_iv_int + \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_iii_int + \fp_mul_product:NN \l_fp_mul_a_v_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_vi_int \l_fp_mul_b_i_int + \tex_divide:D \l_fp_mul_output_int \c_one_thousand + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_v_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_iv_int + \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_iii_int + \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_v_int \l_fp_mul_b_i_int + \fp_mul_end_level: + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iv_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_iii_int + \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_i_int + \fp_mul_end_level: + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iii_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_i_int + \fp_mul_end_level: + #6 0 \l_fp_mul_output_tl \scan_stop: + \tl_clear:N \l_fp_mul_output_tl + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_i_int + \fp_mul_end_level: + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_i_int + \fp_mul_end_level: + \fp_mul_end_level: + #5 0 \l_fp_mul_output_tl \scan_stop: + } +\cs_new_protected_nopar:Npn \fp_mul:NNNNNNNNN #1#2#3#4#5#6#7#8#9 + { + \fp_mul_split:NNNN #2 + \l_fp_mul_a_i_int \l_fp_mul_a_ii_int \l_fp_mul_a_iii_int + \fp_mul_split:NNNN #3 + \l_fp_mul_a_iv_int \l_fp_mul_a_v_int \l_fp_mul_a_vi_int + \fp_mul_split:NNNN #5 + \l_fp_mul_b_i_int \l_fp_mul_b_ii_int \l_fp_mul_b_iii_int + \fp_mul_split:NNNN #6 + \l_fp_mul_b_iv_int \l_fp_mul_b_v_int \l_fp_mul_b_vi_int + \l_fp_mul_output_int \c_zero + \tl_clear:N \l_fp_mul_output_tl + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_vi_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_v_int + \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_iv_int + \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_iii_int + \fp_mul_product:NN \l_fp_mul_a_v_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_vi_int \l_fp_mul_b_i_int + \tex_divide:D \l_fp_mul_output_int \c_one_thousand + \fp_mul_product:NN #1 \l_fp_mul_b_vi_int + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_v_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_iv_int + \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_iii_int + \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_v_int \l_fp_mul_b_i_int + \fp_mul_product:NN \l_fp_mul_a_vi_int #4 + \fp_mul_end_level: + \fp_mul_product:NN #1 \l_fp_mul_b_v_int + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iv_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_iii_int + \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_i_int + \fp_mul_product:NN \l_fp_mul_a_v_int #4 + \fp_mul_end_level: + \fp_mul_product:NN #1 \l_fp_mul_b_iv_int + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iii_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_i_int + \fp_mul_product:NN \l_fp_mul_a_iv_int #4 + \fp_mul_end_level: + #9 0 \l_fp_mul_output_tl \scan_stop: + \tl_clear:N \l_fp_mul_output_tl + \fp_mul_product:NN #1 \l_fp_mul_b_iii_int + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_i_int + \fp_mul_product:NN \l_fp_mul_a_iii_int #4 + \fp_mul_end_level: + \fp_mul_product:NN #1 \l_fp_mul_b_ii_int + \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_i_int + \fp_mul_product:NN \l_fp_mul_a_ii_int #4 + \fp_mul_end_level: + \fp_mul_product:NN #1 \l_fp_mul_b_i_int + \fp_mul_product:NN \l_fp_mul_a_i_int #4 + \fp_mul_end_level: + #8 0 \l_fp_mul_output_tl \scan_stop: + \tl_clear:N \l_fp_mul_output_tl + \fp_mul_product:NN #1 #4 + \fp_mul_end_level: + #7 0 \l_fp_mul_output_tl \scan_stop: + } +\cs_new_protected_nopar:Npn \fp_div_integer:NNNNN #1#2#3#4#5 + { + \l_fp_tmp_int #1 + \tex_divide:D \l_fp_tmp_int #3 + \l_fp_tmp_int \int_eval:w #1 - \l_fp_tmp_int * #3 \int_eval_end: + #4 #1 + \tex_divide:D #4 #3 + #5 #2 + \tex_divide:D #5 #3 + \tex_multiply:D \l_fp_tmp_int \c_one_thousand + \tex_divide:D \l_fp_tmp_int #3 + #5 \int_eval:w #5 + \l_fp_tmp_int * \c_one_million \int_eval_end: + \if_int_compare:w #5 > \c_one_thousand_million + \tex_advance:D #4 \c_one + \tex_advance:D #5 -\c_one_thousand_million + \fi: + } +\cs_new_protected_nopar:Npn \fp_extended_normalise: + { + \fp_extended_normalise_aux_i: + \fp_extended_normalise_aux_ii: + } +\cs_new_protected_nopar:Npn \fp_extended_normalise_aux_i: + { + \if_int_compare:w \l_fp_input_a_exponent_int > \c_zero + \tex_multiply:D \l_fp_input_a_integer_int \c_ten + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \exp_after:wN \fp_extended_normalise_aux_i:w + \int_use:N \l_fp_input_a_decimal_int \q_stop + \exp_after:wN \fp_extended_normalise_aux_i: + \fi: + } +\cs_new_protected_nopar:Npn \fp_extended_normalise_aux_i:w + #1#2#3#4#5#6#7#8#9 \q_stop + { + \l_fp_input_a_integer_int + \int_eval:w \l_fp_input_a_integer_int + #2 \scan_stop: + \l_fp_input_a_decimal_int #3#4#5#6#7#8#9 0 \scan_stop: + \tex_advance:D \l_fp_input_a_extended_int \c_one_thousand_million + \exp_after:wN \fp_extended_normalise_aux_ii:w + \int_use:N \l_fp_input_a_extended_int \q_stop + } +\cs_new_protected_nopar:Npn \fp_extended_normalise_aux_ii:w + #1#2#3#4#5#6#7#8#9 \q_stop + { + \l_fp_input_a_decimal_int + \int_eval:w \l_fp_input_a_decimal_int + #2 \scan_stop: + \l_fp_input_a_extended_int #3#4#5#6#7#8#9 0 \scan_stop: + \tex_advance:D \l_fp_input_a_exponent_int \c_minus_one + } +\cs_new_protected_nopar:Npn \fp_extended_normalise_aux_ii: + { + \if_int_compare:w \l_fp_input_a_exponent_int < \c_zero + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \exp_after:wN \use_i:nn \exp_after:wN + \fp_extended_normalise_ii_aux:NNNNNNNNN + \int_use:N \l_fp_input_a_decimal_int + \exp_after:wN \fp_extended_normalise_aux_ii: + \fi: + } +\cs_new_protected_nopar:Npn \fp_extended_normalise_ii_aux:NNNNNNNNN + #1#2#3#4#5#6#7#8#9 + { + \if_int_compare:w \l_fp_input_a_integer_int = \c_zero + \l_fp_input_a_decimal_int #1#2#3#4#5#6#7#8 \scan_stop: + \else: + \tl_set:Nx \l_fp_tmp_tl + { + \int_use:N \l_fp_input_a_integer_int + #1#2#3#4#5#6#7#8 + } + \l_fp_input_a_integer_int \c_zero + \l_fp_input_a_decimal_int \l_fp_tmp_tl \scan_stop: + \fi: + \tex_divide:D \l_fp_input_a_extended_int \c_ten + \tl_set:Nx \l_fp_tmp_tl + { + #9 + \int_use:N \l_fp_input_a_extended_int + } + \l_fp_input_a_extended_int \l_fp_tmp_tl \scan_stop: + \tex_advance:D \l_fp_input_a_exponent_int \c_one + } +\cs_new_protected_nopar:Npn \fp_extended_normalise_output: + { + \if_int_compare:w \l_fp_output_integer_int > \c_nine + \tex_advance:D \l_fp_output_integer_int \c_one_thousand_million + \exp_after:wN \use_i:nn \exp_after:wN + \fp_extended_normalise_output_aux_i:NNNNNNNNN + \int_use:N \l_fp_output_integer_int + \exp_after:wN \fp_extended_normalise_output: + \fi: + } +\cs_new_protected_nopar:Npn \fp_extended_normalise_output_aux_i:NNNNNNNNN + #1#2#3#4#5#6#7#8#9 + { + \l_fp_output_integer_int #1#2#3#4#5#6#7#8 \scan_stop: + \tex_advance:D \l_fp_output_decimal_int \c_one_thousand_million + \tl_set:Nx \l_fp_tmp_tl + { + #9 + \exp_after:wN \use_none:n + \int_use:N \l_fp_output_decimal_int + } + \exp_after:wN \fp_extended_normalise_output_aux_ii:NNNNNNNNN + \l_fp_tmp_tl + } +\cs_new_protected_nopar:Npn \fp_extended_normalise_output_aux_ii:NNNNNNNNN + #1#2#3#4#5#6#7#8#9 + { + \l_fp_output_decimal_int #1#2#3#4#5#6#7#8#9 \scan_stop: + \fp_extended_normalise_output_aux:N + } +\cs_new_protected_nopar:Npn \fp_extended_normalise_output_aux:N #1 + { + \tex_advance:D \l_fp_output_extended_int \c_one_thousand_million + \tex_divide:D \l_fp_output_extended_int \c_ten + \tl_set:Nx \l_fp_tmp_tl + { + #1 + \exp_after:wN \use_none:n + \int_use:N \l_fp_output_extended_int + } + \l_fp_output_extended_int \l_fp_tmp_tl \scan_stop: + \tex_advance:D \l_fp_output_exponent_int \c_one + } +\cs_new_protected_nopar:Npn \fp_trig_normalise: + { + \if_int_compare:w \l_fp_input_a_exponent_int < \c_ten + \l_fp_input_a_extended_int \c_zero + \fp_extended_normalise: + \fp_trig_normalise_aux: + \if_int_compare:w \l_fp_input_a_integer_int < \c_zero + \l_fp_input_a_sign_int -\l_fp_input_a_sign_int + \l_fp_input_a_integer_int -\l_fp_input_a_integer_int + \fi: + \exp_after:wN \fp_trig_octant: + \else: + \l_fp_input_a_sign_int \c_one + \l_fp_output_integer_int \c_zero + \l_fp_output_decimal_int \c_zero + \l_fp_output_exponent_int \c_zero + \exp_after:wN \fp_trig_overflow_msg: + \fi: + } +\cs_new_protected_nopar:Npn \fp_trig_normalise_aux: + { + \if_int_compare:w \l_fp_input_a_integer_int > \c_three + \fp_trig_sub:NNN + \c_six \c_fp_two_pi_decimal_int \c_fp_two_pi_extended_int + \exp_after:wN \fp_trig_normalise_aux: + \else: + \if_int_compare:w \l_fp_input_a_integer_int > \c_two + \if_int_compare:w \l_fp_input_a_decimal_int > \c_fp_pi_decimal_int + \fp_trig_sub:NNN + \c_six \c_fp_two_pi_decimal_int \c_fp_two_pi_extended_int + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \fp_trig_normalise_aux: + \fi: + \fi: + \fi: + } +\cs_new_protected_nopar:Npn \fp_trig_sub:NNN #1#2#3 + { + \l_fp_input_a_integer_int + \int_eval:w \l_fp_input_a_integer_int - #1 \int_eval_end: + \l_fp_input_a_decimal_int + \int_eval:w \l_fp_input_a_decimal_int - #2 \int_eval_end: + \l_fp_input_a_extended_int + \int_eval:w \l_fp_input_a_extended_int - #3 \int_eval_end: + \if_int_compare:w \l_fp_input_a_extended_int < \c_zero + \tex_advance:D \l_fp_input_a_decimal_int \c_minus_one + \tex_advance:D \l_fp_input_a_extended_int \c_one_thousand_million + \fi: + \if_int_compare:w \l_fp_input_a_decimal_int < \c_zero + \tex_advance:D \l_fp_input_a_integer_int \c_minus_one + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \fi: + \if_int_compare:w \l_fp_input_a_integer_int < \c_zero + \l_fp_input_a_sign_int -\l_fp_input_a_sign_int + \if_int_compare:w + \int_eval:w + \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int + = \c_zero + \l_fp_input_a_integer_int -\l_fp_input_a_integer_int + \else: + \l_fp_input_a_integer_int + \int_eval:w + - \l_fp_input_a_integer_int - \c_one + \int_eval_end: + \l_fp_input_a_decimal_int + \int_eval:w + \c_one_thousand_million - \l_fp_input_a_decimal_int + \int_eval_end: + \l_fp_input_a_extended_int + \int_eval:w + \c_one_thousand_million - \l_fp_input_a_extended_int + \int_eval_end: + \fi: + \fi: + } +\cs_new_protected_nopar:Npn \fp_trig_octant: + { + \l_fp_trig_octant_int \c_one + \fp_trig_octant_aux: + \if_int_compare:w \l_fp_input_a_decimal_int < \c_ten + \l_fp_input_a_decimal_int \c_zero + \l_fp_input_a_extended_int \c_zero + \fi: + \if_int_odd:w \l_fp_trig_octant_int + \else: + \fp_sub:NNNNNNNNN + \c_zero \c_fp_pi_by_four_decimal_int \c_fp_pi_by_four_extended_int + \l_fp_input_a_integer_int \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int + \l_fp_input_a_integer_int \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int + \fi: + } +\cs_new_protected_nopar:Npn \fp_trig_octant_aux: + { + \if_int_compare:w \l_fp_input_a_integer_int > \c_zero + \fp_sub:NNNNNNNNN + \l_fp_input_a_integer_int \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int + \c_zero \c_fp_pi_by_four_decimal_int \c_fp_pi_by_four_extended_int + \l_fp_input_a_integer_int \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int + \tex_advance:D \l_fp_trig_octant_int \c_one + \exp_after:wN \fp_trig_octant_aux: + \else: + \if_int_compare:w + \l_fp_input_a_decimal_int > \c_fp_pi_by_four_decimal_int + \fp_sub:NNNNNNNNN + \l_fp_input_a_integer_int \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int + \c_zero \c_fp_pi_by_four_decimal_int + \c_fp_pi_by_four_extended_int + \l_fp_input_a_integer_int \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int + \tex_advance:D \l_fp_trig_octant_int \c_one + \exp_after:wN \exp_after:wN \exp_after:wN + \fp_trig_octant_aux: + \fi: + \fi: + } +\cs_new_protected_nopar:Npn \fp_sin:Nn { \fp_sin_aux:NNn \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gsin:Nn { \fp_sin_aux:NNn \tl_gset:Nn } +\cs_generate_variant:Nn \fp_sin:Nn { c } +\cs_generate_variant:Nn \fp_gsin:Nn { c } +\cs_new_protected_nopar:Npn \fp_sin_aux:NNn #1#2#3 + { + \group_begin: + \fp_split:Nn a {#3} + \fp_standardise:NNNN + \l_fp_input_a_sign_int + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + \l_fp_input_a_exponent_int + \tl_set:Nx \l_fp_arg_tl + { + \if_int_compare:w \l_fp_input_a_sign_int < \c_zero + - + \else: + + + \fi: + \int_use:N \l_fp_input_a_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_input_a_decimal_int + \c_one_thousand_million + e + \int_use:N \l_fp_input_a_exponent_int + } + \if_int_compare:w \l_fp_input_a_exponent_int < -\c_five + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + #1 \exp_not:N #2 { \l_fp_arg_tl } + } + \else: + \if_cs_exist:w + c_fp_sin ( \l_fp_arg_tl ) _fp + \cs_end: + \else: + \exp_after:wN \exp_after:wN \exp_after:wN + \fp_sin_aux_i: + \fi: + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + #1 \exp_not:N #2 + { \use:c { c_fp_sin ( \l_fp_arg_tl ) _fp } } + } + \fi: + \fp_tmp:w + } +\cs_new_protected_nopar:Npn \fp_sin_aux_i: + { + \fp_trig_normalise: + \fp_sin_aux_ii: + \if_int_compare:w \l_fp_output_integer_int = \c_one + \l_fp_output_exponent_int \c_zero + \else: + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_decimal_int \l_fp_output_extended_int + \l_fp_output_exponent_int -\c_nine + \fi: + \fp_standardise:NNNN + \l_fp_input_a_sign_int + \l_fp_output_integer_int + \l_fp_output_decimal_int + \l_fp_output_exponent_int + \tl_new:c { c_fp_sin ( \l_fp_arg_tl ) _fp } + \tl_gset:cx { c_fp_sin ( \l_fp_arg_tl ) _fp } + { + \if_int_compare:w \l_fp_input_a_sign_int > \c_zero + + + \else: + - + \fi: + \int_use:N \l_fp_output_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_output_decimal_int + \c_one_thousand_million + e + \int_use:N \l_fp_output_exponent_int + } + } +\cs_new_protected_nopar:Npn \fp_sin_aux_ii: + { + \if_case:w \l_fp_trig_octant_int + \or: + \exp_after:wN \fp_trig_calc_sin: + \or: + \exp_after:wN \fp_trig_calc_cos: + \or: + \exp_after:wN \fp_trig_calc_cos: + \or: + \exp_after:wN \fp_trig_calc_sin: + \fi: + } +\cs_new_protected_nopar:Npn \fp_cos:Nn { \fp_cos_aux:NNn \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gcos:Nn { \fp_cos_aux:NNn \tl_gset:Nn } +\cs_generate_variant:Nn \fp_cos:Nn { c } +\cs_generate_variant:Nn \fp_gcos:Nn { c } +\cs_new_protected_nopar:Npn \fp_cos_aux:NNn #1#2#3 + { + \group_begin: + \fp_split:Nn a {#3} + \fp_standardise:NNNN + \l_fp_input_a_sign_int + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + \l_fp_input_a_exponent_int + \tl_set:Nx \l_fp_arg_tl + { + \if_int_compare:w \l_fp_input_a_sign_int < \c_zero + - + \else: + + + \fi: + \int_use:N \l_fp_input_a_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_input_a_decimal_int + \c_one_thousand_million + e + \int_use:N \l_fp_input_a_exponent_int + } + \if_cs_exist:w c_fp_cos ( \l_fp_arg_tl ) _fp \cs_end: + \else: + \exp_after:wN \fp_cos_aux_i: + \fi: + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + #1 \exp_not:N #2 + { \use:c { c_fp_cos ( \l_fp_arg_tl ) _fp } } + } + \fp_tmp:w + } +\cs_new_protected_nopar:Npn \fp_cos_aux_i: + { + \fp_trig_normalise: + \fp_cos_aux_ii: + \if_int_compare:w \l_fp_output_integer_int = \c_one + \l_fp_output_exponent_int \c_zero + \else: + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_decimal_int \l_fp_output_extended_int + \l_fp_output_exponent_int -\c_nine + \fi: + \fp_standardise:NNNN + \l_fp_input_a_sign_int + \l_fp_output_integer_int + \l_fp_output_decimal_int + \l_fp_output_exponent_int + \tl_new:c { c_fp_cos ( \l_fp_arg_tl ) _fp } + \tl_gset:cx { c_fp_cos ( \l_fp_arg_tl ) _fp } + { + \if_int_compare:w \l_fp_input_a_sign_int > \c_zero + + + \else: + - + \fi: + \int_use:N \l_fp_output_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_output_decimal_int + \c_one_thousand_million + e + \int_use:N \l_fp_output_exponent_int + } + } +\cs_new_protected_nopar:Npn \fp_cos_aux_ii: + { + \if_case:w \l_fp_trig_octant_int + \or: + \exp_after:wN \fp_trig_calc_cos: + \or: + \exp_after:wN \fp_trig_calc_sin: + \or: + \exp_after:wN \fp_trig_calc_sin: + \or: + \exp_after:wN \fp_trig_calc_cos: + \fi: + \if_int_compare:w \l_fp_input_a_sign_int > \c_zero + \if_int_compare:w \l_fp_trig_octant_int > \c_two + \l_fp_input_a_sign_int \c_minus_one + \fi: + \else: + \if_int_compare:w \l_fp_trig_octant_int > \c_two + \else: + \l_fp_input_a_sign_int \c_one + \fi: + \fi: + } +\cs_new_protected_nopar:Npn \fp_trig_calc_cos: + { + \if_int_compare:w \l_fp_input_a_decimal_int = \c_zero + \l_fp_output_integer_int \c_one + \l_fp_output_decimal_int \c_zero + \else: + \l_fp_trig_sign_int \c_minus_one + \fp_mul:NNNNNN + \l_fp_input_a_decimal_int \l_fp_input_a_extended_int + \l_fp_input_a_decimal_int \l_fp_input_a_extended_int + \l_fp_trig_decimal_int \l_fp_trig_extended_int + \fp_div_integer:NNNNN + \l_fp_trig_decimal_int \l_fp_trig_extended_int + \c_two + \l_fp_trig_decimal_int \l_fp_trig_extended_int + \l_fp_count_int \c_three + \if_int_compare:w \l_fp_trig_extended_int = \c_zero + \if_int_compare:w \l_fp_trig_decimal_int = \c_zero + \l_fp_output_integer_int \c_one + \l_fp_output_decimal_int \c_zero + \l_fp_output_extended_int \c_zero + \else: + \l_fp_output_integer_int \c_zero + \l_fp_output_decimal_int \c_one_thousand_million + \l_fp_output_extended_int \c_zero + \fi: + \else: + \l_fp_output_integer_int \c_zero + \l_fp_output_decimal_int 999999999 \scan_stop: + \l_fp_output_extended_int \c_one_thousand_million + \fi: + \tex_advance:D \l_fp_output_extended_int -\l_fp_trig_extended_int + \tex_advance:D \l_fp_output_decimal_int -\l_fp_trig_decimal_int + \exp_after:wN \fp_trig_calc_Taylor: + \fi: + } +\cs_new_protected_nopar:Npn \fp_trig_calc_sin: + { + \l_fp_output_integer_int \c_zero + \if_int_compare:w \l_fp_input_a_decimal_int = \c_zero + \l_fp_output_decimal_int \c_zero + \else: + \l_fp_output_decimal_int \l_fp_input_a_decimal_int + \l_fp_output_extended_int \l_fp_input_a_extended_int + \l_fp_trig_sign_int \c_one + \l_fp_trig_decimal_int \l_fp_input_a_decimal_int + \l_fp_trig_extended_int \l_fp_input_a_extended_int + \l_fp_count_int \c_two + \exp_after:wN \fp_trig_calc_Taylor: + \fi: + } +\cs_new_protected_nopar:Npn \fp_trig_calc_Taylor: + { + \l_fp_trig_sign_int -\l_fp_trig_sign_int + \fp_mul:NNNNNN + \l_fp_trig_decimal_int \l_fp_trig_extended_int + \l_fp_input_a_decimal_int \l_fp_input_a_extended_int + \l_fp_trig_decimal_int \l_fp_trig_extended_int + \fp_mul:NNNNNN + \l_fp_trig_decimal_int \l_fp_trig_extended_int + \l_fp_input_a_decimal_int \l_fp_input_a_extended_int + \l_fp_trig_decimal_int \l_fp_trig_extended_int + \fp_div_integer:NNNNN + \l_fp_trig_decimal_int \l_fp_trig_extended_int + \l_fp_count_int + \l_fp_trig_decimal_int \l_fp_trig_extended_int + \tex_advance:D \l_fp_count_int \c_one + \fp_div_integer:NNNNN + \l_fp_trig_decimal_int \l_fp_trig_extended_int + \l_fp_count_int + \l_fp_trig_decimal_int \l_fp_trig_extended_int + \tex_advance:D \l_fp_count_int \c_one + \if_int_compare:w \l_fp_trig_decimal_int > \c_zero + \if_int_compare:w \l_fp_trig_sign_int > \c_zero + \tex_advance:D \l_fp_output_decimal_int \l_fp_trig_decimal_int + \tex_advance:D \l_fp_output_extended_int + \l_fp_trig_extended_int + \if_int_compare:w \l_fp_output_extended_int < \c_one_thousand_million + \else: + \tex_advance:D \l_fp_output_decimal_int \c_one + \tex_advance:D \l_fp_output_extended_int + -\c_one_thousand_million + \fi: + \if_int_compare:w \l_fp_output_decimal_int < \c_one_thousand_million + \else: + \tex_advance:D \l_fp_output_integer_int \c_one + \tex_advance:D \l_fp_output_decimal_int + -\c_one_thousand_million + \fi: + \else: + \tex_advance:D \l_fp_output_decimal_int -\l_fp_trig_decimal_int + \tex_advance:D \l_fp_output_extended_int + -\l_fp_input_a_extended_int + \if_int_compare:w \l_fp_output_extended_int < \c_zero + \tex_advance:D \l_fp_output_decimal_int \c_minus_one + \tex_advance:D \l_fp_output_extended_int \c_one_thousand_million + \fi: + \if_int_compare:w \l_fp_output_decimal_int < \c_zero + \tex_advance:D \l_fp_output_integer_int \c_minus_one + \tex_advance:D \l_fp_output_decimal_int \c_one_thousand_million + \fi: + \fi: + \exp_after:wN \fp_trig_calc_Taylor: + \fi: + } +\cs_new_protected_nopar:Npn \fp_tan:Nn { \fp_tan_aux:NNn \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gtan:Nn { \fp_tan_aux:NNn \tl_gset:Nn } +\cs_generate_variant:Nn \fp_tan:Nn { c } +\cs_generate_variant:Nn \fp_gtan:Nn { c } +\cs_new_protected_nopar:Npn \fp_tan_aux:NNn #1#2#3 + { + \group_begin: + \fp_split:Nn a {#3} + \fp_standardise:NNNN + \l_fp_input_a_sign_int + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + \l_fp_input_a_exponent_int + \tl_set:Nx \l_fp_arg_tl + { + \if_int_compare:w \l_fp_input_a_sign_int < \c_zero + - + \else: + + + \fi: + \int_use:N \l_fp_input_a_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_input_a_decimal_int + \c_one_thousand_million + e + \int_use:N \l_fp_input_a_exponent_int + } + \if_int_compare:w \l_fp_input_a_exponent_int < -\c_five + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + #1 \exp_not:N #2 { \l_fp_arg_tl } + } + \else: + \if_cs_exist:w + c_fp_tan ( \l_fp_arg_tl ) _fp + \cs_end: + \else: + \exp_after:wN \exp_after:wN \exp_after:wN + \fp_tan_aux_i: + \fi: + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + #1 \exp_not:N #2 + { \use:c { c_fp_tan ( \l_fp_arg_tl ) _fp } } + } + \fi: + \fp_tmp:w + } +\cs_new_protected_nopar:Npn \fp_tan_aux_i: + { + \if_int_compare:w \l_fp_input_a_exponent_int < \c_ten + \exp_after:wN \fp_tan_aux_ii: + \else: + \cs_new_eq:cN { c_fp_tan ( \l_fp_arg_tl ) _fp } + \c_zero_fp + \exp_after:wN \fp_trig_overflow_msg: + \fi: + } +\cs_new_protected_nopar:Npn \fp_tan_aux_ii: + { + \fp_trig_normalise: + \if_int_compare:w \l_fp_input_a_sign_int > \c_zero + \if_int_compare:w \l_fp_trig_octant_int > \c_two + \l_fp_output_sign_int \c_minus_one + \else: + \l_fp_output_sign_int \c_one + \fi: + \else: + \if_int_compare:w \l_fp_trig_octant_int > \c_two + \l_fp_output_sign_int \c_one + \else: + \l_fp_output_sign_int \c_minus_one + \fi: + \fi: + \fp_cos_aux_ii: + \if_int_compare:w \l_fp_input_a_decimal_int = \c_zero + \if_int_compare:w \l_fp_input_a_integer_int = \c_zero + \cs_new_eq:cN { c_fp_tan ( \l_fp_arg_tl ) _fp } + \c_undefined_fp + \else: + \exp_after:wN \exp_after:wN \exp_after:wN + \fp_tan_aux_iii: + \fi: + \else: + \exp_after:wN \fp_tan_aux_iii: + \fi: + } +\cs_new_protected_nopar:Npn \fp_tan_aux_iii: + { + \l_fp_input_b_integer_int \l_fp_output_decimal_int + \l_fp_input_b_decimal_int \l_fp_output_extended_int + \l_fp_input_b_exponent_int -\c_nine + \fp_standardise:NNNN + \l_fp_input_b_sign_int + \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int + \l_fp_input_b_exponent_int + \fp_sin_aux_ii: + \l_fp_input_a_integer_int \l_fp_output_decimal_int + \l_fp_input_a_decimal_int \l_fp_output_extended_int + \l_fp_input_a_exponent_int -\c_nine + \fp_standardise:NNNN + \l_fp_input_a_sign_int + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + \l_fp_input_a_exponent_int + \if_int_compare:w \l_fp_input_a_decimal_int = \c_zero + \if_int_compare:w \l_fp_input_a_integer_int = \c_zero + \cs_new_eq:cN { c_fp_tan ( \l_fp_arg_tl ) _fp } + \c_zero_fp + \else: + \exp_after:wN \exp_after:wN \exp_after:wN \fp_tan_aux_iv: + \fi: + \else: + \exp_after:wN \fp_tan_aux_iv: + \fi: + } +\cs_new_protected_nopar:Npn \fp_tan_aux_iv: + { + \l_fp_output_integer_int \c_zero + \l_fp_output_decimal_int \c_zero + \cs_set_eq:NN \fp_div_store: \fp_div_store_integer: + \l_fp_div_offset_int \c_one_hundred_million + \fp_div_loop: + \l_fp_output_exponent_int + \int_eval:w + \l_fp_input_a_exponent_int - \l_fp_input_b_exponent_int + \int_eval_end: + \fp_standardise:NNNN + \l_fp_output_sign_int + \l_fp_output_integer_int + \l_fp_output_decimal_int + \l_fp_output_exponent_int + \tl_new:c { c_fp_tan ( \l_fp_arg_tl ) _fp } + \tl_gset:cx { c_fp_tan ( \l_fp_arg_tl ) _fp } + { + \if_int_compare:w \l_fp_output_sign_int > \c_zero + + + \else: + - + \fi: + \int_use:N \l_fp_output_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_output_decimal_int + \c_one_thousand_million + e + \int_use:N \l_fp_output_exponent_int + } + } +\tl_const:cn { c_fp_exp_1_tl } { { 2 } { 718281828 } { 459045235 } { 0 } } +\tl_const:cn { c_fp_exp_2_tl } { { 7 } { 389056098 } { 930650227 } { 0 } } +\tl_const:cn { c_fp_exp_3_tl } { { 2 } { 008553692 } { 318766774 } { 1 } } +\tl_const:cn { c_fp_exp_4_tl } { { 5 } { 459815003 } { 314423908 } { 1 } } +\tl_const:cn { c_fp_exp_5_tl } { { 1 } { 484131591 } { 025766034 } { 2 } } +\tl_const:cn { c_fp_exp_6_tl } { { 4 } { 034287934 } { 927351226 } { 2 } } +\tl_const:cn { c_fp_exp_7_tl } { { 1 } { 096633158 } { 428458599 } { 3 } } +\tl_const:cn { c_fp_exp_8_tl } { { 2 } { 980957987 } { 041728275 } { 3 } } +\tl_const:cn { c_fp_exp_9_tl } { { 8 } { 103083927 } { 575384008 } { 3 } } +\tl_const:cn { c_fp_exp_10_tl } { { 2 } { 202646579 } { 480671652 } { 4 } } +\tl_const:cn { c_fp_exp_20_tl } { { 4 } { 851651954 } { 097902280 } { 8 } } +\tl_const:cn { c_fp_exp_30_tl } { { 1 } { 068647458 } { 152446215 } { 13 } } +\tl_const:cn { c_fp_exp_40_tl } { { 2 } { 353852668 } { 370199854 } { 17 } } +\tl_const:cn { c_fp_exp_50_tl } { { 5 } { 184705528 } { 587072464 } { 21 } } +\tl_const:cn { c_fp_exp_60_tl } { { 1 } { 142007389 } { 815684284 } { 26 } } +\tl_const:cn { c_fp_exp_70_tl } { { 2 } { 515438670 } { 919167006 } { 30 } } +\tl_const:cn { c_fp_exp_80_tl } { { 5 } { 540622384 } { 393510053 } { 34 } } +\tl_const:cn { c_fp_exp_90_tl } { { 1 } { 220403294 } { 317840802 } { 39 } } +\tl_const:cn { c_fp_exp_100_tl } { { 2 } { 688117141 } { 816135448 } { 43 } } +\tl_const:cn { c_fp_exp_200_tl } { { 7 } { 225973768 } { 125749258 } { 86 } } +\tl_const:cn { c_fp_exp_-1_tl } { { 3 } { 678794411 } { 71442322 } { -1 } } +\tl_const:cn { c_fp_exp_-2_tl } { { 1 } { 353352832 } { 366132692 } { -1 } } +\tl_const:cn { c_fp_exp_-3_tl } { { 4 } { 978706836 } { 786394298 } { -2 } } +\tl_const:cn { c_fp_exp_-4_tl } { { 1 } { 831563888 } { 873418029 } { -2 } } +\tl_const:cn { c_fp_exp_-5_tl } { { 6 } { 737946999 } { 085467097 } { -3 } } +\tl_const:cn { c_fp_exp_-6_tl } { { 2 } { 478752176 } { 666358423 } { -3 } } +\tl_const:cn { c_fp_exp_-7_tl } { { 9 } { 118819655 } { 545162080 } { -4 } } +\tl_const:cn { c_fp_exp_-8_tl } { { 3 } { 354626279 } { 025118388 } { -4 } } +\tl_const:cn { c_fp_exp_-9_tl } { { 1 } { 234098040 } { 866795495 } { -4 } } +\tl_const:cn { c_fp_exp_-10_tl } { { 4 } { 539992976 } { 248451536 } { -5 } } +\tl_const:cn { c_fp_exp_-20_tl } { { 2 } { 061153622 } { 438557828 } { -9 } } +\tl_const:cn { c_fp_exp_-30_tl } { { 9 } { 357622968 } { 840174605 } { -14 } } +\tl_const:cn { c_fp_exp_-40_tl } { { 4 } { 248354255 } { 291588995 } { -18 } } +\tl_const:cn { c_fp_exp_-50_tl } { { 1 } { 928749847 } { 963917783 } { -22 } } +\tl_const:cn { c_fp_exp_-60_tl } { { 8 } { 756510762 } { 696520338 } { -27 } } +\tl_const:cn { c_fp_exp_-70_tl } { { 3 } { 975449735 } { 908646808 } { -31 } } +\tl_const:cn { c_fp_exp_-80_tl } { { 1 } { 804851387 } { 845415172 } { -35 } } +\tl_const:cn { c_fp_exp_-90_tl } { { 8 } { 194012623 } { 990515430 } { -40 } } +\tl_const:cn { c_fp_exp_-100_tl } { { 3 } { 720075976 } { 020835963 } { -44 } } +\tl_const:cn { c_fp_exp_-200_tl } { { 1 } { 383896526 } { 736737530 } { -87 } } +\cs_new_protected_nopar:Npn \fp_exp:Nn { \fp_exp_aux:NNn \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gexp:Nn { \fp_exp_aux:NNn \tl_gset:Nn } +\cs_generate_variant:Nn \fp_exp:Nn { c } +\cs_generate_variant:Nn \fp_gexp:Nn { c } +\cs_new_protected_nopar:Npn \fp_exp_aux:NNn #1#2#3 + { + \group_begin: + \fp_split:Nn a {#3} + \fp_standardise:NNNN + \l_fp_input_a_sign_int + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + \l_fp_input_a_exponent_int + \l_fp_input_a_extended_int \c_zero + \tl_set:Nx \l_fp_arg_tl + { + \if_int_compare:w \l_fp_input_a_sign_int < \c_zero + - + \else: + + + \fi: + \int_use:N \l_fp_input_a_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_input_a_decimal_int + \c_one_thousand_million + e + \int_use:N \l_fp_input_a_exponent_int + } + \if_cs_exist:w c_fp_exp ( \l_fp_arg_tl ) _fp \cs_end: + \else: + \exp_after:wN \fp_exp_internal: + \fi: + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + #1 \exp_not:N #2 + { + \if_cs_exist:w c_fp_exp ( \l_fp_arg_tl ) _fp + \cs_end: + \use:c { c_fp_exp ( \l_fp_arg_tl ) _fp } + \else: + \c_zero_fp + \fi: + } + } + \fp_tmp:w + } +\cs_new_protected_nopar:Npn \fp_exp_internal: + { + \if_int_compare:w \l_fp_input_a_exponent_int < \c_three + \fp_extended_normalise: + \if_int_compare:w \l_fp_input_a_sign_int > \c_zero + \if_int_compare:w \l_fp_input_a_integer_int < 230 \scan_stop: + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \fp_exp_aux: + \else: + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \fp_exp_overflow_msg: + \fi: + \else: + \if_int_compare:w \l_fp_input_a_integer_int < 230 \scan_stop: + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \fp_exp_aux: + \else: + \fp_exp_const:cx { c_fp_exp ( \l_fp_arg_tl ) _fp } + { \c_zero_fp } + \fi: + \fi: + \else: + \exp_after:wN \fp_exp_overflow_msg: + \fi: + } +\cs_new_protected_nopar:Npn \fp_exp_aux: + { + \if_int_compare:w \l_fp_input_a_integer_int > \c_zero + \exp_after:wN \fp_exp_integer: + \else: + \l_fp_output_integer_int \c_one + \l_fp_output_decimal_int \c_zero + \l_fp_output_extended_int \c_zero + \l_fp_output_exponent_int \c_zero + \exp_after:wN \fp_exp_decimal: + \fi: + } +\cs_new_protected_nopar:Npn \fp_exp_integer: + { + \if_int_compare:w \l_fp_input_a_integer_int < \c_one_hundred + \l_fp_exp_integer_int \c_one + \l_fp_exp_decimal_int \c_zero + \l_fp_exp_extended_int \c_zero + \l_fp_exp_exponent_int \c_zero + \exp_after:wN \fp_exp_integer_tens: + \else: + \tl_set:Nx \l_fp_tmp_tl + { + \exp_after:wN \use_i:nnn + \int_use:N \l_fp_input_a_integer_int + } + \l_fp_input_a_integer_int + \int_eval:w + \l_fp_input_a_integer_int - \l_fp_tmp_tl 00 + \int_eval_end: + \if_int_compare:w \l_fp_input_a_sign_int < \c_zero + \if_int_compare:w \l_fp_output_integer_int > 200 \scan_stop: + \fp_exp_const:cx { c_fp_exp ( \l_fp_arg_tl ) _fp } + { \c_zero_fp } + \else: + \fp_exp_integer_const:n { - \l_fp_tmp_tl 00 } + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \fp_exp_integer_tens: + \fi: + \else: + \fp_exp_integer_const:n { \l_fp_tmp_tl 00 } + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \fp_exp_integer_tens: + \fi: + \fi: + } +\cs_new_protected_nopar:Npn \fp_exp_integer_tens: + { + \l_fp_output_integer_int \l_fp_exp_integer_int + \l_fp_output_decimal_int \l_fp_exp_decimal_int + \l_fp_output_extended_int \l_fp_exp_extended_int + \l_fp_output_exponent_int \l_fp_exp_exponent_int + \if_int_compare:w \l_fp_input_a_integer_int > \c_nine + \tl_set:Nx \l_fp_tmp_tl + { + \exp_after:wN \use_i:nn + \int_use:N \l_fp_input_a_integer_int + } + \l_fp_input_a_integer_int + \int_eval:w + \l_fp_input_a_integer_int - \l_fp_tmp_tl 0 + \int_eval_end: + \if_int_compare:w \l_fp_input_a_sign_int > \c_zero + \fp_exp_integer_const:n { \l_fp_tmp_tl 0 } + \else: + \fp_exp_integer_const:n { - \l_fp_tmp_tl 0 } + \fi: + \fp_mul:NNNNNNNNN + \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + \tex_advance:D \l_fp_output_exponent_int \l_fp_exp_exponent_int + \fp_extended_normalise_output: + \fi: + \fp_exp_integer_units: + } +\cs_new_protected_nopar:Npn \fp_exp_integer_units: + { + \if_int_compare:w \l_fp_input_a_integer_int > \c_zero + \if_int_compare:w \l_fp_input_a_sign_int > \c_zero + \fp_exp_integer_const:n { \int_use:N \l_fp_input_a_integer_int } + \else: + \fp_exp_integer_const:n + { - \int_use:N \l_fp_input_a_integer_int } + \fi: + \fp_mul:NNNNNNNNN + \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + \tex_advance:D \l_fp_output_exponent_int \l_fp_exp_exponent_int + \fp_extended_normalise_output: + \fi: + \fp_exp_decimal: + } +\cs_new_protected_nopar:Npn \fp_exp_integer_const:n #1 + { + \exp_after:wN \exp_after:wN \exp_after:wN + \fp_exp_integer_const:nnnn + \cs:w c_fp_exp_ #1 _tl \cs_end: + } +\cs_new_protected_nopar:Npn \fp_exp_integer_const:nnnn #1#2#3#4 + { + \l_fp_exp_integer_int #1 \scan_stop: + \l_fp_exp_decimal_int #2 \scan_stop: + \l_fp_exp_extended_int #3 \scan_stop: + \l_fp_exp_exponent_int #4 \scan_stop: + } +\cs_new_protected_nopar:Npn \fp_exp_decimal: + { + \if_int_compare:w \l_fp_input_a_decimal_int > \c_zero + \if_int_compare:w \l_fp_input_a_sign_int > \c_zero + \l_fp_exp_integer_int \c_one + \l_fp_exp_decimal_int \l_fp_input_a_decimal_int + \l_fp_exp_extended_int \l_fp_input_a_extended_int + \else: + \l_fp_exp_integer_int \c_zero + \if_int_compare:w \l_fp_exp_extended_int = \c_zero + \l_fp_exp_decimal_int + \int_eval:w + \c_one_thousand_million - \l_fp_input_a_decimal_int + \int_eval_end: + \l_fp_exp_extended_int \c_zero + \else: + \l_fp_exp_decimal_int + \int_eval:w + 999999999 - \l_fp_input_a_decimal_int + \scan_stop: + \l_fp_exp_extended_int + \int_eval:w + \c_one_thousand_million - \l_fp_input_a_extended_int + \int_eval_end: + \fi: + \fi: + \l_fp_input_b_sign_int \l_fp_input_a_sign_int + \l_fp_input_b_decimal_int \l_fp_input_a_decimal_int + \l_fp_input_b_extended_int \l_fp_input_a_extended_int + \l_fp_count_int \c_one + \fp_exp_Taylor: + \fp_mul:NNNNNNNNN + \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + \fi: + \if_int_compare:w \l_fp_output_extended_int < \c_five_hundred_million + \else: + \tex_advance:D \l_fp_output_decimal_int \c_one + \if_int_compare:w \l_fp_output_decimal_int < \c_one_thousand_million + \else: + \l_fp_output_decimal_int \c_zero + \tex_advance:D \l_fp_output_integer_int \c_one + \fi: + \fi: + \fp_standardise:NNNN + \l_fp_output_sign_int + \l_fp_output_integer_int + \l_fp_output_decimal_int + \l_fp_output_exponent_int + \fp_exp_const:cx { c_fp_exp ( \l_fp_arg_tl ) _fp } + { + + + \int_use:N \l_fp_output_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_output_decimal_int + \c_one_thousand_million + e + \int_use:N \l_fp_output_exponent_int + } + } +\cs_new_protected_nopar:Npn \fp_exp_Taylor: + { + \tex_advance:D \l_fp_count_int \c_one + \tex_multiply:D \l_fp_input_b_sign_int \l_fp_input_a_sign_int + \fp_mul:NNNNNN + \l_fp_input_a_decimal_int \l_fp_input_a_extended_int + \l_fp_input_b_decimal_int \l_fp_input_b_extended_int + \l_fp_input_b_decimal_int \l_fp_input_b_extended_int + \fp_div_integer:NNNNN + \l_fp_input_b_decimal_int \l_fp_input_b_extended_int + \l_fp_count_int + \l_fp_input_b_decimal_int \l_fp_input_b_extended_int + \if_int_compare:w + \int_eval:w + \l_fp_input_b_decimal_int + \l_fp_input_b_extended_int + > \c_zero + \if_int_compare:w \l_fp_input_b_sign_int > \c_zero + \tex_advance:D \l_fp_exp_decimal_int \l_fp_input_b_decimal_int + \tex_advance:D \l_fp_exp_extended_int + \l_fp_input_b_extended_int + \if_int_compare:w \l_fp_exp_extended_int < \c_one_thousand_million + \else: + \tex_advance:D \l_fp_exp_decimal_int \c_one + \tex_advance:D \l_fp_exp_extended_int + -\c_one_thousand_million + \fi: + \if_int_compare:w \l_fp_exp_decimal_int < \c_one_thousand_million + \else: + \tex_advance:D \l_fp_exp_integer_int \c_one + \tex_advance:D \l_fp_exp_decimal_int + -\c_one_thousand_million + \fi: + \else: + \tex_advance:D \l_fp_exp_decimal_int -\l_fp_input_b_decimal_int + \tex_advance:D \l_fp_exp_extended_int + -\l_fp_input_a_extended_int + \if_int_compare:w \l_fp_exp_extended_int < \c_zero + \tex_advance:D \l_fp_exp_decimal_int \c_minus_one + \tex_advance:D \l_fp_exp_extended_int \c_one_thousand_million + \fi: + \if_int_compare:w \l_fp_exp_decimal_int < \c_zero + \tex_advance:D \l_fp_exp_integer_int \c_minus_one + \tex_advance:D \l_fp_exp_decimal_int \c_one_thousand_million + \fi: + \fi: + \exp_after:wN \fp_exp_Taylor: + \fi: + } +\cs_new_protected_nopar:Npn \fp_exp_const:Nx #1#2 + { + \tl_new:N #1 + \tl_gset:Nx #1 {#2} + } +\cs_generate_variant:Nn \fp_exp_const:Nx { c } +\tl_const:cn { c_fp_ln_10_1_tl } { { 2 } { 302585092 } { 994045684 } { 0 } } +\tl_const:cn { c_fp_ln_10_2_tl } { { 4 } { 605170185 } { 988091368 } { 0 } } +\tl_const:cn { c_fp_ln_10_3_tl } { { 6 } { 907755278 } { 982137052 } { 0 } } +\tl_const:cn { c_fp_ln_10_4_tl } { { 9 } { 210340371 } { 976182736 } { 0 } } +\tl_const:cn { c_fp_ln_10_5_tl } { { 1 } { 151292546 } { 497022842 } { 1 } } +\tl_const:cn { c_fp_ln_10_6_tl } { { 1 } { 381551055 } { 796427410 } { 1 } } +\tl_const:cn { c_fp_ln_10_7_tl } { { 1 } { 611809565 } { 095831979 } { 1 } } +\tl_const:cn { c_fp_ln_10_8_tl } { { 1 } { 842068074 } { 395226547 } { 1 } } +\tl_const:cn { c_fp_ln_10_9_tl } { { 2 } { 072326583 } { 694641116 } { 1 } } +\tl_const:cn { c_fp_ln_2_1_tl } { { 0 } { 693147180 } { 559945309 } { 0 } } +\tl_const:cn { c_fp_ln_2_2_tl } { { 1 } { 386294361 } { 119890618 } { 0 } } +\tl_const:cn { c_fp_ln_2_3_tl } { { 2 } { 079441541 } { 679835928 } { 0 } } +\cs_new_protected_nopar:Npn \fp_ln:Nn { \fp_ln_aux:NNn \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gln:Nn { \fp_ln_aux:NNn \tl_gset:Nn } +\cs_generate_variant:Nn \fp_ln:Nn { c } +\cs_generate_variant:Nn \fp_gln:Nn { c } +\cs_new_protected_nopar:Npn \fp_ln_aux:NNn #1#2#3 + { + \group_begin: + \fp_split:Nn a {#3} + \fp_standardise:NNNN + \l_fp_input_a_sign_int + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + \l_fp_input_a_exponent_int + \if_int_compare:w \l_fp_input_a_sign_int > \c_zero + \if_int_compare:w + \int_eval:w + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + > \c_zero + \exp_after:wN \exp_after:wN \exp_after:wN \fp_ln_aux: + \else: + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + ##1 \exp_not:N ##2 { \c_zero_fp } + } + \exp_after:wN \exp_after:wN \exp_after:wN \fp_ln_error_msg: + \fi: + \else: + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + ##1 \exp_not:N ##2 { \c_zero_fp } + } + \exp_after:wN \fp_ln_error_msg: + \fi: + \fp_tmp:w #1 #2 + } +\cs_new_protected_nopar:Npn \fp_ln_aux: + { + \tl_set:Nx \l_fp_arg_tl + { + + + \int_use:N \l_fp_input_a_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_input_a_decimal_int + \c_one_thousand_million + e + \int_use:N \l_fp_input_a_exponent_int + } + \if_cs_exist:w c_fp_ln ( \l_fp_arg_tl ) _fp \cs_end: + \else: + \exp_after:wN \fp_ln_exponent: + \fi: + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + ##1 \exp_not:N ##2 + { \use:c { c_fp_ln ( \l_fp_arg_tl ) _fp } } + } + } +\cs_new_protected_nopar:Npn \fp_ln_exponent: + { + \fp_ln_internal: + \if_int_compare:w \l_fp_output_extended_int < \c_five_hundred_million + \else: + \tex_advance:D \l_fp_output_decimal_int \c_one + \if_int_compare:w \l_fp_output_decimal_int < \c_one_thousand_million + \else: + \l_fp_output_decimal_int \c_zero + \tex_advance:D \l_fp_output_integer_int \c_one + \fi: + \fi: + \fp_standardise:NNNN + \l_fp_output_sign_int + \l_fp_output_integer_int + \l_fp_output_decimal_int + \l_fp_output_exponent_int + \tl_const:cx { c_fp_ln ( \l_fp_arg_tl ) _fp } + { + \if_int_compare:w \l_fp_output_sign_int > \c_zero + + + \else: + - + \fi: + \int_use:N \l_fp_output_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_output_decimal_int + \c_one_thousand_million + \scan_stop: + e + \int_use:N \l_fp_output_exponent_int + } + } +\cs_new_protected_nopar:Npn \fp_ln_internal: + { + \if_int_compare:w \l_fp_input_a_exponent_int < \c_zero + \l_fp_input_a_exponent_int -\l_fp_input_a_exponent_int + \l_fp_output_sign_int \c_minus_one + \else: + \l_fp_output_sign_int \c_one + \fi: + \if_int_compare:w \l_fp_input_a_exponent_int > \c_nine + \exp_after:wN \fp_ln_exponent_tens:NN + \int_use:N \l_fp_input_a_exponent_int + \else: + \l_fp_output_integer_int \c_zero + \l_fp_output_decimal_int \c_zero + \l_fp_output_extended_int \c_zero + \l_fp_output_exponent_int \c_zero + \fi: + \fp_ln_exponent_units: + } +\cs_new_protected_nopar:Npn \fp_ln_exponent_tens:NN #1 #2 + { + \l_fp_input_a_exponent_int #2 \scan_stop: + \fp_ln_const:nn { 10 } { #1 } + \tex_advance:D \l_fp_exp_exponent_int \c_one + \l_fp_output_integer_int \l_fp_exp_integer_int + \l_fp_output_decimal_int \l_fp_exp_decimal_int + \l_fp_output_extended_int \l_fp_exp_extended_int + \l_fp_output_exponent_int \l_fp_exp_exponent_int + } +\cs_new_protected_nopar:Npn \fp_ln_exponent_units: + { + \if_int_compare:w \l_fp_input_a_exponent_int > \c_zero + \fp_ln_const:nn { 10 } { \int_use:N \l_fp_input_a_exponent_int } + \fp_ln_normalise: + \fp_add:NNNNNNNNN + \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + \fi: + \fp_ln_mantissa: + } +\cs_new_protected_nopar:Npn \fp_ln_normalise: + { + \if_int_compare:w \l_fp_exp_exponent_int < \l_fp_output_exponent_int + \tex_advance:D \l_fp_exp_decimal_int \c_one_thousand_million + \exp_after:wN \use_i:nn \exp_after:wN + \fp_ln_normalise_aux:NNNNNNNNN + \int_use:N \l_fp_exp_decimal_int + \exp_after:wN \fp_ln_normalise: + \else: + \l_fp_output_exponent_int \l_fp_exp_exponent_int + \fi: + } +\cs_new_protected_nopar:Npn \fp_ln_normalise_aux:NNNNNNNNN #1#2#3#4#5#6#7#8#9 + { + \if_int_compare:w \l_fp_exp_integer_int = \c_zero + \l_fp_exp_decimal_int #1#2#3#4#5#6#7#8 \scan_stop: + \else: + \tl_set:Nx \l_fp_tmp_tl + { + \int_use:N \l_fp_exp_integer_int + #1#2#3#4#5#6#7#8 + } + \l_fp_exp_integer_int \c_zero + \l_fp_exp_decimal_int \l_fp_tmp_tl \scan_stop: + \fi: + \tex_divide:D \l_fp_exp_extended_int \c_ten + \tl_set:Nx \l_fp_tmp_tl + { + #9 + \int_use:N \l_fp_exp_extended_int + } + \l_fp_exp_extended_int \l_fp_tmp_tl \scan_stop: + \tex_advance:D \l_fp_exp_exponent_int \c_one + } +\cs_new_protected_nopar:Npn \fp_ln_mantissa: + { + \l_fp_count_int \c_zero + \l_fp_input_a_extended_int \c_zero + \fp_ln_mantissa_aux: + \if_int_compare:w \l_fp_count_int > \c_zero + \fp_ln_const:nn { 2 } { \int_use:N \l_fp_count_int } + \fp_ln_normalise: + \if_int_compare:w \l_fp_output_sign_int > \c_zero + \exp_after:wN \fp_add:NNNNNNNNN + \else: + \exp_after:wN \fp_sub:NNNNNNNNN + \fi: + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + \fi: + \if_int_compare:w + \int_eval:w + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int > \c_one + \exp_after:wN \fp_ln_Taylor: + \fi: + } +\cs_new_protected_nopar:Npn \fp_ln_mantissa_aux: + { + \if_int_compare:w \l_fp_input_a_integer_int > \c_one + \tex_advance:D \l_fp_count_int \c_one + \fp_ln_mantissa_divide_two: + \exp_after:wN \fp_ln_mantissa_aux: + \fi: + } +\cs_new_protected_nopar:Npn \fp_ln_mantissa_divide_two: + { + \if_int_odd:w \l_fp_input_a_decimal_int + \tex_advance:D \l_fp_input_a_extended_int \c_one_thousand_million + \fi: + \if_int_odd:w \l_fp_input_a_integer_int + \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \fi: + \tex_divide:D \l_fp_input_a_integer_int \c_two + \tex_divide:D \l_fp_input_a_decimal_int \c_two + \tex_divide:D \l_fp_input_a_extended_int \c_two + } +\cs_new_protected_nopar:Npn \fp_ln_const:nn #1#2 + { + \exp_after:wN \exp_after:wN \exp_after:wN + \fp_exp_integer_const:nnnn + \cs:w c_fp_ln_ #1 _ #2 _tl \cs_end: + } +\cs_new_protected_nopar:Npn \fp_ln_Taylor: + { + \group_begin: + \l_fp_input_a_integer_int \c_zero + \l_fp_input_a_exponent_int \c_zero + \l_fp_input_b_integer_int \c_two + \l_fp_input_b_decimal_int \l_fp_input_a_decimal_int + \l_fp_input_b_exponent_int \c_zero + \fp_div_internal: + \fp_ln_fixed: + \l_fp_input_a_integer_int \l_fp_output_integer_int + \l_fp_input_a_decimal_int \l_fp_output_decimal_int + \l_fp_input_a_extended_int \c_zero + \l_fp_input_a_exponent_int \l_fp_output_exponent_int + \l_fp_output_decimal_int \c_zero %^^A Bug? + \l_fp_output_decimal_int \l_fp_input_a_decimal_int + \l_fp_output_extended_int \l_fp_input_a_extended_int + \fp_mul:NNNNNN + \l_fp_input_a_decimal_int \l_fp_input_a_extended_int + \l_fp_input_a_decimal_int \l_fp_input_a_extended_int + \l_fp_input_b_decimal_int \l_fp_input_b_extended_int + \l_fp_count_int \c_one + \fp_ln_Taylor_aux: + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + \l_fp_exp_integer_int \c_zero + \exp_not:N \l_fp_exp_decimal_int + \int_use:N \l_fp_output_decimal_int \scan_stop: + \exp_not:N \l_fp_exp_extended_int + \int_use:N \l_fp_output_extended_int \scan_stop: + \exp_not:N \l_fp_exp_exponent_int + \int_use:N \l_fp_output_exponent_int \scan_stop: + } + \fp_tmp:w + \tex_advance:D \l_fp_exp_decimal_int \l_fp_exp_decimal_int + \if_int_compare:w \l_fp_exp_extended_int < \c_five_hundred_million + \else: + \tex_advance:D \l_fp_exp_extended_int -\c_five_hundred_million + \tex_advance:D \l_fp_exp_decimal_int \c_one + \fi: + \tex_advance:D \l_fp_exp_extended_int \l_fp_exp_extended_int + \fp_ln_normalise: + \if_int_compare:w \l_fp_output_sign_int > \c_zero + \exp_after:wN \fp_add:NNNNNNNNN + \else: + \exp_after:wN \fp_sub:NNNNNNNNN + \fi: + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + \c_zero \l_fp_exp_decimal_int \l_fp_exp_extended_int + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + } +\cs_new_protected_nopar:Npn \fp_ln_fixed: + { + \if_int_compare:w \l_fp_output_exponent_int < \c_zero + \tex_advance:D \l_fp_output_decimal_int \c_one_thousand_million + \exp_after:wN \use_i:nn \exp_after:wN + \fp_ln_fixed_aux:NNNNNNNNN + \int_use:N \l_fp_output_decimal_int + \exp_after:wN \fp_ln_fixed: + \fi: + } +\cs_new_protected_nopar:Npn \fp_ln_fixed_aux:NNNNNNNNN #1#2#3#4#5#6#7#8#9 + { + \if_int_compare:w \l_fp_output_integer_int = \c_zero + \l_fp_output_decimal_int #1#2#3#4#5#6#7#8 \scan_stop: + \else: + \tl_set:Nx \l_fp_tmp_tl + { + \int_use:N \l_fp_output_integer_int + #1#2#3#4#5#6#7#8 + } + \l_fp_output_integer_int \c_zero + \l_fp_output_decimal_int \l_fp_tmp_tl \scan_stop: + \fi: + \tex_advance:D \l_fp_output_exponent_int \c_one + } +\cs_new_protected_nopar:Npn \fp_ln_Taylor_aux: + { + \tex_advance:D \l_fp_count_int \c_two + \fp_mul:NNNNNN + \l_fp_input_a_decimal_int \l_fp_input_a_extended_int + \l_fp_input_b_decimal_int \l_fp_input_b_extended_int + \l_fp_input_a_decimal_int \l_fp_input_a_extended_int + \if_int_compare:w + \int_eval:w + \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int + > \c_zero + \fp_div_integer:NNNNN + \l_fp_input_a_decimal_int \l_fp_input_a_extended_int + \l_fp_count_int + \l_fp_exp_decimal_int \l_fp_exp_extended_int + \tex_advance:D \l_fp_output_decimal_int \l_fp_exp_decimal_int + \tex_advance:D \l_fp_output_extended_int \l_fp_exp_extended_int + \if_int_compare:w \l_fp_output_extended_int < \c_one_thousand_million + \else: + \tex_advance:D \l_fp_output_decimal_int \c_one + \tex_advance:D \l_fp_output_extended_int + -\c_one_thousand_million + \fi: + \if_int_compare:w \l_fp_output_decimal_int < \c_one_thousand_million + \else: + \tex_advance:D \l_fp_output_integer_int \c_one + \tex_advance:D \l_fp_output_decimal_int + -\c_one_thousand_million + \fi: + \exp_after:wN \fp_ln_Taylor_aux: + \fi: + } +\cs_new_protected_nopar:Npn \fp_pow:Nn { \fp_pow_aux:NNn \tl_set:Nn } +\cs_new_protected_nopar:Npn \fp_gpow:Nn { \fp_pow_aux:NNn \tl_gset:Nn } +\cs_generate_variant:Nn \fp_pow:Nn { c } +\cs_generate_variant:Nn \fp_gpow:Nn { c } +\cs_new_protected_nopar:Npn \fp_pow_aux:NNn #1#2#3 + { + \group_begin: + \fp_read:N #2 + \l_fp_input_b_sign_int \l_fp_input_a_sign_int + \l_fp_input_b_integer_int \l_fp_input_a_integer_int + \l_fp_input_b_decimal_int \l_fp_input_a_decimal_int + \l_fp_input_b_exponent_int \l_fp_input_a_exponent_int + \fp_split:Nn a {#3} + \fp_standardise:NNNN + \l_fp_input_a_sign_int + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + \l_fp_input_a_exponent_int + \if_int_compare:w + \int_eval:w + \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int + = \c_zero + \if_int_compare:w + \int_eval:w + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + = \c_zero + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + ##1 ##2 { \c_undefined_fp } + } + \else: + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + ##1 ##2 { \c_zero_fp } + } + \fi: + \else: + \if_int_compare:w + \int_eval:w + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + = \c_zero + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + ##1 ##2 { \c_one_fp } + } + \else: + \exp_after:wN \exp_after:wN \exp_after:wN + \fp_pow_aux_i: + \fi: + \fi: + \fp_tmp:w #1 #2 +} +\cs_new_protected_nopar:Npn \fp_pow_aux_i: + { + \if_int_compare:w \l_fp_input_b_sign_int > \c_zero + \tl_set:Nn \l_fp_sign_tl { + } + \exp_after:wN \fp_pow_aux_ii: + \else: + \l_fp_input_a_extended_int \c_zero + \if_int_compare:w \l_fp_input_a_exponent_int < \c_ten + \group_begin: + \fp_extended_normalise: + \if_int_compare:w + \int_eval:w + \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int + = \c_zero + \group_end: + \tl_set:Nn \l_fp_sign_tl { - } + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \fp_pow_aux_ii: + \else: + \group_end: + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + ##1 ##2 { \c_undefined_fp } + } + \fi: + \else: + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + ##1 ##2 { \c_undefined_fp } + } + \fi: + \fi: + } +\cs_new_protected_nopar:Npn \fp_pow_aux_ii: + { + \if_int_compare:w \l_fp_input_a_sign_int > \c_zero + \exp_after:wN \fp_pow_aux_iv: + \else: + \if_int_compare:w \l_fp_input_a_exponent_int < \c_ten + \group_begin: + \l_fp_input_a_extended_int \c_zero + \fp_extended_normalise: + \if_int_compare:w \l_fp_input_a_decimal_int = \c_zero + \if_int_compare:w \l_fp_input_a_integer_int > \c_ten + \group_end: + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \fp_pow_aux_iv: + \else: + \group_end: + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \fp_pow_aux_iii: + \fi: + \else: + \group_end: + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN \exp_after:wN + \exp_after:wN \fp_pow_aux_iv: + \fi: + \else: + \exp_after:wN \exp_after:wN \exp_after:wN + \fp_pow_aux_iv: + \fi: + \fi: + \cs_set_protected_nopar:Npx \fp_tmp:w ##1##2 + { + \group_end: + ##1 ##2 + { + \l_fp_sign_tl + \int_use:N \l_fp_output_integer_int + . + \exp_after:wN \use_none:n + \int_value:w \int_eval:w + \l_fp_output_decimal_int + \c_one_thousand_million + e + \int_use:N \l_fp_output_exponent_int + } + } + } +\cs_new_protected_nopar:Npn \fp_pow_aux_iii: + { + \l_fp_input_a_sign_int \c_one + \fp_pow_aux_iv: + \l_fp_input_a_integer_int \c_one + \l_fp_input_a_decimal_int \c_zero + \l_fp_input_a_exponent_int \c_zero + \l_fp_input_b_integer_int \l_fp_output_integer_int + \l_fp_input_b_decimal_int \l_fp_output_decimal_int + \l_fp_input_b_exponent_int \l_fp_output_exponent_int + \fp_div_internal: + } +\cs_new_protected_nopar:Npn \fp_pow_aux_iv: + { + \group_begin: + \l_fp_input_a_integer_int \l_fp_input_b_integer_int + \l_fp_input_a_decimal_int \l_fp_input_b_decimal_int + \l_fp_input_a_exponent_int \l_fp_input_b_exponent_int + \fp_ln_internal: + \cs_set_protected_nopar:Npx \fp_tmp:w + { + \group_end: + \exp_not:N \l_fp_input_b_sign_int + \int_use:N \l_fp_output_sign_int \scan_stop: + \exp_not:N \l_fp_input_b_integer_int + \int_use:N \l_fp_output_integer_int \scan_stop: + \exp_not:N \l_fp_input_b_decimal_int + \int_use:N \l_fp_output_decimal_int \scan_stop: + \exp_not:N \l_fp_input_b_extended_int + \int_use:N \l_fp_output_extended_int \scan_stop: + \exp_not:N \l_fp_input_b_exponent_int + \int_use:N \l_fp_output_exponent_int \scan_stop: + } + \fp_tmp:w + \l_fp_input_a_extended_int \c_zero + \fp_mul:NNNNNNNNN + \l_fp_input_a_integer_int \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int + \l_fp_input_b_integer_int \l_fp_input_b_decimal_int + \l_fp_input_b_extended_int + \l_fp_output_integer_int \l_fp_output_decimal_int + \l_fp_output_extended_int + \l_fp_output_exponent_int + \int_eval:w + \l_fp_input_a_exponent_int + \l_fp_input_b_exponent_int + \scan_stop: + \fp_extended_normalise_output: + \tex_multiply:D \l_fp_input_a_sign_int \l_fp_input_b_sign_int + \l_fp_input_a_integer_int \l_fp_output_integer_int + \l_fp_input_a_decimal_int \l_fp_output_decimal_int + \l_fp_input_a_extended_int \l_fp_output_extended_int + \l_fp_input_a_exponent_int \l_fp_output_exponent_int + \l_fp_output_integer_int \c_zero + \l_fp_output_decimal_int \c_zero + \l_fp_output_extended_int \c_zero + \l_fp_output_exponent_int \c_zero + \cs_set_eq:NN \fp_exp_const:Nx \use_none:nn + \fp_exp_internal: + } +\prg_new_conditional:Npnn \fp_if_undefined:N #1 { p , T , F , TF } + { + \if_meaning:w #1 \c_undefined_fp + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\prg_new_conditional:Npnn \fp_if_zero:N #1 { p , T , F , TF } + { + \if_meaning:w #1 \c_zero_fp + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\prg_new_protected_conditional:Npnn \fp_compare:nNn #1#2#3 { T , F , TF } + { + \group_begin: + \fp_split:Nn a {#1} + \fp_standardise:NNNN + \l_fp_input_a_sign_int + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + \l_fp_input_a_exponent_int + \fp_split:Nn b {#3} + \fp_standardise:NNNN + \l_fp_input_b_sign_int + \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int + \l_fp_input_b_exponent_int + \fp_compare_aux:N #2 + } +\prg_new_protected_conditional:Npnn \fp_compare:NNN #1#2#3 { T , F , TF } + { + \group_begin: + \fp_read:N #3 + \l_fp_input_b_sign_int \l_fp_input_a_sign_int + \l_fp_input_b_integer_int \l_fp_input_a_integer_int + \l_fp_input_b_decimal_int \l_fp_input_a_decimal_int + \l_fp_input_b_exponent_int \l_fp_input_a_exponent_int + \fp_read:N #1 + \fp_compare_aux:N #2 + } +\cs_new_protected_nopar:Npn \fp_compare_aux:N #1 + { + \cs_if_exist:cTF { fp_compare_#1: } + { \use:c { fp_compare_#1: } } + { + \group_end: + \prg_return_false: + } + } +\cs_new_protected_nopar:cpn { fp_compare_=: } + { + \if_int_compare:w \l_fp_input_a_sign_int = \l_fp_input_b_sign_int + \if_int_compare:w \l_fp_input_a_integer_int = \l_fp_input_b_integer_int + \if_int_compare:w \l_fp_input_a_decimal_int = \l_fp_input_b_decimal_int + \if_int_compare:w + \l_fp_input_a_exponent_int = \l_fp_input_b_exponent_int + \group_end: + \prg_return_true: + \else: + \group_end: + \prg_return_false: + \fi: + \else: + \group_end: + \prg_return_false: + \fi: + \else: + \group_end: + \prg_return_false: + \fi: + \else: + \group_end: + \prg_return_false: + \fi: + } +\cs_new_protected_nopar:cpn { fp_compare_>: } + { + \if_int_compare:w \int_eval:w + \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int + = \c_zero + \if_int_compare:w \int_eval:w + \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int + = \c_zero + \group_end: + \prg_return_false: + \else: + \if_int_compare:w \l_fp_input_b_sign_int > \c_zero + \group_end: + \prg_return_false: + \else: + \group_end: + \prg_return_true: + \fi: + \fi: + \else: + \if_int_compare:w \int_eval:w + \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int + = \c_zero + \if_int_compare:w \l_fp_input_a_sign_int > \c_zero + \group_end: + \prg_return_true: + \else: + \group_end: + \prg_return_false: + \fi: + \else: + \use:c { fp_compare_>_aux: } + \fi: + \fi: + } +\cs_new_protected_nopar:cpn { fp_compare_>_aux: } + { + \if_int_compare:w \l_fp_input_a_sign_int > \l_fp_input_b_sign_int + \group_end: + \prg_return_true: + \else: + \if_int_compare:w \l_fp_input_a_sign_int < \l_fp_input_b_sign_int + \group_end: + \prg_return_false: + \else: + \if_int_compare:w \l_fp_input_a_sign_int > \c_zero + \use:c { fp_compare_absolute_a>b: } + \else: + \use:c { fp_compare_absolute_a<b: } + \fi: + \fi: + \fi: + } +\cs_new_protected_nopar:cpn { fp_compare_absolute_a>b: } + { + \if_int_compare:w \l_fp_input_a_exponent_int > \l_fp_input_b_exponent_int + \group_end: + \prg_return_true: + \else: + \if_int_compare:w \l_fp_input_a_exponent_int < \l_fp_input_b_exponent_int + \group_end: + \prg_return_false: + \else: + \if_int_compare:w \l_fp_input_a_integer_int > \l_fp_input_b_integer_int + \group_end: + \prg_return_true: + \else: + \if_int_compare:w + \l_fp_input_a_integer_int < \l_fp_input_b_integer_int + \group_end: + \prg_return_false: + \else: + \if_int_compare:w + \l_fp_input_a_decimal_int > \l_fp_input_b_decimal_int + \group_end: + \prg_return_true: + \else: + \group_end: + \prg_return_false: + \fi: + \fi: + \fi: + \fi: + \fi: + } +\cs_new_protected_nopar:cpn { fp_compare_absolute_a<b: } + { + \if_int_compare:w \l_fp_input_b_exponent_int > \l_fp_input_a_exponent_int + \group_end: + \prg_return_true: + \else: + \if_int_compare:w \l_fp_input_b_exponent_int < \l_fp_input_a_exponent_int + \group_end: + \prg_return_false: + \else: + \if_int_compare:w \l_fp_input_b_integer_int > \l_fp_input_a_integer_int + \group_end: + \prg_return_true: + \else: + \if_int_compare:w + \l_fp_input_b_integer_int < \l_fp_input_a_integer_int + \group_end: + \prg_return_false: + \else: + \if_int_compare:w + \l_fp_input_b_decimal_int > \l_fp_input_a_decimal_int + \group_end: + \prg_return_true: + \else: + \group_end: + \prg_return_false: + \fi: + \fi: + \fi: + \fi: + \fi: + } +\cs_new_protected_nopar:cpn { fp_compare_<: } + { + \tl_set:Nx \l_fp_tmp_tl + { + \int_set:Nn \exp_not:N \l_fp_input_a_sign_int + { \int_use:N \l_fp_input_b_sign_int } + \int_set:Nn \exp_not:N \l_fp_input_a_integer_int + { \int_use:N \l_fp_input_b_integer_int } + \int_set:Nn \exp_not:N \l_fp_input_a_decimal_int + { \int_use:N \l_fp_input_b_decimal_int } + \int_set:Nn \exp_not:N \l_fp_input_a_exponent_int + { \int_use:N \l_fp_input_b_exponent_int } + \int_set:Nn \exp_not:N \l_fp_input_b_sign_int + { \int_use:N \l_fp_input_a_sign_int } + \int_set:Nn \exp_not:N \l_fp_input_b_integer_int + { \int_use:N \l_fp_input_a_integer_int } + \int_set:Nn \exp_not:N \l_fp_input_b_decimal_int + { \int_use:N \l_fp_input_a_decimal_int } + \int_set:Nn \exp_not:N \l_fp_input_b_exponent_int + { \int_use:N \l_fp_input_a_exponent_int } + } + \l_fp_tmp_tl + \use:c { fp_compare_>: } + } +\prg_new_protected_conditional:Npnn \fp_compare:n #1 { T , F , TF } + { + \group_begin: + \tl_set:Nx \l_fp_tmp_tl + { + \group_end: + \fp_compare_aux_i:w #1 \exp_not:n { == \q_nil == \q_stop } + } + \l_fp_tmp_tl + } +\cs_new_protected_nopar:Npn \fp_compare_aux_i:w #1 == #2 == #3 \q_stop + { + \quark_if_nil:nTF {#2} + { \fp_compare_aux_ii:w #1 != \q_nil != \q_stop } + { \fp_compare:nNnTF {#1} = {#2} \prg_return_true: \prg_return_false: } + } +\cs_new_protected_nopar:Npn \fp_compare_aux_ii:w #1 != #2 != #3 \q_stop + { + \quark_if_nil:nTF {#2} + { \fp_compare_aux_iii:w #1 <= \q_nil <= \q_stop } + { \fp_compare:nNnTF {#1} = {#2} \prg_return_false: \prg_return_true: } + } +\cs_new_protected_nopar:Npn \fp_compare_aux_iii:w #1 <= #2 <= #3 \q_stop + { + \quark_if_nil:nTF {#2} + { \fp_compare_aux_iv:w #1 >= \q_nil >= \q_stop } + { \fp_compare:nNnTF {#1} > {#2} \prg_return_false: \prg_return_true: } + } +\cs_new_protected_nopar:Npn \fp_compare_aux_iv:w #1 >= #2 >= #3 \q_stop + { + \quark_if_nil:nTF {#2} + { \fp_compare_aux_v:w #1 = \q_nil \q_stop } + { \fp_compare:nNnTF {#1} < {#2} \prg_return_false: \prg_return_true: } + } +\cs_new_protected_nopar:Npn \fp_compare_aux_v:w #1 = #2 = #3 \q_stop + { + \quark_if_nil:nTF {#2} + { \fp_compare_aux_vi:w #1 < \q_nil < \q_stop } + { \fp_compare:nNnTF {#1} = {#2} \prg_return_true: \prg_return_false: } + } +\cs_new_protected_nopar:Npn \fp_compare_aux_vi:w #1 < #2 < #3 \q_stop + { + \quark_if_nil:nTF {#2} + { \fp_compare_aux_vii:w #1 > \q_nil > \q_stop } + { \fp_compare:nNnTF {#1} < {#2} \prg_return_true: \prg_return_false: } + } +\cs_new_protected_nopar:Npn \fp_compare_aux_vii:w #1 > #2 > #3 \q_stop + { + \quark_if_nil:nTF {#2} + { \prg_return_false: } + { \fp_compare:nNnTF {#1} > {#2} \prg_return_true: \prg_return_false: } + } +\msg_kernel_new:nnnn { fpu } { overflow } + { Number~too~big. } + { + The~input~given~is~too~big~for~the~LaTeX~floating~point~unit. \\ + Further~errors~may~well~occur! + } +\cs_new_protected_nopar:Npn \fp_overflow_msg: + { \msg_kernel_error:nn { fpu } { overflow } } +\msg_kernel_new:nnnn { fpu } { exponent-overflow } + { Number~too~big~for~exponent~unit. } + { + The~exponent~of~the~input~given~is~too~big~for~the~floating~point~ + unit:~the~maximum~input~value~for~an~exponent~is~230. + } +\cs_new_protected_nopar:Npn \fp_exp_overflow_msg: + { \msg_kernel_error:nn { fpu } { exponent-overflow } } +\msg_kernel_new:nnnn { fpu } { logarithm-input-error } + { Invalid~input~to~ln~function. } + { Logarithms~can~only~be~calculated~for~positive~numbers. } +\cs_new_protected_nopar:Npn \fp_ln_error_msg: { + \msg_kernel_error:nn { fpu } { logarithm-input-error } +} +\msg_kernel_new:nnnn { fpu } { trigonometric-overflow } + { Number~too~big~for~trigonometry~unit. } + { + The~trigonometry~code~can~only~work~with~numbers~smaller~ + than~1000000000. + } +\cs_new_protected_nopar:Npn \fp_trig_overflow_msg: + { \msg_kernel_error:nn { fpu } { trigonometric-overflow } } +%% +%% +%% End of file `l3fp.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty new file mode 100644 index 00000000000..7f009832fcf --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty @@ -0,0 +1,743 @@ +%% +%% This is file `l3int.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3int.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3int.dtx Copyright (C) 1990-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3int.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental integers} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\cs_set_eq:NN \int_value:w \tex_number:D +\cs_set_eq:NN \int_eval:w \etex_numexpr:D +\cs_new_eq:NN \int_eval_end: \tex_relax:D +\cs_new_eq:NN \if_num:w \tex_ifnum:D +\cs_set_eq:NN \if_int_odd:w \tex_ifodd:D +\cs_new_eq:NN \if_case:w \tex_ifcase:D +\cs_new:Npn \int_eval:n #1 + { \int_value:w \int_eval:w #1 \int_eval_end: } +\cs_new:Npn \int_abs:n #1 + { + \int_value:w + \if_int_compare:w \int_eval:w #1 < \c_zero + - + \fi: + \int_eval:w #1 \int_eval_end: + } +\cs_new:Npn \int_max:nn #1#2 + { + \int_value:w \int_eval:w + \if_int_compare:w + \int_eval:w #1 > \int_eval:w #2 \int_eval_end: + #1 + \else: + #2 + \fi: + \int_eval_end: + } +\cs_new:Npn \int_min:nn #1#2 + { + \int_value:w \int_eval:w + \if_int_compare:w + \int_eval:w #1 < \int_eval:w #2 \int_eval_end: + #1 + \else: + #2 + \fi: + \int_eval_end: + } +\cs_new:Npn \int_div_truncate:nn #1#2 + { + \int_value:w \int_eval:w + \if_int_compare:w \int_eval:w #1 = \c_zero + 0 + \else: + ( #1 % ) + \if_int_compare:w \int_eval:w #1 < \c_zero + \if_int_compare:w \int_eval:w #2 < \c_zero + - ( #2 + % ) + \else: + + ( #2 - % ) + \fi: + \else: + \if_int_compare:w \int_eval:w #2 < \c_zero + + ( #2 + % ) + \else: + - ( #2 - % ) + \fi: + \fi: % ( ( + 1 ) / 2 ) + \fi: + / ( #2 ) + \int_eval_end: + } +\cs_new:Npn \int_div_round:nn #1#2 { \int_eval:n { ( #1 ) / ( #2 ) } } +\cs_new:Npn \int_mod:nn #1#2 + { + \int_value:w \int_eval:w + #1 - \int_div_truncate:nn {#1} {#2} * ( #2 ) + \int_eval_end: + } +\cs_new_protected_nopar:Npn \int_new:N #1 + { + \chk_if_free_cs:N #1 + \newcount #1 + } +\cs_generate_variant:Nn \int_new:N { c } +\cs_new_protected_nopar:Npn \int_const:Nn #1#2 + { + \int_compare:nNnTF {#2} > \c_minus_one + { + \int_compare:nNnTF {#2} > \c_max_register_int + { + \int_new:N #1 + \int_gset:Nn #1 {#2} + } + { + \chk_if_free_cs:N #1 + \pref_global:D \tex_mathchardef:D #1 = + \int_eval:w #2 \int_eval_end: + } + } + { + \int_new:N #1 + \int_gset:Nn #1 {#2} + } + } +\cs_generate_variant:Nn \int_const:Nn { c } +\cs_new_protected_nopar:Npn \int_zero:N #1 { #1 = \c_zero } +\cs_new_protected_nopar:Npn \int_gzero:N #1 { \pref_global:D #1 = \c_zero } +\cs_generate_variant:Nn \int_zero:N { c } +\cs_generate_variant:Nn \int_gzero:N { c } +\cs_new_protected_nopar:Npn \int_set_eq:NN #1#2 { #1 = #2 } +\cs_generate_variant:Nn \int_set_eq:NN { c } +\cs_generate_variant:Nn \int_set_eq:NN { Nc , cc } +\cs_new_protected_nopar:Npn \int_gset_eq:NN #1#2 { \pref_global:D #1 = #2 } +\cs_generate_variant:Nn \int_gset_eq:NN { c } +\cs_generate_variant:Nn \int_gset_eq:NN { Nc , cc } +\cs_new_protected_nopar:Npn \int_add:Nn #1#2 + { \tex_advance:D #1 by \int_eval:w #2 \int_eval_end: } +\cs_new_nopar:Npn \int_sub:Nn #1#2 + { \tex_advance:D #1 by - \int_eval:w #2 \int_eval_end: } +\cs_new_protected_nopar:Npn \int_gadd:Nn + { \pref_global:D \int_add:Nn } +\cs_new_protected_nopar:Npn \int_gsub:Nn + { \pref_global:D \int_sub:Nn } +\cs_generate_variant:Nn \int_add:Nn { c } +\cs_generate_variant:Nn \int_gadd:Nn { c } +\cs_generate_variant:Nn \int_sub:Nn { c } +\cs_generate_variant:Nn \int_gsub:Nn { c } +\cs_new_protected_nopar:Npn \int_incr:N #1 + { \tex_advance:D #1 \c_one } +\cs_new_protected_nopar:Npn \int_decr:N #1 + { \tex_advance:D #1 \c_minus_one } +\cs_new_protected_nopar:Npn \int_gincr:N + { \pref_global:D \int_incr:N } +\cs_new_protected_nopar:Npn \int_gdecr:N + { \pref_global:D \int_decr:N } +\cs_generate_variant:Nn \int_incr:N { c } +\cs_generate_variant:Nn \int_decr:N { c } +\cs_generate_variant:Nn \int_gincr:N { c } +\cs_generate_variant:Nn \int_gdecr:N { c } +\cs_new_protected_nopar:Npn \int_set:Nn #1#2 + { #1 ~ \int_eval:w #2\int_eval_end: } +\cs_new_protected_nopar:Npn \int_gset:Nn { \pref_global:D \int_set:Nn } +\cs_generate_variant:Nn \int_set:Nn { c } +\cs_generate_variant:Nn \int_gset:Nn { c } +\cs_new_eq:NN \int_use:N \tex_the:D +\cs_new_nopar:Npn \int_use:c #1 { \int_use:N \cs:w #1 \cs_end: } +\prg_new_conditional:Npnn \int_compare:n #1 { p , T , F , TF } + { \exp_after:wN \int_compare_aux:nw \int_value:w \int_eval:w #1 \q_stop } +\cs_new:Npn \int_compare_aux:nw #1#2 \q_stop + { + \exp_after:wN \int_compare_aux:Nw + \int_to_roman:w + \if:w #1 - + \else: + - + \fi: + #1#2 \q_mark #1#2 \q_stop + } +\cs_new:Npn \int_compare_aux:Nw #1#2#3 \q_mark + { \use:c { int_compare_ #1 \if_meaning:w = #2 = \fi: :w } } +\cs_new:cpn { int_compare_=:w } #1 = #2 \q_stop + { + \if_int_compare:w #1 = \int_eval:w #2 \int_eval_end: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new:cpn { int_compare_==:w } #1 == #2 \q_stop + { + \if_int_compare:w #1 = \int_eval:w #2 \int_eval_end: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new:cpn { int_compare_!=:w } #1 != #2 \q_stop + { + \if_int_compare:w #1 = \int_eval:w #2 \int_eval_end: + \prg_return_false: + \else: + \prg_return_true: + \fi: + } +\cs_new:cpn { int_compare_<:w } #1 < #2 \q_stop + { + \if_int_compare:w #1 < \int_eval:w #2 \int_eval_end: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new:cpn { int_compare_>:w } #1 > #2 \q_stop + { + \if_int_compare:w #1 > \int_eval:w #2 \int_eval_end: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new:cpn { int_compare_<=:w } #1 <= #2 \q_stop + { + \if_int_compare:w #1 > \int_eval:w #2 \int_eval_end: + \prg_return_false: + \else: + \prg_return_true: + \fi: + } +\cs_new:cpn { int_compare_>=:w } #1 >= #2 \q_stop + { + \if_int_compare:w #1 < \int_eval:w #2 \int_eval_end: + \prg_return_false: + \else: + \prg_return_true: + \fi: + } +\prg_new_conditional:Npnn \int_compare:nNn #1#2#3 { p , T , F , TF} + { + \if_int_compare:w \int_eval:w #1 #2 \int_eval:w #3 \int_eval_end: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\prg_new_conditional:Npnn \int_if_odd:n #1 { p , T , F , TF} + { + \if_int_odd:w \int_eval:w #1 \int_eval_end: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\prg_new_conditional:Npnn \int_if_even:n #1 { p , T , F , TF} + { + \if_int_odd:w \int_eval:w #1 \int_eval_end: + \prg_return_false: + \else: + \prg_return_true: + \fi: + } +\cs_new:Npn \int_while_do:nn #1#2 + { + \int_compare:nT {#1} + { + #2 + \int_while_do:nn {#1} {#2} + } + } +\cs_new:Npn \int_until_do:nn #1#2 + { + \int_compare:nF {#1} + { + #2 + \int_until_do:nn {#1} {#2} + } + } +\cs_new:Npn \int_do_while:nn #1#2 + { + #2 + \int_compare:nT {#1} + { \int_do_while:nNnn {#1} {#2} } + } +\cs_new:Npn \int_do_until:nn #1#2 + { + #2 + \int_compare:nF {#1} + { \int_do_until:nn {#1} {#2} } + } +\cs_new:Npn \int_while_do:nNnn #1#2#3#4 + { + \int_compare:nNnT {#1} #2 {#3} + { + #4 + \int_while_do:nNnn {#1} #2 {#3} {#4} + } + } +\cs_new:Npn \int_until_do:nNnn #1#2#3#4 + { + \int_compare:nNnF {#1} #2 {#3} + { + #4 + \int_until_do:nNnn {#1} #2 {#3} {#4} + } + } +\cs_new:Npn \int_do_while:nNnn #1#2#3#4 + { + #4 + \int_compare:nNnT {#1} #2 {#3} + { \int_do_while:nNnn {#1} #2 {#3} {#4} } + } +\cs_new:Npn \int_do_until:nNnn #1#2#3#4 + { + #4 + \int_compare:nNnF {#1} #2 {#3} + { \int_do_until:nNnn {#1} #2 {#3} {#4} } + } +\cs_new_nopar:Npn \int_to_arabic:n #1 { \int_eval:n {#1} } +\cs_new_nopar:Npn \int_to_symbols:nnn #1#2#3 + { + \int_compare:nNnTF {#1} > {#2} + { + \exp_args:Nf \int_to_symbols:nnn + { \int_div_truncate:nn { #1 - 1 } {#2} } {#2} {#3} + \exp_args:Nf \prg_case_int:nnn + { \int_eval:n { 1 + \int_mod:nn { #1 - 1 } {#2} } } + {#3} { } + } + { \exp_args:Nf \prg_case_int:nnn { \int_eval:n {#1} } {#3} { } } + } +\cs_new:Npn \int_to_alph:n #1 + { + \int_to_symbols:nnn {#1} { 26 } + { + { 1 } { a } + { 2 } { b } + { 3 } { c } + { 4 } { d } + { 5 } { e } + { 6 } { f } + { 7 } { g } + { 8 } { h } + { 9 } { i } + { 10 } { j } + { 11 } { k } + { 12 } { l } + { 13 } { m } + { 14 } { n } + { 15 } { o } + { 16 } { p } + { 17 } { q } + { 18 } { r } + { 19 } { s } + { 20 } { t } + { 21 } { u } + { 22 } { v } + { 23 } { w } + { 24 } { x } + { 25 } { y } + { 26 } { z } + } + } +\cs_new:Npn \int_to_Alph:n #1 + { + \int_to_symbols:nnn {#1} { 26 } + { + { 1 } { A } + { 2 } { B } + { 3 } { C } + { 4 } { D } + { 5 } { E } + { 6 } { F } + { 7 } { G } + { 8 } { H } + { 9 } { I } + { 10 } { J } + { 11 } { K } + { 12 } { L } + { 13 } { M } + { 14 } { N } + { 15 } { O } + { 16 } { P } + { 17 } { Q } + { 18 } { R } + { 19 } { S } + { 20 } { T } + { 21 } { U } + { 22 } { V } + { 23 } { W } + { 24 } { X } + { 25 } { Y } + { 26 } { Z } + } + } +\cs_new:Npn \int_to_base:nn #1#2 + { + \int_compare:nNnTF {#1} < \c_zero + { + - + \exp_args:Nnf \int_to_base_aux:nnn + { } { \int_eval:n { 0 - ( #1 ) } } {#2} + } + { + \exp_args:Nnf \int_to_base_aux:nnn + { } { \int_eval:n {#1} } {#2} + } +} +\cs_new:Npn \int_to_base_aux:nnn #1#2#3 { + \int_compare:nNnTF {#2} < {#3} + { + \int_to_letter:n {#2} + #1 + } + { + \exp_args:Nff \int_to_base_aux:nnn + { + \int_to_letter:n { \int_mod:nn {#2} {#3} } + #1 + } + { \int_div_truncate:nn {#2} {#3} } + {#3} + } + } +\cs_new:Npn \int_to_letter:n #1 + { + \prg_case_int:nnn { #1 - 9 } + { + { 1 } { A } + { 2 } { B } + { 3 } { C } + { 4 } { D } + { 5 } { E } + { 6 } { F } + { 7 } { G } + { 8 } { H } + { 9 } { I } + { 10 } { J } + { 11 } { K } + { 12 } { L } + { 13 } { M } + { 14 } { N } + { 15 } { O } + { 16 } { P } + { 17 } { Q } + { 18 } { R } + { 19 } { S } + { 20 } { T } + { 21 } { U } + { 22 } { V } + { 23 } { W } + { 24 } { X } + { 25 } { Y } + { 26 } { Z } + } + {#1} + } +\cs_new:Npn \int_to_binary:n #1 + { \int_to_base:nn {#1} { 2 } } +\cs_new:Npn \int_to_hexadecimal:n #1 + { \int_to_base:nn {#1} { 16 } } +\cs_new:Npn \int_to_octal:n #1 + { \int_to_base:nn {#1} { 8 } } +\cs_new_nopar:Npn \int_to_roman:n #1 + { + \exp_after:wN \int_to_roman_aux:N + \int_to_roman:w \int_eval:n {#1} Q + } +\cs_new_nopar:Npn \int_to_roman_aux:N #1 + { + \use:c { int_to_roman_ #1 :w } + \int_to_roman_aux:N + } +\cs_new_nopar:Npn \int_to_Roman:n #1 + { + \exp_after:wN \int_to_Roman_aux:N + \int_to_roman:w \int_eval:n {#1} Q + } +\cs_new_nopar:Npn \int_to_Roman_aux:N #1 + { + \use:c { int_to_Roman_ #1 :w } + \int_to_Roman_aux:N + } +\cs_new_nopar:Npn \int_to_roman_i:w { i } +\cs_new_nopar:Npn \int_to_roman_v:w { v } +\cs_new_nopar:Npn \int_to_roman_x:w { x } +\cs_new_nopar:Npn \int_to_roman_l:w { l } +\cs_new_nopar:Npn \int_to_roman_c:w { c } +\cs_new_nopar:Npn \int_to_roman_d:w { d } +\cs_new_nopar:Npn \int_to_roman_m:w { m } +\cs_new_nopar:Npn \int_to_roman_Q:w #1 { } +\cs_new_nopar:Npn \int_to_Roman_i:w { I } +\cs_new_nopar:Npn \int_to_Roman_v:w { V } +\cs_new_nopar:Npn \int_to_Roman_x:w { X } +\cs_new_nopar:Npn \int_to_Roman_l:w { L } +\cs_new_nopar:Npn \int_to_Roman_c:w { C } +\cs_new_nopar:Npn \int_to_Roman_d:w { D } +\cs_new_nopar:Npn \int_to_Roman_m:w { M } +\cs_new_nopar:Npn \int_to_Roman_Q:w #1 { } +\cs_new:Npn \int_get_sign:n #1 + { + \int_get_sign_and_digits_aux:nNNN {#1} + \c_true_bool \c_true_bool \c_false_bool + } +\cs_new:Npn \int_get_digits:n #1 + { + \int_get_sign_and_digits_aux:nNNN {#1} + \c_true_bool \c_false_bool \c_true_bool + } +\cs_new:Npn \int_get_sign_and_digits_aux:nNNN #1#2#3#4 + { + \tl_if_head_eq_charcode:fNTF {#1} - + { + \bool_if:NTF #2 + { + \int_get_sign_and_digits_aux:oNNN + { \use_none:n #1 } \c_false_bool #3#4 + } + { + \int_get_sign_and_digits_aux:oNNN + { \use_none:n #1 } \c_true_bool #3#4 + } + } + { + \tl_if_head_eq_charcode:fNTF {#1} + + { \int_get_sign_and_digits_aux:oNNN { \use_none:n #1 } #2#3#4 } + { + \bool_if:NT #3 { \bool_if:NF #2 - } + \bool_if:NT #4 {#1} + } + } + } +\cs_generate_variant:Nn \int_get_sign_and_digits_aux:nNNN { o } +\cs_new:Npn \int_from_alph:n #1 + { + \int_eval:n + { + \int_get_sign:n {#1} + \exp_args:Nf \int_from_alph_aux:n { \int_get_digits:n {#1} } + } + } +\cs_new:Npn \int_from_alph_aux:n #1 + { \int_from_alph_aux:nN { 0 } #1 \q_nil } +\cs_new:Npn \int_from_alph_aux:nN #1#2 + { + \quark_if_nil:NTF #2 + {#1} + { + \exp_args:Nf \int_from_alph_aux:nN + { \int_eval:n { #1 * 26 + \int_from_alph_aux:N #2 } } + } + } +\cs_new:Npn \int_from_alph_aux:N #1 + { \int_eval:n { `#1 - \int_compare:nNnTF { `#1 } < { 91 } { 64 } { 96 } } } +\cs_new:Npn \int_from_base:nn #1#2 + { + \int_eval:n + { + \int_get_sign:n {#1} + \exp_args:Nf \int_from_base_aux:nn + { \int_get_digits:n {#1} } {#2} + } + } +\cs_new:Npn \int_from_base_aux:nn #1#2 + { \int_from_base_aux:nnN { 0 } { #2 } #1 \q_nil } +\cs_new:Npn \int_from_base_aux:nnN #1#2#3 + { + \quark_if_nil:NTF #3 + {#1} + { + \exp_args:Nf \int_from_base_aux:nnN + { \int_eval:n { #1 * #2 + \int_from_base_aux:N #3 } } + {#2} + } + } +\cs_new:Npn \int_from_base_aux:N #1 + { + \int_compare:nNnTF { `#1 } < { 58 } + {#1} + { + \int_eval:n + { `#1 - \int_compare:nNnTF { `#1 } < { 91 } { 55 } { 87 } } + } + } +\cs_new:Npn \int_from_binary:n #1 + { \int_from_base:nn {#1} \c_two } +\cs_new:Npn \int_from_hexadecimal:n #1 + { \int_from_base:nn {#1} \c_sixteen } +\cs_new:Npn \int_from_octal:n #1 + { \int_from_base:nn {#1} \c_eight } +\int_const:cn { c_int_from_roman_i_int } { 1 } +\int_const:cn { c_int_from_roman_v_int } { 5 } +\int_const:cn { c_int_from_roman_x_int } { 10 } +\int_const:cn { c_int_from_roman_l_int } { 50 } +\int_const:cn { c_int_from_roman_c_int } { 100 } +\int_const:cn { c_int_from_roman_d_int } { 500 } +\int_const:cn { c_int_from_roman_m_int } { 1000 } +\int_const:cn { c_int_from_roman_I_int } { 1 } +\int_const:cn { c_int_from_roman_V_int } { 5 } +\int_const:cn { c_int_from_roman_X_int } { 10 } +\int_const:cn { c_int_from_roman_L_int } { 50 } +\int_const:cn { c_int_from_roman_C_int } { 100 } +\int_const:cn { c_int_from_roman_D_int } { 500 } +\int_const:cn { c_int_from_roman_M_int } { 1000 } +\cs_new_nopar:Npn \int_from_roman:n #1 + { + \tl_if_blank:nF {#1} + { + \exp_after:wN \int_from_roman_end:w + \int_value:w \int_eval:w + \int_from_roman_aux:NN #1 Q \q_stop + } + } +\cs_new_nopar:Npn \int_from_roman_aux:NN #1#2 + { + \str_if_eq:nnTF {#1} { Q } + {#1#2} + { + \str_if_eq:nnTF {#2} { Q } + { + \cs_if_exist:cF { c_int_from_roman_ #1 _int } + { \int_from_roman_clean_up:w } + + + \use:c { c_int_from_roman_ #1 _int } + #2 + } + { + \cs_if_exist:cF { c_int_from_roman_ #1 _int } + { \int_from_roman_clean_up:w } + \cs_if_exist:cF { c_int_from_roman_ #2 _int } + { \int_from_roman_clean_up:w } + \int_compare:nNnTF + { \use:c { c_int_from_roman_ #1 _int } } + < + { \use:c { c_int_from_roman_ #2 _int } } + { + + \use:c { c_int_from_roman_ #2 _int } + - \use:c { c_int_from_roman_ #1 _int } + \int_from_roman_aux:NN + } + { + + \use:c { c_int_from_roman_ #1 _int } + \int_from_roman_aux:NN #2 + } + } + } + } +\cs_new_nopar:Npn \int_from_roman_end:w #1 Q #2 \q_stop + { \tl_if_empty:nTF {#2} {#1} {#2} } +\cs_new_nopar:Npn \int_from_roman_clean_up:w #1 Q { + 0 Q -1 } +\cs_new_eq:NN \int_show:N \kernel_register_show:N +\cs_new_eq:NN \int_show:c \kernel_register_show:c +\int_const:Nn \c_one { 1 } +\int_const:Nn \c_two { 2 } +\int_const:Nn \c_three { 3 } +\int_const:Nn \c_four { 4 } +\int_const:Nn \c_five { 5 } +\int_const:Nn \c_eight { 8 } +\int_const:Nn \c_nine { 9 } +\int_const:Nn \c_ten { 10 } +\int_const:Nn \c_eleven { 11 } +\int_const:Nn \c_thirteen { 13 } +\int_const:Nn \c_fourteen { 14 } +\int_const:Nn \c_fifteen { 15 } +\int_const:Nn \c_thirty_two { 32 } +\int_const:Nn \c_two_hundred_fifty_five { 255 } +\int_const:Nn \c_two_hundred_fifty_six { 256 } +\int_const:Nn \c_one_hundred { 100 } +\int_const:Nn \c_one_thousand { 1000 } +\int_const:Nn \c_ten_thousand { 10000 } +\int_const:Nn \c_max_int { 2 147 483 647 } +\int_new:N \l_tmpa_int +\int_new:N \l_tmpb_int +\int_new:N \l_tmpc_int +\int_new:N \g_tmpa_int +\int_new:N \g_tmpb_int +\int_new:N \g_seq_nesting_depth_int +\int_new:N \g_tl_inline_level_int +\cs_new_eq:NN \int_convert_from_base_ten:nn \int_to_base:nn +\cs_new_eq:NN \int_convert_to_symbols:nnn \int_to_symbols:nnn +\cs_new_eq:NN \int_convert_to_base_ten:nn \int_from_base:nn +\cs_new_nopar:Npn \int_to_symbol:n + { + \mode_if_math:TF + { \int_to_symbol_math:n } + { \int_to_symbol_text:n } + } +\cs_new:Npn \int_to_symbol_math:n #1 + { + \int_to_symbols:nnn {#1} { 9 } + { + { 1 } { * } + { 2 } { \dagger } + { 3 } { \ddagger } + { 4 } { \mathsection } + { 5 } { \mathparagraph } + { 6 } { \| } + { 7 } { ** } + { 8 } { \dagger \dagger } + { 9 } { \ddagger \ddagger } + } + } +\cs_new:Npn \int_to_symbol_text:n #1 + { + \int_to_symbols:nnn {#1} { 9 } + { + { 1 } { \textasteriskcentered } + { 2 } { \textdagger } + { 3 } { \textdaggerdbl } + { 4 } { \textsection } + { 5 } { \textparagraph } + { 6 } { \textbardbl } + { 7 } { \textasteriskcentered \textasteriskcentered } + { 8 } { \textdagger \textdagger } + { 9 } { \textdaggerdbl \textdaggerdbl } + } + } +%% +%% +%% End of file `l3int.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3io.sty b/Master/texmf-dist/tex/latex/l3kernel/l3io.sty new file mode 100644 index 00000000000..7239fbae288 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3io.sty @@ -0,0 +1,430 @@ +%% +%% This is file `l3io.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3io.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3io.dtx Copyright (C) 1990-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3io.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental input-output operations} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\cs_new_eq:NN \if_eof:w \tex_ifeof:D +\cs_new_eq:NN \c_iow_term_stream \c_sixteen +\cs_new_eq:NN \c_ior_term_stream \c_sixteen +\cs_new_eq:NN \c_iow_log_stream \c_minus_one +\cs_new_eq:NN \c_ior_log_stream \c_minus_one +\tl_const:Nn \c_iow_streams_tl + { + \c_zero + \c_one + \c_two + \c_three + \c_four + \c_five + \c_six + \c_seven + \c_eight + \c_nine + \c_ten + \c_eleven + \c_twelve + \c_thirteen + \c_fourteen + \c_fifteen + } +\cs_new_eq:NN \c_ior_streams_tl \c_iow_streams_tl +\prop_new:N \g_iow_streams_prop +\prop_new:N \g_ior_streams_prop +\prop_put:Nnn \g_iow_streams_prop { 0 } { LaTeX2e~reserved } +\prop_put:Nnn \g_iow_streams_prop { 1 } { LaTeX2e~reserved } +\prop_put:Nnn \g_iow_streams_prop { 2 } { LaTeX2e~reserved } +\prop_put:Nnn \g_ior_streams_prop { 0 } { LaTeX2e~reserved } +\int_new:N \l_iow_stream_int +\cs_new_eq:NN \l_ior_stream_int \l_iow_stream_int +\cs_set_eq:NN \iow_raw_new:N \newwrite +\cs_set_eq:NN \ior_raw_new:N \newread +\cs_generate_variant:Nn \ior_raw_new:N { c } +\cs_generate_variant:Nn \iow_raw_new:N { c } +\cs_new_protected_nopar:Npn \ior_open:Nn #1#2 + { + \ior_close:N #1 + \int_set:Nn \l_ior_stream_int \c_sixteen + \tl_map_function:NN \c_ior_streams_tl \ior_alloc_read:n + \int_compare:nNnTF \l_ior_stream_int = \c_sixteen + { \msg_kernel_error:nn { ior } { streams-exhausted } } + { + \ior_stream_alloc:N #1 + \prop_gput:NVn \g_ior_streams_prop \l_ior_stream_int {#2} + \tex_openin:D #1#2 \scan_stop: + } + } +\cs_new_protected_nopar:Npn \iow_open:Nn #1#2 + { + \iow_close:N #1 + \int_set:Nn \l_iow_stream_int \c_sixteen + \tl_map_function:NN \c_iow_streams_tl \iow_alloc_write:n + \int_compare:nNnTF \l_iow_stream_int = \c_sixteen + { \msg_kernel_error:nn { iow } { streams-exhausted } } + { + \iow_stream_alloc:N #1 + \prop_gput:NVn \g_iow_streams_prop \l_iow_stream_int {#2} + \tex_immediate:D \tex_openout:D #1#2 \scan_stop: + } + } +\cs_generate_variant:Nn \ior_open:Nn { c } +\cs_generate_variant:Nn \iow_open:Nn { c } +\cs_new_protected_nopar:Npn \iow_alloc_write:n #1 + { + \prop_if_in:NnF \g_iow_streams_prop {#1} + { + \int_set:Nn \l_iow_stream_int {#1} + \tl_map_break: + } + } +\cs_new_protected_nopar:Npn \ior_alloc_read:n #1 + { + \prop_if_in:NnF \g_iow_streams_prop {#1} + { + \int_set:Nn \l_ior_stream_int {#1} + \tl_map_break: + } + } +\cs_new_protected_nopar:Npn \iow_stream_alloc:N #1 + { + \cs_if_exist:cTF { g_iow_ \int_use:N \l_iow_stream_int _stream } + { \cs_gset_eq:Nc #1 { g_iow_ \int_use:N \l_iow_stream_int _stream } } + { + \iow_stream_alloc_aux: + \int_compare:nNnT \l_iow_stream_int = \c_sixteen + { + \iow_raw_new:N \g_iow_tmp_stream + \int_set:Nn \l_iow_stream_int { \g_iow_tmp_stream } + \cs_gset_eq:cN + { g_iow_ \int_use:N \l_iow_stream_int _stream } + \g_iow_tmp_stream + } + \cs_gset_eq:Nc #1 { g_iow_ \int_use:N \l_iow_stream_int _stream } + } + } +\cs_new_protected_nopar:Npn \iow_stream_alloc_aux: + { + \int_incr:N \l_iow_stream_int + \int_compare:nNnT \l_iow_stream_int < \c_sixteen + { + \cs_if_exist:cTF { g_iow_ \int_use:N \l_iow_stream_int _stream } + { + \prop_if_in:NVT \g_iow_streams_prop \l_iow_stream_int + { \iow_stream_alloc_aux: } + } + { \iow_stream_alloc_aux: } + } + } +\cs_new_protected_nopar:Npn \ior_stream_alloc:N #1 + { + \cs_if_exist:cTF { g_ior_ \int_use:N \l_ior_stream_int _stream } + { \cs_gset_eq:Nc #1 { g_ior_ \int_use:N \l_ior_stream_int _stream } } + { + \ior_stream_alloc_aux: + \int_compare:nNnT \l_ior_stream_int = \c_sixteen + { + \ior_raw_new:N \g_ior_tmp_stream + \int_set:Nn \l_ior_stream_int { \g_ior_tmp_stream } + \cs_gset_eq:cN + { g_ior_ \int_use:N \l_iow_stream_int _stream } + \g_ior_tmp_stream + } + \cs_gset_eq:Nc #1 { g_ior_ \int_use:N \l_ior_stream_int _stream } + } + } +\cs_new_protected_nopar:Npn \ior_stream_alloc_aux: + { + \int_incr:N \l_ior_stream_int + \int_compare:nNnT \l_ior_stream_int < \c_sixteen + { + \cs_if_exist:cTF { g_ior_ \int_use:N \l_ior_stream_int _stream } + { + \prop_if_in:NVT \g_ior_streams_prop \l_ior_stream_int + { \ior_stream_alloc_aux: } + } + { \ior_stream_alloc_aux: } + } + } +\cs_new_protected_nopar:Npn \ior_close:N #1 + { + \cs_if_exist:NT #1 + { + \int_compare:nNnF #1 = \c_minus_one + { + \tex_closein:D #1 + \prop_gdel:NV \g_ior_streams_prop #1 + \cs_undefine:N #1 + } + } + } +\cs_new_protected_nopar:Npn \iow_close:N #1 + { + \cs_if_exist:NT #1 + { + \int_compare:nNnF #1 = \c_minus_one + { + \tex_immediate:D \tex_closeout:D #1 + \prop_gdel:NV \g_iow_streams_prop #1 + \cs_undefine:N #1 + } + } + } +\cs_generate_variant:Nn \ior_close:N { c } +\cs_generate_variant:Nn \iow_close:N { c } +\cs_new_protected_nopar:Npn \ior_list_streams: + { + \prop_if_empty:NTF \g_ior_streams_prop + { + \iow_term:x { No~input~streams~are~open } + \tl_show:n { } + } + { + \iow_term:x { The~following~input~streams~are~in~use: } + \tl_set:Nx \l_prop_show_tl + { \prop_map_function:NN \g_ior_streams_prop \ior_show_aux:nn } + \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN + { \exp_after:wN \prop_show_aux:w \l_prop_show_tl } + } + } +\cs_new:Npn \ior_show_aux:nn #1#2 + { + \iow_newline: > \c_space_tl \c_space_tl + #1 \iow_char:N + \c_space_tl \c_space_tl => \c_space_tl \c_space_tl + \exp_not:n {#2} + } +\cs_new_protected_nopar:Npn \iow_list_streams: + { + \prop_if_empty:NTF \g_iow_streams_prop + { + \iow_term:x { No~output~streams~are~open } + \tl_show:n { } + } + { + \iow_term:x { The~following~output~streams~are~in~use: } + \tl_set:Nx \l_prop_show_tl + { \prop_map_function:NN \g_iow_streams_prop \iow_show_aux:nn } + \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN + { \exp_after:wN \prop_show_aux:w \l_prop_show_tl } + } + } +\cs_new_eq:NN \iow_show_aux:nn \ior_show_aux:nn +\msg_kernel_new:nnnn { iow } { streams-exhausted } + { Output~streams~exhausted } + { + TeX~can~only~open~up~to~16~output~streams~at~one~time.\\ + All~16 are currently~in~use,~and~something~wanted~to~open + another~one. + } +\msg_kernel_new:nnnn { ior } { streams-exhausted } + { Input~streams~exhausted } + { + TeX~can~only~open~up~to~16~input~streams~at~one~time.\\ + All~16 are currently~in~use,~and~something~wanted~to~open + another~one. + } +\cs_new_eq:NN \iow_shipout_x:Nn \tex_write:D +\cs_generate_variant:Nn \iow_shipout_x:Nn { Nx } +\cs_new_protected_nopar:Npn \iow_shipout:Nn #1#2 + { \iow_shipout_x:Nn #1 { \exp_not:n {#2} } } +\cs_generate_variant:Nn \iow_shipout:Nn { Nx } +\cs_new_protected_nopar:Npn \iow_now:Nx { \tex_immediate:D \iow_shipout_x:Nn } +\cs_new_protected_nopar:Npn \iow_now:Nn #1#2 + { \iow_now:Nx #1 { \exp_not:n {#2} } } +\cs_set_protected_nopar:Npn \iow_log:x { \iow_now:Nx \c_iow_log_stream } +\cs_new_protected_nopar:Npn \iow_log:n { \iow_now:Nn \c_iow_log_stream } +\cs_set_protected_nopar:Npn \iow_term:x { \iow_now:Nx \c_iow_term_stream } +\cs_new_protected_nopar:Npn \iow_term:n { \iow_now:Nn \c_iow_term_stream } +\cs_new_protected_nopar:Npn \iow_now_when_avail:Nn #1 + { \cs_if_free:NTF #1 { \use_none:n } { \iow_now:Nn #1 } } +\cs_new_protected_nopar:Npn \iow_now_when_avail:Nx #1 + { \cs_if_free:NTF #1 { \use_none:n } { \iow_now:Nx #1 } } +\int_new:N \l_iow_line_length_int +\int_set:Nn \l_iow_line_length_int { 78 } +\int_new:N \l_iow_target_length_int +\int_new:N \l_iow_current_line_int +\int_new:N \l_iow_current_word_int +\tl_new:N \l_iow_current_line_tl +\tl_new:N \l_iow_current_word_tl +\tl_new:N \l_iow_wrap_tl +\tl_new:N \l_iow_wrapped_tl +\quark_new:N \q_iow_stop +\bool_new:N \l_iow_line_start_bool +\cs_new_protected:Npn \iow_wrap:xnnnN #1#2#3#4#5 + { + \group_begin: + \int_set:Nn \l_iow_target_length_int { \l_iow_line_length_int - ( #3 ) } + \int_zero:N \l_iow_current_line_int + \tl_clear:N \l_iow_current_line_tl + \tl_clear:N \l_iow_wrap_tl + \bool_set_true:N \l_iow_line_start_bool + \cs_set:Npx \\ { \c_space_tl \iow_newline: \c_space_tl } + \cs_set_eq:NN \ \c_space_tl + #4 + \protected@edef \l_iow_wrap_tl {#1} + \cs_set:Npn \\ { \iow_newline: #2 } + \use:x + { + \exp_not:N \iow_wrap_loop:w + \tl_to_str:N \l_iow_wrap_tl \c_space_tl + \exp_not:N \q_iow_stop \c_space_tl + } + \exp_args:NNo \group_end: + #5 \l_iow_wrapped_tl + } +\cs_new_protected:Npn \iow_wrap_loop:w #1 ~ % + { + \tl_set:Nn \l_iow_current_word_tl {#1} + \tl_if_eq:NNTF \l_iow_current_word_tl \iow_newline: + { \iow_wrap_newline: } + { + \tl_if_eq:NNTF \l_iow_current_word_tl \q_iow_stop + { \iow_wrap_end: } + { \iow_wrap_word: } + } + } +\cs_new_protected_nopar:Npn \iow_wrap_word: + { + \int_set:Nn \l_iow_current_word_int + { \str_length_skip_spaces:N \l_iow_current_word_tl } + \int_add:Nn \l_iow_current_line_int { \l_iow_current_word_int } + \int_compare:nNnTF \l_iow_current_line_int + < \l_iow_target_length_int + { \iow_wrap_word_fits: } + { \iow_wrap_word_newline: } + \iow_wrap_loop:w + } +\cs_new_protected_nopar:Npn \iow_wrap_word_fits: + { + \bool_if:NTF \l_iow_line_start_bool + { + \bool_set_false:N \l_iow_line_start_bool + \tl_set_eq:NN \l_iow_current_line_tl \l_iow_current_word_tl + } + { + \tl_put_right:Nx \l_iow_current_line_tl + { ~ \l_iow_current_word_tl } + \int_incr:N \l_iow_current_line_int + } + } +\cs_new_protected_nopar:Npn \iow_wrap_word_newline: + { + \tl_put_right:Nx \l_iow_wrapped_tl + { \l_iow_current_line_tl \\ } + \int_set_eq:NN \l_iow_current_line_int \l_iow_current_word_int + \tl_set_eq:NN \l_iow_current_line_tl \l_iow_current_word_tl + } +\cs_new_protected_nopar:Npn \iow_wrap_newline: + { + \tl_put_right:Nx \l_iow_wrapped_tl + { \l_iow_current_line_tl \\ } + \int_zero:N \l_iow_current_line_int + \tl_clear:N \l_iow_current_line_tl + \bool_set_true:N \l_iow_line_start_bool + \iow_wrap_loop:w + } +\cs_new_protected_nopar:Npn \iow_wrap_end: + { + \tl_put_right:Nx \l_iow_wrapped_tl + { \l_iow_current_line_tl } + } +\cs_new_nopar:Npn \str_length_skip_spaces:N + { \exp_args:No \str_length_skip_spaces:n } +\cs_new:Npn \str_length_skip_spaces:n #1 + { + \int_value:w \int_eval:w + \exp_after:wN \str_length_loop:NNNNNNNNN \tl_to_str:n {#1} + {X8}{X7}{X6}{X5}{X4}{X3}{X2}{X1}{X0} \q_stop + \int_eval_end: + } +\cs_new:Npn \str_length_loop:NNNNNNNNN #1#2#3#4#5#6#7#8#9 + { + \if_catcode:w X #9 + \exp_after:wN \use_none_delimit_by_q_stop:w + \else: + 9 + + \exp_after:wN \str_length_loop:NNNNNNNNN + \fi: + } +\cs_new_nopar:Npn \iow_newline: { ^^J } +\cs_new_eq:NN \iow_char:N \cs_to_str:N +\prg_new_conditional:Nnn \ior_if_eof:N { p , T , F , TF } + { + \cs_if_exist:NTF #1 + { + \if_eof:w #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + { \prg_return_true: } + } +\cs_new_protected_nopar:Npn \ior_to:NN #1#2 + { \tex_read:D #1 to #2 } +\cs_new_protected_nopar:Npn \ior_gto:NN #1#2 + { \pref_global:D \tex_read:D #1 to #2 } +\cs_new_protected_nopar:Npn \ior_str_to:NN #1#2 + { \etex_readline:D #1 to #2 } +\cs_new_protected_nopar:Npn \ior_str_gto:NN #1#2 + { \pref_global:D \etex_readline:D #1 to #2 } +\cs_new_protected:Npn \iow_now_buffer_safe:Nn #1#2 + { \iow_wrap:xnnnN { \exp_not:n {#2} } { } \c_zero { } \iow_now:Nn #1 } +\cs_new_protected:Npn \iow_now_buffer_safe:Nx #1#2 + { \iow_wrap:xnnnN {#2} { } \c_zero { } \iow_now:Nn #1 } +\cs_new_eq:NN \ior_new:N \use_none:n +\cs_new_eq:NN \ior_new:c \use_none:n +\cs_new_eq:NN \iow_new:N \use_none:n +\cs_new_eq:NN \iow_new:c \use_none:n +\cs_new_eq:NN \ior_open_streams: \ior_list_streams: +\cs_new_eq:NN \iow_open_streams: \iow_list_streams: +%% +%% +%% End of file `l3io.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty b/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty new file mode 100644 index 00000000000..b12add10c9c --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty @@ -0,0 +1,475 @@ +%% +%% This is file `l3keys.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3keys.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3keys.dtx Copyright (C) 2009-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3keys.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental key-value interfaces} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\tl_const:Nn \c_keys_code_root_tl { key~code~>~ } +\tl_const:Nn \c_keys_vars_root_tl { key~var~>~ } +\tl_const:Nn \c_keys_props_root_tl { key~prop~>~ } +\tl_const:Nn \c_keys_value_forbidden_tl { forbidden } +\tl_const:Nn \c_keys_value_required_tl { required } +\int_new:N \l_keys_choice_int +\tl_new:N \l_keys_choices_tl +\tl_new:N \l_keys_key_tl +\tl_new:N \l_keys_module_tl +\bool_new:N \l_keys_no_value_bool +\tl_new:N \l_keys_path_tl +\tl_new:N \l_keys_property_tl +\tl_new:N \l_keys_value_tl +\cs_new_protected:Npn \keys_define:nn + { \keys_define_aux:onn \l_keys_module_tl } +\cs_new_protected:Npn \keys_define_aux:nnn #1#2#3 + { + \tl_set:Nx \l_keys_module_tl { \tl_to_str:n {#2} } + \keyval_parse:NNn \keys_define_elt:n \keys_define_elt:nn {#3} + \tl_set:Nn \l_keys_module_tl {#1} + } +\cs_generate_variant:Nn \keys_define_aux:nnn { o } +\cs_new_protected_nopar:Npn \keys_define_elt:n #1 + { + \bool_set_true:N \l_keys_no_value_bool + \keys_define_elt_aux:nn {#1} { } + } +\cs_new_protected:Npn \keys_define_elt:nn #1#2 + { + \bool_set_false:N \l_keys_no_value_bool + \keys_define_elt_aux:nn {#1} {#2} + } +\cs_new_protected:Npn \keys_define_elt_aux:nn #1#2 { + \keys_property_find:n {#1} + \cs_if_exist:cTF { \c_keys_props_root_tl \l_keys_property_tl } + { \keys_define_key:n {#2} } + { + \msg_kernel_error:nnxx { keys } { property-unknown } + { \l_keys_property_tl } { \l_keys_path_tl } + } +} +\cs_new_protected_nopar:Npn \keys_property_find:n #1 + { + \tl_set:Nx \l_keys_path_tl { \l_keys_module_tl / } + \tl_if_in:nnTF {#1} { . } + { \keys_property_find_aux:w #1 \q_stop } + { \msg_kernel_error:nnx { keys } { key-no-property } {#1} } + } +\cs_new_protected_nopar:Npn \keys_property_find_aux:w #1 . #2 \q_stop + { + \tl_set:Nx \l_keys_path_tl { \l_keys_path_tl \tl_to_str:n {#1} } + \tl_if_in:nnTF {#2} { . } + { + \tl_set:Nx \l_keys_path_tl { \l_keys_path_tl . } + \keys_property_find_aux:w #2 \q_stop + } + { \tl_set:Nn \l_keys_property_tl { . #2 } } + } +\cs_new_protected:Npn \keys_define_key:n #1 + { + \bool_if:NTF \l_keys_no_value_bool + { + \exp_after:wN \keys_define_key_aux:w + \l_keys_property_tl \q_stop + { \use:c { \c_keys_props_root_tl \l_keys_property_tl } } + { + \msg_kernel_error:nnxx { keys } + { property-requires-value } { \l_keys_property_tl } + { \l_keys_path_tl } + } + } + { \use:c { \c_keys_props_root_tl \l_keys_property_tl } {#1} } + } +\cs_new_protected:Npn \keys_define_key_aux:w #1 : #2 \q_stop + { \tl_if_empty:nTF {#2} } +\cs_new_nopar:Npn \keys_bool_set:NN #1#2 + { + \cs_if_exist:NF #1 { \bool_new:N #1 } + \keys_choice_make: + \keys_cmd_set:nx { \l_keys_path_tl / true } + { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 } + \keys_cmd_set:nx { \l_keys_path_tl / false } + { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 } + \keys_cmd_set:nn { \l_keys_path_tl / unknown } + { + \msg_kernel_error:nnx { keys } { boolean-values-only } + { \l_keys_key_tl } + } + \keys_default_set:n { true } + } +\cs_new_protected_nopar:Npn \keys_choice_make: + { + \keys_cmd_set:nn { \l_keys_path_tl } + { \keys_choice_find:n {##1} } + \keys_cmd_set:nn { \l_keys_path_tl / unknown } + { + \msg_kernel_error:nnxx { keys } { choice-unknown } + { \l_keys_path_tl } {##1} + } + } +\cs_new_protected:Npn \keys_choices_generate:n #1 + { + \cs_if_exist:cTF + { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + { + \keys_choice_make: + \int_zero:N \l_keys_choice_int + \clist_map_function:nN {#1} \keys_choices_generate_aux:n + } + { + \msg_kernel_error:nnx { keys } + { generate-choices-before-code } { \l_keys_path_tl } + } + } +\cs_new_protected_nopar:Npn \keys_choices_generate_aux:n #1 + { + \keys_cmd_set:nx { \l_keys_path_tl / #1 } + { + \exp_not:n { \tl_set:Nn \l_keys_choice_tl } {#1} + \exp_not:n { \int_set:Nn \l_keys_choice_int } + { \int_use:N \l_keys_choice_int } + \exp_not:v + { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + } + \int_incr:N \l_keys_choice_int + } +\cs_new_protected:Npn \keys_choice_code_store:x #1 + { + \cs_if_exist:cF + { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + { + \tl_new:c + { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + } + \tl_set:cx { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + {#1} + } +\cs_new_protected:Npn \keys_cmd_set:nn #1#2 + { + \keys_cmd_set_aux:n {#1} + \cs_set:cpn { \c_keys_code_root_tl #1 } ##1 {#2} + } +\cs_new_protected:Npn \keys_cmd_set:nx #1#2 + { + \keys_cmd_set_aux:n {#1} + \cs_set:cpx { \c_keys_code_root_tl #1 } ##1 {#2} + } +\cs_new_protected_nopar:Npn \keys_cmd_set_aux:n #1 + { + \tl_clear_new:c { \c_keys_vars_root_tl #1 .default } + \tl_set:cn { \c_keys_vars_root_tl #1 .default } { \q_no_value } + \tl_clear_new:c { \c_keys_vars_root_tl #1 .req } + } +\cs_new_protected:Npn \keys_default_set:n #1 + { \tl_set:cn { \c_keys_vars_root_tl \l_keys_path_tl .default } {#1} } +\cs_generate_variant:Nn \keys_default_set:n { V } +\cs_new_protected_nopar:Npn \keys_meta_make:n #1 + { + \exp_args:NNo \keys_cmd_set:nn \l_keys_path_tl + { \exp_after:wN \keys_set:nn \exp_after:wN { \l_keys_module_tl } {#1} } + } +\cs_new_protected_nopar:Npn \keys_meta_make:x #1 + { + \keys_cmd_set:nx { \l_keys_path_tl } + { \exp_not:N \keys_set:nn { \l_keys_module_tl } {#1} } + } +\cs_new_protected_nopar:Npn \keys_value_requirement:n #1 + { + \tl_set_eq:cc + { \c_keys_vars_root_tl \l_keys_path_tl .req } + { c_keys_value_ #1 _tl } + } +\cs_new_protected_nopar:Npn \keys_variable_set:NnNN #1#2#3#4 + { + \cs_if_exist:NF #1 { \use:c { #2 _new:N } #1 } + \keys_cmd_set:nx { \l_keys_path_tl } + { \exp_not:c { #2 _ #3 set:N #4 } \exp_not:N #1 {##1} } + } +\cs_new_protected_nopar:Npn \keys_variable_set:NnN #1#2#3 + { \keys_variable_set:NnNN #1 {#2} { } #3 } +\cs_generate_variant:Nn \keys_variable_set:NnNN { c } +\cs_generate_variant:Nn \keys_variable_set:NnN { c } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .bool_set:N } #1 + { \keys_bool_set:NN #1 { } } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .bool_gset:N } #1 + { \keys_bool_set:NN #1 g } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .choice: } + { \keys_choice_make: } +\cs_new_protected:cpn { \c_keys_props_root_tl .code:n } #1 + { \keys_cmd_set:nn { \l_keys_path_tl } {#1} } +\cs_new_protected:cpn { \c_keys_props_root_tl .code:x } #1 + { \keys_cmd_set:nx { \l_keys_path_tl } {#1} } +\cs_new_protected:cpn { \c_keys_props_root_tl .choice_code:n } #1 + { \keys_choice_code_store:x { \exp_not:n {#1} } } +\cs_new_protected:cpn { \c_keys_props_root_tl .choice_code:x } #1 + { \keys_choice_code_store:x {#1} } +\cs_new_protected:cpn { \c_keys_props_root_tl .default:n } #1 + { \keys_default_set:n {#1} } +\cs_new_protected:cpn { \c_keys_props_root_tl .default:V } #1 + { \keys_default_set:V #1 } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .dim_set:N } #1 + { \keys_variable_set:NnN #1 { dim } n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .dim_set:c } #1 + { \keys_variable_set:cnN {#1} { dim } n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .dim_gset:N } #1 + { \keys_variable_set:NnNN #1 { dim } g n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .dim_gset:c } #1 + { \keys_variable_set:cnNN {#1} { dim } g n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .fp_set:N } #1 + { \keys_variable_set:NnN #1 { fp } n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .fp_set:c } #1 + { \keys_variable_set:cnN {#1} { fp } n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .fp_gset:N } #1 + { \keys_variable_set:NnNN #1 { fp } g n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .fp_gset:c } #1 + { \keys_variable_set:cnNN {#1} { fp } g n } +\cs_new_protected:cpn { \c_keys_props_root_tl .generate_choices:n } #1 + { \keys_choices_generate:n {#1} } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .int_set:N } #1 + { \keys_variable_set:NnN #1 { int } n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .int_set:c } #1 + { \keys_variable_set:cnN {#1} { int } n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .int_gset:N } #1 + { \keys_variable_set:NnNN #1 { int } g n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .int_gset:c } #1 + { \keys_variable_set:cnNN {#1} { int } g n } +\cs_new_protected:cpn { \c_keys_props_root_tl .meta:n } #1 + { \keys_meta_make:n {#1} } +\cs_new_protected:cpn { \c_keys_props_root_tl .meta:x } #1 + { \keys_meta_make:x {#1} } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .skip_set:N } #1 + { \keys_variable_set:NnN #1 { skip } n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .skip_set:c } #1 + { \keys_variable_set:cnN {#1} { skip } n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .skip_gset:N } #1 + { \keys_variable_set:NnNN #1 { skip } g n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .skip_gset:c } #1 + { \keys_variable_set:cnNN {#1} { skip } g n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .tl_set:N } #1 + { \keys_variable_set:NnN #1 { tl } n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .tl_set:c } #1 + { \keys_variable_set:cnN {#1} { tl } n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .tl_set_x:N } #1 + { \keys_variable_set:NnN #1 { tl } x } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .tl_set_x:c } #1 + { \keys_variable_set:cnN {#1} { tl } x } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .tl_gset:N } #1 + { \keys_variable_set:NnNN #1 { tl } g n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .tl_gset:c } #1 + { \keys_variable_set:cnNN {#1} { tl } g n } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .tl_gset_x:N } #1 + { \keys_variable_set:NnNN #1 { tl } g x } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .tl_gset_x:c } #1 + { \keys_variable_set:cnNN {#1} { tl } g x } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .value_forbidden: } + { \keys_value_requirement:n { forbidden } } +\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .value_required: } + { \keys_value_requirement:n { required } } +\cs_new_protected:Npn \keys_set:nn + { \keys_set_aux:onn { \l_keys_module_tl } } +\cs_new_protected:Npn \keys_set_aux:nnn #1#2#3 + { + \tl_set:Nn \l_keys_module_tl {#2} + \keyval_parse:NNn \keys_set_elt:n \keys_set_elt:nn {#3} + \tl_set:Nn \l_keys_module_tl {#1} + } +\cs_generate_variant:Nn \keys_set:nn { nV , nv , no } +\cs_generate_variant:Nn \keys_set_aux:nnn { o } +\cs_new_protected_nopar:Npn \keys_set_elt:n #1 + { + \bool_set_true:N \l_keys_no_value_bool + \keys_set_elt_aux:nn {#1} { } + } +\cs_new_protected:Npn \keys_set_elt:nn #1#2 + { + \bool_set_false:N \l_keys_no_value_bool + \keys_set_elt_aux:nn {#1} {#2} + } +\cs_new_protected:Npn \keys_set_elt_aux:nn #1#2 + { + \tl_set:Nx \l_keys_key_tl { \tl_to_str:n {#1} } + \tl_set:Nx \l_keys_path_tl { \l_keys_module_tl / \l_keys_key_tl } + \keys_value_or_default:n {#2} + \bool_if:nTF + { + \keys_if_value_p:n { required } && + \l_keys_no_value_bool + } + { + \msg_kernel_error:nnx { keys } { value-required } + { \l_keys_path_tl } + } + { + \bool_if:nTF + { + \keys_if_value_p:n { forbidden } && + ! \l_keys_no_value_bool + } + { + \msg_kernel_error:nnxx { keys } { value-forbidden } + { \l_keys_path_tl } { \l_keys_value_tl } + } + { \keys_execute: } + } + } +\cs_new_protected:Npn \keys_value_or_default:n #1 + { + \tl_set:Nn \l_keys_value_tl {#1} + \bool_if:NT \l_keys_no_value_bool + { + \quark_if_no_value:cF { \c_keys_vars_root_tl \l_keys_path_tl .default } + { + \tl_set_eq:Nc \l_keys_value_tl + { \c_keys_vars_root_tl \l_keys_path_tl .default } + } + } + } +\prg_new_conditional:Npnn \keys_if_value:n #1 { p } + { + \tl_if_eq:ccTF { c_keys_value_ #1 _tl } + { \c_keys_vars_root_tl \l_keys_path_tl .req } + { \prg_return_true: } + { \prg_return_false: } + } +\cs_new_nopar:Npn \keys_execute: + { \keys_execute:nn { \l_keys_path_tl } { \keys_execute_unknown: } } +\cs_new_nopar:Npn \keys_execute_unknown: + { + \keys_execute:nn { \l_keys_module_tl / unknown } + { + \msg_kernel_error:nnxx { keys } { key-unknown } + { \l_keys_path_tl } { \l_keys_module_tl } + } + } +\cs_new_nopar:Npn \keys_execute:nn #1#2 + { + \cs_if_exist:cTF { \c_keys_code_root_tl #1 } + { + \exp_args:Nno \use:c { \c_keys_code_root_tl #1 } + \l_keys_value_tl + } + {#2} + } +\cs_new_nopar:Npn \keys_choice_find:n #1 + { + \keys_execute:nn { \l_keys_path_tl / \tl_to_str:n {#1} } + { \keys_execute:nn { \l_keys_path_tl / unknown } { } } + } +\prg_new_conditional:Npnn \keys_if_exist:nn #1#2 { p , T , F , TF } + { + \cs_if_exist:cTF { \c_keys_code_root_tl #1 / #2 } + { \prg_return_true:} + { \prg_return_false:} + } +\cs_new_nopar:Npn \keys_show:nn #1#2 + { \cs_show:c { \c_keys_code_root_tl #1 / \tl_to_str:n {#2} } } +\msg_kernel_new:nnnn { keys } { boolean-values-only } + { Key~'#1'~accepts~boolean~values~only. } + { The~key~'#1'~only~accepts~the~values~'true'~and~'false'. } +\msg_kernel_new:nnnn { keys } { choice-unknown } + { Choice~'#2'~unknown~for~key~'#1'. } + { + The~key~'#1'~takes~a~limited~number~of~values.\\ + The~input~given,~'#2',~is~not~on~the~list~accepted. + } +\msg_kernel_new:nnnn { keys } { generate-choices-before-code } + { No~code~available~to~generate~choices~for~key~'#1'. } + { + \c_msg_coding_error_text_tl + Before~using~.generate_choices:n~the~code~should~be~defined~ + with~'.choice_code:n'~or~'.choice_code:x'. + } +\msg_kernel_new:nnnn { keys } { key-no-property } + { No~property~given~in~definition~of~key~'#1'. } + { + \c_msg_coding_error_text_tl + Inside~\keys_define:nn each~key~name + needs~a~property: \\ + ~ ~ #1 .<property> \\ + LaTeX~did~not~find~a~'.'~to~indicate~the~start~of~a~property. + } +\msg_kernel_new:nnnn { keys } { key-unknown } + { The~key~'#1'~is~unknown~and~is~being~ignored. } + { + The~module~'#2'~does~not~have~a~key~called~#1'.\\ + Check~that~you~have~spelled~the~key~name~correctly. + } +\msg_kernel_new:nnnn { keys } { option-unknown } + { Unknown~option~'#1'~for~package~#2. } + { + LaTeX~has~been~asked~to~set~an~option~called~'#1'~ + but~the~#2~package~has~not~created~an~option~with~this~name. + } +\msg_kernel_new:nnnn { keys } { property-requires-value } + { The~property~'#1'~requires~a~value. } + { + \c_msg_coding_error_text_tl + LaTeX~was~asked~to~set~property~'#2'~for~key~'#1'.\\ + No~value~was~given~for~the~property,~and~one~is~required. + } +\msg_kernel_new:nnnn { keys } { property-unknown } + { The~key~property~'#1'~is~unknown. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~set~the~property~'#1'~for~key~'#2':~ + this~property~is~not~defined. + } +\msg_kernel_new:nnnn { keys } { value-forbidden } + { The~key~'#1'~does~not~taken~a~value. } + { + The~key~'#1'~should~be~given~without~a~value.\\ + LaTeX~will~ignore~the~given~value~'#2'. + } +\msg_kernel_new:nnnn { keys } { value-required } + { The~key~'#1'~requires~a~value. } + { + The~key~'#1'~must~have~a~value.\\ + No~value~was~present:~the~key~will~be~ignored. + } +%% +%% +%% End of file `l3keys.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3keyval.sty b/Master/texmf-dist/tex/latex/l3kernel/l3keyval.sty new file mode 100644 index 00000000000..c42867b5b48 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3keyval.sty @@ -0,0 +1,177 @@ +%% +%% This is file `l3keyval.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3keyval.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3keyval.dtx Copyright (C) 2006-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3keyval.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental key-value parsing} + %\section{Parsing key--value lists} + %\begin{function}{\keyval_parse:NNn} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\int_new:N \g_keyval_level_int +\tl_new:N \l_keyval_key_tl +\tl_new:N \l_keyval_value_tl +\tl_new:N \l_keyval_sanitise_tl +\tl_new:N \l_keyval_parse_tl +\group_begin: + \char_set_catcode_active:n { `\= } + \char_set_catcode_active:n { `\, } + \char_set_lccode:nn { `\8 } { `\= } + \char_set_lccode:nn { `\9 } { `\, } +\tl_to_lowercase:n + { + \group_end: + \cs_new_protected:Npn \keyval_parse:n #1 + { + \group_begin: + \tl_clear:N \l_keyval_sanitise_tl + \tl_set:Nn \l_keyval_sanitise_tl {#1} + \tl_replace_all_in:Nnn \l_keyval_sanitise_tl { = } { 8 } + \tl_replace_all_in:Nnn \l_keyval_sanitise_tl { , } { 9 } + \tl_clear:N \l_keyval_parse_tl + \exp_after:wN \keyval_parse_elt:w \exp_after:wN + \q_no_value \l_keyval_sanitise_tl 9 \q_nil 9 + \exp_after:wN \group_end: + \l_keyval_parse_tl + } + } +\cs_new_protected:Npn \keyval_parse_elt:w #1 , + { + \tl_if_blank:oTF { \use_none:n #1 } + { \keyval_parse_elt:w \q_no_value } + { + \quark_if_nil:oF { \use_ii:nn #1 } + { + \keyval_split_key_value:w #1 = = \q_stop + \keyval_parse_elt:w \q_no_value + } + } + } +\cs_new_protected:Npn \keyval_split_key_value:w #1 = #2 \q_stop + { + \keyval_split_key:w #1 \q_stop + \str_if_eq:nnTF {#2} { = } + { + \tl_put_right:Nx \l_keyval_parse_tl + { + \exp_not:c { keyval_key_no_value_elt_ \int_use:N \g_keyval_level_int :n } + { \exp_not:o \l_keyval_key_tl } + } + } + { + \keyval_split_key_value_aux:wTF #2 \q_no_value \q_stop + { \keyval_split_value:w \q_nil #2 } + { \msg_kernel_error:nn { keyval } { misplaced-equals-sign } } + } + } +\cs_new:Npn \keyval_split_key_value_aux:wTF #1 = #2#3 \q_stop + { \tl_if_head_eq_meaning:nNTF {#3} \q_no_value } +\group_begin: + \char_set_catcode_math_toggle:n { `\Q } + \cs_new_protected:Npn \keyval_split_key:w #1 \q_stop + { + \exp_args:NNf \tl_set:Nn \l_keyval_key_tl + { + \exp_after:wN \keyval_remove_spaces:w \exp_after:wN + \exp_not:N \use_none:n #1 Q ~ Q + } + \tl_set:Nx \l_keyval_key_tl + { \exp_after:wN \keyval_split_key_aux:w \l_keyval_key_tl \q_stop } + } + \cs_gset:Npn \keyval_split_key_aux:w #1 \q_stop { \exp_not:n {#1} } + \cs_gset:Npn \keyval_remove_spaces:w #1 ~ Q { \keyval_remove_spaces_aux:w #1 Q } + \cs_gset:Npn \keyval_remove_spaces_aux:w #1 Q #2 {#1} +\group_end: +\cs_new_protected:Npn \keyval_split_value:w #1 = = + { + \tl_put_right:Nx \l_keyval_parse_tl + { + \exp_not:c { keyval_key_value_elt_ \int_use:N \g_keyval_level_int :nn } + { \exp_not:o \l_keyval_key_tl } + } + \tl_set:Nx \l_keyval_value_tl { \exp_not:o { \use_none:nnn #1 \q_nil \q_nil } } + \tl_if_empty:NTF \l_keyval_value_tl + { \tl_put_right:Nn \l_keyval_parse_tl { { } } } + { + \quark_if_nil:NTF \l_keyval_value_tl + { + \tl_put_right:Nx \l_keyval_parse_tl + { { \exp_not:o { \use_ii:nnn #1 \q_nil } } } + } + { \keyval_split_value_aux:w #1 \q_stop } + } + } +\group_begin: + \char_set_catcode_math_toggle:n { `\Q } + \cs_new_protected:Npn \keyval_split_value_aux:w \q_nil #1 \q_stop + { + \exp_args:NNf \tl_set:Nn \l_keyval_value_tl + { \keyval_remove_spaces:w \exp_not:N #1 Q ~ Q } + \tl_put_right:Nx \l_keyval_parse_tl { { \exp_not:o \l_keyval_value_tl } } + } +\group_end: +\cs_new_protected:Npn \keyval_parse:NNn #1#2#3 + { + \int_gincr:N \g_keyval_level_int + \cs_gset_eq:cN { keyval_key_no_value_elt_ \int_use:N \g_keyval_level_int :n } #1 + \cs_gset_eq:cN { keyval_key_value_elt_ \int_use:N \g_keyval_level_int :nn } #2 + \keyval_parse:n {#3} + \int_gdecr:N \g_keyval_level_int + } +\msg_kernel_new:nnnn { keyval } { misplaced-equals-sign } + { Misplaced~equals~sign~in~key-value~input~\msg_line_number: } + { + LaTeX~is~attempting~to~parse~some~key-value~input~but~found~ + two~equals~signs~not~separated~by~a~comma. + } +\cs_new_eq:NN \KV_process_space_removal_sanitize:NNn \keyval_parse:NNn +\cs_new_eq:NN \KV_process_space_removal_no_sanitize:NNn \keyval_parse:NNn +\cs_new_eq:NN \KV_process_no_space_removal_no_sanitize:NNn \keyval_parse:NNn +%% +%% +%% End of file `l3keyval.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty b/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty new file mode 100644 index 00000000000..b7e63c89882 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty @@ -0,0 +1,160 @@ +%% +%% This is file `l3luatex.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3luatex.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3luatex.dtx Copyright (C) 2010,2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3luatex.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental LuaTeX-specific functions} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\luatex_if_engine:TF + { + \cs_new_eq:NN \lua_now:x \luatex_directlua:D + \cs_new_eq:NN \lua_shipout_x:n \luatex_latelua:D + } + { + \cs_new:Npn \lua_now:x #1 { \lua_wrong_engine: } + \cs_new_protected:Npn \lua_shipout_x:n #1 { \lua_wrong_engine: } + } +\cs_new:Npn \lua_now:n #1 + { \lua_now:x { \exp_not:n {#1} } } +\cs_generate_variant:Nn \lua_shipout_x:n { x } +\cs_new_protected:Npn \lua_shipout:n #1 + { \lua_shipout_x:n { \exp_not:n {#1} } } +\cs_generate_variant:Nn \lua_shipout:n { x } +\group_begin: +\char_set_catcode_letter:N\! +\char_set_catcode_letter:N\ % +\cs_gset:Npn\lua_wrong_engine:{% +\LuaTeX engine not in use!% +}% +\group_end:% +\int_new:N \g_cctab_allocate_int +\int_set:Nn \g_cctab_allocate_int { -1 } +\int_new:N \g_cctab_stack_int +\seq_new:N \g_cctab_stack_seq +\cs_new_protected_nopar:Npn \cctab_new:N #1 + { + \cs_if_free:NTF #1 + { + \int_gadd:Nn \g_cctab_allocate_int { 2 } + \int_compare:nNnTF + { \g_cctab_allocate_int } < { \c_max_register_int + 1 } + { + \pref_global:D \tex_mathchardef:D #1 \g_cctab_allocate_int + \luatex_initcatcodetable:D #1 + } + { \msg_kernel_fatal:nnx { alloc } { out-of-registers } { cctab } } + } + { + \msg_kernel_error:nnx { code } { variable-already-defined } + { \token_to_str:N #1 } + } + } +\luatex_if_engine:F + { \cs_set_protected_nopar:Npn \cctab_new:N #1 { \lua_wrong_engine: } } +\luatex_if_engine:T + { + \cs_set_protected_nopar:Npn \cctab_new:N #1 + { + \newcatcodetable #1 + \luatex_initcatcodetable:D #1 + } + } +\cs_new_protected_nopar:Npn \cctab_begin:N #1 + { + \seq_gpush:Nx \g_cctab_stack_seq { \tex_the:D \luatex_catcodetable:D } + \luatex_catcodetable:D #1 + \int_gadd:Nn \g_cctab_stack_int { 2 } + \int_compare:nNnT { \g_cctab_stack_int } > { 268 435 453 } + { \msg_kernel_error:nn { code } { cctab-stack-full } } + \luatex_savecatcodetable:D \g_cctab_stack_int + \luatex_catcodetable:D \g_cctab_stack_int + } +\cs_new_protected_nopar:Npn \cctab_end: + { + \int_gsub:Nn \g_cctab_stack_int { 2 } + \seq_gpop:NN \g_cctab_stack_seq \l_cctab_tmp_tl + \quark_if_no_value:NT \l_cctab_tmp_tl + { \tl_set:Nn \l_cctab_tmp_tl { 0 } } + \luatex_catcodetable:D \l_cctab_tmp_tl \scan_stop: + } +\luatex_if_engine:F + { + \cs_set_protected_nopar:Npn \cctab_begin:N #1 { \lua_wrong_engine: } + \cs_set_protected_nopar:Npn \cctab_end: { \lua_wrong_engine: } + } +\luatex_if_engine:T + { + \cs_set_protected_nopar:Npn \cctab_begin:N #1 { \BeginCatcodeRegime #1 } + \cs_set_protected_nopar:Npn \cctab_end: { \EndCatcodeRegime } + } +\tl_new:N \l_cctab_tmp_tl +\cs_new_protected:Npn \cctab_gset:Nn #1#2 + { + \group_begin: + #2 + \luatex_savecatcodetable:D #1 + \group_end: + } +\luatex_if_engine:F + { \cs_set_protected_nopar:Npn \cctab_gset:Nn #1#2 { \lua_wrong_engine: } } +\luatex_if_engine:T + { + \cctab_new:N \c_code_cctab + \cctab_gset:Nn \c_code_cctab { } + } +\luatex_if_engine:T + { + \cs_new_eq:NN \c_document_cctab \CatcodeTableLaTeX + \cs_new_eq:NN \c_initex_cctab \CatcodeTableIniTeX + \cs_new_eq:NN \c_other_cctab \CatcodeTableOther + \cs_new_eq:NN \c_string_cctab \CatcodeTableString + } +%% +%% +%% End of file `l3luatex.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty new file mode 100644 index 00000000000..bf1d732514f --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty @@ -0,0 +1,574 @@ +%% +%% This is file `l3msg.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3msg.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3msg.dtx Copyright (C) 2009-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3msg.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental messages} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\tl_new:N \l_msg_tmp_tl +\tl_const:Nn \c_msg_text_prefix_tl { msg~text~>~ } +\tl_const:Nn \c_msg_more_text_prefix_tl { msg~extra~text~>~ } +\cs_new_protected:Npn \msg_new:nnnn #1#2 + { + \cs_if_exist:cT { \c_msg_text_prefix_tl #1 / #2 } + { + \msg_kernel_error:nn { msg } { message-already-defined } + {#1} {#2} + } + \msg_set:nnnn {#1} {#2} + } +\cs_new_protected:Npn \msg_new:nnn #1#2#3 + { \msg_new:nnnn {#1} {#2} {#3} { } } +\cs_new_protected:Npn \msg_set:nnnn #1#2#3#4 + { + \cs_set:cpn { \c_msg_text_prefix_tl #1 / #2 } + ##1##2##3##4 {#3} + \cs_set:cpn { \c_msg_more_text_prefix_tl #1 / #2 } + ##1##2##3##4 {#4} + } +\cs_new_protected:Npn \msg_set:nnn #1#2#3 + { \msg_set:nnnn {#1} {#2} {#3} { } } +\tl_const:Nn \c_msg_coding_error_text_tl + { + This~is~a~coding~error. + \\ \\ + } +\tl_const:Nn \c_msg_continue_text_tl + { Type~<return>~to~continue } +\tl_const:Nn \c_msg_critical_text_tl + { Reading~the~current~file~will~stop } +\tl_const:Nn \c_msg_fatal_text_tl + { This~is~a~fatal~error:~LaTeX~will~abort } +\tl_const:Nn \c_msg_help_text_tl + { For~immediate~help~type~H~<return> } +\tl_const:Nn \c_msg_no_info_text_tl + { + LaTeX~does~not~know~anything~more~about~this~error,~sorry. + \c_msg_return_text_tl + } +\tl_const:Nn \c_msg_on_line_text_tl { on~line } +\tl_const:Nn \c_msg_return_text_tl + { + \\ \\ + Try~typing~<return>~to~proceed. + \\ + If~that~doesn't~work,~type~X~<return>~to~quit. + } +\tl_const:Nn \c_msg_trouble_text_tl + { + \\ \\ + More~errors~will~almost~certainly~follow: \\ + the~LaTeX~run~should~be~aborted. + } +\cs_new_nopar:Npn \msg_newline: { ^^J } +\cs_new_nopar:Npn \msg_two_newlines: { ^^J ^^J } +\cs_new_nopar:Npn \msg_line_number: { \int_use:N \tex_inputlineno:D } +\cs_set_nopar:Npn \msg_line_context: + { + \c_msg_on_line_text_tl + \c_space_tl + \msg_line_number: + } +\char_set_catcode_letter:N \. +\tl_new:N + \c_msg_hide_tl.......................................................... +\tl_const:Nn \c_msg_hide_tl + { \c_msg_hide_tl.......................................................... } +\char_set_catcode_other:N \. +\cs_new_protected:Npn \msg_interrupt:xxx #1#2#3 + { + \group_begin: + \tl_if_empty:nTF {#3} + { \msg_interrupt_no_details:xx {#1} {#2} } + { \msg_interrupt_details:xxx {#1} {#2} {#3} } + \msg_interrupt_aux: + \group_end: + } +\cs_new_protected:Npn \msg_interrupt_no_details:xx #1#2 + { + \iow_wrap:xnnnN + { \\ \c_msg_no_info_text_tl } + { |~ } { 2 } { } \msg_interrupt_more_text:n + \iow_wrap:xnnnN { #1 \\ \\ #2 \\ \\ \c_msg_continue_text_tl } + { ! ~ } { 2 } {} \msg_interrupt_text:n + } +\cs_new_protected:Npn \msg_interrupt_details:xxx #1#2#3 + { + \iow_wrap:xnnnN + { \\ #3 } + { |~ } { 2 } { } \msg_interrupt_more_text:n + \iow_wrap:xnnnN { #1 \\ \\ #2 \\ \\ \c_msg_help_text_tl } + { ! ~ } { 2 } { } \msg_interrupt_text:n + } +\cs_new_protected:Npn \msg_interrupt_text:n #1 + { \tl_set:Nn \l_msg_text_tl {#1} } +\cs_new_protected:Npn \msg_interrupt_more_text:n #1 + { + \protected@edef \l_msg_tmp_tl + { + |''''''''''''''''''''''''''''''''''''''''''''''' + #1 + \msg_newline: + |............................................... + } + \tex_errhelp:D \exp_after:wN { \l_msg_tmp_tl } + } +\group_begin: % { + \char_set_lccode:w `\} = `\ \scan_stop: + \char_set_lccode:w `\& = `\! \scan_stop: + \char_set_catcode_active:N \& +\tl_to_lowercase:n + { + \group_end: + \cs_new_protected:Npn \msg_interrupt_aux: + { + \iow_term:x + { + \iow_newline: + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + \iow_newline: + ! + } + \tl_put_right:No \l_msg_text_tl { \c_msg_hide_tl } + \cs_set_protected_nopar:Npx & + { \tex_errmessage:D { \exp_not:o { \l_msg_text_tl } } } + & + } + } +\cs_new_protected:Npn \msg_log:x #1 + { + \iow_log:x { ................................................. } + \iow_wrap:xnnnN { . ~ #1} { . ~ } { 2 } { } + \iow_log:x + \iow_log:x { ................................................. } + } +\cs_new_protected:Npn \msg_term:x #1 + { + \iow_term:x { ************************************************* } + \iow_wrap:xnnnN { * ~ #1} { * ~ } { 2 } { } + \iow_term:x + \iow_term:x { ************************************************* } + } +\int_set:Nn \tex_errorcontextlines:D { -1 } +\cs_new_nopar:Npn \msg_fatal_text:n #1 { Fatal~#1~error } +\cs_new_nopar:Npn \msg_critical_text:n #1 { Critical~#1~error } +\cs_new_nopar:Npn \msg_error_text:n #1 { #1~error } +\cs_new_nopar:Npn \msg_warning_text:n #1 { #1~warning } +\cs_new_nopar:Npn \msg_info_text:n #1 { #1~info } +\cs_new_nopar:Npn \msg_see_documentation_text:n #1 + { \\ \\ See~the~#1~documentation~for~further~information. } +\prop_new:N \l_msg_redirect_classes_prop +\prop_new:N \l_msg_redirect_names_prop +\cs_new_protected_nopar:Npn \msg_class_set:nn #1#2 + { + \prop_clear_new:c { l_msg_redirect_ #1 _prop } + \cs_set_protected:cpn { msg_ #1 :nnxxxx } ##1##2##3##4##5##6 + { \msg_use:nnnnxxxx {#1} {#2} {##1} {##2} {##3} {##4} {##5} {##6} } + \cs_set_protected:cpx { msg_ #1 :nnxxx } ##1##2##3##4##5 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} {##5} { } } + \cs_set_protected:cpx { msg_ #1 :nnxx } ##1##2##3##4 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} { } { } } + \cs_set_protected:cpx { msg_ #1 :nnx } ##1##2##3 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} { } { } { } } + \cs_set_protected:cpx { msg_ #1 :nn } ##1##2 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} { } { } { } { } } + } +\prg_set_conditional:Npnn \msg_if_more_text:N #1 { p , T , F , TF } + { + \cs_if_eq:NNTF #1 \msg_no_more_text:xxxx + { \prg_return_false: } + { \prg_return_true: } + } +\cs_new:Npn \msg_no_more_text:xxxx #1#2#3#4 { } +\cs_generate_variant:Nn \msg_if_more_text_p:N { c } +\cs_generate_variant:Nn \msg_if_more_text:NT { c } +\cs_generate_variant:Nn \msg_if_more_text:NF { c } +\cs_generate_variant:Nn \msg_if_more_text:NTF { c } +\msg_class_set:nn { fatal } + { + \msg_interrupt:xxx + { \msg_fatal_text:n {#1} : ~ "#2" } + { + \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n {#1} + } + { \c_msg_fatal_text_tl } + \tex_end:D + } +\msg_class_set:nn { critical } + { + \msg_interrupt:xxx + { \msg_critical_text:n {#1} : ~ "#2" } + { + \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n {#1} + } + { \c_msg_critical_text_tl } + \tex_endinput:D + } +\msg_class_set:nn { error } + { + \msg_if_more_text:cTF { \c_msg_more_text_prefix_tl #1 / #2 } + { + \msg_interrupt:xxx + { \msg_error_text:n {#1} : ~ "#2" } + { + \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n {#1} + } + { \use:c { \c_msg_more_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } + } + { + \msg_interrupt:xxx + { \msg_error_text:n {#1} : ~ "#2" } + { + \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n {#1} + } + { } + } + } +\msg_class_set:nn { warning } + { + \msg_term:x + { + \msg_warning_text:n {#1} : ~ "#2" \\ \\ + \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + } + } +\msg_class_set:nn { info } + { + \msg_log:x + { + \msg_info_text:n {#1} : ~ "#2" \\ \\ + \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + } + } +\msg_class_set:nn { log } + { + \msg_log:x + { \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } + } +\msg_class_set:nn { none } { } +\seq_new:N \l_msg_redirect_classes_seq +\tl_new:N \l_msg_class_tl +\tl_new:N \l_msg_current_class_tl +\tl_new:N \l_msg_current_module_tl +\cs_new_protected:Npn \msg_use:nnnnxxxx #1#2#3#4#5#6#7#8 + { + \cs_set_protected_nopar:Npx \msg_use_code: + { + \seq_clear:N \exp_not:N \l_msg_redirect_classes_seq + \exp_not:n {#2} + } + \cs_set_protected:Npx \msg_use_loop:n ##1 + { + \seq_if_in:NnTF \exp_not:n \l_msg_redirect_classes_seq {#1} + { \msg_kernel_error:nn { msg } { message-loop } {#1} } + { + \seq_put_right:Nn \exp_not:N \l_msg_redirect_classes_seq {#1} + \exp_not:N \cs_if_exist:cTF { msg_ ##1 :nnxxxx } + { + \exp_not:N \use:c { msg_ ##1 :nnxxxx } + \exp_not:n { {#3} {#4} {#5} {#6} {#7} {#8} } + } + { + \msg_kernel_error:nnx { msg } { message-class-unknown } {##1} + } + } + } + \cs_if_exist:cTF { \c_msg_text_prefix_tl #3 / #4 } + { \msg_use_aux:nnn {#1} {#3} {#4} } + { \msg_kernel_error:nnxx { msg } { message-unknown } {#3} {#4} } + } +\cs_new_protected_nopar:Npn \msg_use_aux:nnn #1#2#3 + { + \tl_set:Nn \l_msg_current_class_tl {#1} + \tl_set:Nn \l_msg_current_module_tl {#2} + \prop_if_in:NnTF \l_msg_redirect_names_prop { // #2 / #3 / } + { \msg_use_loop_check:nn { names } { // #2 / #3 / } } + { \msg_use_aux:nn {#1} {#2} } + } +\cs_new_protected_nopar:Npn \msg_use_aux:nn #1#2 + { + \prop_if_in:cnTF { l_msg_redirect_ #1 _prop } {#2} + { \msg_use_loop_check:nn {#1} {#2} } + { + \prop_if_in:cnTF { l_msg_redirect_ #1 _prop } { * } + { \msg_use_loop_check:nn {#1} { * } } + { \msg_use_code: } + } + } +\cs_new_protected:Npn \msg_use_loop_check:nn #1#2 + { + \prop_get:cnN { l_msg_redirect_ #1 _prop } {#2} \l_msg_class_tl + \tl_if_eq:NNTF \l_msg_current_class_tl \l_msg_class_tl + { + { \msg_use_code: } + { \msg_use_loop:o \l_msg_class_tl } + } + } +\cs_new_protected_nopar:Npn \msg_use_code: { } +\cs_new_protected:Npn \msg_use_loop:n #1 { } +\cs_generate_variant:Nn \msg_use_loop:n { o } +\cs_new_protected_nopar:Npn \msg_redirect_class:nn #1#2 + { \prop_put:cnn { l_msg_redirect_ #1 _prop } { * } {#2} } +\cs_new_protected_nopar:Npn \msg_redirect_module:nnn #1#2#3 + { \prop_put:cnn { l_msg_redirect_ #2 _prop } {#1} {#3} } +\cs_new_protected_nopar:Npn \msg_redirect_name:nnn #1#2#3 + { \prop_put:Nnn \l_msg_redirect_names_prop { // #1 / #2 / } {#3} } +\cs_new_protected_nopar:Npn \msg_kernel_new:nnnn #1#2 + { \msg_new:nnnn { LaTeX } { #1 / #2 } } +\cs_new_protected_nopar:Npn \msg_kernel_new:nnn #1#2 + { \msg_new:nnn { LaTeX } { #1 / #2 } } +\cs_new_protected_nopar:Npn \msg_kernel_set:nnnn #1#2 + { \msg_set:nnnn { LaTeX } { #1 / #2 } } +\cs_new_protected_nopar:Npn \msg_kernel_set:nnn #1#2 + { \msg_set:nnn { LaTeX } { #1 / #2 } } +\cs_new_protected:Npn \msg_kernel_fatal:nnxxxx #1#2#3#4#5#6 + { + \msg_interrupt:xxx + { \msg_fatal_text:n { LaTeX } : ~ "#1 / #2" } + { + \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } + {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n { LaTeX3 } + } + { \c_msg_fatal_text_tl } + \tex_end:D + } +\cs_new_protected:Npn \msg_kernel_fatal:nnxxx #1#2#3#4#5 + {\msg_kernel_fatal:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } +\cs_new_protected:Npn \msg_kernel_fatal:nnxx #1#2#3#4 + { \msg_kernel_fatal:nnxxxx {#1} {#2} {#3} {#4} { } { } } +\cs_new_protected:Npn \msg_kernel_fatal:nnx #1#2#3 + { \msg_kernel_fatal:nnxxxx {#1} {#2} {#3} { } { } { } } +\cs_new_protected:Npn \msg_kernel_fatal:nn #1#2 + { \msg_kernel_fatal:nnxxxx {#1} {#2} { } { } { } { } } +\cs_new_protected:Npn \msg_kernel_error:nnxxxx #1#2#3#4#5#6 + { + \msg_if_more_text:cTF { \c_msg_more_text_prefix_tl LaTeX / #1 / #2 } + { + \msg_interrupt:xxx + { \msg_error_text:n { LaTeX } : ~ " #1 / #2 " } + { + \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } + {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n { LaTeX3 } + } + { + \use:c { \c_msg_more_text_prefix_tl LaTeX / #1 / #2 } + {#3} {#4} {#5} {#6} + } + } + { + \msg_interrupt:xxx + { \msg_error_text:n { LaTeX } : ~ " #1 / #2 " } + { + \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } + {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n { LaTeX3 } + } + { } + } + } +\cs_new_protected:Npn \msg_kernel_error:nnxxx #1#2#3#4#5 + {\msg_kernel_error:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } +\cs_set_protected:Npn \msg_kernel_error:nnxx #1#2#3#4 + { \msg_kernel_error:nnxxxx {#1} {#2} {#3} {#4} { } { } } +\cs_set_protected:Npn \msg_kernel_error:nnx #1#2#3 + { \msg_kernel_error:nnxxxx {#1} {#2} {#3} { } { } { } } +\cs_set_protected:Npn \msg_kernel_error:nn #1#2 + { \msg_kernel_error:nnxxxx {#1} {#2} { } { } { } { } } +\prop_new:N \l_msg_redirect_kernel_warning_prop +\cs_new_protected:Npn \msg_kernel_warning:nnxxxx #1#2#3#4#5#6 + { + \msg_use:nnnnxxxx { warning } + { + \msg_term:x + { + \msg_warning_text:n { LaTeX } : ~ " #1 / #2 " \\ \\ + \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } + {#3} {#4} {#5} {#6} + } + } + { LaTeX } { #1 / #2 } {#3} {#4} {#5} {#6} + } +\cs_new_protected:Npn \msg_kernel_warning:nnxxx #1#2#3#4#5 + { \msg_kernel_warning:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } +\cs_new_protected:Npn \msg_kernel_warning:nnxx #1#2#3#4 + { \msg_kernel_warning:nnxxxx {#1} {#2} {#3} {#4} { } { } } +\cs_new_protected:Npn \msg_kernel_warning:nnx #1#2#3 + { \msg_kernel_warning:nnxxxx {#1} {#2} {#3} { } { } { } } +\cs_new_protected:Npn \msg_kernel_warning:nn #1#2 + { \msg_kernel_warning:nnxxxx {#1} {#2} { } { } { } { } } +\prop_new:N \l_msg_redirect_kernel_info_prop +\cs_new_protected:Npn \msg_kernel_info:nnxxxx #1#2#3#4#5#6 + { + \msg_use:nnnnxxxx { info } + { + \msg_log:x + { + \msg_info_text:n { LaTeX } : ~ " #1 / #2 " \\ \\ + \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } + {#3} {#4} {#5} {#6} + } + } + { LaTeX } { #1 / #2 } {#3} {#4} {#5} {#6} + } +\cs_new_protected:Npn \msg_kernel_info:nnxxx #1#2#3#4#5 + { \msg_kernel_info:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } +\cs_new_protected:Npn \msg_kernel_info:nnxx #1#2#3#4 + { \msg_kernel_info:nnxxxx {#1} {#2} {#3} {#4} { } { } } +\cs_new_protected:Npn \msg_kernel_info:nnx #1#2#3 + { \msg_kernel_info:nnxxxx {#1} {#2} {#3} { } { } { } } +\cs_new_protected:Npn \msg_kernel_info:nn #1#2 + { \msg_kernel_info:nnxxxx {#1} {#2} { } { } { } { } } +\msg_kernel_new:nnnn { msg } { message-already-defined } + { Message~'#2'~for~module~'#1'~already~defined. } + { + \c_msg_coding_error_text_tl + LaTeX~was~asked~to~define~a~new~message~called~'#2' + by~the~module~'#1'~module:\\ + this~message~already~exists. + \c_msg_return_text_tl + } +\msg_kernel_new:nnnn { msg } { message-unknown } + { Unknown~message~'#2'~for~module~'#1'. } + { + \c_msg_coding_error_text_tl + LaTeX~was~asked~to~display~a~message~called~'#2'\\ + by~the~module~'#1'~module:~this~message~does~not~exist. + \c_msg_return_text_tl + } +\msg_kernel_new:nnnn { msg } { message-class-unknown } + { Unknown~message~class~'#1'. } + { + LaTeX~has~been~asked~to~redirect~messages~to~a~class~'#1':\\ + this~was~never~defined. + \c_msg_return_text_tl + } +\msg_kernel_new:nnnn { msg } { redirect-loop } + { Message~redirection~loop~for~message~class~'#1'. } + { + LaTeX~has~been~asked~to~redirect~messages~in~an~infinite~loop.\\ + The~original~message~here~has~been~lost. + \c_msg_return_text_tl + } +\msg_kernel_new:nnnn { kernel } { bad-number-of-arguments } + { Function~'#1'~cannot~be~defined~with~#2~arguments. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~define~a~function~'#1'~with~ + #2~arguments. \\ + TeX~allows~between~0~and~9~arguments~for~a~single~function. + } +\msg_kernel_new:nnnn { kernel } { command-already-defined } + { Control~sequence~#1~already~defined. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~create~a~new~control~sequence~'#1'~ + but~this~name~has~already~been~used~elsewhere. \\ \\ + The~current~meaning~is:\\ + \ \ #2 + } +\msg_kernel_new:nnnn { kernel } { command-not-defined } + { Control~sequence~#1~undefined. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~use~a~command~#1,~but~this~has~not~ + been~defined~yet. + } +\msg_kernel_new:nnnn { kernel } { variable-not-defined } + { Variable~#1~undefined. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~show~a~variable~#1,~but~this~has~not~ + been~defined~yet. + } +\msg_kernel_new:nnnn { seq } { empty-sequence } + { Empty~sequence~#1. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~recover~an~entry~from~a~sequence~that~ + has~no~content:~that~cannot~happen! + } +\cs_set_protected:Npn \msg_kernel_bug:x #1 + { + \msg_interrupt:xxx { \c_msg_kernel_bug_text_tl } + { + #1 + \msg_see_documentation_text:n { LaTeX3 } + } + { \c_msg_kernel_bug_more_text_tl } + } +\tl_const:Nn \c_msg_kernel_bug_text_tl + { This~is~a~LaTeX~bug:~check~coding! } +\tl_const:Nn \c_msg_kernel_bug_more_text_tl + { + There~is~a~coding~bug~somewhere~around~here. \\ + This~probably~needs~examining~by~an~expert. + \c_msg_return_text_tl + } +\cs_new_eq:NN \msg_class_new:nn \msg_class_set:nn +\cs_new_eq:NN \msg_trace:nnxxxx \msg_log:nnxxxx +\cs_new_eq:NN \msg_trace:nnxxx \msg_log:nnxxx +\cs_new_eq:NN \msg_trace:nnxx \msg_log:nnxx +\cs_new_eq:NN \msg_trace:nnx \msg_log:nnx +\cs_new_eq:NN \msg_trace:nn \msg_log:nn +\cs_new_protected:Npn \msg_generic_new:nnn #1#2#3 { \deprecated } +\cs_new_protected:Npn \msg_generic_new:nn #1#2 { \deprecated } +\cs_new_protected:Npn \msg_generic_set:nnn #1#2#3 { \deprecated } +\cs_new_protected:Npn \msg_generic_set:nn #1#2 { \deprecated } +\cs_new_protected:Npn \msg_direct_interrupt:xxxxx #1#2#3#4#5 { \deprecated } +\cs_new_protected:Npn \msg_direct_log:xx #1#2 { \deprecated } +\cs_new_protected:Npn \msg_direct_term:xx #1#2 { \deprecated } +%% +%% +%% End of file `l3msg.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3names.sty b/Master/texmf-dist/tex/latex/l3kernel/l3names.sty new file mode 100644 index 00000000000..a504049d1ed --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3names.sty @@ -0,0 +1,489 @@ +%% +%% This is file `l3names.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3names.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3names.dtx Copyright (C) 1990-2011 The LaTeX3 project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3bootstrap} +\GetIdInfo$Id: l3names.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental namespace for primitives} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\let \tex_global:D \global +\let \tex_let:D \let +\begingroup + \long \def \name_primitive:NN #1#2 + { + \tex_global:D \tex_let:D #2 #1 + } + \name_primitive:NN \ \tex_space:D + \name_primitive:NN \/ \tex_italiccor:D + \name_primitive:NN \- \tex_hyphen:D + \name_primitive:NN \let \tex_let:D + \name_primitive:NN \def \tex_def:D + \name_primitive:NN \edef \tex_edef:D + \name_primitive:NN \gdef \tex_gdef:D + \name_primitive:NN \xdef \tex_xdef:D + \name_primitive:NN \chardef \tex_chardef:D + \name_primitive:NN \countdef \tex_countdef:D + \name_primitive:NN \dimendef \tex_dimendef:D + \name_primitive:NN \skipdef \tex_skipdef:D + \name_primitive:NN \muskipdef \tex_muskipdef:D + \name_primitive:NN \mathchardef \tex_mathchardef:D + \name_primitive:NN \toksdef \tex_toksdef:D + \name_primitive:NN \futurelet \tex_futurelet:D + \name_primitive:NN \advance \tex_advance:D + \name_primitive:NN \divide \tex_divide:D + \name_primitive:NN \multiply \tex_multiply:D + \name_primitive:NN \font \tex_font:D + \name_primitive:NN \fam \tex_fam:D + \name_primitive:NN \global \tex_global:D + \name_primitive:NN \long \tex_long:D + \name_primitive:NN \outer \tex_outer:D + \name_primitive:NN \setlanguage \tex_setlanguage:D + \name_primitive:NN \globaldefs \tex_globaldefs:D + \name_primitive:NN \afterassignment \tex_afterassignment:D + \name_primitive:NN \aftergroup \tex_aftergroup:D + \name_primitive:NN \expandafter \tex_expandafter:D + \name_primitive:NN \noexpand \tex_noexpand:D + \name_primitive:NN \begingroup \tex_begingroup:D + \name_primitive:NN \endgroup \tex_endgroup:D + \name_primitive:NN \halign \tex_halign:D + \name_primitive:NN \valign \tex_valign:D + \name_primitive:NN \cr \tex_cr:D + \name_primitive:NN \crcr \tex_crcr:D + \name_primitive:NN \noalign \tex_noalign:D + \name_primitive:NN \omit \tex_omit:D + \name_primitive:NN \span \tex_span:D + \name_primitive:NN \tabskip \tex_tabskip:D + \name_primitive:NN \everycr \tex_everycr:D + \name_primitive:NN \if \tex_if:D + \name_primitive:NN \ifcase \tex_ifcase:D + \name_primitive:NN \ifcat \tex_ifcat:D + \name_primitive:NN \ifnum \tex_ifnum:D + \name_primitive:NN \ifodd \tex_ifodd:D + \name_primitive:NN \ifdim \tex_ifdim:D + \name_primitive:NN \ifeof \tex_ifeof:D + \name_primitive:NN \ifhbox \tex_ifhbox:D + \name_primitive:NN \ifvbox \tex_ifvbox:D + \name_primitive:NN \ifvoid \tex_ifvoid:D + \name_primitive:NN \ifx \tex_ifx:D + \name_primitive:NN \iffalse \tex_iffalse:D + \name_primitive:NN \iftrue \tex_iftrue:D + \name_primitive:NN \ifhmode \tex_ifhmode:D + \name_primitive:NN \ifmmode \tex_ifmmode:D + \name_primitive:NN \ifvmode \tex_ifvmode:D + \name_primitive:NN \ifinner \tex_ifinner:D + \name_primitive:NN \else \tex_else:D + \name_primitive:NN \fi \tex_fi:D + \name_primitive:NN \or \tex_or:D + \name_primitive:NN \immediate \tex_immediate:D + \name_primitive:NN \closeout \tex_closeout:D + \name_primitive:NN \openin \tex_openin:D + \name_primitive:NN \openout \tex_openout:D + \name_primitive:NN \read \tex_read:D + \name_primitive:NN \write \tex_write:D + \name_primitive:NN \closein \tex_closein:D + \name_primitive:NN \newlinechar \tex_newlinechar:D + \name_primitive:NN \input \tex_input:D + \name_primitive:NN \endinput \tex_endinput:D + \name_primitive:NN \inputlineno \tex_inputlineno:D + \name_primitive:NN \errmessage \tex_errmessage:D + \name_primitive:NN \message \tex_message:D + \name_primitive:NN \show \tex_show:D + \name_primitive:NN \showthe \tex_showthe:D + \name_primitive:NN \showbox \tex_showbox:D + \name_primitive:NN \showlists \tex_showlists:D + \name_primitive:NN \errhelp \tex_errhelp:D + \name_primitive:NN \errorcontextlines \tex_errorcontextlines:D + \name_primitive:NN \tracingcommands \tex_tracingcommands:D + \name_primitive:NN \tracinglostchars \tex_tracinglostchars:D + \name_primitive:NN \tracingmacros \tex_tracingmacros:D + \name_primitive:NN \tracingonline \tex_tracingonline:D + \name_primitive:NN \tracingoutput \tex_tracingoutput:D + \name_primitive:NN \tracingpages \tex_tracingpages:D + \name_primitive:NN \tracingparagraphs \tex_tracingparagraphs:D + \name_primitive:NN \tracingrestores \tex_tracingrestores:D + \name_primitive:NN \tracingstats \tex_tracingstats:D + \name_primitive:NN \pausing \tex_pausing:D + \name_primitive:NN \showboxbreadth \tex_showboxbreadth:D + \name_primitive:NN \showboxdepth \tex_showboxdepth:D + \name_primitive:NN \batchmode \tex_batchmode:D + \name_primitive:NN \errorstopmode \tex_errorstopmode:D + \name_primitive:NN \nonstopmode \tex_nonstopmode:D + \name_primitive:NN \scrollmode \tex_scrollmode:D + \name_primitive:NN \end \tex_end:D + \name_primitive:NN \csname \tex_csname:D + \name_primitive:NN \endcsname \tex_endcsname:D + \name_primitive:NN \ignorespaces \tex_ignorespaces:D + \name_primitive:NN \relax \tex_relax:D + \name_primitive:NN \the \tex_the:D + \name_primitive:NN \mag \tex_mag:D + \name_primitive:NN \language \tex_language:D + \name_primitive:NN \mark \tex_mark:D + \name_primitive:NN \topmark \tex_topmark:D + \name_primitive:NN \firstmark \tex_firstmark:D + \name_primitive:NN \botmark \tex_botmark:D + \name_primitive:NN \splitfirstmark \tex_splitfirstmark:D + \name_primitive:NN \splitbotmark \tex_splitbotmark:D + \name_primitive:NN \fontname \tex_fontname:D + \name_primitive:NN \escapechar \tex_escapechar:D + \name_primitive:NN \endlinechar \tex_endlinechar:D + \name_primitive:NN \mathchoice \tex_mathchoice:D + \name_primitive:NN \delimiter \tex_delimiter:D + \name_primitive:NN \mathaccent \tex_mathaccent:D + \name_primitive:NN \mathchar \tex_mathchar:D + \name_primitive:NN \mskip \tex_mskip:D + \name_primitive:NN \radical \tex_radical:D + \name_primitive:NN \vcenter \tex_vcenter:D + \name_primitive:NN \mkern \tex_mkern:D + \name_primitive:NN \above \tex_above:D + \name_primitive:NN \abovewithdelims \tex_abovewithdelims:D + \name_primitive:NN \atop \tex_atop:D + \name_primitive:NN \atopwithdelims \tex_atopwithdelims:D + \name_primitive:NN \over \tex_over:D + \name_primitive:NN \overwithdelims \tex_overwithdelims:D + \name_primitive:NN \displaystyle \tex_displaystyle:D + \name_primitive:NN \textstyle \tex_textstyle:D + \name_primitive:NN \scriptstyle \tex_scriptstyle:D + \name_primitive:NN \scriptscriptstyle \tex_scriptscriptstyle:D + \name_primitive:NN \nonscript \tex_nonscript:D + \name_primitive:NN \eqno \tex_eqno:D + \name_primitive:NN \leqno \tex_leqno:D + \name_primitive:NN \abovedisplayshortskip \tex_abovedisplayshortskip:D + \name_primitive:NN \abovedisplayskip \tex_abovedisplayskip:D + \name_primitive:NN \belowdisplayshortskip \tex_belowdisplayshortskip:D + \name_primitive:NN \belowdisplayskip \tex_belowdisplayskip:D + \name_primitive:NN \displaywidowpenalty \tex_displaywidowpenalty:D + \name_primitive:NN \displayindent \tex_displayindent:D + \name_primitive:NN \displaywidth \tex_displaywidth:D + \name_primitive:NN \everydisplay \tex_everydisplay:D + \name_primitive:NN \predisplaysize \tex_predisplaysize:D + \name_primitive:NN \predisplaypenalty \tex_predisplaypenalty:D + \name_primitive:NN \postdisplaypenalty \tex_postdisplaypenalty:D + \name_primitive:NN \mathbin \tex_mathbin:D + \name_primitive:NN \mathclose \tex_mathclose:D + \name_primitive:NN \mathinner \tex_mathinner:D + \name_primitive:NN \mathop \tex_mathop:D + \name_primitive:NN \displaylimits \tex_displaylimits:D + \name_primitive:NN \limits \tex_limits:D + \name_primitive:NN \nolimits \tex_nolimits:D + \name_primitive:NN \mathopen \tex_mathopen:D + \name_primitive:NN \mathord \tex_mathord:D + \name_primitive:NN \mathpunct \tex_mathpunct:D + \name_primitive:NN \mathrel \tex_mathrel:D + \name_primitive:NN \overline \tex_overline:D + \name_primitive:NN \underline \tex_underline:D + \name_primitive:NN \left \tex_left:D + \name_primitive:NN \right \tex_right:D + \name_primitive:NN \binoppenalty \tex_binoppenalty:D + \name_primitive:NN \relpenalty \tex_relpenalty:D + \name_primitive:NN \delimitershortfall \tex_delimitershortfall:D + \name_primitive:NN \delimiterfactor \tex_delimiterfactor:D + \name_primitive:NN \nulldelimiterspace \tex_nulldelimiterspace:D + \name_primitive:NN \everymath \tex_everymath:D + \name_primitive:NN \mathsurround \tex_mathsurround:D + \name_primitive:NN \medmuskip \tex_medmuskip:D + \name_primitive:NN \thinmuskip \tex_thinmuskip:D + \name_primitive:NN \thickmuskip \tex_thickmuskip:D + \name_primitive:NN \scriptspace \tex_scriptspace:D + \name_primitive:NN \noboundary \tex_noboundary:D + \name_primitive:NN \accent \tex_accent:D + \name_primitive:NN \char \tex_char:D + \name_primitive:NN \discretionary \tex_discretionary:D + \name_primitive:NN \hfil \tex_hfil:D + \name_primitive:NN \hfilneg \tex_hfilneg:D + \name_primitive:NN \hfill \tex_hfill:D + \name_primitive:NN \hskip \tex_hskip:D + \name_primitive:NN \hss \tex_hss:D + \name_primitive:NN \vfil \tex_vfil:D + \name_primitive:NN \vfilneg \tex_vfilneg:D + \name_primitive:NN \vfill \tex_vfill:D + \name_primitive:NN \vskip \tex_vskip:D + \name_primitive:NN \vss \tex_vss:D + \name_primitive:NN \unskip \tex_unskip:D + \name_primitive:NN \kern \tex_kern:D + \name_primitive:NN \unkern \tex_unkern:D + \name_primitive:NN \hrule \tex_hrule:D + \name_primitive:NN \vrule \tex_vrule:D + \name_primitive:NN \leaders \tex_leaders:D + \name_primitive:NN \cleaders \tex_cleaders:D + \name_primitive:NN \xleaders \tex_xleaders:D + \name_primitive:NN \lastkern \tex_lastkern:D + \name_primitive:NN \lastskip \tex_lastskip:D + \name_primitive:NN \indent \tex_indent:D + \name_primitive:NN \par \tex_par:D + \name_primitive:NN \noindent \tex_noindent:D + \name_primitive:NN \vadjust \tex_vadjust:D + \name_primitive:NN \baselineskip \tex_baselineskip:D + \name_primitive:NN \lineskip \tex_lineskip:D + \name_primitive:NN \lineskiplimit \tex_lineskiplimit:D + \name_primitive:NN \clubpenalty \tex_clubpenalty:D + \name_primitive:NN \widowpenalty \tex_widowpenalty:D + \name_primitive:NN \exhyphenpenalty \tex_exhyphenpenalty:D + \name_primitive:NN \hyphenpenalty \tex_hyphenpenalty:D + \name_primitive:NN \linepenalty \tex_linepenalty:D + \name_primitive:NN \doublehyphendemerits \tex_doublehyphendemerits:D + \name_primitive:NN \finalhyphendemerits \tex_finalhyphendemerits:D + \name_primitive:NN \adjdemerits \tex_adjdemerits:D + \name_primitive:NN \hangafter \tex_hangafter:D + \name_primitive:NN \hangindent \tex_hangindent:D + \name_primitive:NN \parshape \tex_parshape:D + \name_primitive:NN \hsize \tex_hsize:D + \name_primitive:NN \lefthyphenmin \tex_lefthyphenmin:D + \name_primitive:NN \righthyphenmin \tex_righthyphenmin:D + \name_primitive:NN \leftskip \tex_leftskip:D + \name_primitive:NN \rightskip \tex_rightskip:D + \name_primitive:NN \looseness \tex_looseness:D + \name_primitive:NN \parskip \tex_parskip:D + \name_primitive:NN \parindent \tex_parindent:D + \name_primitive:NN \uchyph \tex_uchyph:D + \name_primitive:NN \emergencystretch \tex_emergencystretch:D + \name_primitive:NN \pretolerance \tex_pretolerance:D + \name_primitive:NN \tolerance \tex_tolerance:D + \name_primitive:NN \spaceskip \tex_spaceskip:D + \name_primitive:NN \xspaceskip \tex_xspaceskip:D + \name_primitive:NN \parfillskip \tex_parfillskip:D + \name_primitive:NN \everypar \tex_everypar:D + \name_primitive:NN \prevgraf \tex_prevgraf:D + \name_primitive:NN \spacefactor \tex_spacefactor:D + \name_primitive:NN \shipout \tex_shipout:D + \name_primitive:NN \vsize \tex_vsize:D + \name_primitive:NN \interlinepenalty \tex_interlinepenalty:D + \name_primitive:NN \brokenpenalty \tex_brokenpenalty:D + \name_primitive:NN \topskip \tex_topskip:D + \name_primitive:NN \maxdeadcycles \tex_maxdeadcycles:D + \name_primitive:NN \maxdepth \tex_maxdepth:D + \name_primitive:NN \output \tex_output:D + \name_primitive:NN \deadcycles \tex_deadcycles:D + \name_primitive:NN \pagedepth \tex_pagedepth:D + \name_primitive:NN \pagestretch \tex_pagestretch:D + \name_primitive:NN \pagefilstretch \tex_pagefilstretch:D + \name_primitive:NN \pagefillstretch \tex_pagefillstretch:D + \name_primitive:NN \pagefilllstretch \tex_pagefilllstretch:D + \name_primitive:NN \pageshrink \tex_pageshrink:D + \name_primitive:NN \pagegoal \tex_pagegoal:D + \name_primitive:NN \pagetotal \tex_pagetotal:D + \name_primitive:NN \outputpenalty \tex_outputpenalty:D + \name_primitive:NN \hoffset \tex_hoffset:D + \name_primitive:NN \voffset \tex_voffset:D + \name_primitive:NN \insert \tex_insert:D + \name_primitive:NN \holdinginserts \tex_holdinginserts:D + \name_primitive:NN \floatingpenalty \tex_floatingpenalty:D + \name_primitive:NN \insertpenalties \tex_insertpenalties:D + \name_primitive:NN \lower \tex_lower:D + \name_primitive:NN \moveleft \tex_moveleft:D + \name_primitive:NN \moveright \tex_moveright:D + \name_primitive:NN \raise \tex_raise:D + \name_primitive:NN \copy \tex_copy:D + \name_primitive:NN \lastbox \tex_lastbox:D + \name_primitive:NN \vsplit \tex_vsplit:D + \name_primitive:NN \unhbox \tex_unhbox:D + \name_primitive:NN \unhcopy \tex_unhcopy:D + \name_primitive:NN \unvbox \tex_unvbox:D + \name_primitive:NN \unvcopy \tex_unvcopy:D + \name_primitive:NN \setbox \tex_setbox:D + \name_primitive:NN \hbox \tex_hbox:D + \name_primitive:NN \vbox \tex_vbox:D + \name_primitive:NN \vtop \tex_vtop:D + \name_primitive:NN \prevdepth \tex_prevdepth:D + \name_primitive:NN \badness \tex_badness:D + \name_primitive:NN \hbadness \tex_hbadness:D + \name_primitive:NN \vbadness \tex_vbadness:D + \name_primitive:NN \hfuzz \tex_hfuzz:D + \name_primitive:NN \vfuzz \tex_vfuzz:D + \name_primitive:NN \overfullrule \tex_overfullrule:D + \name_primitive:NN \boxmaxdepth \tex_boxmaxdepth:D + \name_primitive:NN \splitmaxdepth \tex_splitmaxdepth:D + \name_primitive:NN \splittopskip \tex_splittopskip:D + \name_primitive:NN \everyhbox \tex_everyhbox:D + \name_primitive:NN \everyvbox \tex_everyvbox:D + \name_primitive:NN \nullfont \tex_nullfont:D + \name_primitive:NN \textfont \tex_textfont:D + \name_primitive:NN \scriptfont \tex_scriptfont:D + \name_primitive:NN \scriptscriptfont \tex_scriptscriptfont:D + \name_primitive:NN \fontdimen \tex_fontdimen:D + \name_primitive:NN \hyphenchar \tex_hyphenchar:D + \name_primitive:NN \skewchar \tex_skewchar:D + \name_primitive:NN \defaulthyphenchar \tex_defaulthyphenchar:D + \name_primitive:NN \defaultskewchar \tex_defaultskewchar:D + \name_primitive:NN \number \tex_number:D + \name_primitive:NN \romannumeral \tex_romannumeral:D + \name_primitive:NN \string \tex_string:D + \name_primitive:NN \lowercase \tex_lowercase:D + \name_primitive:NN \uppercase \tex_uppercase:D + \name_primitive:NN \meaning \tex_meaning:D + \name_primitive:NN \penalty \tex_penalty:D + \name_primitive:NN \unpenalty \tex_unpenalty:D + \name_primitive:NN \lastpenalty \tex_lastpenalty:D + \name_primitive:NN \special \tex_special:D + \name_primitive:NN \dump \tex_dump:D + \name_primitive:NN \patterns \tex_patterns:D + \name_primitive:NN \hyphenation \tex_hyphenation:D + \name_primitive:NN \time \tex_time:D + \name_primitive:NN \day \tex_day:D + \name_primitive:NN \month \tex_month:D + \name_primitive:NN \year \tex_year:D + \name_primitive:NN \jobname \tex_jobname:D + \name_primitive:NN \everyjob \tex_everyjob:D + \name_primitive:NN \count \tex_count:D + \name_primitive:NN \dimen \tex_dimen:D + \name_primitive:NN \skip \tex_skip:D + \name_primitive:NN \toks \tex_toks:D + \name_primitive:NN \muskip \tex_muskip:D + \name_primitive:NN \box \tex_box:D + \name_primitive:NN \wd \tex_wd:D + \name_primitive:NN \ht \tex_ht:D + \name_primitive:NN \dp \tex_dp:D + \name_primitive:NN \catcode \tex_catcode:D + \name_primitive:NN \delcode \tex_delcode:D + \name_primitive:NN \sfcode \tex_sfcode:D + \name_primitive:NN \lccode \tex_lccode:D + \name_primitive:NN \uccode \tex_uccode:D + \name_primitive:NN \mathcode \tex_mathcode:D + \name_primitive:NN \ifdefined \etex_ifdefined:D + \name_primitive:NN \ifcsname \etex_ifcsname:D + \name_primitive:NN \unless \etex_unless:D + \name_primitive:NN \eTeXversion \etex_eTeXversion:D + \name_primitive:NN \eTeXrevision \etex_eTeXrevision:D + \name_primitive:NN \marks \etex_marks:D + \name_primitive:NN \topmarks \etex_topmarks:D + \name_primitive:NN \firstmarks \etex_firstmarks:D + \name_primitive:NN \botmarks \etex_botmarks:D + \name_primitive:NN \splitfirstmarks \etex_splitfirstmarks:D + \name_primitive:NN \splitbotmarks \etex_splitbotmarks:D + \name_primitive:NN \unexpanded \etex_unexpanded:D + \name_primitive:NN \detokenize \etex_detokenize:D + \name_primitive:NN \scantokens \etex_scantokens:D + \name_primitive:NN \showtokens \etex_showtokens:D + \name_primitive:NN \readline \etex_readline:D + \name_primitive:NN \tracingassigns \etex_tracingassigns:D + \name_primitive:NN \tracingscantokens \etex_tracingscantokens:D + \name_primitive:NN \tracingnesting \etex_tracingnesting:D + \name_primitive:NN \tracingifs \etex_tracingifs:D + \name_primitive:NN \currentiflevel \etex_currentiflevel:D + \name_primitive:NN \currentifbranch \etex_currentifbranch:D + \name_primitive:NN \currentiftype \etex_currentiftype:D + \name_primitive:NN \tracinggroups \etex_tracinggroups:D + \name_primitive:NN \currentgrouplevel \etex_currentgrouplevel:D + \name_primitive:NN \currentgrouptype \etex_currentgrouptype:D + \name_primitive:NN \showgroups \etex_showgroups:D + \name_primitive:NN \showifs \etex_showifs:D + \name_primitive:NN \interactionmode \etex_interactionmode:D + \name_primitive:NN \lastnodetype \etex_lastnodetype:D + \name_primitive:NN \iffontchar \etex_iffontchar:D + \name_primitive:NN \fontcharht \etex_fontcharht:D + \name_primitive:NN \fontchardp \etex_fontchardp:D + \name_primitive:NN \fontcharwd \etex_fontcharwd:D + \name_primitive:NN \fontcharic \etex_fontcharic:D + \name_primitive:NN \parshapeindent \etex_parshapeindent:D + \name_primitive:NN \parshapelength \etex_parshapelength:D + \name_primitive:NN \parshapedimen \etex_parshapedimen:D + \name_primitive:NN \numexpr \etex_numexpr:D + \name_primitive:NN \dimexpr \etex_dimexpr:D + \name_primitive:NN \glueexpr \etex_glueexpr:D + \name_primitive:NN \muexpr \etex_muexpr:D + \name_primitive:NN \gluestretch \etex_gluestretch:D + \name_primitive:NN \glueshrink \etex_glueshrink:D + \name_primitive:NN \gluestretchorder \etex_gluestretchorder:D + \name_primitive:NN \glueshrinkorder \etex_glueshrinkorder:D + \name_primitive:NN \gluetomu \etex_gluetomu:D + \name_primitive:NN \mutoglue \etex_mutoglue:D + \name_primitive:NN \lastlinefit \etex_lastlinefit:D + \name_primitive:NN \interlinepenalties \etex_interlinepenalties:D + \name_primitive:NN \clubpenalties \etex_clubpenalties:D + \name_primitive:NN \widowpenalties \etex_widowpenalties:D + \name_primitive:NN \displaywidowpenalties \etex_displaywidowpenalties:D + \name_primitive:NN \middle \etex_middle:D + \name_primitive:NN \savinghyphcodes \etex_savinghyphcodes:D + \name_primitive:NN \savingvdiscards \etex_savingvdiscards:D + \name_primitive:NN \pagediscards \etex_pagediscards:D + \name_primitive:NN \splitdiscards \etex_splitdiscards:D + \name_primitive:NN \TeXXETstate \etex_TeXXETstate:D + \name_primitive:NN \beginL \etex_beginL:D + \name_primitive:NN \endL \etex_endL:D + \name_primitive:NN \beginR \etex_beginR:D + \name_primitive:NN \endR \etex_endR:D + \name_primitive:NN \predisplaydirection \etex_predisplaydirection:D + \name_primitive:NN \everyeof \etex_everyeof:D + \name_primitive:NN \protected \etex_protected:D + \name_primitive:NN \pdfcreationdate \pdftex_pdfcreationdate:D + \name_primitive:NN \pdfcolorstack \pdftex_pdfcolorstack:D + \name_primitive:NN \pdfcompresslevel \pdftex_pdfcompresslevel:D + \name_primitive:NN \pdfdecimaldigits \pdftex_pdfdecimaldigits:D + \name_primitive:NN \pdfhorigin \pdftex_pdfhorigin:D + \name_primitive:NN \pdfinfo \pdftex_pdfinfo:D + \name_primitive:NN \pdfliteral \pdftex_pdfliteral:D + \name_primitive:NN \pdfminorversion \pdftex_pdfminorversion:D + \name_primitive:NN \pdfobjcompresslevel \pdftex_pdfobjcompresslevel:D + \name_primitive:NN \pdfoutput \pdftex_pdfoutput:D + \name_primitive:NN \pdfrestore \pdftex_pdfrestore:D + \name_primitive:NN \pdfsave \pdftex_pdfsave:D + \name_primitive:NN \pdfsetmatrix \pdftex_pdfsetmatrix:D + \name_primitive:NN \pdfpkresolution \pdftex_pdfpkresolution:D + \name_primitive:NN \pdftexrevision \pdftex_pdftextrevision:D + \name_primitive:NN \pdfvorigin \pdftex_pdfvorigin:D + \name_primitive:NN \pdfstrcmp \pdftex_strcmp:D + \name_primitive:NN \XeTeXversion \xetex_XeTeXversion:D + \name_primitive:NN \catcodetable \luatex_catcodetable:D + \name_primitive:NN \directlua \luatex_directlua:D + \name_primitive:NN \initcatcodetable \luatex_initcatcodetable:D + \name_primitive:NN \latelua \luatex_latelua:D + \name_primitive:NN \luatexversion \luatex_luatexversion:D + \name_primitive:NN \savecatcodetable \luatex_savecatcodetable:D +\tex_endgroup:D +\tex_let:D \tex_end:D \@@end +\tex_let:D \tex_everydisplay:D \frozen@everydisplay +\tex_let:D \tex_everymath:D \frozen@everymath +\tex_let:D \tex_hyphen:D \@@hyph +\tex_let:D \tex_input:D \@@input +\tex_let:D \tex_italic_correction:D \@@italiccorr +\tex_let:D \tex_underline:D \@@underline +\tex_let:D \luatex_catcodetable:D \luatexcatcodetable +\tex_let:D \luatex_initcatcodetable:D \luatexinitcatcodetable +\tex_let:D \luatex_latelua:D \luatexlatelua +\tex_let:D \luatex_savecatcodetable:D \luatexsavecatcodetable +%% +%% +%% End of file `l3names.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty new file mode 100644 index 00000000000..4a20c040547 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty @@ -0,0 +1,563 @@ +%% +%% This is file `l3prg.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3prg.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3prg.dtx Copyright (C) 2005-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3prg.dtx 2495 2011-07-06 16:57:08Z bruno $ + {L3 Experimental control structures} +%% +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\cs_new_protected_nopar:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool } +\cs_generate_variant:Nn \bool_new:N { c } +\cs_new_protected_nopar:Npn \bool_set_true:N #1 + { \cs_set_eq:NN #1 \c_true_bool } +\cs_new_protected_nopar:Npn \bool_set_false:N #1 + { \cs_set_eq:NN #1 \c_false_bool } +\cs_new_protected_nopar:Npn \bool_gset_true:N #1 + { \cs_gset_eq:NN #1 \c_true_bool } +\cs_new_protected_nopar:Npn \bool_gset_false:N #1 + { \cs_gset_eq:NN #1 \c_false_bool } +\cs_generate_variant:Nn \bool_set_true:N { c } +\cs_generate_variant:Nn \bool_set_false:N { c } +\cs_generate_variant:Nn \bool_gset_true:N { c } +\cs_generate_variant:Nn \bool_gset_false:N { c } +\cs_new_eq:NN \bool_set_eq:NN \cs_set_eq:NN +\cs_new_eq:NN \bool_set_eq:Nc \cs_set_eq:Nc +\cs_new_eq:NN \bool_set_eq:cN \cs_set_eq:cN +\cs_new_eq:NN \bool_set_eq:cc \cs_set_eq:cc +\cs_new_eq:NN \bool_gset_eq:NN \cs_gset_eq:NN +\cs_new_eq:NN \bool_gset_eq:Nc \cs_gset_eq:Nc +\cs_new_eq:NN \bool_gset_eq:cN \cs_gset_eq:cN +\cs_new_eq:NN \bool_gset_eq:cc \cs_gset_eq:cc +\cs_new:Npn \bool_set:Nn #1#2 + { \tex_chardef:D #1 = \bool_if_p:n {#2} } +\cs_new:Npn \bool_gset:Nn #1#2 + { \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} } +\cs_generate_variant:Nn \bool_set:Nn { c } +\cs_generate_variant:Nn \bool_gset:Nn { c } +\prg_new_conditional:Npnn \bool_if:N #1 { p , T , F , TF } + { + \if_bool:N #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_generate_variant:Nn \bool_if_p:N { c } +\cs_generate_variant:Nn \bool_if:NT { c } +\cs_generate_variant:Nn \bool_if:NF { c } +\cs_generate_variant:Nn \bool_if:NTF { c } +\bool_new:N \l_tmpa_bool +\bool_new:N \g_tmpa_bool +\prg_new_conditional:Npnn \bool_if:n #1 { T , F , TF } + { + \if_predicate:w \bool_if_p:n {#1} + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new:Npn \bool_if_p:n #1 + { + \group_align_safe_begin: + \bool_get_next:N ( #1 ) S + } +\cs_new:Npn \bool_get_next:N #1 + { + \use:c + { + bool_ + \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi: + :w + } + #1 + } +\cs_new:Npn \bool_get_not_next:N #1 + { + \use:c + { + bool_not_ + \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi: + :w + } + #1 + } +\cs_new:Npn \bool_get_next:NN #1#2 { \bool_get_next:N #2 } +\cs_new:Npn \bool_get_not_next:NN #1#2 { \bool_get_not_next:N #2 } +\cs_new:cpn { bool_!:w } #1#2 + { + \if_meaning:w ( #2 + \exp_after:wN \bool_Not:w + \else: + \if_meaning:w ! #2 + \exp_after:wN \exp_after:wN \exp_after:wN \bool_get_next:NN + \else: + \exp_after:wN \exp_after:wN \exp_after:wN \bool_Not:N + \fi: + \fi: + #2 + } +\cs_new:cpn { bool_not_!:w } #1#2 + { + \if_meaning:w ( #2 + \exp_after:wN \bool_not_Not:w + \else: + \if_meaning:w ! #2 + \exp_after:wN \exp_after:wN \exp_after:wN \bool_get_not_next:NN + \else: + \exp_after:wN \exp_after:wN \exp_after:wN \bool_not_Not:N + \fi: + \fi: + #2 + } +\cs_new:Npn \bool_Not:w { \exp_after:wN \int_value:w \bool_get_not_next:N } +\cs_new:Npn \bool_not_Not:w { \exp_after:wN \int_value:w \bool_get_next:N } +\cs_new:Npn \bool_Not:N #1 + { + \exp_after:wN \bool_p:w + \if_meaning:w #1 \c_true_bool + \c_false_bool + \else: + \c_true_bool + \fi: + } +\cs_new:Npn \bool_not_Not:N #1 + { + \exp_after:wN \bool_p:w + \if_meaning:w #1 \c_true_bool + \c_true_bool + \else: + \c_false_bool + \fi: + } +\cs_new:cpn { bool_(:w } #1 + { \exp_after:wN \bool_cleanup:N \int_value:w \bool_get_next:N } +\cs_new:cpn { bool_not_(:w } #1 + { \exp_after:wN \bool_not_cleanup:N \int_value:w \bool_get_next:N } +\cs_new:cpn { bool_p:w } { \exp_after:wN \bool_cleanup:N \int_value:w } +\cs_new:cpn { bool_not_p:w } {\exp_after:wN \bool_not_cleanup:N \int_value:w } +\cs_new:Npn \bool_cleanup:N #1 + { + \exp_after:wN \bool_choose:NN \exp_after:wN #1 + \int_to_roman:w - `\q + } +\cs_new:Npn \bool_not_cleanup:N #1 + { + \exp_after:wN \bool_not_choose:NN \exp_after:wN #1 + \int_to_roman:w - `\q + } +\cs_new_nopar:Npn \bool_choose:NN #1#2 { \use:c { bool_ #2 _ #1 :w } } +\cs_new_nopar:Npn \bool_not_choose:NN #1#2 { \use:c { bool_not_ #2 _ #1 :w } } +\cs_new_nopar:cpn { bool_&_1:w } & { \bool_get_next:N } +\cs_new_nopar:cpn { bool_|_0:w } | { \bool_get_next:N } +\cs_new_nopar:cpn { bool_not_&_0:w } & { \bool_get_next:N } +\cs_new_nopar:cpn { bool_not_|_1:w } | { \bool_get_next:N } +\cs_new_nopar:cpn { bool_)_0:w } { \c_false_bool } +\cs_new_nopar:cpn { bool_)_1:w } { \c_true_bool } +\cs_new_nopar:cpn { bool_not_)_0:w } { \c_true_bool } +\cs_new_nopar:cpn { bool_not_)_1:w } { \c_false_bool } +\cs_new_nopar:cpn { bool_S_0:w } { \group_align_safe_end: \c_false_bool } +\cs_new_nopar:cpn { bool_S_1:w } { \group_align_safe_end: \c_true_bool } +\cs_new_nopar:cpn { bool_&_0:w } & { \bool_eval_skip_to_end:Nw \c_false_bool } +\cs_new_nopar:cpn { bool_|_1:w } | { \bool_eval_skip_to_end:Nw \c_true_bool } +\cs_new_nopar:cpn { bool_not_&_1:w } & + { \bool_eval_skip_to_end:Nw \c_false_bool } +\cs_new_nopar:cpn { bool_not_|_0:w } | + { \bool_eval_skip_to_end:Nw \c_true_bool } +%% ( +\cs_new:Npn \bool_eval_skip_to_end:Nw #1#2 ) + { + \bool_eval_skip_to_end_aux:Nw #1#2 ( % ) + \q_no_value \q_stop + {#2} + } +\cs_new:Npn \bool_eval_skip_to_end_aux:Nw #1#2 ( #3#4 \q_stop #5 % ) + { + \quark_if_no_value:NTF #3 + {#1} + { \bool_eval_skip_to_end_aux_ii:Nw #1 #5 } + } +\cs_new:Npn \bool_eval_skip_to_end_aux_ii:Nw #1#2 ( #3 ) + { % ( + \bool_eval_skip_to_end:Nw #1#3 ) + } +\cs_new:Npn \bool_not_p:n #1 { \bool_if_p:n { ! ( #1 ) } } +\cs_new:Npn \bool_xor_p:nn #1#2 + { + \int_compare:nNnTF { \bool_if_p:n {#1} } = { \bool_if_p:n {#2} } + \c_false_bool + \c_true_bool + } +\cs_new:Npn \bool_while_do:Nn #1#2 + { \bool_if:NT #1 { #2 \bool_while_do:Nn #1 {#2} } } +\cs_new:Npn \bool_until_do:Nn #1#2 + { \bool_if:NF #1 { #2 \bool_until_do:Nn #1 {#2} } } +\cs_generate_variant:Nn \bool_while_do:Nn { c } +\cs_generate_variant:Nn \bool_until_do:Nn { c } +\cs_new:Npn \bool_do_while:Nn #1#2 + { #2 \bool_if:NT #1 { \bool_do_while:Nn #1 {#2} } } +\cs_new:Npn \bool_do_until:Nn #1#2 + { #2 \bool_if:NF #1 { \bool_do_until:Nn #1 {#2} } } +\cs_generate_variant:Nn \bool_do_while:Nn { c } +\cs_generate_variant:Nn \bool_do_until:Nn { c } +\cs_new:Npn \bool_while_do:nn #1#2 + { + \bool_if:nT {#1} + { + #2 + \bool_while_do:nn {#1} {#2} + } + } +\cs_new:Npn \bool_do_while:nn #1#2 + { + #2 + \bool_if:nT {#1} { \bool_do_while:nn {#1} {#2} } + } +\cs_new:Npn \bool_until_do:nn #1#2 + { + \bool_if:nF {#1} + { + #2 + \bool_until_do:nn {#1} {#2} + } + } +\cs_new:Npn \bool_do_until:nn #1#2 + { + #2 + \bool_if:nF {#1} { \bool_do_until:nn {#1} {#2} } + } +\cs_new_eq:NN \prg_case_end:nw \use_i_delimit_by_q_recursion_stop:nw +\cs_new:Npn \prg_case_int:nnn #1 + { \exp_args:Nf \prg_case_int_aux:nnn { \int_eval:n {#1} } } +\cs_new:Npn \prg_case_int_aux:nnn #1 #2 #3 + { \prg_case_int_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } +\cs_new:Npn \prg_case_int_aux:nw #1#2#3 + { + \int_compare:nNnTF {#1} = {#2} + { \prg_case_end:nw {#3} } + { \prg_case_int_aux:nw {#1} } + } +\cs_new:Npn \prg_case_dim:nnn #1 + { \exp_args:Nf \prg_case_dim_aux:nnn { \dim_eval:n {#1} } } +\cs_new:Npn \prg_case_dim_aux:nnn #1 #2 #3 + { \prg_case_dim_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } +\cs_new:Npn \prg_case_dim_aux:nw #1#2#3 + { + \dim_compare:nNnTF {#1} = {#2} + { \prg_case_end:nw {#3} } + { \prg_case_dim_aux:nw {#1} } + } +\cs_new:Npn \prg_case_str:nnn #1#2#3 + { \prg_case_str_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } +\cs_new:Npn \prg_case_str_aux:nw #1#2#3 + { + \str_if_eq:nnTF {#1} {#2} + { \prg_case_end:nw {#3} } + { \prg_case_str_aux:nw {#1} } + } +\cs_generate_variant:Nn \prg_case_str:nnn { o } +\cs_new:Npn \prg_case_str:xxn #1#2#3 + { \prg_case_str_x_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } +\cs_new:Npn \prg_case_str_x_aux:nw #1#2#3 + { + \str_if_eq:xxTF {#1} {#2} + { \prg_case_end:nw {#3} } + { \prg_case_str_aux:nw {#1} } + } +\cs_new:Npn \prg_case_tl:Nnn #1#2#3 + { \prg_case_tl_aux:Nw #1 #2 #1 {#3} \q_recursion_stop } +\cs_new:Npn \prg_case_tl_aux:Nw #1#2#3 + { + \tl_if_eq:NNTF #1 #2 + { \prg_case_end:nw {#3} } + { \prg_case_tl_aux:Nw #1 } + } +\cs_generate_variant:Nn \prg_case_tl:Nnn { c } +\cs_new_nopar:Npn \prg_replicate:nn #1 + { + \int_to_roman:w + \exp_after:wN \prg_replicate_first_aux:N + \int_value:w \int_eval:w #1 \int_eval_end: + \cs_end: + } +\cs_new_nopar:Npn \prg_replicate_aux:N #1 + { \cs:w prg_replicate_#1 :n \prg_replicate_aux:N } +\cs_new_nopar:Npn \prg_replicate_first_aux:N #1 + { \cs:w prg_replicate_first_ #1 :n \prg_replicate_aux:N } +\cs_new_nopar:Npn \prg_replicate_ :n #1 { \cs_end: } +\cs_new:cpn { prg_replicate_0:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} } +\cs_new:cpn { prg_replicate_1:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1 } +\cs_new:cpn { prg_replicate_2:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1 } +\cs_new:cpn { prg_replicate_3:n } #1 + { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1 } +\cs_new:cpn { prg_replicate_4:n } #1 + { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1 } +\cs_new:cpn { prg_replicate_5:n } #1 + { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1 } +\cs_new:cpn { prg_replicate_6:n } #1 + { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1 } +\cs_new:cpn { prg_replicate_7:n } #1 + { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1#1 } +\cs_new:cpn { prg_replicate_8:n } #1 + { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1#1#1 } +\cs_new:cpn { prg_replicate_9:n } #1 + { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1#1#1#1 } +\cs_new:cpn { prg_replicate_first_-:n } #1 { \c_zero \negative_replication } +\cs_new:cpn { prg_replicate_first_0:n } #1 { \c_zero } +\cs_new:cpn { prg_replicate_first_1:n } #1 { \c_zero #1 } +\cs_new:cpn { prg_replicate_first_2:n } #1 { \c_zero #1#1 } +\cs_new:cpn { prg_replicate_first_3:n } #1 { \c_zero #1#1#1 } +\cs_new:cpn { prg_replicate_first_4:n } #1 { \c_zero #1#1#1#1 } +\cs_new:cpn { prg_replicate_first_5:n } #1 { \c_zero #1#1#1#1#1 } +\cs_new:cpn { prg_replicate_first_6:n } #1 { \c_zero #1#1#1#1#1#1 } +\cs_new:cpn { prg_replicate_first_7:n } #1 { \c_zero #1#1#1#1#1#1#1 } +\cs_new:cpn { prg_replicate_first_8:n } #1 { \c_zero #1#1#1#1#1#1#1#1 } +\cs_new:cpn { prg_replicate_first_9:n } #1 { \c_zero #1#1#1#1#1#1#1#1#1 } +\cs_new:Npn \prg_stepwise_function:nnnN #1#2 + { + \int_compare:nNnTF {#2} > { 0 } + { \exp_args:Nf \prg_stepwise_function_incr:nnnN } + { \exp_args:Nf \prg_stepwise_function_decr:nnnN } + { \int_eval:n {#1} } {#2} + } +\cs_new:Npn \prg_stepwise_function_incr:nnnN #1#2#3#4 + { + \int_compare:nNnF {#1} > {#3} + { + #4 {#1} + \exp_args:Nf \prg_stepwise_function_incr:nnnN + { \int_eval:n { #1 + #2 } } {#2} {#3} #4 + } + } +\cs_new:Npn \prg_stepwise_function_decr:nnnN #1#2#3#4 + { + \int_compare:nNnF {#1} < {#3} + { + #4 {#1} + \exp_args:Nf \prg_stepwise_function_decr:nnnN + { \int_eval:n { #1 + #2 } } {#2} {#3} #4 + } + } +\int_new:N \g_prg_stepwise_level_int +\cs_new_protected:Npn \prg_stepwise_inline:nnnn #1#2#3#4 + { + \int_gincr:N \g_prg_stepwise_level_int + \cs_gset_nopar:cpn + { g_prg_stepwise_ \int_use:N \g_prg_stepwise_level_int :n } + ##1 {#4} + \int_compare:nNnTF {#2} > { 0 } + { \exp_args:Ncf \prg_stepwise_inline_incr:Nnnn } + { \exp_args:Ncf \prg_stepwise_inline_decr:Nnnn } + { g_prg_stepwise_ \int_use:N \g_prg_stepwise_level_int :n } + { \int_eval:n {#1} } {#2} {#3} + \int_gdecr:N \g_prg_stepwise_level_int + } +\cs_new_protected:Npn \prg_stepwise_inline_incr:Nnnn #1#2#3#4 + { + \int_compare:nNnF {#2} > {#4} + { + #1 {#2} + \exp_args:NNf \prg_stepwise_inline_incr:Nnnn #1 + { \int_eval:n { #2 + #3 } } {#3} {#4} + } + } +\cs_new_protected:Npn \prg_stepwise_inline_decr:Nnnn #1#2#3#4 + { + \int_compare:nNnF {#2} < {#4} + { + #1 {#2} + \exp_args:NNf \prg_stepwise_inline_decr:Nnnn #1 + { \int_eval:n { #2 + #3 } } {#3} {#4} + } + } +\cs_new_protected:Npn \prg_stepwise_variable:nnnNn #1#2#3#4#5 + { + \prg_stepwise_inline:nnnn {#1} {#2} {#3} + { + \tl_set:Nn #4 {##1} + #5 + } + } +\prg_new_conditional:Npnn \mode_if_vertical: { p , T , F , TF } + { \if_mode_vertical: \prg_return_true: \else: \prg_return_false: \fi: } +\prg_new_conditional:Npnn \mode_if_horizontal: { p , T , F , TF } + { \if_mode_horizontal: \prg_return_true: \else: \prg_return_false: \fi: } +\prg_new_conditional:Npnn \mode_if_inner: { p , T , F , TF } + { \if_mode_inner: \prg_return_true: \else: \prg_return_false: \fi: } +\prg_new_conditional:Npnn \mode_if_math: { p , T , F , TF } + { + \scan_align_safe_stop: + \if_mode_math: \prg_return_true: \else: \prg_return_false: \fi: + } +\cs_new_nopar:Npn \group_align_safe_begin: + { \if_false: { \fi: \if_int_compare:w `} = \c_zero \fi: } +\cs_new_nopar:Npn \group_align_safe_end: + { \if_int_compare:w `{ = \c_zero } \fi: } +\cs_new_nopar:Npn \scan_align_safe_stop: + { + \int_compare:nNnT \etex_currentgrouptype:D = \c_six + { + \int_compare:nNnF \etex_lastnodetype:D = \c_zero + { \int_compare:nNnF \etex_lastnodetype:D = \c_seven { \scan_stop: } } + } + } +\group_begin: + \tex_lccode:D `\& = `\g \scan_stop: + \tex_catcode:D `\& = \c_twelve +\tl_to_lowercase:n + { + \group_end: + \cs_new_nopar:Npn \prg_variable_get_scope:N #1 + { + \exp_last_unbraced:Nf \prg_variable_get_scope_aux:w + { \cs_to_str:N #1 \exp_stop_f: \q_stop } + } + \cs_new_nopar:Npn \prg_variable_get_scope_aux:w #1#2 \q_stop + { \token_if_eq_meaning:NNT & #1 { g } } + } +\group_begin: + \tex_lccode:D `\& = `\_ \scan_stop: + \tex_catcode:D `\& = \c_twelve +\tl_to_lowercase:n + { + \group_end: + \cs_new_nopar:Npn \prg_variable_get_type:N #1 + { + \exp_after:wN \prg_variable_get_type_aux:w + \token_to_str:N #1 & a \q_stop + } + \cs_new_nopar:Npn \prg_variable_get_type_aux:w #1 & #2#3 \q_stop + { + \token_if_eq_meaning:NNTF a #2 + {#1} + { \prg_variable_get_type_aux:w #2#3 \q_stop } + } + } +\cs_new_protected_nopar:Npn \prg_define_quicksort:nnn #1#2#3 { + \cs_set:cpx{#1_quicksort:n}##1{ + \exp_not:c{#1_quicksort_start_partition:w} ##1 + \exp_not:n{#2\q_nil#3\q_stop} + } + \cs_set:cpx{#1_quicksort_braced:n}##1{ + \exp_not:c{#1_quicksort_start_partition_braced:n} ##1 + \exp_not:N\q_nil\exp_not:N\q_stop + } + \cs_set:cpx {#1_quicksort_start_partition:w} #2 ##1 #3{ + \exp_not:N \quark_if_nil:nT {##1}\exp_not:N \use_none_delimit_by_q_stop:w + \exp_not:c{#1_quicksort_do_partition_i:nnnw} {##1}{}{} + } + \cs_set:cpx {#1_quicksort_start_partition_braced:n} ##1 { + \exp_not:N \quark_if_nil:nT {##1}\exp_not:N \use_none_delimit_by_q_stop:w + \exp_not:c{#1_quicksort_do_partition_i_braced:nnnn} {##1}{}{} + } + \cs_set:cpx {#1_quicksort_do_partition_i:nnnw} ##1##2##3 #2 ##4 #3 { + \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw} + { + \exp_not:c{#1_quicksort_compare:nnTF}{##1}{##4} + \exp_not:c{#1_quicksort_partition_greater_ii:nnnn} + \exp_not:c{#1_quicksort_partition_less_ii:nnnn} + } + {##1}{##2}{##3}{##4} + } + \cs_set:cpx {#1_quicksort_do_partition_i_braced:nnnn} ##1##2##3##4 { + \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw} + { + \exp_not:c{#1_quicksort_compare:nnTF}{##1}{##4} + \exp_not:c{#1_quicksort_partition_greater_ii_braced:nnnn} + \exp_not:c{#1_quicksort_partition_less_ii_braced:nnnn} + } + {##1}{##2}{##3}{##4} + } + \cs_set:cpx {#1_quicksort_do_partition_ii:nnnw} ##1##2##3 #2 ##4 #3 { + \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw} + { + \exp_not:c{#1_quicksort_compare:nnTF}{##4}{##1} + \exp_not:c{#1_quicksort_partition_less_i:nnnn} + \exp_not:c{#1_quicksort_partition_greater_i:nnnn} + } + {##1}{##2}{##3}{##4} + } + \cs_set:cpx {#1_quicksort_do_partition_ii_braced:nnnn} ##1##2##3##4 { + \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw} + { + \exp_not:c{#1_quicksort_compare:nnTF}{##4}{##1} + \exp_not:c{#1_quicksort_partition_less_i_braced:nnnn} + \exp_not:c{#1_quicksort_partition_greater_i_braced:nnnn} + } + {##1}{##2}{##3}{##4} + } + \cs_set:cpx {#1_quicksort_partition_less_i:nnnn} ##1##2##3##4{ + \exp_not:c{#1_quicksort_do_partition_i:nnnw}{##1}{##2}{{##4}##3}} + \cs_set:cpx {#1_quicksort_partition_less_ii:nnnn} ##1##2##3##4{ + \exp_not:c{#1_quicksort_do_partition_ii:nnnw}{##1}{##2}{##3{##4}}} + \cs_set:cpx {#1_quicksort_partition_greater_i:nnnn} ##1##2##3##4{ + \exp_not:c{#1_quicksort_do_partition_i:nnnw}{##1}{{##4}##2}{##3}} + \cs_set:cpx {#1_quicksort_partition_greater_ii:nnnn} ##1##2##3##4{ + \exp_not:c{#1_quicksort_do_partition_ii:nnnw}{##1}{##2{##4}}{##3}} + \cs_set:cpx {#1_quicksort_partition_less_i_braced:nnnn} ##1##2##3##4{ + \exp_not:c{#1_quicksort_do_partition_i_braced:nnnn}{##1}{##2}{{##4}##3}} + \cs_set:cpx {#1_quicksort_partition_less_ii_braced:nnnn} ##1##2##3##4{ + \exp_not:c{#1_quicksort_do_partition_ii_braced:nnnn}{##1}{##2}{##3{##4}}} + \cs_set:cpx {#1_quicksort_partition_greater_i_braced:nnnn} ##1##2##3##4{ + \exp_not:c{#1_quicksort_do_partition_i_braced:nnnn}{##1}{{##4}##2}{##3}} + \cs_set:cpx {#1_quicksort_partition_greater_ii_braced:nnnn} ##1##2##3##4{ + \exp_not:c{#1_quicksort_do_partition_ii_braced:nnnn}{##1}{##2{##4}}{##3}} + \cs_set:cpx {#1_do_quicksort_braced:nnnnw} ##1##2##3##4\q_stop { + \exp_not:c{#1_quicksort_braced:n}{##2} + \exp_not:c{#1_quicksort_function:n}{##1} + \exp_not:c{#1_quicksort_braced:n}{##3} + } +} +\prg_define_quicksort:nnn {prg}{}{} +\cs_set:Npn \prg_quicksort_function:n {\ERROR} +\cs_set:Npn \prg_quicksort_compare:nnTF {\ERROR} +\cs_new_protected:Npn \prg_new_map_functions:Nn #1#2 { \deprectiated } +\cs_new_protected:Npn \prg_set_map_functions:Nn #1#2 { \deprectiated } +%% +%% +%% End of file `l3prg.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty new file mode 100644 index 00000000000..5d2a1ff69d0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty @@ -0,0 +1,333 @@ +%% +%% This is file `l3prop.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3prop.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3prop.dtx Copyright (C) 1990-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3prop.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental property lists} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\quark_new:N \q_prop +\tl_const:Nn \c_empty_prop { \q_prop } +\cs_new_protected:Npn \prop_new:N #1 { \cs_new_eq:NN #1 \c_empty_prop } +\cs_new_protected:Npn \prop_new:c #1 { \cs_new_eq:cN {#1} \c_empty_prop } +\cs_new_protected:Npn \prop_clear:N #1 { \cs_set_eq:NN #1 \c_empty_prop } +\cs_new_protected:Npn \prop_clear:c #1 { \cs_set_eq:cN {#1} \c_empty_prop } +\cs_new_protected:Npn \prop_gclear:N #1 { \cs_gset_eq:NN #1 \c_empty_prop } +\cs_new_protected:Npn \prop_gclear:c #1 { \cs_gset_eq:cN {#1} \c_empty_prop } +\cs_new_protected:Npn \prop_clear_new:N #1 + { \cs_if_exist:NTF #1 { \prop_clear:N #1 } { \prop_new:N #1 } } +\cs_generate_variant:Nn \prop_clear_new:N {c} +\cs_new_protected:Npn \prop_gclear_new:N #1 + { \cs_if_exist:NTF #1 { \prop_gclear:N #1 } { \prop_new:N #1 } } +\cs_new_eq:NN \prop_gclear_new:c \prop_gclear:c +\cs_new_eq:NN \prop_set_eq:NN \tl_set_eq:NN +\cs_new_eq:NN \prop_set_eq:Nc \tl_set_eq:Nc +\cs_new_eq:NN \prop_set_eq:cN \tl_set_eq:cN +\cs_new_eq:NN \prop_set_eq:cc \tl_set_eq:cc +\cs_new_eq:NN \prop_gset_eq:NN \tl_gset_eq:NN +\cs_new_eq:NN \prop_gset_eq:Nc \tl_gset_eq:Nc +\cs_new_eq:NN \prop_gset_eq:cN \tl_gset_eq:cN +\cs_new_eq:NN \prop_gset_eq:cc \tl_gset_eq:cc +\cs_set_protected:Npn \prop_split:NnTF #1#2 + { \exp_args:NNo \prop_split_aux:NnTF #1 { \tl_to_str:n {#2} } } +\cs_new_protected:Npn \prop_split_aux:NnTF #1#2 + { + \cs_set_protected:Npn \prop_split_aux:w + ##1 \q_prop #2 \q_prop ##2 ##3 ##4 \q_mark ##5 \q_stop + { \prop_split_aux:nnnn ##3 { {##1 \q_prop } {##2} {##4} } } + \exp_after:wN \prop_split_aux:w #1 \q_mark + \q_prop #2 \q_prop { } { ? \use_ii:nn { } } \q_mark \q_stop + } +\cs_new:Npn \prop_split_aux:nnnn #1#2#3#4 { #3 #2 } +\cs_new_protected:Npn \prop_split_aux:w { } +\cs_set_protected:Npn \prop_split:Nnn #1#2#3 + { + \prop_split:NnTF #1 {#2} + {#3} + { \exp_args:Nno \use:n {#3} {#1} { \q_no_value } { } } + } +\cs_new_protected:Npn \prop_del:Nn #1#2 + { \prop_split:NnTF #1 {#2} { \prop_del_aux:NNnnn \tl_set:Nn #1 } { } } +\cs_new_protected:Npn \prop_gdel:Nn #1#2 + { \prop_split:NnTF #1 {#2} { \prop_del_aux:NNnnn \tl_gset:Nn #1 } { } } +\cs_new_protected:Npn \prop_del_aux:NNnnn #1#2#3#4#5 + { #1 #2 { #3 #5 } } +\cs_generate_variant:Nn \prop_del:Nn { NV } +\cs_generate_variant:Nn \prop_del:Nn { c , cV } +\cs_generate_variant:Nn \prop_gdel:Nn { NV } +\cs_generate_variant:Nn \prop_gdel:Nn { c , cV } +\cs_new_protected:Npn \prop_get:NnN #1#2#3 + { + \prop_split:NnTF #1 {#2} + { \prop_get_aux:Nnnn #3 } + { \tl_set:Nn #3 { \q_no_value } } + } +\cs_new_protected:Npn \prop_get_aux:Nnnn #1#2#3#4 + { \tl_set:Nn #1 {#3} } +\cs_generate_variant:Nn \prop_get:NnN { NV , No } +\cs_generate_variant:Nn \prop_get:NnN { c , cV , co } +\cs_new_protected:Npn \prop_pop:NnN #1#2#3 + { + \prop_split:NnTF #1 {#2} + { \prop_pop_aux:NNNnnn \tl_set:Nn #1 #3 } + { \tl_set:Nn #3 { \q_no_value } } + } +\cs_new_protected:Npn \prop_gpop:NnN #1#2#3 + { + \prop_split:NnTF #1 {#2} + { \prop_pop_aux:NNNnnn \tl_gset:Nn #1 #3 } + { \tl_set:Nn #3 { \q_no_value } } + } +\cs_new_protected:Npn \prop_pop_aux:NNNnnn #1#2#3#4#5#6 + { + \tl_set:Nn #3 {#5} + #1 #2 { #4 #6 } + } +\cs_generate_variant:Nn \prop_pop:NnN { No } +\cs_generate_variant:Nn \prop_pop:NnN { c , co } +\cs_generate_variant:Nn \prop_gpop:NnN { No } +\cs_generate_variant:Nn \prop_gpop:NnN { c , co } +\cs_new_protected:Npn \prop_put:Nnn { \prop_put_aux:NNnn \tl_set:Nx } +\cs_new_protected:Npn \prop_gput:Nnn { \prop_put_aux:NNnn \tl_gset:Nx } +\cs_new_protected:Npn \prop_put_aux:NNnn #1#2#3#4 + { + \prop_split:Nnn #2 {#3} { \prop_put_aux:NNnnnnn #1 #2 {#3} {#4} } + } +\cs_new_protected:Npn \prop_put_aux:NNnnnnn #1#2#3#4#5#6#7 + { + #1 #2 + { + \exp_not:n { #5 #7 } + \tl_to_str:n {#3} \exp_not:n { \q_prop {#4} \q_prop } + } + } +\cs_generate_variant:Nn \prop_put:Nnn + { NnV , Nno , Nnx , NV , NVV , No , Noo } +\cs_generate_variant:Nn \prop_put:Nnn + { c , cnV , cno , cnx , cV , cVV , co , coo } +\cs_generate_variant:Nn \prop_gput:Nnn + { NnV , Nno , Nnx , NV , NVV , No , Noo } +\cs_generate_variant:Nn \prop_gput:Nnn + { c , cnV , cno , cnx , cV , cVV , co , coo } +\cs_new_protected_nopar:Npn \prop_put_if_new:Nnn + { \prop_put_if_new_aux:NNnn \tl_put_right:Nx } +\cs_new_protected_nopar:Npn \prop_gput_if_new:Nnn + { \prop_put_if_new_aux:NNnn \tl_gput_right:Nx } +\cs_new_protected:Npn \prop_put_if_new_aux:NNnn #1#2#3#4 + { + \prop_split:NnTF #2 {#3} + { \use_none:nnn } + { + #1 #2 + { \tl_to_str:n {#3} \exp_not:n { \q_prop {#4} \q_prop } } + } + } +\cs_generate_variant:Nn \prop_put_if_new:Nnn { c } +\cs_generate_variant:Nn \prop_gput_if_new:Nnn { c } +\prg_new_conditional:Npnn \prop_if_empty:N #1 { p, T , F , TF } + { + \if_meaning:w #1 \c_empty_prop + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_generate_variant:Nn \prop_if_empty_p:N {c} +\cs_generate_variant:Nn \prop_if_empty:NTF {c} +\cs_generate_variant:Nn \prop_if_empty:NT {c} +\cs_generate_variant:Nn \prop_if_empty:NF {c} +\prg_new_conditional:Npnn \prop_if_in:Nn #1#2 { p , T , F , TF } + { + \exp_last_unbraced:Noo \prop_if_in_aux:nwn + { \tl_to_str:n {#2} } #1 + A \q_prop { } \q_stop + } +\cs_new:Npn \prop_if_in_aux:nwn #1 \q_prop #2 \q_prop #3 + { + \if_catcode:w A #2 + \prg_return_false: + \exp_after:wN \use_none_delimit_by_q_stop:w + \fi: + \str_if_eq:nnT {#1} {#2} + { + \prg_return_true: + \use_none_delimit_by_q_stop:w + } + \prop_if_in_aux:nwn {#1} + } +\cs_generate_variant:Nn \prop_if_in_p:Nn { NV , No } +\cs_generate_variant:Nn \prop_if_in_p:Nn { c , cV , co } +\cs_generate_variant:Nn \prop_if_in:NnT { NV , No } +\cs_generate_variant:Nn \prop_if_in:NnT { c , cV , co } +\cs_generate_variant:Nn \prop_if_in:NnF { NV , No } +\cs_generate_variant:Nn \prop_if_in:NnF { c , cV , co } +\cs_generate_variant:Nn \prop_if_in:NnTF { NV , No } +\cs_generate_variant:Nn \prop_if_in:NnTF { c , cV , co } +\cs_new_nopar:Npn \prop_map_function:NN #1#2 + { + \exp_last_unbraced:NNo \prop_map_function_aux:Nwn #2 + #1 A \q_prop { } \q_recursion_stop + } +\cs_new:Npn \prop_map_function_aux:Nwn #1 \q_prop #2 \q_prop #3 + { + \if_catcode:w A #2 + \exp_after:wN \prop_map_break: + \fi: + #1 {#2} {#3} + \prop_map_function_aux:Nwn #1 + } +\cs_generate_variant:Nn \prop_map_function:NN { Nc } +\cs_generate_variant:Nn \prop_map_function:NN { c , cc } +\int_new:N \g_prop_map_inline_int +\cs_new_protected:Npn \prop_map_inline:Nn #1#2 + { + \int_gincr:N \g_prop_map_inline_int + \cs_gset:cpn { prop_map_inline_ \int_use:N \g_prop_map_inline_int :nn } + ##1##2 {#2} + \prop_map_function:Nc #1 + { prop_map_inline_ \int_use:N \g_prop_map_inline_int :nn } + \int_gdecr:N \g_prop_map_inline_int + } +\cs_generate_variant:Nn \prop_map_inline:Nn { c } +\cs_new_eq:NN \prop_map_break: \use_none_delimit_by_q_recursion_stop:w +\cs_new_eq:NN \prop_map_break:n \use_i_delimit_by_q_recursion_stop:nw +\tl_new:N \l_prop_show_tl +\cs_new_protected_nopar:Npn \prop_show:N #1 + { + \prop_if_empty:NTF #1 + { + \iow_term:x { Property~list~\token_to_str:N #1 \c_space_tl is~empty } + \tl_show:n { } + } + { + \iow_term:x + { + Property~list~\token_to_str:N #1 \c_space_tl + contains~the~pairs~(without~outer~braces): + } + \tl_set:Nx \l_prop_show_tl + { \prop_map_function:NN #1 \prop_show_aux:nn } + \tl_show:n \exp_after:wN \exp_after:wN \exp_after:wN + { \exp_after:wN \prop_show_aux:w \l_prop_show_tl } + } + } +\cs_new:Npn \prop_show_aux:nn #1#2 + { + \iow_newline: > \c_space_tl \c_space_tl + \iow_char:N \{ #1 \iow_char:N \} + \c_space_tl \c_space_tl => \c_space_tl \c_space_tl + \iow_char:N \{ \exp_not:n {#2} \iow_char:N \} + } +\cs_new:Npn \prop_show_aux:w #1 > ~ { } +\cs_generate_variant:Nn \prop_show:N { c } +\prg_new_protected_conditional:Npnn \prop_get:NnN #1#2#3 { T , F , TF } + { + \prop_split:NnTF #1 {#2} + { \prop_get_aux_true:Nnnn #3 } + { \prg_return_false: } + } +\cs_new_protected:Npn \prop_get_aux_true:Nnnn #1#2#3#4 + { + \tl_set:Nn #1 {#3} + \prg_return_true: + } +\prg_new_protected_conditional:Npnn \prop_pop:NnN #1#2#3 {T,F,TF} + { + \prop_split:NnTF #1 {#2} + { \prop_pop_aux_true:NNNnnn \tl_set:Nn #1 #3 } + { \prg_return_false: } + } +\prg_new_protected_conditional:Npnn \prop_gpop:NnN #1#2#3 {T,F,TF} + { + \prop_split:NnTF #1 {#2} + { \prop_pop_aux_true:NNNnnn \tl_gset:Nn #1 #3 } + { \prg_return_false: } + } +\cs_new_protected:Npn \prop_pop_aux_true:NNNnnn #1#2#3#4#5#6 + { + \tl_set:Nn #3 {#5} + #1 #2 { #4 #6 } + \prg_return_true: + } +\cs_new:Npn \prop_map_tokens:Nn #1#2 + { + \exp_last_unbraced:Nno \prop_map_tokens_aux:nwn {#2} #1 + A \q_prop { } \q_recursion_stop + } +\cs_new:Npn \prop_map_tokens_aux:nwn #1 \q_prop #2 \q_prop #3 + { + \if_catcode:w A #2 + \exp_after:wN \prop_map_break: + \fi: + \use:n {#1} {#2} {#3} + \prop_map_tokens_aux:nwn {#1} + } +\cs_new:Npn \prop_get:Nn #1 #2 + { \prop_map_tokens:Nn #1 { \prop_get_aux:nnn {#2} } } +\cs_new:Npn \prop_get_aux:nnn #1 #2 #3 + { \str_if_eq:nnT {#1} {#2} { \prop_map_break:n {#3} } } +\cs_new_eq:NN \prop_display:N \prop_show:N +\cs_new_eq:NN \prop_display:c \prop_show:c +\cs_new_protected:Npn \prop_gget:NnN #1#2#3 + { \prop_split:Nnn #1 {#2} { \prop_gget_aux:Nnnn #3 } } +\cs_new_protected:Npn \prop_gget_aux:Nnnn #1#2#3#4 + { \tl_gset:Nn #1 {#3} } +\cs_generate_variant:Nn \prop_gget:NnN { NV } +\cs_generate_variant:Nn \prop_gget:NnN { c , cV } +\cs_new_eq:NN \prop_get_gdel:NnN \prop_gpop:NnN +\cs_generate_variant:Nn \prop_if_in:NnT { cc } +\cs_generate_variant:Nn \prop_if_in:NnF { cc } +\cs_generate_variant:Nn \prop_if_in:NnTF { cc } +\cs_generate_variant:Nn \prop_gput:Nnn { ccx } +\prg_new_eq_conditional:NNn \prop_if_eq:NN \tl_if_eq:NN { p , T , F , TF } +\prg_new_eq_conditional:NNn \prop_if_eq:cN \tl_if_eq:cN { p , T , F , TF } +\prg_new_eq_conditional:NNn \prop_if_eq:Nc \tl_if_eq:Nc { p , T , F , TF } +\prg_new_eq_conditional:NNn \prop_if_eq:cc \tl_if_eq:cc { p , T , F , TF } +%% +%% +%% End of file `l3prop.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty b/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty new file mode 100644 index 00000000000..35a8ca8f8e7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty @@ -0,0 +1,154 @@ +%% +%% This is file `l3quark.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3quark.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3quark.dtx Copyright (C) 1990-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3quark.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental quarks} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\cs_new_protected_nopar:Npn \quark_new:N #1 { \tl_const:Nn #1 {#1} } +\quark_new:N \q_nil +\quark_new:N \q_mark +\quark_new:N \q_no_value +\quark_new:N \q_stop +\quark_new:N \q_recursion_tail +\quark_new:N \q_recursion_stop +\cs_new:Npn \quark_if_recursion_tail_stop:N #1 + { + \if_meaning:w #1 \q_recursion_tail + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \fi: + } +\cs_new:Npn \quark_if_recursion_tail_stop_do:Nn #1#2 + { + \if_meaning:w #1 \q_recursion_tail + \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw + \else: + \exp_after:wN \use_none:n + \fi: + {#2} + } +\cs_new:Npn \quark_if_recursion_tail_stop:n #1 + { + \if_catcode:w + A + \etex_detokenize:D \exp_after:wN + { + \quark_if_recursion_tail_aux:w #1 \q_recursion_stop + \q_recursion_tail \q_recursion_stop \q_stop + } + A + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \fi: + } +\cs_new:Npn \quark_if_recursion_tail_stop_do:nn #1#2 + { + \if_catcode:w + A + \etex_detokenize:D \exp_after:wN + { + \quark_if_recursion_tail_aux:w #1 \q_recursion_stop + \q_recursion_tail \q_recursion_stop \q_stop + } + A + \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw + \else: + \exp_after:wN \use_none:n + \fi: + {#2} + } +\cs_new:Npn \quark_if_recursion_tail_aux:w + #1 \q_recursion_tail #2 \q_recursion_stop #3 \q_stop + { #1 #2 } +\cs_generate_variant:Nn \quark_if_recursion_tail_stop:n { o } +\cs_generate_variant:Nn \quark_if_recursion_tail_stop_do:nn { o } +\prg_new_conditional:Nnn \quark_if_nil:N { p, T , F , TF } + { + \if_meaning:w \q_nil #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\prg_new_conditional:Nnn \quark_if_no_value:N { p, T , F , TF } + { + \if_meaning:w \q_no_value #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_generate_variant:Nn \quark_if_no_value_p:N { c } +\cs_generate_variant:Nn \quark_if_no_value:NT { c } +\cs_generate_variant:Nn \quark_if_no_value:NF { c } +\cs_generate_variant:Nn \quark_if_no_value:NTF { c } +\prg_new_conditional:Nnn \quark_if_nil:n { p, T , F , TF } + { + \if_int_compare:w \pdftex_strcmp:D + { \exp_not:N \q_nil } { \exp_not:n {#1} } = \c_zero + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\prg_new_conditional:Nnn \quark_if_no_value:n { p, T , F , TF } + { + \if_int_compare:w \pdftex_strcmp:D + { \exp_not:N \q_no_value } { \exp_not:n {#1} } = \c_zero + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_generate_variant:Nn \quark_if_nil_p:n { V , o } +\cs_generate_variant:Nn \quark_if_nil:nTF { V , o } +\cs_generate_variant:Nn \quark_if_nil:nT { V , o } +\cs_generate_variant:Nn \quark_if_nil:nF { V , o } +%% +%% +%% End of file `l3quark.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty new file mode 100644 index 00000000000..13136da4828 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty @@ -0,0 +1,531 @@ +%% +%% This is file `l3seq.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3seq.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3seq.dtx Copyright (C) 1990-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3seq.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental sequences and stacks} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\cs_new:Npn \seq_item:n + { + \seq_use_error: + \use_none:n + } +\tl_new:N \l_seq_tmpa_tl +\tl_new:N \l_seq_tmpb_tl +\cs_new_eq:NN \seq_new:N \tl_new:N +\cs_new_eq:NN \seq_new:c \tl_new:c +\cs_new_eq:NN \seq_clear:N \tl_clear:N +\cs_new_eq:NN \seq_clear:c \tl_clear:c +\cs_new_eq:NN \seq_gclear:N \tl_gclear:N +\cs_new_eq:NN \seq_gclear:c \tl_gclear:c +\cs_new_eq:NN \seq_clear_new:N \tl_clear_new:N +\cs_new_eq:NN \seq_clear_new:c \tl_clear_new:c +\cs_new_eq:NN \seq_gclear_new:N \tl_gclear_new:N +\cs_new_eq:NN \seq_gclear_new:c \tl_gclear_new:c +\cs_new_eq:NN \seq_set_eq:NN \tl_set_eq:NN +\cs_new_eq:NN \seq_set_eq:Nc \tl_set_eq:Nc +\cs_new_eq:NN \seq_set_eq:cN \tl_set_eq:cN +\cs_new_eq:NN \seq_set_eq:cc \tl_set_eq:cc +\cs_new_eq:NN \seq_gset_eq:NN \tl_gset_eq:NN +\cs_new_eq:NN \seq_gset_eq:Nc \tl_gset_eq:Nc +\cs_new_eq:NN \seq_gset_eq:cN \tl_gset_eq:cN +\cs_new_eq:NN \seq_gset_eq:cc \tl_gset_eq:cc +\cs_new_protected_nopar:Npn \seq_concat:NNN #1#2#3 + { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } +\cs_new_protected_nopar:Npn \seq_gconcat:NNN #1#2#3 + { \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } +\cs_generate_variant:Nn \seq_concat:NNN { ccc } +\cs_generate_variant:Nn \seq_gconcat:NNN { ccc } +\cs_new_protected:Npn \seq_put_left:Nn #1#2 + { \tl_put_left:Nn #1 { \seq_item:n {#2} } } +\cs_new_protected:Npn \seq_put_right:Nn #1#2 + { \tl_put_right:Nn #1 { \seq_item:n {#2} } } +\cs_generate_variant:Nn \seq_put_left:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_put_left:Nn { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_put_right:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_put_right:Nn { c , cV , cv , co , cx } +\cs_new_protected:Npn \seq_gput_left:Nn #1#2 + { \tl_gput_left:Nn #1 { \seq_item:n {#2} } } +\cs_new_protected:Npn \seq_gput_right:Nn #1#2 + { \tl_gput_right:Nn #1 { \seq_item:n {#2} } } +\cs_generate_variant:Nn \seq_gput_left:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_gput_left:Nn { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_gput_right:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_gput_right:Nn { c , cV , cv , co , cx } +\seq_new:N \l_seq_remove_seq +\cs_new_protected:Npn \seq_remove_duplicates:N + { \seq_remove_duplicates_aux:NN \seq_set_eq:NN } +\cs_new_protected:Npn \seq_gremove_duplicates:N + { \seq_remove_duplicates_aux:NN \seq_gset_eq:NN } +\cs_new_protected:Npn \seq_remove_duplicates_aux:NN #1#2 + { + \seq_clear:N \l_seq_remove_seq + \seq_map_inline:Nn #2 + { + \seq_if_in:NnF \l_seq_remove_seq {##1} + { \seq_put_right:Nn \l_seq_remove_seq {##1} } + } + #1 #2 \l_seq_remove_seq + } +\cs_generate_variant:Nn \seq_remove_duplicates:N { c } +\cs_generate_variant:Nn \seq_gremove_duplicates:N { c } +\cs_new_protected:Npn \seq_remove_all:Nn + { \seq_remove_all_aux:NNn \tl_set:Nx } +\cs_new_protected:Npn \seq_gremove_all:Nn + { \seq_remove_all_aux:NNn \tl_gset:Nx } +\cs_new_protected:Npn \seq_remove_all_aux:NNn #1#2#3 + { + \seq_push_item_def:n + { + \str_if_eq:nnT {##1} {#3} + { + \if_false: { \fi: } + \tl_set:Nn \l_seq_tmpb_tl {##1} + #1 #2 + { \if_false: } \fi: + \exp_not:o {#2} + \tl_if_eq:NNT \l_seq_tmpa_tl \l_seq_tmpb_tl + { \use_none:nn } + } + \exp_not:n { \seq_item:n {##1} } + } + \tl_set:Nn \l_seq_tmpa_tl {#3} + #1 #2 {#2} + \seq_pop_item_def: + } +\cs_generate_variant:Nn \seq_remove_all:Nn { c } +\cs_generate_variant:Nn \seq_gremove_all:Nn { c } +\prg_new_eq_conditional:NNn \seq_if_empty:N \tl_if_empty:N + { p , T , F , TF } +\prg_new_eq_conditional:NNn \seq_if_empty:c \tl_if_empty:c + { p , T , F , TF } +\prg_new_protected_conditional:Npnn \seq_if_in:Nn #1#2 + { T , F , TF } + { + \group_begin: + \tl_set:Nn \l_seq_tmpa_tl {#2} + \cs_set_protected:Npn \seq_item:n ##1 + { + \tl_set:Nn \l_seq_tmpb_tl {##1} + \if_meaning:w \l_seq_tmpa_tl \l_seq_tmpb_tl + \exp_after:wN \seq_if_in_aux: + \fi: + } + #1 + \seq_break:n { \prg_return_false: } + \seq_break_point:n { \group_end: } + } +\cs_new_nopar:Npn \seq_if_in_aux: { \seq_break:n { \prg_return_true: } } +\cs_generate_variant:Nn \seq_if_in:NnT { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_if_in:NnT { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_if_in:NnF { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_if_in:NnF { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_if_in:NnTF { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_if_in:NnTF { c , cV , cv , co , cx } +\cs_new_protected_nopar:Npn \seq_get_left:NN #1#2 + { + \seq_if_empty_err_break:N #1 + \exp_after:wN \seq_get_left_aux:NnwN #1 \q_stop #2 + \seq_break_point:n { } + } +\cs_new_protected:Npn \seq_get_left_aux:NnwN \seq_item:n #1#2 \q_stop #3 + { \tl_set:Nn #3 {#1} } +\cs_generate_variant:Nn \seq_get_left:NN { c } +\cs_new_protected_nopar:Npn \seq_pop_left:NN + { \seq_pop_left_aux:NNN \tl_set:Nn } +\cs_new_protected_nopar:Npn \seq_gpop_left:NN + { \seq_pop_left_aux:NNN \tl_gset:Nn } +\cs_new_protected_nopar:Npn \seq_pop_left_aux:NNN #1#2#3 + { + \seq_if_empty_err_break:N #2 + \exp_after:wN \seq_pop_left_aux:NnwNNN #2 \q_stop #1#2#3 + \seq_break_point:n { } + } +\cs_new_protected:Npn \seq_pop_left_aux:NnwNNN \seq_item:n #1#2 \q_stop #3#4#5 + { + #3 #4 {#2} + \tl_set:Nn #5 {#1} + } +\cs_generate_variant:Nn \seq_pop_left:NN { c } +\cs_generate_variant:Nn \seq_gpop_left:NN { c } +\cs_new_protected_nopar:Npn \seq_get_right:NN #1#2 + { + \seq_if_empty_err_break:N #1 + \seq_get_right_aux:NN #1#2 + \seq_break_point:n { } + } +\cs_new_protected_nopar:Npn \seq_get_right_aux:NN #1#2 + { + \seq_push_item_def:n { } + \exp_after:wN \exp_after:wN \exp_after:wN \seq_get_right_loop:nn + \exp_after:wN \use_none:n #1 + { \tl_set:Nn #2 } + { } + { + \seq_pop_item_def: + \seq_break: + } +} +\cs_new:Npn \seq_get_right_loop:nn #1#2 + { + #2 {#1} + \seq_get_right_loop:nn + } +\cs_generate_variant:Nn \seq_get_right:NN { c } +\cs_new_protected_nopar:Npn \seq_pop_right:NN + { \seq_pop_right_aux:NNN \tl_set:Nx } +\cs_new_protected_nopar:Npn \seq_gpop_right:NN + { \seq_pop_right_aux:NNN \tl_gset:Nx } +\cs_new_protected_nopar:Npn \seq_pop_right_aux:NNN #1#2#3 + { + \seq_if_empty_err_break:N #2 + \seq_pop_right_aux_ii:NNN #1 #2 #3 + \seq_break_point:n { } + } +\cs_new_protected_nopar:Npn \seq_pop_right_aux_ii:NNN #1#2#3 + { + \seq_push_item_def:n { \exp_not:n { \seq_item:n {##1} } } + #1 #2 { \if_false: } \fi: + \exp_after:wN \exp_after:wN \exp_after:wN \seq_get_right_loop:nn + \exp_after:wN \use_none:n #2 + { + \if_false: { \fi: } + \tl_set:Nn #3 + } + { } + { + \seq_pop_item_def: + \seq_break: + } + } +\cs_generate_variant:Nn \seq_pop_right:NN { c } +\cs_generate_variant:Nn \seq_gpop_right:NN { c } +\cs_new:Npn \seq_break: #1 \seq_break_point:n #2 {#2} +\cs_new:Npn \seq_break:n #1#2 \seq_break_point:n #3 { #3 #1 } +\cs_new_eq:NN \seq_map_break: \seq_break: +\cs_new_eq:NN \seq_map_break:n \seq_break:n +\cs_new_eq:NN \seq_break_point:n \use:n +\cs_new_protected_nopar:Npn \seq_if_empty_err_break:N #1 + { + \if_meaning:w #1 \c_empty_tl + \msg_kernel_error:nnx { seq } { empty-sequence } { \token_to_str:N #1 } + \exp_after:wN \seq_break: + \fi: + } +\cs_new:Npn \seq_map_function:NN #1#2 + { + \exp_after:wN \seq_map_function_aux:NNn \exp_after:wN #2 #1 + { ? \seq_map_break: } { } + \seq_break_point:n { } + } +\cs_new:Npn \seq_map_function_aux:NNn #1#2#3 + { + \use_none:n #2 + #1 {#3} + \seq_map_function_aux:NNn #1 + } +\cs_generate_variant:Nn \seq_map_function:NN { c } +\cs_new_protected:Npn \seq_push_item_def:n + { + \seq_push_item_def_aux: + \cs_gset:Npn \seq_item:n ##1 + } +\cs_new_protected:Npn \seq_push_item_def:x + { + \seq_push_item_def_aux: + \cs_gset:Npx \seq_item:n ##1 + } +\cs_new_protected:Npn \seq_push_item_def_aux: + { + \cs_gset_eq:cN { seq_item_ \int_use:N \g_seq_nesting_depth_int :n } + \seq_item:n + \int_gincr:N \g_seq_nesting_depth_int + } +\cs_new_protected_nopar:Npn \seq_pop_item_def: + { + \int_gdecr:N \g_seq_nesting_depth_int + \cs_gset_eq:Nc \seq_item:n + { seq_item_ \int_use:N \g_seq_nesting_depth_int :n } + } +\cs_new_protected:Npn \seq_map_inline:Nn #1#2 + { + \seq_push_item_def:n {#2} + #1 + \seq_break_point:n { \seq_pop_item_def: } + } +\cs_generate_variant:Nn \seq_map_inline:Nn { c } +\cs_new_protected:Npn \seq_map_variable:NNn #1#2#3 + { + \seq_push_item_def:x + { + \tl_set:Nn \exp_not:N #2 {##1} + \exp_not:n {#3} + } + #1 + \seq_break_point:n { \seq_pop_item_def: } + } +\cs_generate_variant:Nn \seq_map_variable:NNn { Nc } +\cs_generate_variant:Nn \seq_map_variable:NNn { c , cc } +\cs_new_eq:NN \seq_push:Nn \seq_put_left:Nn +\cs_new_eq:NN \seq_push:NV \seq_put_left:NV +\cs_new_eq:NN \seq_push:Nv \seq_put_left:Nv +\cs_new_eq:NN \seq_push:No \seq_put_left:No +\cs_new_eq:NN \seq_push:Nx \seq_put_left:Nx +\cs_new_eq:NN \seq_push:cn \seq_put_left:cn +\cs_new_eq:NN \seq_push:cV \seq_put_left:cV +\cs_new_eq:NN \seq_push:cv \seq_put_left:cv +\cs_new_eq:NN \seq_push:co \seq_put_left:co +\cs_new_eq:NN \seq_push:cx \seq_put_left:cx +\cs_new_eq:NN \seq_gpush:Nn \seq_gput_left:Nn +\cs_new_eq:NN \seq_gpush:NV \seq_gput_left:NV +\cs_new_eq:NN \seq_gpush:Nv \seq_gput_left:Nv +\cs_new_eq:NN \seq_gpush:No \seq_gput_left:No +\cs_new_eq:NN \seq_gpush:Nx \seq_gput_left:Nx +\cs_new_eq:NN \seq_gpush:cn \seq_gput_left:cn +\cs_new_eq:NN \seq_gpush:cV \seq_gput_left:cV +\cs_new_eq:NN \seq_gpush:cv \seq_gput_left:cv +\cs_new_eq:NN \seq_gpush:co \seq_gput_left:co +\cs_new_eq:NN \seq_gpush:cx \seq_gput_left:cx +\cs_new_eq:NN \seq_get:NN \seq_get_left:NN +\cs_new_eq:NN \seq_get:cN \seq_get_left:cN +\cs_new_eq:NN \seq_pop:NN \seq_pop_left:NN +\cs_new_eq:NN \seq_pop:cN \seq_pop_left:cN +\cs_new_eq:NN \seq_gpop:NN \seq_gpop_left:NN +\cs_new_eq:NN \seq_gpop:cN \seq_gpop_left:cN +\tl_new:N \l_seq_show_tl +\cs_new_protected_nopar:Npn \seq_show:N #1 + { + \seq_if_empty:NTF #1 + { + \iow_term:x { Sequence~\token_to_str:N #1 \c_space_tl is~empty } + \tl_show:n { } + } + { + \iow_term:x + { + Sequence~\token_to_str:N #1 \c_space_tl + contains~the~items~(without~outer~braces): + } + \tl_set:Nx \l_seq_show_tl + { \seq_map_function:NN #1 \seq_show_aux:n } + \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN + { \exp_after:wN \seq_show_aux:w \l_seq_show_tl } + } + } +\cs_new:Npn \seq_show_aux:n #1 + { + \iow_newline: > \c_space_tl \c_space_tl + \iow_char:N \{ \exp_not:n {#1} \iow_char:N \} + } +\cs_new:Npn \seq_show_aux:w #1 > ~ { } +\cs_generate_variant:Nn \seq_show:N { c } +\cs_new_nopar:Npn \seq_if_empty_break_return_false:N #1 + { + \if_meaning:w #1 \c_empty_tl + \prg_return_false: + \exp_after:wN \seq_break: + \fi: + } +\prg_new_protected_conditional:Npnn \seq_get_left:NN #1 #2 { T , F , TF } + { + \seq_if_empty_break_return_false:N #1 + \exp_after:wN \seq_get_left_aux:Nw #1 \q_stop #2 + \prg_return_true: + \seq_break: + \seq_break_point:n { } + } +\prg_new_protected_conditional:Npnn \seq_get_right:NN #1#2 { T , F , TF } + { + \seq_if_empty_break_return_false:N #1 + \seq_get_right_aux:NN #1#2 + \prg_return_true: \seq_break: + \seq_break_point:n { } + } +\cs_generate_variant:Nn \seq_get_left:NNT { c } +\cs_generate_variant:Nn \seq_get_left:NNF { c } +\cs_generate_variant:Nn \seq_get_left:NNTF { c } +\cs_generate_variant:Nn \seq_get_right:NNT { c } +\cs_generate_variant:Nn \seq_get_right:NNF { c } +\cs_generate_variant:Nn \seq_get_right:NNTF { c } +\prg_new_protected_conditional:Npnn \seq_pop_left:NN #1#2 { T , F , TF } + { + \seq_if_empty_break_return_false:N #1 + \exp_after:wN \seq_pop_left_aux:NnwNNN #1 \q_stop \tl_set:Nn #1#2 + \prg_return_true: \seq_break: + \seq_break_point:n { } + } +\prg_new_protected_conditional:Npnn \seq_gpop_left:NN #1#2 { T , F , TF } + { + \seq_if_empty_break_return_false:N #1 + \exp_after:wN \seq_pop_left_aux:NnwNNN #1 \q_stop \tl_gset:Nn #1#2 + \prg_return_true: \seq_break: + \seq_break_point:n { } + } +\prg_new_protected_conditional:Npnn \seq_pop_right:NN #1#2 { T , F , TF } + { + \seq_if_empty_break_return_false:N #1 + \seq_pop_right_aux_ii:NNN \tl_set:Nx #1 #2 + \prg_return_true: \seq_break: + \seq_break_point:n { } + } +\prg_new_protected_conditional:Npnn \seq_gpop_right:NN #1#2 { T , F , TF } + { + \seq_if_empty_break_return_false:N #1 + \seq_pop_right_aux_ii:NNN \tl_gset:Nx #1 #2 + \prg_return_true: \seq_break: + \seq_break_point:n { } + } +\cs_generate_variant:Nn \seq_pop_left:NNT { c } +\cs_generate_variant:Nn \seq_pop_left:NNF { c } +\cs_generate_variant:Nn \seq_pop_left:NNTF { c } +\cs_generate_variant:Nn \seq_gpop_left:NNT { c } +\cs_generate_variant:Nn \seq_gpop_left:NNF { c } +\cs_generate_variant:Nn \seq_gpop_left:NNTF { c } +\cs_generate_variant:Nn \seq_pop_right:NNT { c } +\cs_generate_variant:Nn \seq_pop_right:NNF { c } +\cs_generate_variant:Nn \seq_pop_right:NNTF { c } +\cs_generate_variant:Nn \seq_gpop_right:NNT { c } +\cs_generate_variant:Nn \seq_gpop_right:NNF { c } +\cs_generate_variant:Nn \seq_gpop_right:NNTF { c } +\cs_new:Npn \seq_length:N #1 + { + \int_eval:n + { + 0 + \seq_map_function:NN #1 \seq_length_aux:n + } + } +\cs_new:Npn \seq_length_aux:n #1 { +1 } +\cs_generate_variant:Nn \seq_length:N { c } +\cs_new_nopar:Npn \seq_item:Nn #1#2 + { + \exp_last_unbraced:Nfo \seq_item_aux:nnn + { + \int_eval:n + { + \int_compare:nNnT {#2} < \c_zero + { \seq_length:N #1 + } + #2 + } + } + #1 + { ? \seq_break: } + { } + \seq_break_point:n { } + } +\cs_new_nopar:Npn \seq_item_aux:nnn #1#2#3 + { + \use_none:n #2 + \int_compare:nNnTF {#1} = \c_zero + { \seq_break:n {#3} } + { \exp_args:Nf \seq_item_aux:nnn { #1 - 1 } } + } +\cs_generate_variant:Nn \seq_item:Nn { c } +\cs_new_nopar:Npn \seq_use:N #1 { \seq_map_function:NN #1 \use:n } +\cs_generate_variant:Nn \seq_use:N { c } +\cs_new_nopar:Npn \seq_mapthread_function:NNN #1#2#3 + { + \exp_after:wN \seq_mapthread_function_aux:NN + \exp_after:wN #3 + \exp_after:wN #1 + #2 + { ? \seq_break: } { } + \seq_break_point:n { } + } +\cs_new_nopar:Npn \seq_mapthread_function_aux:NN #1#2 + { + \exp_after:wN \seq_mapthread_function_aux:Nnnwnn + \exp_after:wN #1 + #2 + { ? \seq_break: } { } + \q_stop + } +\cs_new:Npn \seq_mapthread_function_aux:Nnnwnn #1#2#3#4 \q_stop #5#6 + { + \use_none:n #2 + \use_none:n #5 + #1 {#3} {#6} + \seq_mapthread_function_aux:Nnnwnn #1 #4 \q_stop + } +\cs_generate_variant:Nn \seq_mapthread_function:NNN { Nc } +\cs_generate_variant:Nn \seq_mapthread_function:NNN { c , cc } +\cs_new_protected:Npn \seq_set_from_clist:NN #1#2 + { + \tl_set:Nx #1 + { \clist_map_function:NN #2 \seq_wrap_item:n } + } +\cs_new_protected:Npn \seq_set_from_clist:Nn #1#2 + { + \tl_set:Nx #1 + { \clist_map_function:nN {#2} \seq_wrap_item:n } + } +\cs_new_protected:Npn \seq_gset_from_clist:NN #1#2 + { + \tl_gset:Nx #1 + { \clist_map_function:NN #2 \seq_wrap_item:n } + } +\cs_new_protected:Npn \seq_gset_from_clist:Nn #1#2 + { + \tl_gset:Nx #1 + { \clist_map_function:nN {#2} \seq_wrap_item:n } + } +\cs_new:Npn \seq_wrap_item:n #1 { \exp_not:n { \seq_item:n {#1} } } +\cs_generate_variant:Nn \seq_set_from_clist:NN { Nc } +\cs_generate_variant:Nn \seq_set_from_clist:NN { c , cc } +\cs_generate_variant:Nn \seq_set_from_clist:Nn { c } +\cs_generate_variant:Nn \seq_gset_from_clist:NN { Nc } +\cs_generate_variant:Nn \seq_gset_from_clist:NN { c , cc } +\cs_generate_variant:Nn \seq_gset_from_clist:Nn { c } +\cs_new_eq:NN \seq_top:NN \seq_get_left:NN +\cs_new_eq:NN \seq_top:cN \seq_get_left:cN +\cs_new_eq:NN \seq_display:N \seq_show:N +\cs_new_eq:NN \seq_display:c \seq_show:c +%% +%% +%% End of file `l3seq.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty b/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty new file mode 100644 index 00000000000..ae4a46fc805 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty @@ -0,0 +1,332 @@ +%% +%% This is file `l3skip.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3skip.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3skip.dtx Copyright (C) 2004-2011 Frank Mittelbach, The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3skip.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental dimensions and skips} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\cs_new_eq:NN \if_dim:w \tex_ifdim:D +\cs_new_eq:NN \dim_eval:w \etex_dimexpr:D +\cs_new_eq:NN \dim_eval_end: \tex_relax:D +\cs_new_protected_nopar:Npn \dim_new:N #1 + { + \chk_if_free_cs:N #1 + \newdimen #1 + } +\cs_generate_variant:Nn \dim_new:N { c } +\cs_new_protected_nopar:Npn \dim_zero:N #1 { #1 \c_zero_dim } +\cs_new_protected_nopar:Npn \dim_gzero:N { \pref_global:D \dim_zero:N } +\cs_generate_variant:Nn \dim_zero:N { c } +\cs_generate_variant:Nn \dim_gzero:N { c } +\cs_new_protected_nopar:Npn \dim_set:Nn #1#2 + { #1 ~ \dim_eval:w #2 \dim_eval_end: } +\cs_new_protected_nopar:Npn \dim_gset:Nn { \pref_global:D \dim_set:Nn } +\cs_generate_variant:Nn \dim_set:Nn { c } +\cs_generate_variant:Nn \dim_gset:Nn { c } +\cs_new_protected_nopar:Npn \dim_set_eq:NN #1#2 { #1 = #2 } +\cs_generate_variant:Nn \dim_set_eq:NN { c } +\cs_generate_variant:Nn \dim_set_eq:NN { Nc , cc } +\cs_new_protected_nopar:Npn \dim_gset_eq:NN #1#2 { \pref_global:D #1 = #2 } +\cs_generate_variant:Nn \dim_gset_eq:NN { c } +\cs_generate_variant:Nn \dim_gset_eq:NN { Nc , cc } +\cs_new_protected_nopar:Npn \dim_set_max:Nn #1#2 + { \dim_compare:nNnT {#1} < {#2} { \dim_set:Nn #1 {#2} } } +\cs_new_protected_nopar:Npn \dim_gset_max:Nn #1#2 + { \dim_compare:nNnT {#1} < {#2} { \dim_gset:Nn #1 {#2} } } +\cs_new_protected_nopar:Npn \dim_set_min:Nn #1#2 + { \dim_compare:nNnT {#1} > {#2} { \dim_set:Nn #1 {#2} } } +\cs_new_protected_nopar:Npn \dim_gset_min:Nn #1#2 + { \dim_compare:nNnT {#1} > {#2} { \dim_gset:Nn #1 {#2} } } +\cs_generate_variant:Nn \dim_set_max:Nn { c } +\cs_generate_variant:Nn \dim_gset_max:Nn { c } +\cs_generate_variant:Nn \dim_set_min:Nn { c } +\cs_generate_variant:Nn \dim_gset_min:Nn { c } +\cs_new_protected_nopar:Npn \dim_add:Nn #1#2 + { \tex_advance:D #1 by \dim_eval:w #2 \dim_eval_end: } +\cs_new_protected_nopar:Npn \dim_gadd:Nn { \pref_global:D \dim_add:Nn } +\cs_generate_variant:Nn \dim_add:Nn { c } +\cs_generate_variant:Nn \dim_gadd:Nn { c } +\cs_new_protected_nopar:Npn \dim_sub:Nn #1#2 + { \tex_advance:D #1 by - \dim_eval:w #2 \dim_eval_end: } +\cs_new_protected_nopar:Npn \dim_gsub:Nn { \pref_global:D \dim_sub:Nn } +\cs_generate_variant:Nn \dim_sub:Nn { c } +\cs_generate_variant:Nn \dim_gsub:Nn { c } +\cs_new_nopar:Npn \dim_ratio:nn #1#2 + { \dim_ratio_aux:n {#1} / \dim_ratio_aux:n {#2} } +\cs_new_nopar:Npn \dim_ratio_aux:n #1 + { \exp_after:wN \int_value:w \dim_eval:w #1 \dim_eval_end: } +\prg_new_conditional:Npnn \dim_compare:nNn #1#2#3 { p , T , F , TF } + { + \if_dim:w \dim_eval:w #1 #2 \dim_eval:w #3 \dim_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \dim_compare:n #1 { p , T , F , TF } + { + \exp_after:wN \dim_compare_aux:wNN \dim_use:N \dim_eval:w #1 + \dim_eval_end: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\exp_args:Nno \use:nn + { \cs_new:Npn \dim_compare_aux:wNN #1 } + { \tl_to_str:n { pt } } + #2 #3 + { + \use:c + { + dim_compare_ #2 + \if_meaning:w = #3 = \fi: + :nw + } + { #1 pt } #3 + } +\cs_new:cpn { dim_compare_<:nw } #1 { \if_dim:w #1 < \dim_eval:w } +\cs_new:cpn { dim_compare_=:nw } #1 { \if_dim:w #1 = \dim_eval:w } +\cs_new:cpn { dim_compare_>:nw } #1 { \if_dim:w #1 > \dim_eval:w } +\cs_new:cpn {dim_compare_==:nw} #1#2 { \if_dim:w #1 = \dim_eval:w } +\cs_new:cpn {dim_compare_<=:nw} #1#2 {\reverse_if:N \if_dim:w #1 > \dim_eval:w} +\cs_new:cpn {dim_compare_!=:nw} #1#2 {\reverse_if:N \if_dim:w #1 = \dim_eval:w} +\cs_new:cpn {dim_compare_>=:nw} #1#2 {\reverse_if:N \if_dim:w #1 < \dim_eval:w} +\cs_set:Npn \dim_while_do:nn #1#2 + { + \dim_compare:nT {#1} + { + #2 + \dim_while_do:nn {#1} {#2} + } + } +\cs_set:Npn \dim_until_do:nn #1#2 + { + \dim_compare:nF {#1} + { + #2 + \dim_until_do:nn {#1} {#2} + } + } +\cs_set:Npn \dim_do_while:nn #1#2 + { + #2 + \dim_compare:nT {#1} + { \dim_do_while:nNnn {#1} {#2} } + } +\cs_set:Npn \dim_do_until:nn #1#2 + { + #2 + \dim_compare:nF {#1} + { \dim_do_until:nn {#1} {#2} } + } +\cs_set:Npn \dim_while_do:nNnn #1#2#3#4 + { + \dim_compare:nNnT {#1} #2 {#3} + { + #4 + \dim_while_do:nNnn {#1} #2 {#3} {#4} + } + } +\cs_set:Npn \dim_until_do:nNnn #1#2#3#4 + { + \dim_compare:nNnF {#1} #2 {#3} + { + #4 + \dim_until_do:nNnn {#1} #2 {#3} {#4} + } + } +\cs_set:Npn \dim_do_while:nNnn #1#2#3#4 + { + #4 + \dim_compare:nNnT {#1} #2 {#3} + { \dim_do_while:nNnn {#1} #2 {#3} {#4} } + } +\cs_set:Npn \dim_do_until:nNnn #1#2#3#4 + { + #4 + \dim_compare:nNnF {#1} #2 {#3} + { \dim_do_until:nNnn {#1} #2 {#3} {#4} } + } +\cs_new_nopar:Npn \dim_eval:n #1 + { \dim_use:N \dim_eval:w #1 \dim_eval_end: } +\cs_new_eq:NN \dim_use:N \tex_the:D +\cs_generate_variant:Nn \dim_use:N { c } +\cs_new_eq:NN \dim_show:N \kernel_register_show:N +\cs_generate_variant:Nn \dim_show:N { c } +\cs_new_eq:NN \c_zero_dim \z@ +\cs_new_eq:NN \c_max_dim \maxdimen +\dim_new:N \l_tmpa_dim +\dim_new:N \l_tmpb_dim +\dim_new:N \l_tmpc_dim +\dim_new:N \g_tmpa_dim +\dim_new:N \g_tmpb_dim +\cs_new_protected_nopar:Npn \skip_new:N #1 + { + \chk_if_free_cs:N #1 + \newskip #1 + } +\cs_generate_variant:Nn \skip_new:N { c } +\cs_new_protected_nopar:Npn \skip_zero:N #1 { #1 \c_zero_skip } +\cs_new_protected_nopar:Npn \skip_gzero:N { \pref_global:D \skip_zero:N } +\cs_generate_variant:Nn \skip_zero:N { c } +\cs_generate_variant:Nn \skip_gzero:N { c } +\cs_new_protected_nopar:Npn \skip_set:Nn #1#2 + { #1 ~ \etex_glueexpr:D #2 \scan_stop: } +\cs_new_protected_nopar:Npn \skip_gset:Nn { \pref_global:D \skip_set:Nn } +\cs_generate_variant:Nn \skip_set:Nn { c } +\cs_generate_variant:Nn \skip_gset:Nn { c } +\cs_new_protected_nopar:Npn \skip_set_eq:NN #1#2 { #1 = #2 } +\cs_generate_variant:Nn \skip_set_eq:NN { c } +\cs_generate_variant:Nn \skip_set_eq:NN { Nc , cc } +\cs_new_protected_nopar:Npn \skip_gset_eq:NN #1#2 { \pref_global:D #1 = #2 } +\cs_generate_variant:Nn \skip_gset_eq:NN { c } +\cs_generate_variant:Nn \skip_gset_eq:NN { Nc , cc } +\cs_new_protected_nopar:Npn \skip_add:Nn #1#2 + { \tex_advance:D #1 by \etex_glueexpr:D #2 \scan_stop: } +\cs_new_protected_nopar:Npn \skip_gadd:Nn { \pref_global:D \skip_add:Nn } +\cs_generate_variant:Nn \skip_add:Nn { c } +\cs_generate_variant:Nn \skip_gadd:Nn { c } +\cs_new_protected_nopar:Npn \skip_sub:Nn #1#2 + { \tex_advance:D #1 by - \etex_glueexpr:D #2 \scan_stop: } +\cs_new_protected_nopar:Npn \skip_gsub:Nn { \pref_global:D \skip_sub:Nn } +\cs_generate_variant:Nn \skip_sub:Nn { c } +\cs_generate_variant:Nn \skip_gsub:Nn { c } +\prg_new_conditional:Npnn \skip_if_eq:nn #1#2 { p , T , F , TF } + { + \if_int_compare:w + \pdftex_strcmp:D { \skip_eval:n { #1 } } { \skip_eval:n { #2 } } + = \c_zero + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\prg_new_conditional:Npnn \skip_if_infinite_glue:n #1 { p , T , F , TF } + { + \bool_if:nTF + { + \int_compare_p:nNn { \etex_gluestretchorder:D #1 } > \c_zero || + \int_compare_p:nNn { \etex_glueshrinkorder:D #1 } > \c_zero + } + { \prg_return_true: } + { \prg_return_false: } + } +\cs_new_nopar:Npn \skip_eval:n #1 + { \skip_use:N \etex_glueexpr:D #1 \scan_stop: } +\cs_new_eq:NN \skip_use:N \tex_the:D +\cs_generate_variant:Nn \skip_use:N { c } +\cs_new_eq:NN \skip_horizontal:N \tex_hskip:D +\cs_new_nopar:Npn \skip_horizontal:n #1 + { \skip_horizontal:N \etex_glueexpr:D #1 \scan_stop: } +\cs_new_eq:NN \skip_vertical:N \tex_vskip:D +\cs_new_nopar:Npn \skip_vertical:n #1 + { \skip_vertical:N \etex_glueexpr:D #1 \scan_stop: } +\cs_generate_variant:Nn \skip_horizontal:N { c } +\cs_generate_variant:Nn \skip_vertical:N { c } +\cs_new_eq:NN \skip_show:N \kernel_register_show:N +\cs_generate_variant:Nn \skip_show:N { c } +\cs_new_eq:NN \c_zero_skip \c_zero_dim +\cs_new_eq:NN \c_max_skip \c_max_dim +\skip_new:N \l_tmpa_skip +\skip_new:N \l_tmpb_skip +\skip_new:N \l_tmpc_skip +\skip_new:N \g_tmpa_skip +\skip_new:N \g_tmpb_skip +\cs_new_protected_nopar:Npn \muskip_new:N #1 + { + \chk_if_free_cs:N #1 + \newmuskip #1 + } +\cs_generate_variant:Nn \muskip_new:N { c } +\cs_new_protected_nopar:Npn \muskip_zero:N #1 + { #1 \c_zero_muskip } +\cs_new_protected_nopar:Npn \muskip_gzero:N { \pref_global:D \muskip_zero:N } +\cs_generate_variant:Nn \muskip_zero:N { c } +\cs_generate_variant:Nn \muskip_gzero:N { c } +\cs_new_protected_nopar:Npn \muskip_set:Nn #1#2 + { #1 ~ \etex_muexpr:D #2 \scan_stop: } +\cs_new_protected_nopar:Npn \muskip_gset:Nn { \pref_global:D \muskip_set:Nn } +\cs_generate_variant:Nn \muskip_set:Nn { c } +\cs_generate_variant:Nn \muskip_gset:Nn { c } +\cs_new_protected_nopar:Npn \muskip_set_eq:NN #1#2 { #1 = #2 } +\cs_generate_variant:Nn \muskip_set_eq:NN { c } +\cs_generate_variant:Nn \muskip_set_eq:NN { Nc , cc } +\cs_new_protected_nopar:Npn \muskip_gset_eq:NN #1#2 { \pref_global:D #1 = #2 } +\cs_generate_variant:Nn \muskip_gset_eq:NN { c } +\cs_generate_variant:Nn \muskip_gset_eq:NN { Nc , cc } +\cs_new_protected_nopar:Npn \muskip_add:Nn #1#2 + { \tex_advance:D #1 by \etex_muexpr:D #2 \scan_stop: } +\cs_new_protected_nopar:Npn \muskip_gadd:Nn { \pref_global:D \muskip_add:Nn } +\cs_generate_variant:Nn \muskip_add:Nn { c } +\cs_generate_variant:Nn \muskip_gadd:Nn { c } +\cs_new_protected_nopar:Npn \muskip_sub:Nn #1#2 + { \tex_advance:D #1 by - \etex_muexpr:D #2 \scan_stop: } +\cs_new_protected_nopar:Npn \muskip_gsub:Nn { \pref_global:D \muskip_sub:Nn } +\cs_generate_variant:Nn \muskip_sub:Nn { c } +\cs_generate_variant:Nn \muskip_gsub:Nn { c } +\cs_new_nopar:Npn \muskip_eval:n #1 + { \muskip_use:N \etex_muexpr:D #1 \scan_stop: } +\cs_new_eq:NN \muskip_use:N \tex_the:D +\cs_generate_variant:Nn \muskip_use:N { c } +\cs_new_eq:NN \muskip_show:N \kernel_register_show:N +\cs_generate_variant:Nn \muskip_show:N { c } +\cs_new_nopar:Npn \skip_split_finite_else_action:nnNN #1#2#3#4 + { + \skip_if_infinite_glue:nTF {#1} + { + #3 = \c_zero_skip + #4 = \c_zero_skip + #2 + } + { + #3 = \etex_gluestretch:D #1 \scan_stop: + #4 = \etex_glueshrink:D #1 \scan_stop: + } + } +%% +%% +%% End of file `l3skip.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty new file mode 100644 index 00000000000..34238f643f0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty @@ -0,0 +1,628 @@ +%% +%% This is file `l3tl.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3tl.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3tl.dtx Copyright (C) 1990-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3tl.dtx 2498 2011-07-09 17:51:47Z joseph $ + {L3 Experimental token lists} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\cs_new_protected_nopar:Npn \tl_new:N #1 + { + \chk_if_free_cs:N #1 + \cs_gset_eq:NN #1 \c_empty_tl + } +\cs_generate_variant:Nn \tl_new:N { c } +\cs_new_protected:Npn \tl_const:Nn #1#2 + { + \chk_if_free_cs:N #1 + \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } + } +\cs_new_protected:Npn \tl_const:Nx #1#2 + { + \chk_if_free_cs:N #1 + \cs_gset_nopar:Npx #1 {#2} + } +\cs_generate_variant:Nn \tl_const:Nn { c } +\cs_generate_variant:Nn \tl_const:Nx { c } +\cs_new_protected_nopar:Npn \tl_clear:N #1 + { \tl_set_eq:NN #1 \c_empty_tl } +\cs_new_protected_nopar:Npn \tl_gclear:N #1 + { \tl_gset_eq:NN #1 \c_empty_tl } +\cs_generate_variant:Nn \tl_clear:N { c } +\cs_generate_variant:Nn \tl_gclear:N { c } +\cs_new_protected_nopar:Npn \tl_clear_new:N #1 + { \cs_if_exist:NTF #1 { \tl_clear:N #1 } { \tl_new:N #1 } } +\cs_new_protected_nopar:Npn \tl_gclear_new:N #1 + { \cs_if_exist:NTF #1 { \tl_gclear:N #1 } { \tl_new:N #1 } } +\cs_generate_variant:Nn \tl_clear_new:N { c } +\cs_generate_variant:Nn \tl_gclear_new:N { c } +\cs_new_eq:NN \tl_set_eq:NN \cs_set_eq:NN +\cs_new_eq:NN \tl_set_eq:cN \cs_set_eq:cN +\cs_new_eq:NN \tl_set_eq:Nc \cs_set_eq:Nc +\cs_new_eq:NN \tl_set_eq:cc \cs_set_eq:cc +\cs_new_eq:NN \tl_gset_eq:NN \cs_gset_eq:NN +\cs_new_eq:NN \tl_gset_eq:cN \cs_gset_eq:cN +\cs_new_eq:NN \tl_gset_eq:Nc \cs_gset_eq:Nc +\cs_new_eq:NN \tl_gset_eq:cc \cs_gset_eq:cc +\cs_new_protected:Npn \tl_set:Nn #1#2 + { \cs_set_nopar:Npx #1 { \exp_not:n {#2} } } +\cs_new_protected:Npn \tl_set:No #1#2 + { \cs_set_nopar:Npx #1 { \exp_not:o {#2} } } +\cs_new_protected:Npn \tl_set:Nx #1#2 + { \cs_set_nopar:Npx #1 {#2} } +\cs_new_protected:Npn \tl_gset:Nn #1#2 + { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } } +\cs_new_protected:Npn \tl_gset:No #1#2 + { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} } } +\cs_new_protected:Npn \tl_gset:Nx #1#2 + { \cs_gset_nopar:Npx #1 {#2} } +\cs_generate_variant:Nn \tl_set:Nn { NV , Nv , Nf } +\cs_generate_variant:Nn \tl_set:Nx { c } +\cs_generate_variant:Nn \tl_set:Nn { c, co , cV , cv , cf } +\cs_generate_variant:Nn \tl_gset:Nn { NV , Nv , Nf } +\cs_generate_variant:Nn \tl_gset:Nx { c } +\cs_generate_variant:Nn \tl_gset:Nn { c, co , cV , cv , cf } +\cs_new_protected:Npn \tl_put_left:Nn #1#2 + { \cs_set_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } +\cs_new_protected:Npn \tl_put_left:NV #1#2 + { \cs_set_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } +\cs_new_protected:Npn \tl_put_left:No #1#2 + { \cs_set_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } +\cs_new_protected:Npn \tl_put_left:Nx #1#2 + { \cs_set_nopar:Npx #1 { #2 \exp_not:o #1 } } +\cs_new_protected:Npn \tl_gput_left:Nn #1#2 + { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } +\cs_new_protected:Npn \tl_gput_left:NV #1#2 + { \cs_gset_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } +\cs_new_protected:Npn \tl_gput_left:No #1#2 + { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } +\cs_new_protected:Npn \tl_gput_left:Nx #1#2 + { \cs_gset_nopar:Npx #1 { #2 \exp_not:o {#1} } } +\cs_generate_variant:Nn \tl_put_left:Nn { c } +\cs_generate_variant:Nn \tl_put_left:NV { c } +\cs_generate_variant:Nn \tl_put_left:No { c } +\cs_generate_variant:Nn \tl_put_left:Nx { c } +\cs_generate_variant:Nn \tl_gput_left:Nn { c } +\cs_generate_variant:Nn \tl_gput_left:NV { c } +\cs_generate_variant:Nn \tl_gput_left:No { c } +\cs_generate_variant:Nn \tl_gput_left:Nx { c } +\cs_new_protected:Npn \tl_put_right:Nn #1#2 + { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } +\cs_new_protected:Npn \tl_put_right:NV #1#2 + { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } +\cs_new_protected:Npn \tl_put_right:No #1#2 + { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } +\cs_new_protected:Npn \tl_put_right:Nx #1#2 + { \cs_set_nopar:Npx #1 { \exp_not:o #1 #2 } } +\cs_new_protected:Npn \tl_gput_right:Nn #1#2 + { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } +\cs_new_protected:Npn \tl_gput_right:NV #1#2 + { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } +\cs_new_protected:Npn \tl_gput_right:No #1#2 + { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } +\cs_new_protected:Npn \tl_gput_right:Nx #1#2 + { \cs_gset_nopar:Npx #1 { \exp_not:o {#1} #2 } } +\cs_generate_variant:Nn \tl_put_right:Nn { c } +\cs_generate_variant:Nn \tl_put_right:NV { c } +\cs_generate_variant:Nn \tl_put_right:No { c } +\cs_generate_variant:Nn \tl_put_right:Nx { c } +\cs_generate_variant:Nn \tl_gput_right:Nn { c } +\cs_generate_variant:Nn \tl_gput_right:NV { c } +\cs_generate_variant:Nn \tl_gput_right:No { c } +\cs_generate_variant:Nn \tl_gput_right:Nx { c } +\group_begin: + \tex_lccode:D `\A = `\@ \scan_stop: + \tex_lccode:D `\B = `\@ \scan_stop: + \tex_catcode:D `\A = 8 \scan_stop: + \tex_catcode:D `\B = 3 \scan_stop: +\tex_lowercase:D + { + \group_end: + \tl_const:Nn \c_tl_rescan_marker_tl { A B } + } +\tl_new:N \l_tl_rescan_tl +\cs_new_protected_nopar:Npn \tl_set_rescan:Nnn + { \tl_set_rescan_aux:NNnn \tl_set:Nn } +\cs_new_protected_nopar:Npn \tl_gset_rescan:Nnn + { \tl_set_rescan_aux:NNnn \tl_gset:Nn } +\cs_new_protected:Npn \tl_set_rescan_aux:NNnn #1#2#3#4 + { + \group_begin: + \exp_args:No \etex_everyeof:D { \c_tl_rescan_marker_tl } + \tex_endlinechar:D \c_minus_one + #3 + \tl_clear:N \l_tl_rescan_tl + \exp_after:wN \tl_rescan_aux:w \etex_scantokens:D {#4} + \exp_args:NNNo \group_end: + #1 #2 \l_tl_rescan_tl + } +\cs_new_nopar:Npx \tl_rescan_aux:w + { + \cs_set_protected:Npn \exp_not:N \tl_rescan_aux:w ##1 + \c_tl_rescan_marker_tl + { \tl_set:Nn \exp_not:N \l_tl_rescan_tl {##1} } + } +\tl_rescan_aux:w +\cs_generate_variant:Nn \tl_set_rescan:Nnn { Nno } +\cs_generate_variant:Nn \tl_set_rescan:Nnn { c , cno } +\cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nno } +\cs_generate_variant:Nn \tl_gset_rescan:Nnn { c , cno } +\cs_new_protected_nopar:Npn \tl_set_rescan:Nnx + { \tl_set_rescan_aux:NNnx \tl_set:Nn } +\cs_new_protected_nopar:Npn \tl_gset_rescan:Nnx + { \tl_set_rescan_aux:NNnx \tl_gset:Nn } +\cs_new_protected_nopar:Npn \tl_set_rescan_aux:NNnx #1#2#3#4 + { + \group_begin: + \etex_everyeof:D { \exp_not:N } + \tex_endlinechar:D \c_minus_one + #3 + \tl_set:Nx \l_tl_rescan_tl { \etex_scantokens:D {#4} } + \exp_args:NNNo \group_end: + #1 #2 \l_tl_rescan_tl + } +\cs_generate_variant:Nn \tl_set_rescan:Nnx { c } +\cs_generate_variant:Nn \tl_gset_rescan:Nnx { c } +\cs_new_protected:Npn \tl_rescan:nn #1#2 + { + \group_begin: + \exp_args:No \etex_everyeof:D { \c_tl_rescan_marker_tl } + \tex_endlinechar:D \c_minus_one + #1 + \exp_after:wN \tl_rescan_aux:w \etex_scantokens:D {#2} + \exp_args:No \group_end: + \l_tl_rescan_tl + } +\cs_new_eq:NN \tl_to_lowercase:n \tex_lowercase:D +\cs_new_eq:NN \tl_to_uppercase:n \tex_uppercase:D +\tl_new:N \l_tl_replace_tl +\cs_new_protected_nopar:Npn \tl_replace_once:Nnn + { \tl_replace_once_aux:NNnn \tl_set_eq:NN } +\cs_new_protected_nopar:Npn \tl_greplace_once:Nnn + { \tl_replace_once_aux:NNnn \tl_gset_eq:NN } +\cs_new_protected:Npn \tl_replace_once_aux:NNnn #1#2#3#4 + { + \cs_set_protected:Npx \tl_tmp:w ##1 #3 ##2 \q_stop + { + \exp_not:N \quark_if_no_value:nF {##2} + { + \tl_set:No \exp_not:N \l_tl_replace_tl { ##1 \exp_not:n{#4} } + \exp_not:n + { + \cs_set_protected:Npn \tl_tmp:w ##1 \q_nil #3 \q_no_value + { \tl_put_right:No \l_tl_replace_tl {##1} } + } + \exp_not:n { \tl_tmp:w \prg_do_nothing: } ##2 + \exp_not:n { #1 #2 \l_tl_replace_tl } + } + } + \exp_after:wN \tl_tmp:w \exp_after:wN \prg_do_nothing: + #2 \q_nil #3 \q_no_value \q_stop + } +\cs_generate_variant:Nn \tl_replace_once:Nnn { c } +\cs_generate_variant:Nn \tl_greplace_once:Nnn { c } +\cs_new_protected_nopar:Npn \tl_replace_all:Nnn + { \tl_replace_all_aux:NNnn \tl_set_eq:NN } +\cs_new_protected_nopar:Npn \tl_greplace_all:Nnn + { \tl_replace_all_aux:NNnn \tl_gset_eq:NN } +\cs_new_protected:Npn \tl_replace_all_aux:NNnn #1#2#3#4 + { + \tl_clear:N \l_tl_replace_tl + \cs_set_protected:Npx \tl_tmp:w ##1 #3 ##2 \q_stop + { + \exp_not:N \quark_if_no_value:nTF {##2} + { + \exp_not:n + { + \cs_set_protected:Npn \tl_tmp:w ##1 \q_nil ##2 \q_stop + { \tl_put_right:No \l_tl_replace_tl {##1} } + } + \exp_not:N \tl_tmp:w ##1 \exp_not:N \q_stop + } + { + \exp_not:n { \tl_put_right:No \l_tl_replace_tl } + { ##1 \exp_not:n{#4} } + \exp_not:n { \tl_tmp:w \prg_do_nothing: } ##2 \exp_not:N \q_stop + } + } + \exp_after:wN \tl_tmp:w \exp_after:wN \prg_do_nothing: + #2 \q_nil #3 \q_no_value \q_stop + #1 #2 \l_tl_replace_tl + } +\cs_generate_variant:Nn \tl_replace_all:Nnn { c } +\cs_generate_variant:Nn \tl_greplace_all:Nnn { c } +\cs_new_protected_nopar:Npn \tl_remove_once:Nn #1#2 + { \tl_replace_once:Nnn #1 {#2} { } } +\cs_new_protected_nopar:Npn \tl_gremove_once:Nn #1#2 + { \tl_greplace_once:Nnn #1 {#2} { } } +\cs_generate_variant:Nn \tl_remove_once:Nn { c } +\cs_generate_variant:Nn \tl_gremove_once:Nn { c } +\cs_new_protected_nopar:Npn \tl_remove_all:Nn #1#2 + { \tl_replace_all:Nnn #1 {#2} { } } +\cs_new_protected_nopar:Npn \tl_gremove_all:Nn #1#2 + { \tl_greplace_all:Nnn #1 {#2} { } } +\cs_generate_variant:Nn \tl_remove_all:Nn { c } +\cs_generate_variant:Nn \tl_gremove_all:Nn { c } +\prg_new_conditional:Npnn \tl_if_blank:n #1 { p , T , F , TF } + { \tl_if_empty_return:o { \use_none:n #1 ? } } +\cs_generate_variant:Nn \tl_if_blank_p:n { V } +\cs_generate_variant:Nn \tl_if_blank:nT { V } +\cs_generate_variant:Nn \tl_if_blank:nF { V } +\cs_generate_variant:Nn \tl_if_blank:nTF { V } +\cs_generate_variant:Nn \tl_if_blank_p:n { o } +\cs_generate_variant:Nn \tl_if_blank:nT { o } +\cs_generate_variant:Nn \tl_if_blank:nF { o } +\cs_generate_variant:Nn \tl_if_blank:nTF { o } +\prg_set_conditional:Npnn \tl_if_empty:N #1 { p , T , F , TF } + { + \if_meaning:w #1 \c_empty_tl + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_generate_variant:Nn \tl_if_empty_p:N { c } +\cs_generate_variant:Nn \tl_if_empty:NT { c } +\cs_generate_variant:Nn \tl_if_empty:NF { c } +\cs_generate_variant:Nn \tl_if_empty:NTF { c } +\prg_new_conditional:Npnn \tl_if_empty:n #1 { p,TF,T,F} { + \exp_after:wN \if_meaning:w \exp_after:wN \q_nil \tl_to_str:n {#1} \q_nil + \prg_return_true: + \else: + \prg_return_false: + \fi: +} +\cs_generate_variant:Nn \tl_if_empty_p:n { V } +\cs_generate_variant:Nn \tl_if_empty:nTF { V } +\cs_generate_variant:Nn \tl_if_empty:nT { V } +\cs_generate_variant:Nn \tl_if_empty:nF { V } +\cs_new:Npn \tl_if_empty_return:o #1 { + \exp_after:wN \if_meaning:w \exp_after:wN \q_nil + \tl_to_str:n \exp_after:wN {#1} \q_nil + \prg_return_true: + \else: + \prg_return_false: + \fi: +} +\prg_new_conditional:Npnn \tl_if_empty:o #1 { p,TF,T,F} + { \tl_if_empty_return:o {#1} } +\prg_new_conditional:Npnn \tl_if_eq:NN #1#2 { p , T , F , TF } + { + \if_meaning:w #1 #2 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_generate_variant:Nn \tl_if_eq_p:NN { Nc , c , cc } +\cs_generate_variant:Nn \tl_if_eq:NNTF { Nc , c , cc } +\cs_generate_variant:Nn \tl_if_eq:NNT { Nc , c , cc } +\cs_generate_variant:Nn \tl_if_eq:NNF { Nc , c , cc } +\prg_new_protected_conditional:Npnn \tl_if_eq:nn #1#2 { T , F , TF } + { + \group_begin: + \tl_set:Nn \l_tl_tmpa_tl {#1} + \tl_set:Nn \l_tl_tmpb_tl {#2} + \if_meaning:w \l_tl_tmpa_tl \l_tl_tmpb_tl + \group_end: + \prg_return_true: + \else: + \group_end: + \prg_return_false: + \fi: + } +\tl_new:N \l_tl_tmpa_tl +\tl_new:N \l_tl_tmpb_tl +\cs_new_protected_nopar:Npn \tl_if_in:NnT { \exp_args:No \tl_if_in:nnT } +\cs_new_protected_nopar:Npn \tl_if_in:NnF { \exp_args:No \tl_if_in:nnF } +\cs_new_protected_nopar:Npn \tl_if_in:NnTF { \exp_args:No \tl_if_in:nnTF } +\cs_generate_variant:Nn \tl_if_in:NnT { c } +\cs_generate_variant:Nn \tl_if_in:NnF { c } +\cs_generate_variant:Nn \tl_if_in:NnTF { c } +\prg_new_protected_conditional:Npnn \tl_if_in:nn #1#2 { T , F , TF } + { + \cs_set:Npn \tl_tmp:w ##1 #2 { } + \tl_if_empty:oTF { \tl_tmp:w #1 {} {} #2 } + { \prg_return_false: } { \prg_return_true: } + } +\cs_generate_variant:Nn \tl_if_in:nnT { V } +\cs_generate_variant:Nn \tl_if_in:nnF { V } +\cs_generate_variant:Nn \tl_if_in:nnTF { V } +\cs_generate_variant:Nn \tl_if_in:nnT { o } +\cs_generate_variant:Nn \tl_if_in:nnF { o } +\cs_generate_variant:Nn \tl_if_in:nnTF { o } +\cs_generate_variant:Nn \tl_if_in:nnT { no } +\cs_generate_variant:Nn \tl_if_in:nnF { no } +\cs_generate_variant:Nn \tl_if_in:nnTF { no } +\prg_new_conditional:Npnn \tl_if_single:n #1 { p , T , F , TF } + { + \tl_if_blank:nTF {#1} + { \tl_if_empty:nTF {#1} { \prg_return_false: } { \prg_return_true: } } + { \tl_if_single_aux:n {#1} } + } +\prg_new_conditional:Npnn \tl_if_single:N #1 { p , T , F , TF } + { + \tl_if_blank:oTF #1 + { \tl_if_empty:NTF #1 { \prg_return_false: } { \prg_return_true: } } + { \exp_args:No \tl_if_single_aux:n {#1} } + } +\cs_new:Npn \tl_if_single_aux:n #1 + { \tl_if_empty_return:o { \use_none:n #1 } } +\cs_new:Npn \tl_map_function:nN #1#2 + { \tl_map_function_aux:Nn #2 #1 \q_recursion_tail \q_recursion_stop } +\cs_new_nopar:Npn \tl_map_function:NN #1#2 + { + \exp_after:wN \tl_map_function_aux:Nn + \exp_after:wN #2 #1 \q_recursion_tail \q_recursion_stop + } +\cs_new:Npn \tl_map_function_aux:Nn #1#2 + { + \quark_if_recursion_tail_stop:n {#2} + #1 {#2} \tl_map_function_aux:Nn #1 + } +\cs_generate_variant:Nn \tl_map_function:NN { c } +\cs_new_protected:Npn \tl_map_inline:nn #1#2 + { + \int_gincr:N \g_tl_inline_level_int + \cs_gset:cpn { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } + ##1 {#2} + \exp_args:Nc \tl_map_function_aux:Nn + { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } + #1 \q_recursion_tail \q_recursion_stop + \int_gdecr:N \g_tl_inline_level_int + } +\cs_new_protected:Npn \tl_map_inline:Nn #1#2 + { + \int_gincr:N \g_tl_inline_level_int + \cs_gset:cpn { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } + ##1 {#2} + \exp_last_unbraced:NcV \tl_map_function_aux:Nn + { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } + #1 \q_recursion_tail\q_recursion_stop + \int_gdecr:N \g_tl_inline_level_int + } +\cs_generate_variant:Nn \tl_map_inline:Nn { c } +\cs_new_protected:Npn \tl_map_variable:nNn #1#2#3 + { \tl_map_variable_aux:Nnn #2 {#3} #1 \q_recursion_tail \q_recursion_stop } +\cs_new_protected_nopar:Npn \tl_map_variable:NNn + { \exp_args:No \tl_map_variable:nNn } +\cs_new_protected:Npn \tl_map_variable_aux:Nnn #1#2#3 + { + \tl_set:Nn #1 {#3} + \quark_if_recursion_tail_stop:N #1 + #2 \tl_map_variable_aux:Nnn #1 {#2} + } +\cs_generate_variant:Nn \tl_map_variable:NNn { c } +\cs_new_eq:NN \tl_map_break: \use_none_delimit_by_q_recursion_stop:w +\cs_new_eq:NN \tl_to_str:n \etex_detokenize:D +\cs_new_nopar:Npn \tl_to_str:N #1 { \etex_detokenize:D \exp_after:wN {#1} } +\cs_generate_variant:Nn \tl_to_str:N { c } +\cs_new_eq:NN \tl_use:N \prg_do_nothing: +\cs_new_nopar:Npn \tl_use:c #1 + { + \if_cs_exist:w #1 \cs_end: + \cs:w #1 \exp_after:wN \cs_end: + \else: + \exp_after:wN \tl_error_message: + \fi: + } +\group_begin: +\tex_catcode:D `\! = 11 \scan_stop: +\tex_catcode:D `\ = 11\scan_stop:% +\cs_gset_nopar:Npn\tl_error_message:{\undefined variable name!}% +\group_end:% +\cs_new:Npn \tl_length:n #1 + { + \int_eval:n + { 0 \tl_map_function:nN {#1} \tl_length_aux:n } + } +\cs_new_nopar:Npn \tl_length:N #1 + { + \int_eval:n + { 0 \tl_map_function:NN #1 \tl_length_aux:n } + } +\cs_new:Npn \tl_length_aux:n #1 { + 1 } +\cs_generate_variant:Nn \tl_length:n { V , o } +\cs_generate_variant:Nn \tl_length:N { c } +\cs_new:Npn \tl_reverse:n #1 + { \tl_reverse_aux:nN { } #1 \q_recursion_tail \q_recursion_stop } +\cs_new:Npn \tl_reverse_aux:nN #1#2 + { + \quark_if_recursion_tail_stop_do:nn {#2} {#1} + \tl_reverse_aux:nN { #2 #1 } + } +\cs_generate_variant:Nn \tl_reverse:n {V,o} +\cs_new_protected_nopar:Npn \tl_reverse:N #1 + { \tl_set:Nf #1 { \tl_reverse:o { #1 \exp_stop_f: } } } +\cs_generate_variant:Nn \tl_reverse:N { c } +\cs_new:Npn \tl_trim_spaces:n #1 + { + \etex_unexpanded:D \exp_after:wN \exp_after:wN \exp_after:wN + { \tl_trim_spaces_exp:n {#1} } + } +\cs_new_protected:Npn \tl_trim_spaces:N #1 + { \tl_set:Nx #1 { \exp_after:wN \tl_trim_spaces:n \exp_after:wN {#1} } } +\cs_new_protected:Npn \tl_gtrim_spaces:N #1 + { \tl_gset:Nx #1 { \exp_after:wN \tl_trim_spaces:n \exp_after:wN {#1} } } +\group_begin: + \tex_catcode:D `\Q = 3 \scan_stop: + \cs_new:Npn \tl_trim_spaces_exp:n #1 + { \tex_romannumeral:D - `0 \tl_trim_spaces_aux_i:w \exp_not:N #1 Q ~ Q } + \cs_new:Npn \tl_trim_spaces_aux_i:w #1 ~ Q { \tl_trim_spaces_aux_ii:w #1 Q } + \cs_new:Npn \tl_trim_spaces_aux_ii:w #1 Q #2 {#1} +\group_end: +\cs_generate_variant:Nn \tl_trim_spaces:N { c } +\cs_generate_variant:Nn \tl_gtrim_spaces:N { c } +\cs_new:Npn \tl_head:n #1 { \tl_head:w #1 \q_stop } +\cs_new:Npn \tl_tail:n #1 { \tl_tail:w #1 \q_stop } +\cs_new:Npn \tl_head:w #1#2 \q_stop {#1} +\cs_new:Npn \tl_tail:w #1#2 \q_stop {#2} +\cs_generate_variant:Nn \tl_head:n { V , v , f } +\cs_generate_variant:Nn \tl_tail:n { V , v , f } +\prg_new_conditional:Npnn \tl_if_head_eq_meaning:nN #1#2 { p , T , F , TF } + { + \exp_after:wN \if_meaning:w \tl_head:w #1 \q_stop #2 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\prg_new_conditional:Npnn \tl_if_head_eq_charcode:nN #1#2 { p , T , F , TF } + { + \exp_after:wN \if:w + \exp_after:wN \exp_not:N \tl_head:w #1 \q_stop \exp_not:N #2 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_generate_variant:Nn \tl_if_head_eq_charcode_p:nN { f } +\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNTF { f } +\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNT { f } +\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNF { f } +\prg_new_conditional:Npnn \tl_if_head_eq_catcode:nN #1#2 { p , T , F , TF } + { + \exp_after:wN \if_catcode:w \exp_after:wN \exp_not:N + \tl_head:w #1 \q_stop \exp_not:N #2 + \prg_return_true: \else: \prg_return_false: \fi: + } +\cs_new_protected:Npn \tl_show:N #1 { \cs_show:N #1 } +\cs_generate_variant:Nn \tl_show:N { c } +\cs_new_eq:NN \tl_show:n \etex_showtokens:D +\tl_const:Nx \c_job_name_tl { \tex_jobname:D } +\tl_const:Nn \c_empty_tl { } +\tl_const:Nn \c_space_tl { ~ } +\tl_new:N \g_tmpa_tl +\tl_new:N \g_tmpb_tl +\tl_new:N \l_tmpa_tl +\tl_new:N \l_tmpb_tl +\cs_new:Npn \tl_if_single_item:nTF #1 + { \str_if_eq:onTF { \use_ii:nn #1 {?} ? } {??} } +\cs_new:Npn \tl_if_single_item:nT #1 + { \str_if_eq:onT { \use_ii:nn #1 {?} ? } {??} } +\cs_new:Npn \tl_if_single_item:nF #1 + { \str_if_eq:onF { \use_ii:nn #1 {?} ? } {??} } +\cs_new:Npn \tl_if_single_item_p:n #1 + { \str_if_eq_p:on { \use_ii:nn #1 {?} ? } {??} } +\prg_new_conditional:Npnn \tl_if_head_begin_group:n #1 { p , T , F , TF } + { + \exp_after:wN \use_none:n + \exp_after:wN { + \exp_after:wN { + \token_to_str:N #1 . + } + \prg_return_true: \exp_after:wN \use_none:nn \token_to_str:N + } + \prg_return_false: + } +\prg_new_conditional:Npnn \tl_if_head_eq_space:n #1 { p , T , F , TF } + { + \if_false: { \fi: + \tl_if_head_eq_space_aux:w \prg_do_nothing: #1 ? ~ } + } +\cs_new:Npn \tl_if_head_eq_space_aux:w #1 ~ % + { + \tl_if_empty_return:o { #1 } + \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: + } +\prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF } + { + \tl_if_head_eq_space:nTF {#1} + { + \str_if_eq:nnTF {#1} {~} + \prg_return_true: \prg_return_false: + } + { + \str_if_eq:onTF { \use_none:n #1 ? } {?} + { + \tl_if_head_begin_group:nTF {#1} + \prg_return_false: \prg_return_true: + } + \prg_return_false: + } + } +\cs_new_protected:Npn \tl_new:Nn #1#2 + { + \tl_new:N #1 + \tl_gset:Nn #1 {#2} + } +\cs_generate_variant:Nn \tl_new:Nn { c } +\cs_generate_variant:Nn \tl_new:Nn { Nx } +\cs_new_protected_nopar:Npn \tl_gset:Nc + { \pref_global:D \tl_set:Nc } +\cs_new_protected_nopar:Npn \tl_set:Nc #1#2 + { \tl_set:No #1 { \cs:w #2 \cs_end: } } +\cs_new_eq:NN \tl_replace_in:Nnn \tl_replace_once:Nnn +\cs_new_eq:NN \tl_replace_in:cnn \tl_replace_once:cnn +\cs_new_eq:NN \tl_greplace_in:Nnn \tl_greplace_once:Nnn +\cs_new_eq:NN \tl_greplace_in:cnn \tl_greplace_once:cnn +\cs_new_eq:NN \tl_replace_all_in:Nnn \tl_replace_all:Nnn +\cs_new_eq:NN \tl_replace_all_in:cnn \tl_replace_all:cnn +\cs_new_eq:NN \tl_greplace_all_in:Nnn \tl_greplace_all:Nnn +\cs_new_eq:NN \tl_greplace_all_in:cnn \tl_greplace_all:cnn +\cs_new_eq:NN \tl_remove_in:Nn \tl_remove_once:Nn +\cs_new_eq:NN \tl_remove_in:cn \tl_remove_once:cn +\cs_new_eq:NN \tl_gremove_in:Nn \tl_gremove_once:Nn +\cs_new_eq:NN \tl_gremove_in:cn \tl_gremove_once:cn +\cs_new_eq:NN \tl_remove_all_in:Nn \tl_remove_all:Nn +\cs_new_eq:NN \tl_remove_all_in:cn \tl_remove_all:cn +\cs_new_eq:NN \tl_gremove_all_in:Nn \tl_gremove_all:Nn +\cs_new_eq:NN \tl_gremove_all_in:cn \tl_gremove_all:cn +\cs_new_eq:NN \tl_elt_count:n \tl_length:n +\cs_new_eq:NN \tl_elt_count:V \tl_length:V +\cs_new_eq:NN \tl_elt_count:o \tl_length:o +\cs_new_eq:NN \tl_elt_count:N \tl_length:N +\cs_new_eq:NN \tl_elt_count:c \tl_length:c +\cs_new_eq:NN \tl_head_i:n \tl_head:n +\cs_new_eq:NN \tl_head_i:w \tl_head:w +\cs_new:Npn \tl_head_iii:n #1 { \tl_head_iii:w #1 \q_stop } +\cs_generate_variant:Nn \tl_head_iii:n { f } +\cs_new:Npn \tl_head_iii:w #1#2#3#4 \q_stop {#1#2#3} +%% +%% +%% End of file `l3tl.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3token.sty b/Master/texmf-dist/tex/latex/l3kernel/l3token.sty new file mode 100644 index 00000000000..c4ca0549b2f --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3token.sty @@ -0,0 +1,739 @@ +%% +%% This is file `l3token.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3token.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3token.dtx Copyright (C) 2005-2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3token.dtx 2491 2011-07-02 11:49:37Z joseph $ + {L3 Experimental token manipulation} +%% \begin{function}[EXP,pTF]{\token_if_protected_long_macro:N} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\cs_new_protected_nopar:Npn \char_set_catcode:nn #1#2 + { \tex_catcode:D #1 = \int_eval:w #2 \int_eval_end: } +\cs_new_nopar:Npn \char_value_catcode:n #1 + { \tex_the:D \tex_catcode:D \int_eval:w #1\int_eval_end: } +\cs_new_nopar:Npn \char_show_value_catcode:n #1 + { \tex_showthe:D \tex_catcode:D \int_eval:w #1 \int_eval_end: } +\cs_new_protected_nopar:Npn \char_set_catcode_escape:N #1 + { \char_set_catcode:nn { `#1 } \c_zero } +\cs_new_protected_nopar:Npn \char_set_catcode_group_begin:N #1 + { \char_set_catcode:nn { `#1 } \c_one } +\cs_new_protected_nopar:Npn \char_set_catcode_group_end:N #1 + { \char_set_catcode:nn { `#1 } \c_two } +\cs_new_protected_nopar:Npn \char_set_catcode_math_toggle:N #1 + { \char_set_catcode:nn { `#1 } \c_three } +\cs_new_protected_nopar:Npn \char_set_catcode_alignment:N #1 + { \char_set_catcode:nn { `#1 } \c_four } +\cs_new_protected_nopar:Npn \char_set_catcode_end_line:N #1 + { \char_set_catcode:nn { `#1 } \c_five } +\cs_new_protected_nopar:Npn \char_set_catcode_parameter:N #1 + { \char_set_catcode:nn { `#1 } \c_six } +\cs_new_protected_nopar:Npn \char_set_catcode_math_superscript:N #1 + { \char_set_catcode:nn { `#1 } \c_seven } +\cs_new_protected_nopar:Npn \char_set_catcode_math_subscript:N #1 + { \char_set_catcode:nn { `#1 } \c_eight } +\cs_new_protected_nopar:Npn \char_set_catcode_ignore:N #1 + { \char_set_catcode:nn { `#1 } \c_nine } +\cs_new_protected_nopar:Npn \char_set_catcode_space:N #1 + { \char_set_catcode:nn { `#1 } \c_ten } +\cs_new_protected_nopar:Npn \char_set_catcode_letter:N #1 + { \char_set_catcode:nn { `#1 } \c_eleven } +\cs_new_protected_nopar:Npn \char_set_catcode_other:N #1 + { \char_set_catcode:nn { `#1 } \c_twelve } +\cs_new_protected_nopar:Npn \char_set_catcode_active:N #1 + { \char_set_catcode:nn { `#1 } \c_thirteen } +\cs_new_protected_nopar:Npn \char_set_catcode_comment:N #1 + { \char_set_catcode:nn { `#1 } \c_fourteen } +\cs_new_protected_nopar:Npn \char_set_catcode_invalid:N #1 + { \char_set_catcode:nn { `#1 } \c_fifteen } +\cs_new_protected_nopar:Npn \char_set_catcode_escape:n #1 + { \char_set_catcode:nn {#1} \c_zero } +\cs_new_protected_nopar:Npn \char_set_catcode_group_begin:n #1 + { \char_set_catcode:nn {#1} \c_one } +\cs_new_protected_nopar:Npn \char_set_catcode_group_end:n #1 + { \char_set_catcode:nn {#1} \c_two } +\cs_new_protected_nopar:Npn \char_set_catcode_math_toggle:n #1 + { \char_set_catcode:nn {#1} \c_three } +\cs_new_protected_nopar:Npn \char_set_catcode_alignment:n #1 + { \char_set_catcode:nn {#1} \c_four } +\cs_new_protected_nopar:Npn \char_set_catcode_end_line:n #1 + { \char_set_catcode:nn {#1} \c_five } +\cs_new_protected_nopar:Npn \char_set_catcode_parameter:n #1 + { \char_set_catcode:nn {#1} \c_six } +\cs_new_protected_nopar:Npn \char_set_catcode_math_superscript:n #1 + { \char_set_catcode:nn {#1} \c_seven } +\cs_new_protected_nopar:Npn \char_set_catcode_math_subscript:n #1 + { \char_set_catcode:nn {#1} \c_eight } +\cs_new_protected_nopar:Npn \char_set_catcode_ignore:n #1 + { \char_set_catcode:nn {#1} \c_nine } +\cs_new_protected_nopar:Npn \char_set_catcode_space:n #1 + { \char_set_catcode:nn {#1} \c_ten } +\cs_new_protected_nopar:Npn \char_set_catcode_letter:n #1 + { \char_set_catcode:nn {#1} \c_eleven } +\cs_new_protected_nopar:Npn \char_set_catcode_other:n #1 + { \char_set_catcode:nn {#1} \c_twelve } +\cs_new_protected_nopar:Npn \char_set_catcode_active:n #1 + { \char_set_catcode:nn {#1} \c_thirteen } +\cs_new_protected_nopar:Npn \char_set_catcode_comment:n #1 + { \char_set_catcode:nn {#1} \c_fourteen } +\cs_new_protected_nopar:Npn \char_set_catcode_invalid:n #1 + { \char_set_catcode:nn {#1} \c_fifteen } +\cs_new_protected_nopar:Npn \char_set_mathcode:nn #1#2 + { \tex_mathcode:D #1 = \int_eval:w #2 \int_eval_end: } +\cs_new_nopar:Npn \char_value_mathcode:n #1 + { \tex_the:D \tex_mathcode:D \int_eval:w #1\int_eval_end: } +\cs_new_nopar:Npn \char_show_value_mathcode:n #1 + { \tex_showthe:D \tex_mathcode:D \int_eval:w #1 \int_eval_end: } +\cs_new_protected_nopar:Npn \char_set_lccode:nn #1#2 + { \tex_lccode:D #1 = \int_eval:w #2 \int_eval_end: } +\cs_new_nopar:Npn \char_value_lccode:n #1 + { \tex_the:D \tex_lccode:D \int_eval:w #1\int_eval_end: } +\cs_new_nopar:Npn \char_show_value_lccode:n #1 + { \tex_showthe:D \tex_lccode:D \int_eval:w #1 \int_eval_end: } +\cs_new_protected_nopar:Npn \char_set_uccode:nn #1#2 + { \tex_uccode:D #1 = \int_eval:w #2 \int_eval_end: } +\cs_new_nopar:Npn \char_value_uccode:n #1 + { \tex_the:D \tex_uccode:D \int_eval:w #1\int_eval_end: } +\cs_new_nopar:Npn \char_show_value_uccode:n #1 + { \tex_showthe:D \tex_uccode:D \int_eval:w #1 \int_eval_end: } +\cs_new_protected_nopar:Npn \char_set_sfcode:nn #1#2 + { \tex_sfcode:D #1 = \int_eval:w #2 \int_eval_end: } +\cs_new_nopar:Npn \char_value_sfcode:n #1 + { \tex_the:D \tex_sfcode:D \int_eval:w #1\int_eval_end: } +\cs_new_nopar:Npn \char_show_value_sfcode:n #1 + { \tex_showthe:D \tex_sfcode:D \int_eval:w #1 \int_eval_end: } +\cs_new_protected_nopar:Npn \token_new:Nn #1#2 { \cs_new_eq:NN #1 #2 } +\cs_new_eq:NN \c_group_begin_token { +\cs_new_eq:NN \c_group_end_token } +\group_begin: + \char_set_catcode_math_toggle:N \* + \token_new:Nn \c_math_toggle_token { * } + \char_set_catcode_alignment:N \* + \token_new:Nn \c_alignment_token { * } + \token_new:Nn \c_parameter_token { # } + \token_new:Nn \c_math_superscript_token { ^ } + \char_set_catcode_math_subscript:N \* + \token_new:Nn \c_math_subscript_token { * } + \token_new:Nn \c_space_token { ~ } + \token_new:Nn \c_catcode_letter_token { a } + \token_new:Nn \c_catcode_other_token { 1 } +\group_end: +\group_begin: + \char_set_catcode_active:N \* + \cs_new_nopar:Npn \c_catcode_active_tl { \exp_not:N * } +\group_end: +\prg_new_conditional:Npnn \token_if_group_begin:N #1 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \c_group_begin_token + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \token_if_group_end:N #1 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \c_group_end_token + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \token_if_math_toggle:N #1 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \c_math_toggle_token + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \token_if_alignment:N #1 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \c_alignment_token + \prg_return_true: \else: \prg_return_false: \fi: + } +\group_begin: +\cs_set_eq:NN \c_parameter_token \scan_stop: +\prg_new_conditional:Npnn \token_if_parameter:N #1 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \c_parameter_token + \prg_return_true: \else: \prg_return_false: \fi: + } +\group_end: +\prg_new_conditional:Npnn \token_if_math_superscript:N #1 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \c_math_superscript_token + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \token_if_math_subscript:N #1 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \c_math_subscript_token + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \token_if_space:N #1 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \c_space_token + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \token_if_letter:N #1 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \c_catcode_letter_token + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \token_if_other:N #1 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \c_catcode_other_token + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \token_if_active:N #1 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \c_catcode_active_tl + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \token_if_eq_meaning:NN #1#2 { p , T , F , TF } + { + \if_meaning:w #1 #2 + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \token_if_eq_catcode:NN #1#2 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \exp_not:N #2 + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \token_if_eq_charcode:NN #1#2 { p , T , F , TF } + { + \if_charcode:w \exp_not:N #1 \exp_not:N #2 + \prg_return_true: \else: \prg_return_false: \fi: + } +\group_begin: +\char_set_catcode_other:N \M +\char_set_catcode_other:N \A +\char_set_lccode:nn { `\; } { `\: } +\char_set_lccode:nn { `\T } { `\T } +\char_set_lccode:nn { `\F } { `\F } +\tl_to_lowercase:n + { + \group_end: + \prg_new_conditional:Npnn \token_if_macro:N #1 { p , T , F , TF } + { + \exp_after:wN \token_if_macro_p_aux:w + \token_to_meaning:N #1 MA; \q_stop + } + \cs_new_nopar:Npn \token_if_macro_p_aux:w #1 MA #2 ; #3 \q_stop + { + \if_int_compare:w \pdftex_strcmp:D { #2 } { cro } = \c_zero + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + } +\prg_new_conditional:Npnn \token_if_cs:N #1 { p , T , F , TF } + { + \if_catcode:w \exp_not:N #1 \scan_stop: + \prg_return_true: \else: \prg_return_false: \fi: + } +\prg_new_conditional:Npnn \token_if_expandable:N #1 { p , T , F , TF } + { + \cs_if_exist:NTF #1 + { + \exp_after:wN \if_meaning:w \exp_not:N #1 #1 + \prg_return_false: \else: \prg_return_true: \fi: + } + { \prg_return_false: } + } +\group_begin: + \char_set_lccode:nn { `\T } { `\T } + \char_set_lccode:nn { `\F } { `\F } + \char_set_lccode:nn { `\X } { `\n } + \char_set_lccode:nn { `\Y } { `\t } + \char_set_lccode:nn { `\Z } { `\d } + \char_set_lccode:nn { `\? } { `\\ } + \tl_map_inline:nn { \X \Y \Z \M \C \H \A \R \O \U \S \K \I \P \L \G \P \E } + { \char_set_catcode:nn { `#1 } \c_twelve } +\tl_to_lowercase:n + { + \group_end: + \prg_new_conditional:Npnn \token_if_chardef:N #1 { p , T , F , TF } + { + \exp_after:wN \token_if_chardef_aux:w + \token_to_meaning:N #1 ?CHAR" \q_stop + } + \cs_new_nopar:Npn \token_if_chardef_aux:w #1 ?CHAR" #2 \q_stop + { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \prg_new_conditional:Npnn \token_if_mathchardef:N #1 { p , T , F , TF } + { + \exp_after:wN \token_if_mathchardef_aux:w + \token_to_meaning:N #1 ?MAYHCHAR" \q_stop + } + \cs_new_nopar:Npn \token_if_mathchardef_aux:w #1 ?MAYHCHAR" #2 \q_stop + { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \prg_new_conditional:Npnn \token_if_int_register:N #1 { p , T , F , TF } + { + \if_meaning:w \tex_countdef:D #1 + \prg_return_false: + \else: + \exp_after:wN \token_if_int_register_aux:w + \token_to_meaning:N #1 ?COUXY \q_stop + \fi: + } + \cs_new_nopar:Npn \token_if_int_register_aux:w #1 ?COUXY #2 \q_stop + { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \prg_new_conditional:Npnn \token_if_skip_register:N #1 { p , T , F , TF } + { + \if_meaning:w \tex_skipdef:D #1 + \prg_return_false: + \else: + \exp_after:wN \token_if_skip_register_aux:w + \token_to_meaning:N #1?SKIP\q_stop + \fi: + } + \cs_new_nopar:Npn \token_if_skip_register_aux:w #1 ?SKIP #2 \q_stop + { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \prg_new_conditional:Npnn \token_if_dim_register:N #1 { p , T , F , TF } + { + \if_meaning:w \tex_dimendef:D #1 + \c_false_bool + \else: + \exp_after:wN \token_if_dim_register_aux:w + \token_to_meaning:N #1 ?ZIMEX \q_stop + \fi: + } + \cs_new_nopar:Npn \token_if_dim_register_aux:w #1 ?ZIMEX #2 \q_stop + { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \prg_new_conditional:Npnn \token_if_toks_register:N #1 { p , T , F , TF } + { + \if_meaning:w \tex_toksdef:D #1 + \prg_return_false: + \else: + \exp_after:wN \token_if_toks_register_aux:w + \token_to_meaning:N #1 ?YOKS \q_stop + \fi: + } + \cs_new_nopar:Npn \token_if_toks_register_aux:w #1 ?YOKS #2 \q_stop + { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \prg_new_conditional:Npnn \token_if_protected_macro:N #1 + { p , T , F , TF } + { + \exp_after:wN \token_if_protected_macro_aux:w + \token_to_meaning:N #1 ?PROYECYEZ~MACRO \q_stop + } + \cs_new_nopar:Npn \token_if_protected_macro_aux:w + #1 ?PROYECYEZ~MACRO #2 \q_stop + { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \prg_new_conditional:Npnn \token_if_long_macro:N #1 { p , T , F , TF } + { + \exp_after:wN \token_if_long_macro_aux:w + \token_to_meaning:N #1 ?LOXG~MACRO \q_stop + } + \cs_new_nopar:Npn \token_if_long_macro_aux:w #1 ?LOXG~MACRO #2 \q_stop + { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + \prg_new_conditional:Npnn \token_if_protected_long_macro:N #1 + { p , T , F , TF } + { + \exp_after:wN \token_if_protected_long_macro_aux:w + \token_to_meaning:N #1 ?PROYECYEZ?LOXG~MACRO \q_stop + } + \cs_new_nopar:Npn \token_if_protected_long_macro_aux:w + #1 ?PROYECYEZ?LOXG~MACRO #2 \q_stop + { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } } + } +\tex_chardef:D \c_token_A_int = `A ~ % +\group_begin: +\char_set_catcode_other:N \; +\char_set_lccode:nn { `\; } { `\: } +\char_set_lccode:nn { `\T } { `\T } +\char_set_lccode:nn { `\F } { `\F } +\tl_to_lowercase:n { + \group_end: + \prg_new_conditional:Npnn \token_if_primitive:N #1 { p , T , F , TF } + { + \token_if_macro:NTF #1 + \prg_return_false: + { + \exp_after:wN \token_if_primitive_aux:NNw + \token_to_meaning:N #1 ; ; ; \q_stop #1 + } + } + \cs_new_nopar:Npn \token_if_primitive_aux:NNw #1#2 #3 ; #4 \q_stop + { + \tl_if_empty:oTF { \token_if_primitive_aux_space:w #3 ~ } + { \token_if_primitive_aux_loop:N #3 ; \q_stop } + { \token_if_primitive_aux_nullfont:N } + } +} +\cs_new_nopar:Npn \token_if_primitive_aux_space:w #1 ~ { } +\cs_new:Npn \token_if_primitive_aux_nullfont:N #1 + { + \if_meaning:w \tex_nullfont:D #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new_nopar:Npn \token_if_primitive_aux_loop:N #1 + { + \if_num:w `#1 < \c_token_A_int % + \exp_after:wN \token_if_primitive_auxii:Nw + \exp_after:wN #1 + \else: + \exp_after:wN \token_if_primitive_aux_loop:N + \fi: + } +\cs_new_nopar:Npn \token_if_primitive_auxii:Nw #1 #2 \q_stop + { + \if:w : #1 + \exp_after:wN \token_if_primitive_aux_undefined:N + \else: + \prg_return_false: + \exp_after:wN \use_none:n + \fi: + } +\cs_new:Npn \token_if_primitive_aux_undefined:N #1 + { + \if_cs_exist:N #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new_eq:NN \l_peek_token ? +\cs_new_eq:NN \g_peek_token ? +\cs_new_eq:NN \l_peek_search_token ? +\cs_new_nopar:Npn \l_peek_search_tl { } +\cs_new_nopar:Npn \peek_true:w { } +\cs_new_nopar:Npn \peek_true_aux:w { } +\cs_new_nopar:Npn \peek_false:w { } +\cs_new:Npn \peek_tmp:w { } +\cs_new_protected_nopar:Npn \peek_after:Nw + { \tex_futurelet:D \l_peek_token } +\cs_new_protected_nopar:Npn \peek_gafter:Nw + { \pref_global:D \tex_futurelet:D \g_peek_token } +\cs_new_protected:Npn \peek_true_remove:w + { + \group_align_safe_end: + \tex_afterassignment:D \peek_true_aux:w + \cs_set_eq:NN \peek_tmp:w + } +\cs_new_protected:Npn \peek_token_generic:NNTF #1#2#3#4 + { + \cs_set_eq:NN \l_peek_search_token #2 + \tl_set:Nn \l_peek_search_tl {#2} + \cs_set_nopar:Npx \peek_true:w + { + \exp_not:N \group_align_safe_end: + \exp_not:n {#3} + } + \cs_set_nopar:Npx \peek_false:w + { + \exp_not:N \group_align_safe_end: + \exp_not:n {#4} + } + \group_align_safe_begin: + \peek_after:Nw #1 + } +\cs_new_protected:Npn \peek_token_generic:NNT #1#2#3 + { \peek_token_generic:NNTF #1 #2 {#3} { } } +\cs_new_protected:Npn \peek_token_generic:NNF #1#2#3 + { \peek_token_generic:NNTF #1 #2 { } {#3} } +\cs_new_protected:Npn \peek_token_remove_generic:NNTF #1#2#3#4 + { + \cs_set_eq:NN \l_peek_search_token #2 + \tl_set:Nn \l_peek_search_tl {#2} + \cs_set_eq:NN \peek_true:w \peek_true_remove:w + \cs_set_nopar:Npx \peek_true_aux:w { \exp_not:n {#3} } + \cs_set_nopar:Npx \peek_false:w + { + \exp_not:N \group_align_safe_end: + \exp_not:n {#4} + } + \group_align_safe_begin: + \peek_after:Nw #1 + } +\cs_new_protected:Npn \peek_token_remove_generic:NNT #1#2#3 + { \peek_token_remove_generic:NNTF #1 #2 {#3} { } } +\cs_new_protected:Npn \peek_token_remove_generic:NNF #1#2#3 + { \peek_token_remove_generic:NNTF #1 #2 { } {#3} } +\cs_new_nopar:Npn \peek_execute_branches_catcode: + { + \if_catcode:w + \exp_not:N \l_peek_token \exp_not:N \l_peek_search_token + \exp_after:wN \peek_true:w + \else: + \exp_after:wN \peek_false:w + \fi: + } +\cs_new_nopar:Npn \peek_execute_branches_meaning: + { + \if_meaning:w \l_peek_token \l_peek_search_token + \exp_after:wN \peek_true:w + \else: + \exp_after:wN \peek_false:w + \fi: + } +\cs_new_nopar:Npn \peek_execute_branches_charcode: + { + \bool_if:nTF + { + \token_if_eq_catcode_p:NN \l_peek_token \c_group_begin_token + || \token_if_eq_catcode_p:NN \l_peek_token \c_group_end_token + || \token_if_eq_meaning_p:NN \l_peek_token \c_space_token + } + { \peek_false:w } + { + \exp_after:wN \peek_execute_branches_charcode_aux:NN + \l_peek_search_tl + } + } +\cs_new:Npn \peek_execute_branches_charcode_aux:NN #1#2 + { + \if:w \exp_not:N #1 \exp_not:N #2 + \exp_after:wN \peek_true:w + \else: + \exp_after:wN \peek_false:w + \fi: + #2 + } +\cs_new_protected_nopar:Npn \peek_ignore_spaces_execute_branches: + { + \token_if_eq_meaning:NNTF \l_peek_token \c_space_token + { + \tex_afterassignment:D \peek_ignore_spaces_execute_branches_aux: + \cs_set_eq:NN \peek_tmp:w + } + { \peek_execute_branches: } + } +\cs_new_protected_nopar:Npn \peek_ignore_spaces_execute_branches_aux: + { \peek_after:Nw \peek_ignore_spaces_execute_branches: } +\group_begin: + \cs_set_nopar:Npn \peek_def:nnnn #1#2#3#4 + { + \peek_def_aux:nnnnn {#1} {#2} {#3} {#4} { TF } + \peek_def_aux:nnnnn {#1} {#2} {#3} {#4} { T } + \peek_def_aux:nnnnn {#1} {#2} {#3} {#4} { F } + } + \cs_set_nopar:Npn \peek_def_aux:nnnnn #1#2#3#4#5 + { + \cs_gset_nopar:cpx { #1 #5 } + { + \tl_if_empty:nF {#2} + { \exp_not:n { \cs_set_eq:NN \peek_execute_branches: #2 } } + \exp_not:c { #3 #5 } + \exp_not:n {#4} + } + } + \peek_def:nnnn { peek_catcode:N } + { } + { peek_token_generic:NN } + { \peek_execute_branches_catcode: } + \peek_def:nnnn { peek_catcode_ignore_spaces:N } + { \peek_execute_branches_catcode: } + { peek_token_generic:NN } + { \peek_ignore_spaces_execute_branches: } + \peek_def:nnnn { peek_catcode_remove:N } + { } + { peek_token_remove_generic:NN } + { \peek_execute_branches_catcode: } + \peek_def:nnnn { peek_catcode_remove_ignore_spaces:N } + { \peek_execute_branches_catcode: } + { peek_token_remove_generic:NN } + { \peek_ignore_spaces_execute_branches: } + \peek_def:nnnn { peek_charcode:N } + { } + { peek_token_generic:NN } + { \peek_execute_branches_charcode: } + \peek_def:nnnn { peek_charcode_ignore_spaces:N } + { \peek_execute_branches_charcode: } + { peek_token_generic:NN } + { \peek_ignore_spaces_execute_branches: } + \peek_def:nnnn { peek_charcode_remove:N } + { } + { peek_token_remove_generic:NN } + { \peek_execute_branches_charcode: } + \peek_def:nnnn { peek_charcode_remove_ignore_spaces:N } + { \peek_execute_branches_charcode: } + { peek_token_remove_generic:NN } + { \peek_ignore_spaces_execute_branches: } + \peek_def:nnnn { peek_meaning:N } + { } + { peek_token_generic:NN } + { \peek_execute_branches_meaning: } + \peek_def:nnnn { peek_meaning_ignore_spaces:N } + { \peek_execute_branches_meaning: } + { peek_token_generic:NN } + { \peek_ignore_spaces_execute_branches: } + \peek_def:nnnn { peek_meaning_remove:N } + { } + { peek_token_remove_generic:NN } + { \peek_execute_branches_meaning: } + \peek_def:nnnn { peek_meaning_remove_ignore_spaces:N } + { \peek_execute_branches_meaning: } + { peek_token_remove_generic:NN } + { \peek_ignore_spaces_execute_branches: } +\group_end: +\exp_args:Nno \use:nn + { \cs_new_nopar:Npn \token_get_prefix_arg_replacement_aux:wN #1 } + { \tl_to_str:n { macro : } #2 -> #3 \q_stop #4 } + { #4 {#1} {#2} {#3} } +\cs_new:Npn \token_get_prefix_spec:N #1 + { + \token_if_macro:NTF #1 + { + \exp_after:wN \token_get_prefix_arg_replacement_aux:wN + \token_to_meaning:N #1 \q_stop \use_i:nnn + } + { \scan_stop: } + } +\cs_new:Npn \token_get_arg_spec:N #1 + { + \token_if_macro:NTF #1 + { + \exp_after:wN \token_get_prefix_arg_replacement_aux:wN + \token_to_meaning:N #1 \q_stop \use_ii:nnn + } + { \scan_stop: } + } +\cs_new:Npn \token_get_replacement_spec:N #1 + { + \token_if_macro:NTF #1 + { + \exp_after:wN \token_get_prefix_arg_replacement_aux:wN + \token_to_meaning:N #1 \q_stop \use_iii:nnn + } + { \scan_stop: } + } +\group_begin: + \char_set_catcode_active:N \^^@ + \cs_set:Npn \char_tmp:NN #1#2 + { + \cs_new:Npn #1 ##1 + { + \char_set_catcode_active:n { `##1 } + \group_begin: + \char_set_lccode:nn { `\^^@ } { `##1 } + \tl_to_lowercase:n { \group_end: #2 ^^@ } + } + } + \char_tmp:NN \char_active_set:Npn \cs_set:Npn + \char_tmp:NN \char_active_set:Npx \cs_set:Npx + \char_tmp:NN \char_active_gset:Npn \cs_gset:Npn + \char_tmp:NN \char_active_gset:Npx \cs_gset:Npx + \char_tmp:NN \char_active_set_eq:NN \cs_set_eq:NN + \char_tmp:NN \char_active_gset_eq:NN \cs_gset_eq:NN +\group_end: +\cs_new_eq:NN \char_set_catcode:w \tex_catcode:D +\cs_new_eq:NN \char_set_mathcode:w \tex_mathcode:D +\cs_new_eq:NN \char_set_lccode:w \tex_lccode:D +\cs_new_eq:NN \char_set_uccode:w \tex_uccode:D +\cs_new_eq:NN \char_set_sfcode:w \tex_sfcode:D +\cs_new_nopar:Npn \char_value_catcode:w { \tex_the:D \char_set_catcode:w } +\cs_new_nopar:Npn \char_show_value_catcode:w + { \tex_showthe:D \char_set_catcode:w } +\cs_new_nopar:Npn \char_value_mathcode:w { \tex_the:D \char_set_mathcode:w } +\cs_new_nopar:Npn \char_show_value_mathcode:w + { \tex_showthe:D \char_set_mathcode:w } +\cs_new_nopar:Npn \char_value_lccode:w { \tex_the:D \char_set_lccode:w } +\cs_new_nopar:Npn \char_show_value_lccode:w + { \tex_showthe:D \char_set_lccode:w } +\cs_new_nopar:Npn \char_value_uccode:w { \tex_the:D \char_set_uccode:w } +\cs_new_nopar:Npn \char_show_value_uccode:w + { \tex_showthe:D \char_set_uccode:w } +\cs_new_nopar:Npn \char_value_sfcode:w { \tex_the:D \char_set_sfcode:w } +\cs_new_nopar:Npn \char_show_value_sfcode:w + { \tex_showthe:D \char_set_sfcode:w } +\cs_new_eq:NN \peek_after:NN \peek_after:Nw +\cs_new_eq:NN \peek_gafter:NN \peek_gafter:Nw +\cs_new_eq:NN \c_alignment_tab_token \c_alignment_token +\cs_new_eq:NN \c_math_shift_token \c_math_toggle_token +\cs_new_eq:NN \c_letter_token \c_catcode_letter_token +\cs_new_eq:NN \c_other_char_token \c_catcode_other_token +\cs_new_eq:NN \c_active_char_token \c_catcode_active_tl +\cs_new_eq:NN \char_make_escape:N \char_set_catcode_escape:N +\cs_new_eq:NN \char_make_begin_group:N \char_set_catcode_group_begin:N +\cs_new_eq:NN \char_make_end_group:N \char_set_catcode_group_end:N +\cs_new_eq:NN \char_make_math_shift:N \char_set_catcode_math_toggle:N +\cs_new_eq:NN \char_make_alignment_tab:N \char_set_catcode_alignment:N +\cs_new_eq:NN \char_make_end_line:N \char_set_catcode_end_line:N +\cs_new_eq:NN \char_make_parameter:N \char_set_catcode_parameter:N +\cs_new_eq:NN \char_make_math_superscript:N + \char_set_catcode_math_superscript:N +\cs_new_eq:NN \char_make_math_subscript:N + \char_set_catcode_math_subscript:N +\cs_new_eq:NN \char_make_ignore:N \char_set_catcode_ignore:N +\cs_new_eq:NN \char_make_space:N \char_set_catcode_space:N +\cs_new_eq:NN \char_make_letter:N \char_set_catcode_letter:N +\cs_new_eq:NN \char_make_other:N \char_set_catcode_other:N +\cs_new_eq:NN \char_make_active:N \char_set_catcode_active:N +\cs_new_eq:NN \char_make_comment:N \char_set_catcode_comment:N +\cs_new_eq:NN \char_make_invalid:N \char_set_catcode_invalid:N +\cs_new_eq:NN \char_make_escape:n \char_set_catcode_escape:n +\cs_new_eq:NN \char_make_begin_group:n \char_set_catcode_group_begin:n +\cs_new_eq:NN \char_make_end_group:n \char_set_catcode_group_end:n +\cs_new_eq:NN \char_make_math_shift:n \char_set_catcode_math_toggle:n +\cs_new_eq:NN \char_make_alignment_tab:n \char_set_catcode_alignment:n +\cs_new_eq:NN \char_make_end_line:n \char_set_catcode_end_line:n +\cs_new_eq:NN \char_make_parameter:n \char_set_catcode_parameter:n +\cs_new_eq:NN \char_make_math_superscript:n + \char_set_catcode_math_superscript:n +\cs_new_eq:NN \char_make_math_subscript:n + \char_set_catcode_math_subscript:n +\cs_new_eq:NN \char_make_ignore:n \char_set_catcode_ignore:n +\cs_new_eq:NN \char_make_space:n \char_set_catcode_space:n +\cs_new_eq:NN \char_make_letter:n \char_set_catcode_letter:n +\cs_new_eq:NN \char_make_other:n \char_set_catcode_other:n +\cs_new_eq:NN \char_make_active:n \char_set_catcode_active:n +\cs_new_eq:NN \char_make_comment:n \char_set_catcode_comment:n +\cs_new_eq:NN \char_make_invalid:n \char_set_catcode_invalid:n +\cs_new_eq:NN \token_if_alignment_tab_p:N \token_if_alignment_p:N +\cs_new_eq:NN \token_if_alignment_tab:NT \token_if_alignment:NT +\cs_new_eq:NN \token_if_alignment_tab:NF \token_if_alignment:NF +\cs_new_eq:NN \token_if_alignment_tab:NTF \token_if_alignment:NTF +\cs_new_eq:NN \token_if_math_shift_p:N \token_if_math_toggle_p:N +\cs_new_eq:NN \token_if_math_shift:NT \token_if_math_toggle:NT +\cs_new_eq:NN \token_if_math_shift:NF \token_if_math_toggle:NF +\cs_new_eq:NN \token_if_math_shift:NTF \token_if_math_toggle:NTF +\cs_new_eq:NN \token_if_other_char_p:N \token_if_other_p:N +\cs_new_eq:NN \token_if_other_char:NT \token_if_other:NT +\cs_new_eq:NN \token_if_other_char:NF \token_if_other:NF +\cs_new_eq:NN \token_if_other_char:NTF \token_if_other:NTF +\cs_new_eq:NN \token_if_active_char_p:N \token_if_active_p:N +\cs_new_eq:NN \token_if_active_char:NT \token_if_active:NT +\cs_new_eq:NN \token_if_active_char:NF \token_if_active:NF +\cs_new_eq:NN \token_if_active_char:NTF \token_if_active:NTF +%% +%% +%% End of file `l3token.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3toks.sty b/Master/texmf-dist/tex/latex/l3kernel/l3toks.sty new file mode 100644 index 00000000000..1b1ab880687 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3toks.sty @@ -0,0 +1,163 @@ +%% +%% This is file `l3toks.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3toks.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3toks.dtx Copyright (C) 1990-2011 The LaTeX3 project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3toks.dtx 2478 2011-06-19 21:34:23Z joseph $ + {L3 Experimental token registers} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\package_check_loaded_expl: +\cs_new_protected_nopar:Npn \toks_new:N #1 { + \chk_if_free_cs:N #1 + \newtoks #1 +} +\cs_generate_variant:Nn \toks_new:N {c} +\cs_new_eq:NN \toks_use:N \tex_the:D +\cs_generate_variant:Nn \toks_use:N {c} +\cs_new_eq:NN \toks_set:Nn \prg_do_nothing: +\cs_new_protected:Npn \toks_set:NV #1#2 { + #1 \exp_after:wN { \int_to_roman:w -`0 \exp_eval_register:N #2 } +} +\cs_new_protected:Npn \toks_set:Nv #1#2 { + #1 \exp_after:wN { \int_to_roman:w -`0 \exp_eval_register:c {#2} } +} +\cs_new_protected:Npn \toks_set:No #1#2 { #1 \exp_after:wN {#2} } +\cs_new_protected:Npn \toks_set:Nf #1#2 { + #1 \exp_after:wN { \int_to_roman:w -`0#2 } +} +\cs_generate_variant:Nn \toks_set:Nn {Nx,cn,cV,cv,co,cx,cf} +\cs_new_eq:NN \toks_gset:Nn \pref_global:D +\cs_generate_variant:Nn \toks_gset:Nn {NV,No,Nx,cn,cV,co,cx} +\cs_new_eq:NN \toks_set_eq:NN \prg_do_nothing: +\cs_new_eq:NN \toks_gset_eq:NN \pref_global:D +\cs_generate_variant:Nn \toks_set_eq:NN {Nc,cN,cc} +\cs_generate_variant:Nn \toks_gset_eq:NN {Nc,cN,cc} +\cs_new_protected_nopar:Npn \toks_clear:N #1 { + #1\c_empty_toks +} +\cs_new_protected_nopar:Npn \toks_gclear:N { + \pref_global:D + \toks_clear:N +} +\cs_generate_variant:Nn \toks_clear:N {c} +\cs_generate_variant:Nn \toks_gclear:N {c} +\cs_new_protected_nopar:Npn \toks_use_clear:N #1 { + \exp_last_unbraced:NNV \toks_clear:N #1 #1 +} +\cs_new_protected_nopar:Npn \toks_use_gclear:N { + \pref_global:D + \toks_use_clear:N +} +\cs_generate_variant:Nn \toks_use_clear:N {c} +\cs_generate_variant:Nn \toks_use_gclear:N {c} +\cs_new_eq:NN \toks_show:N \kernel_register_show:N +\cs_generate_variant:Nn \toks_show:N {c} +\cs_new_protected_nopar:Npn \toks_put_left:Nn #1 { + \exp_after:wN \toks_put_left_aux:w \exp_after:wN \q_nil + \toks_use:N #1 \q_stop #1 +} +\cs_generate_variant:Nn \toks_put_left:Nn {NV,No,Nx,cn,co,cV} +\cs_new_protected_nopar:Npn \toks_gput_left:Nn { + \pref_global:D + \toks_put_left:Nn +} +\cs_generate_variant:Nn \toks_gput_left:Nn {NV,No,Nx,cn,cV,co} +\cs_new:Npn \toks_put_left_aux:w #1\q_stop #2#3 { + #2 \exp_after:wN { \use_i:nn {#3} #1 } +} +\cs_new_protected:Npn \toks_put_right:Nn #1#2 { + #1 \exp_after:wN { \toks_use:N #1 #2 } +} +\cs_new_protected_nopar:Npn \toks_gput_right:Nn { + \pref_global:D + \toks_put_right:Nn +} +\cs_new_protected:Npn \toks_put_right:NV #1#2 { + #1 \exp_after:wN \exp_after:wN \exp_after:wN { + \exp_after:wN \toks_use:N \exp_after:wN #1 + \int_to_roman:w -`0 \exp_eval_register:N #2 + } +} +\cs_new_protected:Npn \toks_put_right:No #1#2 { + #1 \exp_after:wN \exp_after:wN \exp_after:wN { + \exp_after:wN \toks_use:N \exp_after:wN #1 #2 + } +} +\cs_generate_variant:Nn \toks_put_right:Nn {Nx,cn,cV,co} +\cs_generate_variant:Nn \toks_gput_right:Nn {NV,No,Nx,cn,cV,co} +\cs_new_protected:Npn \toks_put_right:Nf #1#2 { + #1 \exp_after:wN \exp_after:wN \exp_after:wN { + \exp_after:wN \toks_use:N \exp_after:wN #1 \int_to_roman:w -`0#2 + } +} +\prg_new_conditional:Nnn \toks_if_empty:N {p,TF,T,F} { + \tl_if_empty:VTF #1 {\prg_return_true:} {\prg_return_false:} +} +\cs_generate_variant:Nn \toks_if_empty_p:N {c} +\cs_generate_variant:Nn \toks_if_empty:NTF {c} +\cs_generate_variant:Nn \toks_if_empty:NT {c} +\cs_generate_variant:Nn \toks_if_empty:NF {c} +\prg_new_conditional:Nnn \toks_if_eq:NN {p,TF,T,F} { + \str_if_eq:xxTF {\toks_use:N #1} {\toks_use:N #2} + {\prg_return_true:} {\prg_return_false:} +} +\cs_generate_variant:Nn \toks_if_eq_p:NN {Nc,c,cc} +\cs_generate_variant:Nn \toks_if_eq:NNTF {Nc,c,cc} +\cs_generate_variant:Nn \toks_if_eq:NNT {Nc,c,cc} +\cs_generate_variant:Nn \toks_if_eq:NNF {Nc,c,cc} +\tex_toksdef:D \l_tmpa_toks = 255\scan_stop: +\toks_new:N \l_tmpb_toks +\toks_new:N \l_tmpc_toks +\toks_new:N \g_tmpa_toks +\toks_new:N \g_tmpb_toks +\toks_new:N \g_tmpc_toks +\toks_new:N \c_empty_toks +\toks_new:N \l_tl_replace_toks + +%% +%% +%% End of file `l3toks.sty'. |