API files update.
[wine] / tools / make_debug
1 #!/bin/sh
2 #
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.
8 #
9 # Dimitrie O. Paun <dimi@cs.toronto.edu>
10 # Patrik Stridvall <ps@leissner.se>
11 #
12
13 DEBUG_CHANNELS=`tools/find_debug_channels`
14
15 exec > include/debugdefs.h
16
17 cat <<EOF
18 /* Do not modify this file -- it is automatically generated! */
19
20 #include "debugtools.h"
21
22 #define DEBUG_CLASS_COUNT __DBCL_COUNT
23
24 static const char * const debug_cl_name[] = { "fixme", "err", "warn", "trace" };
25
26 EOF
27
28 chno=0
29 for ch in $DEBUG_CHANNELS
30 do
31     echo "char dbch_$ch[] = \"\\003$ch\";"
32     chno=`expr $chno + 1`
33 done
34 echo
35 echo "#define DEBUG_CHANNEL_COUNT $chno"
36
37 count=1
38 echo
39 echo 'static char * const debug_channels[DEBUG_CHANNEL_COUNT] = {'
40 for ch in $DEBUG_CHANNELS
41 do
42     if [ "${count}" != "${chno}" ]; then
43         echo "    dbch_${ch},"
44     else
45         echo "    dbch_${ch}"
46     fi
47     count=`expr $count + 1`
48 done
49 echo '};'
50
51 for cls in err fixme warn trace
52 do
53     cat <<EOF
54
55 int dbg_header_$cls( const char *dbg_channel, const char *func )
56 {
57     return dbg_printf( "$cls:%s:%s ", dbg_channel + 1, func );
58 }
59 EOF
60 done