texlive[68907] Master/texmf-dist: starray (19nov23)

commits+karl at tug.org commits+karl at tug.org
Sun Nov 19 22:30:33 CET 2023


Revision: 68907
          https://tug.org/svn/texlive?view=revision&revision=68907
Author:   karl
Date:     2023-11-19 22:30:32 +0100 (Sun, 19 Nov 2023)
Log Message:
-----------
starray (19nov23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/starray/README.md
    trunk/Master/texmf-dist/doc/latex/starray/starray.pdf
    trunk/Master/texmf-dist/doc/latex/starray/starray.tex
    trunk/Master/texmf-dist/tex/latex/starray/starray.sty

Modified: trunk/Master/texmf-dist/doc/latex/starray/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/starray/README.md	2023-11-19 21:30:23 UTC (rev 68906)
+++ trunk/Master/texmf-dist/doc/latex/starray/README.md	2023-11-19 21:30:32 UTC (rev 68907)
@@ -73,7 +73,10 @@
 
 ## Changelog
 
-* Version 1.3 (this) 
+* Version 1.4 (this) 
+    - added a few functions _set_iter_from_hash:nn and _iterate_over:n.
+
+* Version 1.3 
     - Fixed issue #4, where (in some instances) _set_from_keyval could render a quark loop.
 
 * Version 1.2

Modified: trunk/Master/texmf-dist/doc/latex/starray/starray.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/starray/starray.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/starray/starray.tex	2023-11-19 21:30:23 UTC (rev 68906)
+++ trunk/Master/texmf-dist/doc/latex/starray/starray.tex	2023-11-19 21:30:32 UTC (rev 68907)
@@ -15,7 +15,7 @@
 %%
 %% The Current Maintainer of this work is Alceu Frigeri
 %%
-%% This is version 1.3 (2023/06/04)
+%% This is version 1.4 (2023/11/18)
 %%
 %% The list of files that compose this work can be found in the README.md file at
 %% https://ctan.org/pkg/starray
@@ -450,6 +450,18 @@
 
 
 
+\begin{codedescribe}[code,new=2023/11/04]{\starray_set_iter_from_hash:nn,\starray_set_iter_from_hash:nnTF}
+\begin{codesyntax}%
+\tsmacro{\starray_set_iter_from_hash:nn}{starray-ref,hash}
+\tsmacro{\starray_set_iter_from_hash:nnTF}{starray-ref,hash,if-true,if-false}
+\end{codesyntax}
+\end{codedescribe}
+\tsmacro{\starray_set_iter_from_hash:nn}{starray-ref,hash} will set iter based on the \tsobj[meta]{hash} used when instantiating a term (see \ref{pack:instantiate} ).
+\begin{tsremark}
+A warning is raised (see \ref{pack:options}) in case of a \tsobj[marg]{starray-ref} syntax error or invalid \tsobj[meta]{hash}. The branching version doesn't raise any warning.
+\end{tsremark}
+
+
 \begin{codedescribe}{\starray_get_iter:n,\starray_get_iter:nN,\starray_get_iter:nNTF}
 \begin{codesyntax}%
 \tsmacro{\starray_get_iter:n}{starray-ref}
@@ -495,7 +507,22 @@
 This can be used after any command which 'parses a term', for instance \tsobj{\starray_term_syntax:n}, see section \ref{conditionals:terms}, but it only makes sense (and returns a reliable/meaningful result) IF the last parser operation was successfully executed.
 \end{tsremark}
 
+\begin{codedescribe}[code,new=2023/11/04]{\starray_iterate_over:nn,\starray_iterate_over:nnTF}
+\begin{codesyntax}%
+\tsmacro{\starray_iterate_over:nn}{starray-ref,code}
+\tsmacro{\starray_iterate_over:nnTF}{starray-ref,code,if-true,if-false}
+\end{codesyntax}
+\tsobj{\starray_iterate_over:nn} will reset the \tsobj[marg]{starray-ref} iterator, and then execute \tsobj[marg]{code} for each valid value of \tsobj{iter}. At the loop's end, the \tsobj[marg]{starray-ref} iterator will point to the last element of it. The \tsobj[marg]{if-true} is executed, at the loop's end if there is no syntax error. Similarly \tsobj[marg]{if-false} is only execute if a syntax error is detected.
+\end{codedescribe}
+\begin{tsremark}
+\tsobj{\starray_iterate_over:nn} Creates a local group, so that one can recurse over sub-structures. Be aware, then, that \tsobj[marg]{code} is executed in said local group.
+\end{tsremark}
+\begin{tsremark}
+A warning is raised (see \ref{pack:options}) in case of a \tsobj[marg]{starray-ref} syntax error. The branching version doesn't raise any warning.
+\end{tsremark}
 
+
+
 \section{Changing and recovering starray properties}\label{pack:get/set}
 
 \begin{codedescribe}{\starray_set_prop:nnn,\starray_set_prop:nnV,\starray_set_prop:nnnTF,\starray_set_prop:nnVTF,\starray_gset_prop:nnn,\starray_gset_prop:nnV,\starray_gset_prop:nnnTF,\starray_gset_prop:nnVTF}

Modified: trunk/Master/texmf-dist/tex/latex/starray/starray.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/starray/starray.sty	2023-11-19 21:30:23 UTC (rev 68906)
+++ trunk/Master/texmf-dist/tex/latex/starray/starray.sty	2023-11-19 21:30:32 UTC (rev 68907)
@@ -12,7 +12,7 @@
 %%
 %% The Current Maintainer of this work is Alceu Frigeri
 %%
-%% This is version 1.3 (2023/06/04) 
+%% This is version 1.4 (2023/11/18) 
 %%
 %% The list of files that compose this work can be found in the README.md file at
 %% https://ctan.org/pkg/starray
@@ -24,8 +24,8 @@
 
 \ProvidesExplPackage
     {starray}
-    {2023/06/04}
-    {1.3}
+    {2023/11/18}
+    {1.4}
     {A structured array/hash of properties}
 
 %%%%%%%
@@ -38,8 +38,8 @@
   {
      name        .code:n = starray ,
      prefix      .code:n = starray ,
-     date        .code:n = 2023/06/04,
-     version     .code:n = 1.3 ,
+     date        .code:n = 2023/11/18,
+     version     .code:n = 1.4 ,
      description .code:n = A~structured~array/hash~of~properties
   }
 \cs_if_exist:NF \__codedesc_pkg_info:nn 
@@ -145,6 +145,7 @@
 \cs_generate_variant:Nn \seq_gput_right:Nn {ce}
 
 \cs_generate_variant:Nn \int_to_Alph:n {e}
+\cs_generate_variant:Nn \int_gset:Nn {Ne}
 
 \cs_generate_variant:Nn \prop_put:Nnn {Nee , cee}
 \cs_generate_variant:Nn \prop_gput:Nnn {Nee , cee}
@@ -1088,7 +1089,64 @@
 %%%% \starray_set_iter
 %%%%
 %%%%%%%%%%%%%%%
+\prg_new_protected_conditional:Npnn \__starray_set_iter_from_hash:nn #1#2 {T , F, TF}
+  {
+    \prop_get:cnN {\l__starray_prefix_tl #1 _base_prop} {iter_hash} \l_tmpa_prop
+    \prop_get:NnNTF \l_tmpa_prop {#2} \l_tmpa_tl
+      {
+        \int_gset:Nn
+          { \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {iter} }
+          { \l_tmpa_tl }
+        \prg_return_true:
+      }
+      {
+        \prg_return_false:
+      }    
+  }
 
+
+\cs_new_protected:Npn \starray_set_iter_from_hash:nn #1#2
+  {
+    \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+      {
+        \__starray_set_iter_from_hash:nnTF {\l__starray_parsed_ref_tl}{#2}
+          {
+            \__starray_set_sub_iter:nnn {}{\l__starray_parsed_ref_tl}{}        
+          }
+          {
+            \msg_warning:nnnn {starray} {reference /  iter} {iterhash:1} {#1}{#2}            
+          }
+      }
+      {
+        \__starray_msg_dispatch:
+        \msg_warning:nnnn {starray} {syntax /  iter} {iter:1} {#1}
+      } % returns nothing by default
+  }
+
+\prg_new_protected_conditional:Npnn \starray_set_iter_from_hash:nn #1#2 {T, F, TF}
+  {
+    \bool_set_true:N \l__starray_rtn_bool
+
+    \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
+      {
+        \__starray_set_iter_from_hash:nnTF {\l__starray_parsed_ref_tl}{#2}
+          {
+            \__starray_set_sub_iter:nnn {}{\l__starray_parsed_ref_tl}{}        
+            \prg_return_true:
+          }
+          {
+            \bool_set_false:N \l__starray_rtn_bool
+            \prg_return_false:
+          }
+      }
+      {
+        \bool_set_false:N \l__starray_rtn_bool
+        \seq_clear:N \l__starray_msg_seq
+        \prg_return_false:
+      } % returns nothing by default
+  }
+
+
 \cs_new_protected:Npn \starray_set_iter:nn #1#2
   {
     \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1}
@@ -1226,8 +1284,64 @@
       }
   }
 
+
 %%%%%%%%%%%%%%%
+%%%%
+%%%% \starray_iterate_over
+%%%%
 %%%%%%%%%%%%%%%
+\bool_new:N \l__starray_iterate_bool
+
+\cs_new_protected:Npn \starray_iterate_over:nn #1#2
+  {
+    
+        \bool_if_exist:cF {l__starray_iterate_ #1 _bool}
+          { \bool_new:c   {l__starray_iterate_ #1 _bool} }
+        \starray_reset_iter:nTF {#1}
+          {
+            \bool_gset_true:c {l__starray_iterate_ #1 _bool}
+            \bool_do_while:cn {l__starray_iterate_ #1 _bool}
+            {
+            
+              #2
+              
+              \starray_next_iter:nTF {#1}
+                { \bool_gset_true:c  {l__starray_iterate_ #1 _bool} }
+                { \bool_gset_false:c {l__starray_iterate_ #1 _bool} }
+            }
+          }
+          {
+            \bool_set_false:N \l__starray_rtn_bool
+            \msg_warning:nnnn {starray} {syntax /  iter} {iter:6} {#1}
+          }
+     
+  }
+
+\prg_new_protected_conditional:Npnn \starray_iterate_over:nn #1#2 {T, F, TF}
+  {
+     \bool_if_exist:cF {l__starray_iterate_#1_bool}{\bool_new:c {l__starray_iterate_#1_bool}}
+        \starray_reset_iter:nTF {#1}
+          {
+            \bool_gset_true:c {l__starray_iterate_#1_bool}
+            \bool_do_while:cn {l__starray_iterate_#1_bool}
+            {
+              #2
+              \starray_next_iter:nF {#1}
+                %{\bool_gset_true:c {l__starray_iterate_#1_bool}}
+                {\bool_gset_false:c {l__starray_iterate_#1_bool}}
+            }
+            \prg_return_true:
+          }
+          {
+            \seq_clear:N \l__starray_msg_seq
+            \prg_return_false: 
+          }
+  }
+
+
+
+%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%
 %%%%
 %%%% set/get properties
 %%%%
@@ -1265,7 +1379,7 @@
   
 %%%%%%%%%%%%%%%%
 %%%
-%%% WARNING: This is uses the 'last parsed term'.
+%%% WARNING: This uses the 'last parsed term'.
 %%%
 %%%%%%%%%%%%%%%%  
 \cs_new:Npn \starray_parsed_get_prop:n #1



More information about the tex-live-commits mailing list.