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

Contents of /cl-store/README

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (hide annotations)
Wed Oct 6 14:41:03 2004 UTC (9 years, 6 months ago) by sross
Branch: MAIN
Changes since 1.7: +9 -12 lines
Changelog 2004-10-06
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.8 Version: 0.2.9
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 sross 1.8 Run (asdf:oos 'asdf:test-op :cl-store) and (asdf:oos 'asdf:test-op :cl-store-xml)
27     to make sure that everything works. Running these tests will try to
28 sross 1.4 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 sross 1.8 (defvar *random-obj-code* (register-code 110 'random-obj))
65 sross 1.4
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 sross 1.4 Store and Restore now take an optional backend argument which
86 sross 1.8 currently can be one of *default-backend*, *xml-backend* or
87     a self defined backend.
88    
89 sross 1.4 The xml written out is not very human readable.
90     I recommend using a tool like tidy <http://tidy.sourceforge.net/>
91     to view it in a nice format.
92    
93 sross 1.2
94 sross 1.4 5. Issues
95 sross 1.8 There are a number of issues with CL-STORE as it stands (0.2.9).
96 sross 1.1
97     - Functions, closures and anything remotely funcallable is unserializable.
98     - MOP classes are largely unsupported at the moment.
99 sross 1.6 - Structure instances are not supported in MCL, OpenMCL and Clisp.
100 sross 1.1 - Structure definitions aren't supported at all.
101     - No documentation.
102 sross 1.3 - Older cmucl versions, where (eq 'cl:class 'pcl::class)
103     returns nil, cannot store classes obtained using cl:find-class.
104     The solution for this is to use pcl::find-class.
105 sross 1.8
106 sross 1.1
107     Enjoy
108     Sean.

  ViewVC Help
Powered by ViewVC 1.1.5