Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -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")))

View file

@ -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}>)