doc.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. # THIS would be much easier with a ruby script that parsed each .h/.cpp pair
  3. # and created a <tr> row.
  4. #
  5. echo "<html>"
  6. echo " <head>"
  7. echo " <title>IGL LIB documentation</title>"
  8. echo ' <link href="./style.css" rel="stylesheet" type="text/css">'
  9. echo " </head>"
  10. echo " <body>"
  11. echo " <h1>IGL LIB</h1>"
  12. echo " <h2>Headers:</h2>"
  13. echo " <table>"
  14. echo " <tr><th>.h file</th><th>Functions</th></tr>"
  15. # loop over all headers
  16. odd="0"
  17. for h in include/igl/*.h;
  18. do
  19. b=`basename $h`
  20. if [ -e $h ]
  21. then
  22. printf " <tr id='$b' class=d$odd><td>$b</td>"
  23. fi
  24. # portion of file inside namespace
  25. html_nsp=`cat $h | \
  26. perl -ne 'BEGIN{$p = 0} $o=$p;$p ^= $_=~"[{}]";print if $o && $p;' | \
  27. sed -e "s/</\&lt;/g" | sed -e "s/>/\&gt;/g" | sed -e "s/%/%%/g" | \
  28. sed -e "s/^\( *[^ \/].*\)$/<pre><code>\1<\/code><\/pre>/g" | \
  29. sed -e ':a' -e 'N' -e '$!ba' -e 's/<\/code><\/pre>\n<pre><code>/\\\n/g' | \
  30. sed -e "s/^\(.*[^ ].*\)$/\1<br>/g"`;
  31. printf "<td>$html_nsp</td>"
  32. # Try to find functions and corresponding comments
  33. echo "</tr>"
  34. odd=`echo "($odd+1)%2" | bc`
  35. done
  36. echo " </body>"
  37. echo "</html>"