source: project/srfi-38/trunk/srfi-38.html @ 6364

Last change on this file since 6364 was 6364, checked in by Kon Lovett, 13 years ago

Added tests. Bug fix for new "interesting" objects. Added Chicken named symbols.

File size: 4.8 KB
Line 
1<html>
2<head><title>Eggs Unlimited - srfi-38</title></head>
3<body>
4
5<center><img src="egg.jpg"></center>
6<center><a href="index.html">back</a></center>
7
8<h2>srfi-38</h2>
9
10<h3>Description:</h3>
11A Chicken version of the reference implementation for
12<a href="http://srfi.schemers.org/srfi-38/srfi-38.html">SRFI-38</a>, a facility
13for reading and writing objects with shared structure.
14
15<h3>Author:</h3>
16Al Petrofsky and Ray Dillinger
17
18<h3>Usage:</h3>
19<pre>
20(require-extension srfi-38)
21</pre>
22
23<h3>Download:</h3>
24<a href="srfi-38.egg">srfi-38.egg</a>
25
26<h3>History</h3>
27
28<ul>
29<li>1.3 records & hash-tables are "interesting", #:interesting-procedures parameter [Kon Lovett]
30<li>1.2 option for ignoring sharing of strings [suggested by Sven Hartrumpf]
31<li>1.1 Initial release
32</ul>
33
34<h3>Documentation:</h3>
35<p>See <a href="http://srfi.schemers.org/srfi-38/srfi-38.html">SRFI-38 document</a>.</p>
36
37<p>This implementation extends <tt>write-with-shared-structure</tt> to
38accept optional flags (following the optional port argument).</p>
39
40<p>Passing the keyword <tt>#:ignore-strings</tt> will treat strings as normal
41(nonshared) objects.</p>
42
43<p>The keyword <tt>#:interesting-procedures</tt> is followed by a list of three procedures:</p>
44
45<ul>
46<li>interesting? : (object -&gt; boolean)</li>
47<li>write-interesting : ((output-port -&gt; object) output-port object association-list -&gt; association-list)</li>
48<li>scan : ((object association-list -&gt; association-list) object association-list -&gt; association-list)</li>
49</ul>
50
51<p>The <tt>interesting?</tt> procedure returns <tt>#t</tt> when the object can
52be processed, <tt>#f</tt> otherwise.</p>
53
54<p>All optional "interesting objects" are written as
55#&lt;KIND-SYMBOL[OBJECT]...&gt;. It is the job of <tt>write-interesting</tt> to
56display the <tt>KIND-SYMBOL</tt> and write any elements, using the first
57procedure, separated by <tt>#\space</tt>. Writing the elements of the
58<tt>object</tt> as a list or vector is advised.</p>
59
60<p>The <tt>scan</tt> procedure must call the first procedure for every element
61of the <tt>object</tt>. The returned <tt>association-list</tt> is used for the
62next invocation. Returns the modified <tt>association-list</tt>.</p>
63
64<p>This implementation extends <tt>read-with-shared-structure</tt> to
65accept optional flags (following the optional port argument).</p>
66
67<p>The keyword <tt>#:interesting-procedures</tt> is followed by a list of three procedures:</p>
68
69<ul>
70<li>interesting? : (object -&gt; boolean)</li>
71<li>read-interesting : ((-&gt; object) input-port symbol -&gt; object)</li>
72<li>scan : ((object -&gt; unspecified) (object -&gt; object) object -&gt; unspecified)</li>
73</ul>
74
75<p>The <tt>interesting?</tt> procedure returns <tt>#t</tt> when the object can
76be processed, <tt>#f</tt> otherwise.</p>
77
78<p>The <tt>read-interesting</tt> procedure must use the first procedure to read
79any elements of the <tt>object</tt>. The <tt>symbol</tt> is the
80<tt>KIND-SYMBOL</tt>. The procedure should return <tt>#f</tt> for an
81unsuccessful operation, otherwise the reified object. The procedure must not
82consume the trailing <tt>#\&gt;</tt> but must exit positioned at the trailing
83<tt>#\&gt;</tt>. The <tt>input-port</tt> is positioned just after the
84<tt>KIND-SYMBOL</tt> upon invocation.</p>
85
86<p>The <tt>scan</tt> procedure must call the second procedure for
87every element of the <tt>object</tt> when the element is a procedure, otherwise
88it must call the first procedure with the element.</p>
89
90<h3>License:</h3>
91
92<pre>
93Copyright (C) Ray Dillinger 2003. All Rights Reserved.
94<p>
95This document and translations of it may be copied and furnished to
96others, and derivative works that comment on or otherwise explain it
97or assist in its implementation may be prepared, copied, published and
98distributed, in whole or in part, without restriction of any kind,
99provided that the above copyright notice and this paragraph are
100included on all such copies and derivative works. However, this
101document itself may not be modified in any way, such as by removing
102the copyright notice or references to the Scheme Request For
103Implementation process or editors, except as needed for the purpose of
104developing SRFIs in which case the procedures for copyrights defined
105in the SRFI process must be followed, or as required to translate it
106into languages other than English.
107</p><p>
108The limited permissions granted above are perpetual and will not be
109revoked by the authors or their successors or assigns.
110</p><p>
111This document and the information contained herein is provided on an
112"AS IS" basis and THE AUTHOR AND THE SRFI EDITORS DISCLAIM ALL
113WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
114WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY
115RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
116PARTICULAR PURPOSE.
117</pre>
118
119
120<hr><a href="index.html">back</a>
121
122</body>
123</html>
Note: See TracBrowser for help on using the repository browser.