X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=scripts%2Fsilcdoc%2Fsilcdoc;h=57bb940018db6a6450f29c73ab17856235d984f0;hb=c257b555225193e54d85daf541d29578b3c93882;hp=a9dd91586bb03ae240f69deb66f41cdc6bbe1c85;hpb=76ee719f8c9ba52a21d8cdd92cc7a8689f322a2e;p=silc.git diff --git a/scripts/silcdoc/silcdoc b/scripts/silcdoc/silcdoc index a9dd9158..57bb9400 100755 --- a/scripts/silcdoc/silcdoc +++ b/scripts/silcdoc/silcdoc @@ -2,7 +2,7 @@ # # Author: Pekka Riikonen # -# Copyright (C) GNU GPL 2001 Pekka Riikonen +# Copyright (C) GNU GPL 2001 - 2002 Pekka Riikonen # # SILC Toolkit Reference Manual documentation script. This will automatically # generate documentation from the source tree. This will require the @@ -21,8 +21,8 @@ # Arguments checking if [ $# -lt "4" ]; then - echo "Usage: ./silcdoc " - echo "Supported types: HTML" + echo "Usage: ./silcdoc " + echo "Supported types: HTML PS" # echo "Supported types: HTML, ASCII, LATEX or RTF" exit 1 fi @@ -35,6 +35,52 @@ ROBO=$4 # Get all headers in the source directory headers=`find $SRC -name "silc*.h"` +# +# PS documentation (from LATEX) +# +if [ "$TYPE" = "PS" ]; then + TYPE="LATEX" + rm -rf /tmp/silcdoc.tex + mkdir /tmp/silcdoc.tex + cp $headers /tmp/silcdoc.tex + + path=`pwd` + cd /tmp/silcdoc.tex + + # Generate cross reference files + headers=`find . -name "silc*.h" |cut -d/ -f2 |cut -d. -f1` + touch silcdoc_xref + for i in $headers + do + $ROBO $i.h $i.h.tex $TYPE INTERNAL GENXREF $i.h.xref + echo $i.h.xref >>silcdoc_xref + done + + # Generate the detailed documentation + headers=`find . -name "silc*.h" |cut -d/ -f2 |cut -d. -f1` + for i in $headers + do + # remove internals + rm -rf $i_i.h + $ROBO $i.h $i.h.tex XREF silcdoc_xref $TYPE C SORT NOSOURCE SINGLEDOC + done + + # Generate the index + $ROBO silcdoc_xref toolkit_mi INDEX $TYPE TITLE "SILC Toolkit Reference Manual" + + # Generate the postscript + latex toolkit_mi + makeindex toolkit_mi + latex toolkit_mi + latex toolkit_mi + dvips toolkit_mi.dvi -o $DST + + cd $path + + rm -rf /tmp/silcdoc.tex + exit 0 +fi + # # ASCII documentation # @@ -52,9 +98,10 @@ if [ "$TYPE" = "HTML" ]; then mkdir /tmp/silcdoc_html.html cp $headers /tmp/silcdoc.html - # Generate index template from the DIRECTORY files - files=`find $SRC -name "DIRECTORY"` - for i in $files + # Generate index template from the DIRECTORY files. The template for + # the generated index template is INDEX.tmpl. + dfiles=`find $SRC -name "DIRECTORY"` + for i in $dfiles do # Get library name name=`grep "@LIBRARY=" $i |cut -d= -f2` @@ -63,33 +110,48 @@ if [ "$TYPE" = "HTML" ]; then # Generate links to template file that can be included into various # places on the webpage. - echo "$name
" >>$DST/index.tmpl + echo "$name
" >>$DST/index.tmpl for k in $links do n=`grep $k $i |cut -d= -f2 |cut -d: -f2` - echo "
  • $n" >>$DST/$fname.links - echo "    $n
    " >>$DST/index.tmpl + echo "
  • $n" >>$DST/$fname.links + echo "    $n
    " >>$DST/index.tmpl done done + # Now get the template for the link template, and generate the final index + # template file + temp=`find $SRC -name "INDEX.tmpl"` + sed -e "/@BODY@/ r $DST/index.tmpl" -e s/@BODY@//g $temp >$DST/index.tmpl.tmp + mv $DST/index.tmpl.tmp $DST/index.tmpl # Copy all HTML files to destination - htmlfiles=`find $SRC -name "silc*.html"` + htmlfiles=`find $SRC -name "*.html"` for i in $htmlfiles do cp $i /tmp/silcdoc_html.html done path=`pwd` cd /tmp/silcdoc_html.html - htmlfiles=`find . -name "silc*.html" | cut -d/ -f2` + htmlfiles=`find . -name "*.html" | cut -d/ -f2` cd $path for i in $htmlfiles do # Generate the details and the layout f="/tmp/silcdoc_html.html/$i" - sh gen.sh $DST gen_html_detail.php $f $f - sh gen.sh $DST index.php $f $f + sh gen.sh $DST gen_index.php 1 $f $f cp /tmp/silcdoc_html.html/$i $DST -echo $f + done + + # Generate cross reference files + path=`pwd` + cd /tmp/silcdoc.html + headers=`find . -name "silc*.h" |cut -d/ -f2 |cut -d. -f1` + cd $path + touch $DST/silcdoc_xref + for i in $headers + do + $ROBO /tmp/silcdoc.html/$i.h $DST/$i.html $TYPE GENXREF $DST/$i.xref + echo $DST/$i.xref >>$DST/silcdoc_xref done # Generate the actual detailed documentation @@ -99,26 +161,23 @@ echo $f cd $path for i in $headers do - $ROBO /tmp/silcdoc.html/$i.h $DST/$i.html $TYPE + $ROBO /tmp/silcdoc.html/$i.h $DST/$i.html XREF $DST/silcdoc_xref $TYPE # Generate the TOC file - sh gen.sh $DST gen_toc.php $DST/$i.html $DST/$i.html - sh gen.sh $DST index.php $DST/$i.html $DST/$i.html + sh gen.sh $DST gen_index.php 1 $DST/$i.html $DST/$i.html # Generate the details and the layout - files=`find $DST -name ""$i"__*.html"` + files=`find $DST -name ""$i"-*.html"` for k in $files do - sh gen.sh $DST gen_detail.php $k $k - sh gen.sh $DST index.php $k $k + sh gen.sh $DST gen_index.php 0 $k $k done - rm -f $DST/$i__index.tmpl + rm -f $DST/$i-index.tmpl done # Generate the index and TOC files from the DIRECTORY files - files=`find $SRC -name "DIRECTORY"` - for i in $files + for i in $dfiles do # Get library name name=`grep "@LIBRARY=" $i |cut -d= -f2` @@ -128,11 +187,10 @@ echo $f sed -e "/@LINKS@/ r $DST/$fname.links" -e s/@LINKS@//g $i >$DST/$fname # Generate the TOC file for the library - sh gen.sh $DST gen_toc.php $DST/$fname $DST/$fname - sh gen.sh $DST index.php $DST/$fname $DST/$fname + sh gen.sh $DST gen_index.php 1 $DST/$fname $DST/$fname # Generate the link for the top index.html for this library - echo "
  • $name" >>$DST/index.html.tmp + echo "
  • $name" >>$DST/index.html.tmp rm -f $DST/$fname.links done @@ -141,10 +199,15 @@ echo $f version=`grep SILC_VERSION_STRING $SRC/../includes/version_internal.h |cut -d\" -f2` curdate=`date` sed -e "/@VERSION@/s//$version/" -e "/@DATE@/s//$curdate/" -e "/@BODY@/ r $DST/index.html.tmp" -e s/@BODY@//g $index >$DST/index.html - sh gen.sh $DST gen_toc.php $DST/index.html $DST/index.html - sh gen.sh $DST index.php $DST/index.html $DST/index.html + sh gen.sh $DST gen_index.php 2 $DST/index.html $DST/index.html + + # Generate the index toolkit_index.html file + $ROBO $DST/silcdoc_xref $DST/toolkit_index.html INDEX HTML TITLE "SILC Toolkit Index" + sh gen.sh $DST gen_index.php 2 $DST/toolkit_index.html $DST/toolkit_index.html + # Cleanup rm -rf $DST/index.html.tmp rm -rf /tmp/silcdoc.html rm -rf /tmp/silcdoc_html.html + exit 0 fi