3 for LOG_MACRO in TIZEN_LOGI TIZEN_LOGE AlogInfo AlogError; do
5 # Find files containing TIZEN_LOG[IE] macro.
7 FILES=`grep -lr "$LOG[\(,][^.]" Source/`
9 echo "******************"
11 echo "******************"
14 for file in $FILES; do
20 # Get all matches in the file.
21 MATCH_OUTPUT=`grep -hn $LOG $file`
23 # Find number of matches.
24 MATCH_COUNT=`echo "$MATCH_OUTPUT" | wc -l`
27 for (( index=1; index<=$MATCH_COUNT; index++ )); do
29 # Find the line of the i-th match
30 LINENUM=`echo "$MATCH_OUTPUT" | head -n $index | tail -n 1 | grep -o "^[0-9]\+"`
32 for i in $(seq $LINENUM -1 1); do
34 # Find first open brace.
35 LINE=`head -n $i $file | tail -n 1 | grep ^{`
37 if [ ! -z $LINE ]; then
39 for j in $(seq $(($i-1)) -1 1); do
40 # Function name found.
41 FUNCTION_NAME=`head -n $j $file | tail -n 1`
42 if [ "`expr \"$FUNCTION_NAME\" : \"^[# ]\"`" == "0" ]; then
46 if [ "$FUNCTION_NAME" != "$PREV_FUNCTION_NAME" ]; then
48 # Print function name.
50 echo " $FUNCTION_NAME"
55 LOG_LINE=`echo "$MATCH_OUTPUT" | head -n $index | tail -n 1`
56 echo " $LOG_LINE" | sed "s/ \+/ /g"
58 PREV_FUNCTION_NAME=$FUNCTION_NAME