How to format code using the Astyle plugin in Keil [go]

Source: Internet
Author: User

a good program, not only to have a good algorithm, but also need to have a good writing style. It's not easy to write a good algorithm, but a good code style is not difficult. Referring to the format code, Astyle is not a missed tool, it can easily format the program code into its own style without the need to manually modify, and it is green, free, open source. For Astyle help and download, please refer to its official website:http://astyle.sourceforge.net/.



The following describes the method of adding Astyle in Keil uVision4, the morning reference Keil Help manual, the implementation of Keil in a very convenient way to use Astyle, and we share, if you have better format code method, please do not begrudge your jade, I'm going to throw the bricks here.

Ways to add Astyle menus:
1:UVISION4 Click the Tools menu---Customize tools menus


2: Add Astyle all Files and Astyle current File menu (custom menu name, can be used in Chinese)
I've added two menus here, which are formatting the current file and formatting all the files in project.
3: Add command command: Click ... button, select Astyle.exe.
4:arguments:
Astyle Current File menu fill in! E
Astyle All Files menu fill in "$E *.c" "$E *.h"


Note:! E represents the file that is currently in focus and being edited.
$E *.c and $e*.h represent all. C and. h files that are currently in focus and are being edited in the directory where the files are located (refer to the Help document for Keil uvision)
Use the Astyle default format to format the file, or you can customize the format to refer to the Astyle Help document in the custom format. After the default format, the original file is backed up as the source file name. orig. If you do not want Astyle to back up your files, you can use the-n parameter. such as:-N! E (indicates the format of the current file, not backup)
 
use effect in Keil: The resulting menu appears in the Tools drop-down menu, and Astyle's run structure appears in the Keil build Output window.  

format the results of the current file:formatting results for all files:backup files are generated by defaultreference Help is available: Astyle Help and Keil uVision4 help.

How to format code using the Astyle plugin in Keil [go]

Related Article

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.