/[cl-store]/cl-store/README
ViewVC logotype

Contents of /cl-store/README

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations)
Fri Oct 1 08:49:46 2004 UTC (9 years, 6 months ago) by sross
Branch: MAIN
Changes since 1.6: +9 -4 lines
Changelog 2004-10-01
1 sross 1.4 README for Package CL-STORE.
2 sross 1.1 Author: Sean Ross
3     Homepage: http://www.common-lisp.net/project/cl-store/
4 sross 1.7 Version: 0.2.5
5 sross 1.1
6     0. About.
7     CL-STORE is an portable serialization package which
8     should give you the ability to store all common-lisp
9     data types (well not all yet) into files, streams or whatever.
10    
11    
12     1. Installation.
13 sross 1.4 The first thing you need is a common-lisp, CL-STORE currently
14     supports SBCL, CMUCL, Lispworks, CLISP and OpenMCL.
15 sross 1.1
16 sross 1.4 Hopefully you've asdf-install to install this in which case
17     all should be fine.
18 sross 1.1
19 sross 1.4 Otherwise symlink cl-store.asd to somewhere on asdf:*central-registry*
20     and run (asdf:oos 'asdf:load-op :cl-store).
21 sross 1.1
22 sross 1.4 The xml backend can be loaded with (asdf:oos 'asdf:loaded :cl-store-xml).
23     This requires xmls which can be found on http://www.cliki.net and
24     is asdf-installable.
25    
26     Run (asdf:oos 'asdf:test-op :cl-store) to make sure that
27     everything works. Running these tests will try to
28     load the RT package, which is asdf-installable.
29     If anything breaks drop me a line, see
30     http://www.common-lisp.net/project/cl-store/ for mailing-lists.
31 sross 1.1
32    
33     2. Usage
34     The two main entry points are
35 sross 1.4 - cl-store:store (obj place &optional (backend *default-backend*)) i
36     => obj
37 sross 1.7 Where place is a path designator or stream and
38     backend is one of the registered backends.
39 sross 1.4
40     - cl-store:restore (place &optional (backend *default-backend*))
41     => restored-obj
42     Where place and backend is as above.
43 sross 1.1
44     - cl-store:restore is setfable, which I think makes
45     for a great serialized hit counter.
46     eg. (incf (restore place))
47    
48    
49     3. Extending
50 sross 1.4 CL-STORE is more or less extensible. Using defstore-<backend-name>
51     and defrestore-<backend-name> allows you to customize the storing
52     and restoring of your own classes.
53    
54 sross 1.2 contrived eg.
55    
56 sross 1.4 (in-package :cl-user)
57    
58     (use-package :cl-store)
59    
60 sross 1.5 (setf *default-backend* *cl-store-backend*)
61    
62 sross 1.4 (defclass random-obj () ((a :accessor a :initarg :a)))
63    
64     (defvar *random-obj-code* (register-code 22 'random-obj))
65    
66     (defstore-cl-store (obj random-obj stream)
67     (output-type-code *random-obj-code* stream)
68     (store-object (a obj) stream))
69 sross 1.2
70 sross 1.4 (defrestore-cl-store (random-obj stream)
71     (random (restore-object stream)))
72 sross 1.2
73 sross 1.4 (store (make-instance 'random-obj :a 10) "/tmp/random")
74 sross 1.2
75     (restore "/tmp/random")
76     => ; some number from 0 to 9
77 sross 1.4
78    
79     4. Backends
80     CL-STORE now has a concept of backends, suggested by Robert Sedgewick.
81     Two backends are in releases now, a default backend which is much
82     what cl-store used to be (pre 0.2) and an xml backend which writes out
83     xml to character streams.
84 sross 1.7
85     NOTE: As of 0.2.5 the xml backend isn't actively being developed.
86     It's turning out to more of a pain than it's worth. It is now
87     only there as an example.
88    
89 sross 1.4 Store and Restore now take an optional backend argument which
90     currently can be one of *default-backend* or *xml-backend*.
91    
92     The xml written out is not very human readable.
93     I recommend using a tool like tidy <http://tidy.sourceforge.net/>
94     to view it in a nice format.
95    
96 sross 1.2
97 sross 1.4 5. Issues
98 sross 1.7 There are a number of issues with CL-STORE as it stands (0.2.5).
99 sross 1.1
100     - Functions, closures and anything remotely funcallable is unserializable.
101     - MOP classes are largely unsupported at the moment.
102 sross 1.6 - Structure instances are not supported in MCL, OpenMCL and Clisp.
103 sross 1.1 - Structure definitions aren't supported at all.
104     - No documentation.
105 sross 1.3 - Older cmucl versions, where (eq 'cl:class 'pcl::class)
106     returns nil, cannot store classes obtained using cl:find-class.
107     The solution for this is to use pcl::find-class.
108 sross 1.1
109    
110     Enjoy
111     Sean.

  ViewVC Help
Powered by ViewVC 1.1.5