tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
|
|
@ -0,0 +1,12 @@
|
|||
(defmacro with-serialization-to-file ((stream pathname) &body body)
|
||||
`(with-open-file (,stream ,pathname
|
||||
:element-type '(unsigned-byte 8)
|
||||
:direction :output
|
||||
:if-exists :supersede)
|
||||
,@body))
|
||||
|
||||
(defclass entity ()
|
||||
((name :initarg :name :initform "Some entity")))
|
||||
|
||||
(defclass person (entity)
|
||||
((name :initarg :name :initform "The Nameless One")))
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
CL-USER> (list (make-instance 'entity)
|
||||
(make-instance 'person))
|
||||
|
||||
(#<ENTITY {1004B13141}> #<PERSON {1004B142B1}>)
|
||||
CL-USER> (mapc #'describe *)
|
||||
#<ENTITY {1004B13141}>
|
||||
[standard-object]
|
||||
|
||||
Slots with :INSTANCE allocation:
|
||||
NAME = "Some entity"
|
||||
#<PERSON {1004B142B1}>
|
||||
[standard-object]
|
||||
|
||||
Slots with :INSTANCE allocation:
|
||||
NAME = "The Nameless One"
|
||||
(#<ENTITY {1004B13141}> #<PERSON {1004B142B1}>)
|
||||
CL-USER> (with-serialization-to-file (stream "/tmp/objects.dat")
|
||||
(cl-serializer:serialize * :output stream)
|
||||
;; SERIALIZE shows an octet-vector as its return value
|
||||
(values))
|
||||
; No value
|
||||
CL-USER> (mapc #'describe (with-open-file (stream "/tmp/objects.dat"
|
||||
:element-type '(unsigned-byte 8))
|
||||
(cl-serializer:deserialize stream)))
|
||||
#<ENTITY {1003C12911}>
|
||||
[standard-object]
|
||||
|
||||
Slots with :INSTANCE allocation:
|
||||
NAME = "Some entity"
|
||||
#<PERSON {1003C12A81}>
|
||||
[standard-object]
|
||||
|
||||
Slots with :INSTANCE allocation:
|
||||
NAME = "The Nameless One"
|
||||
(#<ENTITY {1003C12911}> #<PERSON {1003C12A81}>)
|
||||
Loading…
Add table
Add a link
Reference in a new issue