X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucwmac2.tex;h=1c29317c8073e402da2f2bca4b07597d72a03f2d;hb=refs%2Ftags%2Fv2.0.1;hp=d0173694f5e7ebbd30b502aac077144e2edc84b9;hpb=a6d7f2073da5825174b263dc0450552d7c7c4209;p=ucwmac.git diff --git a/ucwmac2.tex b/ucwmac2.tex index d017369..1c29317 100644 --- a/ucwmac2.tex +++ b/ucwmac2.tex @@ -61,6 +61,17 @@ \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