mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-17 12:46:27 +00:00
Added to repository.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1274 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/gawk -f
|
||||
|
||||
############################################################################
|
||||
#
|
||||
# Script for filtering TRACE_ENTRY(), TRACE_EXIT() and TRACE_EXIT_RES()
|
||||
# statements from a patch.
|
||||
#
|
||||
# Copyright (C) 2009 Bart Van Assche <bart.vanassche@gmail.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation, version 2
|
||||
# of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
function categorize_line() {
|
||||
is_blank = 0
|
||||
is_trace_entry = 0
|
||||
is_trace_exit = 0
|
||||
if ($0 ~ "^+$")
|
||||
is_blank = 1
|
||||
else if ($0 ~ "^+\tTRACE_ENTRY\\(\\);$")
|
||||
is_trace_exit = 1
|
||||
else if ($0 ~ "^+\tTRACE_EXIT\\(\\);$" || $0 ~ "^+\tTRACE_EXIT_RES\\(.*\\);$")
|
||||
is_trace_exit = 1
|
||||
}
|
||||
|
||||
function print_conditionally() {
|
||||
if (! previous_is_trace_entry \
|
||||
&& ! (before_previous_is_trace_entry && previous_is_blank) \
|
||||
&& ! previous_is_trace_exit \
|
||||
&& ! (previous_is_blank && is_trace_exit))
|
||||
print previous_line
|
||||
}
|
||||
|
||||
function shift_state_variables() {
|
||||
previous_line = $0
|
||||
before_previous_is_blank = previous_is_blank
|
||||
before_previous_is_trace_entry = previous_is_trace_entry
|
||||
before_previous_is_trace_exit = previous_is_trace_exit
|
||||
previous_is_blank = is_blank
|
||||
previous_is_trace_entry = is_trace_entry
|
||||
previous_is_trace_exit = is_trace_exit
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
previous_is_blank = 0
|
||||
previous_is_trace_entry = 0
|
||||
previous_is_trace_exit = 0
|
||||
getline
|
||||
categorize_line()
|
||||
shift_state_variables()
|
||||
}
|
||||
|
||||
{
|
||||
categorize_line()
|
||||
print_conditionally()
|
||||
shift_state_variables()
|
||||
}
|
||||
|
||||
END {
|
||||
print_conditionally()
|
||||
}
|
||||
Reference in New Issue
Block a user