-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79a19b3
commit 7b79a5b
Showing
6 changed files
with
61 additions
and
44 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "cxx2flow" | ||
version = "0.5.10" | ||
version = "0.5.11" | ||
edition = "2018" | ||
authors = ["mgt <[email protected]>"] | ||
description = "Convert your C/C++ code to control flow chart" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,28 +58,26 @@ For those who are not familiar with command line, I recommend the GUI version of | |
To compile the generated dot file, you need graphviz. You can also copy the output to online graphviz services such as http://magjac.com/graphviz-visual-editor/ . | ||
|
||
``` | ||
cxx2flow 0.5.9 | ||
mgt <[email protected]> | ||
Convert your C/C++ code to control flow chart | ||
USAGE: | ||
cxx2flow [OPTIONS] [ARGS] | ||
ARGS: | ||
<INPUT> Sets the path of the input file. e.g. test.cpp | ||
If not specified, cxx2flow will read from stdin. | ||
<FUNCTION> The function you want to convert. e.g. main [default: main] | ||
OPTIONS: | ||
-c, --curly Sets the style of the flow chart. | ||
If specified, output flow chart will have curly connection line. | ||
--cpp Use C preprocessor. | ||
-h, --help Print help information | ||
-o, --output <OUTPUT> Sets the output file. | ||
If not specified, result will be directed to stdout. | ||
e.g. graph.dot | ||
-t, --tikz Use tikz backend. | ||
-V, --version Print version information | ||
Usage: cxx2flow [OPTIONS] [INPUT] [FUNCTION] | ||
Arguments: | ||
[INPUT] Sets the path of the input file. e.g. test.cpp | ||
If not specified, cxx2flow will read from stdin. | ||
[FUNCTION] The function you want to convert. e.g. main [default: main] | ||
Options: | ||
-o, --output <OUTPUT> Sets the output file. | ||
If not specified, result will be directed to stdout. | ||
e.g. graph.dot | ||
-c, --curly Sets the style of the flow chart. | ||
If specified, output flow chart will have curly connection line. | ||
--cpp Use C preprocessor. | ||
-t, --tikz Use tikz backend. | ||
-d, --dump-ast Dump AST(For debug purpose only). | ||
-h, --help Print help information | ||
-V, --version Print version information | ||
Note that you need to manually compile the dot file using graphviz to get SVG or PNG files. | ||
|
@@ -97,4 +95,4 @@ https://github.com/Enter-tainer/cxx2flow | |
|
||
- The support of preprocessor is based on `cpp`, and is disabled by default. `--cpp` flag is needed to enable it. It will fail if `cpp` does not exist in `PATH`. | ||
- Supported control flow keyword: while,for,if,break,continue,break,return,switch, goto, do-while。 | ||
- Very basic support for range based loop in C++ 11. | ||
- Very basic support for range based loop in C++ 11. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,28 +59,26 @@ cargo install cxx2flow | |
为了编译生成的 dot 文件,你需要安装 graphviz,并将其添加到 PATH 中。也可以将生成的结果复制进在线的 graphviz 服务中,如 http://magjac.com/graphviz-visual-editor/ 。 | ||
|
||
``` | ||
cxx2flow 0.5.9 | ||
mgt <[email protected]> | ||
Convert your C/C++ code to control flow chart | ||
USAGE: | ||
cxx2flow [OPTIONS] [ARGS] | ||
ARGS: | ||
<INPUT> Sets the path of the input file. e.g. test.cpp | ||
If not specified, cxx2flow will read from stdin. | ||
<FUNCTION> The function you want to convert. e.g. main [default: main] | ||
OPTIONS: | ||
-c, --curly Sets the style of the flow chart. | ||
If specified, output flow chart will have curly connection line. | ||
--cpp Use C preprocessor. | ||
-h, --help Print help information | ||
-o, --output <OUTPUT> Sets the output file. | ||
If not specified, result will be directed to stdout. | ||
e.g. graph.dot | ||
-t, --tikz Use tikz backend. | ||
-V, --version Print version information | ||
Usage: cxx2flow [OPTIONS] [INPUT] [FUNCTION] | ||
Arguments: | ||
[INPUT] Sets the path of the input file. e.g. test.cpp | ||
If not specified, cxx2flow will read from stdin. | ||
[FUNCTION] The function you want to convert. e.g. main [default: main] | ||
Options: | ||
-o, --output <OUTPUT> Sets the output file. | ||
If not specified, result will be directed to stdout. | ||
e.g. graph.dot | ||
-c, --curly Sets the style of the flow chart. | ||
If specified, output flow chart will have curly connection line. | ||
--cpp Use C preprocessor. | ||
-t, --tikz Use tikz backend. | ||
-d, --dump-ast Dump AST(For debug purpose only). | ||
-h, --help Print help information | ||
-V, --version Print version information | ||
Note that you need to manually compile the dot file using graphviz to get SVG or PNG files. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
int main() { | ||
int t; | ||
double ans, x; | ||
printf("Please input your salary:"); | ||
scanf("%lf", &x); | ||
printf("Please choose a method\n1:with if; 2:with swtch:"); | ||
scanf("%d", &t); | ||
if (t == 1) | ||
ans = useif(x); | ||
else if (t == 2) | ||
ans = usesw(x); | ||
else { | ||
printf("Invalid input!\n"); | ||
return 0; | ||
}; | ||
if (t == 1) | ||
printf("calculate by if, the tax is:%.2lf\n", ans); | ||
else | ||
printf("calculate by switch, the tax is:%.2lf\n", ans); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters