Debian Codegraph @

data/generators/get-Qt-macros.sh

raw
1 #!/bin/bash
2 #
3 # SPDX-FileCopyrightText: 2011-2012 Alex Turbov
4 #
5 # Simplest (and stupid) way to get #defines from a header file(s)
6 #
7 # TODO Think about to use clang to get (an actual) list of free functions and/or types, classes, etc
8 # Using python bindings it seems possible and not so hard to code...
9 #
10
11 basepath=$1
12 shift
13
14 if [ -n "$*" ]; then
15 for f in $*; do
16 egrep '^\s*#\s*define\s+(Q|QT|QT3)_' ${basepath}/$f
17 done \
18 | sed 's,^\s*#\s*define\s\+\(Q[A-Z0-9_]\+\).*,<item> \1 </item>,' \
19 | sort \
20 | uniq \
21 | grep -v EXPORT \
22 | grep -v QT_BEGIN_ \
23 | grep -v QT_END_ \
24 | grep -v QT_MANGLE_
25 else
26 cat <<EOF
27 Usage:
28 $0 basepath [qt-header-filenames]
29
30 Example:
31 $0 /usr/include/qt4/Qt qglobal.h qconfig.h qfeatures.h
32 EOF
33 fi