checkpoing
This commit is contained in:
parent
1eb9175286
commit
20bfa1a8c0
23 changed files with 519 additions and 443 deletions
|
@ -1,7 +1,6 @@
|
|||
digraph g {
|
||||
Start [shape=box];
|
||||
End [shape=box];
|
||||
Start -> End [style=dashed];
|
||||
Start -> "int a = 1" -> "while (a > 0)" -> "if (a > 10)" -> "break" -> "print(a)";
|
||||
"break" -> "a++" [style=dashed];
|
||||
"if (a > 10)" -> "a++" -> "while (a > 0)" -> "print(a)" -> End;
|
||||
|
|
BIN
img/breakcfg.pdf
BIN
img/breakcfg.pdf
Binary file not shown.
|
@ -1,4 +1,5 @@
|
|||
digraph g {
|
||||
graph [splines = ortho];
|
||||
// nodes g()
|
||||
subgraph cluster_g {
|
||||
enter_g [label=<entry<br/>g()>,shape=rect,style=filled];
|
||||
|
|
Binary file not shown.
|
@ -1,13 +1,13 @@
|
|||
digraph g {
|
||||
subgraph a {
|
||||
E [label = "Entry", shape = box];
|
||||
E [label = "Enter", shape = box];
|
||||
e [label = "Exit", shape = box];
|
||||
c [label = <x_in = 2<br/>y_in = 3<br/>multiply(2, 3)>];
|
||||
E -> c -> e;
|
||||
}
|
||||
|
||||
subgraph b {
|
||||
Entry [shape=box, label = <Entry<br/>x = x_in<br/>y = y_in>];
|
||||
Entry [shape=box, label = <Enter<br/>x = x_in<br/>y = y_in>];
|
||||
Exit [shape=box];
|
||||
Entry -> "int result = 0" -> "while (x > 0)" -> "result += y" -> "x--" -> "while (x > 0)" -> "System.out.println(result)" -> "return result" -> Exit;
|
||||
{ rank = same; "while (x > 0)"; "System.out.println(result)"}
|
||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
digraph cfg {
|
||||
start -> while [label = T];
|
||||
while -> "if (Y)" [label = "T"];
|
||||
while -> "if (Y)";
|
||||
while -> D [label = "F"];
|
||||
D -> end;
|
||||
"if (Y)" -> "if (Z)" [label=T];
|
||||
|
@ -18,5 +18,4 @@ digraph cfg {
|
|||
break1 -> B [style=dashed, label = F];
|
||||
break2 -> C [style=dashed, label = F];
|
||||
C -> while;
|
||||
start -> end [label = F, style = dashed];
|
||||
}
|
Binary file not shown.
|
@ -1,26 +1,63 @@
|
|||
digraph G {
|
||||
a1 [label = <Enter<br/>z = z_in<br/>x = x_in<br/>y = y_in>, shape = rect];
|
||||
a2 [label = "z += x"];
|
||||
a3 [label = "y++"];
|
||||
a4 [label = <z_out = z<br/>y_out = y<br/>Exit>, shape = rect];
|
||||
a1 -> a2 -> a3 -> a4
|
||||
|
||||
// p [label=<x_in = a + b<br/>y_in = c<br/>f()<br/>c = y_out>,shape=rect];
|
||||
f_call [label="f()"]
|
||||
x_in [label="x_in = a + b"]
|
||||
y_in [label="y_in = c"]
|
||||
y_out [label="c = y_out"]
|
||||
f_call -> {x_in y_in y_out};
|
||||
f_start [label="enter f"];
|
||||
x_in [label="x_in = a + 1"]
|
||||
y_in [label="y_in = b"]
|
||||
z_in [label="z_in = z"]
|
||||
y_out [label="b = y_out"]
|
||||
z_out [label="z = z_out"]
|
||||
f_call -> {z_in x_in y_in y_out z_out};
|
||||
|
||||
f_start [label="enter f", shape = rect];
|
||||
fx_in [label="x = x_in"];
|
||||
fy_in [label="y = y_in"];
|
||||
fz_in [label="z = z_in"];
|
||||
fy_out [label="y_out = y"];
|
||||
f_start -> {fx_in fy_in fy_out};
|
||||
fz_out [label="z_out = z"];
|
||||
f_start -> {fz_in fx_in fy_in fy_out fz_out};
|
||||
f_call -> f_start [style=bold];
|
||||
y_in -> f_start [style=invis];
|
||||
x_in -> fx_in [style=dashed];
|
||||
y_in -> fy_in [style=dashed];
|
||||
fy_out -> y_out [constraint=false,style=dashed];
|
||||
{
|
||||
edge [style = dashed];
|
||||
z_in -> fz_in
|
||||
x_in -> fx_in
|
||||
y_in -> fy_in
|
||||
fy_out -> y_out
|
||||
fz_out -> z_out
|
||||
}
|
||||
invis [height=0.001,width=0.001,style=invis];
|
||||
invis2 [height=0.001,width=0.001,style=invis];
|
||||
{rank=same; x_in y_in y_out invis};
|
||||
{rank=same; fx_in fy_in invis2 fy_out};
|
||||
{rank=same; x_in y_in y_out z_in z_out invis};
|
||||
{rank=same; fx_in fy_in invis2 fy_out fz_in fz_out};
|
||||
{edge [style=invis];
|
||||
x_in -> y_in -> invis -> y_out;
|
||||
fx_in -> fy_in -> invis2 -> fy_out;
|
||||
z_in -> x_in -> y_in -> invis -> y_out -> z_out;
|
||||
fz_in -> fx_in -> fy_in -> invis2 -> fy_out -> fz_out;
|
||||
}
|
||||
|
||||
{rank = max;
|
||||
zplus [label = "z += x"];
|
||||
yplus [label = "y++"];
|
||||
}
|
||||
f_start -> {zplus yplus};
|
||||
{
|
||||
edge [color = red];
|
||||
{fz_in fx_in} -> zplus;
|
||||
fy_in -> yplus;
|
||||
edge [constraint = false];
|
||||
zplus -> fz_out;
|
||||
yplus -> fy_out;
|
||||
}
|
||||
|
||||
{
|
||||
edge [color = blue, constraint = false, style = bold];
|
||||
{z_in x_in} -> z_out;
|
||||
y_in -> y_out;
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
|
@ -36,6 +36,4 @@ digraph g {
|
|||
l9 -> {l8 l9 l11}
|
||||
}
|
||||
}
|
||||
|
||||
l4 -> StartF [style=bold,constraint=false];
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -1,21 +1,24 @@
|
|||
digraph g {
|
||||
Start [shape=box,label=<Start<br/>x = x_in>];
|
||||
End [shape=box];
|
||||
Start -> End [style=dashed];
|
||||
End [shape=box,label=<End>];
|
||||
NE [label = <x_out = x<br/>Normal exit>];
|
||||
Start -> "if (x < 0)" -> "throw" -> "Error exit" -> End;
|
||||
"throw" -> "return Math.sqrt(x)" [style=dashed];
|
||||
"if (x < 0)" -> "return Math.sqrt(x)" -> "Normal exit" -> End;
|
||||
"throw" -> "x = Math.sqrt(x)" [style=dashed];
|
||||
"if (x < 0)" -> "x = Math.sqrt(x)" -> NE -> End;
|
||||
// pdg
|
||||
f [label="f()",shape=rect];
|
||||
x_in [label = "x = x_in", style = dashed];
|
||||
x_out [label = "x = x_out", style = dashed];
|
||||
if [label = "if (x < 0)"];
|
||||
t [label = "throw"];
|
||||
ret [label = "return Math.sqrt(x)"];
|
||||
ret [label = "x = Math.sqrt(x)"];
|
||||
ee [label = "error exit", style = dashed];
|
||||
ne [label = "normal exit", style = dashed];
|
||||
f -> x_in;
|
||||
f -> if -> t -> {ret ee ne};
|
||||
ne -> x_out;
|
||||
{ edge [color = red, constraint = false];
|
||||
x_in -> {if ret};
|
||||
ret -> x_out;
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -5,14 +5,15 @@ digraph G {
|
|||
enter -> try;
|
||||
try -> X -> f;
|
||||
f [label = <x_in = x<br/>y_in = y<br/>f()>];
|
||||
f -> { "normal return"; catch; };
|
||||
"normal return" -> "x = x_out" -> Y -> Z;
|
||||
catch -> "y = y_out" -> "print(error)" -> Z -> "normal exit" -> exit;
|
||||
f -> { NR; catch; };
|
||||
NR [label = <normal return<br/>x = x_out>];
|
||||
catch [label = <catch<br/>y = y_out>];
|
||||
NR -> Y -> Z;
|
||||
catch -> "print(error)" -> Z -> "normal exit" -> exit;
|
||||
{ edge [style = dashed, constraint = false];
|
||||
enter -> exit;
|
||||
try -> Z;
|
||||
catch -> Z;
|
||||
"normal return" -> Z;
|
||||
NR -> Z;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,8 +21,8 @@ digraph G {
|
|||
method [label="Start", shape=rect];
|
||||
t [label = "try"];
|
||||
x [label = "X"];
|
||||
x_in [label = "x_in = x"];
|
||||
y_in [label = "y_in = y"];
|
||||
x_in [label = "x_in = x", style = dashed];
|
||||
y_in [label = "y_in = y", style = dashed];
|
||||
call [label = "f()"];
|
||||
nr [style=dashed, label = "normal return"];
|
||||
data [style=dashed, label = "x = x_out"];
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue