Author: esr
Date: Wed Feb 27 12:11:54 2008
New Revision: 24112

URL: http://svn.gna.org/viewcvs/wesnoth?rev=24112&view=rev
Log:
Add export-property comments to _main.cfgs.  These will control whether or
not wmlscope expects each namespace to export names.  Presently,
core exports but campaigns do not. 

Modified:
    trunk/data/campaigns/An_Orcish_Incursion/_main.cfg
    trunk/data/campaigns/Descent_Into_Darkness/_main.cfg
    trunk/data/campaigns/Eastern_Invasion/_main.cfg
    trunk/data/campaigns/Heir_To_The_Throne/_main.cfg
    trunk/data/campaigns/Liberty/_main.cfg
    trunk/data/campaigns/Northern_Rebirth/_main.cfg
    trunk/data/campaigns/Sceptre_of_Fire/_main.cfg
    trunk/data/campaigns/Son_Of_The_Black_Eye/_main.cfg
    trunk/data/campaigns/The_Hammer_of_Thursagan/_main.cfg
    trunk/data/campaigns/The_Rise_Of_Wesnoth/_main.cfg
    trunk/data/campaigns/The_South_Guard/_main.cfg
    trunk/data/campaigns/Two_Brothers/_main.cfg
    trunk/data/campaigns/Under_the_Burning_Suns/_main.cfg
    trunk/data/campaigns/tutorial/scenarios/1_Tutorial.cfg
    trunk/data/core/_main.cfg
    trunk/data/multiplayer/_main.cfg
    trunk/data/themes/default.cfg
    trunk/data/tools/wesnoth/wmltools.py

Modified: trunk/data/campaigns/An_Orcish_Incursion/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/An_Orcish_Incursion/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/An_Orcish_Incursion/_main.cfg (original)
+++ trunk/data/campaigns/An_Orcish_Incursion/_main.cfg Wed Feb 27 12:11:54 2008
@@ -2,6 +2,8 @@
 [textdomain]
     name="wesnoth-aoi"
 [/textdomain]
+
+# wmlscope: set export=no
 [campaign]
     id="orcish_incursion"
     icon="elves-wood/lord.png~TC(1,magenta)"

Modified: trunk/data/campaigns/Descent_Into_Darkness/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Descent_Into_Darkness/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/Descent_Into_Darkness/_main.cfg (original)
+++ trunk/data/campaigns/Descent_Into_Darkness/_main.cfg Wed Feb 27 12:11:54 
2008
@@ -3,6 +3,7 @@
     name="wesnoth-did"
 [/textdomain]
 
+# wmlscope: set export=no
 [campaign]
     id=descent
     rank=210

Modified: trunk/data/campaigns/Eastern_Invasion/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Eastern_Invasion/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/Eastern_Invasion/_main.cfg (original)
+++ trunk/data/campaigns/Eastern_Invasion/_main.cfg Wed Feb 27 12:11:54 2008
@@ -3,6 +3,7 @@
     name="wesnoth-ei"
 [/textdomain]
 
+# wmlscope: set export=no
 [campaign]
     rank=130
     icon=units/human-loyalists/general.png~RC(magenta>red)

Modified: trunk/data/campaigns/Heir_To_The_Throne/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Heir_To_The_Throne/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/Heir_To_The_Throne/_main.cfg (original)
+++ trunk/data/campaigns/Heir_To_The_Throne/_main.cfg Wed Feb 27 12:11:54 2008
@@ -2,6 +2,8 @@
 [textdomain]
     name="wesnoth-httt"
 [/textdomain]
+
+# wmlscope: set export=no
 [campaign]
     id=heir_throne
     rank=30

Modified: trunk/data/campaigns/Liberty/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Liberty/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/Liberty/_main.cfg (original)
+++ trunk/data/campaigns/Liberty/_main.cfg Wed Feb 27 12:11:54 2008
@@ -4,6 +4,7 @@
     name="wesnoth-l"
 [/textdomain]
 
+# wmlscope: set export=no
 [campaign]
     id=liberty
     name= _ "Liberty"

Modified: trunk/data/campaigns/Northern_Rebirth/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Northern_Rebirth/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/Northern_Rebirth/_main.cfg (original)
+++ trunk/data/campaigns/Northern_Rebirth/_main.cfg Wed Feb 27 12:11:54 2008
@@ -3,6 +3,7 @@
     name="wesnoth-nr"
 [/textdomain]
 
