Generalize the --from option.

Add an images-unused production so we can find things than need to be
included in animation frames etc.  Note, the report generator emits a
fair number of false positives through not recognizing implicit
references; I'll fix that next.
This commit is contained in:
Eric S. Raymond 2008-02-10 18:32:20 +00:00
parent 1e6919d28f
commit d1c3678356
2 changed files with 6 additions and 2 deletions

View File

@ -35,6 +35,10 @@ utils-unused:
# opaque macros that trying to reference-check them is hopeless.
# So suppress reporting them unused even if they seem to have
# no references.
images-unused:
@echo "# Report on unused images"
@./wmlscope --crossreference --from images --refcount 0 --force-used "terrain/" $(MAINLINE) $(UMC)
all-unused:
@echo "# Report on unused resource files"
@./wmlscope --crossreference --refcount 0 --force-used "terrain/" $(MAINLINE) $(UMC)

View File

@ -235,7 +235,7 @@ Usage: macroscope [options] dirpath
-C, --collisions Report duplicate resource files
-d, --deflist Make definition list
-e regexp, --exclude regexp Ignore files matching the specified regular expression
-f dir, --from dir Report only on macros defined under dir
-f regexp, --from regexp Report only on things defined in files matching regexp
-l, --listfiles List files that will be processed
-r ddd, --refcount=ddd Report only on macros w/references in ddd files
-u, --unresolved Report unresolved macro references
@ -338,7 +338,7 @@ Usage: macroscope [options] dirpath
print n
elif crossreference or definitions or listfiles or unresolved:
def predicate(name, defloc):
if from_restrict and not defloc.filename.startswith(from_restrict):
if from_restrict and not re.search(from_restrict, defloc.filename):
return False
if refcount_restrict!=None \
and len(defloc.references) != refcount_restrict \