| 1 |
#!r6rs |
| 2 |
;; Copyright 2009 Derick Eddington. My MIT-style license is in the file named |
| 3 |
;; LICENSE from the original collection this file is distributed with. |
| 4 |
|
| 5 |
(library (srfi :38 with-shared-structure) |
| 6 |
(export |
| 7 |
write-with-shared-structure |
| 8 |
(rename (write-with-shared-structure write/ss)) |
| 9 |
read-with-shared-structure |
| 10 |
(rename (read-with-shared-structure read/ss))) |
| 11 |
(import |
| 12 |
(rnrs) |
| 13 |
(only (ikarus) print-graph parameterize)) |
| 14 |
|
| 15 |
(define write-with-shared-structure |
| 16 |
(case-lambda |
| 17 |
((obj) |
| 18 |
(write-with-shared-structure obj (current-output-port))) |
| 19 |
((obj port) |
| 20 |
(parameterize ((print-graph #T)) |
| 21 |
(write obj port))) |
| 22 |
((obj port optarg) |
| 23 |
(assertion-violation 'write-with-shared-structure |
| 24 |
"this implementation does not support optarg")))) |
| 25 |
|
| 26 |
(define read-with-shared-structure read) |
| 27 |
|
| 28 |
) |