1 | (* This is a jgraph of the sending of messages in a multicomputer over
|
---|
2 | a period of time. It is a good mixture of picture drawing and graph-
|
---|
3 | drawing: Note that hash marks and a legend is employed, as is the drawing
|
---|
4 | of multiple arrowed lines, and some text.
|
---|
5 | *)
|
---|
6 | newgraph
|
---|
7 |
|
---|
8 | (* Draw the three time lines with hash ticks. Only draw hash labels on
|
---|
9 | the bottom-most one *)
|
---|
10 |
|
---|
11 | yaxis size 1.6 min 0 max 2 nodraw
|
---|
12 | xaxis size 4.5 min 0.5 max 10.5 nodraw
|
---|
13 | draw_hash_marks draw_hash_labels draw_axis_label
|
---|
14 | hash 1 mhash 0 shash 0 hash_scale -.4
|
---|
15 | label : Time
|
---|
16 | copygraph xaxis draw_at 1 nodraw draw_hash_marks
|
---|
17 | copygraph xaxis draw_at 2
|
---|
18 |
|
---|
19 | (* Reset the axes to draw the picture *)
|
---|
20 |
|
---|
21 | copygraph
|
---|
22 | xaxis size 4.5 min 99.5 max 109.5 nodraw
|
---|
23 |
|
---|
24 | (* Define the legend entries *)
|
---|
25 |
|
---|
26 | newline linethickness .5 linetype dashed
|
---|
27 | rarrows asize 0.19 0.04 label font Times-Italic : mCL Marker
|
---|
28 | copycurve linetype dotdash label : mNSmarker
|
---|
29 | copycurve linetype dotted label : mS Message
|
---|
30 | copycurve linetype solid label : Normal Message
|
---|
31 | legend linelength 1
|
---|
32 |
|
---|
33 | (* Draw each process's time line arrow *)
|
---|
34 |
|
---|
35 | newline linethickness .5 rarrows
|
---|
36 | pts 99.5 0 109.5 0
|
---|
37 | copycurve pts 99.5 1 109.5 1
|
---|
38 | copycurve pts 99.5 2 109.5 2
|
---|
39 |
|
---|
40 | (* Draw the time line processor labels *)
|
---|
41 |
|
---|
42 | newstring fontsize 9 hjl vjc x 99 y 2 : Pc
|
---|
43 | copystring y 1 : P1
|
---|
44 | copystring y 0 : P2
|
---|
45 |
|
---|
46 | (* Draw the initial broadcast of mcl messages *)
|
---|
47 |
|
---|
48 | newline linethickness .5 linetype dashed
|
---|
49 | rarrows asize 0.19 0.04 pts 100 2 102 1
|
---|
50 | copycurve pts 100 2 102 0
|
---|
51 |
|
---|
52 | (* Draw Message from p2 -> p1 *)
|
---|
53 |
|
---|
54 | copycurve linetype solid pts 101 0 103 1
|
---|
55 |
|
---|
56 | (* Draw mns messages to p1 *)
|
---|
57 |
|
---|
58 | copycurve linetype dotdash pts 100 2 104 1
|
---|
59 | copycurve pts 102 0 104 1
|
---|
60 |
|
---|
61 | (* Draw Message from p2 -> pc *)
|
---|
62 |
|
---|
63 | copycurve linetype dashed pts 105 0 106 2
|
---|
64 | copycurve linetype solid pts 105.1 0 106.1 2
|
---|
65 |
|
---|
66 | (* Draw mns messages from p1 *)
|
---|
67 |
|
---|
68 | copycurve linetype dotdash pts 104 1 107 0
|
---|
69 | copycurve pts 104 1 107 2
|
---|
70 |
|
---|
71 | (* Draw mc's -> pc *)
|
---|
72 |
|
---|
73 | copycurve linetype dotted pts 104 1 108 2
|
---|
74 | copycurve pts 107 0 108 2
|
---|
75 |
|
---|
76 | (* Draw mc from pc *)
|
---|
77 |
|
---|
78 | copycurve pts 108 2 109 1
|
---|
79 | copycurve pts 108 2 109 0
|
---|
80 |
|
---|
81 | (* Draw labels for m and m' *)
|
---|
82 |
|
---|
83 | newstring fontsize 9 font Times-Italic x 102.05 y .5 hjl vjt : m
|
---|
84 | copystring x 105.6 y .75 hjl vjc : m'
|
---|
85 |
|
---|
86 | copystring x 105.6 y 2.15 hjr vjc : Pc doesn't log m'
|
---|
87 | copystring x 103.4 y 1.35 hjl vjb : P1 logs m
|
---|
88 |
|
---|
89 | copycurve linetype solid pts 105.7 2.15 106.1 2
|
---|
90 | copycurve pts 103.38 1.32 103 1
|
---|