LaTEX already has a \newpage. Do we want the following to be \clear:page?
<..general utilities..>+
\ifx \newpage\:UnDef
\def\newpage{\vfil\penalty-10000 }
\fi
-_-_-
With packages like pictex around, counters become scarce resources. Hence, their use is minimized here in favor of macros. The tradeoff in time is minor because counters are scarcely needed in TeX4ht.
NOTE: /g:advance in wripro...?????????????????????
<..general utilities..>+
\ifx\tmp:toks\:UnDeF \csname newtoks\endcsname\tmp:toks\fi
\ifx\tmp:cnt\:UnDeF \csname newcount\endcsname\tmp:cnt\fi
\def\Advance:{\ip:op\advance\:Advance}
\def\Multiply:{\ip:op\multiply\:Advance}
\def\Divide:{\ip:op\divide\:Advance}
\def\gHAdvance{\ip:op\advance\g:Advance}
\def\gHMultiply{\ip:op\multiply\g:Advance}
\def\gHDivide{\ip:op\divide\g:Advance}
-_-_-
psfig already has /Multiply and /Divide
When defined, \HAdvance is the same as \Advance:.
<..general utilities..>+
\def\DefOp#1#2{
\ifx #1\:UnDef
\expandafter \ifx \csname #2:\endcsname\relax
\:warning{\string\DefOp...\string{#2\string}?}%
\else \expand:after{\let#1=}\csname #2:\endcsname
\fi
\else \:warning{\string\DefOp\string#1\string{#2\string}
can’t redefine \string#1}%
\fi
}
\DefOp\HAdvance{Advance}
\DefOp\HMultiply{Multiply}
\DefOp\HDivide{Divide}
-_-_-
<..general utilities..>+
\def\ip:op#1#2{\let\mth:op=#1\let\adv:c=#2\adv:}
\def\adv:#1{\def\:var{#1}\futurelet\:temp\Advanc:}
\def\Advanc:{\ifx [\:temp \expandafter\Advanc:e
\else \expand:after{\expandafter\adv:c\:var}\fi}
\def\Advanc:e[#1]{\expandafter\adv:c\csname
\expandafter\string\:var[#1]\endcsname}
\def\g:Advance#1{\bgroup \def\:temp{#1}%
\tmp:cnt=#1\afterassignment\:gplus \mth:op\tmp:cnt}
\def\:gplus{\expandafter\xdef\:temp{\the\tmp:cnt}\egroup}
\def\:Advance#1{\bgroup \def\:temp{#1}%
\tmp:cnt=#1\afterassignment\:aplus \mth:op\tmp:cnt}
\def\:aplus{\xdef\:temp{\def\expandafter\noexpand\:temp{\the\tmp:cnt}}%
\egroup \:temp}
-_-_-
<..general utilities..>+
\def\HAssign{\:ssg\edef}
\def\gHAssign{\:ssg\xdef}
\def\:ssg#1#2{\let\d:fn=#1\def\:var{#2}\futurelet\:temp\:Assgn}
\def\:Assgn{%
\ifx [\:temp
\expandafter\d:fn\:var[##1]{%
\noexpand\csname \expandafter
\string\:var[##1]\noexpand\endcsname}%
\expandafter\assg:m
\else \afterassignment\assg:v \expandafter \tmp:cnt \fi }
\def\assg:v{\expandafter\d:fn\:var{\the\tmp:cnt}}
\def\assg:m[#1]{%
\def\:temp{\expandafter\d:fn
\csname \expandafter\string\:var[#1]\endcsname{\the\tmp:cnt}}%
\afterassignment\:temp \tmp:cnt}
-_-_-
<..utilities..>+
\def\PushStack#1#2{%
\ifx #1\:UnDef \global\let#1=\empty\fi
{\let\Picture=\relax \xdef#1{{#2}{#1}}}}
\def\PopStack#1#2{%
\ifx #1\empty \:warning{empty \string\PopStack\string#1\string#2?}%
\global\let#2=\empty
\else \def\:temp{\:recall#1#2}\expandafter\:temp#1\fi}
\def\:recall#1#2#3#4{\gdef#1{#4}\gdef#2{#3}}
-_-_-
<..utilities..>+
\def\PushMacro#1{%
\expandafter\ifx \csname c:\string#1\endcsname\relax
\expandafter\gHAssign \csname c:\string#1\endcsname = 0
\fi
\HAssign\:temp = \csname c:\string#1\endcsname
\let\:tempa=#1%
\ifx \:tempa\:UnDef \let\:tempa=\like:unDef\fi
\global\expandafter\let\csname \:temp\string#1\endcsname = \:tempa
\expandafter\gHAdvance \csname c:\string#1\endcsname by 1 }
-_-_-
<..utilities..>+
\def\PopMacro#1{%
\expandafter\gHAdvance \csname c:\string#1\endcsname by -1
\HAssign\:temp = \csname c:\string#1\endcsname\relax
\ifnum \:temp < 0
\expandafter\gHAssign \csname c:\string#1\endcsname = 0
\:warning{ignored \string\PopCs\string#1 on empty stack}%
\else
\expand:after{\let#1=}\csname \:temp\string#1\endcsname
\ifx #1\like:unDef \let#1=\:UnDef\fi
\fi
}
\def\like:unDef{\:UnDef\:CS}
-_-_-
<..utilities..>+
\def\PushConfigure#1{\def\cf:name{#1}\expandafter
\expandafter\expandafter\Push:Configure\expandafter
\meaning\csname c:#1:\endcsname<.par del.>}
\def\PopConfigure#1{\def\cf:name{#1}\expandafter
\expandafter\expandafter\Pop:Configure\expandafter
\meaning\csname c:#1:\endcsname<.par del.>}
\def\do:undef#1->#2<.par del.>{%
\if :#2:\:warning{\string\PushConfigure{\cf:name}?}\fi
}
\catcode‘\@=6
\catcode‘\#=12
\def\Push:Configure@1<.par del.>{%
\do:undef@1-><.par del.>%
\do:para@1#1<.par del.>\push:config
\do:parb@1#2<.par del.>\push:config
\do:parc@1#3<.par del.>\push:config
\do:pard@1#4<.par del.>\push:config
\do:pare@1#5<.par del.>\push:config
\do:parf@1#6<.par del.>\push:config
\do:parg@1#7<.par del.>\push:config
\do:parh@1#8<.par del.>\push:config
\do:pari@1#9<.par del.>\push:config
}
\def\Pop:Configure@1<.par del.>{%
\do:pari@1#9<.par del.>\pop:config
\do:parh@1#8<.par del.>\pop:config
\do:parg@1#7<.par del.>\pop:config
\do:parf@1#6<.par del.>\pop:config
\do:pare@1#5<.par del.>\pop:config
\do:pard@1#4<.par del.>\pop:config
\do:parc@1#3<.par del.>\pop:config
\do:parb@1#2<.par del.>\pop:config
\do:para@1#1<.par del.>\pop:config
}
\def\do:para@1#1@2<.par del.>@3{@3{a}{@2}}
\def\do:parb@1#2@2<.par del.>@3{@3{b}{@2}}
\def\do:parc@1#3@2<.par del.>@3{@3{c}{@2}}
\def\do:pard@1#4@2<.par del.>@3{@3{d}{@2}}
\def\do:pare@1#5@2<.par del.>@3{@3{e}{@2}}
\def\do:parf@1#6@2<.par del.>@3{@3{f}{@2}}
\def\do:parg@1#7@2<.par del.>@3{@3{g}{@2}}
\def\do:parh@1#8@2<.par del.>@3{@3{h}{@2}}
\def\do:pari@1#9@2<.par del.>@3{@3{i}{@2}}
\catcode‘\@=11
\catcode‘\#=6
\def\push:config#1#2{%
\if :#2:\else
\expandafter\expandafter\expandafter\ifx \expandafter
\csname \csname#1New:Conf\endcsname\cf:name\endcsname\relax
\:warning{\string\PushConfigure{\cf:name} Failed}%
\else
\expandafter\expandafter\expandafter\PushMacro \expandafter
\csname \csname#1New:Conf\endcsname\cf:name\endcsname
\fi
\fi }
\def\pop:config#1#2{%
\if :#2:\else
\expandafter\expandafter\expandafter\ifx \expandafter
\csname \csname#1New:Conf\endcsname\cf:name\endcsname\relax \else
\expandafter\expandafter\expandafter\PopMacro \expandafter
\csname \csname#1New:Conf\endcsname\cf:name\endcsname
\fi
\fi }
-_-_-
We need category code 12, and not 11, because the latter choise would cause control sequences of unbounded length within the option \Verbatim-.
<..general utilities..>+
\def\no:catcodes#1#2#3{%
\tmp:cnt=#1
\def\no::catcodes{%
\catcode\tmp:cnt=#3
\ifnum\tmp:cnt<#2
\advance\tmp:cnt by 1 \expandafter\no::catcodes
\fi }%
\no::catcodes }
-_-_-
The \long below is to allow \par in the second argument.
<..early utilities..>+
\long\def\append:def#1#2{%
\def\:temp{\def#1}%
\expandafter\expandafter\expandafter\:temp\expandafter{#1#2}}
\long\def\pend:def#1#2{%
\def\:temp{#2}%
\def\:tempa{\def#1}%
\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter\:tempa
\expandafter\expandafter\expandafter{\expandafter\:temp #1}}
\long\def\pend:defI#1#2{%
\def\:tempa{\def#1####1}%
\ex:pend{#2}{\expandafter\:temp #1{##1}}}
\long\def\ex:pend#1{\def\:temp{#1}%
\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter\:tempa
\expandafter\expandafter\expandafter}
-_-_-
<..utilities..>+
\long\def\append:defI#1#2{%
\def\:temp{\def#1####1}%
\expandafter\expandafter\expandafter\:temp\expandafter{#1{##1}#2}}
\long\def\pend:defII#1#2{%
\def\:tempa{\def#1####1####2}%
\ex:pend{#2}{\expandafter\:temp #1{##1}{##2}}}
\long\def\append:defII#1#2{%
\def\:temp{\def#1####1####2}%
\expandafter\expandafter\expandafter\:temp\expandafter{#1{##1}{##2}#2}}
\long\def\pend:defIII#1#2{%
\def\:tempa{\def#1####1####2####3}%
\ex:pend{#2}{\expandafter\:temp #1{##1}{##2}{##3}}}
\long\def\append:defIII#1#2{%
\def\:temp{\def#1####1####2####3}%
\expandafter\expandafter\expandafter
\:temp\expandafter{#1{##1}{##2}{##3}#2}}
-_-_-
<..general utilities..>+
\HAssign\def:cnt=0
\def\Odef#1{\gHAdvance\def:cnt by 1
\edef#1{\noexpand\with:op
\expandafter\noexpand\csname \def:cnt \string#1\endcsname }%
\expandafter\gdef\csname\def:cnt\string#1\endcsname}
\def\with:op#1{\let\n:xt=#1\futurelet\:temp\wth:opt}
\def\wth:opt{\ifx [\:temp
\expandafter\n:xt\else \expand:after{\n:xt[]}\fi}
-_-_-
The \expandafter\gdef\csname\def:cnt\string#1\endcsname} allo \global\let#1=#1.
<..general utilities..>+
\def\Log:Needs#1{{\escapechar=‘\\\immediate\write-1{\:Neds{#1}}}}
-_-_-
<..html config util..>+
\def\c:Needs:{\def\:Needs##1}
\expandafter\def\csname c:Needs-:\endcsname{\def\:Neds##1}
-_-_-
Put the following in a group so that the temporary variables will not interfere with other usages.
<..html utilities..>+
\def\Needs{\bgroup\catcode‘\"=12 \cat:Needs}
\def\cat:Needs#1{\def\:temp{-}\def\:tempa{#1}\ifx \:temp\:tempa
\aftergroup\Log:Needs \else \ht:special{t4ht+@\:Needs{#1}}\fi
\egroup}
-_-_-
The following is introduced at the end of the style file, to allow for \Contribute{name}{...} commands that check for the legality of name. Otherwise, it is identical to the above.
\LinkCommand\Frame{FRAME,SRC,ID} \Frame{a}{A}...\EndFrame \LinkCommand\FRAME{FRAME,SRC,ID,attr} \LinkCommand\FRAME{FRAME,SRC,ID,attr,/,sharp} \FRAME{a}{A} \FRAME[b 1]{c}{d}
<..html utilities..>+
\def\LinkCommand#1#2{\L:Com#1#2,,,,,,<.par del.>{#1}}
\let\:Link=\Link
\def\L:Com#1#2,#3,#4,#5,#6,#7,#8<.par del.>#9{\def\:tempe{#7}%
\def\:tempa{#2}\def\:tempb{#3}\def\:tempc{#4}\def\:tempd{#6}%
\expandafter\edef\csname
End\expandafter\:gobble\string #9\endcsname{%
\ifx\:tempd\empty \noexpand\HCode
{\Hbrakets</\ifx\:tempa\empty \tag:A\else#2\fi>}\fi }%
\edef\:temp{%
\noexpand\Odef\noexpand#1[####1]####2####3{{%
\def\noexpand\tag:A{\ifx\:tempa\empty\tag:A\else#2\fi}%
\def\noexpand\HREF:{ \ifx\:tempb\empty\HREF:\else#3=\fi}%
\def\noexpand\NAME:{ \ifx\:tempc\empty\NAME:\else#4=\fi}%
\def\noexpand\empty:lnk{\ifx\:tempd\empty\else#6\fi}%
\def\noexpand\:sharp{\ifx\:tempe\empty\:sharp\else#7\fi}%
\noexpand\M:link[####1 #5]{####2}{####3}}}}\:temp
<.add - opt to command.>%
}
-_-_-
<..add - opt to command..>
\expandafter\let\csname \string#1 :\endcsname=#1
\def#1{\bgroup\LD:Link{#1}\futurelet#1\M:link}
-_-_-
<..html utilities..>+
\def\LD:Link#1{%
\def\M:link{\ifx -#1\egroup \def\M:link{\:Link-}\expandafter\gob:lnk
\else \egroup \let\M:link=\:Link \fi
\csname \string#1 :\endcsname }}
\def\gob:lnk#1-{#1}
-_-_-
<..html Configure’s..>+
\NewConfigure{Link}[4]{%
\def\empty:lnk{#4}\ifx\empty:lnk\empty\else \def\:sharp{#4}\fi
\let\empty:lnk=\empty \def\tag:A{#1}%
\def\HREF:{#2}\def\NAME:{#3}}
\Configure{Link}{}{}{}{}
\let\NOHREF:=\:gobble
-_-_-
The \let\:Link|=\Link is to allow for the redefinition of \Link and hadling -. An \if !#4!\else will not work for the case that \empty is given to #4.
<..general utilities..>+
\def\g:delete#1{%
\expandafter\expandafter\expandafter\global
\expandafter\let\csname #1\endcsname=\:UnDef
}
\def\xdef:cs#1{\expandafter\xdef \csname #1\endcsname}%
\def\:csname{\expandafter\noexpand\csname}
-_-_-
<..general utilities..>+
\long\def\:gobble#1{}
\long\def\:gobbleII#1#2{}
\long\def\:gobbleIII#1#2#3{}
\long\def\:gobbleIV#1#2#3#4{}
\long\def\:gobbleV#1#2#3#4#5{}
\long\def\:gobbleVI#1#2#3#4#5#6{}
\long\def\:gobbleVIII#1#2#3#4#5#6#7#8{}
-_-_-
[more]
[more]
<..html utilities..>+
\ifx\tmp:dim\:UnDeF \csname newdimen\endcsname\tmp:dim\fi
-_-_-
Fonts in sectioning titles can be a problem, when delivered to tocs. Hence, we need to protect them from early expansions.
Without the space, we can have in toc file expanded control sequences (e.g., \protect\tt x becomming \ttx).
The following is for preveting expansions in edef environments while preserving the meaning within standard environments. We need it, in particular, for writing into toc and for (i.e., HPage?) CutAt when titles of sections are referenced.
<..html utilities..>+
\def\pr:tc{\relax}
\let\prOteCt=\relax
\def\Protect{%
\let\prOteCt=\pr:tc
\ifx \prOteCt\pr:tc \let\prOteCt=\relax
\else \noexpand\Protect\expandafter\noexpand\fi
}
-_-_-
LaTeX has \def\@unexpandable@protect{\noexpand\protect\noexpand} to be included in immediate defines.
The following create <A HREF="aav.\:html#Q1-5-1" NAME="Q2-5-1">.........</A> in the table of contents and <A HREF="a.\:html#Q2-5-1" NAME="Q1-5-1">..........</A> in the title. The address Qi-j-m tells that we deal with tag of type Qi, in file j, for title m in the file.
The prefix \<toc tag\> is required for distinguishing the tocs tags from other tags to allow for selective loading of cross references when communicating toc info.
<..csname: file name -> file id..>
FN -_-_-
<..tag of Tag..>
cw:-_-_-
<..next HPage tag..>
<.auto tag.>N -_-_-
<..bib tag..>
<.auto tag.>B -_-_-
<..tag MarkCurFile..>
cf: -_-_-