PreprocessorRef

From The Battle for Wesnoth Wiki
Revision as of 20:41, 16 August 2010 by Timotei21 (talk | contribs) (add info about: --preprocess-input/output-macros)

The preprocessor command line

Template:DevFeature1.9

As of wesnoth 1.9, there are some new command line arguments available for the wesnoth executable: --preprocess --preprocess-input-macros --preprocess-output-macros

Commands details:

--preprocess

--preprocess[=define1,define2,...] <file/folder> <target directory>

or the short form:

-p[=define1,define2,...] <file/folder> <target directory>

The define1,define2,... is a list of defines, to be added before anything is preprocessed.

The preprocess command will preprocess first the common config files in data/core, and afterwards, the specified ones. You can specifiy a single file to be preprocesses (if you want to preprocess multiple separate files, you have to invoke the command separately), or an entire folder (this will be preprocessed on the known preprocessor rules).

The resulted preprocessed files will be written in the target directory. There will be 2 types of files: the .cfg files and .plain files (this contain the line symbols and textdomain changes)

If <file/folder> and <target directory> are not in absolute path form, they will be treated like relative to the wesnoth's executable path.

Some examples:

-p ~/wesnoth/data/campaigns/tutorial ~/result 

will preprocess entire tutorial folder, and write the resulted files in the ~/result folder

-p=MULTIPLAYER data/campaigns/my_campaign/some_scenario.cfg data/result

will add the MULTIPLAYER define in defines list and then preprocess the scenario config file

-p=SINGLEPLAYER,HARD ~/wesnoth/data/campaigns/my_campaign ~/result

will add the SINGLEPLAYER and HARD defines before preprocessing the files.

Note! As you saw in the examples, the '=' character is mandatory if you want to specify any auxiliar defines

--preprocess-input-macros

--preprocess-input-macros <file>

This command will take the specified file, parse the defines in it, and will use them when preprocessing the resource with --preprocess. The file must contain only [preproc_define]s. This is different than adding defines to --preprocess, as it contains the macro information.

--preprocess-output-macro

--preprocess-output-macro [<file>]

Outputs the defines_map resulted from preprocessing. This is will include (if any) --preprocess-input-macro file's content.


If you want a more detailed log, you can simply add the command: "--log-debug=all" or "--log-info=all" before the preprocessing command, so you will see how things are parsed,etc.