1#! /bin/bash
2
3#
4# src2doxy.sh - fixup some phrases
5#
6# Written by
7#  groepaz <groepaz@gmx.net>
8#
9# This file is part of VICE, the Versatile Commodore Emulator.
10# See README for copyright notice.
11#
12#  This program is free software; you can redistribute it and/or modify
13#  it under the terms of the GNU General Public License as published by
14#  the Free Software Foundation; either version 2 of the License, or
15#  (at your option) any later version.
16#
17#  This program is distributed in the hope that it will be useful,
18#  but WITHOUT ANY WARRANTY; without even the implied warranty of
19#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20#  GNU General Public License for more details.
21#
22#  You should have received a copy of the GNU General Public License
23#  along with this program; if not, write to the Free Software
24#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25#  02111-1307  USA.
26#
27
28# this little script tries to fixup some phrases found in the source so they
29# will (or will not) show up in the doxygen documentation
30#
31# /* BUG: ... -> /*! \bug ...
32# /* FIXME: ... -> /*! \todo FIXME: ...
33# /* TODO: ... -> /*! \todo ...
34# /* #... */ (remove, commented out preprocessor stuff)
35# /* ---... */ (remove)
36# #define ... /* ... */ -> ... /*!< ... */ (autobrief)
37# /* ... */ -> /*! ... */ (autobrief, convert comments to qt style if they begin
38#                          at start of line and the line ends right after them)
39#
40
41#cat $1 | \
42#    sed -s 's/\* BUG:/\*! \\bug /g' |
43#    sed -s 's/\* FIXME:/\*! \\todo FIXME:/g' |
44#    sed -s 's/\* TODO:/\*! \\todo /g' |
45#    sed -s 's:^/\* #.*\*/$::' |
46#    sed -s 's:^/\*.---.*\*/$::' |
47#    sed -s 's:\(^#define .* \)\(/\* \)\(.*\*/$\):\1/\*!< \3:' |
48#    sed -s 's:^/\* \(.*\) \*/$:/\*! \1 \*/:'
49
50# Join regexes together into a single call, reduces execution time from ~21
51# minutes to ~19 minutes. Also remove '/g', which on Linux doesn't seem to have
52# much of an impact, but might on Windows.
53cat $1 | \
54    sed -s 's/\* BUG:/\*! \\bug /;s/\* FIXME:/\*! \\todo FIXME:/;s/\* TODO:/\*! \\todo /;s:^/\* #.*\*/$::;s:^/\*.---.*\*/$::;s:\(^#define .* \)\(/\* \)\(.*\*/$\):\1/\*!< \3:;s:^/\* \(.*\) \*/$:/\*! \1 \*/:'
55
56