ruby-graphviz 0.9.10 → 0.9.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/AUTHORS +1 -0
  2. data/README.rdoc +5 -0
  3. data/examples/maketest.bat +6 -0
  4. data/examples/maketest.sh +6 -0
  5. data/examples/sample30.rb.ps +923 -0
  6. data/examples/sample37.rb +87 -0
  7. data/examples/sample37.rb.dot +50 -0
  8. data/examples/sample37.rb.png +0 -0
  9. data/examples/sample38.rb +11 -0
  10. data/lib/graphviz.rb +34 -17
  11. data/lib/graphviz/constants.rb +1 -1
  12. data/lib/graphviz/core_ext.rb +23 -0
  13. data/lib/graphviz/family_tree.rb +23 -4
  14. data/lib/graphviz/family_tree/couple.rb +3 -2
  15. data/lib/graphviz/family_tree/generation.rb +4 -4
  16. data/lib/graphviz/family_tree/person.rb +27 -3
  17. data/test/output/sample01.rb.png +0 -0
  18. data/test/output/sample02.rb.png +0 -0
  19. data/test/output/sample03.rb.png +0 -0
  20. data/test/output/sample04.rb.png +0 -0
  21. data/test/output/sample05.rb.png +0 -0
  22. data/test/output/sample06.rb.png +0 -0
  23. data/test/output/sample07.rb.png +0 -0
  24. data/test/output/sample08.rb.png +0 -0
  25. data/test/output/sample09.rb.png +0 -0
  26. data/test/output/sample10.rb.png +0 -0
  27. data/test/output/sample11.rb.png +0 -0
  28. data/test/output/sample12.rb.png +0 -0
  29. data/test/output/sample13.rb.png +0 -0
  30. data/test/output/sample14.rb.png +0 -0
  31. data/test/output/sample15.rb.png +0 -0
  32. data/test/output/sample16.rb.png +0 -0
  33. data/test/output/sample17.rb.png +0 -0
  34. data/test/output/sample18.rb.png +0 -0
  35. data/test/output/sample19.rb.png +0 -0
  36. data/test/output/sample20.rb.png +0 -0
  37. data/test/output/sample21.rb.html +3 -0
  38. data/test/output/sample21.rb.png +0 -0
  39. data/test/output/sample22.rb.html +5 -0
  40. data/test/output/sample22.rb.png +0 -0
  41. data/test/output/sample23.rb.png +0 -0
  42. data/test/output/sample24.rb.png +0 -0
  43. data/test/output/sample25.rb.png +0 -0
  44. data/test/output/sample26.rb.png +0 -0
  45. data/test/output/sample28.rb.png +0 -0
  46. data/test/output/sample29.rb.svg +21 -0
  47. data/test/output/sample30.rb.ps +268 -0
  48. data/test/output/sample31.rb.png +0 -0
  49. data/test/output/sample32.rb.png +0 -0
  50. data/test/output/sample37.rb.dot +50 -0
  51. data/test/output/sample37.rb.png +0 -0
  52. data/test/output/sample38.rb.png +0 -0
  53. data/test/output/sample40.rb.png +0 -0
  54. data/test/support.rb +100 -0
  55. data/test/test_examples.rb +130 -0
  56. metadata +47 -5
  57. data/examples/sample13b.rb +0 -48
data/AUTHORS CHANGED
@@ -6,6 +6,7 @@ obruening <http://github.com/obruening>
6
6
  reactive <http://github.com/reactive>
7
7
  Hugh Sasse <hgs@dmu.ac.uk>
8
8
  axgle <http://github.com/axgle>
9
+ hipe <http://github.com/hipe>
9
10
 
10
11
  Thanks to :
11
12
 
data/README.rdoc CHANGED
@@ -13,7 +13,12 @@ Interface to the GraphViz graphing tool
13
13
  == CHANGELOG
14
14
 
15
15
  === 0.9.11 :
