Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/Flow.m4

raw
1 .PS
2 # Flow.m4
3 gen_init
4 ifdef(`FlowchartDefs_',,
5 `sinclude(FlowchartDefs.m4def)
6 sinclude(../FlowchartDefs.m4def)')
7
8 # Pic macros for the colors (although m4 macros would work for these examples)
9 define Thistle {rgbstring(0.85,0.75,0.85)}
10 define RubineRed {rgbstring(0.81,0,0.35)}
11 define YellowGreen {rgbstring(0.68,1,0.18)}
12 define SeaGreen {rgbstring(0.13,0.70,0.67)}
13 define Goldenrod {rgbstring(0.85,0.65,0.13)}
14 define Beaublue {rgbstring(0.74,0.83,0.9)}
15 define Celadon {rgbstring(0.67,0.88,0.69)}
16 define Tan {rgbstring(0.9,0.8,0.7)}
17
18 linethick_(1.0)
19 arrowwid = 0.05
20 arrowht = 0.1
21 fillval = 0.9
22 maxpsht = 20
23
24 define(`Below',`with .nw at last [].sw+(0,-0.25)')
25 TL: Here
26 Simple: [
27 Fbox("\tt F{}box",,shaded Tan)
28 Ftest("\tt F{}test",,shaded Tan) Below
29 Fdata("\tt F{}data",,,shaded Tan) Below
30 Fprep("\tt F{}prep",) Below
31 Fkeying("\tt F{}keying") Below
32 Fkeyboard("\tt F{}keyboard") Below
33 Fdocument("\tt F{}document",,shaded Tan) Below
34 Fdelay("\tt F{}delay",,shaded Beaublue) Below
35 Fdisplay("\tt F{}display",,shaded Celadon) Below
36 Fstored("\tt F{}stored",,shaded Thistle) Below
37 Fconnect(,,shaded Thistle) Below
38 Fconnect("45",wid boxwid ht boxht:45,shaded Thistle) \
39 with .w at last [].e+(boxht/8,0)
40 "\tt F{}connect" at last [].nw + (0,boxht/6)
41 ] with .nw at TL+(0.1,0); move from Simple.nw to TL
42 #showbox_
43 Complex: [
44 Case: Fcase(,
45 "Test 1",[Fbox("Task 1",, shaded Thistle); W:last [].W; N:last [].N
46 arrow down linewid/3 from last [].S
47 Fbox("Task 1.5",, shaded Thistle) with .N at Here
48 E:last [].E; S:last [].S],
49 "Test 2",Fbox("Task 2" "is bigger", wid flowboxwid*1.2 ht flowboxht*3/2, \
50 shaded SeaGreen),
51 "Test 3",Fbox("Task 3",, shaded RubineRed)dnl
52 )
53
54 "\sl .N" at Case.N rjust above; "\sl .S" at Case.S rjust below
55 "\sl .E" at Case.E ljust; "\sl .W" at Case.W rjust
56 "\tt F{}case" below at Case.s #+(0,-0.1)
57
58 Whiledo: Fwhiledo("$i < n$",,,Fbox("Task"),"T" above ljust at Test.E) \
59 with .nw at Case.ne+(0.25,0)
60
61 "\sl .N" at Whiledo.N rjust; "\sl .S" at Whiledo.S rjust below
62 "\sl .E" at Whiledo.E ljust; "\sl .W" at Whiledo.W rjust
63 "\tt F{}whiledo" below at Whiledo.s
64
65 Repeatuntil: Frepeatuntil("$n \geq 5$",,,Fbox("Task"),
66 "T" at Test.E above ljust) with .nw at Whiledo.sw + (0.25,-0.5)
67
68 "\sl .N" at Repeatuntil.N rjust above; "\sl .S" at Repeatuntil.S rjust below
69 "\sl .E" at Repeatuntil.E ljust; "\sl .W" at Repeatuntil.W rjust
70 "\tt F{}repeatuntil" below at Repeatuntil.se +(-0.0,0.1)
71
72 Ifthenelse: Fifthenelse("$A<B$",,,
73 Fbox("False"),
74 Fbox("True",ht flowboxht*1.2 wid flowboxwid)dnl
75 ) with .nw at Repeatuntil.sw +(-0.5,-0.3)
76
77 "\sl .N" at Ifthenelse.N rjust above; "\sl .S" at Ifthenelse.S below rjust
78 "\sl .E" wid 12bp__ at Ifthenelse.E ljust; "\sl .W" at Ifthenelse.W rjust
79 "\tt F{}ifthenelse" below at Ifthenelse.s+(0,-0.15)
80
81 Compound: [ right
82 ellipse shaded YellowGreen "Start"
83 arrow right linewid/2
84
85 Fbox("First task") with .W at Here
86 arrow down linewid/2 from last [].S
87
88 Fifthenelse("Test 1",,,
89 Frepeatuntil("$i \geq 5$",,shaded Goldenrod,Fbox("Task")),
90 Fifthenelse("$A < B$",,shaded Goldenrod,
91 Fbox("Left"),
92 Fbox("Right"),
93 "T" at Test.E above ljust),
94 "T" at Test.E above ljust) with .N at Here
95
96 A: arrow down 0.25 from last [].S ] with .nw at Case.sw + (-12bp__,-0.3)
97
98 "\sl Compound statements" at last [].A.end+(0.1,0) ljust above
99
100 ] with .nw at Simple.ne+(0.1,0)
101 #showbox_
102
103 Example: [ fillvalue = 0.8; awid = linewid/2; right_
104 Start: ellipse wid boxwid/2 ht boxwid/3 shaded "green"
105 arrow right_ awid
106 B1: Fbox("Planejamento")
107 B2: Fbox(`"Execu\c{c}\~ao"') with .W at B1.E+(awid*3,0)
108 B3: Fbox(`"Sele\c{c}\~ao"') with .W at B2.E+(awid*3,0)
109 LT: Ftest(`"Avalia\c{c}\~ao do" "Planejamento"',
110 wid flowboxwid*1.5 ht flowboxht*2.0,
111 shaded YellowGreen,
112 "Correto" at Box.e above ljust;
113 "Incompleto" at Box.w above rjust) with .S at 0.5 between B1.ne and B2.nw
114 arrow from B1.E to (LT.S,B1.E) then to LT.S
115 arrow from LT.W to (B1.N,LT.W) then to B1.N
116 arrow from LT.E to (B2.N,LT.E) then to B2.N
117 RT: Ftest(`"Avalia\c{c}\~ao da" "Execu\c{c}\~ao"',
118 wid flowboxwid*1.5 ht flowboxht*2.0,
119 shaded YellowGreen,
120 "Correto" at Box.e below ljust;
121 "Incompleto" at Box.w below rjust) with .N at 0.5 between B2.se and B3.sw
122 arrow from B2.E to (RT.N,B2.E) then to RT.N
123 arrow from RT.W to (B2.S,RT.W) then to B2.S
124 arrow from RT.E to (B3.S,RT.E) then to B3.S
125 B4: Fbox(`"Extra\c{c}\~ao"') with .S at B3.N+(0,awid)
126 arrow from B3.N to B4.S
127 # arrow right_ awid from B4.E
128 arrow up_ awid from B4.N
129 B5: Fbox(`"Conclus\~ao"')
130 arrow up_ awid from B5.N
131 ellipse wid boxwid/2 ht boxwid/3 shaded "red" # at (B5.S,Start)
132 # arrow down_ awid from B5.S to last ellipse.n
133 ] with .nw at last [].Compound.sw+(0,2.5*flowboxht)
134
135 .PE