The original code of C ++ builder is automatically formatted.
It is difficult to manually adjust indentation when debugging and modifying code. If there are many nesting types, errors are easy to make. c ++ builder has built-in original code formatting tools, however, we recommend that you use a third-party automatic original code formatting tool.Artistic
StyleSupports formatting the original code in multiple languages, C ++/Delphi/Java, and the latest version is 2.02.
Step 1: Prepare astyle
1, http://astyle.sourceforge.net, download and unzip.
2. Stored in
C: \ astyle, and find astyle.exe in the bindirectory.
3. And in c :\
Astyle creates a batch processing programAstyle. batThe Code is as follows:
@ Echo on
Set parm = -- style = Allman -- indent = spaces = 2 -- indent = tab = 2 -- brackets = break -- unpad-Paren
Echo % parm %
Echo % 1
"C: \ astyle \ bin \ astyle.exe" % parm % 1
Rem pause
Batch Processing description:
@ Echo on show all content during running
Set parm = -- style = Allman... working mode, based on the language and formatting rules
Echo % parm % display mode parameter, which can be deleted. for debugging, refer
Echo % 1 displays input parameters, which can be deleted and used for debugging. For more information, see
"C: \ astyle \ bin \ astyle.exe" % parm % 1
Deleting REM makes the pause code valid. you can pause the pause code during runtime, view the running status, and facilitate batch debugging.
Step 2: Prepare a third-party tool for C ++ Builder
1. Enable C ++
Builder
2. Choose tools> Configure from the menu.
Tools to open the Tools Options dialog box.
3. Click Add. The tool is displayed.
Properties dialog box.
Title input: astyle
C ++ code
Program input: C :\
Astyle \ astyle. bat
Working dir :( null)
Parameters input: $ edname
4. Click OK to complete the preparation of the Automatic Code formatting tool.
Use: On the code editing screen, select Tools> astyle C ++ code to format the original code in the current file.
Here, the astyle formatting parameter set
Parm = -- style = Allman -- indent = spaces = 2 -- indent = tab = 2 -- brackets = break -- unpad-Paren, this article only describes how to format C ++. It can also format the original code of Delphi and Java.
[End of full text]