enter-tainer / cxx2flow Goto Github PK
View Code? Open in Web Editor NEW将 C/C++ 代码转换成流程图 / Turn your C/C++ code into flowchart
License: MIT License
将 C/C++ 代码转换成流程图 / Turn your C/C++ code into flowchart
License: MIT License
Dear authors,
I try to put inline functions and '#if define' code into the code, it seems that it does not support them.
Do you have any plan for supporting them in the futhure.
叩谢大神!!!
直接在CMD中执行程序报 0xc000007b 错误,查阅错误码得知是执行文件格式错误。
于是试着在Mingw里面执行...打开了...
应该不算预期打包的行为
请问作者后续会打算添加支持java吗》或者提供一下相关思路
求大神支持trycatch和lambda
打开exe闪退
The following code,
#include <stdio.h>
static void a(void)
{
printf("a\n");
}
static void b(void)
{
printf("b\n");
}
static void x(int y)
{
if (y > 0) {
return a();
} else {
return b();
}
}
int main(void)
{
int y;
scanf("%d", &y);
x(y);
}
With the following parameters,
cxx2flow test.c x | dot -Tpng -o test.png
Results in this output,
Error: cxx2flow::unexpected_dummy_ast
× unexpected dummy ast node
╭─[test.c:15:1]
15 │ return a();
16 │ ╭─▶ } else {
17 │ │ return b();
18 │ ├─▶ }
· ╰──── dummy ast node here
19 │ }
╰────
help: dummy node found in the ast
this might be a bug, please report it to the author
目前不支持函数递归调用,希望能够完善增强一下,谢谢!
#include <bits/stdc++.h>
using namespace std;
int f(int n) {
if (n <= 2) return n;
return f(n - 1) + f(n - 2);
}
int main() {
int n, ans = 0;
cin >> n;
ans = f(n);
cout << ans << endl;
return 0;
}
你好,我遇到一个问题
执行
cxx2flow --cpp -c src/auto.cpp autonomous_driving_decision
报错:
20 errors generated.
Error: cxx2flow::target_function_not_found
× target function not found
╭────
1 │ autonomous_driving_decision
· ─────────────┬─────────────
· ╰── this is the name of your target function
╰────
help: maybe you have a typo, or source code is incomplete,
please check your input
源文件:
#include <stdbool.h>
#include <stdio.h>
// 定义车辆状态枚举类型
typedef enum
{
NORMAL,
EMERGENCY_BRAKE,
MAINTAIN_SPEED,
SLOW_DOWN,
STOP
} VehicleState;
// 定义传感器输入结构体
typedef struct
{
int obstacle_distance; // 障碍物距离(单位:米)
int speed; // 车速(单位:千米/小时)
bool is_traffic_light_green; // 交通灯状态(true表示绿灯,false表示红灯)
bool is_pedestrian_nearby; // 附近是否有行人
} SensorInput;
// 自动驾驶行为决策函数
VehicleState autonomous_driving_decision(SensorInput sensor_data)
{
if (sensor_data.obstacle_distance < 0 || sensor_data.speed < 0)
{
printf("Error: Invalid sensor data.\n");
return STOP;
}
if (sensor_data.is_traffic_light_green)
{
if (sensor_data.obstacle_distance > 50 && sensor_data.speed > 60)
{
return MAINTAIN_SPEED;
}
else if (sensor_data.obstacle_distance <= 50 && sensor_data.speed > 40)
{
return SLOW_DOWN;
}
else
{
if (sensor_data.is_pedestrian_nearby &&
sensor_data.obstacle_distance > 10)
{
return SLOW_DOWN;
}
else
{
return NORMAL;
}
}
}
else
{
if (sensor_data.obstacle_distance > 30 && sensor_data.speed > 30)
{
return MAINTAIN_SPEED;
}
else if (sensor_data.obstacle_distance <= 10)
{
return EMERGENCY_BRAKE;
}
else
{
if (sensor_data.is_pedestrian_nearby &&
sensor_data.obstacle_distance > 20)
{
return EMERGENCY_BRAKE;
}
else
{
return NORMAL;
}
}
}
}
Originally posted by @homui in #47 (comment)
代码
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: [] }
reported by @piggynl
这样各个平台都方便使用。再就是mac版的gui有问题,测试电脑m1 pro
你好,
我想得到一下函数结构的数据比如每个节点以及节点包含的命令,而不仅仅是一个图片。可以帮一下忙么
比如流程图里只包含if else这些分支选项
非常棒的项目,能够快速分析代码结构! 😄
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.