Artifact
27634fdda9c6e8478f1038983761c3441738c625:
0000: 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 28 63 29 ;; Copyright (c)
0010: 20 32 30 30 39 20 44 65 72 69 63 6b 20 45 64 64 2009 Derick Edd
0020: 69 6e 67 74 6f 6e 2e 20 20 41 6c 6c 20 72 69 67 ington. All rig
0030: 68 74 73 20 72 65 73 65 72 76 65 64 2e 0a 3b 3b hts reserved..;;
0040: 20 4c 69 63 65 6e 73 65 64 20 75 6e 64 65 72 20 Licensed under
0050: 61 6e 20 4d 49 54 2d 73 74 79 6c 65 20 6c 69 63 an MIT-style lic
0060: 65 6e 73 65 2e 20 20 4d 79 20 6c 69 63 65 6e 73 ense. My licens
0070: 65 20 69 73 20 69 6e 20 74 68 65 20 66 69 6c 65 e is in the file
0080: 0a 3b 3b 20 6e 61 6d 65 64 20 4c 49 43 45 4e 53 .;; named LICENS
0090: 45 20 66 72 6f 6d 20 74 68 65 20 6f 72 69 67 69 E from the origi
00a0: 6e 61 6c 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 74 nal collection t
00b0: 68 69 73 20 66 69 6c 65 20 69 73 20 64 69 73 74 his file is dist
00c0: 72 69 62 75 74 65 64 0a 3b 3b 20 77 69 74 68 2e ributed.;; with.
00d0: 20 20 49 66 20 74 68 69 73 20 66 69 6c 65 20 69 If this file i
00e0: 73 20 72 65 64 69 73 74 72 69 62 75 74 65 64 20 s redistributed
00f0: 77 69 74 68 20 73 6f 6d 65 20 6f 74 68 65 72 20 with some other
0100: 63 6f 6c 6c 65 63 74 69 6f 6e 2c 20 6d 79 0a 3b collection, my.;
0110: 3b 20 6c 69 63 65 6e 73 65 20 6d 75 73 74 20 61 ; license must a
0120: 6c 73 6f 20 62 65 20 69 6e 63 6c 75 64 65 64 2e lso be included.
0130: 0a 0a 28 6c 69 62 72 61 72 79 20 28 73 72 66 69 ..(library (srfi
0140: 20 73 33 38 20 77 69 74 68 2d 73 68 61 72 65 64 s38 with-shared
0150: 2d 73 74 72 75 63 74 75 72 65 29 0a 20 20 28 65 -structure). (e
0160: 78 70 6f 72 74 0a 20 20 20 20 77 72 69 74 65 2d xport. write-
0170: 77 69 74 68 2d 73 68 61 72 65 64 2d 73 74 72 75 with-shared-stru
0180: 63 74 75 72 65 0a 20 20 20 20 28 72 65 6e 61 6d cture. (renam
0190: 65 20 28 77 72 69 74 65 2d 77 69 74 68 2d 73 68 e (write-with-sh
01a0: 61 72 65 64 2d 73 74 72 75 63 74 75 72 65 20 77 ared-structure w
01b0: 72 69 74 65 2f 73 73 29 29 0a 20 20 20 20 72 65 rite/ss)). re
01c0: 61 64 2d 77 69 74 68 2d 73 68 61 72 65 64 2d 73 ad-with-shared-s
01d0: 74 72 75 63 74 75 72 65 0a 20 20 20 20 28 72 65 tructure. (re
01e0: 6e 61 6d 65 20 28 72 65 61 64 2d 77 69 74 68 2d name (read-with-
01f0: 73 68 61 72 65 64 2d 73 74 72 75 63 74 75 72 65 shared-structure
0200: 20 72 65 61 64 2f 73 73 29 29 29 0a 20 20 28 69 read/ss))). (i
0210: 6d 70 6f 72 74 0a 20 20 20 20 28 72 6e 72 73 29 mport. (rnrs)
0220: 0a 20 20 20 20 28 6f 6e 6c 79 20 28 69 6b 61 72 . (only (ikar
0230: 75 73 29 20 70 72 69 6e 74 2d 67 72 61 70 68 20 us) print-graph
0240: 70 61 72 61 6d 65 74 65 72 69 7a 65 29 29 0a 20 parameterize)).
0250: 20 0a 20 20 28 64 65 66 69 6e 65 20 77 72 69 74 . (define writ
0260: 65 2d 77 69 74 68 2d 73 68 61 72 65 64 2d 73 74 e-with-shared-st
0270: 72 75 63 74 75 72 65 0a 20 20 20 20 28 63 61 73 ructure. (cas
0280: 65 2d 6c 61 6d 62 64 61 20 0a 20 20 20 20 20 20 e-lambda .
0290: 5b 28 6f 62 6a 29 0a 20 20 20 20 20 20 20 28 77 [(obj). (w
02a0: 72 69 74 65 2d 77 69 74 68 2d 73 68 61 72 65 64 rite-with-shared
02b0: 2d 73 74 72 75 63 74 75 72 65 20 6f 62 6a 20 28 -structure obj (
02c0: 63 75 72 72 65 6e 74 2d 6f 75 74 70 75 74 2d 70 current-output-p
02d0: 6f 72 74 29 29 5d 0a 20 20 20 20 20 20 5b 28 6f ort))]. [(o
02e0: 62 6a 20 70 6f 72 74 29 0a 20 20 20 20 20 20 20 bj port).
02f0: 28 70 61 72 61 6d 65 74 65 72 69 7a 65 20 28 5b (parameterize ([
0300: 70 72 69 6e 74 2d 67 72 61 70 68 20 23 74 5d 29 print-graph #t])
0310: 0a 20 20 20 20 20 20 20 20 20 28 77 72 69 74 65 . (write
0320: 20 6f 62 6a 20 70 6f 72 74 29 29 5d 0a 20 20 20 obj port))].
0330: 20 20 20 5b 28 6f 62 6a 20 70 6f 72 74 20 6f 70 [(obj port op
0340: 74 61 72 67 29 0a 20 20 20 20 20 20 20 28 61 73 targ). (as
0350: 73 65 72 74 69 6f 6e 2d 76 69 6f 6c 61 74 69 6f sertion-violatio
0360: 6e 20 27 77 72 69 74 65 2d 77 69 74 68 2d 73 68 n 'write-with-sh
0370: 61 72 65 64 2d 73 74 72 75 63 74 75 72 65 0a 20 ared-structure.
0380: 20 20 20 20 20 20 20 20 22 74 68 69 73 20 69 6d "this im
0390: 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 64 6f 65 plementation doe
03a0: 73 20 6e 6f 74 20 73 75 70 70 6f 72 74 20 6f 70 s not support op
03b0: 74 61 72 67 22 29 5d 29 29 0a 20 20 0a 20 20 28 targ")])). . (
03c0: 64 65 66 69 6e 65 20 72 65 61 64 2d 77 69 74 68 define read-with
03d0: 2d 73 68 61 72 65 64 2d 73 74 72 75 63 74 75 72 -shared-structur
03e0: 65 20 72 65 61 64 29 0a 20 20 0a 29 0a e read). .).