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.
This commit is contained in:
Eric S. Raymond 2008-02-27 11:11:54 +00:00
parent a78354b4d0
commit 92fe16e9ec
18 changed files with 45 additions and 7 deletions

View file

@ -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)"

View file

@ -3,6 +3,7 @@
name="wesnoth-did"
[/textdomain]
# wmlscope: set export=no
[campaign]
id=descent
rank=210

View file

@ -3,6 +3,7 @@
name="wesnoth-ei"
[/textdomain]
# wmlscope: set export=no
[campaign]
rank=130
icon=units/human-loyalists/general.png~RC(magenta>red)

View file

@ -2,6 +2,8 @@
[textdomain]
name="wesnoth-httt"
[/textdomain]
# wmlscope: set export=no
[campaign]
id=heir_throne
rank=30

View file

@ -4,6 +4,7 @@
name="wesnoth-l"
[/textdomain]
# wmlscope: set export=no
[campaign]
id=liberty
name= _ "Liberty"

View file

@ -3,6 +3,7 @@
name="wesnoth-nr"
[/textdomain]
# wmlscope: set export=no
[campaign]
id=northern_rebirth
name= _ "Northern Rebirth"

View file

@ -3,6 +3,7 @@
name="wesnoth-sof"
[/textdomain]
# wmlscope: set export=no
[campaign]
icon="items/sceptre-of-fire.png"
name= _ "The Sceptre of Fire"

View file

@ -3,6 +3,7 @@
name="wesnoth-sotbe"
[/textdomain]
# wmlscope: set export=no
[campaign]
name= _ "Son of the Black-Eye"
abbrev= _ "SotBE"

View file

@ -3,6 +3,7 @@
name="wesnoth-thot"
[/textdomain]
# wmlscope: set export=no
[campaign]
icon="items/hammer-runic.png"
name= _ "The Hammer of Thursagan"

View file

@ -2,6 +2,8 @@
[textdomain]
name="wesnoth-trow"
[/textdomain]
# wmlscope: set export=no
[campaign]
id=The_Rise_of_Wesnoth
rank=120

View file

@ -3,8 +3,8 @@
name="wesnoth-tsg"
[/textdomain]
# wmlscope: set export=no
[campaign]
id=The_South_Guard
name= _ "The South Guard"
abbrev= _ "TSG"

View file

@ -3,6 +3,7 @@
name="wesnoth-tb"
[/textdomain]
# wmlscope: set export=no
[campaign]
id=Two_Brothers
rank=10

View file

@ -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"

View file

@ -1,5 +1,7 @@
#textdomain wesnoth-tutorial
# wmlscope: set export=no
# wmllint: no-syntax-rewrite
{./utils.cfg}

View file

@ -1,6 +1,8 @@
#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}
{core/terrain-graphics/}

View file

@ -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

View file

@ -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]

View file

@ -48,9 +48,9 @@ class Forest:
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 @@ class CrossRef:
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 @@ class CrossRef:
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 @@ class CrossRef:
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 @@ class CrossRef:
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()