Get rid of lame directory-abstraction macros.

Directory structure is exposed elsewhere, so all these really do is
make life difficult for sanity-checking tools.
This commit is contained in:
Eric S. Raymond 2007-05-05 13:28:48 +00:00
parent b0669e064c
commit 043a7a4130
29 changed files with 87 additions and 85 deletions

View file

@ -54,12 +54,6 @@ this list is very incomplete
path=data/campaigns/The_South_Guard
[/binary_path]
### Directory Layout Abstraction ###
#define SG_MAP NAME
map_data="{@campaigns/The_South_Guard/maps/{NAME}.map}"
#enddef
{campaigns/The_South_Guard/utils/sg_unit_utils.cfg}
[+units]

View file

@ -20,9 +20,10 @@
[/music]
{SG_MAP 1_Born_To_The_Banner}
{@campaigns/The_South_Guard/utils/sg_deaths.cfg}
{@campaigns/The_South_Guard/utils/sg_help.cfg}
map_data="{campaigns/The_South_Guard/maps/1_Born_To_The_Banner.map}"
{campaigns/The_South_Guard/utils/sg_deaths.cfg}
{campaigns/The_South_Guard/utils/sg_help.cfg}
{DAWN}
{MORNING}

View file

@ -20,9 +20,10 @@
[/music]
{SG_MAP 2_Proven_By_The_Sword}
{@campaigns/The_South_Guard/utils/sg_deaths.cfg}
{@campaigns/The_South_Guard/utils/sg_help.cfg}
map_data="{campaigns/The_South_Guard/maps/2_Proven_By_The_Sword.map}"
{campaigns/The_South_Guard/utils/sg_deaths.cfg}
{campaigns/The_South_Guard/utils/sg_help.cfg}
[label]
x,y=22,16

View file

@ -19,8 +19,9 @@
append=yes
[/music]
{SG_MAP 3_A_Desperate_Errand}
{@campaigns/The_South_Guard/utils/sg_deaths.cfg}
map_data="{campaigns/The_South_Guard/maps/3_A_Desperate_Errand.map}"
{campaigns/The_South_Guard/utils/sg_deaths.cfg}
{DUSK}
{FIRST_WATCH}

View file

@ -19,9 +19,9 @@
append=yes
[/music]
map_data="{campaigns/The_South_Guard/maps/4_Vale_of_Tears.map}"
{SG_MAP 4_Vale_of_Tears}
{@campaigns/The_South_Guard/utils/sg_deaths.cfg}
{campaigns/The_South_Guard/utils/sg_deaths.cfg}
{DAWN}
{MORNING}

View file

@ -11,8 +11,9 @@
# music changes when bandits are encountered
{SG_MAP 5_Choice_In_The_Fog}
{@campaigns/The_South_Guard/utils/sg_deaths.cfg}
map_data="{campaigns/The_South_Guard/maps/5_Choice_In_The_Fog.map}"
{campaigns/The_South_Guard/utils/sg_deaths.cfg}
{DAWN}
{MORNING}

View file

@ -14,9 +14,10 @@
append=yes
[/music]
{SG_MAP 6a_Tidings_Good_And_Ill}
{@campaigns/The_South_Guard/utils/sg_deaths.cfg}
{@campaigns/The_South_Guard/utils/sg_help.cfg}
map_data="{campaigns/The_South_Guard/maps/6a_Tidings_Good_And_Ill.map}"
{campaigns/The_South_Guard/utils/sg_deaths.cfg}
{campaigns/The_South_Guard/utils/sg_help.cfg}
{DUSK}
{FIRST_WATCH}

View file

@ -15,8 +15,9 @@
[/music]
{SG_MAP 6b_The_Long_March}
{@campaigns/The_South_Guard/utils/sg_deaths.cfg}
map_data="{campaigns/The_South_Guard/maps/6b_The_Long_March.map}"
{campaigns/The_South_Guard/utils/sg_deaths.cfg}
{DUSK}
{FIRST_WATCH}

View file

@ -14,8 +14,9 @@
append=yes
[/music]
{SG_MAP 7a_Into_The_Depths}
{@campaigns/The_South_Guard/utils/sg_deaths.cfg}
map_data="{campaigns/The_South_Guard/maps/7a_Into_The_Depths.map}"
{campaigns/The_South_Guard/utils/sg_deaths.cfg}
{UNDERGROUND}

View file

@ -9,8 +9,9 @@
ms_before=500
[/music]
{SG_MAP 7b_Pebbles_In_The_Flood}
{@campaigns/The_South_Guard/utils/sg_help.cfg}
map_data="{campaigns/The_South_Guard/maps/7b_Pebbles_In_The_Flood.map}"
{campaigns/The_South_Guard/utils/sg_help.cfg}
{DAWN}
{MORNING}

