Banish crusty code with the Uncrustify C/C++/C#/D/Java/Pawn source code beautifier. It indents, adds newlines, aligns, etc, and is highly configurable.
Apologies for posting here but it's the only place I can find in this project that actually allows posting. I'm using uncrustify to format code that is output from a transpiler. Some of the output consists of #if statements which (for unavoidable reasons not worth getting into here) have constant conditions - either '1' or '0'. The true branch of one of these #if statements (whether the 'if' part, or the 'else' part, depending on the value of the condition) is formatted but the false branch never is. It would be nice to handle both branches the same. I do appreciate the issues involved if one of the branches causes a different level of indentation from the other, but I would be quite happy with an implementation that assumed both branches will always apply the same indentation or even one which assumes that both branches leave the indentation as on entry. This would be no worse than the current implementation which gets one branch correct and the other completely ignored.
By all means move this to a support request if you want to. Thank you for giving this any consideration. (btw why are support requests disabled to normal users? Was that deliberate?)
Graham
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
and create a new Issue.
Join your input files, the configuration used, the expected and the got output.
guy
Am 09.05.22 um 17:35 schrieb Graham Toal:
Apologies for posting here but it's the only place I can find in this project that actually allows posting. I'm using uncrustify to format code that is output from a transpiler. Some of the output consists of #if statements which (for unavoidable reasons not worth getting into here) have constant conditions - either '1' or '0'. The true branch of one of these #if statements (whether the 'if' part, or the 'else' part, depending on the value of the condition) is formatted but the false branch never is. It would be nice to handle both branches the same. I do appreciate the issues involved if one of the branches causes a different level of indentation from the other, but I would be quite happy with an implementation that assumed both branches will always apply the same indentation or even one which assumes that both branches leave the indentation as on entry. This would be no worse than the current implementation which gets one branch correct and the other completely ignored.
~~~
if 0 / Target==Vme /
K = Readdata(Chan,Startadd,Length);
else
K = Readtext(Chan, Startadd, Length);
endif
~~~
By all means move this to a support request if you want to. Thank you for giving this any consideration. (btw why are support requests disabled to normal users? Was that deliberate?)
Apologies for posting here but it's the only place I can find in this project that actually allows posting. I'm using uncrustify to format code that is output from a transpiler. Some of the output consists of #if statements which (for unavoidable reasons not worth getting into here) have constant conditions - either '1' or '0'. The true branch of one of these #if statements (whether the 'if' part, or the 'else' part, depending on the value of the condition) is formatted but the false branch never is. It would be nice to handle both branches the same. I do appreciate the issues involved if one of the branches causes a different level of indentation from the other, but I would be quite happy with an implementation that assumed both branches will always apply the same indentation or even one which assumes that both branches leave the indentation as on entry. This would be no worse than the current implementation which gets one branch correct and the other completely ignored.
By all means move this to a support request if you want to. Thank you for giving this any consideration. (btw why are support requests disabled to normal users? Was that deliberate?)
Graham
Hello!
You may use:
https://github.com/uncrustify/uncrustify
and create a new Issue.
Join your input files, the configuration used, the expected and the got output.
guy
Am 09.05.22 um 17:35 schrieb Graham Toal:
--
Guy Maurel
Sebastian-Fischer-Weg 13
89077 Ulm