3 # Author: Pekka Riikonen <priikone@silcnet.org>
5 # Copyright (C) GNU GPL 2001 Pekka Riikonen
7 # SILC Toolkit Reference Manual documentation script. This will automatically
8 # generate documentation from the source tree. This will require the
9 # robodoc compiled in util/robodoc and php utility installed in your system.
11 # This will tarverse the given directory and all subdirectories for the
12 # SILC style header files. All header files starting with prefix `silc'
13 # will be checked. For example, silcpkcs.h.
15 # Usage: ./sildoc <type> <source directory> <destination directory> <robodoc>
17 # The <source directory> is the directory where this starts checking for
18 # the headers and will traverse all subdirectories. The <destination
19 # directory> is the directory to where the documentation is generated.
23 if [ $# -lt "4" ]; then
24 echo "Usage: ./silcdoc <type> <source directory> <destination directory> <robodoc>"
25 echo "Supported types: HTML"
26 # echo "Supported types: HTML, ASCII, LATEX or RTF"
35 # Get all headers in the source directory
36 headers=`find $SRC -name "silc*.h"`
41 if [ "$TYPE" = "HTML" ]; then
42 mkdir /tmp/silcdoc.html
43 cp $headers /tmp/silcdoc.html
45 # Generate indes template from the DIRECTORY files
46 files=`find $SRC -name "DIRECTORY"`
50 name=`grep "@LIBRARY=" $i |cut -d= -f2`
51 fname=`grep "@FILENAME=" $i |cut -d= -f2`
52 links=`grep "@LINK=" $i |cut -d= -f2 |cut -d: -f1`
54 # Generate links to template file that can be included into various
55 # places on the webpage.
56 echo "<A HREF="$fname">$name</A><BR>" >>$DST/index.tmpl
59 n=`grep $k $i |cut -d= -f2 |cut -d: -f2`
60 echo "<LI><A HREF="$k">$n</A>" >>$DST/$fname.links
61 echo " <A HREF="$k">$n</A><BR>" >>$DST/index.tmpl
65 # Generate the actual detailed documentation
68 headers=`find . -name "silc*.h" |cut -d/ -f2 |cut -d. -f1`
72 $ROBO /tmp/silcdoc.html/$i.h $DST/$i.html $TYPE
74 # Generate the TOC file
75 sh gen.sh $DST gen_toc.php $DST/$i.html $DST/$i.html
76 sh gen.sh $DST index.php $DST/$i.html $DST/$i.html
78 # Generate the details and the layour
79 files=`find $DST -name ""$i"_*.html"`
82 sh gen.sh $DST gen_detail.php $k $k
83 sh gen.sh $DST index.php $k $k
86 rm -f $DST/$i_index.tmpl
89 # Generate the index and TOC files from the DIRECTORY files
90 files=`find $SRC -name "DIRECTORY"`
94 name=`grep "@LIBRARY=" $i |cut -d= -f2`
95 fname=`grep "@FILENAME=" $i |cut -d= -f2`
97 # Generate links for this library
98 sed -e "/@LINKS@/ r $DST/$fname.links" -e s/@LINKS@//g $i >$DST/$fname
100 # Generate the TOC file for the library
101 sh gen.sh $DST gen_toc.php $DST/$fname $DST/$fname
102 sh gen.sh $DST index.php $DST/$fname $DST/$fname
104 # Generate the link for the top index.html for this library
105 echo "<LI><A HREF="$fname">$name</A>" >>$DST/index.html.tmp
106 rm -f $DST/$fname.links
109 # Generate the top index.html file
110 index=`find $SRC -name "LIBINDEX"`
112 sed -e "/@DATE@/s//$curdate/" -e "/@BODY@/ r $DST/index.html.tmp" -e s/@BODY@//g $index >$DST/index.html
113 sh gen.sh $DST gen_toc.php $DST/index.html $DST/index.html
114 sh gen.sh $DST index.php $DST/index.html $DST/index.html
116 rm -rf $DST/index.html.tmp
117 rm -rf /tmp/silcdoc.html