From 77a54328d50281d43b82341791b2114bc18bfd51 Mon Sep 17 00:00:00 2001 From: ppisa Date: Mon, 25 May 2009 15:34:28 +0000 Subject: [PATCH] Added script to generate log domains arrays for static registration. --- ulut/ul_log_domains | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 ulut/ul_log_domains diff --git a/ulut/ul_log_domains b/ulut/ul_log_domains new file mode 100755 index 0000000..3723907 --- /dev/null +++ b/ulut/ul_log_domains @@ -0,0 +1,54 @@ +#!/bin/sh + +ARRAY_NAME=ul_log_domains_array + +DIRS="" + +while [ $# -gt 0 ] ; do + case "x${1}x" in + "x--helpx" | "x-hx" ) + echo -e Usage: `basename ${0}`" [options] .." + echo -e " -h --help help" + echo -e " -a --array identifier of log domain array variable" + exit 0 + ;; + "x--arrayx" | "x-ax" ) + shift 1 + ARRAY_NAME="${1}" + ;; + "x--"* ) + echo "Unknown option" + exit 2 + ;; + * ) + DIRS="$DIRS ${1}" + ;; + esac + shift 1 +done + +DOMAINS=$( for d in $DIRS ; do find -L $d '(' -name '*.c' -o -name '*.cc' ')' -exec grep UL_LOG_CUST '{}' ';' | \ + sed -n -e 's/^.*UL_LOG_CUST(\([^)]*\)).*$/\1/p' ; done | sort -u ) + +#echo $DOMAINS + +#echo -e "#define UL_LOGL_DEF UL_LOGL_DEB\n" + +echo "/*" +echo " * This is generated file, do not edit it directly." +echo " * Take it from standard output of \"ul_log_domains\"" +echo " * script called in the top level project directory" +echo " */" + +for i in $DOMAINS ; do + echo "ul_log_domain_t $i = {UL_LOGL_DEF, \"$(echo -n $i | sed -n -e 's/ulogd_\(.*\)/\1/pg' )\"};" +done + +echo +echo "ul_log_domain_t *$ARRAY_NAME[] = {" + +for i in $DOMAINS ; do + echo " &$i," +done + +echo "};" -- 2.39.2