Author: esr
Date: Wed Oct 15 01:14:35 2008
New Revision: 30174
URL: http://svn.gna.org/viewcvs/wesnoth?rev=30174&view=rev
Log:
Another wmllint hack around the macro processor.
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=30174&r1=30173&r2=30174&view=diff
==============================================================================
--- trunk/data/core/macros/carryover-utils.cfg (original)
+++ trunk/data/core/macros/carryover-utils.cfg Wed Oct 15 01:14:35 2008
@@ -31,6 +31,8 @@
# These are used in scenarios, to include the carryover-defining keys into
# [endlevel]s and to show the carryover details in the objectives dialog.
+# wmlscope: start conditionals
+
#ifdef NEW_GOLD_CARRYOVER_USED
#define NEW_GOLD_CARRYOVER PERCENTAGE
carryover_add=yes
@@ -62,6 +64,7 @@
# wmlscope: stop ignoring
#endif
+# wmlscope: stop conditionals
# 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=30174&r1=30173&r2=30174&view=diff
==============================================================================
--- trunk/data/tools/wesnoth/wmltools.py (original)
+++ trunk/data/tools/wesnoth/wmltools.py Wed Oct 15 01:14:35 2008
@@ -307,6 +307,7 @@
self.properties = {}
self.unit_ids = {}
ignoreflag = False
+ conditionalsflag = False
if warnlevel >=2:
print "*** Beginning definition-gathering pass..."
for (namespace, filename) in self.filelist.generator():
@@ -348,6 +349,16 @@
else:
self.xref[name] = self.xref[name][:1]
continue
+ if "# wmlscope: start conditionals" in line:
+ if warnlevel > 1:
+ print '"%s", line %d: starting conditionals' \
+ % (filename, n+1)
+ conditionalsflag = True
+ elif "# wmlscope: stop conditionals" in line:
+ if warnlevel > 1:
+ print '"%s", line %d: stopping conditionals' \
+ % (filename, n+1)
+ conditionalsflag = False
if "# wmlscope: start ignoring" in line:
if warnlevel > 1:
print '"%s", line %d: starting ignoring' \
@@ -374,6 +385,8 @@
if name in self.xref:
for defn in self.xref[name]:
if not self.visible_from(defn, filename, n+1):
+ continue
+ elif conditionalsflag:
continue
elif defn.hash != here.hash:
print >>sys.stderr, \
Modified: trunk/data/tools/wmlscope
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmlscope?rev=30174&r1=30173&r2=30174&view=diff
==============================================================================
--- trunk/data/tools/wmlscope (original)
+++ trunk/data/tools/wmlscope Wed Oct 15 01:14:35 2008
@@ -32,23 +32,30 @@
# property, then treat it as non-exporting.
#
# You can tell wmlscope to ignore stretches of config files
-# with the following magic comments?
+# with the following magic comments:
#
# # wmlscope: start ignoring
# # wmlscope: stop ignoring
+#
+# Similarly, you can tell wmlscope to ignore multiple or duplicate macro
+# definitions in a range of lines with the following magic comments:
+#
+# # wmlscope: start conditionals
+# # wmlscope: stop conditionals
+#
+# The following 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.
+#
#
# This tool does catch one kind of implicit reference: if an attack name
# 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