From 9b283ffdd707fca4cdb630bbdda4e2a0a8284f21 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 11 Mar 2024 19:59:57 +0000 Subject: starray (11mar24) git-svn-id: svn://tug.org/texlive/trunk@70599 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/starray/README.md | 9 +- Master/texmf-dist/doc/latex/starray/starray.pdf | Bin 273009 -> 273444 bytes Master/texmf-dist/doc/latex/starray/starray.tex | 6 +- Master/texmf-dist/tex/latex/starray/starray.sty | 250 ++++++++++++------------ 4 files changed, 130 insertions(+), 135 deletions(-) diff --git a/Master/texmf-dist/doc/latex/starray/README.md b/Master/texmf-dist/doc/latex/starray/README.md index 42e5c77afcf..4da1c376a03 100644 --- a/Master/texmf-dist/doc/latex/starray/README.md +++ b/Master/texmf-dist/doc/latex/starray/README.md @@ -42,7 +42,7 @@ Please do not use the issue page for generic help on how to use the package. * git: https://github.com/alceu-frigeri/starray ------------- -Copyright 2023 by Alceu Frigeri +Copyright 2023-present by Alceu Frigeri This work may be distributed and/or modified under the conditions of @@ -72,7 +72,12 @@ The Current Maintainer of this work is Alceu Frigeri ------------- ## Changelog -* Version 1.5 (this) +* Version 1.6 (this) + - removing all V-expansion of property/sequence lists to avoid further issues with l3kernel + issues: #6, https://github.com/latex3/latex3/issues/1460 and https://github.com/latex3/latex3/issues/1466 + - Remarks: code is operational but needs further cleanup! + +* Version 1.5 - added \starray_term_syntax:nNN variant and friends (\starray_parsed_ ... :NN ) the _parsed_ ones being expandable * Version 1.4 diff --git a/Master/texmf-dist/doc/latex/starray/starray.pdf b/Master/texmf-dist/doc/latex/starray/starray.pdf index cf5a4f2d703..75af49bf472 100644 Binary files a/Master/texmf-dist/doc/latex/starray/starray.pdf and b/Master/texmf-dist/doc/latex/starray/starray.pdf differ diff --git a/Master/texmf-dist/doc/latex/starray/starray.tex b/Master/texmf-dist/doc/latex/starray/starray.tex index 258b5334177..0668574cec7 100644 --- a/Master/texmf-dist/doc/latex/starray/starray.tex +++ b/Master/texmf-dist/doc/latex/starray/starray.tex @@ -2,7 +2,7 @@ % !TEX ext = --interaction=nonstopmode --enable-etex % !BIB program = none %%%============================================================================== -%% Copyright 2023 by Alceu Frigeri +%% Copyright 2023-present by Alceu Frigeri %% %% This work may be distributed and/or modified under the conditions of %% @@ -15,7 +15,7 @@ %% %% The Current Maintainer of this work is Alceu Frigeri %% -%% This is version {1.5} {2023/11/28} +%% This is version {1.6} {2024/03/10} %% %% The list of files that compose this work can be found in the README.md file at %% https://ctan.org/pkg/starray @@ -67,7 +67,7 @@ The current implementation, albeit also complex, tries to reach a balance betwee \end{tsremark} -\section{Class Options}\label{pack:options} +\section{Package Options}\label{pack:options} The package options (\tsobj[key]{key}\,=\tsobj[value]{value}) are: \begin{describelist}{option} \describe{prefix}{(default: \tsobj[value]{\detokenize{l__starray_}} ). Set the \tsobj[key]{prefix} used when declaring the property lists associated with any \tsobj[pkg]{starray}.} diff --git a/Master/texmf-dist/tex/latex/starray/starray.sty b/Master/texmf-dist/tex/latex/starray/starray.sty index 376302469b0..73e07868aae 100644 --- a/Master/texmf-dist/tex/latex/starray/starray.sty +++ b/Master/texmf-dist/tex/latex/starray/starray.sty @@ -1,5 +1,5 @@ %%%============================================================================== -%% Copyright 2023 by Alceu Frigeri +%% Copyright 2023-present by Alceu Frigeri %% %% This work may be distributed and/or modified under the conditions of %% @@ -12,7 +12,7 @@ %% %% The Current Maintainer of this work is Alceu Frigeri %% -%% This is version {1.5} {2023/11/28} +%% This is version {1.6} {2024/03/10} %% %% 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/11/28} - {1.5} + {2024/03/10} + {1.6} {A structured array/hash of properties} %%%%%%% @@ -38,24 +38,16 @@ { name .code:n = {starray} , prefix .code:n = {starray} , - date .code:n = {2023/11/28}, - version .code:n = {1.5} , + date .code:n = {2024/03/10}, + version .code:n = {1.6} , description .code:n = {A~structured~array/hash~of~properties} } -\cs_if_exist:NF \__codedesc_pkg_info:nn +\cs_if_exist:NF \PkgInfo { - \cs_new_protected:Npn \__codedesc_pkg_info:nn #1#2 - { \keys_set:nn {#1 / pkg info}{#2} } - } -\cs_if_exist:NF \PkgInfo - { \NewDocumentCommand \PkgInfo {mm} { \keys_set:nn {#1 / pkg info}{#2} } } -\cs_if_exist:NF \PkgDescription - { + \NewDocumentCommand \PkgInfo {mm} { \keys_set:nn {#1 / pkg info}{#2} } \NewDocumentCommand \PkgDescription {m} - { - \noindent Package~ \textbf{\PkgInfo{#1}{name}}~Version:~\PkgInfo{#1}{version}~ -~ \PkgInfo{#1}{date}\par \emph{\PkgInfo{#1}{description}}~\par - } - } + { \noindent Package~ \textbf{\PkgInfo{#1}{name}}~Version:~\PkgInfo{#1}{version}~ -~ \PkgInfo{#1}{date}\par \emph{\PkgInfo{#1}{description}}~\par } + } %%%%%%% %%% End of cut-n-paste %%%%%%% @@ -159,7 +151,7 @@ \cs_generate_variant:Nn \prop_get:NnN { cnc , cec } -\prg_generate_conditional_variant:Nnn \prop_get:NnN { Nec } { F , T , TF} +\prg_generate_conditional_variant:Nnn \prop_get:NnN { Nec , cec , ceN , cnN } { F , T , TF} \prg_generate_conditional_variant:Nnn \seq_if_in:Nn {ce} {TF} \prg_generate_conditional_variant:Nnn \prop_if_in:Nn {ce} {TF} @@ -506,15 +498,12 @@ { iter } { \use:c {\l__starray_prefix_tl #2 _iter_int} } - \prop_gput:cnV - { \l__starray_prefix_tl #2 _base_prop } - { idx_hash } - \c_empty_prop - \prop_gput:cnV - { \l__starray_prefix_tl #2 _base_prop } - { iter_hash } - \c_empty_prop + %% V-less : new + \prop_new:c {\l__starray_prefix_tl #2 _base_idxhash_prop} + + %% V-less : new iterhash + \prop_new:c {\l__starray_prefix_tl #2 _base_iterhash_prop} } \cs_generate_variant:Nn \__starray_base_new:nn { ee } @@ -540,10 +529,11 @@ \prop_clear:N \l_tmpa_prop - \prop_gput:cnV { \l__starray_prefix_tl #1 _def_prop } {@st_seq} \c_empty_seq - - \prop_gput:cnV - { \l__starray_prefix_tl #1 _def_prop} {def} \l_tmpa_prop + %% V-less : new st_seq => defstkeys_seq + \seq_new:c { \l__starray_prefix_tl #1 _defstkeys_seq } + + %% V-less : This shall be the new defkey's holder {def} + \prop_new:c {\l__starray_prefix_tl #1 _defkeys_prop} } @@ -627,9 +617,12 @@ % needs protection. \cs_new_protected:Npn \__starray_def_prop:nnn #1#2#3 { - \prop_get:cnN {\l__starray_prefix_tl #1 _def_prop} {def} \l_tmpa_prop - \prop_put:Nnn \l_tmpa_prop {#2} {#3} - \prop_gput:cnV {\l__starray_prefix_tl #1 _def_prop} {def} \l_tmpa_prop +% \prop_get:cnN {\l__starray_prefix_tl #1 _def_prop} {def} \l_tmpa_prop +% \prop_put:Nnn \l_tmpa_prop {#2} {#3} +% \prop_gput:cnV {\l__starray_prefix_tl #1 _def_prop} {def} \l_tmpa_prop + + %% V-less : This shall be the new key's holder {def} + \prop_gput:cnn {\l__starray_prefix_tl #1 _defkeys_prop} {#2} {#3} } @@ -676,15 +669,15 @@ % needs protection because of \seq_if... \cs_new_protected:Npn \__starray_def_struct:nn #1#2 { - \prop_get:cnN {\l__starray_prefix_tl #1 _def_prop} {@st_seq} \l_tmpa_seq - \seq_if_in:NnF \l_tmpa_seq {#2} + %% V-less : new st_seq... can be optimized by direct reference (no tmpa) + \seq_if_in:cnF {\l__starray_prefix_tl #1 _defstkeys_seq} {#2} { - \seq_put_right:Nn \l_tmpa_seq {#2} - - \prop_gput:cnV {\l__starray_prefix_tl #1 _def_prop} {@st_seq} \l_tmpa_seq + %% V-less : new st_seq + \seq_gput_right:cn {\l__starray_prefix_tl #1 _defstkeys_seq} {#2} \__starray_new:e { #1 . #2} } + } \cs_generate_variant:Nn \__starray_def_struct:nn {ne} @@ -717,10 +710,11 @@ {\l__starray_prefix_tl #2 _base_prop} {def_ref} \l_tmpa_tl - \prop_get:cec - {\l__starray_prefix_tl \l_tmpa_tl _def_prop} - {@st_seq} - {l__starray_tmp A_seq} + + %% V-less : new st_seq + \seq_set_eq:cc {l__starray_tmp A_seq}{\l__starray_prefix_tl \l_tmpa_tl _defstkeys_seq} + + %% V-less : can't be optimized. _fix_terms_ will change _defstkeys_seq \seq_map_tokens:cn {l__starray_tmp A_seq} {\__starray_fix_terms_seq_aux:nnnn {#1}{#2}{#4}} @@ -730,16 +724,17 @@ \cs_new_protected:Npn \__starray_fix_terms:nn #1#2 { \group_begin: - \prop_get:cnc - {\l__starray_prefix_tl #2 _base_prop} - {idx_hash} - {l__starray_tmp A_prop} + %% V-less : and replaced by + \prop_set_eq:cc {l__starray_tmp A_prop} {\l__starray_prefix_tl #2 _base_idxhash_prop} + + %% V-less : can be improved by direct reference. \prop_if_empty:cF {l__starray_tmp A_prop} { \prop_map_tokens:cn {l__starray_tmp A_prop} {\__starray_fix_terms_seq:nnnn {#1}{#2}} } + \group_end: } @@ -921,33 +916,29 @@ {\prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {iter} } {\prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} } - - % idx_hash Update. - \prop_get:cnN {\l__starray_prefix_tl #1 _base_prop} {idx_hash} \l_tmpa_prop - \prop_get:cnN {\l__starray_prefix_tl #1 _base_prop} {iter_hash} \l_tmpb_prop - - \prop_put:Nee \l_tmpa_prop + %% V-less : new + \prop_put:cee {\l__starray_prefix_tl #1 _base_idxhash_prop} { \int_use:N \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} } { \int_to_Alph:e { \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} } } - \prop_put:Nee \l_tmpb_prop + %% V-less : new iterhash + \prop_put:cee {\l__starray_prefix_tl #1 _base_iterhash_prop} { \int_use:N \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} } { \int_use:N \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} } - + \tl_if_blank:nF {#2} { - \prop_put:Nee \l_tmpa_prop + %% V-less : new + \prop_put:cee {\l__starray_prefix_tl #1 _base_idxhash_prop} { #2 } { \int_to_Alph:e { \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} } } - \prop_put:Nee \l_tmpb_prop + + %% V-less : new iter_hash + \prop_put:cee {\l__starray_prefix_tl #1 _base_iterhash_prop} { #2 } { \int_use:N \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} } } - \prop_gput:cnV {\l__starray_prefix_tl #1 _base_prop} {idx_hash} \l_tmpa_prop - - \prop_gput:cnV {\l__starray_prefix_tl #1 _base_prop} {iter_hash} \l_tmpb_prop - % creating the 'new property list' (aka. term) \tl_set:Ne \l_tmpa_tl { \int_to_Alph:e { \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {cnt} } } @@ -957,19 +948,17 @@ \prop_get:cnN {\l__starray_prefix_tl #1 _base_prop} {def_ref} \l_tmpb_tl - \prop_get:cnN {\l__starray_prefix_tl \l_tmpb_tl _def_prop} {def} \l_tmpa_prop - - \prop_gset_eq:cN { \l__starray_prefix_tl #1 _ \l_tmpa_tl _term_prop } \l_tmpa_prop - - \prop_get:cnN {\l__starray_prefix_tl \l_tmpb_tl _def_prop} {@st_seq} \l_tmpa_seq + %% V-less : replacing above + \prop_gset_eq:cc { \l__starray_prefix_tl #1 _ \l_tmpa_tl _term_prop } {\l__starray_prefix_tl \l_tmpb_tl _defkeys_prop} % map over 'all sub-starrays parts of def_ref -> st_seq (those starting with a dot, @st_seq) - \seq_map_tokens:Nn - \l_tmpa_seq + \seq_map_tokens:cn + {\l__starray_prefix_tl \l_tmpb_tl _defstkeys_seq} { \__starray_sub_base_new:nnn { \l_tmpb_tl }{ #1 _ \l_tmpa_tl } } + } @@ -1051,9 +1040,9 @@ \cs_new_protected:Npn \__starray_set_sub_iter:nnn #1#2#3 { - \prop_get:cnN {\l__starray_prefix_tl #2#3 _base_prop} {idx_hash} \l_tmpa_prop - \prop_get:NecT \l_tmpa_prop + %% V-less : to be replaced by + \prop_get:cecT {\l__starray_prefix_tl #2#3 _base_idxhash_prop} { \int_use:N \prop_item:cn {\l__starray_prefix_tl #2#3 _base_prop} {iter} } { l__starray_tmp #1 A_tl } { @@ -1061,12 +1050,11 @@ {\l__starray_prefix_tl #2#3 _base_prop} {def_ref} \l_tmpa_tl - - \prop_get:cnc - { \l__starray_prefix_tl \l_tmpa_tl _def_prop } - { @st_seq } - {l__starray_tmp #1 A_seq } - + + %% V-less : new st_seq + \seq_set_eq:cc {l__starray_tmp #1 A_seq }{ \l__starray_prefix_tl \l_tmpa_tl _defstkeys_seq } + + %% V-less : could it be optimized? direct reference to defstkeys !? \seq_if_empty:cF {l__starray_tmp #1 A_seq } { \seq_map_variable:cNn @@ -1098,8 +1086,8 @@ %%%%%%%%%%%%%%% \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 +% %% V-less : replacing ... iter_hash + \prop_get:cnNTF {\l__starray_prefix_tl #1 _base_iterhash_prop} {#2} \l_tmpa_tl { \int_gset:Nn { \prop_item:cn {\l__starray_prefix_tl #1 _base_prop} {iter} } @@ -1635,6 +1623,21 @@ } +\prg_new_protected_conditional:Npnn \starray_get_unique_id:nN #1#2 {T, F, TF} + { + \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1} + { + \tl_set:Ne + #2 + { \l__starray_parsed_ref_tl } + \prg_return_true: + } + { + \seq_clear:N \l__starray_msg_seq + \prg_return_false: + } % returns nothing by default + } + @@ -1819,17 +1822,16 @@ {def_ref} {l__starray_tmp #1 _def_prop} - \prop_get:cnc - {\l__starray_prefix_tl \tl_use:c {l__starray_tmp #1 _def_prop} _def_prop} - {@st_seq} - {l__starray_tmp #1 _seq} - + + %% V-less : new st_seq + \seq_set_eq:cc {l__starray_tmp #1 _seq}{\l__starray_prefix_tl \tl_use:c {l__starray_tmp #1 _def_prop} _defstkeys_seq} + + %% V-less : could it be optimized? direct reference to defstkeys !? \seq_if_in:cnTF {l__starray_tmp #1 _seq}{#4} { - \prop_get:cnc - { \l__starray_prefix_tl #3 .#4 _base_prop } - { idx_hash } - { l__starray_tmp #1 _hash_prop } + %% V-less : replacing above + \prop_set_eq:cc { l__starray_tmp #1 _hash_prop } { \l__starray_prefix_tl #3 .#4 _base_idxhash_prop } + \prop_get:cnc { \l__starray_prefix_tl #3 .#4 _base_prop } { iter } @@ -1872,18 +1874,19 @@ {def_ref} {l__starray_tmp #1 _def_prop} - \prop_get:cnc - {\l__starray_prefix_tl \tl_use:c {l__starray_tmp #1 _def_prop} _def_prop} - {@st_seq} - {l__starray_tmp #1 _seq} + %% V-less : new st_seq + \seq_set_eq:cc {l__starray_tmp #1 _seq}{\l__starray_prefix_tl \tl_use:c {l__starray_tmp #1 _def_prop} _defstkeys_seq} + + %% V-less : could it be optimized? direct reference to defstkeys !? \seq_if_in:ceTF { l__starray_tmp #1 _seq } { \tl_use:c{l__starray_tmp #1 :B_tl} } { - \prop_get:cnc - { \l__starray_prefix_tl #3. \tl_use:c{l__starray_tmp #1 :B_tl} _base_prop } - { idx_hash } - { l__starray_tmp #1 _hash_prop } + %% V-less : could it be optimized? direct reference !? + \prop_set_eq:cc + { l__starray_tmp #1 _hash_prop } + { \l__starray_prefix_tl #3. \tl_use:c{l__starray_tmp #1 :B_tl} _base_idxhash_prop } + \tl_set:ce { l__starray_tmp #1 _idx_tl } { @@ -2083,17 +2086,17 @@ % if #2 is empty, test if #1 is valid, return true/false \prg_new_protected_conditional:Npnn \__starray_if_valid_idx:nn #1#2 {T, F, TF} { - \prop_get:cnN {\l__starray_prefix_tl \l__starray_parsed_ref_tl _base_prop} {idx_hash} \l_tmpa_prop - \tl_if_blank:nTF {#2} { - \tl_put_right:Ne \l__starray_parsed_ref_tl - { _ \prop_item:Ne \l_tmpa_prop {#1} } + \prop_get:ceNF {\l__starray_prefix_tl \l__starray_parsed_ref_tl _base_idxhash_prop} {#1} \l_tmpa_tl + { \tl_set:Nn \l_tmpa_tl {} } } { - \tl_put_right:Ne \l__starray_parsed_ref_tl - { _ \prop_item:Ne \l_tmpa_prop {#2} } + \prop_get:ceNF {\l__starray_prefix_tl \l__starray_parsed_ref_tl _base_idxhash_prop} {#2} \l_tmpa_tl + { \tl_set:Nn \l_tmpa_tl {} } } + \tl_put_right:Ne \l__starray_parsed_ref_tl { _ \l_tmpa_tl } + \prop_if_exist:cTF { \l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop } {\prg_return_true:} @@ -2333,25 +2336,18 @@ \tl_to_str:n {{#3} ~ struct} \use:nn { ~ } { ~ } => } - - \prop_get:cnc - {\l__starray_prefix_tl #2#3 _def_prop} - {def} - {l__starray_tmp A _def_prop} - - \prop_get:cnc - { \l__starray_prefix_tl #2#3 _def_prop } - { @st_seq } - {l__starray_tmp A _seq } - + + %% V-less : direct reference to _defkeys \prop_map_tokens:cn - {l__starray_tmp A _def_prop} + {\l__starray_prefix_tl #2#3 _defkeys_prop} {\__starray_show_def_item:nnn {#1}} - - \seq_if_empty:cF { l__starray_tmp A _seq } + + + %% V-less : direct reference to _defstkeys + \seq_if_empty:cF { \l__starray_prefix_tl #2#3 _defstkeys_seq} { \seq_map_tokens:cn - { l__starray_tmp A _seq } + { \l__starray_prefix_tl #2#3 _defstkeys_seq} { \__starray_show_def:nnn { #1 \use:nnn { ~ } { ~ } { ~ }} { #2#3. } } } \group_end: @@ -2421,19 +2417,17 @@ { \l__starray_prefix_tl #2 #3 _base_prop } { def_ref } \l_tmpa_tl - - \prop_get:cnc - { \l__starray_prefix_tl \l_tmpa_tl _def_prop } - { @st_seq } - {l__starray_tmp A _seq } - - \seq_if_empty:cTF { l__starray_tmp A _seq } + + %% V-less : this can be optimized: direct reference to defstkeys_seq + \seq_if_empty:cTF { \l__starray_prefix_tl \l_tmpa_tl _defstkeys_seq } {} { \seq_map_tokens:cn - { l__starray_tmp A _seq } + { \l__starray_prefix_tl \l_tmpa_tl _defstkeys_seq } { \__starray_show_terms:nen { #1 \use:nnn { ~ } { ~ } { ~ }} { #2 #3_#5. } } } + + \group_end: } @@ -2442,13 +2436,9 @@ \cs_new_protected:Npn \__starray_show_terms:nnn #1#2#3 { \group_begin: - \prop_get:cnc - {\l__starray_prefix_tl #2 #3 _base_prop} - {idx_hash} - {l__starray_tmp A _idx_prop} - + %% V-less : direct reference \prop_map_tokens:cn - {l__starray_tmp A _idx_prop} + {\l__starray_prefix_tl #2 #3 _base_idxhash_prop} {\__starray_show_term_item:nnnnn {#1}{#2}{#3}} \group_end: } -- cgit v1.2.3