3 # This script scans the whole source code for symbols of the form dprintf_xxx,
4 # generates the necessary macro definitions and puts them into the files
5 # include/stddebug.h and include/debug.h . This script must be started with
6 # cwd = rootdir of the Wine-distribution.
8 # Michael Patra <micky@marie.physik.tu-berlin.de>
10 DEBUG_H
=include
/debug.h
11 STDDEBUG_H
=include
/stddebug.h
13 mv $DEBUG_H $DEBUG_H.old
14 mv $STDDEBUG_H $STDDEBUG_H.old
16 # Build the list of debug identifiers
17 grep -h dprintf_
*/*.c |
sed 's/.*dprintf_\([A-Za-z0-9_]*\).*/\1/g' | \
22 sed '/^\/\* Do not remove this line or change anything below this line \*\//q'\
23 <$DEBUG_H.old
>$DEBUG_H
24 cat <<++EOF
++ >> $DEBUG_H
29 cat temp.$$ |
tr a-z A-Z |
33 echo "#undef DEBUG_$x" >> $DEBUG_H
37 cat <<++EOF
++ >>$DEBUG_H
43 cat temp.$$ |
tr a-z A-Z |
47 echo "#define DEBUG_$x" >> $DEBUG_H
51 cat <<++EOF
++ >>$DEBUG_H
55 #ifdef DEBUG_DEFINE_VARIABLES
56 short debug_msg_enabled
[]={
59 cat temp.$$ |
tr a-z A-Z |
63 cat <<++EOF
++ >>$DEBUG_H
74 cat <<++EOF
++ >>$DEBUG_H
78 extern short debug_msg_enabled
[];
89 y
=`echo $x | tr a-z A-Z`
90 cat <<++EOF
++ >>$DEBUG_H
92 #define dprintf_$x if(debug_msg_enabled[$i]) fprintf
95 #define dprintf_$x fprintf
106 cat <<++EOF
++ >>$DEBUG_H
109 #ifdef DEBUG_DEFINE_VARIABLES
110 static char
*debug_msg_name
[] = {
117 echo " \"$x\"," >> $DEBUG_H
121 cat <<++EOF
++ >>$DEBUG_H
130 sed '/^\/\* Do not remove this line or change anything below this line \*\//q'\
131 <$STDDEBUG_H.old
>$STDDEBUG_H
133 cat <<++EOF
++ >>$STDDEBUG_H
138 cat temp.$$ |
tr a-z A-Z |
142 echo "#undef DEBUG_$x" >> $STDDEBUG_H
146 cat <<++EOF
++ >>$STDDEBUG_H
152 cat temp.$$ |
tr a-z A-Z |
156 echo "#define DEBUG_$x" >> $STDDEBUG_H
159 echo "#endif" >> $STDDEBUG_H
161 rm temp.$$
$DEBUG_H.old
$STDDEBUG_H.old