Author: esr
Date: Wed Oct 15 00:30:21 2008
New Revision: 30171
URL: http://svn.gna.org/viewcvs/wesnoth?rev=30171&view=rev
Log:
Teach wmlscope to selectively ignore multiple macro definitions.
Modified:
trunk/data/core/macros/carryover-utils.cfg
trunk/data/tools/wesnoth/wmltools.py
trunk/data/tools/wmlscope
Modified: trunk/data/core/macros/carryover-utils.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/macros/carryover-utils.cfg?rev=30171&r1=30170&r2=30171&view=diff
==============================================================================
--- trunk/data/core/macros/carryover-utils.cfg (original)
+++ trunk/data/core/macros/carryover-utils.cfg Wed Oct 15 00:30:21 2008
@@ -61,3 +61,7 @@
#enddef
# wmlscope: stop ignoring
#endif
+
+# wmlscope: prune NEW_GOLD_CARRYOVER
+# wmlscope: prune NEW_GOLD_CARRYOVER_NOTE_20
+# wmlscope: prune NEW_GOLD_CARRYOVER_NOTE_40
Modified: trunk/data/tools/wesnoth/wmltools.py
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wesnoth/wmltools.py?rev=30171&r1=30170&r2=30171&view=diff
==============================================================================
--- trunk/data/tools/wesnoth/wmltools.py (original)
+++ trunk/data/tools/wesnoth/wmltools.py Wed Oct 15 00:30:21 2008
@@ -266,7 +266,7 @@
try:
pattern = re.compile(os.sep + pattern + "$")
except sre_constants.error:
- print >>sys.stderr, "macroscope: confused by %s" % pattern
+ print >>sys.stderr, "wmlscope: confused by %s" % pattern
return None
key = None
for trial in self.fileref:
@@ -337,6 +337,17 @@
if namespace not in self.properties:
self.properties[namespace] = {}
self.properties[namespace][prop] = value
+ m = re.search("# *wmlscope: prune (.*)", line)
+ if m:
+ name = m.group(1)
+ if warnlevel >= 2:
+ print '"%s", line %d: pruning definitions of %s' \
+ % (filename, n+1, name )
+ if name not in self.xref:
+ print >>sys.stderr, "wmlscope: can't prune
undefined macro %s" % name
+ else:
+ self.xref[name] = self.xref[name][:1]
+ continue
if "# wmlscope: start ignoring" in line:
if warnlevel > 1:
print '"%s", line %d: starting ignoring' \
Modified: trunk/data/tools/wmlscope
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmlscope?rev=30171&r1=30170&r2=30171&view=diff
==============================================================================
--- trunk/data/tools/wmlscope (original)
+++ trunk/data/tools/wmlscope Wed Oct 15 00:30:21 2008
@@ -41,6 +41,14 @@
# is specified but no icon is given, the attack icon will default to
# a name generated from the attack name. This behavior can be suppressed
# by adding a magic comment containing the string "no-icon" to the name= line.
+#
+# The collowing magic comment:
+#
+# # prune FOOBAR
+#
+# will cause wmlscope to forget about all but one of the definitions of FOOBAR
+# it has seen. This will be useful mainly for symbols that have different
+# definitions enabled by an #ifdef.
#
# The checking done by this tool has a couple of flaws:
#
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits