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" = "ASCII" ]; then
48 if [ "$TYPE" = "HTML" ]; then
49 rm -rf /tmp/silcdoc.html
50 rm -rf /tmp/silcdoc_html.html
51 mkdir /tmp/silcdoc.html
52 mkdir /tmp/silcdoc_html.html
53 cp $headers /tmp/silcdoc.html
55 # Generate index template from the DIRECTORY files
56 files=`find $SRC -name "DIRECTORY"`
60 name=`grep "@LIBRARY=" $i |cut -d= -f2`
61 fname=`grep "@FILENAME=" $i |cut -d= -f2`
62 links=`grep "@LINK=" $i |cut -d= -f2 |cut -d: -f1`
64 # Generate links to template file that can be included into various
65 # places on the webpage.
66 echo "<A HREF="$fname">$name</A><BR>" >>$DST/index.tmpl
69 n=`grep $k $i |cut -d= -f2 |cut -d: -f2`
70 echo "<LI><A HREF="$k">$n</A>" >>$DST/$fname.links
71 echo " <A HREF="$k">$n</A><BR>" >>$DST/index.tmpl
75 # Copy all HTML files to destination
76 htmlfiles=`find $SRC -name "silc*.html"`
79 cp $i /tmp/silcdoc_html.html
82 cd /tmp/silcdoc_html.html
83 htmlfiles=`find . -name "silc*.html" | cut -d/ -f2`
87 # Generate the details and the layout
88 f="/tmp/silcdoc_html.html/$i"
89 sh gen.sh $DST gen_html_detail.php $f $f
90 sh gen.sh $DST index.php $f $f
91 cp /tmp/silcdoc_html.html/$i $DST
95 # Generate the actual detailed documentation
98 headers=`find . -name "silc*.h" |cut -d/ -f2 |cut -d. -f1`
102 $ROBO /tmp/silcdoc.html/$i.h $DST/$i.html $TYPE
104 # Generate the TOC file
105 sh gen.sh $DST gen_toc.php $DST/$i.html $DST/$i.html
106 sh gen.sh $DST index.php $DST/$i.html $DST/$i.html
108 # Generate the details and the layout
109 files=`find $DST -name ""$i"__*.html"`
112 sh gen.sh $DST gen_detail.php $k $k
113 sh gen.sh $DST index.php $k $k
116 rm -f $DST/$i__index.tmpl
119 # Generate the index and TOC files from the DIRECTORY files
120 files=`find $SRC -name "DIRECTORY"`
124 name=`grep "@LIBRARY=" $i |cut -d= -f2`
125 fname=`grep "@FILENAME=" $i |cut -d= -f2`
127 # Generate links for this library
128 sed -e "/@LINKS@/ r $DST/$fname.links" -e s/@LINKS@//g $i >$DST/$fname
130 # Generate the TOC file for the library
131 sh gen.sh $DST gen_toc.php $DST/$fname $DST/$fname
132 sh gen.sh $DST index.php $DST/$fname $DST/$fname
134 # Generate the link for the top index.html for this library
135 echo "<LI><A HREF="$fname">$name</A>" >>$DST/index.html.tmp
136 rm -f $DST/$fname.links
139 # Generate the top index.html file
140 index=`find $SRC -name "LIBINDEX"`
141 version=`grep SILC_VERSION_STRING $SRC/../includes/version_internal.h |cut -d\" -f2`
143 sed -e "/@VERSION@/s//$version/" -e "/@DATE@/s//$curdate/" -e "/@BODY@/ r $DST/index.html.tmp" -e s/@BODY@//g $index >$DST/index.html
144 sh gen.sh $DST gen_toc.php $DST/index.html $DST/index.html
145 sh gen.sh $DST index.php $DST/index.html $DST/index.html
147 rm -rf $DST/index.html.tmp
148 rm -rf /tmp/silcdoc.html
149 rm -rf /tmp/silcdoc_html.html