summaryrefslogtreecommitdiff
path: root/doc/latex/classPacketSource.eps
blob: 20a1a2eddca4d0775f6934eb12ea11ba2e47b3de (plain) (blame)
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
%!PS-Adobe-2.0 EPSF-2.0
%%Title: ClassName
%%Creator: Doxygen
%%CreationDate: Time
%%For: 
%Magnification: 1.00
%%Orientation: Portrait
%%BoundingBox: 0 0 500 322.581
%%Pages: 0
%%BeginSetup
%%EndSetup
%%EndComments

% ----- variables -----

/boxwidth 0 def
/boxheight 40 def
/fontheight 24 def
/marginwidth 10 def
/distx 20 def
/disty 40 def
/boundaspect 1.55 def  % aspect ratio of the BoundingBox (width/height)
/boundx 500 def
/boundy boundx boundaspect div def
/xspacing 0 def
/yspacing 0 def
/rows 2 def
/cols 1 def
/scalefactor 0 def
/boxfont /Times-Roman findfont fontheight scalefont def

% ----- procedures -----

/dotted { [1 4] 0 setdash } def
/dashed { [5] 0 setdash } def
/solid  { [] 0 setdash } def

/max % result = MAX(arg1,arg2)
{
  /a exch def
  /b exch def
  a b gt {a} {b} ifelse
} def

/xoffset % result = MAX(0,(scalefactor-(boxwidth*cols+distx*(cols-1)))/2)
{
  0 scalefactor boxwidth cols mul distx cols 1 sub mul add sub 2 div max
} def

/cw % boxwidth = MAX(boxwidth, stringwidth(arg1))
{
  /str exch def
  /boxwidth boxwidth str stringwidth pop max def
} def

/box % draws a box with text `arg1' at grid pos (arg2,arg3)
{ gsave
  2 setlinewidth
  newpath
  exch xspacing mul xoffset add
  exch yspacing mul
  moveto
  boxwidth 0 rlineto 
  0 boxheight rlineto 
  boxwidth neg 0 rlineto 
  0 boxheight neg rlineto 
  closepath
  dup stringwidth pop neg boxwidth add 2 div
  boxheight fontheight 2 div sub 2 div
  rmoveto show stroke
  grestore
} def  

/mark
{ newpath
  exch xspacing mul xoffset add boxwidth add
  exch yspacing mul
  moveto
  0 boxheight 4 div rlineto
  boxheight neg 4 div boxheight neg 4 div rlineto
  closepath
  eofill
  stroke
} def

/arrow
{ newpath
  moveto
  3 -8 rlineto
  -6 0 rlineto
  3 8 rlineto
  closepath
  eofill
  stroke
} def

/out % draws an output connector for the block at (arg1,arg2)
{
  newpath
  exch xspacing mul xoffset add boxwidth 2 div add
  exch yspacing mul boxheight add
  /y exch def
  /x exch def
  x y moveto
  0 disty 2 div rlineto 
  stroke
  1 eq { x y disty 2 div add arrow } if
} def

/in % draws an input connector for the block at (arg1,arg2)
{
  newpath
  exch xspacing mul xoffset add boxwidth 2 div add
  exch yspacing mul disty 2 div sub
  /y exch def
  /x exch def
  x y moveto
  0 disty 2 div rlineto
  stroke
  1 eq { x y disty 2 div add arrow } if
} def

/hedge
{
  exch xspacing mul xoffset add boxwidth 2 div add
  exch yspacing mul boxheight 2 div sub
  /y exch def
  /x exch def
  newpath
  x y moveto
  boxwidth 2 div distx add 0 rlineto
  stroke
  1 eq
  { newpath x boxwidth 2 div distx add add y moveto
    -8 3 rlineto
    0 -6 rlineto
    8 3 rlineto
    closepath
    eofill
    stroke
  } if
} def

/vedge
{
  /ye exch def
  /ys exch def
  /xs exch def
  newpath
  xs xspacing mul xoffset add boxwidth 2 div add dup
  ys yspacing mul boxheight 2 div sub
  moveto
  ye yspacing mul boxheight 2 div sub
  lineto
  stroke
} def

/conn % connections the blocks from col `arg1' to `arg2' of row `arg3'
{
  /ys exch def
  /xe exch def
  /xs exch def
  newpath
  xs xspacing mul xoffset add boxwidth 2 div add
  ys yspacing mul disty 2 div sub
  moveto
  xspacing xe xs sub mul 0
  rlineto
  stroke
} def

% ----- main ------

boxfont setfont
1 boundaspect scale
(PacketSource) cw
(UDPPacketSource) cw
/boxwidth boxwidth marginwidth 2 mul add def
/xspacing boxwidth distx add def
/yspacing boxheight disty add def
/scalefactor 
  boxwidth cols mul distx cols 1 sub mul add
  boxheight rows mul disty rows 1 sub mul add boundaspect mul 
  max def
boundx scalefactor div boundy scalefactor div scale

% ----- classes -----

 (PacketSource) 0 1 box
 (UDPPacketSource) 0 0 box

% ----- relations -----

solid
1 0 0.25 out
solid
0 0 0.75 in