texlive[64834] Master/texmf-dist: eolang (27oct22)

commits+karl at tug.org commits+karl at tug.org
Thu Oct 27 22:07:43 CEST 2022


Revision: 64834
          http://tug.org/svn/texlive?view=revision&revision=64834
Author:   karl
Date:     2022-10-27 22:07:43 +0200 (Thu, 27 Oct 2022)
Log Message:
-----------
eolang (27oct22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/eolang/DEPENDS.txt
    trunk/Master/texmf-dist/doc/latex/eolang/README.md
    trunk/Master/texmf-dist/doc/latex/eolang/eolang.pdf
    trunk/Master/texmf-dist/source/latex/eolang/eolang.dtx
    trunk/Master/texmf-dist/tex/latex/eolang/eolang.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/eolang/eolang.bib

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/eolang/main.bib

Modified: trunk/Master/texmf-dist/doc/latex/eolang/DEPENDS.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/eolang/DEPENDS.txt	2022-10-27 14:06:15 UTC (rev 64833)
+++ trunk/Master/texmf-dist/doc/latex/eolang/DEPENDS.txt	2022-10-27 20:07:43 UTC (rev 64834)
@@ -4,4 +4,8 @@
 hard iexec
 hard pgf
 hard fancyvrb
-hard pgfopts
\ No newline at end of file
+hard pgfopts
+hard pdftexcmds
+hard ifluatex
+hard ifxetex
+hard adjustbox

Modified: trunk/Master/texmf-dist/doc/latex/eolang/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/eolang/README.md	2022-10-27 14:06:15 UTC (rev 64833)
+++ trunk/Master/texmf-dist/doc/latex/eolang/README.md	2022-10-27 20:07:43 UTC (rev 64834)
@@ -1,5 +1,5 @@
 [![l3build](https://github.com/objectionary/eolang.sty/actions/workflows/l3build.yml/badge.svg)](https://github.com/objectionary/eolang.sty/actions/workflows/l3build.yml)
-[![CTAN](https://img.shields.io/ctan/v/eolang.sty)](https://ctan.org/pkg/eolang.sty)
+[![CTAN](https://img.shields.io/ctan/v/eolang)](https://ctan.org/pkg/eolang)
 [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/objectionary/eolang.sty/blob/master/LICENSE.txt)
 
 This LaTeX package helps you write 𝜑-calculus formulas and
@@ -16,12 +16,14 @@
 \begin{document}
 \begin{phiquation}
 x -> [
-  \varphi -> |foo|(5),
+  @ -> |foo|(5),
   y -> [ \lambda -> M_1 ]].
 \end{phiquation}
 \end{document}
 ```
 
+Otherwise, you can download [`eolang.sty`](https://raw.githubusercontent.com/objectionary/eolang.sty/gh-pages/eolang/eolang.sty) and add to your project.
+
 If you want to contribute yourself, make a fork, then create a branch, 
 then run `l3build ctan` in the root directory.
 It should compile everything without errors. If not, submit an issue and wait.

Added: trunk/Master/texmf-dist/doc/latex/eolang/eolang.bib
===================================================================
--- trunk/Master/texmf-dist/doc/latex/eolang/eolang.bib	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/eolang/eolang.bib	2022-10-27 20:07:43 UTC (rev 64834)
@@ -0,0 +1,26 @@
+ at misc{bugayenko2021eolang,
+  title={EOLANG and $\varphi$-calculus},
+  author={Yegor Bugayenko},
+  year={2021},
+  eprint={2111.13384},
+  archivePrefix={arXiv},
+  primaryClass={cs.PL}
+}
+
+ at misc{bugayenko2022origins,
+  title={On the Origins of Objects by Means of Careful Selection},
+  author={Yegor Bugayenko},
+  year={2022},
+  eprint={2206.02585},
+  archivePrefix={arXiv},
+  primaryClass={cs.PL}
+}
+
+ at misc{kudasov2021,
+  author = {Kudasov, Nikolai and Kim, Violetta},
+  title = {$\varphi$-calculus: a purely object-oriented calculus of decorated objects},
+  year = 2022,
+  eprint={2204.07454},
+  archivePrefix={arXiv},
+  primaryClass={cs.PL}
+}


Property changes on: trunk/Master/texmf-dist/doc/latex/eolang/eolang.bib
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/eolang/eolang.pdf
===================================================================
(Binary files differ)

Deleted: trunk/Master/texmf-dist/doc/latex/eolang/main.bib
===================================================================
--- trunk/Master/texmf-dist/doc/latex/eolang/main.bib	2022-10-27 14:06:15 UTC (rev 64833)
+++ trunk/Master/texmf-dist/doc/latex/eolang/main.bib	2022-10-27 20:07:43 UTC (rev 64834)
@@ -1,26 +0,0 @@
- at misc{bugayenko2021eolang,
-  title={EOLANG and $\varphi$-calculus},
-  author={Yegor Bugayenko},
-  year={2021},
-  eprint={2111.13384},
-  archivePrefix={arXiv},
-  primaryClass={cs.PL}
-}
-
- at misc{bugayenko2022origins,
-  title={On the Origins of Objects by Means of Careful Selection},
-  author={Yegor Bugayenko},
-  year={2022},
-  eprint={2206.02585},
-  archivePrefix={arXiv},
-  primaryClass={cs.PL}
-}
-
- at misc{kudasov2021,
-  author = {Kudasov, Nikolai and Kim, Violetta},
-  title = {$\varphi$-calculus: a purely object-oriented calculus of decorated objects},
-  year = 2022,
-  eprint={2204.07454},
-  archivePrefix={arXiv},
-  primaryClass={cs.PL}
-}

Modified: trunk/Master/texmf-dist/source/latex/eolang/eolang.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/eolang/eolang.dtx	2022-10-27 14:06:15 UTC (rev 64833)
+++ trunk/Master/texmf-dist/source/latex/eolang/eolang.dtx	2022-10-27 20:07:43 UTC (rev 64834)
@@ -50,15 +50,17 @@
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{eolang}
 %<*package>
-[2022-10-25 0.0.2 Formulas and Graphs for EO Programming Language]
+[2022-10-27 0.1.0 Formulas and Graphs for EO Programming Language]
 %</package>
 %<*driver>
 \documentclass{ltxdoc}
 \usepackage[maxnames=1,minnames=1,maxbibnames=1,natbib=true,citestyle=authoryear,bibstyle=authoryear,doi=false,url=false,isbn=false,isbn=false]{biblatex}
-\addbibresource{main.bib}
+\addbibresource{eolang.bib}
 \usepackage[tt=false, type1=true]{libertine}
 \usepackage{microtype}
+\AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}}
 \usepackage{graphicx}
+\usepackage{xcolor}
 \usepackage[runs=1,dtx]{docshots}
 \usepackage{eolang}
 \usepackage{href-ul}
@@ -80,9 +82,10 @@
 %
 % \maketitle
 %
-% \textbf{NB!}
+% \textbf{\color{red}NB!}
 % You must run \TeX{} processor with |--shell-escape| option
 % and you must have \href{https://www.perl.org}{Perl} installed.
+% This package doesn't work on Windows.
 
 % \section{Introduction}
 %
@@ -101,9 +104,8 @@
 %   ^ !-> $.b,
 %   b -> [[ c -> |fn|(56),
 %     @ -> |hello|($),
-%     \Delta ~> |01-FE-C3| ]]]],
-
-% x -> [[ \alpha_0 -> ? ]]
+%     \Delta ..> |01-FE-C3| ]]]],\\
+% x -> [[ \alpha_0 -> ? ]].
 % \end{phiquation*}
 % \end{document}
 % \end{docshot}
@@ -124,10 +126,10 @@
 %     (|\varnothing|),
 %   \item ``|->|'' maps to ``$\mapsto$''
 %     (|\mapsto|),
-%   \item ``|!->|'' maps to ``$\mapstochar\relbar\mathrel{\mkern-12mu}\mapsto$''
-%     (|\mapstochar\relbar\mathrel{\mkern-12mu}\mapsto|),
-%   \item ``|~>|'' maps to ``$\mapstochar\dashrightarrow$''
-%     (|\mapstochar\dashrightarrow|),
+%   \item ``|!->|'' maps to ``$\phiConst$''
+%     (|\phiConst|),
+%   \item ``|..>|'' maps to ``$\phiDotted$''
+%     (|\phiDotted|),
 %   \item ``|[[|'' maps to ``$\llbracket$''
 %     (|\llbracket|),
 %   \item ``|]]|'' maps to ``$\rrbracket$''
@@ -148,15 +150,14 @@
 % using the same simple plain-text notation:
 % \begin{docshot}
 % \documentclass{article}
-% \usepackage[paperwidth=2in]{geometry}
 % \pagestyle{empty}
 % \usepackage{eolang}
 % \begin{document}
-% A simple object
-% \phiq{x -> [[@ -> y]]}
-% is a decorator of
-% the data object
-% \phiq{y -> [[\Delta ~> 42]]}.
+% A simple object \\
+% \phiq{x -> [[@ -> y]]} \\
+% is a decorator of \\
+% the data object \\
+% \phiq{y -> [[\Delta ..> 42]]}.
 % \end{document}
 % \end{docshot}
 
@@ -198,72 +199,259 @@
 %   \item ``|pi|'' makes it dotted, with $\pi$ label.
 % \end{itemize}
 
+% \DescribeMacro{\eolang}
+% \DescribeMacro{\phic}
+% There is also a no-argument command |\eolang| to help you print the name of
+% \eolang{} language. It understands |anonymous| mode of \href{https://ctan.org/pkg/acmart}{acmart} and prints itself
+% differently, to double-blind your paper. There is also |\phic| command to print
+% the name of \phic{}, also sensitive to |anonymous| mode.
+% \begin{docshot}
+% \documentclass[anonymous]{acmart}
+% \thispagestyle{empty}
+% \usepackage{eolang}
+% \begin{document}
+% In our research we use \eolang{}, \\
+% an experimental object-oriented \\
+% dataflow language, and \phic{}, \\
+% its formal foundation.
+% \end{document}
+% \end{docshot}
+
+% \DescribeMacro{\phiConst}
+% A simple commands is defined to help you render an arrow for a constant attribute.
+% It is recommende not to use it directly, but use |!->| instead. However, if you
+% want to use |\phiConst|, wrap it in |\mathrel| for better display:
+% \begin{docshot}
+% \documentclass{article}
+% \pagestyle{empty}
+% \usepackage{eolang}
+% \begin{document}
+% \phiq{[[ x \mathrel{\phiConst} y ]]}
+% \end{document}
+% \end{docshot}
+
+% \section{Package Options}
+
+% \DescribeMacro{tmpdir}
+% The default location of temp files is |_eolang|. You can change this using |tmpdir| option:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+\usepackage[tmpdir=/tmp/foo]{eolang}
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
+
+% \section{More Examples}
+
+% The |phiquation| environment treats ends of line as signals to start
+% new lines in the formula. If you don't want this to happen and want to parse
+% the next line as the a continuation of the current line, you can use a single
+% backslash as it's done here:
+% \begin{docshot}
+% \documentclass{article}
+% \usepackage{amsmath}
+% \usepackage{eolang}
+% \pagestyle{empty}
+% \begin{document}
+% \begin{phiquation*}
+% \dfrac \
+%  {x->[[@->y]] \quad y->[[z->|42|]]} \
+%  {x.z -> |42|} \
+%  \text{\sffamily R1}
+% \end{phiquation*}
+% \end{document}
+% \end{docshot}
+
+% The |phiquation| environment may be used together with \href{https://ctan.org/pkg/acmart}{acmart}:
+% \begin{docshot}
+% \documentclass{acmart}
+% \usepackage{eolang}
+% \thispagestyle{empty}
+% \begin{document}
+% \begin{phiquation*}
+% x -> [[
+%   y -> [[
+%     z !-> $, f ..> ? ]]]],\\
+% \beta_1 := [ \psi -wait> ? ].
+% \end{phiquation*}
+% \end{document}
+% \end{docshot}
+
+% The |phiquation| environment will automatically align formulas by the first
+% arrow, if there are only left-aligned formulas:
+% \begin{docshot}
+% \documentclass{acmart}
+% \usepackage{eolang}
+% \thispagestyle{empty}
+% \begin{document}
+% \begin{phiquation*}
+% x(\pi) -> [[\lambda ..> f_1]], \\
+% x(a,b,c) -> [[ \alpha_0 -> ?, \
+%   @ -> |hello|($) ]], \\
+% \Delta = |43-09|.
+% \end{phiquation*}
+% \end{document}
+% \end{docshot}
+
 % \StopEventually{}
 
 % \section{Implementation}
+% \changes{0.0.1}{2022/10/15}{First draft.}
 
-% First, we include a few packages:
+% First, we include a few packages.
+% We need \href{https://ctan.org/pkg/stmaryrd}{stmaryrd} for |\llbracket| and |\rrbracket| commands:
 %    \begin{macrocode}
 \RequirePackage{stmaryrd}
+%    \end{macrocode}
+% We need \href{https://ctan.org/pkg/amsmath}{amsmath} for |equation*| environment:
+%    \begin{macrocode}
 \RequirePackage{amsmath}
-\RequirePackage{amssymb}
-\RequirePackage{amsfonts}
-\RequirePackage{iexec}
+%    \end{macrocode}
+% We need \href{https://ctan.org/pkg/amssymb}{amssymb} for |\varnothing| command. We disable |\Bbbk|
+% because it may conflict with some packages from \href{https://ctan.org/pkg/acmart}{acmart}:
+%    \begin{macrocode}
+\let\Bbbk\relax\RequirePackage{amssymb}
+%    \end{macrocode}
+% We need \href{https://ctan.org/pkg/fancyvrb}{fancyvrb} for |\VerbatimEnvironment| command:
+%    \begin{macrocode}
 \RequirePackage{fancyvrb}
 %    \end{macrocode}
+% We need \href{https://ctan.org/pkg/iexec}{iexec} for executing Perl scripts:
+%    \begin{macrocode}
+\RequirePackage{iexec}
+%    \end{macrocode}
 
-% \begin{macro}{\eolang at env}
+% Then, we process package options:
+% \changes{0.1.0}{2022/10/26}{Parsing of package options introduced.}
+%    \begin{macrocode}
+\RequirePackage{pgfopts}
+\RequirePackage{ifluatex}
+\RequirePackage{ifxetex}
+\pgfkeys{
+  /eolang/.cd,
+  tmpdir/.store in=\eolang at tmpdir,
+  tmpdir/.default=_eolang\ifxetex-xe\else\ifluatex-lua\fi\fi,
+  tmpdir
+}
+\ProcessPgfOptions{/eolang}
+%    \end{macrocode}
+
+% Then, we make a directory where all temporary files will be kept:
+%    \begin{macrocode}
+\iexec[null]{mkdir -p "\eolang at tmpdir/\jobname"}%
+%    \end{macrocode}
+
+% \begin{macro}{\eolang at mdfive}
+% \changes{0.1.0}{2022/10/26}{New supplementary command added to calculate MD5 sum of a file.}
+% Then, we define a command for MD5 hash calculating of a file:
+%    \begin{macrocode}
+\RequirePackage{pdftexcmds}
+\makeatletter\newcommand\eolang at mdfive[1]{\pdf at filemdfivesum{#1}}\makeatother
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{eolang-phi.pl}
 % \changes{0.0.2}{2022/10/21}{The symbols ``['' and ``]'' replaced with ``[['' and ``]]'' for abstract object brackets, because they conflicted with normal square brackets}
 % \changes{0.0.2}{2022/10/21}{New symbol added for basket slots}
 % \changes{0.0.2}{2022/10/21}{Parsing of symbols ``@,'' ``\^{},'' and ``\&'' enabled (varphi, rho, and sigma)}
-% Then, we define |\eolang at env| supplementary command.
-% It is implemented with the help of |\iexec| from
-% \href{https://github.com/yegor256/iexec}{iexec} package:
+% \changes{0.1.0}{2022/10/26}{A new Perl script "eolang-phi.pl" added for parsing of phi expressions.}
+% Then, we create a Perl script for |phiquation| processing:
 %    \begin{macrocode}
-\makeatletter\newcommand\eolang at env[2]{
-  \iexec[trace]{
-    /bin/echo -n '\\begin{#1}\\begin{split} &'
-    &&
-    /bin/echo -n '\detokenize{#2}'
-      | perl -pe 's/^\\r\\+//g'
-      | perl -pe 's/\\r\\+$//g'
-      | perl -pe 's/\\?/\\\\varnothing/g'
-      | perl -pe 's/@/\\\\varphi/g'
-      | perl -pe 's/&/\\\\sigma/g'
-      | perl -pe 's/\\^/\\\\rho/g'
-      | perl -pe 's/\\$/\\\\xi/g'
-      | perl -pe 's/-([a-z]+)>/\\\\xrightarrow{\\\\text{\\\\sffamily\\\\scshape \\1}}/g'
-      | perl -pe 's/!->/\\\\mapstochar\\\\relbar\\\\mathrel{\\\\mkern-12mu}\\\\mapsto/g'
-      | perl -pe 's/->/\\\\mapsto/g'
-      | perl -pe 's/:=/\\\\vDash/g'
-      | perl -pe 's/\unexpanded{~}>/\\\\mapstochar\\\\dashrightarrow/g'
-      | perl -pe 's/\\|([^\\|]+)\\|/\\\\texttt{\\1}/g'
-      | perl -pe 's/\\[\\[/\\\\llbracket/g'
-      | perl -pe 's/\\]\\]/\\\\rrbracket/g'
-      | perl -pe 's/\\r\\r/\\\\\\\\ \&/g'
-      | perl -pe 's/\\r/\\\\\\\\[-4pt] \&/g'
-      | perl -pe 's/([^& ]) {2}([^ ])/\\1 \\2/g'
-      | perl -pe 's/ {2}/\\\\quad{}/g'
-      &&
-    /bin/echo -n '\\end{split}\\end{#1}\\endinput'
-  }%
-}\makeatother
+\makeatletter
+\begin{VerbatimOut}{\eolang at tmpdir/eolang-phi.pl}
+$env = $ARGV[0];
+open(my $fh, '<', $ARGV[1]);
+my $tex; { local $/; $tex = <$fh>; }
+print '% This file is auto-generated', "\n";
+print '% There are ', length($tex),
+  ' chars in the input: ', $ARGV[1], "\n";
+print '% ---', "\n";
+if (index($tex, "\t") > 0) {
+  print "TABS are prohibited!";
+  exit 1;
+}
+my @lines = split (/\n/g, $tex);
+foreach my $t (@lines) {
+  print '% ', $t, "\n";
+}
+print '% ---', "\n";
+if ($env eq 'phiq') {
+  print '$';
+} else {
+  print '\begin{', $env, '}\begin{split}';
+}
+$tex =~ s/^\s+|\s+$//g;
+if ($env ne 'phiq') {
+  $tex =~ s/\s+\\\n\s*//g;
+  $tex =~ s/\\\\\n/\n\n/g;
+}
+$tex =~ s/\?/\\varnothing{}/g;
+$tex =~ s/@/\\varphi{}/g;
+$tex =~ s/&/\\sigma{}/g;
+$tex =~ s/\^/\\rho{}/g;
+$tex =~ s/\$/\\xi{}/g;
+$tex =~ s/-([a-z]+)>/\\mathrel{\\xrightarrow{\\text{\\sffamily\\scshape \1}}}/g;
+$tex =~ s/!->/\\mathrel{\\phiConst}/g;
+$tex =~ s/->/\\mathrel{\\mapsto}/g;
+$tex =~ s/:=/\\mathrel{\\vDash}/g;
+$tex =~ s/..>/\\mathrel{\\phiDotted}/g;
+$tex =~ s/\|([^\|]+)\|/\\texttt{\1}{}/g;
+$tex =~ s/\[\[/\\llbracket\\mathrel{}/g;
+$tex =~ s/\]\]/\\mathrel{}\\rrbracket{}/g;
+if ($env ne 'phiq') {
+  $tex =~ s/\n\n/\\\\&/g;
+  $tex =~ s/\n/\\\\[-4pt]&/g;
+  $tex =~ s/([^&\s])\s{2}([^\s])/\1 \2/g;
+  $tex =~ s/\s{2}/ \\quad{}/g;
+  my @leads = $tex =~ /&[^\s]+\s/g;
+  my @eols = $tex =~ /&/g;
+  $tex = '&' . $tex;
+  if (0+ at leads == 0+ at eols && 0+ at eols > 0) {
+    $tex =~ s/&([^\s]+)\s/\1&/g;
+  }
+}
+print $tex;
+if ($env eq 'phiq') {
+  print '$';
+} else {
+  print '\end{split}\end{', $env, '}';
+}
+print '\endinput', "\n";
+\end{VerbatimOut}
+\message{eolang: File with Perl script
+  '\eolang at tmpdir/eolang-phi.pl' saved^^J}%
+\iexec[trace,null]{perl -pi -e 's/(\\\\[a-zA-Z])\\s+/\\1/g'
+  "\eolang at tmpdir/eolang-phi.pl"}
+\makeatother
 %    \end{macrocode}
 % \end{macro}
 
 % \begin{macro}{phiquation}
-% Then, we define |phiquation| and |phiquation*| environments:
+% Then, we define |phiquation| and |phiquation*| environments through a supplementary
+% |\eolang at process| command:
 %    \begin{macrocode}
-\makeatletter
-\NewDocumentEnvironment{phiquation*}{b}{%
-  \eolang at env{equation*}{#1}
-}{}
-\NewDocumentEnvironment{phiquation}{b}{%
-  \eolang at env{equation}{#1}
-}{}
+\makeatletter\newcommand\eolang at process[1]{
+  \def\hash{\eolang at mdfive
+    {\eolang at tmpdir/\jobname/phiquation.tex}}%
+  \iexec[null]{cp "\eolang at tmpdir/\jobname/phiquation.tex"
+    "\eolang at tmpdir/\jobname/\hash.tex"}%
+  \iexec[trace,stdout=\eolang at tmpdir/\jobname/\hash-post.tex]{
+    perl "\eolang at tmpdir/eolang-phi.pl"
+    '#1'
+    "\eolang at tmpdir/\jobname/\hash.tex"}%
+}
+\newenvironment{phiquation*}%
+{\VerbatimEnvironment\begin{VerbatimOut}
+  {\eolang at tmpdir/\jobname/phiquation.tex}}
+{\end{VerbatimOut}\eolang at process{equation*}}
+\newenvironment{phiquation}%
+{\VerbatimEnvironment\begin{VerbatimOut}
+  {\eolang at tmpdir/\jobname/phiquation.tex}}
+{\end{VerbatimOut}\eolang at process{equation}}
 \makeatother
-\AddToHook{env/phiquation*/begin}{\obeylines\obeyspaces}
-\AddToHook{env/phiquation/begin}{\obeylines\obeyspaces}
 %    \end{macrocode}
 % \end{macro}
 
@@ -271,42 +459,47 @@
 % \changes{0.0.2}{2022/10/21}{Parsing of additional symbols enabled}
 % Then, we define |\phiq| command:
 %    \begin{macrocode}
-\newcommand\phiq[1]{
-  \iexec[trace]{
-    /bin/echo -n '$'
-    &&
-    /bin/echo -n '\detokenize{#1}'
-      | perl -pe 's/\\^/\\\\rho/g'
-      | perl -pe 's/\\$/\\\\xi/g'
-      | perl -pe 's/&/\\\\sigma/g'
-      | perl -pe 's/\\?/\\\\varnothing/g'
-      | perl -pe 's/@/\\\\varphi/g'
-      | perl -pe 's/!->/\\\\mapstochar\\\\relbar\\\\mathrel{\\\\mkern-12mu}\\\\mapsto/g'
-      | perl -pe 's/->/\\\\mapsto/g'
-      | perl -pe 's/-([a-z]+)>/\\\\xrightarrow{\\\\text{\\\\sffamily\\\\scshape \\1}}/g'
-      | perl -pe 's/\unexpanded{~}>/\\\\mapstochar\\\\dashrightarrow/g'
-      | perl -pe 's/:=/\\\\vDash/g'
-      | perl -pe 's/\\[\\[/\\\\llbracket/g'
-      | perl -pe 's/\\]\\]/\\\\rrbracket/g'
-    &&
-    /bin/echo -n '$\\endinput'
-  }%
-}
+\makeatletter\newcommand\phiq[1]{
+  \iexec[trace,quiet,stdout=\eolang at tmpdir/\jobname/phiq.tex]{
+    /bin/echo '\detokenize{#1}'}
+  \def\hash{\eolang at mdfive
+    {\eolang at tmpdir/\jobname/phiq.tex}}%
+  \iexec[null]{cp "\eolang at tmpdir/\jobname/phiq.tex"
+    "\eolang at tmpdir/\jobname/\hash.tex"}%
+  \iexec[trace,stdout=\eolang at tmpdir/\jobname/\hash-post.tex]{
+    perl \eolang at tmpdir/eolang-phi.pl 'phiq'
+    "\eolang at tmpdir/\jobname/\hash.tex"}%
+}\makeatother
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{Perl}
+% \begin{macro}{eolang-sodg.pl}
 % \changes{0.0.2}{2022/10/24}{The Perl file now has a fixed name, which doesn't depend on the name of the TeX job. This file may be shared among jobs, no need to make it uniquely named.}
-% Then, create a Perl script:
+% \changes{0.1.0}{2022/10/26}{There are two Perl scripts now: one for phiquation, another one for sodg.}
+% Then, we create a Perl script for |sodg| graphs processing:
 %    \begin{macrocode}
-\begin{VerbatimOut}{eolang.pl}
-$tex = $ARGV[0];
+\makeatletter
+\begin{VerbatimOut}{\eolang at tmpdir/eolang-sodg.pl}
+open(my $fh, '<', $ARGV[0]);
+my $tex; { local $/; $tex = <$fh>; }
+print '% This file is auto-generated', "\n";
+print '% There are ', length($tex),
+  ' chars in the input: ', $ARGV[0], "\n";
+print '% ---', "\n";
+if (index($tex, "\t") > 0) {
+  print "TABS are prohibited!";
+  exit 1;
+}
 $tex =~ s/^\s+|\s+$//g;
 $tex =~ s/(\\[a-zA-Z]+)\s+/\1/g;
-$tex =~ s/\r\s+/\r/g;
+$tex =~ s/\n\s+/\n/g;
 $tex =~ s/\|([^\|]+)\|/\\texttt{\1}/g;
-my @cmds = split (/\r/g, $tex);
-print '\begin{phig}', "\n";
+my @cmds = split (/\n/g, $tex);
+foreach my $t (@cmds) {
+  print '% ', $t, "\n";
+}
+print '% ---', "\n";
+print '\begin{phicture}', "\n";
 foreach my $c (@cmds) {
   my ($head, $tail) = split (/ /, $c, 2);
   my %opts = {};
@@ -380,10 +573,13 @@
   }
   print ";\n";
 }
-print '\end{phig}', "\n", '\endinput';
+print '\end{phicture}', "\n", '\endinput';
 \end{VerbatimOut}
-\message{^^Jeolang: File with Perl script (eolang.pl) saved^^J}%
-\iexec[trace,null]{perl -pi -e 's/(\\\\[a-zA-Z])\\s+/\\1/g' eolang.pl}
+\message{eolang: File with Perl script
+  '\eolang at tmpdir/eolang-sodg.pl' saved^^J}%
+\iexec[trace,null]{perl -pi -e 's/(\\\\[a-zA-Z])\\s+/\\1/g'
+  "\eolang at tmpdir/eolang-sodg.pl"}
+\makeatother
 %    \end{macrocode}
 % \end{macro}
 
@@ -402,10 +598,10 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{phig}
-% Then, we define internal environment |phig|:
+% \begin{macro}{phicture}
+% Then, we define internal environment |phicture|:
 %    \begin{macrocode}
-\newenvironment{phig}%
+\newenvironment{phicture}%
   {\noindent\begin{tikzpicture}[
     ->,>=stealth',node distance=0,thick,
     pics/parallel arrow/.style={
@@ -438,17 +634,87 @@
 % Then, create a new environment |sodg|, as suggested
 % \href{https://tex.stackexchange.com/questions/661056}{here}:
 %    \begin{macrocode}
-\NewDocumentEnvironment{sodg}{b}{%
-  \catcode`\ =10 %
-  \catcode`\^^M=5 %
-  \iexec[trace,stdout=\jobname.tex.eolang]{
-    perl eolang.pl '\detokenize{#1}'}%
-}{}
-\AddToHook{env/sodg/before}{\bgroup\obeylines\obeyspaces}
-\AddToHook{env/sodg/after}{\egroup}
+\makeatletter\newenvironment{sodg}%
+{\VerbatimEnvironment\begin{VerbatimOut}
+  {\eolang at tmpdir/\jobname/sodg.tex}}
+{\end{VerbatimOut}%
+  \def\hash{\eolang at mdfive
+    {\eolang at tmpdir/\jobname/sodg.tex}}%
+  \iexec[null]{cp "\eolang at tmpdir/\jobname/sodg.tex"
+    "\eolang at tmpdir/\jobname/\hash.tex"}%
+  \iexec[trace,stdout=\eolang at tmpdir/\jobname/\hash-post.tex]{
+    perl "\eolang at tmpdir/eolang-sodg.pl"
+    "\eolang at tmpdir/\jobname/\hash.tex"}%
+}\makeatother
 %    \end{macrocode}
 % \end{macro}
 
+% \begin{macro}{\eolang}
+% \changes{0.1.0}{2022/10/25}{New command "eolang" added to print the name of the language in both
+% normal and anonymous mode of "acmart"}
+%    \begin{macrocode}
+\makeatletter\newcommand\eolang{%
+  \ifdefined\anon%
+    \anon[XYZ]{{\sffamily EO}}%
+  \else%
+    {\sffamily EO}%
+  \fi%
+}\makeatother
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\phic}
+% \changes{0.1.0}{2022/10/25}{New command "phic" prints the name of $\varphi$-calculus in both
+% normal and anonymous mode of "acmart"}
+%    \begin{macrocode}
+\makeatletter\newcommand\phic{%
+  \ifdefined\anon%
+    \anon[$\alpha$-calculus]{$\varphi$-calculus}%
+  \else%
+    $\varphi$-calculus%
+  \fi%
+}\makeatother
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\phiConst}
+% \changes{0.1.0}{2022/10/26}{New command "phiConst" added to denote a link to a constant attribute.}
+% Then, we define a command to render an arrow for a constant attribute,
+% as suggested \href{https://tex.stackexchange.com/questions/663121}{here}:
+%    \begin{macrocode}
+\newcommand\phiConst{%
+  \mathrel{\hspace{.15em}}\mapstochar\mathrel{\hspace{-.15em}}\mapsto}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\phiDotted}
+% \changes{0.1.0}{2022/10/27}{New command "phiDotted" added to denote a link to a special attribute.}
+% Then, we define a command to render an arrow for a special attribute,
+% as suggested \href{https://tex.stackexchange.com/questions/663176}{here}:
+%    \begin{macrocode}
+\RequirePackage{trimclip}
+\RequirePackage{amsfonts}
+\makeatletter
+\newcommand{\phiDotted}{\mapstochar\mathrel{\mathpalette\phiDotted@\relax}}
+\newcommand{\phiDotted@}[2]{%
+  \begingroup
+  \settowidth{\dimen\z@}{$\m at th#1\rightarrow$}%
+  \settoheight{\dimen\tw@}{$\m at th#1\rightarrow$}%
+  \sbox\z@{%
+    \makebox[\dimen\z@][s]{%
+      \clipbox{0 0 {0.4\width} 0}%
+        {\resizebox{\dimen\z@}{\height}%
+          {$\m at th#1\dashrightarrow$}}%
+      \hss%
+      \clipbox{{0.69\width} {-0.1\height} 0 {-\height}}{$\m at th#1\rightarrow$}%
+    }%
+  }%
+  \ht\z@=\dimen\tw@ \dp\z@=\z@%
+  \box\z@%
+  \endgroup}\makeatother
+%    \end{macrocode}
+% \end{macro}
+
 % \Finale
 
 % \clearpage

Modified: trunk/Master/texmf-dist/tex/latex/eolang/eolang.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/eolang/eolang.sty	2022-10-27 14:06:15 UTC (rev 64833)
+++ trunk/Master/texmf-dist/tex/latex/eolang/eolang.sty	2022-10-27 20:07:43 UTC (rev 64834)
@@ -31,7 +31,7 @@
 
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{eolang}
-[2022-10-25 0.0.2 Formulas and Graphs for EO Programming Language]
+[2022-10-27 0.1.0 Formulas and Graphs for EO Programming Language]
 
 
 
@@ -41,83 +41,156 @@
 
 
 
+
+
+
+
+
+
+
 \RequirePackage{stmaryrd}
 \RequirePackage{amsmath}
-\RequirePackage{amssymb}
-\RequirePackage{amsfonts}
+\let\Bbbk\relax\RequirePackage{amssymb}
+\RequirePackage{fancyvrb}
 \RequirePackage{iexec}
-\RequirePackage{fancyvrb}
 
-\makeatletter\newcommand\eolang at env[2]{
-  \iexec[trace]{
-    /bin/echo -n '\\begin{#1}\\begin{split} &'
-    &&
-    /bin/echo -n '\detokenize{#2}'
-      | perl -pe 's/^\\r\\+//g'
-      | perl -pe 's/\\r\\+$//g'
-      | perl -pe 's/\\?/\\\\varnothing/g'
-      | perl -pe 's/@/\\\\varphi/g'
-      | perl -pe 's/&/\\\\sigma/g'
-      | perl -pe 's/\\^/\\\\rho/g'
-      | perl -pe 's/\\$/\\\\xi/g'
-      | perl -pe 's/-([a-z]+)>/\\\\xrightarrow{\\\\text{\\\\sffamily\\\\scshape \\1}}/g'
-      | perl -pe 's/!->/\\\\mapstochar\\\\relbar\\\\mathrel{\\\\mkern-12mu}\\\\mapsto/g'
-      | perl -pe 's/->/\\\\mapsto/g'
-      | perl -pe 's/:=/\\\\vDash/g'
-      | perl -pe 's/\unexpanded{~}>/\\\\mapstochar\\\\dashrightarrow/g'
-      | perl -pe 's/\\|([^\\|]+)\\|/\\\\texttt{\\1}/g'
-      | perl -pe 's/\\[\\[/\\\\llbracket/g'
-      | perl -pe 's/\\]\\]/\\\\rrbracket/g'
-      | perl -pe 's/\\r\\r/\\\\\\\\ \&/g'
-      | perl -pe 's/\\r/\\\\\\\\[-4pt] \&/g'
-      | perl -pe 's/([^& ]) {2}([^ ])/\\1 \\2/g'
-      | perl -pe 's/ {2}/\\\\quad{}/g'
-      &&
-    /bin/echo -n '\\end{split}\\end{#1}\\endinput'
-  }%
-}\makeatother
+\RequirePackage{pgfopts}
+\RequirePackage{ifluatex}
+\RequirePackage{ifxetex}
+\pgfkeys{
+  /eolang/.cd,
+  tmpdir/.store in=\eolang at tmpdir,
+  tmpdir/.default=_eolang\ifxetex-xe\else\ifluatex-lua\fi\fi,
+  tmpdir
+}
+\ProcessPgfOptions{/eolang}
 
+\iexec[null]{mkdir -p "\eolang at tmpdir/\jobname"}%
+
+\RequirePackage{pdftexcmds}
+\makeatletter\newcommand\eolang at mdfive[1]{\pdf at filemdfivesum{#1}}\makeatother
+
 \makeatletter
-\NewDocumentEnvironment{phiquation*}{b}{%
-  \eolang at env{equation*}{#1}
-}{}
-\NewDocumentEnvironment{phiquation}{b}{%
-  \eolang at env{equation}{#1}
-}{}
+\begin{VerbatimOut}{\eolang at tmpdir/eolang-phi.pl}
+$env = $ARGV[0];
+open(my $fh, '<', $ARGV[1]);
+my $tex; { local $/; $tex = <$fh>; }
+print '% This file is auto-generated', "\n";
+print '% There are ', length($tex),
+  ' chars in the input: ', $ARGV[1], "\n";
+print '% ---', "\n";
+if (index($tex, "\t") > 0) {
+  print "TABS are prohibited!";
+  exit 1;
+}
+my @lines = split (/\n/g, $tex);
+foreach my $t (@lines) {
+  print '% ', $t, "\n";
+}
+print '% ---', "\n";
+if ($env eq 'phiq') {
+  print '$';
+} else {
+  print '\begin{', $env, '}\begin{split}';
+}
+$tex =~ s/^\s+|\s+$//g;
+if ($env ne 'phiq') {
+  $tex =~ s/\s+\\\n\s*//g;
+  $tex =~ s/\\\\\n/\n\n/g;
+}
+$tex =~ s/\?/\\varnothing{}/g;
+$tex =~ s/@/\\varphi{}/g;
+$tex =~ s/&/\\sigma{}/g;
+$tex =~ s/\^/\\rho{}/g;
+$tex =~ s/\$/\\xi{}/g;
+$tex =~ s/-([a-z]+)>/\\mathrel{\\xrightarrow{\\text{\\sffamily\\scshape \1}}}/g;
+$tex =~ s/!->/\\mathrel{\\phiConst}/g;
+$tex =~ s/->/\\mathrel{\\mapsto}/g;
+$tex =~ s/:=/\\mathrel{\\vDash}/g;
+$tex =~ s/..>/\\mathrel{\\phiDotted}/g;
+$tex =~ s/\|([^\|]+)\|/\\texttt{\1}{}/g;
+$tex =~ s/\[\[/\\llbracket\\mathrel{}/g;
+$tex =~ s/\]\]/\\mathrel{}\\rrbracket{}/g;
+if ($env ne 'phiq') {
+  $tex =~ s/\n\n/\\\\&/g;
+  $tex =~ s/\n/\\\\[-4pt]&/g;
+  $tex =~ s/([^&\s])\s{2}([^\s])/\1 \2/g;
+  $tex =~ s/\s{2}/ \\quad{}/g;
+  my @leads = $tex =~ /&[^\s]+\s/g;
+  my @eols = $tex =~ /&/g;
+  $tex = '&' . $tex;
+  if (0+ at leads == 0+ at eols && 0+ at eols > 0) {
+    $tex =~ s/&([^\s]+)\s/\1&/g;
+  }
+}
+print $tex;
+if ($env eq 'phiq') {
+  print '$';
+} else {
+  print '\end{split}\end{', $env, '}';
+}
+print '\endinput', "\n";
+\end{VerbatimOut}
+\message{eolang: File with Perl script
+  '\eolang at tmpdir/eolang-phi.pl' saved^^J}%
+\iexec[trace,null]{perl -pi -e 's/(\\\\[a-zA-Z])\\s+/\\1/g'
+  "\eolang at tmpdir/eolang-phi.pl"}
 \makeatother
-\AddToHook{env/phiquation*/begin}{\obeylines\obeyspaces}
-\AddToHook{env/phiquation/begin}{\obeylines\obeyspaces}
 
-\newcommand\phiq[1]{
-  \iexec[trace]{
-    /bin/echo -n '$'
-    &&
-    /bin/echo -n '\detokenize{#1}'
-      | perl -pe 's/\\^/\\\\rho/g'
-      | perl -pe 's/\\$/\\\\xi/g'
-      | perl -pe 's/&/\\\\sigma/g'
-      | perl -pe 's/\\?/\\\\varnothing/g'
-      | perl -pe 's/@/\\\\varphi/g'
-      | perl -pe 's/!->/\\\\mapstochar\\\\relbar\\\\mathrel{\\\\mkern-12mu}\\\\mapsto/g'
-      | perl -pe 's/->/\\\\mapsto/g'
-      | perl -pe 's/-([a-z]+)>/\\\\xrightarrow{\\\\text{\\\\sffamily\\\\scshape \\1}}/g'
-      | perl -pe 's/\unexpanded{~}>/\\\\mapstochar\\\\dashrightarrow/g'
-      | perl -pe 's/:=/\\\\vDash/g'
-      | perl -pe 's/\\[\\[/\\\\llbracket/g'
-      | perl -pe 's/\\]\\]/\\\\rrbracket/g'
-    &&
-    /bin/echo -n '$\\endinput'
-  }%
+\makeatletter\newcommand\eolang at process[1]{
+  \def\hash{\eolang at mdfive
+    {\eolang at tmpdir/\jobname/phiquation.tex}}%
+  \iexec[null]{cp "\eolang at tmpdir/\jobname/phiquation.tex"
+    "\eolang at tmpdir/\jobname/\hash.tex"}%
+  \iexec[trace,stdout=\eolang at tmpdir/\jobname/\hash-post.tex]{
+    perl "\eolang at tmpdir/eolang-phi.pl"
+    '#1'
+    "\eolang at tmpdir/\jobname/\hash.tex"}%
 }
+\newenvironment{phiquation*}%
+{\VerbatimEnvironment\begin{VerbatimOut}
+  {\eolang at tmpdir/\jobname/phiquation.tex}}
+{\end{VerbatimOut}\eolang at process{equation*}}
+\newenvironment{phiquation}%
+{\VerbatimEnvironment\begin{VerbatimOut}
+  {\eolang at tmpdir/\jobname/phiquation.tex}}
+{\end{VerbatimOut}\eolang at process{equation}}
+\makeatother
 
-\begin{VerbatimOut}{eolang.pl}
-$tex = $ARGV[0];
+\makeatletter\newcommand\phiq[1]{
+  \iexec[trace,quiet,stdout=\eolang at tmpdir/\jobname/phiq.tex]{
+    /bin/echo '\detokenize{#1}'}
+  \def\hash{\eolang at mdfive
+    {\eolang at tmpdir/\jobname/phiq.tex}}%
+  \iexec[null]{cp "\eolang at tmpdir/\jobname/phiq.tex"
+    "\eolang at tmpdir/\jobname/\hash.tex"}%
+  \iexec[trace,stdout=\eolang at tmpdir/\jobname/\hash-post.tex]{
+    perl \eolang at tmpdir/eolang-phi.pl 'phiq'
+    "\eolang at tmpdir/\jobname/\hash.tex"}%
+}\makeatother
+
+\makeatletter
+\begin{VerbatimOut}{\eolang at tmpdir/eolang-sodg.pl}
+open(my $fh, '<', $ARGV[0]);
+my $tex; { local $/; $tex = <$fh>; }
+print '% This file is auto-generated', "\n";
+print '% There are ', length($tex),
+  ' chars in the input: ', $ARGV[0], "\n";
+print '% ---', "\n";
+if (index($tex, "\t") > 0) {
+  print "TABS are prohibited!";
+  exit 1;
+}
 $tex =~ s/^\s+|\s+$//g;
 $tex =~ s/(\\[a-zA-Z]+)\s+/\1/g;
-$tex =~ s/\r\s+/\r/g;
+$tex =~ s/\n\s+/\n/g;
 $tex =~ s/\|([^\|]+)\|/\\texttt{\1}/g;
-my @cmds = split (/\r/g, $tex);
-print '\begin{phig}', "\n";
+my @cmds = split (/\n/g, $tex);
+foreach my $t (@cmds) {
+  print '% ', $t, "\n";
+}
+print '% ---', "\n";
+print '\begin{phicture}', "\n";
 foreach my $c (@cmds) {
   my ($head, $tail) = split (/ /, $c, 2);
   my %opts = {};
@@ -191,10 +264,13 @@
   }
   print ";\n";
 }
-print '\end{phig}', "\n", '\endinput';
+print '\end{phicture}', "\n", '\endinput';
 \end{VerbatimOut}
-\message{^^Jeolang: File with Perl script (eolang.pl) saved^^J}%
-\iexec[trace,null]{perl -pi -e 's/(\\\\[a-zA-Z])\\s+/\\1/g' eolang.pl}
+\message{eolang: File with Perl script
+  '\eolang at tmpdir/eolang-sodg.pl' saved^^J}%
+\iexec[trace,null]{perl -pi -e 's/(\\\\[a-zA-Z])\\s+/\\1/g'
+  "\eolang at tmpdir/eolang-sodg.pl"}
+\makeatother
 
 \RequirePackage{tikz}
   \usetikzlibrary{arrows}
@@ -206,7 +282,7 @@
   \usetikzlibrary{calc}
   \usetikzlibrary{shapes.arrows}
 
-\newenvironment{phig}%
+\newenvironment{phicture}%
   {\noindent\begin{tikzpicture}[
     ->,>=stealth',node distance=0,thick,
     pics/parallel arrow/.style={
@@ -232,17 +308,61 @@
   above=2pt,sloped/.append style={transform shape},
   font={\scriptsize},color=black]
 
-\NewDocumentEnvironment{sodg}{b}{%
-  \catcode`\ =10 %
-  \catcode`\^^M=5 %
-  \iexec[trace,stdout=\jobname.tex.eolang]{
-    perl eolang.pl '\detokenize{#1}'}%
-}{}
-\AddToHook{env/sodg/before}{\bgroup\obeylines\obeyspaces}
-\AddToHook{env/sodg/after}{\egroup}
+\makeatletter\newenvironment{sodg}%
+{\VerbatimEnvironment\begin{VerbatimOut}
+  {\eolang at tmpdir/\jobname/sodg.tex}}
+{\end{VerbatimOut}%
+  \def\hash{\eolang at mdfive
+    {\eolang at tmpdir/\jobname/sodg.tex}}%
+  \iexec[null]{cp "\eolang at tmpdir/\jobname/sodg.tex"
+    "\eolang at tmpdir/\jobname/\hash.tex"}%
+  \iexec[trace,stdout=\eolang at tmpdir/\jobname/\hash-post.tex]{
+    perl "\eolang at tmpdir/eolang-sodg.pl"
+    "\eolang at tmpdir/\jobname/\hash.tex"}%
+}\makeatother
 
+\makeatletter\newcommand\eolang{%
+  \ifdefined\anon%
+    \anon[XYZ]{{\sffamily EO}}%
+  \else%
+    {\sffamily EO}%
+  \fi%
+}\makeatother
 
+\makeatletter\newcommand\phic{%
+  \ifdefined\anon%
+    \anon[$\alpha$-calculus]{$\varphi$-calculus}%
+  \else%
+    $\varphi$-calculus%
+  \fi%
+}\makeatother
 
+\newcommand\phiConst{%
+  \mathrel{\hspace{.15em}}\mapstochar\mathrel{\hspace{-.15em}}\mapsto}
+
+\RequirePackage{trimclip}
+\RequirePackage{amsfonts}
+\makeatletter
+\newcommand{\phiDotted}{\mapstochar\mathrel{\mathpalette\phiDotted@\relax}}
+\newcommand{\phiDotted@}[2]{%
+  \begingroup
+  \settowidth{\dimen\z@}{$\m at th#1\rightarrow$}%
+  \settoheight{\dimen\tw@}{$\m at th#1\rightarrow$}%
+  \sbox\z@{%
+    \makebox[\dimen\z@][s]{%
+      \clipbox{0 0 {0.4\width} 0}%
+        {\resizebox{\dimen\z@}{\height}%
+          {$\m at th#1\dashrightarrow$}}%
+      \hss%
+      \clipbox{{0.69\width} {-0.1\height} 0 {-\height}}{$\m at th#1\rightarrow$}%
+    }%
+  }%
+  \ht\z@=\dimen\tw@ \dp\z@=\z@%
+  \box\z@%
+  \endgroup}\makeatother
+
+
+
 \endinput
 %%
 %% End of file `eolang.sty'.



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