#!/bin/sh # # Author: Pekka Riikonen # # Copyright (C) GNU GPL 2001 Pekka Riikonen # # SILC Toolkit Reference Manual documentation script. This will automatically # generate documentation from the source tree. This will require the # robodoc compiled in util/robodoc and php utility installed in your system. # # This will tarverse the given directory and all subdirectories for the # SILC style header files. All header files starting with prefix `silc' # will be checked. For example, silcpkcs.h. # # Usage: ./sildoc # # The is the directory where this starts checking for # the headers and will traverse all subdirectories. The is the directory to where the documentation is generated. # # Arguments checking if [ $# -lt "4" ]; then echo "Usage: ./silcdoc " echo "Supported types: HTML" # echo "Supported types: HTML, ASCII, LATEX or RTF" exit 1 fi TYPE=$1 SRC=$2 DST=$3 ROBO=$4 # Get all headers in the source directory headers=`find $SRC -name "silc*.h"` # # HTML documentation # if [ "$TYPE" = "HTML" ]; then mkdir /tmp/silcdoc.html cp $headers /tmp/silcdoc.html # Generate the actual detailed documentation path=`pwd` cd /tmp/silcdoc.html headers=`find . -name "silc*.h" |cut -d/ -f2 |cut -d. -f1` cd $path for i in $headers do $ROBO /tmp/silcdoc.html/$i.h $DST/$i.html $TYPE # Generate the TOC file sh gen.sh gen_toc.php $DST/$i.html $DST/$i.html sh gen.sh index.php $DST/$i.html $DST/$i.html # Generate the details and the layour files=`find $DST -name ""$i"_*.html"` for k in $files do sh gen.sh gen_detail.php $k $k sh gen.sh index.php $k $k done rm -f $DST/$i_index.tmpl done # Generate the index and TOC files from the DIRECTORY files files=`find $SRC -name "DIRECTORY"` touch $DST/index.html.tmp for i in $files do # Get library name name=`grep "@LIBRARY=" $i |cut -d= -f2` fname=`grep "@FILENAME" $i |cut -d= -f2` # Generate the TOC file for the library sh gen.sh gen_toc.php $i $DST/$fname sh gen.sh index.php $DST/$fname $DST/$fname # Generate the link for the top index.html for this library echo "
  • $name" >>$DST/index.html.tmp done # Generate the top index.html file index=`find $SRC -name "LIBINDEX"` curdate=`date` sed -e "/@DATE@/s//$curdate/" -e "/@BODY@/ r $DST/index.html.tmp" -e s/@BODY@//g $index >$DST/index.html sh gen.sh gen_toc.php $DST/index.html $DST/index.html sh gen.sh index.php $DST/index.html $DST/index.html rm -rf $DST/index.html.tmp rm -rf /tmp/silcdoc.html fi