1#!/bin/bash
2
3ARGS=${ARGS:-} # Set to "-v" for debugging
4SCRIPTDIR=$(cd $(dirname "$0"); pwd) # Pick up full path to scripts from wherever doxify.sh lives
5
6nwarnings=0
7
8for file in "$@"; do
9   "${SCRIPTDIR}/is_fypp.py" "${file}" && continue
10
11   # generate temp-file names
12   tmp_file=`mktemp`
13
14   # * First apply the pre-processing script to get rid of any double & type lines
15   # * Run the fixcomments.pl script. This adds comment blocks to any subroutine/function
16   #   definitions that don't have any and checks that existing comments are complete,
17   #   fixing these if required.
18   # * After adding comments, remove any double comment header lines
19   "${SCRIPTDIR}/remove_double_ampersands.pl" ${ARGS} "${file}" \
20       | "${SCRIPTDIR}/fixcomments.pl" ${ARGS} \
21       | "${SCRIPTDIR}/remove_extra_comments.pl" ${ARGS} > "${tmp_file}"
22
23   # Copy the final modified source file on top of the original file
24   if ! cmp -s "${file}" "${tmp_file}" ; then
25       cp "${tmp_file}" "${file}"
26   fi
27
28   # Remove temp-file
29   rm -f "${tmp_file}"
30
31   if grep -e "UNMATCHED_PROCEDURE_ARGUMENT" \
32           -e "UNKNOWN_DOXYGEN_COMMENT" \
33           -e "UNKNOWN_COMMENT" \
34           "${file}" ; then
35     echo "Found doxify warnings in ${file}"
36     ((nwarnings++))
37   fi
38done
39
40exit ${nwarnings}
41