diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/expl3/l3basics.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/expl3/l3basics.sty | 1102 |
1 files changed, 647 insertions, 455 deletions
diff --git a/Master/texmf-dist/tex/latex/expl3/l3basics.sty b/Master/texmf-dist/tex/latex/expl3/l3basics.sty index d4e9c2abe9e..4d9e49664c5 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3basics.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3basics.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3basics.dtx Copyright (C) 1990-2006 LaTeX3 project +%% File: l3basics.dtx Copyright (C) 1990-2008 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 @@ -33,7 +33,7 @@ %% %% The development version of the bundle can be found at %% -%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ +%% http://www.latex-project.org/svnroot/experimental/trunk/ %% %% for those people who are interested. %% @@ -48,483 +48,675 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3basics.dtx 702 2007-11-27 14:21:49Z morten $ +\GetIdInfo$Id: l3basics.dtx 1365 2009-05-31 17:26:17Z mittelba $ {L3 Experimental basic definitions} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\tex_let:D \let:NwN \tex_let:D -\let:NwN \if_true: \tex_iftrue:D -\let:NwN \if_false: \tex_iffalse:D -\let:NwN \else: \tex_else:D -\let:NwN \fi: \tex_fi:D -\let:NwN \reverse_if:N \etex_unless:D -\let:NwN \if:w \tex_if:D -\let:NwN \if_charcode:w \tex_if:D -\let:NwN \if_catcode:w \tex_ifcat:D -\let:NwN \if_meaning:NN \tex_ifx:D -\let:NwN \if_token_eq:NN \tex_ifx:D -\let:NwN \if_cs_meaning_eq:NN\tex_ifx:D -\let:NwN \if_mode_math: \tex_ifmmode:D -\let:NwN \if_mode_horizontal:\tex_ifhmode:D -\let:NwN \if_mode_vertical: \tex_ifvmode:D -\let:NwN \if_mode_inner: \tex_ifinner:D -\let:NwN \if_cs_exist:N \etex_ifdefined:D -\let:NwN \if_cs_exist:w \etex_ifcsname:D -\let:NwN \exp_after:NN \tex_expandafter:D -\let:NwN \exp_not:N \tex_noexpand:D -\let:NwN \exp_not:n \etex_unexpanded:D -\let:NwN \io_put_deferred:Nx \tex_write:D -\let:NwN \token_to_meaning:N \tex_meaning:D -\let:NwN \token_to_string:N \tex_string:D -\let:NwN \cs:w \tex_csname:D -\let:NwN \cs_end: \tex_endcsname:D -\let:NwN \cs_meaning:N \tex_meaning:D -\tex_def:D \cs_meaning:c #1{\exp_after:NN\cs_meaning:N\cs:w #1\cs_end:} -\let:NwN \cs_show:N \tex_show:D -\tex_def:D \cs_show:c #1{\exp_after:NN\cs_show:N\cs:w #1\cs_end:} -\let:NwN \scan_stop: \tex_relax:D -\let:NwN \group_begin: \tex_begingroup:D -\let:NwN \group_end: \tex_endgroup:D -\let:NwN \group_execute_after:N \tex_aftergroup:D -\let:NwN \the_internal:D \tex_the:D -\let:NwN \pref_global:D \tex_global:D -\let:NwN \pref_long:D \tex_long:D -\let:NwN \pref_protected:D \etex_protected:D -\let:NwN \def:Npn \tex_def:D -\let:NwN \def:Npx \tex_edef:D -\pref_protected:D \def:Npn \def_long:Npn {\pref_long:D \def:Npn} -\pref_protected:D \def:Npn \def_long:Npx {\pref_long:D \def:Npx} -\pref_protected:D \def:Npn \def_protected:Npn {\pref_protected:D \def:Npn} -\pref_protected:D \def:Npn \def_protected:Npx {\pref_protected:D \def:Npx} -\def_protected:Npn \def_protected_long:Npn { - \pref_protected:D \pref_long:D \def:Npn -} -\def_protected:Npn \def_protected_long:Npx { - \pref_protected:D \pref_long:D \def:Npx -} -\let:NwN \gdef:Npn \tex_gdef:D -\let:NwN \gdef:Npx \tex_xdef:D -\def_protected:Npn \gdef_long:Npn {\pref_long:D \gdef:Npn} -\def_protected:Npn \gdef_long:Npx {\pref_long:D \gdef:Npx} -\def_protected:Npn \gdef_protected:Npn {\pref_protected:D \gdef:Npn} -\def_protected:Npn \gdef_protected:Npx {\pref_protected:D \gdef:Npx} -\def_protected:Npn \gdef_protected_long:Npn { - \pref_protected:D \pref_long:D \gdef:Npn -} -\def_protected:Npn \gdef_protected_long:Npx { - \pref_protected:D \pref_long:D \gdef:Npx -} -\def:Npn \c_true {00} -\def:Npn \c_false {01} -\let:NwN \c_minus_one\m@ne -\tex_chardef:D \c_sixteen = 16\scan_stop: -\def:Npn \io_put_log:x{ - \tex_immediate:D\io_put_deferred:Nx \c_minus_one } -\def:Npn \io_put_term:x{ - \tex_immediate:D\io_put_deferred:Nx \c_sixteen } -\def:Npn\err_latex_bug:x#1{ - \io_put_term:x{This~is~a~LaTeX~bug!~Check~coding!}\tex_errmessage:D{#1}} -\def:Npn \cs_record_meaning:N#1{} -\def_long:Npn \use_none:n #1{} -\def_long:Npn \use_arg_i:n #1{#1} -\def:Npn \chk_new_cs:N #1{ - \if:w \cs_if_free_p:N #1 - \exp_after:NN \use_none:n +\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 \iow_shipout_x:Nn \tex_write: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 +\tex_def:D \cs_meaning:c {\exp_args:Nc\cs_meaning:N} +\cs_set_eq:NwN \cs_show:N \tex_show:D +\tex_def:D \cs_show:c {\exp_args:Nc\cs_show:N} +\tex_def:D \token_to_str:c {\exp_args:Nc\token_to_str:N} +\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 \group_execute_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 +\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: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: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_i_ii:nnn #1#2#3{#1#2} +\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:Npn \exp_args:Nc #1#2{\exp_after:wN#1\cs:w#2\cs_end:} +\cs_set:Npn \prg_return_true: { \exp_after:wN\if_true:\tex_romannumeral:D } +\cs_set:Npn \prg_return_false: {\exp_after:wN\if_false:\tex_romannumeral:D } +\cs_set: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: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: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: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: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: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: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: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:Npn \prg_get_count_aux:nn #1#2 {#1{#2}} +\cs_set:Npn \prg_get_parm_aux:nw #1#2#{#1{#2}} +\cs_set: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: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:Npn \prg_generate_p_form_parm:Nnnnn #1#2#3#4#5{ + \exp_args:Nc #1 {#2_p:#3}#4{#5 \c_zero + \exp_after:wN\c_true_bool\else:\exp_after:wN\c_false_bool\fi: + } +} +\cs_set:Npn \prg_generate_TF_form_parm:Nnnnn #1#2#3#4#5{ + \exp_args:Nc#1 {#2:#3TF}#4{#5 \c_zero + \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn \fi: + } +} +\cs_set:Npn \prg_generate_T_form_parm:Nnnnn #1#2#3#4#5{ + \exp_args:Nc#1 {#2:#3T}#4{#5 \c_zero + \else:\exp_after:wN\use_none:nn\fi:\use:n + } +} +\cs_set:Npn \prg_generate_F_form_parm:Nnnnn #1#2#3#4#5{ + \exp_args:Nc#1 {#2:#3F}#4{#5 \c_zero + \exp_after:wN\use_none:nn\fi:\use:n + } +} +\cs_set: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 + \exp_after:wN\c_true_bool\else:\exp_after:wN\c_false_bool\fi: + } +} +\cs_set:Npn \prg_generate_TF_form_count:Nnnnn #1#2#3#4#5{ + \cs_generate_from_arg_count:cNnn {#2:#3TF} #1 {#4}{#5 \c_zero + \exp_after:wN\use_i:nn\else:\exp_after:wN\use_ii:nn\fi: + } +} +\cs_set:Npn \prg_generate_T_form_count:Nnnnn #1#2#3#4#5{ + \cs_generate_from_arg_count:cNnn {#2:#3T} #1 {#4}{#5 \c_zero + \else:\exp_after:wN\use_none:nn\fi:\use:n + } +} +\cs_set:Npn \prg_generate_F_form_count:Nnnnn #1#2#3#4#5{ + \cs_generate_from_arg_count:cNnn {#2:#3F} #1 {#4}{#5 \c_zero + \exp_after:wN\use_none:nn\fi:\use:n + } +} +\tex_chardef:D \c_true_bool = 1~ +\tex_chardef:D \c_false_bool = 0~ +\cs_set_nopar:Npn \cs_to_str:N { + \if:w \exp_after:wN \cs_str_aux:w\token_to_str:N \a ax\q_nil + \else: + \exp_after:wN \exp_after:wN\exp_after:wN \use_ii:nn + \fi: + \exp_after:wN \use_none:n \token_to_str:N +} +\cs_set:Npn \cs_str_aux:w #1#2#3#4\q_nil{#2#3} +\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 + \tex_romannumeral:D -`\q \cs_to_str:N #1 @a \q_nil #2 +} +\cs_set:Npn \cs_split_function_aux:w #1@#2#3\q_nil#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_nil #4{#1}} +} +\cs_set:Npn \cs_split_function_auxii:w #1@a\q_nil#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,TF,T,F}{ + \if_meaning:w #1\tex_relax:D + \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,TF,T,F}{ + \if_cs_exist:w #1 \cs_end: + \exp_after:wN \use_i:nn \else: - \exp_after:NN \use_arg_i:n + \exp_after:wN \use_ii:nn \fi: { - \err_latex_bug:x {Command~name~`\token_to_string:N #1'~ + \exp_after:wN \if_meaning:w \cs:w #1\cs_end: \tex_relax:D + \prg_return_false: + \else: + \prg_return_true: + \fi: + } + \prg_return_false: +} +\cs_set:Npn \cs_if_do_not_use_p:N #1{ + \cs_split_function:NN #1 \cs_if_do_not_use_aux:nnN +} +\cs_set:Npn \cs_if_do_not_use_aux:nnN #1#2#3{ + \exp_after:wN\str_if_eq_p:nn \token_to_str:N D {#2} +} +\prg_set_conditional:Npnn \cs_if_free:N #1{p,TF,T,F}{ + \tex_ifnum:D \cs_if_exist_p:N #1 =\c_zero + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn + \fi: + { + \tex_ifnum:D \cs_if_do_not_use_p:N #1 =\c_zero + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + \prg_return_false: +} +\cs_set_nopar:Npn \cs_if_free_p:c{\exp_args:Nc\cs_if_free_p:N} +\cs_set_nopar:Npn \cs_if_free:cTF{\exp_args:Nc\cs_if_free:NTF} +\cs_set_nopar:Npn \cs_if_free:cT{\exp_args:Nc\cs_if_free:NT} +\cs_set_nopar:Npn \cs_if_free:cF{\exp_args:Nc\cs_if_free:NF} +\cs_set_eq:NwN \c_minus_one\m@ne +\tex_chardef:D \c_sixteen = 16~ +\tex_chardef:D \c_zero = 0~ +\cs_set_nopar:Npn \iow_log:x { + \tex_immediate:D \iow_shipout_x:Nn \c_minus_one +} +\cs_set_nopar:Npn \iow_term:x { + \tex_immediate:D \iow_shipout_x:Nn \c_sixteen +} +\cs_set_nopar:Npn \msg_kernel_bug:x #1 { + \iow_term:x { This~is~a~LaTeX~bug:~check~coding! } + \tex_errmessage:D {#1} +} +\cs_set:Npn \cs_record_meaning:N #1{} +\cs_set_nopar:Npn \chk_if_free_cs:N #1{ + \cs_if_free:NF #1 + { + \msg_kernel_bug:x {Command~name~`\token_to_str:N #1'~ already~defined!~ Current~meaning:~\token_to_meaning:N #1 } } \cs_record_meaning:N#1 - \io_put_log:x{Defining~\token_to_string:N #1~on~ + \iow_log:x{Defining~\token_to_str:N #1~on~ line~\tex_the:D \tex_inputlineno:D} } -\def:Npn \cs_if_exist_p:N #1{ - \if:w \cs_if_free_p:N #1 - \c_false - \else: - \c_true \fi:} -\def:Npn \chk_if_exist_cs:N #1 { - \if:w \cs_if_exist_p:N #1 - \else: - \err_latex_bug:x{Command~ `\token_to_string:N #1'~ +\cs_set_nopar:Npn \chk_if_exist_cs:N #1 { + \cs_if_exist:NF #1 + { + \msg_kernel_bug:x {Command~ `\token_to_str:N #1'~ not~ yet~ defined!} - \fi:} -\def:Npn \chk_if_exist_cs:c #1 { - \exp_after:NN \chk_if_exist_cs:N \cs:w #1\cs_end: } -\def:Npn \cs_if_free_p:N #1{ - \if_cs_exist:N #1 - \if_meaning:NN#1\scan_stop: - \if:w\cs_if_eq_name_p:NN #1\scan_stop: - \c_false \else: \c_true \fi: - \else: - \c_false - \fi: - \else: - \if:w \cs_if_eq_name_p:NN #1\c_undefined - \c_false \else: \c_true \fi: - \fi: + } } -\let:NwN \cs_free_p:N \cs_if_free_p:N -\def:Npn \str_if_eq_p:nn #1#2{ +\cs_set_nopar:Npn \chk_if_exist_cs:c {\exp_args:Nc \chk_if_exist_cs:N } +\prg_set_conditional:Npnn \str_if_eq:nn #1#2{p}{ \str_if_eq_p_aux:w #1\scan_stop:\\#2\scan_stop:\\ } -\def:Npn \str_if_eq_p_aux:w #1#2\\#3#4\\{ - \if_meaning:NN#1#3 - \if_meaning:NN#1\scan_stop:\c_true \else: - \if_meaning:NN#3\scan_stop:\c_false \else: +\cs_set_nopar:Npn \str_if_eq_p_aux:w #1#2\\#3#4\\{ + \if_meaning:w#1#3 + \if_meaning:w#1\scan_stop:\prg_return_true: \else: + \if_meaning:w#3\scan_stop:\prg_return_false: \else: \str_if_eq_p_aux:w #2\\#4\\\fi:\fi: - \else:\c_false \fi:} -\def_long:Npn \cs_if_eq_name_p:NN #1#2{ - \exp_after:NN\exp_after:NN - \exp_after:NN\str_if_eq_p_aux:w - \exp_after:NN\token_to_string:N - \exp_after:NN#1 - \exp_after:NN\scan_stop: - \exp_after:NN\\ - \token_to_string:N#2\scan_stop:\\} -\def:Npn \str_if_eq_var_p:nf#1{ - \if:w \tex_number:D\str_if_eq_var_start:nnN{}{}#1\scan_stop: -} -\def:Npn\str_if_eq_var_start:nnN#1#2#3{ - \if:w#3\scan_stop:\exp_after:NN\str_if_eq_var_stop:w\fi: + \else:\prg_return_false: \fi:} +\prg_set_conditional:Npnn \cs_if_eq_name:NN #1#2{p}{ + \exp_after:wN\exp_after:wN + \exp_after:wN\str_if_eq_p_aux:w + \exp_after:wN\token_to_str:N + \exp_after:wN#1 + \exp_after:wN\scan_stop: + \exp_after:wN\\ + \token_to_str:N#2\scan_stop:\\} +\prg_set_conditional:Npnn \str_if_eq_var:nf #1#2 {p} { + \if:w \tex_number:D\str_if_eq_var_start:nnN{}{}#1\scan_stop:{#2} +} +\cs_set_nopar:Npn\str_if_eq_var_start:nnN#1#2#3{ + \if:w#3\scan_stop:\exp_after:wN\str_if_eq_var_stop:w\fi: \str_if_eq_var_start:nnN{\if:w#3#1}{#2\fi:} } -\def:Npn\str_if_eq_var_stop:w\str_if_eq_var_start:nnN#1#2#3{ - #1#3\scan_stop:'#213~\c_true\else:\c_false\fi: -} -\def_protected:Npn \def_new:Npn #1{\chk_new_cs:N #1 - \def:Npn #1} -\def_protected:Npn \def_new:Npx #1{\chk_new_cs:N #1 - \def:Npx #1} -\def_protected:Npn \def_long_new:Npn #1{\chk_new_cs:N #1 - \def_long:Npn #1} -\def_protected:Npn \def_long_new:Npx #1{\chk_new_cs:N #1 - \def_long:Npx #1} -\def_protected:Npn \def_protected_new:Npn #1{\chk_new_cs:N #1 - \def_protected:Npn #1} -\def_protected:Npn \def_protected_new:Npx #1{\chk_new_cs:N #1 - \def_protected:Npx #1} -\def_protected:Npn \def_protected_long_new:Npn #1{\chk_new_cs:N #1 - \def_protected_long:Npn #1} -\def_protected:Npn \def_protected_long_new:Npx #1{\chk_new_cs:N #1 - \def_protected_long:Npx #1} -\def_protected_new:Npn \gdef_new:Npn #1{\chk_new_cs:N #1 - \gdef:Npn #1} -\def_protected_new:Npn \gdef_new:Npx #1{\chk_new_cs:N #1 - \gdef:Npx #1} -\def_protected_new:Npn \gdef_long_new:Npn #1{\chk_new_cs:N #1 - \gdef_long:Npn #1} -\def_protected_new:Npn \gdef_long_new:Npx #1{\chk_new_cs:N #1 - \gdef_long:Npx #1} -\def_protected_new:Npn \gdef_protected_new:Npn #1{\chk_new_cs:N #1 - \gdef_protected:Npn #1} -\def_protected_new:Npn \gdef_protected_new:Npx #1{\chk_new_cs:N #1 - \gdef_protected:Npx #1} -\def_protected_new:Npn \gdef_protected_long_new:Npn #1{\chk_new_cs:N #1 - \gdef_protected_long:Npn #1} -\def_protected_new:Npn \gdef_protected_long_new:Npx #1{\chk_new_cs:N #1 - \gdef_protected_long:Npx #1} -\def_new:Npn \def:cpn #1{\exp_after:NN \def:Npn \cs:w #1\cs_end:} -\def_new:Npn \def:cpx #1{\exp_after:NN \def:Npx \cs:w #1\cs_end:} -\def_new:Npn \gdef:cpn #1{\exp_after:NN \gdef:Npn \cs:w #1\cs_end:} -\def_new:Npn \gdef:cpx #1{\exp_after:NN \gdef:Npx \cs:w #1\cs_end:} -\def_new:Npn \def_new:cpn #1{\exp_after:NN \def_new:Npn \cs:w #1\cs_end:} -\def_new:Npn \def_new:cpx #1{\exp_after:NN \def_new:Npx \cs:w #1\cs_end:} -\def_new:Npn \gdef_new:cpn #1{\exp_after:NN \gdef_new:Npn \cs:w #1\cs_end:} -\def_new:Npn \gdef_new:cpx #1{\exp_after:NN \gdef_new:Npx \cs:w #1\cs_end:} -\def_new:Npn \def_long:cpn #1{\exp_after:NN \def_long:Npn \cs:w #1\cs_end:} -\def_new:Npn \def_long:cpx #1{ - \exp_after:NN\def_long:Npx\cs:w #1\cs_end:} -\def_new:Npn \gdef_long:cpn #1{ - \exp_after:NN \gdef_long:Npn \cs:w #1\cs_end:} -\def_new:Npn \gdef_long:cpx #1{ - \exp_after:NN\gdef_long:Npx\cs:w #1\cs_end:} -\def_new:Npn \def_long_new:cpn #1{ - \exp_after:NN \def_long_new:Npn \cs:w #1\cs_end:} -\def_new:Npn \def_long_new:cpx #1{ - \exp_after:NN \def_long_new:Npx \cs:w #1\cs_end:} -\def_new:Npn \gdef_long_new:cpn #1{ - \exp_after:NN \gdef_long_new:Npn \cs:w #1\cs_end:} -\def_new:Npn \gdef_long_new:cpx #1{ - \exp_after:NN \gdef_long_new:Npx \cs:w #1\cs_end:} -\def_new:Npn \def_protected:cpn #1{ - \exp_after:NN \def_protected:Npn \cs:w #1\cs_end:} -\def_new:Npn \def_protected:cpx #1{ - \exp_after:NN\def_protected:Npx\cs:w #1\cs_end:} -\def_new:Npn \gdef_protected:cpn #1{ - \exp_after:NN \gdef_protected:Npn \cs:w #1\cs_end:} -\def_new:Npn \gdef_protected:cpx #1{ - \exp_after:NN\gdef_protected:Npx\cs:w #1\cs_end:} -\def_new:Npn \def_protected_new:cpn #1{ - \exp_after:NN \def_protected_new:Npn \cs:w #1\cs_end:} -\def_new:Npn \def_protected_new:cpx #1{ - \exp_after:NN \def_protected_new:Npx \cs:w #1\cs_end:} -\def_new:Npn \gdef_protected_new:cpn #1{ - \exp_after:NN \gdef_protected_new:Npn \cs:w #1\cs_end:} -\def_new:Npn \gdef_protected_new:cpx #1{ - \exp_after:NN \gdef_protected_new:Npx \cs:w #1\cs_end:} -\def_new:Npn \def_protected_long:cpn #1{ - \exp_after:NN \def_protected_long:Npn \cs:w #1\cs_end:} -\def_new:Npn \def_protected_long:cpx #1{ - \exp_after:NN\def_protected_long:Npx\cs:w #1\cs_end:} -\def_new:Npn \gdef_protected_long:cpn #1{ - \exp_after:NN \gdef_protected_long:Npn \cs:w #1\cs_end:} -\def_new:Npn \gdef_protected_long:cpx #1{ - \exp_after:NN\gdef_protected_long:Npx\cs:w #1\cs_end:} -\def_new:Npn \def_protected_long_new:cpn #1{ - \exp_after:NN \def_protected_long_new:Npn \cs:w #1\cs_end:} -\def_new:Npn \def_protected_long_new:cpx #1{ - \exp_after:NN \def_protected_long_new:Npx \cs:w #1\cs_end:} -\def_new:Npn \gdef_protected_long_new:cpn #1{ - \exp_after:NN \gdef_protected_long_new:Npn \cs:w #1\cs_end:} -\def_new:Npn \gdef_protected_long_new:cpx #1{ - \exp_after:NN \gdef_protected_long_new:Npx \cs:w #1\cs_end:} -\def_new:cpn {def_aux_0:NNn} #1#2 {#1 #2 } -\def_new:cpn {def_aux_1:NNn} #1#2 {#1 #2 ##1 } -\def_new:cpn {def_aux_2:NNn} #1#2 {#1 #2 ##1##2 } -\def_new:cpn {def_aux_3:NNn} #1#2 {#1 #2 ##1##2##3 } -\def_new:cpn {def_aux_4:NNn} #1#2 {#1 #2 ##1##2##3##4 } -\def_new:cpn {def_aux_5:NNn} #1#2 {#1 #2 ##1##2##3##4##5 } -\def_new:cpn {def_aux_6:NNn} #1#2 {#1 #2 ##1##2##3##4##5##6 } -\def_new:cpn {def_aux_7:NNn} #1#2 {#1 #2 ##1##2##3##4##5##6##7 } -\def_new:cpn {def_aux_8:NNn} #1#2 {#1 #2 ##1##2##3##4##5##6##7##8 } -\def_new:cpn {def_aux_9:NNn} #1#2 {#1 #2 ##1##2##3##4##5##6##7##8##9 } -\def_protected_long_new:Npn \def_aux:NNnn #1#2#3#4 { - \cs_if_really_exist:cTF {def_aux_\tex_the:D\etex_numexpr:D #3 :NNn} +\cs_set:Npn\str_if_eq_var_stop:w\str_if_eq_var_start:nnN#1#2#3{ + #1#3\scan_stop:'#213~\prg_return_true:\else:\prg_return_false:\fi: +} +\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_set_nopar:Npn +\cs_tmp:w \cs_new_nopar:Npx\cs_set_nopar:Npx +\cs_tmp:w \cs_new:Npn \cs_set:Npn +\cs_tmp:w \cs_new:Npx\cs_set:Npx +\cs_tmp:w \cs_new_protected_nopar:Npn \cs_set_protected_nopar:Npn +\cs_tmp:w \cs_new_protected_nopar:Npx\cs_set_protected_nopar:Npx +\cs_tmp:w \cs_new_protected:Npn \cs_set_protected:Npn +\cs_tmp:w \cs_new_protected:Npx\cs_set_protected:Npx +\cs_tmp:w \cs_gnew_nopar:Npn \cs_gset_nopar:Npn +\cs_tmp:w \cs_gnew_nopar:Npx \cs_gset_nopar:Npx +\cs_tmp:w \cs_gnew:Npn \cs_gset:Npn +\cs_tmp:w \cs_gnew:Npx \cs_gset:Npx +\cs_tmp:w \cs_gnew_protected_nopar:Npn \cs_gset_protected_nopar:Npn +\cs_tmp:w \cs_gnew_protected_nopar:Npx \cs_gset_protected_nopar:Npx +\cs_tmp:w \cs_gnew_protected:Npn \cs_gset_protected:Npn +\cs_tmp:w \cs_gnew_protected:Npx \cs_gset_protected:Npx +\cs_set:Npn \cs_tmp:w #1#2{ + \cs_new_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_gnew_nopar:cpn \cs_gnew_nopar:Npn +\cs_tmp:w \cs_gnew_nopar:cpx \cs_gnew_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_gnew:cpn \cs_gnew:Npn +\cs_tmp:w \cs_gnew:cpx \cs_gnew: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_gnew_protected_nopar:cpn \cs_gnew_protected_nopar:Npn +\cs_tmp:w \cs_gnew_protected_nopar:cpx \cs_gnew_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_tmp:w \cs_gnew_protected:cpn \cs_gnew_protected:Npn +\cs_tmp:w \cs_gnew_protected:cpx \cs_gnew_protected:Npx +\cs_set_nopar:cpn{use_0_parameter:}{} +\cs_set_nopar:cpn{use_1_parameter:}{{##1}} +\cs_set_nopar:cpn{use_2_parameter:}{{##1}{##2}} +\cs_set_nopar:cpn{use_3_parameter:}{{##1}{##2}{##3}} +\cs_set_nopar:cpn{use_4_parameter:}{{##1}{##2}{##3}{##4}} +\cs_set_nopar:cpn{use_5_parameter:}{{##1}{##2}{##3}{##4}{##5}} +\cs_set_nopar:cpn{use_6_parameter:}{{##1}{##2}{##3}{##4}{##5}{##6}} +\cs_set_nopar:cpn{use_7_parameter:}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}} +\cs_set_nopar:cpn{use_8_parameter:}{ + {##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}} +\cs_set_nopar:cpn{use_9_parameter:}{ + {##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}{##9}} +\cs_set_protected:Npn \cs_set_eq:NN #1 { \cs_set_eq:NwN #1=~ } +\cs_set_nopar:Npn \cs_set_eq:cN { \exp_args:Nc \cs_set_eq:NN } +\cs_set_nopar:Npn \cs_set_eq:Nc { \exp_args:NNc \cs_set_eq:NN } +\cs_set_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 + \cs_set_eq:NN #1 +} +\cs_new_nopar:Npn \cs_new_eq:cN { \exp_args:Nc \cs_new_eq:NN } +\cs_new_nopar:Npn \cs_new_eq:Nc { \exp_args:NNc \cs_new_eq:NN } +\cs_new_nopar:Npn \cs_new_eq:cc { \exp_args:Ncc \cs_new_eq:NN } +\cs_new_protected:Npn \cs_gset_eq:NN { \pref_global:D \cs_set_eq:NN } +\cs_new_nopar:Npn \cs_gset_eq:Nc { \exp_args:NNc \cs_gset_eq:NN } +\cs_new_nopar:Npn \cs_gset_eq:cN { \exp_args:Nc \cs_gset_eq:NN } +\cs_new_nopar:Npn \cs_gset_eq:cc { \exp_args:Ncc \cs_gset_eq:NN } +\cs_new_protected:Npn \cs_gnew_eq:NN #1 { + \chk_if_free_cs:N #1 + \pref_global:D \cs_set_eq:NN #1 +} +\cs_new_nopar:Npn \cs_gnew_eq:cN { \exp_args:Nc \cs_gnew_eq:NN } +\cs_new_nopar:Npn \cs_gnew_eq:Nc { \exp_args:NNc \cs_gnew_eq:NN } +\cs_new_nopar:Npn \cs_gnew_eq:cc { \exp_args:Ncc \cs_gnew_eq:NN } +\cs_new_nopar:Npn \cs_gundefine:N #1{\cs_gset_eq:NN #1\c_undefined:D} +\if_cs_exist:N \xetex_version:D + \cs_new_eq:NN \c_xetex_is_engine_bool \c_true_bool +\else: + \cs_new_eq:NN \c_xetex_is_engine_bool \c_false_bool +\fi: +\prg_new_conditional:Npnn \xetex_if_engine: {TF,T,F} { + \if_bool:N \c_xetex_is_engine_bool + \prg_return_true: \else: \prg_return_false: \fi: +} +\if_cs_exist:N \luatex_directlua:D + \cs_new_eq:NN \c_luatex_is_engine_bool \c_true_bool +\else: + \cs_new_eq:NN \c_luatex_is_engine_bool \c_false_bool +\fi: +\prg_set_conditional:Npnn \xetex_if_engine: {TF,T,F}{ + \if_bool:N \c_xetex_is_engine_bool \prg_return_true: + \else: \prg_return_false: \fi: +} +\prg_set_conditional:Npnn \luatex_if_engine: {TF,T,F}{ + \if_bool:N \c_luatex_is_engine_bool \prg_return_true: + \else: \prg_return_false: \fi: +} +\cs_new_nopar:Npn \prg_do_nothing: {} +\cs_set:Npn \cs_get_arg_count_from_signature:N #1{ + \cs_split_function:NN #1 \cs_get_arg_count_from_signature_aux:nnN +} +\cs_set:Npn \cs_get_arg_count_from_signature_aux:nnN #1#2#3{ + \if_predicate:w #3 % \bool_if:NTF here + \exp_after:wN \use_i:nn + \else: + \exp_after:wN\use_ii:nn + \fi: { - \cs_use:c {def_aux_\tex_the:D\etex_numexpr:D #3 :NNn} #1 #2 {#4} + \exp_after:wN \cs_get_arg_count_from_signature_auxii:w + \use_none:nnnnnnnnn #2 9876543210\q_nil } - { \def_arg_number_error_msg:Nn #2{#3} } -} -\def_new:Npn \def_aux:Ncnn #1#2{ - \exp_after:NN \def_aux:NNnn \exp_after:NN #1 \cs:w #2\cs_end:} -\def_new:Npn \def_arg_number_error_msg:Nn #1#2 { - \err_latex_bug:x{ - You're~ trying~ to~ define~ the~ command~ `\token_to_string:N #1'~ - with~ \use_arg_i:n{\tex_the:D\etex_numexpr:D #2\scan_stop:} ~ - arguments~ but~ I~ only~ allow~ 0-9~ arguments.~ I~ can~ probably~ - not~ help~ you~ here + {-1} +} +\cs_set:Npn \cs_get_arg_count_from_signature_auxii:w #1#2\q_nil{#1} +\cs_set_nopar:Npn \cs_get_arg_count_from_signature:c { + \exp_args:Nc \cs_get_arg_count_from_signature:N +} +\cs_set:Npn \cs_generate_from_arg_count:NNnn #1#2#3#4{ + \tex_ifcase:D \etex_numexpr:D #3\tex_relax:D + \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 % to remove replacement text + } + \fi: + {#4} +} +\cs_set_nopar:Npn \cs_generate_from_arg_count:cNnn { + \exp_args:Nc \cs_generate_from_arg_count:NNnn +} +\cs_set:Npn \cs_generate_from_arg_count_error_msg:Nn #1#2 { + \msg_kernel_bug:x { + You're~ trying~ to~ define~ the~ command~ `\token_to_str:N #1'~ + with~ \use:n{\tex_the:D\etex_numexpr:D #2\tex_relax:D} ~ + arguments~ but~ I~ only~ allow~ 0-9~arguments.~Perhaps~you~ + forgot~to~use~a~colon~in~the~function~name?~ + I~ can~ probably~ not~ help~ you~ here } } -\def:cpn{def_aux_use_0_parameter:}{} -\def:cpn{def_aux_use_1_parameter:}{{##1}} -\def:cpn{def_aux_use_2_parameter:}{{##1}{##2}} -\def:cpn{def_aux_use_3_parameter:}{{##1}{##2}{##3}} -\def:cpn{def_aux_use_4_parameter:}{{##1}{##2}{##3}{##4}} -\def:cpn{def_aux_use_5_parameter:}{{##1}{##2}{##3}{##4}{##5}} -\def:cpn{def_aux_use_6_parameter:}{{##1}{##2}{##3}{##4}{##5}{##6}} -\def:cpn{def_aux_use_7_parameter:}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}} -\def:cpn{def_aux_use_8_parameter:}{ - {##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}} -\def:cpn{def_aux_use_9_parameter:}{ - {##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}{##9}} -\def_new:Npn \def:NNn { \def_aux:NNnn \def:Npn } -\def_new:Npn \def:NNx { \def_aux:NNnn \def:Npx } -\def_new:Npn \def:cNn { \def_aux:Ncnn \def:Npn } -\def_new:Npn \def:cNx { \def_aux:Ncnn \def:Npx } -\def_new:Npn \gdef:NNn { \def_aux:NNnn \gdef:Npn } -\def_new:Npn \gdef:NNx { \def_aux:NNnn \gdef:Npx } -\def_new:Npn \gdef:cNn { \def_aux:Ncnn \gdef:Npn } -\def_new:Npn \gdef:cNx { \def_aux:Ncnn \gdef:Npx } -\def_new:Npn \def_new:NNn { \def_aux:NNnn \def_new:Npn } -\def_new:Npn \def_new:NNx { \def_aux:NNnn \def_new:Npx } -\def_new:Npn \def_new:cNn { \def_aux:Ncnn \def_new:Npn } -\def_new:Npn \def_new:cNx { \def_aux:Ncnn \def_new:Npx } -\def_new:Npn \gdef_new:NNn { \def_aux:NNnn \gdef_new:Npn } -\def_new:Npn \gdef_new:NNx { \def_aux:NNnn \gdef_new:Npx } -\def_new:Npn \gdef_new:cNn { \def_aux:Ncnn \gdef_new:Npn } -\def_new:Npn \gdef_new:cNx { \def_aux:Ncnn \gdef_new:Npx } -\def_new:Npn \def_long:NNn { \def_aux:NNnn \def_long:Npn } -\def_new:Npn \def_long:NNx { \def_aux:NNnn \def_long:Npx } -\def_new:Npn \def_long:cNn { \def_aux:Ncnn \def_long:Npn } -\def_new:Npn \def_long:cNx { \def_aux:Ncnn \def_long:Npx } -\def_new:Npn \gdef_long:NNn { \def_aux:NNnn \gdef_long:Npn } -\def_new:Npn \gdef_long:NNx { \def_aux:NNnn \gdef_long:Npx } -\def_new:Npn \gdef_long:cNn { \def_aux:Ncnn \gdef_long:Npn } -\def_new:Npn \gdef_long:cNx { \def_aux:Ncnn \gdef_long:Npx } -\def_new:Npn \def_long_new:NNn { \def_aux:NNnn \def_long_new:Npn } -\def_new:Npn \def_long_new:NNx { \def_aux:NNnn \def_long_new:Npx } -\def_new:Npn \def_long_new:cNn { \def_aux:Ncnn \def_long_new:Npn } -\def_new:Npn \def_long_new:cNx { \def_aux:Ncnn \def_long_new:Npx } -\def_new:Npn \gdef_long_new:NNn { \def_aux:NNnn \gdef_long_new:Npn } -\def_new:Npn \gdef_long_new:NNx { \def_aux:NNnn \gdef_long_new:Npx } -\def_new:Npn \gdef_long_new:cNn { \def_aux:Ncnn \gdef_long_new:Npn } -\def_new:Npn \gdef_long_new:cNx { \def_aux:Ncnn \gdef_long_new:Npx } -\def_new:Npn \def_protected:NNn { \def_aux:NNnn \def_protected:Npn } -\def_new:Npn \def_protected:NNx { \def_aux:NNnn \def_protected:Npx } -\def_new:Npn \def_protected:cNn { \def_aux:Ncnn \def_protected:Npn } -\def_new:Npn \def_protected:cNx { \def_aux:Ncnn \def_protected:Npx } -\def_new:Npn \gdef_protected:NNn { \def_aux:NNnn \gdef_protected:Npn } -\def_new:Npn \gdef_protected:NNx { \def_aux:NNnn \gdef_protected:Npx } -\def_new:Npn \gdef_protected:cNn { \def_aux:Ncnn \gdef_protected:Npn } -\def_new:Npn \gdef_protected:cNx { \def_aux:Ncnn \gdef_protected:Npx } -\def_new:Npn \def_protected_new:NNn { \def_aux:NNnn \def_protected_new:Npn } -\def_new:Npn \def_protected_new:NNx { \def_aux:NNnn \def_protected_new:Npx } -\def_new:Npn \def_protected_new:cNn { \def_aux:Ncnn \def_protected_new:Npn } -\def_new:Npn \def_protected_new:cNx { \def_aux:Ncnn \def_protected_new:Npx } -\def_new:Npn \gdef_protected_new:NNn { \def_aux:NNnn \gdef_protected_new:Npn } -\def_new:Npn \gdef_protected_new:NNx { \def_aux:NNnn \gdef_protected_new:Npx } -\def_new:Npn \gdef_protected_new:cNn { \def_aux:Ncnn \gdef_protected_new:Npn } -\def_new:Npn \gdef_protected_new:cNx { \def_aux:Ncnn \gdef_protected_new:Npx } -\def_new:Npn \def_protected_long:NNn { \def_aux:NNnn \def_protected_long:Npn } -\def_new:Npn \def_protected_long:NNx { \def_aux:NNnn \def_protected_long:Npx } -\def_new:Npn \def_protected_long:cNn { \def_aux:Ncnn \def_protected_long:Npn } -\def_new:Npn \def_protected_long:cNx { \def_aux:Ncnn \def_protected_long:Npx } -\def_new:Npn \gdef_protected_long:NNn { \def_aux:NNnn \gdef_protected_long:Npn } -\def_new:Npn \gdef_protected_long:NNx { \def_aux:NNnn \gdef_protected_long:Npx } -\def_new:Npn \gdef_protected_long:cNn { \def_aux:Ncnn \gdef_protected_long:Npn } -\def_new:Npn \gdef_protected_long:cNx { \def_aux:Ncnn \gdef_protected_long:Npx } -\def_new:Npn \def_protected_long_new:NNn { - \def_aux:NNnn \def_protected_long_new:Npn } -\def_new:Npn \def_protected_long_new:NNx { - \def_aux:NNnn \def_protected_long_new:Npx } -\def_new:Npn \def_protected_long_new:cNn { - \def_aux:Ncnn \def_protected_long_new:Npn } -\def_new:Npn \def_protected_long_new:cNx { - \def_aux:Ncnn \def_protected_long_new:Npx } -\def_new:Npn \gdef_protected_long_new:NNn { - \def_aux:NNnn \gdef_protected_long_new:Npn } -\def_new:Npn \gdef_protected_long_new:NNx { - \def_aux:NNnn \gdef_protected_long_new:Npx } -\def_new:Npn \gdef_protected_long_new:cNn { - \def_aux:Ncnn \gdef_protected_long_new:Npn } -\def_new:Npn \gdef_protected_long_new:cNx { - \def_aux:Ncnn \gdef_protected_long_new:Npx } -\def_protected_long_new:Npn \let:NN #1{ - \let:NwN #1=~} -\def_new:Npn\let:cN #1 {\exp_after:NN\let:NN\cs:w#1\cs_end:} -\def_new:Npn\let:Nc{\exp_args:NNc\let:NN} -\def_new:Npn\let:cc{\exp_args:Ncc\let:NN} -\def_new:Npn \let_new:NN #1{\chk_new_cs:N #1 - \let:NN #1} -\def_new:Npn \let_new:cN {\exp_args:Nc \let_new:NN} -\def_new:Npn \let_new:Nc {\exp_args:NNc \let_new:NN} -\def_new:Npn \let_new:cc {\exp_args:Ncc \let_new:NN} -\def_protected_new:Npn \glet:NN {\pref_global:D \let:NN} -\def_protected_new:Npn \glet:Nc {\exp_args:NNc \glet:NN} -\def_protected_new:Npn \glet:cN {\exp_args:Nc \glet:NN} -\def_new:Npn \glet:cc {\exp_args:Ncc \glet:NN} -\def_new:Npn \glet_new:NN #1{\chk_new_cs:N #1 - \tex_global:D\let:NN #1} -\def_new:Npn \glet_new:cN {\exp_args:Nc \glet_new:NN} -\def_new:Npn \glet_new:Nc {\exp_args:NNc \glet_new:NN} -\def_new:Npn \glet_new:cc {\exp_args:Ncc \glet_new:NN} -\def_new:Npn \def:No{\exp_args:NNo\def:Npn} -\def_new:Npn \gdef:No {\exp_args:NNo\gdef:Npn} -\def_long_new:Npn \def_test_function_aux:Nnnn #1#2#3#4{ - #1 {#2TF} #3 {#4 - \exp_after:NN\use_arg_i:nn\else:\exp_after:NN\use_arg_ii:nn\fi:} - #1 {#2FT} #3 {#4 - \exp_after:NN\use_arg_ii:nn\else:\exp_after:NN\use_arg_i:nn\fi:} - #1 {#2T} #3 {#4 - \else:\exp_after:NN\use_none:nn\fi:\use_arg_i:n} - #1 {#2F} #3 {#4 - \exp_after:NN\use_none:nn\fi:\use_arg_i:n}} -\def_long_new:Npn \def_test_function_aux:Nnnx #1#2#3#4{ - #1 {#2TF} #3 {#4 - \exp_not:n{\exp_after:NN\use_arg_i:nn\else:\exp_after:NN\use_arg_ii:nn\fi:}} - #1 {#2FT} #3 {#4 - \exp_not:n{\exp_after:NN\use_arg_ii:nn\else:\exp_after:NN\use_arg_i:nn\fi:}} - #1 {#2T} #3 {#4 - \exp_not:n{\else:\exp_after:NN\use_none:nn\fi:\use_arg_i:n}} - #1 {#2F} #3 {#4 - \exp_not:n{\exp_after:NN\use_none:nn\fi:\use_arg_i:n}}} -\def_long_new:Npn \def_test_function:npn #1#2#{ - \def_test_function_aux:Nnnn \def:cpn {#1}{#2} -} -\def_long_new:Npn \def_test_function:npx #1#2#{ - \def_test_function_aux:Nnnx \def:cpx {#1}{#2} -} -\def_long_new:Npn \def_long_test_function:npn #1#2#{ - \def_test_function_aux:Nnnn \def_long:cpn {#1}{#2} -} -\def_long_new:Npn \def_long_test_function:npx #1#2#{ - \def_test_function_aux:Nnnx \def_long:cpx {#1}{#2} -} -\def_long_new:Npn \def_test_function_new:npn #1#2#{ - \def_test_function_aux:Nnnn \def_new:cpn {#1}{#2} -} -\def_long_new:Npn \def_long_test_function_new:npn #1#2#{ - \def_test_function_aux:Nnnn \def_long_new:cpn {#1}{#2} -} -\def_long_new:Npn \def_test_function_new:npx #1#2#{ - \def_test_function_aux:Nnnx \def_new:cpx {#1}{#2} -} -\def_long_new:Npn \def_long_test_function_new:npx #1#2#{ - \def_test_function_aux:Nnnx \def_long_new:cpx {#1}{#2} -} -\def_long_test_function_new:npn {cs_if_free:N}#1{\if:w\cs_if_free_p:N #1} -\let:NN \cs_free:NTF \cs_if_free:NTF -\let:NN \cs_free:NT \cs_if_free:NT -\let:NN \cs_free:NF \cs_if_free:NF -\def_long_test_function_new:npn {cs_if_free:c}#1{ - \exp_after:NN \if_meaning:NN \cs:w#1\cs_end: \scan_stop:} -\let:NN \cs_free:cTF \cs_if_free:cTF -\let:NN \cs_free:cT \cs_if_free:cT -\let:NN \cs_free:cF \cs_if_free:cF -\def_long_test_function_new:npn {cs_if_really_free:c}#1{ - \reverse_if:N\if_cs_exist:w #1\cs_end:} -\let:NN \cs_really_free:cTF \cs_if_really_free:cTF -\let:NN \cs_really_free:cT \cs_if_really_free:cT -\let:NN \cs_really_free:cF \cs_if_really_free:cF -\def_long_test_function_new:npn {cs_if_exist:N}#1{\if:w\cs_if_exist_p:N #1} -\def_long_test_function_new:npn {cs_if_exist:c}#1{ - \exp_after:NN\reverse_if:N - \exp_after:NN \if_meaning:NN \cs:w#1\cs_end: \scan_stop:} -\def_long_test_function_new:npn {cs_if_really_exist:c}#1{ - \if_cs_exist:w #1\cs_end:} -\def_new:Npn \cs_gundefine:N #1{\glet:NN #1\c_undefined} -\def_test_function_new:npn {engine_if_aleph:}{\if_cs_exist:N \aleph_textdir:D} -\def_new:Npn \use:c #1{\cs:w #1\cs_end:} -\def_new:Npn \cs_use:c #1 { \cs:w#1\cs_end: } -\def_new:Npn \use:cc #1#2 - {\cs:w #1\exp_after:NN\cs_end:\cs:w #2\cs_end:} -\def_long_new:Npn \use_arg_i:nn #1#2{#1} -\def_long_new:Npn \use_arg_ii:nn #1#2{#2} -\def_long_new:NNn \use_arg_i:nnn 3{#1} -\def_long_new:NNn \use_arg_ii:nnn 3{#2} -\def_long_new:NNn \use_arg_iii:nnn 3{#3} -\def_long_new:NNn \use_arg_i:nnnn 4{#1} -\def_long_new:NNn \use_arg_ii:nnnn 4{#2} -\def_long_new:NNn \use_arg_iii:nnnn 4{#3} -\def_long_new:NNn \use_arg_iv:nnnn 4{#4} -\def_long_new:NNn\use_arg_i_ii:nn 2{#1#2} -\def_long_new:Npn \use_none_delimit_by_q_nil:w #1\q_nil{} -\def_long_new:Npn \use_none_delimit_by_q_stop:w #1\q_stop{} -\def_long_new:Npn \use_arg_i_delimit_by_q_nil:nw #1#2\q_nil{#1} -\def_long_new:Npn \use_arg_i_delimit_by_q_stop:nw #1#2\q_stop{#1} -\def_long_new:Npn \use_arg_i_after_fi:nw #1\fi:{\fi: #1} -\def_long_new:Npn \use_arg_i_after_else:nw #1\else:#2\fi:{\fi: #1} -\def_long_new:Npn \use_arg_i_after_or:nw #1\or: #2\fi: {\fi:#1} -\def_long_new:Npn \use_arg_i_after_orelse:nw #1 #2#3\fi: {\fi:#1} -\def_long_new:NNn \use_none:nn 2{} -\def_long_new:NNn \use_none:nnn 3{} -\def_long_new:NNn \use_none:nnnn 4{} -\def_long_new:NNn \use_none:nnnnn 5{} -\def_long_new:NNn \use_none:nnnnnn 6{} -\def_long_new:NNn \use_none:nnnnnnn 7{} -\def_long_new:NNn \use_none:nnnnnnnn 8{} -\def_long_new:NNn \use_none:nnnnnnnnn 9{} -\def_new:Npn \gtmp:w {} -\def_new:Npn \tmp:w {} -\def_new:Npn \use_noop: {} -\def_new:Npn \cs_to_str:N {\exp_after:NN\use_none:n \token_to_string:N} -\def_test_function_new:npn {cs_if_eq:NN} #1#2{\if_meaning:NN #1#2} -\def_new:Npn \cs_if_eq:cNTF {\exp_args:Nc \cs_if_eq:NNTF} -\def_new:Npn \cs_if_eq:cNT {\exp_args:Nc \cs_if_eq:NNT} -\def_new:Npn \cs_if_eq:cNF {\exp_args:Nc \cs_if_eq:NNF} -\def_new:Npn \cs_if_eq:NcTF {\exp_args:NNc \cs_if_eq:NNTF} -\def_new:Npn \cs_if_eq:NcT {\exp_args:NNc \cs_if_eq:NNT} -\def_new:Npn \cs_if_eq:NcF {\exp_args:NNc \cs_if_eq:NNF} -\def_new:Npn \cs_if_eq:ccTF {\exp_args:Ncc \cs_if_eq:NNTF} -\def_new:Npn \cs_if_eq:ccT {\exp_args:Ncc \cs_if_eq:NNT} -\def_new:Npn \cs_if_eq:ccF {\exp_args:Ncc \cs_if_eq:NNF} -\def_new:Npn\file_not_found:nTF #1#2#3{\IfFileExists{#1}{#3}{#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_tmp:w {gnew}{Nn}{Npn} +\cs_tmp:w {gnew}{Nx}{Npx} +\cs_tmp:w {gnew_nopar}{Nn}{Npn} +\cs_tmp:w {gnew_nopar}{Nx}{Npx} +\cs_tmp:w {gnew_protected}{Nn}{Npn} +\cs_tmp:w {gnew_protected}{Nx}{Npx} +\cs_tmp:w {gnew_protected_nopar}{Nn}{Npn} +\cs_tmp:w {gnew_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} +\cs_tmp:w {gnew}{cn}{Npn} +\cs_tmp:w {gnew}{cx}{Npx} +\cs_tmp:w {gnew_nopar}{cn}{Npn} +\cs_tmp:w {gnew_nopar}{cx}{Npx} +\cs_tmp:w {gnew_protected}{cn}{Npn} +\cs_tmp:w {gnew_protected}{cx}{Npx} +\cs_tmp:w {gnew_protected_nopar}{cn}{Npn} +\cs_tmp:w {gnew_protected_nopar}{cx}{Npx} +\prg_set_conditional:Npnn \cs_if_eq:NN #1#2{p,TF,T,F}{ + \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\file_not_found:nTF #1#2#3{\IfFileExists{#1}{#3}{#2}} +\cs_set:Npn \prg_set_eq_conditional:NNn #1#2#3 { + \prg_set_eq_conditional_aux:NNNn \cs_set_eq:cc #1#2 {#3} +} +\cs_set: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_set_eq_conditional_aux:NNNn #1#2#3#4 { + \prg_set_eq_conditional_aux:NNNw #1#2#3#4,?,\q_recursion_stop +} +\cs_set: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:#2TF} +\cs_set:Npn \prg_conditional_form_T:nnn #1#2#3 {#1:#2T} +\cs_set:Npn \prg_conditional_form_F:nnn #1#2#3 {#1:#2F} %% %% %% End of file `l3basics.sty'. |