<blockdef name="manlink" option="href *">
<if not href><set href="${ref}${block}.html"></if
><a href=$href $*><img src="${ref}pic/manual.png" border=0 alt="[ref]"><use
block></a></blockdef>

<!--- Macro to pretty print htp code via an external perl script
  It uses a temporary output file to store the block.  Note the tricky
  use of newlines, the condense option, expand and noexpand.  If you
  understand this, you can consider yourself a htp expert :)        --->
<blockdef name="htpcode" option="file linenr syntax option">
  <if not file><set file="ref.tmp"></if>
<opt nocondense><output file="$file" expand>
<use block noexpand></output><opt semicondense>
  <if not option>
    <set option="">
  </if>
  <if linenr><set option="$option -n"></if>
  <if syntax><set option="$option -s"></if>
  <file execute="perl pphtp.pl $option $file" redirect>
</blockdef>

<blockdef name="toc">
  <set ctr=0>
  <set prectr="">
  <blockdef name="section" option="name href longname">
     <inc ctr>
     <if not longname><set longname=$name></if>
     <set TOC_${prectr}${ctr}=$longname GLOBAL>
     <set TOC_SHORT_${prectr}${ctr}=$name GLOBAL>
     <if href>
       <set TOC_HREF_${prectr}${ctr}=$href GLOBAL>
       <set TOC_IHREF_${href}=${prectr}${ctr} GLOBAL>
     </if>
     <set TOC_SECT_${prectr}${ctr}="TRUE" GLOBAL>
     <set oldprectr=$prectr>
     <set oldctr=$ctr>
     <set prectr="${oldprectr}${oldctr}_">
     <set ctr=0>
     <unset longname>
     <use block>
     <set ctr=$oldctr>
     <set prectr=$oldprectr>
  </blockdef>
  <def name="entry" option="name href longname">
     <inc ctr>
     <if not longname><set longname=$name></if>
     <set TOC_${prectr}${ctr}=$longname GLOBAL>
     <set TOC_SHORT_${prectr}${ctr}=$name GLOBAL>
     <set TOC_HREF_${prectr}${ctr}=$href GLOBAL>
     <set TOC_IHREF_${href}=${prectr}${ctr} GLOBAL>
  </def>
  <use block>
</blockdef>

<def name=showsubtoc option="sect">
    <ul>
    <set subctr=1>
    <while TOC_${sect}_${subctr}>
     <li><a class=noline href="${TOC_HREF_${sect}_${subctr}}"><use TOC_${sect}_${subctr}></a></li>
     <inc subctr>
    </while>
    </ul>
</def>

<def name=showtoc>
 <ul>
 <set ctr=1>
 <while TOC_$ctr>
  <if TOC_SECT_$ctr>
   <li><use TOC_${ctr}>
   <showsubtoc sect=$ctr>
   </li>
  <else>
   <li><a class=noline href="${TOC_HREF_${ctr}}"><use TOC_${ctr}></a></li>
  </if>
  <inc ctr>
 </while>
 </ul>
</def>

<def name=showsidetoc option="level prefix cols ctr">
 <if not level><set level=1></if>
 <if not prefix><set prefix=""></if>
 <set ctr=1>
 <while TOC_$ctr>
  <tr><td class=tocf width="12">
  <if TOC_SECTION="${ctr}">
    <img src="${ref}pic/arrow.png" alt=">">
  <else>
    &nbsp;
  </if>
  </td><td class="toc" colspan="2">
  <if TOC_SECT_$ctr>
   <if TOC_SECTION=$ctr>
     <set SHOW_SUB>
   <else>
     <set subctr=1>
     <while TOC_${ctr}_${subctr}>
       <if TOC_SECTION="${ctr}_${subctr}">
         <set SHOW_SUB>
       </if>
       <inc subctr>
     </while>
   </if>
   <if SHOW_SUB>
    <use TOC_SHORT_${ctr}></td></tr>
    <set subctr=1>
    <while TOC_${ctr}_${subctr}>
     <tr><td class=tocf width="12">&nbsp;</td><td class=tocf width="12">
     <if TOC_SECTION="${ctr}_${subctr}">
       <img src="${ref}pic/arrow.png" alt=">">
     <else>
       &nbsp;
     </if>
     </td><td class="toc"><a class="noline" href="${TOC_HREF_${ctr}_${subctr}}"><use TOC_SHORT_${ctr}_${subctr}></a></td></tr>
     <inc subctr>
    </while>
    <unset SHOW_SUB>
   <else>
    <if not TOC_HREF_${ctr}>
      <set TOC_HREF_$ctr=${TOC_HREF_${ctr}_1}>
    </if>
    <a class="noline" href="${TOC_HREF_${ctr}}"><use TOC_SHORT_${ctr}></a></td></tr>
   </if>
  <else>
    <a class="noline" href="${TOC_HREF_${ctr}}"><use TOC_SHORT_${ctr}></a></td></tr>
  </if>
  <inc ctr>
 </while>
</def>






