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. The template for
56 # the generated index template is INDEX.tmpl.
57 files=`find $SRC -name "DIRECTORY"`
61 name=`grep "@LIBRARY=" $i |cut -d= -f2`
62 fname=`grep "@FILENAME=" $i |cut -d= -f2`
63 links=`grep "@LINK=" $i |cut -d= -f2 |cut -d: -f1`
65 # Generate links to template file that can be included into various
66 # places on the webpage.
67 echo "<a href="$fname"><img src="box.gif" border="0" alt="">$name</a><br />" >>$DST/index.tmpl
70 n=`grep $k $i |cut -d= -f2 |cut -d: -f2`
71 echo "<li><a href="$k">$n</a>" >>$DST/$fname.links
72 echo " <a href="$k"><img src="box2.gif" border="0" alt="">$n</a><br />" >>$DST/index.tmpl
75 # Now get the template for the link template, and generate the final index
77 temp=`find $SRC -name "INDEX.tmpl"`
78 sed -e "/@BODY@/ r $DST/index.tmpl" -e s/@BODY@//g $temp >$DST/index.tmpl.tmp
79 mv $DST/index.tmpl.tmp $DST/index.tmpl
81 # Copy all HTML files to destination
82 htmlfiles=`find $SRC -name "*.html"`
85 cp $i /tmp/silcdoc_html.html
88 cd /tmp/silcdoc_html.html
89 htmlfiles=`find . -name "*.html" | cut -d/ -f2`
93 # Generate the details and the layout
94 f="/tmp/silcdoc_html.html/$i"
95 sh gen.sh $DST gen_index.php 1 $f $f
96 cp /tmp/silcdoc_html.html/$i $DST
100 # Generate the actual detailed documentation
103 headers=`find . -name "silc*.h" |cut -d/ -f2 |cut -d. -f1`
107 $ROBO /tmp/silcdoc.html/$i.h $DST/$i.html $TYPE
109 # Generate the TOC file
110 sh gen.sh $DST gen_index.php 1 $DST/$i.html $DST/$i.html
112 # Generate the details and the layout
113 files=`find $DST -name ""$i"__*.html"`
116 sh gen.sh $DST gen_index.php 0 $k $k
119 rm -f $DST/$i__index.tmpl
122 # Generate the index and TOC files from the DIRECTORY files
123 files=`find $SRC -name "DIRECTORY"`
127 name=`grep "@LIBRARY=" $i |cut -d= -f2`
128 fname=`grep "@FILENAME=" $i |cut -d= -f2`
130 # Generate links for this library
131 sed -e "/@LINKS@/ r $DST/$fname.links" -e s/@LINKS@//g $i >$DST/$fname
133 # Generate the TOC file for the library
134 sh gen.sh $DST gen_index.php 1 $DST/$fname $DST/$fname
136 # Generate the link for the top index.html for this library
137 echo "<li><a href="$fname">$name</a>" >>$DST/index.html.tmp
138 rm -f $DST/$fname.links
141 # Generate the top index.html file
142 index=`find $SRC -name "LIBINDEX"`
143 version=`grep SILC_VERSION_STRING $SRC/../includes/version_internal.h |cut -d\" -f2`
145 sed -e "/@VERSION@/s//$version/" -e "/@DATE@/s//$curdate/" -e "/@BODY@/ r $DST/index.html.tmp" -e s/@BODY@//g $index >$DST/index.html
146 sh gen.sh $DST gen_index.php 2 $DST/index.html $DST/index.html
148 rm -rf $DST/index.html.tmp
149 rm -rf /tmp/silcdoc.html
150 rm -rf /tmp/silcdoc_html.html