+# wmlscope: set export=no
 [campaign]
     id=northern_rebirth
     name= _ "Northern Rebirth"

Modified: trunk/data/campaigns/Sceptre_of_Fire/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Sceptre_of_Fire/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/Sceptre_of_Fire/_main.cfg (original)
+++ trunk/data/campaigns/Sceptre_of_Fire/_main.cfg Wed Feb 27 12:11:54 2008
@@ -3,6 +3,7 @@
     name="wesnoth-sof"
 [/textdomain]
 
+# wmlscope: set export=no
 [campaign]
     icon="items/sceptre-of-fire.png"
     name= _ "The Sceptre of Fire"

Modified: trunk/data/campaigns/Son_Of_The_Black_Eye/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Son_Of_The_Black_Eye/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/Son_Of_The_Black_Eye/_main.cfg (original)
+++ trunk/data/campaigns/Son_Of_The_Black_Eye/_main.cfg Wed Feb 27 12:11:54 2008
@@ -3,6 +3,7 @@
     name="wesnoth-sotbe"
 [/textdomain]
 
+# wmlscope: set export=no
 [campaign]
     name= _ "Son of the Black-Eye"
     abbrev= _ "SotBE"

Modified: trunk/data/campaigns/The_Hammer_of_Thursagan/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/The_Hammer_of_Thursagan/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/The_Hammer_of_Thursagan/_main.cfg (original)
+++ trunk/data/campaigns/The_Hammer_of_Thursagan/_main.cfg Wed Feb 27 12:11:54 
2008
@@ -3,6 +3,7 @@
     name="wesnoth-thot"
 [/textdomain]
 
+# wmlscope: set export=no
 [campaign]
     icon="items/hammer-runic.png"
     name= _ "The Hammer of Thursagan"

Modified: trunk/data/campaigns/The_Rise_Of_Wesnoth/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/The_Rise_Of_Wesnoth/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/The_Rise_Of_Wesnoth/_main.cfg (original)
+++ trunk/data/campaigns/The_Rise_Of_Wesnoth/_main.cfg Wed Feb 27 12:11:54 2008
@@ -2,6 +2,8 @@
 [textdomain]
     name="wesnoth-trow"
 [/textdomain]
+
+# wmlscope: set export=no
 [campaign]
     id=The_Rise_of_Wesnoth
     rank=120

Modified: trunk/data/campaigns/The_South_Guard/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/The_South_Guard/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/The_South_Guard/_main.cfg (original)
+++ trunk/data/campaigns/The_South_Guard/_main.cfg Wed Feb 27 12:11:54 2008
@@ -3,8 +3,8 @@
     name="wesnoth-tsg"
 [/textdomain]
 
+# wmlscope: set export=no
 [campaign]
-
     id=The_South_Guard
     name= _ "The South Guard"
     abbrev= _ "TSG"

Modified: trunk/data/campaigns/Two_Brothers/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Two_Brothers/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/Two_Brothers/_main.cfg (original)
+++ trunk/data/campaigns/Two_Brothers/_main.cfg Wed Feb 27 12:11:54 2008
@@ -3,6 +3,7 @@
     name="wesnoth-tb"
 [/textdomain]
 
+# wmlscope: set export=no
 [campaign]
     id=Two_Brothers
     rank=10

Modified: trunk/data/campaigns/Under_the_Burning_Suns/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Under_the_Burning_Suns/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/Under_the_Burning_Suns/_main.cfg (original)
+++ trunk/data/campaigns/Under_the_Burning_Suns/_main.cfg Wed Feb 27 12:11:54 
2008
@@ -8,6 +8,7 @@
     name="wesnoth-utbs"
 [/textdomain]
 
+# wmlscope: set export=no
 [campaign]
     
icon=../data/campaigns/Under_the_Burning_Suns/images/units/elves-desert/kaleh.png
     name= _ "Under the Burning Suns"

Modified: trunk/data/campaigns/tutorial/scenarios/1_Tutorial.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/tutorial/scenarios/1_Tutorial.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/campaigns/tutorial/scenarios/1_Tutorial.cfg (original)
+++ trunk/data/campaigns/tutorial/scenarios/1_Tutorial.cfg Wed Feb 27 12:11:54 
2008
@@ -1,4 +1,6 @@
 #textdomain wesnoth-tutorial
