Stephane Lussier
[wine/dcerpc.git] / tools / make_debug
blobe5a59f0044a6a717d675dd3f1ee034f61708d1a5
1 #!/bin/sh
3 # This script generates the required file for supporting the debug
4 # channels used throught the code.
5 # The generated file is
6 # include/debugdefs.h
7 # The script must be run in the root directory of the project.
9 # Dimitrie O. Paun <dimi@cs.toronto.edu>
10 # Patrik Stridvall <ps@leissner.se>
13 DEBUG_CHANNELS=`tools/find_debug_channels`
15 exec > include/debugdefs.h
17 cat <<EOF
18 /* Do not modify this file -- it is automatically generated! */
20 #include "debugtools.h"
22 #define DEBUG_CLASS_COUNT __DBCL_COUNT
24 static const char * const debug_cl_name[] = { "fixme", "err", "warn", "trace" };
26 EOF
28 chno=0
29 for ch in $DEBUG_CHANNELS
31 echo "char dbch_$ch[] = \"\\003$ch\";"
32 chno=`expr $chno + 1`
33 done
34 echo
35 echo "#define DEBUG_CHANNEL_COUNT $chno"
37 count=1
38 echo
39 echo 'static char * const debug_channels[DEBUG_CHANNEL_COUNT] = {'
40 for ch in $DEBUG_CHANNELS
42 if [ "${count}" != "${chno}" ]; then
43 echo " dbch_${ch},"
44 else
45 echo " dbch_${ch}"
47 count=`expr $count + 1`
48 done
49 echo '};'
51 for cls in err fixme warn trace
53 cat <<EOF
55 int dbg_header_$cls( const char *dbg_channel, const char *func )
57 return dbg_printf( "$cls:%s:%s ", dbg_channel + 1, func );
59 EOF
60 done