diff options
author | Karl Berry <karl@freefriends.org> | 2009-06-09 23:31:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-06-09 23:31:15 +0000 |
commit | 215b9a864d5829070bdc66ba736986eb72e5143e (patch) | |
tree | fe0882c81fc4ec945cee4b512f72eaa21ea5f791 /Master/texmf-dist/tex | |
parent | df90ec06321940c2f066b05e12f1b5ab099105da (diff) |
expl3 1407 (9jun09)
git-svn-id: svn://tug.org/texlive/trunk@13686 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
29 files changed, 5386 insertions, 3936 deletions
diff --git a/Master/texmf-dist/tex/latex/expl3/expl3.sty b/Master/texmf-dist/tex/latex/expl3/expl3.sty new file mode 100644 index 00000000000..db6b998e867 --- /dev/null +++ b/Master/texmf-dist/tex/latex/expl3/expl3.sty @@ -0,0 +1,84 @@ +%% +%% 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-2009 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 LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: expl3.dtx 1381 2009-06-01 20:36:02Z joseph $ + {L3 Experimental code bundle wrapper}% +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\RequirePackage{ + l3basics, + l3expan, + l3tl, + l3num, + l3intexpr, + l3quark, + l3seq, + l3toks, + l3int, + l3prg, + l3clist, + l3token, + l3io, + l3prop, + l3msg, + l3skip, +} +\RequirePackage{ + l3box, + l3keyval, + l3precom, + l3calc, + l3xref, + l3file +} +%% +%% +%% End of file `expl3.sty'. 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'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3box.sty b/Master/texmf-dist/tex/latex/expl3/l3box.sty index be463eacf81..7f790646251 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3box.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3box.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3box.dtx Copyright (C) 2005-2007 LaTeX3 project +%% File: l3box.dtx Copyright (C) 2005-2009 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,111 +48,125 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3box.dtx 718 2007-12-16 22:59:58Z morten $ +\GetIdInfo$Id: l3box.dtx 1375 2009-06-01 12:28:52Z joseph $ {L3 Experimental Box module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3prg,l3token}\par -\let_new:NN \box_new:N \newbox -\def_new:Npn \box_new:c {\exp_args:Nc \box_new:N} -\let_new:NN \if_hbox:N \tex_ifhbox:D -\let_new:NN \if_vbox:N \tex_ifvbox:D -\let_new:NN \if_box_empty:N \tex_ifvoid:D -\def_new:Npn \box_if_empty_p:N #1{ - \if_box_empty:N #1 \c_true \else: \c_false \fi:} -\def_new:Npn \box_if_empty_p:c {\exp_args:Nc \box_if_empty_p:N} -\def_test_function_new:npn {box_if_empty:N}#1{\if_box_empty:N #1} -\def_new:Npn \box_if_empty:cTF {\exp_args:Nc \box_if_empty:NTF} -\def_new:Npn \box_if_empty:cT {\exp_args:Nc \box_if_empty:NT} -\def_new:Npn \box_if_empty:cF {\exp_args:Nc \box_if_empty:NF} -\def_new:Npn \box_set_eq:NN #1#2 {\tex_setbox:D #1 \tex_box:D #2} -\def_new:Npn \box_set_eq:cN {\exp_args:Nc \box_set_eq:NN} -\def_new:Npn \box_set_eq:Nc {\exp_args:NNc \box_set_eq:NN} -\def_new:Npn \box_set_eq:cc {\exp_args:Ncc \box_set_eq:NN} -\def_new:Npn \box_gset_eq:NN {\pref_global:D\box_set_eq:NN} -\def_new:Npn \box_gset_eq:cN {\exp_args:Nc \box_gset_eq:NN} -\def_new:Npn \box_gset_eq:Nc {\exp_args:NNc \box_gset_eq:NN} -\def_new:Npn \box_gset_eq:cc {\exp_args:Ncc \box_gset_eq:NN} -\let_new:NN \R_last_box \tex_lastbox:D -\def_new:Npn \box_set_to_last:N #1{\tex_setbox:D#1\R_last_box} -\def_new:Npn \box_set_to_last:c {\exp_args:Nc \box_set_to_last:N} -\def_new:Npn \box_gset_to_last:N {\pref_global:D \box_set_to_last:N} -\def_new:Npn \box_gset_to_last:c {\exp_args:Nc \box_gset_to_last:N} -\def_long_new:Npn \box_move_left:nn #1#2{\tex_moveleft:D\dim_eval:n{#1}{#2}} -\def_long_new:Npn \box_move_right:nn #1#2{\tex_moveright:D\dim_eval:n{#1}{#2}} -\def_long_new:Npn \box_move_up:nn #1#2{\tex_raise:D\dim_eval:n{#1}{#2}} -\def_long_new:Npn \box_move_down:nn #1#2{\tex_lower:D\dim_eval:n{#1}{#2}} -\def_new:Npn \box_clear:N #1{\box_set_eq:NN #1 \c_empty_box } -\def_new:Npn \box_clear:c {\exp_args:Nc \box_clear:N } -\def_new:Npn \box_gclear:N {\pref_global:D\box_clear:N} -\def_new:Npn \box_gclear:c {\exp_args:Nc \box_gclear:c } -\let_new:NN \box_ht:N \tex_ht:D -\def_new:Npn \box_ht:c {\exp_args:Nc \box_ht:N} -\let_new:NN \box_dp:N \tex_dp:D -\def_new:Npn \box_dp:c {\exp_args:Nc \box_dp:N} -\let_new:NN \box_wd:N \tex_wd:D -\def_new:Npn \box_wd:c {\exp_args:Nc \box_wd:N} -\let_new:NN \box_use_clear:N \tex_box:D -\def_new:Npn \box_use_clear:c {\exp_args:Nc \box_use_clear:N} -\let_new:NN \box_use:N \tex_copy:D -\def_new:Npn \box_use:c {\exp_args:Nc \box_use:N} -\let:NN \box_show:N \tex_showbox:D -\def_new:Npn \box_show:c {\exp_args:Nc \box_show:N} -\let:NN \c_empty_box \voidb@x -\let_new:NN \l_tmpa_box \@tempboxa +\package_check_loaded_expl: +\cs_new:Npn \box_new:N #1 { + \chk_if_free_cs:N #1 + \newbox #1 +} +\cs_generate_variant:Nn \box_new:N {c} +\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:Nnn \box_if_horizontal:N {p,TF,T,F} { + \tex_ifhbox:D #1 \prg_return_true: \else: \prg_return_false: \fi: +} +\prg_new_conditional:Nnn \box_if_vertical:N {p,TF,T,F} { + \tex_ifvbox:D #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:NTF {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_vertical_p:N {c} +\cs_generate_variant:Nn \box_if_vertical:NTF {c} +\cs_generate_variant:Nn \box_if_vertical:NT {c} +\cs_generate_variant:Nn \box_if_vertical:NF {c} +\prg_new_conditional:Nnn \box_if_empty:N {p,TF,T,F} { + \tex_ifvoid:D #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:NTF {c} +\cs_generate_variant:Nn \box_if_empty:NT {c} +\cs_generate_variant:Nn \box_if_empty:NF {c} +\cs_new_nopar:Npn \box_set_eq:NN #1#2 {\tex_setbox:D #1 \tex_box:D #2} +\cs_generate_variant:Nn \box_set_eq:NN {cN,Nc,cc} +\cs_new_nopar:Npn \box_gset_eq:NN {\pref_global:D\box_set_eq:NN} +\cs_generate_variant:Nn \box_gset_eq:NN {cN,Nc,cc} +\cs_new_eq:NN \l_last_box \tex_lastbox:D +\cs_new_nopar:Npn \box_set_to_last:N #1{\tex_setbox:D#1\l_last_box} +\cs_generate_variant:Nn \box_set_to_last:N {c} +\cs_new_nopar:Npn \box_gset_to_last:N {\pref_global:D \box_set_to_last:N} +\cs_generate_variant:Nn \box_gset_to_last:N {c} +\cs_new:Npn \box_move_left:nn #1#2{\tex_moveleft:D\dim_eval:n{#1}{#2}} +\cs_new:Npn \box_move_right:nn #1#2{\tex_moveright:D\dim_eval:n{#1}{#2}} +\cs_new:Npn \box_move_up:nn #1#2{\tex_raise:D\dim_eval:n{#1}{#2}} +\cs_new:Npn \box_move_down:nn #1#2{\tex_lower:D\dim_eval:n{#1}{#2}} +\cs_new_nopar:Npn \box_clear:N #1{\box_set_eq:NN #1 \c_empty_box } +\cs_generate_variant:Nn \box_clear:N {c} +\cs_new_nopar:Npn \box_gclear:N {\pref_global:D\box_clear:N} +\cs_generate_variant:Nn \box_gclear:N {c} +\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_eq:NN \box_use_clear:N \tex_box:D +\cs_generate_variant:Nn \box_use_clear:N {c} +\cs_new_eq:NN \box_use:N \tex_copy:D +\cs_generate_variant:Nn \box_use:N {c} +\cs_set_eq:NN \box_show:N \tex_showbox:D +\cs_generate_variant:Nn \box_show:N {c} +\cs_set_eq:NN \c_empty_box \voidb@x +\cs_new_eq:NN \l_tmpa_box \@tempboxa \box_new:N \l_tmpb_box -\def_new:Npn \vbox:n {\tex_vbox:D \scan_stop:} -\def_long_new:Npn \vbox_set:Nn #1#2 {\tex_setbox:D #1 \tex_vbox:D {#2}} -\def_new:Npn \vbox_set:cn {\exp_args:Nc \vbox_set:Nn} -\def_new:Npn \vbox_gset:Nn {\pref_global:D \vbox_set:Nn} -\def_new:Npn \vbox_gset:cn {\exp_args:Nc \vbox_gset:Nn} -\def_long_new:Npn \vbox_set_to_ht:Nnn #1#2#3 { - \tex_setbox:D #1 \tex_vbox:D to #2 {#3}} -\def_new:Npn \vbox_set_to_ht:cnn{\exp_args:Nc \vbox_set_to_ht:Nnn } -\def_new:Npn \vbox_gset_to_ht:Nnn {\pref_global:D \vbox_set_to_ht:Nnn } -\def_new:Npn \vbox_gset_to_ht:cnn{\exp_args:Nc \vbox_gset_to_ht:Nnn } -\def_new:Npn \vbox_gset_to_ht:ccn {\exp_args:Ncc \vbox_gset_to_ht:Nnn} -\def_new:Npn \vbox_set_inline_begin:N #1 { +\cs_new_nopar:Npn \vbox:n {\tex_vbox:D \scan_stop:} +\cs_new:Npn \vbox_set:Nn #1#2 {\tex_setbox:D #1 \tex_vbox:D {#2}} +\cs_generate_variant:Nn \vbox_set:Nn {cn} +\cs_new_nopar:Npn \vbox_gset:Nn {\pref_global:D \vbox_set:Nn} +\cs_generate_variant:Nn \vbox_gset:Nn {cn} +\cs_new:Npn \vbox_set_to_ht:Nnn #1#2#3 { + \tex_setbox:D #1 \tex_vbox:D to #2 {#3} +} +\cs_generate_variant:Nn \vbox_set_to_ht:Nnn {cnn} +\cs_new_nopar:Npn \vbox_gset_to_ht:Nnn { \pref_global:D \vbox_set_to_ht:Nnn } +\cs_generate_variant:Nn \vbox_gset_to_ht:Nnn {cnn,ccn} +\cs_new_nopar:Npn \vbox_set_inline_begin:N #1 { \tex_setbox:D #1 \tex_vbox:D \c_group_begin_token } -\let_new:NN \vbox_set_inline_end: \c_group_end_token -\def_new:Npn \vbox_gset_inline_begin:N { +\cs_new_eq:NN \vbox_set_inline_end: \c_group_end_token +\cs_new_nopar:Npn \vbox_gset_inline_begin:N { \pref_global:D \vbox_set_inline_begin:N } -\let_new:NN \vbox_gset_inline_end: \c_group_end_token -\def_long_new:Npn \vbox_to_ht:nn #1#2{\tex_vbox:D to \dim_eval:n{#1}{#2}} -\def_long_new:Npn \vbox_to_zero:n #1 {\tex_vbox:D to \c_zero_dim {#1}} -\def_new:Npn \vbox_set_split_to_ht:NNn #1#2#3{ +\cs_new_eq:NN \vbox_gset_inline_end: \c_group_end_token +\cs_new:Npn \vbox_to_ht:nn #1#2{\tex_vbox:D to \dim_eval:n{#1}{#2}} +\cs_new:Npn \vbox_to_zero:n #1 {\tex_vbox:D to \c_zero_dim {#1}} +\cs_new_nopar:Npn \vbox_set_split_to_ht:NNn #1#2#3{ \tex_setbox:D #1 \tex_vsplit:D #2 to #3 } -\let_new:NN \vbox_unpack:N \tex_unvcopy:D -\def_new:Npn \vbox_unpack:c {\exp_args:Nc \vbox_unpack:N} -\let_new:NN \vbox_unpack_clear:N \tex_unvbox:D -\def_new:Npn \vbox_unpack_clear:c {\exp_args:Nc \vbox_unpack_clear:N} -\def_new:Npn \hbox:n {\tex_hbox:D \scan_stop:} -\def_long_new:Npn \hbox_set:Nn #1#2 {\tex_setbox:D #1 \tex_hbox:D {#2}} -\def_new:Npn \hbox_set:cn {\exp_args:Nc \hbox_set:Nn} -\def_new:Npn \hbox_gset:Nn {\pref_global:D \hbox_set:Nn} -\def_new:Npn \hbox_gset:cn {\exp_args:Nc \hbox_gset:Nn} -\def_long_new:Npn \hbox_set_to_wd:Nnn #1#2#3 { - \tex_setbox:D #1 \tex_hbox:D to \dim_eval:n{#2} {#3}} -\def_new:Npn \hbox_set_to_wd:cnn{\exp_args:Nc \hbox_set_to_wd:Nnn } -\def_new:Npn \hbox_gset_to_wd:Nnn {\pref_global:D \hbox_set_to_wd:Nnn } -\def_new:Npn \hbox_gset_to_wd:cnn{\exp_args:Nc \hbox_gset_to_wd:Nnn } -\def_new:Npn \hbox_set_inline_begin:N #1 { - \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token } -\def:Npn \hbox_set_inline_begin:c {\exp_args:Nc - \hbox_set_inline_begin:N} -\let_new:NN \hbox_set_inline_end: \c_group_end_token -\def_new:Npn \hbox_gset_inline_begin:N { - \pref_global:D \hbox_set_inline_begin:N } -\def:Npn \hbox_gset_inline_begin:c {\exp_args:Nc - \hbox_gset_inline_begin:N } -\let_new:NN \hbox_gset_inline_end: \c_group_end_token -\def_long_new:Npn \hbox_to_wd:nn #1#2 {\tex_hbox:D to #1 {#2}} -\def_long_new:Npn \hbox_to_zero:n #1 {\tex_hbox:D to \c_zero_skip {#1}} -\let_new:NN \hbox_unpack:N \tex_unhcopy:D -\def_new:Npn \hbox_unpack:c {\exp_args:Nc \hbox_unpack:N} -\let_new:NN \hbox_unpack_clear:N \tex_unhbox:D -\def_new:Npn \hbox_unpack_clear:c {\exp_args:Nc \hbox_unpack_clear:N} +\cs_new_eq:NN \vbox_unpack:N \tex_unvcopy:D +\cs_generate_variant:Nn \vbox_unpack:N {c} +\cs_new_eq:NN \vbox_unpack_clear:N \tex_unvbox:D +\cs_generate_variant:Nn \vbox_unpack_clear:N {c} +\cs_new_nopar:Npn \hbox:n {\tex_hbox:D \scan_stop:} +\cs_new:Npn \hbox_set:Nn #1#2 {\tex_setbox:D #1 \tex_hbox:D {#2}} +\cs_generate_variant:Nn \hbox_set:Nn {cn} +\cs_new_nopar:Npn \hbox_gset:Nn {\pref_global:D \hbox_set:Nn} +\cs_generate_variant:Nn \hbox_gset:Nn {cn} +\cs_new:Npn \hbox_set_to_wd:Nnn #1#2#3 { + \tex_setbox:D #1 \tex_hbox:D to \dim_eval:n{#2} {#3} +} +\cs_generate_variant:Nn \hbox_set_to_wd:Nnn {cnn} +\cs_new_nopar:Npn \hbox_gset_to_wd:Nnn {\pref_global:D \hbox_set_to_wd:Nnn } +\cs_generate_variant:Nn \hbox_gset_to_wd:Nnn {cnn} +\cs_new_nopar:Npn \hbox_set_inline_begin:N #1 { + \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token +} +\cs_generate_variant:Nn \hbox_set_inline_begin:N {c} +\cs_new_eq:NN \hbox_set_inline_end: \c_group_end_token +\cs_new_nopar:Npn \hbox_gset_inline_begin:N { + \pref_global:D \hbox_set_inline_begin:N +} +\cs_generate_variant:Nn \hbox_gset_inline_begin:N {c} +\cs_new_eq:NN \hbox_gset_inline_end: \c_group_end_token +\cs_new:Npn \hbox_to_wd:nn #1#2 {\tex_hbox:D to #1 {#2}} +\cs_new:Npn \hbox_to_zero:n #1 {\tex_hbox:D to \c_zero_skip {#1}} +\cs_new_eq:NN \hbox_unpack:N \tex_unhcopy:D +\cs_generate_variant:Nn \hbox_unpack:N {c} +\cs_new_eq:NN \hbox_unpack_clear:N \tex_unhbox:D +\cs_generate_variant:Nn \hbox_unpack_clear:N {c} %% %% %% End of file `l3box.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3calc.sty b/Master/texmf-dist/tex/latex/expl3/l3calc.sty index 6d6239ac0b6..6bdfdcef00c 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3calc.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3calc.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3calc.dtx Copyright (C) 2006 LaTeX3 project +%% File: l3calc.dtx Copyright (C) 2006,2009 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,16 +48,14 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3calc.dtx 621 2007-09-01 20:14:19Z morten $ +\GetIdInfo$Id: l3calc.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental calc module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3int} -\RequirePackage{l3skip} -\RequirePackage{l3box} -\tlp_new:Nn\l_calc_expression_tlp{} -\def_new:Npn \g_calc_A_register{} -\def_new:Npn \l_calc_B_register{} +\package_check_loaded_expl: +\tl_new:Nn\l_calc_expression_tl{} +\cs_new_nopar:Npn \g_calc_A_register{} +\cs_new_nopar:Npn \l_calc_B_register{} \int_new:N \l_calc_current_type_int \int_new:N \g_calc_A_int \int_new:N \l_calc_B_int @@ -71,136 +69,136 @@ \muskip_new:N \g_calc_A_muskip \muskip_new:N \l_calc_B_muskip \muskip_new:N \l_calc_C_muskip -\def_long_new:Npn \calc_assign_generic:NNNNnn#1#2#3#4#5#6{ - \let:NN\g_calc_A_register#2 - \let:NN\l_calc_B_register#3 +\cs_new:Npn \calc_assign_generic:NNNNnn#1#2#3#4#5#6{ + \cs_set_eq:NN\g_calc_A_register#2 + \cs_set_eq:NN\l_calc_B_register#3 \int_set:Nn \l_calc_current_type_int {#1} \group_begin: - \let:NN \real \calc_real:n - \let:NN \ratio\calc_ratio:nn - \tlp_set:Nx\l_calc_expression_tlp{#6} - \exp_after:NN + \cs_set_eq:NN \real \calc_real:n + \cs_set_eq:NN \ratio\calc_ratio:nn + \tl_set:Nx\l_calc_expression_tl{#6} + \exp_after:wN \group_end: - \exp_after:NN\calc_open:w\exp_after:NN(\l_calc_expression_tlp ! + \exp_after:wN\calc_open:w\exp_after:wN(\l_calc_expression_tl ! \pref_global:D\g_calc_A_register\l_calc_B_register \group_end: #4{#5}\l_calc_B_register } -\def_new:Npn\calc_int_set:Nn{ +\cs_new_nopar:Npn\calc_int_set:Nn{ \calc_assign_generic:NNNNnn\c_zero\g_calc_A_int\l_calc_B_int\int_set:Nn } -\def_new:Npn\calc_int_gset:Nn{ +\cs_new_nopar:Npn\calc_int_gset:Nn{ \calc_assign_generic:NNNNnn\c_zero\g_calc_A_int\l_calc_B_int\int_gset:Nn } -\def_new:Npn\calc_int_add:Nn{ +\cs_new_nopar:Npn\calc_int_add:Nn{ \calc_assign_generic:NNNNnn\c_zero\g_calc_A_int\l_calc_B_int\int_add:Nn } -\def_new:Npn\calc_int_gadd:Nn{ +\cs_new_nopar:Npn\calc_int_gadd:Nn{ \calc_assign_generic:NNNNnn\c_zero\g_calc_A_int\l_calc_B_int\int_gadd:Nn } -\def_new:Npn\calc_int_sub:Nn{ +\cs_new_nopar:Npn\calc_int_sub:Nn{ \calc_assign_generic:NNNNnn\c_zero\g_calc_A_int\l_calc_B_int\int_sub:Nn } -\def_new:Npn\calc_int_gsub:Nn{ +\cs_new_nopar:Npn\calc_int_gsub:Nn{ \calc_assign_generic:NNNNnn\c_zero\g_calc_A_int\l_calc_B_int\int_gsub:Nn } -\def_new:Npn\calc_dim_set:Nn{ +\cs_new_nopar:Npn\calc_dim_set:Nn{ \calc_assign_generic:NNNNnn\c_one\g_calc_A_dim\l_calc_B_dim\dim_set:Nn } -\def_new:Npn\calc_dim_gset:Nn{ +\cs_new_nopar:Npn\calc_dim_gset:Nn{ \calc_assign_generic:NNNNnn\c_one\g_calc_A_dim\l_calc_B_dim\dim_gset:Nn } -\def_new:Npn\calc_dim_add:Nn{ +\cs_new_nopar:Npn\calc_dim_add:Nn{ \calc_assign_generic:NNNNnn\c_one\g_calc_A_dim\l_calc_B_dim\dim_add:Nn } -\def_new:Npn\calc_dim_gadd:Nn{ +\cs_new_nopar:Npn\calc_dim_gadd:Nn{ \calc_assign_generic:NNNNnn\c_one\g_calc_A_dim\l_calc_B_dim\dim_gadd:Nn } -\def_new:Npn\calc_dim_sub:Nn{ +\cs_new_nopar:Npn\calc_dim_sub:Nn{ \calc_assign_generic:NNNNnn\c_one\g_calc_A_int\l_calc_B_int\dim_sub:Nn } -\def_new:Npn\calc_dim_gsub:Nn{ +\cs_new_nopar:Npn\calc_dim_gsub:Nn{ \calc_assign_generic:NNNNnn\c_one\g_calc_A_int\l_calc_B_int\dim_gsub:Nn } -\def_new:Npn\calc_skip_set:Nn{ +\cs_new_nopar:Npn\calc_skip_set:Nn{ \calc_assign_generic:NNNNnn\c_two\g_calc_A_skip\l_calc_B_skip\skip_set:Nn } -\def_new:Npn\calc_skip_gset:Nn{ +\cs_new_nopar:Npn\calc_skip_gset:Nn{ \calc_assign_generic:NNNNnn\c_two\g_calc_A_skip\l_calc_B_skip\skip_gset:Nn } -\def_new:Npn\calc_skip_add:Nn{ +\cs_new_nopar:Npn\calc_skip_add:Nn{ \calc_assign_generic:NNNNnn\c_two\g_calc_A_skip\l_calc_B_skip\skip_add:Nn } -\def_new:Npn\calc_skip_gadd:Nn{ +\cs_new_nopar:Npn\calc_skip_gadd:Nn{ \calc_assign_generic:NNNNnn\c_two\g_calc_A_skip\l_calc_B_skip\skip_gadd:Nn } -\def_new:Npn\calc_skip_sub:Nn{ +\cs_new_nopar:Npn\calc_skip_sub:Nn{ \calc_assign_generic:NNNNnn\c_two\g_calc_A_skip\l_calc_B_skip\skip_sub:Nn } -\def_new:Npn\calc_skip_gsub:Nn{ +\cs_new_nopar:Npn\calc_skip_gsub:Nn{ \calc_assign_generic:NNNNnn\c_two\g_calc_A_skip\l_calc_B_skip\skip_gsub:Nn } -\def_new:Npn\calc_muskip_set:Nn{ +\cs_new_nopar:Npn\calc_muskip_set:Nn{ \calc_assign_generic:NNNNnn\c_three\g_calc_A_muskip\l_calc_B_muskip \muskip_set:Nn } -\def_new:Npn\calc_muskip_gset:Nn{ +\cs_new_nopar:Npn\calc_muskip_gset:Nn{ \calc_assign_generic:NNNNnn\c_three\g_calc_A_muskip\l_calc_B_muskip \muskip_gset:Nn } -\def_new:Npn\calc_muskip_add:Nn{ +\cs_new_nopar:Npn\calc_muskip_add:Nn{ \calc_assign_generic:NNNNnn\c_three\g_calc_A_muskip\l_calc_B_muskip \muskip_add:Nn } -\def_new:Npn\calc_muskip_gadd:Nn{ +\cs_new_nopar:Npn\calc_muskip_gadd:Nn{ \calc_assign_generic:NNNNnn\c_three\g_calc_A_muskip\l_calc_B_muskip \muskip_gadd:Nn } -\def_new:Npn\calc_muskip_sub:Nn{ +\cs_new_nopar:Npn\calc_muskip_sub:Nn{ \calc_assign_generic:NNNNnn\c_three\g_calc_A_muskip\l_calc_B_muskip \muskip_add:Nn } -\def_new:Npn\calc_muskip_gsub:Nn{ +\cs_new_nopar:Npn\calc_muskip_gsub:Nn{ \calc_assign_generic:NNNNnn\c_three\g_calc_A_muskip\l_calc_B_muskip \muskip_gadd:Nn } -\def_new:Npn \calc_pre_scan:N #1{ - \if_meaning:NN(#1 - \exp_after:NN\calc_open:w +\cs_new_nopar:Npn \calc_pre_scan:N #1{ + \if_meaning:w(#1 + \exp_after:wN\calc_open:w \else: - \if_meaning:NN \calc_textsize:Nn #1 + \if_meaning:w \calc_textsize:Nn #1 \else: - \if_meaning:NN \calc_maxmin_operation:Nnn #1 + \if_meaning:w \calc_maxmin_operation:Nnn #1 \else: \calc_numeric: \fi: \fi: \fi: #1} -\def_new:Npn \calc_open:w({ +\cs_new_nopar:Npn \calc_open:w({ \group_begin:\group_execute_after:N\calc_init_B: \group_begin:\group_execute_after:N\calc_init_B: \calc_pre_scan:N } -\def_new:Npn\calc_init_B:{\l_calc_B_register\g_calc_A_register} -\def_new:Npn\calc_numeric:{ +\cs_new_nopar:Npn\calc_init_B:{\l_calc_B_register\g_calc_A_register} +\cs_new_nopar:Npn\calc_numeric:{ \tex_afterassignment:D\calc_post_scan:N \pref_global:D\g_calc_A_register } -\def_new:Npn\calc_close:{ +\cs_new_nopar:Npn\calc_close:{ \group_end:\pref_global:D\g_calc_A_register\l_calc_B_register \group_end:\pref_global:D\g_calc_A_register\l_calc_B_register \calc_post_scan:N} -\def_new:Npn\calc_post_scan:N#1{ - \if_meaning:NN#1!\let:NN\calc_next:w\group_end: \else: - \if_meaning:NN#1+\let:NN\calc_next:w\calc_add: \else: - \if_meaning:NN#1-\let:NN\calc_next:w\calc_subtract: \else: - \if_meaning:NN#1*\let:NN\calc_next:w\calc_multiply:N \else: - \if_meaning:NN#1/\let:NN\calc_next:w\calc_divide:N \else: - \if_meaning:NN#1)\let:NN\calc_next:w\calc_close: \else: - \if_meaning:NN#1\scan_stop:\let:NN\calc_next:w\calc_post_scan:N +\cs_new_nopar:Npn\calc_post_scan:N#1{ + \if_meaning:w#1!\cs_set_eq:NN\calc_next:w\group_end: \else: + \if_meaning:w#1+\cs_set_eq:NN\calc_next:w\calc_add: \else: + \if_meaning:w#1-\cs_set_eq:NN\calc_next:w\calc_subtract: \else: + \if_meaning:w#1*\cs_set_eq:NN\calc_next:w\calc_multiply:N \else: + \if_meaning:w#1/\cs_set_eq:NN\calc_next:w\calc_divide:N \else: + \if_meaning:w#1)\cs_set_eq:NN\calc_next:w\calc_close: \else: + \if_meaning:w#1\scan_stop:\cs_set_eq:NN\calc_next:w\calc_post_scan:N \else: - \let:NN \calc_next:w \use_noop: + \cs_set_eq:NN \calc_next:w \prg_do_nothing: \calc_error:N#1 \fi: \fi: @@ -210,48 +208,48 @@ \fi: \fi: \calc_next:w} -\def_new:Npn \calc_multiply:N #1{ - \if_meaning:NN \calc_maxmin_operation:Nnn #1 - \let:NN \calc_next:w \calc_maxmin_multiply: +\cs_new_nopar:Npn \calc_multiply:N #1{ + \if_meaning:w \calc_maxmin_operation:Nnn #1 + \cs_set_eq:NN \calc_next:w \calc_maxmin_multiply: \else: - \if_meaning:NN \calc_ratio_multiply:nn #1 - \let:NN \calc_next:w \calc_ratio_multiply:nn + \if_meaning:w \calc_ratio_multiply:nn #1 + \cs_set_eq:NN \calc_next:w \calc_ratio_multiply:nn \else: - \if_meaning:NN \calc_real_evaluate:nn #1 - \let:NN \calc_next:w \calc_real_multiply:n + \if_meaning:w \calc_real_evaluate:nn #1 + \cs_set_eq:NN \calc_next:w \calc_real_multiply:n \else: - \def:Npn \calc_next:w{\calc_multiply: #1} + \cs_set_nopar:Npn \calc_next:w{\calc_multiply: #1} \fi: \fi: \fi: \calc_next:w } -\def_new:Npn \calc_divide:N #1{ - \if_meaning:NN \calc_maxmin_operation:Nnn #1 - \let:NN \calc_next:w \calc_maxmin_divide: +\cs_new_nopar:Npn \calc_divide:N #1{ + \if_meaning:w \calc_maxmin_operation:Nnn #1 + \cs_set_eq:NN \calc_next:w \calc_maxmin_divide: \else: - \if_meaning:NN \calc_ratio_multiply:nn #1 - \let:NN \calc_next:w \calc_ratio_divide:nn + \if_meaning:w \calc_ratio_multiply:nn #1 + \cs_set_eq:NN \calc_next:w \calc_ratio_divide:nn \else: - \if_meaning:NN \calc_real_evaluate:nn #1 - \let:NN \calc_next:w \calc_real_divide:n + \if_meaning:w \calc_real_evaluate:nn #1 + \cs_set_eq:NN \calc_next:w \calc_real_divide:n \else: - \def:Npn \calc_next:w{\calc_divide: #1} + \cs_set_nopar:Npn \calc_next:w{\calc_divide: #1} \fi: \fi: \fi: \calc_next:w } -\def_new:Npn\calc_generic_add_or_subtract:N#1{ +\cs_new_nopar:Npn\calc_generic_add_or_subtract:N#1{ \group_end: \pref_global:D\g_calc_A_register\l_calc_B_register\group_end: \group_begin:\group_execute_after:N#1\group_begin: \group_execute_after:N\calc_init_B: \calc_pre_scan:N} -\def_new:Npn\calc_add:{\calc_generic_add_or_subtract:N\calc_add_A_to_B:} -\def_new:Npn\calc_subtract:{ +\cs_new_nopar:Npn\calc_add:{\calc_generic_add_or_subtract:N\calc_add_A_to_B:} +\cs_new_nopar:Npn\calc_subtract:{ \calc_generic_add_or_subtract:N\calc_subtract_A_from_B:} -\def_new:Npn\calc_add_A_to_B:{ +\cs_new_nopar:Npn\calc_add_A_to_B:{ \l_calc_B_register \if_case:w\l_calc_current_type_int \etex_numexpr:D\or: @@ -260,7 +258,7 @@ \etex_muexpr:D\fi: \l_calc_B_register + \g_calc_A_register\scan_stop: } -\def_new:Npn\calc_subtract_A_from_B:{ +\cs_new_nopar:Npn\calc_subtract_A_from_B:{ \l_calc_B_register \if_case:w\l_calc_current_type_int \etex_numexpr:D\or: @@ -269,15 +267,15 @@ \etex_muexpr:D\fi: \l_calc_B_register - \g_calc_A_register\scan_stop: } -\def_new:Npn\calc_generic_multiply_or_divide:N#1{ +\cs_new_nopar:Npn\calc_generic_multiply_or_divide:N#1{ \group_end: \group_begin: - \let:NN\g_calc_A_register\g_calc_A_int - \let:NN\l_calc_B_register\l_calc_B_int + \cs_set_eq:NN\g_calc_A_register\g_calc_A_int + \cs_set_eq:NN\l_calc_B_register\l_calc_B_int \int_zero:N \l_calc_current_type_int \group_execute_after:N#1\calc_pre_scan:N } -\def_new:Npn\calc_multiply_B_by_A:{ +\cs_new_nopar:Npn\calc_multiply_B_by_A:{ \l_calc_B_register \if_case:w\l_calc_current_type_int \etex_numexpr:D\or: @@ -286,7 +284,7 @@ \etex_muexpr:D\fi: \l_calc_B_register*\g_calc_A_int\scan_stop: } -\def_new:Npn\calc_divide_B_by_A:{ +\cs_new_nopar:Npn\calc_divide_B_by_A:{ \l_calc_B_register \if_case:w\l_calc_current_type_int \etex_numexpr:D\or: @@ -295,34 +293,34 @@ \etex_muexpr:D\fi: \l_calc_B_register/\g_calc_A_int\scan_stop: } -\def_new:Npn\calc_multiply:{ +\cs_new_nopar:Npn\calc_multiply:{ \calc_generic_multiply_or_divide:N\calc_multiply_B_by_A:} -\def_new:Npn\calc_divide:{ +\cs_new_nopar:Npn\calc_divide:{ \calc_generic_multiply_or_divide:N\calc_divide_B_by_A:} -\def_long_new:Npn \calc_calculate_box_size:nnn #1#2#3{ +\cs_new:Npn \calc_calculate_box_size:nnn #1#2#3{ \hbox_set:Nn \l_tmpa_box {{#3}} - #2{\c_zero_dim \tlist_map_function:nN{#1}\calc_calculate_box_size_aux:n} + #2{\c_zero_dim \tl_map_function:nN{#1}\calc_calculate_box_size_aux:n} } -\def:Npn \calc_calculate_box_size_aux:n#1{ + #1\l_tmpa_box} -\def_protected_long:Npn \calc_textsize:Nn#1#2{ +\cs_set_nopar:Npn \calc_calculate_box_size_aux:n#1{ + #1\l_tmpa_box} +\cs_set_protected:Npn \calc_textsize:Nn#1#2{ \group_begin: - \let:NN\calc_widthof_aux:n\box_wd:N - \let:NN\calc_heightof_aux:n\box_ht:N - \let:NN\calc_depthof_aux:n\box_dp:N - \def:Npn\calc_totalheightof_aux:n{\box_ht:N\box_dp:N} + \cs_set_eq:NN\calc_widthof_aux:n\box_wd:N + \cs_set_eq:NN\calc_heightof_aux:n\box_ht:N + \cs_set_eq:NN\calc_depthof_aux:n\box_dp:N + \cs_set_nopar:Npn\calc_totalheightof_aux:n{\box_ht:N\box_dp:N} \exp_args:No\calc_calculate_box_size:nnn{#1} {\dim_gset:Nn\g_calc_A_register} { - \let:NN \calc_depthof_aux:n \calc_depthof_auxi:n - \let:NN \calc_widthof_aux:n \calc_widthof_auxi:n - \let:NN \calc_heightof_aux:n \calc_heightof_auxi:n - \let:NN \calc_totalheightof_aux:n \calc_totalheightof_auxi:n + \cs_set_eq:NN \calc_depthof_aux:n \calc_depthof_auxi:n + \cs_set_eq:NN \calc_widthof_aux:n \calc_widthof_auxi:n + \cs_set_eq:NN \calc_heightof_aux:n \calc_heightof_auxi:n + \cs_set_eq:NN \calc_totalheightof_aux:n \calc_totalheightof_auxi:n #2 } \group_end: \calc_post_scan:N } -\def_protected_long:Npn\calc_ratio_multiply:nn#1#2{ +\cs_set_protected:Npn\calc_ratio_multiply:nn#1#2{ \group_end:\group_begin: \if_num:w\l_calc_current_type_int < \c_three \calc_dim_set:Nn\l_calc_B_int{#1} @@ -331,7 +329,7 @@ \calc_dim_muskip:Nn{\l_calc_B_int\etex_mutoglue:D}{#1} \calc_dim_muskip:Nn{\l_calc_C_int\etex_mutoglue:D}{#2} \fi: - \gdef:Npx\calc_calculated_ratio:{ + \cs_gset_nopar:Npx\calc_calculated_ratio:{ \int_use:N\l_calc_B_int/\int_use:N\l_calc_C_int } \group_end: @@ -344,8 +342,8 @@ \l_calc_B_register*\calc_calculated_ratio:\scan_stop: \group_begin: \calc_post_scan:N} -\def_long_new:Npn \calc_ratio_divide:nn#1#2{\calc_ratio_multiply:nn{#2}{#1}} -\def_protected_new:Npn\calc_real_evaluate:nn #1#2{ +\cs_new:Npn \calc_ratio_divide:nn#1#2{\calc_ratio_multiply:nn{#2}{#1}} +\cs_new_protected_nopar:Npn\calc_real_evaluate:nn #1#2{ \group_end: \l_calc_B_register \if_case:w\l_calc_current_type_int @@ -359,15 +357,15 @@ \scan_stop: \group_begin: \calc_post_scan:N} -\def_new:Npn \calc_real_multiply:n #1{\calc_real_evaluate:nn{#1}{1}} -\def_new:Npn \calc_real_divide:n {\calc_real_evaluate:nn{1}} -\def_protected_long:Npn\calc_maxmin_operation:Nnn#1#2#3{ +\cs_new_nopar:Npn \calc_real_multiply:n #1{\calc_real_evaluate:nn{#1}{1}} +\cs_new_nopar:Npn \calc_real_divide:n {\calc_real_evaluate:nn{1}} +\cs_set_protected:Npn\calc_maxmin_operation:Nnn#1#2#3{ \group_begin: \calc_maxmin_generic:Nnn#1{#2}{#3} \group_end: \calc_post_scan:N } -\def_protected_long_new:Npn \calc_maxmin_generic:Nnn#1#2#3{ +\cs_new_protected:Npn \calc_maxmin_generic:Nnn#1#2#3{ \group_begin: \if_case:w\l_calc_current_type_int \calc_int_set:Nn\l_calc_C_int{#2}% @@ -396,7 +394,7 @@ \fi: \group_end: } -\def_long_new:Npn\calc_maxmin_div_or_mul:NNnn#1#2#3#4{ +\cs_new:Npn\calc_maxmin_div_or_mul:NNnn#1#2#3#4{ \group_end: \group_begin: \int_zero:N\l_calc_current_type_int @@ -406,99 +404,99 @@ \group_begin: \calc_post_scan:N } -\def_new:Npn\calc_maxmin_multiply:{ +\cs_new_nopar:Npn\calc_maxmin_multiply:{ \calc_maxmin_div_or_mul:NNnn\calc_multiply_B_by_A:} -\def_new:Npn\calc_maxmin_divide: { +\cs_new_nopar:Npn\calc_maxmin_divide: { \calc_maxmin_div_or_mul:NNnn\calc_divide_B_by_A:} -\def_new:Npn\calc_error:N#1{ +\cs_new_nopar:Npn\calc_error:N#1{ \PackageError{calc} - {`\token_to_string:N#1'~ invalid~ at~ this~ point} + {`\token_to_str:N#1'~ invalid~ at~ this~ point} {I~ expected~ to~ see~ one~ of:~ +~ -~ *~ /~ )} } -\def_long_new:Npn \calc_maxof:nn#1#2{ +\cs_new:Npn \calc_maxof:nn#1#2{ \calc_maxmin_operation:Nnn > \exp_not:n{{#1}{#2}} } -\def_long_new:Npn \calc_minof:nn#1#2{ +\cs_new:Npn \calc_minof:nn#1#2{ \calc_maxmin_operation:Nnn < \exp_not:n{{#1}{#2}} } -\let:NN \maxof \calc_maxof:nn -\let:NN \minof \calc_minof:nn -\def_long_new:Npn \calc_widthof:n#1{ +\cs_set_eq:NN \maxof \calc_maxof:nn +\cs_set_eq:NN \minof \calc_minof:nn +\cs_new:Npn \calc_widthof:n#1{ \calc_textsize:Nn \exp_not:N\calc_widthof_aux:n\exp_not:n{{#1}} } -\def_long_new:Npn \calc_heightof:n#1{ +\cs_new:Npn \calc_heightof:n#1{ \calc_textsize:Nn \exp_not:N\calc_heightof_aux:n\exp_not:n{{#1}} } -\def_long_new:Npn \calc_depthof:n#1{ +\cs_new:Npn \calc_depthof:n#1{ \calc_textsize:Nn \exp_not:N\calc_depthof_aux:n\exp_not:n{{#1}} } -\def_long_new:Npn \calc_totalheightof:n#1{ +\cs_new:Npn \calc_totalheightof:n#1{ \calc_textsize:Nn \exp_not:N\calc_totalheightof_aux:n \exp_not:n{{#1}} } -\def_long_new:Npn \calc_widthof_aux:n #1{ +\cs_new:Npn \calc_widthof_aux:n #1{ \exp_not:N\calc_widthof_aux:n\exp_not:n{{#1}} } -\let_new:NN \calc_widthof_auxi:n \calc_widthof_aux:n -\def_long_new:Npn \calc_depthof_aux:n #1{ +\cs_new_eq:NN \calc_widthof_auxi:n \calc_widthof_aux:n +\cs_new:Npn \calc_depthof_aux:n #1{ \exp_not:N\calc_depthof_aux:n\exp_not:n{{#1}} } -\let_new:NN \calc_depthof_auxi:n \calc_depthof_aux:n -\def_long_new:Npn \calc_heightof_aux:n #1{ +\cs_new_eq:NN \calc_depthof_auxi:n \calc_depthof_aux:n +\cs_new:Npn \calc_heightof_aux:n #1{ \exp_not:N\calc_heightof_aux:n\exp_not:n{{#1}} } -\let_new:NN \calc_heightof_auxi:n \calc_heightof_aux:n -\def_long_new:Npn \calc_totalheightof_aux:n #1{ +\cs_new_eq:NN \calc_heightof_auxi:n \calc_heightof_aux:n +\cs_new:Npn \calc_totalheightof_aux:n #1{ \exp_not:N\calc_totalheightof_aux:n\exp_not:n{{#1}} } -\let_new:NN \calc_totalheightof_auxi:n \calc_totalheightof_aux:n -\def_long_new:Npn \calc_ratio:nn#1#2{ +\cs_new_eq:NN \calc_totalheightof_auxi:n \calc_totalheightof_aux:n +\cs_new:Npn \calc_ratio:nn#1#2{ \calc_ratio_multiply:nn\exp_not:n{{#1}{#2}}} -\def_new:Npn \calc_real:n {\calc_real_evaluate:nn} -\let:NN \depthof\calc_depthof:n -\let:NN \widthof\calc_widthof:n -\let:NN \heightof\calc_heightof:n -\let:NN \totalheightof\calc_totalheightof:n -%%\let:NN \ratio\calc_ratio:nn -%%\let:NN \real\calc_real:n -\def_protected:Npn \setlength{\calc_skip_set:Nn} -\def_protected:Npn \gsetlength{\calc_skip_gset:Nn} -\def_protected:Npn \addtolength{\calc_skip_add:Nn} -\def_protected:Npn \gaddtolength{\calc_skip_gadd:Nn} +\cs_new_nopar:Npn \calc_real:n {\calc_real_evaluate:nn} +\cs_set_eq:NN \depthof\calc_depthof:n +\cs_set_eq:NN \widthof\calc_widthof:n +\cs_set_eq:NN \heightof\calc_heightof:n +\cs_set_eq:NN \totalheightof\calc_totalheightof:n +%%\cs_set_eq:NN \ratio\calc_ratio:nn +%%\cs_set_eq:NN \real\calc_real:n +\cs_set_protected_nopar:Npn \setlength{\calc_skip_set:Nn} +\cs_set_protected_nopar:Npn \gsetlength{\calc_skip_gset:Nn} +\cs_set_protected_nopar:Npn \addtolength{\calc_skip_add:Nn} +\cs_set_protected_nopar:Npn \gaddtolength{\calc_skip_gadd:Nn} \newif\iffirstchoice@ \firstchoice@true -\def_protected:Npn \calc_setcounter:nn#1#2{ +\cs_set_protected_nopar:Npn \calc_setcounter:nn#1#2{ \calc_chk_document_counter:nn{#1}{ \exp_args:Nc\calc_int_gset:Nn {c@#1}{#2} } } -\def_protected:Npn \calc_addtocounter:nn#1#2{ +\cs_set_protected_nopar:Npn \calc_addtocounter:nn#1#2{ \iffirstchoice@ \calc_chk_document_counter:nn{#1}{ \exp_args:Nc\calc_int_gadd:Nn {c@#1}{#2} } \fi: } -\def_protected:Npn \calc_stepcounter:n#1{ +\cs_set_protected_nopar:Npn \calc_stepcounter:n#1{ \iffirstchoice@ \calc_chk_document_counter:nn{#1}{ \int_gincr:c {c@#1} \group_begin: - \let:NN \@elt\@stpelt \cs_use:c{cl@#1} + \cs_set_eq:NN \@elt\@stpelt \use:c{cl@#1} \group_end: } \fi: } -\def_new:Npn \calc_chk_document_counter:nn#1{ +\cs_new_nopar:Npn \calc_chk_document_counter:nn#1{ \cs_if_free:cTF{c@#1}{\@nocounterr {#1}} } -\let:NN \setcounter \calc_setcounter:nn -\let:NN \addtocounter \calc_addtocounter:nn -\let:NN \stepcounter \calc_stepcounter:n +\cs_set_eq:NN \setcounter \calc_setcounter:nn +\cs_set_eq:NN \addtocounter \calc_addtocounter:nn +\cs_set_eq:NN \stepcounter \calc_stepcounter:n \AtBeginDocument{ - \let:NN \setcounter \calc_setcounter:nn - \let:NN \addtocounter \calc_addtocounter:nn - \let:NN \stepcounter \calc_stepcounter:n + \cs_set_eq:NN \setcounter \calc_setcounter:nn + \cs_set_eq:NN \addtocounter \calc_addtocounter:nn + \cs_set_eq:NN \stepcounter \calc_stepcounter:n } -\def:cpn{ver@calc.sty}{2005/08/06} +\cs_set_nopar:cpn{ver@calc.sty}{2005/08/06} %% %% %% End of file `l3calc.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3chk.sty b/Master/texmf-dist/tex/latex/expl3/l3chk.sty index 7900e8409d0..b059aa3167e 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3chk.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3chk.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3chk.dtx Copyright (C) 1990-2006 LaTeX3 project +%% File: l3chk.dtx Copyright (C) 1990-2006,2009 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. %% @@ -49,50 +49,49 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{l3names} -\GetIdInfo$Id: l3chk.dtx 621 2007-09-01 20:14:19Z morten $ +\GetIdInfo$Id: l3chk.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental check module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3basics} -\RequirePackage{l3int,l3prg} -\def_new:Npn \chk_local:N #1{ - \exp_after:NN \chk_local_aux:w \token_to_string:N#1\q_stop} +\package_check_loaded_expl: +\cs_new_nopar:Npn \chk_local:N #1{ + \exp_after:wN \chk_local_aux:w \token_to_str:N#1\q_stop} -\def_new:Npn \chk_local_aux:w #1#2#3\q_stop{ +\cs_new_nopar:Npn \chk_local_aux:w #1#2#3\q_stop{ \if_num:w\tex_uccode:D`#2=`G\scan_stop: - \err_latex_bug:x{Local~mismatch:~local~function~called~with~ + \msg_kernel_bug:x {Local~mismatch:~local~function~called~with~ global~variable:^^J\text_put_four_sp: #1#2#3~ on~line~\tex_the:D\tex_inputlineno:D} \else: \if_num:w\tex_uccode:D`#2=`L\scan_stop: \else: - \err_latex_bug:x{Variable~mismatch:~function~not~called~with~ + \msg_kernel_bug:x {Variable~mismatch:~function~not~called~with~ proper~variable:^^J\text_put_four_sp: #1#2#3~ on~line~\tex_the:D\tex_inputlineno:D}\fi: \fi:} \tex_newlinechar:D=`\^^J -\def_new:Npn \chk_global:N #1{\exp_after:NN - \chk_global_aux:w \token_to_string:N#1\q_stop} -\def_new:Npn \chk_global_aux:w #1#2#3\q_stop{ +\cs_new_nopar:Npn \chk_global:N #1{\exp_after:wN + \chk_global_aux:w \token_to_str:N#1\q_stop} +\cs_new_nopar:Npn \chk_global_aux:w #1#2#3\q_stop{ \if_num:w\tex_uccode:D`#2=`L\scan_stop: - \err_latex_bug:x{Global~mismatch:~global~function~called~with~ + \msg_kernel_bug:x {Global~mismatch:~global~function~called~with~ local~variable:~#1#2#3~ on~line~\tex_the:D\tex_inputlineno:D} \else: \if_num:w\tex_uccode:D`#2=`G\scan_stop: \else: - \err_latex_bug:x{Variable~mismatch:~function~not~called~with~ + \msg_kernel_bug:x {Variable~mismatch:~function~not~called~with~ proper~variable:~#1#2#3~ on~line~\tex_the:D\tex_inputlineno:D}\fi:\fi:} -\def_new:Npn \pref_global_chk: { - \gdef:Npn \chk_local_or_pref_global:N ##1{ +\cs_new_nopar:Npn \pref_global_chk: { + \cs_gset_nopar:Npn \chk_local_or_pref_global:N ##1{ \chk_global:N ##1 - \glet:NN \chk_local_or_pref_global:N \chk_local:N} + \cs_gset_eq:NN \chk_local_or_pref_global:N \chk_local:N} \pref_global:D} -\let_new:NN \chk_local_or_pref_global:N \chk_local:N -\def_new:Npn \chk_var_or_const:N #1{\exp_after:NN - \chk_var_or_const_aux:w \token_to_string:N#1\q_stop } -\def_new:Npn \chk_var_or_const_aux:w #1#2#3\q_stop { +\cs_new_eq:NN \chk_local_or_pref_global:N \chk_local:N +\cs_new_nopar:Npn \chk_var_or_const:N #1{\exp_after:wN + \chk_var_or_const_aux:w \token_to_str:N#1\q_stop } +\cs_new_nopar:Npn \chk_var_or_const_aux:w #1#2#3\q_stop { \if_num:w\tex_uccode:D`#2=`L\scan_stop: \else: \if_num:w\tex_uccode:D`#2=`G\scan_stop: @@ -101,24 +100,24 @@ \else: \if_charcode:w#2q\scan_stop: \else: - \err_latex_bug:x{Variable~mismatch:~function~not~called~with~ + \msg_kernel_bug:x {Variable~mismatch:~function~not~called~with~ proper~variable:^^J\text_put_four_sp: #1#2#3~ on~line~\tex_the:D\tex_inputlineno:D}\fi:\fi:\fi: \fi:} -\def_new:Npn\donotcheck{ - \let:NN \chk_global:N \use_none:n - \let:NN \chk_local:N \use_none:n - \let:NN \chk_local_or_pref_global:N \use_none:n - \let:NN \pref_global_chk: \pref_global:D - \let:NN \chk_new_cs:N \use_none:n - \let:NN \chk_exist_cs:N \use_none:n - \let:NN \chk_var_or_const:N \use_none:n - \let:NN \cs_record_name:N \use_none:n - \let:NN \cs_record_name:c \use_none:n - \let:NN \cs_record_meaning:N \use_none:n - \let:NN \register_record_name:N \use_none:n +\cs_new_nopar:Npn\donotcheck{ + \cs_set_eq:NN \chk_global:N \use_none:n + \cs_set_eq:NN \chk_local:N \use_none:n + \cs_set_eq:NN \chk_local_or_pref_global:N \use_none:n + \cs_set_eq:NN \pref_global_chk: \pref_global:D + \cs_set_eq:NN \chk_if_free_cs:N \use_none:n + \cs_set_eq:NN \chk_exist_cs:N \use_none:n + \cs_set_eq:NN \chk_var_or_const:N \use_none:n + \cs_set_eq:NN \cs_record_name:N \use_none:n + \cs_set_eq:NN \cs_record_name:c \use_none:n + \cs_set_eq:NN \cs_record_meaning:N \use_none:n + \cs_set_eq:NN \register_record_name:N \use_none:n } -\def_new:Npn\absolutelytracingall{ +\cs_new_nopar:Npn\absolutelytracingall{ \pref_global:D\g_trace_commands_status\c_two \pref_global:D\g_trace_statistics_status\c_two \pref_global:D\g_trace_pages_status\c_one @@ -131,7 +130,7 @@ \pref_global:D\g_trace_box_depth_int\c_ten_thousand \pref_global:D\g_trace_online_status\c_one \tex_errorstopmode:D} -\def_new:Npn\tracingoff{ +\cs_new_nopar:Npn\tracingoff{ \pref_global:D\g_trace_online_status\c_zero \pref_global:D\g_trace_commands_status\c_zero \pref_global:D\g_trace_statistics_status\c_zero @@ -144,15 +143,15 @@ \pref_global:D\g_trace_box_breadth_int\c_zero \pref_global:D\g_trace_box_depth_int\c_zero } -\def_new:Npn\traceon#1{ +\cs_new_nopar:Npn\traceon#1{ \clist_map_inline:nn {#1}{ - \cs_free:cF{g_trace_ ##1 _status} + \cs_if_free:cF{g_trace_ ##1 _status} {\int_gincr:c{g_trace_ ##1 _status}} } } -\def_new:Npn\traceoff#1{ +\cs_new_nopar:Npn\traceoff#1{ \clist_map_inline:nn {#1}{ - \cs_free:cF{g_trace_ ##1 _status} + \cs_if_free:cF{g_trace_ ##1 _status} {\int_gdecr:c{g_trace_ ##1 _status}} } } diff --git a/Master/texmf-dist/tex/latex/expl3/l3clist.sty b/Master/texmf-dist/tex/latex/expl3/l3clist.sty index ac82ec646f0..33051453762 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3clist.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3clist.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3clist.dtx Copyright (C) 2005-2006 Frank Mittelbach, LaTeX3 project +%% File: l3clist.dtx Copyright (C) 2005-2008 Frank Mittelbach, 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,114 +48,149 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3clist.dtx 745 2008-08-03 18:50:46Z morten $ +\GetIdInfo$Id: l3clist.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental comma separated lists} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\NeedsTeXFormat{LaTeX2e} -\RequirePackage{l3prg,l3quark} -\def_new:Npn \clist_new:N #1{\tlp_new:Nn #1{}} -\def_new:Npn \clist_new:c {\exp_args:Nc \clist_new:N} -\let_new:NN \clist_clear:N \tlp_clear:N -\let_new:NN \clist_clear:c \tlp_clear:c -\let_new:NN \clist_gclear:N \tlp_gclear:N -\let_new:NN \clist_gclear:c \tlp_gclear:c -\let_new:NN \clist_set_eq:NN \let:NN -\let_new:NN \clist_gset_eq:NN \glet:NN -\def_new:Npn \clist_gset_eq:cN {\exp_args:Nc \clist_gset_eq:NN} -\def_new:Npn \clist_gset_eq:Nc {\exp_args:NNc \clist_gset_eq:NN} -\def_new:Npn \clist_gset_eq:cc {\exp_args:Ncc \clist_gset_eq:NN} -\let_new:NN \clist_if_empty_p:N \tlp_if_empty_p:N -\def_test_function_new:npn {clist_if_empty:N}#1{\if_meaning:NN#1\c_empty_tlp} -\def_new:Npn \clist_if_empty:cTF {\exp_args:Nc\clist_if_empty:NTF} -\def_new:Npn \clist_if_empty:cT {\exp_args:Nc\clist_if_empty:NT} -\def_new:Npn \clist_if_empty:cF {\exp_args:Nc\clist_if_empty:NF} -\def_new:Npn \clist_if_empty_err:N #1{ - \if_meaning:NN#1\c_empty_tlp - \tlp_clear:N \l_testa_tlp % catch prefixes - \err_latex_bug:x{Empty~comma-list~`\token_to_string:N#1'} - \fi:} -\let_new:NN \clist_if_eq:NNTF \tlp_if_eq:NNTF -\def_new:Npn \clist_get:NN #1{ +\package_check_loaded_expl: +\cs_new_eq:NN \clist_new:N \tl_new:N +\cs_generate_variant:Nn \clist_new:N {c} +\cs_new_eq:NN \clist_clear:N \tl_clear:N +\cs_generate_variant:Nn \clist_clear:N {c} +\cs_new_eq:NN \clist_gclear:N \tl_gclear:N +\cs_generate_variant:Nn \clist_gclear:N {c} +\cs_new_eq:NN \clist_clear_new:N \tl_clear_new:N +\cs_generate_variant:Nn \clist_clear_new:N {c} +\cs_new_eq:NN \clist_gclear_new:N \tl_gclear_new:N +\cs_generate_variant:Nn \clist_gclear_new:N {c} +\cs_new_eq:NN \clist_set_eq:NN \cs_set_eq:NN +\cs_new_eq:NN \clist_set_eq:cN \cs_set_eq:cN +\cs_new_eq:NN \clist_set_eq:Nc \cs_set_eq:Nc +\cs_new_eq:NN \clist_set_eq:cc \cs_set_eq:cc +\cs_new_eq:NN \clist_gset_eq:NN \cs_gset_eq:NN +\cs_new_eq:NN \clist_gset_eq:cN \cs_gset_eq:cN +\cs_new_eq:NN \clist_gset_eq:Nc \cs_gset_eq:Nc +\cs_new_eq:NN \clist_gset_eq:cc \cs_gset_eq:cc +\prg_new_eq_conditional:NNn \clist_if_empty:N \tl_if_empty:N {p,TF,T,F} +\prg_new_eq_conditional:NNn \clist_if_empty:c \tl_if_empty:c {p,TF,T,F} +\cs_new_nopar:Npn \clist_if_empty_err:N #1 { + \if_meaning:w #1 \c_empty_tl + \tl_clear:N \l_testa_tl % catch prefixes + \msg_kernel_bug:x {Empty~comma-list~`\token_to_str:N #1'} + \fi: +} +\prg_new_eq_conditional:NNn \clist_if_eq:NN \tl_if_eq:NN {p,TF,T,F} +\prg_new_eq_conditional:NNn \clist_if_eq:cN \tl_if_eq:cN {p,TF,T,F} +\prg_new_eq_conditional:NNn \clist_if_eq:Nc \tl_if_eq:Nc {p,TF,T,F} +\prg_new_eq_conditional:NNn \clist_if_eq:cc \tl_if_eq:cc {p,TF,T,F} +\prg_new_conditional:Nnn \clist_if_in:Nn {TF,T,F} { + \cs_set: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 +} +\cs_generate_variant:Nn \clist_if_in:NnTF {NV,No,cn,cV,co} +\cs_generate_variant:Nn \clist_if_in:NnT {NV,No,cn,cV,co} +\cs_generate_variant:Nn \clist_if_in:NnF {NV,No,cn,cV,co} +\cs_new_nopar:Npn \clist_use:N #1 { + \if_meaning:w #1 \scan_stop: + \msg_kernel_bug:x { + Comma~list~ `\token_to_str:N #1'~ has~ an~ erroneous~ structure!} + \else: + \exp_after:wN #1 + \fi: +} +\cs_generate_variant:Nn \clist_use:N {c} +\cs_new_nopar:Npn \clist_get:NN #1 { \clist_if_empty_err:N #1 - \exp_after:NN\clist_get_aux:w #1,\q_stop} -\def_new:Npn \clist_get_aux:w #1,#2\q_stop #3{\tlp_set:Nn #3{#1}} -\def_new:Npn \clist_get:cN {\exp_args:Nc \clist_get:NN} -\def_new:Npn \clist_pop_aux:nnNN #1#2#3{ + \exp_after:wN \clist_get_aux:w #1,\q_stop +} +\cs_new:Npn \clist_get_aux:w #1,#2\q_stop #3 { \tl_set:Nn #3{#1} } +\cs_generate_variant:Nn \clist_get:NN {cN} +\cs_new:Npn \clist_pop_aux:nnNN #1#2#3 { \clist_if_empty_err:N #3 - \exp_after:NN\clist_pop_aux:w #3,\q_nil\q_stop #1#2#3} -\def_new:Npn \clist_pop_aux:w #1,#2\q_stop #3#4#5#6{ - #4#6{#1} - #3#5{#2} - \quark_if_nil:NTF #5 - { #3#5{} } - { \clist_pop_auxi:w #2 #3#5 } -} -\def_new:Npn\clist_pop_auxi:w #1,\q_nil #2#3 {#2#3{#1}} -\def_new:Npn \clist_put_aux:NNnnNn #1#2#3#4#5#6{ - \clist_if_empty:NTF#5 {#1 #5{#6}} - { \tlist_if_empty:nF {#6}{ #2 #5{#3#6#4} } } -} -\def_new:Npn \clist_put_left:Nn { - \clist_put_aux:NNnnNn \tlp_set:Nn \tlp_put_left:Nn {} , -} -\def_new:Npn \clist_put_left:cn {\exp_args:Nc \clist_put_left:Nn} -\def_new:Npn \clist_put_left:No {\exp_args:NNo\clist_put_left:Nn} -\def_new:Npn \clist_put_left:Nx {\exp_args:Nnx\clist_put_left:Nn} -\def_new:Npn \clist_gput_left:Nn { - \clist_put_aux:NNnnNn \tlp_gset:Nn \tlp_gput_left:Nn {} , -} -\def_new:Npn \clist_put_right:Nn { - \clist_put_aux:NNnnNn \tlp_set:Nn \tlp_put_right:Nn , {} -} -\def_new:Npn \clist_put_right:cn {\exp_args:Nc \clist_put_right:Nn} -\def_new:Npn \clist_put_right:No {\exp_args:Nno\clist_put_right:Nn} -\def_new:Npn \clist_put_right:Nx {\exp_args:Nnx\clist_put_right:Nn} -\def_new:Npn \clist_gput_right:Nn { - \clist_put_aux:NNnnNn \tlp_gset:Nn \tlp_gput_right:Nn , {} -} -\def_new:Npn \clist_gput_right:No {\exp_args:NNo \clist_gput_right:Nn} -\def_new:Npn \clist_gput_right:cn {\exp_args:Nc \clist_gput_right:Nn} -\def_new:Npn \clist_gput_right:co {\exp_args:Nco \clist_gput_right:Nn} -\def_new:Npn \clist_gput_right:cc {\exp_args:Ncc \clist_gput_right:Nn} -\def_new:Npn \clist_gput_right:NC {\exp_args:NNC \clist_gput_right:Nn} -\def_new:Npn \clist_map_function:NN #1#2{ - \clist_if_empty:NF #1 - { - \exp_after:NN \clist_map_function_aux:Nw - \exp_after:NN #2 #1 , \q_recursion_tail , \q_recursion_stop + \exp_after:wN \clist_pop_aux:w #3,\q_nil\q_stop #1#2#3 +} +\cs_new:Npn \clist_pop_aux:w #1,#2\q_stop #3#4#5#6 { + #4 #6 {#1} + #3 #5 {#2} + \quark_if_nil:NTF #5 { #3 #5 {} }{ \clist_pop_auxi:w #2 #3#5 } +} +\cs_new:Npn \clist_pop_auxi:w #1,\q_nil #2#3 { #2#3{#1} } +\cs_new_eq:NN \clist_show:N \tl_show:N +\cs_new_eq:NN \clist_show:c \tl_show:c +\cs_new_nopar:Npn \clist_display:N #1 { + \iow_term:x { Comma-list~\token_to_str:N #1~contains~ + the~elements~(without~outer~braces): } + \toks_clear:N \l_tmpa_toks + \clist_map_inline:Nn #1 { + \toks_if_empty:NF \l_tmpa_toks { + \toks_put_right:Nx \l_tmpa_toks {^^J>~} + } + \toks_put_right:Nx \l_tmpa_toks { + \iow_space: \iow_char:N \{ \exp_not:n {##1} \iow_char:N \} + } + } + \toks_show:N \l_tmpa_toks +} +\cs_generate_variant:Nn \clist_display:N {c} +\cs_new: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} } } } -\def_new:Npn \clist_map_function:cN{\exp_args:Nc\clist_map_function:NN} -\def_new:Npn \clist_map_function:nN #1#2{ - \tlist_if_blank:nF {#1} - { \clist_map_function_aux:Nw #2 #1 , \q_recursion_tail , \q_recursion_stop } +\cs_new_nopar:Npn \clist_put_left:Nn { + \clist_put_aux:NNnnNn \tl_set:Nn \tl_put_left:Nn {} , } -\def_long_new:Npn \clist_map_function_aux:Nw #1#2,{ +\cs_generate_variant:Nn \clist_put_left:Nn {NV,No,Nx,cn,cV,co} +\cs_new_nopar:Npn \clist_gput_left:Nn { + \clist_put_aux:NNnnNn \tl_gset:Nn \tl_gput_left:Nn {} , +} +\cs_generate_variant:Nn \clist_gput_left:Nn {NV,No,Nx,cn,cV,co} +\cs_new_nopar:Npn \clist_put_right:Nn { + \clist_put_aux:NNnnNn \tl_set:Nn \tl_put_right:Nn , {} +} +\cs_generate_variant:Nn \clist_put_right:Nn {NV,No,Nx,cn,cV,co} +\cs_new_nopar:Npn \clist_gput_right:Nn { + \clist_put_aux:NNnnNn \tl_gset:Nn \tl_gput_right:Nn , {} +} +\cs_generate_variant:Nn \clist_gput_right:Nn {NV,No,Nx,cn,cV,co} +\cs_new_nopar:Npn \clist_map_function:NN #1#2 { + \clist_if_empty:NF #1 { + \exp_after:wN \clist_map_function_aux:Nw + \exp_after:wN #2 #1 , \q_recursion_tail , \q_recursion_stop + } +} +\cs_generate_variant:Nn \clist_map_function:NN {cN} +\cs_new:Npn \clist_map_function:nN #1#2 { + \tl_if_blank: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 } -\let_new:NN \clist_map_break:w \use_none_delimit_by_q_recursion_stop:w +\cs_new_eq:NN \clist_map_break: \use_none_delimit_by_q_recursion_stop:w \int_new:N \g_clist_inline_level_int -\def_long_new:Npn \clist_map_inline:Nn #1#2{ - \clist_if_empty:NF #1 - { +\cs_new:Npn \clist_map_inline:Nn #1#2 { + \clist_if_empty:NF #1 { \int_gincr:N \g_clist_inline_level_int - \gdef_long:cpn {clist_map_inline_ \int_use:N \g_clist_inline_level_int :n} + \cs_gset:cpn {clist_map_inline_ \int_use:N \g_clist_inline_level_int :n} ##1{#2} - \exp_args:NcE \clist_map_function_aux:Nw + \exp_last_unbraced:NcV \clist_map_function_aux:Nw {clist_map_inline_ \int_use:N \g_clist_inline_level_int :n} #1 , \q_recursion_tail , \q_recursion_stop \int_gdecr:N \g_clist_inline_level_int } } -\def_new:Npn \clist_map_inline:cn{\exp_args:Nc\clist_map_inline:Nn} -\def_long_new:Npn \clist_map_inline:nn #1#2{ - \tlist_if_empty:nF {#1} - { +\cs_generate_variant:Nn \clist_map_inline:Nn {c} +\cs_new:Npn \clist_map_inline:nn #1#2 { + \tl_if_empty:nF {#1} { \int_gincr:N \g_clist_inline_level_int - \gdef_long:cpn {clist_map_inline_ \int_use:N \g_clist_inline_level_int :n} + \cs_gset:cpn {clist_map_inline_ \int_use:N \g_clist_inline_level_int :n} ##1{#2} \exp_args:Nc \clist_map_function_aux:Nw {clist_map_inline_ \int_use:N \g_clist_inline_level_int :n} @@ -163,84 +198,80 @@ \int_gdecr:N \g_clist_inline_level_int } } -\def_new:Npn \clist_map_variable:nNn #1#2#3{ - \tlist_if_empty:nF{#1} - { +\cs_new:Npn \clist_map_variable:nNn #1#2#3 { + \tl_if_empty:nF {#1} { \clist_map_variable_aux:Nnw #2 {#3} #1 , \q_recursion_tail , \q_recursion_stop } } -\def_new:Npn \clist_map_variable:NNn {\exp_args:No \clist_map_variable:nNn} -\def_new:Npn \clist_map_variable:cNn {\exp_args:Nc \clist_map_variable:NNn} -\def_new:Npn \clist_map_variable_aux:Nnw #1#2#3,{ - \def:Npn #1{#3} +\cs_new_nopar:Npn \clist_map_variable:NNn {\exp_args:No \clist_map_variable:nNn} +\cs_generate_variant:Nn\clist_map_variable:NNn {cNn} +\cs_new:Npn \clist_map_variable_aux:Nnw #1#2#3,{ + \cs_set_nopar:Npn #1{#3} \quark_if_recursion_tail_stop:N #1 #2 \clist_map_variable_aux:Nnw #1{#2} } -\def_new:Npn \clist_concat_aux:NNNN #1#2#3#4{ +\cs_new_nopar:Npn \clist_concat_aux:NNNN #1#2#3#4 { \toks_set:No \l_tmpa_toks {#3} \toks_set:No \l_tmpb_toks {#4} #1 #2 { \toks_use:N \l_tmpa_toks - \toks_if_empty:NF \l_tmpa_toks {\toks_if_empty:NF \l_tmpb_toks ,} + \toks_if_empty:NF \l_tmpa_toks { \toks_if_empty:NF \l_tmpb_toks , } \toks_use:N \l_tmpb_toks } } -\def_new:Npn \clist_concat:NNN {\clist_concat_aux:NNNN \tlp_set:Nx} -\def_new:Npn \clist_gconcat:NNN {\clist_concat_aux:NNNN \tlp_gset:Nx} -\def_new:Npn \clist_gconcat:NNc{\exp_args:Nnnc\clist_gconcat:NNN} -\def_new:Npn \clist_gconcat:ccc{\exp_args:Nccc\clist_gconcat:NNN} -\def:Npn \clist_remove_duplicates_aux:NN #1#2 { - \clist_clear:N \l_clist_remove_duplicates_clist +\cs_new_nopar:Npn \clist_concat:NNN { \clist_concat_aux:NNNN \tl_set:Nx } +\cs_new_nopar:Npn \clist_gconcat:NNN { \clist_concat_aux:NNNN \tl_gset:Nx } +\cs_generate_variant:Nn \clist_concat:NNN {ccc} +\cs_generate_variant:Nn \clist_gconcat:NNN {ccc} +\clist_new:N \l_clist_remove_clist +\cs_new:Nn \clist_remove_duplicates_aux:NN { + \clist_clear:N \l_clist_remove_clist \clist_map_function:NN #2 \clist_remove_duplicates_aux:n - #1 #2 \l_clist_remove_duplicates_clist + #1 #2 \l_clist_remove_clist } -\def:Npn \clist_remove_duplicates_aux:n #1 { - \clist_if_in:NnTF \l_clist_remove_duplicates_clist {#1} {} - {\clist_put_right:Nn \l_clist_remove_duplicates_clist {#1}} +\cs_new:Nn \clist_remove_duplicates_aux:n { + \clist_if_in:NnF \l_clist_remove_clist {#1} { + \clist_put_right:Nn \l_clist_remove_clist {#1} + } } -\def_new:Npn \clist_remove_duplicates:N { +\cs_new_nopar:Npn \clist_remove_duplicates:N { \clist_remove_duplicates_aux:NN \clist_set_eq:NN } -\def_new:Npn \clist_gremove_duplicates:N { +\cs_new_nopar:Npn \clist_gremove_duplicates:N { \clist_remove_duplicates_aux:NN \clist_gset_eq:NN } -\clist_new:N \l_clist_remove_duplicates_clist -\def_new:Npn \clist_use:N #1 { - \if_meaning:NN #1 \scan_stop: - \err_latex_bug:x {Comma~list~ `\token_to_string:N #1'~ - has~ an~ erroneous~ structure!} - \else: - \exp_after:NN #1 - \fi: +\cs_new_nopar:Npn \clist_remove_element:Nn { + \clist_remove_element_aux:NNn \clist_set_eq:NN +} +\cs_new_nopar:Npn \clist_gremove_element:Nn { + \clist_remove_element_aux:NNn \clist_gset_eq:NN } -\def_new:Npn \clist_use:c {\exp_args:Nc \clist_use:N} -\def_new:Npn \clist_if_in:NnTF #1#2{ - \def:Npn \tmp:w ##1 ,#2, ##2##3\q_stop{ - \if_meaning:NN\q_no_value##2 - \exp_after:NN\use_arg_ii:nn - \else: - \exp_after:NN\use_arg_i:nn - \fi: +\cs_new:Nn \clist_remove_element_aux:NNn { + \clist_clear:N \l_clist_remove_clist + \cs_set:Nn \clist_remove_element_aux:n { + \tl_if_eq:nnF {#3} {##1} { + \clist_put_right:Nn \l_clist_remove_clist {##1} + } } - \exp_after:NN \tmp:w - \exp_after:NN , #1, #2, \q_no_value \q_stop -} -\def_new:Npn \clist_if_in:NoTF {\exp_args:NNo \clist_if_in:NnTF} -\def_new:Npn \clist_if_in:coTF {\exp_args:Nco \clist_if_in:NnTF} -\def_new:Npn \clist_if_in:cnTF {\exp_args:Nc \clist_if_in:NnTF} -\let_new:NN \clist_push:Nn \clist_put_left:Nn -\let_new:NN \clist_push:No \clist_put_left:No -\let_new:NN \clist_push:cn \clist_put_left:cn -\def_new:Npn \clist_pop:NN {\clist_pop_aux:nnNN \tlp_set:Nn \tlp_set:Nn} -\def_new:Npn \clist_pop:cN {\exp_args:Nc \clist_pop:NN} -\let_new:NN \clist_gpush:Nn \clist_gput_left:Nn -\def_new:Npn \clist_gpush:No {\exp_args:NNo \clist_gpush:Nn} -\def_new:Npn \clist_gpush:cn {\exp_args:Nc \clist_gpush:Nn} -\def_new:Npn \clist_gpop:NN {\clist_pop_aux:nnNN \tlp_gset:Nn \tlp_set:Nn} -\def_new:Npn \clist_gpop:cN {\exp_args:Nc \clist_gpop:NN} -\let_new:NN \clist_top:NN \clist_get:NN -\let_new:NN \clist_top:cN \clist_get:cN + \clist_map_function:NN #2 \clist_remove_element_aux:n + #1 #2 \l_clist_remove_clist +} +\cs_new:Nn \clist_remove_element_aux:n { } +\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:cn \clist_put_left:cn +\cs_new_nopar:Npn \clist_pop:NN {\clist_pop_aux:nnNN \tl_set:Nn \tl_set:Nn} +\cs_generate_variant:Nn \clist_pop:NN {cN} +\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_generate_variant:Nn \clist_gpush:Nn {cn} +\cs_new_nopar:Npn \clist_gpop:NN {\clist_pop_aux:nnNN \tl_gset:Nn \tl_set:Nn} +\cs_generate_variant:Nn \clist_gpop:NN {cN} +\cs_new_eq:NN \clist_top:NN \clist_get:NN +\cs_new_eq:NN \clist_top:cN \clist_get:cN %% %% %% End of file `l3clist.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3doc.cls b/Master/texmf-dist/tex/latex/expl3/l3doc.cls index da59bf174ef..09d6928412f 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3doc.cls +++ b/Master/texmf-dist/tex/latex/expl3/l3doc.cls @@ -1,5 +1,21 @@ -% \iffalse -%% File: l3doc.dtx Copyright (C) 1990-2008 LaTeX3 project +%% +%% 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-2009 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 @@ -17,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. %% @@ -31,385 +47,697 @@ %% prior consultation with the LaTeX Project Team. %% %% ----------------------------------------------------------------------- -%% \fi -% \iffalse -% \begin{macrocode} -%<*class> -\NeedsTeXFormat{LaTeX2e} -\ProvidesClass{l3doc} - [2008/08/01 v0.0k class for documenting experimental stuff] -% -\NeedsTeXFormat{LaTeX2e} -%</class> -% \end{macrocode} -% -% \section{Options} -% -% \begin{macrocode} -%<*class> -\DeclareOption{a5paper}{\@latexerr{Option not supported}% - {}} -\DeclareOption{full}{\AtBeginDocument{\input{l3full.cfg}}} -% \end{macrocode} -% -% \begin{macrocode} +\RequirePackage{l3names} +\let \filenameOld \filename +\let \filenameextOld \filenameext +\let \filedateOld \filedate +\let \fileversionOld \fileversion +\let \filedescriptionOld \filedescription +\GetIdInfo$Id: l3doc.dtx 1398 2009-06-08 15:53:26Z joseph $ + {L3 Experimental documentation class} +\ProvidesExplClass + {\filename}{\filedate}{\fileversion}{\filedescription} +\RequirePackage{expl3} +\let \filename \filenameOld +\let \filenameext \filenameextOld +\let \filedate \filedateOld +\let \fileversion \fileversionOld +\let \filedescription \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_set_false:N \g_doc_full_bool +\DeclareOption{full}{ \bool_set_true:N \g_doc_full_bool } +\DeclareOption{onlydoc}{ \bool_set_false:N \g_doc_full_bool } +\bool_new:N \g_doc_checkfunc_bool +\bool_set_true:N \g_doc_checkfunc_bool +\DeclareOption{check}{ \bool_set_true:N \g_doc_checkfunc_bool } +\DeclareOption{nocheck}{ \bool_set_false:N \g_doc_checkfunc_bool } \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} -% \end{macrocode} -% -% \section{Option Processing} -% -% \begin{macrocode} +\ExecuteOptions{full} \ProcessOptions -% \end{macrocode} -% -% \section{Loading article and doc} -% -% \begin{macrocode} -\LoadClass{article} -% \end{macrocode} -% We need eTeX. Otherwise stop processing now. -% \begin{macrocode} -\@ifundefined{eTeXversion}{% - \ClassError{l3doc}{This document class requires eTeX extensions}% - {I'm going to stop now.}% - \endinput\stop -}{} -% \end{macrocode} -% -% \begin{macrocode} -\RequirePackage{l3names,trace} +\LoadClass[a4paper]{article} \RequirePackage{doc} -\renewcommand\MakePrivateLetters{\makeatletter - \catcode`\_=11\relax - \catcode`\:=11\relax} -% \end{macrocode} -% -% \section{Configuration} -% Input a local configuration file, if it exists. -% \begin{macrocode} -\InputIfFileExists{l3doc.cfg} - {\typeout{*************************************^^J% - * Local config file l3doc.cfg used^^J% - *************************************}} - {} -% \end{macrocode} -% -% taken out for the moment as my laptop doesn't have a full set of -% type 1 fonts installed right now --- fmi -%\RequirePackage[T1]{fontenc} - -%% The Guilty Parties -\def\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}} - -%% You do not want to look at the mess below this line. -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -\catcode`\_=11 -\AtBeginDocument{\catcode`\_=11\relax} -% \end{macrocode} -% -% Make \verb+|+ and \verb+"+ be `short verb' characters, but not in -% the document preamble, where an active character may interfere -% with packages that are loaded. -% \begin{macrocode} -\MakeShortVerb\" -\MakeShortVerb\| -% \end{macrocode} -% -% As `doc' documents tend to have a lot of monospaced material, -% Set up some |tt| substitutions to occur silently. -% \begin{macrocode} -\DeclareFontShape{OT1}{cmtt}{bx}{n}{<-> ssub * cmtt/m/n}{} -\DeclareFontFamily{OMS}{cmtt}{\skewchar\font 48} % '60 -\DeclareFontShape{OMS}{cmtt}{m}{n}{<-> ssub * cmsy/m/n}{} -\DeclareFontShape{OMS}{cmtt}{bx}{n}{<-> ssub * cmsy/b/n}{} -% \end{macrocode} -% This substitution is in the standard fd file, but not silent. -% \begin{macrocode} -\DeclareFontShape{OT1}{cmss}{m}{it}{<->ssub*cmss/m/sl}{} -% \begin{macrocode} -\CodelineNumbered -\DisableCrossrefs -% \end{macrocode} -% -% Increase the text width slightly so that width the standard fonts -% 72 columns of code may appear in a |macrocode| environment. -% \changes{v2.0c}{1994/03/15}{Set \cs{textwidth}.} -% \begin{macrocode} -\setlength{\textwidth}{355pt} -% \end{macrocode} -% -% Increase the marginpar width slightly, for long command names. -% And increase the left margin by a similar amount -% \changes{v2.0l} -% {1994/05/25}{Increase \cs{marginparwidth}} -% \changes{v2.0q}{1995/11/28} -% {Increase \cs{marginparwidth} and page margin.} -% \begin{macrocode} -\addtolength\marginparwidth{30pt} -\addtolength\oddsidemargin{20pt} -\addtolength\evensidemargin{20pt} -% \end{macrocode} -% -% -% \begin{macrocode} +\RequirePackage{array,alphalph,color,fixltx2e,enumitem,trace,underscore} +\RequirePackage[T1]{fontenc} +\RequirePackage{lmodern,textcomp} +\RequirePackage{hypdoc} +\let\doc@verbatim\verbatim +\let\enddoc@verbatim\endverbatim +\let\doc@@verbatim\@verbatim +\usepackage{verbatim} +\AtBeginDocument{% + \let\verbatim\doc@verbatim + \let\endverbatim\enddoc@verbatim + \let\@verbatim\doc@@verbatim +} +\cs_set_nopar:Npn \MakePrivateLetters { + \char_make_letter:N \@ + \char_make_letter:N \_ + \char_make_letter:N \: +} \setcounter{StandardModuleDepth}{1} -% \end{macrocode} -% -% \begin{macrocode} -\newcommand{\tn}[1]{{\ttfamily\bslash #1}% - \index{TeX and LaTeX2e commands\actualchar - \string\TeX{} and \string\LaTeXe{} commands:\levelchar - #1\actualchar{\string\ttfamily\string\bslash{}#1}}} -\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}} -% This command will be used to input the patch file -% if that file exists. -\newcommand{\includeltpatch}{% - \def\currentfile{l3patch.ltx} - \part{l3patch} - {\let\ttfamily\relax - \xdef\filekey{\filekey, \thepart={\ttfamily\currentfile}}}% - Things we did wrong\ldots - \IndexInput{l3patch.ltx}} - -% Get the date from ltvers.dtx -\def\patchdate{0} -\begingroup - %%\def\ProvidesFile#1\fmtversion#2{\date{#2}\endinput} - \def\ProvidesFile#1[#2#3]{\date{#2}\endinput} - \input{l3vers.dtx} - \xdef\@date{\@date} - \global\let\X@date=\@date -% Add the patch version if available. - \long\def\Xdef#1#2#3\def#4#5{% - \xdef\X@date{#2}% - \xdef\patchdate{#5}% - \endinput}% - \InputIfFileExists{l3patch.ltx} - {\let\def\Xdef}{\global\let\includeltpatch\relax} -\endgroup - -\ifx\@date\X@date - \def\Xpatch{0} - \ifx\patchdate\Xpatch\else - \edef\@date{\@date\space Patch level \patchdate} - \fi -\else - \@warning{l3patch.ltx does not match l3vers.dtx!} - \let\includeltpatch\relax -\fi - -\providecommand*\eTeX{% +\@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} + $\m@th\varepsilon$-\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}}} +\newenvironment{documentation}{}{} +\newenvironment{implementation}{}{} +\newcommand\EnableDocumentation{% + \renewenvironment{documentation}{}{}% +} +\newcommand\EnableImplementation{% + \renewenvironment{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 +} +\group_begin: +\char_make_active:N \< +\cs_gnew_nopar:Npn \function { + \char_make_active:N \< + \cs_set_eq:NN < \doc_open_meta:n + \group_begin: + \MakePrivateLetters + \char_make_other:N \| + \char_make_other:N \^ + \char_make_other:N \\ + \char_make_space:N \~ + \char_make_ignore:N \ % space + \char_make_ignore:N \^^M + \char_make_ignore:N \^^I + \function_aux:n +} +\group_end: +\cs_set_eq:NN \variable \function +\cs_set_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 + \doc_showmacro:w #1 | \q_stop \\ + \hline + \endtabular + \group_end: +} +\cs_set_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 } + } +} +\bool_new:N \l_doc_meta_TF_bool +\bool_new:N \l_doc_meta_EXP_bool +\cs_new_nopar:Npn \doc_showmacro_aux:w #1 / #2 \q_stop { -\providecommand*\file{\texttt} + \tl_if_in:nnTF {#2} { (TF) } { + \bool_gset_true:N \l_doc_meta_TF_bool + }{ + \bool_gset_false:N \l_doc_meta_TF_bool + } + \tl_if_in:nnTF {#2} { (EXP) } { + \bool_gset_true:N \l_doc_meta_EXP_bool + }{ + \bool_gset_false:N \l_doc_meta_EXP_bool + } + \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 } } + } -\def\vindex#1>#2\@nil{% - \edef\temp{\foo#2<>\@nil}% - \ifx\temp\space\else - \expandafter\SpecialMainIndexB\expandafter{\temp}\fi} + \doc_showmacro_aux_ii:w #1::\q_stop +} +\cs_set_nopar:Npn \doc_showmacro_aux_ii:w #1:#2:#3 \q_stop { + \nextnewline -% remove <foo> from index (quick hack, could be better) -\def\foo#1<#2>#3\@nil{% - #1\ifx\foo#3\foo - \else#2\expandafter\foo\fi#3\@nil} -%\def\foo#1<#2>#3\@nil{#1<#2>#3} -\def\foo#1<#2>#3\@nil{#1} + \tl_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$ + } +} +\newenvironment{syntax}{% + \minipage[b]{.7\textwidth}% + \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_make_active:N #1 } + \cs_gnew:Npn \doc_open_meta:n { + \group_begin: + \tl_map_function:nN {0123456789} \doc_assign_num:n + \doc_close_meta:w + } + \cs_gnew: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_make_active:N #1 + \cs_set_nopar:Npn #1 { \unskip \, $ {} \sb { \use:c { char_other_\string #1 } } $ } +} +\renewcommand \macro [1][] { + \bool_set_false:N \l_doc_macro_aux_bool + \bool_set_false:N \l_doc_macro_TF_bool + \cs_set_eq:NN \doc_macroname_prefix:n \use:n + \cs_set_eq:NN \doc_macroname_suffix: \c_empty_tl -% Cant remember why I switched from \SpecialMainIndexB -%%\gdef\SpecialMainIndexB#1{\index{\@gobble#1\space\actualchar{\string\verb+#1+}}} + \cs_set_nopar:Npn \KV_key_no_value_elt:n ##1 { \use:c {doc_macro_opt_##1:} } + \KV_parse_space_removal_sanitize:n {#1} -\gdef\SpecialMainIndexB#1{\index{\@gobble#1\actualchar\string\verb - \quotechar*\verbatimchar#1\verbatimchar\encapchar usage}} + \group_begin: + \MakePrivateLetters + \char_make_letter:N \\ + \char_make_ignore:N \ % space + \char_make_ignore:N \^^M + \char_make_ignore:N \^^I + \doc_macro_aux:n +} +\cs_new_nopar:Npn \doc_macro_aux:n #1 { + \group_end: + \clist_map_inline:nn {#1} { \doc_macro_single {##1} } +} +\bool_new:N \l_doc_macro_aux_bool +\bool_new:N \l_doc_macro_TF_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_TF: { \bool_set_true:N \l_doc_macro_TF_bool } +\cs_set_nopar:Npn \doc_macro_single #1 { -% A helper for later on. -\def\q@nil{\q@nil} -\long\def\tlist@if@blank@p@n #1{% - \expandafter\tlist@if@blank@p@aux@w\detokenize{#1}aa..\q@nil} -\def\tlist@if@blank@p@aux@w #1#2a#3#4\q@nil{% - \ifx #3#400\else01\fi} + \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: + } -\let\m\meta -\newenvironment{texnote}% - {\endgraf\vspace{3mm}\textbf{\TeX{}hackers~note:}\small} - {\vspace{3mm}} -% stick the function names in a box. -{\catcode`\|=\active\catcode`\<=\active + \cs_set_nopar:Npx \@tempa { + \exp_not:N \item [ \exp_not:N \doc_print_macroname:n { + \tl_to_str:n {#1} + }] + } \@tempa + \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} + } - -% index fuction lists (could be better...) -\gdef\funcindex#1|{% - \if\tlist@if@blank@p@n{#1}% - \expandafter\@firstoftwo + \global\advance \c@CodelineNo \m@ne + \ignorespaces +} +\cs_set_nopar:Npn \doc_print_macroname:n #1 { + \strut \MacroFont + \doc_macroname_prefix:n {#1} \doc_macroname_suffix: \ % space! +} +\cs_set_nopar:Npn \doc_typeset_TF: { + \color[gray]{0.5} + \underline { \color{black} \itshape TF \kern-0.1em } +} +\cs_set_nopar:Npn \doc_typeset_aux:n #1 { + {\color[gray]{0.5} #1} +} +\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 template 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' (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 - \expandafter\@secondoftwo + \@docinclude #1 \fi - {\@ifnextchar|{\@gobble}{}}% at the end, look for extra | and remove it - {\def\yyy{#1}\expandafter\vindex\meaning\yyy\@nil \funcindex}% } - -\gdef\function{% - \catcode`\<=\active\def<##1>{\meta{##1}}% - \bigskip - \bgroup - \@makeother\\ - \@makeother\_ - \catcode`\ =9 - \catcode`\^^M=9 - \catcode`\^^I=9 - \catcode`\|=\active\def|{\\}% - \@function} -\gdef\@function#1{% - \ifx\@function#1\@function\else - \funcindex#1| |% +\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 - \ttfamily - \endgraf - \noindent\hspace*{-2\parindent}% - \tabular[b]% - {@{\vline\hskip\tabcolsep}l@{\hskip\tabcolsep\vline}}% - \hline - #1\crcr - \hline - \noalign{\kern-2pt}% - \endtabular - \egroup}} - - -\let\variable\function - -% syntax for functions -\def\syntax{% - \@syntax} - -\def\@syntax{% - \minipage[b]{.7\textwidth}% - \small\ttfamily\raggedright - \obeyspaces\obeylines} -\def\endsyntax{\endminipage\hfil\break\global\@ignoretrue} - + \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:~\filedate\ % space + Version~\fileversion + \fi + \hfill\thepage + } + \cs_set_eq:NN \@evenfoot \@oddfoot +} +\seq_new:N \g_doc_functions_seq +\seq_new:N \g_doc_macros_seq +\iow_new:N \g_write_func_stream +\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 } -%The toks file uses these, Icould not see the original definition... -\let\zz\m -\let\zv\m + \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) + } -\setcounter{StandardModuleDepth}{1} -\addtolength{\textwidth}{30pt} + \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: } -\let\@@oldlist\list -\def\list#1#2{\@@oldlist{#1}{#2\listparindent\z@}} + \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: } -\setlength{\parindent}{0pt} -\setlength{\itemindent}{0pt} -\setlength{\parskip}{\medskipamount} - -% \section{DocInclude} -% -% \begin{macrocode} -\@addtoreset{CodelineNo}{part} -% \end{macrocode} -% -% \begin{macro}{\DocInclude} -% More or less exactly the same as |\include|, but uses |\DocInput| -% on a |dtx| file, not |\input| on a |tex| file. -% \changes{v2.0b}{1994/03/14}{Rename from \cs{docinclude}} -% \changes{v2.0f}{1994/03/25}{Use \cs{part}} -% \changes{v2.0u}{1999/08/08}{Also works for .fdd (M. Schroeder)} -% \begin{macrocode} -\def\partname{File} -% \end{macrocode} -% -% \begin{macrocode} -\newcommand*{\DocInclude}[1]{% - \relax - \clearpage - \docincludeaux - \IfFileExists{#1.fdd}{\def\currentfile{#1.fdd}}{\def\currentfile{#1.dtx}}% - \ifnum\@auxout=\@partaux - \@latexerr{\string\include\space cannot be nested}\@eha - \else \@docinclude#1 \fi} -\def\@docinclude#1 {\clearpage -\if@filesw \immediate\write\@mainaux{\string\@input{#1.aux}}\fi -\@tempswatrue\if@partsw \@tempswafalse\edef\@tempb{#1}\@for -\@tempa:=\@partlist\do{\ifx\@tempa\@tempb\@tempswatrue\fi}\fi -\if@tempswa \let\@auxout\@partaux \if@filesw -\immediate\openout\@partaux #1.aux -\immediate\write\@partaux{\relax}\fi -% \end{macrocode} -% We need to save (and later restore) various index-related -% commands which might be changed by the included file. -% \begin{macrocode} -\let\@ltxdoc@PrintIndex\PrintIndex -\let\PrintIndex\relax -\let\@ltxdoc@PrintChanges\PrintChanges -\let\PrintChanges\relax -\let\@ltxdoc@theglossary\theglossary -\let\@ltxdoc@endtheglossary\endtheglossary -\part{\currentfile}% - {\let\ttfamily\relax - \xdef\filekey{\filekey, \thepart={\ttfamily\currentfile}}}% -\DocInput{\currentfile}% -\let\PrintIndex\@ltxdoc@PrintIndex -\let\PrintChanges\@ltxdoc@PrintChanges -\let\theglossary\@ltxdoc@theglossary -\let\endtheglossary\@ltxdoc@endtheglossary -\clearpage -\@writeckpt{#1}\if@filesw \immediate\closeout\@partaux \fi -\else\@nameuse{cp@#1}\fi\let\@auxout\@mainaux} -% \end{macrocode} -% -% \begin{macrocode} -\gdef\codeline@wrindex#1{\if@filesw - \immediate\write\@indexfile - {\string\indexentry{#1}% - {\filesep\number\c@CodelineNo}}\fi}% -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -\let\filesep\@empty -% \end{macrocode} -% -% \begin{macro}{\docincludeaux} -% \changes{v2.06}{1994/03/31}{Use \cs{footnotesize} in file key.} -% \changes{v2.0k}{1994/05/21}{Use \cs{aalph}} -% \begin{macrocode} -\def\docincludeaux{% - \def\thepart{\aalph{part}}\def\filesep{\thepart-}% - \let\filekey\@gobble - \g@addto@macro\index@prologue{% - \gdef\@oddfoot{\parbox{\textwidth}{\strut\footnotesize - \raggedright{\bfseries File Key:} \filekey}}% - \let\@evenfoot\@oddfoot}% - \global\let\docincludeaux\relax - \gdef\@oddfoot{% - \expandafter\ifx\csname ver@\currentfile\endcsname\relax - File \thepart: {\ttfamily\currentfile} % - \else - \GetFileInfo{\currentfile}% - File \thepart: {\ttfamily\filename} % - Date: \filedate\ % - Version \fileversion - \fi - \hfill\thepage}% - \let\@evenfoot\@oddfoot}% -% \end{macrocode} -% \end{macro} -% -% -% \begin{macrocode} -\def\task#1#2{} -%</class> -% \end{macrocode} -% \Finale -% + \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 + } +} +\g@addto@macro\theindex{\MakePrivateLetters} +\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 + \msg_four_spaces: 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 + \msg_four_spaces: makeindex~-s~gglo.ist~~-o~\jobname.gls~\jobname.glo^^J + ========================================^^J + }} +} +\cs_new_nopar:Npn \includeltpatch { + \cs_set_nopar:Npn \currentfile {l3patch.ltx} + \part{l3patch} + {\cs_set_eq:NN \ttfamily\relax + \cs_gset_nopar:Npx \filekey{\filekey, \thepart={\ttfamily\currentfile}}} + Things~we~did~wrong\ldots + \IndexInput{l3patch.ltx}} +\cs_set_nopar:Npn \patchdate{0} +\begingroup + %%\cs_set_nopar:Npn \ProvidesFile#1\fmtversion#2{\date{#2}\endinput} + \cs_set_nopar:Npn \ProvidesFile#1[#2#3]{\date{#2}\endinput} + \input{l3vers.dtx} + \cs_gset_nopar:Npx \@date{\@date} + \cs_gset_eq:NN \X@date \@date + \cs_set:Npn \Xdef#1#2#3\def#4#5 { + \cs_gset_nopar:Npx \X@date{#2} + \cs_gset_nopar:Npx \patchdate{#5} + \endinput + } + \InputIfFileExists{l3patch.ltx}{ + \cs_set_eq:NN \cs_set_nopar:Npn \Xdef + }{ + \cs_gset_eq:NN \includeltpatch \relax + } +\endgroup +\ifx\@date\X@date + \cs_set_nopar:Npn \Xpatch{0} + \ifx\patchdate\Xpatch\else + \cs_set_nopar:Npx \@date {\@date\space Patch level \patchdate} + \fi +\else + \@warning{l3patch.ltx does not match l3vers.dtx!} + \cs_set_eq:NN \includeltpatch \relax +\fi +\bool_if:NTF \g_doc_full_bool { + \RecordChanges + \CodelineIndex + \EnableCrossrefs + \AlsoImplementation +}{ + \CodelineNumbered + \DisableCrossrefs + \OnlyDescription +} +\InputIfFileExists{l3doc.cfg}{ + \typeout{*************************************^^J + *~Local~config~file~l3doc.cfg~used ^^J + *************************************} +}{} +%% +%% +%% End of file `l3doc.cls'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3expan.sty b/Master/texmf-dist/tex/latex/expl3/l3expan.sty index 4e8ee86603e..c4929513b38 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3expan.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3expan.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3expan.dtx Copyright (C) 1990-2006 LaTeX3 project +%% File: l3expan.dtx Copyright (C) 1990-2009 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,171 +48,246 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3expan.dtx 735 2008-01-14 22:31:02Z morten $ +\GetIdInfo$Id: l3expan.dtx 1376 2009-06-01 17:01:30Z morten $ {L3 Experimental Argument Expansion module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3tlp} -\tlp_new:Nn\l_exp_tlp{} -\def_long_new:Npn\exp_arg_next:nnn#1#2#3{ +\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} } -\def_long_new:Npn\::n#1\:::#2#3{ +\cs_new:Npn\:::#1{#1} +\cs_new:Npn\::n#1\:::#2#3{ #1\:::{#2{#3}} } -\def_long_new:Npn\::N#1\:::#2#3{ +\cs_new:Npn\::N#1\:::#2#3{ #1\:::{#2#3} } -\def_long_new:Npn\::c#1\:::#2#3{ - \exp_after:NN\exp_arg_next:nnn\cs:w #3\cs_end:{#1}{#2} +\cs_new:Npn\::c#1\:::#2#3{ + \exp_after:wN\exp_arg_next_nobrace:nnn\cs:w #3\cs_end:{#1}{#2} } -\def_long_new:Npn\::o#1\:::#2#3{ - \exp_after:NN\exp_arg_next:nnn\exp_after:NN{\exp_after:NN{#3}}{#1}{#2} +\cs_new:Npn\::o#1\:::#2#3{ + \exp_after:wN\exp_arg_next:nnn\exp_after:wN{#3}{#1}{#2} } -\def_long_new:Npn\::f#1\:::#2#3{ - \exp_after:NN\exp_arg_next:nnn - \exp_after:NN{\exp_after:NN{\int_to_roman:w -`0 #3}} +\cs_new:Npn\::f#1\:::#2#3{ + \exp_after:wN\exp_arg_next:nnn + \exp_after:wN{\tex_romannumeral:D -`0 #3} {#1}{#2} } -\def_new:Npn \exp_stop_f: {~} -\let_new:NN \exp_arg:x \expanded % Move eventually. +\cs_new_nopar:Npn \exp_stop_f: {~} +\cs_new_eq:NN \exp_arg:x \expanded % Move eventually. \cs_if_free:NTF\exp_arg:x{ - \def_long_new:Npn\::x#1\:::#2#3{ - % \tlp_set:Nx\l_exp_tlp{{{#3}}} - \def:Npx \l_exp_tlp{{{#3}}} - \exp_after:NN\exp_arg_next:nnn\l_exp_tlp{#1}{#2}} + \cs_new: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}} } { - \def_long_new:Npn\::x#1\:::#2#3{ - \exp_after:NN\exp_arg_next:nnn - \exp_after:NN{\exp_arg:x{{#3}}}{#1}{#2} + \cs_new:Npn\::x#1\:::#2#3{ + \exp_after:wN\exp_arg_next:nnn + \exp_after:wN{\exp_arg:x{{#3}}}{#1}{#2} } } -\def_long_new:Npn\:::#1{#1} -\def_long_new:Npn\::C#1\:::#2#3{ - \exp_after:NN\exp_C_aux:nnn\cs:w #3\cs_end:{#1}{#2}} -\def_long_new:Npn\exp_C_aux:nnn #1{ - \exp_after:NN - \exp_arg_next:nnn - \exp_after:NN - { - \exp_after:NN - {#1} - } -} -\def_long_new:Npn\::E#1\:::#2#3{ - \exp_after:NN\exp_arg_next:nnn \exp_after:NN{#3}{#1}{#2} -} -\def_long_new:Npn\::e#1\:::#2#3{ - \exp_after:NN\exp_arg_next:nnn \exp_after:NN{#3}{#1}{#2} -} -\def_long_new:Npn\::d#1\:::#2#3{ - \exp_after:NN\exp_after:NN\exp_after:NN\exp_arg_next:nnn - \exp_after:NN\exp_after:NN\exp_after:NN{ - \exp_after:NN\exp_after:NN\exp_after:NN{#3}}{#1}{#2} -} -\let:NN \exp_args:NE \exp_after:NN -\def:Npn \exp_args:NNE #1{\exp_args:NE#1\exp_args:NE} -\def:Npn \exp_args:NNNE #1#2{\exp_args:NE#1\exp_args:NE#2\exp_args:NE} -\def:Npn \exp_args:NEE #1{\exp_args:NE\exp_args:NE\exp_args:NE#1\exp_args:NE} -\def:Npn \exp_args:NcE #1#2{\exp_after:NN #1\cs:w #2\exp_after:NN\cs_end:} -\def:Npn \exp_args:Nd {\::d\:::} -\def:Npn \exp_args:NNd {\::N\::d\:::} - -\def:Npn \exp_args:NC {\::C\:::} -\def:Npn \exp_args:NNC {\::N\::C\:::} -\def:Npn \exp_args:NNf {\::N\::f\:::} -\def:Npn \exp_args:NNno {\::N\::n\::o\:::} -\def:Npn \exp_args:NNnx {\::N\::n\::x\:::} % new -\def:Npn \exp_args:NNoo {\::N\::o\::o\:::} % new -\def:Npn \exp_args:NNox {\::N\::o\::x\:::} % new -\def:Npn \exp_args:NNx {\::N\::x\:::} -\def:Npn \exp_args:NcNc {\::c\::N\::c\:::} -\def:Npn \exp_args:NcNo {\::c\::N\::o\:::} -\def:Npn \exp_args:Ncco {\::c\::c\::o\:::} -\def:Npn \exp_args:Ncco {\::c\::c\::o\:::} -\def:Npn \exp_args:Nccx {\::c\::c\::x\:::} -\def:Npn \exp_args:Ncnx {\::c\::n\::x\:::} -\def:Npn \exp_args:Ncx {\::c\::x\:::} -\def:Npn \exp_args:Nf {\::f\:::} -\def:Npn \exp_args:Nfo{\::f\::o\:::} -\def:Npn \exp_args:Nnf {\::n\::f\:::} -\def:Npn \exp_args:NnnN {\::n\::n\::N\:::} %% Strange one this one... -\def:Npn \exp_args:Nnnc {\::n\::n\::c\:::} -\def:Npn \exp_args:Nnno {\::n\::n\::o\:::} -\def:Npn \exp_args:Nnnx {\::n\::n\::x\:::} -\def:Npn \exp_args:Nno {\::n\::o\:::} -\def:Npn \exp_args:Nnox {\::n\::o\::x\:::} -\def:Npn \exp_args:Nnx {\::n\::x\:::} -\def:Npn \exp_args:Noo {\::o\::o\:::} -\def:Npn \exp_args:Noox {\::o\::o\::x\:::} -\def:Npn \exp_args:Nox {\::o\::x\:::} -\def:Npn \exp_args:Nx {\::x\:::} -\def:Npn \exp_args:Nxo {\::x\::o\:::} -\def:Npn \exp_args:Nxx {\::x\::x\:::} -\def_long_new:Npn\exp_not:o#1{\exp_not:n\exp_after:NN{#1}} -\def_long_new:Npn\exp_not:d#1{ - \exp_not:n\exp_after:NN\exp_after:NN\exp_after:NN{#1} -} -\def_long_new:Npn\exp_not:f#1{ - \exp_not:n\exp_after:NN{\int_to_roman:w -`0 #1} -} -\def_new:Npn\exp_not:E{\exp_after:NN\exp_not:N} -\def_long_new:Npn\exp_not:c#1{\exp_after:NN\exp_not:N\cs:w#1\cs_end:} -\def_long_new:Npn \exp_args:No #1#2{\exp_after:NN#1\exp_after:NN{#2}} -\def_long_new:Npn \exp_args:NOo #1#2#3{\exp_after:NN\exp_args:No \exp_after:NN#1 - \exp_after:NN#2\exp_after:NN{#3}} -\def_long_new:Npn \exp_args:NOOo #1#2#3#4{\exp_after:NN\exp_args:NOo - \exp_after:NN#1\exp_after:NN#2\exp_after:NN#3\exp_after:NN{#4}} -\def_long_new:Npn \exp_args:NNo #1#2#3{\exp_after:NN#1\exp_after:NN#2 - \exp_after:NN{#3}} -\def_long_new:Npn \exp_args:NNO #1#2#3 {\exp_after:NN#1 - \exp_after:NN#2 #3} -\def_long_new:Npn \exp_args:NNOo #1#2#3#4{\exp_after:NN\exp_args:NNo - \exp_after:NN#1\exp_after:NN#2\exp_after:NN#3\exp_after:NN{#4}} -\def_long_new:Npn \exp_args:NNNo #1#2#3#4{\exp_after:NN#1\exp_after:NN#2 - \exp_after:NN#3\exp_after:NN{#4}} -\def_long_new:Npn \exp_args:Nc #1#2{\exp_after:NN#1\cs:w#2\cs_end:} -\def_long_new:Npn \exp_args:NNc #1#2#3{\exp_after:NN#1\exp_after:NN#2 +\cs_new:Npn \::V#1\:::#2#3{ + \exp_after:wN\exp_arg_next:nnn + \exp_after:wN{ + \tex_romannumeral:D -`0 + \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 -`0 + \exp_eval_register:c {#3} + } + {#1}{#2} +} +\cs_set_nopar:Npn \exp_eval_register:N #1{ + \exp_after:wN \if_meaning:w \exp_not:N #1#1 + \if_meaning:w \tex_relax:D #1 + \exp_eval_error_msg:w + \fi: + \else: + \exp_after:wN \use_i_ii:nnn + \fi: + \exp_after:wN \exp_stop_f: \tex_the:D #1 +} +\cs_set_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\tex_relax:D% +\tex_catcode:D`\ =11\tex_relax:D% +\cs_gset:Npn\exp_eval_error_msg:w#1\tex_the:D#2{% +\fi:\fi:\erroneous variable used!}% +\group_end:% +\cs_new:Npn\::d#1\:::#2#3{ + \exp_after:wN\exp_after:wN\exp_after:wN\exp_arg_next:nnn + \exp_after:wN\exp_after:wN\exp_after:wN{#3}{#1}{#2} +} +\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_set:Npn \exp_args:Nc #1#2{\exp_after:wN#1\cs:w#2\cs_end:} +\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:} -\def_long_new:Npn \exp_args:NOc#1#2#3{\exp_after:NN\exp_args:No\exp_after:NN - #1\exp_after:NN#2\cs:w#3\cs_end:} -\def_long_new:Npn \exp_args:Ncc #1#2#3{\exp_after:NN#1 - \cs:w#2\exp_after:NN\cs_end:\cs:w#3\cs_end:} -\def_long_new:Npn \exp_args:Nccc #1#2#3#4{\exp_after:NN#1 - \cs:w#2\exp_after:NN\cs_end:\cs:w#3\exp_after:NN +\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:} -\def_long_new:Npn \exp_args:Nco #1#2#3{\exp_after:NN#1\cs:w#2\exp_after:NN - \cs_end:\exp_after:NN{#3}} -\def:Npn\exp_def_form:nnn#1#2#3{ - \exp_after:NN - \def:Npn - \cs:w - #1:#3 - \exp_after:NN - \cs_end: - \exp_after:NN - { - \cs:w - exp_args:N#3 - \exp_after:NN - \cs_end: - \cs:w - #1:#2 - \cs_end: - } - \cs_if_free:cT - {exp_args:N#3} - {\def:cpx {exp_args:N#3} - {\exp_args_form_x:w #3 :} - } -} -\def_new:Npn\exp_args_form_x:w #1 { +\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_set_nopar:Npn \exp_args:Nd {\::d\:::} +\cs_set_nopar:Npn \exp_args:Nf {\::f\:::} +\cs_set_nopar:Npn \exp_args:Nv {\::v\:::} +\cs_set_nopar:Npn \exp_args:NV {\::V\:::} +\cs_set_nopar:Npn \exp_args:Nx {\::x\:::} +\cs_set_nopar:Npn \exp_args:NNd {\::N\::d\:::} +\cs_set_nopar:Npn \exp_args:NNf {\::N\::f\:::} +\cs_set_nopar:Npn \exp_args:NNv {\::N\::v\:::} +\cs_set_nopar:Npn \exp_args:NNV {\::N\::V\:::} +\cs_set_nopar:Npn \exp_args:NNx {\::N\::x\:::} + +\cs_set_nopar:Npn \exp_args:Ncx {\::c\::x\:::} +\cs_set_nopar:Npn \exp_args:Nfo {\::f\::o\:::} +\cs_set_nopar:Npn \exp_args:Nff {\::f\::f\:::} +\cs_set_nopar:Npn \exp_args:Ncf {\::c\::f\:::} +\cs_set_nopar:Npn \exp_args:Nnf {\::n\::f\:::} +\cs_set_nopar:Npn \exp_args:Nno {\::n\::o\:::} +\cs_set_nopar:Npn \exp_args:Nnx {\::n\::x\:::} + +\cs_set_nopar:Npn \exp_args:Noc {\::o\::c\:::} +\cs_set_nopar:Npn \exp_args:Noo {\::o\::o\:::} +\cs_set_nopar:Npn \exp_args:Nox {\::o\::x\:::} + +\cs_set_nopar:Npn \exp_args:NVV {\::V\::V\:::} + +\cs_set_nopar:Npn \exp_args:Nxo {\::x\::o\:::} +\cs_set_nopar:Npn \exp_args:Nxx {\::x\::x\:::} +\cs_set_nopar:Npn \exp_args:NNno {\::N\::n\::o\:::} +\cs_set_nopar:Npn \exp_args:NNnx {\::N\::n\::x\:::} +\cs_set_nopar:Npn \exp_args:NNoo {\::N\::o\::o\:::} +\cs_set_nopar:Npn \exp_args:NNox {\::N\::o\::x\:::} + +\cs_set_nopar:Npn \exp_args:Nnnc {\::n\::n\::c\:::} +\cs_set_nopar:Npn \exp_args:Nnno {\::n\::n\::o\:::} +\cs_set_nopar:Npn \exp_args:Nnnx {\::n\::n\::x\:::} +\cs_set_nopar:Npn \exp_args:Nnox {\::n\::o\::x\:::} + +\cs_set_nopar:Npn \exp_args:NcNc {\::c\::N\::c\:::} +\cs_set_nopar:Npn \exp_args:NcNo {\::c\::N\::o\:::} +\cs_set_nopar:Npn \exp_args:Ncco {\::c\::c\::o\:::} +\cs_set_nopar:Npn \exp_args:Ncco {\::c\::c\::o\:::} +\cs_set_nopar:Npn \exp_args:Nccx {\::c\::c\::x\:::} +\cs_set_nopar:Npn \exp_args:Ncnx {\::c\::n\::x\:::} + +\cs_set_nopar:Npn \exp_args:Noox {\::o\::o\::x\:::} +\cs_set_nopar:Npn \exp_args:Nooo {\::o\::o\::o\:::} +\cs_new:Npn\exp_not:o#1{\exp_not:n\exp_after:wN{#1}} +\cs_new:Npn\exp_not:d#1{ + \exp_not:n\exp_after:wN\exp_after:wN\exp_after:wN{#1} +} +\cs_new:Npn\exp_not:f#1{ + \exp_not:n\exp_after:wN{\tex_romannumeral:D -`0 #1} +} +\cs_new:Npn\exp_not:v#1{ + \exp_not:n\exp_after:wN{\tex_romannumeral:D -`0 \exp_eval_register:c {#1}} +} +\cs_new:Npn\exp_not:V#1{ + \exp_not:n\exp_after:wN{\tex_romannumeral:D -`0 \exp_eval_register:N #1} +} +\cs_new:Npn\exp_not:c#1{\exp_after:wN\exp_not:N\cs:w#1\cs_end:} +\cs_new:Npn \cs_generate_variant:Nn #1 { + \chk_if_exist_cs:N #1 + \cs_split_function:NN #1 \cs_generate_variant_aux:nnNn +} +\cs_set:Npn \cs_generate_variant_aux:nnNn #1#2#3#4{ + \cs_generate_variant_aux:nnw {#1}{#2} #4,?,\q_recursion_stop +} +\cs_set:Npn \cs_generate_variant_aux:nnw #1 #2 #3, { + \if:w ? #3 + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \fi: + \cs_if_free:cTF { + #1:#3\use:c {use_none:\cs_generate_variant_aux:N #3 ?}#2 + } + { + \cs_new_nopar:cpx { + #1:#3 \use:c{use_none:\cs_generate_variant_aux:N #3 ?}#2 + } + { + \exp_not:c { exp_args:N #3} \exp_not:c {#1:#2} + } + \cs_generate_internal_variant:n {#3} + } + { + \iow_log:x{ + Variant~\token_to_str:c { + #1:#3\use:c {use_none:\cs_generate_variant_aux:N #3 ?}#2 + }~already~defined;~ not~ changing~ it~on~line~ + \tex_the:D \tex_inputlineno:D + } + } + \cs_generate_variant_aux:nnw{#1}{#2} +} +\cs_set:Npn \cs_generate_variant_aux:N #1{ + \if:w ?#1 \exp_after:wN\use_none:nn \fi: n \cs_generate_variant_aux:N +} +\cs_new: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:NN #1 : - \else: - \exp_after:NN\exp_args_form_x:w - \fi:} + \if_meaning:w #1 : + \exp_after:wN \use_none:n + \fi: + \cs_generate_internal_variant_aux:n +} +\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 -`0 \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 -`0 \exp_eval_register:c {#2} + } {#1} +} +\cs_new_nopar:Npn \exp_last_unbraced:Nf { \::f_unbraced \::: } +\cs_new_nopar:Npn \exp_last_unbraced:NV { \::V_unbraced \::: } +\cs_new_nopar:Npn \exp_last_unbraced:Nv { \::v_unbraced \::: } +\cs_new_nopar:Npn \exp_last_unbraced:NcV { + \::c \::V_unbraced \::: +} +\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:NNV { + \::N \::V_unbraced \::: +} +\cs_new:Npn \exp_last_unbraced:NNNo #1#2#3#4 { + \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 #4 +} %% %% %% End of file `l3expan.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3file.sty b/Master/texmf-dist/tex/latex/expl3/l3file.sty new file mode 100644 index 00000000000..4e576422173 --- /dev/null +++ b/Master/texmf-dist/tex/latex/expl3/l3file.sty @@ -0,0 +1,161 @@ +%% +%% 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 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 LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\RequirePackage{l3names} +\GetIdInfo$Id: l3file.dtx 1352 2009-05-28 11:50:39Z morten $ + {L3 Experimental file loading} +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\package_check_loaded_expl: +\clist_new:N \g_file_record_clist +\clist_new:N \g_file_record_full_clist +\clist_new:N \l_file_search_path_clist +\ior_new:N \l_file_test_read_stream +\bool_new:N \l_file_tmp_bool +\tl_new:N \l_file_tmp_tl +\prg_new_conditional:Nnn \file_if_exist:n {p,TF,T,F} { + \ior_open:Nn \l_file_test_read_stream {#1} + \ior_if_eof:NTF \l_file_test_read_stream { + \file_if_exist_path:n {#1} + }{ + \ior_close:N \l_file_test_read_stream + \prg_return_true: + } +} +\cs_new_nopar:Nn \file_if_exist_path:n { + \bool_set_false:N \l_file_tmp_bool + \cs_set_nopar:Nn \file_if_exist_aux:n { + \ior_open:Nn \l_file_test_read_stream { #1 ##1 } + \ior_if_eof:NF \l_file_test_read_stream { + \bool_set_true:N \l_file_tmp_bool + \clist_map_break: + } + } + \cs_if_exist:NT \input@path { + \cs_set_eq:NN \l_file_search_path_clist \input@path + } + \clist_map_function:NN \l_file_search_path_clist \file_if_exist_aux:n + \ior_close:N \l_file_test_read_stream + \bool_if:NTF \l_file_tmp_bool { + \prg_return_true: + }{ + \prg_return_false: + } +} +\cs_new_nopar:Nn \file_if_exist_aux:n { } +\cs_new_nopar:Nn \file_add_path:nN { + \tl_clear:N #2 + \ior_open:Nn \l_file_test_read_stream {#1} + \ior_if_eof:NTF \l_file_test_read_stream { + \file_add_path_search:nN {#1} #2 + }{ + \tl_set:Nn #2 {#1} + } + \ior_close:N \l_file_test_read_stream +} +\cs_new_nopar:Nn \file_add_path_search:nN { + \cs_set_nopar:Nn \file_add_path_aux:n { + \ior_open:Nn \l_file_test_read_stream { ##1 #1 } + \ior_if_eof:NF \l_file_test_read_stream { + \tl_set:Nn #2 { ##1 #1 } + \clist_map_break: + } + } + \cs_if_exist:NT \input@path { + \cs_set_eq:NN \l_file_search_path_clist \input@path + } + \clist_map_function:NN \l_file_search_path_clist \file_add_path_aux:n +} +\cs_new_nopar:Nn \file_add_path_aux:n { } +\cs_new:Nn \file_input:n { + \file_add_path:nN {#1} \l_file_tmp_tl + \tl_if_empty:NF \l_file_tmp_tl { + \file_input_no_check:n \l_file_tmp_tl + } +} +\cs_new:Nn \file_input_no_record:n { + \file_add_path:nN {#1} \l_file_tmp_tl + \tl_if_empty:NF \l_file_tmp_tl { + \file_input_no_check_no_record:n \l_file_tmp_tl + } +} +\cs_new_nopar:Nn \file_input_no_check:n { + \clist_gput_right:Nx \g_file_record_clist {#1} + \wlog{ADDING: #1} + \@addtofilelist {#1} + \clist_gput_right:Nx \g_file_record_full_clist {#1} + \tex_input:D #1 ~ +} +\cs_new_nopar:Nn \file_input_no_check_no_record:n { + \clist_gput_right:Nx \g_file_record_full_clist {#1} + \tex_input:D #1 ~ +} +\cs_new_nopar:Nn \file_list: { + \file_list:N \g_file_record_clist +} +\cs_new_nopar:Nn \file_list_full: { + \file_list:N \g_file_record_full_clist +} +\cs_new_nopar:Nn \file_list:N { + \clist_remove_duplicates:N #1 + \iow_log:x { *~File~List~* } + \clist_map_function:NN #1 \file_list_aux:n + \iow_log:x { ************* } +} +\cs_new_nopar:Nn \file_list_aux:n { + \iow_log:x { #1 } +} +\AtBeginDocument{ + \clist_put_right:NV \g_file_record_clist \@filelist + \clist_put_right:NV \g_file_record_full_clist \@filelist +} +%% +%% +%% End of file `l3file.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3int.sty b/Master/texmf-dist/tex/latex/expl3/l3int.sty index 7c9ea287861..3ab5772e28a 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3int.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3int.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3int.dtx Copyright (C) 1990-2008 LaTeX3 project +%% File: l3int.dtx Copyright (C) 1990-2009 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,68 +48,72 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 738 2008-08-01 13:21:42Z morten $ +\GetIdInfo$Id: l3int.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental Integer module} - \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3num} -\let_new:NN \int_to_roman:w \tex_romannumeral:D -\let_new:NN \int_to_number:w \tex_number:D -\let_new:NN \int_advance:w \tex_advance:D -\def_new:Npn \int_incr:N #1{\int_advance:w#1\c_one +\package_check_loaded_expl: +\cs_new_eq:NN \int_to_roman:w \tex_romannumeral:D +\cs_new_eq:NN \int_to_number:w \tex_number:D +\cs_new_eq:NN \int_advance:w \tex_advance:D +\cs_new_nopar:Npn \int_new:N #1 { + \chk_if_free_cs:N #1 + \newcount #1 +} +\cs_generate_variant:Nn \int_new:N {c} +\cs_new_nopar:Npn \int_set:Nn #1#2{#1 \intexpr_eval:w #2\intexpr_eval_end: +} +\cs_new_nopar:Npn \int_gset:Nn { + \pref_global:D + \int_set:Nn } +\cs_generate_variant:Nn\int_set:Nn {cn} +\cs_generate_variant:Nn\int_gset:Nn {cn} +\cs_new_nopar:Npn \int_incr:N #1{\int_advance:w#1\c_one } -\def_new:Npn \int_decr:N #1{\int_advance:w#1\c_minus_one +\cs_new_nopar:Npn \int_decr:N #1{\int_advance:w#1\c_minus_one } -\def_new:Npn \int_gincr:N { +\cs_new_nopar:Npn \int_gincr:N { \pref_global:D \int_incr:N} -\def_new:Npn \int_gdecr:N { +\cs_new_nopar:Npn \int_gdecr:N { \pref_global:D \int_decr:N} -\def:Npn \int_incr:N #1{\int_add:Nn#1\c_one} -\def:Npn \int_decr:N #1{\int_add:Nn#1\c_minus_one} -\def:Npn \int_gincr:N #1{\int_gadd:Nn#1\c_one} -\def:Npn \int_gdecr:N #1{\int_gadd:Nn#1\c_minus_one} -\def:Npn \int_incr:c {\exp_args:Nc\int_incr:N} -\def:Npn \int_decr:c {\exp_args:Nc\int_decr:N} -\def:Npn \int_gincr:c {\exp_args:Nc\int_gincr:N} -\def:Npn \int_gdecr:c {\exp_args:Nc\int_gdecr:N} -\let:NN \int_new:N \newcount% allocation better nick the LaTeX one... -\def_new:Npn \int_new:c {\exp_args:Nc \int_new:N} -\def_new:Npn \int_set:Nn #1#2{#1 \int_eval:w #2\int_eval_end: -} -\def_new:Npn \int_gset:Nn { - \pref_global:D - \int_set:Nn } -\def_new:Npn \int_set:cn {\exp_args:Nc \int_set:Nn } -\def_new:Npn \int_gset:cn {\exp_args:Nc \int_gset:Nn } -\def_new:Npn \int_zero:N #1 {#1=\c_zero} -\def_new:Npn \int_zero:c #1 {\exp_args:Nc \int_zero:N} -\def_new:Npn \int_gzero:N #1 {\pref_global:D #1=\c_zero} -\def_new:Npn \int_gzero:c {\exp_args:Nc \int_gzero:N} -\def_new:Npn \int_add:Nn #1#2{ - \int_advance:w #1 by \int_eval:w #2\int_eval_end: -} -\def_new:Npn\int_add:cn{\exp_args:Nc\int_add:Nn} -\def_new:Npn \int_sub:Nn #1#2{ - \int_advance:w #1-\int_eval:w #2\int_eval_end: -} -\def_new:Npn \int_gadd:Nn { +\cs_set_nopar:Npn \int_incr:N #1{\int_add:Nn#1\c_one} +\cs_set_nopar:Npn \int_decr:N #1{\int_add:Nn#1\c_minus_one} +\cs_set_nopar:Npn \int_gincr:N #1{\int_gadd:Nn#1\c_one} +\cs_set_nopar:Npn \int_gdecr:N #1{\int_gadd:Nn#1\c_minus_one} +\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_nopar:Npn \int_zero:N #1 {#1=\c_zero} +\cs_generate_variant:Nn \int_zero:N {c} +\cs_new_nopar:Npn \int_gzero:N #1 {\pref_global:D #1=\c_zero} +\cs_generate_variant:Nn \int_gzero:N {c} +\cs_new_nopar:Npn \int_add:Nn #1#2{ + \int_advance:w #1 by \intexpr_eval:w #2\intexpr_eval_end: +} +\cs_new_nopar:Npn \int_sub:Nn #1#2{ + \int_advance:w #1-\intexpr_eval:w #2\intexpr_eval_end: +} +\cs_new_nopar:Npn \int_gadd:Nn { \pref_global:D \int_add:Nn } -\def_new:Npn \int_gsub:Nn { +\cs_new_nopar:Npn \int_gsub:Nn { \pref_global:D \int_sub:Nn } -\def_new:Npn \int_gadd:cn{\exp_args:Nc\int_gadd:Nn} -\def_new:Npn \int_sub:cn{\exp_args:Nc\int_sub:Nn} -\def_new:Npn \int_gsub:cn{\exp_args:Nc\int_gsub:Nn} -\let_new:NN \int_use:N \tex_the:D -\def_new:Npn \int_use:c #1{\int_use:N \cs:w#1\cs_end:} -\def_new:Npn \int_to_arabic:n #1{\int_to_number:w \int_eval:n{#1}} -\def_new:Npn \int_roman_lcuc_mapping:Nnn #1#2#3{ - \def:cpn {int_to_lc_roman_#1:}{#2} - \def:cpn {int_to_uc_roman_#1:}{#3} +\cs_generate_variant:Nn \int_add:Nn {cn} +\cs_generate_variant:Nn \int_gadd:Nn {cn} +\cs_generate_variant:Nn \int_sub:Nn {cn} +\cs_generate_variant:Nn \int_gsub:Nn {cn} +\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:} +\cs_new_eq:NN \int_show:N \tex_showthe:D +\cs_new_nopar:Npn \int_show:c {\exp_args:Nc \int_show:N } +\cs_new_nopar:Npn \int_to_arabic:n #1{ \intexpr_eval:n{#1}} +\cs_new_nopar:Npn \int_roman_lcuc_mapping:Nnn #1#2#3{ + \cs_set_nopar:cpn {int_to_lc_roman_#1:}{#2} + \cs_set_nopar:cpn {int_to_uc_roman_#1:}{#3} } \int_roman_lcuc_mapping:Nnn i i I \int_roman_lcuc_mapping:Nnn v v V @@ -119,29 +123,29 @@ \int_roman_lcuc_mapping:Nnn d d D \int_roman_lcuc_mapping:Nnn m m M \int_roman_lcuc_mapping:Nnn Q \use_none:nn \use_none:nn -\def_new:Npn \int_to_roman:n #1 { - \exp_after:NN \int_to_roman_lcuc:NN \exp_after:NN l - \int_to_roman:w \int_eval:n {#1} Q +\cs_new_nopar:Npn \int_to_roman:n #1 { + \exp_after:wN \int_to_roman_lcuc:NN \exp_after:wN l + \int_to_roman:w \intexpr_eval:n {#1} Q } -\def_new:Npn \int_to_Roman:n #1 { - \exp_after:NN \int_to_roman_lcuc:NN \exp_after:NN u - \int_to_roman:w \int_eval:n {#1} Q +\cs_new_nopar:Npn \int_to_Roman:n #1 { + \exp_after:wN \int_to_roman_lcuc:NN \exp_after:wN u + \int_to_roman:w \intexpr_eval:n {#1} Q } -\def_new:Npn \int_to_roman_lcuc:NN #1#2{ - \cs_use:c {int_to_#1c_roman_#2:} +\cs_new_nopar:Npn \int_to_roman_lcuc:NN #1#2{ + \use:c {int_to_#1c_roman_#2:} \int_to_roman_lcuc:NN #1 } -\def:Npn \int_convert_number_with_rule:nnN #1#2#3{ - \int_compare:nNnTF {#1}>{#2} +\cs_set_nopar:Npn \int_convert_number_with_rule:nnN #1#2#3{ + \intexpr_compare:nNnTF {#1}>{#2} { - \exp_args:No \int_convert_number_with_rule:nnN - { \int_use:N\int_div_truncate:nn {#1-1}{#2} }{#2} + \exp_args:Nf \int_convert_number_with_rule:nnN + { \intexpr_div_truncate:nn {#1-1}{#2} }{#2} #3 - \exp_args:No #3 { \int_use:N\int_eval:n{1+\int_mod:nn {#1-1}{#2}} } + \exp_args:Nf #3 { \intexpr_eval:n{1+\intexpr_mod:nn {#1-1}{#2}} } } - { \exp_args:No #3{ \int_use:N\int_eval:n{#1} } } + { \exp_args:Nf #3{ \intexpr_eval:n{#1} } } } -\def_new:Npn \int_alph_default_conversion_rule:n #1{ +\cs_new_nopar:Npn \int_alph_default_conversion_rule:n #1{ \if_case:w #1 \or: a\or: b\or: c\or: d\or: e\or: f \or: g\or: h\or: i\or: j\or: k\or: l @@ -150,7 +154,7 @@ \or: y\or: z \fi: } -\def_new:Npn \int_Alph_default_conversion_rule:n #1{ +\cs_new_nopar:Npn \int_Alph_default_conversion_rule:n #1{ \if_case:w #1 \or: A\or: B\or: C\or: D\or: E\or: F \or: G\or: H\or: I\or: J\or: K\or: L @@ -159,15 +163,15 @@ \or: Y\or: Z \fi: } -\def_new:Npn \int_to_alph:n #1{ +\cs_new_nopar:Npn \int_to_alph:n #1{ \int_convert_number_with_rule:nnN {#1}{26} \int_alph_default_conversion_rule:n } -\def_new:Npn \int_to_Alph:n #1{ +\cs_new_nopar:Npn \int_to_Alph:n #1{ \int_convert_number_with_rule:nnN {#1}{26} \int_Alph_default_conversion_rule:n } -\def_new:Npn \int_to_symbol:n #1{ +\cs_new_nopar:Npn \int_to_symbol:n #1{ \mode_if_math:TF { \int_convert_number_with_rule:nnN {#1}{9} @@ -178,7 +182,7 @@ \int_symbol_text_conversion_rule:n } } -\def_new:Npn \int_symbol_math_conversion_rule:n #1 { +\cs_new_nopar:Npn \int_symbol_math_conversion_rule:n #1 { \if_case:w #1 \or: * \or: \dagger @@ -191,7 +195,7 @@ \or: \ddagger\ddagger \fi: } -\def_new:Npn \int_symbol_text_conversion_rule:n #1 { +\cs_new_nopar:Npn \int_symbol_text_conversion_rule:n #1 { \if_case:w #1 \or: \textasteriskcentered \or: \textdagger @@ -209,175 +213,139 @@ \int_new:N \l_tmpc_int \int_new:N \g_tmpa_int \int_new:N \g_tmpb_int -\int_new:N \l_loop_int % a variable for use in loops (whilenum etc) -\let_new:NN \int_eval:n \num_eval:n -\let_new:NN \int_eval:w \num_eval:w -\let_new:NN \int_eval_end: \num_eval_end: -\const_new:Nn \c_max_int {2147483647} -\def:Npn \int_pre_eval_one_arg:Nnn #1#2{\exp_args:No#1{\int_eval:w#2}} -\def:Npn \int_pre_eval_two_args:Nnn #1#2#3{ - \exp_args:Noo#1{\int_use:N\int_eval:w#2}{\int_use:N\int_eval:w#3} -} -\def_new:Npn \int_div_truncate:nn { - \int_pre_eval_two_args:Nnn\int_div_truncate_raw:nn -} -\def_new:Npn \int_div_truncate_raw:nn #1#2 { - \int_eval:w - \if_num:w \int_eval:w#1 = \c_zero - 0 - \else: - (#1 - \if_num:w \int_eval:w #1 < \c_zero - \if_num:w \int_eval:w#2 < \c_zero - -( #2 + - \else: - +( #2 - - \fi: - \else: - \if_num:w \int_eval:w #2 < \c_zero - +( #2 + - \else: - -( #2 - - \fi: - \fi: - 1)/2) - \fi: - /(#2) - \int_eval_end: -} -\def_new:Npn \int_div_round:nn { - \int_pre_eval_two_args:Nnn\int_div_round_raw:nn -} -\def_new:Npn \int_div_round_raw:nn #1#2 {\int_eval:n{#1/#2}} -\def_new:Npn \int_mod:nn {\int_pre_eval_two_args:Nnn\int_mod_raw:nn} -\def_new:Npn \int_mod_raw:nn #1#2 { - \int_eval:n{ #1 - \int_div_truncate_raw:nn {#1}{#2} * #2 } -} -\let_new:NN \int_compare:nNnTF \num_compare:nNnTF -\let_new:NN \int_compare:nNnT \num_compare:nNnT -\let_new:NN \int_compare:nNnF \num_compare:nNnF -\let_new:NN \int_max_of:nn \num_max_of:nn -\let_new:NN \int_min_of:nn \num_min_of:nn -\let_new:NN \int_abs:nn \num_abs:nn -\let_new:NN \int_compare_p:nNn \num_compare_p:nNn -\def_new:Npn \int_if_odd_p:n #1 { - \if_num_odd:w \int_eval:n{#1} - \c_true - \else: - \c_false - \fi: -} -\def_test_function_new:npn {int_if_odd:n}#1{\if_num_odd:w \int_eval:n{#1}} -\def_long_new:Npn \int_whiledo:nNnT #1#2#3#4{ - \int_compare:nNnT {#1}#2{#3}{#4 \int_whiledo:nNnT {#1}#2{#3}{#4}} -} -\def_long_new:Npn \int_whiledo:nNnF #1#2#3#4{ - \int_compare:nNnF {#1}#2{#3}{#4 \int_whiledo:nNnF {#1}#2{#3}{#4}} -} -\def_long_new:Npn \int_dowhile:nNnT #1#2#3#4{ - #4 \int_compare:nNnT {#1}#2{#3}{\int_dowhile:nNnT {#1}#2{#3}{#4}} -} -\def_long_new:Npn \int_dowhile:nNnF #1#2#3#4{ - #4 \int_compare:nNnF {#1}#2{#3}{\int_dowhile:nNnF {#1}#2{#3}{#4}} -} -\def_new:Npn \int_get_sign_and_digits:n #1{ - \int_get_sign_and_digits_aux:nNNN {#1} \c_true \c_true \c_true -} -\def_new:Npn \int_get_sign:n #1{ - \int_get_sign_and_digits_aux:nNNN {#1} \c_true \c_true \c_false -} -\def_new:Npn \int_get_digits:n #1{ - \int_get_sign_and_digits_aux:nNNN {#1} \c_true \c_false \c_true +\cs_set_nopar:Npn \int_pre_eval_one_arg:Nn #1#2{ + \exp_args:Nf#1{\intexpr_eval:n{#2}}} +\cs_set_nopar:Npn \int_pre_eval_two_args:Nnn #1#2#3{ + \exp_args:Nff#1{\intexpr_eval:n{#2}}{\intexpr_eval:n{#3}} +} +\cs_new_nopar:Npn \int_const:Nn #1#2 { + \intexpr_compare:nNnTF {#2} > \c_minus_one { + \intexpr_compare:nNnTF {#2} > \c_max_register_num { + \int_new:N #1 \int_set:Nn #1{#2} + } { + \chk_if_free_cs:N #1 \tex_mathchardef:D #1 = \intexpr_eval:n{#2} + } + } { + \int_new:N #1 \int_set:Nn #1{#2} + } } -\def_new:Npn \int_get_sign_and_digits_aux:nNNN #1#2#3#4{ - \tlist_if_head_eq_charcode:fNTF {#1} - + %% \tex_countdef:D \c_minus_one = 10 \scan_stop: + %% \c_minus_one = -1 \scan_stop: %% in l3basics +\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_six {6} +\int_const:Nn \c_seven {7} +\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_twelve {12} +\int_const:Nn \c_thirteen {13} +\int_const:Nn \c_fourteen {14} +\int_const:Nn \c_fifteen {15} + %% \tex_chardef:D \c_sixteen = 16\scan_stop: %% in l3basics +\int_const:Nn \c_thirty_two {32} +\int_const:Nn \c_hundred_one {101} +\int_const:Nn \c_twohundred_fifty_five{255} +\int_const:Nn \c_twohundred_fifty_six {256} +\int_const:Nn \c_thousand {1000} +\int_const:Nn \c_ten_thousand {10000} +\int_const:Nn \c_ten_thousand_one {10001} +\int_const:Nn \c_ten_thousand_two {10002} +\int_const:Nn \c_ten_thousand_three {10003} +\int_const:Nn \c_ten_thousand_four {10004} +\int_const:Nn \c_twenty_thousand {20000} +\int_const:Nn \c_max_int {2147483647} +\cs_new_nopar:Npn \int_get_sign_and_digits:n #1{ + \int_get_sign_and_digits_aux:nNNN {#1} \c_true_bool \c_true_bool \c_true_bool +} +\cs_new_nopar: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_nopar: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_nopar: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 #3#4 } - { \int_get_sign_and_digits_aux:oNNN {\use_none:n #1} \c_true #3#4 } + { \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 } } { - \tlist_if_head_eq_charcode:fNTF {#1} + + \tl_if_head_eq_charcode:fNTF {#1} + { \int_get_sign_and_digits_aux:oNNN {\use_none:n #1} #2#3#4} { - \bool_double_if:NNnnnn #3#4 - { \bool_if:NF #2 - #1 } - { \bool_if:NF #2 - } - { #1 } { } + \bool_if:NT #3 { \bool_if:NF #2 - } + \bool_if:NT #4 {#1} } } } -\def_new:Npn \int_get_sign_and_digits_aux:oNNN{ - \exp_args:No\int_get_sign_and_digits_aux:nNNN -} -\def:Npn \int_convert_from_base_ten:nn#1#2{ - \num_compare:nNnTF {#1}<\c_zero +\cs_generate_variant:Nn \int_get_sign_and_digits_aux:nNNN {oNNN} +\cs_set_nopar:Npn \int_convert_from_base_ten:nn#1#2{ + \intexpr_compare:nNnTF {#1}<\c_zero { - - \int_convert_from_base_ten_aux:non {} - { \int_use:N \int_eval:n {-#1} } + - \int_convert_from_base_ten_aux:nfn {} + { \intexpr_eval:n {-#1} } } { - \int_convert_from_base_ten_aux:non {} - { \int_use:N \int_eval:n {#1} } + \int_convert_from_base_ten_aux:nfn {} + { \intexpr_eval:n {#1} } } {#2} } -\def_new:Npn \int_convert_from_base_ten_aux:nnn#1#2#3{ - \num_compare:nNnTF {#2}<{#3} +\cs_new_nopar:Npn \int_convert_from_base_ten_aux:nnn#1#2#3{ + \intexpr_compare:nNnTF {#2}<{#3} { \int_convert_number_to_letter:n{#2} #1 } { - \int_convert_from_base_ten_aux:fon + \int_convert_from_base_ten_aux:ffn { - \int_convert_number_to_letter:n {\int_use:N\int_mod_raw:nn {#2}{#3}} + \int_convert_number_to_letter:n {\intexpr_mod:nn {#2}{#3}} #1 } - {\int_use:N \int_div_truncate_raw:nn{#2}{#3}} + { \intexpr_div_truncate:nn{#2}{#3}} {#3} } } -\def:Npn \int_convert_from_base_ten_aux:non{ - \exp_args:Nno\int_convert_from_base_ten_aux:nnn -} -\def:Npn \int_convert_from_base_ten_aux:fon{ - \exp_args:Nfo\int_convert_from_base_ten_aux:nnn -} -\def:Npn \int_convert_number_to_letter:n #1{ \if_case:w \int_eval:w - #1-10\scan_stop: \exp_after:NN A \or: \exp_after:NN B \or: - \exp_after:NN C \or: \exp_after:NN D \or: \exp_after:NN E \or: - \exp_after:NN F \or: \exp_after:NN G \or: \exp_after:NN H \or: - \exp_after:NN I \or: \exp_after:NN J \or: \exp_after:NN K \or: - \exp_after:NN L \or: \exp_after:NN M \or: \exp_after:NN N \or: - \exp_after:NN O \or: \exp_after:NN P \or: \exp_after:NN Q \or: - \exp_after:NN R \or: \exp_after:NN S \or: \exp_after:NN T \or: - \exp_after:NN U \or: \exp_after:NN V \or: \exp_after:NN W \or: - \exp_after:NN X \or: \exp_after:NN Y \or: \exp_after:NN Z \else: - \use_arg_i_after_fi:nw{ #1 }\fi: } -\def:Npn \int_convert_to_base_ten:nn #1#2 { - \int_use:N\int_eval:n{ +\cs_generate_variant:Nn \int_convert_from_base_ten_aux:nnn {nfn} +\cs_generate_variant:Nn \int_convert_from_base_ten_aux:nnn {ffn} +\cs_set_nopar:Npn \int_convert_number_to_letter:n #1{ + \if_case:w \intexpr_eval:w #1-10\intexpr_eval_end: + \exp_after:wN A \or: \exp_after:wN B \or: + \exp_after:wN C \or: \exp_after:wN D \or: \exp_after:wN E \or: + \exp_after:wN F \or: \exp_after:wN G \or: \exp_after:wN H \or: + \exp_after:wN I \or: \exp_after:wN J \or: \exp_after:wN K \or: + \exp_after:wN L \or: \exp_after:wN M \or: \exp_after:wN N \or: + \exp_after:wN O \or: \exp_after:wN P \or: \exp_after:wN Q \or: + \exp_after:wN R \or: \exp_after:wN S \or: \exp_after:wN T \or: + \exp_after:wN U \or: \exp_after:wN V \or: \exp_after:wN W \or: + \exp_after:wN X \or: \exp_after:wN Y \or: \exp_after:wN Z \else: + \use_i_after_fi:nw{ #1 }\fi: } +\cs_set_nopar:Npn \int_convert_to_base_ten:nn #1#2 { + \intexpr_eval:n{ \int_get_sign:n{#1} \exp_args:Nf\int_convert_to_base_ten_aux:nn {\int_get_digits:n{#1}}{#2} } } -\def_new:Npn \int_convert_to_base_ten_aux:nn #1#2{ +\cs_new_nopar:Npn \int_convert_to_base_ten_aux:nn #1#2{ \int_convert_to_base_ten_auxi:nnN {0}{#2} #1 \q_nil } -\def_new:Npn \int_convert_to_base_ten_auxi:nnN#1#2#3{ +\cs_new_nopar:Npn \int_convert_to_base_ten_auxi:nnN#1#2#3{ \quark_if_nil:NTF #3 {#1} - {\exp_args:No\int_convert_to_base_ten_auxi:nnN - {\int_use:N \int_eval:n{ #1*#2+\int_convert_letter_to_number:N #3} } + {\exp_args:Nf\int_convert_to_base_ten_auxi:nnN + {\intexpr_eval:n{ #1*#2+\int_convert_letter_to_number:N #3} } {#2} } } -\def:Npn \int_convert_letter_to_number:N #1{ - \int_compare:nNnTF{`#1}<{58}{#1} +\cs_set_nopar:Npn \int_convert_letter_to_number:N #1{ + \intexpr_compare:nNnTF{`#1}<{58}{#1} { - \int_eval:n{ `#1 - - \if:w\int_compare_p:nNn{`#1}<{91} - 55 - \else: - 87 - \fi: + \intexpr_eval:n{ `#1 - + \intexpr_compare:nNnTF{`#1}<{91}{ 55 }{ 87 } } } } diff --git a/Master/texmf-dist/tex/latex/expl3/l3intexpr.sty b/Master/texmf-dist/tex/latex/expl3/l3intexpr.sty new file mode 100644 index 00000000000..91d7d2daeb0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/expl3/l3intexpr.sty @@ -0,0 +1,203 @@ +%% +%% This is file `l3intexpr.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3intexpr.dtx (with options: `package,trace') +%% +%% +%% 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: l3intexpr.dtx Copyright (C) 2009 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 LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3intexpr.dtx 1086 2009-03-20 19:29:35Z morten $ + {L3 Integer Expressions} +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\package_check_loaded_expl: +\cs_set_eq:NN \intexpr_value:w \tex_number:D +\cs_set_eq:NN \intexpr_eval:w \etex_numexpr:D +\cs_set_protected:Npn \intexpr_eval_end: {\tex_relax:D} +\cs_set_eq:NN \if_intexpr_compare:w \tex_ifnum:D +\cs_set_eq:NN \if_intexpr_odd:w \tex_ifodd:D +\cs_set_eq:NN \if_intexpr_case:w \tex_ifcase:D +\cs_set:Npn \intexpr_eval:n #1{ + \intexpr_value:w \intexpr_eval:w #1\intexpr_eval_end: +} +\prg_set_conditional:Npnn \intexpr_compare:n #1{p,TF,T,F}{ + \exp_after:wN \intexpr_compare_auxi:w \intexpr_value:w + \intexpr_eval:w #1\q_stop +} +\cs_set:Npn \intexpr_compare_auxi:w #1#2\q_stop{ + \exp_after:wN \intexpr_compare_auxii:w \tex_romannumeral:D + \if:w #1- \else: -\fi: #1#2 \q_stop #1#2 \q_nil +} +\cs_set:Npn \intexpr_compare_auxii:w #1#2#3\q_stop{ + \use:c{ + intexpr_compare_ + #1 \if_meaning:w =#2 = \fi: + :w} +} +\cs_set:cpn {intexpr_compare_=:w} #1=#2\q_nil{ + \if_intexpr_compare:w #1=\intexpr_eval:w #2 \intexpr_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set:cpn {intexpr_compare_==:w} #1==#2\q_nil{ + \if_intexpr_compare:w #1=\intexpr_eval:w #2 \intexpr_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set:cpn {intexpr_compare_!=:w} #1!=#2\q_nil{ + \if_intexpr_compare:w #1=\intexpr_eval:w #2 \intexpr_eval_end: + \prg_return_false: \else: \prg_return_true: \fi: +} +\cs_set:cpn {intexpr_compare_<:w} #1<#2\q_nil{ + \if_intexpr_compare:w #1<\intexpr_eval:w #2 \intexpr_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set:cpn {intexpr_compare_>:w} #1>#2\q_nil{ + \if_intexpr_compare:w #1>\intexpr_eval:w #2 \intexpr_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set:cpn {intexpr_compare_<=:w} #1<=#2\q_nil{ + \if_intexpr_compare:w #1<\intexpr_eval:w #2 +\c_one \intexpr_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set:cpn {intexpr_compare_>=:w} #1>=#2\q_nil{ + \if_intexpr_compare:w #1>\intexpr_eval:w #2 - \c_one \intexpr_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\prg_set_conditional:Npnn \intexpr_compare:nNn #1#2#3{p,TF,T,F}{ + \if_intexpr_compare:w \intexpr_eval:w #1 #2 \intexpr_eval:w #3 \intexpr_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set:Npn \intexpr_abs:n #1{ + \intexpr_value:w + \if_intexpr_compare:w \intexpr_eval:w #1<\c_zero + - + \fi: + \intexpr_eval:w #1\intexpr_eval_end: +} +\cs_set:Npn \intexpr_max:nn #1#2{ + \intexpr_value:w \intexpr_eval:w + \if_intexpr_compare:w + \intexpr_eval:w #1>\intexpr_eval:w #2\intexpr_eval_end: + #1 + \else: + #2 + \fi: + \intexpr_eval_end: +} +\cs_set:Npn \intexpr_min:nn #1#2{ + \intexpr_value:w \intexpr_eval:w + \if_intexpr_compare:w + \intexpr_eval:w #1<\intexpr_eval:w #2\intexpr_eval_end: + #1 + \else: + #2 + \fi: + \intexpr_eval_end: +} +\cs_set:Npn \intexpr_div_truncate:nn #1#2 { + \intexpr_value:w \intexpr_eval:w + \if_intexpr_compare:w \intexpr_eval:w #1 = \c_zero + 0 + \else: + (#1 + \if_intexpr_compare:w \intexpr_eval:w #1 < \c_zero + \if_intexpr_compare:w \intexpr_eval:w #2 < \c_zero + -( #2 + + \else: + +( #2 - + \fi: + \else: + \if_intexpr_compare:w \intexpr_eval:w #2 < \c_zero + +( #2 + + \else: + -( #2 - + \fi: + \fi: + 1)/2) + \fi: + /(#2) + \intexpr_eval_end: +} +\cs_set:Npn \intexpr_div_round:nn #1#2 {\intexpr_eval:n{(#1)/(#2)}} +\cs_set:Npn \intexpr_mod:nn #1#2 { + \intexpr_value:w + \intexpr_eval:w + #1 - \intexpr_div_truncate:nn {#1}{#2} * (#2) + \intexpr_eval_end: +} +\prg_set_conditional:Npnn \intexpr_if_odd:n #1 {p,TF,T,F} { + \if_intexpr_odd:w \intexpr_eval:w #1\intexpr_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\prg_set_conditional:Npnn \intexpr_if_even:n #1 {p,TF,T,F} { + \if_intexpr_odd:w \intexpr_eval:w #1\intexpr_eval_end: + \prg_return_false: \else: \prg_return_true: \fi: +} +\cs_set:Npn \intexpr_while_do:nn #1#2{ + \intexpr_compare:nT {#1}{#2 \intexpr_while_do:nn {#1}{#2}} +} +\cs_set:Npn \intexpr_until_do:nn #1#2{ + \intexpr_compare:nF {#1}{#2 \intexpr_until_do:nn {#1}{#2}} +} +\cs_set:Npn \intexpr_do_while:nn #1#2{ + #2 \intexpr_compare:nT {#1}{\intexpr_do_while:nNnn {#1}{#2}} +} +\cs_set:Npn \intexpr_do_until:nn #1#2{ + #2 \intexpr_compare:nF {#1}{\intexpr_do_until:nn {#1}{#2}} +} +\cs_set:Npn \intexpr_while_do:nNnn #1#2#3#4{ + \intexpr_compare:nNnT {#1}#2{#3}{#4 \intexpr_while_do:nNnn {#1}#2{#3}{#4}} +} +\cs_set:Npn \intexpr_until_do:nNnn #1#2#3#4{ + \intexpr_compare:nNnF {#1}#2{#3}{#4 \intexpr_until_do:nNnn {#1}#2{#3}{#4}} +} +\cs_set:Npn \intexpr_do_while:nNnn #1#2#3#4{ + #4 \intexpr_compare:nNnT {#1}#2{#3}{\intexpr_do_while:nNnn {#1}#2{#3}{#4}} +} +\cs_set:Npn \intexpr_do_until:nNnn #1#2#3#4{ + #4 \intexpr_compare:nNnF {#1}#2{#3}{\intexpr_do_until:nNnn {#1}#2{#3}{#4}} +} +%% +%% +%% End of file `l3intexpr.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3io.sty b/Master/texmf-dist/tex/latex/expl3/l3io.sty index 608c6b7c624..5ea97d6b61a 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3io.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3io.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3io.dtx Copyright (C) 1990-2006 LaTeX3 project +%% File: l3io.dtx Copyright (C) 1990-2009 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,59 +48,73 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3io.dtx 621 2007-09-01 20:14:19Z morten $ +\GetIdInfo$Id: l3io.dtx 1369 2009-05-31 21:36:35Z joseph $ {L3 Experimental i/o module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3toks}\par -\let:NN \iow_new:N \newwrite -\def_new:Npn \iow_new:c {\exp_args:Nc \iow_new:N} -\def_new:Npn \iow_open:Nn #1#2{\iow_close:N #1 - \tex_immediate:D\tex_openout:D#1#2\scan_stop:} -\def_new:Npn \iow_open:cn {\exp_args:Nc \iow_open:Nn} -\def_new:Npn \iow_close:N {\tex_immediate:D\tex_closeout:D} -\let_new:NN \c_io_term_stream \c_sixteen -\let_new:NN \c_iow_log_stream \c_minus_one -\def_new:Npn \iow_expanded:Nn {\tex_immediate:D\iow_deferred_expanded:Nn} -\def_new:Npn \iow_unexpanded:Nn #1#2{ - \iow_expanded:Nn #1{\exp_not:n{#2}}} -\def:Npn \iow_expanded_log:n {\iow_expanded:Nn \c_iow_log_stream} -\def:Npn \iow_expanded_term:n{\iow_expanded:Nn \c_io_term_stream} - -\def_new:Npn \iow_unexpanded_term:n {\iow_unexpanded:Nn \c_io_term_stream} -\def_new:Npn \iow_unexpanded_if_avail:Nn #1{ - \cs_free:NTF #1\use_none:n {\iow_unexpanded:Nn #1}} -\def_new:Npn \iow_unexpanded_if_avail:cn { - \exp_args:Nc \iow_unexpanded_if_avail:Nn } -\def_new:Npn \iow_long_expanded_aux:w #1#2#3{ - \group_begin:\tex_newlinechar:D`\ #1#2{#3}\group_end:} -\def_new:Npn \iow_long_expanded:Nn {\iow_long_expanded_aux:w - \iow_expanded:Nn} -\def_new:Npn \iow_long_unexpanded:Nn {\iow_long_expanded_aux:w - \iow_unexpanded:Nn} -\let:NN \iow_deferred_expanded:Nn \tex_write:D -\def_new:Npn \iow_deferred_unexpanded:Nn #1#2{ - \iow_deferred_expanded:Nn{\exp_not:n{#2}} +\package_check_loaded_expl: +\cs_set_eq:NN \iow_new:N \newwrite +\cs_generate_variant:Nn \iow_new:N {c} +\cs_new_nopar:Npn \iow_open:Nn #1#2 { + \iow_close:N #1 + \tex_immediate:D \tex_openout:D #1#2 \scan_stop: +} +\cs_generate_variant:Nn \iow_open:Nn {c} +\cs_new_nopar:Npn \iow_close:N { \tex_immediate:D \tex_closeout: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 +\cs_new_nopar:Npn \iow_now:Nx { \tex_immediate:D \iow_shipout_x:Nn } +\cs_new_nopar:Npn \iow_now:Nn #1#2 { + \iow_now:Nx #1 { \exp_not:n {#2} } +} +\cs_set_nopar:Npn \iow_log:x { \iow_now:Nx \c_iow_log_stream } +\cs_new_nopar:Npn \iow_log:n { \iow_now:Nn \c_iow_log_stream } +\cs_set_nopar:Npn \iow_term:x { \iow_now:Nx \c_iow_term_stream } +\cs_new_nopar:Npn \iow_term:n { \iow_now:Nn \c_iow_term_stream } +\cs_new_nopar:Npn \iow_now_when_avail:Nn #1 { + \cs_if_free:NTF #1 {\use_none:n} {\iow_now:Nn #1} +} +\cs_generate_variant:Nn \iow_now_when_avail:Nn {c} +\cs_new_nopar:Npn \iow_now_buffer_safe_aux:w #1#2#3 { + \group_begin: \tex_newlinechar:D`\ #1#2{#3} \group_end: +} +\cs_new_nopar:Npn \iow_now_buffer_safe:Nx { + \iow_now_buffer_safe_aux:w \iow_now:Nx +} +\cs_new_nopar:Npn \iow_now_buffer_safe:Nn { + \iow_now_buffer_safe_aux:w \iow_now:Nn +} +\cs_set_eq:NN \iow_shipout_x:Nn \tex_write:D +\cs_generate_variant:Nn \iow_shipout_x:Nn {Nx} +\cs_new_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_nopar:Npn \iow_newline: {^^J} +\cs_new_nopar:Npn \iow_space: {~} +\cs_new:Nn \iow_char:N { \cs_to_str:N #1 } +\tl_new:Nx \c_iow_comment_char {\cs_to_str:N\%} +\tl_new:Nx \c_iow_lbrace_char{\cs_to_str:N\{} +\tl_new:Nx \c_iow_rbrace_char{\cs_to_str:N\}} +\cs_set_eq:NN \ior_new:N \newread +\cs_set_eq:NN \ior_close:N \tex_closein:D +\cs_new_nopar:Npn \ior_open:Nn #1#2 { + \ior_close:N #1 \scan_stop: + \tex_openin:D #1#2 \scan_stop: +} +\cs_new_eq:NN \if_eof:w \tex_ifeof:D +\prg_new_conditional:Nnn \ior_if_eof:N {p,TF,T,F} { + \tex_ifeof:D #1 \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_new_nopar:Npn \ior_to:NN #1#2 { + \tex_read:D #1 to #2 +} +\cs_new_nopar:Npn \ior_gto:NN { + \pref_global:D + \ior_to:NN } -%% Old implementation: -\def_new:Npn \iow_newline: {^^J} -\tlp_new:Nx \c_iow_comment_char {\cs_to_str:N\%} -\tlp_new:Nx \c_iow_lbrace_char{\cs_to_str:N\{} -\tlp_new:Nx \c_iow_rbrace_char{\cs_to_str:N\}} -\let:NN \ior_new:N \newread -\let:NN \ior_close:N \tex_closein:D -\def_new:Npn \ior_open:Nn #1#2{\ior_close:N #1\scan_stop: - \tex_openin:D#1#2\scan_stop:} -\def_new:Npn \ior_eof:NTF #1{\if_eof:w#1 - \exp_after:NN\use_arg_i:nn \else: - \exp_after:NN\use_arg_ii:nn \fi:} -\let:NN \if_eof:w \tex_ifeof:D -\def_new:Npn \ior_eof:NF #1{\if_eof:w#1 - \exp_after:NN \use_none:nn \fi: \use_arg_i:n} - \def_new:Npn \ior_to:NN #1{\tex_read:D#1to} -\def_new:Npn \ior_gto:NN { - \pref_global:D - \ior_to:NN} %% %% %% End of file `l3io.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3keyval.sty b/Master/texmf-dist/tex/latex/expl3/l3keyval.sty index 683d121e3aa..d74b9ef62be 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3keyval.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3keyval.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3keyval.dtx Copyright (C) 2006 LaTeX3 project +%% File: l3keyval.dtx Copyright (C) 2006-2009 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,17 +48,14 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3keyval.dtx 621 2007-09-01 20:14:19Z morten $ +\GetIdInfo$Id: l3keyval.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental keyval processing} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3quark} -\RequirePackage{l3toks} -\RequirePackage{l3int} -\RequirePackage{l3token} -\tlp_new:Nn\l_KV_tmpa_tlp{} -\tlp_new:Nn\l_KV_tmpb_tlp{} -\tlp_new:Nn \c_KV_single_equal_sign_tlp{=} +\package_check_loaded_expl: +\tl_new:N \l_KV_tmpa_tl +\tl_new:N \l_KV_tmpb_tl +\tl_new:Nn \c_KV_single_equal_sign_tl{=} \toks_new:N \l_KV_parse_toks \toks_new:N \l_KV_currkey_toks \toks_new:N \l_KV_currval_toks @@ -69,84 +66,85 @@ \char_set_catcode:nn{`\,}{13} \char_set_lccode:nn{`\8}{`\=} \char_set_lccode:nn{`\9}{`\,} -\tlist_to_lowercase:n{\group_end: -\def_new:Npn \KV_sanitize_outerlevel_active_equals:N #1{ - \tlp_replace_all_in:Nnn #1 = 8 +\tl_to_lowercase:n{\group_end: +\cs_new_nopar:Npn \KV_sanitize_outerlevel_active_equals:N #1{ + \tl_replace_all_in:Nnn #1 = 8 } -\def_new:Npn \KV_sanitize_outerlevel_active_commas:N #1{ - \tlp_replace_all_in:Nnn #1 , 9 +\cs_new_nopar:Npn \KV_sanitize_outerlevel_active_commas:N #1{ + \tl_replace_all_in:Nnn #1 , 9 } } \group_begin: \char_set_catcode:nn{`\Q}{3} -\gdef_long_new:Npn\KV_remove_surrounding_spaces:nw#1#2\q_nil{ +\cs_gnew:Npn\KV_remove_surrounding_spaces:nw#1#2\q_nil{ #1{\KV_remove_surrounding_spaces_auxi:w \exp_not:N#2Q~Q} } -\gdef_long_new:Npn\KV_remove_surrounding_spaces_auxi:w#1~Q{ +\cs_gnew:Npn\KV_remove_surrounding_spaces_auxi:w#1~Q{ \KV_remove_surrounding_spaces_auxii:w #1 Q } -\gdef_long_new:Npn\KV_remove_surrounding_spaces_auxii:w#1Q#2{#1} -\gdef_long_new:Npn\KV_add_value_element:w\q_stop#1\q_nil{ +\cs_gnew:Npn\KV_remove_surrounding_spaces_auxii:w#1Q#2{#1} +\cs_gnew:Npn\KV_add_value_element:w\q_stop#1\q_nil{ \toks_set:Nf\l_KV_currval_toks { \KV_remove_surrounding_spaces_auxi:w \exp_not:N#1Q~Q } \toks_put_right:No\l_KV_parse_toks{ - \exp_after:NN {\toks_use:N \l_KV_currval_toks} + \exp_after:wN {\toks_use:N \l_KV_currval_toks} } } -\gdef_long_new:Npn\KV_set_key_element:w#1\q_nil{ +\cs_gnew:Npn\KV_set_key_element:w#1\q_nil{ \toks_set:Nf\l_KV_currkey_toks { - \exp_after:NN\KV_remove_surrounding_spaces_auxi:w - \exp_after:NN\exp_not:N\use_none:n #1Q~Q + \exp_last_unbraced:NNo \KV_remove_surrounding_spaces_auxi:w + \exp_not:N \use_none:n #1Q~Q } \bool_if:NT \l_KV_remove_one_level_of_braces_bool { - \toks_set:Nd \l_KV_currkey_toks{ - \exp_after:NN \KV_add_element_aux:w - \toks_use:N \l_KV_currkey_toks \q_nil + \exp_args:NNo \toks_set:No \l_KV_currkey_toks { + \exp_after:wN \KV_add_element_aux:w + \toks_use:N \l_KV_currkey_toks \q_nil } } } \group_end: -\def_long_new:Npn \KV_add_element_aux:w#1\q_nil{#1} -\def_long_new:Npn \KV_parse_sanitize_aux:n #1{ +\cs_new:Npn \KV_add_element_aux:w#1\q_nil{#1} +\cs_new:Npn \KV_parse_sanitize_aux:n #1 { \group_begin: - \toks_clear:N \l_KV_parse_toks - \tlp_set:Nx\l_KV_tmpa_tlp{\exp_not:n{#1}} - \KV_sanitize_outerlevel_active_equals:N\l_KV_tmpa_tlp - \KV_sanitize_outerlevel_active_commas:N\l_KV_tmpa_tlp - \exp_after:NN \KV_parse_elt:w \exp_after:NN\q_no_value \l_KV_tmpa_tlp,\q_nil, - \exp_after:NN\group_end: - \toks_use:N \l_KV_parse_toks -} -\def_long_new:Npn \KV_parse_no_sanitize_aux:n #1{ + \toks_clear:N \l_KV_parse_toks + \tl_set:Nx \l_KV_tmpa_tl { \exp_not:n {#1} } + \KV_sanitize_outerlevel_active_equals:N \l_KV_tmpa_tl + \KV_sanitize_outerlevel_active_commas:N \l_KV_tmpa_tl + \exp_last_unbraced:NNV \KV_parse_elt:w \q_no_value + \l_KV_tmpa_tl , \q_nil , + \exp_last_unbraced:NV \group_end: + \l_KV_parse_toks +} +\cs_new:Npn \KV_parse_no_sanitize_aux:n #1{ \group_begin: - \toks_clear:N \l_KV_parse_toks - \KV_parse_elt:w \q_no_value #1,\q_nil, - \exp_after:NN\group_end: - \toks_use:N \l_KV_parse_toks + \toks_clear:N \l_KV_parse_toks + \KV_parse_elt:w \q_no_value #1 , \q_nil , + \exp_last_unbraced:NV \group_end: + \l_KV_parse_toks } -\def_long:Npn \KV_parse_elt:w #1,{ - \tlist_if_blank:oTF{\use_none:n #1} +\cs_set:Npn \KV_parse_elt:w #1,{ + \tl_if_blank:oTF{\use_none:n #1} { \KV_parse_elt:w \q_no_value } { - \quark_if_nil:oF {\use_arg_ii:nn #1 } + \quark_if_nil:oF {\use_ii:nn #1 } { \KV_split_key_value_current:w #1==\q_nil \KV_parse_elt:w \q_no_value } } } -\let_new:NN \KV_split_key_value_current:w \ERROR -\def_long_new:Npn \KV_split_key_value_space_removal:w #1 = #2\q_nil{ +\cs_new:Npn \KV_split_key_value_current:w {\ERROR} +\cs_new:Npn \KV_split_key_value_space_removal:w #1 = #2\q_nil{ \KV_set_key_element:w#1\q_nil - \tlp_set:Nx\l_KV_tmpa_tlp{\exp_not:n{#2}} - \tlp_if_eq:NNTF\l_KV_tmpa_tlp\c_KV_single_equal_sign_tlp + \tl_set:Nx\l_KV_tmpa_tl{\exp_not:n{#2}} + \tl_if_eq:NNTF\l_KV_tmpa_tl\c_KV_single_equal_sign_tl { \toks_put_right:No\l_KV_parse_toks{ - \exp_after:NN \KV_key_no_value_elt:n - \exp_after:NN {\toks_use:N\l_KV_currkey_toks} + \exp_after:wN \KV_key_no_value_elt:n + \exp_after:wN {\toks_use:N\l_KV_currkey_toks} } } { @@ -155,63 +153,63 @@ {\ERROR} } } -\def_long_new:Npn +\cs_new:Npn \KV_split_key_value_space_removal_detect_error:wTF#1=#2#3\q_nil{ - \tlist_if_head_eq_meaning:nNTF{#3}\q_no_value + \tl_if_head_eq_meaning:nNTF{#3}\q_no_value } -\def_long_new:Npn \KV_val_preserve_braces:NnN #1#2#3{{#2}} -\def_long_new:Npn\KV_split_key_value_space_removal_aux:w #1=={ - \tlp_set:Nx\l_KV_tmpa_tlp{\exp_not:o{\use_none:nnn#1\q_nil\q_nil}} +\cs_new:Npn \KV_val_preserve_braces:NnN #1#2#3{{#2}} +\cs_new:Npn\KV_split_key_value_space_removal_aux:w #1=={ + \tl_set:Nx\l_KV_tmpa_tl{\exp_not:o{\use_none:nnn#1\q_nil\q_nil}} \toks_put_right:No\l_KV_parse_toks{ - \exp_after:NN \KV_key_value_elt:nn - \exp_after:NN {\toks_use:N\l_KV_currkey_toks} + \exp_after:wN \KV_key_value_elt:nn + \exp_after:wN {\toks_use:N\l_KV_currkey_toks} } - \tlp_if_empty:NTF\l_KV_tmpa_tlp + \tl_if_empty:NTF\l_KV_tmpa_tl { \toks_put_right:Nn\l_KV_parse_toks{{}} } { - \quark_if_nil:NTF\l_KV_tmpa_tlp + \quark_if_nil:NTF\l_KV_tmpa_tl { \bool_if:NTF \l_KV_remove_one_level_of_braces_bool { \toks_put_right:No\l_KV_parse_toks{ - \exp_after:NN{\use_arg_ii:nnn #1\q_nil} + \exp_after:wN{\use_ii:nnn #1\q_nil} } } { \toks_put_right:No\l_KV_parse_toks{ - \exp_after:NN{\KV_val_preserve_braces:NnN #1\q_nil} + \exp_after:wN{\KV_val_preserve_braces:NnN #1\q_nil} } } } { \KV_add_value_element:w #1\q_nil } } } -\def_long_new:Npn \KV_split_key_value_no_space_removal:w #1#2=#3=#4\q_nil{ - \tlp_set:Nn\l_KV_tmpa_tlp{#4} - \tlp_if_empty:NTF \l_KV_tmpa_tlp +\cs_new:Npn \KV_split_key_value_no_space_removal:w #1#2=#3=#4\q_nil{ + \tl_set:Nn\l_KV_tmpa_tl{#4} + \tl_if_empty:NTF \l_KV_tmpa_tl { \toks_put_right:Nn\l_KV_parse_toks{\KV_key_no_value_elt:n{#2}} } { - \tlp_if_eq:NNTF\c_KV_single_equal_sign_tlp\l_KV_tmpa_tlp + \tl_if_eq:NNTF\c_KV_single_equal_sign_tl\l_KV_tmpa_tl { \toks_put_right:Nn\l_KV_parse_toks{\KV_key_value_elt:nn{#2}{#3}} } {\ERROR} } } -\def_long_new:Npn \KV_key_no_value_elt:n #1{\ERROR} -\def_long_new:Npn \KV_key_value_elt:nn #1#2{\ERROR} -\def_new:Npn \KV_parse_no_space_removal_no_sanitize:n { - \let:NN \KV_split_key_value_current:w \KV_split_key_value_no_space_removal:w +\cs_new:Npn \KV_key_no_value_elt:n #1{\ERROR} +\cs_new:Npn \KV_key_value_elt:nn #1#2{\ERROR} +\cs_new_nopar:Npn \KV_parse_no_space_removal_no_sanitize:n { + \cs_set_eq:NN \KV_split_key_value_current:w \KV_split_key_value_no_space_removal:w \KV_parse_no_sanitize_aux:n } -\def_new:Npn \KV_parse_space_removal_sanitize:n { - \let:NN \KV_split_key_value_current:w \KV_split_key_value_space_removal:w +\cs_new_nopar:Npn \KV_parse_space_removal_sanitize:n { + \cs_set_eq:NN \KV_split_key_value_current:w \KV_split_key_value_space_removal:w \KV_parse_sanitize_aux:n } -\def_new:Npn \KV_parse_space_removal_no_sanitize:n { - \let:NN \KV_split_key_value_current:w \KV_split_key_value_space_removal:w +\cs_new_nopar:Npn \KV_parse_space_removal_no_sanitize:n { + \cs_set_eq:NN \KV_split_key_value_current:w \KV_split_key_value_space_removal:w \KV_parse_no_sanitize_aux:n } %% diff --git a/Master/texmf-dist/tex/latex/expl3/l3messages.sty b/Master/texmf-dist/tex/latex/expl3/l3messages.sty deleted file mode 100644 index eee8eab7c8b..00000000000 --- a/Master/texmf-dist/tex/latex/expl3/l3messages.sty +++ /dev/null @@ -1,316 +0,0 @@ -%% -%% This is file `l3messages.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% l3messages.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: l3messages.dtx Copyright (C) 1990-2007 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/cgi-bin/cvsweb.cgi/ -%% -%% 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 LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -\RequirePackage{l3names} -\GetIdInfo$Id: l3messages.dtx 673 2007-09-28 20:50:33Z mittelba $ - {L3 Experimental LaTeX Messages module} -\ProvidesExplPackage - {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3basics} -\RequirePackage{l3tlp} -\RequirePackage{l3expan} -\RequirePackage{l3num} -\RequirePackage{l3io} -\RequirePackage{l3int} -\RequirePackage{l3toks} -\RequirePackage{l3token} -\tlp_new:Nn \g_file_curr_name_tlp {no~file} -\let_new:NN \err_message:x \tex_errmessage:D -\def_new:Npn \text_put_sp: {~} -\def_new:Npn \text_put_four_sp: {\text_put_sp: \text_put_sp: - \text_put_sp: \text_put_sp: } -\def:Npn\cmd_arg_list_build#1{ - \toks_clear:N\l_tmpb_toks - \int_set:Nn \l_tmpa_int {#1} - \int_while:nNnT \l_tmpa_int > \c_zero { - \toks_put_left:No \l_tmpb_toks {\the_internal:D\l_tmpa_int} - \toks_put_left:Nn \l_tmpb_toks {##} - \int_decr:N\l_tmpa_int - } - \def:Npx\l_cmd_arg_list{\the_internal:D\l_tmpb_toks} -} -\def:Npn\cmd_declare:Nnn#1[#2]{ - \cmd_arg_list_build{#2} - \exp_args:NNO\def:Npn#1\l_cmd_arg_list -} -\def_new:Npn \io_show_file_lineno:{ - on~line~\the_internal:D\tex_inputlineno:D\text_put_sp:~of~ - file~\g_file_curr_name_tlp} -\let:NwN \g_err_help_toks \tex_errhelp:D -\def_new:Npn \l_err_label_token {} -\int_set:Nn\tex_errorcontextlines:D\c_minus_one -\def_new:Npn \err_info:nn #1#2{ - \def:Npn\err_newline:{\iow_newline:#2} - \io_put_log:x {#1~\io_show_file_lineno:}} -\def_new:Npn \err_warn:nn #1#2{ - \def:Npn\err_newline:{\iow_newline:#2} - \io_put_term:x {#1~\io_show_file_lineno:}} -\def_new:Npn \err_info_noline:nn #1#2{ - \def:Npn\err_newline:{\iow_newline:#2} - \io_put_log:x {#1}} -\def_new:Npn \err_warn_noline:nn #1#2{ - \def:Npn\err_newline:{\iow_newline:#2} - \io_put_term:x {#1}} -\def_new:Npn \err_interrupt:NNw #1#2{\let:NwN \l_err_label_token #2 - \group_begin: - \let:NwN \par\use_noop: - \CodeStop - \NamesStart: - %\clearshortrefmaps - \tex_input:D #1~\err_display_aux:w} -\def_new:Npn \err_fatal:nn #1#2{ - \def:Npn\err_newline:{\iow_newline:#2} - \io_put_term:x {#1~\io_show_file_lineno:} - \tex_end:D - } -\def_new:Npn \err_fatal_noline:nn #1#2{ - \def:Npn\err_newline:{\iow_newline:#2} - \io_put_term:x {#1} - \tex_end:D - } -\def_new:Npn \err_newline: {^^J} -\iow_new:N \c_iow_err_stream -\tlp_new:Nn \g_err_curr_fname{} -\def_new:Npn \err_file_new:Nn #1#2{ - \tlp_if_empty:NF\g_err_curr_fname - {\err_latex_bug:x{Unclosed~error~file~`\g_err_curr_fname'}} - \iow_open:Nn \c_iow_err_stream {#2} - \err_kernel_info:n{Errorfile~`#2'~opened~for~output} - \tlp_gset:Nn \g_err_curr_fname{#2} - \tlp_new:Nn #1{#2}} -\def_new:Npn \err_file_close:N#1{ - \tlp_if_eq:NNF#1\g_err_curr_fname - {\err_latex_bug:x{You~closed~the~wrong~error~file~`#1'.~ - Open~is~`\g_err_curr_fname'.}} - \iow_long_unexpanded:Nn \c_iow_err_stream {\err_latex_bug:x{Didn't~find~the~ - correct~error~message~to~show.\iow_newline: - Was~searching~for~a~function~ - with~the~following~meaning:\iow_newline: - \token_to_string:N\token_to_meaning:N - \token_to_string:N\l_err_label_token} - \group_end:} - \iow_close:N \c_iow_err_stream - \err_kernel_info:n{Errorfile~`\g_err_curr_fname'~closed} - \tlp_gset_eq:NN\g_err_curr_fname\c_empty_tlp -} -\def_new:Npn \err_interrupt_new:NNNnnn #1{ - \group_begin: \char_set_catcode:nn{`\#}{12} - \if_meaning:NN#1\g_err_curr_fname - \else: - \err_latex_bug:x{Error~text~goes~to~wrong~err~file:~ - `\g_err_curr_fname'~is~open~but~you~requested~ - `#1'} - \fi: - \err_interrupt_new_aux:w} -\def_long_new:Npn \err_interrupt_new_aux:w #1#2#3#4#5{ - \iow_long_unexpanded:Nn \c_iow_err_stream - {\err_msgline_aux:NNnnn #1#2{#3}{#4}{#5}\use_noop:} - \group_end:} -\def_new:Npn \err_msgline_aux:NNnnn #1#2#3#4#5{ - \if_meaning:NN#1\l_err_label_token - \cmd_declare:Nnn\err_display_aux:w [#2]{ - \group_end: - \toks_gset:Nx\g_err_help_toks{#4} - \io_put_term:x{LaTeX~error~\io_show_file_lineno:.\iow_newline: - \text_put_sp:\text_put_four_sp: \text_put_sp: - See~LaTeX~manual~for~explanation.\iow_newline: - \text_put_sp:\text_put_four_sp: \text_put_sp: - Type~\text_put_sp: H~<return>~\text_put_sp: for~ - immediate~help.} - \err_message:x{#3} - #5} - \tex_endinput:D - \fi:} -\def_new:Npn \err_display_aux:w {} -\def_new:Npn \err_kernel_interrupt:Nw {\err_interrupt:NNw \c_kernel_err_tlp} -\def_new:Npn \err_kernel_interrupt_new:NNnnn { - \err_interrupt_new:NNNnnn \c_kernel_err_tlp} -\def_new:Npn \err_kernel_info:n #1 { - \err_info:nn {LaTeX~Info:~#1} - {\text_put_four_sp:\text_put_four_sp:\text_put_four_sp:} - } -\def_new:Npn \err_kernel_warn:n #1 { - \err_warn:nn {LaTeX~Warning:~#1} - {\text_put_sp:\text_put_sp:\text_put_sp: - \text_put_four_sp:\text_put_four_sp:\text_put_four_sp:} - } -\def_new:Npn \err_kernel_fatal:n #1 { - \err_fatal:nn {LaTeX~Fatal:~#1} - {\text_put_sp: - \text_put_four_sp:\text_put_four_sp:\text_put_four_sp:} - } -\def_new:Npn \err_kernel_info_noline:n #1 { - \err_info_noline:nn {LaTeX~Info:~#1} - {\text_put_four_sp:\text_put_four_sp:\text_put_four_sp:} - } -\def_new:Npn \err_kernel_warn_noline:n #1 { - \err_warn_noline:nn {LaTeX~Warning:~#1} - {\text_put_sp:\text_put_sp:\text_put_sp: - \text_put_four_sp:\text_put_four_sp:\text_put_four_sp:} - } -\def_new:Npn \err_kernel_fatal_noline:n #1 { - \err_fatal_noline:nn {LaTeX~Fatal:~#1} - {\text_put_sp: - \text_put_four_sp:\text_put_four_sp:\text_put_four_sp:} - } -\err_file_new:Nn \c_kernel_err_tlp {l3in2e.err} -\def:Npn\err_help_ignored: { - Your~command~was~ignored.\iow_newline: - Type \text_put_sp: I~<command>~<return> - \text_put_sp: to~replace~it~with~another~command,\iow_newline: - or~\text_put_sp: <return> \text_put_sp: to~continue~without~it.} - -\def:Npn\err_help_textlost: { - You've~lost~some~text.\text_put_sp: \err_help_return_or_X:} - -\def:Npn\err_help_return_or_X: { - Try~typing\text_put_sp: <return> - \text_put_sp: to~proceed.\iow_newline: - If~that~doesn't~work,~type - \text_put_sp: X~<return>\text_put_sp: to~quit.} - -\def:Npn\err_help_trouble: { - You're~ in~ trouble~ here. - \text_put_sp:\err_help_return_or_X:} - -\err_kernel_interrupt_new:NNnnn\cs_free_p:N{1} - {Command~name~`\tex_string:D#1'~already~used} - {You~tried~to~define~a~command~which~already~has~ - a~meaning.\iow_newline: - If~you~really~want~to~redefine~it~try~ - \token_to_string:N\cmd_declare:Nnn\text_put_sp: - next~time.\iow_newline: - For~this~run~I~will~ignore~your~definition.} - {} - -\err_kernel_interrupt_new:NNnnn\newline{0} - {There's~no~line~here~to~end} - {You~tried~to~end~a~line~at~a~place~where~I~thought~ - we~were~already~between~paragraphs.} - {} - -\err_kernel_interrupt_new:NNnnn\newcnt{0} - {No~such~counter} - {The~counter~name~mentioned~in~the~operation~is~not~ - known~to~me.\iow_newline: - Check~the~spelling.} - {} - -\err_kernel_interrupt_new:NNnnn\nodocument{0} - {Missing~\token_to_string:N\begin{document}} - {\err_help_trouble:} - {} - -\err_kernel_interrupt_new:NNnnn\badmath{0} - {Bad~math~environment~delimiter} - {\err_help_ignored:} - {} - -\err_kernel_interrupt_new:NNnnn\toodeep{0} - {Too~deeply~nested} - {\err_help_trouble:} - {} - -\err_kernel_interrupt_new:NNnnn\badpoptabs{0} - {\token_to_string:N\pushtabs \text_put_sp: - and~\token_to_string:N\poptabs - \text_put_sp: don't~match} - {\err_help_trouble:} - {} - -\err_kernel_interrupt_new:NNnnn\badtab{0} - {Undefined~tab~position} - {\err_help_trouble:} - {} - -\err_kernel_interrupt_new:NNnnn\preamerr{} - {\if_case:w #1~Illegal~character\or: - Missing~@-exp\or: Missing~p-arg\fi:\text_put_sp: - in~array~arg} - {\err_help_trouble:} - {} - -\err_kernel_interrupt_new:NNnnn\badlinearg{} - {Bad~\token_to_string:N\line - \text_put_sp: or~\token_to_string:N\vector - \text_put_sp: argument} - {\err_help_textlost:} - {} - -\err_kernel_interrupt_new:NNnnn\parmoderr{0} - {Not~in~outer~par~mode} - {\err_help_textlost:} - {} - -\err_kernel_interrupt_new:NNnnn\fltovf{0} - {Too~many~unprocessed~floats} - {\err_help_textlost:} - {} - -\err_kernel_interrupt_new:NNnnn\badcrerr{0} - {Bad~use~of~\token_to_string:N\\} - {\err_help_return_or_X:} - {} - -\err_kernel_interrupt_new:NNnnn\noitemerr{0} - {Something's~wrong--perhaps~a~missing~ - \token_to_string:N\item} - {\err_help_return_or_X:} - {} - -\err_kernel_interrupt_new:NNnnn\notprerr{0} - {Can~be~used~only~in~preamble} - {\err_help_ignored:} - {} - -\err_file_close:N\c_kernel_err_tlp - -%% -%% -%% End of file `l3messages.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3msg.sty b/Master/texmf-dist/tex/latex/expl3/l3msg.sty new file mode 100644 index 00000000000..6d7cee74366 --- /dev/null +++ b/Master/texmf-dist/tex/latex/expl3/l3msg.sty @@ -0,0 +1,487 @@ +%% +%% 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 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 LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\RequirePackage{l3names} +\GetIdInfo$Id: l3msg.dtx 1362 2009-05-28 20:19:21Z joseph $ + {L3 Experimental LaTeX Messages module} +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\package_check_loaded_expl: +\int_set:Nn \tex_errorcontextlines:D { \c_minus_one } +\tl_new:Nn \c_msg_fatal_tl { Fatal~Error } +\tl_new:Nn \c_msg_error_tl { Error } +\tl_new:Nn \c_msg_warning_tl { Warning } +\tl_new:Nn \c_msg_info_tl { Info } +\tl_new:Nn \c_msg_fatal_text_tl { + This~is~a~fatal~error:~LaTeX~will~abort +} +\tl_new:Nn \c_msg_help_text_tl { + For~immediate~help~type~H~<return> +} +\tl_new:Nn \c_msg_kernel_bug_text_tl { + This~is~a~LaTeX~bug:~check~coding! +} +\tl_new:Nn \c_msg_kernel_bug_more_text_tl { + There~is~a~coding~bug~somewhere~around~here. + \msg_newline: + This~probably~needs~examining~by~an~expert. + \c_msg_return_text_tl +} +\tl_new:Nn \c_msg_no_info_text_tl { + LaTeX~does~not~know~anything~more~about~this~error,~sorry. + \c_msg_return_text_tl +} +\tl_new:Nn \c_msg_return_text_tl { + \msg_two_newlines: + Try~typing~<return>~to~proceed. + \msg_newline: + If~that~doesn't~work,~type~X~<return>~to~quit +} +\group_begin: +\char_make_letter:N\ % +\tl_to_lowercase:n{% +\group_end:% +\tl_new:Nn% +\c_msg_hide_tl % +{}% +}% +\tl_new:Nn \c_msg_on_line_tl { on~line } +\tl_new:Nn \c_msg_text_prefix_tl { msg_text // } +\tl_new:Nn \c_msg_more_text_prefix_tl { msg_text_more // } +\tl_new:Nn \c_msg_code_prefix_tl { msg_code // } +\tl_new:N \l_msg_class_tl +\tl_new:N \l_msg_current_class_tl +\clist_new:N \l_msg_names_clist +\prop_new:N \l_msg_redirect_classes_prop +\prop_new:N \l_msg_redirect_names_prop +\clist_new:N \l_msg_redirect_classes_clist +\cs_new_nopar:Nn { \msg_line_number: } { + \toks_use:N \tex_inputlineno:D +} +\cs_new_nopar:Nn { \msg_line_context: } { + \msg_space: + \c_msg_on_line_tl + \msg_space: + \msg_line_number: +} +\cs_new_nopar:Nn \msg_newline: { ^^J } +\cs_new_nopar:Nn \msg_two_newlines: { ^^J ^^J } +\cs_new_nopar:Nn \msg_space: { ~ } +\cs_new_nopar:Nn \msg_two_spaces: { \msg_space: \msg_space: } +\cs_new_nopar:Nn \msg_four_spaces: { \msg_two_spaces: \msg_two_spaces: } +\cs_new_nopar:Npn \msg_generic_new:nnnn #1 { + \exp_args:Nc \chk_if_free_cs:N { \c_msg_text_prefix_tl #1 :nn } + \msg_generic_set:nnnn {#1} +} +\cs_new_nopar:Npn \msg_generic_new:nnn #1 { + \exp_args:Nc \chk_if_free_cs:N { \c_msg_text_prefix_tl #1 :nn } + \msg_generic_set:nnn {#1} +} +\cs_new_nopar:Npn \msg_generic_new:nn #1 { + \exp_args:Nc \chk_if_free_cs:N { \c_msg_text_prefix_tl #1 :nn } + \msg_generic_set:nn {#1} +} +\cs_new_nopar:Npn \msg_generic_set:nnnn #1 { + \msg_generic_set_clist:n {#1} + \char_make_space:N \ % + \msg_generic_set_code:nnnn{#1}% +} +\cs_new_nopar:Npn \msg_generic_set:nnn #1 { + \msg_generic_set_clist:n {#1} + \char_make_space:N \ % + \msg_generic_set_more_text:nnn{#1}% +} +\cs_new_nopar:Npn \msg_generic_set:nn #1 { + \msg_generic_set_clist:n {#1} + \char_make_space:N \ % + \msg_generic_set_text:nn{#1}% +} +\cs_new_nopar:Npn \msg_generic_set_clist:n #1 { + \clist_if_in:NnF \l_msg_names_clist { // #1 / } { + \clist_put_right:Nn \l_msg_names_clist { // #1 / } + } +} +\cs_new:Nn \msg_generic_set_text:nn { + \cs_set:cn { \c_msg_text_prefix_tl #1 :nn } {#2} + \char_make_ignore:N \ +} +\cs_new:Nn \msg_generic_set_more_text:nnn { + \cs_set:cn { \c_msg_text_prefix_tl #1 :nn } {#2} + \tl_if_empty:nTF {#3} { + \cs_set_eq:cN { \c_msg_more_text_prefix_tl #1 } \c_undefined + }{ + \cs_set:cn { \c_msg_more_text_prefix_tl #1 :nn } {#3} + } + \char_make_ignore:N \ +} +\cs_new:Npn \msg_generic_set_code:nnnn #1#2#3 { + \cs_set:cn { \c_msg_text_prefix_tl #1 :nn } {#2} + \tl_if_empty:nTF {#3} { + \cs_set_eq:cN { \c_msg_more_text_prefix_tl #1 } \c_undefined + }{ + \cs_set:cn { \c_msg_more_text_prefix_tl #1 :nn } {#3} + } + \char_make_ignore:N \ + \msg_generic_set_code:nn {#1} +} +\cs_new:Nn \msg_generic_set_code:nn { + \tl_if_empty:nTF {#2} { + \cs_set_eq:cN { \c_msg_code_prefix_tl #1 : } \c_undefined + }{ + \cs_set:cn { \c_msg_code_prefix_tl #1 : } {#2} + } +} +\group_begin: + \char_set_lccode:nn {`\&} {`\ } % { + \char_set_lccode:w `\} = `\ \scan_stop: + \char_make_active:N \& + \char_make_letter:N\ % +\tl_to_lowercase:n{% +\group_end:% +\cs_new_protected:Nn\msg_direct_interrupt:xxxxn{% +\group_begin:% +\cs_set_eq:NN\\\msg_newline:% +\cs_set_eq:NN\ \msg_space:% +\msg_direct_interrupt_aux:n{#4}% +\cs_set_nopar:Npn\\{\msg_newline:#3}% +\tex_errhelp:D\l_msg_tmp_tl% +\cs_set:Npn&{% +\tex_errmessage:D{% +#1\msg_newline:% +#2\msg_two_newlines:% +\c_msg_help_text_tl% +\c_msg_hide_tl % +}% +}% +&% +\group_end:% +#5% +}% +}% +\cs_new:Nn \msg_direct_interrupt_aux:n { + \tl_if_empty:nTF {#1} { + \tl_set:Nx \l_msg_tmp_tl { { \c_msg_no_info_text_tl } } + }{ + \tl_set:Nx \l_msg_tmp_tl { {#1 } } + } +} +\cs_new_protected:Nn \msg_direct_log:xx { + \group_begin: + \cs_set:Npn \\ { \msg_newline: #2 } + \cs_set_eq:NN \ \msg_space: + \iow_log:x { #1 \msg_newline: } + \group_end: +} +\cs_new_protected:Nn \msg_direct_term:xx { + \group_begin: + \cs_set:Npn \\ { \msg_newline: #2 } + \cs_set_eq:NN \ \msg_space: + \iow_term:x { #1 \msg_newline: } + \group_end: +} +\cs_new_nopar:Npn \msg_new:nnnnn #1#2 { + \msg_generic_new:nnnn { #1 / #2 } +} +\cs_new_nopar:Npn \msg_new:nnnn #1#2 { + \msg_generic_new:nnn { #1 / #2 } +} +\cs_new_nopar:Npn \msg_new:nnn #1#2 { + \msg_generic_new:nn { #1 / #2 } +} +\cs_new_nopar:Npn \msg_set:nnnnn #1#2 { + \msg_generic_set:nnnn { #1 / #2 } +} +\cs_new_nopar:Npn \msg_set:nnnn #1#2 { + \msg_generic_set:nnn { #1 / #2 } +} +\cs_new_nopar:Npn \msg_set:nnn #1#2 { + \msg_generic_set:nn { #1 / #2 } +} +\cs_new_nopar:Npn \msg_class_new:nn #1 { + \exp_args:Nc \chk_if_free_cs:N { msg_ #1 :nnxx } + \prop_new:c { l_msg_redirect_ #1 _prop } + \msg_class_set:nn {#1} +} +\cs_new_nopar:Nn \msg_class_set:nn { + \prop_clear:c { l_msg_redirect_ #1 _prop } + \cs_set_protected:cn { msg_ #1 :nnxx } { + \msg_use:nnnnxx {#1} {#2} {##1} {##2} {##3} {##4} + } + \cs_set_protected:cn { msg_ #1 :nnx } { + \use:c { msg_ #1 :nnxx } {##1} {##2} {##3} { } + } + \cs_set_protected:cn { msg_ #1 :nn } { + \use:c { msg_ #1 :nnxx } {##1} {##2} { } { } + } +} +\cs_new:Nn \msg_use:nnnnxx { + \cs_set:Nn \msg_use_code: { + \clist_clear:N \l_msg_redirect_classes_clist + #2 + } + \cs_set:Nn \msg_use_loop:n { + \clist_if_in:NnTF \l_msg_redirect_classes_clist {#1} { + \msg_kernel_error:n { message~loop } + }{ + \clist_put_right:Nn \l_msg_redirect_classes_clist {#1} + \cs_if_exist:cTF { msg_ ##1 :nnxx } { + \use:c { msg_ ##1 :nnxx } {#3} {#4} {#5} {#6} + }{ + \msg_kernel_error:nx { message~class~unknown } { ##1 } + } + } + } + \cs_if_exist:cTF { \c_msg_text_prefix_tl #3 / #4 :nn } { + \msg_use_aux:nnn {#1} {#3} {#4} + }{ + \msg_kernel_error:nxx { message~unknown } { #3 } { #4 } + } +} +\cs_new_nopar:Nn \msg_use_code: { } +\cs_new_nopar:Nn \msg_use_loop:n { } +\cs_new_nopar:Nn \msg_use_aux:nnn { + \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_nopar:Nn \msg_use_aux:nn { + \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:Nn \msg_use_loop_check:nn { + \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:n { \l_msg_class_tl } + } +} +\msg_class_new:nn { fatal } { + \msg_direct_interrupt:xxxxn + { \c_msg_fatal_tl \msg_two_newlines: } + { + ( \c_msg_fatal_tl ) \msg_space: + \use:c { \c_msg_text_prefix_tl #1 / #2 :nn } {#3} {#4} + } + { ( \c_msg_fatal_tl ) \msg_space: } + { \c_msg_fatal_text_tl } + { \tex_end:D } +} +\msg_class_new:nn { error } { + \msg_direct_interrupt:xxxxn + { #1~\c_msg_error_tl \msg_newline: } + { + ( #1 ) \msg_space: + \use:c { \c_msg_text_prefix_tl #1 / #2 :nn } {#3} {#4} + } + { ( #1 ) \msg_space: } + { + \cs_if_exist:cTF { \c_msg_more_text_prefix_tl #1 / #2 :nn } { + \use:c { \c_msg_more_text_prefix_tl #1 / #2 :nn } {#3} {#4} + }{ + \c_msg_no_info_text_tl + } + } + { + \cs_if_exist:cT { \c_msg_code_prefix_tl #1 /#2 :nn } { + \use:c { \c_msg_code_prefix_tl #1 / #2 :nn} {#3} {#4} + } + } +} +\msg_class_new:nn { warning } { + \msg_direct_term:xx { + \msg_space: #1~\c_msg_warning_tl :~ + \use:c { \c_msg_text_prefix_tl #1 / #2 :nn } {#3} {#4} + } + { ( #1 ) \msg_two_spaces: } +} +\msg_class_new:nn { info } { + \msg_direct_log:xx { + \msg_space: #1~\c_msg_info_tl :~ + \use:c { \c_msg_text_prefix_tl #1 / #2 :nn } {#3} {#4} + } + { ( #1 ) \msg_two_spaces: } +} +\msg_class_new:nn { log } { + \msg_direct_log:xx { + \use:c { \c_msg_text_prefix_tl #1 / #2 :nn } {#3} {#4} + } + { } +} +\msg_class_new:nn { trace } { + \msg_direct_log:xx { + \use:c { \c_msg_text_prefix_tl #1 / #2 :nn } {#3} {#4} + } + { } +} +\msg_class_new:nn { none } { } +\cs_new_nopar:Nn \msg_redirect_class:nn { + \prop_put:cnn { l_msg_redirect_ #1 _prop } {*} {#2} +} +\cs_new_nopar:Nn \msg_redirect_module:nnn { + \prop_put:cnn { l_msg_redirect_ #2 _prop } {#1} {#3} +} +\cs_new_nopar:Nn \msg_redirect_name:nnn { + \prop_put:Nnn \l_msg_redirect_names_prop { // #1 / #2 / } {#3} +} +\cs_new_nopar:Npn \msg_kernel_new:nnnn #1 { + \msg_new:nnnnn { LaTeX } {#1} +} +\cs_new_nopar:Npn \msg_kernel_new:nnn #1 { + \msg_new:nnnn { LaTeX } {#1} +} +\cs_new_nopar:Npn \msg_kernel_new:nn #1 { + \msg_new:nnn { LaTeX } {#1} +} +\cs_new_nopar:Npn \msg_kernel_set:nnnn #1 { + \msg_set:nnnnn { LaTeX } {#1} +} +\cs_new_nopar:Npn \msg_kernel_set:nnn #1 { + \msg_set:nnnn { LaTeX } {#1} +} +\cs_new_nopar:Npn \msg_kernel_set:nn #1 { + \msg_set:nnn { LaTeX } {#1} +} +\cs_new_nopar:Nn \msg_kernel_classes_new:n { + \cs_new_protected:cn { msg_kernel_ #1 :nx } { + \use:c { msg_kernel_ #1 :nxx } {##1} {##2} { } + } + \cs_new_protected:cn { msg_kernel_ #1 :n } { + \use:c { msg_kernel_ #1 :nxx } {##1} { } { } + } +} +\cs_new_protected:Nn \msg_kernel_fatal:nxx { + \msg_direct_interrupt:xxxxn + { \c_msg_fatal_tl \msg_two_newlines: } + { + ( LaTeX ) \msg_space: + \use:c { \c_msg_text_prefix_tl LaTeX / #1 :nn } {#2} {#3} + } + { ( LaTeX ) \msg_space: } + { \c_msg_fatal_text_tl } + { \tex_end:D } +} +\msg_kernel_classes_new:n { fatal } +\cs_new_protected:Nn \msg_kernel_error:nxx { + \msg_direct_interrupt:xxxxn + { LaTeX~\c_msg_error_tl \msg_newline: } + { + ( LaTeX ) \msg_space: + \use:c { \c_msg_text_prefix_tl LaTeX / #1 :nn } {#2} {#3} + } + { ( LaTeX ) \msg_space: } + { + \cs_if_exist:cTF { \c_msg_more_text_prefix_tl LaTeX / #1 :nn } { + \use:c { \c_msg_more_text_prefix_tl LaTeX / #1 :nn } {#2} {#3} + }{ + \c_msg_no_info_text_tl + } + } + { + \cs_if_exist:cT { \c_msg_code_prefix_tl LaTeX /#1 :nn } { + \use:c { \c_msg_code_prefix_tl LaTeX / #1 :nn} {#2} {#3} + } + } +} +\msg_kernel_classes_new:n { error } +\cs_new_protected_nopar:Npn \msg_kernel_warning:nxx { + \msg_warning:nnxx { LaTeX } +} +\msg_kernel_classes_new:n { warning } +\cs_new_protected_nopar:Npn \msg_kernel_info:nxx { + \msg_info:nnxx { LaTeX } +} +\msg_kernel_classes_new:n { info } +\msg_kernel_new:nnn + { coding~bug } + {This is a LaTeX bug: check coding!\\#1} + {#2} +\msg_kernel_new:nnn + { message~unknown } + {Unknown message `#2' for module `#1'.} + {LaTeX was asked to display a message by the `#1' module.\\ + The message was supposed to be called `#2', but I can't\\ + find a message with that name. + \c_msg_return_text_tl} +\msg_kernel_new:nnn + { message~class~unknown } + {Unknown message class `#1'.} + {You have asked for a message to be redirected to class `#1'\\ + but this class is unknown. + \c_msg_return_text_tl} +\msg_kernel_new:nnn + { message~loop } + {Message redirection loop.} + {You have asked for a message to be redirected,\\ + but the redirection instructions form a loop:\\ + you've lost the message. + \c_msg_return_text_tl} +\cs_set_protected:Nn \msg_kernel_bug:x { + \msg_direct_interrupt:xxxxn + { \c_msg_kernel_bug_text_tl } + { !~#1 } + { ! } + { \c_msg_kernel_bug_more_text_tl } + { } +} +%% +%% +%% End of file `l3msg.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3names.sty b/Master/texmf-dist/tex/latex/expl3/l3names.sty index 485ad03e134..28f36638615 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3names.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3names.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3names.dtx Copyright (C) 1990-2006 LaTeX3 project +%% File: l3names.dtx Copyright (C) 1990-2006,2009 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,7 +48,18 @@ %% %% ----------------------------------------------------------------------- \begingroup -\def\GetIdInfo$#1 #2.#3 #4 #5 #6 #7${% +\def\GetIdInfo$#1${% + \begingroup + \def\GetIdInfoString{#1}% + \def\IdInfoStringUnexp{Id}% + \ifx \GetIdInfoString \IdInfoStringUnexp + \def\next{\endgroup\GetIdInfoMissing} + \else + \def\next{\endgroup\GetIdInfoFull$#1$} + \fi + \next +} +\def\GetIdInfoFull$#1 #2.#3 #4 #5 #6 #7${% \GetIdInfoAux #5\relax{#2}#5\relax{#4}% } \def\GetIdInfoAux #1#2#3#4#5#6\relax{% @@ -70,9 +81,43 @@ \gdef\filedescription{#6}% \ProvidesPackage{#1}[#2/#3/#4 v#5 #6] } -\GetIdInfo$Id: l3names.dtx 621 2007-09-01 20:14:19Z morten $ +\def\GetIdInfoMissing#1{% + \gdef\fileversion{000}% + \gdef\filedate{0000/00/00}% + \gdef\filedescription{#1}% + \ProvidesPackage{[unknown package]}[0000/00/00 v0.0 #1] +} +\GetIdInfo$Id: l3names.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental Naming Scheme for TeX Primitives} \endgroup +\begingroup +\def\firstoftwo#1#2{#1} +\def\secondoftwo#1#2{#2} +\def\etexmissingerror{Not running under e-TeX} +\def\etexmissinghelp{% + This package requires e-TeX.^^J% + Try compiling the document with `elatex' instead of `latex'.^^J% + When using pdfTeX, try `pdfelatex' instead of `pdflatex'% +}% +\expandafter\ifx\csname eTeXversion\endcsname\relax + \expandafter\secondoftwo\else\expandafter\firstoftwo\fi + {\endgroup}{% + \PackageError{l3names}{\etexmissingerror}{\etexmissinghelp}% + \endgroup + \endinput + } +\edef\ExplSyntaxOff{ + \unexpanded{\ifodd \ExplSyntaxStatus\relax + \def\ExplSyntaxStatus{0} + } + \catcode 126=\the \catcode 126 \relax + \catcode 32=\the \catcode 32 \relax + \catcode 9=\the \catcode 9 \relax + \endlinechar =\the \endlinechar \relax + \catcode 95=\the \catcode 95 \relax + \catcode 58=\the \catcode 58 \relax + \noexpand\fi +} \catcode126=10\relax % tilde is a space char. \catcode32=9\relax % space is ignored \catcode9=9\relax % tab also ignored @@ -583,39 +628,70 @@ \name_primitive:NN \pdfresettimer \pdf_resettimer:D \name_primitive:NN \pdfsetrandomseed \pdf_setrandomseed:D \name_primitive:NN \pdfnoligatures \pdf_noligatures:D -\name_primitive:NN \textdir \aleph_textdir:D +\name_primitive:NN \XeTeXversion \xetex_version:D +\name_primitive:NN \directlua \luatex_directlua:D +\etex_ifdefined:D \strcmp + \etex_ifdefined:D \xetex_version:D + \name_primitive:NN \strcmp \pdf_strcmp:D + \tex_fi:D +\tex_fi:D \tex_def:D\ExplSyntaxOn{ - \tex_def:D\ExplSyntaxStatus{00} - \tex_catcode:D 126=10 \tex_relax:D % tilde is a space char. - \tex_catcode:D 32=9 \tex_relax:D % space is ignored - \tex_catcode:D 9=9 \tex_relax:D % tab also ignored - \tex_endlinechar:D =32 \tex_relax:D % endline is space - \tex_catcode:D 95=11 \tex_relax:D % underscore letter - \tex_catcode:D 58=11 \tex_relax:D % colon letter -} -\tex_def:D\ExplSyntaxOff{ - \tex_def:D\ExplSyntaxStatus{01} - \tex_catcode:D 126=13 \tex_relax:D - \tex_catcode:D 32=10 \tex_relax:D - \tex_catcode:D 9=10 \tex_relax:D - \tex_endlinechar:D =13 \tex_relax:D - \tex_catcode:D 95=8 \tex_relax:D - \tex_catcode:D 58=12 \tex_relax:D + \tex_ifodd:D \ExplSyntaxStatus \tex_relax:D + \tex_else:D + \tex_edef:D\ExplSyntaxOff{ + \etex_unexpanded:D{ + \tex_ifodd:D \ExplSyntaxStatus \tex_relax:D + \tex_def:D \ExplSyntaxStatus{0} + } + \tex_catcode:D 126=\tex_the:D \tex_catcode:D 126 \tex_relax:D + \tex_catcode:D 32=\tex_the:D \tex_catcode:D 32 \tex_relax:D + \tex_catcode:D 9=\tex_the:D \tex_catcode:D 9 \tex_relax:D + \tex_endlinechar:D =\tex_the:D \tex_endlinechar:D \tex_relax:D + \tex_catcode:D 95=\tex_the:D \tex_catcode:D 95 \tex_relax:D + \tex_catcode:D 58=\tex_the:D \tex_catcode:D 58 \tex_relax:D + \tex_noexpand:D \tex_fi:D + } + \tex_def:D\ExplSyntaxStatus{1} + \tex_catcode:D 126=10 \tex_relax:D % tilde is a space char. + \tex_catcode:D 32=9 \tex_relax:D % space is ignored + \tex_catcode:D 9=9 \tex_relax:D % tab also ignored + \tex_endlinechar:D =32 \tex_relax:D % endline is space + \tex_catcode:D 95=11 \tex_relax:D % underscore letter + \tex_catcode:D 58=11 \tex_relax:D % colon letter + \tex_fi:D } -\tex_let:D \CodeStart \ExplSyntaxOn -\tex_let:D \CodeStop \ExplSyntaxOff -\tex_def:D \NamesStart{ +\tex_def:D\ExplSyntaxStatus{1} +\tex_def:D \ExplSyntaxNamesOn{ \tex_catcode:D `\_=11\tex_relax:D \tex_catcode:D `\:=11\tex_relax:D } -\tex_def:D \NamesStop{ +\tex_def:D \ExplSyntaxNamesOff{ \tex_catcode:D `\_=8\tex_relax:D \tex_catcode:D `\:=12\tex_relax:D } \tex_def:D\GetIdInfo{ \tex_begingroup:D \tex_catcode:D 32=10 \tex_relax:D % needed? Probably for now. - \GetIdInfoAuxi:w + \GetIdInfoMaybeMissing:w +} +\tex_def:D\GetIdInfoMaybeMissing:w$#1$#2{ + \tex_def:D \l_tmpa_tl {#1} + \tex_def:D \l_tmpb_tl {Id} + \tex_ifx:D \l_tmpa_tl \l_tmpb_tl + \tex_def:D \l_tmpa_tl { + \tex_endgroup:D + \tex_def:D\filedescription{#2} + \tex_def:D\filename {[unknown~name]} + \tex_def:D\fileversion {000} + \tex_def:D\fileauthor {[unknown~author]} + \tex_def:D\filedate {0000/00/00} + \tex_def:D\filenameext {[unknown~ext]} + \tex_def:D\filetimestamp {[unknown~timestamp]} + } + \tex_else:D + \tex_def:D \l_tmpa_tl {\GetIdInfoAuxi:w$#1${#2}} + \tex_fi:D + \l_tmpa_tl } \tex_def:D\GetIdInfoAuxi:w$#1~#2.#3~#4~#5~#6~#7~#8$#9{ \tex_endgroup:D @@ -653,27 +729,31 @@ \ProvidesClass{#1}[#2~v#3~#4] \ExplSyntaxOn } -\tex_let:D \org@onefilewithoptions\@onefilewithoptions -\tex_def:D \@onefilewithoptions#1[#2][#3]#4{ - \tex_edef:D \ExplSyntaxStack{ \ExplSyntaxStatus\ExplSyntaxStack } - \ExplSyntaxOff - \org@onefilewithoptions{#1}[{#2}][{#3}]{#4} - \tex_expandafter:D\ExplSyntaxPopStack\ExplSyntaxStack\tex_relax:D -} -\g@addto@macro\@popfilename{% - \tex_ifnum:D\tex_the:D\tex_catcode:D`\@=12\tex_relax:D +\tex_edef:D \@pushfilename{ + \etex_unexpanded:D{ + \tex_edef:D \ExplSyntaxStack{ \ExplSyntaxStatus \ExplSyntaxStack } \ExplSyntaxOff - \tex_fi:D + } + \etex_unexpanded:D\tex_expandafter:D{\@pushfilename } } -\tex_def:D\ExplSyntaxPopStack#1#2#3\tex_relax:D{ - \tex_def:D\ExplSyntaxStack{#3} - \tex_if:D#1#2 +\tex_edef:D \@popfilename{ + \etex_unexpanded:D\tex_expandafter:D{\@popfilename + \tex_if:D 2\ExplSyntaxStack 2 + \ExplSyntaxOff + \tex_else:D + \tex_expandafter:D\ExplSyntaxPopStack\ExplSyntaxStack\q_nil + \tex_fi:D + } +} +\tex_def:D\ExplSyntaxPopStack#1#2\q_nil{ + \tex_def:D\ExplSyntaxStack{#2} + \tex_ifodd:D#1\tex_relax:D \ExplSyntaxOn \tex_else:D \ExplSyntaxOff \tex_fi:D } -\tex_def:D\ExplSyntaxStack{} +\tex_def:D \ExplSyntaxStack{0} \tex_let:D\tex_input:D \@@input \tex_let:D\tex_underline:D \@@underline \tex_let:D\tex_end:D \@@end @@ -683,7 +763,6 @@ \tex_let:D\tex_hyphen:D \@@hyph \tex_let:D\par \tex_par:D \tex_ifx:D\name_undefine:N\@gobble - \AtEndOfPackage{\ExplSyntaxOff} \tex_def:D\name_pop_stack:w{} \tex_else:D \tex_def:D\ProvidesPackage{ @@ -715,6 +794,14 @@ \tex_fi:D} \tex_fi:D \tex_futurelet:D\name_tmp:\name_pop_stack:w +\tex_def:D \package_check_loaded_expl: { + \@ifpackageloaded{expl3}{}{ + \PackageError{expl3}{Cannot~load~the~expl3~modules~separately}{ + The~expl3~modules~cannot~be~loaded~separately;\MessageBreak + please~\protect\usepackage{expl3}~instead. + } + } +} %% %% %% End of file `l3names.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3num.sty b/Master/texmf-dist/tex/latex/expl3/l3num.sty index e34d1f82280..f2a12228b84 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3num.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3num.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3num.dtx Copyright (C) 2005-2008 Frank Mittelbach, LaTeX3 project +%% File: l3num.dtx Copyright (C) 2005-2009 Frank Mittelbach, 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,118 +48,53 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3num.dtx 741 2008-08-01 13:37:16Z morten $ +\GetIdInfo$Id: l3num.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental token numbers} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3expan}\par -\let_new:NN \num_value:w \tex_number:D -\let_new:NN \num_eval:w \etex_numexpr:D -\let_new:NN \num_eval_end: \scan_stop: -\let_new:NN \if_num:w \tex_ifnum:D -\let_new:NN \if_num_odd:w \tex_ifodd:D -\let_new:NN \if_case:w \tex_ifcase:D -\let_new:NN \or: \tex_or:D -\def:Npn \num_incr:N #1{\num_add:Nn#1 1} -\def:Npn \num_decr:N #1{\num_add:Nn#1 \c_minus_one} -\def:Npn \num_gincr:N #1{\num_gadd:Nn#1 1} -\def:Npn \num_gdecr:N #1{\num_gadd:Nn#1 \c_minus_one} -\def_new:Npn \num_incr:c {\exp_args:Nc \num_incr:N} -\def_new:Npn \num_decr:c {\exp_args:Nc \num_decr:N} -\def_new:Npn \num_gincr:c {\exp_args:Nc \num_gincr:N} -\def_new:Npn \num_gdecr:c {\exp_args:Nc \num_gdecr:N} -\def_new:Npn \num_zero:N #1 {\num_set:Nn #1 0} -\def_new:Npn \num_gzero:N #1 {\num_gset:Nn #1 0} -\def_new:Npn \num_zero:c {\exp_args:Nc \num_zero:N} -\def_new:Npn \num_gzero:c {\exp_args:Nc \num_gzero:N} -\def_new:Npn \num_new:N #1{\tlp_new:Nn #1{0}} -\def_new:Npn \num_new:c {\exp_args:Nc \num_new:N} -\def_new:Npn \num_eval:n #1{\num_eval:w #1\num_eval_end:} -\def_new:Npn \num_set:Nn #1#2{ - \tlp_set:No #1{ \tex_number:D \num_eval:n {#2} } +\package_check_loaded_expl: +\cs_new_eq:NN \if_num:w \tex_ifnum:D +\cs_new_eq:NN \if_case:w \tex_ifcase:D +\cs_set_nopar:Npn \num_incr:N #1{\num_add:Nn#1 1} +\cs_set_nopar:Npn \num_decr:N #1{\num_add:Nn#1 \c_minus_one} +\cs_set_nopar:Npn \num_gincr:N #1{\num_gadd:Nn#1 1} +\cs_set_nopar:Npn \num_gdecr:N #1{\num_gadd:Nn#1 \c_minus_one} +\cs_generate_variant:Nn \num_incr:N {c} +\cs_generate_variant:Nn \num_decr:N {c} +\cs_generate_variant:Nn \num_gincr:N {c} +\cs_generate_variant:Nn \num_gdecr:N {c} +\cs_new_nopar:Npn \num_zero:N #1 {\num_set:Nn #1 0} +\cs_new_nopar:Npn \num_gzero:N #1 {\num_gset:Nn #1 0} +\cs_generate_variant:Nn \num_zero:N {c} +\cs_generate_variant:Nn \num_gzero:N {c} +\cs_new_nopar:Npn \num_new:N #1{\tl_new:Nn #1{0}} +\cs_generate_variant:Nn \num_new:N {c} +\cs_new_nopar:Npn \num_set:Nn #1#2{ + \tl_set:No #1{ \tex_number:D \intexpr_eval:n {#2} } } -\def_new:Npn \num_gset:Nn {\pref_global:D \num_set:Nn} -\def_new:Npn \num_set:cn {\exp_args:Nc \num_set:Nn } -\def_new:Npn \num_gset:cn {\exp_args:Nc \num_gset:Nn } -\let_new:NN \num_set_eq:NN \tlp_set_eq:NN -\def_new:Npn \num_set_eq:cN {\exp_args:Nc \num_set_eq:NN} -\def_new:Npn \num_set_eq:Nc {\exp_args:NNc \num_set_eq:NN} -\def_new:Npn \num_set_eq:cc {\exp_args:Ncc \num_set_eq:NN} -\let_new:NN \num_gset_eq:NN \tlp_gset_eq:NN -\def_new:Npn \num_gset_eq:cN {\exp_args:Nc \num_gset_eq:NN} -\def_new:Npn \num_gset_eq:Nc {\exp_args:NNc \num_gset_eq:NN} -\def_new:Npn \num_gset_eq:cc {\exp_args:Ncc \num_gset_eq:NN} -\def_new:Npn \num_add:Nn #1#2 {\num_set:Nn #1{#1+#2}} -\def_new:Npn \num_add:cn {\exp_args:Nc\num_add:Nn} -\def_new:Npn \num_gadd:Nn {\pref_global:D \num_add:Nn} -\def_new:Npn \num_gadd:cn {\exp_args:Nc\num_gadd:Nn} -\let_new:NN\num_use:N \use_arg_i:n -\let_new:NN\num_use:c \cs_use:c -\def_test_function_new:npn {num_compare:nNn}#1#2#3{ - \if_num:w \num_eval:n {#1}#2\num_eval:n {#3} -} -\def_new:Npn \num_compare:cNcTF { \exp_args:NcNc\num_compare:nNnTF } -\def_new:Npn \num_compare_p:nNn #1#2#3{ - \if_num:w \num_eval:n {#1}#2\num_eval:n {#3} - \c_true - \else: - \c_false - \fi: -} -\def_new:Npn \num_abs:n#1{ - \if_num:w \num_eval:n{#1}<\c_zero \exp_after:NN -\fi: #1 -} -\def_new:Npn \num_max_of:nn#1#2{\num_compare:nNnTF {#1}>{#2}{#1}{#2}} -\def_new:Npn \num_min_of:nn#1#2{\num_compare:nNnTF {#1}<{#2}{#1}{#2}} -\def_long_new:Npn \num_elt_count:n #1 { + 1 } -\def_long_new:Npn \num_elt_count_prop:Nn #1#2 { + 1 } +\cs_generate_variant:Nn\num_set:Nn {c} +\cs_new_nopar:Npn \num_gset:Nn {\pref_global:D \num_set:Nn} +\cs_generate_variant:Nn\num_gset:Nn {c} +\cs_new_eq:NN \num_set_eq:NN \tl_set_eq:NN +\cs_generate_variant:Nn\num_set_eq:NN {c,Nc,cc} +\cs_new_eq:NN \num_gset_eq:NN \tl_gset_eq:NN +\cs_generate_variant:Nn\num_gset_eq:NN {c,Nc,cc} +\cs_new_nopar:Npn \num_add:Nn #1#2 {\num_set:Nn #1{#1+#2}} +\cs_generate_variant:Nn\num_add:Nn {c} +\cs_new_nopar:Npn \num_gadd:Nn {\pref_global:D \num_add:Nn} +\cs_generate_variant:Nn\num_gadd:Nn {c} +\cs_new_eq:NN\num_use:N \use:n +\cs_new_eq:NN\num_use:c \use:c +\cs_new_eq:NN\num_show:N \cs_show:N +\cs_new_eq:NN\num_show:c \cs_show:c +\cs_new:Npn \num_elt_count:n #1 { + 1 } +\cs_new:Npn \num_elt_count_prop:Nn #1#2 { + 1 } \num_new:N \l_tmpa_num \num_new:N \l_tmpb_num \num_new:N \l_tmpc_num \num_new:N \g_tmpa_num \num_new:N \g_tmpb_num -\engine_if_aleph:TF -{ - \let_new:NN \const_new_aux:Nw \tex_chardef:D - \const_new_aux:Nw \c_max_register_num = 65535 \scan_stop: -} -{ - \let_new:NN \const_new_aux:Nw \tex_mathchardef:D - \const_new_aux:Nw \c_max_register_num = 32767 \scan_stop: -} -\def_new:Npn \const_new:Nn #1#2 { - \num_compare:nNnTF {#2} > \c_minus_one - { - \num_compare:nNnTF {#2} > \c_max_register_num - {\int_new:N #1 \int_set:Nn #1{#2}} - {\chk_new_cs:N #1 \const_new_aux:Nw #1 = #2 \scan_stop: } - } - {\int_new:N #1 \int_set:Nn #1{#2}} -} - %% \tex_countdef:D \c_minus_one = 10 \scan_stop: - %% \c_minus_one = -1 \scan_stop: %% in l3basics - %% \tex_chardef:D \c_sixteen = 16\scan_stop: %% in l3basics -\const_new:Nn \c_zero {0} -\const_new:Nn \c_one {1} -\const_new:Nn \c_two {2} -\const_new:Nn \c_three {3} -\const_new:Nn \c_four {4} -\const_new:Nn \c_six {6} -\const_new:Nn \c_seven {7} -\const_new:Nn \c_nine {9} -\const_new:Nn \c_ten {10} -\const_new:Nn \c_eleven {11} -\const_new:Nn \c_thirty_two {32} -\const_new:Nn \c_hundred_one {101} -\const_new:Nn \c_twohundred_fifty_five {255} -\const_new:Nn \c_twohundred_fifty_six {256} -\const_new:Nn \c_thousand {1000} -\const_new:Nn \c_ten_thousand {10000} -\const_new:Nn \c_ten_thousand_one {10001} -\const_new:Nn \c_ten_thousand_two {10002} -\const_new:Nn \c_ten_thousand_three {10003} -\const_new:Nn \c_ten_thousand_four {10004} -\const_new:Nn \c_twenty_thousand {20000} +\tex_mathchardef:D \c_max_register_num = 32767 \scan_stop: %% %% %% End of file `l3num.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3precom.sty b/Master/texmf-dist/tex/latex/expl3/l3precom.sty index 39bf566c3f8..c8a07a52680 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3precom.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3precom.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3precom.dtx Copyright (C) 1990-2006 Frank Mittelbach, LaTeX3 project +%% File: l3precom.dtx Copyright (C) 1990-2006,2009 Frank Mittelbach, 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,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3precom.dtx 621 2007-09-01 20:14:19Z morten $ +\GetIdInfo$Id: l3precom.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental precompilation module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -57,83 +57,83 @@ \RequirePackage{l3seq} \RequirePackage{l3int} \iow_new:N\c_cs_dump_stream -\tlp_new:Nn\g_cs_dump_name_tlp{} +\tl_new:Nn\g_cs_dump_name_tl{} \seq_new:N\g_cs_dump_seq -\def_new:Npn\cs_record_name:N#1{ +\cs_new_nopar:Npn\cs_record_name:N#1{ \seq_gput_left:Nn \g_cs_trace_seq#1 \seq_gput_left:Nn \g_cs_dump_seq#1} -\def_new:Npn\cs_record_name:c{\exp_args:Nc\cs_record_name:N} -\def_new:Npn\cs_dump:{ -\iow_expanded_term:n{Precompiling~style~into~(\g_cs_dump_name_tlp)} -\iow_open:Nn\c_cs_dump_stream{\g_cs_dump_name_tlp} -\iow_expanded:Nn\c_cs_dump_stream +\cs_generate_variant:Nn \cs_record_name:N {c} +\cs_new_nopar:Npn\cs_dump:{ +\iow_term:x{Precompiling~style~into~(\g_cs_dump_name_tl)} +\iow_open:Nn\c_cs_dump_stream{\g_cs_dump_name_tl} +\iow_now:Nx\c_cs_dump_stream {\group_begin: -\tex_catcode:D`\token_to_string:N\*=11\scan_stop: -\token_to_string:N\CodeStart +\tex_catcode:D`\token_to_str:N\*=11\scan_stop: +\token_to_str:N\ExplSyntaxOn } \seq_map_inline:Nn \g_cs_dump_seq {\tex_message:D{.} -\iow_expanded:Nn\c_cs_dump_stream - {\exp_not:n{\gdef:Npn ##1} - {\tlp_to_str:N##1}} +\iow_now:Nx\c_cs_dump_stream + {\exp_not:n{\cs_gset_nopar:Npn ##1} + {\tl_to_str:N##1}} } -\iow_expanded:Nn \c_cs_dump_stream {\exp_not:n{\num_gset:Nn +\iow_now:Nx \c_cs_dump_stream {\exp_not:n{\num_gset:Nn \g_gen_sym_num} {\num_use:N\g_gen_sym_num}^^J \exp_not:n{\num_gset:Nn \g_ggen_sym_num} {\num_use:N\g_ggen_sym_num}} -\iow_expanded:Nn +\iow_now:Nx \c_cs_dump_stream {\group_end:} \iow_close:N\c_cs_dump_stream \tex_message:D{~finished} } -\def_new:Npn\cs_load_dump:n#1{ +\cs_new_nopar:Npn\cs_load_dump:n#1{ \file_not_found:nTF{#1.cmp} -{\tlp_gset:Nn\g_cs_dump_name_tlp{#1.cmp}} +{\tl_gset:Nn\g_cs_dump_name_tl{#1.cmp}} {\input{#1.cmp} -\let:NN\cs_dump:\fi: +\cs_set_eq:NN\cs_dump:\fi: \if_false:}} \num_new:N\g_gen_sym_num \num_gset:Nn\g_gen_sym_num{0} \num_new:N\g_ggen_sym_num \num_gset:Nn\g_ggen_sym_num{0} -\def_new:Npn\cs_gen_sym:N#1{ +\cs_new_nopar:Npn\cs_gen_sym:N#1{ \num_gincr:N\g_gen_sym_num -\tlp_set:Nc#1{l*\tex_romannumeral:D\num_use:N\g_gen_sym_num} -\exp_after:NN\cs_record_name:N#1 -\exp_after:NN\tlp_clear_new:N#1} -\def_new:Npn\cs_ggen_sym:N#1{ +\tl_set:Nc#1{l*\tex_romannumeral:D\num_use:N\g_gen_sym_num} +\exp_after:wN\cs_record_name:N#1 +\exp_after:wN\tl_clear_new:N#1} +\cs_new_nopar:Npn\cs_ggen_sym:N#1{ \num_gincr:N\g_ggen_sym_num -\tlp_set:Nc#1{g*\tex_romannumeral:D\num_use:N\g_ggen_sym_num} -\exp_after:NN\cs_record_name:N#1 -\exp_after:NN\tlp_clear_new:N#1} +\tl_set:Nc#1{g*\tex_romannumeral:D\num_use:N\g_ggen_sym_num} +\exp_after:wN\cs_record_name:N#1 +\exp_after:wN\tl_clear_new:N#1} \seq_new:N\g_cs_trace_seq \seq_new:N\g_register_trace_seq -\def:Npn\cs_record_meaning:N#1{ +\cs_set_nopar:Npn\cs_record_meaning:N#1{ \seq_gput_left:Nn \g_cs_trace_seq#1} -\def:Npn\register_record_name:N#1{ +\cs_set_nopar:Npn\register_record_name:N#1{ \seq_gput_left:Nn \g_register_trace_seq#1} -\def_new:Npn\dumpLaTeXstate#1{ - \iow_expanded_term:n{Dumping~commands~into~(#1.dmp)} +\cs_new_nopar:Npn\dumpLaTeXstate#1{ + \iow_term:x{Dumping~commands~into~(#1.dmp)} \iow_open:Nn\c_cs_dump_stream{#1.dmp} \seq_map_inline:Nn \g_cs_trace_seq {\tex_message:D{.} - \iow_expanded:Nn\c_cs_dump_stream - {\token_to_string:N##1~ + \iow_now:Nx\c_cs_dump_stream + {\token_to_str:N##1~ \token_to_meaning:N##1} } \tex_message:D{~registers} \seq_map_inline:Nn \g_register_trace_seq {\tex_message:D{.} - \iow_expanded:Nn\c_cs_dump_stream - {\token_to_string:N##1 - \the_internal:D##1} + \iow_now:Nx\c_cs_dump_stream + {\token_to_str:N##1 + \toks_use:N##1} } \tex_message:D{~finished} } diff --git a/Master/texmf-dist/tex/latex/expl3/l3prg.sty b/Master/texmf-dist/tex/latex/expl3/l3prg.sty index 7cc170fef4f..d696e412e06 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3prg.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3prg.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3prg.dtx Copyright (C) 2005-2006 LaTeX3 project +%% File: l3prg.dtx Copyright (C) 2005-2009 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,301 +48,325 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 768 2008-08-05 19:45:06Z morten $ +\GetIdInfo$Id: l3prg.dtx 1365 2009-05-31 17:26:17Z mittelba $ {L3 Experimental control structures} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3quark} -\RequirePackage{l3toks} -\RequirePackage{l3int} -\def_new:Npn \mode_if_vertical_p: { - \if_mode_vertical: \c_true \else: \c_false\fi:} -\def_test_function_new:npn{mode_if_vertical:}{\if_mode_vertical:} -\def_new:Npn \mode_if_horizontal_p: { - \if_mode_horizontal: \c_true \else: \c_false\fi:} -\def_test_function_new:npn{mode_if_horizontal:}{\if_mode_horizontal:} -\def_new:Npn \mode_if_inner_p: { - \if_mode_inner: \c_true \else: \c_false\fi:} -\def_test_function_new:npn{mode_if_inner:}{\if_mode_inner:} -\def_test_function_new:npn{mode_if_math:} { - \scan_align_safe_stop: \if_mode_math: } -\def_new:Npn \group_align_safe_begin: { +\package_check_loaded_expl: +\prg_set_conditional:Npnn \mode_if_vertical: {p,TF,T,F}{ + \if_mode_vertical: + \prg_return_true: \else: \prg_return_false: \fi: +} +\prg_set_conditional:Npnn \mode_if_horizontal: {p,TF,T,F}{ + \if_mode_horizontal: + \prg_return_true: \else: \prg_return_false: \fi: +} +\prg_set_conditional:Npnn \mode_if_inner: {p,TF,T,F}{ + \if_mode_inner: + \prg_return_true: \else: \prg_return_false: \fi: +} +\prg_set_conditional:Npnn \mode_if_math: {p,TF,T,F}{ + \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_num:w`}=\c_zero\fi:} -\def_new:Npn \group_align_safe_end: {\if_num:w`{=\c_zero}\fi:} -\def_new:Npn \scan_align_safe_stop: { - \num_compare:nNnT \etex_currentgrouptype:D = \c_six +\cs_new_nopar:Npn \group_align_safe_end: {\if_num:w`{=\c_zero}\fi:} +\cs_new_nopar:Npn \scan_align_safe_stop: { + \intexpr_compare:nNnT \etex_currentgrouptype:D = \c_six { - \num_compare:nNnF \etex_lastnodetype:D = \c_zero + \intexpr_compare:nNnF \etex_lastnodetype:D = \c_zero { - \num_compare:nNnF \etex_lastnodetype:D = \c_seven + \intexpr_compare:nNnF \etex_lastnodetype:D = \c_seven \scan_stop: } } } -\def_new:Npn \prg_replicate:nn #1{ - \cs:w use_noop: - \exp_after:NN\prg_replicate_first_aux:N - \int_use:N \int_eval:n{#1} \cs_end: +\cs_new_nopar:Npn \prg_replicate:nn #1{ + \cs:w prg_do_nothing: + \exp_after:wN\prg_replicate_first_aux:N + \tex_romannumeral:D -`\q \intexpr_eval:n{#1} \cs_end: \cs_end: } -\def_new:Npn \prg_replicate_aux:N#1{ +\cs_new_nopar:Npn \prg_replicate_aux:N#1{ \cs:w prg_replicate_#1:n\prg_replicate_aux:N } -\def_new:Npn \prg_replicate_first_aux:N#1{ +\cs_new_nopar:Npn \prg_replicate_first_aux:N#1{ \cs:w prg_replicate_first_#1:n\prg_replicate_aux:N } -\def_new:Npn \prg_replicate_ :n #1{}% no, this is not a typo! -\def_long_new:cpn {prg_replicate_0:n}#1{\cs_end:{#1#1#1#1#1#1#1#1#1#1}} -\def_long_new:cpn {prg_replicate_1:n}#1{\cs_end:{#1#1#1#1#1#1#1#1#1#1}#1} -\def_long_new:cpn {prg_replicate_2:n}#1{\cs_end:{#1#1#1#1#1#1#1#1#1#1}#1#1} -\def_long_new:cpn {prg_replicate_3:n}#1{ +\cs_new_nopar:Npn \prg_replicate_ :n #1{}% no, this is not a typo! +\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} -\def_long_new:cpn {prg_replicate_4:n}#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} -\def_long_new:cpn {prg_replicate_5:n}#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} -\def_long_new:cpn {prg_replicate_6:n}#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} -\def_long_new:cpn {prg_replicate_7:n}#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} -\def_long_new:cpn {prg_replicate_8:n}#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} -\def_long_new:cpn {prg_replicate_9:n}#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} -\def_long_new:cpn {prg_replicate_first_0:n}#1{\cs_end: } -\def_long_new:cpn {prg_replicate_first_1:n}#1{\cs_end: #1} -\def_long_new:cpn {prg_replicate_first_2:n}#1{\cs_end: #1#1} -\def_long_new:cpn {prg_replicate_first_3:n}#1{\cs_end: #1#1#1} -\def_long_new:cpn {prg_replicate_first_4:n}#1{\cs_end: #1#1#1#1} -\def_long_new:cpn {prg_replicate_first_5:n}#1{\cs_end: #1#1#1#1#1} -\def_long_new:cpn {prg_replicate_first_6:n}#1{\cs_end: #1#1#1#1#1#1} -\def_long_new:cpn {prg_replicate_first_7:n}#1{\cs_end: #1#1#1#1#1#1#1} -\def_long_new:cpn {prg_replicate_first_8:n}#1{\cs_end: #1#1#1#1#1#1#1#1} -\def_long_new:cpn {prg_replicate_first_9:n}#1{\cs_end: #1#1#1#1#1#1#1#1#1} -\def_long_new:NNn \prg_stepwise_function:nnnN 2{ - \num_compare:nNnTF{#2}<\c_zero - {\exp_args:No\prg_stepwise_function_decr:nnnN } - {\exp_args:No\prg_stepwise_function_incr:nnnN } - {\int_use:N\int_eval:n{#1}}{#2} -} -\def_long_new:NNn \prg_stepwise_function_incr:nnnN 4{ - \num_compare:nNnF {#1}>{#3} +\cs_new:cpn {prg_replicate_first_0:n}#1{\cs_end: } +\cs_new:cpn {prg_replicate_first_1:n}#1{\cs_end: #1} +\cs_new:cpn {prg_replicate_first_2:n}#1{\cs_end: #1#1} +\cs_new:cpn {prg_replicate_first_3:n}#1{\cs_end: #1#1#1} +\cs_new:cpn {prg_replicate_first_4:n}#1{\cs_end: #1#1#1#1} +\cs_new:cpn {prg_replicate_first_5:n}#1{\cs_end: #1#1#1#1#1} +\cs_new:cpn {prg_replicate_first_6:n}#1{\cs_end: #1#1#1#1#1#1} +\cs_new:cpn {prg_replicate_first_7:n}#1{\cs_end: #1#1#1#1#1#1#1} +\cs_new:cpn {prg_replicate_first_8:n}#1{\cs_end: #1#1#1#1#1#1#1#1} +\cs_new:cpn {prg_replicate_first_9:n}#1{\cs_end: #1#1#1#1#1#1#1#1#1} +\cs_new:Npn \prg_stepwise_function:nnnN #1#2{ + \intexpr_compare:nNnTF{#2}<\c_zero + {\exp_args:Nf\prg_stepwise_function_decr:nnnN } + {\exp_args:Nf\prg_stepwise_function_incr:nnnN } + {\intexpr_eval:n{#1}}{#2} +} +\cs_new:Npn \prg_stepwise_function_incr:nnnN #1#2#3#4{ + \intexpr_compare:nNnF {#1}>{#3} { #4{#1} - \exp_args:No \prg_stepwise_function_incr:nnnN - {\int_use:N\int_eval:n{#1 + #2}} + \exp_args:Nf \prg_stepwise_function_incr:nnnN + {\intexpr_eval:n{#1 + #2}} {#2}{#3}{#4} } } -\def_long_new:NNn \prg_stepwise_function_decr:nnnN 4{ - \num_compare:nNnF {#1}<{#3} +\cs_new:Npn \prg_stepwise_function_decr:nnnN #1#2#3#4{ + \intexpr_compare:nNnF {#1}<{#3} { #4{#1} - \exp_args:No \prg_stepwise_function_decr:nnnN - {\int_use:N\int_eval:n{#1 + #2}} + \exp_args:Nf \prg_stepwise_function_decr:nnnN + {\intexpr_eval:n{#1 + #2}} {#2}{#3}{#4} } } \int_new:N\g_prg_inline_level_int -\def_long_new:NNn\prg_stepwise_inline:nnnn 4{ +\cs_new:Npn\prg_stepwise_inline:nnnn #1#2#3#4{ \int_gincr:N \g_prg_inline_level_int - \gdef:cpn{prg_stepwise_inline_\int_use:N\g_prg_inline_level_int :n}##1{#4} - \num_compare:nNnTF {#2}<\c_zero - {\exp_args:Nco \prg_stepwise_inline_decr:Nnnn } - {\exp_args:Nco \prg_stepwise_inline_incr:Nnnn } + \cs_gset_nopar:cpn{prg_stepwise_inline_\int_use:N\g_prg_inline_level_int :n}##1{#4} + \intexpr_compare:nNnTF {#2}<\c_zero + {\exp_args:Ncf \prg_stepwise_inline_decr:Nnnn } + {\exp_args:Ncf \prg_stepwise_inline_incr:Nnnn } {prg_stepwise_inline_\int_use:N\g_prg_inline_level_int :n} - {\int_use:N\int_eval:n{#1}} {#2} {#3} + {\intexpr_eval:n{#1}} {#2} {#3} \int_gdecr:N \g_prg_inline_level_int } -\def_long_new:NNn \prg_stepwise_inline_incr:Nnnn 4{ - \num_compare:nNnF {#2}>{#4} +\cs_new:Npn \prg_stepwise_inline_incr:Nnnn #1#2#3#4{ + \intexpr_compare:nNnF {#2}>{#4} { #1{#2} - \exp_args:NNo \prg_stepwise_inline_incr:Nnnn #1 - {\int_use:N\int_eval:n{#2 + #3}} {#3}{#4} + \exp_args:NNf \prg_stepwise_inline_incr:Nnnn #1 + {\intexpr_eval:n{#2 + #3}} {#3}{#4} } } -\def_long_new:NNn \prg_stepwise_inline_decr:Nnnn 4{ - \num_compare:nNnF {#2}<{#4} +\cs_new:Npn \prg_stepwise_inline_decr:Nnnn #1#2#3#4{ + \intexpr_compare:nNnF {#2}<{#4} { #1{#2} - \exp_args:NNo \prg_stepwise_inline_decr:Nnnn #1 - {\int_use:N\int_eval:n{#2 + #3}} {#3}{#4} + \exp_args:NNf \prg_stepwise_inline_decr:Nnnn #1 + {\intexpr_eval:n{#2 + #3}} {#3}{#4} } } -\def_long_new:NNn \prg_stepwise_variable:nnnNn 2 { - \num_compare:nNnTF {#2}<\c_zero - {\exp_args:No\prg_stepwise_variable_decr:nnnNn} - {\exp_args:No\prg_stepwise_variable_incr:nnnNn} - {\int_use:N\int_eval:n{#1}}{#2} +\cs_new:Npn \prg_stepwise_variable:nnnNn #1#2 { + \intexpr_compare:nNnTF {#2}<\c_zero + {\exp_args:Nf\prg_stepwise_variable_decr:nnnNn} + {\exp_args:Nf\prg_stepwise_variable_incr:nnnNn} + {\intexpr_eval:n{#1}}{#2} } -\def_long_new:NNn \prg_stepwise_variable_incr:nnnNn 5 { - \num_compare:nNnF {#1}>{#3} +\cs_new:Npn \prg_stepwise_variable_incr:nnnNn #1#2#3#4#5 { + \intexpr_compare:nNnF {#1}>{#3} { - \def:Npn #4{#1} #5 - \exp_args:No \prg_stepwise_variable_incr:nnnNn - {\int_use:N\int_eval:n{#1 + #2}}{#2}{#3}#4{#5} + \cs_set_nopar:Npn #4{#1} #5 + \exp_args:Nf \prg_stepwise_variable_incr:nnnNn + {\intexpr_eval:n{#1 + #2}}{#2}{#3}#4{#5} } } -\def_long_new:NNn \prg_stepwise_variable_decr:nnnNn 5 { - \num_compare:nNnF {#1}<{#3} +\cs_new:Npn \prg_stepwise_variable_decr:nnnNn #1#2#3#4#5 { + \intexpr_compare:nNnF {#1}<{#3} { - \def:Npn #4{#1} #5 - \exp_args:No \prg_stepwise_variable_decr:nnnNn - {\int_use:N\int_eval:n{#1 + #2}}{#2}{#3}#4{#5} + \cs_set_nopar:Npn #4{#1} #5 + \exp_args:Nf \prg_stepwise_variable_decr:nnnNn + {\intexpr_eval:n{#1 + #2}}{#2}{#3}#4{#5} } } -\def_new:Npn \bool_new:N #1 { \let_new:NN #1 \c_false } -\def_new:Npn \bool_new:c #1 { \let_new:cN {#1} \c_false } -\def_new:Npn \bool_set_true:N #1 { \let:NN #1 \c_true } -\def_new:Npn \bool_set_true:c #1 { \let:cN {#1} \c_true } -\def_new:Npn \bool_set_false:N #1 { \let:NN #1 \c_false } -\def_new:Npn \bool_set_false:c #1 { \let:cN {#1} \c_false } -\def_new:Npn \bool_gset_true:N #1 { \glet:NN #1 \c_true } -\def_new:Npn \bool_gset_true:c #1 { \glet:cN {#1} \c_true } -\def_new:Npn \bool_gset_false:N #1 { \glet:NN #1 \c_false } -\def_new:Npn \bool_gset_false:c #1 { \glet:cN {#1} \c_false } -\let_new:NN \bool_set_eq:NN \let:NN -\let_new:NN \bool_set_eq:Nc \let:Nc -\let_new:NN \bool_set_eq:cN \let:cN -\let_new:NN \bool_set_eq:cc \let:cc -\let_new:NN \bool_gset_eq:NN \glet:NN -\let_new:NN \bool_gset_eq:Nc \glet:Nc -\let_new:NN \bool_gset_eq:cN \glet:cN -\let_new:NN \bool_gset_eq:cc \glet:cc +\cs_new_nopar:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool } +\cs_new_nopar:Npn \bool_new:c #1 { \cs_new_eq:cN {#1} \c_false_bool } +\cs_new_nopar:Npn \bool_set_true:N #1 { \cs_set_eq:NN #1 \c_true_bool } +\cs_new_nopar:Npn \bool_set_true:c #1 { \cs_set_eq:cN {#1} \c_true_bool } +\cs_new_nopar:Npn \bool_set_false:N #1 { \cs_set_eq:NN #1 \c_false_bool } +\cs_new_nopar:Npn \bool_set_false:c #1 { \cs_set_eq:cN {#1} \c_false_bool } +\cs_new_nopar:Npn \bool_gset_true:N #1 { \cs_gset_eq:NN #1 \c_true_bool } +\cs_new_nopar:Npn \bool_gset_true:c #1 { \cs_gset_eq:cN {#1} \c_true_bool } +\cs_new_nopar:Npn \bool_gset_false:N #1 { \cs_gset_eq:NN #1 \c_false_bool } +\cs_new_nopar:Npn \bool_gset_false:c #1 { \cs_gset_eq:cN {#1} \c_false_bool } +\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 \bool_new:N \l_tmpa_bool \bool_new:N \g_tmpa_bool -\def_test_function_new:npn{bool_if:N}#1{\if:w #1} -\def_new:Npn \bool_if:cTF{\exp_args:Nc\bool_if:NTF} -\def_new:Npn \bool_if:cT{\exp_args:Nc\bool_if:NT} -\def_new:Npn \bool_if:cF{\exp_args:Nc\bool_if:NF} -\def_new:Npn \bool_if_p:N #1 { #1 } -\let_new:NN \bool_if_p:c \cs_use:c -\def_long_new:Npn \bool_whiledo:NT #1 #2 { - \bool_if:NT #1 {#2 \bool_whiledo:NT #1 {#2}} -} -\def_new:Npn \bool_whiledo:cT{\exp_args:Nc\bool_whiledo:NT} -\def_long_new:Npn \bool_whiledo:NF #1 #2 { - \bool_if:NF #1 {#2 \bool_whiledo:NF #1 {#2}} -} -\def_new:Npn \bool_whiledo:cF{\exp_args:Nc\bool_whiledo:NF} -\def_long_new:Npn \bool_dowhile:NT #1 #2 { - #2 \bool_if:NT #1 {\bool_dowhile:NT #1 {#2}} -} -\def_new:Npn \bool_dowhile:cT{\exp_args:Nc\bool_dowhile:NT} -\def_long_new:Npn \bool_dowhile:NF #1 #2 { - #2 \bool_if:NF #1 {\bool_dowhile:NF #1 {#2}} -} -\def_new:Npn \bool_dowhiledo:cF{\exp_args:Nc\bool_dowhile:cF} -\def_new:Npn \bool_double_if:NNnnnn#1#2{ - \if_case:w \num_eval:w #1\scan_stop: - \if_case:w \num_eval:w #2\scan_stop: - \exp_after:NN\exp_after:NN\exp_after:NN \use_arg_i:nnnn - \else: - \exp_after:NN\exp_after:NN\exp_after:NN \use_arg_ii:nnnn - \fi: - \else: - \if_case:w \num_eval:w #2\scan_stop: - \exp_after:NN\exp_after:NN\exp_after:NN \use_arg_iii:nnnn - \else: - \exp_after:NN\exp_after:NN\exp_after:NN \use_arg_iv:nnnn - \fi: - \fi: -} -\def_new:Npn \bool_double_if:cNnnnn{\exp_args:Nc\bool_double_if:NNnnnn} -\def_new:Npn \bool_double_if:Ncnnnn{\exp_args:NNc\bool_double_if:NNnnnn} -\def_new:Npn \bool_double_if:ccnnnn{\exp_args:Ncc\bool_double_if:NNnnnn} -\def_long_new:Npn \prg_whiledo:nT #1#2{ - #1 {#2 \prg_whiledo:nT {#1}{#2}} -} -\def_long_new:Npn \prg_whiledo:nF #1#2{ - #1 {#2 \prg_whiledo:nF {#1}{#2}} -} -\def_long_new:Npn \prg_dowhile:nT #1#2{ - #2 #1 {\prg_dowhile:nT {#1}{#2}} -} -\def_long_new:Npn \prg_dowhile:nF #1#2{ - #2 #1 {\prg_dowhile:nF {#1}{#2}} -} -\def_long_new:Npn \predicate_p:n #1{ +\prg_set_conditional:Npnn \bool_if:N #1 {p,TF,T,F}{ + \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:NTF {c} +\cs_generate_variant:Nn \bool_if:NT {c} +\cs_generate_variant:Nn \bool_if:NF {c} +\cs_new:Npn \bool_while_do:Nn #1 #2 { + \bool_if:NT #1 {#2 \bool_while_do:Nn #1 {#2}} +} +\cs_generate_variant:Nn \bool_while_do:Nn {c} +\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_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_generate_variant:Nn \bool_do_while:Nn {c} +\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_until:Nn {c} +\cs_set:Npn \bool_if_p:n #1{ \group_align_safe_begin: - \exp_after:NN \predicate_auxi:NN - \int_to_roman:w-`\q #1 02\scan_stop: + \bool_get_next:N ( #1 )S } -\def_long_test_function_new:npn {predicate:n}#1{ - \group_align_safe_begin: - \if:w \exp_after:NN \predicate_auxi:NN - \int_to_roman:w-`\q #1 02\scan_stop: +\cs_set:Npn \bool_get_next:N #1{ + \use:c { + bool_ + \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi: + :w + } #1 } -\def_new:Npn \predicate_auxi:NN 0 #1{ - \exp_after:NN \predicate_auxii:NNN \exp_after:NN #1 +\cs_set:cpn {bool_!:w}#1{ + \exp_after:wN \intexpr_if_even_p:n \tex_number:D \bool_get_next:N +} +\cs_set:cpn {bool_(:w}#1{ + \exp_after:wN \bool_cleanup:N \tex_number:D \bool_get_next:N +} +\cs_set:cpn {bool_p:w}{\exp_after:wN \bool_cleanup:N \tex_number:D } +\cs_new_nopar:Npn \bool_cleanup:N #1{ + \exp_after:wN \bool_choose:NN \exp_after:wN #1 \int_to_roman:w-`\q } -\def_new:Npn \predicate_auxii:NNN #1#2#3{ - \cs_use:c{predicate_#2#3_#1:w} } -\def_new:cpn{predicate_&&_0:w}{ - \exp_after:NN \predicate_auxi:NN\int_to_roman:w-`\q -} -\def_long_new:cpn{predicate_&&_1:w} #1 02\scan_stop:{ - \group_align_safe_end: 01} -\def_long_new:cpn{predicate_||_0:w} #1 02\scan_stop:{ - \group_align_safe_end: 00} -\def_new:cpn{predicate_||_1:w}{ - \exp_after:NN \predicate_auxi:NN\int_to_roman:w-`\q -} -\def_new:cpn{predicate_02_0:w}\scan_stop:{ \group_align_safe_end: 00 } -\def_new:cpn{predicate_02_1:w}\scan_stop:{ \group_align_safe_end: 01 } -\def_long_new:Npn \predicate_not_p:n #1{ - \if:w \predicate_p:n{#1} \c_false \else: \c_true \fi: -} -\def_long:Npn \prg_case_int:nnn #1 #2 { - \exp_args:No \prg_case_int_aux:nnn {\num_value:w \int_eval:n{#1}} #2 +\cs_new_nopar:Npn \bool_choose:NN #1#2{ \use:c{bool_#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_)_0:w}{ \c_false_bool } +\cs_new_nopar:cpn{bool_)_1:w}{ \c_true_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_set:cpn{bool_&_0:w}&{\bool_eval_skip_to_end:Nw \c_false_bool} +\cs_set:cpn{bool_|_1:w}|{\bool_eval_skip_to_end:Nw \c_true_bool} +\cs_set:Npn \bool_eval_skip_to_end:Nw #1#2){ + \bool_eval_skip_to_end_aux:Nw #1 #2(\q_no_value\q_nil{#2} +} +\cs_set:Npn \bool_eval_skip_to_end_aux:Nw #1#2(#3#4\q_nil#5{ + \quark_if_no_value:NTF #3 + { #1 } + { \bool_eval_skip_to_end_auxii:Nw #1 #5 } +} +\cs_set:Npn \bool_eval_skip_to_end_auxii:Nw #1#2(#3){ + \bool_eval_skip_to_end:Nw #1#3 ) +} +\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} +\cs_new:Npn \bool_not_p:n #1{ \bool_if_p:n{!(#1)} } +\cs_new:Npn \bool_xor_p:nn #1#2 { + \intexpr_compare:nNnTF {\bool_if_p:n { #1 }} = {\bool_if_p:n { #2 }} + {\c_false_bool}{\c_true_bool} +} +\prg_set_conditional:Npnn \bool_if:n #1 {TF,T,F}{ + \if_predicate:w \bool_if_p:n{#1} + \prg_return_true: \else: \prg_return_false: \fi: +} +\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_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_new:Npn \prg_case_int:nnn #1 #2 { + \exp_args:Nf \prg_case_int_aux:nnn { \intexpr_eval:n{#1}} #2 \q_recursion_tail ? \q_recursion_stop } -\def_long_new:Npn \prg_case_int_aux:nnn #1#2#3{ - \quark_if_recursion_tail_stop_do:nn{#2}{\use_arg_i:n} - \num_compare:nNnTF{#1}={#2} - { \use_arg_i_delimit_by_q_recursion_stop:nw {\use_arg_i:nn{#3}} } +\cs_new:Npn \prg_case_int_aux:nnn #1#2#3{ + \quark_if_recursion_tail_stop_do:nn{#2}{\use:n} + \intexpr_compare:nNnTF{#1}={#2} + { \prg_end_case:nw {#3} } { \prg_case_int_aux:nnn {#1}} } -\def_long:Npn \prg_case_dim:nnn #1 #2 { +\cs_new:Npn \prg_case_dim:nnn #1 #2 { \exp_args:No \prg_case_dim_aux:nnn {\dim_use:N \dim_eval:n{#1}} #2 \q_recursion_tail ? \q_recursion_stop } -\def_long_new:Npn \prg_case_dim_aux:nnn #1#2#3{ - \quark_if_recursion_tail_stop_do:nn{#2}{\use_arg_i:n} +\cs_new:Npn \prg_case_dim_aux:nnn #1#2#3{ + \quark_if_recursion_tail_stop_do:nn{#2}{\use:n} \dim_compare:nNnTF{#1}={#2} - { \use_arg_i_delimit_by_q_recursion_stop:nw {\use_arg_i:nn{#3}} } + { \prg_end_case:nw {#3} } { \prg_case_dim_aux:nnn {#1}} } -\def_long:Npn \prg_case_str:nnn #1 #2 { +\cs_new:Npn \prg_case_str:nnn #1 #2 { \prg_case_str_aux:nnn {#1} #2 \q_recursion_tail ? \q_recursion_stop } -\def_long_new:Npn \prg_case_str_aux:nnn #1#2#3{ - \quark_if_recursion_tail_stop_do:nn{#2}{\use_arg_i:n} - \tlist_if_eq:xxTF{#1}{#2} - { \use_arg_i_delimit_by_q_recursion_stop:nw {\use_arg_i:nn{#3}} } +\cs_new:Npn \prg_case_str_aux:nnn #1#2#3{ + \quark_if_recursion_tail_stop_do:nn{#2}{\use:n} + \tl_if_eq:xxTF{#1}{#2} + { \prg_end_case:nw {#3} } { \prg_case_str_aux:nnn {#1}} } -\def_new:NNn \prg_define_quicksort:nnn 3 { - \def_long:cNx{#1_quicksort:n}1{ +\cs_new:Npn \prg_case_tl:Nnn #1 #2 { + \prg_case_tl_aux:NNn #1 #2 + \q_recursion_tail ? \q_recursion_stop +} +\cs_new:Npn \prg_case_tl_aux:NNn #1#2#3{ + \quark_if_recursion_tail_stop_do:Nn #2{\use:n} + \tl_if_eq:NNTF #1 #2 + { \prg_end_case:nw {#3} } + { \prg_case_tl_aux:NNn #1} +} +\cs_new:Npn \prg_end_case:nw #1#2\q_recursion_stop#3{#1} + +\cs_new_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} } - \def_long:cNx{#1_quicksort_braced:n}1{ + \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 } - \def_long:cpx {#1_quicksort_start_partition:w} #2 ##1 #3{ + \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}{}{} } - \def_long:cNx {#1_quicksort_start_partition_braced:n} 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}{}{} } - \def_long:cpx {#1_quicksort_do_partition_i:nnnw} ##1##2##3 #2 ##4 #3 { + \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} @@ -351,7 +375,7 @@ } {##1}{##2}{##3}{##4} } - \def_long:cNx {#1_quicksort_do_partition_i_braced:nnnn} 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} @@ -360,7 +384,7 @@ } {##1}{##2}{##3}{##4} } - \def_long:cpx {#1_quicksort_do_partition_ii:nnnw} ##1##2##3 #2 ##4 #3 { + \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} @@ -369,7 +393,7 @@ } {##1}{##2}{##3}{##4} } - \def_long:cNx {#1_quicksort_do_partition_ii_braced:nnnn} 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} @@ -378,31 +402,31 @@ } {##1}{##2}{##3}{##4} } - \def_long:cNx {#1_quicksort_partition_less_i:nnnn} 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}} - \def_long:cNx {#1_quicksort_partition_less_ii:nnnn} 4{ + \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}}} - \def_long:cNx {#1_quicksort_partition_greater_i:nnnn} 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}} - \def_long:cNx {#1_quicksort_partition_greater_ii:nnnn} 4{ + \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}} - \def_long:cNx {#1_quicksort_partition_less_i_braced:nnnn} 4{ + \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}} - \def_long:cNx {#1_quicksort_partition_less_ii_braced:nnnn} 4{ + \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}}} - \def_long:cNx {#1_quicksort_partition_greater_i_braced:nnnn} 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}} - \def_long:cNx {#1_quicksort_partition_greater_ii_braced:nnnn} 4{ + \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}} - \def_long:cpx {#1_do_quicksort_braced:nnnnw} ##1##2##3##4\q_stop { + \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}{}{} -\let:NN \prg_quicksort_function:n \ERROR -\let:NN \prg_quicksort_compare:nnTF \ERROR +\cs_set:Npn \prg_quicksort_function:n {\ERROR} +\cs_set:Npn \prg_quicksort_compare:nnTF {\ERROR} %% %% %% End of file `l3prg.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3prop.sty b/Master/texmf-dist/tex/latex/expl3/l3prop.sty index 21ff956c0fd..e18fb8e2b7f 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3prop.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3prop.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3prop.dtx Copyright (C) 1990-2008 LaTeX3 project +%% File: l3prop.dtx Copyright (C) 1990-2009 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,202 +48,143 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prop.dtx 745 2008-08-03 18:50:46Z morten $ +\GetIdInfo$Id: l3prop.dtx 1365 2009-05-31 17:26:17Z mittelba $ {L3 Experimental Property Lists} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3toks}\par -\RequirePackage{l3quark}\par +\package_check_loaded_expl: \quark_new:N\q_prop - -\def_new:Npn \prop_new:N #1{\toks_new:N #1} -\def_new:Npn \prop_new:c {\exp_args:Nc \prop_new:N} -\let_new:NN \prop_clear:N \toks_clear:N -\def_new:Npn \prop_clear:c {\exp_args:Nc\prop_clear:N} -\let_new:NN \prop_gclear:N \toks_gclear:N -\def_new:Npn \prop_gclear:c {\exp_args:Nc\prop_gclear:N} -\def_long_new:Npn \prop_split_aux:Nnn #1#2#3{ - \def:Npn \tmp:w ##1\q_prop#2\q_prop##2##3\q_stop {#3{##1}{##2}{##3}} - \exp_after:NN\tmp:w \toks_use:N#1\q_prop#2\q_prop\q_no_value \q_stop +\cs_new_eq:NN \prop_new:N \toks_new:N +\cs_new_eq:NN \prop_new:c \toks_new:c +\cs_new_eq:NN \prop_clear:N \toks_clear:N +\cs_new_eq:NN \prop_clear:c \toks_clear:c +\cs_new_eq:NN \prop_gclear:N \toks_gclear:N +\cs_new_eq:NN \prop_gclear:c \toks_gclear:c +\cs_new_eq:NN \prop_set_eq:NN \toks_set_eq:NN +\cs_new_eq:NN \prop_set_eq:Nc \toks_set_eq:Nc +\cs_new_eq:NN \prop_set_eq:cN \toks_set_eq:cN +\cs_new_eq:NN \prop_set_eq:cc \toks_set_eq:cc +\cs_new_eq:NN \prop_gset_eq:NN \toks_gset_eq:NN +\cs_new_eq:NN \prop_gset_eq:Nc \toks_gset_eq:Nc +\cs_new_eq:NN \prop_gset_eq:cN \toks_gset_eq:cN +\cs_new_eq:NN \prop_gset_eq:cc \toks_gset_eq:cc +\cs_new_eq:NN \prop_show:N \toks_show:N +\cs_new_eq:NN \prop_show:c \toks_show:c +\cs_new_nopar:Npn \prop_display:N #1 { + \iow_term:x { Property-list~\token_to_str:N #1~contains~ + the~pairs~(without~outer~braces): } + \toks_clear:N \l_tmpa_toks + \prop_map_inline:Nn #1 { + \toks_if_empty:NF \l_tmpa_toks { + \toks_put_right:Nx \l_tmpa_toks {^^J>~} + } + \toks_put_right:Nx \l_tmpa_toks { + \iow_space: \iow_char:N \{ \exp_not:n {##1} \iow_char:N \} \iow_space: + \iow_space: => \iow_space: + \iow_space: \iow_char:N \{ \exp_not:n {##2} \iow_char:N \} + } + } + \toks_show:N \l_tmpa_toks +} +\cs_generate_variant:Nn \prop_display:N {c} +\cs_new:Npn \prop_split_aux:Nnn #1#2#3{ + \cs_set:Npn \prop_tmp:w ##1 \q_prop #2 \q_prop ##2##3 \q_stop { + #3 {##1}{##2}{##3} + } + \exp_after:wN \prop_tmp:w \toks_use:N #1 \q_prop #2 \q_prop \q_no_value \q_stop } -\def_long_new:NNn \prop_get:NnN 2{ - \prop_split_aux:Nnn #1{#2}\prop_get_aux:w} -\def_long_new:NNn \prop_get_aux:w 4{\tlp_set:Nx#4{\exp_not:n{#2}}} -\def_new:Npn \prop_get:cnN { \exp_args:Nc \prop_get:NnN } -\def_long_new:NNn \prop_gget:NnN 2{ +\cs_new:Npn \prop_get:NnN #1#2 { + \prop_split_aux:Nnn #1{#2}\prop_get_aux:w +} +\cs_new:Npn \prop_get_aux:w #1#2#3#4 { \tl_set:Nx #4 {\exp_not:n{#2}} } +\cs_generate_variant:Nn \prop_get:NnN {cnN} +\cs_new:Npn \prop_gget:NnN #1#2{ \prop_split_aux:Nnn #1{#2}\prop_gget_aux:w} -\def_new:Npn \prop_gget:NcN {\exp_args:NNc \prop_gget:NnN} -\def_new:Npn \prop_gget:cnN {\exp_args:Nc \prop_gget:NnN} -\def_long_new:NNn \prop_gget_aux:w 4{\tlp_gset:Nx#4{\exp_not:n{#2}}} -\def_long_new:NNn \prop_get_gdel:NnN 3{ +\cs_new:Npn \prop_gget_aux:w #1#2#3#4{\tl_gset:Nx#4{\exp_not:n{#2}}} +\cs_generate_variant:Nn \prop_gget:NnN {cnN} +\cs_new:Npn \prop_get_gdel:NnN #1#2#3{ \prop_split_aux:Nnn #1{#2}{\prop_get_del_aux:w #3{\toks_gset:Nn #1}{#2}}} -\def_long_new:NNn \prop_get_del_aux:w 6{ - \tlp_set:Nx #1{\exp_not:n{#5}} +\cs_new:Npn \prop_get_del_aux:w #1#2#3#4#5#6{ + \tl_set:Nx #1{\exp_not:n{#5}} \quark_if_no_value:NF #1 { - \def:Npn \tmp:w ##1\q_prop#3\q_prop\q_no_value {#2{#4##1}} - \tmp:w #6} + \cs_set_nopar:Npn \prop_tmp:w ##1\q_prop#3\q_prop\q_no_value {#2{#4##1}} + \prop_tmp:w #6} } -\def_long_new:NNn \prop_put:Nnn 2{ +\cs_new:Npn \prop_put:Nnn #1#2{ \prop_split_aux:Nnn #1{#2}{ \prop_clear:N #1 - \prop_put_aux:w {\toks_put_right:Nn #1}{#2}} + \prop_put_aux:w {\toks_put_right:Nn #1}{#2} + } } -\def_new:Npn \prop_put:ccn {\exp_args:Ncc \prop_put:Nnn } - -\def_long_new:NNn \prop_gput:Nnn 2{ +\cs_new:Npn \prop_gput:Nnn #1#2{ \prop_split_aux:Nnn #1{#2}{ \prop_gclear:N #1 - \prop_put_aux:w {\toks_gput_right:Nn #1}{#2}} + \prop_put_aux:w {\toks_gput_right:Nn #1}{#2} + } } - -\def_long_new:NNn \prop_put_aux:w 6{ +\cs_new:Npn \prop_put_aux:w #1#2#3#4#5#6{ #1{\q_prop#2\q_prop{#6}#3} - \tlist_if_empty:nF{#5} + \tl_if_empty:nF{#5} { - \def:Npn \tmp:w ##1\q_prop#2\q_prop\q_no_value {#1{##1}} - \tmp:w #5 + \cs_set_nopar:Npn \prop_tmp:w ##1\q_prop#2\q_prop\q_no_value {#1{##1}} + \prop_tmp:w #5 } } -\def_new:Npn \prop_gput:Nno {\exp_args:NNno \prop_gput:Nnn} -\def_new:Npn \prop_gput:Nnx {\exp_args:NNnx \prop_gput:Nnn} -\def_new:Npn \prop_gput:Nox {\exp_args:NNox \prop_gput:Nnn} -\def_new:Npn \prop_gput:Noo {\exp_args:NNoo \prop_gput:Nnn} -\def_new:Npn \prop_gput:Ncn {\exp_args:NNc \prop_gput:Nnn} -\def_new:Npn \prop_gput:Ooo {\exp_args:NOoo \prop_gput:Nnn} -\def_new:Npn \prop_gput:cnn {\exp_args:Nc \prop_gput:Nnn} -\def_new:Npn \prop_gput:ccn {\exp_args:Ncc \prop_gput:Nnn} -\def_new:Npn \prop_gput:cco {\exp_args:Ncco \prop_gput:Nnn} -\def_new:Npn \prop_gput:ccx {\exp_args:Nccx \prop_gput:Nnn} -\def_long_new:NNn \prop_del:Nn 2{ +\cs_generate_variant:Nn \prop_put:Nnn {cnn} +\cs_generate_variant:Nn \prop_gput:Nnn {NnV,Nno,Nnx,Nox,cnn,ccx} +\cs_new:Npn \prop_del:Nn #1#2{ \prop_split_aux:Nnn #1{#2}{\prop_del_aux:w {\toks_set:Nn #1}{#2}}} -\def_long_new:NNn \prop_gdel:Nn 2{ +\cs_new:Npn \prop_gdel:Nn #1#2{ \prop_split_aux:Nnn #1{#2}{\prop_del_aux:w {\toks_gset:Nn #1}{#2}}} -\def_long_new:NNn \prop_del_aux:w 5{ - \def:Npn \tmp:w {#4} - \quark_if_no_value:NF \tmp:w - {\def:Npn \tmp:w ##1\q_prop#2\q_prop\q_no_value {#1{#3##1}} - \tmp:w #5}} -\def_new:NNn \prop_if_in:NnTF 2{ - \prop_split_aux:Nnn #1{#2}\prop_if_in_aux:w} -\def_new:NNn \prop_if_in_aux:w 3{\quark_if_no_value:nFT {#2}} - -\def_new:Npn \prop_if_in:NoTF {\exp_args:NNo \prop_if_in:NnTF} -\def_new:Npn \prop_if_in:ccTF {\exp_args:Ncc \prop_if_in:NnTF} -\def_long_new:NNn \prop_gput_if_new:Nnn 2{ - \prop_split_aux:Nnn #1{#2}{\prop_put_if_new_aux:w #1{#2}}} -\def_long_new:NNn \prop_put_if_new_aux:w 6{ - \tlist_if_empty:nT {#5}{#1{\q_prop#2\q_prop{#6}#3}}} -\let_new:NN \prop_set_eq:NN \toks_set_eq:NN -\let_new:NN \prop_set_eq:Nc \toks_set_eq:Nc -\let_new:NN \prop_set_eq:cN \toks_set_eq:cN -\let_new:NN \prop_set_eq:cc \toks_set_eq:cc -\let_new:NN \prop_gset_eq:NN \toks_gset_eq:NN -\let_new:NN \prop_gset_eq:Nc \toks_gset_eq:Nc -\let_new:NN \prop_gset_eq:cN \toks_gset_eq:cN -\let_new:NN \prop_gset_eq:cc \toks_gset_eq:cc -\let_new:NN \prop_if_empty_p:N \toks_if_empty_p:N -\let_new:NN \prop_if_empty_p:c \toks_if_empty_p:c -\let_new:NN \prop_if_empty:NTF \toks_if_empty:NTF -\let_new:NN \prop_if_empty:NT \toks_if_empty:NT -\let_new:NN \prop_if_empty:NF \toks_if_empty:NF -\let_new:NN \prop_if_empty:cTF \toks_if_empty:cTF -\let_new:NN \prop_if_empty:cT \toks_if_empty:cTF -\let_new:NN \prop_if_empty:cF \toks_if_empty:cF -\def_new:NNn \prop_if_eq:NNTF 2 { - \tlist_if_eq:xxTF{\toks_use:N #1}{\toks_use:N #2} -} -\def_new:NNn \prop_if_eq:NNT 2 { - \tlist_if_eq:xxT{\toks_use:N #1}{\toks_use:N #2} -} -\def_new:NNn \prop_if_eq:NNF 2 { - \tlist_if_eq:xxF{\toks_use:N #1}{\toks_use:N #2} -} -\def_new:Npn \prop_if_eq:NcTF {\exp_args:NNc \prop_if_eq:NNTF} -\def_new:Npn \prop_if_eq:NcT {\exp_args:NNc \prop_if_eq:NNT} -\def_new:Npn \prop_if_eq:NcF {\exp_args:NNc \prop_if_eq:NNF} -\def_new:Npn \prop_if_eq:cNTF {\exp_args:Nc \prop_if_eq:NNTF} -\def_new:Npn \prop_if_eq:cNT {\exp_args:Nc \prop_if_eq:NNT} -\def_new:Npn \prop_if_eq:cNF {\exp_args:Nc \prop_if_eq:NNF} -\def_new:Npn \prop_if_eq:ccTF {\exp_args:Ncc \prop_if_eq:NNTF} -\def_new:Npn \prop_if_eq:ccT {\exp_args:Ncc \prop_if_eq:NNT} -\def_new:Npn \prop_if_eq:ccF {\exp_args:Ncc \prop_if_eq:NNF} -\def_new:Npn \prop_map_function:NN #1#2{ - \exp_after:NN \prop_map_function_aux:w - \exp_after:NN #2 \toks_use:N #1 \q_prop{}\q_prop \q_no_value \q_stop -} -\def_new:Npn \prop_map_function_aux:w #1\q_prop#2\q_prop#3{ - \if:w \tlist_if_empty_p:n{#2} - \exp_after:NN \prop_map_break:w - \fi: - #1{#2}{#3} - \prop_map_function_aux:w #1 +\cs_new:Npn \prop_del_aux:w #1#2#3#4#5{ + \cs_set_nopar:Npn \prop_tmp:w {#4} + \quark_if_no_value:NF \prop_tmp:w { + \cs_set_nopar:Npn \prop_tmp:w ##1\q_prop#2\q_prop\q_no_value {#1{#3##1}} + \prop_tmp:w #5 + } } - -\def:Npn \prop_map_function:NN #1#2{ - \exp_after:NN \prop_map_function_aux:w - \exp_after:NN #2 \toks_use:N #1 \q_prop \q_no_value \q_prop \q_no_value +\cs_new:Npn \prop_gput_if_new:Nnn #1#2{ + \prop_split_aux:Nnn #1{#2}{\prop_put_if_new_aux:w #1{#2}}} +\cs_new:Npn \prop_put_if_new_aux:w #1#2#3#4#5#6{ + \tl_if_empty:nT {#5}{#1{\q_prop#2\q_prop{#6}#3}}} +\prg_new_eq_conditional:NNn \prop_if_empty:N \toks_if_empty:N {p,TF,T,F} +\prg_new_eq_conditional:NNn \prop_if_empty:c \toks_if_empty:c {p,TF,T,F} +\prg_new_eq_conditional:NNn \prop_if_eq:NN \toks_if_eq:NN {p,TF,T,F} +\prg_new_eq_conditional:NNn \prop_if_eq:cN \toks_if_eq:cN {p,TF,T,F} +\prg_new_eq_conditional:NNn \prop_if_eq:Nc \toks_if_eq:Nc {p,TF,T,F} +\prg_new_eq_conditional:NNn \prop_if_eq:cc \toks_if_eq:cc {p,TF,T,F} +\prg_new_conditional:Nnn \prop_if_in:Nn {TF,T,F} { + \prop_split_aux:Nnn #1 {#2} {\prop_if_in_aux:w} } -\def:Npn \prop_map_function_aux:w #1\q_prop#2\q_prop#3{ - \quark_if_no_value:nF{#2} - { - #1{#2}{#3} - \prop_map_function_aux:w #1 - } +\cs_new_nopar:Npn \prop_if_in_aux:w #1#2#3 { + \quark_if_no_value:nTF {#2} {\prg_return_false:} {\prg_return_true:} } - -\def:Npn \prop_map_function:NN #1#2{ - \exp_after:NN \prop_map_function_aux:w - \exp_after:NN #2 \toks_use:N #1 \q_prop \q_nil \q_prop \q_no_value \q_stop +\cs_generate_variant:Nn \prop_if_in:NnTF {NV,No,cn,cc} +\cs_generate_variant:Nn \prop_if_in:NnT {NV,No,cn,cc} +\cs_generate_variant:Nn \prop_if_in:NnF {NV,No,cn,cc} +\cs_set_nopar:Npn \prop_map_function:NN #1#2 { + \exp_after:wN \prop_map_function_aux:w + \exp_after:wN #2 \toks_use:N #1 \q_prop \q_nil \q_prop \q_no_value \q_stop } -\def:Npn \prop_map_function_aux:w #1\q_prop#2\q_prop#3{ - \if_meaning:NN \q_nil #2 - \exp_after:NN \prop_map_break:w +\cs_set:Npn \prop_map_function_aux:w #1 \q_prop #2 \q_prop #3 { + \if_meaning:w \q_nil #2 + \exp_after:wN \prop_map_break: \fi: #1{#2}{#3} \prop_map_function_aux:w #1 } - - -\def_new:Npn \prop_map_function:cN {\exp_args:Nc \prop_map_function:NN } -\def_new:Npn \prop_map_function:Nc {\exp_args:NNc \prop_map_function:NN } -\def_new:Npn \prop_map_function:cc {\exp_args:Ncc \prop_map_function:NN} +\cs_generate_variant:Nn \prop_map_function:NN {c,Nc,cc} \num_new:N \g_prop_inline_level_num -\def_new:Npn \prop_map_inline:Nn #1#2 { +\cs_new_nopar:Npn \prop_map_inline:Nn #1#2 { \num_gincr:N \g_prop_inline_level_num - \gdef_long:cpn {prop_map_inline_ \num_use:N \g_prop_inline_level_num :n} + \cs_gset:cpn {prop_map_inline_ \num_use:N \g_prop_inline_level_num :n} ##1##2{#2} \prop_map_function:Nc #1 {prop_map_inline_ \num_use:N \g_prop_inline_level_num :n} \num_gdecr:N \g_prop_inline_level_num } -\def_new:Npn \prop_map_inline:cN { \exp_args:Nc \prop_map_inline:NN } -\let_new:NN \prop_map_break:w \use_none_delimit_by_q_stop:w -\def:Npn \prop_put:NNn {\typeout{Warning:~name~ - changed~ to~ \string\prop_put:Nnn}\prop_put:Nnn} -\def:Npn \prop_gput:NNn {\typeout{Warning:~name~ - changed~ to~ \string\prop_gput:Nnn }\prop_gput:Nnn } -\def:Npn \prop_gput:NNo {\typeout{Warning:~name~ - changed~ to~ \string\prop_gput:Nno }\prop_gput:Nno } -\def:Npn \prop_gput:cNn {\typeout{Warning:~name~ - changed~ to~ \string\prop_gput:cnn }\prop_gput:cnn } -\def:Npn \prop_gput_if_new:NNn {\typeout{Warning:~name~ - changed~ to~ \string\prop_gput_if_new:Nnn }\prop_gput_if_new:Nnn } -\def:Npn \prop_get:NNN {\typeout{Warning:~name~ - changed~ to~ \string\prop_get:NnN }\prop_get:NnN } -\def:Npn \prop_get:cNN {\typeout{Warning:~name~ - changed~ to~ \string\prop_get:cnN }\prop_get:cnN } -\def:Npn \prop_gget:NNN {\typeout{Warning:~name~ - changed~ to~ \string\prop_gget:NnN }\prop_gget:NnN } -\def:Npn \prop_gget:cNN {\typeout{Warning:~name~ - changed~ to~ \string\prop_gget:cnN }\prop_gget:cnN } -\def:Npn \prop_get_gdel:NNN {\typeout{Warning:~name~ - changed~ to~ \string\prop_get_gdel:NnN }\prop_get_gdel:NnN } -\def:Npn \prop_del:NN {\typeout{Warning:~name~ - changed~ to~ \string\prop_del:Nn }\prop_del:Nn } -\def:Npn \prop_gdel:NN {\typeout{Warning:~name~ - changed~ to~ \string\prop_gdel:Nn }\prop_gdel:Nn } -\def:Npn \prop_if_in:NNTF {\typeout{Warning:~name~ - changed~ to~ \string\prop_if_in:NnTF }\prop_if_in:NnTF } +\cs_generate_variant:Nn\prop_map_inline:Nn {cn} +\cs_new_eq:NN \prop_map_break: \use_none_delimit_by_q_stop:w %% %% %% End of file `l3prop.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3quark.sty b/Master/texmf-dist/tex/latex/expl3/l3quark.sty index 1b44ce2ab2d..8302f07306a 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3quark.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3quark.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3quark.dtx Copyright (C) 1990-2006 LaTeX3 project +%% File: l3quark.dtx Copyright (C) 1990-2009 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,12 +48,12 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3quark.dtx 761 2008-08-04 21:35:13Z morten $ +\GetIdInfo$Id: l3quark.dtx 1365 2009-05-31 17:26:17Z mittelba $ {L3 Experimental Quark Commands} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3expan}\par -\def_new:Npn \quark_new:N #1{\tlp_new:Nn #1{#1}} +\package_check_loaded_expl: +\cs_new_nopar:Npn \quark_new:N #1{\tl_new:Nn #1{#1}} \quark_new:N \q_stop \quark_new:N \q_no_value \quark_new:N \q_nil @@ -61,109 +61,92 @@ \quark_new:N\q_mark \quark_new:N\q_recursion_tail \quark_new:N\q_recursion_stop -\def_long_new:Npn \quark_if_recursion_tail_stop:n #1 { - \exp_after:NN\if_meaning:NN +\cs_new:Npn \quark_if_recursion_tail_stop:n #1 { + \exp_after:wN\if_meaning:w \quark_if_recursion_tail_aux:w #1?\q_nil\q_recursion_tail\q_recursion_tail - \exp_after:NN \use_none_delimit_by_q_recursion_stop:w + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: } -\def_long_new:Npn \quark_if_recursion_tail_stop:N #1 { - \if_meaning:NN#1\q_recursion_tail - \exp_after:NN \use_none_delimit_by_q_recursion_stop:w +\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: } -\def_new:Npn \quark_if_recursion_tail_stop:o{ - \exp_args:No\quark_if_recursion_tail_stop:n -} -\def_long_new:Npn \quark_if_recursion_tail_stop_do:nn #1#2 { - \exp_after:NN\if_meaning:NN +\cs_generate_variant:Nn \quark_if_recursion_tail_stop:n {o} +\cs_new:Npn \quark_if_recursion_tail_stop_do:nn #1#2 { + \exp_after:wN\if_meaning:w \quark_if_recursion_tail_aux:w #1?\q_nil\q_recursion_tail\q_recursion_tail - \exp_after:NN \use_arg_i_delimit_by_q_recursion_stop:nw + \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw \else: - \exp_after:NN\use_none:n + \exp_after:wN\use_none:n \fi: {#2} } -\def_long_new:Npn \quark_if_recursion_tail_stop_do:Nn #1#2 { - \if_meaning:NN #1\q_recursion_tail - \exp_after:NN \use_arg_i_delimit_by_q_recursion_stop:nw +\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:NN\use_none:n + \exp_after:wN\use_none:n \fi: {#2} } -\def_new:Npn \quark_if_recursion_tail_stop_do:on{ - \exp_args:No\quark_if_recursion_tail_stop_do:nn -} -\def_long_new:Npn \quark_if_recursion_tail_aux:w - #1#2\q_nil\q_recursion_tail{#1} -\def_long_new:Npn\use_none_delimit_by_q_recursion_stop:w - #1\q_recursion_stop {} -\def_long_new:Npn\use_arg_i_delimit_by_q_recursion_stop:nw - #1#2\q_recursion_stop {#1} -\def_long_test_function_new:npn {quark_if_no_value:N} #1 { - \if_meaning:NN\q_no_value#1} -\def_long_new:Npn \quark_if_no_value_p:N #1{ - \if_meaning:NN \q_no_value #1 \c_true - \else: \c_false \fi: +\cs_generate_variant:Nn \quark_if_recursion_tail_stop_do:nn {on} +\cs_new:Npn \quark_if_recursion_tail_aux:w #1#2 \q_nil \q_recursion_tail {#1} +\prg_new_conditional:Nnn \quark_if_no_value:N {p,TF,T,F} { + \if_meaning:w \q_no_value #1 + \prg_return_true: \else: \prg_return_false: \fi: } -\cs_if_really_free:cTF{pdf_strcmp:D}{ - \def_long_new:Npn \quark_if_no_value_p:n #1{ - \if:w \exp_args:No \str_if_eq_var_p:nf - {\token_to_string:N\q_no_value\space} - {\tlist_to_str:n{#1}} - \c_true - \else: - \c_false +\cs_if_exist:cTF {pdf_strcmp:D} +{ + \prg_new_conditional:Nnn \quark_if_no_value:n {p,TF,T,F} { + \if_num:w \pdf_strcmp:D + {\exp_not:N \q_no_value} + {\exp_not:n{#1}} = \c_zero + \prg_return_true: \else: \prg_return_false: \fi: } } { - \def_long_new:Npn \quark_if_no_value_p:n #1{ - \if_num:w - \pdf_strcmp:D {\exp_not:N \q_no_value}{\exp_not:n{#1}}=\c_zero - \c_true \else: \c_false \fi: - } -} -\def_long_test_function_new:npn {quark_if_no_value:n} #1 { - \if:w \quark_if_no_value_p:n{#1}} -\def_long:Npn \quark_if_no_value:nFT #1{ - \if:w \quark_if_no_value_p:n{#1} - \exp_after:NN\use_arg_ii:nn - \else: - \exp_after:NN\use_arg_i:nn + \prg_new_conditional:Nnn \quark_if_no_value:n {p,TF,T,F} { + \exp_args:NNo + \if_predicate:w \str_if_eq_var_p:nf + {\token_to_str:N\q_no_value\iow_space:} + {\tl_to_str:n{#1}} + \prg_return_true: \else: \prg_return_false: \fi: + } } -\def_long_new:Npn \quark_if_nil_p:N #1{ - \if_meaning:NN \q_nil #1 \c_true - \else: \c_false \fi: +\prg_new_conditional:Nnn \quark_if_nil:N {p,TF,T,F} { + \if_meaning:w \q_nil #1 \prg_return_true: \else: \prg_return_false: \fi: } -\def_long_test_function_new:npn {quark_if_nil:N}#1{ - \if_meaning:NN\q_nil#1} -\cs_if_really_free:cTF{pdf_strcmp:D}{ - \def_long_new:Npn \quark_if_nil_p:n #1{ - \if:w \exp_args:No \str_if_eq_var_p:nf - {\token_to_string:N\q_nil\space} - {\tlist_to_str:n{#1}} - \c_true - \else: - \c_false +\cs_if_exist:cTF {pdf_strcmp:D} { + \prg_new_conditional:Nnn \quark_if_nil:n {p,TF,T,F} { + \if_num:w \pdf_strcmp:D + {\exp_not:N \q_nil} + {\exp_not:n{#1}} = \c_zero + \prg_return_true: \else: \prg_return_false: \fi: } } { - \def_long_new:Npn \quark_if_nil_p:n #1{ - \if_num:w - \pdf_strcmp:D {\exp_not:N \q_nil}{\exp_not:n{#1}}=\c_zero - \c_true \else: \c_false \fi: + \prg_new_conditional:Nnn \quark_if_nil:n {p,TF,T,F} { + \exp_args:NNo + \if_predicate:w \str_if_eq_var_p:nf + {\token_to_str:N\q_nil\iow_space:} + {\tl_to_str:n{#1}} + \prg_return_true: \else: \prg_return_false: + \fi: } } -\def_long_test_function_new:npn {quark_if_nil:n} #1 { - \if:w \quark_if_nil_p:n{#1}} -\def_new:Npn \quark_if_nil_p:o{\exp_args:No\quark_if_nil_p:n} -\def_new:Npn \quark_if_nil:oTF{\exp_args:No\quark_if_nil:nTF} -\def_new:Npn \quark_if_nil:oT {\exp_args:No\quark_if_nil:nT} -\def_new:Npn \quark_if_nil:oF {\exp_args:No\quark_if_nil:nF} +\cs_generate_variant:Nn \quark_if_nil_p:n {V} +\cs_generate_variant:Nn \quark_if_nil:nTF {V} +\cs_generate_variant:Nn \quark_if_nil:nT {V} +\cs_generate_variant:Nn \quark_if_nil:nF {V} +\cs_generate_variant:Nn \quark_if_nil_p:n {o} +\cs_generate_variant:Nn \quark_if_nil:nTF {o} +\cs_generate_variant:Nn \quark_if_nil:nT {o} +\cs_generate_variant:Nn \quark_if_nil:nF {o} + %% %% %% End of file `l3quark.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3seq.sty b/Master/texmf-dist/tex/latex/expl3/l3seq.sty index c4ebb497c03..a28d9f64ad7 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3seq.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3seq.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3seq.dtx Copyright (C) 1990-2006 LaTeX3 project +%% File: l3seq.dtx Copyright (C) 1990-2009 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,128 +48,147 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3seq.dtx 621 2007-09-01 20:14:19Z morten $ +\GetIdInfo$Id: l3seq.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental sequences and stacks} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3quark} -\RequirePackage{l3tlp} -\RequirePackage{l3expan} -\let_new:NN \seq_elt:w \ERROR -\let_new:NN \seq_elt_end: \ERROR -\def_new:Npn \seq_new:N #1{\tlp_new:Nn #1{}} -\def_new:Npn \seq_new:c {\exp_args:Nc \seq_new:N} -\let_new:NN \seq_clear:N \tlp_clear:N -\let_new:NN \seq_clear:c \tlp_clear:c -\let_new:NN \seq_gclear:N \tlp_gclear:N -\let_new:NN \seq_gclear:c \tlp_gclear:c -\let_new:NN \seq_clear_new:N \tlp_clear_new:N -\let_new:NN \seq_clear_new:c \tlp_clear_new:c -\let_new:NN \seq_gclear_new:N \tlp_gclear_new:N -\let_new:NN \seq_gclear_new:c \tlp_gclear_new:c -\let_new:NN \seq_if_empty_p:N \tlp_if_empty_p:N -\let_new:NN \seq_if_empty:NTF \tlp_if_empty:NTF -\def_new:Npn \seq_if_empty:cTF {\exp_args:Nc\seq_if_empty:NTF} -\let_new:NN \seq_if_empty:NF \tlp_if_empty:NF -\def_new:Npn \seq_if_empty:cF {\exp_args:Nc\seq_if_empty:NF} -\def_new:Npn \seq_if_empty_err:N #1{\if_meaning:NN#1\c_empty_tlp - \tlp_clear:N \l_testa_tlp % catch prefixes - \err_latex_bug:x{Empty~sequence~`\token_to_string:N#1'}\fi:} -\def_new:Npn \seq_get:NN #1{ +\package_check_loaded_expl: +\cs_new:Npn \seq_elt:w {\ERROR} +\cs_new:Npn \seq_elt_end: {\ERROR} +\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 \cs_set_eq:NN +\cs_new_eq:NN \seq_set_eq:cN \cs_set_eq:cN +\cs_new_eq:NN \seq_set_eq:Nc \cs_set_eq:Nc +\cs_new_eq:NN \seq_set_eq:cc \cs_set_eq:cc +\cs_new_eq:NN \seq_gset_eq:NN \cs_gset_eq:NN +\cs_new_eq:NN \seq_gset_eq:cN \cs_gset_eq:cN +\cs_new_eq:NN \seq_gset_eq:Nc \cs_gset_eq:Nc +\cs_new_eq:NN \seq_gset_eq:cc \cs_gset_eq:cc +\cs_new_nopar:Npn \seq_gconcat:NNN #1#2#3 { + \tl_gset:Nx #1 { \exp_not:V #2 \exp_not:V #3 } +} +\cs_generate_variant:Nn \seq_gconcat:NNN {ccc} +\prg_new_eq_conditional:NNn \seq_if_empty:N \tl_if_empty:N {p,TF,T,F} +\prg_new_eq_conditional:NNn \seq_if_empty:c \tl_if_empty:c {p,TF,T,F} +\cs_new_nopar:Npn \seq_if_empty_err:N #1 { + \if_meaning:w #1 \c_empty_tl + \tl_clear:N \l_testa_tl % catch prefixes + \msg_kernel_bug:x {Empty~sequence~`\token_to_str:N#1'} + \fi: +} +\prg_new_conditional:Nnn \seq_if_in:Nn {TF,T,F} { + \cs_set:Npn \seq_tmp:w ##1 \seq_elt:w #2 \seq_elt_end: ##2##3 \q_stop { + \if_meaning:w \q_no_value ##2 + \prg_return_false: \else: \prg_return_true: \fi: + } + \exp_after:wN \seq_tmp:w #1 \seq_elt:w #2 \seq_elt_end: \q_no_value \q_stop +} +\cs_generate_variant:Nn \seq_if_in:NnTF {cV,co,c,cx} +\cs_generate_variant:Nn \seq_if_in:NnT {cV,co,c,cx} +\cs_generate_variant:Nn \seq_if_in:NnF {cV,co,c,cx} +\cs_new_nopar:Npn \seq_get:NN #1 { \seq_if_empty_err:N #1 - \exp_after:NN\seq_get_aux:w #1\q_stop} -\def_new:Npn \seq_get_aux:w \seq_elt:w #1\seq_elt_end: - #2\q_stop #3{\tlp_set:Nn #3{#1}} -\def_new:Npn \seq_get:cN {\exp_args:Nc \seq_get:NN} -\def_new:Npn \seq_pop_aux:nnNN #1#2#3{ + \exp_after:wN \seq_get_aux:w #1 \q_stop +} +\cs_new:Npn \seq_get_aux:w \seq_elt:w #1 \seq_elt_end: #2 \q_stop #3 { + \tl_set:Nn #3 {#1} +} +\cs_generate_variant:Nn \seq_get:NN {c} +\cs_new:Npn \seq_pop_aux:nnNN #1#2#3 { \seq_if_empty_err:N #3 - \exp_after:NN\seq_pop_aux:w #3\q_stop #1#2#3} -\def_new:Npn \seq_pop_aux:w \seq_elt:w #1\seq_elt_end: - #2\q_stop #3#4#5#6{#3#5{#2}#4#6{#1}} -\def_new:Npn \seq_put_aux:Nnn #1{ - \exp_after:NN\seq_put_aux:w #1\q_stop #1} -\def_new:Npn \seq_put_aux:w #1\q_stop #2#3#4{\tlp_set:Nn #2{#3#1#4}} -\def_new:Npn \seq_put_left:Nn #1#2{ - \seq_put_aux:Nnn #1{\seq_elt:w #2\seq_elt_end:}{}} -\def_new:Npn \seq_put_left:cn {\exp_args:Nc\seq_put_left:Nn} -\def_new:Npn \seq_put_left:No {\exp_args:NNo\seq_put_left:Nn} -\def_new:Npn \seq_put_left:Nx {\exp_args:Nnx\seq_put_left:Nn} -\def_new:Npn \seq_put_right:Nn #1#2{ + \exp_after:wN \seq_pop_aux:w #3 \q_stop #1#2#3 +} +\cs_new:Npn \seq_pop_aux:w + \seq_elt:w #1 \seq_elt_end: #2\q_stop #3#4#5#6 { + #3 #5 {#2} + #4 #6 {#1} +} +\cs_new_eq:NN \seq_show:N \tl_show:N +\cs_new_eq:NN \seq_show:c \tl_show:c +\cs_new_nopar:Npn \seq_display:N #1 { + \iow_term:x { Sequence~\token_to_str:N #1~contains~ + the~elements~(without~outer~braces): } + \toks_clear:N \l_tmpa_toks + \seq_map_inline:Nn #1 { + \toks_if_empty:NF \l_tmpa_toks { + \toks_put_right:Nx \l_tmpa_toks {^^J>~} + } + \toks_put_right:Nx \l_tmpa_toks { + \iow_space: \iow_char:N \{ \exp_not:n {##1} \iow_char:N \} + } + } + \toks_show:N \l_tmpa_toks +} +\cs_generate_variant:Nn \seq_display:N {c} +\cs_new:Npn \seq_put_aux:Nnn #1 { + \exp_after:wN \seq_put_aux:w #1 \q_stop #1 +} +\cs_new:Npn \seq_put_aux:w #1\q_stop #2#3#4 { \tl_set:Nn #2 {#3#1#4} } +\cs_new:Npn \seq_put_left:Nn #1#2 { + \seq_put_aux:Nnn #1 {\seq_elt:w #2\seq_elt_end:} {} +} +\cs_generate_variant:Nn \seq_put_left:Nn {NV,No,Nx,c,cV,co} +\cs_new:Npn \seq_put_right:Nn #1#2{ \seq_put_aux:Nnn #1{}{\seq_elt:w #2\seq_elt_end:}} -\def_new:Npn \seq_put_right:No {\exp_args:NNo\seq_put_right:Nn} -\def_new:Npn \seq_put_right:Nx {\exp_args:NNx\seq_put_right:Nn} -\def_new:Npn \seq_gput_left:Nn { - \pref_global:D - \seq_put_left:Nn} -\def_new:Npn \seq_gput_right:Nn { - \pref_global:D - \seq_put_right:Nn} -\def_new:Npn \seq_gput_right:No {\exp_args:NNo \seq_gput_right:Nn} -\def_new:Npn \seq_gput_right:Nc {\exp_args:NNc \seq_gput_right:Nn} -\def_new:Npn \seq_gput_right:cn {\exp_args:Nc \seq_gput_right:Nn} -\def_new:Npn \seq_gput_right:co {\exp_args:Nco \seq_gput_right:Nn} -\def_new:Npn \seq_gput_right:cc {\exp_args:Ncc \seq_gput_right:Nn} -\def_new:Npn \seq_map_variable_aux:Nnw #1#2\seq_elt:w#3\seq_elt_end:{ - \tlp_set:Nn #1{#3} - \quark_if_nil:NT #1 \seq_map_break:w +\cs_generate_variant:Nn \seq_put_right:Nn {NV,No,Nx,c,cV,co} +\cs_new:Npn \seq_gput_left:Nn { + \pref_global:D + \seq_put_left:Nn +} +\cs_new:Npn \seq_gput_right:Nn { + \pref_global:D + \seq_put_right:Nn +} +\cs_generate_variant:Nn \seq_gput_left:Nn {NV,No,Nx,c,cV,co} +\cs_generate_variant:Nn \seq_gput_right:Nn {NV,No,Nx,c,cV,co} +\cs_generate_variant:Nn \seq_gput_right:Nn {Nc} +\cs_new:Npn \seq_map_variable_aux:Nnw #1#2 \seq_elt:w #3 \seq_elt_end: { + \tl_set:Nx #1{\exp_not:n{#3}} + \quark_if_nil:NT #1 \seq_map_break: #2 \seq_map_variable_aux:Nnw #1{#2} } -\def_new:Npn \seq_map_variable:NNn #1#2#3{ - \tlp_set:Nx #2 {\exp_not:n{\seq_map_variable_aux:Nnw #2{#3}}} - \exp_after:NN #2 #1 \seq_elt:w \q_nil\seq_elt_end: \q_stop -} -\def_new:Npn \seq_map_variable:cNn{\exp_args:Nc\seq_map_variable:Nn} -\let_new:NN \seq_map_break:w \use_none_delimit_by_q_stop:w -\def_new:Npn \seq_map:NN #1#2{ - \def:Npn \seq_elt:w ##1\seq_elt_end: {#2{##1}}#1 - \let:NN \seq_elt:w \ERROR -} -\def_new:Npn \seq_map_inline:Nn #1#2{ - \def:Npn \seq_elt:w ##1\seq_elt_end: {#2}#1 - \let:NN \seq_elt:w \ERROR -} -\def_new:Npn \seq_map_inline:cn{\exp_args:Nc\seq_map_inline:Nn} -\let_new:NN \seq_set_eq:NN \let:NN -\def_new:Npn \seq_set_eq:Nc {\exp_args:NNc \seq_set_eq:NN} -\let_new:NN \seq_gset_eq:NN \glet:NN -\def_new:Npn \seq_gset_eq:cN {\exp_args:Nc \seq_gset_eq:NN} -\def_new:Npn \seq_gset_eq:Nc {\exp_args:NNc \seq_gset_eq:NN} -\def_new:Npn \seq_gset_eq:cc {\exp_args:Ncc \seq_gset_eq:NN} -\def_new:Npn \seq_gconcat:NNN #1#2#3{ - \tlp_gset:Nx #1 {\exp_not:o{#2}\exp_not:o{#3}} -} -\def_new:Npn \seq_gconcat:ccc{\exp_args:Nccc\seq_gconcat:NNN} -\def_new:Npn \seq_if_in:NnTF #1#2{ - \def:Npn\tmp:w - ##1\seq_elt:w #2\seq_elt_end: ##2##3\q_stop{ - \if_meaning:NN\q_no_value##2 - \exp_after:NN\use_arg_ii:nn - \else: - \exp_after:NN\use_arg_i:nn - \fi: - } - \exp_after:NN - \tmp:w #1\seq_elt:w - #2\seq_elt_end: \q_no_value \q_stop} -\def_new:Npn \seq_if_in:coTF {\exp_args:Nco \seq_if_in:NnTF} -\def_new:Npn \seq_if_in:cnTF {\exp_args:Nc \seq_if_in:NnTF} -\def_new:Npn \seq_if_in:cxTF {\exp_args:Ncx \seq_if_in:NnTF} -\def_new:Npn \seq_if_in:NnF #1#2 { \seq_if_in:NnTF #1{#2}\use_noop: } -\def_new:Npn \seq_if_in:cnF {\exp_args:Nc \seq_if_in:NnF} -\let_new:NN \seq_push:Nn \seq_put_left:Nn -\let_new:NN \seq_push:No \seq_put_left:No -\let_new:NN \seq_push:cn \seq_put_left:cn -\def_new:Npn \seq_pop:NN {\seq_pop_aux:nnNN \tlp_set:Nn \tlp_set:Nn} -\def_new:Npn \seq_pop:cN {\exp_args:Nc \seq_pop:NN} -\let_new:NN \seq_gpush:Nn \seq_gput_left:Nn -\def_new:Npn \seq_gpush:No {\exp_args:NNo \seq_gpush:Nn} -\def_new:Npn \seq_gpush:cn {\exp_args:Nc \seq_gpush:Nn} -\def_new:Npn \seq_gpush:NC {\exp_args:NNC \seq_gpush:Nn} -\def_new:Npn \seq_gpop:NN {\seq_pop_aux:nnNN \tlp_gset:Nn \tlp_set:Nn} -\def_new:Npn \seq_gpop:cN {\exp_args:Nc \seq_gpop:NN} -\let_new:NN \seq_top:NN \seq_get:NN -\let_new:NN \seq_top:cN \seq_get:cN +\cs_new:Npn \seq_map_variable:NNn #1#2#3 { + \tl_set:Nx #2 {\exp_not:n{\seq_map_variable_aux:Nnw #2{#3}}} + \exp_after:wN #2 #1 \seq_elt:w \q_nil\seq_elt_end: \q_stop +} +\cs_generate_variant:Nn \seq_map_variable:NNn {c} + +\cs_new_eq:NN \seq_map_break: \use_none_delimit_by_q_stop:w +\cs_new_eq:NN \seq_map_break:n \use_i_delimit_by_q_stop:nw +\cs_new_nopar:Npn \seq_map_function:NN #1#2 { + \cs_set:Npn \seq_elt:w ##1 \seq_elt_end: {#2{##1}} + #1 + \cs_set_eq:NN \seq_elt:w \ERROR +} +\cs_generate_variant:Nn \seq_map_function:NN {c} +\cs_new_nopar:Npn \seq_map_inline:Nn #1#2 { + \cs_set:Npn \seq_elt:w ##1 \seq_elt_end: {#2} + #1 + \cs_set_eq:NN \seq_elt:w \ERROR +} +\cs_generate_variant:Nn \seq_map_inline:Nn {c} +\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:No \seq_put_left:No +\cs_new_eq:NN \seq_push:cn \seq_put_left:cn +\cs_new_nopar:Npn \seq_pop:NN { \seq_pop_aux:nnNN \tl_set:Nn \tl_set:Nn } +\cs_generate_variant:Nn \seq_pop:NN {c} +\cs_new_eq:NN \seq_gpush:Nn \seq_gput_left:Nn +\cs_new_nopar:Npn \seq_gpop:NN { \seq_pop_aux:nnNN \tl_gset:Nn \tl_set:Nn } +\cs_generate_variant:Nn \seq_gpush:Nn {NV,No,c,Nv} +\cs_generate_variant:Nn \seq_gpop:NN {c} +\cs_new_eq:NN \seq_top:NN \seq_get:NN +\cs_new_eq:NN \seq_top:cN \seq_get:cN %% %% %% End of file `l3seq.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3skip.sty b/Master/texmf-dist/tex/latex/expl3/l3skip.sty index 588bcb9f88b..53462fcaea7 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3skip.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3skip.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3skip.dtx Copyright (C) 2005-2007 Frank Mittelbach, LaTeX3 project +%% File: l3skip.dtx Copyright (C) 2005-2008 Frank Mittelbach, 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,67 +48,78 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3skip.dtx 666 2007-09-27 15:53:26Z mittelba $ +\GetIdInfo$Id: l3skip.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental skip registers} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3int} -\RequirePackage{l3prg} -\let:NN \skip_new:N \newskip -\def_new:Npn \skip_new:c {\exp_args:Nc \skip_new:N} -\def_new:Npn \skip_set:Nn #1#2{#1\skip_eval:n{#2} +\package_check_loaded_expl: +\cs_new_nopar:Npn \skip_new:N #1 { + \chk_if_free_cs:N #1 + \newskip #1 } -\def_new:Npn \skip_gset:Nn { +\cs_generate_variant:Nn \skip_new:N {c} +\cs_new_nopar:Npn \skip_set:Nn #1#2 { + #1\skip_eval:n{#2} +} +\cs_new_nopar:Npn \skip_gset:Nn { \pref_global:D - \skip_set:Nn } -\def_new:Npn \skip_set:cn {\exp_args:Nc \skip_set:Nn } -\def_new:Npn \skip_gset:cn {\exp_args:Nc \skip_gset:Nn } -\def_new:Npn \skip_zero:N #1{#1\c_zero_skip \scan_stop: + \skip_set:Nn +} +\cs_generate_variant:Nn \skip_set:Nn {cn} +\cs_generate_variant:Nn \skip_gset:Nn {cn} +\cs_new_nopar:Npn \skip_zero:N #1{ + #1\c_zero_skip \scan_stop: } -\def_new:Npn \skip_gzero:N { +\cs_new_nopar:Npn \skip_gzero:N { \pref_global:D - \skip_zero:N} -\def_new:Npn \skip_zero:c {\exp_args:Nc \skip_zero:N} -\def_new:Npn \skip_gzero:c {\exp_args:Nc \skip_gzero:N} -\def_new:Npn \skip_add:Nn #1#2{ - \tex_advance:D#1 by \skip_eval:n{#2} + \skip_zero:N } -\def_new:Npn\skip_add:cn{\exp_args:Nc\skip_add:Nn} -\def_new:Npn \skip_sub:Nn #1#2{ - \tex_advance:D#1-\skip_eval:n{#2} +\cs_generate_variant:Nn \skip_zero:N {c} +\cs_generate_variant:Nn \skip_gzero:N {c} +\cs_new_nopar:Npn \skip_add:Nn #1#2 { + \tex_advance:D#1 by \skip_eval:n{#2} } -\def_new:Npn \skip_gadd:Nn { +\cs_generate_variant:Nn \skip_add:Nn {cn} +\cs_new_nopar:Npn \skip_sub:Nn #1#2{ + \tex_advance:D#1-\skip_eval:n{#2} +} +\cs_new_nopar:Npn \skip_gadd:Nn { \pref_global:D - \skip_add:Nn } -\def_new:Npn \skip_gsub:Nn { + \skip_add:Nn +} +\cs_generate_variant:Nn \skip_gadd:Nn {cn} +\cs_new_nopar:Npn \skip_gsub:Nn { \pref_global:D - \skip_sub:Nn } -\let_new:NN \skip_horizontal:N \tex_hskip:D -\def_new:Npn \skip_horizontal:c {\exp_args:Nc\skip_horizontal:N} -\def_new:Npn \skip_horizontal:n #1{\skip_horizontal:N \skip_eval:n{#1}} -\let_new:NN \skip_vertical:N \tex_vskip:D -\def_new:Npn \skip_vertital:c {\exp_args:Nc\skip_vertical:N} -\def_new:Npn \skip_vertical:n #1{\skip_vertical:N \skip_eval:n{#1}} -\let_new:NN \skip_use:N \tex_the:D -\def_new:Npn \skip_use:c #1{\exp_args:Nc\skip_use:N} -\def_new:Npn \skip_eval:n #1 {\etex_glueexpr:D #1 \scan_stop:} -%%\chk_new_cs:N \l_tmpa_skip + \skip_sub:Nn +} +\cs_new_eq:NN \skip_horizontal:N \tex_hskip:D +\cs_generate_variant:Nn \skip_horizontal:N {c} +\cs_new_nopar:Npn \skip_horizontal:n #1 { \skip_horizontal:N \skip_eval:n{#1} } +\cs_new_eq:NN \skip_vertical:N \tex_vskip:D +\cs_generate_variant:Nn \skip_vertical:N {c} +\cs_new_nopar:Npn \skip_vertical:n #1 { \skip_vertical:N \skip_eval:n{#1} } +\cs_new_eq:NN \skip_use:N \tex_the:D +\cs_generate_variant:Nn \skip_use:N {c} +\cs_new_eq:NN \skip_show:N \tex_showthe:D +\cs_new_nopar:Npn \skip_show:c #1 { \skip_show:N \cs:w #1 \cs_end: } +\cs_new_nopar:Npn \skip_eval:n #1 { \etex_glueexpr:D #1 \scan_stop: } +%%\chk_if_free_cs:N \l_tmpa_skip %%\tex_skipdef:D\l_tmpa_skip 255 %currently taken up by \skip@ \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 -\let:NN \c_zero_skip \z@ -\let:NN \c_max_skip \maxdimen -\def_new:Npn \skip_infinite_glue:nTF #1{ - \predicate:nTF { - \int_compare_p:nNn {\etex_gluestretchorder:D #1 } > \c_zero || - \int_compare_p:nNn {\etex_glueshrinkorder:D #1 } > \c_zero - } +\cs_set_eq:NN \c_zero_skip \z@ +\cs_set_eq:NN \c_max_skip \maxdimen +\prg_new_conditional:Nnn \skip_if_infinite_glue:n {p,TF,T,F} { + \bool_if:nTF { + \intexpr_compare_p:nNn {\etex_gluestretchorder:D #1 } > \c_zero || + \intexpr_compare_p:nNn {\etex_glueshrinkorder:D #1 } > \c_zero + } {\prg_return_true:} {\prg_return_false:} } -\def_new:Npn \skip_split_finite_else_action:nnNN #1#2#3#4{ - \skip_infinite_glue:nTF {#1} +\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 @@ -119,89 +130,70 @@ #4 = \etex_glueshrink:D #1 \scan_stop: } } -\let:NN \dim_new:N \newdimen -\def_new:Npn \dim_new:c {\exp_args:Nc \dim_new:N} -\def_new:Npn \dim_set:Nn #1#2{#1~ \dim_eval:n{#2}} -\def_new:Npn \dim_gset:Nn {\pref_global:D \dim_set:Nn } -\def_new:Npn \dim_set:cn {\exp_args:Nc \dim_set:Nn } -\def_new:Npn \dim_set:Nc {\exp_args:NNc \dim_set:Nn } -\def_new:Npn \dim_gset:cn {\exp_args:Nc \dim_gset:Nn } -\def_new:Npn \dim_gset:Nc {\exp_args:NNc \dim_gset:Nn } -\def_new:Npn \dim_gset:cc {\exp_args:Ncc \dim_gset:Nn } -\def_new:Npn \dim_zero:N #1{#1\c_zero_skip} -\def_new:Npn \dim_gzero:N {\pref_global:D \dim_zero:N} -\def_new:Npn \dim_zero:c {\exp_args:Nc \dim_zero:N} -\def_new:Npn \dim_gzero:c {\exp_args:Nc \dim_gzero:N} -\def_new:Npn \dim_add:Nn #1#2{ +\cs_new_nopar:Npn \dim_new:N #1 { + \chk_if_free_cs:N #1 + \newdimen #1 +} +\cs_generate_variant:Nn \dim_new:N {c} +\cs_new_nopar:Npn \dim_set:Nn #1#2 { #1~ \dim_eval:n{#2} } +\cs_generate_variant:Nn \dim_set:Nn {cn,Nc} +\cs_new_nopar:Npn \dim_gset:Nn { \pref_global:D \dim_set:Nn } +\cs_generate_variant:Nn \dim_gset:Nn {cn,Nc,cc} +\cs_new_nopar:Npn \dim_zero:N #1 { #1\c_zero_skip } +\cs_generate_variant:Nn \dim_zero:N {c} +\cs_new_nopar:Npn \dim_gzero:N { \pref_global:D \dim_zero:N } +\cs_generate_variant:Nn \dim_gzero:N {c} +\cs_new_nopar:Npn \dim_add:Nn #1#2{ \tex_advance:D#1 by \dim_eval:n{#2}\scan_stop: } -\def_new:Npn\dim_add:cn{\exp_args:Nc\dim_add:Nn} -\def_new:Npn\dim_add:Nc{\exp_args:NNc\dim_add:Nn} -\def_new:Npn \dim_gadd:Nn { \pref_global:D \dim_add:Nn } -\def_new:Npn\dim_gadd:cn{\exp_args:Nc\dim_gadd:Nn} -\def_new:Npn \dim_sub:Nn #1#2{\tex_advance:D#1-#2\scan_stop:} -\def_new:Npn\dim_sub:cn{\exp_args:Nc\dim_sub:Nn} -\def_new:Npn\dim_sub:Nc{\exp_args:NNc\dim_sub:Nn} -\def_new:Npn \dim_gsub:Nn {\pref_global:D \dim_sub:Nn } -\def_new:Npn\dim_gsub:cn{\exp_args:Nc\dim_gsub:Nn} -\let_new:NN \dim_use:N \tex_the:D -\def_new:Npn \dim_use:c {\exp_args:Nc\dim_use:N} +\cs_generate_variant:Nn \dim_add:Nn {cn,Nc} +\cs_new_nopar:Npn \dim_gadd:Nn { \pref_global:D \dim_add:Nn } +\cs_generate_variant:Nn \dim_gadd:Nn {cn} +\cs_new_nopar:Npn \dim_sub:Nn #1#2 { \tex_advance:D#1-#2\scan_stop: } +\cs_generate_variant:Nn \dim_sub:Nn {cn,Nc} +\cs_new_nopar:Npn \dim_gsub:Nn { \pref_global:D \dim_sub:Nn } +\cs_generate_variant:Nn \dim_gsub:Nn {cn} +\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 \tex_showthe:D +\cs_new_nopar:Npn \dim_show:c #1 { \dim_show:N \cs:w #1 \cs_end: } \dim_new:N \l_tmpa_dim \dim_new:N \l_tmpb_dim \dim_new:N \l_tmpc_dim \dim_new:N \l_tmpd_dim \dim_new:N \g_tmpa_dim \dim_new:N \g_tmpb_dim -\let_new:NN \c_zero_dim \c_zero_skip -\let_new:NN \c_max_dim \c_max_skip -\def_new:Npn \dim_eval:n #1 {\etex_dimexpr:D #1 \scan_stop:} -\let_new:NN \if_dim:w \tex_ifdim:D -\def_new:Npn \dim_compare:nNnTF #1#2#3{ +\cs_new_eq:NN \c_zero_dim \c_zero_skip +\cs_new_eq:NN \c_max_dim \c_max_skip +\cs_new_nopar:Npn \dim_eval:n #1 { \etex_dimexpr:D #1 \scan_stop: } +\cs_new_eq:NN \if_dim:w \tex_ifdim:D +\prg_new_conditional:Nnn \dim_compare:nNn {p,TF,T,F} { \if_dim:w \dim_eval:n {#1} #2 \dim_eval:n {#3} - \exp_after:NN \use_arg_i:nn - \else: - \exp_after:NN \use_arg_ii:nn - \fi: + \prg_return_true: \else: \prg_return_false: \fi: } -\def_new:Npn \dim_compare:nNnT #1#2#3{ - \if_dim:w \dim_eval:n {#1} #2 \dim_eval:n {#3} - \exp_after:NN \use_arg_ii:nn - \fi: - \use_none:n +\cs_new_nopar:Npn \dim_while_do:nNnn #1#2#3#4{ + \dim_compare:nNnT {#1}#2{#3}{#4 \dim_while_do:nNnn {#1}#2{#3}{#4}} } -\def_new:Npn \dim_compare:nNnF #1#2#3{ - \if_dim:w \dim_eval:n {#1} #2 \dim_eval:n {#3} - \exp_after:NN \use_none:n - \else: - \exp_after:NN \use_arg_i:n - \fi: +\cs_new_nopar:Npn \dim_until_do:nNnn #1#2#3#4{ + \dim_compare:nNnF {#1}#2{#3}{#4 \dim_until_do:nNnn {#1}#2{#3}{#4}} } -\def_new:Npn \dim_compare_p:nNn #1#2#3{ - \if_dim:w \dim_eval:n {#1} #2 \dim_eval:n {#3} - \c_true - \else: - \c_false - \fi: -} -\def_new:Npn \dim_while:nNnT #1#2#3#4{ - \dim_compare:nNnT {#1}#2{#3}{#4 \dim_while:nNnT {#1}#2{#3}{#4}} -} -\def_new:Npn \dim_while:nNnF #1#2#3#4{ - \dim_compare:nNnF {#1}#2{#3}{#4 \dim_while:nNnF {#1}#2{#3}{#4}} -} -\def_new:Npn \dim_dowhile:nNnT #1#2#3#4{ - #4 \dim_compare:nNnT {#1}#2{#3}{\dim_dowhile:nNnT {#1}#2{#3}{#4}} -} -\def_new:Npn \dim_dowhile:nNnF #1#2#3#4{ - #4 \dim_compare:nNnF {#1}#2{#3}{\dim_dowhile:nNnF {#1}#2{#3}{#4}} -} -\let_new:NN \muskip_new:N \newmuskip % nicked from LaTeX -\def_new:Npn \muskip_set:Nn#1#2{#1\etex_muexpr:D#2\scan_stop:} -\def_new:Npn \muskip_gset:Nn{\pref_global:D\muskip_set:Nn} -\def_new:Npn \muskip_add:Nn#1#2{\tex_advance:D#1\etex_muexpr:D#2\scan_stop:} -\def_new:Npn \muskip_gadd:Nn{\pref_global:D\muskip_add:Nn} -\def_new:Npn \muskip_sub:Nn#1#2{\tex_advance:D#1-\etex_muexpr:D#2\scan_stop:} -\def_new:Npn \muskip_gsub:Nn{\pref_global:D\muskip_sub:Nn} +\cs_new_nopar: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_new_nopar: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 \muskip_new:N #1 { + \chk_if_free_cs:N #1 + \newmuskip #1 +} +\cs_new_nopar:Npn \muskip_set:Nn#1#2{#1\etex_muexpr:D#2\scan_stop:} +\cs_new_nopar:Npn \muskip_gset:Nn{\pref_global:D\muskip_set:Nn} +\cs_new_nopar:Npn \muskip_add:Nn#1#2{\tex_advance:D#1\etex_muexpr:D#2\scan_stop:} +\cs_new_nopar:Npn \muskip_gadd:Nn{\pref_global:D\muskip_add:Nn} +\cs_new_nopar:Npn \muskip_sub:Nn#1#2{\tex_advance:D#1-\etex_muexpr:D#2\scan_stop:} +\cs_new_nopar:Npn \muskip_gsub:Nn{\pref_global:D\muskip_sub:Nn} +\cs_new_eq:NN \muskip_use:N \tex_the:D %% %% %% End of file `l3skip.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3tl.sty b/Master/texmf-dist/tex/latex/expl3/l3tl.sty new file mode 100644 index 00000000000..2e5c8294ac1 --- /dev/null +++ b/Master/texmf-dist/tex/latex/expl3/l3tl.sty @@ -0,0 +1,610 @@ +%% +%% This is file `l3tl.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3tl.dtx (with options: `package,trace') +%% +%% +%% 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-2009 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 LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{l3names} +\GetIdInfo$Id: l3tl.dtx 1365 2009-05-31 17:26:17Z mittelba $ + {L3 Experimental Token Lists} +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\package_check_loaded_expl: +\cs_new:Npn \tl_new:Nn #1#2{ + \chk_if_free_cs:N #1 + \cs_gset_nopar:Npn #1{#2} +} +\cs_generate_variant:Nn \tl_new:Nn {cn} +\cs_new:Npn \tl_new:Nx #1#2{ + \chk_if_free_cs:N #1 + \cs_gset_nopar:Npx #1{#2} +} +\cs_new_nopar:Npn \tl_new:N #1{\tl_new:Nn #1{}} +\cs_new_nopar:Npn \tl_new:c #1{\tl_new:cn {#1}{}} +\cs_new_nopar:Npn \tl_use:N #1 { + \if_meaning:w #1 \tex_relax:D + \msg_kernel_bug:x {Token~list~variable~ `\token_to_str:N #1'~ + has~ an~ erroneous~ structure!} + \else: + \exp_after:wN #1 + \fi: +} +\cs_generate_variant:Nn \tl_use:N {c} +\cs_new_nopar:Npn \tl_show:N #1 { \cs_show:N #1 } +\cs_generate_variant:Nn \tl_show:N {c} +\cs_set_eq:NN \tl_show:n \etex_showtokens:D +\cs_new:Npn\tl_set:Nn#1#2{\cs_set_nopar:Npn#1{#2}} +\cs_new:Npn\tl_set:Nx#1#2{\cs_set_nopar:Npx#1{#2}} +\cs_new:Npn\tl_gset:Nn#1#2{\cs_gset_nopar:Npn#1{#2}} +\cs_new:Npn\tl_gset:Nx#1#2{\cs_gset_nopar:Npx#1{#2}} +\cs_generate_variant:Nn \tl_set:Nn {NV,No,Nv,Nd,Nf,cn,cV,co,cx} +\cs_generate_variant:Nn \tl_gset:Nn {NV,No,Nv,Nd,cn,cx} +\cs_new_eq:NN \tl_set_eq:NN \cs_set_eq:NN +\cs_new_eq:NN \tl_gset_eq:NN \cs_gset_eq:NN +\cs_generate_variant:Nn \tl_set_eq:NN {Nc,c,cc} +\cs_generate_variant:Nn \tl_gset_eq:NN {Nc,c,cc} +\cs_new_nopar:Npn \tl_clear:N #1{\tl_set_eq:NN #1\c_empty_tl} +\cs_generate_variant:Nn \tl_clear:N {c} +\cs_new_nopar:Npn \tl_gclear:N #1{\tl_gset_eq:NN #1\c_empty_tl} +\cs_generate_variant:Nn \tl_gclear:N {c} +\cs_new_eq:NN \tl_clear_new:N \tl_clear:N +\cs_generate_variant:Nn \tl_clear_new:N {c} +\cs_new_eq:NN \tl_gclear_new:N \tl_gclear:N +\cs_generate_variant:Nn \tl_gclear_new:N {c} +\cs_new:Npn \tl_put_left:Nn #1#2 { + \tl_set:Nn \l_exp_tl {#2} + \tl_set:Nx #1 { \exp_not:V \l_exp_tl \exp_not:V #1 } +} +\cs_new:Npn \tl_put_left:NV #1#2 { + \tl_set:Nx #1 { \exp_not:V #2 \exp_not:V #1 } +} +\cs_new:Npn \tl_put_left:No #1#2{ + \tl_set:No \l_exp_tl {#2} + \tl_set:Nx #1 { \exp_not:V \l_exp_tl \exp_not:V #1 } +} +\cs_new:Npn \tl_put_left:Nx #1#2{ + \tl_set:Nx #1 { #2 \exp_not:V #1 } +} +\cs_new:Npn \tl_gput_left:Nn #1#2{ + \tl_set:Nn \l_exp_tl{#2} + \tl_gset:Nx #1 { \exp_not:V \l_exp_tl \exp_not:V #1 } +} +\cs_new:Npn \tl_gput_left:NV #1#2 { + \tl_gset:Nx #1 { \exp_not:V #2 \exp_not:V #1 } +} +\cs_new:Npn \tl_gput_left:No #1#2{ + \tl_set:No \l_exp_tl {#2} + \tl_gset:Nx #1 { \exp_not:V \l_exp_tl \exp_not:V #1 } +} +\cs_new:Npn \tl_gput_left:Nx #1#2{ + \tl_gset:Nx #1 { #2 \exp_not:V #1 } +} +\cs_generate_variant:Nn \tl_put_left:Nn {cn,co} +\cs_generate_variant:Nn \tl_put_left:NV {cV} +\cs_generate_variant:Nn \tl_gput_left:Nn {cn,co} +\cs_generate_variant:Nn \tl_gput_left:NV {cV} +\cs_new:Npn \tl_put_right:Nn #1#2 { + \tl_set:Nn \l_exp_tl {#2} + \tl_set:Nx #1 { \exp_not:V #1 \exp_not:V \l_exp_tl } +} +\cs_new:Npn \tl_gput_right:Nn #1#2{ + \tl_set:Nn \l_exp_tl {#2} + \tl_gset:Nx #1 { \exp_not:V #1 \exp_not:V \l_exp_tl } +} +\cs_new:Npn \tl_put_right:NV #1#2 { + \tl_set:Nx #1 { \exp_not:V #1 \exp_not:V #2 } +} +\cs_new:Npn \tl_put_right:No #1#2 { + \tl_set:No \l_exp_tl {#2} + \tl_set:Nx #1 { \exp_not:V #1 \exp_not:V \l_exp_tl } +} +\cs_new:Npn \tl_gput_right:NV #1#2 { + \tl_gset:Nx #1 { \exp_not:V #1 \exp_not:V #2 } +} +\cs_new:Npn \tl_gput_right:No #1#2 { + \tl_set:No \l_exp_tl {#2} + \tl_gset:Nx #1 { \exp_not:V #1 \exp_not:V \l_exp_tl } +} +\cs_set:Npn \tl_put_right:Nx #1#2 { + \tl_set:Nx #1 { \exp_not:V #1 #2 } +} +\cs_set:Npn \tl_gput_right:Nx #1#2 { + \tl_gset:Nx #1 { \exp_not:V #1 #2 } +} +\cs_generate_variant:Nn \tl_put_right:Nn {cn,co} +\cs_generate_variant:Nn \tl_put_right:NV {cV} +\cs_generate_variant:Nn \tl_gput_right:Nn {cn,co} +\cs_generate_variant:Nn \tl_gput_right:NV {cV} +\cs_new_nopar:Npn \tl_gset:Nc { + \pref_global:D + \tl_set:Nc} +\cs_new_nopar:Npn \tl_set:Nc #1#2{\tl_set:No #1{\cs:w#2\cs_end:}} +\tl_new:Nn \c_job_name_tl {\tex_jobname:D} +\tl_new:Nn \c_empty_tl {} +\tl_new:Nn \g_tmpa_tl{} +\tl_new:Nn \g_tmpb_tl{} +\tl_new:Nn \l_testa_tl {} +\tl_new:Nn \l_testb_tl {} +\tl_new:Nn \g_testa_tl {} +\tl_new:Nn \g_testb_tl {} +\tl_new:Nn \l_tmpa_tl{} +\tl_new:Nn \l_tmpb_tl{} +\prg_set_conditional:Npnn \tl_if_empty:N #1 {p,TF,T,F} { + \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:NTF {c} +\cs_generate_variant:Nn \tl_if_empty:NT {c} +\cs_generate_variant:Nn \tl_if_empty:NF {c} +\prg_new_conditional:Npnn \tl_if_eq:NN #1#2 {p,TF,T,F} { + \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_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_generate_variant:Nn \tl_if_empty_p:n {o} +\cs_generate_variant:Nn \tl_if_empty:nTF {o} +\cs_generate_variant:Nn \tl_if_empty:nT {o} +\cs_generate_variant:Nn \tl_if_empty:nF {o} +\prg_new_conditional:Npnn \tl_if_blank:n #1 {p,TF,T,F} { + \exp_after:wN \tl_if_blank_p_aux:w \tl_to_str:n {#1} aa..\q_nil +} +\cs_new:Npn \tl_if_blank_p_aux:w #1#2 a #3#4 \q_nil { + \if_meaning:w #3 #4 \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_generate_variant:Nn \tl_if_blank_p:n {V} +\cs_generate_variant:Nn \tl_if_blank:nTF {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_p:n {o} +\cs_generate_variant:Nn \tl_if_blank:nTF {o} +\cs_generate_variant:Nn \tl_if_blank:nT {o} +\cs_generate_variant:Nn \tl_if_blank:nF {o} +\cs_new_eq:NN \tl_compare:xx \pdf_strcmp:D +\cs_new:Npn \tl_compare:nn #1#2{ + \tl_compare:xx{\exp_not:n{#1}}{\exp_not:n{#2}} +} +\cs_new:Npn \tl_compare:nx #1{ + \tl_compare:xx{\exp_not:n{#1}} +} +\cs_new:Npn \tl_compare:xn #1#2{ + \tl_compare:xx{#1}{\exp_not:n{#2}} +} +\cs_new:Npn \tl_compare:nV #1#2 { + \tl_compare:xx { \exp_not:n {#1} } { \exp_not:V #2 } +} +\cs_new:Npn \tl_compare:no #1#2{ + \tl_compare:xx{\exp_not:n{#1}}{\exp_not:n\exp_after:wN{#2}} +} +\cs_new:Npn \tl_compare:Vn #1#2 { + \tl_compare:xx { \exp_not:V #1 } { \exp_not:n {#2} } +} +\cs_new:Npn \tl_compare:on #1#2{ + \tl_compare:xx{\exp_not:n\exp_after:wN{#1}}{\exp_not:n{#2}} +} +\cs_new:Npn \tl_compare:VV #1#2 { + \tl_compare:xx { \exp_not:V #1 } { \exp_not:V #2 } +} +\cs_new:Npn \tl_compare:oo #1#2{ + \tl_compare:xx{\exp_not:n\exp_after:wN{#1}}{\exp_not:n\exp_after:wN{#2}} +} +\cs_new:Npn \tl_compare:xV #1#2 { + \tl_compare:xx {#1} { \exp_not:V #2 } +} +\cs_new:Npn \tl_compare:xo #1#2{ + \tl_compare:xx{#1}{\exp_not:n\exp_after:wN{#2}} +} +\cs_new:Npn \tl_compare:Vx #1#2 { + \tl_compare:xx { \exp_not:V #1 } {#2} +} +\cs_new:Npn \tl_compare:ox #1#2{ + \tl_compare:xx{\exp_not:n\exp_after:wN{#1}}{#2} +} +\cs_set_nopar:Npn \tl_tmp:w #1 { + \tl_set:Nx \l_tmpa_tl { + \exp_not:N \prg_new_conditional:Npnn \exp_not:c {tl_if_eq:#1} + ####1 ####2 {p,TF,T,F} { + \exp_not:N \tex_ifnum:D + \exp_not:c {tl_compare:#1} {####1}{####2} + \exp_not:n{ =\c_zero \prg_return_true: \else: \prg_return_false: \fi: } + } + } + \l_tmpa_tl +} +\tl_tmp:w{xx} \tl_tmp:w{nx} \tl_tmp:w{ox} \tl_tmp:w{Vx} +\tl_tmp:w{xn} \tl_tmp:w{nn} \tl_tmp:w{on} \tl_tmp:w{Vn} +\tl_tmp:w{xo} \tl_tmp:w{no} \tl_tmp:w{oo} +\tl_tmp:w{xV} \tl_tmp:w{nV} \tl_tmp:w{VV} +\cs_if_exist:cF{pdf_strcmp:D}{ + \prg_set_protected_conditional:Npnn \tl_if_eq:nn #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl {\exp_not:n{#1}} + \tl_set:Nx \l_testb_tl {\exp_not:n{#2}} + \if_meaning:w\l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:nV #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl { \exp_not:n {#1} } + \tl_set:Nx \l_testb_tl { \exp_not:V #2 } + \if_meaning:w \l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:no #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl {\exp_not:n{#1}} + \tl_set:Nx \l_testb_tl {\exp_not:o{#2}} + \if_meaning:w\l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:nx #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl {\exp_not:n{#1}} + \tl_set:Nx \l_testb_tl {#2} + \if_meaning:w\l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:Vn #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl { \exp_not:V #1 } + \tl_set:Nx \l_testb_tl { \exp_not:n{#2} } + \if_meaning:w \l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:on #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl {\exp_not:o{#1}} + \tl_set:Nx \l_testb_tl {\exp_not:n{#2}} + \if_meaning:w\l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:VV #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl { \exp_not:V #1 } + \tl_set:Nx \l_testb_tl { \exp_not:V #2 } + \if_meaning:w \l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:oo #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl {\exp_not:o{#1}} + \tl_set:Nx \l_testb_tl {\exp_not:o{#2}} + \if_meaning:w\l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:Vx #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl { \exp_not:V #1 } + \tl_set:Nx \l_testb_tl {#2} + \if_meaning:w \l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:ox #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl {\exp_not:o{#1}} + \tl_set:Nx \l_testb_tl {#2} + \if_meaning:w\l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:xn #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl {#1} + \tl_set:Nx \l_testb_tl {\exp_not:n{#2}} + \if_meaning:w\l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:xV #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl {#1} + \tl_set:Nx \l_testb_tl { \exp_not:V #2 } + \if_meaning:w \l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:xo #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl {#1} + \tl_set:Nx \l_testb_tl {\exp_not:o{#2}} + \if_meaning:w\l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } + \prg_set_protected_conditional:Npnn \tl_if_eq:xx #1#2 {TF,T,F} { + \tl_set:Nx \l_testa_tl {#1} + \tl_set:Nx \l_testb_tl {#2} + \if_meaning:w\l_testa_tl \l_testb_tl + \prg_return_true: \else: \prg_return_false: + \fi: + } +} +\cs_new_eq:NN \tl_to_lowercase:n \tex_lowercase:D +\cs_new_eq:NN \tl_to_uppercase:n \tex_uppercase:D +\cs_new_eq:NN \tl_to_str:n \etex_detokenize:D +\cs_new_nopar:Npn \tl_to_str:N {\exp_after:wN\tl_to_str_aux:w + \token_to_meaning:N} +\cs_new_nopar:Npn \tl_to_str_aux:w #1>{} +\cs_generate_variant:Nn \tl_to_str:N {c} +\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 {cN} +\cs_new:Npn \tl_map_inline:nn #1#2{ + \num_gincr:N \g_tl_inline_level_num + \cs_gset:cpn {tl_map_inline_ \num_use:N \g_tl_inline_level_num :n} + ##1{#2} + \exp_args:Nc \tl_map_function_aux:Nn + {tl_map_inline_ \num_use:N \g_tl_inline_level_num :n} + #1 \q_recursion_tail\q_recursion_stop + \num_gdecr:N \g_tl_inline_level_num +} +\cs_new:Npn \tl_map_inline:Nn #1#2{ + \num_gincr:N \g_tl_inline_level_num + \cs_gset:cpn {tl_map_inline_ \num_use:N \g_tl_inline_level_num :n} + ##1{#2} + \exp_last_unbraced:NcV \tl_map_function_aux:Nn + {tl_map_inline_ \num_use:N \g_tl_inline_level_num :n} + #1 \q_recursion_tail\q_recursion_stop + \num_gdecr:N \g_tl_inline_level_num +} +\cs_generate_variant:Nn \tl_map_inline:Nn {c} +\tl_new:Nn \g_tl_inline_level_num{0} +\cs_new:Npn \tl_map_variable:nNn #1#2#3{ + \tl_map_variable_aux:Nnn #2 {#3} #1 \q_recursion_tail \q_recursion_stop +} +\cs_new_nopar:Npn \tl_map_variable:NNn {\exp_args:No \tl_map_variable:nNn} +\cs_generate_variant:Nn \tl_map_variable:NNn {c} +\cs_new: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_new_eq:NN \tl_map_break: \use_none_delimit_by_q_recursion_stop:w +\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_nopar:Npn \tl_reverse:N #1 { + \tl_set:Nf #1 { \tl_reverse:o { #1 \exp_stop_f: } } +} +\cs_new:Npn \tl_elt_count:n #1{ + \intexpr_eval:n { + \tl_map_function:nN {#1}\num_elt_count:n + } +} +\cs_generate_variant:Nn \tl_elt_count:n {V,o} +\cs_new_nopar:Npn \tl_elt_count:N #1{ + \intexpr_eval:n { + \tl_map_function:NN #1 \num_elt_count:n + } +} +\cs_new:Npn \tl_set_rescan:Nnn { \tl_set_rescan_aux:NNnn \tl_set:Nn } +\cs_new:Npn \tl_gset_rescan:Nnn { \tl_set_rescan_aux:NNnn \tl_gset:Nn } +\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: +\tl_to_lowercase:n { + \group_end: + \tl_new:Nn \c_two_ats_with_two_catcodes_tl {AB} +} +\cs_new:Npn \tl_set_rescan_aux:NNnn #1#2#3#4 { + \group_begin: + \toks_set:No \etex_everyeof:D { \c_two_ats_with_two_catcodes_tl } + \tex_endlinechar:D = \c_minus_one + #3 + \exp_after:wN \tl_rescan_aux:w \etex_scantokens:D {#4} + \exp_args:NNNo + \group_end: + #1 #2 { \l_tmpa_tl } +} +\exp_after:wN \cs_set:Npn +\exp_after:wN \tl_rescan_aux:w +\exp_after:wN # +\exp_after:wN 1 \c_two_ats_with_two_catcodes_tl { + \tl_set:Nn \l_tmpa_tl {#1} +} +\cs_new:Npn \tl_set_rescan:Nnx #1#2#3 { + \group_begin: + \etex_everyeof:D { \exp_not:N } + \tex_endlinechar:D = \c_minus_one + #2 + \tl_set:Nx \l_tmpa_tl { \etex_scantokens:D {#3} } + \exp_args:NNNo + \group_end: + \tl_set:Nn #1 { \l_tmpa_tl } +} +\cs_new:Npn \tl_gset_rescan:Nnx #1#2#3 { + \group_begin: + \etex_everyeof:D { \exp_not:N } + \tex_endlinechar:D = \c_minus_one + #2 + \tl_gset:Nx #1 { \etex_scantokens:D {#3} } + \group_end: +} +\cs_new:Npn \tl_rescan:nn #1#2 { + \group_begin: + \etex_everyeof:D { \exp_not:N } + \tex_endlinechar:D = \c_minus_one + #1 + \toks_set:Nx \l_tmpa_toks { \etex_scantokens:D {#2} } + \exp_args:NV \group_end: \l_tmpa_toks +} +\prg_new_protected_conditional:Npnn \tl_if_in:Nn #1#2 {TF,T,F} { + \cs_set:Npn \tl_tmp:w ##1 #2 ##2 \q_stop { + \quark_if_no_value:nTF {##2} {\prg_return_false:} {\prg_return_true:} + } + \exp_after:wN \tl_tmp:w #1 #2 \q_no_value \q_stop +} +\cs_generate_variant:Nn \tl_if_in:NnTF {c} +\cs_generate_variant:Nn \tl_if_in:NnT {c} +\cs_generate_variant:Nn \tl_if_in:NnF {c} +\prg_new_protected_conditional:Npnn \tl_if_in:nn #1#2 {TF,T,F} { + \cs_set:Npn \tl_tmp:w ##1 #2 ##2 \q_stop { + \quark_if_no_value:nTF {##2} {\prg_return_false:} {\prg_return_true:} + } + \tl_tmp:w #1 #2 \q_no_value \q_stop +} +\cs_generate_variant:Nn \tl_if_in:nnTF {V} +\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 {o} +\cs_generate_variant:Nn \tl_if_in:nnT {o} +\cs_generate_variant:Nn \tl_if_in:nnF {o} +%%\l_tl_replace_toks % moved to l3token as alloc not set up yet. +\cs_new:Npn \tl_replace_in_aux:NNnn #1#2#3#4{ + \cs_set:Npn \tl_tmp:w ##1#3##2\q_stop{ + \quark_if_no_value:nF{##2} + { + \toks_set:No\l_tl_replace_toks{##1#4} + \cs_set:Npn \tl_tmp:w ####1#3\q_no_value{ + \toks_put_right:No \l_tl_replace_toks { ####1 } + } + \tl_tmp:w \prg_do_nothing: ##2 + #1#2{\toks_use:N\l_tl_replace_toks} + } + } + \use:n{\exp_after:wN \tl_tmp:w\exp_after:wN\prg_do_nothing:} + #2#3 \q_no_value\q_stop +} +\cs_new_nopar:Npn \tl_replace_in:Nnn {\tl_replace_in_aux:NNnn \tl_set:Nx} +\cs_generate_variant:Nn\tl_replace_in:Nnn {cnn} +\cs_new_nopar:Npn \tl_greplace_in:Nnn {\tl_replace_in_aux:NNnn \tl_gset:Nx} +\cs_generate_variant:Nn\tl_greplace_in:Nnn {cnn} +\cs_set:Npn \tl_replace_all_in_aux:NNnn #1#2#3#4{ + \toks_clear:N \l_tl_replace_toks + \cs_set:Npn \tl_tmp:w ##1#3##2\q_stop{ + \quark_if_no_value:nTF{##2} + { + \toks_put_right:No \l_tl_replace_toks {##1} + } + { + \toks_put_right:No \l_tl_replace_toks {##1 #4} + \tl_tmp:w \prg_do_nothing: ##2 \q_stop + } + } + \use:n{\exp_after:wN \tl_tmp:w \exp_after:wN \prg_do_nothing:} + #2#3 \q_no_value\q_stop + #1#2{\toks_use:N\l_tl_replace_toks} +} +\cs_new_nopar:Npn \tl_replace_all_in:Nnn { + \tl_replace_all_in_aux:NNnn \tl_set:Nx} +\cs_generate_variant:Nn \tl_replace_all_in:Nnn {cnn} +\cs_new_nopar:Npn \tl_greplace_all_in:Nnn { + \tl_replace_all_in_aux:NNnn \tl_gset:Nx} +\cs_generate_variant:Nn \tl_greplace_all_in:Nnn {cnn} +\cs_new:Npn \tl_remove_in:Nn #1#2{\tl_replace_in:Nnn #1{#2}{}} +\cs_new:Npn \tl_gremove_in:Nn #1#2{\tl_greplace_in:Nnn #1{#2}{}} +\cs_generate_variant:Nn \tl_remove_in:Nn {cn} +\cs_generate_variant:Nn \tl_gremove_in:Nn {cn} +\cs_new:Npn \tl_remove_all_in:Nn #1#2{ + \tl_replace_all_in:Nnn #1{#2}{} +} +\cs_new:Npn \tl_gremove_all_in:Nn #1#2{ + \tl_greplace_all_in:Nnn #1{#2}{} +} +\cs_generate_variant:Nn \tl_remove_all_in:Nn {cn} +\cs_generate_variant:Nn \tl_gremove_all_in:Nn {cn} +\cs_new:Npn \tl_head:n #1{\tl_head:w #1\q_nil} +\cs_new_eq:NN \tl_head_i:n \tl_head:n +\cs_new:Npn \tl_tail:n #1{\tl_tail:w #1\q_nil} +\cs_generate_variant:Nn \tl_tail:n {f} +\cs_new:Npn \tl_head_iii:n #1{\tl_head_iii:w #1\q_nil} +\cs_generate_variant:Nn \tl_head_iii:n {f} +\cs_new_eq:NN \tl_head:w \use_i_delimit_by_q_nil:nw +\cs_new_eq:NN \tl_head_i:w \tl_head:w +\cs_new:Npn \tl_tail:w #1#2\q_nil{#2} +\cs_new:Npn \tl_head_iii:w #1#2#3#4\q_nil{#1#2#3} +\prg_new_conditional:Npnn \tl_if_head_eq_meaning:nN #1#2 {p,TF,T,F} { + \exp_after:wN \if_meaning:w \tl_head:w #1 \q_nil #2 + \prg_return_true: \else: \prg_return_false: \fi: +} +\prg_new_conditional:Npnn \tl_if_head_eq_charcode:nN #1#2 {p,TF,T,F} { + \exp_after:wN \if:w \exp_after:wN \exp_not:N + \tl_head:w #1 \q_nil \exp_not:N #2 + \prg_return_true: \else: \prg_return_false: \fi: +} +%% \cs_new:Npn \tl_if_head_eq_charcode_p:fN #1#2{ +%% \exp_after:wN\if_charcode:w \tl_head:w #1\q_nil\exp_not:N#2 +%% \c_true_bool +%% \else: +%% \c_false_bool +%% \fi: +%% } +%% \def_long_test_function_new:npn {tl_if_head_eq_charcode:fN}#1#2{ +%% \if_predicate:w \tl_if_head_eq_charcode_p:fN {#1}#2} +\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,TF,T,F} { + \exp_after:wN \if_catcode:w \exp_after:wN \exp_not:N + \tl_head:w #1 \q_nil \exp_not:N #2 + \prg_return_true: \else: \prg_return_false: \fi: +} +%% +%% +%% End of file `l3tl.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3tlp.sty b/Master/texmf-dist/tex/latex/expl3/l3tlp.sty deleted file mode 100644 index 1867f9e2e0e..00000000000 --- a/Master/texmf-dist/tex/latex/expl3/l3tlp.sty +++ /dev/null @@ -1,506 +0,0 @@ -%% -%% This is file `l3tlp.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% l3tlp.dtx (with options: `package,trace') -%% -%% -%% 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: l3tlp.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 -%% 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/cgi-bin/cvsweb.cgi/ -%% -%% 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 LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -\RequirePackage{l3names} -\GetIdInfo$Id: l3tlp.dtx 767 2008-08-05 19:44:21Z morten $ - {L3 Experimental Token List Pointers} -\ProvidesExplPackage - {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3basics} -\def_long_new:Npn \tlp_new:Nn #1#2{ - \chk_new_cs:N #1 - \gdef:Npn #1{#2} -} -\def_new:Npn \tlp_new:cn {\exp_args:Nc \tlp_new:Nn } -\def_long_new:Npn \tlp_new:Nx #1#2{ - \chk_new_cs:N #1 - \gdef:Npx #1{#2} -} -\def_new:Npn \tlp_new:N #1{\tlp_new:Nn #1{}} -\def_new:Npn \tlp_new:c #1{\tlp_new:cn {#1}{}} -\def_new:Npn \tlp_use:N #1 { - \if_meaning:NN #1 \scan_stop: - \err_latex_bug:x {Token~list~pointer~ `\token_to_string:N #1'~ - has~ an~ erroneous~ structure!} - \else: - \exp_after:NN #1 - \fi: -} -\def_new:Npn \tlp_use:c {\exp_args:Nc \tlp_use:N} -\def_long_new:Npn\tlp_set:Nn#1#2{\def:Npn#1{#2}} -\def_long_new:Npn\tlp_set:Nx#1#2{\def:Npx#1{#2}} -\def_long_new:Npn\tlp_gset:Nn#1#2{\gdef:Npn#1{#2}} -\def_long_new:Npn\tlp_gset:Nx#1#2{\gdef:Npx#1{#2}} -\def_new:Npn \tlp_set:No {\exp_args:NNo \tlp_set:Nn} -\def_new:Npn \tlp_set:Nd {\exp_args:NNd \tlp_set:Nn} -\def_new:Npn \tlp_set:Nf {\exp_args:NNf \tlp_set:Nn} -\def_new:Npn \tlp_set:cn {\exp_args:Nc \tlp_set:Nn} -\def_new:Npn \tlp_set:co {\exp_args:Nco \tlp_set:Nn} -\def_new:Npn \tlp_set:cx {\exp_args:Nc \tlp_set:Nx} -\def_new:Npn \tlp_gset:No {\exp_args:NNo \tlp_gset:Nn} -\def_new:Npn \tlp_gset:Nd {\exp_args:NNd \tlp_gset:Nn} -\def_new:Npn \tlp_gset:cn {\exp_args:Nc \tlp_gset:Nn} -\def_new:Npn \tlp_gset:cx {\exp_args:Nc \tlp_gset:Nx} -\let_new:NN \tlp_set_eq:NN \let:NN -\let_new:NN \tlp_gset_eq:NN \glet:NN -\def_new:Npn \tlp_set_eq:Nc {\exp_args:NNc \tlp_set_eq:NN} -\def_new:Npn \tlp_set_eq:cN {\exp_args:Nc \tlp_set_eq:NN} -\def_new:Npn \tlp_set_eq:cc {\exp_args:Ncc \tlp_set_eq:NN} -\def_new:Npn \tlp_gset_eq:Nc {\exp_args:NNc \tlp_gset_eq:NN} -\def_new:Npn \tlp_gset_eq:cN {\exp_args:Nc \tlp_gset_eq:NN} -\def_new:Npn \tlp_gset_eq:cc {\exp_args:Ncc \tlp_gset_eq:NN} -\def_new:Npn \tlp_clear:N #1{\tlp_set_eq:NN #1\c_empty_tlp} -\def_new:Npn \tlp_clear:c {\exp_args:Nc \tlp_clear:N} -\def_new:Npn \tlp_gclear:N #1{\tlp_gset_eq:NN #1\c_empty_tlp} -\def_new:Npn \tlp_gclear:c {\exp_args:Nc \tlp_gclear:N} -\let_new:NN \tlp_clear_new:N \tlp_clear:N -\def_new:Npn \tlp_clear_new:c {\exp_args:Nc \tlp_clear_new:N} -\let_new:NN \tlp_gclear_new:N \tlp_gclear:N -\def_new:Npn \tlp_gclear_new:c {\exp_args:Nc \tlp_gclear_new:N} -\def_long_new:Npn \tlp_put_left:Nn #1#2{ - \tlp_set:Nn \l_exp_tlp{#2} - \tlp_set:Nx #1{\exp_not:o{\l_exp_tlp}\exp_not:o{#1}} -} -\def_long_new:Npn \tlp_put_left:No #1#2{ - \tlp_set:Nn \l_exp_tlp{#2} - \tlp_set:Nx #1{\exp_not:d{\l_exp_tlp}\exp_not:o{#1}} -} -\def_long_new:Npn \tlp_put_left:Nx #1#2{ - \tlp_set:Nx #1{#2\exp_not:o{#1}} -} -\def_long_new:Npn \tlp_gput_left:Nn #1#2{ - \tlp_set:Nn \l_exp_tlp{#2} - \tlp_gset:Nx #1{\exp_not:o{\l_exp_tlp}\exp_not:o{#1}} -} -\def_long_new:Npn \tlp_gput_left:No #1#2{ - \tlp_set:Nn \l_exp_tlp{#2} - \tlp_gset:Nx #1{\exp_not:d{\l_exp_tlp}\exp_not:o{#1}} -} -\def_long_new:Npn \tlp_gput_left:Nx #1#2{ - \tlp_gset:Nx #1{#2\exp_not:o{#1}} -} -\def_long_new:Npn \tlp_put_left:cn{\exp_args:Nc\tlp_put_left:Nn} -\def_long_new:Npn \tlp_put_left:co{\exp_args:Nc\tlp_put_left:No} -\def_long_new:Npn \tlp_put_left:cx{\exp_args:Nc\tlp_put_left:Nx} -\def_long_new:Npn \tlp_gput_left:cn{\exp_args:Nc\tlp_gput_left:Nn} -\def_long_new:Npn \tlp_gput_left:co{\exp_args:Nc\tlp_gput_left:No} -\def_long_new:Npn \tlp_gput_left:cx{\exp_args:Nc\tlp_gput_left:Nx} -\def_long_new:Npn \tlp_put_right:Nn #1#2{ - \tlp_set:Nn \l_exp_tlp{#2} - \tlp_set:Nx #1{\exp_not:o{#1}\exp_not:o{\l_exp_tlp}} -} -\def_long_new:Npn \tlp_gput_right:Nn #1#2{ - \tlp_set:Nn \l_exp_tlp{#2} - \tlp_gset:Nx #1{\exp_not:o{#1}\exp_not:o{\l_exp_tlp}} -} -\def_long_new:Npn \tlp_put_right:No #1#2{ - \tlp_set:Nn \l_exp_tlp{#2} - \tlp_set:Nx #1{\exp_not:o{#1}\exp_not:d{\l_exp_tlp}} -} -\def_long_new:Npn \tlp_gput_right:No #1#2{ - \tlp_set:Nn \l_exp_tlp{#2} - \tlp_gset:Nx #1{\exp_not:o{#1}\exp_not:d{\l_exp_tlp}} -} -\def_long:Npn \tlp_put_right:Nx #1#2{ - \tlp_set:Nx #1{\exp_not:o{#1}#2} -} -\def_long:Npn \tlp_gput_right:Nx #1#2{ - \tlp_gset:Nx #1{\exp_not:o{#1}#2} -} -\def_new:Npn \tlp_gput_right:cn {\exp_args:Nc \tlp_gput_right:Nn} -\def_new:Npn \tlp_gput_right:co {\exp_args:Nc \tlp_gput_right:No} -\def_new:Npn \tlp_put_right:cc {\exp_args:Ncc \tlp_put_right:Nn} -\def_new:Npn \tlp_gset:Nc { - \pref_global:D - \tlp_set:Nc} -\def_new:Npn \tlp_set:Nc #1#2{\tlp_set:No #1{\cs:w#2\cs_end:}} -\def_new:Npn \tlp_if_empty_p:N #1{ - \if_meaning:NN#1\c_empty_tlp \c_true \else: \c_false \fi:} -\def_new:Npn \tlp_if_empty_p:c {\exp_args:Nc\tlp_if_empty_p:N} -\def_test_function_new:npn {tlp_if_empty:N} #1{ - \if_meaning:NN#1\c_empty_tlp} -\def_new:Npn \tlp_if_empty:cTF {\exp_args:Nc \tlp_if_empty:NTF} -\def_new:Npn \tlp_if_empty:cT {\exp_args:Nc \tlp_if_empty:NT} -\def_new:Npn \tlp_if_empty:cF {\exp_args:Nc \tlp_if_empty:NF} -\def_new:Npn \tlp_if_eq_p:NN #1#2{ - \if_meaning:NN#1#2 \c_true \else: \c_false \fi:} -\def_new:Npn \tlp_if_eq_p:Nc {\exp_args:NNc\tlp_if_empty_p:NN} -\def_new:Npn \tlp_if_eq_p:cN {\exp_args:Nc\tlp_if_empty_p:NN} -\def_new:Npn \tlp_if_eq_p:cc {\exp_args:Ncc\tlp_if_empty_p:NN} -\def_test_function_new:npn {tlp_if_eq:NN} #1#2{\if_meaning:NN#1#2} -\def_new:Npn \tlp_if_eq:cNTF{\exp_args:Nc \tlp_if_eq:NNTF} -\def_new:Npn \tlp_if_eq:cNT {\exp_args:Nc \tlp_if_eq:NNT} -\def_new:Npn \tlp_if_eq:cNF {\exp_args:Nc \tlp_if_eq:NNF} -\def_new:Npn \tlp_if_eq:NcTF{\exp_args:NNc \tlp_if_eq:NNTF} -\def_new:Npn \tlp_if_eq:NcT {\exp_args:NNc \tlp_if_eq:NNT} -\def_new:Npn \tlp_if_eq:NcF {\exp_args:NNc \tlp_if_eq:NNF} -\def_new:Npn \tlp_if_eq:ccTF{\exp_args:Ncc \tlp_if_eq:NNTF} -\def_new:Npn \tlp_if_eq:ccT {\exp_args:Ncc \tlp_if_eq:NNT} -\def_new:Npn \tlp_if_eq:ccF {\exp_args:Ncc \tlp_if_eq:NNF} -\tlp_new:Nn \c_empty_tlp {} -\tlp_new:Nn \c_relax_tlp {\scan_stop:} -\tlp_new:Nn \g_tmpa_tlp{} -\tlp_new:Nn \g_tmpb_tlp{} -\tlp_new:Nn \l_testa_tlp {} -\tlp_new:Nn \l_testb_tlp {} -\tlp_new:Nn \g_testa_tlp {} -\tlp_new:Nn \g_testb_tlp {} -\tlp_new:Nn \l_tmpa_tlp{} -\tlp_new:Nn \l_tmpb_tlp{} -\def_new:Npn \tlp_to_str:N {\exp_after:NN\tlp_to_str_aux:w - \token_to_meaning:N} -\def_new:Npn \tlp_to_str_aux:w #1>{} -\def_new:Npn\tlp_to_str:c{\exp_args:Nc\tlp_to_str:N} -\def_long_new:Npn \tlist_if_empty_p:n #1{ - \exp_after:NN\if_meaning:NN\exp_after:NN\q_nil\tlist_to_str:n{#1}\q_nil - \c_true - \else: - \c_false - \fi: -} -\def_new:Npn \tlist_if_empty_p:o {\exp_args:No\tlist_if_empty_p:n} -\def_long_test_function_new:npn{tlist_if_empty:n}#1{ - \if:w\tlist_if_empty_p:n{#1}} -\def_long_test_function_new:npn{tlist_if_empty:o}#1{ - \if:w\tlist_if_empty_p:o{#1}} -\def_long_new:Npn \tlist_if_blank_p:n #1{ - \exp_after:NN\tlist_if_blank_p_aux:w\tlist_to_str:n{#1}aa..\q_nil -} -\def_new:Npn \tlist_if_blank_p_aux:w #1#2a#3#4\q_nil{ - \if_meaning:NN #3#4\c_true\else:\c_false\fi:} -\def_long_test_function_new:npn{tlist_if_blank:n}#1{ - \if:w\tlist_if_blank_p:n{#1}} -\def:Npn \tlist_if_blank_p:o{\exp_args:No\tlist_if_blank_p:n} -\def_long_test_function_new:npn{tlist_if_blank:o}#1{ - \if:w\tlist_if_blank_p:o{#1}} -\let_new:NN \tlist_to_lowercase:n \tex_lowercase:D -\let_new:NN \tlist_to_uppercase:n \tex_uppercase:D -\let_new:NN \tlist_to_str:n \etex_detokenize:D -\def_long_new:Npn \tlist_map_function:nN #1#2{ - \tlist_map_function_aux:Nn #2 #1 \q_recursion_tail \q_recursion_stop -} -\def_new:Npn \tlp_map_function:NN #1#2{ - \exp_after:NN \tlist_map_function_aux:Nn - \exp_after:NN #2 #1 \q_recursion_tail \q_recursion_stop -} -\def_long_new:Npn \tlist_map_function_aux:Nn #1#2{ - \quark_if_recursion_tail_stop:n{#2} - #1{#2} \tlist_map_function_aux:Nn #1 -} -\def_new:Npn\tlp_map_function:cN{\exp_args:Nc\tlp_map_function:NN} -\def_long_new:Npn \tlist_map_inline:nn #1#2{ - \num_gincr:N \g_tlp_inline_level_num - \gdef_long:cpn {tlist_map_inline_ \num_use:N \g_tlp_inline_level_num :n} - ##1{#2} - \exp_args:Nc \tlist_map_function_aux:Nn - {tlist_map_inline_ \num_use:N \g_tlp_inline_level_num :n} - #1 \q_recursion_tail\q_recursion_stop - \num_gdecr:N \g_tlp_inline_level_num -} -\def_long_new:Npn \tlp_map_inline:Nn #1#2{ - \num_gincr:N \g_tlp_inline_level_num - \gdef_long:cpn {tlist_map_inline_ \num_use:N \g_tlp_inline_level_num :n} - ##1{#2} - \exp_args:NcE \tlist_map_function_aux:Nn - {tlist_map_inline_ \num_use:N \g_tlp_inline_level_num :n} - #1 \q_recursion_tail\q_recursion_stop - \num_gdecr:N \g_tlp_inline_level_num -} -\def_new:Npn\tlp_map_inline:cN{\exp_args:Nc\tlp_map_inline:NN} -\tlp_new:Nn \g_tlp_inline_level_num{0} -\def_long_new:Npn \tlist_map_variable:nNn #1#2#3{ - \tlist_map_variable_aux:Nnn #2 {#3} #1 \q_recursion_tail \q_recursion_stop -} -\def_new:Npn \tlp_map_variable:NNn {\exp_args:No \tlist_map_variable:nNn} -\def_new:Npn \tlp_map_variable:cNn {\exp_args:Nc \tlp_map_variable:NNn} -\def_long_new:Npn \tlist_map_variable_aux:Nnn #1#2#3{ - \tlp_set:Nn #1{#3} - \quark_if_recursion_tail_stop:N #1 - #2 \tlist_map_variable_aux:Nnn #1{#2} -} -\let_new:NN \tlist_map_break:w \use_none_delimit_by_q_recursion_stop:w -\let_new:NN \tlp_map_break:w \tlist_map_break:w -\def_long_new:Npn \tlist_elt_count:n #1{ - \num_value:w \num_eval:w 0 - \tlist_map_function:nN {#1}\num_elt_count:n - \num_eval_end: -} -\def_new:Npn \tlist_elt_count:o {\exp_args:No\tlist_elt_count:n} -\def_new:Npn \tlp_elt_count:N #1{ - \num_value:w \num_eval:w 0 - \tlp_map_function:NN #1 \num_elt_count:n - \num_eval_end: -} -\let_new:NN \tlist_compare:xx \pdfstrcmp -\def_long_new:NNn \tlist_compare:nn 2{ - \tlist_compare:xx{\exp_not:n{#1}}{\exp_not:n{#2}} -} -\def_long_new:NNn \tlist_compare:nx 1{ - \tlist_compare:xx{\exp_not:n{#1}} -} -\def_long_new:NNn \tlist_compare:xn 2{ - \tlist_compare:xx{#1}{\exp_not:n{#2}} -} -\def_long_new:NNn \tlist_compare:no 2{ - \tlist_compare:xx{\exp_not:n{#1}}{\exp_not:n\exp_after:NN{#2}} -} -\def_long_new:NNn \tlist_compare:on 2{ - \tlist_compare:xx{\exp_not:n\exp_after:NN{#1}}{\exp_not:n{#2}} -} -\def_long_new:NNn \tlist_compare:oo 2{ - \tlist_compare:xx{\exp_not:n\exp_after:NN{#1}}{\exp_not:n\exp_after:NN{#2}} -} -\def_long_new:NNn \tlist_compare:xo 2{ - \tlist_compare:xx{#1}{\exp_not:n\exp_after:NN{#2}} -} -\def_long_new:NNn \tlist_compare:ox 2{ - \tlist_compare:xx{\exp_not:n\exp_after:NN{#1}}{\exp_not:n{#2}} -} -\def:Npn \tmp:w #1{ - \def_long_new:cNx {tlist_if_eq_p:#1} 2{ - \exp_not:N \if_num:w - \exp_after:NN \exp_not:N \cs:w tlist_compare:#1\cs_end:{##1}{##2} - \exp_not:n{ =\c_zero \c_true \else: \c_false \fi: } - } - \def_long_test_function_new:npx{tlist_if_eq:#1}##1##2{ - \exp_not:N \if_num:w - \exp_after:NN \exp_not:N \cs:w tlist_compare:#1\cs_end:{##1}{##2} - \exp_not:n{ =\c_zero } - } -} -\tmp:w{xx} \tmp:w{nn} \tmp:w{oo} \tmp:w{xn} \tmp:w{nx} -\tmp:w{on} \tmp:w{no} \tmp:w{xo} \tmp:w{ox} -\cs_if_really_free:cT{pdf_strcmp:D}{ - \def_long_test_function:npn{tlist_if_eq:nn}#1#2{ - \tlp_set:Nx \l_testa_tlp {\exp_not:n{#1}} - \tlp_set:Nx \l_testb_tlp {\exp_not:n{#2}} - \if_meaning:NN\l_testa_tlp \l_testb_tlp - } - \def_long_test_function:npn{tlist_if_eq:no}#1#2{ - \tlp_set:Nx \l_testa_tlp {\exp_not:n{#1}} - \tlp_set:Nx \l_testb_tlp {\exp_not:o{#2}} - \if_meaning:NN\l_testa_tlp \l_testb_tlp - } - \def_long_test_function:npn{tlist_if_eq:nx}#1#2{ - \tlp_set:Nx \l_testa_tlp {\exp_not:n{#1}} - \tlp_set:Nx \l_testb_tlp {#2} - \if_meaning:NN\l_testa_tlp \l_testb_tlp - } - \def_long_test_function:npn{tlist_if_eq:on}#1#2{ - \tlp_set:Nx \l_testa_tlp {\exp_not:o{#1}} - \tlp_set:Nx \l_testb_tlp {\exp_not:n{#2}} - \if_meaning:NN\l_testa_tlp \l_testb_tlp - } - \def_long_test_function:npn{tlist_if_eq:oo}#1#2{ - \tlp_set:Nx \l_testa_tlp {\exp_not:o{#1}} - \tlp_set:Nx \l_testb_tlp {\exp_not:o{#2}} - \if_meaning:NN\l_testa_tlp \l_testb_tlp - } - \def_long_test_function:npn{tlist_if_eq:ox}#1#2{ - \tlp_set:Nx \l_testa_tlp {\exp_not:o{#1}} - \tlp_set:Nx \l_testb_tlp {#2} - \if_meaning:NN\l_testa_tlp \l_testb_tlp - } - \def_long_test_function:npn{tlist_if_eq:xn}#1#2{ - \tlp_set:Nx \l_testa_tlp {#1} - \tlp_set:Nx \l_testb_tlp {\exp_not:n{#2}} - \if_meaning:NN\l_testa_tlp \l_testb_tlp - } - \def_long_test_function:npn{tlist_if_eq:xo}#1#2{ - \tlp_set:Nx \l_testa_tlp {#1} - \tlp_set:Nx \l_testb_tlp {\exp_not:o{#2}} - \if_meaning:NN\l_testa_tlp \l_testb_tlp - } - \def_long_test_function:npn{tlist_if_eq:xx}#1#2{ - \tlp_set:Nx \l_testa_tlp {#1} - \tlp_set:Nx \l_testb_tlp {#2} - \if_meaning:NN\l_testa_tlp \l_testb_tlp - } -} -\def_long:Npn \tlp_if_in:NnTF #1#2{ - \def_long:Npn\tmp:w ##1 #2 ##2\q_stop{ - \quark_if_no_value:nFT{##2} - } - \exp_after:NN \tmp:w #1 #2 \q_no_value \q_stop -} -\def_new:Npn \tlp_if_in:cnTF {\exp_args:Nc\tlp_if_in:NnTF} -\def_long:Npn \tlp_if_in:NnT #1#2{ - \def_long:Npn\tmp:w ##1 #2 ##2\q_stop{ - \quark_if_no_value:nF{##2} - } - \exp_after:NN \tmp:w #1 #2 \q_no_value \q_stop -} -\def_new:Npn \tlp_if_in:cnT {\exp_args:Nc\tlp_if_in:NnT} -\def_long:Npn \tlp_if_in:NnF #1#2{ - \def_long:Npn\tmp:w ##1 #2 ##2\q_stop{ - \quark_if_no_value:nT{##2} - } - \exp_after:NN \tmp:w #1 #2 \q_no_value \q_stop -} -\def_new:Npn \tlp_if_in:cnF {\exp_args:Nc\tlp_if_in:NnF} -\def_long_new:Npn \tlist_if_in:nnTF #1#2{ - \def_long:Npn\tmp:w ##1 #2 ##2\q_stop{ - \quark_if_no_value:nFT{##2} - } - \tmp:w #1 #2 \q_no_value \q_stop -} -\def_new:Npn \tlist_if_in:onTF {\exp_args:No\tlist_if_in:nnTF} -\tlp_new:Nn\l_tlp_replace_tlp{} -\def_long_new:NNn \tlp_replace_in_aux:NNnn 4{ - \def_long:Npn \tmp:w ##1#3##2\q_stop{ - \quark_if_no_value:nF{##2} - { - \tlp_set:Nx\l_tlp_replace_tlp{\exp_not:o{\use_none:n##1#4}} - \def_long:Npn \tmp:w ####1#3\q_no_value{ - \tlp_put_right:Nx \l_tlp_replace_tlp {\exp_not:o{\use_none:n ####1}} - } - \tmp:w \q_mark ##2 - } - #1#2\l_tlp_replace_tlp - } - \use_arg_i:n{\exp_after:NN \tmp:w\exp_after:NN\q_mark} - #2#3 \q_no_value\q_stop -} -\def_new:Npn \tlp_replace_in:Nnn {\tlp_replace_in_aux:NNnn \tlp_set_eq:NN} -\def_new:Npn \tlp_replace_in:cnn{\exp_args:Nc\tlp_replace_in:Nnn} -\def_new:Npn \tlp_greplace_in:Nnn {\tlp_replace_in_aux:NNnn \tlp_gset_eq:NN} -\def_new:Npn \tlp_greplace_in:cnn{\exp_args:Nc\tlp_greplace_in:Nnn} -\def_long:NNn \tlp_replace_all_in_aux:NNnn 4{ - \tlp_clear:N \l_tlp_replace_tlp - \def_long:Npn \tmp:w ##1#3##2\q_stop{ - \quark_if_no_value:nTF{##2} - { - \tlp_put_right:Nx \l_tlp_replace_tlp {\exp_not:o{\use_none:n##1}} - } - { - \tlp_put_right:Nx \l_tlp_replace_tlp {\exp_not:o{\use_none:n##1 #4}} - \tmp:w \q_mark##2 \q_stop - } - } - \use_arg_i:n{\exp_after:NN \tmp:w\exp_after:NN\q_mark} - #2#3 \q_no_value\q_stop - #1#2\l_tlp_replace_tlp -} -\def_new:Npn \tlp_replace_all_in:Nnn { - \tlp_replace_all_in_aux:NNnn \tlp_set_eq:NN} -\def_new:Npn \tlp_replace_all_in:cnn{\exp_args:Nc\tlp_replace_all_in:Nnn} -\def_new:Npn \tlp_greplace_all_in:Nnn { - \tlp_replace_all_in_aux:NNnn \tlp_gset_eq:NN} -\def_new:Npn \tlp_greplace_all_in:cnn{\exp_args:Nc\tlp_greplace_all_in:Nnn} -\def_long_new:NNn \tlp_remove_in:Nn 2{\tlp_replace_in:Nnn #1{#2}{}} -\def_long_new:NNn \tlp_gremove_in:Nn 2{\tlp_greplace_in:Nnn #1{#2}{}} -\def_new:Npn \tlp_remove_in:cn{\exp_args:Nc\tlp_remove_in:Nn} -\def_new:Npn \tlp_gremove_in:cn{\exp_args:Nc\tlp_gremove_in:Nn} -\def_long_new:Npn \tlp_remove_all_in:Nn #1#2{ - \tlp_replace_all_in:Nnn #1{#2}{} -} -\def_long_new:Npn \tlp_gremove_all_in:Nn #1#2{ - \tlp_greplace_all_in:Nnn #1{#2}{} -} -\def_new:Npn \tlp_remove_all_in:cn{\exp_args:Nc\tlp_remove_all_in:Nn} -\def_new:Npn \tlp_gremove_all_in:cn{\exp_args:Nc\tlp_gremove_all_in:Nn} -\def_long_new:Npn \tlist_head:n #1{\tlist_head:w #1\q_nil} -\let_new:NN \tlist_head_i:n \tlist_head:n -\def_long_new:Npn \tlist_tail:n #1{\tlist_tail:w #1\q_nil} -\def_new:Npn \tlist_tail:f {\exp_args:Nf \tlist_tail:n} -\def_long_new:Npn \tlist_head_iii:n #1{\tlist_head_iii:w #1\q_nil} -\def_new:Npn \tlist_head_iii:f {\exp_args:Nf \tlist_head_iii:n} -\let_new:NN \tlist_head:w \use_arg_i_delimit_by_q_nil:nw -\def_long_new:Npn \tlist_tail:w #1#2\q_nil{#2} -\def_long_new:Npn \tlist_head_iii:w #1#2#3#4\q_nil{#1#2#3} -\def_long_new:Npn \tlist_if_head_eq_meaning_p:nN #1#2{ - \exp_after:NN \if_meaning:NN \tlist_head:w #1\q_nil#2 - \c_true - \else: - \c_false - \fi: -} -\def_long_test_function_new:npn {tlist_if_head_eq_meaning:nN}#1#2{ - \if:w \tlist_if_head_eq_meaning_p:nN{#1}#2} -\def_long_new:Npn \tlist_if_head_eq_charcode_p:nN #1#2{ - \exp_after:NN\if_charcode:w \exp_after:NN\exp_not:N - \tlist_head:w #1\q_nil\exp_not:N#2 - \c_true - \else: - \c_false - \fi: -} -\def_long_test_function_new:npn {tlist_if_head_eq_charcode:nN}#1#2{ - \if:w\tlist_if_head_eq_charcode_p:nN{#1}#2} -\def_long_new:Npn \tlist_if_head_eq_charcode_p:fN #1#2{ - \exp_after:NN\if_charcode:w \tlist_head:w #1\q_nil\exp_not:N#2 - \c_true - \else: - \c_false - \fi: -} -\def_long_test_function_new:npn {tlist_if_head_eq_charcode:fN}#1#2{ - \if:w\tlist_if_head_eq_charcode_p:fN{#1}#2} -\def_long_new:Npn \tlist_if_head_eq_catcode_p:nN #1#2{ - \exp_after:NN\if_charcode:w \exp_after:NN\exp_not:N - \tlist_head:w #1\q_nil\exp_not:N#2 - \c_true - \else: - \c_false - \fi: -} -\def_long_test_function_new:npn {tlist_if_head_eq_catcode:nN}#1#2{ - \if:w\tlist_if_head_eq_catcode_p:nN{#1}#2} -\def_long_new:Npn \tlist_reverse:n #1{ - \tlist_reverse_aux:nN {} #1 \q_recursion_tail\q_recursion_stop -} -\def_long_new:Npn \tlist_reverse_aux:nN #1#2{ - \quark_if_recursion_tail_stop_do:nn {#2}{ #1 } - \tlist_reverse_aux:nN {#2#1} -} -\RequirePackage{l3expan} -\RequirePackage{l3num}\par -%% -%% -%% End of file `l3tlp.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3token.sty b/Master/texmf-dist/tex/latex/expl3/l3token.sty index b9f43418038..034312a4707 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3token.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3token.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3token.dtx Copyright (C) 2005-2006 LaTeX3 project +%% File: l3token.dtx Copyright (C) 2005-2009 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,64 +48,108 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3token.dtx 701 2007-11-27 14:21:05Z morten $ +\GetIdInfo$Id: l3token.dtx 1365 2009-05-31 17:26:17Z mittelba $ {L3 Experimental token investigation and manipulation} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3prg} -\RequirePackage{l3int} -\let_new:NN \char_set_catcode:w \tex_catcode:D -\def_new:Npn \char_set_catcode:nn #1#2{ - \char_set_catcode:w #1 = \int_eval:n{#2} -} -\def_new:Npn \char_value_catcode:w {\int_use:N\tex_catcode:D} -\def_new:Npn \char_value_catcode:n #1{\char_value_catcode:w \int_eval:n{#1}} -\def_new:Npn \char_show_value_catcode:w {\tex_showthe:D\tex_catcode:D} -\def_new:Npn \char_show_value_catcode:n #1{ - \char_show_value_catcode:w \int_eval:n{#1}} -\let_new:NN \char_set_mathcode:w \tex_mathcode:D -\def_new:Npn \char_set_mathcode:nn #1#2{ - \char_set_mathcode:w #1 = \int_eval:n{#2} -} -\def_protected_new:Npn \char_gset_mathcode:w {\pref_global:D\tex_mathcode:D} -\def_new:Npn \char_gset_mathcode:nn #1#2{ - \char_gset_mathcode:w #1 = \int_eval:n{#2} -} -\def_new:Npn \char_value_mathcode:w {\int_use:N\tex_mathcode:D} -\def_new:Npn \char_value_mathcode:n #1{\char_value_mathcode:w \int_eval:n{#1}} -\def_new:Npn \char_show_value_mathcode:w {\tex_showthe:D\tex_mathcode:D} -\def_new:Npn \char_show_value_mathcode:n #1{ - \char_show_value_mathcode:w \int_eval:n{#1}} -\let_new:NN \char_set_lccode:w \tex_lccode:D -\def_new:Npn \char_set_lccode:nn #1#2{ - \char_set_lccode:w #1 = \int_eval:n{#2} -} -\def_new:Npn \char_value_lccode:w {\int_use:N\tex_lccode:D} -\def_new:Npn \char_value_lccode:n #1{\char_value_lccode:w \int_eval:n{#1}} -\def_new:Npn \char_show_value_lccode:w {\tex_showthe:D\tex_lccode:D} -\def_new:Npn \char_show_value_lccode:n #1{ - \char_show_value_lccode:w \int_eval:n{#1}} -\let_new:NN \char_set_uccode:w \tex_uccode:D -\def_new:Npn \char_set_uccode:nn #1#2{ - \char_set_uccode:w #1 = \int_eval:n{#2} -} -\def_new:Npn \char_value_uccode:w {\int_use:N\tex_uccode:D} -\def_new:Npn \char_value_uccode:n #1{\char_value_uccode:w \int_eval:n{#1}} -\def_new:Npn \char_show_value_uccode:w {\tex_showthe:D\tex_uccode:D} -\def_new:Npn \char_show_value_uccode:n #1{ - \char_show_value_uccode:w \int_eval:n{#1}} -\let_new:NN \char_set_sfcode:w \tex_sfcode:D -\def_new:Npn \char_set_sfcode:nn #1#2{ - \char_set_sfcode:w #1 = \int_eval:n{#2} -} -\def_new:Npn \char_value_sfcode:w {\int_use:N\tex_uccode:D} -\def_new:Npn \char_value_sfcode:n #1{\char_value_sfcode:w \int_eval:n{#1}} -\def_new:Npn \char_show_value_sfcode:w {\tex_showthe:D\tex_sfcode:D} -\def_new:Npn \char_show_value_sfcode:n #1{ - \char_show_value_sfcode:w \int_eval:n{#1}} -\def_new:Npn \token_new:Nn #1#2{\glet_new:NN #1#2} -\let_new:NN \c_group_begin_token { -\let_new:NN \c_group_end_token } +\package_check_loaded_expl: +\cs_new_eq:NN \char_set_catcode:w \tex_catcode:D +\cs_new_nopar:Npn \char_set_catcode:nn #1#2 { + \char_set_catcode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: +} +\cs_new_nopar:Npn \char_value_catcode:w { \int_use:N \tex_catcode:D } +\cs_new_nopar:Npn \char_value_catcode:n #1 { + \char_value_catcode:w \intexpr_eval:w #1\intexpr_eval_end: +} +\cs_new_nopar:Npn \char_show_value_catcode:w { + \tex_showthe:D \tex_catcode:D +} +\cs_new_nopar:Npn \char_show_value_catcode:n #1 { + \char_show_value_catcode:w \intexpr_eval:w #1\intexpr_eval_end: +} +\cs_new_nopar:Npn \char_make_escape:N #1 { \char_set_catcode:nn {`#1} {\c_zero} } +\cs_new_nopar:Npn \char_make_begin_group:N #1 { \char_set_catcode:nn {`#1} {\c_one} } +\cs_new_nopar:Npn \char_make_end_group:N #1 { \char_set_catcode:nn {`#1} {\c_two} } +\cs_new_nopar:Npn \char_make_math_shift:N #1 { \char_set_catcode:nn {`#1} {\c_three} } +\cs_new_nopar:Npn \char_make_alignment:N #1 { \char_set_catcode:nn {`#1} {\c_four} } +\cs_new_nopar:Npn \char_make_end_line:N #1 { \char_set_catcode:nn {`#1} {\c_five} } +\cs_new_nopar:Npn \char_make_parameter:N #1 { \char_set_catcode:nn {`#1} {\c_six} } +\cs_new_nopar:Npn \char_make_math_superscript:N #1 { \char_set_catcode:nn {`#1} {\c_seven} } +\cs_new_nopar:Npn \char_make_math_subscript:N #1 { \char_set_catcode:nn {`#1} {\c_eight} } +\cs_new_nopar:Npn \char_make_ignore:N #1 { \char_set_catcode:nn {`#1} {\c_nine} } +\cs_new_nopar:Npn \char_make_space:N #1 { \char_set_catcode:nn {`#1} {\c_ten} } +\cs_new_nopar:Npn \char_make_letter:N #1 { \char_set_catcode:nn {`#1} {\c_eleven} } +\cs_new_nopar:Npn \char_make_other:N #1 { \char_set_catcode:nn {`#1} {\c_twelve} } +\cs_new_nopar:Npn \char_make_active:N #1 { \char_set_catcode:nn {`#1} {\c_thirteen} } +\cs_new_nopar:Npn \char_make_comment:N #1 { \char_set_catcode:nn {`#1} {\c_fourteen} } +\cs_new_nopar:Npn \char_make_invalid:N #1 { \char_set_catcode:nn {`#1} {\c_fifteen} } +\cs_new_nopar:Npn \char_make_escape:n #1 { \char_set_catcode:nn {#1} {\c_zero} } +\cs_new_nopar:Npn \char_make_begin_group:n #1 { \char_set_catcode:nn {#1} {\c_one} } +\cs_new_nopar:Npn \char_make_end_group:n #1 { \char_set_catcode:nn {#1} {\c_two} } +\cs_new_nopar:Npn \char_make_math_shift:n #1 { \char_set_catcode:nn {#1} {\c_three} } +\cs_new_nopar:Npn \char_make_alignment:n #1 { \char_set_catcode:nn {#1} {\c_four} } +\cs_new_nopar:Npn \char_make_end_line:n #1 { \char_set_catcode:nn {#1} {\c_five} } +\cs_new_nopar:Npn \char_make_parameter:n #1 { \char_set_catcode:nn {#1} {\c_six} } +\cs_new_nopar:Npn \char_make_math_superscript:n #1 { \char_set_catcode:nn {#1} {\c_seven} } +\cs_new_nopar:Npn \char_make_math_subscript:n #1 { \char_set_catcode:nn {#1} {\c_eight} } +\cs_new_nopar:Npn \char_make_ignore:n #1 { \char_set_catcode:nn {#1} {\c_nine} } +\cs_new_nopar:Npn \char_make_space:n #1 { \char_set_catcode:nn {#1} {\c_ten} } +\cs_new_nopar:Npn \char_make_letter:n #1 { \char_set_catcode:nn {#1} {\c_eleven} } +\cs_new_nopar:Npn \char_make_other:n #1 { \char_set_catcode:nn {#1} {\c_twelve} } +\cs_new_nopar:Npn \char_make_active:n #1 { \char_set_catcode:nn {#1} {\c_thirteen} } +\cs_new_nopar:Npn \char_make_comment:n #1 { \char_set_catcode:nn {#1} {\c_fourteen} } +\cs_new_nopar:Npn \char_make_invalid:n #1 { \char_set_catcode:nn {#1} {\c_fifteen} } +\cs_new_eq:NN \char_set_mathcode:w \tex_mathcode:D +\cs_new_nopar:Npn \char_set_mathcode:nn #1#2 { + \char_set_mathcode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: +} +\cs_new_protected_nopar:Npn \char_gset_mathcode:w { \pref_global:D \tex_mathcode:D } +\cs_new_nopar:Npn \char_gset_mathcode:nn #1#2 { + \char_gset_mathcode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: +} +\cs_new_nopar:Npn \char_value_mathcode:w { \int_use:N \tex_mathcode:D } +\cs_new_nopar:Npn \char_value_mathcode:n #1 { + \char_value_mathcode:w \intexpr_eval:w #1\intexpr_eval_end: +} +\cs_new_nopar:Npn \char_show_value_mathcode:w { \tex_showthe:D \tex_mathcode:D } +\cs_new_nopar:Npn \char_show_value_mathcode:n #1 { + \char_show_value_mathcode:w \intexpr_eval:w #1\intexpr_eval_end: +} +\cs_new_eq:NN \char_set_lccode:w \tex_lccode:D +\cs_new_nopar:Npn \char_set_lccode:nn #1#2{ + \char_set_lccode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: +} +\cs_new_nopar:Npn \char_value_lccode:w {\int_use:N\tex_lccode:D} +\cs_new_nopar:Npn \char_value_lccode:n #1{\char_value_lccode:w + \intexpr_eval:w #1\intexpr_eval_end:} +\cs_new_nopar:Npn \char_show_value_lccode:w {\tex_showthe:D\tex_lccode:D} +\cs_new_nopar:Npn \char_show_value_lccode:n #1{ + \char_show_value_lccode:w \intexpr_eval:w #1\intexpr_eval_end:} +\cs_new_eq:NN \char_set_uccode:w \tex_uccode:D +\cs_new_nopar:Npn \char_set_uccode:nn #1#2{ + \char_set_uccode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: +} +\cs_new_nopar:Npn \char_value_uccode:w {\int_use:N\tex_uccode:D} +\cs_new_nopar:Npn \char_value_uccode:n #1{\char_value_uccode:w + \intexpr_eval:w #1\intexpr_eval_end:} +\cs_new_nopar:Npn \char_show_value_uccode:w {\tex_showthe:D\tex_uccode:D} +\cs_new_nopar:Npn \char_show_value_uccode:n #1{ + \char_show_value_uccode:w \intexpr_eval:w #1\intexpr_eval_end:} +\cs_new_eq:NN \char_set_sfcode:w \tex_sfcode:D +\cs_new_nopar:Npn \char_set_sfcode:nn #1#2 { + \char_set_sfcode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: +} +\cs_new_nopar:Npn \char_value_sfcode:w { \int_use:N \tex_sfcode:D } +\cs_new_nopar:Npn \char_value_sfcode:n #1 { + \char_value_sfcode:w \intexpr_eval:w #1\intexpr_eval_end: +} +\cs_new_nopar:Npn \char_show_value_sfcode:w { \tex_showthe:D \tex_sfcode:D } +\cs_new_nopar:Npn \char_show_value_sfcode:n #1 { + \char_show_value_sfcode:w \intexpr_eval:w #1\intexpr_eval_end: +} +\cs_new_nopar:Npn \token_new:Nn #1#2 {\cs_gnew_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:nn{`\*}{3} \token_new:Nn \c_math_shift_token {*} @@ -119,260 +163,174 @@ \token_new:Nn \c_letter_token {a} \token_new:Nn \c_other_char_token {1} \char_set_catcode:nn{`\*}{13} -\token_new:Nn \c_active_char_token {*} +\cs_gset_nopar:Npn \c_active_char_token {\exp_not:N*} \group_end: -\def_new:Npn \token_if_group_begin_p:N #1{ +\prg_new_conditional:Nnn \token_if_group_begin:N {p,TF,T,F} { \if_catcode:w \exp_not:N #1\c_group_begin_token - \c_true - \else: - \c_false - \fi: + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_group_begin:N} #1{ - \if:w\token_if_group_begin_p:N #1} -\def_new:Npn \token_if_group_end_p:N #1{ +\prg_new_conditional:Nnn \token_if_group_end:N {p,TF,T,F} { \if_catcode:w \exp_not:N #1\c_group_end_token - \c_true - \else: - \c_false - \fi: + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_group_end:N} #1{ - \if:w\token_if_group_end_p:N #1} -\def_new:Npn \token_if_math_shift_p:N #1{ +\prg_new_conditional:Nnn \token_if_math_shift:N {p,TF,T,F} { \if_catcode:w \exp_not:N #1\c_math_shift_token - \c_true - \else: - \c_false - \fi: + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_math_shift:N} #1{ - \if:w\token_if_math_shift_p:N#1} -\def_new:Npn \token_if_alignment_tab_p:N #1{ +\prg_new_conditional:Nnn \token_if_alignment_tab:N {p,TF,T,F} { \if_catcode:w \exp_not:N #1\c_alignment_tab_token - \c_true - \else: - \c_false - \fi: + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_alignment_tab:N} #1{ - \if:w\token_if_alignment_tab_p:N#1} -\def_new:Npn \token_if_parameter_p:N #1{ - \exp_after:NN\if_catcode:w \cs:w c_parameter_token\cs_end:\exp_not:N #1 - \c_true - \else: - \c_false - \fi: +\prg_new_conditional:Nnn \token_if_parameter:N {p,TF,T,F} { + \exp_after:wN\if_catcode:w \cs:w c_parameter_token\cs_end:\exp_not:N #1 + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_parameter:N} #1{ - \if:w\token_if_parameter_p:N#1} -\def_new:Npn \token_if_math_superscript_p:N #1{ +\prg_new_conditional:Nnn \token_if_math_superscript:N {p,TF,T,F} { \if_catcode:w \exp_not:N #1\c_math_superscript_token - \c_true - \else: - \c_false - \fi: + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_math_superscript:N} #1{ - \if:w\token_if_math_superscript_p:N #1} -\def_new:Npn \token_if_math_subscript_p:N #1{ +\prg_new_conditional:Nnn \token_if_math_subscript:N {p,TF,T,F} { \if_catcode:w \exp_not:N #1\c_math_subscript_token - \c_true - \else: - \c_false - \fi: + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_math_subscript:N} #1{ - \if:w\token_if_math_subscript_p:N #1} -\def_new:Npn \token_if_space_p:N #1{ +\prg_new_conditional:Nnn \token_if_space:N {p,TF,T,F} { \if_catcode:w \exp_not:N #1\c_space_token - \c_true - \else: - \c_false - \fi: + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_space:N} #1{ - \if:w\token_if_space_p:N #1} -\def_new:Npn \token_if_letter_p:N #1{ +\prg_new_conditional:Nnn \token_if_letter:N {p,TF,T,F} { \if_catcode:w \exp_not:N #1\c_letter_token - \c_true - \else: - \c_false - \fi: + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_letter:N} #1{ - \if:w\token_if_letter_p:N #1} -\def_new:Npn \token_if_other_char_p:N #1{ +\prg_new_conditional:Nnn \token_if_other_char:N {p,TF,T,F} { \if_catcode:w \exp_not:N #1\c_other_char_token - \c_true - \else: - \c_false - \fi: + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_other_char:N} #1{ - \if:w\token_if_other_char_p:N #1} -\def_new:Npn \token_if_active_char_p:N #1{ +\prg_new_conditional:Nnn \token_if_active_char:N {p,TF,T,F} { \if_catcode:w \exp_not:N #1\c_active_char_token - \c_true - \else: - \c_false - \fi: + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_active_char:N} #1{ - \if:w\token_if_active_char_p:N #1} -\def_new:Npn \token_if_eq_meaning_p:NN #1#2 { - \if_meaning:NN #1 #2 - \c_true - \else: - \c_false - \fi: +\prg_new_conditional:Nnn \token_if_eq_meaning:NN {p,TF,T,F} { + \if_meaning:w #1 #2 + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_eq_meaning:NN}#1#2{ - \if_meaning:NN #1 #2} -\def_new:Npn \token_if_eq_catcode_p:NN #1#2 { +\prg_new_conditional:Nnn \token_if_eq_catcode:NN {p,TF,T,F} { \if_catcode:w \exp_not:N #1 \exp_not:N #2 - \c_true - \else: - \c_false - \fi: + \prg_return_true: \else: \prg_return_false: \fi: } -\def_test_function_new:npn {token_if_eq_catcode:NN}#1#2{ - \if:w\token_if_eq_catcode_p:NN#1#2} -\def_new:Npn \token_if_charcode_eq_p:NN #1#2 { +\prg_new_conditional:Nnn \token_if_eq_charcode:NN {p,TF,T,F} { \if_charcode:w \exp_not:N #1 \exp_not:N #2 - \c_true - \else: - \c_false - \fi: -} -\def_test_function_new:npn {token_if_eq_charcode:NN}#1#2{ - \if:w\token_if_eq_charcode_p:NN#1#2} -\def_new:Npn \token_if_macro_p:N #1 { - \exp_after:NN \token_if_macro_p_aux:w \token_to_meaning:N #1 -> \q_nil -} -\def_new:Npn \token_if_macro_p_aux:w #1 -> #2 \q_nil{ - \if:w \tlist_if_empty_p:n{#2} \c_false \else: \c_true \fi: -} -\def_test_function_new:npn {token_if_macro:N} #1{\if:w\token_if_macro_p:N#1} -\def_new:Npn \token_if_cs_p:N {\token_if_eq_catcode_p:NN \scan_stop:} -\def_test_function_new:npn {token_if_cs:N} #1{ - \if:w \token_if_eq_catcode_p:NN \scan_stop: #1} -\def_new:Npn \token_if_expandable_p:N #1{ - \exp_after:NN \if_token_eq:NN \exp_not:N #1 \scan_stop: - \c_true - \else: - \c_false - \fi: + \prg_return_true: \else: \prg_return_false: \fi: +} +\prg_new_conditional:Nnn \token_if_macro:N {p,TF,T,F} { + \exp_after:wN \token_if_macro_p_aux:w \token_to_meaning:N #1 -> \q_nil +} +\cs_new_nopar:Npn \token_if_macro_p_aux:w #1 -> #2 \q_nil{ + \if_predicate:w \tl_if_empty_p:n{#2} + \prg_return_false: \else: \prg_return_true: \fi: +} +\prg_new_conditional:Nnn \token_if_cs:N {p,TF,T,F} { + \if_predicate:w \token_if_eq_catcode_p:NN \scan_stop: #1 + \prg_return_true: \else: \prg_return_false: \fi:} +\prg_new_conditional:Nnn \token_if_expandable:N {p,TF,T,F} { + \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: + } } -\def_test_function_new:npn {token_if_expandable:N} #1{ - \if:w\token_if_expandable_p:N#1} \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 {`\?}{`\\} - \tlist_map_inline:nn{\X\Y\Z\M\T\C\H\A\R\O\U\S\K\I\P\L\G\P\E} + \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}{12}} -\tlist_to_lowercase:n{ +\tl_to_lowercase:n{ \group_end: -\def_new:Npn \token_if_chardef_p:N #1 { - \exp_after:NN \token_if_chardef_p_aux:w +\prg_new_conditional:Nnn \token_if_chardef:N {p,TF,T,F} { + \exp_after:wN \token_if_chardef_aux:w \token_to_meaning:N #1?CHAR"\q_nil } -\def_new:Npn \token_if_chardef_p_aux:w #1?CHAR"#2\q_nil{ - \tlist_if_empty_p:n{#1} +\cs_new_nopar:Npn \token_if_chardef_aux:w #1?CHAR"#2\q_nil{ + \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } -\def_new:Npn \token_if_mathchardef_p:N #1 { - \exp_after:NN \token_if_mathchardef_p_aux:w +\prg_new_conditional:Nnn \token_if_mathchardef:N {p,TF,T,F} { + \exp_after:wN \token_if_mathchardef_aux:w \token_to_meaning:N #1?MAYHCHAR"\q_nil } -\def_new:Npn \token_if_mathchardef_p_aux:w #1?MAYHCHAR"#2\q_nil{ - \tlist_if_empty_p:n{#1} +\cs_new_nopar:Npn \token_if_mathchardef_aux:w #1?MAYHCHAR"#2\q_nil{ + \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } -\def:Npn \token_if_int_register_p:N #1{ - \if_meaning:NN \tex_countdef:D #1 - \c_false +\prg_new_conditional:Nnn \token_if_int_register:N {p,TF,T,F} { + \if_meaning:w \tex_countdef:D #1 + \prg_return_false: \else: - \exp_after:NN \token_if_int_register_p_aux:w + \exp_after:wN \token_if_int_register_aux:w \token_to_meaning:N #1?COUXY\q_nil \fi: } -\def_new:Npn \token_if_int_register_p_aux:w #1?COUXY#2\q_nil{ - \tlist_if_empty_p:n{#1} +\cs_new_nopar:Npn \token_if_int_register_aux:w #1?COUXY#2\q_nil{ + \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } -\def:Npn \token_if_skip_register_p:N #1{ - \if_meaning:NN \tex_skipdef:D #1 - \c_false +\prg_new_conditional:Nnn \token_if_skip_register:N {p,TF,T,F} { + \if_meaning:w \tex_skipdef:D #1 + \prg_return_false: \else: - \exp_after:NN \token_if_skip_register_p_aux:w - \token_to_meaning:N #1?SKIP\q_nil + \exp_after:wN \token_if_skip_register_aux:w + \token_to_meaning:N #1?SKIP\q_nil \fi: } -\def_new:Npn \token_if_skip_register_p_aux:w #1?SKIP#2\q_nil{ - \tlist_if_empty_p:n{#1} +\cs_new_nopar:Npn \token_if_skip_register_aux:w #1?SKIP#2\q_nil{ + \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } -\def:Npn \token_if_dim_register_p:N #1{ - \if_meaning:NN \tex_dimendef:D #1 - \c_false +\prg_new_conditional:Nnn \token_if_dim_register:N {p,TF,T,F} { + \if_meaning:w \tex_dimendef:D #1 + \c_false_bool \else: - \exp_after:NN \token_if_dim_register_p_aux:w + \exp_after:wN \token_if_dim_register_aux:w \token_to_meaning:N #1?ZIMEX\q_nil \fi: } -\def_new:Npn \token_if_dim_register_p_aux:w #1?ZIMEX#2\q_nil{ - \tlist_if_empty_p:n{#1} +\cs_new_nopar:Npn \token_if_dim_register_aux:w #1?ZIMEX#2\q_nil{ + \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } -\def:Npn \token_if_toks_register_p:N #1{ - \if_meaning:NN \tex_toksdef:D #1 - \c_false +\prg_new_conditional:Nnn \token_if_toks_register:N {p,TF,T,F} { + \if_meaning:w \tex_toksdef:D #1 + \prg_return_false: \else: - \exp_after:NN \token_if_toks_register_p_aux:w + \exp_after:wN \token_if_toks_register_aux:w \token_to_meaning:N #1?YOKS\q_nil \fi: } -\def_new:Npn \token_if_toks_register_p_aux:w #1?YOKS#2\q_nil{ - \tlist_if_empty_p:n{#1} +\cs_new_nopar:Npn \token_if_toks_register_aux:w #1?YOKS#2\q_nil{ + \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } -\def_new:Npn \token_if_protected_macro_p:N #1 { - \exp_after:NN \token_if_protected_macro_p_aux:w +\prg_new_conditional:Nnn \token_if_protected_macro:N {p,TF,T,F} { + \exp_after:wN \token_if_protected_macro_aux:w \token_to_meaning:N #1?PROYECYEZ~MACRO\q_nil } -\def_new:Npn \token_if_protected_macro_p_aux:w #1?PROYECYEZ~MACRO#2\q_nil{ - \tlist_if_empty_p:n{#1} +\cs_new_nopar:Npn \token_if_protected_macro_aux:w #1?PROYECYEZ~MACRO#2\q_nil{ + \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } -\def_new:Npn \token_if_long_macro_p:N #1 { - \exp_after:NN \token_if_long_macro_p_aux:w +\prg_new_conditional:Nnn \token_if_long_macro:N {p,TF,T,F} { + \exp_after:wN \token_if_long_macro_aux:w \token_to_meaning:N #1?LOXG~MACRO\q_nil } -\def_new:Npn \token_if_long_macro_p_aux:w #1?LOXG~MACRO#2\q_nil{ - \tlist_if_empty_p:n{#1} -} -\def_new:Npn \token_if_protected_long_macro_p:N #1 { - \exp_after:NN \token_if_protected_long_macro_p_aux:w - \token_to_meaning:N #1?PROYECYEZ~?LOXG~MACRO\q_nil -} -\def_new:Npn \token_if_protected_long_macro_p_aux:w #1 - ?PROYECYEZ~?LOXG~MACRO#2\q_nil{ - \tlist_if_empty_p:n{#1} -} -} -\def_test_function_new:npn {token_if_chardef:N} {\if:w \token_if_chardef_p:N} -\def_test_function_new:npn {token_if_mathchardef:N} { - \if:w \token_if_mathchardef_p:N} -\def_test_function_new:npn {token_if_long_macro:N} { - \if:w \token_if_long_macro_p:N} -\def_test_function_new:npn {token_if_protected_macro:N} { - \if:w \token_if_protected_macro_p:N} -\def_test_function_new:npn {token_if_protected_long_macro:N} { - \if:w \token_if_protected_long_macro_p:N} -\def_test_function_new:npn {token_if_dim_register:N} { - \if:w \token_if_dim_register_p:N} -\def_test_function_new:npn {token_if_skip_register:N} { - \if:w \token_if_skip_register_p:N} -\def_test_function_new:npn {token_if_int_register:N} { - \if:w \token_if_int_register_p:N} -\def_test_function_new:npn {token_if_toks_register:N} { - \if:w \token_if_toks_register_p:N} +\cs_new_nopar:Npn \token_if_long_macro_aux:w #1?LOXG~MACRO#2\q_nil{ + \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} +} +\prg_new_conditional:Nnn \token_if_protected_long_macro:N {p,TF,T,F} { + \exp_after:wN \token_if_protected_long_macro_aux:w + \token_to_meaning:N #1?PROYECYEZ?LOXG~MACRO\q_nil +} +\cs_new_nopar:Npn \token_if_protected_long_macro_aux:w #1 + ?PROYECYEZ?LOXG~MACRO#2\q_nil{ + \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} +} +} \group_begin: \char_set_lccode:nn {`\?}{`\:} \char_set_catcode:nn{`\M}{12} @@ -380,63 +338,63 @@ \char_set_catcode:nn{`\C}{12} \char_set_catcode:nn{`\R}{12} \char_set_catcode:nn{`\O}{12} -\tlist_to_lowercase:n{ +\tl_to_lowercase:n{ \group_end: - \def_new:Npn \token_get_prefix_arg_replacement_aux:w #1MACRO?#2->#3\q_nil#4{ + \cs_new_nopar:Npn \token_get_prefix_arg_replacement_aux:w #1MACRO?#2->#3\q_nil#4{ #4{#1}{#2}{#3} } - \def_new:Npn\token_get_prefix_spec:N #1{ + \cs_new_nopar:Npn\token_get_prefix_spec:N #1{ \token_if_macro:NTF #1{ - \exp_after:NN \token_get_prefix_arg_replacement_aux:w - \token_to_meaning:N #1\q_nil\use_arg_i:nnn + \exp_after:wN \token_get_prefix_arg_replacement_aux:w + \token_to_meaning:N #1\q_nil\use_i:nnn }{\scan_stop:} } - \def_new:Npn\token_get_arg_spec:N #1{ + \cs_new_nopar:Npn\token_get_arg_spec:N #1{ \token_if_macro:NTF #1{ - \exp_after:NN \token_get_prefix_arg_replacement_aux:w - \token_to_meaning:N #1\q_nil\use_arg_ii:nnn + \exp_after:wN \token_get_prefix_arg_replacement_aux:w + \token_to_meaning:N #1\q_nil\use_ii:nnn }{\scan_stop:} } - \def_new:Npn\token_get_replacement_spec:N #1{ + \cs_new_nopar:Npn\token_get_replacement_spec:N #1{ \token_if_macro:NTF #1{ - \exp_after:NN \token_get_prefix_arg_replacement_aux:w - \token_to_meaning:N #1\q_nil\use_arg_iii:nnn + \exp_after:wN \token_get_prefix_arg_replacement_aux:w + \token_to_meaning:N #1\q_nil\use_iii:nnn }{\scan_stop:} } } -\def_new:Npn \token_if_primitive_p:N #1{ - \if:w \token_if_cs_p:N #1\scan_stop: - \if:w \token_if_macro_p:N #1 - \c_false +\prg_new_conditional:Nnn \token_if_primitive:N {p,TF,T,F} { + \if_predicate:w \token_if_cs_p:N #1 + \if_predicate:w \token_if_macro_p:N #1 + \prg_return_false: \else: \token_if_primitive_p_aux:N #1 \fi: \else: - \if:w \token_if_active_p:N #1 - \if:w \token_if_macro_p:N #1 - \c_false + \if_predicate:w \token_if_active_char_p:N #1 + \if_predicate:w \token_if_macro_p:N #1 + \prg_return_false: \else: \token_if_primitive_p_aux:N #1 \fi: \else: - \c_false + \prg_return_false: \fi: \fi: } -\def_new:Npn \token_if_primitive_p_aux:N #1{ - \if:w \token_if_chardef_p:N #1 \c_false +\cs_new_nopar:Npn \token_if_primitive_p_aux:N #1{ + \if_predicate:w \token_if_chardef_p:N #1 \c_false_bool \else: - \if:w \token_if_mathchardef_p:N #1 \c_false + \if_predicate:w \token_if_mathchardef_p:N #1 \prg_return_false: \else: - \if:w \token_if_int_register_p:N #1 \c_false + \if_predicate:w \token_if_int_register_p:N #1 \prg_return_false: \else: - \if:w \token_if_skip_register_p:N #1 \c_false + \if_predicate:w \token_if_skip_register_p:N #1 \prg_return_false: \else: - \if:w \token_if_dim_register_p:N #1 \c_false + \if_predicate:w \token_if_dim_register_p:N #1 \prg_return_false: \else: - \if:w \token_if_toks_register_p:N #1 \c_false + \if_predicate:w \token_if_toks_register_p:N #1 \prg_return_false: \else: - \c_true + \prg_return_true: \fi: \fi: \fi: @@ -444,120 +402,161 @@ \fi: \fi: } -\def_test_function_new:npn {token_if_primitive:N} #1{ - \if:w\token_if_primitive_p:N#1} \token_new:Nn \l_peek_token {?} \token_new:Nn \g_peek_token {?} \token_new:Nn \l_peek_search_token {?} -\def_new:Npn \peek_after:NN {\tex_futurelet:D \l_peek_token } -\def_new:Npn \peek_gafter:NN { +\cs_new_nopar:Npn \peek_after:NN {\tex_futurelet:D \l_peek_token } +\cs_new_nopar:Npn \peek_gafter:NN { \pref_global:D \tex_futurelet:D \g_peek_token } -\tlp_new:Nn \l_peek_true_tlp {} -\tlp_new:Nn \l_peek_false_tlp {} -\def_new:Npn \peek_tmp:w{} -\tlp_new:Nn \l_peek_search_tlp{} -\def_long_new:Npn \peek_token_generic:NNTF #1#2#3#4{ - \let:NN \l_peek_search_token #2 - \tlp_set:Nn \l_peek_search_tlp {#2} - \tlp_set:Nx \l_peek_true_tlp {\exp_not:n{\group_align_safe_end: #3}} - \tlp_set:Nx \l_peek_false_tlp {\exp_not:n{\group_align_safe_end: #4}} +\tl_new:Nn \l_peek_true_tl {} +\tl_new:Nn \l_peek_false_tl {} +\cs_new_nopar:Npn \peek_tmp:w {} +\tl_new:Nn \l_peek_search_tl {} +\cs_new: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} + \tl_set:Nx \l_peek_true_tl {\exp_not:n{\group_align_safe_end: #3}} + \tl_set:Nx \l_peek_false_tl {\exp_not:n{\group_align_safe_end: #4}} \group_align_safe_begin: \peek_after:NN #1 } -\def_long_new:Npn \peek_token_remove_generic:NNTF #1#2#3#4{ - \let:NN \l_peek_search_token #2 - \tlp_set:Nn \l_peek_search_tlp {#2} - \tlp_set:Nx \l_peek_true_aux_tlp { \exp_not:n{ #3 } } - \tlp_set_eq:NN \l_peek_true_tlp \c_peek_true_remove_next_tlp - \tlp_set:Nx \l_peek_false_tlp {\exp_not:n{\group_align_safe_end: #4}} +\cs_new:Npn \peek_token_generic:NNT #1#2#3 { + \peek_token_generic:NNTF #1#2 {#3} {} +} +\cs_new:Npn \peek_token_generic:NNF #1#2#3 { + \peek_token_generic:NNTF #1#2 {} {#3} +} +\cs_new: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} + \tl_set:Nx \l_peek_true_aux_tl { \exp_not:n{ #3 } } + \tl_set_eq:NN \l_peek_true_tl \c_peek_true_remove_next_tl + \tl_set:Nx \l_peek_false_tl {\exp_not:n{\group_align_safe_end: #4}} \group_align_safe_begin: \peek_after:NN #1 } -\tlp_new:Nn \l_peek_true_aux_tlp {} -\tlp_new:Nn \c_peek_true_remove_next_tlp {\group_align_safe_end: - \tex_afterassignment:D \l_peek_true_aux_tlp \let:NN \peek_tmp:w +\cs_new:Npn \peek_token_remove_generic:NNT #1#2#3 { + \peek_token_remove_generic:NNTF #1#2 {#3} {} +} +\cs_new:Npn \peek_token_remove_generic:NNF #1#2#3 { + \peek_token_remove_generic:NNTF #1#2 {} {#3} } -\def_new:Npn \peek_execute_branches_meaning: { - \if_meaning:NN \l_peek_token \l_peek_search_token - \exp_after:NN \l_peek_true_tlp +\tl_new:Nn \l_peek_true_aux_tl {} +\tl_new:Nn \c_peek_true_remove_next_tl {\group_align_safe_end: + \tex_afterassignment:D \l_peek_true_aux_tl \cs_set_eq:NN \peek_tmp:w +} +\cs_new_nopar:Npn \peek_execute_branches_meaning: { + \if_meaning:w \l_peek_token \l_peek_search_token + \exp_after:wN \l_peek_true_tl \else: - \exp_after:NN \l_peek_false_tlp + \exp_after:wN \l_peek_false_tl \fi: } -\def_new:Npn \peek_execute_branches_catcode: { +\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:NN \l_peek_true_tlp + \exp_after:wN \l_peek_true_tl \else: - \exp_after:NN \l_peek_false_tlp + \exp_after:wN \l_peek_false_tl \fi: } -\def_new:Npn \peek_execute_branches_charcode: { - \predicate:nTF { +\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_meaning_p:NN \l_peek_token \c_space_token } - { \l_peek_false_tlp } - { \exp_after:NN \peek_execute_branches_charcode_aux:NN \l_peek_search_tlp } + { \l_peek_false_tl } + { \exp_after:wN \peek_execute_branches_charcode_aux:NN \l_peek_search_tl } } -\def_long_new:Npn \peek_execute_branches_charcode_aux:NN #1#2{ +\cs_new:Npn \peek_execute_branches_charcode_aux:NN #1#2{ \if_charcode:w \exp_not:N #1\exp_not:N#2 - \exp_after:NN \l_peek_true_tlp + \exp_after:wN \l_peek_true_tl \else: - \exp_after:NN \l_peek_false_tlp + \exp_after:wN \l_peek_false_tl \fi: #2 } -\def_new:Npn \peek_meaning:NTF { - \peek_token_generic:NNTF \peek_execute_branches_meaning: -} -\def_new:Npn \peek_meaning_ignore_spaces:NTF { - \let:NN \peek_execute_branches: \peek_execute_branches_meaning: - \peek_token_generic:NNTF \peek_ignore_spaces_execute_branches: -} -\def_new:Npn \peek_meaning_remove:NTF { - \peek_token_remove_generic:NNTF \peek_execute_branches_meaning: -} -\def_new:Npn \peek_meaning_remove_ignore_spaces:NTF { - \let:NN \peek_execute_branches: \peek_execute_branches_meaning: - \peek_token_remove_generic:NNTF \peek_ignore_spaces_execute_branches: -} -\def_new:Npn \peek_catcode:NTF { - \peek_token_generic:NNTF \peek_execute_branches_catcode: -} -\def_new:Npn \peek_catcode_ignore_spaces:NTF { - \let:NN \peek_execute_branches: \peek_execute_branches_catcode: - \peek_token_generic:NNTF \peek_ignore_spaces_execute_branches: -} -\def_new:Npn \peek_catcode_remove:NTF { - \peek_token_remove_generic:NNTF \peek_execute_branches_catcode: -} -\def_new:Npn \peek_catcode_remove_ignore_spaces:NTF { - \let:NN \peek_execute_branches: \peek_execute_branches_catcode: - \peek_token_remove_generic:NNTF \peek_ignore_spaces_execute_branches: -} -\def_new:Npn \peek_charcode:NTF { - \peek_token_generic:NNTF \peek_execute_branches_charcode: -} -\def_new:Npn \peek_charcode_ignore_spaces:NTF { - \let:NN \peek_execute_branches: \peek_execute_branches_charcode: - \peek_token_generic:NNTF \peek_ignore_spaces_execute_branches: -} -\def_new:Npn \peek_charcode_remove:NTF { - \peek_token_remove_generic:NNTF \peek_execute_branches_charcode: -} - -\def_new:Npn \peek_charcode_remove_ignore_spaces:NTF { - \let:NN \peek_execute_branches: \peek_execute_branches_charcode: - \peek_token_remove_generic:NNTF \peek_ignore_spaces_execute_branches: +\cs_new_nopar:Npn \peek_def_aux:nnnn #1#2#3#4 { + \peek_def_aux_ii:nnnnn {#1} {#2} {#3} {#4} { TF } + \peek_def_aux_ii:nnnnn {#1} {#2} {#3} {#4} { T } + \peek_def_aux_ii:nnnnn {#1} {#2} {#3} {#4} { F } +} +\cs_new_nopar:Npn \peek_def_aux_ii:nnnnn #1#2#3#4#5 { + \cs_new_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 } + } } -\def_new:Npn \peek_ignore_spaces_aux: { +\peek_def_aux:nnnn + { peek_meaning:N } + {} + { peek_token_generic:NN } + { \peek_execute_branches_meaning: } +\peek_def_aux:nnnn + { peek_meaning_ignore_spaces:N } + { \peek_execute_branches_meaning: } + { peek_token_generic:NN } + { \peek_ignore_spaces_execute_branches: } +\peek_def_aux:nnnn + { peek_meaning_remove:N } + {} + { peek_token_remove_generic:NN } + { \peek_execute_branches_meaning: } +\peek_def_aux:nnnn + { peek_meaning_remove_ignore_spaces:N } + { \peek_execute_branches_meaning: } + { peek_token_remove_generic:NN } + { \peek_ignore_spaces_execute_branches: } +\peek_def_aux:nnnn + { peek_catcode:N } + {} + { peek_token_generic:NN } + { \peek_execute_branches_catcode: } +\peek_def_aux:nnnn + { peek_catcode_ignore_spaces:N } + { \peek_execute_branches_catcode: } + { peek_token_generic:NN } + { \peek_ignore_spaces_execute_branches: } +\peek_def_aux:nnnn + { peek_catcode_remove:N } + {} + { peek_token_remove_generic:NN } + { \peek_execute_branches_catcode: } +\peek_def_aux:nnnn + { peek_catcode_remove_ignore_spaces:N } + { \peek_execute_branches_catcode: } + { peek_token_remove_generic:NN } + { \peek_ignore_spaces_execute_branches: } +\peek_def_aux:nnnn + { peek_charcode:N } + {} + { peek_token_generic:NN } + { \peek_execute_branches_charcode: } +\peek_def_aux:nnnn + { peek_charcode_ignore_spaces:N } + { \peek_execute_branches_charcode: } + { peek_token_generic:NN } + { \peek_ignore_spaces_execute_branches: } +\peek_def_aux:nnnn + { peek_charcode_remove:N } + {} + { peek_token_remove_generic:NN } + { \peek_execute_branches_charcode: } +\peek_def_aux:nnnn + { peek_charcode_remove_ignore_spaces:N } + { \peek_execute_branches_charcode: } + { peek_token_remove_generic:NN } + { \peek_ignore_spaces_execute_branches:} +\cs_new_nopar:Npn \peek_ignore_spaces_aux: { \peek_after:NN \peek_ignore_spaces_execute_branches: } -\def_new:Npn \peek_ignore_spaces_execute_branches: { +\cs_new_nopar:Npn \peek_ignore_spaces_execute_branches: { \token_if_eq_meaning:NNTF \l_peek_token \c_space_token { \tex_afterassignment:D \peek_ignore_spaces_aux: - \let:NN \peek_tmp:w + \cs_set_eq:NN \peek_tmp:w } \peek_execute_branches: } diff --git a/Master/texmf-dist/tex/latex/expl3/l3toks.sty b/Master/texmf-dist/tex/latex/expl3/l3toks.sty index ea18f851ee0..79de834fd71 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3toks.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3toks.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3toks.dtx Copyright (C) 1990-2006 LaTeX3 project +%% File: l3toks.dtx Copyright (C) 1990-2009 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,128 +48,118 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3toks.dtx 728 2008-01-01 16:11:58Z morten $ +\GetIdInfo$Id: l3toks.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental Token Registers} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3expan}\par -\let:NN \toks_new:N \newtoks % nick from LaTeX for the moment -\def_new:Npn \toks_new:c {\exp_args:Nc\toks_new:N} -\def_new:Npn \toks_clear:N #1{#1\c_empty_toks -} -\def_new:Npn \toks_gclear:N { - \pref_global:D - \toks_clear:N} -\let_new:NN \toks_use:N \the_internal:D -\def_new:Npn \toks_use:c {\exp_args:Nc\toks_use:N} -\def_new:Npn \toks_use_clear:N#1{ - \exp_after:NN - \toks_clear:N - \exp_after:NN - #1 - \toks_use:N#1} -\def_new:Npn \toks_use_gclear:N{ - \pref_global:D - \toks_use_clear:N} -\def_new:Npn \toks_put_left:Nn #1{ - \exp_after:NN\toks_put_left_aux:w\exp_after:NN\q_mark - \toks_use:N #1\q_stop #1} -\def_new:Npn \toks_put_left:No {\exp_args:NNo \toks_put_left:Nn} -\def_new:Npn \toks_gput_left:Nn { - \pref_global:D - \toks_put_left:Nn} -\def_new:Npn \toks_gput_left:Nx {\exp_args:NNx \toks_gput_left:Nn} -\def_long_new:Npn \toks_put_left_aux:w #1\q_stop #2#3{ - #2\exp_after:NN{\use_arg_i:nn{#3}#1} -} -\def_long_new:Npn \toks_put_right:Nn #1#2{#1\exp_after:NN{\toks_use:N #1#2} -} -\def_new:Npn \toks_gput_right:Nn { - \pref_global:D - \toks_put_right:Nn} -\def_long_new:Npn\toks_put_right:No#1#2{#1\exp_after:NN\exp_after:NN -\exp_after:NN{\exp_after:NN\toks_use:N\exp_after:NN #1#2}} -\def_long_new:Npn\toks_put_right:Nd#1#2{ - \exp_after:NN\toks_put_right:No\exp_after:NN#1\exp_after:NN{#2}} -\def_long_new:Npn \toks_put_right:Nf #1#2{ - #1\exp_after:NN\exp_after:NN\exp_after:NN{ - \exp_after:NN\toks_use:N\exp_after:NN #1\int_to_roman:w -`0#2}} -\def_new:Npn \toks_put_right:Nx {\exp_args:NNx \toks_put_right:Nn } -\def_new:Npn \toks_gput_right:No {\exp_args:NNo\toks_gput_right:Nn} -\def_new:Npn \toks_gput_right:Nx {\exp_args:NNx\toks_gput_right:Nn} - \let_new:NN \toks_set:Nn\use_noop: - \def_long_new:Npn \toks_set:No#1#2{#1\exp_after:NN{#2}} - \def_long_new:Npn \toks_set:Nd#1#2{ - #1\exp_after:NN\exp_after:NN\exp_after:NN{#2}} -\def_new:Npn \toks_set:Nx {\exp_args:NNx \toks_set:Nn} -\def_long_new:Npn\toks_set:Nf #1#2{ - #1\exp_after:NN{\int_to_roman:w -`0#2}} -\def_new:Npn \toks_set:cf {\exp_args:Nc\toks_set:Nf} -\def_new:Npn \toks_set:cn {\exp_args:Nc\toks_set:Nn} -\def_new:Npn \toks_set:co {\exp_args:Nc\toks_set:No} -\def_new:Npn \toks_set:cx {\exp_args:Nc\toks_set:Nx} - \let_new:NN \toks_gset:Nn\pref_global:D -\def_new:Npn \toks_gset:No {\exp_args:NNo \toks_gset:Nn} -\def_new:Npn \toks_gset:Nx {\exp_args:NNx \toks_gset:Nn} -\def_new:Npn \toks_gset:cn {\exp_args:Nc \toks_gset:Nn} -\def_new:Npn \toks_gset:co {\exp_args:Nc \toks_gset:No} -\def_new:Npn \toks_gset:cx {\exp_args:Nc \toks_gset:Nx} - \let_new:NN \toks_set_eq:NN \use_noop: - \let_new:NN \toks_gset_eq:NN \pref_global:D -\def_new:Npn \toks_set_eq:Nc {\exp_args:NNc\toks_set_eq:NN} -\def_new:Npn \toks_set_eq:cN {\exp_args:Nc\toks_set_eq:NN} -\def_new:Npn \toks_set_eq:cc {\exp_args:Ncc\toks_set_eq:NN} -\def_new:Npn \toks_gset_eq:Nc {\exp_args:NNc\toks_gset_eq:NN} -\def_new:Npn \toks_gset_eq:cN {\exp_args:Nc\toks_gset_eq:NN} -\def_new:Npn \toks_gset_eq:cc {\exp_args:Ncc\toks_gset_eq:NN} -\def_new:Npn\toks_if_empty_p:N#1{ - \if:w \tlist_if_empty_p:o{\toks_use:N #1} - \c_true - \else: - \c_false - \fi: -} -\def_test_function_new:npn{toks_if_empty:N}#1{\if:w \toks_if_empty_p:N #1} -\def_new:Npn\toks_if_empty:cTF{\exp_args:Nc\toks_if_empty:NTF} -\def_new:Npn\toks_if_empty:cT{\exp_args:Nc\toks_if_empty:NT} -\def_new:Npn\toks_if_empty:cF{\exp_args:Nc\toks_if_empty:NF} -\def_new:NNn \toks_if_eq:NNTF 2 { - \tlist_if_eq:xxTF{\toks_use:N #1}{\toks_use:N #2} -} -\def_new:NNn \toks_if_eq:NNT 2 { - \tlist_if_eq:xxT{\toks_use:N #1}{\toks_use:N #2} -} -\def_new:NNn \toks_if_eq:NNF 2 { - \tlist_if_eq:xxF{\toks_use:N #1}{\toks_use:N #2} -} -\def_new:Npn \toks_if_eq:NcTF {\exp_args:NNc \toks_if_eq:NNTF} -\def_new:Npn \toks_if_eq:NcT {\exp_args:NNc \toks_if_eq:NNT} -\def_new:Npn \toks_if_eq:NcF {\exp_args:NNc \toks_if_eq:NNF} -\def_new:Npn \toks_if_eq:cNTF {\exp_args:Nc \toks_if_eq:NNTF} -\def_new:Npn \toks_if_eq:cNT {\exp_args:Nc \toks_if_eq:NNT} -\def_new:Npn \toks_if_eq:cNF {\exp_args:Nc \toks_if_eq:NNF} -\def_new:Npn \toks_if_eq:ccTF {\exp_args:Ncc \toks_if_eq:NNTF} -\def_new:Npn \toks_if_eq:ccT {\exp_args:Ncc \toks_if_eq:NNT} -\def_new:Npn \toks_if_eq:ccF {\exp_args:Ncc \toks_if_eq:NNF} -\def_new:NNn \toks_if_eq_p:NN 2 { - \tlist_if_eq_p:xx {\toks_use:N #1} {\toks_use:N #2} -} -\def_new:Npn \toks_if_eq_p:cN {\exp_args:Nc \toks_if_eq_p:NN} -\def_new:Npn \toks_if_eq_p:Nc {\exp_args:NNc \toks_if_eq_p:NN} -\def_new:Npn \toks_if_eq_p:cc {\exp_args:Ncc \toks_if_eq_p:NN} -\tex_toksdef:D \l_tmpa_toks = 255 +\package_check_loaded_expl: +\cs_set_eq:NN \toks_new:N \newtoks % nick from LaTeX for the moment +\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:Npn \toks_set:NV #1#2 { + #1 \exp_after:wN { \int_to_roman:w -`0 \exp_eval_register:N #2 } +} +\cs_new:Npn \toks_set:Nv #1#2 { + #1 \exp_after:wN { \int_to_roman:w -`0 \exp_eval_register:c {#2} } +} +\cs_new:Npn \toks_set:No #1#2 { #1 \exp_after:wN {#2} } +\cs_new:Npn \toks_set:Nd #1#2 { + #1 \exp_after:wN \exp_after:wN \exp_after:wN {#2} +} +\cs_new: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,cd,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_nopar:Npn \toks_clear:N #1 { + #1\c_empty_toks +} +\cs_new_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_nopar:Npn \toks_use_clear:N #1 { + \exp_last_unbraced:NNV \toks_clear:N #1 #1 +} +\cs_new_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 \tex_showthe:D +\cs_generate_variant:Nn \toks_show:N {c} +\cs_new_nopar:Npn \toks_put_left:Nn #1 { + \exp_after:wN \toks_put_left_aux:w \exp_after:wN \q_mark + \toks_use:N #1 \q_stop #1 +} +\cs_generate_variant:Nn \toks_put_left:Nn {NV,No,Nx,cn,co,cV} +\cs_new_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:Npn \toks_put_right:Nn #1#2 { + #1 \exp_after:wN { \toks_use:N #1 #2 } +} +\cs_new_nopar:Npn \toks_gput_right:Nn { + \pref_global:D + \toks_put_right:Nn +} +\cs_new: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: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: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} { + \tl_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 -\def_new:Npn \toks_remove_extra_brace_group:N #1{ - \exp_after:NN \toks_remove_extra_brace_group_aux:NNw - \exp_after:NN \toks_set:Nn \exp_after:NN #1 - \toks_use:N#1\q_nil -} -\def_long_new:Npn\toks_remove_extra_brace_group_aux:NNw #1#2#3\q_nil{#1#2{#3}} +\toks_new:N \l_tl_replace_toks + %% %% %% End of file `l3toks.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3vers.dtx b/Master/texmf-dist/tex/latex/expl3/l3vers.dtx new file mode 100644 index 00000000000..c61d07ce94c --- /dev/null +++ b/Master/texmf-dist/tex/latex/expl3/l3vers.dtx @@ -0,0 +1,142 @@ +% \iffalse +%% File: l3vers.dtx Copyright (C) 1990-2009 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 LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%<*driver|package> +\RequirePackage{l3names} +%</driver|package> +%\fi +\GetIdInfo$Id: l3vers.dtx 1378 2009-06-01 19:15:56Z joseph $ + {L3 Experimental LaTeX format version} +%\iffalse +%<*driver> +%\fi +\ProvidesFile{\filename.\filenameext} + [\filedate\space v\fileversion\space\filedescription] +%\iffalse +\documentclass[full]{l3doc} +\begin{document} +\DocInput{\filename.\filenameext} +\end{document} +%</driver> +% \fi +% +% \begin{documentation} +% +% \section{Version Identification} +% Here we identify the date and version number of this release of +% \LaTeX3, and set |\tex_everyjob:D| so that it is printed at the start of +% every \LaTeX3 run. +% +% \begin{variable}{\c_format_name|\c_format_date} +% Name and date. +% \end{variable} +% +% \begin{variable}{\c_fmt_too_old} +% Age in months past "\c_format_date" after which an error is called +% during format generation. +% \end{variable} +% +% \begin{function}{\chk_format_age:w} +% Function that calculates the age of the format and calls an error if it +% is too old. +% \end{function} +% +% \end{documentation} +% +% \begin{implementation} +% +% \begin{macro}{\c_format_name} +% \begin{macro}{\c_format_date} +% \begin{macrocode} +%<*initex> +\cs_set_nopar:Npn\c_format_name{Experimental~ LaTeX3} +\cs_set_nopar:Npn\c_format_date{2009/06/01} +%^^A\cs_set_nopar:Npx\c_format_version{--release--date--goes--here--} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\c_fmt_too_old} +% \begin{macro}{\chk_format_age:w} +% Check that the format being made is not too old. While in development +% it should be a rather small number. +% \begin{macrocode} +\int_const:Nn \c_fmt_too_old{12} +\cs_set_nopar:Npn\chk_format_age:w #1/#2/#3\q_stop{ +% \end{macrocode} +% We just calculate the age of this file in months and give a warning +% if deemed too old. +% \begin{macrocode} + \intexpr_compare:nNnT{(\tex_year:D-#1)*12+\tex_month:D-#2}>\c_fmt_too_old + {\iow_term:x{^^J + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J + !~~You~are~attempting~to~make~an~experimental~LaTeX3~format~from^^J + !~~source~files~that~are~more~than~ + \intexpr_eval:n{\c_fmt_too_old}~months~old.^^J + !^^J + !~~If~you~enter~<return>~to~scroll~past~this~message~then~the~format^^J + !~~will~be~built,~but~please~consider~obtaining~newer~source~files^^J + !~~before~continuing~to~build~an~experimental~LaTeX3~format.^^J + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J + } + \tex_errhelp:D{ + To~avoid~this~error~message,~obtain~new~Experimental~LaTeX3~sources.} + \tex_errmessage:D{ + Experimental~LaTeX3~source~files~are~more~than~ + \intexpr_eval:n{\c_fmt_too_old}~months~old!} + } +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% Then we execute it. +% \begin{macrocode} +\exp_after:wN\chk_format_age:w\c_format_date\q_stop +% \end{macrocode} +% And since it's no longer needed we remove it again. +% \begin{macrocode} +\cs_gundefine:N \chk_format_age:w +% \end{macrocode} +% +% This startup banner may be further modified by the code in +% |ltfinal.dtx| if a patch file is present. +% \begin{macrocode} +\tex_everyjob:D{\iow_term:x{\c_format_name,~<\c_format_date>}} +\iow_term:x{\c_format_name,~<\c_format_date>} +%</initex> +% \end{macrocode} +% +% \end{implementation} +% \PrintIndex +% +% \endinput diff --git a/Master/texmf-dist/tex/latex/expl3/l3xref.sty b/Master/texmf-dist/tex/latex/expl3/l3xref.sty index 4635b63f382..98a3ca09251 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3xref.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3xref.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3xref.dtx Copyright (C) 2006 LaTeX3 project +%% File: l3xref.dtx Copyright (C) 2006,2009 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,62 +48,60 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3xref.dtx 621 2007-09-01 20:14:19Z morten $ +\GetIdInfo$Id: l3xref.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental cross referencing} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3quark} -\RequirePackage{l3toks} -\RequirePackage{l3io} -\RequirePackage{l3prop} -\RequirePackage{l3int} -\RequirePackage{l3token} -\prop_new:N \g_xref_all_curr_immediate_fields_plist -\prop_new:N \g_xref_all_curr_deferred_fields_plist -\def_new:Npn \xref_new:nn {\xref_new_aux:nnn{immediate}} -\def_new:Npn \xref_deferred_new:nn {\xref_new_aux:nnn{deferred}} -\def_new:Npn \xref_new_aux:nnn #1#2#3{ - \prop_gput:ccx {g_xref_all_curr_ #1 _fields_plist} +\package_check_loaded_expl: +\prop_new:N \g_xref_all_curr_immediate_fields_prop +\prop_new:N \g_xref_all_curr_deferred_fields_prop +\cs_new_nopar:Npn \xref_new:nn {\xref_new_aux:nnn{immediate}} +\cs_new_nopar:Npn \xref_deferred_new:nn {\xref_new_aux:nnn{deferred}} +\cs_new_nopar:Npn \xref_new_aux:nnn #1#2#3{ + \prop_gput:ccx {g_xref_all_curr_ #1 _fields_prop} { xref_ #2 _key } - { \exp_not:c {l_xref_curr_#2_tlp }} - \def_protected:cpn { xref_#2_key }{} - \tlp_new:cn{l_xref_curr_#2_tlp}{#3} + { \exp_not:c {l_xref_curr_#2_tl }} + \cs_set_protected_nopar:cpn { xref_#2_key }{} + \tl_new:cn{l_xref_curr_#2_tl}{#3} \toks_set:Nx \l_tmpa_toks { - \exp_not:n { \def:cpn {xref_get_value_#2_aux:w} ##1 } + \exp_not:n { \cs_set_nopar:cpn {xref_get_value_#2_aux:w} ##1 } + \exp_not:N \q_prop \exp_not:c { xref_#2_key } + \exp_not:N \q_prop } \toks_use:N \l_tmpa_toks ##2 ##3\q_nil {##2} } -\def_new:Npn \xref_get_value:nn #1#2 { - \cs_if_really_free:cTF{g_xref_#2_plist} - {??} +\cs_new_nopar:Npn \xref_get_value:nn #1#2 { + \cs_if_exist:cTF{g_xref_#2_prop} { - \exp_args:NcNc \exp_after:NN {xref_get_value_#1_aux:w} - \prop_use:N {g_xref_#2_plist} + \exp_args:NcNc \exp_after:wN {xref_get_value_#1_aux:w} + \toks_use:N {g_xref_#2_prop} \q_nil } + {??} } -\def:NNn \exp_after:cc 2 { - \exp_after:NN \exp_after:NN - \cs:w #1\exp_after:NN\cs_end: \cs:w #2\cs_end: +\cs_set_nopar:Npn \exp_after:cc #1#2 { + \exp_after:wN \exp_after:wN + \cs:w #1\exp_after:wN\cs_end: \cs:w #2\cs_end: } -\def_protected_new:Npn \xref_define_label:nn { +\cs_set_protected:Npn \q_prop {\q_prop} +\cs_new_protected_nopar:Npn \xref_define_label:nn { \group_begin: \char_set_catcode:nn {`\ }\c_ten \xref_define_label_aux:nn } -\def_new:Npn \xref_define_label_aux:nn #1#2 { - \cs_if_really_free:cTF{g_xref_#1_plist} - {\prop_new:c{g_xref_#1_plist}}{\WARNING} - \toks_gset:cn{g_xref_#1_plist}{#2} +\cs_new_nopar:Npn \xref_define_label_aux:nn #1#2 { + \cs_if_free:cTF{g_xref_#1_prop} + {\prop_new:c{g_xref_#1_prop}}{\WARNING} + \toks_gset:cn{g_xref_#1_prop}{#2} \group_end: } -\def:Npn \xref_set_label:n #1{ - \def:Npx \tmp:w{\prop_use:N\g_xref_all_curr_immediate_fields_plist} - \exp_args:NNx\iow_deferred_expanded:Nn \xref_write{ +\cs_set_nopar:Npn \xref_set_label:n #1{ + \cs_set_nopar:Npx \xref_tmp:w{\toks_use:N\g_xref_all_curr_immediate_fields_prop} + \exp_args:NNx\iow_shipout_x:Nn \xref_write{ \xref_define_label:nn {#1} { - \tmp:w - \prop_use:N \g_xref_all_curr_deferred_fields_plist + \xref_tmp:w + \toks_use:N \g_xref_all_curr_deferred_fields_prop } } } |