Author: esr
Date: Sun Apr 8 01:09:56 2007
New Revision: 16682
URL: http://svn.gna.org/viewcvs/wesnoth?rev=16682&view=rev
Log:
Improve documentation, speed yp processing in macroscope.
Modified:
trunk/data/tools/macroscope
Modified: trunk/data/tools/macroscope
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/macroscope?rev=16682&r1=16681&r2=16682&view=diff
==============================================================================
--- trunk/data/tools/macroscope (original)
+++ trunk/data/tools/macroscope Sun Apr 8 01:09:56 2007
@@ -17,6 +17,10 @@
datafiles = filter(lambda x: ".svn" not in x, datafiles)
datafiles = filter(lambda x: not os.path.isdir(x), datafiles)
return datafiles
+
+def iswml(filename):
+ "Is the specified filename WML?"
+ return filename.endswith(".cfg")
class reference:
"Describes a location by file and line."
@@ -49,8 +53,6 @@
self.unresolved = []
formals = []
for filename in filelist:
- if not filename.endswith(".cfg"):
- continue
rfp = open(filename)
for (n, line) in enumerate(rfp):
if line.startswith("#define"):
@@ -97,13 +99,14 @@
if __name__ == "__main__":
def help():
sys.stderr.write("""\
-Usage: macroscope [options] sourcedirpath targetdirpath
+Usage: macroscope [options] dirpath
Options may be any of these:
- -h, --help Emit this help message
- -b dir, --basedir=dir Set base directory for relative paths
- -c, --crossreference Report target-to-source references
- -u, --unresolved Report sourcepath macros unresolved in targetpath
- -r ddd, --refcount=ddd Report only on macros w/refs in ddd files
+ -h, --help Emit this help message and quit
+ -c, --crossreference Report resolved macro references
+ -u, --unresolved Report unresolved macro references
+ -f dir, --from dir Report only on macros defined under dir
+ -r ddd, --refcount=ddd Report only on macros w/references in ddd files
+ The required dirpath argument may be a colon-separated directory list.
""")
# Process options
@@ -136,7 +139,7 @@
print "# Directory path: %s" % dirpath
files = allfiles(dirpath)
if crossreference or unresolved:
- xref = macro_cross_reference(allfiles(dirpath))
+ xref = macro_cross_reference(filter(iswml, allfiles(dirpath)))
def predicate(name, defloc, references):
if from_restrict and not defloc.filename.startswith(from_restrict):
return False
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits