• Stars
    star
    479
  • Rank 91,752 (Top 2 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

将 C/C++ 代码转换成流程图 / Turn your C/C++ code into flowchart

cxx2flow

简体中文 | English

将 C/C++ 代码转换为流程图

效果

更多效果图请参考 GALLERY

两种样式:

折线 平滑
ployline curve
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;
}

错误报告

error reporting

安装

自行编译

cargo install cxx2flow

下载预构建二进制

推荐从右侧的 Github Release 下载对应平台的二进制文件。

也可以到 GitHub ActionsNightly.link 下载最新构建的二进制,包含 Linux, Windows 和 MacOS 版本。

使用 GUI 版本

对于没有命令行使用经验的用户,推荐下载使用基于 tauri 编写的 GUI 版本。 https://github.com/Enter-tainer/cxx2flow-gui/releases

gui

使用

为了编译生成的 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 则会失败。
  • 支持的控制流语句有:while,for,if,break,continue,break,return,switch, goto, do-while。
  • 对 range for 有基本支持。部分情况下,受到 tree-sitter-cpp 能力限制,会出现一些问题

More Repositories

1

typst-preview

[DEPRECATED] Use tinymist instead
Typst
450
star
2

typstyle

Beautiful and reliable typst code formatter
Typst
259
star
3

rspb

pastebin written in pure rust. A rewrite of ptpb/pb.
Rust
42
star
4

luoguPaintAutomatonTS

luogu冬日画板自动绘图脚本支持多用户,维护
TypeScript
34
star
5

typst-ws

preview your typst document in instant
Rust
27
star
6

cxx2flow-gui

Tauri based GUI for cxx2flow
Vue
26
star
7

tetris

在自制 RISC-V CPU 和 x86 上运行的现代俄罗斯方块 / Modern tetris that runs on self-made RISC-V CPU and x86 machines.
C
16
star
8

simplerv

Verilog
14
star
9

cpprepl

a deadly simple repl for cpp with ghci style commands
C++
13
star
10

LuoguPaintAutomaton

luogu冬日画板自动绘图脚本
Python
10
star
11

hubakc

Authorize an ssh session using your keys on GitHub.
Rust
6
star
12

libinteger

big num support at binary level
C++
5
star
13

richat

Realtime chat with markdown/LaTeX support
JavaScript
5
star
14

MathEditor

LaTeX equation editor, based on zhihu
Vue
4
star
15

MaterialSlide

A material design slide. Easy to use
HTML
4
star
16

fasterminal

a deadly simple utility to toggle windows terminal using hotkeys
C++
4
star
17

bottom-wallpaper

动态桌面壁纸:系统资源监视
C++
3
star
18

usysy

An incomplete SysY compiler in Rust and LLVM
C
3
star
19

hackweek

Go
3
star
20

lookup

simple cli dictionary
TypeScript
2
star
21

richat-backend

Realtime chat with markdown/LaTeX support - backend
JavaScript
2
star
22

unique_lab_shell

a linux shell written in cxx
C++
1
star
23

nas-fanctl

Rust
1
star
24

remark-code-wrap

JavaScript
1
star
25

content_recommend

Python
1
star
26

zint-wasi

C
1
star
27

mainpage

HTML
1
star
28

serial2tcp

serve serial over tcp, or connect serial port to a tcp server
Rust
1
star