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

Overview

cxx2flow

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

效果

两种样式:

折线 平滑
ployline curve

安装

自行编译

cargo install cxx2flow

下载预构建二进制

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

使用

为了编译生成的 dot 文件,你需要安装 graphviz,并将其添加到 PATH 中。也可以将生成的结果复制进在线的 graphviz 服务中,如 http://viz-js.com/

cxx2flow 0.1.5
mgt. 
Convert your C/C++ code to control flow chart

USAGE:
    cxx2flow [FLAGS] [OPTIONS]  [FUNCTION]

FLAGS:
    -c, --curved     Sets the style of the flow chart.
                     If specified, output flow chart will have curved connection line.
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -o, --output     Sets the output file.
                             If not specified, result will be directed to stdout.
                             e.g. graph.dot

ARGS:
           Sets the input file. e.g. test.cpp
        The function you want to convert. e.g. main

Note that you need to manually compile the dot file using graphviz to get SVG or PNG files.
EXAMPLES:
    cxx2flow test.cpp | dot -Tpng -o test.png
    cxx2flow main.cpp my_custom_func | dot -Tsvg -o test.svg

限制

  • 暂时不支持 do-while,switch 和 goto
  • 不支持预处理器,如 include, ifdef, ifndef...
  • 支持的控制流语句有:while,for,if,break,continue,break,return。
Issues
  • switch出现的一点问题

    switch出现的一点问题

    代码

    int main(void)
    {
    	struct grades_list list = {NULL, NULL, 0};
    	struct grades *g;
    	int is_exit = 0;
    	while (is_exit == 0) {
    		int choice, num, i, sub_choice;
    		char ID[16];
    		scanf("%d", &choice);
    		switch (choice) {
    		case 0:
    			clean_info(&list);
    			is_exit = 1;
    			break;
    		case 1: /* 输入 */
    			scanf("%d", &num);
    			for (i = 0; i < num; ++i) {
    				get_grades(&list);
    			}
    			sort_grades(&list);
    			break;
    		case 2: /* 输出 */
    			for_each(&list, print_basic_info);
    			break;
    		case 3: /* 修改 */
    			scanf("%s%d", ID, &sub_choice);
    			g = find_grades(&list, ID);
    			if (g == NULL)
    				break;
    			switch (sub_choice) {
    			case 1:
    				scanf("%d", &(g->english));
    				break;
    			case 2:
    				scanf("%d", &(g->math));
    				break;
    			case 3:
    				scanf("%d", &(g->physics));
    				break;
    			case 4:
    				scanf("%d", &(g->c_lang));
    				break;
    			default:
    				break;
    			}
    			count_grades(g);
    			break;
    		case 4: /* 统计平均 */
    			for_each(&list, print_average);
    			break;
    		case 5: /* 输出总成绩及平均成绩 */
    			for_each(&list, print_sum_and_average);
    			break;
    		default:
    			break;
    		}
    	}
    	return 0;
    }
    

    报错信息

    % ./cxx2flow b.c -c | dot -Tpng -o a.png
    Error: UnexpectedOutgoingNodes { node_index: NodeIndex(22), neighbors: [] }
    
    opened by vaaandark 1
Releases(v0.5.9)
Owner
mgt
CS @ HUST | @UniqueStudio | @OI-wiki | @heptagonhust | 95C1C2DF
mgt
CITL's static analysis engine for native code artifacts

citl-static-analyzer Fast binary hardening analysis tooling. Building on Linux The build process varies by Linux distribution, owing to differences be

Cyber Independent Testing Lab 17 Jul 11, 2022
Qt-oriented static code analyzer based on the Clang framework

WARNING: master is the development branch. Please use the v1.10 branch. clazy v1.11 clazy is a compiler plugin which allows clang to understand Qt sem

KDE GitHub Mirror 526 Jul 15, 2022
Static analysis of C/C++ code

Cppcheck GitHub Actions Linux Build Status Windows Build Status OSS-Fuzz Coverity Scan Build Status License About the name The original name of this p

Daniel Marjamäki 4.3k Aug 3, 2022
C/C++ Application to solve irrigation rotation whatever two-turn rotation or three-turn rotation, longitudinal section design, hydraulic calculations, and design of hydraulic structures like weirs and tail escape.

Irrigation works C/C++ Application to solve irrigation rotation whatever two-turn rotation or three-turn rotation, longitudinal section design, hydrau

Mohamed Jamal Ghayyad 1 Jun 24, 2022
Netstick client for Nintendo 3DS -- turn your portable console into a Linux compatible WiFi gamepad!

Netstick turns your 3DS into a wifi enabled gamepad! Control any linux-based device (such as a Raspberry Pi running Retropie) using your 3DS!

null 32 May 6, 2022
Turn your ESP32 into a easy to use micro web-server allowing to interact with any GPIO by simple http(s) calls.

WebhooksTriggeredESP32WiFi Turn your ESP32 into an easy to use and manage wireless micro web-server allowing it to process reliably and asynchronouly

JayDeLux 4 Jun 1, 2022
Raw HID keyboard forwarder to turn the Pi 400 into a USB keyboard

Raspberry Pi 400 as a USB HID Keyboard Hook your Pi 400 up to your PC somehow, using a USB Type-C cable into the power port. Anker make good ones- I u

Philip Howard 153 Jul 20, 2022
Turn 2 esp32 boards into pixhawk telemetry for use with Ardupilot/Ardurover Mission Planner.

RoverLink Turn 2 esp32 boards into pixhawk telemetry for use with Ardupilot/Ardurover Mission Planner I used to use these cheap Chinese 900mhz Pixhawk

Jeffrey Berezin 2 Jan 18, 2022
Turn images into text better than caca/aalib

