1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#!/bin/sh
#
# This script generates the required file for supporting the debug
# channels used throught the code.
# The generated file is
# include/debugdefs.h
# The script must be run in the root directory of the project.
#
# Dimitrie O. Paun <dimi@cs.toronto.edu>
# Patrik Stridvall <ps@leissner.se>
#
DEBUG_CHANNELS=`tools/find_debug_channels`
exec > include/debugdefs.h
cat <<EOF
/* Do not modify this file -- it is automatically generated! */
#include "debugtools.h"
#define DEBUG_CLASS_COUNT __DBCL_COUNT
#ifdef DEBUG_RUNTIME
const char * const debug_cl_name[] = { "fixme", "err", "warn", "trace" };
EOF
chno=0
for ch in $DEBUG_CHANNELS
do
echo "const int dbch_$ch = $chno;"
chno=`expr $chno + 1`
done
echo
echo "#define DEBUG_CHANNEL_COUNT $chno"
count=1
echo
echo 'char __debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = {'
for ch in $DEBUG_CHANNELS
do
if [ "${count}" != "${chno}" ]; then
echo "{1, 1, 0, 0},"
else
echo "{1, 1, 0, 0}"
fi
count=`expr $count + 1`
done
echo '};'
count=1
echo
echo 'const char * const debug_ch_name[DEBUG_CHANNEL_COUNT] = {'
for ch in $DEBUG_CHANNELS
do
if [ "${count}" != "${chno}" ]; then
echo "\"${ch}\",";
else
echo "\"${ch}\"";
fi
count=`expr $count + 1`
done
echo '};'
cat <<EOF
#endif /*DEBUG_RUNTIME*/
/* end of automatically generated debug.h */
EOF
|