An Uncrustify Documentation Script (UDS) is a text file used to drive the execution of uncrustify with various values of the same option.
80% of what you need to know is in this table:
Syntax | Examples | ||
---|---|---|---|
align_func_params.uds | nl_after_if.uds | cmt_reflow_mode.uds | |
==== NAME <option_name> ==== CODE ... valid C/C++/Java code ... ==== SET <option_name>=<value1> ==== SET <option_name>=<value2> ==== SET <option_name>=<value3> |
==== NAME align_func_params ==== CODE void main(void){ puts("Hello world!"); } ==== SET align_func_params=false ==== SET align_func_params=true | ==== NAME nl_after_if ==== CODE void main(void){ puts("Hello world!"); } ==== SET nl_after_if=ignore ==== SET nl_after_if=add ==== SET nl_after_if=remove ==== SET nl_after_if=force ==== SET nl_after_if=not_defined | ==== NAME cmt_reflow_mode ==== CODE void main(void){ puts("Hello world!"); } ==== SET cmt_reflow_mode=0 ==== SET cmt_reflow_mode=1 ==== SET cmt_reflow_mode=2 |
You can explore the existing uds files.
The name of the file must be <option_name>.uds Example: align_func_params.uds
and the line ==== NAME <option_name>
must be the first section and inline with the name of the file it belongs to.
By default the CODE section is selected by an algorithm based on the option name.
For example, the option 'indent_else_if' will trigger the use of a piece of code with if/else structures.
But there are many reasons why the code chosen is wrong or not optimal.
This is where YOU (the reader) have a role to play in this project, by providing an uds file with a better code section.
The "=== SET <option_name>=<value>
" lines list all the possible values for this option.
When the html page for an option is generated, the CODE section of the uds file is submitted to uncrustify with an empty configuration and with every SET line:
==== SET cmt_reflow_mode=0 ==== SET cmt_reflow_mode=1 ==== SET cmt_reflow_mode=2 Results in the execution of: uncrustify -c - --set cmt_reflow_mode=0 ... uncrustify -c - --set cmt_reflow_mode=1 ... uncrustify -c - --set cmt_reflow_mode=2 ...
The output of each execution of uncrustify is shown as a column in the results table, along with the original CODE.
==== INFO See also @nl_max and @nl_after_for Updated by Riton based on issue #1234This section is displayed after the table showing the effects on CODE for each SET.
@option_name
is replaced by a link to this option.
==== SET <option_name>=<value> <option_name_A>=<value1> <option_name_B>=<value2>This is required when the effect of the option depends on the value of other options.
==== CODE JAVA import java.awt.*; ...The default is CPP.
==== TRACK [space|sp|newline|nl] <option_name>
A TRACK, like a SET, causes the execution of uncrustify and the output generated is added to the table
Depending on the family the <option_name> belongs to (space or newline) the icon or
will show in the output where the <option_name> has un effect in the CODE.
The icon is used to show other places in the CODE where other options in the same family
have an effect.
==== NAME ... # 1st group ==== CODE ... ==== SET ... ==== SET ... ==== TRACK ... ==== INFO ... # 2nd group ==== CODE JAVA ... ==== SET ... ==== SET ... ==== SET ... ==== INFO ... # 3rd group ...Each group produces its own table of results in the final html page.
Provide your uds file in a comment and/or in a pull request > here <
IMPORTANT: