might be useful if you want to see a common-segment report only for
files with a particular extension such as .h or .S.</para>
+<para>The -F option takes an argument which is a file containing
+a list of filenames. Any clique that does not contain one of these
+filenames is discarded.</para>
+
<para>The -n option suppresses code listing, so that an SCF-B output
is produced instead. You can use this to filter common-segment
-reports with -m and -f options of the tool.</para>
+reports with -m, -f, and -F options of the tool and then hand-filter
+them for junk before generating a listing.</para>
<para>Each <application>filterator</application> line beginning with %
is the filename from which the following common span of lines is displayed
# Main line begins here
import getopt
try:
- (optlist, args) = getopt.getopt(sys.argv[1:], 'd:f:m:n')
+ (optlist, args) = getopt.getopt(sys.argv[1:], 'd:f:F:m:n')
except getopt.GetoptError:
- sys.stderr.write("usage: filterator [-n] [-d dir] [-m size] [-f filter]\n")
+ sys.stderr.write("usage: filterator [-n] [-d dir] [-m size] [-f filter] [-F matchfile]\n")
sys.exit(2)
dir = None
filter = None
minsize = 5
expand = True
+ matchfiles = []
linecounts = {}
for (opt, val) in optlist:
if opt == '-d':
dir = val
elif opt == '-f':
filter = re.compile(val)
+ elif opt == '-F':
+ fp = open(val, "r")
+ matchfiles = map(lambda x: x.strip(), fp.readlines())
+ fp.close()
elif opt == '-m':
minsize = int(val)
elif opt == '-n':
state.cliquefilter(lambda file,start,end: end-start+1 >= minsize)
if filter:
state.cliquefilter(lambda file, start, end: filter.search(file))
+ if matchfiles:
+ state.cliquefilter(lambda file, start, end: file in matchfiles)
try:
if expand:
state.metadump(sys.stdout, (75 * '-')+"\n", reporthook, {"Minimum-Size":minsize})