Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
doxygen.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3#--------------------------------------------------------------------------------------
4#
5# Utility script for generation of HTML Doxygen main page.
6#
7#--------------------------------------------------------------------------------------
8# \author mdejong
9#
10script=${0##*/}
11
12if [ -z $JPP_DIR ]; then
13 echo "Variable JPP_DIR undefined."
14 exit 1
15fi
16
17source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
18
19if do_usage $*; then
20 usage "$script"
21fi
22
23setopt +o nomatch
24
25set_variable NUMBER_OF_COLUMNS 3
26
27#
28function findapps()
29{
30 find $* -mindepth 1 -executable ! -regex ".*\.\‍(\‍(\|c\|z\‍)sh\|py\‍)" -printf "%f\n" | sort
31}
32
33#
34function findscripts()
35{
36 find $* -mindepth 1 -executable -regex ".*\.\‍(\‍(\|c\|z\‍)sh\|py\‍)" -printf "%f\n" | sort
37}
38
39#
40function findexamples()
41{
42 find $* -mindepth 1 -executable | sort
43}
44
45#
46# Method to get file name of source code.
47#
48# \param 1 executable file
49# \return source file
50#
51function get_source()
52{
53 file=`which $1 2> /dev/null`
54
55 if [[ -n "${file}" && -x ${file} ]]; then
56 if [[ $file == *\.((|c|z)sh|py) ]]; then
57 source=${file}
58 else
59 source=`${file} -v 2> /dev/null | sed -n 's/source: *//p'`
60 fi
61 else
62 source=$1
63 fi
64
65 echo ${source:a}
66}
67
68
69echo "/**"
70echo " * \mainpage Documentation"
71echo " * \htmlonly"
72echo " * <style>"
73echo " * ul.b { list-style-type: none; counter-reset: section; columns: ${NUMBER_OF_COLUMNS}; -moz-column-count: ${NUMBER_OF_COLUMNS}; -webkit-column-count: ${NUMBER_OF_COLUMNS}; column-count: ${NUMBER_OF_COLUMNS}; }"
74echo " * </style>"
75
76# Documents
77
78echo " * <hr>"
79echo " * <h2>Documents</h2>"
80echo " * <ul class=\"b\">"
81for file in `ls ${JPP_DOC}/*`; do
82 if [ -f ${file} ]; then
83 echo " * <li><a href=\"${file##*/}\">${file##*/}</a></li>"
84 fi
85done
86echo " * </ul>"
87
88
89# Applications header
90
91echo " * <hr>"
92echo " * <h2>Applications</h2>"
93echo " * <ul class=\"b\">"
94for file in `findapps ${JPP_BIN}`; do
95 echo " * <li><a href=\"#${file}\">${file}</a></li>"
96done
97echo " * </ul>"
98
99
100# Scripts header
101
102echo " * <hr>"
103echo " * <h2>Scripts</h2>"
104echo " * <ul class=\"b\">"
105for file in `findscripts ${JPP_BIN}`; do
106 echo " * <li><a href=\"#${file}\">${file}</a></li>"
107done
108echo " * </ul>"
109
110
111# Examples header
112
113echo " * <hr>"
114echo " * <h2>Examples</h2>"
115echo " * <ul class=\"b\">"
116for dir in `ls $JPP_DIR/examples`; do
117
118 if [[ -d $JPP_DIR/examples/${dir} ]]; then
119 echo " * <li><a href=\"#examples/${dir}\">${dir}</a></li>"
120 fi
121done
122echo " * </ul>"
123
124
125# Applications data
126
127for file in `findapps ${JPP_BIN}`; do
128
129 source=`get_source ${file}`
130
131 echo " * <hr>"
132 echo " * <h4 id=\"${file}\">"
133 if [[ -n "${source}" ]]; then
134 if (`ls $JPP_DIR/examples/*/${source:t} >& /dev/null`); then
135 source=${source##${JPP_DIR:a}/}
136 else
137 source=${source:t}
138 fi
139 echo " * \\\\endhtmlonly"
140 echo " * ${source}"
141 echo " * \htmlonly"
142 else
143 echo " * ${file}"
144 fi
145 echo " * </h4>"
146 echo " * <pre>"
147 ${file} -h! 2> /dev/null | sed 's/</\&lt;/g;s/>/\&gt;/g'
148 echo " * </pre>"
149 echo " * <a href="#top">Go back to top of page.</a>"
150done
151
152
153# Scripts data
154
155for file in `findscripts ${JPP_BIN}`; do
156
157 source=`eval ls $JPP_DIR/software/*/$file`
158
159 echo " * <hr>"
160 echo " * <h4 id=\"${file}\">"
161 if [[ -n "${source}" ]]; then
162 if (`ls $JPP_DIR/examples/*/${source:t} >& /dev/null`); then
163 source=${source##${JPP_DIR:a}/}
164 else
165 source=${source:t}
166 fi
167 echo " * \\\\endhtmlonly"
168 echo " * ${source}"
169 echo " * \htmlonly"
170 else
171 echo " * ${file}"
172 fi
173 echo " * </h4>"
174 echo " * <pre>"
175 ${file} -h! 2> /dev/null | sed 's/</\&lt;/g;s/>/\&gt;/g'
176 echo " * </pre>"
177 echo " * <a href="#top">Go back to top of page.</a>"
178done
179
180
181# Examples data
182
183for dir in `ls $JPP_DIR/examples`; do
184
185 if [[ -d $JPP_DIR/examples/${dir} ]]; then
186
187 echo " * <hr>"
188 echo " * <h4 id=\"examples/${dir}\">${dir}</h4>"
189 echo " * <ul class=\"b\">"
190 for file in `findexamples $JPP_DIR/examples/${dir}`; do
191 echo " * <li><a href=\"#${file}\">${file:t}</a></li>"
192 done
193 echo " * </ul>"
194 echo " * <a href="#top">Go back to top of page.</a>"
195
196 for file in `findexamples $JPP_DIR/examples/${dir}/`; do
197
198 if [[ ! $file = *.sh && ! $file = *.csh ]]; then
199 source=`get_source ${file}`
200 else
201 source=$file
202 fi
203
204 echo " * <hr>"
205 echo " * <h4 id=\"${file}\">"
206 if [[ -n "${source}" ]]; then
207 if (`ls ${JPP_DIR}/software/*/${source:t} >& /dev/null` || `ls ${JPP_DIR}/examples/^${dir}/${source:t} >& /dev/null`); then
208 source=${source##${JPP_DIR:a}/}
209 else
210 source=${source:t}
211 fi
212 echo " * \\\\endhtmlonly"
213 echo " * ${source}"
214 echo " * \htmlonly"
215 else
216 echo " * ${file}"
217 fi
218 echo " * </h4>"
219 echo " * <pre>"
220 ${file} -h! 2>&1 | sed 's/</\&lt;/g;s/>/\&gt;/g'
221 echo " * </pre>"
222 echo " * <a href="#top">Go back to top of page.</a>"
223 done
224 fi
225done
226
227echo " * \\\\endhtmlonly"
228echo " */"