C ++ builder code automatic formatting

Source: Internet
Author: User

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
Style
Supports 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]

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.