From d1c367835651d68064ba75fefe5a607ecec6b1e4 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 10 Feb 2008 18:32:20 +0000 Subject: [PATCH] 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. --- data/tools/Makefile | 4 ++++ data/tools/wmlscope | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/data/tools/Makefile b/data/tools/Makefile index 586859c6715..ef2d87a5b1e 100644 --- a/data/tools/Makefile +++ b/data/tools/Makefile @@ -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) diff --git a/data/tools/wmlscope b/data/tools/wmlscope index e4bc7eabd25..ab6387bcafc 100755 --- a/data/tools/wmlscope +++ b/data/tools/wmlscope @@ -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 \