Hello All,
for some days I have started to program under BricxCC / NXC for my Lego Mindstorms NXT.
Is there any option to auto formatting of the existed (already entered) source code, like for example in Eclipse?
Thanks and regards.
Source code formatter for BricxCC / NXC
Re: Source code formatter for BricxCC / NXC
A quick way to do this in Eclipse, is to go to Preferences->General->Editors->File Associations and define an association for *.nxc (which I presume is the default extension for NXC files), and map it to the CDT editor.surfi-nxt wrote:Hello All,
for some days I have started to program under BricxCC / NXC for my Lego Mindstorms NXT.
Is there any option to auto formatting of the existed (already entered) source code, like for example in Eclipse?
Thanks and regards.
Not all keywords will be highlighted, but most of the standard C keywords would be recognized.
Re: Source code formatter for BricxCC / NXC
tcwan, do you mean, I should copy the source code to Eclipse, reformat it, and then copy back to BricxCC?
Not so comfortable as I expected :)
The source code formatter is almost the only thing is missing for me in BricxCC...
Not so comfortable as I expected :)
The source code formatter is almost the only thing is missing for me in BricxCC...
Re: Source code formatter for BricxCC / NXC
Well, I'm not aware of any source formatter for BrcixCC itself.surfi-nxt wrote:tcwan, do you mean, I should copy the source code to Eclipse, reformat it, and then copy back to BricxCC?
Not so comfortable as I expected
The source code formatter is almost the only thing is missing for me in BricxCC...
I misunderstood your question earlier, Eclipse does have a source formatter, it can be enabled via Preferences->C/C++->Code Style->Formatter.
You'll need to select the code block to reformat, and select Source->Format (Ctrl-Shift-F).
I suppose you don't really need to copy it back to BricxCC, just open the files in one IDE, modify, save it, and reopen it in the other.
Re: Source code formatter for BricxCC / NXC
BricxCC does not come with a code beautifier/formatter. Until that changes, which might be a very long while, you will need to use other standalone tools for this. If I can find some cross-platform pascal code that would make it easy to add this feature to BricxCC I will certainly consider doing so.
John
John
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
Re: Source code formatter for BricxCC / NXC
Hello John,
would you consider some other approach for the source code formatter? I think it would be very easy to add this feature to BricxCC in this way.
You could make a menu command (better with a hot-key) to call some external source code formatter via command line. After the call of the formatter you could just reload the nxc-file in the BricxCC. For the user it would be transparent and working fine!
You could put an option in BricxCC to configure the command line of the formatter call like:
“formatter.exe –c %srcfileâ€
or something like that, or the fix coded command line call for the test purposes.
I would be the first tester for the feature :)
BTW, I have found and tested this formatter:
http://uncrustify.sourceforge.net/
Just called:
“uncrustify.exe -c d.cfg test.nxc†- it works very fine!
“uncrustify.exe -c ben.cfg test.nxc†- is also good!
I am looking forward to hear from you.
Thanks and regards.
would you consider some other approach for the source code formatter? I think it would be very easy to add this feature to BricxCC in this way.
You could make a menu command (better with a hot-key) to call some external source code formatter via command line. After the call of the formatter you could just reload the nxc-file in the BricxCC. For the user it would be transparent and working fine!
You could put an option in BricxCC to configure the command line of the formatter call like:
“formatter.exe –c %srcfileâ€
or something like that, or the fix coded command line call for the test purposes.
I would be the first tester for the feature :)
BTW, I have found and tested this formatter:
http://uncrustify.sourceforge.net/
Just called:
“uncrustify.exe -c d.cfg test.nxc†- it works very fine!
“uncrustify.exe -c ben.cfg test.nxc†- is also good!
I am looking forward to hear from you.
Thanks and regards.
Re: Source code formatter for BricxCC / NXC
I personally didn't use such a beautifier ever - and never wished to have one. I'm just typing my spaces and tabs in the moment I'm writing code.
For John's development time to invest I surely would have more and better proposals for the top of his to-do-list (e.g., ANSI C compa.........) :P
But I must admit, that auto-indent of 2x white space after, e.g., "{" + [ENTER] for line feed sometimes would be nice to have ;)
For John's development time to invest I surely would have more and better proposals for the top of his to-do-list (e.g., ANSI C compa.........) :P
But I must admit, that auto-indent of 2x white space after, e.g., "{" + [ENTER] for line feed sometimes would be nice to have ;)
Who is online
Users browsing this forum: Semrush [Bot] and 2 guests