+
+# wmlscope: set export=no
 
 # wmllint: no-syntax-rewrite
 

Modified: trunk/data/core/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/core/_main.cfg (original)
+++ trunk/data/core/_main.cfg Wed Feb 27 12:11:54 2008
@@ -1,5 +1,7 @@
 #textdomain wesnoth
 # Main purpose of this file is to ensure that macros get read in first.
+
+# wmlscope: set export=yes
 
 #ifdef EDITOR
 {core/terrain.cfg}

Modified: trunk/data/multiplayer/_main.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/multiplayer/_main.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/multiplayer/_main.cfg (original)
+++ trunk/data/multiplayer/_main.cfg Wed Feb 27 12:11:54 2008
@@ -1,4 +1,7 @@
 #textdomain wesnoth-multiplayer
+
+# wmlscope: set export=no
+
 # Main purpose of this file is to ensure that macros get read in first.
 [generic_multiplayer]
     id=user_map

Modified: trunk/data/themes/default.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/themes/default.cfg?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/themes/default.cfg (original)
+++ trunk/data/themes/default.cfg Wed Feb 27 12:11:54 2008
@@ -1,7 +1,11 @@
 #textdomain wesnoth
 
-# some information about how theming works (especially the coordinates defined 
with rect=):
+# wmlscope: set export=no
+
+# some information about how theming works (especially the coordinates
+# defined with rect=):
 # http://www.wesnoth.org/forum/viewtopic.php?p=213708#213708
+
 [theme]
     name=null
     [resolution]

Modified: trunk/data/tools/wesnoth/wmltools.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wesnoth/wmltools.py?rev=24112&r1=24111&r2=24112&view=diff
==============================================================================
--- trunk/data/tools/wesnoth/wmltools.py (original)
+++ trunk/data/tools/wesnoth/wmltools.py Wed Feb 27 12:11:54 2008
@@ -48,9 +48,9 @@
         return allfiles
     def generator(self):
         "Return a generator that walks through all files."
-        for tree in self.forest:
+        for (dir, tree) in zip(self.dirpath, self.forest):
             for filename in tree:
-                yield filename
+                yield (dir, filename)
 
 def iswml(filename):
     "Is the specified filename WML?"
@@ -239,9 +239,10 @@
         self.xref = {}
         self.fileref = {}
         self.noxref = False
+        self.properties = {}
         if warnlevel >=2:
             print "*** Beginning definition-gathering pass..."
-        for filename in self.filelist.generator():
+        for (namespace, filename) in self.filelist.generator():
             if warnlevel > 1:
                 print filename + ":"
             if isresource(filename):
@@ -261,7 +262,14 @@
                         print '"%s", line %d: warnlevel set to %d 
(definition-gathering pass)' \
                              % (filename, n+1, warnlevel)
                         continue
-                    elif line.strip().startswith("#define"):
+                    m = re.search("# *wmlscope: set *([^=]*)=(.*)", line)
+                    if m:
+                        prop = m.group(1).strip()
+                        value = m.group(1).strip()
+                        if namespace not in self.properties:
+                            self.properties[namespace] = {}
+                        self.properties[namespace][prop] = value
+                    if line.strip().startswith("#define"):
                         tokens = line.split()
                         name = tokens[1]
                         here = Reference(filename, n+1, line, args=tokens[2:])
@@ -316,7 +324,7 @@
         formals = []
         if warnlevel >=2:
             print "*** Beginning reference-gathering pass..."
-        for fn in self.filelist.generator():
+        for (namespace, fn) in self.filelist.generator():
             if iswml(fn):
                 rfp = open(fn)
                 attack_name = None
@@ -465,6 +473,10 @@
                         elif line.strip().startswith("["):
                             beneath += 1
                 rfp.close()
+        # Check whether each namespace has a defined export property
+        for namespace in dirpath:
+            if namespace not in self.properties or "export" not in 
self.properties[namespace]:
+                print "warning: %s has no export property" % namespace
     def subtract(self, filelist):
         "Transplant file references in files from filelist to a new CrossRef."
         smallref = CrossRef()


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to