find_debug_channels 1.84 KB
Newer Older
1
#!/bin/sh
Alexandre Julliard's avatar
Alexandre Julliard committed
2 3
#
# This script scans the whole source code for symbols of the form 
Alexandre Julliard's avatar
Alexandre Julliard committed
4 5 6 7 8 9
# 'xxx(yyy' where:
#        xxx is either TRACE, WARN, ERR or WARN
#        yyy is a C identifier 
# It outputs on the standard output a sorted list of the 
# yyy identifiers found in the .c files. 
# Each identifier is reported once. Header files are not scanned.
Alexandre Julliard's avatar
Alexandre Julliard committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#
# The script can be given an argument that specify the files to be
# searched according to the following scheme:
#    - if the argument does not contain a slash (/), the script
#      will search the tree rooted in the current directory for
#      files that match that description. You can also pass
#      wildcard arguments, but remember to quote them to prevent
#      expansion by the shell
#    - if the argument does contain a slash, only that file is
#      searched
#    - if no argument is given, the argument defaults to "*.c"
#      that is, all C files are searched.
#    - if more than a argument is given, only the listed files are
#      searched. Note that in this case, the script will not
#      attempt to find them in some subdirectories, but rather
#      it will try to open them in the current directory.
# Thus, if you want to disable the automatic searching when the file
# name does not contain a /, either prefix the filename with ./
# or add /dev/null as another argument.
#
# Dimitrie O. Paun <dimi@cs.toronto.edu>
31
# Patrik Stridvall <ps@leissner.se>
Alexandre Julliard's avatar
Alexandre Julliard committed
32 33 34 35
#

case "$#" in
    0 | 1)  files=${1:-'*.c'}
36 37
	    if [ `echo $files | sed 's/^\(.*\)\/$/\1/g'` = "$files" ]; then
		files=`find . -name "$files" -print`
Alexandre Julliard's avatar
Alexandre Julliard committed
38 39 40 41
	    fi;;
    *    )  files="$@";;
esac

Alexandre Julliard's avatar
Alexandre Julliard committed
42
(
43 44 45 46
grep -h "DECLARE_DEBUG_CHANNEL *(" $files /dev/null | \
    sed 's/.*DECLARE_DEBUG_CHANNEL( *\([A-Za-z0-9_]*\) *).*/\1/g'
grep -h "DEFAULT_DEBUG_CHANNEL *(" $files /dev/null | \
    sed 's/.*DEFAULT_DEBUG_CHANNEL( *\([A-Za-z0-9_]*\) *).*/\1/g'
Alexandre Julliard's avatar
Alexandre Julliard committed
47
) | sort | uniq