View file

@ -15,7 +15,8 @@
[/music]
{SG_MAP 8a_Vengeance}
map_data="{campaigns/The_South_Guard/maps/8a_Vengeance.map}"
{MORNING}
{AFTERNOON}

View file

@ -15,8 +15,9 @@
[/music]
{SG_MAP 8b_The_Tides_of_War}
{@campaigns/The_South_Guard/utils/sg_deaths.cfg}
map_data="{campaigns/The_South_Guard/maps/8b_The_Tides_of_War.map}"
{campaigns/The_South_Guard/utils/sg_deaths.cfg}
{DAWN}
{MORNING}

View file

@ -67,11 +67,6 @@
path=data/campaigns/Under_the_Burning_Suns
[/binary_path]
# used to load maps
#define DESERTMAP DATA_NAME
map_data="{campaigns/Under_the_Burning_Suns/maps/{DATA_NAME}}"
#enddef
#Append utils folder
{campaigns/Under_the_Burning_Suns/utils}

View file

@ -7,7 +7,7 @@ id="10_SpeakingwiththeFishes"
name= _ "Speaking with the Fishes"
label= _ "Speaking with the Fishes"
{DESERTMAP 10Fish2}
map_data="{campaigns/Under_the_Burning_Suns/maps/10Fish2.map}"
[music]
name=revelation.ogg

View file

@ -13,7 +13,7 @@ label= _ "The Battle for Zocthanol Isle"
next_scenario=12_FinalConfrontation
{DESERTMAP 11Island5}
map_data="{campaigns/Under_the_Burning_Suns/maps/11Island5.map}"
[music]
name=wanderer.ogg

View file

@ -9,7 +9,7 @@ label= _ "The Final Confrontation"
next_scenario=13_Epilogue
{DESERTMAP 12Final4}
map_data="{campaigns/Under_the_Burning_Suns/maps/12Final4.map}"
[music]
name=frantic.ogg

View file

@ -7,7 +7,7 @@ id="13_Epilogue"
name= _ "Epilogue"
label= _ "Epilogue"
{DESERTMAP 13Epilogue}
map_data="{campaigns/Under_the_Burning_Suns/maps/13Epilogue.map}"
[music]
name=elf-land.ogg

View file

@ -8,7 +8,7 @@ id="1_MorningAfter"
name= _ "The Morning After"
label= _ "The Morning After"
{DESERTMAP 1MorningAfter5}
map_data="{campaigns/Under_the_Burning_Suns/maps/1MorningAfter5.map}"
next_scenario=2_HarshSands

View file

@ -7,7 +7,7 @@ id="2_HarshSands"
name= _ "Across the Harsh Sands"
label= _ "Across the Harsh Sands"
{DESERTMAP 2HarshSands12}
map_data="{campaigns/Under_the_Burning_Suns/maps/2HarshSands12.map}"
next_scenario=3_LongNight

View file

@ -12,7 +12,7 @@ id="3_LongNight"
name= _ "A Stirring in the Night"
label= _ "A Stirring in the Night"
{DESERTMAP 3Night4}
map_data="{campaigns/Under_the_Burning_Suns/maps/3Night4.map}"
[music]
name=frantic.ogg

View file

@ -9,7 +9,7 @@ id="4_OrcishFoothills"
name= _ "Descending into Darkness"
label= _ "Descending into Darkness"
{DESERTMAP 4OrcishFoothills9}
map_data="{campaigns/Under_the_Burning_Suns/maps/4OrcishFoothills9.map}"
[music]
name=northerners.ogg

View file

@ -7,7 +7,7 @@ id="5_Struggle"
name= _ "A Subterranean Struggle"
label= _ "A Subterranean Struggle"
{DESERTMAP 5StruggleNew5}
map_data="{campaigns/Under_the_Burning_Suns/maps/5StruggleNew5.map}"
[music]
name=underground.ogg

View file

@ -10,7 +10,7 @@ id="6_1_HuntingTrolls"
name= _ "In the Tunnels of the Trolls"
label= _ "In the Tunnels of the Trolls"
{DESERTMAP 6_1TrollMission5}
map_data="{campaigns/Under_the_Burning_Suns/maps/6_1TrollMission5.map}"
[music]
name=knolls.ogg

View file

@ -7,7 +7,7 @@ id="6_2_HuntingDwarves"
name= _ "In the Domain of the Dwarves"
label= _ "In the Domain of the Dwarves"
{DESERTMAP 6_2DwarfMission3}
map_data="{campaigns/Under_the_Burning_Suns/maps/6_2DwarfMission3.map}"
[music]
name=knolls.ogg

View file

@ -7,7 +7,7 @@ id="7_1_DwarfInterlude"
name= _ "Dealing with Dwarves"
label= _ "Dealing with Dwarves"
{DESERTMAP 7_1DwarfInterlude2}
map_data="{campaigns/Under_the_Burning_Suns/maps/7_1DwarfInterlude2.map}"
[music]
name=underground.ogg

View file

@ -7,7 +7,7 @@ id="7_2_TrollInterlude"
name= _ "Talking with Trolls"
label= _ "Talking with Trolls"
{DESERTMAP 7_2TrollInterlude}
map_data="{campaigns/Under_the_Burning_Suns/maps/7_2TrollInterlude.map}"
[music]
name=underground.ogg

View file

@ -9,7 +9,7 @@ label= _ "Out of the Frying Pan"
next_scenario=9_BloodisThickerThanWater
{DESERTMAP 8Frying8}
map_data="{campaigns/Under_the_Burning_Suns/maps/8Frying8.map}"
[music]
name=underground.ogg

View file

@ -9,7 +9,7 @@ label= _ "Blood is Thicker than Water"
next_scenario=10_SpeakingwiththeFishes
{DESERTMAP 9Water5}
map_data="{campaigns/Under_the_Burning_Suns/maps/9Water5.map}"
[music]
name=loyalists.ogg

View file

@ -53,42 +53,10 @@
import sys, os, time, re, getopt, sre_constants, md5
## Generic cross-referencer code begins here
resource_extensions = ("png", "jpg", "ogg", "wav", "map")
def htmlize(line):
"HTML-escape a text line"
return line.replace("<", "&lt;").replace(">", "&gt;").replace("&", "&amp;")
def interpret(lines, css):
"Interpret the ! convention for .cfg comments."
inlisting = False
outstr = '<p class="%s">' % css
for line in lines:
line = line.rstrip()
if not inlisting and not line:
outstr += "</p><p>"
continue
if not inlisting and line[0] == '!':
outstr += "</p>\n<pre class='listing'>"
inlisting = True
bracketdepth = curlydepth = 0
line = htmlize(line)
if inlisting:
outstr += line[1:] + "\n"
else:
outstr += line + "\n"
if inlisting:
if line and line[0] != '!':
outstr += "</pre>\n<p>"
inlisting = False
if not inlisting:
outstr += "</p>\n"
else:
outstr += "</pre>\n"
outstr = outstr.replace("<p></p>", "")
outstr = outstr.replace("\n\n</pre>", "\n</pre>")
return outstr
class Forest:
"Return an iterable directory forest object."
def __init__(self, dirpath, exclude=None):
@ -343,6 +311,41 @@ class CrossRef:
if not key:
self.missing.append((name, reference(fn,n+1)))
rfp.close()
## Generic cross-referencer code ends here
def interpret(lines, css):
"Interpret the ! convention for .cfg comments."
inlisting = False
outstr = '<p class="%s">' % css
for line in lines:
line = line.rstrip()
if not inlisting and not line:
outstr += "</p><p>"
continue
if not inlisting and line[0] == '!':
outstr += "</p>\n<pre class='listing'>"
inlisting = True
bracketdepth = curlydepth = 0
line = line.replace("<", "&lt;").replace(">", "&gt;").replace("&", "&amp;")
if inlisting:
outstr += line[1:] + "\n"
else:
outstr += line + "\n"
if inlisting:
if line and line[0] != '!':
outstr += "</pre>\n<p>"
inlisting = False
if not inlisting:
outstr += "</p>\n"
else:
outstr += "</pre>\n"
outstr = outstr.replace("<p></p>", "")
outstr = outstr.replace("\n\n</pre>", "\n</pre>")
return outstr
class CrossRefLister(CrossRef):
"Cross-reference generator with reporting functions"
def xrefdump(self, pred=None):
"Report resolved macro references."
for name in self.xref:
@ -516,7 +519,7 @@ Usage: macroscope [options] dirpath
print "# Macroscope reporting on %s" % time.ctime()
print "# Invocation: %s" % " ".join(sys.argv)
print "# Working directory: %s" % os.getcwd()
xref = CrossRef(dirpath, "|".join(exclude), warnlevel)
xref = CrossRefLister(dirpath, "|".join(exclude), warnlevel)
if extracthelp:
xref.extracthelp(dirpath[0], sys.stdout)
elif listfiles: