Introduce a tool that is indented in a VC

xiaoxiao2021-03-05  34

Original author / Zhang Yushan

If you are a VC programmer, are you troubled by a question? The project team has a programming specification requires strict implementation, but the project is tense, and there are a lot of code to be completed every day. It is difficult to achieve both development progress, and write a good style, indentation code. If you use other tools to make the source file, you need to reopen the source code outside of the VC, and the resulting results cannot be viewed directly in the VC. Can you integrate a tool in the VC, easy to click the VC button to finish the source code? The answer is there. Here I introduce a method called ASTYLE Open Source Code and integrates configuration in the VC development environment. You can quickly implement the function of code finishing in the VC, I hope to give you a certain help. 1. Visit http://sourceforge.net/projects/asty, download the ASTYL package, including the source file, executable file, instructions, etc. 2, copy AStyle.exe to C: / WinNT / System32. 3, next to configure the VC, add ASTYLE code finishing. 1) Newly built menu item "Format" in VC. On the toolbar, click Right click to open the Customize window, create a menu item in the Tools tab: "Format Squiring" and enter the menu item in Command to correspond to the current path of the plug-in tool: "c: /winnt/system32/astyle.exe ".

figure 1

2) Enter the plug-in tool program configuration parameters in Arguments --Style = ANSI $ {filename} $ {fileext}. Among them --Style = ANSI indicates that selecting an ANSI style format and indentation. Of course, other styles, optional style and samples are also available: --style = ANSI: ANSI style format and indentation

Namespace foospace {int foo () {if (isbar) {bar (); returnit 1;} else return 0;}} --style = kr: kernighan & ritchie style format and indentation

Namespace Foospace {Int foo () {if (isbar) {bar (); returnit 1;} else return 0;}} --style = linux: Linux style format and indentation

Namespace foospace {INT foo () {if (isbar) {bar (); return 1;} else return 0;}} --style = gnu: GNU style format and indentation

Namespace foospace {INT foo () {if (isbar) {bar (); return 1;} else return 0;}} --style = java: Java style format and indentation

Class Foospace {Int foo () {if (isbar) {bar (); returnif 1;} else return 0;}} More detailed configuration parameters can participate in the AStyle random document. $ {FileEname} $ {fileext}: Indicates the source file that organizes the current edited. Enter a $ (fileDir) parameter in Initial Directory: Represents the initial run path. After setting this item, the initial path of the ASTYLE starts is the current file path.

figure 2

3) In order to make the DOS box when the ASTYLE.EXE is organized and the run results are displayed directly into the VC, the "Use Output Window" option is required, as shown. image 3

4) For the convenience of the use of the ASTYLE tool, you can add this menu item to the convenient toolbar. It is also set in the Customize under Tools. When setting, pay attention to the tool icon number, as shown in the figure:

Figure 4

5) The setting work is basically completed, and there is a little consideration. Because ASTYLE is organized to organize the code is a source file in the hard disk. If you do not save the source file, you will play directly, the VC will pop the source file to reload the prompt box. If the choice is, you will lose it. The code developed, this is undoubtedly the most painful thing for programmers; if it will make the finishing operation. So to ensure that the development code is saved in time, you need to save the modified source file before finishing. To implement this feature, you only need to set Save Options to: "Save Before Running Tools" in the Option setting in Tools, as shown:

Figure 5

Ok, I'm telling, the code is just easy to click the VC toolbar button to immediately appear in the VC Editing box. Let's enjoy the pleasant result of using the VC integration AStyle finishing code! 1. Before organizing, messy code line:

Figure 6

2. The code line after organizing:

Figure 7

Full text

转载请注明原文地址:https://www.9cbs.com/read-33687.html

New Post(0)