Announcement: Find_VS_Config script released

Need help testing contributed art or code or having trouble getting your newest additions into game compatible format? Confused by changes to data formats? Reading through source and wondering what the developers were thinking when they wrote something? Need "how-to" style guidance for messing with VS internals? This is probably the right forum.
Post Reply
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Announcement: Find_VS_Config script released

Post by chuck_starchaser »

Wolphin, of PU development fame, has finished his find_vs_config.py script.

The script automates [url-http://vegastrike.sourceforge.net/forum ... 4249#94249]the procedure originally suggested by safemode[/url] to find config variables and their defaults; it scans the sources for instances of accesses to vegastrike.config, strips out everything other than the "var name=..." part, generates alphabetically sorted internal tables per section, and outputs the results to a valid xml file. Here's a randomly picked excerpt from the generated file:

Code: Select all

		<section name="splash" >
			<var name="auto_hide" value="true" />	<!-- main.cpp:722 -->
			<var name="while_loading_starsystem" value="false" />	<!-- universe_generic.cpp:278 -->
		</section>
It handles multiple calls, and identifies seemingly duplicates, such as,

Code: Select all

		<section name="unitaudio" >
			<var name="afterburner" value="sfx10.wav" />	<!-- cmd/unit_csv.cpp:562 cmd/unit_xml.cpp:1225 -->
			<var name="armor" value="sfx08.wav" />	<!-- cmd/unit_csv.cpp:570,574 cmd/unit_xml.cpp:1233,1237 -->
			<var name="cloak" value="sfx43.wav" />	<!-- cmd/unit_csv.cpp:558 cmd/unit_xml.cpp:1221 -->
			<var name="explode" value="explosion.wav" />	<!-- cmd/unit_csv.cpp:578 cmd/unit_xml.cpp:1241 -->
<!-- <var name="explode" value="sfx43.wav" /> --><!-- cmd/unit_csv.cpp:582 cmd/unit_xml.cpp:1245 ['duplicate variable'] -->
...............
And it detects various other apparent snafus and places them at the bottom of the output file:

Code: Select all

<!-- 		<section name=category >	-->
<!-- 			<var name=option value=def /> -->	<!-- universe_util_generic.cpp:155 ['section not quoted', 'variable not quoted', 'value not quoted', 'broken section'] -->
<!-- 		</section>	-->
<!-- 		<section name=section >	-->
<!-- 			<var name=name value=def /> -->	<!-- universe_util_generic.cpp:720 ['section not quoted', 'variable not quoted', 'value not quoted', 'broken section'] -->
<!-- 			<section name=subsection >	-->
<!-- 				<var name=name value=def /> -->	<!-- universe_util_generic.cpp:723 ['section not quoted', 'subsection not quoted', 'variable not quoted', 'value not quoted', 'broken section', 'broken subsection', 'duplicate variable'] -->
<!-- 			</section>	-->
<!-- 		</section>	-->
<!-- 		<section name=std::string('player')+((squadnum>0)?XMLSupport::tostring(squadnum+1):std::string('')) >	-->
<!-- 			<var name="callsign" value="pilot" /> -->	<!-- options.cpp:130 ['section not quoted', 'broken section'] -->
<!-- 		</section>	-->
	</variables>
</vegaconfig>
The script is here:
https://svn.wcjunction.com/priv_pu/trun ... _config.py

Its latest generated xml output, as of this writing, can be seen here:
https://svn.wcjunction.com/priv_pu/trun ... config.xml

For usage, check Wolphin's find_vs_config.py announcement at the PU board.


I believe this should help with safemode's project of cleaning up the config variables, first of all. Secondly, it is a major leap in documenting vegastrike.config. My suggestion would be that the script be installed on the sourceforge server, as a post-commit hook, to generate an updated output each time there's a commit to svn trunk, and automatically post it to a wiki page.
Once that's done, the work of documenting the variables (explaining what they are for) should be a breeze, and could cross-reference to the generated file.
Perhaps a modification of the script to make it generate wiki formatted headings for each section would be in order, so that cross references can link to the relevant section within the page.

Cheers!
safemode
Developer
Developer
Posts: 2150
Joined: Mon Apr 23, 2007 1:17 am
Location: Pennsylvania
Contact:

Post by safemode »

Sounds good.

You can wiggle out of some of the valid snafu uses of vs_config by looking only for those uses that use string literals for it's arguments.

Also, how are multiple uses handled? is each file documented? that would be an excellent validation check for the options work.

Also, it would be good to mention when the default value string is different when there are multiple instances of a variable lookup. This is something i'm fixing as i add to vs_options.
Ed Sweetman endorses this message.
Post Reply