From f7855c12c18bb97b7b9e49ab685ee558d8c0b47b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 23 Jul 2012 17:14:27 +0000 Subject: l3 3990 git-svn-id: svn://tug.org/texlive/trunk@27107 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/l3experimental/l3str/l3flag.dtx | 58 ++++++++++++---------- 1 file changed, 32 insertions(+), 26 deletions(-) (limited to 'Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx') diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx index 717065d7d27..d3b17183671 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx @@ -36,7 +36,7 @@ %<*driver|package> \RequirePackage{expl3} \GetIdInfo$Id: l3flag.dtx 3039 2011-12-08 09:22:35Z bruno $ - {L3 Experimental Flags} + {L3 Experimental flags} % %<*driver> \documentclass[full]{l3doc} @@ -175,6 +175,10 @@ % \end{macrocode} % % \begin{macrocode} +%<@@=flag> +% \end{macrocode} +% +% \begin{macrocode} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} % \end{macrocode} @@ -187,28 +191,28 @@ % \begin{macrocode} \cs_new_protected:Npn \flag_new:n #1 { - \cs_new:cpn { flag_trap_#1:w } ##1 ; - { \exp_after:wN \use_none:n \cs:w l_#1_##1_flag \cs_end: } + \cs_new:cpn { @@_trap_#1:w } ##1 ; + { \exp_after:wN \use_none:n \cs:w @@_#1_##1: \cs_end: } } % \end{macrocode} % \end{macro} % % \begin{macro}{\flag_clear:n} -% \begin{macro}[aux]{\flag_clear_aux:ww} +% \begin{macro}[aux]{\@@_clear:ww} % Undefine control sequences, starting from the |_0| flag, upwards, % until reaching an undefined control sequence. % \begin{macrocode} \cs_new_protected:Npn \flag_clear:n #1 - { \flag_clear_aux:ww 0 ; #1 \q_stop } -\cs_new_protected:Npn \flag_clear_aux:ww #1 ; #2 \q_stop + { \@@_clear:ww 0 ; #1 \q_stop } +\cs_new_protected:Npn \@@_clear:ww #1 ; #2 \q_stop { - \if_cs_exist:w l_#2_#1_flag \cs_end: + \if_cs_exist:w @@_#2_#1: \cs_end: \else: \exp_after:wN \use_none_delimit_by_q_stop:w \fi: - \cs_set_eq:cN { l_#2_#1_flag } \c_undefined:D - \exp_after:wN \flag_clear_aux:ww - \int_use:N \int_eval:w \c_one + #1 ; + \cs_set_eq:cN { @@_#2_#1: } \c_undefined:D + \exp_after:wN \@@_clear:ww + \int_use:N \__int_eval:w \c_one + #1 ; #2 \q_stop } % \end{macrocode} @@ -216,7 +220,8 @@ % \end{macro} % % \begin{macro}{\flag_clear_new:n} -% A flag exist if \cs{flag_trap_\meta{flag name}:n} exists. +% As for other datatypes, clear the \meta{flag} or create a new one, +% as appropriate. % \begin{macrocode} \cs_new_protected:Npn \flag_clear_new:n #1 { \flag_if_exist:nTF {#1} { \flag_clear:n } { \flag_new:n } {#1} } @@ -224,22 +229,23 @@ % \end{macro} % % \begin{macro}{\flag_set_trap:nn} -% Should that \pkg{l3flag} function check whether the flag exists? +% ^^A todo: check that the flag exists. +% Redefine the trap. % \begin{macrocode} \cs_new_protected:Npn \flag_set_trap:nn #1#2 - { \cs_set:cpn { flag_trap_#1:w } ##1 ; {#2} } + { \cs_set:cpn { @@_trap_#1:w } ##1 ; {#2} } % \end{macrocode} % \end{macro} % % \subsection{Expandable flag commands} % % \begin{macro}[EXP, pTF]{\flag_if_exist:n} -% A \meta{flag} is defined if the corresponding \enquote{trap} is -% defined. +% A flag exist if the corresponding trap \cs{@@_trap_\meta{flag +% name}:n} is defined. % \begin{macrocode} \prg_new_conditional:Npnn \flag_if_exist:n #1 { p , T , F , TF } { - \cs_if_exist:cTF { flag_trap_#1:w } + \cs_if_exist:cTF { @@_trap_#1:w } { \prg_return_true: } { \prg_return_false: } } % \end{macrocode} @@ -250,7 +256,7 @@ % \begin{macrocode} \prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } { - \if_cs_exist:w l_#1_0_flag \cs_end: + \if_cs_exist:w @@_#1_0: \cs_end: \prg_return_true: \else: \prg_return_false: @@ -260,21 +266,21 @@ % \end{macro} % % \begin{macro}[EXP]{\flag_height:n} -% \begin{macro}[EXP, aux]{\flag_height_loop:ww, \flag_height_end:ww} +% \begin{macro}[EXP, aux]{\@@_height_loop:ww, \@@_height_end:ww} % Extract the value of the flag by going through all of the % |_|\meta{integer} control sequences starting from $0$. % \begin{macrocode} -\cs_new:Npn \flag_height:n #1 { \flag_height_loop:ww 0; #1 \q_stop } -\cs_new:Npn \flag_height_loop:ww #1 ; #2 \q_stop +\cs_new:Npn \flag_height:n #1 { \@@_height_loop:ww 0; #1 \q_stop } +\cs_new:Npn \@@_height_loop:ww #1 ; #2 \q_stop { - \if_cs_exist:w l_#2_#1_flag \cs_end: - \exp_after:wN \flag_height_loop:ww \int_use:N \int_eval:w \c_one + + \if_cs_exist:w @@_#2_#1: \cs_end: + \exp_after:wN \@@_height_loop:ww \int_use:N \__int_eval:w \c_one + \else: - \exp_after:wN \flag_height_end:ww + \exp_after:wN \@@_height_end:ww \fi: #1 ; #2 \q_stop } -\cs_new:Npn \flag_height_end:ww #1 ; #2 \q_stop { #1 } +\cs_new:Npn \@@_height_end:ww #1 ; #2 \q_stop { #1 } % \end{macrocode} % \end{macro} % \end{macro} @@ -284,8 +290,8 @@ % \begin{macrocode} \cs_new:Npn \flag_raise:n #1 { - \cs:w flag_trap_#1:w \exp_after:wN \cs_end: - \int_value:w \flag_height:n {#1} ; + \cs:w @@_trap_#1:w \exp_after:wN \cs_end: + \__int_value:w \flag_height:n {#1} ; } % \end{macrocode} % \end{macro} -- cgit v1.2.3