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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
divert(-1)
FlowchartDefs.m4
`Some experimental flow-chart macros.
In the following, every subchart is in
[] brackets, with .N, .S, .E and .W
internally defined. Follow this convention
if you create compound constructs.
Generally, the first argument is one
or more strings; the second adjusts
the size, and the third can be used
to add color, dashed lines, labels,
or other embellishements. Default is
grey fill if arg3 is blank.
These macros have been renamed from earlier
versions because of slight differences of
arguments.'
define(`FlowchartDefs_')
`Default sizes:'
define(`fboxwid',linewid*2)
define(`fboxht',linewid*0.75)
define(`farrowht',linewid*0.5)
`Fbox( "text", wid expr ht expr,
attributes ) The basic task box: arg1 may
be 1 or more label strings. Attributes
include box line and fill specs.
To adjust the box size to the size of
the typeset text, see the \boxdims macro
in the manual. Example:
Fbox("$x < 1$",,
shaded rgbstring(0.46,0.53,0.63))'
define(`Fbox',`[ boxwid = fboxwid; boxht = fboxht
Box: box `$2' ifelse(`$3',,`fill_(fillval)',`$3') `$1'
N: Box.n; S:Box.s; E:Box.e; W: Box.w
`$4']')
`If-then
Ftest( "text", wid expr ht expr, attributes )'
define(`Ftest',`[boxwid = fboxwid*0.8; boxht = fboxht*1.4
Box: box ifelse(`$2',,,`$2') invis
N: Box.n; S: Box.s; E: Box.e; W: Box.w
line from 0.5 between last box.n and last box.e \
to last box.e then to last box.s then to last box.w then to last box.n \
then to 0.5 between last box.n and last box.e \
ifelse(`$3',,`fill_(fillval)',`$3')
ifelse(`$1',,,`$1' at Box)
`$4']')
`case statement
Fcase(wid expr ht expr,
"Test string 1",task, ...,
"Test string n",task)'
`arg1 adjusts the size of the tests
A task is a flow subchart with internal names .E and .S defined
The test blocks are labeled Test1, Test2, ... and the tasks are
labeled Task1, Task2, ... '
define(`Fcase',`[ down; S: Here; sx = S.x
Fcaseloop_(1,$@)
ifelse(`$2',,`E:S; W:S; N:S',
`E:(sx+linewid/2,Task1.E.y); W:Test1.W; N:Test1.N')
Fcasearrow_(1,$@)
arrow from E to (E,S) then to S ]')
define(`Fcaseloop_',`ifelse(`$3',,,
`Test`$1': Ftest(`$3',`$2') with .N at S
Task`$1': `$4' with .nw at Test`$1'.E+(linewid/2,min(Test`$1'.ht,fboxht)/2)
arrow right linewid/4 from Test`$1'.E \
then down Test`$1'.E.y-Task`$1'.W.y then to Task`$1'.W
S: (Test`$1'.S.x,min(Test`$1'.S.y,Task`$1'.S.y)-linewid/3)
ifelse(`$5',,`line',`arrow') from Test`$1'.S to S
sx = max(sx,Task`$1'.E.x)
Fcaseloop_(incr($1),`$2',shift(shift(shift(shift($@)))))')')
define(`Fcasearrow_',`ifelse(`$3',,,
`arrow from Task`$1'.E to (E,Task`$1'.E)
Fcasearrow_(incr($1),`$2',shift(shift(shift(shift($@)))))')')
`while statement with explicit test
Fwhiledo("test text", wid x ht y, attributes, task spec )
The task structure is given label Task '
define(`Fwhiledo',`[ down
Test: Ftest(`$1',`$2',`$3')
arrow right linewid/2 from Test.E
Task: `$4' with .W at Here
E: Task.E; W: Test.w; S: Test.S
arrow up max(linewid/4,Test.n.y-Task.n.y+arrowht*1.5) \
from Task.N then left Task.x-Test.x
N: Here
arrow to Test.n
`$5']')
`repeat statement with explicit test
Frepeatuntil("test",wid x ht y,attributes, task spec )
The task structure is given label Task '
define(`Frepeatuntil',`[ N: Here
Task: ifelse(`$4',,Here,`$4' with .N at N)
W: Task.W
arrow down linewid/3
Test: Ftest(`$1',`$2',`$3')
E: Task.E+(linewid/2+max(0,Test.e.x-Task.e.x),0)
arrow from Test.e to (E,Test) then to E then to Task.E
S: Test.S
`$5']')
`if-then-else
Fifthenelse( "test", wid x ht y, attributes,
left tasks, right tasks)
The left task structure is given label Ltask and the right
task structure is given label Rtask '
define(`Fifthenelse',`[ Test: Ftest(`$1',`$2',`$3')
N: Test.N
Ltask: ifelse(`$4',,`Test.S; W:Test.W; LS:Ltask',
`$4 with .ne at ((Test.W.x+Test.x)/2,Test.S.y)
W: Ltask.W; LS:Ltask.S
arrow from Test.W to (Ltask.N,Test.W) then to Ltask.N')
Rtask: ifelse(`$5',,`Test.S; E:Test.E; RS:Rtask',
`$5 with .nw at ((Test.E.x+Test.x)/2,Test.S.y)
E: Rtask.E; RS: Rtask.S
arrow from Test.E to (Rtask.N,Test.E) then to Rtask.N')
S: (Test.x,min(LS.y,RS.y)-linewid/3)
arrow from LS to (LS,S)
arrow from RS to (RS,S)
line to (LS,Here)
`$6']')
divert(0)dnl
|