]> rtime.felk.cvut.cz Git - frescor/forb.git/blob - src/ul_log_domains
forb: Split forb_port_destroy() to stop and destroy phases
[frescor/forb.git] / src / ul_log_domains
1 #!/bin/sh
2
3 ARRAY_NAME=ul_log_domains_array
4
5 DIRS=""
6
7 while [ $# -gt 0 ] ; do
8   case "x${1}x" in
9     "x--helpx" | "x-hx" )
10       echo -e Usage: `basename ${0}`" [options] <srcdir> .."
11       echo -e "      -h --help       help"
12       echo -e "      -a --array      identifier of log domain array variable"
13       exit 0
14       ;;
15     "x--arrayx" | "x-ax" )
16       shift 1
17       ARRAY_NAME="${1}"
18       ;;
19     "x--"* )
20       echo "Unknown option"
21       exit 2
22       ;;
23     * )
24       DIRS="$DIRS ${1}"
25       ;;
26   esac
27   shift 1
28 done
29
30 DOMAINS=$( for d in $DIRS ; do find -L $d '(' -name '*.c' -o -name '*.cc' ')' -exec grep UL_LOG_CUST '{}' ';' | \
31   sed -n -e 's/^.*UL_LOG_CUST(\([^)]*\)).*$/\1/p' ; done | sort -u )
32
33 #echo $DOMAINS
34
35 #echo -e "#define UL_LOGL_DEF UL_LOGL_DEB\n"
36
37 echo "/*"
38 echo " * This is generated file, do not edit it directly."
39 echo " * Take it from standard output of \"ul_log_domains\""
40 echo " * script called in the top level project directory"
41 echo " */"
42
43 for i in $DOMAINS ; do
44   echo "ul_log_domain_t $i      = {UL_LOGL_DEF, \"$(echo -n $i | sed -n -e 's/ulogd_\(.*\)/\1/pg' )\"};"
45 done
46
47 echo
48 echo "ul_log_domain_t *$ARRAY_NAME[] = {"
49
50 for i in $DOMAINS ; do
51   echo "  &$i,"
52 done
53
54 echo "};"