]> mj.ucw.cz Git - ucwmac.git/blobdiff - ucwmac2.tex
Released as v2.0.1
[ucwmac.git] / ucwmac2.tex
index d0173694f5e7ebbd30b502aac077144e2edc84b9..1c29317c8073e402da2f2bca4b07597d72a03f2d 100644 (file)
 
 \def\ucwwarn#1{\immediate\write16{*** UCWmac warning: #1 ***}}
 
+% Replace all occurrences of #1 in \tmpb by #2.
+% Thanks to Petr Olsak's OPmac for an efficient implementation.
+\bgroup \catcode`!=3 \catcode`?=3
+\gdef\replacestrings#1#2{\long\def\replacestringsA##1#1{\def\tmpb{##1}\replacestringsB}%
+   \long\def\replacestringsB##1#1{\ifx!##1\relax \else\appendef\tmpb{#2##1}%
+      \expandafter\replacestringsB\fi}%
+   \expandafter\replacestringsA\tmpb?#1!#1%
+   \long\def\replacestringsA##1?{\def\tmpb{##1}}\expandafter\replacestringsA\tmpb
+}
+\egroup
+
 %%% Page size and margins %%%
 
 % If you modify these registers, call \setuppage afterwards