Graphviz: seperate out function graphs

This commit is contained in:
Akemi Izuko 2023-11-14 14:32:25 -07:00
parent 044e3fb127
commit 8f707512e0
Signed by: akemi
GPG key ID: 8DE0764E1809E9FC
7 changed files with 95 additions and 61 deletions

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
/target
graphviz/*.svg
*.svg

View file

@ -1,58 +0,0 @@
digraph functions {
rankdir=TB;
graph [fontname = "cc wild words"];
node [fontname = "cc wild words"];
edge [fontname = "cc wild words"];
rank=TB;
subgraph cluster_fn_args_1 {
label="fn_args(GazType)";
fontname=lovebeat;
rankdir=TB;
newrank=true;
A1 [label="gen_type(GazType)" shape=diamond style=filled fillcolor=lightcoral];
B1 [label="pack into var"];
C1 [label="return" style=filled fillcolor=lightskyblue1];
A1 -> B1 -> A1;
B1 -> C1;
}
subgraph cluster_fn_gen_type_2 {
label="fn_gen_type(GazType)";
fontname=lovebeat;
rankdir=TB;
newrank=true;
A2 [label="expr for type"];
B2 [label="literal"];
C2 [label="variable"];
D2 [label="subroutine"];
F2 [label="return" style=filled fillcolor=lightskyblue1];
A2 -> A2 [dir=back];
A2 -> B2 -> A2;
A2 -> C2 -> A2;
A2 -> D2 -> A2;
A2 -> F2;
}
subgraph cluster_fn_gen_global_type_3 {
label="fn_gen_global_type(GazType)";
fontname=lovebeat;
rankdir=TB;
newrank=true;
A3 [label="expr for type"];
B3 [label="literal"];
C3 [label="global"];
D3 [label="function"];
F3 [label="return" style=filled fillcolor=lightskyblue1];
A3 -> A3 [dir=back];
A3 -> B3 -> A3;
A3 -> C3 -> A3;
A3 -> D3 -> A3;
A3 -> F3;
}
}

View file

@ -0,0 +1,19 @@
digraph fn_args {
labelloc="t";
graph [fontname = "cc wild words"];
node [fontname = "cc wild words"];
edge [fontname = "cc wild words"];
label="fn_args(Vec<GazType>)";
fontname=lovebeat;
rankdir=TB;
newrank=true;
A [label="for each type"];
B [label="gen_type(GazType)" shape=diamond style=filled fillcolor=lightcoral];
C [label="pack into var"];
D [label="return" style=filled fillcolor=lightskyblue];
A -> B -> C -> A;
A -> D;
}

View file

@ -0,0 +1,22 @@
digraph fn_gen_function {
labelloc="t";
graph [fontname = "cc wild words"];
node [fontname = "cc wild words"];
edge [fontname = "cc wild words"];
label="fn_gen_function(Vec<GazType>, return: GazType)";
fontname=lovebeat;
rankdir=TB;
newrank=true;
A [label="push args into scope"];
B [label="new scope"];
C [label="gen_statement()" shape=diamond style=filled
fillcolor=lightcoral];
D [label="gen_return(GazType)" shape=diamond style=filled
fillcolor=lightcoral];
F [label="return" style=filled fillcolor=lightskyblue1];
A -> B -> C -> D -> F;
C -> C [dir=back];
}

View file

@ -0,0 +1,23 @@
digraph fn_gen_global_type {
labelloc="t";
graph [fontname = "cc wild words"];
node [fontname = "cc wild words"];
edge [fontname = "cc wild words"];
label="fn_gen_global_type(GazType)";
fontname=lovebeat;
rankdir=TB;
newrank=true;
A [label="expr for type"];
B [label="literal"];
C [label="global"];
D [label="function"];
F [label="return" style=filled fillcolor=lightskyblue1];
A -> A [dir=back];
A -> B -> A;
A -> C -> A;
A -> D -> A;
A -> F;
}

View file

@ -0,0 +1,24 @@
digraph fn_gen_type {
rankdir=TB;
labelloc="t";
graph [fontname = "cc wild words"];
node [fontname = "cc wild words"];
edge [fontname = "cc wild words"];
label="fn_gen_type(GazType)";
fontname=lovebeat;
rankdir=TB;
newrank=true;
A [label="expr for type"];
B [label="literal"];
C [label="variable"];
D [label="subroutine"];
F [label="return" style=filled fillcolor=lightskyblue1];
A -> A [dir=back];
A -> B -> A;
A -> C -> A;
A -> D -> A;
A -> F;
}

View file

@ -19,6 +19,10 @@ HELP
exit 1
fi
for name in "${fnames[@]}"; do
dot -Tsvg -o "${path}/${name}.svg" "${path}/${name}.dot"
for name in ${path}/*.dot; do
dot -Tsvg -o "${name%.*}.svg" "$name"
done
for name in ${path}/**/*.dot; do
dot -Tsvg -o "${name%.*}.svg" "$name"
done