1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
#!/bin/sh
# Runs doxygen and massages the output files.
# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
#
# Synopsis: run_doxygen --mode=[user|maint|man] v3srcdir v3builddir
#
# Originally hacked together by Phil Edwards <pme@gcc.gnu.org>
# We can check now that the version of doxygen is >= this variable.
DOXYVER=1.2.15
doxygen=
find_doxygen() {
v_required=`echo $DOXYVER | \
awk -F. '{if(NF<3)$3=0;print ($1*100+$2)*100+$3}'`
testing_version=
# thank you goat book
set `IFS=:; X="$PATH:/usr/local/bin:/bin:/usr/bin"; echo $X`
for dir
do
# AC_EXEEXT could come in useful here
maybedoxy="$dir/doxygen"
test -f "$maybedoxy" && testing_version=`$maybedoxy --version`
if test -n "$testing_version"; then
v_found=`echo $testing_version | \
awk -F. '{if(NF<3)$3=0;print ($1*100+$2)*100+$3}'`
if test $v_found -ge $v_required; then
doxygen="$maybedoxy"
break
fi
fi
done
if test -z "$doxygen"; then
echo run_doxygen error: Could not find Doxygen $DOXYVER in path. 1>&2
print_usage
fi
}
print_usage() {
cat 1>&2 <<EOF
Usage: run_doxygen --mode=MODE [<options>] <v3-src-dir> <v3-build-dir>
MODE is one of:
user Generate user-level HTML library documentation.
maint Generate maintainers' HTML documentation (lots more;
exposes non-public members, etc).
man Generate user-level man pages.
more options when i think of them
Note: Requires Doxygen ${DOXYVER} or later; get it at
ftp://ftp.stack.nl/pub/users/dimitri/doxygen-${DOXYVER}.src.tar.gz
EOF
exit 1
}
parse_options() {
for o
do
# Blatantly ripped from autoconf, er, I mean, "gratefully standing
# on the shoulders of those giants who have gone before us."
case "$o" in
-*=*) arg=`echo "$o" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) arg= ;;
esac
case "$o" in
--mode=*)
mode=$arg ;;
--mode | --help | -h)
print_usage ;;
*)
# this turned out to be a mess, maybe change to --srcdir=, etc
if test $srcdir = unset; then
srcdir=$o
elif test $outdir = unset; then
builddir=${o}
outdir=${o}/docs/doxygen
else
echo run_doxygen error: Too many arguments 1>&2
exit 1
fi
;;
esac
done
}
# script begins here
mode=unset
srcdir=unset
outdir=unset
do_html=no
do_man=no
enabled_sections=
DATEtext=`date '+%Y-%m-%d'`
parse_options $*
find_doxygen
if test $srcdir = unset || test $outdir = unset || test $mode = unset; then
# this could be better
echo run_doxygen error: You have not given enough information...! 1>&2
print_usage
fi
case x"$mode" in
xuser) do_html=yes
LEVELtext='User'
;;
xmaint) do_html=yes
enabled_sections=maint
LEVELtext='Maintainer'
;;
xman) do_man=yes
;;
*)
echo run_doxygen error: $mode is an invalid mode 1>&2
exit 1 ;;
esac
#rm -rf $outdir
mkdir -p $outdir
chmod u+w $outdir
# work around a stupid doxygen bug
test $do_man = yes && {
mkdir -p $outdir/man/man3/ext
chmod -R u+w $outdir/man/man3/ext
}
set -e
(
set -e
cd $builddir
sed -e "s=@outdir@=${outdir}=" \
-e "s=@srcdir@=${srcdir}=" \
-e "s=@html_output_dir@=html_${mode}=" \
-e "s=@enabled_sections@=${enabled_sections}=" \
-e "s=@do_html@=${do_html}=" \
-e "s=@do_man@=${do_man}=" \
${srcdir}/docs/doxygen/user.cfg.in > ${outdir}/${mode}.cfg
echo :: NOTE that this may take some time...
echo $doxygen ${outdir}/${mode}.cfg
$doxygen ${outdir}/${mode}.cfg
echo :: Finished, exit code was $?
)
set +e
test $do_html = yes && {
sed -e "s=@LEVEL@=${LEVELtext}=" \
-e "s=@DATE@=${DATEtext}=" \
${srcdir}/docs/doxygen/mainpage.html > ${outdir}/html_${mode}/index.html
cd ${outdir}/html_${mode}
sed -e 's=\(::[[:alnum:]_]*\)< .* >=\1=' annotated.html > annstrip.html
mv annstrip.html annotated.html
cp ${srcdir}/docs/doxygen/tables.html tables.html
echo ::
echo :: HTML pages begin with
echo :: ${outdir}/html_${mode}/index.html
}
# Mess with the man pages. We don't need documentation of the internal
# headers, since the man pages for those contain nothing useful anyhow. The
# man pages for doxygen modules need to be renamed (or deleted). And the
# generated #include lines need to be changed from the internal names to the
# standard ones (e.g., "#include <stl_tempbuf.h>" -> "#include <memory>").
test $do_man = yes && {
echo ::
echo :: Fixing up the man pages...
cd $outdir/man/man3
# here's the other end of the "stupid doxygen bug" mentioned above
rm -rf ext
# File names with embedded spaces (EVIL!) need to be....? renamed or removed?
find . -name "* *" -print0 | xargs -0 rm # requires GNU tools
# can leave SGIextensions.3 alone, it's an okay name
mv s20_3_1_base.3 Intro_functors.3
mv s20_3_2_arithmetic.3 Arithmetic_functors.3
mv s20_3_3_comparisons.3 Comparison_functors.3
mv s20_3_4_logical.3 Logical_functors.3
mv s20_3_5_negators.3 Negation_functors.3
mv s20_3_6_binder.3 Binder_functors.3
mv s20_3_7_adaptors.3 Func_ptr_functors.3
mv s20_3_8_memadaptors.3 Member_ptr_functors.3
mv std.3 Namespace_Std.3
mv iterator_tags.3 Iterator_types.3
# man pages are for functions/types/other entities, not source files
# directly. who the heck would type "man foo.h" anyhow?
find . -name "[a-z]*" -a ! -name "std_*" -print | xargs rm
rm -f *.h.3 *config* *.cc.3 *.tcc.3
rm -f *_t.3 # workaround doxygen template parsing bug for now
# this is used to examine what we would have deleted, for debugging
#mkdir trash
#find . -name "[a-z]*" -a ! -name "std_*" -print | xargs -i mv {} trash
#mv *.h.3 *config* *.cc.3 *.tcc.3 *_t.3 trash
# Standardize the displayed header names. If anyone who knows perl cares
# enough to rewrite all this, feel free. This only gets run once a century,
# and I'm off getting coffee then anyhow, so I didn't care enough to make
# this super-fast.
g++ ${srcdir}/docs/doxygen/stdheader.cc -o ./stdheader
problematic=`egrep -l '#include <.*_.*>' [a-z]*.3`
for f in $problematic; do
# this is also slow, but safe and easy to debug
oldh=`sed -n '/fC#include </s/.*<\(.*\)>.*/\1/p' $f`
newh=`echo $oldh | ./stdheader`
sed "s=${oldh}=${newh}=" $f > TEMP
mv TEMP $f
done
rm stdheader
# Some of the pages for generated modules have text that confuses certain
# implementations of man(1), e.g., Linux's. We need to have another top-level
# *roff tag to /stop/ the .SH NAME entry.
#problematic=`egrep --files-without-match '^\.SH SYNOPSIS' [A-Z]*.3`
problematic='Containers.3 Sequences.3 Assoc_containers.3 Allocators.3
Iterator_types.3'
for f in $problematic; do
sed '/^\.SH NAME/{
n
a\
\
.SH SYNOPSIS
}' $f > TEMP
mv TEMP $f
done
cp ${srcdir}/docs/doxygen/Intro.3 .
echo ::
echo :: Man pages in ${outdir}/man
}
# all done
echo ::
exit 0
# vim:ts=4:et:
|