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]