wine/tools/find_debug_channels
1999-10-25 15:38:58 +00:00

48 lines
1.9 KiB
Bash
Executable File

#!/bin/sh
#
# This script scans the whole source code for symbols of the form
# 'xxx(yyy' where:
# xxx is either DECLARE_DEBUG_CHANNEL or DEFAULT_DEBUG_CHANNEL
# 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.
#
# The script can be given an argument that specifies 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 one 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>
# Patrik Stridvall <ps@leissner.se>
#
case "$#" in
0 | 1) files=${1:-'*.c'}
if [ `echo $files | sed 's/^\(.*\)\/$/\1/g'` = "$files" ]; then
files=`find . -name "$files" -print`
fi;;
* ) files="$@";;
esac
(
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'
) | sort | uniq