forked from acsl-language/acsl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcfg.mp
51 lines (44 loc) · 1.3 KB
/
cfg.mp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
verbatimtex
%&latex
\documentclass[a4paper,11pt,twoside,openright]{report}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{ifthen}
\usepackage{color}
\input{macros_modern}
\begin{document}
etex
input boxes
vardef fleche(expr p) =
drawarrow p withcolor blue;
point .5*length p of p
enddef;
vardef yellownodes(text t) =
forsuffixes a=t:
fill bpath a withcolor red+green;
endfor;
drawboxed(t);
enddef;
beginfig(1);
circleit.init(btex ~~~ etex) ;
circleit.loop(btex ~~~ etex) ;
circleit.inv(btex inv etex) ;
circleit.loopend(btex ~~~ etex) ;
circleit.test(btex do etex) ;
circleit.exit(btex ~~~ etex) ;
loopend.c - exit.c =
inv.c - loopend.c =
loop.c - inv.c =
init.c - loop.c = (0,40pt) ;
inv.c - test.c = (100pt,0);
yellownodes(init,loop,inv,loopend,test,exit) ;
pickup pencircle scaled 1pt;
label.rt(btex $i\la 0$ etex, fleche(init.s -- loop.n)) ;
label.rt(btex $m\la t[i]$ etex, fleche(loop.s -- inv.n)) ;
label.rt(btex $i\la i+1$ etex, fleche(inv.s -- loopend.n)) ;
label.rt(btex $i\geq n$ etex, fleche(loopend.s -- exit.n)) ;
label.urt(btex $i < n$ etex, fleche(loopend.w{left} .. {up}test.s)) ;
label.top(btex $m < t[i]$ etex, fleche(test.n{up} .. {right}loop.w)) ;
label.top(btex $m\geq t[i]$ etex, fleche(test.e -- inv.w)) ;
endfig;
end