Crates.io | cxx2flow |
lib.rs | cxx2flow |
version | 0.6.2 |
source | src |
created_at | 2021-08-17 13:10:46.24844 |
updated_at | 2024-06-09 16:10:17.075731 |
description | Convert your C/C++ code to control flow chart |
homepage | |
repository | https://github.com/Enter-tainer/cxx2flow |
max_upload_size | |
id | 438459 |
size | 91,090 |
将 C/C++ 代码转换为流程图
更多效果图请参考 GALLERY
两种样式:
折线 | 平滑 |
inline int read() { //快读
char c = getchar();
int x = 0, f = 1;
while (c < '0' || c > '9') {
if (c == '-') f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - '0';
c = getchar();
}
return x * f;
}
cargo install cxx2flow
推荐从右侧的 Github Release 下载对应平台的二进制文件。
也可以到 GitHub Actions 或 Nightly.link 下载最新构建的二进制,包含 Linux, Windows 和 MacOS 版本。
对于没有命令行使用经验的用户,推荐下载使用基于 tauri 编写的 GUI 版本。 https://github.com/Enter-tainer/cxx2flow-gui/releases
为了编译生成的 dot 文件,你需要安装 graphviz,并将其添加到 PATH 中。也可以将生成的结果复制进在线的 graphviz 服务中,如 http://magjac.com/graphviz-visual-editor/ 。
Convert your C/C++ code to control flow chart
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.
EXAMPLES:
cat main.cpp | cxx2flow | dot -Tsvg -o test.svg
cxx2flow test.cpp | dot -Tpng -o test.png
cxx2flow main.cpp my_custom_func | dot -Tsvg -o test.svg
Please give me star if this application helps you!
如果这个应用有帮助到你,请给我点一个 star!
https://github.com/Enter-tainer/cxx2flow
cpp
,默认关闭,需要使用 --cpp
参数手动启用。如果 PATH
中不存在 cpp
则会失败。