From cf8a0db51f662fd607e26d22b5d724c2e1d4df04 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Thu, 30 Jun 2022 20:38:41 +0000
Subject: lt3rawobjects (30jun22)

git-svn-id: svn://tug.org/texlive/trunk@63766 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/latex/lt3rawobjects/lt3rawobjects.sty      | 422 +++++++++++++++++++++
 1 file changed, 422 insertions(+)
 create mode 100644 Master/texmf-dist/tex/latex/lt3rawobjects/lt3rawobjects.sty

(limited to 'Master/texmf-dist/tex/latex/lt3rawobjects/lt3rawobjects.sty')

diff --git a/Master/texmf-dist/tex/latex/lt3rawobjects/lt3rawobjects.sty b/Master/texmf-dist/tex/latex/lt3rawobjects/lt3rawobjects.sty
new file mode 100644
index 00000000000..11ef07f1901
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/lt3rawobjects/lt3rawobjects.sty
@@ -0,0 +1,422 @@
+%%
+%% This is file `lt3rawobjects.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lt3rawobjects.dtx  (with options: `package')
+%% 
+%% This is a generated file.
+%% 
+%% lt3rawobjects Object oriented programming in LaTeX3
+%% Copyright (C) 2022  Paolo De Donato <dedonato95@hotmail.it>
+%% 
+%% lt3rawobjects is free software: you can redistribute it and/or modify
+%% it under the terms of the GNU General Public License as published by
+%% the Free Software Foundation, either version 3 of the License, or
+%% (at your option) any later version.
+%% 
+%% lt3rawobjects is distributed in the hope that it will be useful,
+%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+%% GNU General Public License for more details.
+%% 
+%% You should have received a copy of the GNU General Public License
+%% along with lt3rawobjects.  If not, see <https://www.gnu.org/licenses/>.
+%% 
+\NeedsTeXFormat{LaTeX2e}
+\RequirePackage{expl3}[2022-04-10]
+\ProvidesExplPackage{lt3rawobjects}{2022/06/30}{ 1.0.2 }{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}
+\cs_new:Nn \object_address:nn {
+  \tl_to_str:n { #1  _  #2 }
+}
+\cs_new:Nn \__objpriv_object_modvar:n{
+  c __ #1 _ MODULE _ str
+}
+
+\cs_new:Nn \__objpriv_object_pxyvar:n{
+  c __ #1 _ PROXY _ str
+}
+
+\cs_new:Nn \__objpriv_object_scovar:n{
+  c __ #1 _ SCOPE _ str
+}
+
+\cs_new:Nn \__objpriv_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 }
+
+
+\prg_new_conditional:Nnn \object_if_exist:n { p, T, F, TF }
+  {
+    \cs_if_exist:cTF
+      {
+        \__objpriv_object_modvar:n { #1 }
+      }
+      {
+        \prg_return_true:
+      }
+      {
+        \prg_return_false:
+      }
+  }
+
+\prg_generate_conditional_variant:Nnn \object_if_exist:n { V }
+  { p, T, F, TF }
+
+\cs_new:Nn \object_get_module:n {
+  \str_use:c { \__objpriv_object_modvar:n { #1 } }
+}
+\cs_new:Nn \object_get_proxy_adr:n {
+  \str_use:c { \__objpriv_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:
+  }
+}
+
+\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
+  {
+    \prg_return_true:
+  }
+  {
+    \prg_return_false:
+  }
+}
+
+\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
+  {
+    \prg_return_true:
+  }
+  {
+    \prg_return_false:
+  }
+}
+
+\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
+  {
+    \prg_return_true:
+  }
+  {
+    \prg_return_false:
+  }
+}
+
+\prg_generate_conditional_variant:Nnn \object_if_local:n { V }
+  { p, T, F, TF }
+\prg_generate_conditional_variant:Nnn \object_if_global:n { V }
+  { p, T, F, TF }
+\prg_generate_conditional_variant:Nnn \object_if_public:n { V }
+  { p, T, F, TF }
+\prg_generate_conditional_variant:Nnn \object_if_private:n { V }
+  { p, T, F, TF }
+
+\cs_new:Nn \__objpriv_scope:n
+  {
+    \object_if_global:nTF { #1 }
+      {
+        g
+      }
+      {
+        \str_if_eq:cNTF { \__objpriv_object_scovar:n { #1 } }
+          \c__objpriv_const_str
+          {
+            c
+          }
+          {
+            l
+          }
+      }
+  }
+
+\cs_new:Nn \object_member_adr:nnn
+  {
+    \__objpriv_scope:n { #1 }
+    \object_if_private:nTF { #1 }
+      {
+        __
+      }
+      {
+        _
+      }
+    #1 \tl_to_str:n { _ MEMBER _ #2 _ #3 }
+  }
+
+\cs_generate_variant:Nn \object_member_adr:nnn { Vnn, vnn, nnv }
+
+\cs_new:Nn \object_member_adr:nn
+  {
+    \object_member_adr:nnv { #1 }{ #2 }
+      {
+        \object_member_adr:vnn { \__objpriv_object_pxyvar:n { #1 } }
+          { #2 _ type }{ str }
+      }
+  }
+
+\cs_generate_variant:Nn \object_member_adr:nn { Vn }
+
+\cs_new:Nn \object_member_type:nn
+  {
+    \object_member_use:vnn { \__objpriv_object_pxyvar:n { #1 } }
+      { #2 _ type }{ str }
+  }
+
+
+\msg_new:nnnn { lt3rawobjects }{ 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
+  {
+    \bool_if:nF
+      {
+        \object_if_local_p:n { #1 } || \object_if_global_p:n { #1 }
+      }
+      {
+        \msg_error:nnx { lt3rawobjects }{ scoperr }{ #1 }
+      }
+  }
+
+
+\cs_new_protected:Nn \object_new_member:nnn
+  {
+    \__objpriv_force_scope:n { #1 }
+    \cs_if_exist_use:cT { #3 _ new:c }
+      {
+        { \object_member_adr:nnn { #1 }{ #2 }{ #3 } }
+      }
+  }
+
+\cs_generate_variant:Nn \object_new_member:nnn { Vnn, nnv }
+
+
+\cs_new:Nn \object_member_use:nnn
+  {
+    \cs_if_exist_use:cT { #3 _ use:c }
+      {
+        { \object_member_adr:nnn { #1 }{ #2 }{ #3 } }
+      }
+  }
+
+\cs_new:Nn \object_member_use:nn
+  {
+    \object_member_use:nnv { #1 }{ #2 }
+      {
+        \object_member_adr:vnn { \__objpriv_object_pxyvar:n { #1 } }
+          { #2 _ type }{ str }
+      }
+  }
+
+\cs_generate_variant:Nn \object_member_use:nnn { Vnn, vnn, nnv }
+\cs_generate_variant:Nn \object_member_use:nn { Vn }
+
+
+\cs_new_protected:Nn \object_member_set_eq:nnnN
+  {
+    \__objpriv_force_scope:n { #1 }
+    \cs_if_exist_use:cT
+      {
+        #3 _ \object_if_global:nT { #1 }{ g } set _ eq:cN
+      }
+      {
+        { \object_member_adr:nnn { #1 }{ #2 }{ #3 } } #4
+      }
+  }
+
+\cs_generate_variant:Nn \object_member_set_eq:nnnN { VnnN, nnnc, Vnnc, nnvN }
+
+\cs_new_protected:Nn \object_member_set_eq:nnN
+  {
+    \object_member_set_eq:nnvN { #1 }{ #2 }
+      {
+        \object_member_adr:vnn { \__objpriv_object_pxyvar:n { #1 } }
+          { #2 _ type }{ str }
+      } #3
+  }
+
+\cs_generate_variant:Nn \object_member_set_eq:nnN { VnN, nnc, Vnc }
+
+\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 }
+  \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 }
+  \c_object_public_str
+
+\cs_generate_variant:Nn \seq_const_from_clist:Nn { cx }
+
+\seq_const_from_clist:cn
+  {
+    \object_member_adr:Vnn \c_proxy_address_str { varlist }{ seq }
+  }
+  { varlist }
+
+\str_const:cn
+  {
+    \object_member_adr:Vnn \c_proxy_address_str { varlist_type }{ str }
+  }
+  { seq }
+
+\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:
+    }
+  }
+
+
+\msg_new:nnn { aa }{ mess }{ #1 }
+
+\msg_new:nnnn { lt3rawobjects }{ notproxy }{ Fake ~ proxy }
+  {
+    Object ~ #1 ~ is ~ not ~ a ~ proxy.
+  }
+
+\cs_new_protected:Nn \__objpriv_force_proxy:n
+  {
+    \object_if_proxy:nF { #1 }
+      {
+        \msg_error:nnn { lt3rawobjects }{ notproxy }{ #1 }
+      }
+  }
+
+\cs_new_protected:Nn \__objpriv_create_anon:nnnNN
+  {
+
+    \__objpriv_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
+
+    \seq_map_inline:cn
+      {
+        \object_member_adr:nnn { #1 }{ varlist }{ seq }
+      }
+      {
+        \object_new_member:nnv { #2 }{ ##1 }
+          {
+            \object_member_adr:nnn { #1 }{ ##1 _ type }{ str }
+          }
+      }
+  }
+
+\cs_new_protected:Nn \object_create:nnnNN
+  {
+    \__objpriv_create_anon:nnnNN { #1 }{ \object_address:nn { #2 }{ #3 } }
+      { #2 } #4 #5
+  }
+
+\cs_new_protected:Nn \object_create_set:NnnnNN
+  {
+    \object_create:nnnNN { #2 }{ #3 }{ #4 } #5 #6
+    \str_set:Nx #1 { \object_address:nn { #3 }{ #4 } }
+  }
+
+\cs_new_protected:Nn \object_create_gset:NnnnNN
+  {
+    \object_create:nnnNN { #2 }{ #3 }{ #4 } #5 #6
+    \str_gset:Nx #1 { \object_address:nn { #3 }{ #4 } }
+  }
+
+\cs_generate_variant:Nn \object_create:nnnNN { VnnNN }
+\cs_generate_variant:Nn \object_create_set:NnnnNN { NVnnNN }
+\cs_generate_variant:Nn \object_create_gset:NnnnNN { NVnnNN }
+
+
+\cs_new_protected:Nn \proxy_create:nnN
+  {
+    \object_create:VnnNN \c_proxy_address_str { #1 }{ #2 }
+      \c_object_global_str #3
+  }
+
+\cs_new_protected:Nn \proxy_create_set:NnnN
+  {
+    \object_create_set:NVnnNN #1 \c_proxy_address_str { #2 }{ #3 }
+      \c_object_global_str #4
+  }
+
+\cs_new_protected:Nn \proxy_create_gset:NnnN
+  {
+    \object_create_gset:NVnnNN #1 \c_proxy_address_str { #2 }{ #3 }
+      \c_object_global_str #4
+  }
+
+\cs_new_protected:Nn \proxy_push_member:nnn
+  {
+    \__objpriv_force_scope:n { #1 }
+    \object_new_member:nnn { #1 }{ #2 _ type }{ str }
+    \str_set:cn
+      {
+        \object_member_adr:nnn { #1 }{ #2 _ type }{ str }
+      }
+      { #3 }
+    \seq_gput_left:cn
+      {
+        \object_member_adr:nnn { #1 }{ varlist }{ seq }
+      }
+      { #2 }
+  }
+
+\cs_generate_variant:Nn \proxy_push_member:nnn { Vnn }
+
+\cs_new_protected:Nn \object_assign:nn
+  {
+    \seq_map_inline:cn
+      {
+        \object_member_adr:vnn
+          {
+            \__objpriv_object_pxyvar:n { #1 }
+          }
+          { varlist }{ seq }
+      }
+      {
+        \object_member_set_eq:nnc { #1 }{ ##1 }
+          {
+            \object_member_adr:nn{ #2 }{ ##1 }
+          }
+      }
+  }
+
+\cs_generate_variant:Nn \object_assign:nn { nV, Vn, VV }
+
+\endinput
+%%
+%% End of file `lt3rawobjects.sty'.
-- 
cgit v1.2.3

