From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 2 Sep 2019 13:46:59 +0900
Subject: Initial commit

---
 macros/latex/contrib/gmutils/gmenvir.sty | 143 +++++++++++++++++++++++++++++++
 1 file changed, 143 insertions(+)
 create mode 100644 macros/latex/contrib/gmutils/gmenvir.sty

(limited to 'macros/latex/contrib/gmutils/gmenvir.sty')

diff --git a/macros/latex/contrib/gmutils/gmenvir.sty b/macros/latex/contrib/gmutils/gmenvir.sty
new file mode 100644
index 0000000000..347198ceac
--- /dev/null
+++ b/macros/latex/contrib/gmutils/gmenvir.sty
@@ -0,0 +1,143 @@
+%% 
+%% \iffalse ^^A we skip the debug setting
+\IfFileExists{\string~/bin/gen_and_xela}{\errorcontextlines=1000 }{}
+%% \fi
+%% ^^A $Id: TheUltimateMaster.gmd,v 0.352 2011/10/12 15:19:42 natror Exp natror $
+%% This is file “gmenvir.sty” generated with the DocStrip utility.
+%% 
+%%
+%% The original source files were:
+%%
+%% gmutils/gmutils.gmd  (with options: `envir')
+%%
+%% 
+%% Copyright ©  
+%% by Grzegorz ‘Natror’ Murzynowski
+%% natror (at) gmail (dot) com
+%% 
+%% This program is subject to the LaTeX Project Public License.
+%% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
+%% for the details of that license.
+%%
+%% LPPL status: "author-maintained".
+%%
+%% 
+%% 
+%% For documentation please refer to the file(s)
+%% gmutils.{gmd,pdf}.
+%% 
+%% 
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{gmenvir}
+    [2011/10/12 v0.996 redefinition of \string \begin \space and \string \end  (GM)]
+
+
+%%
+%%
+%%     ^^A\typeout{\unexpanded{#4}}%%
+
+\RequirePackage{gmbase, gmampulex} % the low-level macros
+
+
+
+\emptify\@envirstack
+
+\def\@pushenvir{%
+  %^^V\edef\@currenvir{\@currenvir}% is already expanded.
+  \xdef\@envirstack{%
+    {\@xa\detokenize\@xa{\@currenvir}}%
+    {\the\currentgrouplevel}%
+    {\@currenvline}%
+    \@envirstack
+  }%
+}
+
+\def\@popenvir #1#2#3{%
+  \@XA{\@popenvir@ #1#2#3}\@envirstack\@nil
+}
+
+\def\@popenvir@ #1#2#3#4#5#6#7\@nil{%
+  \gdef #1{#4}% |#1| carries last envir name
+  \gdef #2{#5}% |#2| carries last envir level
+  \gdef #3{#6}% |#3| carries last envir beginnig line
+  \gdef\@envirstack{#7}% and we update the stack
+}
+
+\long\def\@begnamedgroup#1{%
+  \edef\@prevgrouplevel{\the\currentgrouplevel}% added 2009/03/24 to
+  % handle special pseudo-environments that don't increase
+  % \incmd\currentgrouplevel (such as \inenv{document}). Note it's
+  % |\edef|ed \emph{outside} the environment's group.
+  \@ignorefalse% not to ignore blanks after group
+  \begingroup\@endpefalse
+  \edef\@prevenvir{\@currenvir}% Note we |\edef| it inside the group
+  % (for obvious reason), unlike the ‘previous’ grouplevel.
+  \edef\@currenvir{#1}% We could do recatcoding
+  % through\inverb|\string| or \nlperc\cmd\detokenize\ but all the name
+  % `other' and 10 could affect
+  % a~thousand packages so we don't do that and we'll recatcode in
+  % a~testing macro, see line \ref{@ifenvir}.
+  \edef\@currenvline{\on@line}%
+  \@pushenvir % we put current envir to |\@envirstack|.
+  \csname #1\endcsname}% if the argument is a~command's name (an
+
+\def\begin{\gmu@ifstar{\@begnamedgroup}{%
+      \@begnamedgroup@ifcs}}
+
+\def\@begnamedgroup@ifcs#1{%
+  \ifcsname#1\endcsname\afterfi{\@begnamedgroup{#1}}%
+  \else\afterfi{\@latex@error{Environment #1 undefined}\@eha}%
+  \fi}%
+
+
+\long\def\@fourthofmany#1#2#3#4#5\@nil{#4}%
+
+\lpdef\@ifprevenvir#1{%\label{@ifenvir}\
+  \gmu@ifedetokens
+  {\@xa\@fourthofmany\@envirstack\relax\relax\relax\relax\@nil}%
+  {#1}%
+}
+
+
+\def\@checkend#1{%
+  \@ifenvir{#1}%
+  {}%
+  {\@badend{#1}}%
+}
+
+\ampulexdef\end[#1][#1]\endcsname\@checkend{%
+\endcsname
+\@xa\gmu@ifempty\@xa{\@envirstack}%
+{%
+  \PackageError {gmutils/base}%
+  {There's no environment to pop!}{Oy vey, gefeelte fish!}%
+}%
+{\@popenvir\gmu@drain\gmu@drain\gmu@drain }%
+\@checkend
+}
+
+\pdef\@endif#1{\@ifenvir{#1}{\end{#1}}{}}
+
+\pdef\@endifprev#1{\@ifprevenvir{#1}{\end{#1}}{}}
+
+\newcount\c@EnvirInterruption
+
+\lpdef\gmu@InterruptEnvir
+#1% the contents of interruption.
+{%
+  \global  \advance\c@EnvirInterruption\@ne
+  \Name \@popenvir
+  {gmu@InterruptCurrenv \the\c@EnvirInterruption}\gmu@drain\gmu@drain
+  \endgroup
+  #1%
+  \begingroup
+  \@XA {\let\@currenvir}%
+  \csname gmu@InterruptCurrenv \the\c@EnvirInterruption \endcsname
+  \@pushenvir
+  \global  \advance\c@EnvirInterruption\m@ne
+}
+
+
+\endinput
+%%
+%% End of file `gmenvir.sty'.
-- 
cgit v1.2.3

