File indexing completed on 2024-05-12 15:49:58

0001 #!/bin/bash
0002 #
0003 # SPDX-FileCopyrightText: 2011-2012 Alex Turbov 
0004 #
0005 # Simplest (and stupid) way to get #defines from a header file(s)
0006 #
0007 # TODO Think about to use clang to get (an actual) list of free functions and/or types, classes, etc
0008 #      Using python bindings it seems possible and not so hard to code...
0009 #
0010 
0011 basepath=$1
0012 shift
0013 
0014 if [ -n "$*" ]; then
0015   for f in $*; do
0016     egrep '^\s*#\s*define\s+(Q|QT|QT3)_' ${basepath}/$f
0017   done \
0018     | sed 's,^\s*#\s*define\s\+\(Q[A-Z0-9_]\+\).*,<item> \1 </item>,' \
0019     | sort \
0020     | uniq \
0021     | grep -v EXPORT \
0022     | grep -v QT_BEGIN_ \
0023     | grep -v QT_END_ \
0024     | grep -v QT_MANGLE_
0025 else
0026   cat <<EOF
0027 Usage:
0028   $0 basepath [qt-header-filenames]
0029 
0030 Example:
0031   $0 /usr/include/qt4/Qt qglobal.h qconfig.h qfeatures.h
0032 EOF
0033 fi