hiptext hiptext is command line tool for rendering images and videos inside terminals. Dependencies You need clang or gcc >=4.7. You also need to inst

Justine Tunney 664 Jul 29, 2022
Connecting an ESP8266 to a Google Calendar service to turn an useless "On Air" sign into a smart meeting indicator

ESP8266-GoogleCalendar Intro I had an useless "On Air" sign hanging around my home, and I thought it would be cool to connect it to my Google Calendar

3D Fix It 2 Jan 20, 2022
Violet - Lightweight STUN/TURN server

Violet is a lightweight STUN/TURN server (RFC8489 and RFC8656) based on libjuice.

Paul-Louis Ageneau 86 Jul 30, 2022
To turn on and off the pump, most people use a manual switch.

To turn on and off the pump, most people use a manual switch. As a result, people forget to switch off the pump from time to time, resulting in water overflow. They may forget to switch on the motor at times, resulting in a water problem later on. It also wastes a lot of electricity. To solve this problem, we need a smart device to control the pump.

Md. Asad Chowdhury Dipu 1 Oct 14, 2021
A program to backup all of your game savefiles on your system, neatly, and into a single folder.

Savefile Saver I created this project as a solution to a simple, but annoying problem: Backing up my game savefiles. I wanted to be able to copy all o

Dominic Esposito 4 Jun 8, 2022
Open-source node system framework, to change your algorithmic code into useful tools to create much more complicated simulations!

Open-source node system framework, to change your algorithmic code into useful tools to create much more complicated simulations!

Zenus Technology 612 Jul 30, 2022
Embed read-only filesystems into any C++11 program w. a single header, zero dependencies and zero modifications to your code

c-embed Embed read-only filesystems into any C++11 program w. a single header, zero dependencies and zero modifications to your code. Usage c-embed al

Nick McDonald 5 Jun 24, 2022
🧼 Cleanly pause and play your YouTube videos while cooking/crafting/doing your makeup by waving your hand over a proximity sensor!

?? Cleanly pause and play your YouTube videos while cooking/crafting/doing your makeup by waving your hand over a proximity sensor!

Tala Buwadi 10 May 1, 2022
NoDevFee - Redirect devfee shares into your wallet using DevFeeCut v0.1 for PhoenixMiner

DevFeeCut A simple program to use along side with PhoenixMiner. Changelog: v0.1 - DevFeeCut v0.1 Compatible with PhoenixMiner up to 5.6d. Functionalit

Jess K Crypto 45 May 19, 2022
A package to use Material side sheet into your Flutter project. Learn more about side sheet at Material.io

Side Sheet A package to use Material side sheet into your Flutter project. Learn more about side sheet at Material.io Platform Support Android iOS Mac

Lalit Jarwal 5 May 2, 2022
Galaxy simulation that runs directly into your terminal !

ASCII-galaxy-simulation (Work in progress) Current result : Two galaxies colliding Goal : Galaxy with black hole (Should make the galaxies more stable

Célian Riboulet 6 Jun 2, 2022
WIP / DIN-rail compatible WiFi security camera with additional features (doorbell detection, magnetic / reed switch door & PIR sensor...) that sends you alerts on Telegram if someone unauthorised breaks into your house.

WIP / DIN-rail compatible WiFi security camera with additional features (doorbell detection, magnetic / reed switch door & PIR sensor...) that sends you alerts on Telegram if someone unauthorised breaks into your house.

François Leparoux 2 Dec 18, 2021
An injector is simply a program that injects some sort of file into your game

example-injector What it injector? An injector is simply a program that injects some sort of file into your game. This could be something as benign as

Speedy 19 Jul 23, 2022
OpenScan is an open-source document scanner app that enables users to scan hard copies of documents or notes and convert it into a PDF file. No ads. No data collection. We respect your privacy.

OpenScan An open source app that enables users to scan hardcopies of documents or notes and convert it to a PDF file. No ads. No data collection. We r

Ethereal Developers Inc 1.1k Aug 9, 2022
Make your OpenPOWER system into a Power Macintosh.

SheepSforza SheepSforza is an OpenPOWER-enhanced version of SheepShaver V2.5, incorporating kanjitalk755's 64-bit fixes, intended for POWER8 and POWER

Cameron Kaiser 9 May 5, 2022
A toolchain for injecting custom code into Super Mario Galaxy 2.

Syati Syati is a custom code loader for Super Mario Galaxy 2. It is able to compile custom code and link to existing functions in the game to create o

shibbs 20 Mar 29, 2022
You can use this to compile the code and output images into a word doc for assignment purposes

Code_n_Ouput_to_docx You can use this to compile the code and output images into a word doc for assignment purposes Basic requirements: Python 3.7 or

Aaditya Prabu K 1 Dec 25, 2021
Translates binary information (images, fonts, shaders) into C++ source code.

Binary bakery ?? Translates binary files (images, fonts etc.) into C++ source code and gives access to that data at compile- or runtime. There are dif

Sebastian Werhausen 126 May 28, 2022
This code converts a point cloud obtained by a Velodyne VLP16 3D-Lidar sensor into a depth image mono16.

pc2image This code converts a point cloud obtained by a Velodyne VLP16 3D-Lidar sensor into a depth image mono16. Requisites ROS Kinetic or Melodic Ve

Edison Velasco Sánchez 6 May 18, 2022
Jaws is an invisible programming language! Inject invisible code into other languages and files! Created for security research -- see blog post

Jaws is an invisible interpreted programming language that was created for antivirus research. Since Jaws code is composed entirely of whitespace char

C.J. May 207 Jul 30, 2022
Lee Thomason 292 Jul 6, 2022