16
+ * Issue #11 : Cygwin PATH
17
+ * Major bugs correction in output
18
+ * Bug correction in find_executable
19
+ * Add tests (by Chip Malice : http://github.com/hipe)
16
20
  * TODO: GraphViz::Parser support block
21
+ * TODO: Issue #12
17
22
 
18
23
  === 0.9.10 :
19
24
  * Move ChangeLog in README
@@ -71,6 +71,12 @@
71
71
  @ruby sample32.rb
72
72
  @echo "sample33.rb"
73
73
  @ruby sample33.rb
74
+ @echo "sample34.rb"
75
+ @ruby sample34.rb
76
+ @echo "sample35.rb"
77
+ @ruby sample35.rb
78
+ @echo "sample36.rb"
79
+ @ruby sample36.rb
74
80
 
75
81
 
76
82
  @echo "shapes.rb"
data/examples/maketest.sh CHANGED
@@ -73,6 +73,12 @@ echo "sample32.rb"
73
73
  ruby sample32.rb
74
74
  echo "sample33.rb"
75
75
  ruby sample33.rb
76
+ echo "sample34.rb"
77
+ ruby sample34.rb
78
+ echo "sample35.rb"
79
+ ruby sample35.rb
80
+ echo "sample36.rb"
81
+ ruby sample36.rb
76
82
 
77
83
  echo "shapes.rb"
78
84
  ruby shapes.rb
@@ -0,0 +1,923 @@
1
+ %!PS-Adobe-3.0
2
+ %%Creator: graphviz version 2.26.3 (20100126.1600)
3
+ %%Title: g
4
+ %%Pages: (atend)
5
+ %%BoundingBox: (atend)
6
+ %%EndComments
7
+ save
8
+ %%BeginProlog
9
+ /DotDict 200 dict def
10
+ DotDict begin
11
+
12
+ /setupLatin1 {
13
+ mark
14
+ /EncodingVector 256 array def
15
+ EncodingVector 0
16
+
17
+ ISOLatin1Encoding 0 255 getinterval putinterval
18
+ EncodingVector 45 /hyphen put
19
+
20
+ % Set up ISO Latin 1 character encoding
21
+ /starnetISO {
22
+ dup dup findfont dup length dict begin
23
+ { 1 index /FID ne { def }{ pop pop } ifelse
24
+ } forall
25
+ /Encoding EncodingVector def
26
+ currentdict end definefont
27
+ } def
28
+ /Times-Roman starnetISO def
29
+ /Times-Italic starnetISO def
30
+ /Times-Bold starnetISO def
31
+ /Times-BoldItalic starnetISO def
32
+ /Helvetica starnetISO def
33
+ /Helvetica-Oblique starnetISO def
34
+ /Helvetica-Bold starnetISO def
35
+ /Helvetica-BoldOblique starnetISO def
36
+ /Courier starnetISO def
37
+ /Courier-Oblique starnetISO def
38
+ /Courier-Bold starnetISO def
39
+ /Courier-BoldOblique starnetISO def
40
+ cleartomark
41
+ } bind def
42
+
43
+ %%BeginResource: procset graphviz 0 0
44
+ /coord-font-family /Times-Roman def
45
+ /default-font-family /Times-Roman def
46
+ /coordfont coord-font-family findfont 8 scalefont def
47
+
48
+ /InvScaleFactor 1.0 def
49
+ /set_scale {
50
+ dup 1 exch div /InvScaleFactor exch def
51
+ scale
52
+ } bind def
53
+
54
+ % styles
55
+ /solid { [] 0 setdash } bind def
56
+ /dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
57
+ /dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
58
+ /invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
59
+ /bold { 2 setlinewidth } bind def
60
+ /filled { } bind def
61
+ /unfilled { } bind def
62
+ /rounded { } bind def
63
+ /diagonals { } bind def
64
+
65
+ % hooks for setting color
66
+ /nodecolor { sethsbcolor } bind def
67
+ /edgecolor { sethsbcolor } bind def
68
+ /graphcolor { sethsbcolor } bind def
69
+ /nopcolor {pop pop pop} bind def
70
+
71
+ /beginpage { % i j npages
72
+ /npages exch def
73
+ /j exch def
74
+ /i exch def
75
+ /str 10 string def
76
+ npages 1 gt {
77
+ gsave
78
+ coordfont setfont
79
+ 0 0 moveto
80
+ (\() show i str cvs show (,) show j str cvs show (\)) show
81
+ grestore
82
+ } if
83
+ } bind def
84
+
85
+ /set_font {
86
+ findfont exch
87
+ scalefont setfont
88
+ } def
89
+
90
+ % draw text fitted to its expected width
91
+ /alignedtext { % width text
92
+ /text exch def
93
+ /width exch def
94
+ gsave
95
+ width 0 gt {
96
+ [] 0 setdash
97
+ text stringwidth pop width exch sub text length div 0 text ashow
98
+ } if
99
+ grestore
100
+ } def
101
+
102
+ /boxprim { % xcorner ycorner xsize ysize
103
+ 4 2 roll
104
+ moveto
105
+ 2 copy
106
+ exch 0 rlineto
107
+ 0 exch rlineto
108
+ pop neg 0 rlineto
109
+ closepath
110
+ } bind def
111
+
112
+ /ellipse_path {
113
+ /ry exch def
114
+ /rx exch def
115
+ /y exch def
116
+ /x exch def
117
+ matrix currentmatrix
118
+ newpath
119
+ x y translate
120
+ rx ry scale
121
+ 0 0 1 0 360 arc
122
+ setmatrix
123
+ } bind def
124
+
125
+ /endpage { showpage } bind def
126
+ /showpage { } def
127
+
128
+ /layercolorseq
129
+ [ % layer color sequence - darkest to lightest
130
+ [0 0 0]
131
+ [.2 .8 .8]
132
+ [.4 .8 .8]
133
+ [.6 .8 .8]
134
+ [.8 .8 .8]
135
+ ]
136
+ def
137
+
138
+ /layerlen layercolorseq length def
139
+
140
+ /setlayer {/maxlayer exch def /curlayer exch def
141
+ layercolorseq curlayer 1 sub layerlen mod get
142
+ aload pop sethsbcolor
143
+ /nodecolor {nopcolor} def
144
+ /edgecolor {nopcolor} def
145
+ /graphcolor {nopcolor} def
146
+ } bind def
147
+
148
+ /onlayer { curlayer ne {invis} if } def
149
+
150
+ /onlayers {
151
+ /myupper exch def
152
+ /mylower exch def
153
+ curlayer mylower lt
154
+ curlayer myupper gt
155
+ or
156
+ {invis} if
157
+ } def
158
+
159
+ /curlayer 0 def
160
+
161
+ %%EndResource
162
+ %%EndProlog
163
+ %%BeginSetup
164
+ 14 default-font-family set_font
165
+ 1 setmiterlimit
166
+ % /arrowlength 10 def
167
+ % /arrowwidth 5 def
168
+
169
+ % make sure pdfmark is harmless for PS-interpreters other than Distiller
170
+ /pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
171
+ % make '<<' and '>>' safe on PS Level 1 devices
172
+ /languagelevel where {pop languagelevel}{1} ifelse
173
+ 2 lt {
174
+ userdict (<<) cvn ([) cvn load put
175
+ userdict (>>) cvn ([) cvn load put
176
+ } if
177
+
178
+ %%EndSetup
179
+ %! SDL shapes for Graphviz/dot in PostScript output mode
180
+
181
+ % FILE
182
+ % sdl.ps - SDL shapes for Graphviz/dot in PostScript output mode
183
+ %
184
+ % USE
185
+ % All procedures expect to be passed a rectangular bounding box in the
186
+ % order [upper right, lower right, lower left, upper left, upper right].
187
+ % All procedures expect to be used with "peripheries = 0".
188
+ %
189
+ % BUGS
190
+ % The following shapes are currently not implemented:
191
+ % - frame/system/block/process/procedure/service/procedure, and types thereof
192
+ % - macro inlet/outlet/call
193
+ % - exception handler/handle/raise
194
+ % - decision (suggest use diamond)
195
+ % - alternative (suggest use triangle)
196
+ % - internal input/output (suggest stop using historical relics!)
197
+ %
198
+ % COPYRIGHT AND PERMISSION NOTICE
199
+ % Copyright (C) 2005 Cambridge Silicon Radio Ltd.; all rights reserved.
200
+ %
201
+ % Permission is hereby granted, free of charge, to any person obtaining
202
+ % a copy of this software and associated documentation files (the
203
+ % "Software"), to deal in the Software without restriction, including
204
+ % without limitation the rights to use, copy, modify, merge, publish,
205
+ % distribute, sublicense, and/or sell copies of the Software, and to
206
+ % permit persons to whom the Software is furnished to do so, subject to
207
+ % the following conditions:
208
+ %
209
+ % The above copyright notice and this permission notice shall be
210
+ % included in all copies or substantial portions of the Software.
211
+ %
212
+ % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
213
+ % EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
214
+ % MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
215
+ % NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
216
+ % LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
217
+ % OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
218
+ % WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
219
+ %
220
+ % Except as contained in this notice, the name of a copyright holder
221
+ % shall not be used in advertising or otherwise to promote the sale, use
222
+ % or other dealings in the Software without prior written authorization
223
+ % of the copyright holder.
224
+ %
225
+ % REVISION
226
+ % #4
227
+
228
+ /xdef {exch def} bind def
229
+
230
+ % SDL task
231
+
232
+ /sdl_task {
233
+ 3 1 roll % put filled flag at end
234
+ 4 ne { stop } if % sanity-check number of sides
235
+ aload pop
236
+ newpath
237
+ moveto
238
+ lineto
239
+ lineto
240
+ lineto
241
+ pop pop
242
+ closepath
243
+ { fill } { stroke } ifelse
244
+ } bind def
245
+
246
+ % SDL input from right
247
+ % The indent has lines at 45 degrees
248
+ % There should be a few spaces at the end of this shape's label
249
+
250
+ /sdl_input_from_right {
251
+ 9 dict begin
252
+ 3 1 roll % put filled flag at end
253
+ 4 ne { stop } if % sanity-check number of sides
254
+ aload pop
255
+ /ury xdef /urx xdef
256
+ /lry xdef /lrx xdef
257
+ /lly xdef /llx xdef
258
+ /uly xdef /ulx xdef
259
+ /h2 ury lry sub 2 div def
260
+ newpath
261
+ moveto
262
+ urx h2 sub ury h2 sub lineto
263
+ lrx lry lineto
264
+ llx lly lineto
265
+ ulx uly lineto
266
+ closepath
267
+ { fill } { stroke } ifelse
268
+ end
269
+ } bind def
270
+
271
+ % SDL input from left
272
+ % Similar to SDL input from right
273
+ % There should be a few spaces at the start of this shape's label
274
+
275
+ /sdl_input_from_left {
276
+ 9 dict begin
277
+ 3 1 roll % put filled flag at end
278
+ 4 ne { stop } if % sanity-check number of sides
279
+ aload pop
280
+ /ury xdef /urx xdef
281
+ /lry xdef /lrx xdef
282
+ /lly xdef /llx xdef
283
+ /uly xdef /ulx xdef
284
+ /h2 uly lly sub 2 div def
285
+ newpath
286
+ moveto
287
+ lrx lry lineto
288
+ llx lly lineto
289
+ ulx h2 add ury h2 sub lineto
290
+ ulx uly lineto
291
+ closepath
292
+ { fill } { stroke } ifelse
293
+ end
294
+ } bind def
295
+
296
+ % SDL priority input from right
297
+ % Similar to SDL input from right
298
+ % The chevrons are displaced by an eighth of the shape height
299
+ % The filled version is indistinguishable from a non-priority SDL input
300
+
301
+ /sdl_priority_input_from_right {
302
+ 9 dict begin
303
+ 3 1 roll % put filled flag at end
304
+ 4 ne { stop } if % sanity-check number of sides
305
+ aload pop
306
+ /ury xdef /urx xdef
307
+ /lry xdef /lrx xdef
308
+ /lly xdef /llx xdef
309
+ /uly xdef /ulx xdef
310
+ /h2 ury lry sub 2 div def
311
+ newpath
312
+ moveto
313
+ urx h2 sub ury h2 sub lineto
314
+ lrx lry lineto
315
+ llx lly lineto
316
+ ulx uly lineto
317
+ closepath
318
+ { fill } { stroke
319
+ urx h2 4 div sub ury moveto
320
+ urx h2 sub h2 4 div sub ury h2 sub lineto
321
+ lrx h2 4 div sub lry lineto
322
+ stroke } ifelse
323
+ end
324
+ } bind def
325
+
326
+ % SDL priority input from left
327
+ % Similar to SDL priority input from right
328
+
329
+ /sdl_priority_input_from_left {
330
+ 9 dict begin
331
+ 3 1 roll % put filled flag at end
332
+ 4 ne { stop } if % sanity-check number of sides
333
+ aload pop
334
+ /ury xdef /urx xdef
335
+ /lry xdef /lrx xdef
336
+ /lly xdef /llx xdef
337
+ /uly xdef /ulx xdef
338
+ /h2 uly lly sub 2 div def
339
+ newpath
340
+ moveto
341
+ lrx lry lineto
342
+ llx lly lineto
343
+ ulx h2 add uly h2 sub lineto
344
+ ulx uly lineto
345
+ closepath
346
+ { fill } { stroke
347
+ llx h2 4 div add lly moveto
348
+ ulx h2 add h2 4 div add uly h2 sub lineto
349
+ ulx h2 4 div add uly lineto
350
+ stroke } ifelse
351
+ end
352
+ } bind def
353
+
354
+ % SDL start
355
+ % The left and right sides are semicircles
356
+ % This should be used with "label = " ""
357
+
358
+ /sdl_start {
359
+ 9 dict begin
360
+ 3 1 roll % put filled flag at end
361
+ 4 ne { stop } if % sanity-check number of sides
362
+ aload pop
363
+ /ury xdef /urx xdef
364
+ /lry xdef /lrx xdef
365
+ /lly xdef /llx xdef
366
+ /uly xdef /ulx xdef
367
+ pop pop
368
+ /r ury lry sub 2 div def
369
+ newpath
370
+ urx r sub ury r sub r 90 -90 arcn
371
+ ulx r add uly r sub r -90 90 arcn
372
+ closepath
373
+ { fill } { stroke } ifelse
374
+ end
375
+ } bind def
376
+
377
+ % SDL procedure start
378
+ % Similar to SDL start
379
+ % The filled version is indistinguishable from an SDL start
380
+ % This should be used with "label = " ""
381
+
382
+ /sdl_procedure_start {
383
+ 9 dict begin
384
+ 3 1 roll % put filled flag at end
385
+ 4 ne { stop } if % sanity-check number of sides
386
+ aload pop
387
+ /ury xdef /urx xdef
388
+ /lry xdef /lrx xdef
389
+ /lly xdef /llx xdef
390
+ /uly xdef /ulx xdef
391
+ pop pop
392
+ /r ury lry sub 2 div def
393
+ newpath
394
+ urx r sub ury r sub r 90 -90 arcn
395
+ ulx r add uly r sub r -90 90 arcn
396
+ closepath
397
+ { fill } { stroke
398
+ lrx r sub lry moveto
399
+ 0 r 2 mul rlineto
400
+ llx r add lly moveto
401
+ 0 r 2 mul rlineto
402
+ stroke } ifelse
403
+ end
404
+ } bind def
405
+
406
+ % SDL state/nextstate
407
+ % The left and right sides are arcs
408
+
409
+ /sdl_state {
410
+ 12 dict begin
411
+ 3 1 roll % put filled flag at end
412
+ 4 ne { stop } if % sanity-check number of sides
413
+ aload pop
414
+ /ury xdef /urx xdef
415
+ /lry xdef /lrx xdef
416
+ /lly xdef /llx xdef
417
+ /uly xdef /ulx xdef
418
+ pop pop
419
+ /h2 ury lry sub 2 div def
420
+ /w2 h2 1.5 mul def % was urx ulx sub 2 div def but this made curvature width-dependent
421
+ /r w2 def
422
+ /th h2 r dup mul h2 dup mul sub sqrt atan def
423
+ newpath
424
+ urx w2 sub ury h2 sub r th th neg arcn
425
+ ulx w2 add uly h2 sub r -180 th add -180 th sub arcn
426
+ closepath
427
+ { fill } { stroke } ifelse
428
+ end
429
+ } bind def
430
+
431
+ % SDL output to right
432
+ % The outdent has lines at 45 degrees
433
+ % There should be a few spaces at the end of this shape's label
434
+
435
+ /sdl_output_to_right {
436
+ 9 dict begin
437
+ 3 1 roll % put filled flag at end
438
+ 4 ne { stop } if % sanity-check number of sides
439
+ aload pop
440
+ /ury xdef /urx xdef
441
+ /lry xdef /lrx xdef
442
+ /lly xdef /llx xdef
443
+ /uly xdef /ulx xdef
444
+ /h2 ury lry sub 2 div def
445
+ newpath
446
+ exch h2 sub exch moveto
447
+ urx ury h2 sub lineto
448
+ lrx h2 sub lry lineto
449
+ llx lly lineto
450
+ ulx uly lineto
451
+ closepath
452
+ { fill } { stroke } ifelse
453
+ end
454
+ } bind def
455
+
456
+ % SDL output to left
457
+ % Similar to SDL output to right
458
+ % There should be a few spaces at the start of this shape's label
459
+
460
+ /sdl_output_to_left {
461
+ 9 dict begin
462
+ 3 1 roll % put filled flag at end
463
+ 4 ne { stop } if % sanity-check number of sides
464
+ aload pop
465
+ /ury xdef /urx xdef
466
+ /lry xdef /lrx xdef
467
+ /lly xdef /llx xdef
468
+ /uly xdef /ulx xdef
469
+ /h2 ury lry sub 2 div def
470
+ newpath
471
+ moveto
472
+ lrx lry lineto
473
+ llx h2 add lly lineto
474
+ ulx ury h2 sub lineto
475
+ ulx h2 add uly lineto
476
+ closepath
477
+ { fill } { stroke } ifelse
478
+ end
479
+ } bind def
480
+
481
+ % SDL continuous signal/enabling condition
482
+ % The chevrons have lines at 45 degrees
483
+ % There should be a few spaces at the start and end of this shape's label
484
+
485
+ /sdl_condition {
486
+ 9 dict begin
487
+ 3 1 roll % put filled flag at end
488
+ 4 ne { stop } if % sanity-check number of sides
489
+ aload pop
490
+ /ury xdef /urx xdef
491
+ /lry xdef /lrx xdef
492
+ /lly xdef /llx xdef
493
+ /uly xdef /ulx xdef
494
+ /h2 ury lry sub 2 div def
495
+ newpath
496
+ exch h2 sub exch moveto
497
+ urx ury h2 sub lineto
498
+ lrx h2 sub lry lineto
499
+ dup llx h2 add lly 3 -1 roll { lineto } { moveto } ifelse
500
+ ulx uly h2 sub lineto
501
+ ulx h2 add uly lineto
502
+ { fill } { stroke } ifelse
503
+ end
504
+ } bind def
505
+
506
+ % SDL save
507
+ % The left and right edges are at about 60 degrees
508
+ % There should be a few spaces at the start and end of this shape's label
509
+
510
+ /sdl_save {
511
+ 9 dict begin
512
+ 3 1 roll % put filled flag at end
513
+ 4 ne { stop } if % sanity-check number of sides
514
+ aload pop
515
+ /ury xdef /urx xdef
516
+ /lry xdef /lrx xdef
517
+ /lly xdef /llx xdef
518
+ /uly xdef /ulx xdef
519
+ /h3 ury lry sub 3 div def
520
+ newpath
521
+ moveto
522
+ lrx h3 sub lry lineto
523
+ llx lly lineto
524
+ ulx h3 add uly lineto
525
+ closepath
526
+ { fill } { stroke } ifelse
527
+ end
528
+ } bind def
529
+
530
+ % SDL stop
531
+ % The width of the bounding box is ignored; the lines are set at 45 degrees
532
+ % This shape cannot be filled
533
+ % This should be used with "label = """ and "arrowhead = none, headclip = false"
534
+
535
+ /sdl_stop {
536
+ 7 dict begin
537
+ { stop } if % make sure not asked to fill this
538
+ 4 ne { stop } if % sanity-check number of sides
539
+ aload pop
540
+ pop pop
541
+ /lry xdef /lrx xdef
542
+ /lly xdef /llx xdef
543
+ /uly xdef pop
544
+ /h2 uly lly sub 2 div def
545
+ /mx llx lrx add 2 div def
546
+ newpath
547
+ mx h2 add exch moveto pop
548
+ mx h2 sub lly lineto
549
+ mx h2 sub uly moveto
550
+ mx h2 add lry lineto
551
+ closepath
552
+ stroke
553
+ end
554
+ } bind def
555
+
556
+ % SDL return
557
+ % The width of the bounding box is ignored; the lines are set at 45 degrees
558
+ % The filled version is indistinguishable from an SDL connection
559
+
560
+ /sdl_return {
561
+ 9 dict begin
562
+ 3 1 roll % put filled flag at end
563
+ 4 ne { stop } if % sanity-check number of sides
564
+ aload pop
565
+ /ury xdef pop
566
+ /lry xdef /lrx xdef
567
+ /lly xdef /llx xdef
568
+ /uly xdef pop
569
+ pop pop
570
+ /h2 uly lly sub 2 div 2 sqrt div def
571
+ /mx llx lrx add 2 div def
572
+ /my lry ury add 2 div def
573
+ newpath
574
+ mx my uly lly sub 2 div 0 360 arc
575
+ { fill } { stroke
576
+ mx h2 add my h2 add moveto
577
+ mx h2 sub my h2 sub lineto
578
+ mx h2 sub my h2 add moveto
579
+ mx h2 add my h2 sub lineto
580
+ stroke } ifelse
581
+ end
582
+ } bind def
583
+
584
+ % SDL create
585
+ % The extra lines are displaced by an eighth of the shape height
586
+ % The filled version is indistinguishable from an SDL task
587
+
588
+ /sdl_create {
589
+ 9 dict begin
590
+ 3 1 roll % put filled flag at end
591
+ 4 ne { stop } if % sanity-check number of sides
592
+ aload pop
593
+ /ury xdef /urx xdef
594
+ /lry xdef /lrx xdef
595
+ /lly xdef /llx xdef
596
+ /uly xdef /ulx xdef
597
+ /h8 ury lry sub 8 div def
598
+ newpath
599
+ moveto
600
+ lrx lry lineto
601
+ llx lly lineto
602
+ ulx uly lineto
603
+ closepath
604
+ { fill } { stroke
605
+ ulx uly h8 sub moveto
606
+ urx ury h8 sub lineto
607
+ llx lly h8 add moveto
608
+ lrx lry h8 add lineto
609
+ stroke } ifelse
610
+ end
611
+ } bind def
612
+
613
+ % SDL call
614
+ % The extra lines are displaced by an eighth of the shape height
615
+ % The filled version is indistinguishable from an SDL task
616
+ % There should be a few spaces at the start and end of this shape's label
617
+
618
+ /sdl_call {
619
+ 9 dict begin
620
+ 3 1 roll % put filled flag at end
621
+ 4 ne { stop } if % sanity-check number of sides
622
+ aload pop
623
+ /ury xdef /urx xdef
624
+ /lry xdef /lrx xdef
625
+ /lly xdef /llx xdef
626
+ /uly xdef /ulx xdef
627
+ /h8 ury lry sub 8 div def
628
+ newpath
629
+ moveto
630
+ lrx lry lineto
631
+ llx lly lineto
632
+ ulx uly lineto
633
+ closepath
634
+ { fill } { stroke
635
+ urx h8 sub ury moveto
636
+ lrx h8 sub lry lineto
637
+ llx h8 add lly moveto
638
+ ulx h8 add uly lineto
639
+ stroke } ifelse
640
+ end
641
+ } bind def
642
+
643
+ % SDL text symbol
644
+ % The corner has a size of twice the H height
645
+
646
+ /sdl_text {
647
+ 10 dict begin
648
+ 3 1 roll % put filled flag at end
649
+ 4 ne { stop } if % sanity-check number of sides
650
+ aload pop
651
+ /ury xdef /urx xdef
652
+ /lry xdef /lrx xdef
653
+ /lly xdef /llx xdef
654
+ /uly xdef /ulx xdef
655
+ /h8 ury lry sub 8 div def
656
+ newpath
657
+ moveto
658
+ /d (H) true charpath flattenpath pathbbox exch pop exch sub exch pop 2 mul def
659
+ newpath
660
+ urx ury d sub moveto
661
+ lrx lry lineto
662
+ llx lly lineto
663
+ ulx uly lineto
664
+ urx d sub ury lineto
665
+ closepath
666
+ { fill } { stroke } ifelse
667
+ urx ury d sub moveto
668
+ d neg 0 rlineto
669
+ 0 d rlineto
670
+ stroke
671
+ end
672
+ } bind def
673
+
674
+ % SDL text extension from left
675
+ % This should be used with "rank = same"
676
+
677
+ /sdl_text_extension_from_left {
678
+ 3 1 roll % put filled flag at end
679
+ 4 ne { stop } if % sanity-check number of sides
680
+ aload pop
681
+ pop pop
682
+ moveto
683
+ lineto
684
+ lineto
685
+ lineto
686
+ { fill } { stroke } ifelse
687
+ } bind def
688
+
689
+ % SDL text extension from right
690
+ % This should be used with "rank = same"
691
+
692
+ /sdl_text_extension_from_right {
693
+ 3 1 roll % put filled flag at end
694
+ 4 ne { stop } if % sanity-check number of sides
695
+ aload pop
696
+ pop pop
697
+ 8 4 roll
698
+ moveto
699
+ lineto
700
+ lineto
701
+ lineto
702
+ { fill } { stroke } ifelse
703
+ } bind def
704
+
705
+ % SDL comment from left
706
+ % This should be used with "style = dashed" and "rank = same"
707
+
708
+ /sdl_comment_from_left { sdl_text_extension_from_left } bind def
709
+
710
+ % SDL comment from right
711
+ % This should be used with "style = dashed" and "rank = same"
712
+
713
+ /sdl_comment_from_right { sdl_text_extension_from_right } bind def
714
+
715
+ % SDL connector
716
+ % The width of the bounding box is ignored
717
+
718
+ /sdl_connector {
719
+ 7 dict begin
720
+ 3 1 roll % put filled flag at end
721
+ 4 ne { stop } if % sanity-check number of sides
722
+ aload pop
723
+ pop pop
724
+ /lry xdef /lrx xdef
725
+ /lly xdef /llx xdef
726
+ /uly xdef pop
727
+ pop pop
728
+ /h2 uly lly sub 2 div def
729
+ /mx llx lrx add 2 div def
730
+ newpath
731
+ mx uly h2 sub h2 0 360 arc
732
+ { fill } { stroke } ifelse
733
+ end
734
+ } bind def
735
+
736
+ % SDL set (extension)
737
+ % The hourglass has a size of twice the H height
738
+ % There should be a few spaces at the start of this shape's label
739
+
740
+ /sdl_set {
741
+ 10 dict begin
742
+ 3 1 roll % put filled flag at end
743
+ 4 ne { stop } if % sanity-check number of sides
744
+ aload pop
745
+ /ury xdef /urx xdef
746
+ /lry xdef /lrx xdef
747
+ /lly xdef /llx xdef
748
+ /uly xdef /ulx xdef
749
+ /my uly lly add 2 div def
750
+ newpath
751
+ moveto
752
+ /d (H) true charpath flattenpath pathbbox exch pop exch sub exch pop def
753
+ newpath
754
+ llx d add my d add moveto
755
+ ulx d add uly lineto
756
+ urx ury lineto
757
+ lrx lry lineto
758
+ llx d add lly lineto
759
+ llx d add my d sub lineto
760
+ dup { closepath fill } { stroke } ifelse
761
+ llx my d sub moveto
762
+ d 2 mul dup rlineto
763
+ d 2 mul neg 0 rlineto
764
+ d 2 mul dup neg rlineto
765
+ closepath
766
+ { fill } { stroke } ifelse
767
+ end
768
+ } bind def
769
+
770
+ % SDL reset (extension)
771
+ % The cross has a size of twice the H height
772
+ % There should be a few spaces at the start of this shape's label
773
+
774
+ /sdl_reset {
775
+ 10 dict begin
776
+ 3 1 roll % put filled flag at end
777
+ 4 ne { stop } if % sanity-check number of sides
778
+ aload pop
779
+ /ury xdef /urx xdef
780
+ /lry xdef /lrx xdef
781
+ /lly xdef /llx xdef
782
+ /uly xdef /ulx xdef
783
+ /my uly lly add 2 div def
784
+ newpath
785
+ moveto
786
+ /d (H) true charpath flattenpath pathbbox exch pop exch sub exch pop def
787
+ newpath
788
+ urx ury moveto
789
+ lrx lry lineto
790
+ llx d add lly lineto
791
+ ulx d add uly lineto
792
+ closepath
793
+ { fill } { stroke } ifelse
794
+ llx my d sub moveto
795
+ d 2 mul dup rlineto
796
+ llx d 2 mul add my d sub moveto
797
+ d 2 mul dup neg exch rlineto
798
+ stroke
799
+ end
800
+ } bind def
801
+
802
+ % SDL export (extension)
803
+ % The store has a width of twice the H height
804
+ % There should be a few spaces at the start of this shape's label
805
+
806
+ /sdl_export {
807
+ 10 dict begin
808
+ 3 1 roll % put filled flag at end
809
+ 4 ne { stop } if % sanity-check number of sides
810
+ aload pop
811
+ /ury xdef /urx xdef
812
+ /lry xdef /lrx xdef
813
+ /lly xdef /llx xdef
814
+ /uly xdef /ulx xdef
815
+ /my uly lly add 2 div def
816
+ newpath
817
+ moveto
818
+ /d (H) true charpath flattenpath pathbbox exch pop exch sub exch pop def
819
+ newpath
820
+ llx d add my d 2 div add moveto
821
+ ulx d add uly lineto
822
+ urx ury lineto
823
+ lrx lry lineto
824
+ llx d add lly lineto
825
+ llx d add my d 2 div sub lineto
826
+ { closepath fill } { stroke } ifelse
827
+ llx my d 2 div sub moveto
828
+ d 2 mul 0 rlineto
829
+ llx my d 2 div add moveto
830
+ d 2 mul 0 rlineto
831
+ stroke
832
+ end
833
+ } bind def
834
+ setupLatin1
835
+ %%Page: 1 1
836
+ %%PageBoundingBox: 275 302 337 490
837
+ %%PageOrientation: Portrait
838
+ 0 0 1 beginpage
839
+ gsave
840
+ 275 302 62 188 boxprim clip newpath
841
+ 1 1 set_scale 0 rotate 279 307 translate
842
+ % A
843
+ gsave
844
+ 1 setlinewidth
845
+ 0 0 0 nodecolor
846
+ [ 54 180 0 180 0 144 54 144 54 180 ] 4 false sdl_procedure_start
847
+ 0 0 0 nodecolor
848
+ 14 /Times-Roman set_font
849
+ 21.5 156.9 moveto 11 (A) alignedtext
850
+ grestore
851
+ % B
852
+ gsave
853
+ 1 setlinewidth
854
+ 0 0 0 nodecolor
855
+ [ 54 108 0 108 0 72 54 72 54 108 ] 4 false sdl_save
856
+ 0 0 0 nodecolor
857
+ 14 /Times-Roman set_font
858
+ 22 84.9 moveto 10 (B) alignedtext
859
+ grestore
860
+ % A->B
861
+ gsave
862
+ 1 setlinewidth
863
+ 0 0 0 edgecolor
864
+ newpath 27 143.83 moveto
865
+ 27 136.13 27 126.97 27 118.42 curveto
866
+ stroke
867
+ 0 0 0 edgecolor
868
+ newpath 30.5 118.41 moveto
869
+ 27 108.41 lineto
870
+ 23.5 118.41 lineto
871
+ closepath fill
872
+ 1 setlinewidth
873
+ solid
874
+ 0 0 0 edgecolor
875
+ newpath 30.5 118.41 moveto
876
+ 27 108.41 lineto
877
+ 23.5 118.41 lineto
878
+ closepath stroke
879
+ grestore
880
+ % n
881
+ gsave
882
+ 1 setlinewidth
883
+ 0 0 0 nodecolor
884
+ newpath 54 36 moveto
885
+ 0 36 lineto
886
+ 0 0 lineto
887
+ 54 0 lineto
888
+ closepath stroke
889
+ 0 0 0 nodecolor
890
+ 14 /Times-Roman set_font
891
+ 25 12.9 moveto 21 (g::n) alignedtext
892
+ grestore
893
+ % B->n
894
+ gsave
895
+ 1 setlinewidth
896
+ 0 0 0 edgecolor
897
+ newpath 27 71.83 moveto
898
+ 27 64.13 27 54.97 27 46.42 curveto
899
+ stroke
900
+ 0 0 0 edgecolor
901
+ newpath 30.5 46.41 moveto
902
+ 27 36.41 lineto
903
+ 23.5 46.41 lineto
904
+ closepath fill
905
+ 1 setlinewidth
906
+ solid
907
+ 0 0 0 edgecolor
908
+ newpath 30.5 46.41 moveto
909
+ 27 36.41 lineto
910
+ 23.5 46.41 lineto
911
+ closepath stroke
912
+ grestore
913
+ endpage
914
+ showpage
915
+ grestore
916
+ %%PageTrailer
917
+ %%EndPage: 1
918
+ %%Trailer
919
+ %%Pages: 1
920
+ %%BoundingBox: 275 302 337 490
921
+ end
922
+ restore
923
+ %%EOF