#! /bin/bash

tools="new info conv slice draw val sum diff sedt mask wdt wd-norm mlut dtma \
ball.sh bissec metbases print xfig geomv anim4d.sh"

templa="templa"

target="npic-tools.html"

test -f "$target" && mv -f "$target" "$target.back"

echo "Generating $target ..."


#------------------------------------------------------------------------------

cat > "$target" << ENDOFZEDOC
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Npic tools</title>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#ff0000">

  <h1>Npic command-line tools</h1>
  
  <h4>Copyright (C) 2003 by Edouard Thiel
  <a href="mailto:Edouard.Thiel@lif.univ-mrs.fr?subject=Helium">&lt;Edouard.Thiel@lif.univ-mrs.fr&gt;</a></h4>

<p><hr>

  This page describes the set of command-line tools that comes along with the
  <a href="../index.html">Npic library</a>. <p>

  Some of these tools are available in a plugin menu for <a href="http://qvox.sourceforge.net/">QVox</a>.
  Run qvox, go to "Plugins" / "Manage plugins" / "Add plugin menu",
  select <a href="../npic-qvox-plugins.qpx">npic-qvox-plugins.qpx</a>,
  "Rebuild menu". You should now have the "Plugins" / "Npic tools" menu.
<hr>

  <center>Back to <a href="../index.html">main page</a>.</center>

<h3><c>tools/</c></h3>

 <table border=0 width=100%>

ENDOFZEDOC

#------------------------------------------------------------------------------

for i in $tools ; do
cat >> "$target" << ENDOFZEDOC
    <tr><a name="tools-npic-$i-1"></a>
      <td align=left width=20></td>
      <td align=left width=15%>
        <a href="#tools-npic-$i-2">npic-$i</a>
      </td>
      <td align=left>
        $(../tools/npic-$i -h | head -1 | { read a b c ; echo "$c" ; })
      </td>
    </tr>

ENDOFZEDOC
done

#------------------------------------------------------------------------------

cat >> "$target" << ENDOFZEDOC
  </table>
 
<p>

<h3><c>templa/</c></h3>

 <table border=0 width=100%>

ENDOFZEDOC

#------------------------------------------------------------------------------

for i in $templa ; do
cat >> "$target" << ENDOFZEDOC
    <tr><a name="templa-npic-$i-1"></a>
      <td align=left width=20></td>
      <td align=left width=15%>
        <a href="#templa-npic-$i-2">npic-$i</a>
      </td>
      <td align=left>
        $(../templa/npic-$i -h | head -1 | { read a b c ; echo "$c" ; })
      </td>
    </tr>

ENDOFZEDOC
done

#------------------------------------------------------------------------------

cat >> "$target" << ENDOFZEDOC
  </table>
 
<p>

<hr>

<h3>Syntax and usage:</h3>

ENDOFZEDOC

#------------------------------------------------------------------------------

for i in $tools ; do
ext=".c"
if [ "${i%.*}" != "$i" ]; then ext="" ; fi
cat >> "$target" << ENDOFZEDOC
<a name="tools-npic-$i-2"></a>
<c>tools/<a href="../tools/npic-$i$ext">npic-$i$ext</a></c>
<p>
<table border=0 width=100%>
  <tr>
    <td align=left width=20></td>
    <td>
<pre>
$(../tools/npic-$i -h | sed -e 's/\&/\&amp;/g ; s/</\&lt;/g ; s/>/\&gt;/g')
</pre>
    </td>
  </tr>
</table>
<p>

ENDOFZEDOC
done

#------------------------------------------------------------------------------

for i in $templa ; do
ext=".c"
if [ "${i%.*}" != "$i" ]; then ext="" ; fi
cat >> "$target" << ENDOFZEDOC
<a name="templa-npic-$i-2"></a>
<c>templa/<a href="../templa/npic-$i$ext">npic-$i$ext</a></c>
<p>
<table border=0 width=100%>
  <tr>
    <td align=left width=20></td>
    <td>
<pre>
$(../templa/npic-$i -h | sed -e 's/\&/\&amp;/g ; s/</\&lt;/g ; s/>/\&gt;/g')
</pre>
    </td>
  </tr>
</table>
<p>

ENDOFZEDOC
done

#------------------------------------------------------------------------------

cat >> "$target" << ENDOFZEDOC
<p>
<hr>
<font size=-2>
<div align=right>Generated by <a href="$0"><c>${0##*/}</c></a> on $(date '+%m/%d/%Y')</div>
</font>
</body>
</html>
ENDOFZEDOC

#------------------------------------------------------------------------------


exit 0

