diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/lt3rawobjects/lt3rawobjects.sty | 328 |
1 files changed, 266 insertions, 62 deletions
diff --git a/Master/texmf-dist/tex/latex/lt3rawobjects/lt3rawobjects.sty b/Master/texmf-dist/tex/latex/lt3rawobjects/lt3rawobjects.sty index 11ef07f1901..e213d3d4530 100644 --- a/Master/texmf-dist/tex/latex/lt3rawobjects/lt3rawobjects.sty +++ b/Master/texmf-dist/tex/latex/lt3rawobjects/lt3rawobjects.sty @@ -26,43 +26,52 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3}[2022-04-10] -\ProvidesExplPackage{lt3rawobjects}{2022/06/30}{ 1.0.2 }{Objects and proxies in LaTeX3} +\ProvidesExplPackage{lt3rawobjects}{2022/07/11}{ 1.1.1 }{Objects and proxies in LaTeX3} \str_const:Nn \c_object_local_str {loc} \str_const:Nn \c_object_global_str {glo} \str_const:Nn \c_object_public_str {pub} \str_const:Nn \c_object_private_str {pri} -\str_const:Nn \c__objpriv_const_str {con} +\str_const:Nn \c__rawobjects_const_str {con} \cs_new:Nn \object_address:nn { \tl_to_str:n { #1 _ #2 } } -\cs_new:Nn \__objpriv_object_modvar:n{ + +\cs_new_protected:Nn \object_address_set:Nnn { + \str_set:Nn #1 { #2 _ #3 } +} + +\cs_new_protected:Nn \object_address_gset:Nnn { + \str_gset:Nn #1 { #2 _ #3 } +} + +\cs_new:Nn \__rawobjects_object_modvar:n{ c __ #1 _ MODULE _ str } -\cs_new:Nn \__objpriv_object_pxyvar:n{ +\cs_new:Nn \__rawobjects_object_pxyvar:n{ c __ #1 _ PROXY _ str } -\cs_new:Nn \__objpriv_object_scovar:n{ +\cs_new:Nn \__rawobjects_object_scovar:n{ c __ #1 _ SCOPE _ str } -\cs_new:Nn \__objpriv_object_visvar:n{ +\cs_new:Nn \__rawobjects_object_visvar:n{ c __ #1 _ VISIB _ str } -\cs_generate_variant:Nn \__objpriv_object_modvar:n { V } -\cs_generate_variant:Nn \__objpriv_object_pxyvar:n { V } -\cs_generate_variant:Nn \__objpriv_object_scovar:n { V } -\cs_generate_variant:Nn \__objpriv_object_visvar:n { V } +\cs_generate_variant:Nn \__rawobjects_object_modvar:n { V } +\cs_generate_variant:Nn \__rawobjects_object_pxyvar:n { V } +\cs_generate_variant:Nn \__rawobjects_object_scovar:n { V } +\cs_generate_variant:Nn \__rawobjects_object_visvar:n { V } \prg_new_conditional:Nnn \object_if_exist:n { p, T, F, TF } { \cs_if_exist:cTF { - \__objpriv_object_modvar:n { #1 } + \__rawobjects_object_modvar:n { #1 } } { \prg_return_true: @@ -76,28 +85,29 @@ { p, T, F, TF } \cs_new:Nn \object_get_module:n { - \str_use:c { \__objpriv_object_modvar:n { #1 } } + \str_use:c { \__rawobjects_object_modvar:n { #1 } } } \cs_new:Nn \object_get_proxy_adr:n { - \str_use:c { \__objpriv_object_pxyvar:n { #1 } } + \str_use:c { \__rawobjects_object_pxyvar:n { #1 } } } \cs_generate_variant:Nn \object_get_module:n { V } \cs_generate_variant:Nn \object_get_proxy_adr:n { V } \prg_new_conditional:Nnn \object_if_local:n {p, T, F, TF} { - \str_if_eq:cNTF { \__objpriv_object_scovar:n {#1} } \c_object_local_str - { - \prg_return_true: - } - { - \prg_return_false: - } + \str_if_eq:cNTF { \__rawobjects_object_scovar:n {#1} } + \c_object_local_str + { + \prg_return_true: + } + { + \prg_return_false: + } } \prg_new_conditional:Nnn \object_if_global:n {p, T, F, TF} { - \str_if_eq:cNTF { \__objpriv_object_scovar:n {#1} } \c_object_global_str + \str_if_eq:cNTF { \__rawobjects_object_scovar:n {#1} } \c_object_global_str { \prg_return_true: } @@ -108,7 +118,7 @@ \prg_new_conditional:Nnn \object_if_public:n {p, T, F, TF} { - \str_if_eq:cNTF { \__objpriv_object_visvar:n { #1 } } \c_object_public_str + \str_if_eq:cNTF { \__rawobjects_object_visvar:n { #1 } } \c_object_public_str { \prg_return_true: } @@ -119,7 +129,7 @@ \prg_new_conditional:Nnn \object_if_private:n {p, T, F, TF} { - \str_if_eq:cNTF { \__objpriv_object_visvar:n {#1} } \c_object_private_str + \str_if_eq:cNTF { \__rawobjects_object_visvar:n {#1} } \c_object_private_str { \prg_return_true: } @@ -137,15 +147,15 @@ \prg_generate_conditional_variant:Nnn \object_if_private:n { V } { p, T, F, TF } -\cs_new:Nn \__objpriv_scope:n +\cs_new:Nn \__rawobjects_scope:n { \object_if_global:nTF { #1 } { g } { - \str_if_eq:cNTF { \__objpriv_object_scovar:n { #1 } } - \c__objpriv_const_str + \str_if_eq:cNTF { \__rawobjects_object_scovar:n { #1 } } + \c__rawobjects_const_str { c } @@ -157,7 +167,7 @@ \cs_new:Nn \object_member_adr:nnn { - \__objpriv_scope:n { #1 } + \__rawobjects_scope:n { #1 } \object_if_private:nTF { #1 } { __ @@ -174,7 +184,7 @@ { \object_member_adr:nnv { #1 }{ #2 } { - \object_member_adr:vnn { \__objpriv_object_pxyvar:n { #1 } } + \object_member_adr:vnn { \__rawobjects_object_pxyvar:n { #1 } } { #2 _ type }{ str } } } @@ -183,32 +193,32 @@ \cs_new:Nn \object_member_type:nn { - \object_member_use:vnn { \__objpriv_object_pxyvar:n { #1 } } + \object_member_use:vnn { \__rawobjects_object_pxyvar:n { #1 } } { #2 _ type }{ str } } -\msg_new:nnnn { lt3rawobjects }{ scoperr }{ Nonstandard ~ scope } +\msg_new:nnnn { rawobjects }{ scoperr }{ Nonstandard ~ scope } { Operation ~ not ~ permitted ~ on ~ object ~ #1 ~ ~ since ~ it ~ wasn't ~ declared ~ local ~ or ~ global } -\cs_new_protected:Nn \__objpriv_force_scope:n +\cs_new_protected:Nn \__rawobjects_force_scope:n { \bool_if:nF { \object_if_local_p:n { #1 } || \object_if_global_p:n { #1 } } { - \msg_error:nnx { lt3rawobjects }{ scoperr }{ #1 } + \msg_error:nnx { rawobjects }{ scoperr }{ #1 } } } \cs_new_protected:Nn \object_new_member:nnn { - \__objpriv_force_scope:n { #1 } + \__rawobjects_force_scope:n { #1 } \cs_if_exist_use:cT { #3 _ new:c } { { \object_member_adr:nnn { #1 }{ #2 }{ #3 } } @@ -230,7 +240,7 @@ { \object_member_use:nnv { #1 }{ #2 } { - \object_member_adr:vnn { \__objpriv_object_pxyvar:n { #1 } } + \object_member_adr:vnn { \__rawobjects_object_pxyvar:n { #1 } } { #2 _ type }{ str } } } @@ -241,7 +251,7 @@ \cs_new_protected:Nn \object_member_set_eq:nnnN { - \__objpriv_force_scope:n { #1 } + \__rawobjects_force_scope:n { #1 } \cs_if_exist_use:cT { #3 _ \object_if_global:nT { #1 }{ g } set _ eq:cN @@ -257,22 +267,128 @@ { \object_member_set_eq:nnvN { #1 }{ #2 } { - \object_member_adr:vnn { \__objpriv_object_pxyvar:n { #1 } } + \object_member_adr:vnn { \__rawobjects_object_pxyvar:n { #1 } } { #2 _ type }{ str } } #3 } \cs_generate_variant:Nn \object_member_set_eq:nnN { VnN, nnc, Vnc } + +\cs_new:Nn \object_nconst_adr:nnn + { + c _ #1 \tl_to_str:n { _ CONST _ #2 _ #3 } + } + +\cs_generate_variant:Nn \object_member_adr:nnn { Vnn, vnn } + +\cs_new:Nn \object_rconst_adr:nnn + { + \object_nconst_adr:vnn { \__rawobjects_object_pxyvar:n { #1 } } + { #2 }{ #3 } + } + +\cs_generate_variant:Nn \object_member_adr:nnn { Vnn } + +\cs_new:Nn \object_nconst_use:nnn + { + \cs_if_exist_use:cT { #3 _ use:c } + { + { \object_nconst_adr:nnn { #1 }{ #2 }{ #3 } } + } + } + +\cs_new:Nn \object_rconst_use:nnn + { + \cs_if_exist_use:cT { #3 _ use:c } + { + { \object_rconst_adr:nnn { #1 }{ #2 }{ #3 } } + } + } + +\cs_generate_variant:Nn \object_nconst_use:nnn { Vnn } +\cs_generate_variant:Nn \object_rconst_use:nnn { Vnn } + + +\cs_new_protected:Nn \__rawobjects_const_create:nnnn + { + \use:c { #1 _ const:cn } + { + \object_nconst_adr:nnn { #2 }{ #3 }{ #1 } + } + { #4 } + } + +\cs_new_protected:Nn \object_newconst_tl:nnn + { + \__rawobjects_const_create:nnnn { tl }{ #1 }{ #2 }{ #3 } + } +\cs_new_protected:Nn \object_newconst_str:nnn + { + \__rawobjects_const_create:nnnn { str }{ #1 }{ #2 }{ #3 } + } +\cs_new_protected:Nn \object_newconst_int:nnn + { + \__rawobjects_const_create:nnnn { int }{ #1 }{ #2 }{ #3 } + } +\cs_new_protected:Nn \object_newconst_clist:nnn + { + \__rawobjects_const_create:nnnn { clist }{ #1 }{ #2 }{ #3 } + } +\cs_new_protected:Nn \object_newconst_dim:nnn + { + \__rawobjects_const_create:nnnn { dim }{ #1 }{ #2 }{ #3 } + } +\cs_new_protected:Nn \object_newconst_skip:nnn + { + \__rawobjects_const_create:nnnn { skip }{ #1 }{ #2 }{ #3 } + } +\cs_new_protected:Nn \object_newconst_fp:nnn + { + \__rawobjects_const_create:nnnn { fp }{ #1 }{ #2 }{ #3 } + } + +\cs_generate_variant:Nn \object_newconst_tl:nnn { Vnn } +\cs_generate_variant:Nn \object_newconst_str:nnn { Vnn } +\cs_generate_variant:Nn \object_newconst_int:nnn { Vnn } +\cs_generate_variant:Nn \object_newconst_clist:nnn { Vnn } +\cs_generate_variant:Nn \object_newconst_dim:nnn { Vnn } +\cs_generate_variant:Nn \object_newconst_skip:nnn { Vnn } +\cs_generate_variant:Nn \object_newconst_fp:nnn { Vnn } + + +\cs_new_protected:Nn \object_newconst_seq_from_clist:nnn + { + \seq_const_from_clist:cn + { + \object_nconst_adr:nnn { #1 }{ #2 }{ seq } + } + { #3 } + } + +\cs_generate_variant:Nn \object_newconst_seq_from_clist:nnn { Vnn } + + +\cs_new_protected:Nn \object_newconst_prop_from_keyval:nnn + { + \prop_const_from_keyval:cn + { + \object_nconst_adr:nnn { #1 }{ #2 }{ prop } + } + { #3 } + } + +\cs_generate_variant:Nn \object_newconst_prop_from_keyval:nnn { Vnn } + \str_const:Nx \c_proxy_address_str - { \object_address:nn { lt3rawobjects }{ proxy } } -\str_const:cn { \__objpriv_object_modvar:V \c_proxy_address_str } - { lt3rawobjects } -\str_const:cV { \__objpriv_object_pxyvar:V \c_proxy_address_str } + { \object_address:nn { rawobjects }{ proxy } } +\str_const:cn { \__rawobjects_object_modvar:V \c_proxy_address_str } + { rawobjects } +\str_const:cV { \__rawobjects_object_pxyvar:V \c_proxy_address_str } \c_proxy_address_str -\str_const:cV { \__objpriv_object_scovar:V \c_proxy_address_str } - \c__objpriv_const_str -\str_const:cV { \__objpriv_object_visvar:V \c_proxy_address_str } +\str_const:cV { \__rawobjects_object_scovar:V \c_proxy_address_str } + \c__rawobjects_const_str +\str_const:cV { \__rawobjects_object_visvar:V \c_proxy_address_str } \c_object_public_str \cs_generate_variant:Nn \seq_const_from_clist:Nn { cx } @@ -291,40 +407,41 @@ \prg_new_conditional:Nnn \object_if_proxy:n {p, T, F, TF} { - \str_if_eq:cNTF { \__objpriv_object_pxyvar:n { #1 } } \c_proxy_address_str - { - \prg_return_true: - } - { - \prg_return_false: - } + \str_if_eq:cNTF { \__rawobjects_object_pxyvar:n { #1 } } + \c_proxy_address_str + { + \prg_return_true: + } + { + \prg_return_false: + } } \msg_new:nnn { aa }{ mess }{ #1 } -\msg_new:nnnn { lt3rawobjects }{ notproxy }{ Fake ~ proxy } +\msg_new:nnnn { rawobjects }{ notproxy }{ Fake ~ proxy } { Object ~ #1 ~ is ~ not ~ a ~ proxy. } -\cs_new_protected:Nn \__objpriv_force_proxy:n +\cs_new_protected:Nn \__rawobjects_force_proxy:n { \object_if_proxy:nF { #1 } { - \msg_error:nnn { lt3rawobjects }{ notproxy }{ #1 } + \msg_error:nnn { rawobjects }{ notproxy }{ #1 } } } -\cs_new_protected:Nn \__objpriv_create_anon:nnnNN +\cs_new_protected:Nn \__rawobjects_create_anon:nnnNN { - \__objpriv_force_proxy:n { #1 } + \__rawobjects_force_proxy:n { #1 } - \str_const:cn { \__objpriv_object_modvar:n { #2 } }{ #3 } - \str_const:cx { \__objpriv_object_pxyvar:n { #2 } }{ #1 } - \str_const:cV { \__objpriv_object_scovar:n { #2 } } #4 - \str_const:cV { \__objpriv_object_visvar:n { #2 } } #5 + \str_const:cn { \__rawobjects_object_modvar:n { #2 } }{ #3 } + \str_const:cx { \__rawobjects_object_pxyvar:n { #2 } }{ #1 } + \str_const:cV { \__rawobjects_object_scovar:n { #2 } } #4 + \str_const:cV { \__rawobjects_object_visvar:n { #2 } } #5 \seq_map_inline:cn { @@ -340,7 +457,7 @@ \cs_new_protected:Nn \object_create:nnnNN { - \__objpriv_create_anon:nnnNN { #1 }{ \object_address:nn { #2 }{ #3 } } + \__rawobjects_create_anon:nnnNN { #1 }{ \object_address:nn { #2 }{ #3 } } { #2 } #4 #5 } @@ -361,6 +478,66 @@ \cs_generate_variant:Nn \object_create_gset:NnnnNN { NVnnNN } +\cs_new:Nn \__rawobjects_combine:nn + { + anon . #2 . #1 + } + +\cs_generate_variant:Nn \__rawobjects_combine:nn { Vn } + +\cs_new_protected:Nn \object_allocate_incr:NNnnNN + { + \object_create_set:NnnnNN #1 { #3 }{ #4 } + { + \__rawobjects_combine:Vn #2 { #3 } + } + #5 #6 + + \int_incr:N #2 + } + +\cs_new_protected:Nn \object_gallocate_incr:NNnnNN + { + \object_create_gset:NnnnNN #1 { #3 }{ #4 } + { + \__rawobjects_combine:Vn #2 { #3 } + } + #5 #6 + + \int_incr:N #2 + } + +\cs_generate_variant:Nn \object_allocate_incr:NNnnNN { NNVnNN } + +\cs_generate_variant:Nn \object_gallocate_incr:NNnnNN { NNVnNN } + +\cs_new_protected:Nn \object_allocate_gincr:NNnnNN + { + \object_create_set:NnnnNN #1 { #3 }{ #4 } + { + \__rawobjects_combine:Vn #2 { #3 } + } + #5 #6 + + \int_gincr:N #2 + } + +\cs_new_protected:Nn \object_gallocate_gincr:NNnnNN + { + \object_create_gset:NnnnNN #1 { #3 }{ #4 } + { + \__rawobjects_combine:Vn #2 { #3 } + } + #5 #6 + + \int_gincr:N #2 + } + +\cs_generate_variant:Nn \object_allocate_gincr:NNnnNN { NNVnNN } + +\cs_generate_variant:Nn \object_gallocate_gincr:NNnnNN { NNVnNN } + + \cs_new_protected:Nn \proxy_create:nnN { \object_create:VnnNN \c_proxy_address_str { #1 }{ #2 } @@ -381,7 +558,7 @@ \cs_new_protected:Nn \proxy_push_member:nnn { - \__objpriv_force_scope:n { #1 } + \__rawobjects_force_scope:n { #1 } \object_new_member:nnn { #1 }{ #2 _ type }{ str } \str_set:cn { @@ -403,7 +580,7 @@ { \object_member_adr:vnn { - \__objpriv_object_pxyvar:n { #1 } + \__rawobjects_object_pxyvar:n { #1 } } { varlist }{ seq } } @@ -417,6 +594,33 @@ \cs_generate_variant:Nn \object_assign:nn { nV, Vn, VV } +\cs_new_protected:Nn \rawobjects_fwl_inst:n + { + \object_if_exist:nF + { + \object_address:nn { rawobjects }{ fwl ! #1 } + } + { + \proxy_create:nnN { rawobjects }{ fwl ! #1 } \c_object_private_str + \proxy_push_member + { + \object_address:nn { rawobjects }{ fwl ! #1 } + } + { next }{ str } + } + } + +\cs_new_protected:Nn \rawobjects_fwl_newnode:nnnNN + { + \rawobjects_fwl_inst:n { #1 } + \object_create:nnnNN + { + \object_address:nn { rawobjects }{ fwl ! #1 } + } + { #2 }{ #3 } #4 #5 + } + + \endinput %% %% End of file `lt3rawobjects.sty'. |